Xref: utzoo comp.sys.hp:6122 comp.unix.internals:166 Path: utzoo!utgpu!watserv1!watmath!att!occrsh!uokmax!apple!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.sys.hp,comp.unix.internals Subject: Re: hp-ux 7.0/800 select() strangeness? Message-ID: <26445@mimsy.umd.edu> Date: 9 Sep 90 12:53:02 GMT References: <90242.151955MAH@awiwuw11.wu-wien.ac.at> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 35 In article cph@zurich.ai.mit.edu (Chris Hanson) writes: >The real problem here is that the documentation for `select' doesn't >define what it does. ... Well, the most likely reason is that select does not *do* ANYthing, except time out. The `selecting' is all done in lower layers, much like ioctl. There is no way that ioctl(2) can list what ioctl() does, because it really does not do *any*thing. >"... reading, writing, or has an exceptional condition" Of course, the lower layers try to do something sensible. For `read', select is supposed to return true whenever a read() system call would not block, regardless of any `non-blocking' mode on the file descriptor. That is, it should return true when there are data, and it should return true when there is a `boundary condition' like an `EOF' on a tty or a socket. For `write', it is supposed to return true when the lower layer can accept (some) more data without blocking. `Exceptions' are left entirely up to the lower layers, and you have to look at those (or read their manuals, provided that someone bothered to document them properly) to find out which descriptor entities (sockets, ptys, ttys, disks, tapes, ...) actually do something, and what, with `exceptions'. >An aside: if it were the case that "ready for reading" meant "a read >on this channel will not block", then `select' would always say >"readable" for every non-blocking channel. But emacs did a `select' >on four channels, all non-blocking, and it indicated only one of them >was "readable". So I don't believe this definition is correct. No, but it is close---closer than `there are data', at any rate. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris