io_uring_prep_connect(3)
β¨ io_uring_prep_connect β from the liburing manual, bestie edition β¨
okay so. sit down, grab your strawberry milk π, because we're talking about io_uring_prep_connect(3) β that's the liburing page, section 3, and she is so useful.
π NAME π
io_uring_prep_connect β get a connect request all prepped and ready to go π
π¦ SYNOPSIS π¦
#include <sys/types.h>
#include <sys/socket.h>
#include <liburing.h>
void io_uring_prep_connect(struct io_uring_sqe *sqe,
int sockfd,
const struct sockaddr *addr,
socklen_t addrlen);
like, literally copy that, don't freestyle it π
πΈ DESCRIPTION πΈ
so io_uring_prep_connect(3) does exactly what it says on the tin: it prepares a connect request. the submission queue entry sqe gets set up to use the file descriptor sockfd to start connecting to the destination described by the socket address at addr, and that structure's length is addrlen. simple. iconic. no notes. π
this function prepares an async connect(2) request β so if you want the deets on what connecting actually means, go read that man page, because that's where the lore lives. π
π RETURN VALUE π
None. that's it. nothing. void. she returns nothing because the whole vibe is "the result shows up in the CQE, babe." π
π ERRORS π
the CQE res field is gonna hold the result of the operation. what values could show up? check the related man page, bestie, that's where they're listed.
ok this part matters, don't skim it: normal synchronous system calls return-1on failure and seterrnoto the actual error value.io_uringNEVER useserrno. instead, it hands you the negated errno directly in theCQEresfield. so like, if you see a negative number in there, that's your error, and it's negative, and that's on purpose. no cap. π₯
π§ NOTES π§
okay so this is the part where we talk about lifetime, and it's giving "read this twice." π
as with any request that passes in data in a struct, that data must remain valid until the request has been successfully submitted. it does not need to remain valid until completion. once a request has been submitted, the in-kernel state is stable β periodt. β¨
but listen: very early kernels (5.4 and earlier) were extra and required that state to stay stable until the completion occurred. π if you wanna know which world you're living in, apps can test for this behavior by inspecting theIORING_FEAT_SUBMIT_STABLEflag passed back fromio_uring_queue_init_params(3).
π SEE ALSO π
and that's the whole page, you ate it, you're welcome π«Ά
liburing-2.2 Β· March 13, 2022 Β· mwah, love u, go submit some SQEs ππ¦β¨
π¦ where this page comes from
- alpine 3.22: liburing-doc 2.9-r0 Β· LGPL-2.1-or-later OR MIT
- alpine 3.23: liburing-doc 2.12-r0 Β· LGPL-2.1-or-later OR MIT
- alpine 3.24: liburing-doc 2.14-r0 Β· LGPL-2.1-or-later OR MIT
- arch rolling: liburing 2.15-1 Β· GPL-2.0-only WITH Linux-syscall-note OR MIT AND LGPL-2.0-or-later AND MIT
- centos-stream 10: liburing-devel 2.12-1.el10 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- centos-stream 9: liburing-devel 2.12-1.el9 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- centos-stream 9: liburing-devel 2.12-1.el9 Β· (GPLv2 with exceptions and LGPLv2+) or MIT
- debian bookworm: liburing-dev 2.3-3
- debian trixie: liburing-dev 2.9-1
- fedora 43: liburing-devel 2.9-2.fc43 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 43: liburing-devel 2.9-2.fc43 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 44: liburing-devel 2.13-2.fc44 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- fedora 44: liburing-devel 2.13-2.fc44 Β· (GPL-2.0-only WITH Linux-syscall-note OR MIT) AND (LGPL-2.0-or-later OR MIT)
- nixpkgs unstable: liburing 2.14
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- opensuse-leap 16.0: liburing-devel 2.8-160000.3.1 Β· (GPL-2.0-only AND LGPL-2.1-or-later) OR MIT
- ubuntu noble: liburing-dev 2.5-1build1
- ubuntu questing: liburing-dev 2.11-1
- ubuntu resolute: liburing-dev 2.14-1
- ubuntu stonking: liburing-dev 2.15-1
- π the page's license: LGPL-2.0-or-later
- Copyright (C) 2022 Jens Axboe <axboe@kernel.dk>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms