From owner-freebsd-hackers Mon Dec 8 15:06:42 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id PAA24905 for hackers-outgoing; Mon, 8 Dec 1997 15:06:42 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id PAA24873 for ; Mon, 8 Dec 1997 15:06:33 -0800 (PST) (envelope-from luigi@labinfo.iet.unipi.it) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id XAA29524; Mon, 8 Dec 1997 23:05:25 +0100 From: Luigi Rizzo Message-Id: <199712082205.XAA29524@labinfo.iet.unipi.it> Subject: Re: Why FIONREAD has no dual for write ? To: avalon@coombs.anu.edu.au (Darren Reed) Date: Mon, 8 Dec 1997 23:05:24 +0100 (MET) Cc: tlambert@primenet.com, julian@whistle.com, hackers@FreeBSD.ORG In-Reply-To: <199712082202.OAA18121@hub.freebsd.org> from "Darren Reed" at Dec 9, 97 09:01:37 am X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > I don't know how select() works with drivers such as the audio drivers, > but I've only encountered one OS which returned an fd as witeable when > it wasn't and it hasn't been possible to buy that particular Unix for > some years now. i was not referring to broken select(). But i think a working select returns you an fd as soon as you can exchange one byte on it. What happens underneath is probably device-dependent, e.g. a tty with some special line discipline might make select return when full slip/ppp packets are ready, or when whole mouse frames (3/5 bytes) are ready... I have no idea if select on a tty really works like this. I hope so, but then... is there a PPP or MOUSE line discipline ? Audio drivers typically use DMA to transfer one block at a time, you can set the blocksize but in general you cannot tell 'wake me up when a whole block is ready'. This can be a problem when the allowed block sizes are not the same as your desired block size. E.g. in Voxware, you can have DMA blocksizes which are powers of two, but the audio frame is 160 samples... In my audio driver I explicitly modify the select() behaviour so that, when the user explicitly requests a blocksize (e.g. 160 bytes) then select() nonly returns when that many bytes can be read/written to the device. > > Plus there are apps which want only to check the status of the queue in > > a descriptor without actually doing the I/O, for whatever reason they > > like. > > You can still use select for this. again you cannot tell the difference between different levels of queue occupation, only empty/non-empty and full/non-full luigi -----------------------------+-------------------------------------- Luigi Rizzo | Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it | Universita' di Pisa tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ _____________________________|______________________________________