summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2016-11-17 18:13:44 -0200
committerAdhemerval Zanella <adhemerval.zanella@linaro.com>2017-03-09 15:22:06 +0100
commit01061a7cab941c1676cf3bad70c7ccdd953f0463 (patch)
treead3e60c5c40541f455779308a1962b203c46cbc7 /sysdeps/unix/sysv
parent9a56f8718341082d98cee9b245a02c8bf8c074da (diff)
downloadglibc-01061a7cab941c1676cf3bad70c7ccdd953f0463.tar.gz
Consolidate Linux accept implementation
This patch consolidates the accept Linux syscall implementation on sysdeps/unix/sysv/linux/accept.c. The changes are: 1. Remove accept from auto-generation syscalls.list on the architecture that uses __NR_accept. 2. Define __NR_accept as default (__ASSUME_ACCEPT_SYSCALL) and undef for architectures that do not support it. 3. Remove __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL and decide to use __NR_accept4 for accept generation based on __ASSUME_ACCEPT4_SYSCALL. Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32, aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu. * sysdeps/unix/sysv/linux/accept.c (__libc_accept): Replace __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL by __ASSUME_ACCEPT4_SYSCALL. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove accept from auto-generation list. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/generic/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): New define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Define wheter kernel version supports. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Define. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Remove define. (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/sh/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine. * sysdeps/unix/sysv/linux/sparc/kernel-features.h (__ASSUME_ACCEPT_SYSCALL): Undefine for 32 bits.
Diffstat (limited to 'sysdeps/unix/sysv')
-rw-r--r--sysdeps/unix/sysv/linux/accept.c7
-rw-r--r--sysdeps/unix/sysv/linux/alpha/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/arm/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/generic/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/hppa/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/i386/kernel-features.h3
-rw-r--r--sysdeps/unix/sysv/linux/ia64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h1
-rw-r--r--sysdeps/unix/sysv/linux/m68k/kernel-features.h3
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/kernel-features.h1
-rw-r--r--sysdeps/unix/sysv/linux/mips/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/kernel-features.h1
-rw-r--r--sysdeps/unix/sysv/linux/s390/kernel-features.h3
-rw-r--r--sysdeps/unix/sysv/linux/sh/kernel-features.h1
-rw-r--r--sysdeps/unix/sysv/linux/sparc/kernel-features.h4
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/syscalls.list1
17 files changed, 12 insertions, 20 deletions
diff --git a/sysdeps/unix/sysv/linux/accept.c b/sysdeps/unix/sysv/linux/accept.c
index c5935ab0a8..2fb59b7537 100644
--- a/sysdeps/unix/sysv/linux/accept.c
+++ b/sysdeps/unix/sysv/linux/accept.c
@@ -15,21 +15,16 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <errno.h>
-#include <signal.h>
#include <sys/socket.h>
-
#include <sysdep-cancel.h>
#include <socketcall.h>
-#include <sys/syscall.h>
-#include <kernel-features.h>
int
__libc_accept (int fd, __SOCKADDR_ARG addr, socklen_t *len)
{
#ifdef __ASSUME_ACCEPT_SYSCALL
return SYSCALL_CANCEL (accept, fd, addr.__sockaddr__, len);
-#elif defined __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL
+#elif defined __ASSUME_ACCEPT4_SYSCALL
return SYSCALL_CANCEL (accept4, fd, addr.__sockaddr__, len, 0);
#else
return SOCKETCALL_CANCEL (accept, fd, addr.__sockaddr__, len);
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 4001020a6f..4cfe19e645 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -5,7 +5,6 @@ sigstack - sigstack 2 sigstack
getpriority - getpriority i:ii __getpriority getpriority
# proper socket implementations:
-accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 0263eee406..1c4f61ff40 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -22,7 +22,6 @@ fanotify_mark EXTRA fanotify_mark i:iiiiis fanotify_mark
personality EXTRA personality Ei:i __personality personality
# proper socket implementations:
-accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 3bb547303e..b176a729d7 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -5,7 +5,6 @@ socket - socket i:iii __socket socket
socketpair - socketpair i:iiif __socketpair socketpair
bind - bind i:ipi __bind bind
listen - listen i:ii __listen listen
-accept - accept Ci:iBN __libc_accept __accept accept
connect - connect Ci:ipi __libc_connect __connect connect
getsockname - getsockname i:ipp __getsockname getsockname
getpeername - getpeername i:ipp __getpeername getpeername
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 6d47b11f8a..ee814fba6f 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -1,7 +1,6 @@
# File name Caller Syscall name # args Strong name Weak names
# proper socket implementations:
-accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 2696d1af57..07462f824a 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -33,7 +33,6 @@
# define __ASSUME_BIND_SYSCALL 1
# define __ASSUME_CONNECT_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
-# define __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL 1
# define __ASSUME_GETSOCKOPT_SYSCALL 1
# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
@@ -47,6 +46,8 @@
#include_next <kernel-features.h>
+#undef __ASSUME_ACCEPT_SYSCALL
+
#if __LINUX_KERNEL_VERSION < 0x040300
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_SENDMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index dd07db3539..96db4c30a5 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -5,7 +5,6 @@ umount2 - umount 2 __umount2 umount2
getpriority - getpriority i:ii __getpriority getpriority
# proper socket implementations:
-accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 08485cd0fd..78b091b6ae 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -147,6 +147,7 @@
separate syscalls were only added later. */
#define __ASSUME_SENDMSG_SYSCALL 1
#define __ASSUME_RECVMSG_SYSCALL 1
+#define __ASSUME_ACCEPT_SYSCALL 1
/* Support for SysV IPC through wired syscalls. All supported architectures
either support ipc syscall and/or all the ipc correspondent syscalls. */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 6811a28121..ff196ac12f 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -27,7 +27,6 @@
# define __ASSUME_BIND_SYSCALL 1
# define __ASSUME_CONNECT_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
-# define __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL 1
# define __ASSUME_GETSOCKOPT_SYSCALL 1
# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
@@ -41,6 +40,8 @@
#include_next <kernel-features.h>
+#undef __ASSUME_ACCEPT_SYSCALL
+
#if __LINUX_KERNEL_VERSION < 0x040300
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_RECVMMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index f68e8c5d16..9532d5716e 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -24,7 +24,6 @@
#define __ASSUME_BIND_SYSCALL 1
#define __ASSUME_CONNECT_SYSCALL 1
#define __ASSUME_LISTEN_SYSCALL 1
-#define __ASSUME_ACCEPT_SYSCALL 1
#define __ASSUME_GETSOCKNAME_SYSCALL 1
#define __ASSUME_GETPEERNAME_SYSCALL 1
#define __ASSUME_SOCKETPAIR_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index cd946a0e4d..81ea2a7ada 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -12,7 +12,6 @@ sysmips - sysmips i:iiii __sysmips sysmips
# Socket functions; Linux/MIPS doesn't use the socketcall(2) wrapper;
# it's provided for compatibility, though.
#
-accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 02dadc80f5..272800c263 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -25,7 +25,6 @@
#define __ASSUME_BIND_SYSCALL 1
#define __ASSUME_CONNECT_SYSCALL 1
#define __ASSUME_LISTEN_SYSCALL 1
-#define __ASSUME_ACCEPT_SYSCALL 1
#define __ASSUME_GETSOCKNAME_SYSCALL 1
#define __ASSUME_GETPEERNAME_SYSCALL 1
#define __ASSUME_SOCKETPAIR_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 4e04d26308..ccfb0a2c88 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -27,7 +27,6 @@
# define __ASSUME_BIND_SYSCALL 1
# define __ASSUME_CONNECT_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
-# define __ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL 1
# define __ASSUME_GETSOCKOPT_SYSCALL 1
# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
@@ -41,6 +40,8 @@
#include_next <kernel-features.h>
+#undef __ASSUME_ACCEPT_SYSCALL
+
#if __LINUX_KERNEL_VERSION < 0x040300
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_RECVMMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 10a669fe3f..7a83211661 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -28,7 +28,6 @@
#define __ASSUME_BIND_SYSCALL 1
#define __ASSUME_CONNECT_SYSCALL 1
#define __ASSUME_LISTEN_SYSCALL 1
-#define __ASSUME_ACCEPT_SYSCALL 1
#define __ASSUME_GETSOCKNAME_SYSCALL 1
#define __ASSUME_GETPEERNAME_SYSCALL 1
#define __ASSUME_SOCKETPAIR_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index f78ae8518b..3ffa96e303 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -38,5 +38,9 @@
# undef __ASSUME_SET_ROBUST_LIST
#endif
+#if !defined __arch64__
+# undef __ASSUME_ACCEPT_SYSCALL
+#endif
+
/* sparc only supports ipc syscall. */
#undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index eecd83742d..27ca5fa4a3 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -2,7 +2,6 @@
# Override select.S in parent directory:
select - select C:5 __select select
-accept - accept C:3 __libc_accept __accept accept
bind - bind 3 __bind bind
connect - connect C:3 __libc_connect __connect connect
getpeername - getpeername 3 __getpeername getpeername
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 45d5ebf59b..fe7d1567cb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -10,7 +10,6 @@ syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
# proper socket implementations:
-accept - accept Ci:iBN __libc_accept __accept accept
bind - bind i:ipi __bind bind
connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername