Alternatives to popen()?

Karl Young karly at
Tue Sep 8 21:50:48 UTC 2015

We've run into ths bug:

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

Since popen returns FILE* it hits the same issue.  The program we use
will typically have  many thousands of sockets open, and if it happens
to have over 32K open when we call popen it fails.

So I guess we can cobble together our own popen with fork and pipe.  Are
there any other alternatives?



More information about the freebsd-questions mailing list