[prev in list] [next in list] [prev in thread] [next in thread]
List: cygwin-patches
Subject: [PATCH 1/4] Cygwin: getdtablesize: always return OPEN_MAX_MAX
From: Ken Brown via Cygwin-patches <cygwin-patches () cygwin ! com>
Date: 2021-01-29 19:24:18
Message-ID: 20210129192421.1651-2-kbrown () cornell ! edu
[Download RAW message or body]
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.
---
winsup/cygwin/syscalls.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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
--
2.30.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic