Typo in <sys/select.h>?
Lavrentiev, Anton (NIH/NLM/NCBI) [C]
lavr@ncbi.nlm.nih.gov
Tue Jul 5 14:13:52 GMT 2022
Hi,
There's some inconsistency between <sys/select.h> and <sys/param.h>:
sys/select.h has this:
-----------------------
/*
* Select uses bit masks of file descriptors in longs.
* These macros manipulate such bit fields (the filesystem macros use chars).
* FD_SETSIZE may be defined by the user, but the default here
* should be >= NOFILE (param.h).
*/
#ifndef FD_SETSIZE
#define FD_SETSIZE 64
#endif
----------------------
Now, this is the relevant part of sys/param.h looks like this:
----------------------
/* Max number of open files. The Posix version is OPEN_MAX. */
/* Number of fds is virtually unlimited in cygwin, but we must provide
some reasonable value for Posix conformance */
#define NOFILE 8192
----------------------
So it's either "<= NOFILE" that was actually meant to be there in the comment (or,
an equivalent "should NOT be > NOFILE"), or FD_SETSIZE should have been defined as 8192,
if the comment is actually correct. Or maybe I'm missing something here :-)
I understand that if I redefined FD_SETSIZE in my code before including <sys/select.h>,
it'd work with whatever large (or small) fd_set I need, but that's not what I'm after.
Anton Lavrentiev
Contractor NIH/NLM/NCBI
More information about the Cygwin
mailing list