Cygwin: redefine some macros for Linux compatibility

Define FD_SETSIZE (<sys/select.h>) to be 1024 by default, and define
NOFILE (<sys/param.h>) to be OPEN_MAX (== 3200) by default.

Remove the comment in <sys/select.h> that FD_SETSIZE should be >=
NOFILE.

Bump API minor.

Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251839.html
This commit is contained in:
Ken Brown 2022-07-06 14:43:16 -04:00
parent d908a30fdc
commit 5d4f405d3b
5 changed files with 21 additions and 5 deletions

View File

@ -25,11 +25,15 @@ typedef __sigset_t sigset_t;
* 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).
* should be enough for most uses.
*/
#ifndef FD_SETSIZE
# ifdef __CYGWIN__
# define FD_SETSIZE 1024
# else
# define FD_SETSIZE 64
# endif
#endif
typedef unsigned long __fd_mask;
#if __BSD_VISIBLE

View File

@ -517,12 +517,13 @@ details. */
pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock,
sem_clockwait, sig2str, str2sig.
342: Remove cleanup_glue.
343: Change FD_SETSIZE and NOFILE.
Note that we forgot to bump the api for ualarm, strtoll, strtoull,
sigaltstack, sethostname. */
#define CYGWIN_VERSION_API_MAJOR 0
#define CYGWIN_VERSION_API_MINOR 342
#define CYGWIN_VERSION_API_MINOR 343
/* There is also a compatibity version number associated with the shared memory
regions. It is incremented when incompatible changes are made to the shared

View File

@ -17,7 +17,9 @@
/* 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
#if !defined NOFILE && defined OPEN_MAX
# define NOFILE OPEN_MAX
#endif
/* Max number of groups; must keep in sync with NGROUPS_MAX in limits.h */
#define NGROUPS NGROUPS_MAX

View File

@ -25,6 +25,10 @@ What changed:
the current directory as Linux does.
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251730.html
- The default values of FD_SETSIZE and NOFILE are now 1024 and 3200,
respectively.
Addresses: https://cygwin.com/pipermail/cygwin/2022-July/251839.html
Bug Fixes
---------

View File

@ -33,6 +33,11 @@ Handle UDP_SEGMENT and UDP_GRO socket options.
The stdio input functions no longer try again to read after EOF.
</para></listitem>
<listitem><para>
The default values of FD_SETSIZE and NOFILE are now 1024 and 3200,
respectively.
</para></listitem>
</itemizedlist>
</sect2>