nixd
Loading...
Searching...
No Matches
AutoCloseFD.cpp
Go to the documentation of this file.
2
3#include <unistd.h>
4
5namespace nixd::util {
6
8 if (FD != ReleasedFD) [[likely]]
9 close(FD);
10}
11
13 That.release();
14}
15
16AutoCloseFD::FDTy AutoCloseFD::get() const { return FD; }
17
18void AutoCloseFD::release() { FD = ReleasedFD; }
19
20bool AutoCloseFD::isReleased(FDTy FD) { return FD == ReleasedFD; }
21
22bool AutoCloseFD::isReleased() const { return isReleased(FD); }
23
25
26} // namespace nixd::util
File Descriptor RAII wrapper.
Definition AutoCloseFD.h:8
bool fromJSON(const llvm::json::Value &Params, Configuration::Diagnostic &R, llvm::json::Path P)