[Discuss] Making read() non-restartable
noel at natnix.com
noel at natnix.com
Tue Dec 5 12:36:09 PST 2006
Interesting question! What are you reading from? A file? socket? How
do you know that read doesn't get interrupted? You will only get EINTR
if read was interrupted before it read anything. If read() gets n bytes
before an interrupt, it will return n.
If you're using perl, are you using read() or sysread()?
--Noel
On Tue, Dec 05, 2006 at 10:41:45AM -0800, Peter Scott wrote:
> I may be a bit out of my depth here, but I have at least (tried to)
> read Stevens on the subject. It appears that read() is restartable by
> default. I want it to not be restarted after SIGALRM. How/can I do
> that? It's getting restarted even though SA_RESTART was not specified
> in sigaction(). And SA_INTERRUPT is a no-op according to
> bits/sigaction.h. (Yeah, I'm doing it in Perl, but I straced it so I
> could see the system calls and that's where I see read() returning
> ERESTARTSYS.)
> --
> Peter Scott
> Pacific Systems Design Technologies
> http://www.perldebugged.com/
> http://www.perlmedic.com/
>
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
More information about the Discuss
mailing list