1 /*
2 * Copyright (c) 1999, 2015, 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 *
153 static void signal_sets_init();
154 static void install_signal_handlers();
155 static void set_signal_handler(int, bool);
156 static bool is_sig_ignored(int sig);
157
158 static sigset_t* unblocked_signals();
159 static sigset_t* vm_signals();
160 static sigset_t* allowdebug_blocked_signals();
161
162 // For signal-chaining
163 static struct sigaction *get_chained_signal_action(int sig);
164 static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
165
166 // GNU libc and libpthread version strings
167 static const char *glibc_version() { return _glibc_version; }
168 static const char *libpthread_version() { return _libpthread_version; }
169
170 static void libpthread_init();
171 static bool libnuma_init();
172 static void* libnuma_dlsym(void* handle, const char* name);
173 // Minimum stack size a thread can be created with (allowing
174 // the VM to completely create the thread and enter user code)
175 static size_t min_stack_allowed;
176
177 // Return default stack size or guard size for the specified thread type
178 static size_t default_stack_size(os::ThreadType thr_type);
179 static size_t default_guard_size(os::ThreadType thr_type);
180
181 static void capture_initial_stack(size_t max_size);
182
183 // Stack overflow handling
184 static bool manually_expand_stack(JavaThread * t, address addr);
185 static int max_register_window_saves_before_flushing();
186
187 // Real-time clock functions
188 static void clock_init(void);
189
190 // fast POSIX clocks support
191 static void fast_thread_clock_init(void);
192
193 static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
194 return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
195 }
196
197 static int pthread_getcpuclockid(pthread_t tid, clockid_t *clock_id) {
198 return _pthread_getcpuclockid ? _pthread_getcpuclockid(tid, clock_id) : -1;
|
1 /*
2 * Copyright (c) 1999, 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 *
153 static void signal_sets_init();
154 static void install_signal_handlers();
155 static void set_signal_handler(int, bool);
156 static bool is_sig_ignored(int sig);
157
158 static sigset_t* unblocked_signals();
159 static sigset_t* vm_signals();
160 static sigset_t* allowdebug_blocked_signals();
161
162 // For signal-chaining
163 static struct sigaction *get_chained_signal_action(int sig);
164 static bool chained_handler(int sig, siginfo_t* siginfo, void* context);
165
166 // GNU libc and libpthread version strings
167 static const char *glibc_version() { return _glibc_version; }
168 static const char *libpthread_version() { return _libpthread_version; }
169
170 static void libpthread_init();
171 static bool libnuma_init();
172 static void* libnuma_dlsym(void* handle, const char* name);
173
174 // Return default guard size for the specified thread type
175 static size_t default_guard_size(os::ThreadType thr_type);
176
177 static void capture_initial_stack(size_t max_size);
178
179 // Stack overflow handling
180 static bool manually_expand_stack(JavaThread * t, address addr);
181 static int max_register_window_saves_before_flushing();
182
183 // Real-time clock functions
184 static void clock_init(void);
185
186 // fast POSIX clocks support
187 static void fast_thread_clock_init(void);
188
189 static int clock_gettime(clockid_t clock_id, struct timespec *tp) {
190 return _clock_gettime ? _clock_gettime(clock_id, tp) : -1;
191 }
192
193 static int pthread_getcpuclockid(pthread_t tid, clockid_t *clock_id) {
194 return _pthread_getcpuclockid ? _pthread_getcpuclockid(tid, clock_id) : -1;
|