Fun with file descriptors
Posted Jun 11, 2007 9:33 UTC (Mon) by
nlucas (subscriber, #33793)
In reply to:
Fun with file descriptors by RobSeace
Parent article:
Fun with file descriptors
According to the text, the problem is with applications assuming the "lowest available descriptor" guarantee, which seems to be a POSIX thing, so can't be changed in the generic case.
An example where it can be an issue would be for an application to allocate several file descriptors in a loop, mixed with the usual mix of libc functions, and then assume the <max> parameter for select (which, by the way, is a brain-dead parameter) as the first file descriptor plus the number of file descriptors created.
This seems to be a POSIX accepted behaviour, even if the code seems a bit fishy (not very good for later maintenance), so must be supported either by the kernel or by libc.
(
Log in to post comments)