21

When one calls select() asking which file descriptors have "exceptions" waiting, what does that mean?

How does one trigger one of these "exceptions"?

If anyone can point me to a nice explanation, that'd be awesome. I've been googling and can't find a thing.

Verdagon
  • 2,456
  • 3
  • 22
  • 36
  • Possible duplicate of [\*nix select and exceptfds/errorfds semantics](http://stackoverflow.com/questions/1342712/nix-select-and-exceptfds-errorfds-semantics) – kriss Aug 24 '16 at 09:44

2 Answers2

13

Short form: exceptional situations occur when a TCP socket recieves out of band data.

If you read the select manual page, you will find a reference to another supplementary manual page called select_tut with the explanation:

exceptfds

This set is watched for "exceptional conditions". In practice, only one such exceptional condition is common: the availability of out-of-band (OOB) data for reading from a TCP socket. See recv(2), send(2), and tcp(7) for more details about OOB data. (One other less common case where select(2) indicates an exceptional condition occurs with pseudo-terminals in packet mode; see tty_ioctl(4).) After select() has returned, exceptfds will be cleared of all file descriptors except for those for which an exceptional condition has occurred.

Community
  • 1
  • 1
jmkeyes
  • 3,751
  • 17
  • 20
3

Indeed there seems to be very little information on this. Thankfully there's an existing question with a very good answer.

In the case of Linux, for example, it can denote out-of-band data being received on a stream socket, or "a state change occuring on a pseudoterminal slave connected to a master that is in packet mode" (TLPI 63.2.1).

Community
  • 1
  • 1
Jorge Israel Peña
  • 36,800
  • 16
  • 93
  • 123