diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2016-11-17 18:47:00 -0200 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.com> | 2017-03-09 15:22:06 +0100 |
commit | df799d9eb335921f53aab8834219ef77fe280bc8 (patch) | |
tree | 349a6009a86dfe3ccda1496a4039cb3562616010 /sysdeps/unix/sysv/linux/recv.c | |
parent | 1f8161a801b2292a58f3036ea92aa7feeafc10f2 (diff) | |
download | glibc-df799d9eb335921f53aab8834219ef77fe280bc8.tar.gz glibc-df799d9eb335921f53aab8834219ef77fe280bc8.tar.xz glibc-df799d9eb335921f53aab8834219ef77fe280bc8.zip |
Consolidate Linux recv implementation
This patch consolidates the recv Linux syscall implementation on sysdeps/unix/sysv/linux/recv.c. The changes are: 1. Remove recv from auto-generation syscalls.list on the architecture that uses __NR_recv. 2. Define __NR_recv for architectures that supports it. It was done instead of defining in default kernel-features.h because current Linux practice for new ports is 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. 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/syscalls.list: Remove recv from auto-generation list. * sysdeps/unix/sysv/linux/arm/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/alpha/kernel-features.h (__ASSUME_RECV_SYSCALL): New 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 (__ASSUME_RECV_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define. * sysdeps/unix/sysv/linux/m68k/kernel-features.h (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define. * sysdeps/unix/sysv/linux/generic/recv.c: Remove file. * sysdeps/unix/sysv/linux/mips/mips64/recv.c: Likewise. * sysdeps/unix/sysv/linux/x86_64/recv.c: Likewise. * sysdeps/unix/sysv/linux/recv.c: Simplify includes. (__libc_recv): Use __ASSUME_RECVFROM_SYSCALL instead of __ASSUME_RECVFROM_FOR_RECV_SYSCALL to issue recvfrom syscall. [1] include/asm-generic/unistd.h (__ARCH_WANT_SYSCALL_DEPRECATED)
Diffstat (limited to 'sysdeps/unix/sysv/linux/recv.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/recv.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/sysdeps/unix/sysv/linux/recv.c b/sysdeps/unix/sysv/linux/recv.c index 6d62cf89d2..2467d9955d 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); |