* [PATCH 4/4] Consolidate Linux send and sendto implementation
2017-01-30 14:02 [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 2/4] Consolidate Linux connect implementation Adhemerval Zanella
@ 2017-01-30 14:02 ` Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 3/4] Consolidate Linux recv and recvfrom implementation Adhemerval Zanella
` (2 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2017-01-30 14:02 UTC (permalink / raw)
To: libc-alpha
This patch consolidates the send Linux syscall implementation on
sysdeps/unix/sysv/linux/send{to}.c. The changes are:
1. Remove send and sendto from auto-generation syscalls.list on the
architecture that uses __NR_send.
2. Define __NR_send for such architectures. It was done instead of
defining in default kernel-features.h because current Linux practice
for new ports are to implement only __NR_sendto [1] and it will
require adding new kernel-features for ports that do not require it
(aarch64 for instance).
3. Define __NR_sendto as default (__ASSUME_SENDTO_SYSCALL) and undef
for architectures that do not support it.
4. Remove __ASSUME_SENDTO_FOR_SEND_SYSCALL and decide to use
__NR_sendto for send generation based on __ASSUME_SENDTO_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/generic/send.c: Remove file.
* sysdeps/unix/sysv/linux/x86_64/send.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/send.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h
(__ASSUME_SEND_SYSCALL): Define.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
(__ASSUME_SEND_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
(__ASSUME_SEND_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/ia64/kernel-features.h
(__ASSUME_SEND_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_SEND_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
[_MIPS_SIM == _ABIO32] (__ASSUME_SEND_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_SEND_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Remove.
(__ASSUME_SENDTO_SYSCALL): Define wheter the kernel supports it.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Remove.
(__ASSUME_SENDTO_SYSCALL): Define wheter the kernel supports it.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Remove.
(__ASSUME_SENDTO_SYSCALL): Define wheter the kernel supports it.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_SENDTO_SYSCALL): Define as default.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Define.
(__ASSUME_SENDTO_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_SENDTO_SYSCALL): Remove defune.
* sysdeps/unix/sysv/linux/send.c (__ASSUME_SENDTO_FOR_SEND_SYSCALL):
Replace by __ASSUME_SENDTO_SYSCALL.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_SEND_SYSCALL): Remove define.
(__ASSUME_SENDTO_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sysdep.h (HAVE_INTERNAL_SEND_SYMBOl)
* sysdeps/unix/sysv/linux/aarch64/sysdep.h
(HAVE_INTERNAL_SEND_SYMBOl): Undefine.
* sysdeps/unix/sysv/linux/nios2/sysdep.h
(HAVE_INTERNAL_SEND_SYMBOl): Likewise.
* sysdeps/unix/sysv/linux/tile/sysdep.h
(HAVE_INTERNAL_SEND_SYMBOl): Likewise.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove send and
sendto 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.
[1] include/asm-generic/unistd.h (__ARCH_WANT_SYSCALL_DEPRECATED)
---
ChangeLog | 55 ++++++++++++++++++++++
sysdeps/unix/sysv/linux/aarch64/sysdep.h | 4 ++
sysdeps/unix/sysv/linux/alpha/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/alpha/syscalls.list | 2 -
sysdeps/unix/sysv/linux/arm/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/arm/syscalls.list | 2 -
sysdeps/unix/sysv/linux/generic/send.c | 30 ------------
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/hppa/syscalls.list | 2 -
sysdeps/unix/sysv/linux/i386/kernel-features.h | 3 +-
sysdeps/unix/sysv/linux/ia64/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/ia64/syscalls.list | 2 -
sysdeps/unix/sysv/linux/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 3 +-
sysdeps/unix/sysv/linux/mips/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/mips/mips64/send.c | 1 -
sysdeps/unix/sysv/linux/mips/syscalls.list | 2 -
sysdeps/unix/sysv/linux/nios2/sysdep.h | 4 ++
sysdeps/unix/sysv/linux/s390/kernel-features.h | 3 +-
sysdeps/unix/sysv/linux/send.c | 9 ++--
sysdeps/unix/sysv/linux/sendto.c | 5 --
sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 -
.../unix/sysv/linux/sparc/sparc64/syscalls.list | 2 -
sysdeps/unix/sysv/linux/sysdep.h | 4 ++
sysdeps/unix/sysv/linux/tile/sysdep.h | 4 ++
sysdeps/unix/sysv/linux/x86_64/send.c | 31 ------------
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
28 files changed, 83 insertions(+), 94 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/generic/send.c
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/send.c
delete mode 100644 sysdeps/unix/sysv/linux/x86_64/send.c
diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index ad49241..ea38588 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -157,6 +157,10 @@
# define HAVE_CLOCK_GETTIME_VSYSCALL 1
# define HAVE_GETTIMEOFDAY_VSYSCALL 1
+/* Previously AArch64 used the generic version withouth the libc_hidden_def
+ which lead in a non existent __send symbol in libc.so. */
+# undef HAVE_INTERNAL_SEND_SYMBOl
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
# undef INLINE_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
index 3383a98..53f7611 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -33,5 +33,6 @@
#define __NR_shmat __NR_osf_shmat
#define __ASSUME_RECV_SYSCALL 1
+#define __ASSUME_SEND_SYSCALL 1
#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 8a62b6e..aa21b10 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -10,8 +10,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-send - send Ci:ibni __libc_send __send send
-sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
shutdown - shutdown i:ii __shutdown shutdown
socket - socket i:iii __socket socket
diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
index 104c9f9..4923dfd 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -39,3 +39,4 @@
#define __NR_fadvise64_64 __NR_arm_fadvise64_64
#define __ASSUME_RECV_SYSCALL 1
+#define __ASSUME_SEND_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 9f445e6..13441f7 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -27,8 +27,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-send - send Ci:ibni __libc_send __send send
-sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
shutdown - shutdown i:ii __shutdown shutdown
socket - socket i:iii __socket socket
diff --git a/sysdeps/unix/sysv/linux/generic/send.c b/sysdeps/unix/sysv/linux/generic/send.c
deleted file mode 100644
index d0cb035..0000000
--- a/sysdeps/unix/sysv/linux/generic/send.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sysdep-cancel.h>
-#include <libc-symbols.h>
-
-ssize_t
-__libc_send (int sockfd, const void *buffer, size_t len, int flags)
-{
- return SYSCALL_CANCEL (sendto, sockfd, buffer, len, flags, NULL, 0);
-}
-strong_alias (__libc_send, __send)
-weak_alias (__libc_send, send)
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index c16ee52..ed8b216 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -7,7 +7,6 @@ bind - bind i:ipi __bind bind
listen - listen i:ii __listen listen
getsockname - getsockname i:ipp __getsockname getsockname
getpeername - getpeername i:ipp __getpeername getpeername
-sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
shutdown - shutdown i:ii __shutdown shutdown
diff --git a/sysdeps/unix/sysv/linux/hppa/kernel-features.h b/sysdeps/unix/sysv/linux/hppa/kernel-features.h
index 1fd7398..0e73a5c 100644
--- a/sysdeps/unix/sysv/linux/hppa/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/hppa/kernel-features.h
@@ -26,3 +26,4 @@
#include_next <kernel-features.h>
#define __ASSUME_RECV_SYSCALL 1
+#define __ASSUME_SEND_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 1248877..cd37573 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -6,8 +6,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-send - send Ci:ibni __libc_send __send send
-sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
shutdown - shutdown i:ii __shutdown shutdown
socket - socket i:iii __socket socket
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index a886442..96a8e3b 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -36,8 +36,6 @@
# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
# define __ASSUME_GETPEERNAME_SYSCALL 1
-# define __ASSUME_SENDTO_SYSCALL 1
-# define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
#endif
@@ -51,6 +49,7 @@
# undef __ASSUME_RECVMSG_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
+# undef __ASSUME_SENDTO_SYSCALL
#endif
/* i686 only supports ipc syscall. */
diff --git a/sysdeps/unix/sysv/linux/ia64/kernel-features.h b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
index 80e41b6..ac9403e 100644
--- a/sysdeps/unix/sysv/linux/ia64/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
@@ -29,5 +29,6 @@
#endif
#define __ASSUME_RECV_SYSCALL 1
+#define __ASSUME_SEND_SYSCALL 1
#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 24e9c98..56f4138 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -10,8 +10,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-send - send Ci:ibni __libc_send __send send
-sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
shutdown - shutdown i:ii __shutdown shutdown
socket - socket i:iii __socket socket
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index c6c816e..318fcf9 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -150,6 +150,7 @@
#define __ASSUME_ACCEPT_SYSCALL 1
#define __ASSUME_CONNECT_SYSCALL 1
#define __ASSUME_RECVFROM_SYSCALL 1
+#define __ASSUME_SENDTO_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 5e756ab..3bcd1c2 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -30,8 +30,6 @@
# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
# define __ASSUME_GETPEERNAME_SYSCALL 1
-# define __ASSUME_SENDTO_SYSCALL 1
-# define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
#endif
@@ -48,6 +46,7 @@
# undef __ASSUME_RECVMSG_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
+# undef __ASSUME_SENDTO_SYSCALL
#endif
/* No support for PI futexes or robust mutexes before 3.10 for m68k. */
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index 276d12f..cf21681 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -36,6 +36,7 @@
# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
/* mips32 support wire-up network syscalls. */
# define __ASSUME_RECV_SYSCALL 1
+# define __ASSUME_SEND_SYSCALL 1
#endif
/* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/send.c b/sysdeps/unix/sysv/linux/mips/mips64/send.c
deleted file mode 100644
index d2c2996..0000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/send.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/x86_64/send.c>
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index 48a33bb..f3621cd 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -17,8 +17,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-send - send Ci:ibni __libc_send __send send
-sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
shutdown - shutdown i:ii __shutdown shutdown
socket - socket i:iii __socket socket
diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h
index b1c04cd..7b3efb2 100644
--- a/sysdeps/unix/sysv/linux/nios2/sysdep.h
+++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h
@@ -140,6 +140,10 @@
/* In order to get __set_errno() definition in INLINE_SYSCALL. */
#include <errno.h>
+/* Previously AArch64 used the generic version withouth the libc_hidden_def
+ which lead in a non existent __send symbol in libc.so. */
+# undef HAVE_INTERNAL_SEND_SYMBOl
+
/* Define a macro which expands into the inline wrapper code for a system
call. */
#undef INLINE_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 59bc434..f44d429 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -30,8 +30,6 @@
# define __ASSUME_SETSOCKOPT_SYSCALL 1
# define __ASSUME_GETSOCKNAME_SYSCALL 1
# define __ASSUME_GETPEERNAME_SYSCALL 1
-# define __ASSUME_SENDTO_SYSCALL 1
-# define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
#endif
@@ -47,6 +45,7 @@
# undef __ASSUME_RECVMSG_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
+# undef __ASSUME_SENDTO_SYSCALL
#endif
/* s390 only supports ipc syscall. */
diff --git a/sysdeps/unix/sysv/linux/send.c b/sysdeps/unix/sysv/linux/send.c
index 4c02c8b..8a0ea67 100644
--- a/sysdeps/unix/sysv/linux/send.c
+++ b/sysdeps/unix/sysv/linux/send.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 <kernel-features.h>
-#include <sys/syscall.h>
ssize_t
__libc_send (int fd, const void *buf, size_t len, int flags)
{
#ifdef __ASSUME_SEND_SYSCALL
return SYSCALL_CANCEL (send, fd, buf, len, flags);
-#elif defined __ASSUME_SENDTO_FOR_SEND_SYSCALL
+#elif defined __ASSUME_SENDTO_SYSCALL
return SYSCALL_CANCEL (sendto, fd, buf, len, flags, NULL, 0);
#else
return SOCKETCALL_CANCEL (send, fd, buf, len, flags);
@@ -37,4 +32,6 @@ __libc_send (int fd, const void *buf, size_t len, int flags)
}
weak_alias (__libc_send, send)
weak_alias (__libc_send, __send)
+#ifdef HAVE_INTERNAL_SEND_SYMBOl
libc_hidden_def (__send)
+#endif
diff --git a/sysdeps/unix/sysv/linux/sendto.c b/sysdeps/unix/sysv/linux/sendto.c
index 2b9e1d7..be1bc6f 100644
--- a/sysdeps/unix/sysv/linux/sendto.c
+++ b/sysdeps/unix/sysv/linux/sendto.c
@@ -15,14 +15,9 @@
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 <kernel-features.h>
-#include <sys/syscall.h>
ssize_t
__libc_sendto (int fd, const void *buf, size_t len, int flags,
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 61bdd45..72ec394 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -32,7 +32,6 @@
#define __ASSUME_GETPEERNAME_SYSCALL 1
#define __ASSUME_SOCKETPAIR_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
-#define __ASSUME_SENDTO_SYSCALL 1
#define __ASSUME_SHUTDOWN_SYSCALL 1
#define __ASSUME_GETSOCKOPT_SYSCALL 1
#define __ASSUME_SETSOCKOPT_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index bf2cfdc..1e85118 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -7,8 +7,6 @@ getpeername - getpeername 3 __getpeername getpeername
getsockname - getsockname 3 __getsockname getsockname
getsockopt - getsockopt 5 __getsockopt getsockopt
listen - listen 2 __listen listen
-send - send C:4 __libc_send __send send
-sendto - sendto C:6 __libc_sendto __sendto sendto
setsockopt - setsockopt 5 __setsockopt setsockopt
shutdown - shutdown 2 __shutdown shutdown
socketpair - socketpair 4 __socketpair socketpair
diff --git a/sysdeps/unix/sysv/linux/sysdep.h b/sysdeps/unix/sysv/linux/sysdep.h
index 02c957e..ed1c807 100644
--- a/sysdeps/unix/sysv/linux/sysdep.h
+++ b/sysdeps/unix/sysv/linux/sysdep.h
@@ -62,3 +62,7 @@
#define LO_HI_LONG(val) \
(long) (val), \
(long) (((uint64_t) (val)) >> 32)
+
+/* Exports the __send symbol on send.c linux implementation (some ABI have
+ it missing due the usage of a old generic version without it). */
+#define HAVE_INTERNAL_SEND_SYMBOl 1
diff --git a/sysdeps/unix/sysv/linux/tile/sysdep.h b/sysdeps/unix/sysv/linux/tile/sysdep.h
index 70ff6b9..f8cfe66 100644
--- a/sysdeps/unix/sysv/linux/tile/sysdep.h
+++ b/sysdeps/unix/sysv/linux/tile/sysdep.h
@@ -218,6 +218,10 @@
#define HAVE_CLOCK_GETTIME_VSYSCALL 1
#define HAVE_GETTIMEOFDAY_VSYSCALL 1
+/* Previously tile used the generic version withouth the libc_hidden_def
+ which lead in a non existent __send symbol in libc.so. */
+# undef HAVE_INTERNAL_SEND_SYMBOl
+
#endif /* __ASSEMBLER__ */
/* Pointer mangling support. */
diff --git a/sysdeps/unix/sysv/linux/x86_64/send.c b/sysdeps/unix/sysv/linux/x86_64/send.c
deleted file mode 100644
index c4af9cd..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/send.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 2001-2017 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <sys/socket.h>
-#include <sysdep-cancel.h>
-
-/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
-ssize_t
-__libc_send (int fd, const void *buf, size_t n, int flags)
-{
- return SYSCALL_CANCEL (sendto, fd, buf, n, flags, NULL, (size_t) 0);
-}
-
-weak_alias (__libc_send, __send)
-libc_hidden_weak (__send)
-weak_alias (__send, send)
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index 7ff0376..889193b 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -15,7 +15,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
shutdown - shutdown i:ii __shutdown shutdown
socket - socket i:iii __socket socket
--
2.7.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] Consolidate Linux accept implementation
2017-01-30 14:02 [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
` (2 preceding siblings ...)
2017-01-30 14:02 ` [PATCH 3/4] Consolidate Linux recv and recvfrom implementation Adhemerval Zanella
@ 2017-01-30 14:02 ` Adhemerval Zanella
2017-02-08 20:59 ` Phil Blundell
2017-02-20 14:19 ` [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
4 siblings, 1 reply; 13+ messages in thread
From: Adhemerval Zanella @ 2017-01-30 14:02 UTC (permalink / raw)
To: libc-alpha
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_acccept 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.
---
ChangeLog | 33 ++++++++++++++++++++++
sysdeps/unix/sysv/linux/accept.c | 7 +----
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/i386/kernel-features.h | 3 +-
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 4 ++-
.../unix/sysv/linux/microblaze/kernel-features.h | 1 -
sysdeps/unix/sysv/linux/mips/syscalls.list | 1 -
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 1 -
sysdeps/unix/sysv/linux/s390/kernel-features.h | 3 +-
sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 -
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 4 +++
.../unix/sysv/linux/sparc/sparc64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
18 files changed, 46 insertions(+), 20 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/accept.c b/sysdeps/unix/sysv/linux/accept.c
index c5935ab..2fb59b7 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 4001020..4cfe19e 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 0263eee..1c4f61f 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 3bb5473..b176a72 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 6d47b11..ee814fb 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 2696d1a..07462f8 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 dd07db3..96db4c3 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 08485cd..78b091b 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 6811a28..f583ae7 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,7 +40,10 @@
#include_next <kernel-features.h>
+#undef __ASSUME_ACCEPT_SYSCALL
+
#if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_ACCCEPT_SYSCALL
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_RECVMMSG_SYSCALL
# undef __ASSUME_SENDMMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index f68e8c5..9532d57 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 cd946a0..81ea2a7 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 02dadc8..272800c 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 4e04d26..ccfb0a2 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 10a669f..7a83211 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 f78ae85..3ffa96e 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 eecd837..27ca5fa 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 45d5ebf..fe7d156 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
--
2.7.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/4] Consolidate Linux recv and recvfrom implementation
2017-01-30 14:02 [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 2/4] Consolidate Linux connect implementation Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 4/4] Consolidate Linux send and sendto implementation Adhemerval Zanella
@ 2017-01-30 14:02 ` Adhemerval Zanella
2017-03-06 10:48 ` Dmitry V. Levin
2017-01-30 14:02 ` [PATCH 1/4] Consolidate Linux accept implementation Adhemerval Zanella
2017-02-20 14:19 ` [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
4 siblings, 1 reply; 13+ messages in thread
From: Adhemerval Zanella @ 2017-01-30 14:02 UTC (permalink / raw)
To: libc-alpha
This patch consolidates the recv Linux syscall implementation on
sysdeps/unix/sysv/linux/recv.c. The changes are:
1. Remove recv and recvfrom from auto-generation syscalls.list on the
architecture that uses __NR_recv.
2. Define __NR_recv for such architectures. It was done instead of
defining in default kernel-features.h because current Linux practice
for new ports are to implement only __NR_recvfrom [1] and it will
require adding new kernel-features for ports that do not require it
(aarch64 for instance).
3. Define __NR_recvfrom as default (__ASSUME_RECVFROM_SYSCALL) and undef
for architectures that do not support it.
4. Remove __ASSUME_RECVFROM_FOR_RECV_SYSCALL and decide to use
__NR_recvfrom for recv generation based on __ASSUME_RECVFROM__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/alpha/kernel-features.h
(__ASSUME_RECV_SYSCALL): Define.
* sysdeps/unix/sysv/linux/arm/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/hppa/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/ia64/kernel-features.h
(__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/mips/kernel-features.h
[_MIPS_SIM == _ABIO32] (__ASSUME_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define whether the kernel supports it.
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Undefine.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define whether the kernel supports it.
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Undefine.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define whether the kernel supports it.
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Undefine.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define as default.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define.
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define.
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define.
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define whether the kernel supports it.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recv and
recvfrom from uto-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: Likwise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/generic/recv.c: Remove file.
* sysdeps/unix/sysv/linux/x86_64/recv.c: Likewise.
* sysdeps/unix/sysv/linux/mips/mips64/recv.c: Likewise.
* sysdeps/unix/sysv/linux/recv.c
(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Replace by
__ASSUME_RECVFROM_SYSCALL.
[1] include/asm-generic/unistd.h (__ARCH_WANT_SYSCALL_DEPRECATED)
---
ChangeLog | 49 ++++++++++++++++++++++
sysdeps/unix/sysv/linux/alpha/kernel-features.h | 2 +
sysdeps/unix/sysv/linux/alpha/syscalls.list | 2 -
sysdeps/unix/sysv/linux/arm/kernel-features.h | 2 +
sysdeps/unix/sysv/linux/arm/syscalls.list | 2 -
sysdeps/unix/sysv/linux/generic/recv.c | 32 --------------
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/kernel-features.h | 2 +
sysdeps/unix/sysv/linux/hppa/syscalls.list | 2 -
sysdeps/unix/sysv/linux/i386/kernel-features.h | 3 +-
sysdeps/unix/sysv/linux/ia64/kernel-features.h | 2 +
sysdeps/unix/sysv/linux/ia64/syscalls.list | 2 -
sysdeps/unix/sysv/linux/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 3 +-
.../unix/sysv/linux/microblaze/kernel-features.h | 3 +-
sysdeps/unix/sysv/linux/mips/kernel-features.h | 2 +
sysdeps/unix/sysv/linux/mips/mips64/recv.c | 1 -
sysdeps/unix/sysv/linux/mips/syscalls.list | 2 -
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 1 -
sysdeps/unix/sysv/linux/recv.c | 7 +---
sysdeps/unix/sysv/linux/recvfrom.c | 5 ---
sysdeps/unix/sysv/linux/s390/kernel-features.h | 3 +-
sysdeps/unix/sysv/linux/sh/kernel-features.h | 2 -
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 1 +
.../unix/sysv/linux/sparc/sparc64/syscalls.list | 2 -
sysdeps/unix/sysv/linux/x86_64/recv.c | 33 ---------------
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
27 files changed, 66 insertions(+), 102 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/generic/recv.c
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/recv.c
delete mode 100644 sysdeps/unix/sysv/linux/x86_64/recv.c
diff --git a/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
index 0614c78..3383a98 100644
--- a/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -32,4 +32,6 @@
/* Alpha defines SysV ipc shmat syscall with a different name. */
#define __NR_shmat __NR_osf_shmat
+#define __ASSUME_RECV_SYSCALL 1
+
#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index e9efb43..8a62b6e 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -10,8 +10,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-recv - recv Ci:ibni __libc_recv __recv recv
-recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
send - send Ci:ibni __libc_send __send send
sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h
index a3c0d9a..104c9f9 100644
--- a/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -37,3 +37,5 @@
/* ARM only has a syscall for fadvise64{_64} and it is defined with a
non-standard name. */
#define __NR_fadvise64_64 __NR_arm_fadvise64_64
+
+#define __ASSUME_RECV_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 1c12be4..9f445e6 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -27,8 +27,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-recv - recv Ci:ibni __libc_recv __recv recv
-recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
send - send Ci:ibni __libc_send __send send
sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
diff --git a/sysdeps/unix/sysv/linux/generic/recv.c b/sysdeps/unix/sysv/linux/generic/recv.c
deleted file mode 100644
index c1aebd7..0000000
--- a/sysdeps/unix/sysv/linux/generic/recv.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Chris Metcalf <cmetcalf@tilera.com>, 2011.
-
- 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sysdep-cancel.h>
-#include <libc-symbols.h>
-
-ssize_t
-__libc_recv (int sockfd, void *buffer, size_t len, int flags)
-{
- return SYSCALL_CANCEL (recvfrom, sockfd, buffer, len, flags,
- NULL, NULL);
-}
-strong_alias (__libc_recv, __recv)
-libc_hidden_def (__recv)
-weak_alias (__libc_recv, recv)
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 2874a1f..c16ee52 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -8,7 +8,6 @@ listen - listen i:ii __listen listen
getsockname - getsockname i:ipp __getsockname getsockname
getpeername - getpeername i:ipp __getpeername getpeername
sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
-recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
shutdown - shutdown i:ii __shutdown shutdown
diff --git a/sysdeps/unix/sysv/linux/hppa/kernel-features.h b/sysdeps/unix/sysv/linux/hppa/kernel-features.h
index 7ff5434..1fd7398 100644
--- a/sysdeps/unix/sysv/linux/hppa/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/hppa/kernel-features.h
@@ -24,3 +24,5 @@
#endif
#include_next <kernel-features.h>
+
+#define __ASSUME_RECV_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index 288d096..1248877 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -6,8 +6,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-recv - recv Ci:ibni __libc_recv __recv recv
-recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
send - send Ci:ibni __libc_send __send send
sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 23ca794..a886442 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -38,8 +38,6 @@
# define __ASSUME_GETPEERNAME_SYSCALL 1
# define __ASSUME_SENDTO_SYSCALL 1
# define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1
-# define __ASSUME_RECVFROM_SYSCALL 1
-# define __ASSUME_RECVFROM_FOR_RECV_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
#endif
@@ -52,6 +50,7 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
+# undef __ASSUME_RECVFROM_SYSCALL
#endif
/* i686 only supports ipc syscall. */
diff --git a/sysdeps/unix/sysv/linux/ia64/kernel-features.h b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
index d13e403..80e41b6 100644
--- a/sysdeps/unix/sysv/linux/ia64/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
@@ -28,4 +28,6 @@
# undef __ASSUME_ACCEPT4
#endif
+#define __ASSUME_RECV_SYSCALL 1
+
#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 32fdb08..24e9c98 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -10,8 +10,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-recv - recv Ci:ibni __libc_recv __recv recv
-recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
send - send Ci:ibni __libc_send __send send
sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index e93f5f4..c6c816e 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -149,6 +149,7 @@
#define __ASSUME_RECVMSG_SYSCALL 1
#define __ASSUME_ACCEPT_SYSCALL 1
#define __ASSUME_CONNECT_SYSCALL 1
+#define __ASSUME_RECVFROM_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 a58c168..5e756ab 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -32,8 +32,6 @@
# define __ASSUME_GETPEERNAME_SYSCALL 1
# define __ASSUME_SENDTO_SYSCALL 1
# define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1
-# define __ASSUME_RECVFROM_SYSCALL 1
-# define __ASSUME_RECVFROM_FOR_RECV_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
#endif
@@ -49,6 +47,7 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
+# undef __ASSUME_RECVFROM_SYSCALL
#endif
/* No support for PI futexes or robust mutexes before 3.10 for m68k. */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 9532d57..8c59c89 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -28,9 +28,8 @@
#define __ASSUME_GETPEERNAME_SYSCALL 1
#define __ASSUME_SOCKETPAIR_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
-#define __ASSUME_SENDTO_SYSCALL 1
#define __ASSUME_RECV_SYSCALL 1
-#define __ASSUME_RECVFROM_SYSCALL 1
+#define __ASSUME_SENDTO_SYSCALL 1
#define __ASSUME_SHUTDOWN_SYSCALL 1
#define __ASSUME_GETSOCKOPT_SYSCALL 1
#define __ASSUME_SETSOCKOPT_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/mips/kernel-features.h b/sysdeps/unix/sysv/linux/mips/kernel-features.h
index 83a5c8f..276d12f 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel-features.h
@@ -34,6 +34,8 @@
# define __ASSUME_ALIGNED_REGISTER_PAIRS 1
/* mips32 only supports ipc syscall. */
# undef __ASSUME_DIRECT_SYSVIPC_SYSCALLS
+/* mips32 support wire-up network syscalls. */
+# define __ASSUME_RECV_SYSCALL 1
#endif
/* Define that mips64-n32 is a ILP32 ABI to set the correct interface to
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/recv.c b/sysdeps/unix/sysv/linux/mips/mips64/recv.c
deleted file mode 100644
index b910525..0000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/recv.c
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/x86_64/recv.c>
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index 8b0c5a3..48a33bb 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -17,8 +17,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-recv - recv Ci:ibni __libc_recv __recv recv
-recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
send - send Ci:ibni __libc_send __send send
sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 272800c..a0d2e8f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -31,7 +31,6 @@
#define __ASSUME_SEND_SYSCALL 1
#define __ASSUME_SENDTO_SYSCALL 1
#define __ASSUME_RECV_SYSCALL 1
-#define __ASSUME_RECVFROM_SYSCALL 1
#define __ASSUME_SHUTDOWN_SYSCALL 1
#define __ASSUME_GETSOCKOPT_SYSCALL 1
#define __ASSUME_SETSOCKOPT_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/recv.c b/sysdeps/unix/sysv/linux/recv.c
index 6d62cf8..2467d99 100644
--- a/sysdeps/unix/sysv/linux/recv.c
+++ b/sysdeps/unix/sysv/linux/recv.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 <kernel-features.h>
-#include <sys/syscall.h>
ssize_t
__libc_recv (int fd, void *buf, size_t len, int flags)
{
#ifdef __ASSUME_RECV_SYSCALL
return SYSCALL_CANCEL (recv, fd, buf, len, flags);
-#elif defined __ASSUME_RECVFROM_FOR_RECV_SYSCALL
+#elif defined __ASSUME_RECVFROM_SYSCALL
return SYSCALL_CANCEL (recvfrom, fd, buf, len, flags, NULL, NULL);
#else
return SOCKETCALL_CANCEL (recv, fd, buf, len, flags);
diff --git a/sysdeps/unix/sysv/linux/recvfrom.c b/sysdeps/unix/sysv/linux/recvfrom.c
index 10ffb26..27c2360 100644
--- a/sysdeps/unix/sysv/linux/recvfrom.c
+++ b/sysdeps/unix/sysv/linux/recvfrom.c
@@ -15,14 +15,9 @@
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 <kernel-features.h>
-#include <sys/syscall.h>
ssize_t
__libc_recvfrom (int fd, void *buf, size_t len, int flags,
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 50a7e8c..59bc434 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -32,8 +32,6 @@
# define __ASSUME_GETPEERNAME_SYSCALL 1
# define __ASSUME_SENDTO_SYSCALL 1
# define __ASSUME_SENDTO_FOR_SEND_SYSCALL 1
-# define __ASSUME_RECVFROM_SYSCALL 1
-# define __ASSUME_RECVFROM_FOR_RECV_SYSCALL 1
# define __ASSUME_SHUTDOWN_SYSCALL 1
#endif
@@ -48,6 +46,7 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
+# undef __ASSUME_RECVFROM_SYSCALL
#endif
/* s390 only supports ipc syscall. */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 7a83211..61bdd45 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -33,8 +33,6 @@
#define __ASSUME_SOCKETPAIR_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
#define __ASSUME_SENDTO_SYSCALL 1
-#define __ASSUME_RECV_SYSCALL 1
-#define __ASSUME_RECVFROM_SYSCALL 1
#define __ASSUME_SHUTDOWN_SYSCALL 1
#define __ASSUME_GETSOCKOPT_SYSCALL 1
#define __ASSUME_SETSOCKOPT_SYSCALL 1
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index ba6e4c4..8e74478 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -41,6 +41,7 @@
#if !defined __arch64__
# undef __ASSUME_ACCEPT_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
+# undef __ASSUME_RECVFROM_SYSCALL
#endif
/* sparc only supports ipc syscall. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index 4c785fd..bf2cfdc 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -7,8 +7,6 @@ getpeername - getpeername 3 __getpeername getpeername
getsockname - getsockname 3 __getsockname getsockname
getsockopt - getsockopt 5 __getsockopt getsockopt
listen - listen 2 __listen listen
-recv - recv C:4 __libc_recv __recv recv
-recvfrom - recvfrom C:6 __libc_recvfrom __recvfrom recvfrom
send - send C:4 __libc_send __send send
sendto - sendto C:6 __libc_sendto __sendto sendto
setsockopt - setsockopt 5 __setsockopt setsockopt
diff --git a/sysdeps/unix/sysv/linux/x86_64/recv.c b/sysdeps/unix/sysv/linux/x86_64/recv.c
deleted file mode 100644
index 10be5d5..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/recv.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (C) 2001-2017 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, see
- <http://www.gnu.org/licenses/>. */
-
-#include <errno.h>
-#include <sys/socket.h>
-#include <sysdep-cancel.h>
-
-/* Read N bytes into BUF from socket FD.
- Returns the number read or -1 for errors. */
-
-ssize_t
-__libc_recv (int fd, void *buf, size_t n, int flags)
-{
- return SYSCALL_CANCEL (recvfrom, fd, buf, n, flags, NULL, NULL);
-}
-
-weak_alias (__libc_recv, __recv)
-libc_hidden_weak (__recv)
-weak_alias (__recv, recv)
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index b832593..7ff0376 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -15,7 +15,6 @@ getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
listen - listen i:ii __listen listen
-recvfrom - recvfrom Ci:ibniBN __libc_recvfrom __recvfrom recvfrom
sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
shutdown - shutdown i:ii __shutdown shutdown
--
2.7.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/4] Consolidate Linux connect implementation
2017-01-30 14:02 [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
@ 2017-01-30 14:02 ` Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 4/4] Consolidate Linux send and sendto implementation Adhemerval Zanella
` (3 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2017-01-30 14:02 UTC (permalink / raw)
To: libc-alpha
This patch consolidates the connect Linux syscall implementation on
sysdeps/unix/sysv/linux/accept.c. The changes are:
1. Remove connect from auto-generation syscalls.list on the architecture
that uses __NR_connect.
2. Define __NR_conect as default (__ASSUME_CONNECT_SYSCALL) and undef for
architectures that do not support it.
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/alpha/syscalls.list: Remove connect from
auto-generation list.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/generic/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/hppa/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/connect.c: Simplify include list.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Define.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Undef if kernel does not support it.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_CONNECT_SYSCALL): Likewise.
---
ChangeLog | 21 +++++++++++++++++++++
sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 -
sysdeps/unix/sysv/linux/arm/syscalls.list | 1 -
sysdeps/unix/sysv/linux/connect.c | 5 -----
sysdeps/unix/sysv/linux/generic/syscalls.list | 1 -
sysdeps/unix/sysv/linux/hppa/syscalls.list | 1 -
sysdeps/unix/sysv/linux/i386/kernel-features.h | 2 +-
sysdeps/unix/sysv/linux/ia64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 2 +-
sysdeps/unix/sysv/linux/mips/syscalls.list | 1 -
sysdeps/unix/sysv/linux/s390/kernel-features.h | 2 +-
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 1 +
sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list | 1 -
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 1 -
15 files changed, 26 insertions(+), 16 deletions(-)
diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list
index 4cfe19e..e9efb43 100644
--- a/sysdeps/unix/sysv/linux/alpha/syscalls.list
+++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list
@@ -6,7 +6,6 @@ getpriority - getpriority i:ii __getpriority getpriority
# proper socket implementations:
bind - bind i:ipi __bind bind
-connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
diff --git a/sysdeps/unix/sysv/linux/arm/syscalls.list b/sysdeps/unix/sysv/linux/arm/syscalls.list
index 1c4f61f..1c12be4 100644
--- a/sysdeps/unix/sysv/linux/arm/syscalls.list
+++ b/sysdeps/unix/sysv/linux/arm/syscalls.list
@@ -23,7 +23,6 @@ personality EXTRA personality Ei:i __personality personality
# proper socket implementations:
bind - bind i:ipi __bind bind
-connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
diff --git a/sysdeps/unix/sysv/linux/connect.c b/sysdeps/unix/sysv/linux/connect.c
index 3837a5b..f6ab5df 100644
--- a/sysdeps/unix/sysv/linux/connect.c
+++ b/sysdeps/unix/sysv/linux/connect.c
@@ -15,14 +15,9 @@
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 <kernel-features.h>
-#include <sys/syscall.h>
int
__libc_connect (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len)
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index b176a72..2874a1f 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
-connect - connect Ci:ipi __libc_connect __connect connect
getsockname - getsockname i:ipp __getsockname getsockname
getpeername - getpeername i:ipp __getpeername getpeername
sendto - sendto Ci:ibnibn __libc_sendto __sendto sendto
diff --git a/sysdeps/unix/sysv/linux/hppa/syscalls.list b/sysdeps/unix/sysv/linux/hppa/syscalls.list
index ee814fb..288d096 100644
--- a/sysdeps/unix/sysv/linux/hppa/syscalls.list
+++ b/sysdeps/unix/sysv/linux/hppa/syscalls.list
@@ -2,7 +2,6 @@
# proper socket implementations:
bind - bind i:ipi __bind bind
-connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 07462f8..23ca794 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -31,7 +31,6 @@
# define __ASSUME_SOCKET_SYSCALL 1
# define __ASSUME_SOCKETPAIR_SYSCALL 1
# define __ASSUME_BIND_SYSCALL 1
-# define __ASSUME_CONNECT_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
# define __ASSUME_GETSOCKOPT_SYSCALL 1
# define __ASSUME_SETSOCKOPT_SYSCALL 1
@@ -52,6 +51,7 @@
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
+# undef __ASSUME_CONNECT_SYSCALL
#endif
/* i686 only supports ipc syscall. */
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index 96db4c3..32fdb08 100644
--- a/sysdeps/unix/sysv/linux/ia64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/ia64/syscalls.list
@@ -6,7 +6,6 @@ getpriority - getpriority i:ii __getpriority getpriority
# proper socket implementations:
bind - bind i:ipi __bind bind
-connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 78b091b..e93f5f4 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -148,6 +148,7 @@
#define __ASSUME_SENDMSG_SYSCALL 1
#define __ASSUME_RECVMSG_SYSCALL 1
#define __ASSUME_ACCEPT_SYSCALL 1
+#define __ASSUME_CONNECT_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 f583ae7..a58c168 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -25,7 +25,6 @@
# define __ASSUME_SOCKET_SYSCALL 1
# define __ASSUME_SOCKETPAIR_SYSCALL 1
# define __ASSUME_BIND_SYSCALL 1
-# define __ASSUME_CONNECT_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
# define __ASSUME_GETSOCKOPT_SYSCALL 1
# define __ASSUME_SETSOCKOPT_SYSCALL 1
@@ -49,6 +48,7 @@
# undef __ASSUME_SENDMMSG_SYSCALL
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
+# undef __ASSUME_CONNECT_SYSCALL
#endif
/* No support for PI futexes or robust mutexes before 3.10 for m68k. */
diff --git a/sysdeps/unix/sysv/linux/mips/syscalls.list b/sysdeps/unix/sysv/linux/mips/syscalls.list
index 81ea2a7..8b0c5a3 100644
--- a/sysdeps/unix/sysv/linux/mips/syscalls.list
+++ b/sysdeps/unix/sysv/linux/mips/syscalls.list
@@ -13,7 +13,6 @@ sysmips - sysmips i:iiii __sysmips sysmips
# it's provided for compatibility, though.
#
bind - bind i:ipi __bind bind
-connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index ccfb0a2..50a7e8c 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -25,7 +25,6 @@
# define __ASSUME_SOCKET_SYSCALL 1
# define __ASSUME_SOCKETPAIR_SYSCALL 1
# define __ASSUME_BIND_SYSCALL 1
-# define __ASSUME_CONNECT_SYSCALL 1
# define __ASSUME_LISTEN_SYSCALL 1
# define __ASSUME_GETSOCKOPT_SYSCALL 1
# define __ASSUME_SETSOCKOPT_SYSCALL 1
@@ -48,6 +47,7 @@
# undef __ASSUME_SENDMMSG_SYSCALL
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
+# undef __ASSUME_CONNECT_SYSCALL
#endif
/* s390 only supports ipc syscall. */
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 3ffa96e..ba6e4c4 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -40,6 +40,7 @@
#if !defined __arch64__
# undef __ASSUME_ACCEPT_SYSCALL
+# undef __ASSUME_CONNECT_SYSCALL
#endif
/* sparc only supports ipc syscall. */
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
index 27ca5fa..4c785fd 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list
@@ -3,7 +3,6 @@
# Override select.S in parent directory:
select - select C:5 __select select
bind - bind 3 __bind bind
-connect - connect C:3 __libc_connect __connect connect
getpeername - getpeername 3 __getpeername getpeername
getsockname - getsockname 3 __getsockname getsockname
getsockopt - getsockopt 5 __getsockopt getsockopt
diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalls.list b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
index fe7d156..b832593 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -11,7 +11,6 @@ syscall_clock_gettime EXTRA clock_gettime Ei:ip __syscall_clock_gettime
# proper socket implementations:
bind - bind i:ipi __bind bind
-connect - connect Ci:ipi __libc_connect __connect connect
getpeername - getpeername i:ipp __getpeername getpeername
getsockname - getsockname i:ipp __getsockname getsockname
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
--
2.7.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 0/4] Consolidation patches for bz12683
@ 2017-01-30 14:02 Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 2/4] Consolidate Linux connect implementation Adhemerval Zanella
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2017-01-30 14:02 UTC (permalink / raw)
To: libc-alpha
Hi all,
This patchset is the initial one I am proposing for upcoming BZ#12683
(Race conditions in pthread cancellation) [1]. General idea is to remove
all the auto-generation cancellation syscall from syscalls.list for
all architectures to simplifiy bz12683 fix.
These patches consolidates the accept, connect, recv, recvfrom, send,
and sendto Linux implementation on default ones. I have tested
a full build/run on x86_64, i686, x32, powerpc64le, aarch64, and
armhf and a build/check for all other supported architectures
(with run-built-tests=no). Besides the already broken hppa
build (due the new pthread condition) I saw no regressions.
[1] https://sourceware.org/bugzilla/show_bug.cgi?id=12683
Adhemerval Zanella (4):
Consolidate Linux accept implementation
Consolidate Linux connect implementation
Consolidate Linux recv and recvfrom implementation
Consolidate Linux send and sendto implementation
ChangeLog | 158 +++++++++++++++++++++
sysdeps/unix/sysv/linux/aarch64/sysdep.h | 4 +
sysdeps/unix/sysv/linux/accept.c | 7 +-
sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/alpha/syscalls.list | 6 -
sysdeps/unix/sysv/linux/arm/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/arm/syscalls.list | 6 -
sysdeps/unix/sysv/linux/connect.c | 5 -
sysdeps/unix/sysv/linux/generic/recv.c | 32 -----
sysdeps/unix/sysv/linux/generic/send.c | 30 ----
sysdeps/unix/sysv/linux/generic/syscalls.list | 4 -
sysdeps/unix/sysv/linux/hppa/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/hppa/syscalls.list | 6 -
sysdeps/unix/sysv/linux/i386/kernel-features.h | 11 +-
sysdeps/unix/sysv/linux/ia64/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/ia64/syscalls.list | 6 -
sysdeps/unix/sysv/linux/kernel-features.h | 4 +
sysdeps/unix/sysv/linux/m68k/kernel-features.h | 12 +-
.../unix/sysv/linux/microblaze/kernel-features.h | 4 +-
sysdeps/unix/sysv/linux/mips/kernel-features.h | 3 +
sysdeps/unix/sysv/linux/mips/mips64/recv.c | 1 -
sysdeps/unix/sysv/linux/mips/mips64/send.c | 1 -
sysdeps/unix/sysv/linux/mips/syscalls.list | 6 -
sysdeps/unix/sysv/linux/nios2/sysdep.h | 4 +
sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 2 -
sysdeps/unix/sysv/linux/recv.c | 7 +-
sysdeps/unix/sysv/linux/recvfrom.c | 5 -
sysdeps/unix/sysv/linux/s390/kernel-features.h | 11 +-
sysdeps/unix/sysv/linux/send.c | 9 +-
sysdeps/unix/sysv/linux/sendto.c | 5 -
sysdeps/unix/sysv/linux/sh/kernel-features.h | 4 -
sysdeps/unix/sysv/linux/sparc/kernel-features.h | 6 +
.../unix/sysv/linux/sparc/sparc64/syscalls.list | 6 -
sysdeps/unix/sysv/linux/sysdep.h | 4 +
sysdeps/unix/sysv/linux/tile/sysdep.h | 4 +
sysdeps/unix/sysv/linux/x86_64/recv.c | 33 -----
sysdeps/unix/sysv/linux/x86_64/send.c | 31 ----
sysdeps/unix/sysv/linux/x86_64/syscalls.list | 4 -
38 files changed, 221 insertions(+), 232 deletions(-)
delete mode 100644 sysdeps/unix/sysv/linux/generic/recv.c
delete mode 100644 sysdeps/unix/sysv/linux/generic/send.c
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/recv.c
delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/send.c
delete mode 100644 sysdeps/unix/sysv/linux/x86_64/recv.c
delete mode 100644 sysdeps/unix/sysv/linux/x86_64/send.c
--
2.7.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] Consolidate Linux accept implementation
2017-01-30 14:02 ` [PATCH 1/4] Consolidate Linux accept implementation Adhemerval Zanella
@ 2017-02-08 20:59 ` Phil Blundell
2017-02-08 23:26 ` Adhemerval Zanella
0 siblings, 1 reply; 13+ messages in thread
From: Phil Blundell @ 2017-02-08 20:59 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Mon, 2017-01-30 at 12:02 -0200, Adhemerval Zanella wrote:
>
> Â 2. Define __NR_acccept as default (__ASSUME_ACCEPT_SYSCALL) and
> undef for
Too many "c"s in accept?
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 6811a28..f583ae7 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,7 +40,10 @@
> Â
> Â #include_next <kernel-features.h>
> Â
> +#undef __ASSUME_ACCEPT_SYSCALL
> +
> Â #if __LINUX_KERNEL_VERSION < 0x040300
> +# undef __ASSUME_ACCCEPT_SYSCALL
This is a bit odd. Â __ASSUME_ACCCEPT_SYSCALL never seems to be defined
anywhere that I can find, but you are explicitly undefining it for
these old kernels. Â I would have assumed it was a typo for
__ASSUME_ACCEPT_SYSCALL if you weren't also undefining that one a
couple of lines further up. Â Can you clarify?
p.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] Consolidate Linux accept implementation
2017-02-08 20:59 ` Phil Blundell
@ 2017-02-08 23:26 ` Adhemerval Zanella
2017-02-09 19:14 ` Phil Blundell
0 siblings, 1 reply; 13+ messages in thread
From: Adhemerval Zanella @ 2017-02-08 23:26 UTC (permalink / raw)
To: Phil Blundell, libc-alpha
Thanks for the review.
On 08/02/2017 18:59, Phil Blundell wrote:
> On Mon, 2017-01-30 at 12:02 -0200, Adhemerval Zanella wrote:
>>
>> 2. Define __NR_acccept as default (__ASSUME_ACCEPT_SYSCALL) and
>> undef for
>
> Too many "c"s in accept?
Ops, fixed on commit message localy.
>
>> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> index 6811a28..f583ae7 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,7 +40,10 @@
>>
>> #include_next <kernel-features.h>
>>
>> +#undef __ASSUME_ACCEPT_SYSCALL
>> +
>> #if __LINUX_KERNEL_VERSION < 0x040300
>> +# undef __ASSUME_ACCCEPT_SYSCALL
>
> This is a bit odd. __ASSUME_ACCCEPT_SYSCALL never seems to be defined
> anywhere that I can find, but you are explicitly undefining it for
> these old kernels. I would have assumed it was a typo for
> __ASSUME_ACCEPT_SYSCALL if you weren't also undefining that one a
> couple of lines further up. Can you clarify?
>
> p.
With this patch it is now defined as based on:
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 08485cd..78b091b 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. */
And this snippet is indeed wrong as you pointed out, m68k (and any other
architecture) just need to undef is for kernel < 4.3 as:
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 6811a28..0f31f86 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
@@ -42,6 +41,7 @@
#include_next <kernel-features.h>
#if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_ACCCEPT_SYSCALL
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_RECVMMSG_SYSCALL
# undef __ASSUME_SENDMMSG_SYSCALL
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] Consolidate Linux accept implementation
2017-02-08 23:26 ` Adhemerval Zanella
@ 2017-02-09 19:14 ` Phil Blundell
2017-02-09 19:20 ` Adhemerval Zanella
0 siblings, 1 reply; 13+ messages in thread
From: Phil Blundell @ 2017-02-09 19:14 UTC (permalink / raw)
To: Adhemerval Zanella, libc-alpha
On Wed, 2017-02-08 at 21:26 -0200, Adhemerval Zanella wrote:
>
> And this snippet is indeed wrong as you pointed out, m68k (and any
> other
> architecture) just need to undef is for kernel < 4.3 as:
>
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 6811a28..0f31f86 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
> @@ -42,6 +41,7 @@
> Â #include_next <kernel-features.h>
>
> Â #if __LINUX_KERNEL_VERSION < 0x040300
> +# undef __ASSUME_ACCCEPT_SYSCALL
> Â # undef __ASSUME_ACCEPT4_SYSCALL
> Â # undef __ASSUME_RECVMMSG_SYSCALL
> Â # undef __ASSUME_SENDMMSG_SYSCALL
Thanks, that makes sense. Â I think you've still got too many "C"s in
"ACCEPT" in that last hunk above though.
p.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] Consolidate Linux accept implementation
2017-02-09 19:14 ` Phil Blundell
@ 2017-02-09 19:20 ` Adhemerval Zanella
0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2017-02-09 19:20 UTC (permalink / raw)
To: Phil Blundell, libc-alpha
On 09/02/2017 17:14, Phil Blundell wrote:
> On Wed, 2017-02-08 at 21:26 -0200, Adhemerval Zanella wrote:
>>
>> And this snippet is indeed wrong as you pointed out, m68k (and any
>> other
>> architecture) just need to undef is for kernel < 4.3 as:
>>
>> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
>> index 6811a28..0f31f86 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
>> @@ -42,6 +41,7 @@
>> #include_next <kernel-features.h>
>>
>> #if __LINUX_KERNEL_VERSION < 0x040300
>> +# undef __ASSUME_ACCCEPT_SYSCALL
>> # undef __ASSUME_ACCEPT4_SYSCALL
>> # undef __ASSUME_RECVMMSG_SYSCALL
>> # undef __ASSUME_SENDMMSG_SYSCALL
>
> Thanks, that makes sense. I think you've still got too many "C"s in
> "ACCEPT" in that last hunk above though.
Indeed, below it is an updated patch with m68k fix with also the same one
for i386.
--
diff --git a/sysdeps/unix/sysv/linux/accept.c b/sysdeps/unix/sysv/linux/accept.c
index c5935ab..2fb59b7 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 4001020..4cfe19e 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 0263eee..1c4f61f 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 3bb5473..b176a72 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 6d47b11..ee814fb 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 2696d1a..6f18b80 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
@@ -48,6 +47,7 @@
#include_next <kernel-features.h>
#if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_ACCEPT_SYSCALL
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/ia64/syscalls.list b/sysdeps/unix/sysv/linux/ia64/syscalls.list
index dd07db3..96db4c3 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 08485cd..78b091b 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 6811a28..6f41dc8 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
@@ -42,6 +41,7 @@
#include_next <kernel-features.h>
#if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_ACCEPT_SYSCALL
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_RECVMMSG_SYSCALL
# undef __ASSUME_SENDMMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index f68e8c5..9532d57 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 cd946a0..81ea2a7 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 02dadc8..272800c 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 4e04d26..4f19efc 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
@@ -42,6 +41,7 @@
#include_next <kernel-features.h>
#if __LINUX_KERNEL_VERSION < 0x040300
+# undef __ASSUME_ACCEPT_SYSCALL
# undef __ASSUME_ACCEPT4_SYSCALL
# undef __ASSUME_RECVMMSG_SYSCALL
# undef __ASSUME_SENDMMSG_SYSCALL
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 10a669f..7a83211 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 f78ae85..3ffa96e 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 eecd837..27ca5fa 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 51a9177..b059f80 100644
--- a/sysdeps/unix/sysv/linux/x86_64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/x86_64/syscalls.list
@@ -6,7 +6,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
--
2.7.4
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] Consolidation patches for bz12683
2017-01-30 14:02 [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
` (3 preceding siblings ...)
2017-01-30 14:02 ` [PATCH 1/4] Consolidate Linux accept implementation Adhemerval Zanella
@ 2017-02-20 14:19 ` Adhemerval Zanella
2017-03-06 9:52 ` Adhemerval Zanella
4 siblings, 1 reply; 13+ messages in thread
From: Adhemerval Zanella @ 2017-02-20 14:19 UTC (permalink / raw)
To: libc-alpha
Ping.
On 30/01/2017 12:02, Adhemerval Zanella wrote:
> Hi all,
>
> This patchset is the initial one I am proposing for upcoming BZ#12683
> (Race conditions in pthread cancellation) [1]. General idea is to remove
> all the auto-generation cancellation syscall from syscalls.list for
> all architectures to simplifiy bz12683 fix.
>
> These patches consolidates the accept, connect, recv, recvfrom, send,
> and sendto Linux implementation on default ones. I have tested
> a full build/run on x86_64, i686, x32, powerpc64le, aarch64, and
> armhf and a build/check for all other supported architectures
> (with run-built-tests=no). Besides the already broken hppa
> build (due the new pthread condition) I saw no regressions.
>
> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=12683
>
> Adhemerval Zanella (4):
> Consolidate Linux accept implementation
> Consolidate Linux connect implementation
> Consolidate Linux recv and recvfrom implementation
> Consolidate Linux send and sendto implementation
>
> ChangeLog | 158 +++++++++++++++++++++
> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 4 +
> sysdeps/unix/sysv/linux/accept.c | 7 +-
> sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/alpha/syscalls.list | 6 -
> sysdeps/unix/sysv/linux/arm/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/arm/syscalls.list | 6 -
> sysdeps/unix/sysv/linux/connect.c | 5 -
> sysdeps/unix/sysv/linux/generic/recv.c | 32 -----
> sysdeps/unix/sysv/linux/generic/send.c | 30 ----
> sysdeps/unix/sysv/linux/generic/syscalls.list | 4 -
> sysdeps/unix/sysv/linux/hppa/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/hppa/syscalls.list | 6 -
> sysdeps/unix/sysv/linux/i386/kernel-features.h | 11 +-
> sysdeps/unix/sysv/linux/ia64/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/ia64/syscalls.list | 6 -
> sysdeps/unix/sysv/linux/kernel-features.h | 4 +
> sysdeps/unix/sysv/linux/m68k/kernel-features.h | 12 +-
> .../unix/sysv/linux/microblaze/kernel-features.h | 4 +-
> sysdeps/unix/sysv/linux/mips/kernel-features.h | 3 +
> sysdeps/unix/sysv/linux/mips/mips64/recv.c | 1 -
> sysdeps/unix/sysv/linux/mips/mips64/send.c | 1 -
> sysdeps/unix/sysv/linux/mips/syscalls.list | 6 -
> sysdeps/unix/sysv/linux/nios2/sysdep.h | 4 +
> sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 2 -
> sysdeps/unix/sysv/linux/recv.c | 7 +-
> sysdeps/unix/sysv/linux/recvfrom.c | 5 -
> sysdeps/unix/sysv/linux/s390/kernel-features.h | 11 +-
> sysdeps/unix/sysv/linux/send.c | 9 +-
> sysdeps/unix/sysv/linux/sendto.c | 5 -
> sysdeps/unix/sysv/linux/sh/kernel-features.h | 4 -
> sysdeps/unix/sysv/linux/sparc/kernel-features.h | 6 +
> .../unix/sysv/linux/sparc/sparc64/syscalls.list | 6 -
> sysdeps/unix/sysv/linux/sysdep.h | 4 +
> sysdeps/unix/sysv/linux/tile/sysdep.h | 4 +
> sysdeps/unix/sysv/linux/x86_64/recv.c | 33 -----
> sysdeps/unix/sysv/linux/x86_64/send.c | 31 ----
> sysdeps/unix/sysv/linux/x86_64/syscalls.list | 4 -
> 38 files changed, 221 insertions(+), 232 deletions(-)
> delete mode 100644 sysdeps/unix/sysv/linux/generic/recv.c
> delete mode 100644 sysdeps/unix/sysv/linux/generic/send.c
> delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/recv.c
> delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/send.c
> delete mode 100644 sysdeps/unix/sysv/linux/x86_64/recv.c
> delete mode 100644 sysdeps/unix/sysv/linux/x86_64/send.c
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] Consolidation patches for bz12683
2017-02-20 14:19 ` [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
@ 2017-03-06 9:52 ` Adhemerval Zanella
0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2017-03-06 9:52 UTC (permalink / raw)
To: libc-alpha
If no one opposes it I would like to check this in. I will check run
a full make check on alpha, sparc{v9,64}, and powerpc first.
On 20/02/2017 15:18, Adhemerval Zanella wrote:
> Ping.
>
> On 30/01/2017 12:02, Adhemerval Zanella wrote:
>> Hi all,
>>
>> This patchset is the initial one I am proposing for upcoming BZ#12683
>> (Race conditions in pthread cancellation) [1]. General idea is to remove
>> all the auto-generation cancellation syscall from syscalls.list for
>> all architectures to simplifiy bz12683 fix.
>>
>> These patches consolidates the accept, connect, recv, recvfrom, send,
>> and sendto Linux implementation on default ones. I have tested
>> a full build/run on x86_64, i686, x32, powerpc64le, aarch64, and
>> armhf and a build/check for all other supported architectures
>> (with run-built-tests=no). Besides the already broken hppa
>> build (due the new pthread condition) I saw no regressions.
>>
>> [1] https://sourceware.org/bugzilla/show_bug.cgi?id=12683
>>
>> Adhemerval Zanella (4):
>> Consolidate Linux accept implementation
>> Consolidate Linux connect implementation
>> Consolidate Linux recv and recvfrom implementation
>> Consolidate Linux send and sendto implementation
>>
>> ChangeLog | 158 +++++++++++++++++++++
>> sysdeps/unix/sysv/linux/aarch64/sysdep.h | 4 +
>> sysdeps/unix/sysv/linux/accept.c | 7 +-
>> sysdeps/unix/sysv/linux/alpha/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/alpha/syscalls.list | 6 -
>> sysdeps/unix/sysv/linux/arm/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/arm/syscalls.list | 6 -
>> sysdeps/unix/sysv/linux/connect.c | 5 -
>> sysdeps/unix/sysv/linux/generic/recv.c | 32 -----
>> sysdeps/unix/sysv/linux/generic/send.c | 30 ----
>> sysdeps/unix/sysv/linux/generic/syscalls.list | 4 -
>> sysdeps/unix/sysv/linux/hppa/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/hppa/syscalls.list | 6 -
>> sysdeps/unix/sysv/linux/i386/kernel-features.h | 11 +-
>> sysdeps/unix/sysv/linux/ia64/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/ia64/syscalls.list | 6 -
>> sysdeps/unix/sysv/linux/kernel-features.h | 4 +
>> sysdeps/unix/sysv/linux/m68k/kernel-features.h | 12 +-
>> .../unix/sysv/linux/microblaze/kernel-features.h | 4 +-
>> sysdeps/unix/sysv/linux/mips/kernel-features.h | 3 +
>> sysdeps/unix/sysv/linux/mips/mips64/recv.c | 1 -
>> sysdeps/unix/sysv/linux/mips/mips64/send.c | 1 -
>> sysdeps/unix/sysv/linux/mips/syscalls.list | 6 -
>> sysdeps/unix/sysv/linux/nios2/sysdep.h | 4 +
>> sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 2 -
>> sysdeps/unix/sysv/linux/recv.c | 7 +-
>> sysdeps/unix/sysv/linux/recvfrom.c | 5 -
>> sysdeps/unix/sysv/linux/s390/kernel-features.h | 11 +-
>> sysdeps/unix/sysv/linux/send.c | 9 +-
>> sysdeps/unix/sysv/linux/sendto.c | 5 -
>> sysdeps/unix/sysv/linux/sh/kernel-features.h | 4 -
>> sysdeps/unix/sysv/linux/sparc/kernel-features.h | 6 +
>> .../unix/sysv/linux/sparc/sparc64/syscalls.list | 6 -
>> sysdeps/unix/sysv/linux/sysdep.h | 4 +
>> sysdeps/unix/sysv/linux/tile/sysdep.h | 4 +
>> sysdeps/unix/sysv/linux/x86_64/recv.c | 33 -----
>> sysdeps/unix/sysv/linux/x86_64/send.c | 31 ----
>> sysdeps/unix/sysv/linux/x86_64/syscalls.list | 4 -
>> 38 files changed, 221 insertions(+), 232 deletions(-)
>> delete mode 100644 sysdeps/unix/sysv/linux/generic/recv.c
>> delete mode 100644 sysdeps/unix/sysv/linux/generic/send.c
>> delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/recv.c
>> delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/send.c
>> delete mode 100644 sysdeps/unix/sysv/linux/x86_64/recv.c
>> delete mode 100644 sysdeps/unix/sysv/linux/x86_64/send.c
>>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] Consolidate Linux recv and recvfrom implementation
2017-01-30 14:02 ` [PATCH 3/4] Consolidate Linux recv and recvfrom implementation Adhemerval Zanella
@ 2017-03-06 10:48 ` Dmitry V. Levin
2017-03-06 11:07 ` Adhemerval Zanella
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry V. Levin @ 2017-03-06 10:48 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 2436 bytes --]
On Mon, Jan 30, 2017 at 12:02:05PM -0200, Adhemerval Zanella wrote:
> This patch consolidates the recv Linux syscall implementation on
> sysdeps/unix/sysv/linux/recv.c. The changes are:
>
> 1. Remove recv and recvfrom from auto-generation syscalls.list on the
> architecture that uses __NR_recv.
Please split this for correctness, e.g.
# Remove recvfrom from auto-generation syscalls.list on all Linux
architectures.
# Remove recv from auto-generation syscalls.list on architectures that
use __NR_recv.
> 2. Define __NR_recv for such architectures.
You surely don't define __NR_* for any architecture, do you?
> It was done instead of
> defining in default kernel-features.h because current Linux practice
> for new ports are to implement only __NR_recvfrom [1] and it will
> require adding new kernel-features for ports that do not require it
> (aarch64 for instance).
> 3. Define __NR_recvfrom as default (__ASSUME_RECVFROM_SYSCALL) and undef
> for architectures that do not support it.
This is also misleading, you probably mean
# Define __ASSUME_RECVFROM_SYSCALL by default, undef it for
architectures that do not support __NR_recvfrom.
> 4. Remove __ASSUME_RECVFROM_FOR_RECV_SYSCALL and decide to use
> __NR_recvfrom for recv generation based on __ASSUME_RECVFROM__SYSCALL.
Too many underscores in "__ASSUME_RECVFROM__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/alpha/kernel-features.h
> (__ASSUME_RECV_SYSCALL): Define.
> * sysdeps/unix/sysv/linux/arm/kernel-features.h
> (__ASSUME_RECV_SYSCALL): Likewise.
> * sysdeps/unix/sysv/linux/hppa/kernel-features.h
> (__ASSUME_RECV_SYSCALL): Likewise.
> * sysdeps/unix/sysv/linux/ia64/kernel-features.h
> (__ASSUME_RECV_SYSCALL): Likewise.
> * sysdeps/unix/sysv/linux/mips/kernel-features.h
> [_MIPS_SIM == _ABIO32] (__ASSUME_RECV_SYSCALL): Likewise.
> * sysdeps/unix/sysv/linux/i386/kernel-features.h
> (__ASSUME_RECVFROM_SYSCALL): Define whether the kernel supports it.
This is misleading: the change undefs __ASSUME_RECVFROM_SYSCALL when
the kernel does not support __NR_recvfrom.
> (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Undefine.
The removal of #define is not undefine, it's remove.
--
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] Consolidate Linux recv and recvfrom implementation
2017-03-06 10:48 ` Dmitry V. Levin
@ 2017-03-06 11:07 ` Adhemerval Zanella
0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2017-03-06 11:07 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1.1: Type: text/plain, Size: 2930 bytes --]
On 06/03/2017 11:48, Dmitry V. Levin wrote:
> On Mon, Jan 30, 2017 at 12:02:05PM -0200, Adhemerval Zanella wrote:
>> This patch consolidates the recv Linux syscall implementation on
>> sysdeps/unix/sysv/linux/recv.c. The changes are:
>>
>> 1. Remove recv and recvfrom from auto-generation syscalls.list on the
>> architecture that uses __NR_recv.
>
> Please split this for correctness, e.g.
>
> # Remove recvfrom from auto-generation syscalls.list on all Linux
> architectures.
> # Remove recv from auto-generation syscalls.list on architectures that
> use __NR_recv.
On my first local iteration I had it split, but then I rebase them
together because I though since recv maybe call recvfrom syscall
they should be related. I do not have a strong opinion here, so
I will split in next version.
>
>> 2. Define __NR_recv for such architectures.
>
> You surely don't define __NR_* for any architecture, do you?
Yes, this description is off. I will correct in next version.
>
>> It was done instead of
>> defining in default kernel-features.h because current Linux practice
>> for new ports are to implement only __NR_recvfrom [1] and it will
>> require adding new kernel-features for ports that do not require it
>> (aarch64 for instance).
>> 3. Define __NR_recvfrom as default (__ASSUME_RECVFROM_SYSCALL) and undef
>> for architectures that do not support it.
>
> This is also misleading, you probably mean
>
> # Define __ASSUME_RECVFROM_SYSCALL by default, undef it for
> architectures that do not support __NR_recvfrom.
Yes, I will correct it.
>
>> 4. Remove __ASSUME_RECVFROM_FOR_RECV_SYSCALL and decide to use
>> __NR_recvfrom for recv generation based on __ASSUME_RECVFROM__SYSCALL.
>
> Too many underscores in "__ASSUME_RECVFROM__SYSCALL".
Ack.
>
>> 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/alpha/kernel-features.h
>> (__ASSUME_RECV_SYSCALL): Define.
>> * sysdeps/unix/sysv/linux/arm/kernel-features.h
>> (__ASSUME_RECV_SYSCALL): Likewise.
>> * sysdeps/unix/sysv/linux/hppa/kernel-features.h
>> (__ASSUME_RECV_SYSCALL): Likewise.
>> * sysdeps/unix/sysv/linux/ia64/kernel-features.h
>> (__ASSUME_RECV_SYSCALL): Likewise.
>> * sysdeps/unix/sysv/linux/mips/kernel-features.h
>> [_MIPS_SIM == _ABIO32] (__ASSUME_RECV_SYSCALL): Likewise.
>> * sysdeps/unix/sysv/linux/i386/kernel-features.h
>> (__ASSUME_RECVFROM_SYSCALL): Define whether the kernel supports it.
>
> This is misleading: the change undefs __ASSUME_RECVFROM_SYSCALL when
> the kernel does not support __NR_recvfrom.
I will fix it.
>
>> (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Undefine.
>
> The removal of #define is not undefine, it's remove.
Ack.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-03-06 11:07 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-30 14:02 [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 2/4] Consolidate Linux connect implementation Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 4/4] Consolidate Linux send and sendto implementation Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 3/4] Consolidate Linux recv and recvfrom implementation Adhemerval Zanella
2017-03-06 10:48 ` Dmitry V. Levin
2017-03-06 11:07 ` Adhemerval Zanella
2017-01-30 14:02 ` [PATCH 1/4] Consolidate Linux accept implementation Adhemerval Zanella
2017-02-08 20:59 ` Phil Blundell
2017-02-08 23:26 ` Adhemerval Zanella
2017-02-09 19:14 ` Phil Blundell
2017-02-09 19:20 ` Adhemerval Zanella
2017-02-20 14:19 ` [PATCH 0/4] Consolidation patches for bz12683 Adhemerval Zanella
2017-03-06 9:52 ` Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).