8129526: Solaris: clean up another remnant of interruptible I/O

Reviewed-by: fparain, dcubed
This commit is contained in:
David Holmes 2015-10-30 00:23:07 -04:00
parent 1bdb2e37b2
commit fee39c63e6
15 changed files with 18 additions and 102 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -48,7 +48,6 @@ JVM_ENTRY_NO_ENV(void*, JVM_RegisterSignal(jint sig, void* handler))
: handler;
switch (sig) {
/* The following are already used by the VM. */
case INTERRUPT_SIGNAL:
case SIGFPE:
case SIGILL:
case SIGSEGV:

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -113,7 +113,6 @@
/* Signal definitions */
#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */
#define INTERRUPT_SIGNAL SIGUSR1 /* Interruptible I/O support. */
#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */
#define SHUTDOWN2_SIGNAL SIGINT
#define SHUTDOWN3_SIGNAL SIGTERM

View file

@ -1690,7 +1690,6 @@ void os::print_signal_handlers(outputStream* st, char* buf, size_t buflen) {
print_signal_handler(st, SIGPIPE, buf, buflen);
print_signal_handler(st, SIGXFSZ, buf, buflen);
print_signal_handler(st, SIGILL , buf, buflen);
print_signal_handler(st, INTERRUPT_SIGNAL, buf, buflen);
print_signal_handler(st, SR_signum, buf, buflen);
print_signal_handler(st, SHUTDOWN1_SIGNAL, buf, buflen);
print_signal_handler(st, SHUTDOWN2_SIGNAL , buf, buflen);
@ -3309,7 +3308,6 @@ void os::run_periodic_checks() {
}
DO_SIGNAL_CHECK(SR_signum);
DO_SIGNAL_CHECK(INTERRUPT_SIGNAL);
}
typedef int (*os_sigaction_t)(int, const struct sigaction *, struct sigaction *);
@ -3351,10 +3349,6 @@ void os::Aix::check_signal_handler(int sig) {
jvmHandler = (address)user_handler();
break;
case INTERRUPT_SIGNAL:
jvmHandler = CAST_FROM_FN_PTR(address, SIG_DFL);
break;
default:
if (sig == SR_signum) {
jvmHandler = CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler);
@ -3965,9 +3959,6 @@ int os::available(int fd, jlong *bytes) {
if (::fstat64(fd, &buf64) >= 0) {
mode = buf64.st_mode;
if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
// XXX: is the following call interruptible? If so, this might
// need to go through the INTERRUPT_IO() wrapper as for other
// blocking, interruptible calls in this file.
int n;
if (::ioctl(fd, FIONREAD, &n) >= 0) {
*bytes = n;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,6 @@ JVM_ENTRY_NO_ENV(void*, JVM_RegisterSignal(jint sig, void* handler))
: handler;
switch (sig) {
/* The following are already used by the VM. */
case INTERRUPT_SIGNAL:
case SIGFPE:
case SIGILL:
case SIGSEGV:

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -107,7 +107,6 @@
/* Signal definitions */
#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */
#define INTERRUPT_SIGNAL SIGUSR1 /* Interruptible I/O support. */
#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */
#define SHUTDOWN2_SIGNAL SIGINT
#define SHUTDOWN3_SIGNAL SIGTERM

View file

@ -1777,7 +1777,6 @@ void os::print_signal_handlers(outputStream* st, char* buf, size_t buflen) {
print_signal_handler(st, SIGPIPE, buf, buflen);
print_signal_handler(st, SIGXFSZ, buf, buflen);
print_signal_handler(st, SIGILL , buf, buflen);
print_signal_handler(st, INTERRUPT_SIGNAL, buf, buflen);
print_signal_handler(st, SR_signum, buf, buflen);
print_signal_handler(st, SHUTDOWN1_SIGNAL, buf, buflen);
print_signal_handler(st, SHUTDOWN2_SIGNAL , buf, buflen);
@ -3345,7 +3344,6 @@ void os::run_periodic_checks() {
}
DO_SIGNAL_CHECK(SR_signum);
DO_SIGNAL_CHECK(INTERRUPT_SIGNAL);
}
typedef int (*os_sigaction_t)(int, const struct sigaction *, struct sigaction *);
@ -3391,10 +3389,6 @@ void os::Bsd::check_signal_handler(int sig) {
jvmHandler = (address)user_handler();
break;
case INTERRUPT_SIGNAL:
jvmHandler = CAST_FROM_FN_PTR(address, SIG_DFL);
break;
default:
if (sig == SR_signum) {
jvmHandler = CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler);
@ -3913,9 +3907,6 @@ int os::available(int fd, jlong *bytes) {
if (::fstat(fd, &buf) >= 0) {
mode = buf.st_mode;
if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
// XXX: is the following call interruptible? If so, this might
// need to go through the INTERRUPT_IO() wrapper as for other
// blocking, interruptible calls in this file.
int n;
if (::ioctl(fd, FIONREAD, &n) >= 0) {
*bytes = n;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,6 @@ JVM_ENTRY_NO_ENV(void*, JVM_RegisterSignal(jint sig, void* handler))
: handler;
switch (sig) {
/* The following are already used by the VM. */
case INTERRUPT_SIGNAL:
case SIGFPE:
case SIGILL:
case SIGSEGV:

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -88,7 +88,6 @@
/* Signal definitions */
#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */
#define INTERRUPT_SIGNAL SIGUSR1 /* Interruptible I/O support. */
#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */
#define SHUTDOWN2_SIGNAL SIGINT
#define SHUTDOWN3_SIGNAL SIGTERM

View file

@ -2302,7 +2302,6 @@ void os::print_signal_handlers(outputStream* st, char* buf, size_t buflen) {
print_signal_handler(st, SIGPIPE, buf, buflen);
print_signal_handler(st, SIGXFSZ, buf, buflen);
print_signal_handler(st, SIGILL , buf, buflen);
print_signal_handler(st, INTERRUPT_SIGNAL, buf, buflen);
print_signal_handler(st, SR_signum, buf, buflen);
print_signal_handler(st, SHUTDOWN1_SIGNAL, buf, buflen);
print_signal_handler(st, SHUTDOWN2_SIGNAL , buf, buflen);
@ -4496,7 +4495,6 @@ void os::run_periodic_checks() {
}
DO_SIGNAL_CHECK(SR_signum);
DO_SIGNAL_CHECK(INTERRUPT_SIGNAL);
}
typedef int (*os_sigaction_t)(int, const struct sigaction *, struct sigaction *);
@ -4542,10 +4540,6 @@ void os::Linux::check_signal_handler(int sig) {
jvmHandler = (address)user_handler();
break;
case INTERRUPT_SIGNAL:
jvmHandler = CAST_FROM_FN_PTR(address, SIG_DFL);
break;
default:
if (sig == SR_signum) {
jvmHandler = CAST_FROM_FN_PTR(address, (sa_sigaction_t)SR_handler);
@ -5130,9 +5124,6 @@ int os::available(int fd, jlong *bytes) {
if (::fstat64(fd, &buf64) >= 0) {
mode = buf64.st_mode;
if (S_ISCHR(mode) || S_ISFIFO(mode) || S_ISSOCK(mode)) {
// XXX: is the following call interruptible? If so, this might
// need to go through the INTERRUPT_IO() wrapper as for other
// blocking, interruptible calls in this file.
int n;
if (::ioctl(fd, FIONREAD, &n) >= 0) {
*bytes = n;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -73,11 +73,6 @@ JVM_ENTRY_NO_ENV(void*, JVM_RegisterSignal(jint sig, void* handler))
if (os::Solaris::is_sig_ignored(sig)) return (void*)1;
}
/* Check parameterized signals. Don't allow sharing of our interrupt signal */
if (sig == os::Solaris::SIGinterrupt()) {
return (void *)-1;
}
void* oldHandler = os::signal(sig, newHandler);
if (oldHandler == os::user_handler()) {
return (void *)2;

View file

@ -87,7 +87,6 @@
/* Signal definitions */
#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */
#define INTERRUPT_SIGNAL SIGUSR1 /* Interruptible I/O support. */
#define ASYNC_SIGNAL SIGUSR2 /* Watcher & async err support. */
#define SHUTDOWN1_SIGNAL SIGHUP /* Shutdown Hooks support. */
#define SHUTDOWN2_SIGNAL SIGINT
@ -95,8 +94,7 @@
/* alternative signals used with -XX:+UseAltSigs (or for backward
compatibility with 1.2, -Xusealtsigs) flag. Chosen to be
unlikely to conflict with applications embedding the vm */
#define ALT_INTERRUPT_SIGNAL (SIGRTMIN + SIGRTMAX)/2 /* alternate intio signal */
#define ALT_ASYNC_SIGNAL ALT_INTERRUPT_SIGNAL+1 /* alternate async signal */
#define ALT_ASYNC_SIGNAL (SIGRTMIN + SIGRTMAX)/2 /* alternate async signal */
/* With 1.4.1 libjsig added versioning: used in os_solaris.cpp and jsig.c */
#define JSIG_VERSION_1_4_1 0x30140100

View file

@ -1003,8 +1003,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
// 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, INTERRUPT_SIGNAL is SIGJVM1, ASYNC_SIGNAL is SIGJVM2
// and -XX:+UseAltSigs does nothing since these should have no conflict
// With SIGJVM1, SIGJVM2, ASYNC_SIGNAL is SIGJVM2 and -XX:+UseAltSigs does
// nothing since these should have no conflict. Previously INTERRUPT_SIGNAL
// was SIGJVM1.
//
#if !defined(SIGJVM1)
#define SIGJVM1 39
@ -1013,7 +1014,7 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
debug_only(static bool signal_sets_initialized = false);
static sigset_t unblocked_sigs, vm_sigs, allowdebug_blocked_sigs;
int os::Solaris::_SIGinterrupt = INTERRUPT_SIGNAL;
int os::Solaris::_SIGasync = ASYNC_SIGNAL;
bool os::Solaris::is_sig_ignored(int sig) {
@ -1058,17 +1059,13 @@ void os::Solaris::signal_sets_init() {
sigaddset(&unblocked_sigs, SIGFPE);
if (isJVM1available) {
os::Solaris::set_SIGinterrupt(SIGJVM1);
os::Solaris::set_SIGasync(SIGJVM2);
} else if (UseAltSigs) {
os::Solaris::set_SIGinterrupt(ALT_INTERRUPT_SIGNAL);
os::Solaris::set_SIGasync(ALT_ASYNC_SIGNAL);
} else {
os::Solaris::set_SIGinterrupt(INTERRUPT_SIGNAL);
os::Solaris::set_SIGasync(ASYNC_SIGNAL);
}
sigaddset(&unblocked_sigs, os::Solaris::SIGinterrupt());
sigaddset(&unblocked_sigs, os::Solaris::SIGasync());
if (!ReduceSignalUsage) {
@ -1939,8 +1936,6 @@ void os::print_siginfo(outputStream* st, void* siginfo) {
static int Maxsignum = 0;
static int *ourSigFlags = NULL;
extern "C" void sigINTRHandler(int, siginfo_t*, void*);
int os::Solaris::get_our_sigflags(int sig) {
assert(ourSigFlags!=NULL, "signal data structure not initialized");
assert(sig > 0 && sig < Maxsignum, "vm signal out of expected range");
@ -2005,8 +2000,7 @@ static void print_signal_handler(outputStream* st, int sig,
os::Posix::print_sa_flags(st, sa.sa_flags);
// Check: is it our handler?
if (handler == CAST_FROM_FN_PTR(address, signalHandler) ||
handler == CAST_FROM_FN_PTR(address, sigINTRHandler)) {
if (handler == CAST_FROM_FN_PTR(address, signalHandler)) {
// It is our signal handler
// check for flags
if (sa.sa_flags != os::Solaris::get_our_sigflags(sig)) {
@ -2026,13 +2020,11 @@ void os::print_signal_handlers(outputStream* st, char* buf, size_t buflen) {
print_signal_handler(st, SIGPIPE, buf, buflen);
print_signal_handler(st, SIGXFSZ, buf, buflen);
print_signal_handler(st, SIGILL , buf, buflen);
print_signal_handler(st, INTERRUPT_SIGNAL, buf, buflen);
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::SIGinterrupt(), buf, buflen);
print_signal_handler(st, os::Solaris::SIGasync(), buf, buflen);
}
@ -3796,7 +3788,6 @@ void os::os_exception_wrapper(java_call_t f, JavaValue* value,
// SIGBUS, SIGSEGV, SIGILL, SIGFPE, BREAK_SIGNAL, SIGPIPE, SIGXFSZ,
// os::Solaris::SIGasync
// It should be consulted by handlers for any of those signals.
// It explicitly does not recognize os::Solaris::SIGinterrupt
//
// 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")
@ -3818,20 +3809,6 @@ void signalHandler(int sig, siginfo_t* info, void* ucVoid) {
errno = orig_errno;
}
// Do not delete - if guarantee is ever removed, a signal handler (even empty)
// is needed to provoke threads blocked on IO to return an EINTR
// Note: this explicitly does NOT call JVM_handle_solaris_signal and
// does NOT participate in signal chaining due to requirement for
// NOT setting SA_RESTART to make EINTR work.
extern "C" void sigINTRHandler(int sig, siginfo_t* info, void* ucVoid) {
if (UseSignalChaining) {
struct sigaction *actp = os::Solaris::get_chained_signal_action(sig);
if (actp && actp->sa_handler) {
vm_exit_during_initialization("Signal chaining detected for VM interrupt signal, try -XX:+UseAltSigs");
}
}
}
// This boolean allows users to forward their own non-matching signals
// to JVM_handle_solaris_signal, harmlessly.
bool os::Solaris::signal_handlers_are_installed = false;
@ -3969,13 +3946,6 @@ void os::Solaris::set_signal_handler(int sig, bool set_installed,
// not using stack banging
if (!UseStackBanging && sig == SIGSEGV) {
sigAct.sa_flags = SA_SIGINFO | SA_RESTART | SA_ONSTACK;
} else if (sig == os::Solaris::SIGinterrupt()) {
// Interruptible i/o requires SA_RESTART cleared so EINTR
// is returned instead of restarting system calls
sigemptyset(&sigAct.sa_mask);
sigAct.sa_handler = NULL;
sigAct.sa_flags = SA_SIGINFO;
sigAct.sa_sigaction = sigINTRHandler;
} else {
sigAct.sa_flags = SA_SIGINFO | SA_RESTART;
}
@ -4027,7 +3997,6 @@ void os::run_periodic_checks() {
}
// See comments above for using JVM1/JVM2 and UseAltSigs
DO_SIGNAL_CHECK(os::Solaris::SIGinterrupt());
DO_SIGNAL_CHECK(os::Solaris::SIGasync());
}
@ -4072,12 +4041,9 @@ void os::Solaris::check_signal_handler(int sig) {
break;
default:
int intrsig = os::Solaris::SIGinterrupt();
int asynsig = os::Solaris::SIGasync();
if (sig == intrsig) {
jvmHandler = CAST_FROM_FN_PTR(address, sigINTRHandler);
} else if (sig == asynsig) {
if (sig == asynsig) {
jvmHandler = CAST_FROM_FN_PTR(address, signalHandler);
} else {
return;
@ -4148,8 +4114,7 @@ void os::Solaris::install_signal_handlers() {
set_signal_handler(SIGFPE, true, true);
if (os::Solaris::SIGinterrupt() > OLDMAXSIGNUM || os::Solaris::SIGasync() > OLDMAXSIGNUM) {
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) {
@ -4159,8 +4124,6 @@ void os::Solaris::install_signal_handlers() {
}
}
// Never ok to chain our SIGinterrupt
set_signal_handler(os::Solaris::SIGinterrupt(), true, false);
set_signal_handler(os::Solaris::SIGasync(), true, true);
if (libjsig_is_loaded && !libjsigdone) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -114,16 +114,13 @@ class Solaris {
static void save_preinstalled_handler(int, struct sigaction&);
static void check_signal_handler(int sig);
// For overridable signals
static int _SIGinterrupt; // user-overridable INTERRUPT_SIGNAL
static int _SIGasync; // user-overridable ASYNC_SIGNAL
static void set_SIGinterrupt(int newsig) { _SIGinterrupt = newsig; }
static void set_SIGasync(int newsig) { _SIGasync = newsig; }
public:
// Large Page Support--ISM.
static bool largepage_range(char* addr, size_t size);
static int SIGinterrupt() { return _SIGinterrupt; }
static int SIGasync() { return _SIGasync; }
static address handler_start, handler_end; // start and end pc of thr_sighndlrinfo

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -325,8 +325,6 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
}
}
guarantee(sig != os::Solaris::SIGinterrupt(), "Can not chain VM interrupt signal, try -XX:+UseAltSigs");
if (sig == os::Solaris::SIGasync()) {
if (thread || vmthread) {
OSThread::SR_handler(t, uc);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -382,8 +382,6 @@ JVM_handle_solaris_signal(int sig, siginfo_t* info, void* ucVoid,
}
}
guarantee(sig != os::Solaris::SIGinterrupt(), "Can not chain VM interrupt signal, try -XX:+UseAltSigs");
if (sig == os::Solaris::SIGasync()) {
if(thread || vmthread){
OSThread::SR_handler(t, uc);