1 /*
2 * Copyright (c) 1999, 2013, 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 *
114
115 static sigset_t* unblocked_signals();
116 static sigset_t* vm_signals();
117 static sigset_t* allowdebug_blocked_signals();
118
119 // For signal-chaining
120 static struct sigaction *get_chained_signal_action(int sig);
121 static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
122
123 // Minimum stack size a thread can be created with (allowing
124 // the VM to completely create the thread and enter user code)
125 static size_t min_stack_allowed;
126
127 // Return default stack size or guard size for the specified thread type
128 static size_t default_stack_size(os::ThreadType thr_type);
129 static size_t default_guard_size(os::ThreadType thr_type);
130
131 // Real-time clock functions
132 static void clock_init(void);
133
134 static inline bool supports_monotonic_clock() {
135 return _clock_gettime != NULL;
136 }
137
138 static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
139 return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
140 }
141
142 // Stack repair handling
143
144 // none present
145
146 // BsdThreads work-around for 6292965
147 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime);
148
149 private:
150 typedef int (*sched_getcpu_func_t)(void);
151 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);
152 typedef int (*numa_max_node_func_t)(void);
153 typedef int (*numa_available_func_t)(void);
154 typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node);
155 typedef void (*numa_interleave_memory_func_t)(void *start, size_t size, unsigned long *nodemask);
156
157 static sched_getcpu_func_t _sched_getcpu;
|
1 /*
2 * Copyright (c) 1999, 2014, 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 *
114
115 static sigset_t* unblocked_signals();
116 static sigset_t* vm_signals();
117 static sigset_t* allowdebug_blocked_signals();
118
119 // For signal-chaining
120 static struct sigaction *get_chained_signal_action(int sig);
121 static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
122
123 // Minimum stack size a thread can be created with (allowing
124 // the VM to completely create the thread and enter user code)
125 static size_t min_stack_allowed;
126
127 // Return default stack size or guard size for the specified thread type
128 static size_t default_stack_size(os::ThreadType thr_type);
129 static size_t default_guard_size(os::ThreadType thr_type);
130
131 // Real-time clock functions
132 static void clock_init(void);
133
134 static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
135 return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
136 }
137
138 // Stack repair handling
139
140 // none present
141
142 // BsdThreads work-around for 6292965
143 static int safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime);
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;
|