diff options
| author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-05-22 08:36:08 -0300 |
|---|---|---|
| committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2015-05-22 17:38:06 -0300 |
| commit | 60dce8b9044155bb04eb310fb0fc5e9607b7d2e6 (patch) | |
| tree | ec738d9f4b5f573b77f9af4eca3d2cf4c6cdca44 | |
| parent | dc6b5aed1b406a53c4512d355376b4e12c7da971 (diff) | |
| download | glibc-60dce8b9044155bb04eb310fb0fc5e9607b7d2e6.tar.xz glibc-60dce8b9044155bb04eb310fb0fc5e9607b7d2e6.zip | |
Remove socket.S implementation
This patch removes the socket.S implementation for all ports and replace
it by a C implementation using socketcall. For ports that implement
the syscall directly, there is no change.
The patch idea is to simplify the socket function implementation that
uses the socketcall to be based on C implemetation instead of a pseudo
assembly implementation with arch specific parts. The patch then remove
the assembly implementatation for the ports which uses socketcall
(i386, microblaze, mips, powerpc, sparc, m68k, s390 and sh).
I have cross-build GLIBC for afore-mentioned ports and tested on both
i386 and ppc32 without regressions.
63 files changed, 702 insertions, 1718 deletions
@@ -1,3 +1,90 @@ +2015-05-22 Adhemerval Zanella <adhemerval.zanella@linaro.org> + + * nptl/Makefile (CFLAGS-accept.c): Add -fexceptions and + -fasynchronous-unwind-tables. + (CFLAGS-sendto.c): Likewise. + (CFLAGS-sendmsg.c): Likewise. + (CFLAGS-connect.c): Likewise. + (CFLAGS-recvmsg.c): Likewise. + (CFLAGS-recvfrom.c): Likewise. + * sysdeps/unix/sysv/linux/socketcall.h (SOCKOP_invalid): Define. + (SOCKETCALL): New macro: non-cancellable socketcall. + (SOCKETCALL_CANCEL): New macro: cancellable socketcall. + * sysdeps/unix/sysv/linux/Makefile [$(subdir) = socket]: Remove + internal_accept4, internal_recvmmsg, and internal_sendmmsg rules. + * sysdeps/unix/sysv/linux/accept.c: New file. + * sysdeps/unix/sysv/linux/bind.c: Likewise. + * sysdeps/unix/sysv/linux/connect.c: Likewise. + * sysdeps/unix/sysv/linux/getpeername.c: Likewise. + * sysdeps/unix/sysv/linux/getsockname.c: Likewise. + * sysdeps/unix/sysv/linux/getsockopt.c: Likewise. + * sysdeps/unix/sysv/linux/listen.c: Likewise. + * sysdeps/unix/sysv/linux/recv.c: Likewise. + * sysdeps/unix/sysv/linux/recvfrom.c: Likewise. + * sysdeps/unix/sysv/linux/recvmsg.c: Likewise. + * sysdeps/unix/sysv/linux/send.c: Likewise. + * sysdeps/unix/sysv/linux/sendmsg.c: Likewise. + * sysdeps/unix/sysv/linux/sendto.c: Likewise. + * sysdeps/unix/sysv/linux/setsockopt.c: Likewise. + * sysdeps/unix/sysv/linux/shutdown.c: Likewise. + * sysdeps/unix/sysv/linux/socket.c: Likewise. + * sysdeps/unix/sysv/linux/socketpair.c: Likewise. + * sysdeps/unix/sysv/linux/recvmmsg.c (__internal_recvmmsg): Remove + prototype. + (recvmmsg) [__ASSUME_RECVMMSG_SOCKETCALL]: Add C based implementation. + (recvmmsg) [!__ASSUME_RECVMMSG_SOCKETCALL]: Use SOCKETCALL_CANCEL macro + instead of __internal_xxx function. + * sysdeps/unix/sysv/linux/accept4.c (__internal_accept4): Remove + prototype. + (accept4) [__ASSUME_ACCEPT4_SOCKETCALL]: Add C based implementation. + (accept4) [!__ASSUME_ACCEPT4_SOCKETCALL]: Use SOCKETCALL_CANCEL macro + instead of __internal_xxx function. + * sysdeps/unix/sysv/linux/sendmmsg.c (__internal_sendmmsg): Remove + prototype. + (sendmmsg) [__ASSUME_SENDMMSG_SOCKETCALL]: Add C based implementation. + (sendmmsg) [!__ASSUME_SENDMMSG_SOCKETCALL]: Use SOCKETCALL_CANCEL macro + instead of __internal_xxx function. + * sysdeps/unix/sysv/linux/accept.S: Remove file. + * sysdeps/unix/sysv/linux/bind.S: Likewise. + * sysdeps/unix/sysv/linux/connect.S: Likewise. + * sysdeps/unix/sysv/linux/getpeername.S: Likewise. + * sysdeps/unix/sysv/linux/getsockname.S: Likewise. + * sysdeps/unix/sysv/linux/getsockopt.S: Likewise. + * sysdeps/unix/sysv/linux/arm/internal_accept4.S: Likewise. + * sysdeps/unix/sysv/linux/arm/internal_recvmmsg.S: Likewise. + * sysdeps/unix/sysv/linux/arm/internal_sendmmsg.S: Likewise. + * sysdeps/unix/sysv/linux/i386/accept4.S: Likewise. + * sysdeps/unix/sysv/linux/i386/internal_accept4.S: Likewise. + * sysdeps/unix/sysv/linux/i386/socket.S: Likewise. + * sysdeps/unix/sysv/linux/internal_accept4.S: Likewise. + * sysdeps/unix/sysv/linux/internal_recvmmsg.S: Likewise. + * sysdeps/unix/sysv/linux/internal_sendmmsg.S: Likewise. + * sysdeps/unix/sysv/linux/listen.S: Likewise. + * sysdeps/unix/sysv/linux/microblaze/socket.S: Likewise. + * sysdeps/unix/sysv/linux/mips/mips32/internal_accept4.S: Likewise. + * sysdeps/unix/sysv/linux/mips/mips32/internal_recvmmsg.S: Likewise. + * sysdeps/unix/sysv/linux/mips/mips32/internal_sendmmsg.S: Likewise. + * sysdeps/unix/sysv/linux/powerpc/powerpc32/socket.S: Likewise. + * sysdeps/unix/sysv/linux/powerpc/powerpc64/socket.S: Likewise. + * sysdeps/unix/sysv/linux/recv.S: Likewise. + * sysdeps/unix/sysv/linux/recvfrom.S: Likewise. + * sysdeps/unix/sysv/linux/recvmsg.S: Likewise. + * sysdeps/unix/sysv/linux/s390/s390-32/socket.S: Likewise. + * sysdeps/unix/sysv/linux/s390/s390-64/socket.S: Likewise. + * sysdeps/unix/sysv/linux/send.S: Likewise. + * sysdeps/unix/sysv/linux/sendmsg.S: Likewise. + * sysdeps/unix/sysv/linux/sendto.S: Likewise. + * sysdeps/unix/sysv/linux/setsockopt.S: Likewise. + * sysdeps/unix/sysv/linux/sh/socket.S: Likewise. + * sysdeps/unix/sysv/linux/shutdown.S: Likewise. + * sysdeps/unix/sysv/linux/socketpair.S: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc32/socket.S: Likewise. + * sysdeps/unix/sysv/linux/sparc/sparc64/socket.S: Likewise. + * sysdeps/unix/sysv/linux/m68k/socket.S: Likewise. + * sysdeps/unix/sysv/linux/hppa/socket.S: Likewise. + * sysdeps/unix/sysv/linux/kernel-features.h: Adjust comment on how + socketcall is implemented in GLIBC. + 2015-05-22 Joseph Myers <joseph@codesourcery.com> * soft-fp/fmadf4.c: Include <libc-internal.h>. diff --git a/nptl/Makefile b/nptl/Makefile index fe1ba05717..8e994527cb 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -200,6 +200,12 @@ CFLAGS-open64.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pause.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-recv.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-send.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-accept.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-sendto.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-sendmsg.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-connect.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-recvmsg.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-recvfrom.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pt-system.c = -fexceptions diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index c26a12fa11..bfbabd4b4b 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -11,10 +11,6 @@ ifeq ($(subdir),malloc) CFLAGS-malloc.c += -DMORECORE_CLEARS=2 endif -ifeq ($(subdir),socket) -sysdep_routines += internal_accept4 internal_recvmmsg internal_sendmmsg -endif - ifeq ($(subdir),misc) include $(firstword $(wildcard $(sysdirs:=/sysctl.mk))) diff --git a/sysdeps/unix/sysv/linux/accept.S b/sysdeps/unix/sysv/linux/accept.S deleted file mode 100644 index 491ebe2ab2..0000000000 --- a/sysdeps/unix/sysv/linux/accept.S +++ /dev/null @@ -1,6 +0,0 @@ -#define socket accept -#define __socket __libc_accept -#define NARGS 3 -#define NEED_CANCELLATION -#include <socket.S> -libc_hidden_def (accept) diff --git a/sysdeps/unix/sysv/linux/accept.c b/sysdeps/unix/sysv/linux/accept.c new file mode 100644 index 0000000000..72d42a7d85 --- /dev/null +++ b/sysdeps/unix/sysv/linux/accept.c @@ -0,0 +1,31 @@ +/* Copyright (C) 2015 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 <signal.h> +#include <sys/socket.h> + +#include <sysdep-cancel.h> +#include <socketcall.h> + +int +__libc_accept (int fd, __SOCKADDR_ARG addr, sockle |
