|
|
Message-ID: <aEbDlK7qUVEVkTaP@snips.stderr.spb.ru>
Date: Mon, 9 Jun 2025 14:20:52 +0300
From: Valery Ushakov <uwe@...err.spb.ru>
To: musl@...ts.openwall.com
Subject: Re: The `sigpause` function behavior does not fully comply with the
POSIX specification
On Sun, Jun 08, 2025 at 14:49:32 -0400, Rich Felker wrote:
> This would probably call for an interpretation, except that the
> functions were removed from the standard and the standard no longer
> has anything to say about them. So I'm not sure what's best to do.
>
> If the historical precedent in other implementations is for not
> reporting an error here, and applications are expecting that, perhaps
> we should revert the change?
sigpause is a 4.3BSD interface and it used to be a system call that
did this:
https://www.retro11.de/ouxr/43bsd/usr/src/sys/sys/kern_sig.c.html#s:_sigpause
sigpause()
{
struct a {
int mask;
} *uap = (struct a *)u.u_ap;
register struct proc *p = u.u_procp;
/*
* When returning from sigpause, we want
* the old mask to be restored after the
* signal handler has finished. Thus, we
* save it here and mark the proc structure
* to indicate this (should be in u.).
*/
u.u_oldmask = p->p_sigmask;
p->p_flag |= SOMASK;
p->p_sigmask = uap->mask &~ cantmask;
for (;;)
sleep((caddr_t)&u, PSLEP);
/*NOTREACHED*/
}
Which also brings up another question. The current NetBSD man page
documents that behavior in https://man.netbsd.org/sigpause.3 as
(emphasis mine):
sigpause() ASSIGNS sigmask to the set of masked signals and then waits
for a signal to arrive;
While POSIX says:
The sigpause() function shall REMOVE sig from the signal mask of the
calling process and suspend the calling process until a signal is
received.
Which is not what historic sigpause(2) did, if i read this text (and
"sigdelset" in implementations) correctly.
-uwe
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.