getdtablesize: work around cygwin issue
authorEric Blake <eblake@redhat.com>
Thu, 26 Sep 2013 17:26:29 +0000 (11:26 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 26 Sep 2013 19:16:03 +0000 (13:16 -0600)
commit3bd0d48db800994cc10c3340c41d3242390dc68f
treec7dbaa2d28baa06e25645eaec87102fa32d83a58
parent883e87df0a2236794c97afdd985c3706074d3195
getdtablesize: work around cygwin issue

Cygwin 1.7.25 has a bug that even though it claims to support
RLIMIT_NOFILE inheritance, there is no enforcement of the soft
limit, and getdtablesize() automatically grows until it reaches
the hard limit which cannot be changed by setrlimit().  Best is
to just treat things as an invariant limit, as several other
modules assume that getdtablesize() will not change without an
intervening setrlimit().

* m4/getdtablesize.m4 (gl_FUNC_GETDTABLESIZE): Detect problem.
* modules/getdtablesize (configure.ac): Build replacement.
* m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Set up a witness.
* modules/unistd (Makefile.am): Expose the witness.
* lib/unistd.in.h (getdtablesize): Declare replacement.
* lib/getdtablesize.c (rpl_getdtablesize): Work around it.
* tests/test-getdtablesize.c (main): Test it.
* doc/glibc-functions/getdtablesize.texi (getdtablesize): Document it.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
doc/glibc-functions/getdtablesize.texi
lib/getdtablesize.c
lib/unistd.in.h
m4/getdtablesize.m4
m4/unistd_h.m4
modules/getdtablesize
modules/unistd
tests/test-getdtablesize.c