Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!ucsd!ucrmath!rearl From: rearl@watnxt3.ucr.edu (Robert Earl) Newsgroups: comp.unix.questions Subject: Re: A question about read() system call!! Message-ID: Date: 23 May 91 15:54:06 GMT References: <28398698.26968@maccs.dcss.mcmaster.ca> <1991May23.031442.25522@swsrv1.cirr.com> Sender: news@ucrmath.ucr.edu Organization: (EVIL!) Lines: 26 In-reply-to: toma@swsrv1.cirr.com's message of 23 May 91 03:14:42 GMT In article <1991May23.031442.25522@swsrv1.cirr.com> toma@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@watnxt3.ucr.edu \ --Sisters of Mercy rearl@gnu.ai.mit.edu /