< prev index next >

src/hotspot/os/aix/os_aix.cpp

Print this page




 605 #undef EXTENSIONS_DIR
 606 }
 607 
 608 ////////////////////////////////////////////////////////////////////////////////
 609 // breakpoint support
 610 
 611 void os::breakpoint() {
 612   BREAKPOINT;
 613 }
 614 
 615 extern "C" void breakpoint() {
 616   // use debugger to set breakpoint here
 617 }
 618 
 619 ////////////////////////////////////////////////////////////////////////////////
 620 // signal support
 621 
 622 debug_only(static bool signal_sets_initialized = false);
 623 static sigset_t unblocked_sigs, vm_sigs;
 624 
 625 bool os::Aix::is_sig_ignored(int sig) {
 626   struct sigaction oact;
 627   sigaction(sig, (struct sigaction*)NULL, &oact);
 628   void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction)
 629     : CAST_FROM_FN_PTR(void*, oact.sa_handler);
 630   if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) {
 631     return true;
 632   } else {
 633     return false;
 634   }
 635 }
 636 
 637 void os::Aix::signal_sets_init() {
 638   // Should also have an assertion stating we are still single-threaded.
 639   assert(!signal_sets_initialized, "Already initialized");
 640   // Fill in signals that are necessarily unblocked for all threads in
 641   // the VM. Currently, we unblock the following signals:
 642   // SHUTDOWN{1,2,3}_SIGNAL: for shutdown hooks support (unless over-ridden
 643   //                         by -Xrs (=ReduceSignalUsage));
 644   // BREAK_SIGNAL which is unblocked only by the VM thread and blocked by all
 645   // other threads. The "ReduceSignalUsage" boolean tells us not to alter
 646   // the dispositions or masks wrt these signals.
 647   // Programs embedding the VM that want to use the above signals for their
 648   // own purposes must, at this time, use the "-Xrs" option to prevent
 649   // interference with shutdown hooks and BREAK_SIGNAL thread dumping.
 650   // (See bug 4345157, and other related bugs).
 651   // In reality, though, unblocking these signals is really a nop, since
 652   // these signals are not blocked by default.
 653   sigemptyset(&unblocked_sigs);
 654   sigaddset(&unblocked_sigs, SIGILL);
 655   sigaddset(&unblocked_sigs, SIGSEGV);
 656   sigaddset(&unblocked_sigs, SIGBUS);
 657   sigaddset(&unblocked_sigs, SIGFPE);
 658   sigaddset(&unblocked_sigs, SIGTRAP);
 659   sigaddset(&unblocked_sigs, SR_signum);
 660 
 661   if (!ReduceSignalUsage) {
 662    if (!os::Aix::is_sig_ignored(SHUTDOWN1_SIGNAL)) {
 663      sigaddset(&unblocked_sigs, SHUTDOWN1_SIGNAL);
 664    }
 665    if (!os::Aix::is_sig_ignored(SHUTDOWN2_SIGNAL)) {
 666      sigaddset(&unblocked_sigs, SHUTDOWN2_SIGNAL);
 667    }
 668    if (!os::Aix::is_sig_ignored(SHUTDOWN3_SIGNAL)) {
 669      sigaddset(&unblocked_sigs, SHUTDOWN3_SIGNAL);
 670    }
 671   }
 672   // Fill in signals that are blocked by all but the VM thread.
 673   sigemptyset(&vm_sigs);
 674   if (!ReduceSignalUsage)
 675     sigaddset(&vm_sigs, BREAK_SIGNAL);
 676   debug_only(signal_sets_initialized = true);
 677 }
 678 
 679 // These are signals that are unblocked while a thread is running Java.
 680 // (For some reason, they get blocked by default.)
 681 sigset_t* os::Aix::unblocked_signals() {
 682   assert(signal_sets_initialized, "Not initialized");
 683   return &unblocked_sigs;
 684 }
 685 
 686 // These are the signals that are blocked while a (non-VM) thread is
 687 // running Java. Only the VM thread handles these signals.
 688 sigset_t* os::Aix::vm_signals() {




 605 #undef EXTENSIONS_DIR
 606 }
 607 
 608 ////////////////////////////////////////////////////////////////////////////////
 609 // breakpoint support
 610 
 611 void os::breakpoint() {
 612   BREAKPOINT;
 613 }
 614 
 615 extern "C" void breakpoint() {
 616   // use debugger to set breakpoint here
 617 }
 618 
 619 ////////////////////////////////////////////////////////////////////////////////
 620 // signal support
 621 
 622 debug_only(static bool signal_sets_initialized = false);
 623 static sigset_t unblocked_sigs, vm_sigs;
 624 












 625 void os::Aix::signal_sets_init() {
 626   // Should also have an assertion stating we are still single-threaded.
 627   assert(!signal_sets_initialized, "Already initialized");
 628   // Fill in signals that are necessarily unblocked for all threads in
 629   // the VM. Currently, we unblock the following signals:
 630   // SHUTDOWN{1,2,3}_SIGNAL: for shutdown hooks support (unless over-ridden
 631   //                         by -Xrs (=ReduceSignalUsage));
 632   // BREAK_SIGNAL which is unblocked only by the VM thread and blocked by all
 633   // other threads. The "ReduceSignalUsage" boolean tells us not to alter
 634   // the dispositions or masks wrt these signals.
 635   // Programs embedding the VM that want to use the above signals for their
 636   // own purposes must, at this time, use the "-Xrs" option to prevent
 637   // interference with shutdown hooks and BREAK_SIGNAL thread dumping.
 638   // (See bug 4345157, and other related bugs).
 639   // In reality, though, unblocking these signals is really a nop, since
 640   // these signals are not blocked by default.
 641   sigemptyset(&unblocked_sigs);
 642   sigaddset(&unblocked_sigs, SIGILL);
 643   sigaddset(&unblocked_sigs, SIGSEGV);
 644   sigaddset(&unblocked_sigs, SIGBUS);
 645   sigaddset(&unblocked_sigs, SIGFPE);
 646   sigaddset(&unblocked_sigs, SIGTRAP);
 647   sigaddset(&unblocked_sigs, SR_signum);
 648 
 649   if (!ReduceSignalUsage) {
 650    if (!os::Posix::is_sig_ignored(SHUTDOWN1_SIGNAL)) {
 651      sigaddset(&unblocked_sigs, SHUTDOWN1_SIGNAL);
 652    }
 653    if (!os::Posix::is_sig_ignored(SHUTDOWN2_SIGNAL)) {
 654      sigaddset(&unblocked_sigs, SHUTDOWN2_SIGNAL);
 655    }
 656    if (!os::Posix::is_sig_ignored(SHUTDOWN3_SIGNAL)) {
 657      sigaddset(&unblocked_sigs, SHUTDOWN3_SIGNAL);
 658    }
 659   }
 660   // Fill in signals that are blocked by all but the VM thread.
 661   sigemptyset(&vm_sigs);
 662   if (!ReduceSignalUsage)
 663     sigaddset(&vm_sigs, BREAK_SIGNAL);
 664   debug_only(signal_sets_initialized = true);
 665 }
 666 
 667 // These are signals that are unblocked while a thread is running Java.
 668 // (For some reason, they get blocked by default.)
 669 sigset_t* os::Aix::unblocked_signals() {
 670   assert(signal_sets_initialized, "Not initialized");
 671   return &unblocked_sigs;
 672 }
 673 
 674 // These are the signals that are blocked while a (non-VM) thread is
 675 // running Java. Only the VM thread handles these signals.
 676 sigset_t* os::Aix::vm_signals() {


< prev index next >