summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2021-01-27 20:06:22 -0500
committerKen Brown <kbrown@cornell.edu>2021-02-01 09:55:07 -0500
commit3d256e22e22d435d13cfecf39c15338cfbd6f587 (patch)
tree6b485c62fcaa8d60148de9ffbdb47466328de7ee
parent6c1552b0da7c7cdf1cf1668b3706c0d1a14c9b2d (diff)
downloadcygnal-3d256e22e22d435d13cfecf39c15338cfbd6f587.tar.gz
cygnal-3d256e22e22d435d13cfecf39c15338cfbd6f587.tar.bz2
cygnal-3d256e22e22d435d13cfecf39c15338cfbd6f587.zip
Cygwin: getdtablesize: always return OPEN_MAX_MAX
According to the Linux man page for getdtablesize(3), the latter is supposed to return "the maximum number of files a process can have open, one more than the largest possible value for a file descriptor." The constant OPEN_MAX_MAX is the only limit enforced by Cygwin, so we now return that. Previously getdtablesize returned the current size of cygheap->fdtab, Cygwin's internal file descriptor table. But this is a dynamically growing table, and its current size does not reflect an actual limit on the number of open files. With this change, gnulib now reports that getdtablesize and fcntl(F_DUPFD) work on Cygwin. Packages like GNU tar that use the corresponding gnulib modules will no longer use gnulib replacements on Cygwin.
-rw-r--r--winsup/cygwin/syscalls.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 82ddad46d..d293ff2c0 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -2887,7 +2887,7 @@ setdtablesize (int size)
extern "C" int
getdtablesize ()
{
- return cygheap->fdtab.size;
+ return OPEN_MAX_MAX;
}
extern "C" int