Alternatives to popen()?

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


We've run into ths bug:

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

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

Thanks

-karl



More information about the freebsd-questions mailing list