io_uring_prep_unlinkat(3)
β¨ io_uring_prep_unlinkat β prepare an unlinkat request β¨
okay bestie, welcome to the liburing Manual π this is the page for deleting files the async way, and it's actually so much simpler than it sounds. buckle up π
πΈ NAME πΈ
io_uring_prep_unlinkat β prepare an unlinkat request
π¦ SYNOPSIS π¦
#include <fcntl.h>
#include <unistd.h>
#include <liburing.h>
void io_uring_prep_unlinkat(struct io_uring_sqe *sqe,
int dirfd,
const char *path,
int flags);
void io_uring_prep_unlink(struct io_uring_sqe *sqe,
const char *path,
int flags);
π DESCRIPTION π
so, io_uring_prep_unlinkat(3) prepares an unlinkat request. the submission queue entry sqe gets set up to use the directory file descriptor that dirfd points at, to start an unlinkat operation on the path identified by path, using the flags you passed in flags. yeah it's literally that straightforward π
and io_uring_prep_unlink(3) prepares an unlink request. same deal: the submission queue entry sqe gets set up to start an unlinkat operation on the path identified by path, but this time relative to the current working directory instead of some dirfd, and using the flags given in flags. no dirfd, no problem π«Ά
basically both of these are preparing an async unlinkat(2) or unlink(2) request. if you want the actual details of what those do, go read those man pages, they're the main characters of that story π
π RETURN VALUE π
None. it's a void function bestie, it returns nothing, it just sets your sqe up and vibes β¨
π ERRORS π
the CQE res field is gonna hold the result of the operation. check the related man page for what possible values can show up there π
okay this part matters: where synchronous system calls return-1on failure and seterrnoto the actual error value, io_uring never uses errno. instead it returns the negated errno directly in the CQEresfield. so if you see a negative number, that's your error, fr fr π
π§ NOTES π§
like with literally any request that passes data in a struct, that data must remain valid until the request has been successfully submitted. it does not need to stay valid until completion though. once a request has been submitted, the in-kernel state is stable and you're free πΈ
tiny history moment: very early kernels (5.4 and earlier) required that state to stay stable all the way until the completion occurred. so if you're dealing with ancient kernels, watch out π
applications can test for this behavior by inspecting the IORING_FEAT_SUBMIT_STABLE flag that gets passed back from io_uring_queue_init_params(3). iconic little flag, lowkey saves you π
π SEE ALSO π
and that's the whole page bestie!! this was liburing-2.2, dated March 13, 2022 π go delete some files (responsibly), slay, and remember: negative res = the errno, not a vibe π
ππ¦
π¦ 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