Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3638764rwl; Sun, 2 Apr 2023 11:49:20 -0700 (PDT) X-Google-Smtp-Source: AKy350aiOzJ8JbUXwQZdr0aHcZZIkSbHotrx3RSnaEnZ8mnSxEJ0res/K4D82Pjm/lC3tSfE4fJD X-Received: by 2002:a62:84c4:0:b0:628:134b:6b1c with SMTP id k187-20020a6284c4000000b00628134b6b1cmr37512034pfd.2.1680461360487; Sun, 02 Apr 2023 11:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680461360; cv=none; d=google.com; s=arc-20160816; b=IrI90oWslbLMJmhXUAkylcLh/Oqk+dawJOjUN2kOV9wtlc6XiVgTIaTZRuNGidBUmk 4OkWuw+2/tRvuBEG90x880fsmJNXhpMUtKBKf8czPujERr4NSuGlCF1VH6H4Vtikm5HP GCPAQVR0ZChVdqnUf2TIbZX5IwG9WnKfyn/t99y7ZX7unEMkgVAn3XUncINrvJjeRSo3 5pAi7Ys3TVSZtr0PnjMiaX0jfR1r/HowXDOJwPc6oWrQUe/TlZjKTXkep/Q91SP7uUnL 6c8eh6z6bIMcQAELR+xgSm6VJDYPGn1c7IHjr084cZ2KLjzQVxPLESVwI4VM1JJLRt8e 3DUw== 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; bh=Gjg9w/IRJe2c2K/55wm66sl0kW92YJGVChH0iooKkQc=; b=Ke1OJGbCTfPM3tudGj+gcSa0smhs4SkgAm9VpyYSVQJoVS9ATG8uZkMhmQt9jhK9Wq Rd6IZ2WaUxugWtp8b0IdDURvR9JpnDF2Te7MsDhUAhd2LAiTwynw0qXqfVBbh4pXIyEP 1uhfbhreEmZZrTp6Hi6LkhulazDQgNRIAboWBsEnYoufqoWilzzl6EkkQP3zV8SDN3IF qWWG/6h2y1Nna2RQUVdK300V2rKeE1dQRzq+4ygvscJ+zI8ApFuSpSwfviNx6YIKPWNT 3i90JLCi/Z6j4QNghJO1dTjRT11RDIVrA15+HdqZJLFGbgnPyWaiVV8/iUTztVIorWTG 3Hkg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020aa797a9000000b00627f807ef24si6745805pfq.31.2023.04.02.11.49.10; Sun, 02 Apr 2023 11:49:20 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbjDBSsb (ORCPT + 99 others); Sun, 2 Apr 2023 14:48:31 -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: 8bit X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,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 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 --- 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.17.5