From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS17314 8.43.84.0/22 X-Spam-Status: No, score=-4.4 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 31F521F4DA for ; Wed, 19 Oct 2022 22:21:00 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="YjaGi4Pa"; dkim-atps=neutral Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 28AD0385356F for ; Wed, 19 Oct 2022 22:20:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 28AD0385356F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666218059; bh=RvPE/qt5/EN2FK/2RjJrI4pr4fJ427jEvj0xvVqrm8Q=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=YjaGi4Pa6saEt/LwjK20J4HhHHqiojD765ZGDrrgmo3x487FYMDi+iLCgB/f9LHpW CYGTK8er13aVDYkTqCY7cxhVJvbBItrdWQ22wftsKLYtQVf3o+qQ7p2tNwS5NB6tf8 2rF+tOmtZPo/rCyALBxTMX9hRMQG2e+HnR7TUGic= Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by sourceware.org (Postfix) with ESMTPS id DF76D385742E for ; Wed, 19 Oct 2022 22:15:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DF76D385742E Received: by mail-oi1-x22d.google.com with SMTP id y72so20885849oia.3 for ; Wed, 19 Oct 2022 15:15:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RvPE/qt5/EN2FK/2RjJrI4pr4fJ427jEvj0xvVqrm8Q=; b=1jFqcHHTsGjqjT1XwPL6WJDpMoYvYZ/BX5mqUeApE9tS137g7G4b3jI7efgX70r8xk dNRexC2Sw7KZ/XEGeFfrNCNC5woicxEV/1m+UxnybGstHlvZpgxNpln9IT1Y/XKARDMK H7T0KO6oWMw+L8FgjgotITpzibgu29x4v/HJdOLaw820aBbYm1mEqvmuXUUvSOLJvNeJ xUXG3OGGhiPS30ZAZqmktnXccGxhZDXBj7s7NoOyh+jsGK6erkNzk3bJ1mB6wZvnoh9R dTrYeBB3Nk3MewOnfUUZi3UlcW86oMzgURf7w9be2ffSwsqVraaaZ+knEGN0WT1rATa5 WO6g== X-Gm-Message-State: ACrzQf2aCvQIf+9XzZJtGL/rbx9n/o0D0uZ3gw3OvMgr1B+3Gss39PSq vdr1UuQkJGLKTACklyMNDEALiPtDPMcx89SW X-Google-Smtp-Source: AMsMyM44ImceBKfg1246eHScTEyx6tsZQfz+4k7yZ1xl0unhR4WTPJDUwT50NdHQVrWxk6jzMDnEvw== X-Received: by 2002:a05:6808:219a:b0:354:daec:53cb with SMTP id be26-20020a056808219a00b00354daec53cbmr5360996oib.2.1666217701344; Wed, 19 Oct 2022 15:15:01 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c3:7d19:f1c1:9fb4:472a:ab68]) by smtp.gmail.com with ESMTPSA id m9-20020aca5809000000b00353fe4fb4casm7137927oib.48.2022.10.19.15.15.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 15:15:01 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 18/30] Linux: Assume and consolidate bind wire-up syscall Date: Wed, 19 Oct 2022 19:14:21 -0300 Message-Id: <20221019221433.1082017-19-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221019221433.1082017-1-adhemerval.zanella@linaro.org> References: <20221019221433.1082017-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" And disable if kernel does not support it. Checked on x86_64-linux-gnu and i686-linux-gnu. --- sysdeps/unix/sysv/linux/bind.c | 7 +------ sysdeps/unix/sysv/linux/generic/syscalls.list | 1 - sysdeps/unix/sysv/linux/i386/kernel-features.h | 2 +- sysdeps/unix/sysv/linux/kernel-features.h | 1 + sysdeps/unix/sysv/linux/m68k/kernel-features.h | 2 +- sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 - sysdeps/unix/sysv/linux/powerpc/kernel-features.h | 1 - sysdeps/unix/sysv/linux/s390/kernel-features.h | 2 +- sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 - sysdeps/unix/sysv/linux/sparc/kernel-features.h | 5 ++++- 10 files changed, 9 insertions(+), 14 deletions(-) diff --git a/sysdeps/unix/sysv/linux/bind.c b/sysdeps/unix/sysv/linux/bind.c index 83992a5dbd..97a42c497f 100644 --- a/sysdeps/unix/sysv/linux/bind.c +++ b/sysdeps/unix/sysv/linux/bind.c @@ -15,19 +15,14 @@ License along with the GNU C Library; if not, see . */ -#include -#include #include - #include -#include -#include int __bind (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len) { #ifdef __ASSUME_BIND_SYSCALL - return INLINE_SYSCALL (bind, 3, fd, addr.__sockaddr__, len); + return INLINE_SYSCALL_CALL (bind, fd, addr.__sockaddr__, len); #else return SOCKETCALL (bind, fd, addr.__sockaddr__, len, 0, 0, 0); #endif diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list index f573f27c8b..889b62bbea 100644 --- a/sysdeps/unix/sysv/linux/generic/syscalls.list +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list @@ -3,7 +3,6 @@ # Socket APIs socket - socket i:iii __socket socket socketpair - socketpair i:iiif __socketpair socketpair -bind - bind i:ipi __bind bind listen - listen i:ii __listen listen getsockname - getsockname i:ipp __getsockname getsockname 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 87d610cd66..babb0ff83d 100644 --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h @@ -21,7 +21,6 @@ #if __LINUX_KERNEL_VERSION >= 0x040300 # define __ASSUME_SOCKET_SYSCALL 1 # define __ASSUME_SOCKETPAIR_SYSCALL 1 -# define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 @@ -41,6 +40,7 @@ # undef __ASSUME_SENDTO_SYSCALL # undef __ASSUME_GETSOCKOPT_SYSCALL # undef __ASSUME_SETSOCKOPT_SYSCALL +# undef __ASSUME_BIND_SYSCALL #endif /* i686 only supports ipc syscall before 5.1. */ diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 74adc3956b..3dc93f5b11 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -79,6 +79,7 @@ #define __ASSUME_SENDMMSG_SYSCALL 1 #define __ASSUME_GETSOCKOPT_SYSCALL 1 #define __ASSUME_SETSOCKOPT_SYSCALL 1 +#define __ASSUME_BIND_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 d807ac9cfd..37209378b9 100644 --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -21,7 +21,6 @@ #if __LINUX_KERNEL_VERSION >= 0x040300 # define __ASSUME_SOCKET_SYSCALL 1 # define __ASSUME_SOCKETPAIR_SYSCALL 1 -# define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 @@ -43,6 +42,7 @@ # undef __ASSUME_SENDTO_SYSCALL # undef __ASSUME_GETSOCKOPT_SYSCALL # undef __ASSUME_SETSOCKOPT_SYSCALL +# undef __ASSUME_BIND_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 8ae3cdcd96..7fff6dd902 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -19,7 +19,6 @@ /* All supported kernel versions for MicroBlaze have these syscalls. */ #define __ASSUME_SOCKET_SYSCALL 1 -#define __ASSUME_BIND_SYSCALL 1 #define __ASSUME_CONNECT_SYSCALL 1 #define __ASSUME_LISTEN_SYSCALL 1 #define __ASSUME_GETSOCKNAME_SYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h index 894f29d381..af4555bb1d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h @@ -19,7 +19,6 @@ /* New syscalls added for PowerPC in 2.6.37. */ #define __ASSUME_SOCKET_SYSCALL 1 -#define __ASSUME_BIND_SYSCALL 1 #define __ASSUME_CONNECT_SYSCALL 1 #define __ASSUME_LISTEN_SYSCALL 1 #define __ASSUME_GETSOCKNAME_SYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h index a457c84ba1..ae8dc626b2 100644 --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h @@ -21,7 +21,6 @@ #if __LINUX_KERNEL_VERSION >= 0x040300 # define __ASSUME_SOCKET_SYSCALL 1 # define __ASSUME_SOCKETPAIR_SYSCALL 1 -# define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 # define __ASSUME_GETSOCKNAME_SYSCALL 1 # define __ASSUME_GETPEERNAME_SYSCALL 1 @@ -43,6 +42,7 @@ # undef __ASSUME_SENDTO_SYSCALL # undef __ASSUME_GETSOCKOPT_SYSCALL # undef __ASSUME_SETSOCKOPT_SYSCALL +# undef __ASSUME_BIND_SYSCALL #endif /* s390 only supports ipc syscall before 5.1. */ diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h index 545bef40fd..2883da92b2 100644 --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h @@ -24,7 +24,6 @@ /* These syscalls were added for SH in 2.6.37. */ #define __ASSUME_SOCKET_SYSCALL 1 -#define __ASSUME_BIND_SYSCALL 1 #define __ASSUME_CONNECT_SYSCALL 1 #define __ASSUME_LISTEN_SYSCALL 1 #define __ASSUME_GETSOCKNAME_SYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h index 6cbe189b2f..2b7056c0fb 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -48,10 +48,13 @@ /* These syscalls were added for both 32-bit and 64-bit in 4.4. */ #if __LINUX_KERNEL_VERSION >= 0x040400 -# define __ASSUME_BIND_SYSCALL 1 # define __ASSUME_LISTEN_SYSCALL 1 #endif +#if __LINUX_KERNEL_VERSION < 0x040400 +# undef __ASSUME_BIND_SYSCALL +#endif + #ifdef __arch64__ /* sparc64 defines __NR_pause, however it is not supported (ENOSYS). Undefine so pause.c can use a correct alternative. */ -- 2.34.1