Use /proc/self/fd to efficiently close all FDs on Linux

Issue #1506.
This commit is contained in:
Eelco Dolstra 2017-08-09 16:22:05 +02:00
parent c6184dec6c
commit af765a8eab
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 19 additions and 5 deletions

View file

@ -261,8 +261,8 @@ public:
list of strings. */
std::vector<char *> stringsToCharPtrs(const Strings & ss);
/* Close all file descriptors except stdin, stdout, stderr, and those
listed in the given set. Good practice in child processes. */
/* Close all file descriptors except those listed in the given set.
Good practice in child processes. */
void closeMostFDs(const set<int> & exceptions);
/* Set the close-on-exec flag for the given file descriptor. */