io_uring_register_zcrx_ctrl(3)

πŸ“¦ version 2.15, in arch rolling, ubuntu stonking

✨ io_uring_register_zcrx_ctrl ✨

okay bestie, welcome to the liburing Manual πŸ’– this one's a lil deep in the weeds but we're gonna get through it together, i promise.


πŸŽ€ NAME πŸŽ€

io_uring_register_zcrx_ctrl β€” does control operations on a zero-copy receive context. that's it, that's the whole vibe πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <liburing.h>

int io_uring_register_zcrx_ctrl(struct io_uring *ring,
                                struct zcrx_ctrl *ctrl);

🌸 DESCRIPTION 🌸

so io_uring_register_zcrx_ctrl(3) performs control operations on a zero-copy receive context that you already registered earlier. if you wanna know how to register one of those in the first place, go look at io_uring_register_ifq(3), she explains it 🫢

the ctrl argument has to point at a struct zcrx_ctrl structure that describes which control operation you want:

struct zcrx_ctrl {
    __u32 zcrx_id;
    __u32 op;
    __u64 __resv[2];
    union {
        struct zcrx_ctrl_export     zc_export;
        struct zcrx_ctrl_flush_rq   zc_flush;
    };
};

k so the zcrx_id field? that MUST be set to the ID of the zero-copy receive context that io_uring_register_ifq(3) handed back to you. no guessing, use the one you got πŸ’…

then the op field is the actual "what are we doing today" field, and it can be one of these two iconic options:

  • ZCRX_CTRL_FLUSH_RQ β€” flushes the pending buffers out of the refill queue. this one uses the zc_flush member of the union. it's giving tidy up ✨
  • ZCRX_CTRL_EXPORT β€” exports the zero-copy receive context so other rings can use it. this one uses the zc_export member of the union. and bestie, once the export succeeds, the zcrx_fd field inside zc_export will hold the file descriptor you can use to share this context with other io_uring instances. that's the whole point, that's the moment πŸ‘‘
⚠️ and the reserved __resv fields? clear them to zero. all of them. don't leave crumbs, don't leave vibes, just zeros 😭

⭐ RETURN VALUE ⭐

  • returns 0 when it works πŸŽ‰
  • on error it returns a negative errno value. classic.

🌈 NOTES 🌈

this function has been available since Linux kernel 6.15. so if you're on an older kernel, bestie... she's not there yet 😭


🧚 SEE ALSO 🧚


and that's the whole page, periodt πŸ’– this lil writeup is from liburing-2.15, dated March 26, 2026 β€” go forth and register your zero-copy receive contexts responsibly, queen πŸ‘‘βœ¨

πŸ“¦ where this page comes from