[klibc] Add pipe2() system call
pipe2() is like pipe() except we can set the O_CLOEXEC flag via a
second argument. Unlike pipe(), noone seems to have seemed fit to
create a completely ad hoc calling convention for pipe2(), so we can
just define it in one simple place. Thank goodness.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/usr/include/unistd.h b/usr/include/unistd.h
index 3244e21..3af4c8f 100644
--- a/usr/include/unistd.h
+++ b/usr/include/unistd.h
@@ -71,6 +71,7 @@
__extern int mkdirat(int, const char *, const char *, mode_t);
__extern int rmdir(const char *);
__extern int pipe(int *);
+__extern int pipe2(int *, int);
__extern int chroot(const char *);
__extern int symlink(const char *, const char *);
__extern int symlinkat(int, const char *, const char *);
diff --git a/usr/klibc/SYSCALLS.def b/usr/klibc/SYSCALLS.def
index 5fd2753..d935a92 100644
--- a/usr/klibc/SYSCALLS.def
+++ b/usr/klibc/SYSCALLS.def
@@ -124,6 +124,7 @@
<?> int mkdirat(int, const char *, const char *, mode_t);
int rmdir(const char *);
<!alpha,ia64,mips,mips64,sh,sparc,sparc64> int pipe(int *);
+int pipe2(int *, int);
mode_t umask(mode_t);
int chroot(const char *);
int symlink(const char *, const char *);