io_uring_prep_renameat(3)
π io_uring_prep_renameat β the liburing manual, bestie edition
okay so you want to move/rename files but make it async? say less. this is io_uring_prep_renameat(3) from the liburing manual and she is lowkey iconic.
β¨ NAME β¨
io_uring_prep_renameat β get a renameat request all prepped and ready π
β¨ SYNOPSIS β¨
#include <fcntl.h>
#include <stdio.h>
#include <liburing.h>
void io_uring_prep_renameat(struct io_uring_sqe *sqe,
int olddirfd,
const char *oldpath,
int newdirfd,
const char *newpath,
unsigned int flags);
void io_uring_prep_rename(struct io_uring_sqe *sqe,
const char *oldpath,
const char *newpath);
β¨ DESCRIPTION β¨
so io_uring_prep_renameat(3) prepares a renameat request. the submission queue entry sqe gets set up to use the old directory file descriptor that olddirfd points to, plus the old path that oldpath points to, and then the new directory file descriptor that newdirfd points to with the new path that newpath points to β all using whatever you dropped into flags. π¦
and io_uring_prep_rename(3) prepares a rename request. the submission queue entry sqe gets set up to use the old path that oldpath points to together with the new path that newpath points to, both relative to the current working directory, and using the specified flags in flags. periodt.
these functions prepare an async renameat2(2) or rename(2) request. if flags is zero, then this call is similar to the renameat(2) system call. go read those man pages for the details, iykyk. π
β¨ RETURN VALUE β¨
none. nope. nothing. the void returns nothing, bestie. π
β¨ ERRORS β¨
the res field of the CQE is where the result of the operation lives. check the related man page for the possible values, fr fr. π
β οΈ important: where synchronous system calls will return-1on failure and seterrnoto the actual error value, io_uring never useserrno. instead it returns the negated errno directly in the CQEresfield. no cap.
β¨ NOTES β¨
like with any request that passes in data in a struct, that data has to stay valid until the request has been successfully submitted. it does not need to stay valid until completion β once a request has been submitted, the in-kernel state is stable. π«Ά
very early kernels (5.4 and earlier) did require that state to stay stable until the completion occurred, so watch out for the old ones. applications can test for this behavior by inspecting the IORING_FEAT_SUBMIT_STABLE flag passed back from io_uring_queue_init_params(3). π
β¨ SEE ALSO β¨
liburing-2.2 Β· March 13, 2022 β that's the vibe check, we're done here. go rename something, bestie, you're the main character now πβ¨π
π¦ 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 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
- 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