develooper Front page | perl.perl5.porters | Postings from May 2003

Re: Meaning of sysread()

Thread Previous | Thread Next
From:
Graham Barr
Date:
May 21, 2003 08:17
Subject:
Re: Meaning of sysread()
Message ID:
20030521161713.W6593@pobox.com
On Wed, May 21, 2003 at 03:45:39PM +0100, Nick Ing-Simmons wrote:
> Mark Mielke <mark@mark.mielke.cc> writes:
> >
> >I expect Perl sysread() to call C read() without any buffering, which
> >therefore means the level at which the system call returns
> >units. Specifically I don't want select() to ever block where
> >sysread() would return data.
> 
> That way round is reasonably likely to work.
> What the characters semantic might cause is the converse: select()
> says it is readable but sysread() blocks. For example we only have 
> the (part-of?) escape-sequence that says "following characters are ASCII" 
> but no characters yet - and we don't want to return 0 because that means EOF 
> and it isn't.
> 
> Devious work-rounds like failing with EAGAIN might work round this...

But how do you know if to block or not ? If the application does
not call select and just calls sysread(), then it is expecting it
to block until something becomes available. That is unless
they have explicitly set the handle to be non-blocking

Graham.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About