[Bug 148581] [libc] fopen(3) fails with EMFILE if there are more than SHORT_MAX fds open

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Sep 8 21:39:52 UTC 2015


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=148581

Karl Young <freebsd at kipshouse.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |freebsd at kipshouse.org

--- Comment #3 from Karl Young <freebsd at kipshouse.org> ---
We've run into this on 9.2.  We're using OpenSource software that uses popen()
to run external commands.  Since popen() returns FILE*, it fails when we get to
32K open files.  This seems to be rarely hit (no comments since 2011), but it
can be a show-stopper.

The only workaround I see in our case is to roll our own popen().

BTW in comment 1:

> with a 32-bit file descriptor field. If the file descriptor exceeds 32767, the 16-bit > field then contains -1 and fileno() in old binaries will return that.

I think this fails when FD gets to 64K and the short version starts counting up
from 0 again.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list