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

Peter Rosin peda@lysator.liu.se
Wed Sep 25 07:42:00 GMT 2013

On 2013-09-25 06:32, Christopher Faylor wrote:
> On Tue, Sep 24, 2013 at 12:37:26PM -0600, Eric Blake wrote:
>> 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);
> Why?  What does "3200" have to do with anything?  There is not supposed
> to be a hard-coded upper limit.

Go back and read the gdb session. STC in C:

#include <unistd.h>
#include <stdio.h>
#include <errno.h>
int main(void)
  int ret = dup2(0, 3200);
  if (ret == -1)
    printf("3200 errno %d: %s\n", errno, strerror(errno));
    printf("3200 ok");

  ret = dup2(0, 3199);
  if (ret == -1)
    printf("3199 errno %d: %s\n", errno, strerror(errno));
    printf("3199 ok");
  return 0;

output on my system:

3200 errno 9: Bad file descriptor
3199 ok

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list