---
name: "io_uring_prep_pipe_direct"
section: "3"
platform: "linux"
package: "liburing"
version: "2.15-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/io_uring_prep_pipe_direct"
---

# io\_uring\_prep\_pipe\_direct(3)

prepare a pipe creation request

## NAME

io\_uring\_prep\_pipe - prepare a pipe creation 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

The [**io\_uring\_prep\_pipe**(3)](/io_uring_prep_pipe/3.md) function prepares a pipe creation request. The submission queue entry *sqe* is setup to create a pipe with the created descriptors being copied to the array indicated by  *fds* and using *pipe\_flags* as the pipe creation flags. See **[pipe2(2)](/pipe2/2.md)** for details on the flags accepted.

The [**io\_uring\_prep\_pipe\_direct**(3)](/io_uring_prep_pipe_direct/3.md) function works in the same way, however it uses fixed/registered file descriptors rather than normal file descriptors. This helper takes an additional *file\_index* argument, which can set to either an explicit direct descriptor offset to create the two pipe file descriptors at, or it can be set to **IORING\_FILE\_INDEX\_ALLOC** to let io\_uring pick any available descriptors for the read and write side of the pipe. If a specific index is given, the read side of the pipe will be created at that offset, if free, and the write side will be created at the next (+1) index. Both of these must be currently unused, or the operation will fail. Also see [**io\_uring\_prep\_accept\_direct**(3)](/io_uring_prep_accept_direct/3.md) or [**io\_uring\_prep\_socket\_direct**(3)](/io_uring_prep_socket_direct/3.md) for details on the *file\_index* parameter.

For both the direct and normal file descriptor pipe request, the resulting input/read side of the pipe will be stored in *fds\[0\]* and the output/write side of the pipe will be stored in *fds\[1\]* upon successful completion of this request.

This function prepares an async [**pipe2**(2)](/pipe2/2.md) request. See that man page for details.

## RETURN VALUE

None

## ERRORS

The CQE *res* field will contain the result of the operation. See the related man page for details on possible values. Note that where synchronous system calls will return **-1** on failure and set *errno* to the actual error value, io\_uring never uses *errno*. Instead it returns the negated *errno* directly in the CQE *res* field.

## SEE ALSO

[**io\_uring\_get\_sqe**(3)](/io_uring_get_sqe/3.md), [**io\_uring\_submit**(3)](/io_uring_submit/3.md), [**pipe2**(2)](/pipe2/2.md), [**io\_uring\_prep\_accept\_direct**(3)](/io_uring_prep_accept_direct/3.md), [**io\_uring\_prep\_socket\_direct**(3)](/io_uring_prep_socket_direct/3.md)
