Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp319275rwd; Mon, 12 Jun 2023 14:09:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7uxJLi8quiymIKpkVS6ZhPn6kEjr8by1LySsQvDIvnVOV7pGOGMLN1OuJZLQQBAPHDOKZq X-Received: by 2002:a17:907:3f20:b0:978:82fd:758b with SMTP id hq32-20020a1709073f2000b0097882fd758bmr9870192ejc.29.1686604166790; Mon, 12 Jun 2023 14:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686604166; cv=none; d=google.com; s=arc-20160816; b=IGJlQ6ImmeFVfTFGDl8kDbhczdwr73xg8yBwk9VMEBOh5XNFYAssd3e3n0mRaFy18u oy7X8HU9bW9X2AgklakAxU7Hw8zkTbz2iS5v4NQ/gNRGnTNuxS6lFAGyLDpDwRsnF24G DQeALhEkNDdD0LfC2sVmAm7IEQOJJViD2NLnpFjYd9FgYcjkP34VE74U8nJ2jI18/iLH MZ/rBIy/7I7bTA91JYpd0fiQia1RV/ymaneo+f2nS6U/RJB3aPuRr9B3hycaDbBTFob+ 5AAeMKGD/fZsaHC906oni9cVGynbhyU9pTYkO87k8oYmxDtKQCHyvg80zx5rIgfwhoR4 TQ2w== 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=Qg5hqnmrujkQwO1a6DYPNVUEUnm/D9meTahyHyDFLbg=; b=XaFsi13C5xWpKrr0QQqsQGu58Gdu9EAiURmW0j/2qetTvvb28HaAyoxfvlipE+QRH9 uOY+YYL6orOxVbgut5FxK8Y9nlhVTd/rlfukYEZ25xftF2AFVbw5UycbakDxiNsnXTp/ o0vhQr+q0BsAT2UEGrV0LPeG0fq+RIDAfB5ceKZRJjnQnbubqNAMrMOp3IYXoO3uD2Xx 1HXgqrChpa0kJCLUSAQNoxhhY+cdpEx13vq5ZpioBJJ9gGYJKoe9mW4p8IyJMVEz/H7P 60S/sLc93tox3dn0Bw+nH7UaIqOQKznV9p+/s8a/hzkWGCu2B7tr9JQJMNv/Zuu3cMjx HqtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IIyRNxNo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd12-20020a170906ce2c00b00977eb8d57afsi5546092ejb.821.2023.06.12.14.09.01; Mon, 12 Jun 2023 14:09:26 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IIyRNxNo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237644AbjFLUro (ORCPT + 99 others); Mon, 12 Jun 2023 16:47:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236764AbjFLUqz (ORCPT ); Mon, 12 Jun 2023 16:46:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BA202127 for ; Mon, 12 Jun 2023 13:46:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D954B62B2F for ; Mon, 12 Jun 2023 20:45:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43409C433A0; Mon, 12 Jun 2023 20:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686602716; bh=thHRx3gNkEts77+ULbTuRFI/XccuwcFtR++swDbxeA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IIyRNxNo1pgSe1Dn8b4snZ4lkloc99dpMH5LjxJD09XIZhMLinvsM6aCNqRkPudK9 iDAHvmG/6AKVDvCEEaoOihPjy7/15YbJKo4UJZPLk7qLz+EiR8cQPCqWNhs9VJNq+M DyC7HuB7mg4tENGb/XCHuiAB+yKXtEqsEZQWHFlX5zivcdMriGnVO38bKHjKAsLIx+ e79wp1RiRUOc06c36NOCJQ2nwemqKeTseG/dIYgsTkeYKnFuEGNW2iSm/HGVqP5Jbi a0JhheIZMYY77d+ZPR6ysl8Z43aBXyTMPusrR4QclpuA9gvqlDq7ydPOiWtvdQmID4 wFvHN6MFlWm0g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id B4267CE3A22; Mon, 12 Jun 2023 13:45:15 -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 , "Paul E . McKenney" Subject: [PATCH v2 nolibc 05/53] tools/nolibc: add wrapper for memfd_create Date: Mon, 12 Jun 2023 13:44:26 -0700 Message-Id: <20230612204514.292087-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <8b757cc0-3719-4e63-a755-9710384137bc@paulmck-laptop> References: <8b757cc0-3719-4e63-a755-9710384137bc@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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: Thomas Weißschuh This is useful for users and will also be used by a future testcase. Signed-off-by: Thomas Weißschuh Signed-off-by: Willy Tarreau Signed-off-by: Paul E. McKenney --- tools/include/nolibc/sys.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 5d624dc63a42..bea9760dbd16 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -1365,6 +1365,29 @@ ssize_t write(int fd, const void *buf, size_t count) return ret; } + +/* + * int memfd_create(const char *name, unsigned int flags); + */ + +static __attribute__((unused)) +int sys_memfd_create(const char *name, unsigned int flags) +{ + return my_syscall2(__NR_memfd_create, name, flags); +} + +static __attribute__((unused)) +int memfd_create(const char *name, unsigned int flags) +{ + ssize_t ret = sys_memfd_create(name, flags); + + if (ret < 0) { + SET_ERRNO(-ret); + ret = -1; + } + return ret; +} + /* make sure to include all global symbols */ #include "nolibc.h" -- 2.40.1