F_GETPIPE_SZ(2const)

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

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

HISTORY
Linux 2.6.35.

SEE ALSO
fcntl(2)