]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/unix/handle.cpp
Implement controls for file descriptor inheritance
[libs/core.git] / source / io / unix / handle.cpp
index cb3ce4cae54c16aae8ceb83194044aac98aca94c..cbffa48e62a7354522a8d9efb8fcafe8f8c36c60 100644 (file)
@@ -14,6 +14,12 @@ void sys_set_blocking(Handle &handle, bool b)
        fcntl(*handle, F_SETFL, (flags&~O_NONBLOCK)|(b?0:O_NONBLOCK));
 }
 
+void sys_set_inherit(Handle &handle, bool i)
+{
+       int flags = fcntl(*handle, F_GETFD);
+       fcntl(*handle, F_SETFD, (flags&~O_CLOEXEC)|(i?O_CLOEXEC:0));
+}
+
 unsigned sys_read(Handle &handle, char *buf, unsigned size)
 {
        int ret = read(*handle, buf, size);