public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@suse.de>
To: axboe@kernel.dk
Cc: io-uring@vger.kernel.org, Gabriel Krisman Bertazi <krisman@suse.de>
Subject: [PATCH liburing] io_uring_prep_cmd_getsockname.3: Deduplicate manpage
Date: Mon, 26 Jan 2026 20:50:17 -0500	[thread overview]
Message-ID: <20260127015017.2919925-1-krisman@suse.de> (raw)

I committed the op_getsockname man page under the wrong name, because I
originally wrote the code and manpage as a main io_uring command and then
converted to a uring_cmd but forgot to update the manpage.  Following
this, Jens pushed an AI generated version of this page with the correct
name and almost the same content.

While the AI version is okay-ish, it is missing relevant details, like
differences in error codes to the original syscall.  So I'm replacing
the AI with my version, minus a few corrections. There is no point in
lingering the wrong named version around, as there is no function
with that name.

Reported by exbigboss on Discord.

Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
 man/io_uring_prep_cmd_getsockname.3 | 75 ++++++++++++++++-----------
 man/io_uring_prep_getsockname.3     | 78 -----------------------------
 2 files changed, 47 insertions(+), 106 deletions(-)
 delete mode 100644 man/io_uring_prep_getsockname.3

diff --git a/man/io_uring_prep_cmd_getsockname.3 b/man/io_uring_prep_cmd_getsockname.3
index 060ff4a7..221b49dc 100644
--- a/man/io_uring_prep_cmd_getsockname.3
+++ b/man/io_uring_prep_cmd_getsockname.3
@@ -1,12 +1,14 @@
+.\" Copyright (C) 2025 SUSE LLC.
 .\" Copyright (C) 2025 Jens Axboe <axboe@kernel.dk>
 .\"
 .\" SPDX-License-Identifier: LGPL-2.0-or-later
 .\"
-.TH io_uring_prep_cmd_getsockname 3 "January 18, 2025" "liburing-2.13" "liburing Manual"
+.TH io_uring_prep_cmd_getsockname 3 "December 3, 2025" "liburing-2.13" "liburing Manual"
 .SH NAME
 io_uring_prep_cmd_getsockname \- prepare a getsockname or getpeername request
 .SH SYNOPSIS
 .nf
+.B #include <sys/socket.h>
 .B #include <liburing.h>
 .PP
 .BI "void io_uring_prep_cmd_getsockname(struct io_uring_sqe *" sqe ","
@@ -16,45 +18,62 @@ io_uring_prep_cmd_getsockname \- prepare a getsockname or getpeername request
 .BI "                                   int " peer ");"
 .fi
 .SH DESCRIPTION
-.PP
 The
 .BR io_uring_prep_cmd_getsockname (3)
-function prepares a socket command request to get the socket address. The
-submission queue entry
+function prepares a getsockname/getpeername request.
+The submission queue entry
 .I sqe
-is setup to use the socket indicated by the file descriptor
-.IR fd .
-
-The
-.I sockaddr
-argument points to a buffer where the address will be stored. The
-.I sockaddr_len
-argument points to the length of the buffer, which will be updated with
-the actual length of the address on completion.
+is setup to fetch the locally bound address or peer address of the socket
+file descriptor pointed by
+.IR sockfd .
+The parameter
+.IR sockaddr
+points to a region of size
+.IR sockaddr_len
+where the output is written.
+.IR sockaddr_len
+is modified by the kernel on return  to indicate how many bytes were written.
+The output address is the locally bound address if
+.IR peer
+is set to
+.B 0
+or the peer address if
+.IR peer
+is set to
+.BR 1 .
 
-If
-.I peer
-is 0, this operates like
-.BR getsockname (2),
-returning the local address bound to the socket. If
-.I peer
-is non-zero, this operates like
-.BR getpeername (2),
-returning the address of the peer connected to the socket.
+This function prepares an async
+.BR getsockname (2)
+or
+.BR getpeername (2)
+request. See those man pages for details.
 
 .SH RETURN VALUE
 None
 .SH ERRORS
 The CQE
 .I res
-field will contain the result of the operation. See
-.BR getsockname (2)
-or
-.BR getpeername (2)
-for possible error values.
+field will contain the result of the operation. See the related man page for
+details on possible values. Note that where synchronous system calls will return
+.B -1
+on failure and set
+.I errno
+to the actual error value, io_uring never uses
+.IR errno .
+Instead it returns the negated
+.I errno
+directly in the CQE
+.I res
+field.
+.BR
+Differently from the equivalent system calls, if the user attempts to
+use this operation on a non-socket file descriptor, the CQE error result
+is
+.IR ENOTSUP
+instead of
+.IR ENOSOCK.
 .SH SEE ALSO
 .BR io_uring_get_sqe (3),
 .BR io_uring_submit (3),
-.BR io_uring_prep_getsockname (3),
 .BR getsockname (2),
 .BR getpeername (2)
diff --git a/man/io_uring_prep_getsockname.3 b/man/io_uring_prep_getsockname.3
deleted file mode 100644
index de78cb40..00000000
--- a/man/io_uring_prep_getsockname.3
+++ /dev/null
@@ -1,78 +0,0 @@
-.\" Copyright (C) 2024 SUSE LLC.
-.\"
-.\" SPDX-License-Identifier: LGPL-2.0-or-later
-.\"
-.TH io_uring_prep_getsockname 3 "Dec 3, 2025" "liburing-2.13" "liburing Manual"
-.SH NAME
-io_uring_prep_getsockname \- prepare a getsockname or getpeername request
-.SH SYNOPSIS
-.nf
-.B #include <sys/socket.h>
-.B #include <liburing.h>
-.PP
-.BI "void io_uring_prep_getsockname(struct io_uring_sqe *" sqe ","
-.BI "                               int " sockfd ","
-.BI "                               struct sockaddr *" sockaddr ","
-.BI "                               socklen_t *" sockaddr_len ","
-.BI "                               int " peer ");"
-.fi
-.SH DESCRIPTION
-The
-.BR io_uring_prep_getsockname (3)
-function prepares a getsockname/getpeername request.
-The submission queue entry
-.I sqe
-is setup to fetch the locally bound address or peer address of the socket
-file descriptor pointed by
-.IR sockfd .
-The parameter
-.IR sockaddr
-points to a region of size
-.IR sockaddr_len
-where the output is written.
-.IR sockaddr_len
-is modified by the kernel to indicate how many bytes were written.
-The output address is the locally bound address if
-.IR peer
-is set to
-.B 0
-or the peer address if
-.IR peer
-is set to
-.BR 1 .
-
-This function prepares an async
-.BR getsockname (2)
-or
-.BR getpeername (2)
-request. See those man pages for details.
-
-.SH RETURN VALUE
-None
-.SH ERRORS
-The CQE
-.I res
-field will contain the result of the operation. See the related man page for
-details on possible values. Note that where synchronous system calls will return
-.B -1
-on failure and set
-.I errno
-to the actual error value, io_uring never uses
-.IR errno .
-Instead it returns the negated
-.I errno
-directly in the CQE
-.I res
-field.
-.BR
-Differently from the equivalent system calls, if the user attempts to
-use this operation on a non-socket file descriptor, the CQE error result
-is
-.IR -ENOTSUP
-instead of
-.IR ENOSOCK.
-.SH SEE ALSO
-.BR io_uring_get_sqe (3),
-.BR io_uring_submit (3),
-.BR io_uring_prep_getsockname (2)
-.BR io_uring_prep_getpeername (2)
-- 
2.52.0


             reply	other threads:[~2026-01-27  1:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-27  1:50 Gabriel Krisman Bertazi [this message]
2026-01-27  1:56 ` [PATCH liburing] io_uring_prep_cmd_getsockname.3: Deduplicate manpage 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 \
    --in-reply-to=20260127015017.2919925-1-krisman@suse.de \
    --to=krisman@suse.de \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    /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