Comment by loeg

1 day ago

> But even select() is fine if you just need to watch 2 FDs in a CLI tool.

Only if those fds are below ~1024 or whatever. (If you're going to use one of the legacy interfaces, at least poll() doesn't have arbitrary limits on the numeric value of the fd.)

The Winsock version doesn't have this limitation. It's a very weak select() because it only works on network sockets, but it doesn't care about numeric values of file descriptors. As on POSIX, file descriptors are added and removed to the select set using macros, and these work on a vector or linked list (I forgot) instead of a bitset.

1024 is the default fd limit anyway, isn't it?

  • ...because of select, and how it became essentially impossible to ensure that a process wasn't using it anywhere, indirectly or incidentally.