Subject: uses of CLRSIG()
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 04/02/2006 12:48:18
sys/signalvar.h has:
#define CLRSIG(p, sig) sigdelset(&p->p_sigctx.ps_siglist, sig)
sys/signal.h has:
#define sigdelset(s, n) __sigdelset(s, n)
sys/sigtypes.h has:
#define __sigdelset(s, n) ((s)->__bits[__sigword(n)] &= ~__sigmask(n))
#define __sigword(n) (((unsigned int)(n) - 1) >> 5)

Note that this means that the 'sig' arg to CLRSIG() must not be zero, and
is evaluted twice.

CLRSIG() is used exactly twice [1], both as:
	CLRSIG(p, CURSIG(l));
CURSIG is defined in sys/signalvar.h as:
#define CURSIG(l) (l->l_proc->p_sigctx.ps_sigcheck ? issignal(l) : 0)

So it can easily return 0, and issignal() might return different values
when called twice - it is quite a complex function.

I don't know enough about the signal code to know what CLRSIG should
actually do...

	David

[1] nfs/nfs_nqlease.c & ufs/mfs/mfs_vfsops.c

-- 
David Laight: david@l8s.co.uk