Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 1996 10:36:33 +1030 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        luigi@labinfo.iet.unipi.it (Luigi Rizzo)
Cc:        questions@freebsd.org
Subject:   Re: non-blocking read ?
Message-ID:  <199603120006.KAA24326@genesis.atrad.adelaide.edu.au>
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
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  [[



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