Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 1996 10:17:39 PST
From:      "Marty Leisner" <leisner@sdsp.mc.xerox.com>
To:        Luigi Rizzo <luigi@labinfo.iet.unipi.it>
Cc:        msmith@atrad.adelaide.edu.au, questions@freebsd.org
Subject:   Re: non-blocking read ? 
Message-ID:  <9603121817.AA08720@gnu.mc.xerox.com>
In-Reply-To: Your message of "Tue, 12 Mar 1996 10:06:55 PST." <199603121806.TAA20924@labinfo.iet.unipi.it> 

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9603121817.AA08720>