From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2210) id 117DE386F008; Mon, 1 Feb 2021 14:58:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 117DE386F008 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ken Brown To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: getdtablesize: always return OPEN_MAX_MAX X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: 6c1552b0da7c7cdf1cf1668b3706c0d1a14c9b2d X-Git-Newrev: 3d256e22e22d435d13cfecf39c15338cfbd6f587 Message-Id: <20210201145854.117DE386F008@sourceware.org> Date: Mon, 1 Feb 2021 14:58:54 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 14:58:54 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3d256e22e22d435d13cfecf39c15338cfbd6f587 commit 3d256e22e22d435d13cfecf39c15338cfbd6f587 Author: Ken Brown Date: Wed Jan 27 20:06:22 2021 -0500 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. Diff: --- 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