io_uring_submit_and_wait(3)

πŸ“¦
version 2.15 Β· 2 versions
  • 2.15 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 2.5 Β· debian bookworm, ubuntu noble
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ io_uring_submit_and_wait(3) ✨

okay bestie, welcome to liburing's manual pages, you're gonna slay this 🫢


🌸 NAME 🌸

io_uring_submit_and_wait β€” drop your requests into the submission queue and hang around for the completion, all in one go πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <liburing.h>

int io_uring_submit_and_wait(struct io_uring *ring,
                             unsigned wait_nr);

πŸ¦‹ DESCRIPTION πŸ¦‹

so, io_uring_submit_and_wait(3) does exactly what it says on the tin, no cap: it submits the next requests sitting in the submission queue of the ring you pass in, and then it waits for wait_nr completion events. two jobs, one function call, iconic behaviour honestly.

the flow is like this: first you grab a submission queue entry (an SQE) with io_uring_get_sqe(3), you prep it however you need it, and then you ship it off with io_uring_submit_and_wait(3). that's the whole vibe ✨

πŸ’– pro move: this thing is ideally used with a ring that was set up with IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_DEFER_TASKRUN, because that combo greatly reduces the number of context switches your application will see when it's waiting on a bunch of requests at once. fewer context switches = happier app, periodt.

πŸ‘‘ RETURN VALUE πŸ‘‘

  • on success, io_uring_submit_and_wait(3) returns the number of submitted submission queue entries πŸŽ‰
  • on failure, it returns -errno 😭

πŸ”₯ SEE ALSO πŸ”₯


and that's the tea πŸ“ this page is from liburing-2.1, dated November 15, 2021, and it lives in the liburing manual. go forth and submit responsibly, bestie πŸ’œπŸ§š

πŸ“¦ where this page comes from