io_uring_prep_linkat(3)
π io_uring_prep_linkat β a liburing manual page, bestie edition π
okay so we're doing the io_uring_prep_linkat(3) page from the liburing Manual and honestly? it's a short one, it's cute, it's giving "two functions, one job, zero drama". let's go π¦
β¨ NAME β¨
io_uring_prep_linkat β get a linkat request all prepped and ready to slay
πΈ SYNOPSIS πΈ
#include <fcntl.h>
#include <unistd.h>
#include <liburing.h>
void io_uring_prep_linkat(struct io_uring_sqe *sqe,
int olddirfd,
const char *oldpath,
int newdirfd,
const char *newpath,
int flags);
void io_uring_prep_link(struct io_uring_sqe *sqe,
const char *oldpath,
const char *newpath,
int flags);
like. look at her. two little functions. π
π DESCRIPTION π
so io_uring_prep_linkat(3) is the one that prepares a linkat request, fr fr. it sets up the submission queue entry sqe so it uses:
- the old directory file descriptor, which is the one
olddirfdis pointing at π - the old path, which is the one
oldpathis pointing at - the new directory file descriptor, which is the one
newdirfdis pointing at - the new path, which is the one
newpathis pointing at - and the flags you handed it in
flags, obviously π
then there's io_uring_prep_link(3), her slightly simpler sister. she prepares a link request, and she sets up the submission queue entry sqe to use the old path pointed to by oldpath and the new path pointed to by newpath β both relative to the current working directory β plus whatever you put in flags.
basically these two are out here preparing an async linkat(2) or link(2) request. if you want the actual lore, go read those man pages, they have the details. π
π RETURN VALUE π
None. that's it. that's the whole section. she returns nothing because she's too busy being iconic. β¨
π ERRORS π
the res field of the CQE is where the result of the operation lives. what values can show up there? go check the related man page, bestie, it's all documented there.
β οΈ now THIS part matters: with normal synchronous system calls, a failure gives you-1and setserrnoto the actual error value. io_uring never useserrno. never ever. instead it returns the negated errno directly in theresfield of the CQE. so like, look at the sign, okay? it's not a vibe, it's a whole different convention. π
π§ NOTES π§
okay so here's the tea with any request that passes in data inside a struct: that data has to remain valid until the request has been successfully submitted. that's it. it does not need to stay valid all the way until completion. once a request has been submitted, the in-kernel state is stable, periodt. π
π¨ very early kernels β we're talking 5.4 and earlier β were extra and required the state to stay stable until the completion happened. so if you're on ancient kernel energy, mind that.
wanna know if your kernel is chill about this? 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). iykyk. π₯
π SEE ALSO π
and that's the whole page, bestie π«Ά this was liburing-2.2, dated March 13, 2022 β go forth and link things asynchronously, you absolute main character πππ¦
π¦ 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