system/FileDescriptor: add CheckDuplicate()
This commit is contained in:
@@ -146,6 +146,14 @@ public:
|
||||
bool Duplicate(int new_fd) const noexcept {
|
||||
return ::dup2(Get(), new_fd) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to Duplicate(), but if destination and source file
|
||||
* descriptor are equal, clear the close-on-exec flag. Use
|
||||
* this method to inject file descriptors into a new child
|
||||
* process, to be used by a newly executed program.
|
||||
*/
|
||||
bool CheckDuplicate(int new_fd) noexcept;
|
||||
#endif
|
||||
|
||||
#ifdef USE_EVENTFD
|
||||
|
||||
Reference in New Issue
Block a user