fcntl does not perform as stated in

willcox at urbsdc.Urbana.Gould.COM willcox at urbsdc.Urbana.Gould.COM
Thu Jul 21 23:58:00 AEST 1988


>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).

This isn't how I read the original note, though it was a bit ambiguous.  

The fcntl (...FNDELAY) ensures that a later read on the file descriptor
will set EWOULDBLOCK if it would block.  This does not apply to regular
files, just to things that might block you for a long time like ttys or
sockets.

The original posting expected the later read to return -1 and set
EWOULDBLOCK on an EOF, but FNDELAY does not change the behavior of a
read at EOF.

David A. Willcox
Gould CSD-Urbana
1101 E. University Ave.
Urbana, IL 61801
217-384-8500
UUCP: uunet!uiucuxc!urbsdc!willcox
ARPA:	willcox at xenurus.Gould.COM
	willcox at Gould.COM
	willcox at gswd-vms.Gould.COM (old host name)
	willcox at gswd-vms.arpa (old host name)



More information about the Comp.bugs.4bsd.ucb-fixes mailing list