< prev index next >
src/hotspot/os/posix/os_posix.cpp
Print this page
*** 1904,1913 ****
--- 1904,1966 ----
to_abstime(abstime, millis_to_nanos(millis),
false /* not absolute */,
true /* use real-time clock */);
}
+ #ifndef SOLARIS
+ sigset_t sigs;
+ struct sigaction sigact[NSIG];
+ #else
+ static int *sigs = NULL;
+ static struct sigaction *sigact = NULL;
+ static int Maxsignum = 0;
+ #endif
+
+ struct sigaction* os::Posix::get_preinstalled_handler(int sig) {
+ #ifndef SOLARIS
+ if (sigismember(&sigs, sig)) {
+ return &sigact[sig];
+ }
+ #else
+ assert((sigact != (struct sigaction *)NULL) &&
+ (sigs != (int *)NULL), "signals not yet initialized");
+ if (sigs[sig] != 0) {
+ return &sigact[sig];
+ }
+ #endif
+ return NULL;
+ }
+
+ void os::Posix::save_preinstalled_handler(int sig, struct sigaction& oldAct) {
+ #ifndef SOLARIS
+ assert(sig > 0 && sig < NSIG, "vm signal out of expected range");
+ sigact[sig] = oldAct;
+ sigaddset(&sigs, sig);
+ #else
+ assert(sig > 0 && sig <= Maxsignum, "vm signal out of expected range");
+ assert((sigact != (struct sigaction *)NULL) &&
+ (sigs != (int *)NULL), "signals not yet initialized");
+ sigact[sig] = oldAct;
+ sigs[sig] = 1;
+ #endif
+ }
+
+ void os::Posix::init_sigs() {
+ #ifndef SOLARIS
+ sigemptyset(&sigs);
+ #else
+ Maxsignum = SIGRTMAX;
+ if (UseSignalChaining) {
+ sigact = (struct sigaction *)malloc(sizeof(struct sigaction)
+ * (Maxsignum + 1), mtInternal);
+ memset(sigact, 0, (sizeof(struct sigaction) * (Maxsignum + 1)));
+ sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1), mtInternal);
+ memset(sigs, 0, (sizeof(int) * (Maxsignum + 1)));
+ }
+ #endif
+ }
+
// Shared pthread_mutex/cond based PlatformEvent implementation.
// Not currently usable by Solaris.
#ifndef SOLARIS
< prev index next >