--- old/src/hotspot/os/posix/os_posix.cpp 2019-03-05 18:14:47.106443463 +0800 +++ new/src/hotspot/os/posix/os_posix.cpp 2019-03-05 18:14:46.753991730 +0800 @@ -1644,6 +1644,24 @@ } } +#ifndef SOLARIS +sigset_t sigs; +struct sigaction sigact[NSIG]; + +struct sigaction* os::Posix::get_preinstalled_handler(int sig) { + if (sigismember(&sigs, sig)) { + return &sigact[sig]; + } + return NULL; +} + +void os::Posix::save_preinstalled_handler(int sig, struct sigaction& oldAct) { + assert(sig > 0 && sig < NSIG, "vm signal out of expected range"); + sigact[sig] = oldAct; + sigaddset(&sigs, sig); +} +#endif + // Not all POSIX types and API's are available on all notionally "posix" // platforms. If we have build-time support then we will check for actual // runtime support via dlopen/dlsym lookup. This allows for running on an @@ -1754,6 +1772,7 @@ (_pthread_condattr_setclock != NULL ? "" : " not")); log_info(os)("Relative timed-wait using pthread_cond_timedwait is associated with %s", _use_clock_monotonic_condattr ? "CLOCK_MONOTONIC" : "the default clock"); + sigemptyset(&sigs); #endif // !SOLARIS } @@ -1768,6 +1787,7 @@ log_info(os)("Use of CLOCK_MONOTONIC is not supported"); log_info(os)("Use of pthread_condattr_setclock is not supported"); log_info(os)("Relative timed-wait using pthread_cond_timedwait is associated with the default clock"); + sigemptyset(&sigs); #endif // !SOLARIS }