io_uring_prep_pipe(3)
β¨ io_uring_prep_pipe β prepare a pipe creation request β¨
okay bestie, this one is from the liburing manual, and it's literally just the girlies setting up a pipe request π
πΈ SYNOPSIS πΈ
#include <liburing.h>
void io_uring_prep_pipe(struct io_uring_sqe *sqe,
int *fds,
int pipe_flags);
void io_uring_prep_pipe_direct(struct io_uring_sqe *sqe,
int *fds,
int pipe_flags,
unsigned int file_index);
π¦ DESCRIPTION π¦
So io_uring_prep_pipe(3) prepares a pipe creation request. The submission queue entry sqe gets set up to create a pipe, the freshly created descriptors get copied into the array pointed at by fds, and pipe_flags is used as the pipe creation flags. Wanna know which flags are valid? Run, don't walk, to pipe2(2) β it's all there π
Now io_uring_prep_pipe_direct(3) is the same vibe, but it uses fixed/registered file descriptors instead of the normal kind. This one takes an extra file_index argument, and you've got options, queen:
- set it to an explicit direct descriptor offset where you want the two pipe file descriptors to live, or
- set it to
IORING_FILE_INDEX_ALLOCand let io_uring pick any available descriptors for the read and write side of the pipe π
If you do hand it a specific index, the read side of the pipe gets created at that offset (if it's free, obvi), and the write side goes at the next one β that's +1 index, babes. Both of those slots need to be currently unused, or the whole operation just fails π. Also if you want the tea on the file_index parameter itself, go read io_uring_prep_accept_direct(3) or io_uring_prep_socket_direct(3) π«Ά
For both the direct and the normal file descriptor pipe request: once the request completes successfully, the resulting input/read side of the pipe lands in fds[0] and the output/write side lands in fds[1]. Periodt β¨
This function prepares an async pipe2(2) request. See that man page for the details, bestie.
π RETURN VALUE π
None. Like, literally nothing. She gives you nothing back π
π ERRORS π
The CQE res field is where the result of the operation shows up. Check the related man page for what the possible values could be.
Heads up! Where synchronous system calls would return-1on failure and seterrnoto the actual error value, io_uring never useserrno. Instead it returns the negated errno directly in theCQE resfield. Different system, different rules, no cap π
π SEE ALSO π
io_uring_get_sqe(3)io_uring_submit(3)pipe2(2)io_uring_prep_accept_direct(3)io_uring_prep_socket_direct(3)
mwah π that's the whole page! this icon was brought to you by liburing-2.10, dated April 8, 2025, and she ate, fr fr πβ¨
π¦ where this page comes from
- 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
- nixpkgs unstable: liburing 2.14
- 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