From bdcebfc4c7cc4f08efaf84af19465893f69fd5ed Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 25 Jul 2008 04:51:56 +0000 Subject: [PATCH] * 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. --- ChangeLog | 45 +++++++ Versions.def | 1 + io/Makefile | 4 +- io/Versions | 3 + sysdeps/unix/sysv/linux/eventfd.c => io/dup3.c | 33 ++--- sysdeps/unix/sysv/linux/eventfd.c => io/pipe2.c | 28 ++--- posix/unistd.h | 14 ++- socket/Makefile | 4 +- socket/Versions | 3 + .../unix/sysv/linux/eventfd.c => socket/paccept.c | 38 +++--- socket/sys/socket.h | 18 ++- sysdeps/unix/syscalls.list | 1 + sysdeps/unix/sysv/linux/Versions | 3 + sysdeps/unix/sysv/linux/{ => alpha}/sys/epoll.h | 21 +++- sysdeps/unix/sysv/linux/{ => alpha}/sys/eventfd.h | 11 +- sysdeps/unix/sysv/linux/{ => alpha}/sys/inotify.h | 15 ++- sysdeps/unix/sysv/linux/{ => alpha}/sys/signalfd.h | 8 ++ sysdeps/unix/sysv/linux/{ => alpha}/sys/timerfd.h | 10 ++ sysdeps/unix/sysv/linux/bits/socket.h | 16 ++- sysdeps/unix/sysv/linux/eventfd.c | 12 +- sysdeps/unix/sysv/linux/i386/paccept.S | 135 +++++++++++++++++++++ sysdeps/unix/sysv/linux/{signalfd.c => paccept.c} | 44 ++++--- sysdeps/unix/sysv/linux/signalfd.c | 12 +- sysdeps/unix/sysv/linux/socketcall.h | 6 +- sysdeps/unix/sysv/linux/{ => sparc}/bits/socket.h | 17 ++- sysdeps/unix/sysv/linux/{ => sparc}/sys/epoll.h | 21 +++- sysdeps/unix/sysv/linux/{ => sparc}/sys/eventfd.h | 11 +- sysdeps/unix/sysv/linux/{ => sparc}/sys/inotify.h | 15 ++- sysdeps/unix/sysv/linux/{ => sparc}/sys/signalfd.h | 8 ++ sysdeps/unix/sysv/linux/{ => sparc}/sys/timerfd.h | 10 ++ sysdeps/unix/sysv/linux/sys/epoll.h | 21 +++- sysdeps/unix/sysv/linux/sys/eventfd.h | 11 +- sysdeps/unix/sysv/linux/sys/inotify.h | 15 ++- sysdeps/unix/sysv/linux/sys/signalfd.h | 8 ++ sysdeps/unix/sysv/linux/sys/timerfd.h | 10 ++ sysdeps/unix/sysv/linux/syscalls.list | 3 + 36 files changed, 529 insertions(+), 106 deletions(-) copy sysdeps/unix/sysv/linux/eventfd.c => io/dup3.c (64%) copy sysdeps/unix/sysv/linux/eventfd.c => io/pipe2.c (64%) copy sysdeps/unix/sysv/linux/eventfd.c => socket/paccept.c (55%) copy sysdeps/unix/sysv/linux/{ => alpha}/sys/epoll.h (86%) copy sysdeps/unix/sysv/linux/{ => alpha}/sys/eventfd.h (85%) copy sysdeps/unix/sysv/linux/{ => alpha}/sys/inotify.h (91%) copy sysdeps/unix/sysv/linux/{ => alpha}/sys/signalfd.h (91%) copy sysdeps/unix/sysv/linux/{ => alpha}/sys/timerfd.h (89%) create mode 100644 sysdeps/unix/sysv/linux/i386/paccept.S copy sysdeps/unix/sysv/linux/{signalfd.c => paccept.c} (55%) copy sysdeps/unix/sysv/linux/{ => sparc}/bits/socket.h (95%) copy sysdeps/unix/sysv/linux/{ => sparc}/sys/epoll.h (86%) copy sysdeps/unix/sysv/linux/{ => sparc}/sys/eventfd.h (85%) copy sysdeps/unix/sysv/linux/{ => sparc}/sys/inotify.h (91%) copy sysdeps/unix/sysv/linux/{ => sparc}/sys/signalfd.h (90%) copy sysdeps/unix/sysv/linux/{ => sparc}/sys/timerfd.h (89%) diff --git a/ChangeLog b/ChangeLog index 65d8a969a1..67fc9d3d1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,50 @@ 2008-07-24 Ulrich Drepper + * 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. + * elf/elf.h: Define AT_EXECFN. * elf/rtld.c [!__ASSUME_AT_EXECFN] (process_envvars): Don't handle LD_ORIGIN_PATH. diff --git a/Versions.def b/Versions.def index 0de15f8f7f..8b79917e62 100644 --- a/Versions.def +++ b/Versions.def @@ -25,6 +25,7 @@ libc { GLIBC_2.6 GLIBC_2.7 GLIBC_2.8 + GLIBC_2.9 %ifdef USE_IN_LIBIO HURD_CTHREADS_0.3 %endif 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/sysdeps/unix/sysv/linux/eventfd.c b/io/dup3.c similarity index 64% copy from sysdeps/unix/sysv/linux/eventfd.c copy to io/dup3.c index 180861aad2..162ab4e68b 100644 --- a/sysdeps/unix/sysv/linux/eventfd.c +++ b/io/dup3.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* 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 @@ -17,27 +17,32 @@ 02111-1307 USA. */ #include -#include -#include +#include +#include +/* 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 -eventfd (int count, int flags) +dup3 (fd, fd2, flags) + int fd; + int fd2; + int flags; { - /* The system call has no flag parameter which is bad. So we have - to wait until we have to support to pass additional values to the - kernel (sys_indirect) before implementing setting flags like - O_NONBLOCK etc. */ - if (flags != 0) + if (fd < 0 || fd2 < 0) { - __set_errno (EINVAL); + __set_errno (EBADF); return -1; } -#ifdef __NR_eventfd - return INLINE_SYSCALL (eventfd, 1, count); -#else + if (fd == fd2) + /* No way to check that they are valid. */ + return fd2; + __set_errno (ENOSYS); return -1; -#endif } +stub_warning (dup3) + +#include diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/io/pipe2.c similarity index 64% copy from sysdeps/unix/sysv/linux/eventfd.c copy to io/pipe2.c index 180861aad2..a0b8a8b1f8 100644 --- a/sysdeps/unix/sysv/linux/eventfd.c +++ b/io/pipe2.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* 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 @@ -17,27 +17,27 @@ 02111-1307 USA. */ #include -#include -#include - +#include +#include +/* 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 -eventfd (int count, int flags) +pipe2 (pipedes, flags) + int pipedes[2]; + int flags; { - /* The system call has no flag parameter which is bad. So we have - to wait until we have to support to pass additional values to the - kernel (sys_indirect) before implementing setting flags like - O_NONBLOCK etc. */ - if (flags != 0) + if (pipedes == NULL) { __set_errno (EINVAL); return -1; } -#ifdef __NR_eventfd - return INLINE_SYSCALL (eventfd, 1, count); -#else __set_errno (ENOSYS); return -1; -#endif } +stub_warning (pipe2) + +#include diff --git a/posix/unistd.h b/posix/unistd.h index 01ac3f8b41..96bb02dff4 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 1991-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 @@ -383,6 +383,12 @@ extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n, Returns 0 if successful, -1 if not. */ extern int pipe (int __pipedes[2]) __THROW __wur; +#ifdef __USE_GNU +/* Same as pipe but apply flags passed in FLAGS to the new file + descriptors. */ +extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur; +#endif + /* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. If SECONDS is zero, any currently scheduled alarm will be cancelled. The function returns the number of seconds remaining until the last @@ -492,6 +498,12 @@ extern int dup (int __fd) __THROW __wur; /* Duplicate FD to FD2, closing FD2 and making it open on the same file. */ extern int dup2 (int __fd, int __fd2) __THROW; +#ifdef __USE_GNU +/* Duplicate FD to FD2, closing FD2 and making it open on the same + file while setting flags according to FLAGS. */ +extern int dup3 (int __fd, int __fd2, int __flags) __THROW; +#endif + /* NULL-terminated array of "NAME=VALUE" environment variables. */ extern char **__environ; #ifdef __USE_GNU diff --git a/socket/Makefile b/socket/Makefile index aa0776e5bf..e1c9ec0fad 100644 --- a/socket/Makefile +++ b/socket/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1991,1995-2001,2005 Free Software Foundation, Inc. +# Copyright (C) 1991,1995-2001,2005,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 @@ -27,7 +27,7 @@ headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \ routines := accept bind connect getpeername getsockname getsockopt \ listen recv recvfrom recvmsg send sendmsg sendto \ setsockopt shutdown socket socketpair isfdtype opensock \ - sockatmark + sockatmark paccept distribute := ifreq.h diff --git a/socket/Versions b/socket/Versions index d282eff79e..9764227c36 100644 --- a/socket/Versions +++ b/socket/Versions @@ -31,4 +31,7 @@ libc { # Addition from P1003.1-200x sockatmark; } + GLIBC_2.9 { + paccept; + } } diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/socket/paccept.c similarity index 55% copy from sysdeps/unix/sysv/linux/eventfd.c copy to socket/paccept.c index 180861aad2..777dd8c300 100644 --- a/sysdeps/unix/sysv/linux/eventfd.c +++ b/socket/paccept.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* 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 @@ -17,27 +17,27 @@ 02111-1307 USA. */ #include -#include -#include - +#include +/* Await a connection on socket FD. + When a connection arrives, open a new socket to communicate with it, + set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting + peer and *ADDR_LEN to the address's actual length, and return the + new socket's descriptor, or -1 for errors. SS is installed as + the thread's signal mask and FLAGS are additional flags. */ int -eventfd (int count, int flags) +paccept (fd, addr, addr_len, ss, flags) + int fd; + __SOCKADDR_ARG addr; + socklen_t *addr_len; + const __sigset_t *ss; + int flags; { - /* The system call has no flag parameter which is bad. So we have - to wait until we have to support to pass additional values to the - kernel (sys_indirect) before implementing setting flags like - O_NONBLOCK etc. */ - if (flags != 0) - { - __set_errno (EINVAL); - return -1; - } - -#ifdef __NR_eventfd - return INLINE_SYSCALL (eventfd, 1, count); -#else __set_errno (ENOSYS); return -1; -#endif } +libc_hidden_def (paccept) + + +stub_warning (paccept) +#include diff --git a/socket/sys/socket.h b/socket/sys/socket.h index 6d9eab7f94..ea4123d287 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -1,5 +1,5 @@ /* Declarations of socket constants, types, and functions. - Copyright (C) 1991,92,1994-2001,2003,2005,2007 + Copyright (C) 1991,92,1994-2001,2003,2005,2007,2008 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -28,6 +28,10 @@ __BEGIN_DECLS #include #define __need_size_t #include +#ifdef __USE_GNU +/* Get the __sigset_t definition. */ +# include +#endif /* This operating system-specific header file defines the SOCK_*, PF_*, @@ -210,6 +214,18 @@ extern int listen (int __fd, int __n) __THROW; extern int accept (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); +#ifdef __USE_GNU +/* Variant of the accept function which takes additional parameters. The + MASK parameter allows to change the thread signal mask for the duration + of the call. The FLAGS parameter allows to pass additional flags. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int paccept (int __fd, __SOCKADDR_ARG __addr, + socklen_t *__restrict __addr_len, + __const __sigset_t *__restrict __ss, int __flags); +#endif + /* Shut down all or part of the connection open on socket FD. HOW determines what to shut down: SHUT_RD = No more receptions; diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index 4c963abe58..04ed63c4d7 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -9,6 +9,7 @@ chroot - chroot i:s chroot close - close Ci:i __libc_close __close close dup - dup i:i __dup dup dup2 - dup2 i:ii __dup2 dup2 +dup3 - dup3 i:iii dup3 fchdir - fchdir i:i __fchdir fchdir fcntl - fcntl Ci:iiF __libc_fcntl __fcntl __fcntl_internal fcntl fstatfs - fstatfs i:ip __fstatfs fstatfs diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index af4c293c26..5a76028c6c 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -135,6 +135,9 @@ libc { GLIBC_2.8 { timerfd_create; timerfd_settime; timerfd_gettime; } + GLIBC_2.9 { + epoll_create2; inotify_init1; + } GLIBC_PRIVATE { # functions used in other libraries __syscall_rt_sigqueueinfo; diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/alpha/sys/epoll.h similarity index 86% copy from sysdeps/unix/sysv/linux/sys/epoll.h copy to sysdeps/unix/sysv/linux/alpha/sys/epoll.h index f4e8bda99a..9f983a5156 100644 --- a/sysdeps/unix/sysv/linux/sys/epoll.h +++ b/sysdeps/unix/sysv/linux/alpha/sys/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002-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 @@ -31,6 +31,16 @@ typedef __sigset_t sigset_t; #endif +/* Flags to be passed to epoll_create2. */ +enum + { + EPOLL_CLOEXEC = 010000000, +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 04 +#define EPOLL_NONBLOCK EPOLL_NONBLOCK + }; + + enum EPOLL_EVENTS { EPOLLIN = 0x001, @@ -63,9 +73,9 @@ enum EPOLL_EVENTS /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ -#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */ -#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */ -#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */ +#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ +#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ +#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ typedef union epoll_data @@ -91,6 +101,9 @@ __BEGIN_DECLS returned by epoll_create() should be closed with close(). */ extern int epoll_create (int __size) __THROW; +/* Same as epoll_create but with an additional FLAGS parameter. */ +extern int epoll_create2 (int __size, int __flags) __THROW; + /* Manipulate an epoll instance "epfd". Returns 0 in case of success, -1 in case of error ( the "errno" variable will contain the diff --git a/sysdeps/unix/sysv/linux/sys/eventfd.h b/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h similarity index 85% copy from sysdeps/unix/sysv/linux/sys/eventfd.h copy to sysdeps/unix/sysv/linux/alpha/sys/eventfd.h index 1ebaea7b30..c8ce554625 100644 --- a/sysdeps/unix/sysv/linux/sys/eventfd.h +++ b/sysdeps/unix/sysv/linux/alpha/sys/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -25,6 +25,15 @@ /* Type for event counter. */ typedef uint64_t eventfd_t; +/* Flags for signalfd. */ +enum + { + EFD_CLOEXEC = 010000000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 04 +#define EFD_NONBLOCK EFD_NONBLOCK + }; + __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/inotify.h b/sysdeps/unix/sysv/linux/alpha/sys/inotify.h similarity index 91% copy from sysdeps/unix/sysv/linux/sys/inotify.h copy to sysdeps/unix/sysv/linux/alpha/sys/inotify.h index 0131db9d3e..d61c700d5d 100644 --- a/sysdeps/unix/sysv/linux/sys/inotify.h +++ b/sysdeps/unix/sysv/linux/alpha/sys/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2006, 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 @@ -22,6 +22,16 @@ #include +/* Flags for the parameter of inotify_init1. */ +enum + { + IN_CLOEXEC = 010000000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 04 +#define IN_NONBLOCK IN_NONBLOCK + }; + + /* Structure describing an inotify event. */ struct inotify_event { @@ -79,6 +89,9 @@ __BEGIN_DECLS /* Create and initialize inotify instance. */ extern int inotify_init (void) __THROW; +/* Create and initialize inotify instance. */ +extern int inotify_init1 (int __flags) __THROW; + /* Add watch of object NAME to inotify instance FD. Notify about events specified by MASK. */ extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) diff --git a/sysdeps/unix/sysv/linux/sys/signalfd.h b/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h similarity index 91% copy from sysdeps/unix/sysv/linux/sys/signalfd.h copy to sysdeps/unix/sysv/linux/alpha/sys/signalfd.h index 7a7f53ba32..a820eafe79 100644 --- a/sysdeps/unix/sysv/linux/sys/signalfd.h +++ b/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h @@ -45,6 +45,14 @@ struct signalfd_siginfo uint8_t __pad[48]; }; +/* Flags for signalfd. */ +enum + { + SFD_CLOEXEC = 010000000, +#define SFD_CLOEXEC SFD_CLOEXEC + SFD_NONBLOCK = 04 +#define SFD_NONBLOCK SFD_NONBLOCK + }; __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h similarity index 89% copy from sysdeps/unix/sysv/linux/sys/timerfd.h copy to sysdeps/unix/sysv/linux/alpha/sys/timerfd.h index 0a4b81c9b7..09d6ccf6cc 100644 --- a/sysdeps/unix/sysv/linux/sys/timerfd.h +++ b/sysdeps/unix/sysv/linux/alpha/sys/timerfd.h @@ -22,6 +22,16 @@ #include +/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +enum + { + TFD_CLOEXEC = 010000000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 04 +#define TFD_NONBLOCK TFD_NONBLOCK + }; + + /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ enum { diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 3dda3d1c29..187d964bdf 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -52,12 +52,22 @@ enum __socket_type SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, datagrams of fixed maximum length. */ #define SOCK_SEQPACKET SOCK_SEQPACKET - SOCK_DCCP = 6, -#define SOCK_DCCP SOCK_DCCP /* Datagram Congestion Control Protocol. */ - SOCK_PACKET = 10 /* Linux specific way of getting packets + SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ +#define SOCK_DCCP SOCK_DCCP + SOCK_PACKET = 10, /* Linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level. */ #define SOCK_PACKET SOCK_PACKET + + /* Flags to be ORed into the type parameter of socket and socketpair and + used for the flags parameter of paccept. */ + + SOCK_CLOEXEC = 02000000, /* Atomically set close-on-exec flag for the + new descriptor(s). */ +#define SOCK_CLOEXEC SOCK_CLOEXEC + SOCK_NONBLOCK = 04000 /* Atomically mark descriptor(s) as + non-blocking. */ +#define SOCK_NONBLOCK SOCK_NONBLOCK }; /* Protocol families. */ diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/sysdeps/unix/sysv/linux/eventfd.c index 180861aad2..6ebfed86f1 100644 --- a/sysdeps/unix/sysv/linux/eventfd.c +++ b/sysdeps/unix/sysv/linux/eventfd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -24,7 +24,10 @@ int eventfd (int count, int flags) { - /* The system call has no flag parameter which is bad. So we have +#ifdef __NR_eventfd1 + return INLINE_SYSCALL (eventfd1, 1, flags); +#else + /* The old system call has no flag parameter which is bad. So we have to wait until we have to support to pass additional values to the kernel (sys_indirect) before implementing setting flags like O_NONBLOCK etc. */ @@ -34,10 +37,11 @@ eventfd (int count, int flags) return -1; } -#ifdef __NR_eventfd +# ifdef __NR_eventfd return INLINE_SYSCALL (eventfd, 1, count); -#else +# else __set_errno (ENOSYS); return -1; +# endif #endif } diff --git a/sysdeps/unix/sysv/linux/i386/paccept.S b/sysdeps/unix/sysv/linux/i386/paccept.S new file mode 100644 index 0000000000..02ad78dd47 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/paccept.S @@ -0,0 +1,135 @@ +/* Copyright (C) 1995-1998,2002,2003,2005,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 +#include +#include + +#define _NSIG 64 + +#define P(a, b) P2(a, b) +#define P2(a, b) a##b + + .text +/* The socket-oriented system calls are handled unusally in Linux. + They are all gated through the single `socketcall' system call number. + `socketcall' takes two arguments: the first is the subcode, specifying + which socket function is being called; and the second is a pointer to + the arguments to the specific function. */ + +ENTRY(do_paccept) +#ifdef SOCKOP_paccept + subl $6*4, %esp + cfi_adjust_cfa_offset(6*4) + + movl (%eax), %ecx + movl %ecx, (%esp) + movl 4(%eax), %ecx + movl %ecx, 4(%esp) + movl 8(%eax), %ecx + movl %ecx, 8(%esp) + movl 12(%eax), %ecx + movl %ecx, 12(%esp) + movl $(_NSIG / 8), 16(%esp) + movl 16(%eax), %ecx + movl %ecx, 20(%esp) + + movl $SYS_ify(socketcall), %eax /* System call number in %eax. */ + + movl $SOCKOP_paccept, %ebx /* Subcode is first arg to syscall. */ + movl %esp, %ecx /* Address of args is 2nd arg. */ + + /* Do the system call trap. */ + ENTER_KERNEL + + addl $6*4, %esp + cfi_adjust_cfa_offset(-6*4) + + /* %eax is < 0 if there was an error. */ + cmpl $-125, %eax + jae SYSCALL_ERROR_LABEL +#else + movl $-ENOSYS, %eax + jmp SYSCALL_ERROR_LABEL + + .section .gnu.glibc-stub.paccept + .previous + .section .gnu.warning.paccept + .string "warning: paccept is not implemented and will always fail" + .previous +#endif +L(pseudo_end): + ret +PSEUDO_END(do_paccept) + + + .globl paccept +ENTRY (paccept) +#ifdef CENABLE + SINGLE_THREAD_P + jne 1f +#endif + + /* Save registers. */ + movl %ebx, %edx + cfi_register (3, 2) + + lea 4(%esp), %eax + call do_paccept + + /* Restore registers. */ + movl %edx, %ebx + cfi_restore (3) + + ret + +#ifdef CENABLE + /* We need one more register. */ +1: pushl %esi + cfi_adjust_cfa_offset(4) + + /* Enable asynchronous cancellation. */ + CENABLE + movl %eax, %esi + cfi_offset(6, -8) /* %esi */ + + /* Save registers. */ + movl %ebx, %edx + cfi_register (3, 2) + + lea 8(%esp), %eax + call do_paccept + + /* Restore registers. */ + movl %edx, %ebx + cfi_restore (3) + + /* Restore the cancellation. */ + xchgl %esi, %eax + CDISABLE + + /* Restore registers. */ + movl %esi, %eax + popl %esi + cfi_restore (6) + cfi_adjust_cfa_offset(-4) + + /* Successful; return the syscall's value. */ + ret +#endif +PSEUDO_END (paccept) diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/paccept.c similarity index 55% copy from sysdeps/unix/sysv/linux/signalfd.c copy to sysdeps/unix/sysv/linux/paccept.c index 09355ecd1d..1817d381d9 100644 --- a/sysdeps/unix/sysv/linux/signalfd.c +++ b/sysdeps/unix/sysv/linux/paccept.c @@ -1,5 +1,6 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 2008. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,27 +19,36 @@ #include #include -#include -#include +#include +#include +#include +#ifdef __NR_paccept int -signalfd (int fd, const sigset_t *mask, int flags) +paccept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, + const __sigset_t *ss, int flags) { - /* The system call has no flag parameter which is bad. So we have - to wait until we have to support to pass additional values to the - kernel (sys_indirect) before implementing setting flags like - O_NONBLOCK etc. */ - if (flags != 0) - { - __set_errno (EINVAL); - return -1; - } - -#ifdef __NR_signalfd - return INLINE_SYSCALL (signalfd, 3, fd, mask, _NSIG / 8); + if (SINGLE_THREAD_P) + return INLINE_SYSCALL (paccept, 6, fd, addr, addr_len, ss, + _NSIG / 8, flags); + + int oldtype = LIBC_CANCEL_ASYNC (); + + int result = INLINE_SYSCALL (paccept, 6, fd, addr, addr_len, ss, + _NSIG / 8, flags); + + LIBC_CANCEL_RESET (oldtype); + + return result; +} #else +int +paccept (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, + const __sigset_t *ss, int flags) +{ __set_errno (ENOSYS); return -1; -#endif +stub_warning (epoll_pwait) } +#endif diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c index 09355ecd1d..9898f29231 100644 --- a/sysdeps/unix/sysv/linux/signalfd.c +++ b/sysdeps/unix/sysv/linux/signalfd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -25,7 +25,10 @@ int signalfd (int fd, const sigset_t *mask, int flags) { - /* The system call has no flag parameter which is bad. So we have +#ifdef __NR_signalfd4 + return INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags); +#else + /* The old system call has no flag parameter which is bad. So we have to wait until we have to support to pass additional values to the kernel (sys_indirect) before implementing setting flags like O_NONBLOCK etc. */ @@ -35,10 +38,11 @@ signalfd (int fd, const sigset_t *mask, int flags) return -1; } -#ifdef __NR_signalfd +# ifdef __NR_signalfd return INLINE_SYSCALL (signalfd, 3, fd, mask, _NSIG / 8); -#else +# else __set_errno (ENOSYS); return -1; +# endif #endif } diff --git a/sysdeps/unix/sysv/linux/socketcall.h b/sysdeps/unix/sysv/linux/socketcall.h index d836534f3a..24ec9ee2ac 100644 --- a/sysdeps/unix/sysv/linux/socketcall.h +++ b/sysdeps/unix/sysv/linux/socketcall.h @@ -1,5 +1,5 @@ /* ID for functions called via socketcall system call. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 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 @@ -18,7 +18,6 @@ 02111-1307 USA. */ #ifndef _SYS_SOCKETCALL_H - #define _SYS_SOCKETCALL_H 1 /* Define unique numbers for the operations permitted on socket. Linux @@ -44,5 +43,6 @@ #define SOCKOP_getsockopt 15 #define SOCKOP_sendmsg 16 #define SOCKOP_recvmsg 17 +#define SOCKOP_paccept 18 -#endif /* _SYS_SOCKETCALL_H */ +#endif /* sys/socketcall.h */ diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/sparc/bits/socket.h similarity index 95% copy from sysdeps/unix/sysv/linux/bits/socket.h copy to sysdeps/unix/sysv/linux/sparc/bits/socket.h index 3dda3d1c29..032b7df488 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/socket.h @@ -1,4 +1,4 @@ -/* System-specific socket constants and types. Linux version. +/* System-specific socket constants and types. Linux/SPARC version. Copyright (C) 1991, 1992, 1994-2001, 2004, 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -52,12 +52,21 @@ enum __socket_type SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, datagrams of fixed maximum length. */ #define SOCK_SEQPACKET SOCK_SEQPACKET - SOCK_DCCP = 6, -#define SOCK_DCCP SOCK_DCCP /* Datagram Congestion Control Protocol. */ - SOCK_PACKET = 10 /* Linux specific way of getting packets + SOCK_DCCP = 6, /* Datagram Congestion Control Protocol. */ +#define SOCK_DCCP SOCK_DCCP + SOCK_PACKET = 10, /* Linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level. */ #define SOCK_PACKET SOCK_PACKET + + /* Flags to be ORed into the type parameter of socket and socketpair. */ + + SOCK_CLOEXEC = 0x400000, /* Atomically set close-on-exec flag for the + new descriptor(s). */ +#define SOCK_CLOEXEC SOCK_CLOEXEC + SOCK_NONBLOCK = 0x4000 /* Atomically mark descriptor(s) as + non-blocking. */ +#define SOCK_NONBLOCK SOCK_NONBLOCK }; /* Protocol families. */ diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sparc/sys/epoll.h similarity index 86% copy from sysdeps/unix/sysv/linux/sys/epoll.h copy to sysdeps/unix/sysv/linux/sparc/sys/epoll.h index f4e8bda99a..cc0ddef69e 100644 --- a/sysdeps/unix/sysv/linux/sys/epoll.h +++ b/sysdeps/unix/sysv/linux/sparc/sys/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002-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 @@ -31,6 +31,16 @@ typedef __sigset_t sigset_t; #endif +/* Flags to be passed to epoll_create2. */ +enum + { + EPOLL_CLOEXEC = 0x400000, +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 0x4000 +#define EPOLL_NONBLOCK EPOLL_NONBLOCK + }; + + enum EPOLL_EVENTS { EPOLLIN = 0x001, @@ -63,9 +73,9 @@ enum EPOLL_EVENTS /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ -#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */ -#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */ -#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */ +#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ +#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ +#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ typedef union epoll_data @@ -91,6 +101,9 @@ __BEGIN_DECLS returned by epoll_create() should be closed with close(). */ extern int epoll_create (int __size) __THROW; +/* Same as epoll_create but with an additional FLAGS parameter. */ +extern int epoll_create2 (int __size, int __flags) __THROW; + /* Manipulate an epoll instance "epfd". Returns 0 in case of success, -1 in case of error ( the "errno" variable will contain the diff --git a/sysdeps/unix/sysv/linux/sys/eventfd.h b/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h similarity index 85% copy from sysdeps/unix/sysv/linux/sys/eventfd.h copy to sysdeps/unix/sysv/linux/sparc/sys/eventfd.h index 1ebaea7b30..aff4f3592e 100644 --- a/sysdeps/unix/sysv/linux/sys/eventfd.h +++ b/sysdeps/unix/sysv/linux/sparc/sys/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -25,6 +25,15 @@ /* Type for event counter. */ typedef uint64_t eventfd_t; +/* Flags for signalfd. */ +enum + { + EFD_CLOEXEC = 0x400000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 0x4000 +#define EFD_NONBLOCK EFD_NONBLOCK + }; + __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/inotify.h b/sysdeps/unix/sysv/linux/sparc/sys/inotify.h similarity index 91% copy from sysdeps/unix/sysv/linux/sys/inotify.h copy to sysdeps/unix/sysv/linux/sparc/sys/inotify.h index 0131db9d3e..b1fccc42c6 100644 --- a/sysdeps/unix/sysv/linux/sys/inotify.h +++ b/sysdeps/unix/sysv/linux/sparc/sys/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2006, 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 @@ -22,6 +22,16 @@ #include +/* Flags for the parameter of inotify_init1. */ +enum + { + IN_CLOEXEC = 0x400000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 0x4000 +#define IN_NONBLOCK IN_NONBLOCK + }; + + /* Structure describing an inotify event. */ struct inotify_event { @@ -79,6 +89,9 @@ __BEGIN_DECLS /* Create and initialize inotify instance. */ extern int inotify_init (void) __THROW; +/* Create and initialize inotify instance. */ +extern int inotify_init1 (int __flags) __THROW; + /* Add watch of object NAME to inotify instance FD. Notify about events specified by MASK. */ extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) diff --git a/sysdeps/unix/sysv/linux/sys/signalfd.h b/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h similarity index 90% copy from sysdeps/unix/sysv/linux/sys/signalfd.h copy to sysdeps/unix/sysv/linux/sparc/sys/signalfd.h index 7a7f53ba32..a134cc7bab 100644 --- a/sysdeps/unix/sysv/linux/sys/signalfd.h +++ b/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h @@ -45,6 +45,14 @@ struct signalfd_siginfo uint8_t __pad[48]; }; +/* Flags for signalfd. */ +enum + { + SFD_CLOEXEC = 0x400000, +#define SFD_CLOEXEC SFD_CLOEXEC + SFD_NONBLOCK = 0x4000 +#define SFD_NONBLOCK SFD_NONBLOCK + }; __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h similarity index 89% copy from sysdeps/unix/sysv/linux/sys/timerfd.h copy to sysdeps/unix/sysv/linux/sparc/sys/timerfd.h index 0a4b81c9b7..833d050fb8 100644 --- a/sysdeps/unix/sysv/linux/sys/timerfd.h +++ b/sysdeps/unix/sysv/linux/sparc/sys/timerfd.h @@ -22,6 +22,16 @@ #include +/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +enum + { + TFD_CLOEXEC = 0x400000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 0x4000 +#define TFD_NONBLOCK TFD_NONBLOCK + }; + + /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ enum { diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h index f4e8bda99a..aa8784b1ee 100644 --- a/sysdeps/unix/sysv/linux/sys/epoll.h +++ b/sysdeps/unix/sysv/linux/sys/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002-2006, 2007 Free Software Foundation, Inc. +/* Copyright (C) 2002-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 @@ -31,6 +31,16 @@ typedef __sigset_t sigset_t; #endif +/* Flags to be passed to epoll_create2. */ +enum + { + EPOLL_CLOEXEC = 02000000, +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 04000 +#define EPOLL_NONBLOCK EPOLL_NONBLOCK + }; + + enum EPOLL_EVENTS { EPOLLIN = 0x001, @@ -63,9 +73,9 @@ enum EPOLL_EVENTS /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ -#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */ -#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */ -#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */ +#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ +#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ +#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ typedef union epoll_data @@ -91,6 +101,9 @@ __BEGIN_DECLS returned by epoll_create() should be closed with close(). */ extern int epoll_create (int __size) __THROW; +/* Same as epoll_create but with an additional FLAGS parameter. */ +extern int epoll_create2 (int __size, int __flags) __THROW; + /* Manipulate an epoll instance "epfd". Returns 0 in case of success, -1 in case of error ( the "errno" variable will contain the diff --git a/sysdeps/unix/sysv/linux/sys/eventfd.h b/sysdeps/unix/sysv/linux/sys/eventfd.h index 1ebaea7b30..205824b669 100644 --- a/sysdeps/unix/sysv/linux/sys/eventfd.h +++ b/sysdeps/unix/sysv/linux/sys/eventfd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2007 Free Software Foundation, Inc. +/* Copyright (C) 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 @@ -25,6 +25,15 @@ /* Type for event counter. */ typedef uint64_t eventfd_t; +/* Flags for signalfd. */ +enum + { + EFD_CLOEXEC = 02000000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 04000 +#define EFD_NONBLOCK EFD_NONBLOCK + }; + __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/inotify.h b/sysdeps/unix/sysv/linux/sys/inotify.h index 0131db9d3e..81e31fb646 100644 --- a/sysdeps/unix/sysv/linux/sys/inotify.h +++ b/sysdeps/unix/sysv/linux/sys/inotify.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2006, 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 @@ -22,6 +22,16 @@ #include +/* Flags for the parameter of inotify_init1. */ +enum + { + IN_CLOEXEC = 02000000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 04000 +#define IN_NONBLOCK IN_NONBLOCK + }; + + /* Structure describing an inotify event. */ struct inotify_event { @@ -79,6 +89,9 @@ __BEGIN_DECLS /* Create and initialize inotify instance. */ extern int inotify_init (void) __THROW; +/* Create and initialize inotify instance. */ +extern int inotify_init1 (int __flags) __THROW; + /* Add watch of object NAME to inotify instance FD. Notify about events specified by MASK. */ extern int inotify_add_watch (int __fd, const char *__name, uint32_t __mask) diff --git a/sysdeps/unix/sysv/linux/sys/signalfd.h b/sysdeps/unix/sysv/linux/sys/signalfd.h index 7a7f53ba32..dae71a400e 100644 --- a/sysdeps/unix/sysv/linux/sys/signalfd.h +++ b/sysdeps/unix/sysv/linux/sys/signalfd.h @@ -45,6 +45,14 @@ struct signalfd_siginfo uint8_t __pad[48]; }; +/* Flags for signalfd. */ +enum + { + SFD_CLOEXEC = 02000000, +#define SFD_CLOEXEC SFD_CLOEXEC + SFD_NONBLOCK = 04000 +#define SFD_NONBLOCK SFD_NONBLOCK + }; __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h index 0a4b81c9b7..c1bb06f5ff 100644 --- a/sysdeps/unix/sysv/linux/sys/timerfd.h +++ b/sysdeps/unix/sysv/linux/sys/timerfd.h @@ -22,6 +22,16 @@ #include +/* Bits to be set in the FLAGS parameter of `timerfd_create'. */ +enum + { + TFD_CLOEXEC = 02000000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 04000 +#define TFD_NONBLOCK TFD_NONBLOCK + }; + + /* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ enum { diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index b3ecf9f478..b0fe6707f1 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -8,6 +8,7 @@ creat - creat Ci:si __libc_creat creat create_module EXTRA create_module 3 create_module delete_module EXTRA delete_module 3 delete_module epoll_create EXTRA epoll_create i:i epoll_create +epoll_create2 EXTRA epoll_create2 i:ii epoll_create2 epoll_ctl EXTRA epoll_ctl i:iiip epoll_ctl epoll_wait EXTRA epoll_wait Ci:ipii epoll_wait fdatasync - fdatasync Ci:i fdatasync @@ -26,6 +27,7 @@ getsid - getsid i:i getsid init_module EXTRA init_module 5 init_module inotify_add_watch EXTRA inotify_add_watch i:isi inotify_add_watch inotify_init EXTRA inotify_init i: inotify_init +inotify_init1 EXTRA inotify_init1 i:I inotify_init1 inotify_rm_watch EXTRA inotify_rm_watch i:ii inotify_rm_watch ioperm - ioperm i:iii ioperm iopl - iopl i:i iopl @@ -45,6 +47,7 @@ nfsservctl EXTRA nfsservctl i:ipp nfsservctl pause - pause Ci: __libc_pause pause personality EXTRA personality i:i __personality personality pipe - pipe i:f __pipe pipe +pipe2 - pipe2 i:fi pipe2 pivot_root EXTRA pivot_root i:ss pivot_root prctl EXTRA prctl i:iiiii __prctl prctl putpmsg - putpmsg i:ippii putpmsg -- 2.11.4.GIT