< prev index next >

src/os/solaris/vm/os_solaris.cpp

Print this page

        

@@ -1011,25 +1011,13 @@
 
   // The thread is returned suspended (in state INITIALIZED), and is started higher up in the call chain
   return true;
 }
 
-// defined for >= Solaris 10. This allows builds on earlier versions
-// of Solaris to take advantage of the newly reserved Solaris JVM signals.
-// With SIGJVM1, SIGJVM2, ASYNC_SIGNAL is SIGJVM2. Previously INTERRUPT_SIGNAL
-// was SIGJVM1.
-//
-#if !defined(SIGJVM1)
-  #define SIGJVM1 39
-  #define SIGJVM2 40
-#endif
-
 debug_only(static bool signal_sets_initialized = false);
 static sigset_t unblocked_sigs, vm_sigs, allowdebug_blocked_sigs;
 
-int os::Solaris::_SIGasync = ASYNC_SIGNAL;
-
 bool os::Solaris::is_sig_ignored(int sig) {
   struct sigaction oact;
   sigaction(sig, (struct sigaction*)NULL, &oact);
   void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*,  oact.sa_sigaction)
                                  : CAST_FROM_FN_PTR(void*,  oact.sa_handler);

@@ -1038,16 +1026,10 @@
   } else {
     return false;
   }
 }
 
-// Note: SIGRTMIN is a macro that calls sysconf() so it will
-// dynamically detect SIGRTMIN value for the system at runtime, not buildtime
-static bool isJVM1available() {
-  return SIGJVM1 < SIGRTMIN;
-}
-
 void os::Solaris::signal_sets_init() {
   // Should also have an assertion stating we are still single-threaded.
   assert(!signal_sets_initialized, "Already initialized");
   // Fill in signals that are necessarily unblocked for all threads in
   // the VM. Currently, we unblock the following signals:

@@ -1066,16 +1048,11 @@
   sigemptyset(&allowdebug_blocked_sigs);
   sigaddset(&unblocked_sigs, SIGILL);
   sigaddset(&unblocked_sigs, SIGSEGV);
   sigaddset(&unblocked_sigs, SIGBUS);
   sigaddset(&unblocked_sigs, SIGFPE);
-
-  // Always true on Solaris 10+
-  guarantee(isJVM1available(), "SIGJVM1/2 missing!");
-  os::Solaris::set_SIGasync(SIGJVM2);
-
-  sigaddset(&unblocked_sigs, os::Solaris::SIGasync());
+  sigaddset(&unblocked_sigs, ASYNC_SIGNAL);
 
   if (!ReduceSignalUsage) {
     if (!os::Solaris::is_sig_ignored(SHUTDOWN1_SIGNAL)) {
       sigaddset(&unblocked_sigs, SHUTDOWN1_SIGNAL);
       sigaddset(&allowdebug_blocked_sigs, SHUTDOWN1_SIGNAL);

@@ -1916,11 +1893,10 @@
   (void) check_addr0(st);
 }
 
 // Moved from whole group, because we need them here for diagnostic
 // prints.
-#define OLDMAXSIGNUM 32
 static int Maxsignum = 0;
 static int *ourSigFlags = NULL;
 
 int os::Solaris::get_our_sigflags(int sig) {
   assert(ourSigFlags!=NULL, "signal data structure not initialized");

@@ -2009,11 +1985,10 @@
   print_signal_handler(st, ASYNC_SIGNAL, buf, buflen);
   print_signal_handler(st, BREAK_SIGNAL, buf, buflen);
   print_signal_handler(st, SHUTDOWN1_SIGNAL , buf, buflen);
   print_signal_handler(st, SHUTDOWN2_SIGNAL , buf, buflen);
   print_signal_handler(st, SHUTDOWN3_SIGNAL, buf, buflen);
-  print_signal_handler(st, os::Solaris::SIGasync(), buf, buflen);
 }
 
 static char saved_jvm_path[MAXPATHLEN] = { 0 };
 
 // Find the full path to the current module, libjvm.so

@@ -2177,18 +2152,16 @@
 // The following code is moved from os.cpp for making this
 // code platform specific, which it is by its very nature.
 
 // a counter for each possible signal value
 static int Sigexit = 0;
-static int Maxlibjsigsigs;
 static jint *pending_signals = NULL;
 static int *preinstalled_sigs = NULL;
 static struct sigaction *chainedsigactions = NULL;
 static sema_t sig_sem;
 typedef int (*version_getting_t)();
 version_getting_t os::Solaris::get_libjsig_version = NULL;
-static int libjsigversion = NULL;
 
 int os::sigexitnum_pd() {
   assert(Sigexit > 0, "signal memory not yet initialized");
   return Sigexit;
 }

@@ -2197,12 +2170,10 @@
   // Initialize signal structures
   Maxsignum = SIGRTMAX;
   Sigexit = Maxsignum+1;
   assert(Maxsignum >0, "Unable to obtain max signal number");
 
-  Maxlibjsigsigs = Maxsignum;
-
   // pending_signals has one int per signal
   // The additional signal is for SIGEXIT - exit signal to signal_thread
   pending_signals = (jint *)os::malloc(sizeof(jint) * (Sigexit+1), mtInternal);
   memset(pending_signals, 0, (sizeof(jint) * (Sigexit+1)));
 

@@ -3562,11 +3533,11 @@
     if (state == os::SuspendResume::SR_SUSPENDED) {
       sigset_t suspend_set;  // signals for sigsuspend()
 
       // get current set of blocked signals and unblock resume signal
       pthread_sigmask(SIG_BLOCK, NULL, &suspend_set);
-      sigdelset(&suspend_set, os::Solaris::SIGasync());
+      sigdelset(&suspend_set, ASYNC_SIGNAL);
 
       sr_semaphore.signal();
       // wait here until we are resumed
       while (1) {
         sigsuspend(&suspend_set);

@@ -3617,11 +3588,11 @@
 
   return buf[0] == 'y' || buf[0] == 'Y';
 }
 
 static int sr_notify(OSThread* osthread) {
-  int status = thr_kill(osthread->thread_id(), os::Solaris::SIGasync());
+  int status = thr_kill(osthread->thread_id(), ASYNC_SIGNAL);
   assert_status(status == 0, status, "thr_kill");
   return status;
 }
 
 // "Randomly" selected value for how long we want to spin

@@ -3762,11 +3733,11 @@
 // a serious error if it tried to handle an exception (such as a null check
 // or breakpoint) that the VM was generating for its own correct operation.
 //
 // This routine may recognize any of the following kinds of signals:
 // SIGBUS, SIGSEGV, SIGILL, SIGFPE, BREAK_SIGNAL, SIGPIPE, SIGXFSZ,
-// os::Solaris::SIGasync
+// ASYNC_SIGNAL.
 // It should be consulted by handlers for any of those signals.
 //
 // The caller of this routine must pass in the three arguments supplied
 // to the function referred to in the "sa_sigaction" (not the "sa_handler")
 // field of the structure passed to sigaction().  This routine assumes that

@@ -3797,11 +3768,11 @@
 get_signal_t os::Solaris::get_signal_action = NULL;
 
 struct sigaction* os::Solaris::get_chained_signal_action(int sig) {
   struct sigaction *actp = NULL;
 
-  if ((libjsig_is_loaded)  && (sig <= Maxlibjsigsigs)) {
+  if ((libjsig_is_loaded)  && (sig <= Maxsignum)) {
     // Retrieve the old signal handler from libjsig
     actp = (*get_signal_action)(sig);
   }
   if (actp == NULL) {
     // Retrieve the preinstalled signal handler from jvm

@@ -3972,12 +3943,11 @@
     DO_SIGNAL_CHECK(SHUTDOWN2_SIGNAL);
     DO_SIGNAL_CHECK(SHUTDOWN3_SIGNAL);
     DO_SIGNAL_CHECK(BREAK_SIGNAL);
   }
 
-  // See comments above for using JVM1/JVM2
-  DO_SIGNAL_CHECK(os::Solaris::SIGasync());
+  DO_SIGNAL_CHECK(ASYNC_SIGNAL);
 
 }
 
 typedef int (*os_sigaction_t)(int, const struct sigaction *, struct sigaction *);
 

@@ -4006,10 +3976,11 @@
   case SIGBUS:
   case SIGFPE:
   case SIGPIPE:
   case SIGXFSZ:
   case SIGILL:
+  case ASYNC_SIGNAL:
     jvmHandler = CAST_FROM_FN_PTR(address, signalHandler);
     break;
 
   case SHUTDOWN1_SIGNAL:
   case SHUTDOWN2_SIGNAL:

@@ -4017,20 +3988,12 @@
   case BREAK_SIGNAL:
     jvmHandler = (address)user_handler();
     break;
 
   default:
-    int asynsig = os::Solaris::SIGasync();
-
-    if (sig == asynsig) {
-      jvmHandler = CAST_FROM_FN_PTR(address, signalHandler);
-    } else {
       return;
     }
-    break;
-  }
-
 
   if (thisHandler != jvmHandler) {
     tty->print("Warning: %s handler ", exception_name(sig, buf, O_BUFLEN));
     tty->print("expected:%s", get_signal_handler_name(jvmHandler, buf, O_BUFLEN));
     tty->print_cr("  found:%s", get_signal_handler_name(thisHandler, buf, O_BUFLEN));

@@ -4059,11 +4022,10 @@
   }
 
 }
 
 void os::Solaris::install_signal_handlers() {
-  bool libjsigdone = false;
   signal_handlers_are_installed = true;
 
   // signal-chaining
   typedef void (*signal_setting_t)();
   signal_setting_t begin_signal_setting = NULL;

@@ -4077,11 +4039,12 @@
                                        dlsym(RTLD_DEFAULT, "JVM_get_signal_action"));
     get_libjsig_version = CAST_TO_FN_PTR(version_getting_t,
                                          dlsym(RTLD_DEFAULT, "JVM_get_libjsig_version"));
     libjsig_is_loaded = true;
     if (os::Solaris::get_libjsig_version != NULL) {
-      libjsigversion =  (*os::Solaris::get_libjsig_version)();
+      int libjsigversion =  (*os::Solaris::get_libjsig_version)();
+      guarantee(libjsigversion == JSIG_VERSION_1_4_1, "libjsig version mismatch");
     }
     assert(UseSignalChaining, "should enable signal-chaining");
   }
   if (libjsig_is_loaded) {
     // Tell libjsig jvm is setting signal handlers

@@ -4092,25 +4055,13 @@
   set_signal_handler(SIGPIPE, true, true);
   set_signal_handler(SIGXFSZ, true, true);
   set_signal_handler(SIGBUS, true, true);
   set_signal_handler(SIGILL, true, true);
   set_signal_handler(SIGFPE, true, true);
+  set_signal_handler(ASYNC_SIGNAL, true, true);
 
-
-  if (os::Solaris::SIGasync() > OLDMAXSIGNUM) {
-    // Pre-1.4.1 Libjsig limited to signal chaining signals <= 32 so
-    // can not register overridable signals which might be > 32
-    if (libjsig_is_loaded && libjsigversion <= JSIG_VERSION_1_4_1) {
-      // Tell libjsig jvm has finished setting signal handlers
-      (*end_signal_setting)();
-      libjsigdone = true;
-    }
-  }
-
-  set_signal_handler(os::Solaris::SIGasync(), true, true);
-
-  if (libjsig_is_loaded && !libjsigdone) {
+  if (libjsig_is_loaded) {
     // Tell libjsig jvm finishes setting signal handlers
     (*end_signal_setting)();
   }
 
   // We don't activate signal checker if libjsig is in place, we trust ourselves

@@ -4406,14 +4357,10 @@
 
   Solaris::signal_sets_init();
   Solaris::init_signal_mem();
   Solaris::install_signal_handlers();
 
-  if (libjsigversion < JSIG_VERSION_1_4_1) {
-    Maxlibjsigsigs = OLDMAXSIGNUM;
-  }
-
   // initialize synchronization primitives to use either thread or
   // lwp synchronization (controlled by UseLWPSynchronization)
   Solaris::synchronization_init();
 
   if (MaxFDLimit) {
< prev index next >