mirror of
https://github.com/NixOS/nix
synced 2025-06-28 22:01:15 +02:00
libutil: rename and optimize closeMostFDs
this is only used to close non-stdio files in derivation sandboxes. we
may as well encode that in its name, drop the unnecessary integer set,
and use close_range to deal with the actual closing of files. not only
is this clearer, it also makes sandbox setup on linux fast by 1ms each
(cherry-picked and adapted from
c7d97802e4
)
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
Co-authored-by: John Ericson <git@JohnEricson.me>
This commit is contained in:
parent
af26fe3934
commit
03b258bf97
3 changed files with 28 additions and 8 deletions
|
@ -1993,7 +1993,7 @@ void LocalDerivationGoal::runChild()
|
|||
throw SysError("changing into '%1%'", tmpDir);
|
||||
|
||||
/* Close all other file descriptors. */
|
||||
unix::closeMostFDs({STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO});
|
||||
unix::closeExtraFDs();
|
||||
|
||||
#if __linux__
|
||||
linux::setPersonality(drv->platform);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue