Subject: Re: select(2) question...
To: Jason Thorpe <>
From: Ken Hornstein <>
List: tech-userlevel
Date: 12/13/1994 23:38:48
>Well, I've asked several folks around here, read several manpages on the 
>subject, and still can't find the info that I need, so...
>Select() can test for 3 conditions: ready for reads, ready for writes, 
>and the one that's got me stuck, ``exceptional conditions''.  Can someone 
>define the latter for me?  Specifically, I'm wondering if the 
>closing of a file descriptor during the selection process generates such 
>a condition.

According to "Advanced Programming in the Unix Environment", by Richard
Stevens, an exception condition is triggered by two things:

- Out of band data arriving on a networking connection
- Certain conditions occuring on a pseudo-tty that has been placed into
  packet mode.

If I'm not mistaken, an end of file is signalled by a zero-length read.  If
select says the data is available for reading, and read() returns zero, then
the file is closed.

BTW - I'd just like to make a plug for the abovementioned book.  It's rather
expensive, but is by far one of the best and most practical Unix books I've
ever read.