When working with sigset_t's, and needing to perform masking operations based

on a process's pending signals, use the signal queue flattener,
ksiginfo_to_sigset_t, on the process, and on a local sigset_t, and then work
with that as needed.
This commit is contained in:
jmallett 2002-10-01 02:49:28 +00:00
parent 40b01ec743
commit 588e26e580
3 changed files with 23 additions and 15 deletions

View File

@ -63,6 +63,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/file.h> /* must come after sys/malloc.h */
#include <sys/ksiginfo.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/poll.h>
@ -491,6 +492,7 @@ coda_call(mntinfo, inSize, outSize, buffer)
#ifdef CTL_C
struct thread *td = curthread;
struct proc *p = td->td_proc;
sigset_t pending_set;
sigset_t psig_omask;
sigset_t tempset;
int i;
@ -561,18 +563,20 @@ coda_call(mntinfo, inSize, outSize, buffer)
#endif
}
else {
ksiginfo_to_sigset_t(p, &pending_set);
SIGEMPTYSET(tempset);
SIGADDSET(tempset, SIGIO);
if (SIGSETEQ(p->p_siglist, tempset)) {
if (SIGSETEQ(pending_set, tempset)) {
SIGADDSET(p->p_sigmask, SIGIO);
#ifdef CODA_VERBOSE
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n",
error, i);
#endif
} else {
ksiginfo_to_sigset_t(p, &pending_set);
SIGDELSET(tempset, SIGIO);
SIGADDSET(tempset, SIGALRM);
if (SIGSETEQ(p->p_siglist, tempset)) {
if (SIGSETEQ(pending_set, tempset)) {
SIGADDSET(p->p_sigmask, SIGALRM);
#ifdef CODA_VERBOSE
printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n",
@ -584,17 +588,17 @@ coda_call(mntinfo, inSize, outSize, buffer)
error, i);
#if notyet
tempset = p->p_siglist;
tempset = pending_set;
SIGSETNAND(tempset, p->p_sigmask);
printf("coda_call: siglist = %p, sigmask = %p, mask %p\n",
p->p_siglist, p->p_sigmask,
pending_set, p->p_sigmask,
tempset);
break;
SIGSETOR(p->p_sigmask, p->p_siglist);
tempset = p->p_siglist;
SIGSETOR(p->p_sigmask, pending_set);
tempset = pending_set;
SIGSETNAND(tempset, p->p_sigmask);
printf("coda_call: new mask, siglist = %p, sigmask = %p, mask %p\n",
p->p_siglist, p->p_sigmask,
pending_set, p->p_sigmask,
tempset);
#endif
}

View File

@ -63,6 +63,7 @@ extern int coda_nc_initialized; /* Set if cache has been initialized */
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/file.h> /* must come after sys/malloc.h */
#include <sys/ksiginfo.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/poll.h>
@ -491,6 +492,7 @@ coda_call(mntinfo, inSize, outSize, buffer)
#ifdef CTL_C
struct thread *td = curthread;
struct proc *p = td->td_proc;
sigset_t pending_set;
sigset_t psig_omask;
sigset_t tempset;
int i;
@ -561,18 +563,20 @@ coda_call(mntinfo, inSize, outSize, buffer)
#endif
}
else {
ksiginfo_to_sigset_t(p, &pending_set);
SIGEMPTYSET(tempset);
SIGADDSET(tempset, SIGIO);
if (SIGSETEQ(p->p_siglist, tempset)) {
if (SIGSETEQ(pending_set, tempset)) {
SIGADDSET(p->p_sigmask, SIGIO);
#ifdef CODA_VERBOSE
printf("coda_call: tsleep returns %d SIGIO, cnt %d\n",
error, i);
#endif
} else {
ksiginfo_to_sigset_t(p, &pending_set);
SIGDELSET(tempset, SIGIO);
SIGADDSET(tempset, SIGALRM);
if (SIGSETEQ(p->p_siglist, tempset)) {
if (SIGSETEQ(pending_set, tempset)) {
SIGADDSET(p->p_sigmask, SIGALRM);
#ifdef CODA_VERBOSE
printf("coda_call: tsleep returns %d SIGALRM, cnt %d\n",
@ -584,17 +588,17 @@ coda_call(mntinfo, inSize, outSize, buffer)
error, i);
#if notyet
tempset = p->p_siglist;
tempset = pending_set;
SIGSETNAND(tempset, p->p_sigmask);
printf("coda_call: siglist = %p, sigmask = %p, mask %p\n",
p->p_siglist, p->p_sigmask,
pending_set, p->p_sigmask,
tempset);
break;
SIGSETOR(p->p_sigmask, p->p_siglist);
tempset = p->p_siglist;
SIGSETOR(p->p_sigmask, pending_set);
tempset = pending_set;
SIGSETNAND(tempset, p->p_sigmask);
printf("coda_call: new mask, siglist = %p, sigmask = %p, mask %p\n",
p->p_siglist, p->p_sigmask,
pending_set, p->p_sigmask,
tempset);
#endif
}

View File

@ -456,7 +456,7 @@ ibcs2_sigpending(td, uap)
ibcs2_sigset_t iss;
PROC_LOCK(p);
bss = p->p_siglist;
ksiginfo_to_sigset_t(p, &bss);
SIGSETAND(bss, p->p_sigmask);
PROC_UNLOCK(p);
bsd_to_ibcs2_sigset(&bss, &iss);