1998-09-29 18:15:49 +04:00
|
|
|
/* $NetBSD: linux_sigaction.c,v 1.13 1998/09/29 14:15:49 tv Exp $ */
|
1995-03-01 02:24:35 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1995 Frank van der Linden
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed for the NetBSD Project
|
|
|
|
* by Frank van der Linden
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* heavily from: svr4_signal.c,v 1.7 1995/01/09 01:04:21 christos Exp
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/namei.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/filedesc.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/signal.h>
|
|
|
|
#include <sys/signalvar.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
|
|
|
|
#include <sys/syscallargs.h>
|
|
|
|
|
|
|
|
#include <compat/linux/linux_types.h>
|
1995-08-14 05:11:52 +04:00
|
|
|
#include <compat/linux/linux_signal.h>
|
1995-03-01 02:24:35 +03:00
|
|
|
#include <compat/linux/linux_syscallargs.h>
|
|
|
|
#include <compat/linux/linux_util.h>
|
|
|
|
|
1995-08-14 02:55:28 +04:00
|
|
|
#define linux_sigmask(n) (1 << ((n) - 1))
|
1998-08-10 00:36:58 +04:00
|
|
|
#define linux_sigemptyset(s) memset((s), 0, sizeof(*(s)))
|
1995-08-14 02:55:28 +04:00
|
|
|
#define linux_sigismember(s, n) (*(s) & linux_sigmask(n))
|
|
|
|
#define linux_sigaddset(s, n) (*(s) |= linux_sigmask(n))
|
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
int native_to_linux_sig[NSIG] = {
|
1995-08-14 02:55:28 +04:00
|
|
|
0,
|
|
|
|
LINUX_SIGHUP,
|
|
|
|
LINUX_SIGINT,
|
|
|
|
LINUX_SIGQUIT,
|
|
|
|
LINUX_SIGILL,
|
|
|
|
LINUX_SIGTRAP,
|
|
|
|
LINUX_SIGABRT,
|
1998-09-11 16:50:05 +04:00
|
|
|
0, /* SIGEMT */
|
1995-08-14 02:55:28 +04:00
|
|
|
LINUX_SIGFPE,
|
|
|
|
LINUX_SIGKILL,
|
|
|
|
LINUX_SIGBUS,
|
|
|
|
LINUX_SIGSEGV,
|
1998-09-11 16:50:05 +04:00
|
|
|
0, /* SIGSEGV */
|
1995-08-14 02:55:28 +04:00
|
|
|
LINUX_SIGPIPE,
|
|
|
|
LINUX_SIGALRM,
|
|
|
|
LINUX_SIGTERM,
|
|
|
|
LINUX_SIGURG,
|
|
|
|
LINUX_SIGSTOP,
|
|
|
|
LINUX_SIGTSTP,
|
|
|
|
LINUX_SIGCONT,
|
|
|
|
LINUX_SIGCHLD,
|
|
|
|
LINUX_SIGTTIN,
|
|
|
|
LINUX_SIGTTOU,
|
|
|
|
LINUX_SIGIO,
|
|
|
|
LINUX_SIGXCPU,
|
|
|
|
LINUX_SIGXFSZ,
|
|
|
|
LINUX_SIGVTALRM,
|
|
|
|
LINUX_SIGPROF,
|
|
|
|
LINUX_SIGWINCH,
|
1998-09-11 16:50:05 +04:00
|
|
|
0, /* SIGINFO */
|
1995-08-14 02:55:28 +04:00
|
|
|
LINUX_SIGUSR1,
|
|
|
|
LINUX_SIGUSR2,
|
1998-09-11 16:50:05 +04:00
|
|
|
LINUX_SIGPWR,
|
1995-08-14 02:55:28 +04:00
|
|
|
};
|
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
int linux_to_native_sig[LINUX_NSIG] = {
|
1995-08-14 02:55:28 +04:00
|
|
|
0,
|
|
|
|
SIGHUP,
|
|
|
|
SIGINT,
|
|
|
|
SIGQUIT,
|
|
|
|
SIGILL,
|
|
|
|
SIGTRAP,
|
|
|
|
SIGABRT,
|
|
|
|
SIGBUS,
|
|
|
|
SIGFPE,
|
|
|
|
SIGKILL,
|
|
|
|
SIGUSR1,
|
|
|
|
SIGSEGV,
|
|
|
|
SIGUSR2,
|
|
|
|
SIGPIPE,
|
|
|
|
SIGALRM,
|
|
|
|
SIGTERM,
|
1998-09-11 16:50:05 +04:00
|
|
|
0, /* SIGSTKFLT */
|
1995-08-14 02:55:28 +04:00
|
|
|
SIGCHLD,
|
|
|
|
SIGCONT,
|
|
|
|
SIGSTOP,
|
|
|
|
SIGTSTP,
|
|
|
|
SIGTTIN,
|
|
|
|
SIGTTOU,
|
|
|
|
SIGURG,
|
|
|
|
SIGXCPU,
|
|
|
|
SIGXFSZ,
|
|
|
|
SIGVTALRM,
|
|
|
|
SIGPROF,
|
|
|
|
SIGWINCH,
|
|
|
|
SIGIO,
|
1998-09-11 16:50:05 +04:00
|
|
|
SIGPWR,
|
|
|
|
0, /* SIGUNUSED */
|
1995-08-14 02:55:28 +04:00
|
|
|
};
|
1995-03-01 02:24:35 +03:00
|
|
|
|
1996-04-05 03:51:36 +04:00
|
|
|
/* linux_signal.c */
|
1998-09-11 16:50:05 +04:00
|
|
|
void linux_to_native_sigaction __P((struct linux_sigaction *, struct sigaction *));
|
|
|
|
void native_to_linux_sigaction __P((struct sigaction *, struct linux_sigaction *));
|
1996-04-05 03:51:36 +04:00
|
|
|
|
1995-08-14 02:55:28 +04:00
|
|
|
void
|
1998-09-11 16:50:05 +04:00
|
|
|
linux_to_native_sigset(lss, bss)
|
1995-03-01 02:24:35 +03:00
|
|
|
const linux_sigset_t *lss;
|
|
|
|
sigset_t *bss;
|
|
|
|
{
|
|
|
|
int i, newsig;
|
|
|
|
|
1995-08-14 02:55:28 +04:00
|
|
|
sigemptyset(bss);
|
|
|
|
for (i = 1; i < LINUX_NSIG; i++) {
|
|
|
|
if (linux_sigismember(lss, i)) {
|
1998-09-11 16:50:05 +04:00
|
|
|
newsig = linux_to_native_sig[i];
|
1995-03-01 02:24:35 +03:00
|
|
|
if (newsig)
|
1995-08-14 02:55:28 +04:00
|
|
|
sigaddset(bss, newsig);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-09-11 16:50:05 +04:00
|
|
|
native_to_linux_sigset(bss, lss)
|
1995-03-01 02:24:35 +03:00
|
|
|
const sigset_t *bss;
|
|
|
|
linux_sigset_t *lss;
|
|
|
|
{
|
|
|
|
int i, newsig;
|
|
|
|
|
1995-08-14 02:55:28 +04:00
|
|
|
linux_sigemptyset(lss);
|
|
|
|
for (i = 1; i < NSIG; i++) {
|
|
|
|
if (sigismember(bss, i)) {
|
1998-09-11 16:50:05 +04:00
|
|
|
newsig = native_to_linux_sig[i];
|
1995-03-01 02:24:35 +03:00
|
|
|
if (newsig)
|
1995-08-14 02:55:28 +04:00
|
|
|
linux_sigaddset(lss, newsig);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Convert between Linux and BSD sigaction structures. Linux has
|
1995-08-14 02:55:28 +04:00
|
|
|
* one extra field (sa_restorer) which we don't support.
|
1995-03-01 02:24:35 +03:00
|
|
|
*/
|
|
|
|
void
|
1998-09-11 16:50:05 +04:00
|
|
|
linux_to_native_sigaction(lsa, bsa)
|
1995-03-01 02:24:35 +03:00
|
|
|
struct linux_sigaction *lsa;
|
|
|
|
struct sigaction *bsa;
|
|
|
|
{
|
1995-08-14 02:55:28 +04:00
|
|
|
|
1995-03-01 02:24:35 +03:00
|
|
|
bsa->sa_handler = lsa->sa_handler;
|
1998-09-11 16:50:05 +04:00
|
|
|
linux_to_native_sigset(&lsa->sa_mask, &bsa->sa_mask);
|
1995-03-01 02:24:35 +03:00
|
|
|
bsa->sa_flags = 0;
|
1998-09-11 16:50:05 +04:00
|
|
|
if ((lsa->sa_flags & LINUX_SA_NOCLDSTOP) != 0)
|
|
|
|
bsa->sa_flags |= SA_NOCLDSTOP;
|
1995-08-14 02:55:28 +04:00
|
|
|
if ((lsa->sa_flags & LINUX_SA_ONSTACK) != 0)
|
|
|
|
bsa->sa_flags |= SA_ONSTACK;
|
|
|
|
if ((lsa->sa_flags & LINUX_SA_RESTART) != 0)
|
|
|
|
bsa->sa_flags |= SA_RESTART;
|
|
|
|
if ((lsa->sa_flags & LINUX_SA_ONESHOT) != 0)
|
|
|
|
bsa->sa_flags |= SA_RESETHAND;
|
|
|
|
if ((lsa->sa_flags & LINUX_SA_NOMASK) != 0)
|
|
|
|
bsa->sa_flags |= SA_NODEFER;
|
1998-09-29 18:15:49 +04:00
|
|
|
#ifdef DEBUG
|
1998-09-11 16:50:05 +04:00
|
|
|
if ((lsa->sa_flags & ~LINUX_SA_ALLBITS) != 0)
|
|
|
|
/*XXX*/ printf("linux_to_native_sigaction: extra bits ignored\n");
|
|
|
|
if (lsa->sa_restorer != 0)
|
|
|
|
/*XXX*/ printf("linux_to_native_sigaction: sa_restorer ignored\n");
|
1998-09-29 18:15:49 +04:00
|
|
|
#endif
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1998-09-11 16:50:05 +04:00
|
|
|
native_to_linux_sigaction(bsa, lsa)
|
1995-03-01 02:24:35 +03:00
|
|
|
struct sigaction *bsa;
|
|
|
|
struct linux_sigaction *lsa;
|
|
|
|
{
|
1995-08-14 02:55:28 +04:00
|
|
|
|
1995-03-01 02:24:35 +03:00
|
|
|
lsa->sa_handler = bsa->sa_handler;
|
1998-09-11 16:50:05 +04:00
|
|
|
native_to_linux_sigset(&bsa->sa_mask, &lsa->sa_mask);
|
1995-03-01 02:24:35 +03:00
|
|
|
lsa->sa_flags = 0;
|
1995-08-14 02:55:28 +04:00
|
|
|
if ((bsa->sa_flags & SA_NOCLDSTOP) != 0)
|
|
|
|
lsa->sa_flags |= LINUX_SA_NOCLDSTOP;
|
|
|
|
if ((bsa->sa_flags & SA_ONSTACK) != 0)
|
|
|
|
lsa->sa_flags |= LINUX_SA_ONSTACK;
|
|
|
|
if ((bsa->sa_flags & SA_RESTART) != 0)
|
|
|
|
lsa->sa_flags |= LINUX_SA_RESTART;
|
|
|
|
if ((bsa->sa_flags & SA_NODEFER) != 0)
|
|
|
|
lsa->sa_flags |= LINUX_SA_NOMASK;
|
|
|
|
if ((bsa->sa_flags & SA_RESETHAND) != 0)
|
|
|
|
lsa->sa_flags |= LINUX_SA_ONESHOT;
|
1995-03-01 02:24:35 +03:00
|
|
|
lsa->sa_restorer = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The Linux sigaction() system call. Do the usual conversions,
|
|
|
|
* and just call sigaction(). Some flags and values are silently
|
|
|
|
* ignored (see above).
|
|
|
|
*/
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_sigaction(p, v, retval)
|
1995-03-01 02:24:35 +03:00
|
|
|
register struct proc *p;
|
1995-09-20 02:37:27 +04:00
|
|
|
void *v;
|
|
|
|
register_t *retval;
|
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct linux_sys_sigaction_args /* {
|
1995-03-01 02:24:35 +03:00
|
|
|
syscallarg(int) signum;
|
1998-09-11 16:50:05 +04:00
|
|
|
syscallarg(const struct linux_sigaction *) nsa;
|
1995-03-01 02:24:35 +03:00
|
|
|
syscallarg(struct linux_sigaction *) osa;
|
1995-09-20 02:37:27 +04:00
|
|
|
} */ *uap = v;
|
1998-09-11 16:50:05 +04:00
|
|
|
struct linux_sigaction nlsa, olsa;
|
|
|
|
struct sigaction nbsa, obsa;
|
1995-03-01 02:24:35 +03:00
|
|
|
int error;
|
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
if (SCARG(uap, nsa)) {
|
|
|
|
error = copyin(SCARG(uap, nsa), &nlsa, sizeof(nlsa));
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
linux_to_native_sigaction(&nlsa, &nbsa);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
1998-09-11 16:50:05 +04:00
|
|
|
error = sigaction1(p, linux_to_native_sig[SCARG(uap, signum)],
|
|
|
|
SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
if (SCARG(uap, osa)) {
|
|
|
|
native_to_linux_sigaction(&obsa, &olsa);
|
|
|
|
error = copyout(&olsa, SCARG(uap, osa), sizeof(olsa));
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
return (0);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The Linux signal() system call. I think that the signal() in the C
|
|
|
|
* library actually calls sigaction, so I doubt this one is ever used.
|
|
|
|
* But hey, it can't hurt having it here. The same restrictions as for
|
|
|
|
* sigaction() apply.
|
|
|
|
*/
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_signal(p, v, retval)
|
1995-03-01 02:24:35 +03:00
|
|
|
register struct proc *p;
|
1995-09-20 02:37:27 +04:00
|
|
|
void *v;
|
|
|
|
register_t *retval;
|
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct linux_sys_signal_args /* {
|
1995-03-01 02:24:35 +03:00
|
|
|
syscallarg(int) sig;
|
|
|
|
syscallarg(linux_handler_t) handler;
|
1995-09-20 02:37:27 +04:00
|
|
|
} */ *uap = v;
|
1998-09-11 16:50:05 +04:00
|
|
|
struct sigaction nbsa, obsa;
|
1995-03-01 02:24:35 +03:00
|
|
|
int error;
|
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
nbsa.sa_handler = SCARG(uap, handler);
|
|
|
|
sigemptyset(&nbsa.sa_mask);
|
|
|
|
nbsa.sa_flags = SA_RESETHAND | SA_NODEFER;
|
|
|
|
error = sigaction1(p, linux_to_native_sig[SCARG(uap, sig)],
|
|
|
|
&nbsa, &obsa);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
*retval = (int)obsa.sa_handler;
|
|
|
|
return (0);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_sigprocmask(p, v, retval)
|
1995-03-01 02:24:35 +03:00
|
|
|
register struct proc *p;
|
1995-09-20 02:37:27 +04:00
|
|
|
void *v;
|
|
|
|
register_t *retval;
|
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct linux_sys_sigprocmask_args /* {
|
1995-03-01 02:24:35 +03:00
|
|
|
syscallarg(int) how;
|
1998-09-11 16:50:05 +04:00
|
|
|
syscallarg(const linux_sigset_t *) set;
|
1995-08-14 02:55:28 +04:00
|
|
|
syscallarg(linux_sigset_t *) oset;
|
1995-09-20 02:37:27 +04:00
|
|
|
} */ *uap = v;
|
1998-09-11 16:50:05 +04:00
|
|
|
linux_sigset_t nlss, olss;
|
|
|
|
sigset_t nbss, obss;
|
|
|
|
int how;
|
|
|
|
int error;
|
1995-03-01 02:24:35 +03:00
|
|
|
|
|
|
|
switch (SCARG(uap, how)) {
|
|
|
|
case LINUX_SIG_BLOCK:
|
1998-09-11 16:50:05 +04:00
|
|
|
how = SIG_BLOCK;
|
1995-03-01 02:24:35 +03:00
|
|
|
break;
|
|
|
|
case LINUX_SIG_UNBLOCK:
|
1998-09-11 16:50:05 +04:00
|
|
|
how = SIG_UNBLOCK;
|
1995-03-01 02:24:35 +03:00
|
|
|
break;
|
|
|
|
case LINUX_SIG_SETMASK:
|
1998-09-11 16:50:05 +04:00
|
|
|
how = SIG_SETMASK;
|
1995-03-01 02:24:35 +03:00
|
|
|
break;
|
|
|
|
default:
|
1998-09-11 16:50:05 +04:00
|
|
|
return (EINVAL);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
if (SCARG(uap, set)) {
|
|
|
|
error = copyin(SCARG(uap, set), &nlss, sizeof(nlss));
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
linux_to_native_sigset(&nlss, &nbss);
|
|
|
|
}
|
|
|
|
error = sigprocmask1(p, how,
|
|
|
|
SCARG(uap, set) ? &nbss : 0, SCARG(uap, oset) ? &obss : 0);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
if (SCARG(uap, oset)) {
|
|
|
|
native_to_linux_sigset(&obss, &olss);
|
|
|
|
error = copyout(&olss, SCARG(uap, oset), sizeof(olss));
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
return (error);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ARGSUSED */
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_siggetmask(p, v, retval)
|
1995-08-14 02:55:28 +04:00
|
|
|
register struct proc *p;
|
1995-10-07 09:25:19 +03:00
|
|
|
void *v;
|
1995-03-01 02:24:35 +03:00
|
|
|
register_t *retval;
|
|
|
|
{
|
1998-09-11 16:50:05 +04:00
|
|
|
sigset_t bss;
|
|
|
|
linux_sigset_t lss;
|
|
|
|
int error;
|
1995-08-14 02:55:28 +04:00
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
error = sigprocmask1(p, SIG_SETMASK, 0, &bss);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
native_to_linux_sigset(&bss, &lss);
|
|
|
|
*retval = lss;
|
|
|
|
return (0);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following three functions fiddle with a process' signal mask.
|
|
|
|
* Convert the signal masks because of the different signal
|
|
|
|
* values for Linux. The need for this is the reason why
|
|
|
|
* they are here, and have not been mapped directly.
|
|
|
|
*/
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_sigsetmask(p, v, retval)
|
1995-08-14 02:55:28 +04:00
|
|
|
register struct proc *p;
|
1995-09-20 02:37:27 +04:00
|
|
|
void *v;
|
1995-03-01 02:24:35 +03:00
|
|
|
register_t *retval;
|
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct linux_sys_sigsetmask_args /* {
|
1995-09-20 02:37:27 +04:00
|
|
|
syscallarg(linux_sigset_t) mask;
|
|
|
|
} */ *uap = v;
|
1998-09-11 16:50:05 +04:00
|
|
|
sigset_t nbss, obss;
|
|
|
|
linux_sigset_t nlss, olss;
|
|
|
|
int error;
|
1995-03-01 02:24:35 +03:00
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
nlss = SCARG(uap, mask);
|
|
|
|
linux_to_native_sigset(&nlss, &nbss);
|
|
|
|
error = sigprocmask1(p, SIG_SETMASK, &nbss, &obss);
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
native_to_linux_sigset(&obss, &olss);
|
|
|
|
*retval = olss;
|
|
|
|
return (0);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_sigpending(p, v, retval)
|
1995-08-14 02:55:28 +04:00
|
|
|
register struct proc *p;
|
1995-09-20 02:37:27 +04:00
|
|
|
void *v;
|
1995-03-01 02:24:35 +03:00
|
|
|
register_t *retval;
|
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct linux_sys_sigpending_args /* {
|
1998-09-11 16:50:05 +04:00
|
|
|
syscallarg(linux_sigset_t *) set;
|
1995-09-20 02:37:27 +04:00
|
|
|
} */ *uap = v;
|
1998-09-11 16:50:05 +04:00
|
|
|
sigset_t bss;
|
|
|
|
linux_sigset_t lss;
|
1995-03-01 02:24:35 +03:00
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
sigpending1(p, &bss);
|
|
|
|
native_to_linux_sigset(&bss, &lss);
|
|
|
|
return copyout(&lss, SCARG(uap, set), sizeof(lss));
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_sigsuspend(p, v, retval)
|
1995-08-14 02:55:28 +04:00
|
|
|
register struct proc *p;
|
1995-09-20 02:37:27 +04:00
|
|
|
void *v;
|
|
|
|
register_t *retval;
|
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct linux_sys_sigsuspend_args /* {
|
1995-03-11 01:55:04 +03:00
|
|
|
syscallarg(caddr_t) restart;
|
|
|
|
syscallarg(int) oldmask;
|
1995-03-01 02:24:35 +03:00
|
|
|
syscallarg(int) mask;
|
1995-09-20 02:37:27 +04:00
|
|
|
} */ *uap = v;
|
1998-09-11 16:50:05 +04:00
|
|
|
linux_sigset_t lss;
|
|
|
|
sigset_t bss;
|
|
|
|
|
|
|
|
lss = SCARG(uap, mask);
|
|
|
|
linux_to_native_sigset(&lss, &bss);
|
|
|
|
return (sigsuspend1(p, &bss));
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
1995-03-11 01:55:04 +03:00
|
|
|
/*
|
|
|
|
* The deprecated pause(2), which is really just an instance
|
|
|
|
* of sigsuspend(2).
|
|
|
|
*/
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_pause(p, v, retval)
|
1995-08-14 02:55:28 +04:00
|
|
|
register struct proc *p;
|
1995-10-07 09:25:19 +03:00
|
|
|
void *v;
|
1995-03-11 01:55:04 +03:00
|
|
|
register_t *retval;
|
|
|
|
{
|
|
|
|
|
1998-09-11 16:50:05 +04:00
|
|
|
return (sigsuspend1(p, 0));
|
1995-03-11 01:55:04 +03:00
|
|
|
}
|
|
|
|
|
1995-03-01 02:24:35 +03:00
|
|
|
/*
|
|
|
|
* Once more: only a signal conversion is needed.
|
|
|
|
*/
|
|
|
|
int
|
1995-10-07 09:25:19 +03:00
|
|
|
linux_sys_kill(p, v, retval)
|
1995-08-14 02:55:28 +04:00
|
|
|
register struct proc *p;
|
1995-09-20 02:37:27 +04:00
|
|
|
void *v;
|
|
|
|
register_t *retval;
|
|
|
|
{
|
1995-10-07 09:25:19 +03:00
|
|
|
struct linux_sys_kill_args /* {
|
1995-03-01 02:24:35 +03:00
|
|
|
syscallarg(int) pid;
|
|
|
|
syscallarg(int) signum;
|
1995-09-20 02:37:27 +04:00
|
|
|
} */ *uap = v;
|
1995-10-07 09:25:19 +03:00
|
|
|
struct sys_kill_args ka;
|
1995-08-14 02:55:28 +04:00
|
|
|
|
|
|
|
SCARG(&ka, pid) = SCARG(uap, pid);
|
1998-09-11 16:50:05 +04:00
|
|
|
SCARG(&ka, signum) = linux_to_native_sig[SCARG(uap, signum)];
|
1995-10-07 09:25:19 +03:00
|
|
|
return sys_kill(p, &ka, retval);
|
1995-03-01 02:24:35 +03:00
|
|
|
}
|