From 579f41f3b38f07d05f3135988dbfb99b0adfe738 Mon Sep 17 00:00:00 2001 From: guenther <> Date: Sun, 31 Aug 2014 02:21:18 +0000 Subject: [PATCH] Add additional userland interfaces for setting close-on-exec on fds when creating them: mkostemp(), mkostemps(), the 'e' mode letter for fopen(), freopen(), fdopen(), and popen(). The close-on-exec flag will be cleared by the action created by posix_spawn_file_actions_adddup2(). Also, add support for the C11 'x' mode letter for fopen() and freopen(), setting O_EXCL when possibly creating files. Note: this requires kernel support for pipe2() and dup3()! ok millert@ --- src/include/stdlib.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 495b01bf..520a1b1f 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stdlib.h,v 1.59 2014/07/09 16:57:49 beck Exp $ */ +/* $OpenBSD: stdlib.h,v 1.60 2014/08/31 02:21:18 guenther Exp $ */ /* $NetBSD: stdlib.h,v 1.25 1995/12/27 21:19:08 jtc Exp $ */ /*- @@ -256,6 +256,13 @@ char *mkdtemp(char *); int getsubopt(char **, char * const *, char **); #endif +/* + * The Open Group Base Specifications, post-Issue 7 + */ +#if __BSD_VISIBLE +int mkostemp(char *, int); +#endif + #if __BSD_VISIBLE void *alloca(size_t); @@ -285,6 +292,7 @@ void setprogname(const char *); extern char *suboptarg; /* getsubopt(3) external variable */ int mkstemps(char *, int); +int mkostemps(char *, int, int); int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));