public inbox for [email protected]
 help / color / mirror / Atom feed
From: Hao Xu <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, Pavel Begunkov <[email protected]>
Subject: [PATCH 6/6] man/io_uring_prep_accept.3: add man info for multishot accept
Date: Sat, 14 May 2022 22:35:34 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

From: Hao Xu <[email protected]>

Add man info for multishot accept APIs, including non-direct and direct.

Signed-off-by: Hao Xu <[email protected]>
---
 man/io_uring_prep_accept.3                  | 51 +++++++++++++++++----
 man/io_uring_prep_multishot_accept.3        |  1 +
 man/io_uring_prep_multishot_accept_direct.3 |  1 +
 3 files changed, 44 insertions(+), 9 deletions(-)
 create mode 120000 man/io_uring_prep_multishot_accept.3
 create mode 120000 man/io_uring_prep_multishot_accept_direct.3

diff --git a/man/io_uring_prep_accept.3 b/man/io_uring_prep_accept.3
index 779bcd92fd2f..e52c13ee1288 100644
--- a/man/io_uring_prep_accept.3
+++ b/man/io_uring_prep_accept.3
@@ -18,11 +18,23 @@ io_uring_prep_accept  - prepare an accept request
 .BI "                          int " flags ");"
 .BI "
 .BI "void io_uring_prep_accept_direct(struct io_uring_sqe *" sqe ","
-.BI "                                int " sockfd ","
-.BI "                                struct sockaddr *" addr ","
-.BI "                                socklen_t " addrlen ","
-.BI "                                int " flags ","
-.BI "                                unsigned int " file_index ");"
+.BI "                                 int " sockfd ","
+.BI "                                 struct sockaddr *" addr ","
+.BI "                                 socklen_t " addrlen ","
+.BI "                                 int " flags ","
+.BI "                                 unsigned int " file_index ");"
+.BI "
+.BI "void io_uring_prep_multishot_accept(struct io_uring_sqe *" sqe ","
+.BI "                                    int " sockfd ","
+.BI "                                    struct sockaddr *" addr ","
+.BI "                                    socklen_t " addrlen ","
+.BI "                                    int " flags ");"
+.BI "
+.BI "void io_uring_prep_multishot_accept_direct(struct io_uring_sqe *" sqe ","
+.BI "                                           int " sockfd ","
+.BI "                                           struct sockaddr *" addr ","
+.BI "                                           socklen_t " addrlen ","
+.BI "                                           int " flags ");"
 .PP
 .SH DESCRIPTION
 .PP
@@ -72,6 +84,25 @@ CQE
 .I res
 return.
 
+For a direct descriptor accept request, the
+.I file_index
+argument can be set to
+.B IORING_FILE_INDEX_ALLOC
+In this case a free entry in io_uring file table will
+be used automatically and the file index will be returned as CQE
+.I res.
+.B -ENFILE
+is otherwise returned if there is no free entries in the io_uring file table.
+
+The multishot version accept and accept_direct perform a bit different with the
+normal ones. Users only need to issue one this kind of request to listen all
+the comming fds, each fd accepted is returned in a CQE. One thing to notice is
+io_uring_prep_multishot_accept_direct() only works in
+.B IORING_FILE_INDEX_ALLOC
+mode, which means the CQE
+.I res
+returned is a file index counted from 1 not a real fd.
+
 This function prepares an async
 .BR accept4 (2)
 request. See that man page for details.
@@ -81,12 +112,14 @@ None
 .SH ERRORS
 The CQE
 .I res
-field will contain the result of the operation. While the non-direct accept
-returns the installed file descriptor as its value, the direct accept
-returns
+field will contain the result of the operation. For singleshot accept,the
+non-direct accept returns the installed file descriptor as its value, the
+direct accept returns
 .B 0
 on success. The caller must know which direct descriptor was picked for this
-request. See the related man page for details on possible values for the
+request. For multishot accept, the non-direct accept returns the installed
+file descriptor as its value, the direct accept returns the file index used on
+success. See the related man page for details on possible values for the
 non-direct accept. Note that where synchronous system calls will return
 .B -1
 on failure and set
diff --git a/man/io_uring_prep_multishot_accept.3 b/man/io_uring_prep_multishot_accept.3
new file mode 120000
index 000000000000..0404bf59f71a
--- /dev/null
+++ b/man/io_uring_prep_multishot_accept.3
@@ -0,0 +1 @@
+io_uring_prep_accept.3
\ No newline at end of file
diff --git a/man/io_uring_prep_multishot_accept_direct.3 b/man/io_uring_prep_multishot_accept_direct.3
new file mode 120000
index 000000000000..0404bf59f71a
--- /dev/null
+++ b/man/io_uring_prep_multishot_accept_direct.3
@@ -0,0 +1 @@
+io_uring_prep_accept.3
\ No newline at end of file
-- 
2.36.0


  parent reply	other threads:[~2022-05-14 14:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-14 14:35 [PATCH liburing 0/6] liburing changes for multishot accept Hao Xu
2022-05-14 14:35 ` [PATCH 1/6] test/accept.c: close the listen fd at the end of the test Hao Xu
2022-05-14 14:35 ` [PATCH 2/6] liburing.h: support multishot accept Hao Xu
2022-05-14 14:35 ` [PATCH 3/6] liburing.h: add api to support multishot accept direct Hao Xu
2022-05-14 14:35 ` [PATCH 4/6] test/accept.c: add test for multishot mode accept Hao Xu
2022-05-14 14:35 ` [PATCH 5/6] test/accept.c: test for multishot direct accept with wrong arg Hao Xu
2022-05-14 14:35 ` Hao Xu [this message]
2022-05-14 15:32 ` [PATCH liburing 0/6] liburing changes for multishot accept Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox