Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

pipesz

Set or examine pipe and FIFO buffer sizes.

Synopsis

pipesz [options] --get
pipesz [options] --set <size> [--] [command [args...]]

Operation

Uses fcntl(2) with F_GETPIPE_SZ / F_SETPIPE_SZ to get or set the internal buffer sizes of pipes and FIFOs.

Get mode (--get)

Reports pipe buffer sizes as tab-separated columns: file descriptor name, buffer size in bytes, unread bytes (via FIONREAD ioctl). Defaults to stdin if no fd/file specified.

Set mode (--set)

Sets the buffer size for specified pipes/FIFOs. Defaults to stdout if no fd/file specified. Optionally executes a trailing command with the adjusted pipe sizes.

Inputs

SourcePurpose
Pipe/FIFO file descriptorsTarget for get/set operations
-f <path>FIFO path to operate on
/proc/sys/fs/pipe-max-sizeDefault size if --set given without value

Outputs

  • stdout (get mode): tab-separated table of fd name, buffer size, unread bytes

Syscalls

SyscallOperationDescription
fcntl(2)F_GETPIPE_SZGet pipe buffer size
fcntl(2)F_SETPIPE_SZSet pipe buffer size
ioctl(2)FIONREADGet unread byte count

Command-line options

OptionDescription
-g, --getReport pipe buffer sizes
-s, --set <size>Set pipe buffer size in bytes
-f, --file <path>Operate on a FIFO/pipe path (repeatable)
-n, --fd <N>Operate on file descriptor N (repeatable)
-i, --stdinShorthand for --fd 0
-o, --stdoutShorthand for --fd 1
-e, --stderrShorthand for --fd 2
-c, --checkExit immediately on any error
-q, --quietSuppress non-fatal warnings
-v, --verboseEmit headers (get) or print actual sizes (set)
-h, --helpDisplay help
-V, --versionDisplay version

Exit codes

CodeMeaning
0Success
1Failure

Notes

  • The kernel may round the requested size up to a page boundary.
  • The kernel refuses to shrink a buffer if it would cause data loss.
  • Unprivileged processes have limits on maximum pipe buffer size.
  • FIFO buffer size changes are not preserved across restarts.
  • Requires Linux 2.6.35+ for pipe buffer resizing.

Not yet implemented

  • Size suffix parsing (K, M, G, KiB, MiB, GiB)
  • Reading default from /proc/sys/fs/pipe-max-size when --set has no value