Pretend to do something useful (just fill in oldsigaction with SIG_IGN and

zeroes) if the mapped signal number comes up zero.  Previously, sigaction1()
would return an error, confusing some linux apps trying to set handlers for
"all" signals.
This commit is contained in:
tv 2000-08-09 20:20:49 +00:00
parent 8df356a34f
commit 1d8f5f2ea3
2 changed files with 24 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_sigaction.c,v 1.19 2000/03/30 11:27:17 augustss Exp $ */
/* $NetBSD: linux_sigaction.c,v 1.20 2000/08/09 20:20:49 tv Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@ -91,10 +91,17 @@ linux_sys_sigaction(p, v, retval)
sig = SCARG(uap, signum);
if (sig < 0 || sig >= LINUX__NSIG)
return (EINVAL);
error = sigaction1(p, linux_to_native_sig[sig],
SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0);
if (error)
return (error);
if (sig > 0 && !linux_to_native_sig[sig]) {
/* Pretend that we did something useful for unknown signals. */
obsa.sa_handler = SIG_IGN;
sigemptyset(&obsa.sa_mask);
obsa.sa_flags = 0;
} else {
error = sigaction1(p, linux_to_native_sig[sig],
SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0);
if (error)
return (error);
}
if (SCARG(uap, osa)) {
native_to_linux_old_sigaction(&obsa, &olsa);
error = copyout(&olsa, SCARG(uap, osa), sizeof(olsa));

View File

@ -1,4 +1,4 @@
/* $NetBSD: linux_signal.c,v 1.28 2000/07/28 21:49:09 tron Exp $ */
/* $NetBSD: linux_signal.c,v 1.29 2000/08/09 20:20:49 tv Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@ -344,10 +344,17 @@ linux_sys_rt_sigaction(p, v, retval)
sig = SCARG(uap, signum);
if (sig < 0 || sig >= LINUX__NSIG)
return (EINVAL);
error = sigaction1(p, linux_to_native_sig[sig],
SCARG(uap, nsa) ? &nbsa : NULL, SCARG(uap, osa) ? &obsa : NULL);
if (error)
return (error);
if (sig > 0 && !linux_to_native_sig[sig]) {
/* Pretend that we did something useful for unknown signals. */
obsa.sa_handler = SIG_IGN;
sigemptyset(&obsa.sa_mask);
obsa.sa_flags = 0;
} else {
error = sigaction1(p, linux_to_native_sig[sig],
SCARG(uap, nsa) ? &nbsa : NULL, SCARG(uap, osa) ? &obsa : NULL);
if (error)
return (error);
}
if (SCARG(uap, osa)) {
native_to_linux_sigaction(&obsa, &olsa);
error = copyout(&olsa, SCARG(uap, osa), sizeof(olsa));