1 /*
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 *
52 #ifdef SOLARIS
53 #include <thread.h>
54 #endif // SOLARIS
55
56 #include <limits.h>
57 #include <errno.h>
58
59 #ifdef SOLARIS
60 #include <sys/trap.h>
61 #include <sys/regset.h>
62 #include <sys/procset.h>
63 #include <ucontext.h>
64 #include <setjmp.h>
65 #endif // SOLARIS
66
67 # ifdef SOLARIS_MUTATOR_LIBTHREAD
68 # include <sys/procfs.h>
69 # endif
70
71 #if defined(LINUX) || defined(_ALLBSD_SOURCE)
72 #ifndef __STDC_LIMIT_MACROS
73 #define __STDC_LIMIT_MACROS
74 #endif // __STDC_LIMIT_MACROS
75 #include <inttypes.h>
76 #include <signal.h>
77 #ifndef __OpenBSD__
78 #include <ucontext.h>
79 #endif
80 #ifdef __APPLE__
81 #include <AvailabilityMacros.h>
82 #include <mach/mach.h>
83 #endif
84 #include <sys/time.h>
85 #endif // LINUX || _ALLBSD_SOURCE
86
87 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
88 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
89 // system header files. On 32-bit architectures, there is no problem.
90 // On 64-bit architectures, defining NULL as a 32-bit constant can cause
91 // problems with varargs functions: C++ integral promotion rules say for
92 // varargs, we pass the argument 0 as an int. So, if NULL was passed to a
93 // varargs function it will remain 32-bits. Depending on the calling
94 // convention of the machine, if the argument is passed on the stack then
|
1 /*
2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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 *
52 #ifdef SOLARIS
53 #include <thread.h>
54 #endif // SOLARIS
55
56 #include <limits.h>
57 #include <errno.h>
58
59 #ifdef SOLARIS
60 #include <sys/trap.h>
61 #include <sys/regset.h>
62 #include <sys/procset.h>
63 #include <ucontext.h>
64 #include <setjmp.h>
65 #endif // SOLARIS
66
67 # ifdef SOLARIS_MUTATOR_LIBTHREAD
68 # include <sys/procfs.h>
69 # endif
70
71 #if defined(LINUX) || defined(_ALLBSD_SOURCE)
72 #include <inttypes.h>
73 #include <signal.h>
74 #ifndef __OpenBSD__
75 #include <ucontext.h>
76 #endif
77 #ifdef __APPLE__
78 #include <AvailabilityMacros.h>
79 #include <mach/mach.h>
80 #endif
81 #include <sys/time.h>
82 #endif // LINUX || _ALLBSD_SOURCE
83
84 // 4810578: varargs unsafe on 32-bit integer/64-bit pointer architectures
85 // When __cplusplus is defined, NULL is defined as 0 (32-bit constant) in
86 // system header files. On 32-bit architectures, there is no problem.
87 // On 64-bit architectures, defining NULL as a 32-bit constant can cause
88 // problems with varargs functions: C++ integral promotion rules say for
89 // varargs, we pass the argument 0 as an int. So, if NULL was passed to a
90 // varargs function it will remain 32-bits. Depending on the calling
91 // convention of the machine, if the argument is passed on the stack then
|