diff options
author | Marcel Moolenaar <marcel@FreeBSD.org> | 1999-09-29 15:03:48 +0000 |
---|---|---|
committer | Marcel Moolenaar <marcel@FreeBSD.org> | 1999-09-29 15:03:48 +0000 |
commit | 2c42a1460203c03abbbcefec9fc4d720423a36f9 (patch) | |
tree | 381e6b5ab51db8d6e49358c49b2d286128beae2c /sys/coda/coda_psdev.c | |
parent | da3605dbea3a43379cf48fee6da798d01478c27f (diff) | |
download | src-2c42a1460203c03abbbcefec9fc4d720423a36f9.tar.gz src-2c42a1460203c03abbbcefec9fc4d720423a36f9.zip |
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.
Notes
Notes:
svn path=/head/; revision=51791
Diffstat (limited to 'sys/coda/coda_psdev.c')
-rw-r--r-- | sys/coda/coda_psdev.c | 73 |
1 files changed, 49 insertions, 24 deletions
diff --git a/sys/coda/coda_psdev.c b/sys/coda/coda_psdev.c index 520702ba48d2..4cd559da1558 100644 --- a/sys/coda/coda_psdev.c +++ b/sys/coda/coda_psdev.c @@ -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 |