comparison src/os/linux/vm/jsig.c @ 11173:6b0fd0964b87

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 31 Jul 2013 11:00:54 +0200
parents 732af649bc3a
children
comparison
equal deleted inserted replaced
10912:4ea54634f03e 11173:6b0fd0964b87
1 /* 1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
105 sa_handler_t oldhandler; 105 sa_handler_t oldhandler;
106 bool sigused; 106 bool sigused;
107 107
108 signal_lock(); 108 signal_lock();
109 109
110 sigused = (MASK(sig) & jvmsigs) != 0; 110 sigused = (sig < MAXSIGNUM) && ((MASK(sig) & jvmsigs) != 0);
111 if (jvm_signal_installed && sigused) { 111 if (jvm_signal_installed && sigused) {
112 /* jvm has installed its signal handler for this signal. */ 112 /* jvm has installed its signal handler for this signal. */
113 /* Save the handler. Don't really install it. */ 113 /* Save the handler. Don't really install it. */
114 oldhandler = sact[sig].sa_handler; 114 oldhandler = sact[sig].sa_handler;
115 save_signal_handler(sig, disp); 115 save_signal_handler(sig, disp);
116 116
117 signal_unlock(); 117 signal_unlock();
118 return oldhandler; 118 return oldhandler;
119 } else if (jvm_signal_installing) { 119 } else if (sig < MAXSIGNUM && jvm_signal_installing) {
120 /* jvm is installing its signal handlers. Install the new 120 /* jvm is installing its signal handlers. Install the new
121 * handlers and save the old ones. jvm uses sigaction(). 121 * handlers and save the old ones. jvm uses sigaction().
122 * Leave the piece here just in case. */ 122 * Leave the piece here just in case. */
123 oldhandler = call_os_signal(sig, disp, is_sigset); 123 oldhandler = call_os_signal(sig, disp, is_sigset);
124 save_signal_handler(sig, oldhandler); 124 save_signal_handler(sig, oldhandler);
163 bool sigused; 163 bool sigused;
164 struct sigaction oldAct; 164 struct sigaction oldAct;
165 165
166 signal_lock(); 166 signal_lock();
167 167
168 sigused = (MASK(sig) & jvmsigs) != 0; 168 sigused = (sig < MAXSIGNUM) && ((MASK(sig) & jvmsigs) != 0);
169 if (jvm_signal_installed && sigused) { 169 if (jvm_signal_installed && sigused) {
170 /* jvm has installed its signal handler for this signal. */ 170 /* jvm has installed its signal handler for this signal. */
171 /* Save the handler. Don't really install it. */ 171 /* Save the handler. Don't really install it. */
172 if (oact != NULL) { 172 if (oact != NULL) {
173 *oact = sact[sig]; 173 *oact = sact[sig];
176 sact[sig] = *act; 176 sact[sig] = *act;
177 } 177 }
178 178
179 signal_unlock(); 179 signal_unlock();
180 return 0; 180 return 0;
181 } else if (jvm_signal_installing) { 181 } else if (sig < MAXSIGNUM && jvm_signal_installing) {
182 /* jvm is installing its signal handlers. Install the new 182 /* jvm is installing its signal handlers. Install the new
183 * handlers and save the old ones. */ 183 * handlers and save the old ones. */
184 res = call_os_sigaction(sig, act, &oldAct); 184 res = call_os_sigaction(sig, act, &oldAct);
185 sact[sig] = oldAct; 185 sact[sig] = oldAct;
186 if (oact != NULL) { 186 if (oact != NULL) {