From patchwork Wed Oct 19 22:14:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 59110 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A559F381FE76 for ; Wed, 19 Oct 2022 22:20:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A559F381FE76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666218013; bh=9aBdtdO8KMlrVVleRdicKQXMKw11XV483Q0zAZEHph8=; 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=jBIkFjkreCiadoUpvISM9o+cdeQhMKrTAMpImm/+EYfRZ7mpe5AgEmJaMqmolAK5O 0R7MPPaIyz94Ipql+uWwRwQatPTSko9TkZkobuqninfrsSefID1TTTkhVYcUridR7E uRKICRPyIH0eYoNiIFh4OHrVS5WjV12fkIF8Ot40= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by sourceware.org (Postfix) with ESMTPS id 729D2385801A for ; Wed, 19 Oct 2022 22:15:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 729D2385801A Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-132fb4fd495so22371139fac.12 for ; Wed, 19 Oct 2022 15:15:09 -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=9aBdtdO8KMlrVVleRdicKQXMKw11XV483Q0zAZEHph8=; b=mxTDTSLhhHTh5X6Jcw5FraJL1pF0IYuwEZeBuqNE4pbvUmJ/Lc3a81WaD0dD3sbPeJ /oOTQXAZJQV5CSN/78xRxqLx5NHLq8eyiee0gQnmQEkdb14L4VdVsu1h2ocftaNce85f Gtt5a4qv564YL9zYsDjlqmwNUDB/DVoUv/KDYoc9/2f/4hLwihHiIyPgT8hOEQ8uK5cM R8ZVFNYVUlit/IUr2RF7kfB93vCxzQdjPM5GWHbKLW0PKx86rUbWRBtFPKrBWFEq4aB8 y2zGTY7BoYYuymRsYZOQFzzXs+P7xLF/IdEAbnmRNV1YkRxd9GupKcVHKko+QTpD+HAk eZtw== X-Gm-Message-State: ACrzQf2wUhjHhYf3ch3/c2AH7dtMDzkTPUlZmvVXenO7EOMKXg/xqaCV KOso9lhZYSVg8a88qs99TuoQCHhBkYFw4qnS X-Google-Smtp-Source: AMsMyM7kMaAXndvw88VKtMaZBn+5yinTepSr/o/OBUwACQF9ry4MVpzbcVgnMzXVxkyinijFtY/1Aw== X-Received: by 2002:a05:6870:4284:b0:101:202e:a78d with SMTP id y4-20020a056870428400b00101202ea78dmr23454140oah.37.1666217708547; Wed, 19 Oct 2022 15:15:08 -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.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 15:15:08 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 24/30] Linux: Assume and consolidate shutdown wire-up syscall Date: Wed, 19 Oct 2022 19:14:27 -0300 Message-Id: <20221019221433.1082017-25-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 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" And disable if kernel does not support it. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Carlos O'Donell Tested-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/generic/syscalls.list | 4 ---- sysdeps/unix/sysv/linux/i386/kernel-features.h | 7 ++----- sysdeps/unix/sysv/linux/kernel-features.h | 1 + sysdeps/unix/sysv/linux/m68k/kernel-features.h | 7 ++----- 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 | 7 ++----- sysdeps/unix/sysv/linux/sh/kernel-features.h | 1 - sysdeps/unix/sysv/linux/shutdown.c | 7 +------ sysdeps/unix/sysv/linux/sparc/kernel-features.h | 2 -- 10 files changed, 8 insertions(+), 30 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/generic/syscalls.list diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list deleted file mode 100644 index b000ca3c7c..0000000000 --- a/sysdeps/unix/sysv/linux/generic/syscalls.list +++ /dev/null @@ -1,4 +0,0 @@ -# File name Caller Syscall name # args Strong name Weak names - -# Socket APIs -shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h index 423edc9017..e726fc657a 100644 --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h @@ -17,15 +17,11 @@ License along with the GNU C Library; if not, see . */ -/* Direct socketcalls available with kernel 4.3. */ -#if __LINUX_KERNEL_VERSION >= 0x040300 -# define __ASSUME_SHUTDOWN_SYSCALL 1 -#endif - #include_next #undef __ASSUME_ACCEPT_SYSCALL +/* Direct socketcalls available with kernel 4.3. */ #if __LINUX_KERNEL_VERSION < 0x040300 # undef __ASSUME_ACCEPT4_SYSCALL # undef __ASSUME_SENDMSG_SYSCALL @@ -41,6 +37,7 @@ # undef __ASSUME_LISTEN_SYSCALL # undef __ASSUME_GETSOCKNAME_SYSCALL # undef __ASSUME_GETPEERNAME_SYSCALL +# undef __ASSUME_SHUTDOWN_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 c751530cd3..23586c88d3 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -85,6 +85,7 @@ #define __ASSUME_LISTEN_SYSCALL 1 #define __ASSUME_GETSOCKNAME_SYSCALL 1 #define __ASSUME_GETPEERNAME_SYSCALL 1 +#define __ASSUME_SHUTDOWN_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 a7b3458a21..1ad1193afb 100644 --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -17,15 +17,11 @@ License along with the GNU C Library. If not, see . */ -/* Direct socketcalls available with kernel 4.3. */ -#if __LINUX_KERNEL_VERSION >= 0x040300 -# define __ASSUME_SHUTDOWN_SYSCALL 1 -#endif - #include_next #undef __ASSUME_ACCEPT_SYSCALL +/* Direct socketcalls available with kernel 4.3. */ #if __LINUX_KERNEL_VERSION < 0x040300 # undef __ASSUME_ACCEPT4_SYSCALL # undef __ASSUME_RECVMMSG_SYSCALL @@ -43,6 +39,7 @@ # undef __ASSUME_LISTEN_SYSCALL # undef __ASSUME_GETSOCKNAME_SYSCALL # undef __ASSUME_GETPEERNAME_SYSCALL +# undef __ASSUME_SHUTDOWN_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 328529434d..72496aa922 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -21,7 +21,6 @@ #define __ASSUME_CONNECT_SYSCALL 1 #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 -#define __ASSUME_SHUTDOWN_SYSCALL 1 #include_next diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h index 7fae7ca429..e2dc7a15a3 100644 --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h @@ -21,7 +21,6 @@ #define __ASSUME_CONNECT_SYSCALL 1 #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 -#define __ASSUME_SHUTDOWN_SYSCALL 1 /* Define this if your 32-bit syscall API requires 64-bit register pairs to start with an even-number register. */ diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h index e797b71052..b39e4736b3 100644 --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h @@ -17,15 +17,11 @@ License along with the GNU C Library; if not, see . */ -/* Direct socketcalls available with kernel 4.3. */ -#if __LINUX_KERNEL_VERSION >= 0x040300 -# define __ASSUME_SHUTDOWN_SYSCALL 1 -#endif - #include_next #undef __ASSUME_ACCEPT_SYSCALL +/* Direct socketcalls available with kernel 4.3. */ #if __LINUX_KERNEL_VERSION < 0x040300 # undef __ASSUME_ACCEPT4_SYSCALL # undef __ASSUME_RECVMMSG_SYSCALL @@ -43,6 +39,7 @@ # undef __ASSUME_LISTEN_SYSCALL # undef __ASSUME_GETSOCKNAME_SYSCALL # undef __ASSUME_GETPEERNAME_SYSCALL +# undef __ASSUME_SHUTDOWN_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 3a0b4e6198..ae1387e7d7 100644 --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h @@ -26,7 +26,6 @@ #define __ASSUME_CONNECT_SYSCALL 1 #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 -#define __ASSUME_SHUTDOWN_SYSCALL 1 #include_next diff --git a/sysdeps/unix/sysv/linux/shutdown.c b/sysdeps/unix/sysv/linux/shutdown.c index 26772c9b28..4cee357b9b 100644 --- a/sysdeps/unix/sysv/linux/shutdown.c +++ b/sysdeps/unix/sysv/linux/shutdown.c @@ -15,19 +15,14 @@ License along with the GNU C Library; if not, see . */ -#include -#include #include - #include -#include -#include int __shutdown (int fd, int how) { #ifdef __ASSUME_SHUTDOWN_SYSCALL - return INLINE_SYSCALL (shutdown, 2, fd, how); + return INLINE_SYSCALL_CALL (shutdown, fd, how); #else return SOCKETCALL (shutdown, fd, how); #endif diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h index 7070aaa1ae..12e98a9f95 100644 --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h @@ -40,8 +40,6 @@ # undef __ASSUME_SENDTO_SYSCALL # undef __ASSUME_GETSOCKOPT_SYSCALL # undef __ASSUME_SETSOCKOPT_SYSCALL -#else -# define __ASSUME_SHUTDOWN_SYSCALL 1 #endif /* These syscalls were added for both 32-bit and 64-bit in 4.4. */