This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: sleep ignore sigchld
- To: "H. J. Lu" <hjl@freya.yggdrasil.com>
- Subject: Re: sleep ignore sigchld
- From: Linus Torvalds <torvalds@transmeta.com>
- Date: Mon, 16 Nov 1998 11:02:15 -0800 (PST)
- cc: Adrian Hands <AEH@akc.org>, linux kernel <linux-kernel@vger.rutgers.edu>
On Mon, 16 Nov 1998, H. J. Lu wrote:
>
> That is a kernel bug. SIGCHLD is a special one. Usually it cannot
> be ignored. The older libc. Solaris and Hp-UX use alarm/pause to
> implement sleep. It goes back to sleep when SIGCHLD arrives if
> SIGCHLD is ignored. The problem is glibc uses nanosleep to implement
> sleep. The bug is in nanosleep in kernel. I don't think nanosleep
> should wake up when SIGCHLD arrives if SIGCHLD is ignored. We have
> to treat SIGCHLD specially for nanosleep.
No can do.
"nanosleep()" is implemented in a bad way that makes it impossible to
restart it cleanly. It was done that way because glibc wanted it that way,
not because it's a good idea.
In order to handle ignored interrupts without breaking out, the system
call has to be restartable - which means that any timeouts are updated
correctly in the source or in registers. "nanosleep()" doesn't do that.
This is an example of a bad interface, and I would suggest glibc just
revert to the old code for sleep which _is_ restartable.
Linus
--
H.J. Lu (hjl@gnu.org)