Subject: Re: race in select() ?
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 10/09/2003 22:55:39
> I have a different, somewhat wackier suggestion...
> 
> Pass an actual timeval to select(), with a Really Large Value.  In the SIGCHLD 
> handler, when we restore a socket in the mask, set the timeout to 0.  Handle 
> EWOULDBLOCK by resetting the timeval to the Really Large Value and looping 
> around again.

That isn't the problem. select should (surely) fail EINTR?
The existing code can only work if the select fails.

The problems happen when the signal handler runs while the process
is in the system call shim.

What you actaully need is for the process to have be able to disable
signals unless it is actually blocked interruptable in the kernel.

ie a bit like sigsuspend() but for all system calls.

	David

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