summaryrefslogtreecommitdiff
path: root/io
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-07-25 04:51:56 +0000
committerUlrich Drepper <drepper@redhat.com>2008-07-25 04:51:56 +0000
commitbdcebfc4c7cc4f08efaf84af19465893f69fd5ed (patch)
tree2335c641a0fe139b353e3ae89c8b13385c34ac2e /io
parent0e077a7eea286a8efd63460d0ea5d99e44a86b71 (diff)
* Versions.def (glibc): Add GLIBC_2.9.
* io/Makefile (routines): Add dup3 and pipe2. * io/Versions [glibc] (GLIBC_2.9): Add dup3 and pipe2. * io/dup3.c: New file. * io/pipe2.c: New file. * posix/unistd.h: Declare dup3 and pipe2. * socket/Makefile (routines): Add paccept. * socket/Versions [glibc] (GLIBC_2.9): Add paccept. * socket/paccept.c: New file. * socket/sys/socket.h: Declare paccept. * sysdeps/unix/syscalls.list: Add entry for dup3. * sysdeps/unix/sysv/linux/Versions [glibc] (GLIBC_2.9): Add epoll_create2 and inotify_init1. * sysdeps/unix/sysv/linux/eventfd.c: Use eventfd1 syscall if possible. * sysdeps/unix/sysv/linux/paccept.c: New file. * sysdeps/unix/sysv/linux/signalfd.c: Use signalfd4 syscall if possible. * sysdeps/unix/sysv/linux/socketcall.h: Add SOCKOP_paccept. * sysdeps/unix/sysv/linux/syscalls.list: Add epoll_create2, inotify_init1, and pipe2 entries. * sysdeps/unix/sysv/linux/alpha/sys/epoll.h: New file. * sysdeps/unix/sysv/linux/alpha/sys/eventfd.h: New file. * sysdeps/unix/sysv/linux/alpha/sys/inotify.h: New file. * sysdeps/unix/sysv/linux/alpha/sys/signalfd.h: New file. * sysdeps/unix/sysv/linux/alpha/sys/timerfd.h: New file. * sysdeps/unix/sysv/linux/bits/socket.h: Define SOCK_CLOEXEC and SOCK_NONBLOCK. * sysdeps/unix/sysv/linux/i386/paccept.S: New file. * sysdeps/unix/sysv/linux/sparc/sys/epoll.h: New file. * sysdeps/unix/sysv/linux/sparc/sys/eventfd.h: New file. * sysdeps/unix/sysv/linux/sparc/sys/inotify.h: New file. * sysdeps/unix/sysv/linux/sparc/sys/signalfd.h: New file. * sysdeps/unix/sysv/linux/sparc/sys/timerfd.h: New file. * sysdeps/unix/sysv/linux/sparc/bits/socket.h: New file. * sysdeps/unix/sysv/linux/sys/epoll.h: Define EPOLL_CLOEXEC and EPOLL_NONBLOCK. Declare epoll_create2. * sysdeps/unix/sysv/linux/sys/eventfd.h: Define EFD_CLOEXEC and EFD_NONBLOCK. * sysdeps/unix/sysv/linux/sys/inotify.h: Define IN_CLOEXEC and IN_NONBLOCK. Declare inotify_init1. * sysdeps/unix/sysv/linux/sys/signalfd.h: Define SFD_CLOEXEC and SFD_NONBLOCK. * sysdeps/unix/sysv/linux/sys/timerfd.h: Define TFD_CLOEXEC and TFD_NONBLOCK.
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>