Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3714616rwe; Mon, 29 Aug 2022 18:39:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR6xikD3OasyqsTdQfkrQekB2H1+IheP/ww7muq2mKK3ciaos8a13sWs4Wpl7IEFdNZp6HxW X-Received: by 2002:a17:907:6d05:b0:73d:8092:91ea with SMTP id sa5-20020a1709076d0500b0073d809291eamr15226240ejc.280.1661823556588; Mon, 29 Aug 2022 18:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661823556; cv=none; d=google.com; s=arc-20160816; b=rK7GFarqpjh0ROhF//IwmSJd/ySM54Q36b4PTift6DdipX/a0RB4juQiLcOI/wNkbQ FTzXmMzlJRc4C0MO71FpuZOeS3wWIOdxLAjzdEmRO90DGW5J9KSDYJfTvE29uK1SNCPe veNe4qle6fFn2cKAMeEdlqrHZbcY8wO0rnBowX6b1WtTvaiF7XIPFZoRjrheeYYWU0HQ hMG1kHuIBbf30zfKpkq5707yDDX3Vyy5JIKmchpUM1Nn6TPTs5R/sjh65v7BC36afm/7 z01BE5Tdz9ykbKcFpP7llyHhXWvTQJMMq9eC75ZLKfGzkWj3vq9ikwbj33YruJ8Gy+kv pLCA== 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=0JbLfSVdzarkgX6QV4OaElZlX9nEnmfbAUgjEiG1RJ8=; b=E1oMb1BOZLsBPuHqVyBWygdCD3gvtJjaI4zRNq/xzujVAQHXYRc2qtTsuXQSKDC0nm Gqp6q9gmLor+7Ebo+aEsmbnsshNGdyV8MUueqLR8r7hZ6nH9mi2vPuI1mw2b5SEpKoeJ PKpDU9G5ZBAebo+4GPlf4TFSxZe2L2od7DRYFDSPSRBdkFDyLtIGQ7Q0fn4JcckbPT7O 0pAkO19N9Vm3bnPZZEnMoW79MWNo62G+48HdzBGITl1r9KldHtn8b+ijiKr63kEFuWbP EscKPPAkuT59PkonvBHGMledEpSS/ReCE5yqnuKea2wzTLT6POMXei7uGWSfv6AkOzvg 4lEQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lx16-20020a170906af1000b0072af12dbfafsi6586042ejb.941.2022.08.29.18.38.45; Mon, 29 Aug 2022 18:39:16 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gnuweeb.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229476AbiH3A5I (ORCPT + 99 others); Mon, 29 Aug 2022 20:57:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbiH3A5B (ORCPT ); Mon, 29 Aug 2022 20:57:01 -0400 Received: from linux.gnuweeb.org (gnuweeb.org [51.81.211.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 098D0883EF; Mon, 29 Aug 2022 17:56:58 -0700 (PDT) Received: from localhost.localdomain (unknown [68.183.184.174]) by linux.gnuweeb.org (Postfix) with ESMTPSA id 5BB45374EC4; Tue, 30 Aug 2022 00:56:55 +0000 (UTC) From: Ammar Faizi To: Jens Axboe Cc: Ammar Faizi , Caleb Sander , Muhammad Rizki , Kanna Scarlet , io-uring Mailing List , Linux Kernel Mailing List , GNU/Weeb Mailing List Subject: [PATCH liburing v2 2/7] syscall: Add io_uring syscall functions Date: Tue, 30 Aug 2022 07:56:38 +0700 Message-Id: <20220830005122.885209-3-ammar.faizi@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220830005122.885209-1-ammar.faizi@intel.com> References: <20220830005122.885209-1-ammar.faizi@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, 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: Ammar Faizi We have: man 2 io_uring_setup; man 2 io_uring_enter; man 2 io_uring_register; Those entries say that io_uring syscall functions are declared in ``. But they don't actually exist and never existed. This is causing confusion for people who read the manpage. Let's just implement them in liburing so they exist. This also allows the user to invoke io_uring syscalls directly instead of using the full liburing provided setup. v2: - Use consistent argument types. - Separate syscall declarations in liburing.h with a blank line. - Remove unused include in syscall.c. Link: https://github.com/axboe/liburing/pull/646#issuecomment-1229639532 Reviewed-by: Caleb Sander Signed-off-by: Ammar Faizi --- src/Makefile | 2 +- src/include/liburing.h | 12 ++++++++++++ src/liburing.map | 4 ++++ src/syscall.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/syscall.c diff --git a/src/Makefile b/src/Makefile index dad379d..73a98ba 100644 --- a/src/Makefile +++ b/src/Makefile @@ -32,7 +32,7 @@ endif all: $(all_targets) -liburing_srcs := setup.c queue.c register.c +liburing_srcs := setup.c queue.c register.c syscall.c ifeq ($(CONFIG_NOLIBC),y) liburing_srcs += nolibc.c diff --git a/src/include/liburing.h b/src/include/liburing.h index 66c5095..6e86847 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -203,6 +203,18 @@ int io_uring_register_notifications(struct io_uring *ring, unsigned nr, struct io_uring_notification_slot *slots); int io_uring_unregister_notifications(struct io_uring *ring); +/* + * io_uring syscalls. + */ +int io_uring_enter(unsigned int fd, unsigned int to_submit, + unsigned int min_complete, unsigned int flags, sigset_t *sig); +int io_uring_enter2(unsigned int fd, unsigned int to_submit, + unsigned int min_complete, unsigned int flags, + sigset_t *sig, size_t sz); +int io_uring_setup(unsigned int entries, struct io_uring_params *p); +int io_uring_register(unsigned int fd, unsigned int opcode, const void *arg, + unsigned int nr_args); + /* * Helper for the peek/wait single cqe functions. Exported because of that, * but probably shouldn't be used directly in an application. diff --git a/src/liburing.map b/src/liburing.map index 7d8f143..8573dfc 100644 --- a/src/liburing.map +++ b/src/liburing.map @@ -62,4 +62,8 @@ LIBURING_2.3 { io_uring_register_file_alloc_range; io_uring_register_notifications; io_uring_unregister_notifications; + io_uring_enter; + io_uring_enter2; + io_uring_setup; + io_uring_register; } LIBURING_2.2; diff --git a/src/syscall.c b/src/syscall.c new file mode 100644 index 0000000..2054d17 --- /dev/null +++ b/src/syscall.c @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: MIT */ + +#include "syscall.h" +#include + +int io_uring_enter(unsigned int fd, unsigned int to_submit, + unsigned int min_complete, unsigned int flags, sigset_t *sig) +{ + return __sys_io_uring_enter(fd, to_submit, min_complete, flags, sig); +} + +int io_uring_enter2(unsigned int fd, unsigned int to_submit, + unsigned int min_complete, unsigned int flags, + sigset_t *sig, size_t sz) +{ + return __sys_io_uring_enter2(fd, to_submit, min_complete, flags, sig, + sz); +} + +int io_uring_setup(unsigned int entries, struct io_uring_params *p) +{ + return __sys_io_uring_setup(entries, p); +} + +int io_uring_register(unsigned int fd, unsigned int opcode, const void *arg, + unsigned int nr_args) +{ + return __sys_io_uring_register(fd, opcode, arg, nr_args); +} -- Ammar Faizi