Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3551481rwd; Sat, 10 Jun 2023 09:39:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xWl48QuJBgWQr3earwp8g0NhXpyVEmfpvPGScukQ1nThyRbY7x7a1otlhtfOcjACTvoaV X-Received: by 2002:aa7:c3ca:0:b0:514:9465:81ef with SMTP id l10-20020aa7c3ca000000b00514946581efmr1398768edr.21.1686415155406; Sat, 10 Jun 2023 09:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686415155; cv=none; d=google.com; s=arc-20160816; b=QmdtKn6WKqgyDSQylyI8czDqq3BOFW9gGDjYjYNZS00YrbGHeQdT0RckxNK/5Nyv1o Be9MijKwrJ5e3pRNo4NDBjswOMyZIAEkUV9ddbHDf6xu0QmxV35OIK4xy+9FjM8xGJfR DtRBqhKNz08bF9Q1PVICigFnE84u749zJMJZpPZOQQPmuqfolHhtGZ+sV0e2N2tVXu6/ JB4rNHmlFe0I71hnqPbCHZw+K8LU1dVJYTJUXjfrku9hZuFpVcI7qxz4mBXgrHznSix3 K5u/Kam4ITgcC0Z5XPuW6g1ZUoBUkkt/hci5siHHDb46zWpB8zHeD8kP4RhV7gs27VVM 5tfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=Awy+aUGSIO2CggaT0d7cVaFmpngUFKrkSU9kN13sPI0=; b=NiwPEg6koINeUMx756M6ei52yR9Q4ev+CmhThNVqHsMaMCCPAO9VKwiK8VST1hGsa9 eymsJzjtUci3MGsVCXUL437ND/SF8hIHxm0hFgKGd/6FXb0G/fMjxoJ6w8m7idPFAqTP YeKdTujPWd32J9/ykxZQvO/z3ybfj1zSSkSPnCiaVEi2AhBPALVIfY7sIAyUZP8QrWga YQ+aWGv5qftvVoz9wmxzoprm0zPR1KAn/JxB4eA50cZBnt47B6iIxh5pZEhzw/XhPK+z RTfSFpQa/5ij90WN8Z5Anv1sPqcDerA9loUdT9zN9HxZHBzI+1xk4+5LUzSbeK9Z4djc xfOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020aa7c983000000b0050b3832871csi3682671edt.200.2023.06.10.09.38.51; Sat, 10 Jun 2023 09:39:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbjFJQe0 convert rfc822-to-8bit (ORCPT + 99 others); Sat, 10 Jun 2023 12:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbjFJQeZ (ORCPT ); Sat, 10 Jun 2023 12:34:25 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A76851984 for ; Sat, 10 Jun 2023 09:34:23 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-257-vjr2SVtyMI2O7ZtR7E3aMA-1; Sat, 10 Jun 2023 17:34:20 +0100 X-MC-Unique: vjr2SVtyMI2O7ZtR7E3aMA-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sat, 10 Jun 2023 17:34:16 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Sat, 10 Jun 2023 17:34:16 +0100 From: David Laight To: 'Zhangjin Wu' , "w@1wt.eu" CC: "arnd@arndb.de" , "linux-kernel@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "linux-riscv@lists.infradead.org" , "thomas@t-8ch.de" Subject: RE: [PATCH v2 4/4] tools/nolibc: sys.h: apply __syscall() helper Thread-Topic: [PATCH v2 4/4] tools/nolibc: sys.h: apply __syscall() helper Thread-Index: AQHZmQJ1YTdtMnXhOkqSBnIhvL9uWq+EPW+g Date: Sat, 10 Jun 2023 16:34:16 +0000 Message-ID: <0295105fe0744200bf2ef99e5bf7bc09@AcuMS.aculab.com> References: <20230607053920.667272-1-falcon@tinylab.org> In-Reply-To: <20230607053920.667272-1-falcon@tinylab.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhangjin Wu > Sent: 07 June 2023 06:39 ... > As a summary, will use 'sysret()' and something like: > > static __attribute__((unused)) > int chdir(const char *path) > { > return sysret(chdir(path)); > } > > to renew the syscall helper patchset, Thanks you very much. While I'm all for using 'cpp-magic' to abstract and (hopefully) simplify things. Token-pasting the sys_ here doesn't seem to gain anything. Anyone grepping the code for 'sys_chdir' is also going to wonder where it is used. There might be scope for something like: #define syscall_wrapper(func, type) \ static __attribute__((unused)) \ int func(type *arg) \ { \ return sysret(sys_#func(arg)); \ } and then: syscall_wrapper(chdir, const char *) would expand to the code above. I think you'd need separate defines for each number of arguments. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)