From patchwork Wed Jun 7 11:31:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 13270492 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 645A7C7EE29 for ; Wed, 7 Jun 2023 11:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234384AbjFGLcD (ORCPT ); Wed, 7 Jun 2023 07:32:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237540AbjFGLcC (ORCPT ); Wed, 7 Jun 2023 07:32:02 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D824010CA; Wed, 7 Jun 2023 04:31:57 -0700 (PDT) X-QQ-mid: bizesmtp90t1686137506t0akcs63 Received: from linux-lab-host.localdomain ( [61.141.77.49]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 07 Jun 2023 19:31:45 +0800 (CST) X-QQ-SSF: 01200000000000D0V000000A0000000 X-QQ-FEAT: dKvkn8qoLrHe6LOHMBCWXivAD3jSJX56tkAHTePVV6se5edU/yVWT48Z+BxDO d4DGxeqgrsnPJ4fbTy+ZEMF8RMEdgl8zXU7OdTTO9L9RqxLBdwC87y/40SdiVhpCEdHHvtX xIIgsl9eCnWP1PIRp4Pkhnm4QdwRpuCW+0IT88p2iV00eJwNRnyxsoG58G0v4enZ2XhUkMa SpXG6UsK/2KquLDDbzmmbT2ZRqCRoLMecnsZz1Twz3kR4YlzLU6xwq9EOTUo0vnEsKXtKHl Z2O+l+T6Tx+eQ6bKu7zRTy2NonNIfDFNuxuvoSa6f9yDloKT/lZEoUTIXaI0XtPMAdFZPO5 LqkqOKBaTEkhkwzHDco4hD4piuu1r7UIs/LdG6JBGsyVyjJXV5773+B4SgSVEsT2smFnQ+O X-QQ-GoodBg: 0 X-BIZMAIL-ID: 3202086989928057354 From: Zhangjin Wu To: thomas@t-8ch.de, w@1wt.eu Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v3 2/3] tools/nolibc: unistd.h: apply __sysret() helper Date: Wed, 7 Jun 2023 19:31:39 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Use __sysret() to shrink the whole _syscall() to oneline code. Signed-off-by: Zhangjin Wu --- tools/include/nolibc/unistd.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tools/include/nolibc/unistd.h b/tools/include/nolibc/unistd.h index c20b2fbf065e..7e3c005d28ba 100644 --- a/tools/include/nolibc/unistd.h +++ b/tools/include/nolibc/unistd.h @@ -56,16 +56,7 @@ int tcsetpgrp(int fd, pid_t pid) return ioctl(fd, TIOCSPGRP, &pid); } -#define _syscall(N, ...) \ -({ \ - long _ret = my_syscall##N(__VA_ARGS__); \ - if (_ret < 0) { \ - SET_ERRNO(-_ret); \ - _ret = -1; \ - } \ - _ret; \ -}) - +#define _syscall(N, ...) __sysret(my_syscall##N(__VA_ARGS__)) #define _sycall_narg(...) __syscall_narg(__VA_ARGS__, 6, 5, 4, 3, 2, 1, 0) #define __syscall_narg(_0, _1, _2, _3, _4, _5, _6, N, ...) N #define _syscall_n(N, ...) _syscall(N, __VA_ARGS__)