annotate src/os/solaris/vm/jsig.c @ 3292:c303b3532d4a

7037939: NUMA: Disable adaptive resizing if SHM large pages are used Summary: Make the NUMA allocator behave properly with SHM and ISM large pages. Reviewed-by: ysr
author iveresov
date Tue, 26 Apr 2011 11:46:34 -0700
parents f95d63e2154a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 /* CopyrightVersion 1.2 */
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 /* This is a special library that should be loaded before libc &
a61af66fc99e Initial load
duke
parents:
diff changeset
28 * libthread to interpose the signal handler installation functions:
a61af66fc99e Initial load
duke
parents:
diff changeset
29 * sigaction(), signal(), sigset().
a61af66fc99e Initial load
duke
parents:
diff changeset
30 * Used for signal-chaining. See RFE 4381843.
a61af66fc99e Initial load
duke
parents:
diff changeset
31 */
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 #include <stdlib.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
34 #include <stdio.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
35 #include <string.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
36 #include <signal.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
37 #include <dlfcn.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
38 #include <thread.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
39 #include <synch.h>
a61af66fc99e Initial load
duke
parents:
diff changeset
40 #include "jvm_solaris.h"
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 #define bool int
a61af66fc99e Initial load
duke
parents:
diff changeset
43 #define true 1
a61af66fc99e Initial load
duke
parents:
diff changeset
44 #define false 0
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 static struct sigaction *sact = (struct sigaction *)NULL; /* saved signal handlers */
a61af66fc99e Initial load
duke
parents:
diff changeset
47 static sigset_t jvmsigs;
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 /* used to synchronize the installation of signal handlers */
a61af66fc99e Initial load
duke
parents:
diff changeset
50 static mutex_t mutex = DEFAULTMUTEX;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 static cond_t cond = DEFAULTCV;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 static thread_t tid = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
53
a61af66fc99e Initial load
duke
parents:
diff changeset
54 typedef void (*sa_handler_t)(int);
a61af66fc99e Initial load
duke
parents:
diff changeset
55 typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
a61af66fc99e Initial load
duke
parents:
diff changeset
56 typedef sa_handler_t (*signal_t)(int, sa_handler_t);
a61af66fc99e Initial load
duke
parents:
diff changeset
57 typedef int (*sigaction_t)(int, const struct sigaction *, struct sigaction *);
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 static signal_t os_signal = 0; /* os's version of signal()/sigset() */
a61af66fc99e Initial load
duke
parents:
diff changeset
60 static sigaction_t os_sigaction = 0; /* os's version of sigaction() */
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 static bool jvm_signal_installing = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 static bool jvm_signal_installed = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 /* assume called within signal_lock */
a61af66fc99e Initial load
duke
parents:
diff changeset
67 static void allocate_sact() {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 size_t maxsignum;
a61af66fc99e Initial load
duke
parents:
diff changeset
69 maxsignum = SIGRTMAX;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 if (sact == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 sact = (struct sigaction *)malloc((maxsignum+1) * (size_t)sizeof(struct sigaction));
a61af66fc99e Initial load
duke
parents:
diff changeset
72 memset(sact, 0, (maxsignum+1) * (size_t)sizeof(struct sigaction));
a61af66fc99e Initial load
duke
parents:
diff changeset
73 }
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 if (sact == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
76 printf("%s\n", "libjsig.so unable to allocate memory");
a61af66fc99e Initial load
duke
parents:
diff changeset
77 exit(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 sigemptyset(&jvmsigs);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 static void signal_lock() {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 mutex_lock(&mutex);
a61af66fc99e Initial load
duke
parents:
diff changeset
85 /* When the jvm is installing its set of signal handlers, threads
a61af66fc99e Initial load
duke
parents:
diff changeset
86 * other than the jvm thread should wait */
a61af66fc99e Initial load
duke
parents:
diff changeset
87 if (jvm_signal_installing) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 if (tid != thr_self()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 cond_wait(&cond, &mutex);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92 }
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 static void signal_unlock() {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 mutex_unlock(&mutex);
a61af66fc99e Initial load
duke
parents:
diff changeset
96 }
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 static sa_handler_t call_os_signal(int sig, sa_handler_t disp,
a61af66fc99e Initial load
duke
parents:
diff changeset
99 bool is_sigset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 if (os_signal == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 if (!is_sigset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 os_signal = (signal_t)dlsym(RTLD_NEXT, "signal");
a61af66fc99e Initial load
duke
parents:
diff changeset
103 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
104 os_signal = (signal_t)dlsym(RTLD_NEXT, "sigset");
a61af66fc99e Initial load
duke
parents:
diff changeset
105 }
a61af66fc99e Initial load
duke
parents:
diff changeset
106 if (os_signal == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 printf("%s\n", dlerror());
a61af66fc99e Initial load
duke
parents:
diff changeset
108 exit(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 return (*os_signal)(sig, disp);
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 static void save_signal_handler(int sig, sa_handler_t disp, bool is_sigset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 sigset_t set;
a61af66fc99e Initial load
duke
parents:
diff changeset
116 if (sact == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
117 allocate_sact();
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119 sact[sig].sa_handler = disp;
a61af66fc99e Initial load
duke
parents:
diff changeset
120 sigemptyset(&set);
a61af66fc99e Initial load
duke
parents:
diff changeset
121 sact[sig].sa_mask = set;
a61af66fc99e Initial load
duke
parents:
diff changeset
122 if (!is_sigset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 sact[sig].sa_flags = SA_NODEFER;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 if (sig != SIGILL && sig != SIGTRAP && sig != SIGPWR) {
a61af66fc99e Initial load
duke
parents:
diff changeset
125 sact[sig].sa_flags |= SA_RESETHAND;
a61af66fc99e Initial load
duke
parents:
diff changeset
126 }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
128 sact[sig].sa_flags = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
129 }
a61af66fc99e Initial load
duke
parents:
diff changeset
130 }
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 static sa_handler_t set_signal(int sig, sa_handler_t disp, bool is_sigset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
133 sa_handler_t oldhandler;
a61af66fc99e Initial load
duke
parents:
diff changeset
134 bool sigblocked;
a61af66fc99e Initial load
duke
parents:
diff changeset
135
a61af66fc99e Initial load
duke
parents:
diff changeset
136 signal_lock();
a61af66fc99e Initial load
duke
parents:
diff changeset
137 if (sact == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
138 allocate_sact();
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141 if (jvm_signal_installed && sigismember(&jvmsigs, sig)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 /* jvm has installed its signal handler for this signal. */
a61af66fc99e Initial load
duke
parents:
diff changeset
143 /* Save the handler. Don't really install it. */
a61af66fc99e Initial load
duke
parents:
diff changeset
144 if (is_sigset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
145 /* We won't honor the SIG_HOLD request to change the signal mask */
a61af66fc99e Initial load
duke
parents:
diff changeset
146 sigblocked = sigismember(&(sact[sig].sa_mask), sig);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
148 oldhandler = sact[sig].sa_handler;
a61af66fc99e Initial load
duke
parents:
diff changeset
149 save_signal_handler(sig, disp, is_sigset);
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 if (is_sigset && sigblocked) {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 oldhandler = SIG_HOLD;
a61af66fc99e Initial load
duke
parents:
diff changeset
153 }
a61af66fc99e Initial load
duke
parents:
diff changeset
154
a61af66fc99e Initial load
duke
parents:
diff changeset
155 signal_unlock();
a61af66fc99e Initial load
duke
parents:
diff changeset
156 return oldhandler;
a61af66fc99e Initial load
duke
parents:
diff changeset
157 } else if (jvm_signal_installing) {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 /* jvm is installing its signal handlers. Install the new
a61af66fc99e Initial load
duke
parents:
diff changeset
159 * handlers and save the old ones. jvm uses sigaction().
a61af66fc99e Initial load
duke
parents:
diff changeset
160 * Leave the piece here just in case. */
a61af66fc99e Initial load
duke
parents:
diff changeset
161 oldhandler = call_os_signal(sig, disp, is_sigset);
a61af66fc99e Initial load
duke
parents:
diff changeset
162 save_signal_handler(sig, oldhandler, is_sigset);
a61af66fc99e Initial load
duke
parents:
diff changeset
163
a61af66fc99e Initial load
duke
parents:
diff changeset
164 /* Record the signals used by jvm */
a61af66fc99e Initial load
duke
parents:
diff changeset
165 sigaddset(&jvmsigs, sig);
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167 signal_unlock();
a61af66fc99e Initial load
duke
parents:
diff changeset
168 return oldhandler;
a61af66fc99e Initial load
duke
parents:
diff changeset
169 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
170 /* jvm has no relation with this signal (yet). Install the
a61af66fc99e Initial load
duke
parents:
diff changeset
171 * the handler. */
a61af66fc99e Initial load
duke
parents:
diff changeset
172 oldhandler = call_os_signal(sig, disp, is_sigset);
a61af66fc99e Initial load
duke
parents:
diff changeset
173
a61af66fc99e Initial load
duke
parents:
diff changeset
174 signal_unlock();
a61af66fc99e Initial load
duke
parents:
diff changeset
175 return oldhandler;
a61af66fc99e Initial load
duke
parents:
diff changeset
176 }
a61af66fc99e Initial load
duke
parents:
diff changeset
177 }
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 sa_handler_t signal(int sig, sa_handler_t disp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
180 return set_signal(sig, disp, false);
a61af66fc99e Initial load
duke
parents:
diff changeset
181 }
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 sa_handler_t sigset(int sig, sa_handler_t disp) {
a61af66fc99e Initial load
duke
parents:
diff changeset
184 return set_signal(sig, disp, true);
a61af66fc99e Initial load
duke
parents:
diff changeset
185 }
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 static int call_os_sigaction(int sig, const struct sigaction *act,
a61af66fc99e Initial load
duke
parents:
diff changeset
188 struct sigaction *oact) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 if (os_sigaction == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
190 os_sigaction = (sigaction_t)dlsym(RTLD_NEXT, "sigaction");
a61af66fc99e Initial load
duke
parents:
diff changeset
191 if (os_sigaction == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
192 printf("%s\n", dlerror());
a61af66fc99e Initial load
duke
parents:
diff changeset
193 exit(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
194 }
a61af66fc99e Initial load
duke
parents:
diff changeset
195 }
a61af66fc99e Initial load
duke
parents:
diff changeset
196 return (*os_sigaction)(sig, act, oact);
a61af66fc99e Initial load
duke
parents:
diff changeset
197 }
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199 int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 int res;
a61af66fc99e Initial load
duke
parents:
diff changeset
201 struct sigaction oldAct;
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203 signal_lock();
a61af66fc99e Initial load
duke
parents:
diff changeset
204
a61af66fc99e Initial load
duke
parents:
diff changeset
205 if (sact == NULL ) {
a61af66fc99e Initial load
duke
parents:
diff changeset
206 allocate_sact();
a61af66fc99e Initial load
duke
parents:
diff changeset
207 }
a61af66fc99e Initial load
duke
parents:
diff changeset
208 if (jvm_signal_installed && sigismember(&jvmsigs, sig)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
209 /* jvm has installed its signal handler for this signal. */
a61af66fc99e Initial load
duke
parents:
diff changeset
210 /* Save the handler. Don't really install it. */
a61af66fc99e Initial load
duke
parents:
diff changeset
211 if (oact != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
212 *oact = sact[sig];
a61af66fc99e Initial load
duke
parents:
diff changeset
213 }
a61af66fc99e Initial load
duke
parents:
diff changeset
214 if (act != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
215 sact[sig] = *act;
a61af66fc99e Initial load
duke
parents:
diff changeset
216 }
a61af66fc99e Initial load
duke
parents:
diff changeset
217
a61af66fc99e Initial load
duke
parents:
diff changeset
218 signal_unlock();
a61af66fc99e Initial load
duke
parents:
diff changeset
219 return 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
220 } else if (jvm_signal_installing) {
a61af66fc99e Initial load
duke
parents:
diff changeset
221 /* jvm is installing its signal handlers. Install the new
a61af66fc99e Initial load
duke
parents:
diff changeset
222 * handlers and save the old ones. */
a61af66fc99e Initial load
duke
parents:
diff changeset
223 res = call_os_sigaction(sig, act, &oldAct);
a61af66fc99e Initial load
duke
parents:
diff changeset
224 sact[sig] = oldAct;
a61af66fc99e Initial load
duke
parents:
diff changeset
225 if (oact != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
226 *oact = oldAct;
a61af66fc99e Initial load
duke
parents:
diff changeset
227 }
a61af66fc99e Initial load
duke
parents:
diff changeset
228
a61af66fc99e Initial load
duke
parents:
diff changeset
229 /* Record the signals used by jvm */
a61af66fc99e Initial load
duke
parents:
diff changeset
230 sigaddset(&jvmsigs, sig);
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 signal_unlock();
a61af66fc99e Initial load
duke
parents:
diff changeset
233 return res;
a61af66fc99e Initial load
duke
parents:
diff changeset
234 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 /* jvm has no relation with this signal (yet). Install the
a61af66fc99e Initial load
duke
parents:
diff changeset
236 * the handler. */
a61af66fc99e Initial load
duke
parents:
diff changeset
237 res = call_os_sigaction(sig, act, oact);
a61af66fc99e Initial load
duke
parents:
diff changeset
238
a61af66fc99e Initial load
duke
parents:
diff changeset
239 signal_unlock();
a61af66fc99e Initial load
duke
parents:
diff changeset
240 return res;
a61af66fc99e Initial load
duke
parents:
diff changeset
241 }
a61af66fc99e Initial load
duke
parents:
diff changeset
242 }
a61af66fc99e Initial load
duke
parents:
diff changeset
243
a61af66fc99e Initial load
duke
parents:
diff changeset
244 /* The four functions for the jvm to call into */
a61af66fc99e Initial load
duke
parents:
diff changeset
245 void JVM_begin_signal_setting() {
a61af66fc99e Initial load
duke
parents:
diff changeset
246 signal_lock();
a61af66fc99e Initial load
duke
parents:
diff changeset
247 jvm_signal_installing = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
248 tid = thr_self();
a61af66fc99e Initial load
duke
parents:
diff changeset
249 signal_unlock();
a61af66fc99e Initial load
duke
parents:
diff changeset
250 }
a61af66fc99e Initial load
duke
parents:
diff changeset
251
a61af66fc99e Initial load
duke
parents:
diff changeset
252 void JVM_end_signal_setting() {
a61af66fc99e Initial load
duke
parents:
diff changeset
253 signal_lock();
a61af66fc99e Initial load
duke
parents:
diff changeset
254 jvm_signal_installed = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
255 jvm_signal_installing = false;
a61af66fc99e Initial load
duke
parents:
diff changeset
256 cond_broadcast(&cond);
a61af66fc99e Initial load
duke
parents:
diff changeset
257 signal_unlock();
a61af66fc99e Initial load
duke
parents:
diff changeset
258 }
a61af66fc99e Initial load
duke
parents:
diff changeset
259
a61af66fc99e Initial load
duke
parents:
diff changeset
260 struct sigaction *JVM_get_signal_action(int sig) {
a61af66fc99e Initial load
duke
parents:
diff changeset
261 if (sact == NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
262 allocate_sact();
a61af66fc99e Initial load
duke
parents:
diff changeset
263 }
a61af66fc99e Initial load
duke
parents:
diff changeset
264 /* Does race condition make sense here? */
a61af66fc99e Initial load
duke
parents:
diff changeset
265 if (sigismember(&jvmsigs, sig)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
266 return &sact[sig];
a61af66fc99e Initial load
duke
parents:
diff changeset
267 }
a61af66fc99e Initial load
duke
parents:
diff changeset
268 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
269 }
a61af66fc99e Initial load
duke
parents:
diff changeset
270
a61af66fc99e Initial load
duke
parents:
diff changeset
271 int JVM_get_libjsig_version() {
a61af66fc99e Initial load
duke
parents:
diff changeset
272 return JSIG_VERSION_1_4_1;
a61af66fc99e Initial load
duke
parents:
diff changeset
273 }