From patchwork Thu Feb 9 19:20:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 726293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vK7GB4vntz9s4s for ; Fri, 10 Feb 2017 06:20:50 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="sFJPd8JK"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=VhfENOu5h2zTj8Tw 5Pg/TeUDggI1a5pvcFrHtIkBCu9juRS0xPiyGU2dILL52LKQ3AdZVpAD0WxImATB 5tA7sgdO+4r2fyDKNs+XEXvbsPuVyjNC6frvwf8cA44zsFjj/CZXbChOkU0HdtF6 PRAL1ewEEplYgLB6Du8XoZSb7tA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=RVkx40rbnrKewD1rMFzDuq eKlow=; b=sFJPd8JKa89ZAuco1QviH4as965LWxRZ8fbmvFpGbzzBMTT/tl2dut 7zEz2ovU2eByg96UWaKFUEkn5tIqMXr59RRM/e39VPDWT50xnOM3F74AkxOpyB+K SGkSnOghD1KAsxIqR+tQn6KqryJZAxV6ZEF+xU1o1Xj9L7kmFg8To= Received: (qmail 88400 invoked by alias); 9 Feb 2017 19:20:24 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 88327 invoked by uid 89); 9 Feb 2017 19:20:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=Strong, 1521, 5, 7, 486 X-HELO: mail-qt0-f176.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=malHJbHJGYxT1Ajdx3k5bgt30Q+IAgIqdb9zLjZqbPw=; b=L9S2a4/CVgJENPUoSTVgS8drwvQd3I/fZ32EgFpnlr6g3+rbFYSuksX5COlG6i3TqK IuMA66sYVI15JaE2TgZvdgGNX/B9D1sZV4odX6yEtUTtJ1XLmqaiFLw8JR9pHI5WZvew IXdPvnQk8b/KAZn63dWzRVrYNI+nNaM9RFZihUGMBaD08Fpwa80Co2rabCWO/1XZmKlA oq7DDY23P0H904UbDlS4eNfEfd7+l0yFe8m6iS4MCE0k/SMKbH9kv3qhT1y5nXtnzASI hNuGngubclNR2hUbcXt4CZJChQUfdQle0DTyKTgHbXkPbc9EmFmEOj0x5oxqBRzF17B8 HslQ== X-Gm-Message-State: AMke39lP2HELHpQRr0JRJsz1cSRoleeZ5i3WDITXFjdDo7PtIXvFgK2/+gVvU8ZSmU90dGhB X-Received: by 10.237.59.19 with SMTP id p19mr4489520qte.90.1486668011201; Thu, 09 Feb 2017 11:20:11 -0800 (PST) Subject: Re: [PATCH 1/4] Consolidate Linux accept implementation To: Phil Blundell , libc-alpha@sourceware.org References: <1485784926-2172-1-git-send-email-adhemerval.zanella@linaro.org> <1485784926-2172-2-git-send-email-adhemerval.zanella@linaro.org> <1486587580.1603.24.camel@pbcl.net> <102dbb40-69f8-4358-03b5-3ea9e6961a2e@linaro.org> <1486667674.1603.25.camel@pbcl.net> From: Adhemerval Zanella Message-ID: <5451acc8-bbee-7381-1674-15cefa4c66d7@linaro.org> Date: Thu, 9 Feb 2017 17:20:06 -0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <1486667674.1603.25.camel@pbcl.net> 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 >> >> #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 . */ -#include -#include #include - #include #include -#include -#include 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 #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 #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 #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