1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 12:41:15 +02:00

Put some file descriptor functions in unix and windows namespaces

It is misleading when platform-specific functions are in the overall
`nix` namespace. More namespaces also makes for nicer doxygen.
This commit is contained in:
John Ericson 2024-06-13 10:34:44 -04:00
parent afdd12be5e
commit ff87c1a318
7 changed files with 19 additions and 15 deletions

View file

@ -110,8 +110,8 @@ void Pipe::create()
if (pipe2(fds, O_CLOEXEC) != 0) throw SysError("creating pipe");
#else
if (pipe(fds) != 0) throw SysError("creating pipe");
closeOnExec(fds[0]);
closeOnExec(fds[1]);
unix::closeOnExec(fds[0]);
unix::closeOnExec(fds[1]);
#endif
readSide = fds[0];
writeSide = fds[1];
@ -120,7 +120,7 @@ void Pipe::create()
//////////////////////////////////////////////////////////////////////
void closeMostFDs(const std::set<int> & exceptions)
void unix::closeMostFDs(const std::set<int> & exceptions)
{
#if __linux__
try {
@ -146,7 +146,7 @@ void closeMostFDs(const std::set<int> & exceptions)
}
void closeOnExec(int fd)
void unix::closeOnExec(int fd)
{
int prev;
if ((prev = fcntl(fd, F_GETFD, 0)) == -1 ||