1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
4576 int intrsig = os::Solaris::SIGinterrupt();
4577 int asynsig = os::Solaris::SIGasync();
4578
4579 if (sig == intrsig) {
4580 jvmHandler = CAST_FROM_FN_PTR(address, sigINTRHandler);
4581 } else if (sig == asynsig) {
4582 jvmHandler = CAST_FROM_FN_PTR(address, signalHandler);
4583 } else {
4584 return;
4585 }
4586 break;
4587 }
4588
4589
4590 if (thisHandler != jvmHandler) {
4591 tty->print("Warning: %s handler ", exception_name(sig, buf, O_BUFLEN));
4592 tty->print("expected:%s", get_signal_handler_name(jvmHandler, buf, O_BUFLEN));
4593 tty->print_cr(" found:%s", get_signal_handler_name(thisHandler, buf, O_BUFLEN));
4594 // No need to check this sig any longer
4595 sigaddset(&check_signal_done, sig);
4596 } else if(os::Solaris::get_our_sigflags(sig) != 0 && act.sa_flags != os::Solaris::get_our_sigflags(sig)) {
4597 tty->print("Warning: %s handler flags ", exception_name(sig, buf, O_BUFLEN));
4598 tty->print("expected:" PTR32_FORMAT, os::Solaris::get_our_sigflags(sig));
4599 tty->print_cr(" found:" PTR32_FORMAT, act.sa_flags);
4600 // No need to check this sig any longer
4601 sigaddset(&check_signal_done, sig);
4602 }
4603
4604 // Print all the signal handler state
4605 if (sigismember(&check_signal_done, sig)) {
4606 print_signal_handlers(tty, buf, O_BUFLEN);
4607 }
4608
4609 }
4610
4611 void os::Solaris::install_signal_handlers() {
4612 bool libjsigdone = false;
4613 signal_handlers_are_installed = true;
4614
4615 // signal-chaining
|
1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
4576 int intrsig = os::Solaris::SIGinterrupt();
4577 int asynsig = os::Solaris::SIGasync();
4578
4579 if (sig == intrsig) {
4580 jvmHandler = CAST_FROM_FN_PTR(address, sigINTRHandler);
4581 } else if (sig == asynsig) {
4582 jvmHandler = CAST_FROM_FN_PTR(address, signalHandler);
4583 } else {
4584 return;
4585 }
4586 break;
4587 }
4588
4589
4590 if (thisHandler != jvmHandler) {
4591 tty->print("Warning: %s handler ", exception_name(sig, buf, O_BUFLEN));
4592 tty->print("expected:%s", get_signal_handler_name(jvmHandler, buf, O_BUFLEN));
4593 tty->print_cr(" found:%s", get_signal_handler_name(thisHandler, buf, O_BUFLEN));
4594 // No need to check this sig any longer
4595 sigaddset(&check_signal_done, sig);
4596 // Running under non-interactive shell, SHUTDOWN2_SIGNAL will be reassigned SIG_IGN
4597 if (sig == SHUTDOWN2_SIGNAL && !isatty(fileno(stdin))) {
4598 tty->print_cr("Running in non-interactive shell, %s handler is replaced by shell",
4599 exception_name(sig, buf, O_BUFLEN));
4600 }
4601 } else if(os::Solaris::get_our_sigflags(sig) != 0 && act.sa_flags != os::Solaris::get_our_sigflags(sig)) {
4602 tty->print("Warning: %s handler flags ", exception_name(sig, buf, O_BUFLEN));
4603 tty->print("expected:" PTR32_FORMAT, os::Solaris::get_our_sigflags(sig));
4604 tty->print_cr(" found:" PTR32_FORMAT, act.sa_flags);
4605 // No need to check this sig any longer
4606 sigaddset(&check_signal_done, sig);
4607 }
4608
4609 // Print all the signal handler state
4610 if (sigismember(&check_signal_done, sig)) {
4611 print_signal_handlers(tty, buf, O_BUFLEN);
4612 }
4613
4614 }
4615
4616 void os::Solaris::install_signal_handlers() {
4617 bool libjsigdone = false;
4618 signal_handlers_are_installed = true;
4619
4620 // signal-chaining
|