Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1130437rwd; Thu, 18 May 2023 08:18:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ya5R5o3cOtm09F6R9ZCuxfKcMrPy/3WQX48sZOGjtN+qdrKIi0BEa6onAtVxIiU/zkAWR X-Received: by 2002:a17:902:f683:b0:1ac:8148:8c3e with SMTP id l3-20020a170902f68300b001ac81488c3emr3086266plg.32.1684423093455; Thu, 18 May 2023 08:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684423093; cv=none; d=google.com; s=arc-20160816; b=WVlvuozNPwVoATYrK87BOwlMRcPOYfeeHRNuDG4HdlGlG9/FDEjwQK8m7AR6hVqQBm rIXxHkqfbOgvoZMHz/bS6o7KcSRYRm8EaTh5AP+/0IO6mSG3qPsgoxjbZeRW5P40lzyu hZTAxcLRi4LHu0E8JPLHGQ2QqzV+rgZRl3WJ9bqU+jwiLV/Ed3vu/yIg72BYQf+zlfW/ a7PvoJ/+6Yd5u+eqPQa2KmlPP/psVhlZveB3HaUOLb5w/kyCxJC2AQtrZ9i5SEwT6Xwg jl1jsItySvV/HwpL+IXZlsgycEg8JTn86n7zL28jbG0hfVWJWx8D46si1GvPsTtaIsps onMw== 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=zv8eGXjnZB4TxSksT483Dz6+eqCufp1q7tIqpt4+8i96mqWuhYujcWoF0eMPI4bzH5 agpMeQkHuzOzlfwGh9gHV+ndGqLka6vEqFqc04CQD9JEl5O2vZQkLNYZD9oL+mVuDT0+ e/KGe+AXpiZgoiWSg6MAF5+IiCfiMFUjGw/gy1jfEB1OXN2HXfDKWTHei1/3rtqffmrv QFxoqjX53L8Ku868fe5N8E/4Eo3asjo7fB4aPcM/LtWKuHL6TMB0KY1jhLS/oaNCIwK8 GFGBiUNwzJ53idVnBjwIRh4kil7aaGWiP9f0HX+ct2AOOPm7jcY1f2XPG5FjozW0yP2v WNgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Yi97IyUO; 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 g7-20020a1709029f8700b0019b090e497esi1459919plq.298.2023.05.18.08.17.51; Thu, 18 May 2023 08:18:13 -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=Yi97IyUO; 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 S231778AbjEROzf (ORCPT + 99 others); Thu, 18 May 2023 10:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231682AbjEROz1 (ORCPT ); Thu, 18 May 2023 10:55:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E8B511C for ; Thu, 18 May 2023 07:55:25 -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 4677864FDD for ; Thu, 18 May 2023 14:55:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A389BC433A0; Thu, 18 May 2023 14:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684421723; bh=thHRx3gNkEts77+ULbTuRFI/XccuwcFtR++swDbxeA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yi97IyUOiY4TyB3fpkgKDrTS8C61Xq4cyxFiiHwQEzsgx2xPDBx9Nlazo90NGOEMf t7MFxBbAzfgDyDRh6uJSIlXUIqNpJhmYInJbpo4nzG2B8aORp1aI9NPoRh96enmIau 6O/Kmfi0scb92UQCI5mf2M+FFm98EUCPNBqf9ZLejykKbgZczaZzFhwPwDl5HKWn1m stwvM2hHDgnSPtoOQS9u4UBNf7E6inTAc6gkFDU45Ci+RzjUiq2qEnYsB2if0QqqBU qft+LAcMRujpjyfBR5PtP+XsRzZ8lBDPqbgW6vSQ7ZTigIoBfMPtK7YAMFvphWbFi3 2PZNMfh2x5pEA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 1CB62CE107D; Thu, 18 May 2023 07:55:23 -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/15] tools/nolibc: add wrapper for memfd_create Date: Thu, 18 May 2023 07:55:11 -0700 Message-Id: <20230518145521.3806117-5-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <4817a4dc-69e6-4937-84d5-f2f630ff646c@paulmck-laptop> References: <4817a4dc-69e6-4937-84d5-f2f630ff646c@paulmck-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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