< prev index next >

src/hotspot/share/logging/logFileStreamOutput.cpp

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 #include "precompiled.hpp"

  25 #include "logging/logDecorators.hpp"
  26 #include "logging/logDecorations.hpp"
  27 #include "logging/logFileStreamOutput.hpp"
  28 #include "logging/logMessageBuffer.hpp"
  29 #include "memory/allocation.inline.hpp"
  30 #include "prims/jvm.h"
  31 
  32 static bool initialized;
  33 static union {
  34   char stdoutmem[sizeof(LogStdoutOutput)];
  35   jlong dummy;
  36 } aligned_stdoutmem;
  37 static union {
  38   char stderrmem[sizeof(LogStderrOutput)];
  39   jlong dummy;
  40 } aligned_stderrmem;
  41 
  42 LogStdoutOutput &StdoutLog = reinterpret_cast<LogStdoutOutput&>(aligned_stdoutmem.stdoutmem);
  43 LogStderrOutput &StderrLog = reinterpret_cast<LogStderrOutput&>(aligned_stderrmem.stderrmem);
  44 
  45 LogFileStreamInitializer::LogFileStreamInitializer() {
  46   if (!initialized) {
  47     ::new (&StdoutLog) LogStdoutOutput();
  48     ::new (&StderrLog) LogStderrOutput();
  49     initialized = true;
  50   }




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 #include "precompiled.hpp"
  25 #include "jvm.h"
  26 #include "logging/logDecorators.hpp"
  27 #include "logging/logDecorations.hpp"
  28 #include "logging/logFileStreamOutput.hpp"
  29 #include "logging/logMessageBuffer.hpp"
  30 #include "memory/allocation.inline.hpp"

  31 
  32 static bool initialized;
  33 static union {
  34   char stdoutmem[sizeof(LogStdoutOutput)];
  35   jlong dummy;
  36 } aligned_stdoutmem;
  37 static union {
  38   char stderrmem[sizeof(LogStderrOutput)];
  39   jlong dummy;
  40 } aligned_stderrmem;
  41 
  42 LogStdoutOutput &StdoutLog = reinterpret_cast<LogStdoutOutput&>(aligned_stdoutmem.stdoutmem);
  43 LogStderrOutput &StderrLog = reinterpret_cast<LogStderrOutput&>(aligned_stderrmem.stderrmem);
  44 
  45 LogFileStreamInitializer::LogFileStreamInitializer() {
  46   if (!initialized) {
  47     ::new (&StdoutLog) LogStdoutOutput();
  48     ::new (&StderrLog) LogStderrOutput();
  49     initialized = true;
  50   }


< prev index next >