That sounds like you might want to use this trick
from http://cr.yp.to/docs/selfpipe.html:
--8<--
Conventional wisdom says that you can't safely mix select() with
SIGCHLD (or other signals): the SIGCHLD might go off while select()
is starting, too early to interrupt it, too late to change its
timeout.
Solution: the self-pipe trick. Maintain a pipe and select for
readability on the pipe input. Inside the SIGCHLD handler, write a
byte (non-blocking, just in case) to the pipe output. Done.
Of course, the Right Thing would be to have fork() return a file
descriptor, not a process ID.
--8<--
--
tv@{{hq.yok.utu,havoc,gaeshido}.fi,{debian,wanderer}.org,stonesoft.com}
unix, linux, debian, networks, security, | Three things are certain:
kernel, TCP/IP, C, perl, free software, | Death, taxes, and lost data.
mail, www, sw devel, unix admin, hacks. | Guess which has occurred.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/