io_uring_register_query(3)
π io_uring_register_query β your lil' feature-detector bestie π
okay so this is a page from the liburing Manual (yes, the manual, but make it cute) and it's all about io_uring_register_query(3), aka the function that lets you ask the kernel what it can do before you commit to anything. it's giving "let me check ur vibe first" energy and honestly? we love that for us. π¦
β¨ NAME β¨
io_uring_register_query β query io_uring capabilities and feature support π
ngl the name is literally the whole job: you're querying what io_uring supports. that's it. that's the gig. π
πΈ SYNOPSIS πΈ
#include <liburing.h>
int io_uring_register_query(struct io_uring_query_hdr *query);
one function, one pointer, zero drama. slay. β¨
π DESCRIPTION π
so, bestie, io_uring_register_query(3) is the function that goes "hey kernel, whatcha got?" and comes back with the receipts. it hands you info about supported opcodes, flags, and subsystem-specific capabilities. no cap, it's your pre-flight check. π₯
the query argument has to point to a struct io_uring_query_hdr structure, and that struct is what tells the kernel what you wanna know. here's the whole thing, verbatim, iconic:
struct io_uring_query_hdr {
__u64 next_entry;
__u64 query_data;
__u32 query_op;
__u32 size;
__s32 result;
__u32 __resv[3];
};
let's break down every single field because we are thorough in this house:
next_entryβ this is your chain-maker π«Ά. it can point to the nextstruct io_uring_query_hdrstructure, or you set it to0if this is the last entry in the chain. one query to rule them all, or a whole conga line β your call.query_dataβ must point to a data structure that actually matches the query type you put inquery_op. wrong struct here = wrong vibes, so match them up. π§query_opβ the field that says which query you're doing. and it can be one of these three beauties:IO_URING_QUERY_OPCODESβ returns info about supported opcodes and flags π«. yourquery_datafield must point to astruct io_uring_query_opcodestructure, and it'll get filled in with info about supported request opcodes, register opcodes, feature flags, setup flags, enter flags, and SQE flags. it's the full buffet, fr fr.IO_URING_QUERY_ZCRXβ returns info about zero-copy receive support π. yourquery_datafield must point to astruct io_uring_query_zcrxstructure, and it gets filled with info about supported zero-copy receive flags, features, and configuration details.IO_URING_QUERY_SCQβ returns info about the SQ/CQ ring layout π. yourquery_datafield must point to astruct io_uring_query_scqstructure, and it gets filled with info about ring header size and alignment requirements.
sizeβ set this to the size of the data structure thatquery_datapoints to. yes, the kernel wants to know how big the thing is. be honest with it. πresultβ upon return, this is where the answer lands:0on success, or a negative error code on failure π. check it. always.__resvβ the reserved fields. they must be cleared to zero. no sneaky little values in there, bestie, that's the rule. π«
β RETURN VALUE β
returns 0 on success π
. on error, it returns a negative errno value. so if your number is less than zero, something went sideways and that's your sign to look at it.
π NOTES π
- this function is available since Linux kernel 6.15 π± (so if you're on something older, it's simply not gonna happen, and that's not a skill issue, it's a kernel issue).
- you can do multiple queries efficiently in a single system call by chaining them together using the
next_entryfield π. one syscall, many questions, maximum efficiency. main character energy, genuinely.
π SEE ALSO π
ok real talk: if result comes back negative, do NOT just ignore it and keep vibing. read the errno. the kernel is telling you something and it's not being subtle. π
and that's the whole page, bestie!! this one's from liburing-2.15, dated March 26, 2026 π β go forth, chain ur queries, respect ur __resv fields, and always, always check that result. mwah π«Άβ¨
π¦ where this page comes from
- arch rolling: liburing 2.15-1 Β· GPL-2.0-only WITH Linux-syscall-note OR MIT AND LGPL-2.0-or-later AND MIT
- ubuntu stonking: liburing-dev 2.15-1
- π the page's license: LGPL-2.0-or-later
- Copyright (C) 2026 Yitang Yang <yi1tang.yang@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms