Minor cleanup.

This commit is contained in:
mycroft 1995-08-14 00:41:02 +00:00
parent 1575859e07
commit ca057762b9
1 changed files with 22 additions and 29 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_signal.c,v 1.13 1995/08/13 22:57:10 mycroft Exp $ */ /* $NetBSD: svr4_signal.c,v 1.14 1995/08/14 00:41:02 mycroft Exp $ */
/* /*
* Copyright (c) 1994 Christos Zoulas * Copyright (c) 1994 Christos Zoulas
@ -399,37 +399,31 @@ svr4_signal(p, uap, retval)
case SVR4_SIGNAL_MASK: case SVR4_SIGNAL_MASK:
{ {
struct sigaction_args sa_args; struct sigaction_args sa_args;
struct sigaction *sap = stackgap_alloc(&sg, struct sigaction *nbsa, *obsa, sa;
sizeof(struct sigaction));
struct sigaction *osap = stackgap_alloc(&sg,
sizeof(struct sigaction));
struct sigaction sa;
nbsa = stackgap_alloc(&sg, sizeof(struct sigaction));
obsa = stackgap_alloc(&sg, sizeof(struct sigaction));
SCARG(&sa_args, signum) = signum; SCARG(&sa_args, signum) = signum;
SCARG(&sa_args, nsa) = sap; SCARG(&sa_args, nsa) = nbsa;
SCARG(&sa_args, osa) = osap; SCARG(&sa_args, osa) = obsa;
sa.sa_handler = SCARG(uap, handler); sa.sa_handler = SCARG(uap, handler);
sa.sa_mask = (sigset_t) 0; sigemptyset(&sa.sa_mask);
sa.sa_flags = 0; sa.sa_flags = 0;
#if 0 #if 0
if (signum != SIGALRM) if (signum != SIGALRM)
sa.sa_flags = SA_RESTART; sa.sa_flags = SA_RESTART;
#endif #endif
error = copyout(&sa, sap, sizeof(sa)); if ((error = copyout(&sa, nbsa, sizeof(sa))) != 0)
if (error)
return error; return error;
error = sigaction(p, &sa_args, retval); if ((error = sigaction(p, &sa_args, retval)) != 0) {
if (error) {
DPRINTF(("signal: sigaction failed: %d\n", DPRINTF(("signal: sigaction failed: %d\n",
error)); error));
*retval = (int)SVR4_SIG_ERR; *retval = (int)SVR4_SIG_ERR;
return error; return error;
} }
error = copyin(osap, &sa, sizeof(sa)); if ((error = copyin(obsa, &sa, sizeof(sa))) != 0)
if (error)
return error; return error;
*retval = (int)sa.sa_handler; *retval = (int)sa.sa_handler;
return 0; return 0;
} }
@ -437,6 +431,7 @@ svr4_signal(p, uap, retval)
case SVR4_SIGHOLD_MASK: case SVR4_SIGHOLD_MASK:
{ {
struct sigprocmask_args sa; struct sigprocmask_args sa;
SCARG(&sa, how) = SIG_BLOCK; SCARG(&sa, how) = SIG_BLOCK;
SCARG(&sa, mask) = sigmask(signum); SCARG(&sa, mask) = sigmask(signum);
return sigprocmask(p, &sa, retval); return sigprocmask(p, &sa, retval);
@ -445,6 +440,7 @@ svr4_signal(p, uap, retval)
case SVR4_SIGRELSE_MASK: case SVR4_SIGRELSE_MASK:
{ {
struct sigprocmask_args sa; struct sigprocmask_args sa;
SCARG(&sa, how) = SIG_UNBLOCK; SCARG(&sa, how) = SIG_UNBLOCK;
SCARG(&sa, mask) = sigmask(signum); SCARG(&sa, mask) = sigmask(signum);
return sigprocmask(p, &sa, retval); return sigprocmask(p, &sa, retval);
@ -452,22 +448,20 @@ svr4_signal(p, uap, retval)
case SVR4_SIGIGNORE_MASK: case SVR4_SIGIGNORE_MASK:
{ {
struct sigaction *sap = stackgap_alloc(&sg,
sizeof(struct sigaction));
struct sigaction sa;
struct sigaction_args sa_args; struct sigaction_args sa_args;
struct sigaction *bsa, sa;
bsa = stackgap_alloc(&sg, sizeof(struct sigaction));
SCARG(&sa_args, signum) = signum; SCARG(&sa_args, signum) = signum;
SCARG(&sa_args, nsa) = sap; SCARG(&sa_args, nsa) = bsa;
SCARG(&sa_args, osa) = NULL; SCARG(&sa_args, osa) = NULL;
sa.sa_handler = SIG_IGN; sa.sa_handler = SIG_IGN;
sa.sa_mask = (sigset_t) 0; sigemptyset(&sa.sa_mask);
sa.sa_flags = 0; sa.sa_flags = 0;
error = copyout(&sa, sap, sizeof(sa)); if ((error = copyout(&sa, bsa, sizeof(sa))) != 0)
if (error)
return error; return error;
error = sigaction(p, &sa_args, retval); if ((error = sigaction(p, &sa_args, retval)) != 0) {
if (error) {
DPRINTF(("sigignore: sigaction failed\n")); DPRINTF(("sigignore: sigaction failed\n"));
return error; return error;
} }
@ -477,6 +471,7 @@ svr4_signal(p, uap, retval)
case SVR4_SIGPAUSE_MASK: case SVR4_SIGPAUSE_MASK:
{ {
struct sigsuspend_args sa; struct sigsuspend_args sa;
SCARG(&sa, mask) = p->p_sigmask & ~sigmask(signum); SCARG(&sa, mask) = p->p_sigmask & ~sigmask(signum);
return sigsuspend(p, &sa, retval); return sigsuspend(p, &sa, retval);
} }
@ -500,8 +495,6 @@ svr4_sigprocmask(p, uap, retval)
sigset_t bss; sigset_t bss;
int error = 0; int error = 0;
*retval = 0;
if (SCARG(uap, oset) != NULL) { if (SCARG(uap, oset) != NULL) {
/* Fix the return value first if needed */ /* Fix the return value first if needed */
bsd_to_svr4_sigset(&p->p_sigmask, &sss); bsd_to_svr4_sigset(&p->p_sigmask, &sss);