summary refs log tree commit diff
path: root/io
diff options
context:
space:
mode:
Diffstat (limited to 'io')
-rw-r--r--io/Makefile4
-rw-r--r--io/Versions3
-rw-r--r--io/dup3.c48
-rw-r--r--io/pipe2.c43
4 files changed, 96 insertions, 2 deletions
diff --git a/io/Makefile b/io/Makefile
index 1acda4c8b6..caaa51b351 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-2002,2003,2005,2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 1992-2003,2005,2006,2007,2008 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -40,7 +40,7 @@ routines :=								\
 	open open64 openat openat64 close				\
 	read write lseek lseek64 access euidaccess faccessat		\
 	fcntl flock lockf lockf64					\
-	dup dup2 pipe							\
+	dup dup2 dup3 pipe pipe2					\
 	creat creat64							\
 	chdir fchdir							\
 	getcwd getwd getdirname						\
diff --git a/io/Versions b/io/Versions
index d603668f4f..6c0a23b465 100644
--- a/io/Versions
+++ b/io/Versions
@@ -119,4 +119,7 @@ libc {
   GLIBC_2.7 {
     __open_2; __open64_2; __openat_2; __openat64_2;
   }
+  GLIBC_2.9 {
+    dup3; pipe2;
+  }
 }
diff --git a/io/dup3.c b/io/dup3.c
new file mode 100644
index 0000000000..162ab4e68b
--- /dev/null
+++ b/io/dup3.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2008 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+
+/* Duplicate FD to FD2, closing the old FD2 and making FD2 be
+   open the same file as FD is which setting flags according to
+   FLAGS.  Return FD2 or -1.  */
+int
+dup3 (fd, fd2, flags)
+     int fd;
+     int fd2;
+     int flags;
+{
+  if (fd < 0 || fd2 < 0)
+    {
+      __set_errno (EBADF);
+      return -1;
+    }
+
+  if (fd == fd2)
+    /* No way to check that they are valid.  */
+    return fd2;
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (dup3)
+
+#include <stub-tag.h>
diff --git a/io/pipe2.c b/io/pipe2.c
new file mode 100644
index 0000000000..a0b8a8b1f8
--- /dev/null
+++ b/io/pipe2.c
@@ -0,0 +1,43 @@
+/* Copyright (C) 1991, 1995, 1996, 2002, 2008 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <errno.h>
+#include <unistd.h>
+#include <stddef.h>
+
+/* Create a one-way communication channel (__pipe).  If successful,
+   two file descriptors are stored in PIPEDES; bytes written on
+   PIPEDES[1] can be read from PIPEDES[0].  Apply FLAGS to the new
+   file descriptors.  Returns 0 if successful, -1 if not.  */
+int
+pipe2 (pipedes, flags)
+     int pipedes[2];
+     int flags;
+{
+  if (pipedes == NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  __set_errno (ENOSYS);
+  return -1;
+}
+stub_warning (pipe2)
+
+#include <stub-tag.h>