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
25 #ifndef OS_BSD_VM_OS_BSD_HPP
26 #define OS_BSD_VM_OS_BSD_HPP
27
28 // Bsd_OS defines the interface to Bsd operating systems
29
30 // Information about the protection of the page at address '0' on this os.
31 static bool zero_page_read_protected() { return true; }
32
33 // pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1
34 typedef int (*pthread_getattr_func_type)(pthread_t, pthread_attr_t *);
35
36 #ifdef __APPLE__
37 // Mac OS X doesn't support clock_gettime. Stub out the type, it is
38 // unused
39 typedef int clockid_t;
40 #endif
41
42 class Bsd {
43 friend class os;
44
45 // For signal-chaining
46 #define MAXSIGNUM 32
47 static struct sigaction sigact[MAXSIGNUM]; // saved preinstalled sigactions
48 static unsigned int sigs; // mask of signals that have
49 // preinstalled signal handlers
50 static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
51 // __sigaction(), signal() is loaded
52 static struct sigaction *(*get_signal_action)(int);
53 static struct sigaction *get_preinstalled_handler(int);
54 static void save_preinstalled_handler(int, struct sigaction&);
55
127 static sigset_t* allowdebug_blocked_signals();
128
129 // For signal-chaining
130 static struct sigaction *get_chained_signal_action(int sig);
131 static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
132
133 // Minimum stack size a thread can be created with (allowing
134 // the VM to completely create the thread and enter user code)
135 static size_t min_stack_allowed;
136
137 // Return default stack size or guard size for the specified thread type
138 static size_t default_stack_size(os::ThreadType thr_type);
139 static size_t default_guard_size(os::ThreadType thr_type);
140
141 // Real-time clock functions
142 static void clock_init(void);
143
144 // Stack repair handling
145
146 // none present
147
148 // BsdThreads work-around for 6292965
149 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime);
150
151 private:
152 typedef int (*sched_getcpu_func_t)(void);
153 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);
154 typedef int (*numa_max_node_func_t)(void);
155 typedef int (*numa_available_func_t)(void);
156 typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node);
157 typedef void (*numa_interleave_memory_func_t)(void *start, size_t size, unsigned long *nodemask);
158
159 static sched_getcpu_func_t _sched_getcpu;
160 static numa_node_to_cpus_func_t _numa_node_to_cpus;
161 static numa_max_node_func_t _numa_max_node;
162 static numa_available_func_t _numa_available;
163 static numa_tonode_memory_func_t _numa_tonode_memory;
164 static numa_interleave_memory_func_t _numa_interleave_memory;
165 static unsigned long* _numa_all_nodes;
166
167 static void set_sched_getcpu(sched_getcpu_func_t func) { _sched_getcpu = func; }
168 static void set_numa_node_to_cpus(numa_node_to_cpus_func_t func) { _numa_node_to_cpus = func; }
169 static void set_numa_max_node(numa_max_node_func_t func) { _numa_max_node = func; }
|
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
25 #ifndef OS_BSD_VM_OS_BSD_HPP
26 #define OS_BSD_VM_OS_BSD_HPP
27
28 // Bsd_OS defines the interface to Bsd operating systems
29
30 // Information about the protection of the page at address '0' on this os.
31 static bool zero_page_read_protected() { return true; }
32
33 #ifdef __APPLE__
34 // Mac OS X doesn't support clock_gettime. Stub out the type, it is
35 // unused
36 typedef int clockid_t;
37 #endif
38
39 class Bsd {
40 friend class os;
41
42 // For signal-chaining
43 #define MAXSIGNUM 32
44 static struct sigaction sigact[MAXSIGNUM]; // saved preinstalled sigactions
45 static unsigned int sigs; // mask of signals that have
46 // preinstalled signal handlers
47 static bool libjsig_is_loaded; // libjsig that interposes sigaction(),
48 // __sigaction(), signal() is loaded
49 static struct sigaction *(*get_signal_action)(int);
50 static struct sigaction *get_preinstalled_handler(int);
51 static void save_preinstalled_handler(int, struct sigaction&);
52
124 static sigset_t* allowdebug_blocked_signals();
125
126 // For signal-chaining
127 static struct sigaction *get_chained_signal_action(int sig);
128 static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
129
130 // Minimum stack size a thread can be created with (allowing
131 // the VM to completely create the thread and enter user code)
132 static size_t min_stack_allowed;
133
134 // Return default stack size or guard size for the specified thread type
135 static size_t default_stack_size(os::ThreadType thr_type);
136 static size_t default_guard_size(os::ThreadType thr_type);
137
138 // Real-time clock functions
139 static void clock_init(void);
140
141 // Stack repair handling
142
143 // none present
144
145 private:
146 typedef int (*sched_getcpu_func_t)(void);
147 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);
148 typedef int (*numa_max_node_func_t)(void);
149 typedef int (*numa_available_func_t)(void);
150 typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node);
151 typedef void (*numa_interleave_memory_func_t)(void *start, size_t size, unsigned long *nodemask);
152
153 static sched_getcpu_func_t _sched_getcpu;
154 static numa_node_to_cpus_func_t _numa_node_to_cpus;
155 static numa_max_node_func_t _numa_max_node;
156 static numa_available_func_t _numa_available;
157 static numa_tonode_memory_func_t _numa_tonode_memory;
158 static numa_interleave_memory_func_t _numa_interleave_memory;
159 static unsigned long* _numa_all_nodes;
160
161 static void set_sched_getcpu(sched_getcpu_func_t func) { _sched_getcpu = func; }
162 static void set_numa_node_to_cpus(numa_node_to_cpus_func_t func) { _numa_node_to_cpus = func; }
163 static void set_numa_max_node(numa_max_node_func_t func) { _numa_max_node = func; }
|