Date: Tue, 12 Mar 1996 08:27:03 PST From: "Marty Leisner" <leisner@sdsp.mc.xerox.com> To: Michael Smith <msmith@atrad.adelaide.edu.au> Cc: luigi@labinfo.iet.unipi.it (Luigi Rizzo), questions@freebsd.org Subject: Re: non-blocking read ? Message-ID: <9603121627.AA07775@gnu.mc.xerox.com> In-Reply-To: Your message of "Mon, 11 Mar 1996 16:06:33 PST." <199603120006.KAA24326@genesis.atrad.adelaide.edu.au>
next in thread | previous in thread | raw e-mail | index | archive | help
> Luigi Rizzo stands accused of saying: > > is there a simple way to issue a non-blocking read to a regular file ? > > > > Ideally, I would like a > > > > nbread(handle, buf, count); > > > > which would start reading from the disk, and could then notify > > the completion of I/O via select(). > > Use async I/O and handle SIGIO like everybody else 8) > > > I don't know if fcntl() is enough: you can specify O_NONBLOCK for the > > file, but then I have no idea if select() on that descriptor > > would return immediately or will wait for at least one/the desired > > amound of bytes to be available. > > Select may well behave strangely on regular files; at least I'd expect it > to return immediately unless there's an EOF or error condition. > Reads to regular files are non-blocking by default -- you either read the next block or return EOF...note, they may take "time", but it isn't like a socket or a pipe where you'd wait until something happens... -- marty leisner@sdsp.mc.xerox.com Member of the League for Programming Freedom
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9603121627.AA07775>
