F_GETPIPE_SZ(2const) — Linux manual page

NAME | LIBRARY | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | STANDARDS | HISTORY | SEE ALSO | COLOPHON

F_GETPIPE_SZ(2const)                                 F_GETPIPE_SZ(2const)

NAME         top

       F_GETPIPE_SZ, F_SETPIPE_SZ - get/set the capacity of a pipe

LIBRARY         top

       Standard C library (libc, -lc)

SYNOPSIS         top

       #define _GNU_SOURCE
       #include <fcntl.h>

       int fcntl(int fd, F_SETPIPE_SZ, int arg);
       int fcntl(int fd, F_GETPIPE_SZ);

DESCRIPTION         top

       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)).  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         top

       The pipe capacity.

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

ERRORS         top

       See fcntl(2).

       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).

STANDARDS         top

       Linux.

HISTORY         top

       Linux 2.6.35.

SEE ALSO         top

       fcntl(2)

COLOPHON         top

       This page is part of the man-pages (Linux kernel and C library
       user-space interface documentation) project.  Information about
       the project can be found at 
       ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report
       for this manual page, see
       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.
       This page was obtained from the tarball man-pages-6.15.tar.gz
       fetched from
       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on
       2025-08-11.  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-
       to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not
       part of the original manual page), send a mail to
       man-pages@man7.org

Linux man-pages 6.15            2025-07-20           F_GETPIPE_SZ(2const)

Pages that refer to this page: fcntl(2)