The first part of your proposal looks OK (and I installed the attached patch, which does something like that), but the second one I'm dubious about. We prefer keeping the gnulib code close to the glibc code. libc code can refer to symbols such as __sysconf without problems, since they're in the libc namespace. As long as this usage don't actually break something somewhere we'd rather leave it alone.
From e784740e1cf7143532fe9605368862ffd377b681 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Thu, 7 Aug 2014 18:04:32 -0700
Subject: [PATCH] getdtablesize: fall back on sysconf (_SC_OPEN_MAX)

Problem reported by Jonas 'Sortie' Termansen in:
http://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00023.html
* lib/getdtablesize.c (getdtablesize) [_SC_OPEN_MAX]:
Implement via sysconf for platforms that lack getdtablesize.
---
 ChangeLog           | 6 ++++++
 lib/getdtablesize.c | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 386520b..b0ba90a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-08-07  Paul Eggert  <egg...@cs.ucla.edu>
 
+       getdtablesize: fall back on sysconf (_SC_OPEN_MAX)
+       Problem reported by Jonas 'Sortie' Termansen in:
+       http://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00023.html
+       * lib/getdtablesize.c (getdtablesize) [_SC_OPEN_MAX]:
+       Implement via sysconf for platforms that lack getdtablesize.
+
        vararrays: modernize AC_C_VARARRAYS for C11
        This backports a change I recently made to Autoconf.
        * m4/vararrays.m4 (AC_C_VARARRAYS): Define __STDC_NO_VLA__ if
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index 946738c..f0c6271 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -104,4 +104,12 @@ rpl_getdtablesize(void)
   return getdtablesize ();
 }
 
+#elif defined _SC_OPEN_MAX
+
+int
+getdtablesize (void)
+{
+  return sysconf (_SC_OPEN_MAX);
+}
+
 #endif
-- 
1.9.3

Reply via email to