---
name: "F_SETPIPE_SZ"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/F_GETPIPE_SZ"
---

# F\_SETPIPE\_SZ(2const)

get/set the capacity of a pipe

Part of [F\_GETPIPE\_SZ(2const)](/F_GETPIPE_SZ/2const.md).

## NAME

F\_GETPIPE\_SZ, F\_SETPIPE\_SZ - get/set the capacity of a pipe

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#define _GNU_SOURCE
#include <fcntl.h>
```

**int fcntl(int** *fd***, F\_SETPIPE\_SZ, int** *arg***);** **int fcntl(int** *fd***, F\_GETPIPE\_SZ);**

## DESCRIPTION

- **F\_SETPIPE\_SZ**

  Change the capacity of the pipe referred to by *fd* to be at least *arg* bytes. An unprivileged process can adjust the pipe capacity to any value between the system page size and the limit defined in */proc/sys/fs/pipe-max-size* (see [**proc\_sys\_fs**(5)](/proc_sys_fs/5.md)). Attempts to set the pipe capacity below the page size are silently rounded up to the page size. Attempts by an unprivileged process to set the pipe capacity above the limit in */proc/sys/fs/pipe-max-size* yield the error **EPERM**; a privileged process (**CAP\_SYS\_RESOURCE**) can override the limit.

-

  When allocating the buffer for the pipe, the kernel may use a capacity larger than *arg*, if that is convenient for the implementation. (In the current implementation, the allocation is the next higher power-of-two page-size multiple of the requested size.) The actual capacity (in bytes) that is set is returned as the function result.

-

  Attempting to set the pipe capacity smaller than the amount of buffer space currently used to store data produces the error **EBUSY**.

-

  Note that because of the way the pages of the pipe buffer are employed when data is written to the pipe, the number of bytes that can be written may be less than the nominal size, depending on the size of the writes.

- **F\_GETPIPE\_SZ**

  Return (as the function result) the capacity of the pipe referred to by *fd*.

## RETURN VALUE

The pipe capacity.

On error, -1 is returned, and *errno* is set to indicate the error.

## ERRORS

See [**fcntl**(2)](/fcntl/2.md).

- **EBUSY**

  *op* is **F\_SETPIPE\_SZ** and the new pipe capacity specified in *arg* is smaller than the amount of buffer space currently used to store data in the pipe.

- **EPERM**

  *op* is **F\_SETPIPE\_SZ** and the soft or hard user pipe limit has been reached; see [**pipe**(7)](/pipe/7.md).

## STANDARDS

Linux.

## HISTORY

Linux 2.6.35.

## SEE ALSO

[**fcntl**(2)](/fcntl/2.md)
