io_uring_submit(3)

πŸ“¦
version 2.15 Β· 3 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 Β· ubuntu noble
  • 2.3 Β· debian bookworm
, 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 β€” bestie edition πŸ’–

okay so real quick, this is a page from the liburing Manual and it's all about io_uring_submit(3), aka the moment you finally stop prepping and actually send your requests. let's get into it 🫢


✨ NAME ✨

io_uring_submit β€” submit requests to the submission queue. that's the whole job. that's the vibe. πŸ’…


🌸 SYNOPSIS 🌸

#include <liburing.h>

int io_uring_submit(struct io_uring *ring);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. io_uring_submit(3) submits the next events to the submission queue belonging to the ring. that's it, that's the function. πŸŽ€

the way it works is: you (the caller) grab a submission queue entry (SQE) with io_uring_get_sqe(3), then you prep that SQE using one of the provided helpers, and then you hit it with io_uring_submit(3). prep, prep, prep, submit. iconic pipeline honestly. ✨


πŸ‘‘ RETURN VALUE πŸ‘‘

on success, io_uring_submit(3) returns the number of submitted submission queue entries β€” that's the case if SQPOLL is not used.

⚠️ now if SQPOLL is used, plot twist: the return value may report a higher number of submitted entries than were actually submitted. so it can lowkey lie to you. 😭

if you're using SQPOLL and you genuinely need accurate info about how many submission queue entries have been successfully submitted, you gotta fall back to repeatedly submitting a single submission queue entry. one at a time. no shortcuts. πŸ’€

and on failure? it returns -errno. periodt.


πŸ’œ NOTES πŸ’œ

big one, bestie, listen up: for 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. 🧚

but VERY early kernels (5.4 and earlier) required state to be stable until the completion occurred. ancient behavior, we don't claim her. πŸ’€

wanna know which one you're dealing with? applications can test for this behavior by inspecting the IORING_FEAT_SUBMIT_STABLE flag, which gets passed back from io_uring_queue_init_params(3). 🏁

and in general, the man pages for the individual prep helpers will have a note mentioning this fact too, if it's required for the given command. so like, always check the helper's own page before you assume. iykyk. πŸ‘‘


🌈 SEE ALSO 🌈


that's the whole page babes!! this one came from liburing-2.1, dated November 15, 2021 β€” go submit some requests, you absolute main character πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from