Date: Mon, 8 Dec 1997 23:05:24 +0100 (MET) From: Luigi Rizzo <luigi@labinfo.iet.unipi.it> To: avalon@coombs.anu.edu.au (Darren Reed) Cc: tlambert@primenet.com, julian@whistle.com, hackers@FreeBSD.ORG Subject: Re: Why FIONREAD has no dual for write ? Message-ID: <199712082205.XAA29524@labinfo.iet.unipi.it> In-Reply-To: <199712082202.OAA18121@hub.freebsd.org> from "Darren Reed" at Dec 9, 97 09:01:37 am
next in thread | previous in thread | raw e-mail | index | archive | help
> 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/ _____________________________|______________________________________
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712082205.XAA29524>