From patchwork Wed Oct 19 22:14:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 59113 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 24A32380DBEB for ; Wed, 19 Oct 2022 22:20:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24A32380DBEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666218050; bh=buqKb1nI+SQAhKHFgSqUgVUG+h8p+YMj+f8OSbsfnTk=; 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=k7adbNd7H2dolGogSbpR8zHUAfE6a0S0Wxitv8SmRrlsVSip7WdFxLb2l1Bqlk3P/ sLkBqQNism1iUG5zAbnfDmLI/D9LFUnUQzt1qk6EuC/XhY7f4ymxvobvICmx6tkiBg tymYzGGKT5VGpkFo1cv+VdiYOPNHywrAf9GAu2oU= 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 491963857414 for ; Wed, 19 Oct 2022 22:15:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 491963857414 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-1324e7a1284so22393672fac.10 for ; Wed, 19 Oct 2022 15:15:08 -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=buqKb1nI+SQAhKHFgSqUgVUG+h8p+YMj+f8OSbsfnTk=; b=Aa353dAFFYHXUzhBq0GtWcSkX3w1yx6wnV3lnMnF+t1kpsgmu7t+LqPfh9H8cTDDp1 sfPjgQMc1fl0cl2sSguwwJw74HaC86XzmGPlKGykKpYScS4bV2YUrNBtENTtbqaGE6t2 wfFKwwx008zL7WgAHykAJDffEVzB6f3t9aWBpHVXRmbZ5awLynKN1e6erPiSHn2Kk9EZ LmmuJ7vRQl5zf0+rrKTjnw36gHp8Bg7uu3kAR1aNUyqbL6YcGLBLp6WnJd07D1fAJ1sG LFrLRHn7vOI7AtFx3gBmWV/jMjx5sC5QkYtZd+wkmm3ZJE8s2kwo5+asmUJupH68ijP5 HKaA== X-Gm-Message-State: ACrzQf15Gp8EUyP0EuaXWrKWtVOulTpNNhc5JYo/8XUkF2KsVaoA2mF5 P0G5ms9G7wwVhtujHiDDCxGWygts172b/hER X-Google-Smtp-Source: AMsMyM7h7lfMESIOxLheAvBdGT+05364vdLsZeAajdhQykCscvDUFsMVMvCydkWvEw2cGft46chnAQ== X-Received: by 2002:a05:6870:b68c:b0:132:b864:2aa2 with SMTP id cy12-20020a056870b68c00b00132b8642aa2mr23053080oab.130.1666217707347; Wed, 19 Oct 2022 15:15:07 -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.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 15:15:07 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 23/30] Linux: Assume and consolidate getpeername wire-up syscall Date: Wed, 19 Oct 2022 19:14:26 -0300 Message-Id: <20221019221433.1082017-24-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 Netto 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. Tested-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/generic/syscalls.list | 1 - sysdeps/unix/sysv/linux/getpeername.c | 7 +------ 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 - 9 files changed, 5 insertions(+), 13 deletions(-) diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list index a5bb00a3e4..b000ca3c7c 100644 --- a/sysdeps/unix/sysv/linux/generic/syscalls.list +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list @@ -1,5 +1,4 @@ # File name Caller Syscall name # args Strong name Weak names # Socket APIs -getpeername - getpeername i:ipp __getpeername getpeername shutdown - shutdown i:ii __shutdown shutdown diff --git a/sysdeps/unix/sysv/linux/getpeername.c b/sysdeps/unix/sysv/linux/getpeername.c index 09ca76b9ad..63fa8e2fe5 100644 --- a/sysdeps/unix/sysv/linux/getpeername.c +++ b/sysdeps/unix/sysv/linux/getpeername.c @@ -15,19 +15,14 @@ License along with the GNU C Library; if not, see . */ -#include -#include #include - #include -#include -#include int __getpeername (int fd, __SOCKADDR_ARG addr, socklen_t *len) { #ifdef __ASSUME_GETPEERNAME_SYSCALL - return INLINE_SYSCALL (getpeername, 3, fd, addr.__sockaddr__, len); + return INLINE_SYSCALL_CALL (getpeername, fd, addr.__sockaddr__, len); #else return SOCKETCALL (getpeername, fd, addr.__sockaddr__, len); #endif diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h index f294380215..423edc9017 100644 --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h @@ -19,7 +19,6 @@ /* Direct socketcalls available with kernel 4.3. */ #if __LINUX_KERNEL_VERSION >= 0x040300 -# define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 #endif @@ -41,6 +40,7 @@ # undef __ASSUME_SOCKETPAIR_SYSCALL # undef __ASSUME_LISTEN_SYSCALL # undef __ASSUME_GETSOCKNAME_SYSCALL +# undef __ASSUME_GETPEERNAME_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 6fb99f5c35..c751530cd3 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -84,6 +84,7 @@ #define __ASSUME_SOCKETPAIR_SYSCALL 1 #define __ASSUME_LISTEN_SYSCALL 1 #define __ASSUME_GETSOCKNAME_SYSCALL 1 +#define __ASSUME_GETPEERNAME_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 898c24ba62..a7b3458a21 100644 --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h @@ -19,7 +19,6 @@ /* Direct socketcalls available with kernel 4.3. */ #if __LINUX_KERNEL_VERSION >= 0x040300 -# define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 #endif @@ -43,6 +42,7 @@ # undef __ASSUME_SOCKETPAIR_SYSCALL # undef __ASSUME_LISTEN_SYSCALL # undef __ASSUME_GETSOCKNAME_SYSCALL +# undef __ASSUME_GETPEERNAME_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 7e2b15859e..328529434d 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_CONNECT_SYSCALL 1 -#define __ASSUME_GETPEERNAME_SYSCALL 1 #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h index 8953cb019f..7fae7ca429 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_CONNECT_SYSCALL 1 -#define __ASSUME_GETPEERNAME_SYSCALL 1 #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1 diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h index 1422ee620c..e797b71052 100644 --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h @@ -19,7 +19,6 @@ /* Direct socketcalls available with kernel 4.3. */ #if __LINUX_KERNEL_VERSION >= 0x040300 -# define __ASSUME_GETPEERNAME_SYSCALL 1 # define __ASSUME_SHUTDOWN_SYSCALL 1 #endif @@ -43,6 +42,7 @@ # undef __ASSUME_SOCKETPAIR_SYSCALL # undef __ASSUME_LISTEN_SYSCALL # undef __ASSUME_GETSOCKNAME_SYSCALL +# undef __ASSUME_GETPEERNAME_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 91dc28f33f..3a0b4e6198 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_CONNECT_SYSCALL 1 -#define __ASSUME_GETPEERNAME_SYSCALL 1 #define __ASSUME_SEND_SYSCALL 1 #define __ASSUME_RECV_SYSCALL 1 #define __ASSUME_SHUTDOWN_SYSCALL 1