summaryrefslogtreecommitdiff
path: root/LibC
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-11-13 01:36:31 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-11-13 01:36:31 +0100
commit97c799576a478d3881bfff1196f0fa829d736994 (patch)
treefb9d43820e7e65318c2f0e3d9f67932aee3a78ae /LibC
parent19b9401487e87dcbb43b52c6fe194e3b0e49f842 (diff)
downloadserenity-97c799576a478d3881bfff1196f0fa829d736994.zip
Add close-on-exec flag for file descriptors.
I was surprised to find that dup()'ed fds don't share the close-on-exec flag. That means it has to be stored separately from the FileDescriptor object.
Diffstat (limited to 'LibC')
-rw-r--r--LibC/fcntl.h2
-rw-r--r--LibC/unistd.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/LibC/fcntl.h b/LibC/fcntl.h
index e0ee379b1d..c717acdc1a 100644
--- a/LibC/fcntl.h
+++ b/LibC/fcntl.h
@@ -10,6 +10,8 @@ __BEGIN_DECLS
#define F_GETFL 3
#define F_SETFL 4
+#define FD_CLOEXEC 1
+
int fcntl(int fd, int cmd, ...);
__END_DECLS
diff --git a/LibC/unistd.h b/LibC/unistd.h
index a809a91151..431a5f17bc 100644
--- a/LibC/unistd.h
+++ b/LibC/unistd.h
@@ -99,6 +99,7 @@ int isatty(int fd);
#define O_NONBLOCK 04000
#define O_DIRECTORY 00200000
#define O_NOFOLLOW 00400000
+#define O_CLOEXEC 02000000
__END_DECLS