chris@mimsy.umd.edu (Chris Torek) (05/02/90)
In article <6739@blake.acs.washington.edu> wiml@blake.acs.washington.edu (William Lewis) writes: >... what exactly is the third (fds *) argumnt to select(), called >'exceptfds' in the manual, do? Everything or nothing or maybe something. (Keep reading; there really is some information here :-) ) >The manual says it signals an 'exceptional condition' on the socket, >but does not say what an exceptional condition is. An `exceptional condition' is whatever the code for the object underlying a given file descriptor wants to call `exceptional'. A character device driver, for instance, that connects to a weather monitor could define `exceptional condition' as `tornado headed for computer center'. Now, at it happens, the code for sockets says `there is an exception' whenever there is any out of band data on the socket. It does NOT (and nothing should) say `exception' when a peer closes a socket, because that is a normal condition that shows up as end-of-file. The latter is indicated as `ready for read', since `select for read' really means `ask whether read() will not block'. EOF does not block, so it is `ready to be read'. On EOF, programs should close the (now dead) socket and stop selecting on that socket. The code for other drivers does other things. In particular, the pty driver says `exception' when there is a `control byte' available in TIOCPKT or TIOCUCNTL mode. No other standard driver does anything special. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris