57 #endif
58 # include <time.h>
59 # include <fcntl.h>
60 # include <dlfcn.h>
61 # include <pthread.h>
62 #ifdef SOLARIS
63 # include <thread.h>
64 #endif
65 # include <limits.h>
66 # include <errno.h>
67 #ifdef SOLARIS
68 # include <sys/trap.h>
69 # include <sys/regset.h>
70 # include <sys/procset.h>
71 # include <ucontext.h>
72 # include <setjmp.h>
73 #endif
74 # ifdef SOLARIS_MUTATOR_LIBTHREAD
75 # include <sys/procfs.h>
76 # endif
77 #ifdef LINUX
78 # include <inttypes.h>
79 # include <signal.h>
80 # include <ucontext.h>
81 # include <sys/time.h>
82 #endif
83
84
85 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
86 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
87 // system header files. On 32-bit architectures, there is no problem.
88 // On 64-bit architectures, defining NULL as a 32-bit constant can cause
89 // problems with varargs functions: C++ integral promotion rules say for
90 // varargs, we pass the argument 0 as an int. So, if NULL was passed to a
91 // varargs function it will remain 32-bits. Depending on the calling
92 // convention of the machine, if the argument is passed on the stack then
93 // only 32-bits of the "NULL" pointer may be initialized to zero. The
94 // other 32-bits will be garbage. If the varargs function is expecting a
95 // pointer when it extracts the argument, then we have a problem.
96 //
97 // Solution: For 64-bit architectures, redefine NULL as 64-bit constant 0.
98 //
|
57 #endif
58 # include <time.h>
59 # include <fcntl.h>
60 # include <dlfcn.h>
61 # include <pthread.h>
62 #ifdef SOLARIS
63 # include <thread.h>
64 #endif
65 # include <limits.h>
66 # include <errno.h>
67 #ifdef SOLARIS
68 # include <sys/trap.h>
69 # include <sys/regset.h>
70 # include <sys/procset.h>
71 # include <ucontext.h>
72 # include <setjmp.h>
73 #endif
74 # ifdef SOLARIS_MUTATOR_LIBTHREAD
75 # include <sys/procfs.h>
76 # endif
77
78 #include <inttypes.h>
79
80 // Solaris 8 doesn't provide definitions of these
81 #ifdef SOLARIS
82 #ifndef PRIdPTR
83 #if defined(_LP64)
84 #define PRIdPTR "ld"
85 #define PRIuPTR "lu"
86 #define PRIxPTR "lx"
87 #else
88 #define PRIdPTR "d"
89 #define PRIuPTR "u"
90 #define PRIxPTR "x"
91 #endif
92 #endif
93 #endif
94
95 #ifdef LINUX
96 # include <signal.h>
97 # include <ucontext.h>
98 # include <sys/time.h>
99 #endif
100
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 //
|