Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp527733rdg; Thu, 12 Oct 2023 12:34:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGnkpIJoJKrT46EpAN7J/Eoggo0oDO10LPbUdJ4NPG2WaILxoEPJVS0jCjbpjW+plLBXLDf X-Received: by 2002:a05:6358:1a9e:b0:164:8d78:257f with SMTP id gm30-20020a0563581a9e00b001648d78257fmr12675678rwb.17.1697139268758; Thu, 12 Oct 2023 12:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697139268; cv=none; d=google.com; s=arc-20160816; b=u7UmzJD/gi9jtcHqHAd8mGJafHGo7iFE6Z994eD8UZgot3PxpLakt0jcFnLcIK6+yY rcfWopux1rsk7VRhYmshVaqUNBwAkMXbZlW/Z0gt7IHrN25/cqDsLPFwjgVVLzoG41fX 0K87ekRrv5YwVG8HIFfgu3NBRaRImkA22vfg3tfTiHHIE2jpQMdgIgnAp5KozSJ3cNjH VsuBCRpinlixhOPV6DiYpuJYZXJOcIcg2ZrY8OHlAJvfOi3tHu1sLxzWG/5YSUVY9HJ3 XQE6seytuZ9Du5BXI+AzxdqW6ynmDZ2trrNT95/0XOB1FFs3b4L0vO9LVSn1zEfDEZW3 NM3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/b2QOTNCYZcoVhB8ArjoTwHc5F0rBjVDTydQ+y2mlzY=; fh=n5S/AR14tYMsjDdXEOPrR3UbxswSa5eTzDqlfcgbnjE=; b=oBBXXs37NCoKKMM7e60JnNAyr++mvy2BHe6czz+8BhRbrFPb0u6LYcr3j8Ui2N7leS OzkxyjVhr1hZFcpVZj0/v4BJWRwGfC50n+qj+3X/dJrCDBK5jbcJnN/0ylDF6m34f5HY GQD/BX34yNxFpVt3rmDYuLCgOZ9nvKduiTrWa8y5sGrMHHOoAfIPQEEtRhle/mk3fiDo A2iW2j4boD4D/oNR1Fuj7NsapL3nEiH6m0WXhqAVXVVZmp18tG0Km8JIDYgBtl7FDHwZ 9GVbjFwQAl3+zaULuuaDUbp6ARVKJ2X3rW3f8fubVBI+KFeqVhJaHIKhMcHjjPSFn8Lu 7VXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RHLwSsGW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id i190-20020a6387c7000000b005859c81f1f0si2859868pge.137.2023.10.12.12.34.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 12:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=RHLwSsGW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B64478295BCE; Thu, 12 Oct 2023 12:34:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442312AbjJLTdQ (ORCPT + 99 others); Thu, 12 Oct 2023 15:33:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442316AbjJLTcl (ORCPT ); Thu, 12 Oct 2023 15:32:41 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 997EFE4 for ; Thu, 12 Oct 2023 12:32:38 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 365CAC433AB; Thu, 12 Oct 2023 19:32:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697139156; bh=D8WmWSdjmqDotCTIny5KPDkHdNvvxPLSrd63TdlisnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RHLwSsGWiK5Auz6rJyJMdNuFODjmPjM93DlLx397AdEO0rjXL7Uj2MSghnQzpNGPX QAQ4rEsbUocWvUvcTcKSN3JJith5ORSdH7CmZICqXagBgOpU2yfK8xGagZ9/8S7Ur5 JedBfkUCXkd3ge7yqnhF0SPaLrEmRcrWLms2uSRdFn144xI/v8uVBvr9jjHwuI/xwl dZM5n7tH0/sdHMEc2wYWUdrf5HxdpqU3Yre6CWlDnCvJezSBGIJeh7eIqwDDRCoTGY 9JHDETK7yVoKrlltr+gJSTgyKRuwkvngmctrmd7ecBlOCkIMHDoEZpZqSoWhiwDvDH v5Jb9EOmL+P+A== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 5BBFDCE0DDC; Thu, 12 Oct 2023 12:32:35 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: gwml@vger.gnuweeb.org, kernel-team@meta.com, w@lwt.eu, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Willy Tarreau Subject: [PATCH nolibc 13/19] tools/nolibc: avoid unused parameter warnings for ENOSYS fallbacks Date: Thu, 12 Oct 2023 12:32:27 -0700 Message-Id: <20231012193233.207857-13-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 12 Oct 2023 12:34:21 -0700 (PDT) From: Thomas Weißschuh The ENOSYS fallback code does not use its functions parameters. This can lead to compiler warnings about unused parameters. Explicitly avoid these warnings. Signed-off-by: Thomas Weißschuh Acked-by: Willy Tarreau Link: https://lore.kernel.org/r/20230917-nolibc-syscall-nr-v2-2-03863d509b9a@weissschuh.net --- tools/include/nolibc/sys.h | 44 +++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index b478750c9004..8389820e1928 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -43,6 +43,16 @@ : __sysret_arg; /* return original value */ \ }) +/* Syscall ENOSYS helper: Avoids unused-parameter warnings and provides a + * debugging hook. + */ + +static __inline__ int __nolibc_enosys(const char *syscall, ...) +{ + (void)syscall; + return -ENOSYS; +} + /* Functions in this file only describe syscalls. They're declared static so * that the compiler usually decides to inline them while still being allowed @@ -133,7 +143,7 @@ int sys_chmod(const char *path, mode_t mode) #elif defined(__NR_chmod) return my_syscall2(__NR_chmod, path, mode); #else - return -ENOSYS; + return __nolibc_enosys(__func__, path, mode); #endif } @@ -156,7 +166,7 @@ int sys_chown(const char *path, uid_t owner, gid_t group) #elif defined(__NR_chown) return my_syscall3(__NR_chown, path, owner, group); #else - return -ENOSYS; + return __nolibc_enosys(__func__, path, owner, group); #endif } @@ -230,7 +240,7 @@ int sys_dup2(int old, int new) #elif defined(__NR_dup2) return my_syscall2(__NR_dup2, old, new); #else - return -ENOSYS; + return __nolibc_enosys(__func__, old, new); #endif } @@ -312,7 +322,7 @@ pid_t sys_fork(void) #elif defined(__NR_fork) return my_syscall0(__NR_fork); #else - return -ENOSYS; + return __nolibc_enosys(__func__); #endif } #endif @@ -486,7 +496,7 @@ int sys_gettimeofday(struct timeval *tv, struct timezone *tz) #ifdef __NR_gettimeofday return my_syscall2(__NR_gettimeofday, tv, tz); #else - return -ENOSYS; + return __nolibc_enosys(__func__, tv, tz); #endif } @@ -563,7 +573,7 @@ int sys_link(const char *old, const char *new) #elif defined(__NR_link) return my_syscall2(__NR_link, old, new); #else - return -ENOSYS; + return __nolibc_enosys(__func__, old, new); #endif } @@ -584,7 +594,7 @@ off_t sys_lseek(int fd, off_t offset, int whence) #ifdef __NR_lseek return my_syscall3(__NR_lseek, fd, offset, whence); #else - return -ENOSYS; + return __nolibc_enosys(__func__, fd, offset, whence); #endif } @@ -607,7 +617,7 @@ int sys_mkdir(const char *path, mode_t mode) #elif defined(__NR_mkdir) return my_syscall2(__NR_mkdir, path, mode); #else - return -ENOSYS; + return __nolibc_enosys(__func__, path, mode); #endif } @@ -629,7 +639,7 @@ int sys_rmdir(const char *path) #elif defined(__NR_unlinkat) return my_syscall3(__NR_unlinkat, AT_FDCWD, path, AT_REMOVEDIR); #else - return -ENOSYS; + return __nolibc_enosys(__func__, path); #endif } @@ -652,7 +662,7 @@ long sys_mknod(const char *path, mode_t mode, dev_t dev) #elif defined(__NR_mknod) return my_syscall3(__NR_mknod, path, mode, dev); #else - return -ENOSYS; + return __nolibc_enosys(__func__, path, mode, dev); #endif } @@ -742,7 +752,7 @@ int sys_open(const char *path, int flags, mode_t mode) #elif defined(__NR_open) return my_syscall3(__NR_open, path, flags, mode); #else - return -ENOSYS; + return __nolibc_enosys(__func__, path, flags, mode); #endif } @@ -842,7 +852,7 @@ int sys_poll(struct pollfd *fds, int nfds, int timeout) #elif defined(__NR_poll) return my_syscall3(__NR_poll, fds, nfds, timeout); #else - return -ENOSYS; + return __nolibc_enosys(__func__, fds, nfds, timeout); #endif } @@ -934,7 +944,7 @@ int sys_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeva #endif return my_syscall5(__NR__newselect, nfds, rfds, wfds, efds, timeout); #else - return -ENOSYS; + return __nolibc_enosys(__func__, nfds, rfds, wfds, efds, timeout); #endif } @@ -989,7 +999,7 @@ int sys_statx(int fd, const char *path, int flags, unsigned int mask, struct sta #ifdef __NR_statx return my_syscall5(__NR_statx, fd, path, flags, mask, buf); #else - return -ENOSYS; + return __nolibc_enosys(__func__, fd, path, flags, mask, buf); #endif } @@ -1047,7 +1057,7 @@ int sys_symlink(const char *old, const char *new) #elif defined(__NR_symlink) return my_syscall2(__NR_symlink, old, new); #else - return -ENOSYS; + return __nolibc_enosys(__func__, old, new); #endif } @@ -1104,7 +1114,7 @@ int sys_unlink(const char *path) #elif defined(__NR_unlink) return my_syscall1(__NR_unlink, path); #else - return -ENOSYS; + return __nolibc_enosys(__func__, path); #endif } @@ -1127,7 +1137,7 @@ pid_t sys_wait4(pid_t pid, int *status, int options, struct rusage *rusage) #ifdef __NR_wait4 return my_syscall4(__NR_wait4, pid, status, options, rusage); #else - return -ENOSYS; + return __nolibc_enosys(__func__, pid, status, options, rusage); #endif } -- 2.40.1