[PATCH] tests: don't assume getdtablesize () <= 10000000

Eric Blake eblake@redhat.com
Tue Sep 24 19:27:00 GMT 2013


[adding cygwin]

On 04/29/2013 04:23 PM, Paul Eggert wrote:
> ---

> +
> +	tests: don't assume getdtablesize () <= 10000000
> +	* modules/cloexec-tests:
> +	* modules/dup2-tests:
> +	* modules/dup3-tests:
> +	* modules/nonblocking-tests:
> +	* modules/posix_spawn_file_actions_addclose-tests:
> +	* modules/posix_spawn_file_actions_adddup2-tests:
> +	* modules/posix_spawn_file_actions_addopen-tests:
> +	* modules/unistd-safer-tests:
> +	Depend on the getdtablesize module.
> +	* tests/test-cloexec.c:
> +	* tests/test-dup-safer.c:
> +	* tests/test-dup2.c:
> +	* tests/test-dup3.c:
> +	* tests/test-fcntl.c:
> +	* tests/test-nonblocking.c:
> +	* tests/test-posix_spawn_file_actions_addclose.c:
> +	* tests/test-posix_spawn_file_actions_adddup2.c:
> +	* tests/test-posix_spawn_file_actions_addopen.c:
> +	Don't assume getdtablesize () <= 10000000.

This patch causes failures on at least test-fcntl and test-dup2 on
cygwin (both 32-bit and 64-bit); there, getdtablesize() currently
returns the current runtime value, but this value starts at 256, and
automatically expands as needed at runtime up to 3200.  I think cygwin
should be patched to make getdtablesize() return a constant 3200 (rather
than the current runtime value); but meanwhile, we need to do something
in gnulib to pick a larger value for bad_fd if getdtablesize() returns a
small runtime value.  I also wonder whether cygwin's
sysconf(_SC_OPEN_MAX) should likewise be modified.

(gdb) p getdtablesize()
$5 = 256
(gdb) p dup2(0, 256)
$6 = 256
(gdb) p getdtablesize()
$7 = 288
(gdb) p dup2(0, 3200)
$8 = -1
(gdb) p getdtablesize()
$9 = 288
(gdb) p dup2(0, 3199)
$10 = 3199
(gdb) p getdtablesize()
$11 = 3200

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20130924/b6f0a9d3/attachment.sig>


More information about the Cygwin mailing list