src/share/vm/utilities/globalDefinitions_gcc.hpp

Print this page
rev 3111 : imported patch osx-threadid


  70 #include <sys/procset.h>
  71 #include <ucontext.h>
  72 #include <setjmp.h>
  73 #endif // SOLARIS
  74 
  75 # ifdef SOLARIS_MUTATOR_LIBTHREAD
  76 # include <sys/procfs.h>
  77 # endif
  78 
  79 #if defined(LINUX) || defined(_ALLBSD_SOURCE)
  80 #ifndef __STDC_LIMIT_MACROS
  81 #define __STDC_LIMIT_MACROS
  82 #endif // __STDC_LIMIT_MACROS
  83 #include <inttypes.h>
  84 #include <signal.h>
  85 #ifndef __OpenBSD__
  86 #include <ucontext.h>
  87 #endif
  88 #ifdef __APPLE__
  89   #include <AvailabilityMacros.h>
  90   #if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4)
  91     // Mac OS X 10.4 defines EFL_AC and EFL_ID,
  92     // which conflict with hotspot variable names.
  93     //
  94     // This has been fixed in Mac OS X 10.5.
  95     #undef EFL_AC
  96     #undef EFL_ID
  97   #endif
  98 #endif
  99 #include <sys/time.h>
 100 #endif // LINUX || _ALLBSD_SOURCE
 101 
 102 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
 103 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
 104 // system header files.  On 32-bit architectures, there is no problem.
 105 // On 64-bit architectures, defining NULL as a 32-bit constant can cause
 106 // problems with varargs functions: C++ integral promotion rules say for
 107 // varargs, we pass the argument 0 as an int.  So, if NULL was passed to a
 108 // varargs function it will remain 32-bits.  Depending on the calling
 109 // convention of the machine, if the argument is passed on the stack then
 110 // only 32-bits of the "NULL" pointer may be initialized to zero.  The
 111 // other 32-bits will be garbage.  If the varargs function is expecting a
 112 // pointer when it extracts the argument, then we have a problem.
 113 //
 114 // Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
 115 //
 116 // Note: this fix doesn't work well on Linux because NULL will be overwritten
 117 // whenever a system header file is included. Linux handles NULL correctly




  70 #include <sys/procset.h>
  71 #include <ucontext.h>
  72 #include <setjmp.h>
  73 #endif // SOLARIS
  74 
  75 # ifdef SOLARIS_MUTATOR_LIBTHREAD
  76 # include <sys/procfs.h>
  77 # endif
  78 
  79 #if defined(LINUX) || defined(_ALLBSD_SOURCE)
  80 #ifndef __STDC_LIMIT_MACROS
  81 #define __STDC_LIMIT_MACROS
  82 #endif // __STDC_LIMIT_MACROS
  83 #include <inttypes.h>
  84 #include <signal.h>
  85 #ifndef __OpenBSD__
  86 #include <ucontext.h>
  87 #endif
  88 #ifdef __APPLE__
  89   #include <AvailabilityMacros.h>








  90 #endif
  91 #include <sys/time.h>
  92 #endif // LINUX || _ALLBSD_SOURCE
  93 
  94 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
  95 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
  96 // system header files.  On 32-bit architectures, there is no problem.
  97 // On 64-bit architectures, defining NULL as a 32-bit constant can cause
  98 // problems with varargs functions: C++ integral promotion rules say for
  99 // varargs, we pass the argument 0 as an int.  So, if NULL was passed to a
 100 // varargs function it will remain 32-bits.  Depending on the calling
 101 // convention of the machine, if the argument is passed on the stack then
 102 // only 32-bits of the "NULL" pointer may be initialized to zero.  The
 103 // other 32-bits will be garbage.  If the varargs function is expecting a
 104 // pointer when it extracts the argument, then we have a problem.
 105 //
 106 // Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
 107 //
 108 // Note: this fix doesn't work well on Linux because NULL will be overwritten
 109 // whenever a system header file is included. Linux handles NULL correctly