public inbox for
 help / color / mirror / Atom feed
From: Ken Brown <>
Subject: [PATCH 1/4] Cygwin: getdtablesize: always return OPEN_MAX_MAX
Date: Fri, 29 Jan 2021 14:24:18 -0500	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

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
 winsup/cygwin/ | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/ b/winsup/cygwin/
index 82ddad46d..d293ff2c0 100644
--- a/winsup/cygwin/
+++ b/winsup/cygwin/
@@ -2887,7 +2887,7 @@ setdtablesize (int size)
 extern "C" int
 getdtablesize ()
-  return cygheap->fdtab.size;
+  return OPEN_MAX_MAX;
 extern "C" int

  reply	other threads:[~2021-01-29 19:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 19:24 [PATCH 0/4] getdtablesize, OPEN_MAX, etc Ken Brown
2021-01-29 19:24 ` Ken Brown [this message]
2021-01-29 19:24 ` [PATCH 2/4] Cygwin: sysconf, getrlimit: don't call getdtablesize Ken Brown
2021-01-29 19:24 ` [PATCH 3/4] Cygwin: remove the OPEN_MAX_MAX macro Ken Brown
2021-01-29 19:24 ` [PATCH 4/4] Cygwin: include/cygwin/limits.h: new header Ken Brown
2021-02-01 10:46 ` [PATCH 0/4] getdtablesize, OPEN_MAX, etc Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).