4272N/A * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/Aextern "C" void jio_print(
const char* s);
// Declarationtion of jvm method 0N/A// Execute a vsprintf, using the given buffer if necessary. 0N/A// Return a pointer to the formatted string. 0N/A // constant format string 0N/A // trivial copy-through format string 0N/A // outputStream::stamp() may get called by ostream_abort(), use snprintf 0N/A // to avoid allocating large stack buffer in print(). 0N/A // N.B. Same as INT64_FORMAT 0N/A // N.B. Same as UINT64_FORMAT 3955N/A * This prints out hex data in a 'windbg' or 'xxd' form, where each line is: 3955N/A * <hex-address>: 8 * <hex-halfword> <ascii translation (optional)> 3955N/A * 0000000: 7f44 4f46 0102 0102 0000 0000 0000 0000 .DOF............ 3955N/A * 0000010: 0000 0000 0000 0040 0000 0020 0000 0005 .......@... .... 3955N/A * 0000020: 0000 0000 0000 0040 0000 0000 0000 015d .......@.......] 3955N/A * indent is applied to each line. Ends with a CR. 0N/A// useful for output to fixed chunks of memory, such as performance counters 0N/A // if buffer cannot resize, silently truncate 0N/A // For small overruns, double the buffer. For larger ones, 0N/A // increase to the requested size. 0N/A // invariant: buffer is always null-terminated 0N/A // Note that the following does not depend on write_len. 0N/A // This means that position and count get updated 0N/A // even when overflow occurs. 513N/A // Make an unused local variable to avoid warning from gcc 4.x compiler. 2080N/A //Get rid of annoying \n char 513N/A // Make an unused local variable to avoid warning from gcc 4.x compiler. 2592N/A// rotate_log must be called from VMThread at safepoint. In case need change parameters 2592N/A// for gc log rotation from thread other than VMThread, a sub type of VM_Operation 2592N/A// should be created and be submitted to VMThread's operation queue. DO NOT call this 2592N/A// function directly. Currently, it is safe to rotate log at safepoint through VMThread. 2592N/A// That is, no mutator threads and concurrent GC threads run parallel with VMThread to 2592N/A// write to gc log file at safepoint. If in future, changes made for mutator threads or 2592N/A// concurrent GC threads to run parallel with VMThread at safepoint, write and rotate_log 2592N/A "Must be VMThread at safepoint");
2592N/A // rotate file in names file.0, file.1, file.2, ..., file.<MaxGCLogFileNumbers-1> 2592N/A // close current file, rotate to next file 0N/A // lazily create log file (at startup, LogVMOutput is false even 0N/A // if +LogVMOutput is used, because the flags haven't been parsed yet) 0N/A // For safer printing during fatal error handling, do not init logfile 0N/A // if a VM error has been reported. 1353N/A // Create big enough buffer. 2247N/A // convert foo*bar.log or foo%pbar.log to foo123bar.log 0N/A // %%% Need a MutexLocker? 0N/A // Try again to open the file. 0N/A // Note: This feature is for maintainer use only. No need for L10N. 0N/A // Write XML header. 0N/A // (For now, don't bother to issue a DTD for this private format.) 0N/A // %%% Should be: jlong time_ms = os::start_time_milliseconds(), if 0N/A // we ever get round to introduce that method on the os class 0N/A // Write VM version header immediately. 0N/A // Record information about the command-line invocation. 0N/A xs->
head(
"vm_arguments");
// Cf. Arguments::print_on() 0N/A // Print it as a java-style property list. 0N/A // System properties don't generally contain newlines, so don't bother with unparsing. 0N/A // tty output per se is grouped under the <tty>...</tty> element. 0N/A // All further non-markup text gets copied to the tty: 0N/A // and leave xtty as NULL 0N/A// finish_log() is called during normal VM shutdown. finish_log_on_error() is 0N/A// called by ostream_abort() after a fatal error. 0N/A // Other log forks are appended here, at the End of Time: 0N/A // Other log forks are appended here, at the End of Time: 0N/A // Can't delete or close the file because delete and fclose aren't 0N/A // async-safe. We are about to die, so leave it to the kernel. 0N/A if (
// impossible, but who knows? 0N/A // bootstrap problem 0N/A // can't grab a lock or call Thread::current() if TLS isn't initialized 0N/A // VM already unhealthy 0N/A // safepoint == global lock (for VM only) 0N/A // do not attempt to lock unless we know the thread and the VM is healthy 0N/A // already held, no need to re-grab the lock 0N/A // output a hint where this output is coming from: 0N/A // nothing to release: either a recursive lock, or we scribbled (too bad) 0N/A return;
// already unlocked, perhaps via break_tty_lock_for_safepoint 0N/A// Yuck: jio_print does not accept char*/len. 0N/A // print to output stream. It can be redirected by a vfprintf hook 0N/A // print to log file 0N/A // flush the log file too, if there were any newlines 2135N/A // release the lock and return true so callers know if was 0N/A // (else there was no lock to break) 0N/A // We want to ensure that time stamps in GC logs consider time 0 0N/A // the time when the JVM is initialized, not the first time we ask 0N/A // for a time stamp. So, here, we explicitly update the time stamp 0N/A // Note : this must be called AFTER ostream_init() 0N/A // now we update the time stamp of the GC log to be synced up 0N/A // If we haven't lazily initialized the logfile yet, do it now, 0N/A // to avoid the possibility of lazy initialization during a VM 0N/A // crash, which can affect the stability of the fatal error handler. 0N/A// ostream_exit() is called during normal VM exit to finish log files, flush 0N/A// output and free resource. 0N/A // we temporaly disable PrintMallocFree here 0N/A // as otherwise it'll lead to using of almost deleted 0N/A // tty or defaultStream::instance in logging facility 0N/A // of HeapFree(), see 6391258 0N/A// ostream_abort() is called by os::abort() when VM is about to die. 0N/A // Here we can't delete gclog_or_tty and tty, just flush their output 2267N/A // compile task prints time stamp relative to VM start 0N/A // if buffer cannot resize, silently truncate 0N/A // For small overruns, double the buffer. For larger ones, 0N/A // increase to the requested size. 0N/A assert(
false,
"Socket could not be created!");