1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-04 09:09:56 +00:00

sigset_t change (part 2 of 5)

-----------------------------

The core of the signalling code has been rewritten to operate
on the new sigset_t. No methodological changes have been made.
Most references to a sigset_t object are through macros (see
signalvar.h) to create a level of abstraction and to provide
a basis for further improvements.

The NSIG constant has not been changed to reflect the maximum
number of signals possible. The reason is that it breaks
programs (especially shells) which assume that all signals
have a non-null name in sys_signame. See src/bin/sh/trap.c
for an example. Instead _SIG_MAXSIG has been introduced to
hold the maximum signal possible with the new sigset_t.

struct sigprop has been moved from signalvar.h to kern_sig.c
because a) it is only used there, and b) access must be done
though function sigprop(). The latter because the table doesn't
holds properties for all signals, but only for the first NSIG
signals.

signal.h has been reorganized to make reading easier and to
add the new and/or modified structures. The "old" structures
are moved to signalvar.h to prevent namespace polution.

Especially the coda filesystem suffers from the change, because
it contained lines like (p->p_sigmask == SIGIO), which is easy
to do for integral types, but not for compound types.

NOTE: kdump (and port linux_kdump) must be recompiled.

Thanks to Garrett Wollman and Daniel Eischen for pressing the
importance of changing sigreturn as well.
This commit is contained in:
Marcel Moolenaar 1999-09-29 15:03:48 +00:00
parent da3605dbea
commit 2c42a14602
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51791
34 changed files with 1262 additions and 780 deletions

View File

@ -75,6 +75,10 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */
#define CTL_C
#ifdef CTL_C
#include <sys/signalvar.h>
#endif
int coda_psdev_print_entry = 0;
static
int outstanding_upcalls = 0;
@ -485,7 +489,8 @@ coda_call(mntinfo, inSize, outSize, buffer)
int error;
#ifdef CTL_C
struct proc *p = curproc;
unsigned int psig_omask = p->p_sigmask;
sigset_t psig_omask = p->p_sigmask;
sigset_t tempset;
int i;
#endif
if (mntinfo == NULL) {
@ -541,36 +546,56 @@ coda_call(mntinfo, inSize, outSize, buffer)
*/
i = 0;
do {
error = tsleep(&vmp->vm_sleep, (coda_call_sleep|coda_pcatch), "coda_call", hz*2);
if (error == 0)
break;
else if (error == EWOULDBLOCK) {
error = tsleep(&vmp->vm_sleep,
(coda_call_sleep|coda_pcatch), "coda_call",
hz*2);
if (error == 0)
break;
else if (error == EWOULDBLOCK) {
#ifdef CODA_VERBOSE
printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i);
printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i);
#endif
} else if (p->p_siglist == sigmask(SIGIO)) {
p->p_sigmask |= p->p_siglist;
}
else {
SIGEMPTYSET(tempset);
SIGADDSET(tempset, SIGIO);
if (SIGSETEQ(p->p_siglist, tempset)) {
SIGADDSET(p->p_sigmask, SIGIO);
#ifdef CODA_VERBOSE
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i);
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n",
error, i);
#endif
} else if (p->p_siglist == sigmask(SIGALRM)) {
p->p_sigmask |= p->p_siglist;
} else {
SIGDELSET(tempset, SIGIO);
SIGADDSET(tempset, SIGALRM);
if (SIGSETEQ(p->p_siglist, tempset)) {
SIGADDSET(p->p_sigmask, SIGALRM);
#ifdef CODA_VERBOSE
printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n", error, i);
printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n",
error, i);
#endif
} else {
printf("coda_call: tsleep returns %d, cnt %d\n", error, i);
printf("coda_call: siglist = %x, sigmask = %x, mask %x\n",
p->p_siglist, p->p_sigmask,
p->p_siglist & ~p->p_sigmask);
break;
#ifdef notyet
p->p_sigmask |= p->p_siglist;
printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n",
p->p_siglist, p->p_sigmask,
p->p_siglist & ~p->p_sigmask);
}
else {
printf("coda_call: tsleep returns %d, cnt %d\n",
error, i);
#if notyet
tempset = p->p_siglist;
SIGSETNAND(tempset, p->p_sigmask);
printf("coda_call: siglist = %p, sigmask = %p, mask %p\n",
p->p_siglist, p->p_sigmask,
tempset);
break;
SIGSETOR(p->p_sigmask, p->p_siglist);
tempset = p->p_siglist;
SIGSETNAND(tempset, p->p_sigmask);
printf("coda_call: new mask, siglist = %p, sigmask = %p, mask %p\n",
p->p_siglist, p->p_sigmask,
tempset);
#endif
}
}
}
}
} while (error && i++ < 128 && VC_OPEN(vcp));
p->p_sigmask = psig_omask;
#else

View File

@ -75,6 +75,10 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */
#define CTL_C
#ifdef CTL_C
#include <sys/signalvar.h>
#endif
int coda_psdev_print_entry = 0;
static
int outstanding_upcalls = 0;
@ -485,7 +489,8 @@ coda_call(mntinfo, inSize, outSize, buffer)
int error;
#ifdef CTL_C
struct proc *p = curproc;
unsigned int psig_omask = p->p_sigmask;
sigset_t psig_omask = p->p_sigmask;
sigset_t tempset;
int i;
#endif
if (mntinfo == NULL) {
@ -541,36 +546,56 @@ coda_call(mntinfo, inSize, outSize, buffer)
*/
i = 0;
do {
error = tsleep(&vmp->vm_sleep, (coda_call_sleep|coda_pcatch), "coda_call", hz*2);
if (error == 0)
break;
else if (error == EWOULDBLOCK) {
error = tsleep(&vmp->vm_sleep,
(coda_call_sleep|coda_pcatch), "coda_call",
hz*2);
if (error == 0)
break;
else if (error == EWOULDBLOCK) {
#ifdef CODA_VERBOSE
printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i);
printf("coda_call: tsleep TIMEOUT %d sec\n", 2+2*i);
#endif
} else if (p->p_siglist == sigmask(SIGIO)) {
p->p_sigmask |= p->p_siglist;
}
else {
SIGEMPTYSET(tempset);
SIGADDSET(tempset, SIGIO);
if (SIGSETEQ(p->p_siglist, tempset)) {
SIGADDSET(p->p_sigmask, SIGIO);
#ifdef CODA_VERBOSE
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n", error, i);
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n",
error, i);
#endif
} else if (p->p_siglist == sigmask(SIGALRM)) {
p->p_sigmask |= p->p_siglist;
} else {
SIGDELSET(tempset, SIGIO);
SIGADDSET(tempset, SIGALRM);
if (SIGSETEQ(p->p_siglist, tempset)) {
SIGADDSET(p->p_sigmask, SIGALRM);
#ifdef CODA_VERBOSE
printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n", error, i);
printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n",
error, i);
#endif
} else {
printf("coda_call: tsleep returns %d, cnt %d\n", error, i);
printf("coda_call: siglist = %x, sigmask = %x, mask %x\n",
p->p_siglist, p->p_sigmask,
p->p_siglist & ~p->p_sigmask);
break;
#ifdef notyet
p->p_sigmask |= p->p_siglist;
printf("coda_call: new mask, siglist = %x, sigmask = %x, mask %x\n",
p->p_siglist, p->p_sigmask,
p->p_siglist & ~p->p_sigmask);
}
else {
printf("coda_call: tsleep returns %d, cnt %d\n",
error, i);
#if notyet
tempset = p->p_siglist;
SIGSETNAND(tempset, p->p_sigmask);
printf("coda_call: siglist = %p, sigmask = %p, mask %p\n",
p->p_siglist, p->p_sigmask,
tempset);
break;
SIGSETOR(p->p_sigmask, p->p_siglist);
tempset = p->p_siglist;
SIGSETNAND(tempset, p->p_sigmask);
printf("coda_call: new mask, siglist = %p, sigmask = %p, mask %p\n",
p->p_siglist, p->p_sigmask,
tempset);
#endif
}
}
}
}
} while (error && i++ < 128 && VC_OPEN(vcp));
p->p_sigmask = psig_omask;
#else

View File

@ -192,7 +192,7 @@ procfs_control(curp, p, op)
p->p_flag &= ~P_TRACED;
/* remove pending SIGTRAP, else the process will die */
p->p_siglist &= ~sigmask (SIGTRAP);
SIGDELSET(p->p_siglist, SIGTRAP);
/* give process back to original parent */
if (p->p_oppid != p->p_pptr->p_pid) {

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.64 1999/09/11 00:45:58 alfred Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.65 1999/09/29 15:01:21 marcel Exp
*/
#include "opt_compat.h"
@ -66,13 +66,13 @@ struct sysent sysent[] = {
{ 0, (sy_call_t *)getegid }, /* 43 = getegid */
{ 4, (sy_call_t *)profil }, /* 44 = profil */
{ 4, (sy_call_t *)ktrace }, /* 45 = ktrace */
{ 3, (sy_call_t *)sigaction }, /* 46 = sigaction */
{ 3, (sy_call_t *)osigaction }, /* 46 = osigaction */
{ 0, (sy_call_t *)getgid }, /* 47 = getgid */
{ 2, (sy_call_t *)sigprocmask }, /* 48 = sigprocmask */
{ 2, (sy_call_t *)osigprocmask }, /* 48 = osigprocmask */
{ 2, (sy_call_t *)getlogin }, /* 49 = getlogin */
{ 1, (sy_call_t *)setlogin }, /* 50 = setlogin */
{ 1, (sy_call_t *)acct }, /* 51 = acct */
{ 0, (sy_call_t *)sigpending }, /* 52 = sigpending */
{ 0, (sy_call_t *)osigpending }, /* 52 = osigpending */
{ 2, (sy_call_t *)sigaltstack }, /* 53 = sigaltstack */
{ 3, (sy_call_t *)ioctl }, /* 54 = ioctl */
{ 1, (sy_call_t *)reboot }, /* 55 = reboot */
@ -123,7 +123,7 @@ struct sysent sysent[] = {
{ 2, (sy_call_t *)getpriority }, /* 100 = getpriority */
{ compat(4,send) }, /* 101 = old send */
{ compat(4,recv) }, /* 102 = old recv */
{ 1, (sy_call_t *)sigreturn }, /* 103 = sigreturn */
{ 1, (sy_call_t *)osigreturn }, /* 103 = osigreturn */
{ 3, (sy_call_t *)bind }, /* 104 = bind */
{ 5, (sy_call_t *)setsockopt }, /* 105 = setsockopt */
{ 2, (sy_call_t *)listen }, /* 106 = listen */
@ -131,7 +131,7 @@ struct sysent sysent[] = {
{ compat(3,sigvec) }, /* 108 = old sigvec */
{ compat(1,sigblock) }, /* 109 = old sigblock */
{ compat(1,sigsetmask) }, /* 110 = old sigsetmask */
{ 1, (sy_call_t *)sigsuspend }, /* 111 = sigsuspend */
{ 1, (sy_call_t *)osigsuspend }, /* 111 = osigsuspend */
{ compat(2,sigstack) }, /* 112 = old sigstack */
{ compat(3,recvmsg) }, /* 113 = old recvmsg */
{ compat(3,sendmsg) }, /* 114 = old sendmsg */
@ -360,4 +360,11 @@ struct sysent sysent[] = {
{ 3, (sy_call_t *)kldsym }, /* 337 = kldsym */
{ 1, (sy_call_t *)jail }, /* 338 = jail */
{ 0, (sy_call_t *)nosys }, /* 339 = pioctl */
{ 3, (sy_call_t *)sigprocmask }, /* 340 = sigprocmask */
{ 1, (sy_call_t *)sigsuspend }, /* 341 = sigsuspend */
{ 3, (sy_call_t *)sigaction }, /* 342 = sigaction */
{ 1, (sy_call_t *)sigpending }, /* 343 = sigpending */
{ 1, (sy_call_t *)sigreturn }, /* 344 = sigreturn */
{ 0, (sy_call_t *)nosys }, /* 345 = sigtimedwait */
{ 0, (sy_call_t *)nosys }, /* 346 = sigwaitinfo */
};

View File

@ -173,7 +173,7 @@ exit1(p, rv)
*/
p->p_flag &= ~(P_TRACED | P_PPWAIT);
p->p_flag |= P_WEXIT;
p->p_siglist = 0;
SIGEMPTYSET(p->p_siglist);
if (timevalisset(&p->p_realtimer.it_value))
untimeout(realitexpire, (caddr_t)p, p->p_ithandle);

View File

@ -194,9 +194,9 @@ ktrgenio(vp, fd, rw, iov, len, error)
void
ktrpsig(vp, sig, action, mask, code)
struct vnode *vp;
int sig;
int sig, code;
sig_t action;
int mask, code;
sigset_t *mask;
{
struct ktr_header *kth;
struct ktr_psig kp;
@ -206,7 +206,7 @@ ktrpsig(vp, sig, action, mask, code)
kth = ktrgetheader(KTR_PSIG);
kp.signo = (char)sig;
kp.action = action;
kp.mask = mask;
kp.mask = *mask;
kp.code = code;
kth->ktr_buf = (caddr_t)&kp;
kth->ktr_len = sizeof (struct ktr_psig);

File diff suppressed because it is too large Load Diff

View File

@ -459,7 +459,7 @@ tsleep(ident, priority, wmesg, timo)
if (KTRPOINT(p, KTR_CSW))
ktrcsw(p->p_tracep, 0, 0);
#endif
if (p->p_sigacts->ps_sigintr & sigmask(sig))
if (SIGISMEMBER(p->p_sigacts->ps_sigintr, sig))
return (EINTR);
return (ERESTART);
}
@ -599,7 +599,7 @@ await(int priority, int timo)
if (KTRPOINT(p, KTR_CSW))
ktrcsw(p->p_tracep, 0, 0);
#endif
if (p->p_sigacts->ps_sigintr & sigmask(sig))
if (SIGISMEMBER(p->p_sigacts->ps_sigintr, sig))
return (EINTR);
return (ERESTART);
}

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.64 1999/09/11 00:45:58 alfred Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.65 1999/09/29 15:01:21 marcel Exp
*/
char *syscallnames[] = {
@ -53,13 +53,13 @@ char *syscallnames[] = {
"getegid", /* 43 = getegid */
"profil", /* 44 = profil */
"ktrace", /* 45 = ktrace */
"sigaction", /* 46 = sigaction */
"osigaction", /* 46 = osigaction */
"getgid", /* 47 = getgid */
"sigprocmask", /* 48 = sigprocmask */
"osigprocmask", /* 48 = osigprocmask */
"getlogin", /* 49 = getlogin */
"setlogin", /* 50 = setlogin */
"acct", /* 51 = acct */
"sigpending", /* 52 = sigpending */
"osigpending", /* 52 = osigpending */
"sigaltstack", /* 53 = sigaltstack */
"ioctl", /* 54 = ioctl */
"reboot", /* 55 = reboot */
@ -110,7 +110,7 @@ char *syscallnames[] = {
"getpriority", /* 100 = getpriority */
"old.send", /* 101 = old send */
"old.recv", /* 102 = old recv */
"sigreturn", /* 103 = sigreturn */
"osigreturn", /* 103 = osigreturn */
"bind", /* 104 = bind */
"setsockopt", /* 105 = setsockopt */
"listen", /* 106 = listen */
@ -118,7 +118,7 @@ char *syscallnames[] = {
"old.sigvec", /* 108 = old sigvec */
"old.sigblock", /* 109 = old sigblock */
"old.sigsetmask", /* 110 = old sigsetmask */
"sigsuspend", /* 111 = sigsuspend */
"osigsuspend", /* 111 = osigsuspend */
"old.sigstack", /* 112 = old sigstack */
"old.recvmsg", /* 113 = old recvmsg */
"old.sendmsg", /* 114 = old sendmsg */
@ -347,4 +347,11 @@ char *syscallnames[] = {
"kldsym", /* 337 = kldsym */
"jail", /* 338 = jail */
"#339", /* 339 = pioctl */
"sigprocmask", /* 340 = sigprocmask */
"sigsuspend", /* 341 = sigsuspend */
"sigaction", /* 342 = sigaction */
"sigpending", /* 343 = sigpending */
"sigreturn", /* 344 = sigreturn */
"#345", /* 345 = sigtimedwait */
"#346", /* 346 = sigwaitinfo */
};

View File

@ -739,10 +739,9 @@ ttioctl(tp, cmd, data, flag)
case TIOCSETP:
case TIOCSLTC:
#endif
while (isbackground(p, tp) &&
(p->p_flag & P_PPWAIT) == 0 &&
(p->p_sigignore & sigmask(SIGTTOU)) == 0 &&
(p->p_sigmask & sigmask(SIGTTOU)) == 0) {
while (isbackground(p, tp) && !(p->p_flag & P_PPWAIT) &&
!SIGISMEMBER(p->p_sigignore, SIGTTOU) &&
!SIGISMEMBER(p->p_sigmask, SIGTTOU)) {
if (p->p_pgrp->pg_jobc == 0)
return (EIO);
pgsignal(p->p_pgrp, SIGTTOU, 1);
@ -1448,9 +1447,9 @@ ttread(tp, uio, flag)
*/
if (isbackground(p, tp)) {
splx(s);
if ((p->p_sigignore & sigmask(SIGTTIN)) ||
(p->p_sigmask & sigmask(SIGTTIN)) ||
p->p_flag & P_PPWAIT || p->p_pgrp->pg_jobc == 0)
if (SIGISMEMBER(p->p_sigignore, SIGTTIN) ||
SIGISMEMBER(p->p_sigmask, SIGTTIN) ||
(p->p_flag & P_PPWAIT) || p->p_pgrp->pg_jobc == 0)
return (EIO);
pgsignal(p->p_pgrp, SIGTTIN, 1);
error = ttysleep(tp, &lbolt, TTIPRI | PCATCH, "ttybg2", 0);
@ -1699,17 +1698,20 @@ ttycheckoutq(tp, wait)
register struct tty *tp;
int wait;
{
int hiwat, s, oldsig;
int hiwat, s;
sigset_t oldmask;
hiwat = tp->t_ohiwat;
SIGEMPTYSET(oldmask);
s = spltty();
oldsig = wait ? curproc->p_siglist : 0;
if (wait)
oldmask = curproc->p_siglist;
if (tp->t_outq.c_cc > hiwat + OBUFSIZ + 100)
while (tp->t_outq.c_cc > hiwat) {
ttstart(tp);
if (tp->t_outq.c_cc <= hiwat)
break;
if (wait == 0 || curproc->p_siglist != oldsig) {
if (!(wait && SIGSETEQ(curproc->p_siglist, oldmask))) {
splx(s);
return (0);
}
@ -1766,9 +1768,9 @@ ttwrite(tp, uio, flag)
*/
p = curproc;
if (isbackground(p, tp) &&
ISSET(tp->t_lflag, TOSTOP) && (p->p_flag & P_PPWAIT) == 0 &&
(p->p_sigignore & sigmask(SIGTTOU)) == 0 &&
(p->p_sigmask & sigmask(SIGTTOU)) == 0) {
ISSET(tp->t_lflag, TOSTOP) && !(p->p_flag & P_PPWAIT) &&
!SIGISMEMBER(p->p_sigignore, SIGTTOU) &&
!SIGISMEMBER(p->p_sigmask, SIGTTOU)) {
if (p->p_pgrp->pg_jobc == 0) {
error = EIO;
goto out;

View File

@ -243,10 +243,9 @@ ptsread(dev, uio, flag)
again:
if (pti->pt_flags & PF_REMOTE) {
while (isbackground(p, tp)) {
if ((p->p_sigignore & sigmask(SIGTTIN)) ||
(p->p_sigmask & sigmask(SIGTTIN)) ||
p->p_pgrp->pg_jobc == 0 ||
p->p_flag & P_PPWAIT)
if (SIGISMEMBER(p->p_sigignore, SIGTTIN) ||
SIGISMEMBER(p->p_sigmask, SIGTTIN) ||
p->p_pgrp->pg_jobc == 0 || p->p_flag & P_PPWAIT)
return (EIO);
pgsignal(p->p_pgrp, SIGTTIN, 1);
error = ttysleep(tp, &lbolt, TTIPRI | PCATCH, "ptsbg",

View File

@ -192,7 +192,7 @@ procfs_control(curp, p, op)
p->p_flag &= ~P_TRACED;
/* remove pending SIGTRAP, else the process will die */
p->p_siglist &= ~sigmask (SIGTRAP);
SIGDELSET(p->p_siglist, SIGTRAP);
/* give process back to original parent */
if (p->p_oppid != p->p_pptr->p_pid) {

View File

@ -326,8 +326,10 @@ struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
* such as SIGALRM will not expect file I/O system calls to be interrupted
* by them and break.
*/
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
#define NFSINT_SIGMASK(set) \
(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
SIGISMEMBER(set, SIGQUIT))
/*
* Socket errors ignored for connectionless sockets??

View File

@ -55,6 +55,7 @@
#include <sys/syslog.h>
#include <sys/tprintf.h>
#include <sys/sysctl.h>
#include <sys/signalvar.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@ -1501,14 +1502,16 @@ nfs_sigintr(nmp, rep, p)
struct nfsreq *rep;
register struct proc *p;
{
sigset_t tmpset;
tmpset = p->p_siglist;
SIGSETNAND(tmpset, p->p_sigmask);
SIGSETNAND(tmpset, p->p_sigignore);
if (rep && (rep->r_flags & R_SOFTTERM))
return (EINTR);
if (!(nmp->nm_flag & NFSMNT_INT))
return (0);
if (p && p->p_siglist &&
(((p->p_siglist & ~p->p_sigmask) & ~p->p_sigignore) &
NFSINT_SIGMASK))
if (p && SIGNOTEMPTY(p->p_siglist) && NFSINT_SIGMASK(tmpset))
return (EINTR);
return (0);
}

View File

@ -326,8 +326,10 @@ struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
* such as SIGALRM will not expect file I/O system calls to be interrupted
* by them and break.
*/
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
#define NFSINT_SIGMASK(set) \
(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
SIGISMEMBER(set, SIGQUIT))
/*
* Socket errors ignored for connectionless sockets??

View File

@ -55,6 +55,7 @@
#include <sys/syslog.h>
#include <sys/tprintf.h>
#include <sys/sysctl.h>
#include <sys/signalvar.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@ -1501,14 +1502,16 @@ nfs_sigintr(nmp, rep, p)
struct nfsreq *rep;
register struct proc *p;
{
sigset_t tmpset;
tmpset = p->p_siglist;
SIGSETNAND(tmpset, p->p_sigmask);
SIGSETNAND(tmpset, p->p_sigignore);
if (rep && (rep->r_flags & R_SOFTTERM))
return (EINTR);
if (!(nmp->nm_flag & NFSMNT_INT))
return (0);
if (p && p->p_siglist &&
(((p->p_siglist & ~p->p_sigmask) & ~p->p_sigignore) &
NFSINT_SIGMASK))
if (p && SIGNOTEMPTY(p->p_siglist) && NFSINT_SIGMASK(tmpset))
return (EINTR);
return (0);
}

View File

@ -326,8 +326,10 @@ struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
* such as SIGALRM will not expect file I/O system calls to be interrupted
* by them and break.
*/
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
#define NFSINT_SIGMASK(set) \
(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
SIGISMEMBER(set, SIGQUIT))
/*
* Socket errors ignored for connectionless sockets??

View File

@ -326,8 +326,10 @@ struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
* such as SIGALRM will not expect file I/O system calls to be interrupted
* by them and break.
*/
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
#define NFSINT_SIGMASK(set) \
(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
SIGISMEMBER(set, SIGQUIT))
/*
* Socket errors ignored for connectionless sockets??

View File

@ -326,8 +326,10 @@ struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
* such as SIGALRM will not expect file I/O system calls to be interrupted
* by them and break.
*/
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
#define NFSINT_SIGMASK(set) \
(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
SIGISMEMBER(set, SIGQUIT))
/*
* Socket errors ignored for connectionless sockets??

View File

@ -55,6 +55,7 @@
#include <sys/syslog.h>
#include <sys/tprintf.h>
#include <sys/sysctl.h>
#include <sys/signalvar.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@ -1501,14 +1502,16 @@ nfs_sigintr(nmp, rep, p)
struct nfsreq *rep;
register struct proc *p;
{
sigset_t tmpset;
tmpset = p->p_siglist;
SIGSETNAND(tmpset, p->p_sigmask);
SIGSETNAND(tmpset, p->p_sigignore);
if (rep && (rep->r_flags & R_SOFTTERM))
return (EINTR);
if (!(nmp->nm_flag & NFSMNT_INT))
return (0);
if (p && p->p_siglist &&
(((p->p_siglist & ~p->p_sigmask) & ~p->p_sigignore) &
NFSINT_SIGMASK))
if (p && SIGNOTEMPTY(p->p_siglist) && NFSINT_SIGMASK(tmpset))
return (EINTR);
return (0);
}

View File

@ -326,8 +326,10 @@ struct uio; struct buf; struct vattr; struct nameidata; /* XXX */
* such as SIGALRM will not expect file I/O system calls to be interrupted
* by them and break.
*/
#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \
sigmask(SIGHUP)|sigmask(SIGQUIT))
#define NFSINT_SIGMASK(set) \
(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
SIGISMEMBER(set, SIGQUIT))
/*
* Socket errors ignored for connectionless sockets??

View File

@ -44,56 +44,65 @@
#include <sys/cdefs.h>
#include <sys/_posix.h>
#include <sys/types.h>
#include <machine/signal.h> /* sig_atomic_t; trap codes; sigcontext */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
#define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
#endif
/*
* sigset_t macros
*/
#define _SIG_WORDS 4
#define _SIG_MAXSIG 128
#define _SIG_IDX(sig) ((sig) - 1)
#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
/*
* system defined signals
*/
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instr. (not reset when caught) */
#ifndef _POSIX_SOURCE
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#endif
#define SIGABRT 6 /* abort() */
#define SIGABRT 6 /* abort() */
#ifndef _POSIX_SOURCE
#define SIGIOT SIGABRT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#define SIGIOT SIGABRT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#endif
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#ifndef _POSIX_SOURCE
#define SIGBUS 10 /* bus error */
#define SIGBUS 10 /* bus error */
#endif
#define SIGSEGV 11 /* segmentation violation */
#define SIGSEGV 11 /* segmentation violation */
#ifndef _POSIX_SOURCE
#define SIGSYS 12 /* non-existent system call invoked */
#define SIGSYS 12 /* non-existent system call invoked */
#endif
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#ifndef _POSIX_SOURCE
#define SIGURG 16 /* urgent condition on IO channel */
#define SIGURG 16 /* urgent condition on IO channel */
#endif
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN if (tp->t_local&LTOSTOP) */
#ifndef _POSIX_SOURCE
#define SIGIO 23 /* input/output possible signal */
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#define SIGWINCH 28 /* window size changes */
#define SIGINFO 29 /* information request */
#define SIGIO 23 /* input/output possible signal */
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#define SIGWINCH 28 /* window size changes */
#define SIGINFO 29 /* information request */
#endif
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
/*-
* Type of a signal handling function.
@ -113,56 +122,41 @@
*/
typedef void __sighandler_t __P((int));
#if defined(_P1003_1B_VISIBLE_HISTORICALLY) || \
(!defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE))
#define SIG_DFL ((__sighandler_t *)0)
#define SIG_IGN ((__sighandler_t *)1)
#define SIG_HOLD ((__sighandler_t *)2)
#define SIG_ERR ((__sighandler_t *)-1)
union sigval {
/* Members as suggested by Annex C of POSIX 1003.1b. */
int sigval_int;
void *sigval_ptr;
int sigval_int;
void *sigval_ptr;
};
#endif /* !_ANSI_SOURCE && _P1003_1B_VISIBLE_HISTORICALLY */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
/* POSIX 1003.1b required values. */
#define SI_USER 0x10001
#define SI_QUEUE 0x10002
#define SI_TIMER 0x10003
#define SI_ASYNCIO 0x10004
#define SI_MESGQ 0x10005
/* Additional FreeBSD values. */
#define SI_UNDEFINED 0
struct __siginfo {
struct sigcontext si_sc;
int si_signo; /* signal number */
typedef struct {
int si_signo; /* signal number */
int si_errno; /* errno association */
/*
* Cause of signal, one of the SI_ macros or signal-specific
* values, i.e. one of the FPE_... values for SIGFPE. This
* value is equivalent to the second argument to an old-style
* FreeBSD signal handler.
*/
int si_code;
int si_code; /* signal code */
pid_t si_pid; /* sending process */
uid_t si_uid; /* sender's ruid */
int si_status; /* exit value */
void *si_addr; /* faulting instruction */
union sigval si_value; /* signal value */
long si_band; /* band event for SIGPOLL */
int __spare__[7]; /* gimme some slack */
} siginfo_t;
union sigval si_value;
};
#else /* ! _ANSI_SOURCE && ! _POSIX_SOURCE */
struct __siginfo;
#endif /* ! _ANSI_SOURCE && ! _POSIX_SOURCE */
typedef struct {
unsigned int __bits[_SIG_WORDS];
} sigset_t;
typedef struct __siginfo siginfo_t;
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
typedef void __siginfohandler_t __P((int, siginfo_t *, void *));
#endif /* ! _ANSI_SOURCE && ! _POSIX_SOURCE */
#define SIG_DFL ((__sighandler_t *)0)
#define SIG_IGN ((__sighandler_t *)1)
#define SIG_ERR ((__sighandler_t *)-1)
#ifndef _ANSI_SOURCE
typedef unsigned int sigset_t;
#if !defined(_ANSI_SOURCE)
/*
* Signal vector "template" used in sigaction call.
@ -172,16 +166,19 @@ struct sigaction {
void (*__sa_handler) __P((int));
void (*__sa_sigaction) __P((int, siginfo_t *, void *));
} __sigaction_u; /* signal handler */
sigset_t sa_mask; /* signal mask to apply */
int sa_flags; /* see signal options below */
int sa_flags; /* see signal options below */
sigset_t sa_mask; /* signal mask to apply */
};
/* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */
#define sa_handler __sigaction_u.__sa_handler
#ifndef _POSIX_SOURCE
#define sa_sigaction __sigaction_u.__sa_sigaction
#endif
#ifndef _POSIX_SOURCE
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
#if !defined(_POSIX_SOURCE)
#define sa_sigaction __sigaction_u.__sa_sigaction
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
#define SA_RESTART 0x0002 /* restart system call on signal return */
#define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */
@ -191,17 +188,21 @@ struct sigaction {
#ifdef COMPAT_SUNOS
#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
#endif
#endif /* _POSIX_SOURCE */
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
/*
* Flags for sigprocmask:
*/
#define SIG_BLOCK 1 /* block specified signal set */
#define SIG_UNBLOCK 2 /* unblock specified signal set */
#define SIG_SETMASK 3 /* set specified signal set */
#define NSIG 32
/* POSIX 1003.1b required values. */
#define SI_USER 0x10001
#define SI_QUEUE 0x10002
#define SI_TIMER 0x10003
#define SI_ASYNCIO 0x10004
#define SI_MESGQ 0x10005
/* Additional FreeBSD values. */
#define SI_UNDEFINED 0
typedef void __siginfohandler_t __P((int, siginfo_t *, void *));
#ifndef _POSIX_SOURCE
typedef __sighandler_t *sig_t; /* type of pointer to a signal function */
#ifdef _BSD_SIZE_T_
@ -210,26 +211,32 @@ typedef _BSD_SIZE_T_ size_t;
#endif
/*
* Structure used in sigaltstack call.
* sigaltstack
*/
struct sigaltstack {
char *ss_sp; /* signal stack base */
size_t ss_size; /* signal stack length */
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
};
typedef struct sigaltstack {
char *ss_sp; /* signal stack base */
unsigned int ss_size; /* signal stack length */
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
} stack_t;
#define SS_ONSTACK 0x0001 /* take signal on alternate stack */
#define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */
#define MINSIGSTKSZ 8192 /* minimum allowable stack */
#define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
/*
* Suck in definition of ucontext_t
*/
#include <sys/ucontext.h>
/*
* 4.3 compatibility:
* Signal vector "template" used in sigvec call.
*/
struct sigvec {
__sighandler_t *sv_handler; /* signal handler */
int sv_mask; /* signal mask to apply */
int sv_flags; /* see signal options below */
__sighandler_t *sv_handler; /* signal handler */
int sv_mask; /* signal mask to apply */
int sv_flags; /* see signal options below */
};
#define SV_ONSTACK SA_ONSTACK
@ -244,8 +251,8 @@ struct sigvec {
* Structure used in sigstack call.
*/
struct sigstack {
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
};
/*
@ -256,21 +263,25 @@ struct sigstack {
#define BADSIG SIG_ERR
#endif /* !_POSIX_SOURCE */
#endif /* !_ANSI_SOURCE */
#endif /* !_POSIX_SOURCE */
#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY)
/*
* Flags for sigprocmask:
*/
#define SIG_BLOCK 1 /* block specified signal set */
#define SIG_UNBLOCK 2 /* unblock specified signal set */
#define SIG_SETMASK 3 /* set specified signal set */
struct sigevent {
int sigev_notify; /* Notification type */
int sigev_signo; /* Signal number */
union sigval sigev_value; /* Signal value */
int sigev_notify; /* Notification type */
int sigev_signo; /* Signal number */
union sigval sigev_value; /* Signal value */
};
#define SIGEV_NONE 0 /* No async notification */
#define SIGEV_SIGNAL 1 /* Generate a queued signal */
#endif /* ! _ANSI_SOURCE && _P1003_1B_VISIBLE_HISTORICALLY */
#endif /* !_ANSI_SOURCE */
/*
* For historical reasons; programs expect signal's return value to be

View File

@ -120,8 +120,8 @@ struct ktr_genio {
struct ktr_psig {
int signo;
sig_t action;
int mask;
int code;
sigset_t mask;
};
/*
@ -159,7 +159,7 @@ struct ktr_csw {
#ifdef KERNEL
void ktrnamei __P((struct vnode *,char *));
void ktrcsw __P((struct vnode *,int,int));
void ktrpsig __P((struct vnode *, int, sig_t, int, int));
void ktrpsig __P((struct vnode *, int, sig_t, sigset_t *, int));
void ktrgenio __P((struct vnode *,int, enum uio_rw,struct iovec *,int,int));
void ktrsyscall __P((struct vnode *, int, int narg, register_t args[]));
void ktrsysret __P((struct vnode *, int, int, register_t));

View File

@ -46,7 +46,7 @@
#define BSD4_3 1
#define BSD4_4 1
#undef __FreeBSD_version
#define __FreeBSD_version 400010 /* Master, propagated to newvers */
#define __FreeBSD_version 400011 /* Master, propagated to newvers */
#ifndef NULL
#define NULL 0

View File

@ -167,7 +167,7 @@ struct proc {
int p_traceflag; /* Kernel trace points. */
struct vnode *p_tracep; /* Trace to vnode. */
int p_siglist; /* Signals arrived but not delivered. */
sigset_t p_siglist; /* Signals arrived but not delivered. */
struct vnode *p_textvp; /* Vnode of executable. */
@ -271,6 +271,7 @@ struct proc {
#define P_DEADLKTREAT 0x800000 /* lock aquisition - deadlock treatment */
#define P_JAILED 0x1000000 /* Process is in jail */
#define P_NEWSIGSET 0x2000000 /* Process uses new sigset_t */
/*
* MOVE TO ucred.h?

View File

@ -44,56 +44,65 @@
#include <sys/cdefs.h>
#include <sys/_posix.h>
#include <sys/types.h>
#include <machine/signal.h> /* sig_atomic_t; trap codes; sigcontext */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
#define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */
#endif
/*
* sigset_t macros
*/
#define _SIG_WORDS 4
#define _SIG_MAXSIG 128
#define _SIG_IDX(sig) ((sig) - 1)
#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instruction (not reset when caught) */
/*
* system defined signals
*/
#define SIGHUP 1 /* hangup */
#define SIGINT 2 /* interrupt */
#define SIGQUIT 3 /* quit */
#define SIGILL 4 /* illegal instr. (not reset when caught) */
#ifndef _POSIX_SOURCE
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#define SIGTRAP 5 /* trace trap (not reset when caught) */
#endif
#define SIGABRT 6 /* abort() */
#define SIGABRT 6 /* abort() */
#ifndef _POSIX_SOURCE
#define SIGIOT SIGABRT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#define SIGIOT SIGABRT /* compatibility */
#define SIGEMT 7 /* EMT instruction */
#endif
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#define SIGFPE 8 /* floating point exception */
#define SIGKILL 9 /* kill (cannot be caught or ignored) */
#ifndef _POSIX_SOURCE
#define SIGBUS 10 /* bus error */
#define SIGBUS 10 /* bus error */
#endif
#define SIGSEGV 11 /* segmentation violation */
#define SIGSEGV 11 /* segmentation violation */
#ifndef _POSIX_SOURCE
#define SIGSYS 12 /* non-existent system call invoked */
#define SIGSYS 12 /* non-existent system call invoked */
#endif
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#define SIGPIPE 13 /* write on a pipe with no one to read it */
#define SIGALRM 14 /* alarm clock */
#define SIGTERM 15 /* software termination signal from kill */
#ifndef _POSIX_SOURCE
#define SIGURG 16 /* urgent condition on IO channel */
#define SIGURG 16 /* urgent condition on IO channel */
#endif
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN for output if (tp->t_local&LTOSTOP) */
#define SIGSTOP 17 /* sendable stop signal not from tty */
#define SIGTSTP 18 /* stop signal from tty */
#define SIGCONT 19 /* continue a stopped process */
#define SIGCHLD 20 /* to parent on child stop or exit */
#define SIGTTIN 21 /* to readers pgrp upon background tty read */
#define SIGTTOU 22 /* like TTIN if (tp->t_local&LTOSTOP) */
#ifndef _POSIX_SOURCE
#define SIGIO 23 /* input/output possible signal */
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#define SIGWINCH 28 /* window size changes */
#define SIGINFO 29 /* information request */
#define SIGIO 23 /* input/output possible signal */
#define SIGXCPU 24 /* exceeded CPU time limit */
#define SIGXFSZ 25 /* exceeded file size limit */
#define SIGVTALRM 26 /* virtual time alarm */
#define SIGPROF 27 /* profiling time alarm */
#define SIGWINCH 28 /* window size changes */
#define SIGINFO 29 /* information request */
#endif
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
#define SIGUSR1 30 /* user defined signal 1 */
#define SIGUSR2 31 /* user defined signal 2 */
/*-
* Type of a signal handling function.
@ -113,56 +122,41 @@
*/
typedef void __sighandler_t __P((int));
#if defined(_P1003_1B_VISIBLE_HISTORICALLY) || \
(!defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE))
#define SIG_DFL ((__sighandler_t *)0)
#define SIG_IGN ((__sighandler_t *)1)
#define SIG_HOLD ((__sighandler_t *)2)
#define SIG_ERR ((__sighandler_t *)-1)
union sigval {
/* Members as suggested by Annex C of POSIX 1003.1b. */
int sigval_int;
void *sigval_ptr;
int sigval_int;
void *sigval_ptr;
};
#endif /* !_ANSI_SOURCE && _P1003_1B_VISIBLE_HISTORICALLY */
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
/* POSIX 1003.1b required values. */
#define SI_USER 0x10001
#define SI_QUEUE 0x10002
#define SI_TIMER 0x10003
#define SI_ASYNCIO 0x10004
#define SI_MESGQ 0x10005
/* Additional FreeBSD values. */
#define SI_UNDEFINED 0
struct __siginfo {
struct sigcontext si_sc;
int si_signo; /* signal number */
typedef struct {
int si_signo; /* signal number */
int si_errno; /* errno association */
/*
* Cause of signal, one of the SI_ macros or signal-specific
* values, i.e. one of the FPE_... values for SIGFPE. This
* value is equivalent to the second argument to an old-style
* FreeBSD signal handler.
*/
int si_code;
int si_code; /* signal code */
pid_t si_pid; /* sending process */
uid_t si_uid; /* sender's ruid */
int si_status; /* exit value */
void *si_addr; /* faulting instruction */
union sigval si_value; /* signal value */
long si_band; /* band event for SIGPOLL */
int __spare__[7]; /* gimme some slack */
} siginfo_t;
union sigval si_value;
};
#else /* ! _ANSI_SOURCE && ! _POSIX_SOURCE */
struct __siginfo;
#endif /* ! _ANSI_SOURCE && ! _POSIX_SOURCE */
typedef struct {
unsigned int __bits[_SIG_WORDS];
} sigset_t;
typedef struct __siginfo siginfo_t;
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
typedef void __siginfohandler_t __P((int, siginfo_t *, void *));
#endif /* ! _ANSI_SOURCE && ! _POSIX_SOURCE */
#define SIG_DFL ((__sighandler_t *)0)
#define SIG_IGN ((__sighandler_t *)1)
#define SIG_ERR ((__sighandler_t *)-1)
#ifndef _ANSI_SOURCE
typedef unsigned int sigset_t;
#if !defined(_ANSI_SOURCE)
/*
* Signal vector "template" used in sigaction call.
@ -172,16 +166,19 @@ struct sigaction {
void (*__sa_handler) __P((int));
void (*__sa_sigaction) __P((int, siginfo_t *, void *));
} __sigaction_u; /* signal handler */
sigset_t sa_mask; /* signal mask to apply */
int sa_flags; /* see signal options below */
int sa_flags; /* see signal options below */
sigset_t sa_mask; /* signal mask to apply */
};
/* if SA_SIGINFO is set, sa_sigaction is to be used instead of sa_handler. */
#define sa_handler __sigaction_u.__sa_handler
#ifndef _POSIX_SOURCE
#define sa_sigaction __sigaction_u.__sa_sigaction
#endif
#ifndef _POSIX_SOURCE
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
#if !defined(_POSIX_SOURCE)
#define sa_sigaction __sigaction_u.__sa_sigaction
#define SA_ONSTACK 0x0001 /* take signal on signal stack */
#define SA_RESTART 0x0002 /* restart system call on signal return */
#define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */
@ -191,17 +188,21 @@ struct sigaction {
#ifdef COMPAT_SUNOS
#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */
#endif
#endif /* _POSIX_SOURCE */
#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */
/*
* Flags for sigprocmask:
*/
#define SIG_BLOCK 1 /* block specified signal set */
#define SIG_UNBLOCK 2 /* unblock specified signal set */
#define SIG_SETMASK 3 /* set specified signal set */
#define NSIG 32
/* POSIX 1003.1b required values. */
#define SI_USER 0x10001
#define SI_QUEUE 0x10002
#define SI_TIMER 0x10003
#define SI_ASYNCIO 0x10004
#define SI_MESGQ 0x10005
/* Additional FreeBSD values. */
#define SI_UNDEFINED 0
typedef void __siginfohandler_t __P((int, siginfo_t *, void *));
#ifndef _POSIX_SOURCE
typedef __sighandler_t *sig_t; /* type of pointer to a signal function */
#ifdef _BSD_SIZE_T_
@ -210,26 +211,32 @@ typedef _BSD_SIZE_T_ size_t;
#endif
/*
* Structure used in sigaltstack call.
* sigaltstack
*/
struct sigaltstack {
char *ss_sp; /* signal stack base */
size_t ss_size; /* signal stack length */
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
};
typedef struct sigaltstack {
char *ss_sp; /* signal stack base */
unsigned int ss_size; /* signal stack length */
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
} stack_t;
#define SS_ONSTACK 0x0001 /* take signal on alternate stack */
#define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */
#define MINSIGSTKSZ 8192 /* minimum allowable stack */
#define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */
/*
* Suck in definition of ucontext_t
*/
#include <sys/ucontext.h>
/*
* 4.3 compatibility:
* Signal vector "template" used in sigvec call.
*/
struct sigvec {
__sighandler_t *sv_handler; /* signal handler */
int sv_mask; /* signal mask to apply */
int sv_flags; /* see signal options below */
__sighandler_t *sv_handler; /* signal handler */
int sv_mask; /* signal mask to apply */
int sv_flags; /* see signal options below */
};
#define SV_ONSTACK SA_ONSTACK
@ -244,8 +251,8 @@ struct sigvec {
* Structure used in sigstack call.
*/
struct sigstack {
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
char *ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
};
/*
@ -256,21 +263,25 @@ struct sigstack {
#define BADSIG SIG_ERR
#endif /* !_POSIX_SOURCE */
#endif /* !_ANSI_SOURCE */
#endif /* !_POSIX_SOURCE */
#if !defined(_ANSI_SOURCE) && defined(_P1003_1B_VISIBLE_HISTORICALLY)
/*
* Flags for sigprocmask:
*/
#define SIG_BLOCK 1 /* block specified signal set */
#define SIG_UNBLOCK 2 /* unblock specified signal set */
#define SIG_SETMASK 3 /* set specified signal set */
struct sigevent {
int sigev_notify; /* Notification type */
int sigev_signo; /* Signal number */
union sigval sigev_value; /* Signal value */
int sigev_notify; /* Notification type */
int sigev_signo; /* Signal number */
union sigval sigev_value; /* Signal value */
};
#define SIGEV_NONE 0 /* No async notification */
#define SIGEV_SIGNAL 1 /* Generate a queued signal */
#endif /* ! _ANSI_SOURCE && _P1003_1B_VISIBLE_HISTORICALLY */
#endif /* !_ANSI_SOURCE */
/*
* For historical reasons; programs expect signal's return value to be

View File

@ -38,26 +38,29 @@
#define _SYS_SIGNALVAR_H_
#include <sys/signal.h>
#include <sys/proc.h>
/*
* Kernel signal definitions and data structures,
* not exported to user programs.
*/
int __sigisempty __P((sigset_t *set));
int __sigseteq __P((sigset_t *set1, sigset_t *set2));
/*
* Process signal actions and state, needed only within the process
* (not necessarily resident).
*/
struct sigacts {
sig_t ps_sigact[NSIG]; /* disposition of signals */
sigset_t ps_catchmask[NSIG]; /* signals to be blocked */
sig_t ps_sigact[_SIG_MAXSIG]; /* disposition of signals */
sigset_t ps_catchmask[_SIG_MAXSIG]; /* signals to be blocked */
sigset_t ps_sigonstack; /* signals to take on sigstack */
sigset_t ps_sigintr; /* signals that interrupt syscalls */
sigset_t ps_sigreset; /* signals that reset when caught */
sigset_t ps_signodefer; /* signals not masked while handled */
sigset_t ps_siginfo; /* signals that want SA_SIGINFO args */
int ps_flags; /* signal flags, below */
struct sigaltstack ps_sigstk; /* sp & on stack state variable */
stack_t ps_sigstk; /* sp & on stack state variable */
sigset_t ps_usertramp; /* SunOS compat; libc sigtramp XXX */
};
@ -65,89 +68,131 @@ struct sigacts {
#define SAS_OLDMASK 0x01 /* need to restore mask before pause */
#define SAS_ALTSTACK 0x02 /* have alternate signal stack */
/* additional signal action values, used only temporarily/internally */
#define SIG_CATCH ((__sighandler_t *)2)
#define SIG_HOLD ((__sighandler_t *)3)
/*
* Compatibility
*/
typedef struct {
struct osigcontext si_sc;
int si_signo;
int si_code;
union sigval si_value;
} osiginfo_t;
struct osigaction {
union {
void (*__sa_handler) __P((int));
void (*__sa_sigaction) __P((int, osiginfo_t *, void *));
} __sigaction_u; /* signal handler */
osigset_t sa_mask; /* signal mask to apply */
int sa_flags; /* see signal options below */
};
typedef void __osiginfohandler_t __P((int, osiginfo_t *, void *));
/*
* additional signal action values, used only temporarily/internally
* NOTE: SIG_HOLD was previously internal only, but has been moved to
* sys/signal.h
*/
#define SIG_CATCH ((__sighandler_t *)3)
/*
* get signal action for process and signal; currently only for current process
*/
#define SIGACTION(p, sig) (p->p_sigacts->ps_sigact[(sig)])
#define SIGACTION(p, sig) (p->p_sigacts->ps_sigact[_SIG_IDX(sig)])
/*
* Determine signal that should be delivered to process p, the current
* process, 0 if none. If there is a pending stop signal with default
* action, the process stops in issignal().
* sigset_t manipulation macros
*/
#define CURSIG(p) \
(((p)->p_siglist == 0 || \
(((p)->p_flag & P_TRACED) == 0 && \
((p)->p_siglist & ~(p)->p_sigmask) == 0)) ? \
0 : issignal(p))
#define SIGADDSET(set, signo) \
(set).__bits[_SIG_WORD(signo)] |= _SIG_BIT(signo)
/*
* Clear a pending signal from a process.
*/
#define CLRSIG(p, sig) { (p)->p_siglist &= ~sigmask(sig); }
#define SIGDELSET(set, signo) \
(set).__bits[_SIG_WORD(signo)] &= ~_SIG_BIT(signo)
/*
* Signal properties and actions.
* The array below categorizes the signals and their default actions
* according to the following properties:
*/
#define SA_KILL 0x01 /* terminates process by default */
#define SA_CORE 0x02 /* ditto and coredumps */
#define SA_STOP 0x04 /* suspend process */
#define SA_TTYSTOP 0x08 /* ditto, from tty */
#define SA_IGNORE 0x10 /* ignore by default */
#define SA_CONT 0x20 /* continue if suspended */
#define SA_CANTMASK 0x40 /* non-maskable, catchable */
#define SIGEMPTYSET(set) \
do { \
int __i; \
for (__i = 0; __i < _SIG_WORDS; __i++) \
(set).__bits[__i] = 0; \
} while (0)
#ifdef SIGPROP
static int sigprop[NSIG + 1] = {
0, /* unused */
SA_KILL, /* SIGHUP */
SA_KILL, /* SIGINT */
SA_KILL|SA_CORE, /* SIGQUIT */
SA_KILL|SA_CORE, /* SIGILL */
SA_KILL|SA_CORE, /* SIGTRAP */
SA_KILL|SA_CORE, /* SIGABRT */
SA_KILL|SA_CORE, /* SIGEMT */
SA_KILL|SA_CORE, /* SIGFPE */
SA_KILL, /* SIGKILL */
SA_KILL|SA_CORE, /* SIGBUS */
SA_KILL|SA_CORE, /* SIGSEGV */
SA_KILL|SA_CORE, /* SIGSYS */
SA_KILL, /* SIGPIPE */
SA_KILL, /* SIGALRM */
SA_KILL, /* SIGTERM */
SA_IGNORE, /* SIGURG */
SA_STOP, /* SIGSTOP */
SA_STOP|SA_TTYSTOP, /* SIGTSTP */
SA_IGNORE|SA_CONT, /* SIGCONT */
SA_IGNORE, /* SIGCHLD */
SA_STOP|SA_TTYSTOP, /* SIGTTIN */
SA_STOP|SA_TTYSTOP, /* SIGTTOU */
SA_IGNORE, /* SIGIO */
SA_KILL, /* SIGXCPU */
SA_KILL, /* SIGXFSZ */
SA_KILL, /* SIGVTALRM */
SA_KILL, /* SIGPROF */
SA_IGNORE, /* SIGWINCH */
SA_IGNORE, /* SIGINFO */
SA_KILL, /* SIGUSR1 */
SA_KILL, /* SIGUSR2 */
};
#define SIGFILLSET(set) \
do { \
int __i; \
for (__i = 0; __i < _SIG_WORDS; __i++) \
(set).__bits[__i] = ~(unsigned int)0; \
} while (0)
#define contsigmask (sigmask(SIGCONT))
#define stopsigmask (sigmask(SIGSTOP) | sigmask(SIGTSTP) | \
sigmask(SIGTTIN) | sigmask(SIGTTOU))
#define SIGISMEMBER(set, signo) \
((set).__bits[_SIG_WORD(signo)] & _SIG_BIT(signo))
#endif /* SIGPROP */
#define SIGISEMPTY(set) __sigisempty(&(set))
#define SIGNOTEMPTY(set) (!__sigisempty(&(set)))
#define sigcantmask (sigmask(SIGKILL) | sigmask(SIGSTOP))
#define SIGSETEQ(set1, set2) __sigseteq(&(set1), &(set2))
#define SIGSETNEQ(set1, set2) (!__sigseteq(&(set1), &(set2)))
#define SIGSETOR(set1, set2) \
do { \
int __i; \
for (__i = 0; __i < _SIG_WORDS; __i++) \
(set1).__bits[__i] |= (set2).__bits[__i]; \
} while (0)
#define SIGSETAND(set1, set2) \
do { \
int __i; \
for (__i = 0; __i < _SIG_WORDS; __i++) \
(set1).__bits[__i] &= (set2).__bits[__i]; \
} while (0)
#define SIGSETNAND(set1, set2) \
do { \
int __i; \
for (__i = 0; __i < _SIG_WORDS; __i++) \
(set1).__bits[__i] &= ~(set2).__bits[__i]; \
} while (0)
#define SIG_CANTMASK(set) \
SIGDELSET(set, SIGKILL), SIGDELSET(set, SIGSTOP)
#define SIG_STOPSIGMASK(set) \
SIGDELSET(set, SIGSTOP), SIGDELSET(set, SIGTSTP), \
SIGDELSET(set, SIGTTIN), SIGDELSET(set, SIGTTOU)
#define SIG_CONTSIGMASK(set) \
SIGDELSET(set, SIGCONT)
#define sigcantmask (sigmask(SIGKILL) | sigmask(SIGSTOP))
#define SIG2OSIG(sig, osig) osig = (sig).__bits[0]
#define OSIG2SIG(osig, sig) SIGEMPTYSET(sig); (sig).__bits[0] = osig
extern __inline int __sigisempty(sigset_t *set)
{
int i;
for (i = 0; i < _SIG_WORDS; i++) {
if (set->__bits[i])
return (0);
}
return (1);
}
extern __inline int __sigseteq(sigset_t *set1, sigset_t *set2)
{
int i;
for (i = 0; i < _SIG_WORDS; i++) {
if (set1->__bits[i] != set2->__bits[i])
return (0);
}
return (1);
}
#ifdef KERNEL
struct pgrp;
struct proc;
struct sigio;
@ -168,10 +213,37 @@ void psignal __P((struct proc *p, int sig));
void sigexit __P((struct proc *p, int signum));
void siginit __P((struct proc *p));
void trapsignal __P((struct proc *p, int sig, u_long code));
void check_sigacts (void);
void check_sigacts __P((void));
int __sig_ffs __P((sigset_t *set));
int __cursig __P((struct proc *p));
/*
* Machine-dependent functions:
*/
void sendsig __P((sig_t action, int sig, int returnmask, u_long code));
void sendsig __P((sig_t action, int sig, sigset_t *retmask, u_long code));
int md_sigreturn __P((struct proc *p, void *sigcntxp, sigset_t *mask));
/*
* Inline functions:
*/
#define CURSIG(p) __cursig(p)
/*
* Determine signal that should be delivered to process p, the current
* process, 0 if none. If there is a pending stop signal with default
* action, the process stops in issignal().
*/
extern __inline int __cursig(struct proc *p)
{
sigset_t tmpset;
tmpset = p->p_siglist;
SIGSETNAND(tmpset, p->p_sigmask);
return ((SIGISEMPTY(p->p_siglist) ||
(!(p->p_flag & P_TRACED) && SIGISEMPTY(tmpset)))
? 0 : issignal(p));
}
#endif /* KERNEL */
#endif /* !_SYS_SIGNALVAR_H_ */

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.64 1999/09/11 00:45:58 alfred Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.65 1999/09/29 15:01:21 marcel Exp
*/
HIDE_POSIX(fork)
@ -49,13 +49,13 @@ HIDE_POSIX(pipe)
HIDE_POSIX(getegid)
HIDE_BSD(profil)
HIDE_BSD(ktrace)
HIDE_POSIX(sigaction)
HIDE_POSIX(osigaction)
HIDE_POSIX(getgid)
HIDE_POSIX(sigprocmask)
HIDE_POSIX(osigprocmask)
HIDE_BSD(getlogin)
HIDE_BSD(setlogin)
HIDE_BSD(acct)
HIDE_POSIX(sigpending)
HIDE_POSIX(osigpending)
HIDE_BSD(sigaltstack)
HIDE_POSIX(ioctl)
HIDE_BSD(reboot)
@ -102,14 +102,14 @@ HIDE_BSD(accept)
HIDE_BSD(getpriority)
HIDE_BSD(send)
HIDE_BSD(recv)
HIDE_BSD(sigreturn)
HIDE_BSD(osigreturn)
HIDE_BSD(bind)
HIDE_BSD(setsockopt)
HIDE_BSD(listen)
HIDE_BSD(sigvec)
HIDE_BSD(sigblock)
HIDE_BSD(sigsetmask)
HIDE_POSIX(sigsuspend)
HIDE_POSIX(osigsuspend)
HIDE_BSD(sigstack)
HIDE_BSD(recvmsg)
HIDE_BSD(sendmsg)
@ -257,3 +257,8 @@ HIDE_BSD(sendfile)
HIDE_BSD(kldsym)
HIDE_BSD(jail)
HIDE_BSD(pioctl)
HIDE_POSIX(sigprocmask)
HIDE_POSIX(sigsuspend)
HIDE_POSIX(sigaction)
HIDE_POSIX(sigpending)
HIDE_BSD(sigreturn)

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.64 1999/09/11 00:45:58 alfred Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.65 1999/09/29 15:01:21 marcel Exp
*/
#define SYS_syscall 0
@ -52,13 +52,13 @@
#define SYS_getegid 43
#define SYS_profil 44
#define SYS_ktrace 45
#define SYS_sigaction 46
#define SYS_osigaction 46
#define SYS_getgid 47
#define SYS_sigprocmask 48
#define SYS_osigprocmask 48
#define SYS_getlogin 49
#define SYS_setlogin 50
#define SYS_acct 51
#define SYS_sigpending 52
#define SYS_osigpending 52
#define SYS_sigaltstack 53
#define SYS_ioctl 54
#define SYS_reboot 55
@ -107,7 +107,7 @@
#define SYS_getpriority 100
/* 101 is old send */
/* 102 is old recv */
#define SYS_sigreturn 103
#define SYS_osigreturn 103
#define SYS_bind 104
#define SYS_setsockopt 105
#define SYS_listen 106
@ -115,7 +115,7 @@
/* 108 is old sigvec */
/* 109 is old sigblock */
/* 110 is old sigsetmask */
#define SYS_sigsuspend 111
#define SYS_osigsuspend 111
/* 112 is old sigstack */
/* 113 is old recvmsg */
/* 114 is old sendmsg */
@ -262,4 +262,9 @@
#define SYS_sendfile 336
#define SYS_kldsym 337
#define SYS_jail 338
#define SYS_MAXSYSCALL 340
#define SYS_sigprocmask 340
#define SYS_sigsuspend 341
#define SYS_sigaction 342
#define SYS_sigpending 343
#define SYS_sigreturn 344
#define SYS_MAXSYSCALL 347

View File

@ -1,7 +1,7 @@
# FreeBSD system call names.
# DO NOT EDIT-- this file is automatically generated.
# $FreeBSD$
# created from FreeBSD: src/sys/kern/syscalls.master,v 1.64 1999/09/11 00:45:58 alfred Exp
# created from FreeBSD: src/sys/kern/syscalls.master,v 1.65 1999/09/29 15:01:21 marcel Exp
MIASM = \
syscall.o \
exit.o \
@ -44,13 +44,13 @@ MIASM = \
getegid.o \
profil.o \
ktrace.o \
sigaction.o \
osigaction.o \
getgid.o \
sigprocmask.o \
osigprocmask.o \
getlogin.o \
setlogin.o \
acct.o \
sigpending.o \
osigpending.o \
sigaltstack.o \
ioctl.o \
reboot.o \
@ -85,11 +85,11 @@ MIASM = \
socket.o \
connect.o \
getpriority.o \
sigreturn.o \
osigreturn.o \
bind.o \
setsockopt.o \
listen.o \
sigsuspend.o \
osigsuspend.o \
gettimeofday.o \
getrusage.o \
getsockopt.o \
@ -217,4 +217,9 @@ MIASM = \
utrace.o \
sendfile.o \
kldsym.o \
jail.o
jail.o \
sigprocmask.o \
sigsuspend.o \
sigaction.o \
sigpending.o \
sigreturn.o

View File

@ -36,6 +36,8 @@
#ifndef _SYS_SYSENT_H_
#define _SYS_SYSENT_H_
#include <sys/signal.h>
struct proc;
typedef int sy_call_t __P((struct proc *, void *));
@ -63,7 +65,7 @@ struct sysentvec {
/* translate trap-to-signal mapping */
int (*sv_fixup) __P((long **, struct image_params *));
/* stack fixup function */
void (*sv_sendsig) __P((void (*)(int), int, int, u_long));
void (*sv_sendsig) __P((void (*)(int), int, sigset_t *, u_long));
/* send signal */
char *sv_sigcode; /* start of sigtramp code */
int *sv_szsigcode; /* size of sigtramp code */

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.64 1999/09/11 00:45:58 alfred Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.65 1999/09/29 15:01:21 marcel Exp
*/
#ifndef _SYS_SYSPROTO_H_
@ -188,17 +188,17 @@ struct ktrace_args {
int facs; char facs_[PAD_(int)];
int pid; char pid_[PAD_(int)];
};
struct sigaction_args {
struct osigaction_args {
int signum; char signum_[PAD_(int)];
struct sigaction * nsa; char nsa_[PAD_(struct sigaction *)];
struct sigaction * osa; char osa_[PAD_(struct sigaction *)];
struct osigaction * nsa; char nsa_[PAD_(struct osigaction *)];
struct osigaction * osa; char osa_[PAD_(struct osigaction *)];
};
struct getgid_args {
register_t dummy;
};
struct sigprocmask_args {
struct osigprocmask_args {
int how; char how_[PAD_(int)];
sigset_t mask; char mask_[PAD_(sigset_t)];
osigset_t mask; char mask_[PAD_(osigset_t)];
};
struct getlogin_args {
char * namebuf; char namebuf_[PAD_(char *)];
@ -210,12 +210,12 @@ struct setlogin_args {
struct acct_args {
char * path; char path_[PAD_(char *)];
};
struct sigpending_args {
struct osigpending_args {
register_t dummy;
};
struct sigaltstack_args {
struct sigaltstack * nss; char nss_[PAD_(struct sigaltstack *)];
struct sigaltstack * oss; char oss_[PAD_(struct sigaltstack *)];
stack_t * ss; char ss_[PAD_(stack_t *)];
stack_t * oss; char oss_[PAD_(stack_t *)];
};
struct ioctl_args {
int fd; char fd_[PAD_(int)];
@ -358,8 +358,8 @@ struct getpriority_args {
int which; char which_[PAD_(int)];
int who; char who_[PAD_(int)];
};
struct sigreturn_args {
struct sigcontext * sigcntxp; char sigcntxp_[PAD_(struct sigcontext *)];
struct osigreturn_args {
struct osigcontext * sigcntxp; char sigcntxp_[PAD_(struct osigcontext *)];
};
struct bind_args {
int s; char s_[PAD_(int)];
@ -377,8 +377,8 @@ struct listen_args {
int s; char s_[PAD_(int)];
int backlog; char backlog_[PAD_(int)];
};
struct sigsuspend_args {
sigset_t mask; char mask_[PAD_(sigset_t)];
struct osigsuspend_args {
osigset_t mask; char mask_[PAD_(osigset_t)];
};
struct gettimeofday_args {
struct timeval * tp; char tp_[PAD_(struct timeval *)];
@ -923,6 +923,25 @@ struct kldsym_args {
struct jail_args {
struct jail * jail; char jail_[PAD_(struct jail *)];
};
struct sigprocmask_args {
int how; char how_[PAD_(int)];
const sigset_t * set; char set_[PAD_(const sigset_t *)];
sigset_t * oset; char oset_[PAD_(sigset_t *)];
};
struct sigsuspend_args {
const sigset_t * sigmask; char sigmask_[PAD_(const sigset_t *)];
};
struct sigaction_args {
int sig; char sig_[PAD_(int)];
const struct sigaction * act; char act_[PAD_(const struct sigaction *)];
struct sigaction * oact; char oact_[PAD_(struct sigaction *)];
};
struct sigpending_args {
sigset_t * set; char set_[PAD_(sigset_t *)];
};
struct sigreturn_args {
ucontext_t * sigcntxp; char sigcntxp_[PAD_(ucontext_t *)];
};
int nosys __P((struct proc *, struct nosys_args *));
void exit __P((struct proc *, struct rexit_args *)) __dead2;
int fork __P((struct proc *, struct fork_args *));
@ -964,13 +983,13 @@ int pipe __P((struct proc *, struct pipe_args *));
int getegid __P((struct proc *, struct getegid_args *));
int profil __P((struct proc *, struct profil_args *));
int ktrace __P((struct proc *, struct ktrace_args *));
int sigaction __P((struct proc *, struct sigaction_args *));
int osigaction __P((struct proc *, struct osigaction_args *));
int getgid __P((struct proc *, struct getgid_args *));
int sigprocmask __P((struct proc *, struct sigprocmask_args *));
int osigprocmask __P((struct proc *, struct osigprocmask_args *));
int getlogin __P((struct proc *, struct getlogin_args *));
int setlogin __P((struct proc *, struct setlogin_args *));
int acct __P((struct proc *, struct acct_args *));
int sigpending __P((struct proc *, struct sigpending_args *));
int osigpending __P((struct proc *, struct osigpending_args *));
int sigaltstack __P((struct proc *, struct sigaltstack_args *));
int ioctl __P((struct proc *, struct ioctl_args *));
int reboot __P((struct proc *, struct reboot_args *));
@ -1005,11 +1024,11 @@ int setpriority __P((struct proc *, struct setpriority_args *));
int socket __P((struct proc *, struct socket_args *));
int connect __P((struct proc *, struct connect_args *));
int getpriority __P((struct proc *, struct getpriority_args *));
int sigreturn __P((struct proc *, struct sigreturn_args *));
int osigreturn __P((struct proc *, struct osigreturn_args *));
int bind __P((struct proc *, struct bind_args *));
int setsockopt __P((struct proc *, struct setsockopt_args *));
int listen __P((struct proc *, struct listen_args *));
int sigsuspend __P((struct proc *, struct sigsuspend_args *));
int osigsuspend __P((struct proc *, struct osigsuspend_args *));
int gettimeofday __P((struct proc *, struct gettimeofday_args *));
int getrusage __P((struct proc *, struct getrusage_args *));
int getsockopt __P((struct proc *, struct getsockopt_args *));
@ -1136,6 +1155,11 @@ int utrace __P((struct proc *, struct utrace_args *));
int sendfile __P((struct proc *, struct sendfile_args *));
int kldsym __P((struct proc *, struct kldsym_args *));
int jail __P((struct proc *, struct jail_args *));
int sigprocmask __P((struct proc *, struct sigprocmask_args *));
int sigsuspend __P((struct proc *, struct sigsuspend_args *));
int sigaction __P((struct proc *, struct sigaction_args *));
int sigpending __P((struct proc *, struct sigpending_args *));
int sigreturn __P((struct proc *, struct sigreturn_args *));
#ifdef COMPAT_43

44
sys/sys/ucontext.h Normal file
View File

@ -0,0 +1,44 @@
/*-
* Copyright (c) 1999 Marcel Moolenaar
* 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
* in this position and unchanged.
* 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. 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.
*
* $FreeBSD$
*/
#ifndef _SYS_UCONTEXT_H_
#define _SYS_UCONTEXT_H_ 1
#include <machine/ucontext.h>
typedef struct __ucontext {
struct __ucontext *uc_link;
stack_t uc_stack;
sigset_t uc_sigmask;
mcontext_t uc_mcontext;
int __spare__[8];
} ucontext_t;
#endif /* _SYS_UCONTEXT_H_ */

View File

@ -410,7 +410,7 @@ mfs_start(mp, flags, p)
register struct vnode *vp = VFSTOUFS(mp)->um_devvp;
register struct mfsnode *mfsp = VTOMFS(vp);
register struct buf *bp;
register int gotsig = 0;
register int gotsig = 0, sig;
/*
* We must prevent the system from trying to swap
@ -449,8 +449,11 @@ mfs_start(mp, flags, p)
*/
if (gotsig) {
gotsig = 0;
if (dounmount(mp, 0, p) != 0)
CLRSIG(p, CURSIG(p)); /* try sleep again.. */
if (dounmount(mp, 0, p) != 0) {
sig = CURSIG(p);
if (sig)
SIGDELSET(p->p_siglist, sig);
}
}
else if (tsleep((caddr_t)vp, mfs_pri, "mfsidl", 0))
gotsig++; /* try to unmount in next pass */