From 1d8f5f2ea3651e1c11ac5bb2256940cc7587ab0d Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 9 Aug 2000 20:20:49 +0000 Subject: [PATCH] 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. --- sys/compat/linux/common/linux_sigaction.c | 17 ++++++++++++----- sys/compat/linux/common/linux_signal.c | 17 ++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/sys/compat/linux/common/linux_sigaction.c b/sys/compat/linux/common/linux_sigaction.c index 4fc165a18b92..90148d96e816 100644 --- a/sys/compat/linux/common/linux_sigaction.c +++ b/sys/compat/linux/common/linux_sigaction.c @@ -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)); diff --git a/sys/compat/linux/common/linux_signal.c b/sys/compat/linux/common/linux_signal.c index 951627ef7dea..26233b35973b 100644 --- a/sys/compat/linux/common/linux_signal.c +++ b/sys/compat/linux/common/linux_signal.c @@ -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));