summaryrefslogtreecommitdiff
path: root/libc/io
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2008-08-19 17:24:09 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2008-08-19 17:24:09 +0000
commit447fd9179ef3effda7c99168c310c5e0d0e8e770 (patch)
treef90fa016ce2e15d5b509f124107ea12273ee605e /libc/io
parent46a638ad529cc323bb7fbd02968b0770ab6626e8 (diff)
Merge changes between r6509 and r6780 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@6785 7b3dc134-2b1b-0410-93df-9e9f96275f8d
Diffstat (limited to 'libc/io')
-rw-r--r--libc/io/Makefile4
-rw-r--r--libc/io/Versions3
-rw-r--r--libc/io/dup3.c48
-rw-r--r--libc/io/ftw.c4
-rw-r--r--libc/io/pipe2.c44
5 files changed, 99 insertions, 4 deletions
diff --git a/libc/io/Makefile b/libc/io/Makefile
index e83952e06..8edfee01d 100644
--- a/libc/io/Makefile
+++ b/libc/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
@@ -42,7 +42,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/libc/io/Versions b/libc/io/Versions
index d603668f4..6c0a23b46 100644
--- a/libc/io/Versions
+++ b/libc/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/libc/io/dup3.c b/libc/io/dup3.c
new file mode 100644
index 000000000..162ab4e68
--- /dev/null
+++ b/libc/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/libc/io/ftw.c b/libc/io/ftw.c
index 5495bc7ec..9cc09077e 100644
--- a/libc/io/ftw.c
+++ b/libc/io/ftw.c
@@ -1,5 +1,5 @@
/* File tree walker functions.
- Copyright (C) 1996-2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1996-2004, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -243,7 +243,7 @@ object_compare (const void *p1, const void *p2)
}
-static inline int
+static int
add_object (struct ftw_data *data, struct STAT *st)
{
struct known_object *newp = malloc (sizeof (struct known_object));
diff --git a/libc/io/pipe2.c b/libc/io/pipe2.c
new file mode 100644
index 000000000..aa54d17ae
--- /dev/null
+++ b/libc/io/pipe2.c
@@ -0,0 +1,44 @@
+/* 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;
+}
+weak_alias (__pipe2, pipe2)
+stub_warning (pipe2)
+
+#include <stub-tag.h>