io_uring_prep_mkdirat(3)
β¨ io_uring_prep_mkdirat β the liburing glow-up β¨
okay bestie, we're doing liburing today and honestly? it's giving "make a directory but async, and make it cute." no cap, let's go π
πΈ NAME πΈ
io_uring_prep_mkdirat β prepare an mkdirat request π«Ά
π SYNOPSIS π
#include <fcntl.h>
#include <sys/stat.h>
#include <liburing.h>
void io_uring_prep_mkdirat(struct io_uring_sqe *sqe,
int dirfd,
const char *path,
mode_t mode);
void io_uring_prep_mkdir(struct io_uring_sqe *sqe,
const char *path,
mode_t mode);
π DESCRIPTION π
so. io_uring_prep_mkdirat(3) prepares a mkdirat request. the submission queue entry sqe gets set up to use the directory file descriptor that dirfd points at, to start a mkdirat operation on the path identified by path, with the mode given in mode. iconic behavior, truly. β¨
then there's io_uring_prep_mkdir(3), which prepares a mkdir request. that one sets up the submission queue entry sqe to use the current working directory to start a mkdir operation on the path identified by path, with the mode given in mode. same energy, just no dirfd, she works with what she's got πβοΈ
both of these functions prepare an async mkdir(2) or mkdirat(2) request. lowkey if you want the full tea on how that goes down, go read those man pages, because the details live there. π
β RETURN VALUE β
None. that's it. nothing returned. she gives you nothing and you respect it. π
π₯ ERRORS π₯
the CQE res field is where the result of the operation shows up. check the related man page for what values are possible, bestie, because that's where the lore is.
now here's the important part, and I need you to lock in: where synchronous system calls will return -1 on failure and set errno to the actual error value, io_uring never uses errno. nope. instead it returns the negated errno directly in the CQE res field. periodt. π¨
π¦ NOTES π¦
okay so this part is the "don't get got" section. π
like 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. slay.
β οΈ BUT β and this is the plot twist β very early kernels (5.4 and earlier) required state to be stable until the completion occurred. so if you're out here living in the past, be careful.
apps can test for this behavior by inspecting the IORING_FEAT_SUBMIT_STABLE flag that gets passed back from io_uring_queue_init_params(3). vibe check your kernel, basically. π
π SEE ALSO π
and that's the whole page, bestie, you ate. this was served up by liburing-2.2 on March 13, 2022 β go make some directories, but like, asynchronously πβ¨π
π¦ 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