From owner-freebsd-questions Mon Mar 11 15:58:19 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA01562 for questions-outgoing; Mon, 11 Mar 1996 15:58:19 -0800 (PST) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id PAA01557 for ; Mon, 11 Mar 1996 15:58:15 -0800 (PST) Received: from msmith@localhost by genesis.atrad.adelaide.edu.au (8.6.12/8.6.9) id KAA24326; Tue, 12 Mar 1996 10:36:33 +1030 From: Michael Smith Message-Id: <199603120006.KAA24326@genesis.atrad.adelaide.edu.au> Subject: Re: non-blocking read ? To: luigi@labinfo.iet.unipi.it (Luigi Rizzo) Date: Tue, 12 Mar 1996 10:36:33 +1030 (CST) Cc: questions@freebsd.org In-Reply-To: <199603111814.TAA18793@labinfo.iet.unipi.it> from "Luigi Rizzo" at Mar 11, 96 07:14:37 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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. > Luigi Rizzo Dip. di Ingegneria dell'Informazione -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] Collector of old Unix hardware. "Where are your PEZ?" The Tick [[