< prev index next >
src/hotspot/share/utilities/ostream.cpp
Print this page
rev 49818 : 8201649: Remove dubious call_jio_print in ostream.cpp
@@ -34,12 +34,10 @@
#include "utilities/macros.hpp"
#include "utilities/ostream.hpp"
#include "utilities/vmError.hpp"
#include "utilities/xmlstream.hpp"
-extern "C" void jio_print(const char* s); // Declarationtion of jvm method
-
outputStream::outputStream(int width) {
_width = width;
_position = 0;
_newlines = 0;
_precount = 0;
@@ -610,23 +608,19 @@
return file;
}
// Try again to open the file in the temp directory.
delete file;
- char warnbuf[O_BUFLEN*2];
- jio_snprintf(warnbuf, sizeof(warnbuf), "Warning: Cannot open log file: %s\n", log_name);
- // Note: This feature is for maintainer use only. No need for L10N.
- jio_print(warnbuf);
+ // Note: This feature is for maintainer use only. No need for L10N.
+ jio_fprintf(output_stream(), "Warning: Cannot open log file: %s\n", log_name);
try_name = make_log_name(log_name, os::get_temp_directory());
if (try_name == NULL) {
warning("Cannot open file %s: file name is too long for directory %s.\n", log_name, os::get_temp_directory());
return NULL;
}
- jio_snprintf(warnbuf, sizeof(warnbuf),
- "Warning: Forcing option -XX:LogFile=%s\n", try_name);
- jio_print(warnbuf);
+ jio_fprintf(output_stream(), "Warning: Forcing option -XX:LogFile=%s\n", try_name);
file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
FREE_C_HEAP_ARRAY(char, try_name);
if (file->is_open()) {
return file;
@@ -822,35 +816,21 @@
}
_writer = NO_WRITER;
tty_lock->unlock();
}
-
-// Yuck: jio_print does not accept char*/len.
-static void call_jio_print(const char* s, size_t len) {
- char buffer[O_BUFLEN+100];
- if (len > sizeof(buffer)-1) {
- warning("increase O_BUFLEN in ostream.cpp -- output truncated");
- len = sizeof(buffer)-1;
- }
- strncpy(buffer, s, len);
- buffer[len] = '\0';
- jio_print(buffer);
-}
-
-
void defaultStream::write(const char* s, size_t len) {
intx thread_id = os::current_thread_id();
intx holder = hold(thread_id);
if (DisplayVMOutput &&
(_outer_xmlStream == NULL || !_outer_xmlStream->inside_attrs())) {
- // print to output stream. It can be redirected by a vfprintf hook
- if (s[len] == '\0') {
- jio_print(s);
+ // write data to output stream unless redirected by a vfprintf hook
+ if (Arguments::vfprintf_hook() == NULL) {
+ ::write(output_fd(), s, (int)len);
} else {
- call_jio_print(s, len);
+ jio_fprintf(output_stream(), "%.*s", (int)len, s);
}
}
// print to log file
if (has_log_file()) {
< prev index next >