Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3355351rwl; Sun, 2 Apr 2023 06:03:55 -0700 (PDT) X-Google-Smtp-Source: AKy350b7/ctiOCbRroBotu/MZ9LFazwEWa85dwbhdPHNgZqKMRhKAQPbpQ5c1e5eUXtfgF/6nb58 X-Received: by 2002:aa7:d806:0:b0:501:d43e:d1e6 with SMTP id v6-20020aa7d806000000b00501d43ed1e6mr31910404edq.4.1680440635555; Sun, 02 Apr 2023 06:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680440635; cv=none; d=google.com; s=arc-20160816; b=1JXpylD2TN/D67UkQOUg2yallgdfq7rpugFgNA0ocvOjk3etFySMz/NKxuefVj7qhY fWFtCofEuJKEdTOHif/nHM7ZDtsiTcQnx7izSKX2fwrlM+kq+dG4stuub4i110S4utwZ Rpk7FAPooBwatcw7yV97WMUGxa49oB4ONrn7SI9cUCD6mT7eqcpDYdsUyWjUtuIOW/pR 24/YwCFkBmJcvYhNE9p1SU9KWz351GBVUn7doxQGArExUybvw9pl0Lb2+dMb29ttak2D AOrSxKPZsd78iRnpI+DUi5DLAOyi+ZkypYHwSgrBhaBB0etDUUvYzAY+yqjOzJaOhZFG 3GIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:dkim-signature :from; bh=Tn92QrYrO30FJIGvcj7KKlVx9kMcoU0T+e1tbWXUs+A=; b=EXfKU3zL9LrHdFdc8BNZSMjHFn7CsTrjE60IlXZ3reD8PCPzpX0DqBA8eSyE8iOXXD c3oxnFlqJt/yzf+DLTAdv21DCLmocfDt/kpcBCDVPUOt5CYQ1n3fRuZqG2FR90wMS5ev mZqeBPP7P0BhLjuAX1naF4Cwkel5jUp43Wj2OjBtHLaf45Am7xbdLlTbd+9KIGQ/cQBr C+JkG4SRUGER6EsXSNXzzkoSpndC2R73eJArtQpiM7Y7VyMpFfkV0k1y1JQq8jOKa59Z uKY/mG6phrbWJmOSrehu8RbFEZEEzP26MUE7jTMlaizL0sJfyaGb9+1zyTr4BiJfokd9 0lYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b="pqdHX2/y"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020aa7cc07000000b004fd298a62b6si573021edt.458.2023.04.02.06.03.25; Sun, 02 Apr 2023 06:03:55 -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=@weissschuh.net header.s=mail header.b="pqdHX2/y"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbjDBNC5 (ORCPT + 99 others); Sun, 2 Apr 2023 09:02:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbjDBNCx (ORCPT ); Sun, 2 Apr 2023 09:02:53 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D8E811151; Sun, 2 Apr 2023 06:02:52 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1680440570; bh=WpL7AHZ/RVZDepQeqXUZNCLzamt9+Jfw6eToN9dbdkk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=pqdHX2/ysrjGil1F8CJvU3kSvvN0g51gBI/jMf8KQ4eq3O07Q8BlWw5rQbWTK1s5M 3mAp4bMylFffDG/R2qBr/qyl+k4BxdsIPiizR1qawC3fxjPIWrmYdmz+Kef8gdziqB +N8jnnbecQC/IkFE2c1eKXoNQDh/T0qFoBwromJQ= Date: Sun, 02 Apr 2023 13:02:45 +0000 Subject: [PATCH v2 1/3] tools/nolibc: add wrapper for memfd_create MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230328-nolibc-printf-test-v2-1-f72bdf210190@weissschuh.net> References: <20230328-nolibc-printf-test-v2-0-f72bdf210190@weissschuh.net> In-Reply-To: <20230328-nolibc-printf-test-v2-0-f72bdf210190@weissschuh.net> To: Willy Tarreau , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1680440570; l=1058; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=WpL7AHZ/RVZDepQeqXUZNCLzamt9+Jfw6eToN9dbdkk=; b=fZuToNS5fW3RpPlq3PQshf/DvtoGs9y00jV2XPNuT/mGd1z22og9U2HDGMtjzWtGJ6g3OOfdY DdkW1Gy8q4WDjOB5w5x31JvvBmMvRSbTf+Ks9TVWkkiFA1yUAoF/WXp X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is useful for users and will also be used by a future testcase. Signed-off-by: Thomas Weißschuh --- 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.0