odd socketpair() failure

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Aug 4 08:26:00 GMT 2011


On Aug  3 17:09, Eric Blake wrote:
> A while ago, I tested pipe() for EMFILE failures [1].  Well, I
> repeated those tests for socketpair() [2], and cygwin is once again
> the odd man out.
> [...]
> after fd 3199, open failed with errno 24 Too many open files
> try 1, socketpair returned -1 errno 24 Too many open files, fds -2 -3
> try 2, socketpair returned -1 errno 24 Too many open files, fds -2 -3
> try 3, socketpair returned -1 errno 24 Too many open files, fds -2 -3
> 
> But on Linux, try 3 succeeds.  Something in cygwin is not quite
> right on try 3 - the program explicitly freed two fd slots (0 and
> 3199), so it should have plenty of room to create the socketpair
> without hitting EMFILE.

The socketpair function forgot to free the descriptor slot of the first
socket if there was no room left for the second socket.  Fixed in CVS.


Thanks,
Corinna


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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