aboutsummaryrefslogtreecommitdiffhomepage
path: root/wutil.h
diff options
context:
space:
mode:
authorGravatar Peter Ammon <corydoras@ridiculousfish.com>2012-03-02 00:27:40 -0800
committerGravatar Peter Ammon <corydoras@ridiculousfish.com>2012-03-02 00:27:40 -0800
commit8b26d0104c1d85c271e5ce6e08bfe64a779beba7 (patch)
tree995568526f190084fd12d74bc6dcd0e828b1018a /wutil.h
parent36622c35781c3212c2102c45781a496f3e1b3659 (diff)
Some initial changes to use CLO_EXEC, with an eye towards some day using it correctly.
Diffstat (limited to 'wutil.h')
-rw-r--r--wutil.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/wutil.h b/wutil.h
index e2043023..66a1bee3 100644
--- a/wutil.h
+++ b/wutil.h
@@ -42,19 +42,23 @@ void wutil_init();
void wutil_destroy();
/**
- Wide character version of fopen().
+ Wide character version of fopen(). This sets CLO_EXEC.
*/
FILE *wfopen(const wcstring &path, const char *mode);
+/** Sets CLO_EXEC on a given fd */
+bool set_cloexec(int fd);
+
/**
Wide character version of freopen().
*/
FILE *wfreopen(const wcstring &path, const char *mode, FILE *stream);
-/**
- Wide character version of open().
-*/
-int wopen(const wcstring &pathname, int flags, ...);
+/** Wide character version of open(). */
+int wopen(const wcstring &pathname, int flags, mode_t mode = 0);
+
+/** Wide character version of open() that also sets the close-on-exec flag (atomically when possible). */
+int wopen_cloexec(const wcstring &pathname, int flags, mode_t mode = 0);
/**
Wide character version of creat().
@@ -62,9 +66,7 @@ int wopen(const wcstring &pathname, int flags, ...);
int wcreat(const wcstring &pathname, mode_t mode);
-/**
- Wide character version of opendir().
-*/
+/** Wide character version of opendir(). Note that opendir() is guaranteed to set close-on-exec by POSIX (hooray). */
DIR *wopendir(const wcstring &name);
/**