io_uring_pre...d_fd_install(3)
π io_uring_prep_fixed_fd_install(3) π
okay bestie, so this one lives in the liburing Manual and it's literally the glow-up arc for your file descriptors β¨
πΈ NAME πΈ
io_uring_prep_fixed_fd_install β get your fixed file fd installed, like it's moving into a whole new apartment π π
π SYNOPSIS π
#include <liburing.h>
void io_uring_prep_fixed_fd_install(struct io_uring_sqe *sqe,
int fd,
unsigned int flags);
β¨ DESCRIPTION β¨
so the io_uring_prep_fixed_fd_install(3) helper is out here prepping a fixed file descriptor installation. it sets up the submission queue entry sqe to install the direct/fixed file descriptor fd, using whatever flags you hand it for the file installation flags. no cap, that's the whole job π«Ά
one use case of direct/fixed file descriptors is turning a regular file descriptor into a direct one β that way any request that needs to touch this file has less overhead to deal with. this helper goes the other way, turning a direct descriptor into a regular file descriptor that can then be used by regular system calls that take a normal file descriptor. super handy when there's justβ¦ no regular file descriptor for this direct descriptor?? π either because it got instantiated directly as a fixed descriptor, or because the regular file was closed with close(2) after it got turned into a direct descriptor. messy history, we don't judge π
once this request returns successfully, both a normal and a fixed file descriptor exist for the same file. either one can be used to access the file, and either one can be closed without affecting the other one. iconic, no drama, they don't even know each other π
now, flags can be either zero, or set to IORING_FIXED_FD_NO_CLOEXEC β which says the new regular file descriptor should not be closed during exec. by default, O_CLOEXEC gets set on the new descriptor otherwise. and listen, if you set this field to literally anything besides those two values, the request gets failed with -EINVAL in the CQE res field. soβ¦ don't π
π RETURN VALUE π
None. nothing. zero. it's void, bestie, she gives nothing back directly π
π₯ ERRORS π₯
the CQE res field is where the tea actually lives β it holds the result of the operation, which in this case is the value of the new regular file descriptor. if it went sideways, you get a negative value back instead π
π SEE ALSO π
io_uring_get_sqe(3)io_uring_submit(3)io_uring_register_files(3)io_uring_unregister_files(3)io_uring_prep_close_direct(3)io_uring_prep_openat_direct(3)
and that's the whole page, periodt π this was brought to you by liburing-2.6, dated December 8, 2023 β go install some fixed fds, you've got this, mwah π¦π
π¦ 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
- 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 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) 2023 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