A question about read() system call!!

Robert Earl rearl at watnxt3.ucr.edu
Fri May 24 01:54:06 AEST 1991


In article <1991May23.031442.25522 at swsrv1.cirr.com> toma at swsrv1.cirr.com (Tom Armistead) writes:

|   You need to use the O_NDELAY flags for open, e.g.
|
|	   open( "FILE", O_RDONLY|O_NDELAY )

Remember that some versions of open(2) take three arguments, path,
flags, and mode.

|   With the O_NDELAY set, the open will fail (with -1) and errno will be set to
|   ?(I think)? ENXIO.

The manpage says that all O_NDELAY does is causes open() to return
immediately with a file descriptor if the operation would block
otherwise.  The first read() on the descriptor will return EWOULDBLOCK
(on the systems I checked.)  ENXIO is "No such device or address".
So, you must use the FNDELAY (aka O_NDELAY) fcntl once the descriptor
is open.


--
______________________________________________________________________
			\					
 robert earl		/	"Love is a many splintered thing"
 rearl at watnxt3.ucr.edu	\		--Sisters of Mercy
 rearl at gnu.ai.mit.edu	/



More information about the Comp.unix.questions mailing list