From nobody Wed Feb 11 04:26:25 2026 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 36833C76196 for ; Sun, 2 Apr 2023 18:48:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231203AbjDBSsc (ORCPT ); Sun, 2 Apr 2023 14:48:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbjDBSs2 (ORCPT ); Sun, 2 Apr 2023 14:48:28 -0400 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 793128697 for ; Sun, 2 Apr 2023 11:48:25 -0700 (PDT) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 332ImDKD012488; Sun, 2 Apr 2023 20:48:13 +0200 From: Willy Tarreau To: "Paul E. McKenney" Cc: linux@weissschuh.net, linux-kernel@vger.kernel.org, Willy Tarreau Subject: [PATCH 2/4] tools/nolibc: add wrapper for memfd_create Date: Sun, 2 Apr 2023 20:48:04 +0200 Message-Id: <20230402184806.12440-3-w@1wt.eu> X-Mailer: git-send-email 2.17.5 In-Reply-To: <20230402184806.12440-1-w@1wt.eu> References: <20230402184806.12440-1-w@1wt.eu> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Wei=C3=9Fschuh This is useful for users and will also be used by a future testcase. Signed-off-by: Thomas Wei=C3=9Fschuh Signed-off-by: Willy Tarreau --- 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; } =20 + +/* + * 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 =3D sys_memfd_create(name, flags); + + if (ret < 0) { + SET_ERRNO(-ret); + ret =3D -1; + } + return ret; +} + /* make sure to include all global symbols */ #include "nolibc.h" =20 --=20 2.17.5