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 *
103
104 // This boolean allows users to forward their own non-matching signals
105 // to JVM_handle_bsd_signal, harmlessly.
106 static bool signal_handlers_are_installed;
107
108 static int get_our_sigflags(int);
109 static void set_our_sigflags(int, int);
110 static void signal_sets_init();
111 static void install_signal_handlers();
112 static void set_signal_handler(int, bool);
113 static bool is_sig_ignored(int sig);
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 // Stack repair handling
135
136 // none present
137
138 private:
139 typedef int (*sched_getcpu_func_t)(void);
140 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);
141 typedef int (*numa_max_node_func_t)(void);
142 typedef int (*numa_available_func_t)(void);
143 typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node);
144 typedef void (*numa_interleave_memory_func_t)(void *start, size_t size, unsigned long *nodemask);
145
146 static sched_getcpu_func_t _sched_getcpu;
147 static numa_node_to_cpus_func_t _numa_node_to_cpus;
148 static numa_max_node_func_t _numa_max_node;
149 static numa_available_func_t _numa_available;
150 static numa_tonode_memory_func_t _numa_tonode_memory;
|
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 *
103
104 // This boolean allows users to forward their own non-matching signals
105 // to JVM_handle_bsd_signal, harmlessly.
106 static bool signal_handlers_are_installed;
107
108 static int get_our_sigflags(int);
109 static void set_our_sigflags(int, int);
110 static void signal_sets_init();
111 static void install_signal_handlers();
112 static void set_signal_handler(int, bool);
113 static bool is_sig_ignored(int sig);
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 // Real-time clock functions
124 static void clock_init(void);
125
126 // Stack repair handling
127
128 // none present
129
130 private:
131 typedef int (*sched_getcpu_func_t)(void);
132 typedef int (*numa_node_to_cpus_func_t)(int node, unsigned long *buffer, int bufferlen);
133 typedef int (*numa_max_node_func_t)(void);
134 typedef int (*numa_available_func_t)(void);
135 typedef int (*numa_tonode_memory_func_t)(void *start, size_t size, int node);
136 typedef void (*numa_interleave_memory_func_t)(void *start, size_t size, unsigned long *nodemask);
137
138 static sched_getcpu_func_t _sched_getcpu;
139 static numa_node_to_cpus_func_t _numa_node_to_cpus;
140 static numa_max_node_func_t _numa_max_node;
141 static numa_available_func_t _numa_available;
142 static numa_tonode_memory_func_t _numa_tonode_memory;
|