Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.wizards Subject: Re: But I don't wanna do non-blocking I/O... Message-ID: <1990Jun12.203245.5804@virtech.uucp> Date: 12 Jun 90 20:32:45 GMT References: <397@minya.UUCP> Reply-To: cpcahil@virtech.UUCP (Conor P. Cahill) Organization: Virtual Technologies Inc., Sterling VA Lines: 26 In article <397@minya.UUCP> jc@minya.UUCP (John Chambers) writes: > > [story of program where fgets() returns EOF on first read deleted] > >calling a shell. The open() does include F_NDELAY, but ^^^^^^^^ I assume you mean O_NDELAY >this is supposed to apply only to the open; it shouldn't >set non-blocking I/O permanently for the file (I hope ;-). You should RTFM (specifically the read(2) man page). Therein you should find a paragraph similar to the following: When attempting to read a file associated with a tty that has no data currently available: If O_NDELAY is set, the read will return 0. If O_NDELAY is clear, the read will block until data becomes available. If you don't want this behavior, you should use the fcntl(2) to change turn off the O_NDELAY once the open has returned. -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170