[comp.bugs.4bsd] fcntl does not perform as stated in man page

cammie@oravax.UUCP (Cammie Howard) (07/19/88)

As I understand the man (2) page for fcntl, the line

	fcntl(d,F_SETFL,FNDELAY)

is supposed to make a "read" call on the file descriptor d and return
a -1 if you're at the EOF of d.  

The results are that it returns a 0.

Is there a fix for this?

Thank you,

	Cammie Howard

	cammie%oravax.uucp@cu-arpa.cs.cornell.edu

boykin@encore.UUCP (Joe Boykin) (07/20/88)

In article <405@oravax.UUCP> cammie@oravax.UUCP (Cammie Howard) writes:
>As I understand the man (2) page for fcntl, the line
>
>	fcntl(d,F_SETFL,FNDELAY)
>
>is supposed to make a "read" call on the file descriptor d and return
>a -1 if you're at the EOF of d.  
>
>The results are that it returns a 0.

What this call does is to make sure that any *future* read call will
return -1 with errno set to EWOULDBLOCK.  The fcntl call itself just
specifies that this is the specified behavior, rather than the normal
behavior of blocking until input is available.  The return value of 0
indicates that the fcntl completed successfully, rather than (in this
case) EBADF stating that you passed it an invalid file descriptor (d).

----

Joe Boykin
Encore Computer Corp
Chairman, IEEE Computer Societies
    Technical Committee on Operating Systems

UUCP: encore!boykin
ARPA: boykin@multimax.arpa