Consolidate Linux recvfrom implementation

This patch consolidates the recvfrom Linux syscall implementation on
sysdeps/unix/sysv/linux/recvfrom.c.  The changes are:

  1. Define __ASSUME_RECVFROM_SYSCALL by default
  2. Undef it for  architectures that do not support __NR_recvfrom.

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 recvfrom 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/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Define by default.
	(__ASSUME_RECVFROM_SYSCALL): Undef it if kernel does not support
	__NR_recvfrom.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Remove definition.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_RECVFROM_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/recvfrom.c: Simplify includes.
This commit is contained in:
Adhemerval Zanella 2017-03-06 12:53:14 +01:00
parent 3e9ff426cb
commit 1f8161a801
18 changed files with 33 additions and 19 deletions

View File

@ -1,5 +1,33 @@
2016-03-08 Adhemerval Zanella <adhemerval.zanella@linaro.org>
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recvfrom 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/sparc/sparc64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
* sysdeps/unix/sysv/linux/i386/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Define by default.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Undef it if kernel does not support
__NR_recvfrom.
* sysdeps/unix/sysv/linux/m68k/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/s390/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Remove definition.
* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sh/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/sparc/kernel-features.h
(__ASSUME_RECVFROM_SYSCALL): Likewise.
* sysdeps/unix/sysv/linux/recvfrom.c: Simplify includes.
* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove connect from
auto-generation list.
* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.

View File

@ -11,7 +11,6 @@ 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

View File

@ -28,7 +28,6 @@ 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

View File

@ -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

View File

@ -7,7 +7,6 @@ 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

View File

@ -38,7 +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 +51,7 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
#endif
/* i686 only supports ipc syscall. */

View File

@ -11,7 +11,6 @@ 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

View File

@ -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. */

View File

@ -32,7 +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 +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. */

View File

@ -30,7 +30,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

View File

@ -18,7 +18,6 @@ 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

View File

@ -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

View File

@ -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,

View File

@ -32,7 +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 +47,7 @@
# undef __ASSUME_SENDMSG_SYSCALL
# undef __ASSUME_RECVMSG_SYSCALL
# undef __ASSUME_CONNECT_SYSCALL
# undef __ASSUME_RECVFROM_SYSCALL
#endif
/* s390 only supports ipc syscall. */

View File

@ -34,7 +34,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

View File

@ -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. */

View File

@ -8,7 +8,6 @@ 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

View File

@ -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