Date: Wed, 13 Mar 1996 05:45:43 -0500 (EST) From: Peter Dufault <dufault@hda.com> To: luigi@labinfo.iet.unipi.it (Luigi Rizzo) Cc: questions@FreeBSD.org Subject: Re: non-blocking read ? Message-ID: <199603131045.FAA24643@hda.com> In-Reply-To: <199603111814.TAA18793@labinfo.iet.unipi.it> from "Luigi Rizzo" at Mar 11, 96 07:14:37 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > Hi, > 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(). > > 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. If you're interested in portability then the POSIX spec says that O_NONBLOCK behavior on a regular file is unspecified. If you don't mind the extra syscall overhead then you can stat the file and keep track of what was there. I do this in a data logging display package. This should be portable. -- *** March 13, 1996: Our ISP may be GONE. You may never read this. *** *** "hda.com" connectivity is now intermittent to nonexistent *** Peter Dufault Real-Time Machine Control and Simulation HD Associates, Inc. Voice: 508 433 6936 dufault@hda.com Fax: 508 433 5267
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603131045.FAA24643>