From owner-freebsd-questions Tue Mar 12 10:18:30 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id KAA03070 for questions-outgoing; Tue, 12 Mar 1996 10:18:30 -0800 (PST) Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id KAA03064 for ; Tue, 12 Mar 1996 10:18:27 -0800 (PST) Received: from gemini.sdsp.mc.xerox.com ([13.231.132.20]) by alpha.xerox.com with SMTP id <14745(11)>; Tue, 12 Mar 1996 10:17:47 PST Received: from gnu.mc.xerox.com (gnu.sdsp.mc.xerox.com) by gemini.sdsp.mc.xerox.com (4.1/SMI-4.1) id AA03253; Tue, 12 Mar 96 13:17:48 EST Received: by gnu.mc.xerox.com (4.1/SMI-4.1) id AA08720; Tue, 12 Mar 96 13:17:42 EST Message-Id: <9603121817.AA08720@gnu.mc.xerox.com> To: Luigi Rizzo Cc: msmith@atrad.adelaide.edu.au, questions@freebsd.org Subject: Re: non-blocking read ? In-Reply-To: Your message of "Tue, 12 Mar 1996 10:06:55 PST." <199603121806.TAA20924@labinfo.iet.unipi.it> Date: Tue, 12 Mar 1996 10:17:39 PST From: "Marty Leisner" Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk In message <199603121806.TAA20924@labinfo.iet.unipi.it>, you write: > result=read(handle, buf, size); > >The lseek might be non blocking -- no problem with that. >The read is non-blocking because of the previous call to fcntl(). > >But how much data will be available when I get the SIGIO (or select >will return that I/O is possible) ? The amount I requested (assuming it >is available), or the system idea of a block, or what ? > > Thanks > Luigi Reads on files have to block...the only think you can do is set a timer to go off in about 10 Msec, and if the read isn't done yet, the alarm will knock you out of the read with an -EINTR. I don't know if the kernel will continue on the read... GNU libc says: - Macro: int O_NONBLOCK This prevents `open' from blocking for a "long time" to open the file. This is only meaningful for some kinds of files, usually devices such as serial ports; when it is not meaningful, it is harmless and ignored. Often opening a port to a modem blocks until the modem reports carrier detection; if `O_NONBLOCK' is specified, `open' will return immediately without a carrier. files but design "don't block" marty