table of contents
PIPESZ(1) | User Commands | PIPESZ(1) |
NAME¶
pipesz - set or examine pipe and FIFO buffer sizes
SYNOPSIS¶
pipesz [options] [--set size] [--] [command [argument] ...]
pipesz [options] --get
DESCRIPTION¶
Pipes and FIFOs maintain an internal buffer used to transfer data between the read end and the write end. In some cases, the default size of this internal buffer may not be appropriate. This program provides facilities to set and examine the size of these buffers.
The --set operation sets pipe buffer sizes. If it is specified, it must be specified with an explicit size. Otherwise, it is implied and the size is read from /proc/sys/fs/pipe-max-size. The kernel may adjust size as described in fcntl(2). To determine the actual buffer sizes set, use the --verbose option. If neither --file nor --fd are specified, --set acts on standard output.
The --set operation permits an optional command to execute after setting the pipe buffer sizes. This command is executed with the adjusted pipes.
The --get operation outputs data in a tabular format. The first column is the name of the pipe as passed to pipesz. File descriptors are named as "fd N". The second column is the size, in bytes, of the pipe’s internal buffer. The third column is the number of unread bytes currently in the pipe. The columns are separated by tabs ('\t', ASCII 09h). If --verbose is specified, a descriptive header is also emitted. If neither --file nor --fd are specified, --get acts on standard input.
Unless the --check option is specified, pipesz does not exit if it encounters an error while manipulating a file or file descriptor. This allows pipesz to be used generically without fear of disrupting the execution of pipelines should the type of certain files be later changed. For minimal disruption, the --quiet option prevents warnings from being emitted in these cases.
The kernel imposes limits on the amount of pipe buffer space unprivileged processes can use, though see BUGS below. The kernel will also refuse to shrink a pipe buffer if this would cause a loss of buffered data. See pipe(7) for additional details.
pipesz supports specifying multiple short options consecutively, in the usual getopt(3) fashion. The first non-option argument is interpreted as command. If command might begin with '-', use '--' to separate it from arguments to pipesz. In shell scripts, it is good practice to use '--' when parameter expansion is involved. pipesz itself does not read from standard input and does not write to standard output unless --get, --help, or --version are specified.
OPTIONS¶
-g, --get
-s, --set size
-f, --file path
-n, --fd fd
-i, --stdin
-o, --stdout
-e, --stderr
-c, --check
-q, --quiet
-v, --verbose
-h, --help
-V, --version
EXAMPLES¶
pipesz dd if=file bs=1M | ...
pipesz -s1M -cf /run/my-service.fifo
echo hello | pipesz -g
find /proc/PID/fd -exec pipesz -gqf '{}' ';'
NOTES¶
Linux supports adjusting the size of pipe buffers since kernel 2.6.35. This release also introduced /proc/sys/fs/pipe-max-size.
This program uses fcntl(2) F_GETPIPE_SZ/F_SETPIPE_SZ to get and set pipe buffer sizes.
This program uses ioctl(2) FIONREAD to report the amount of unread data in pipes. If for some reason this fails, the amount of unread data is reported as 0.
BUGS¶
Before Linux 4.9, some bugs affect how certain resource limits are enforced when setting pipe buffer sizes. See pipe(7) for details.
AUTHORS¶
Nathan Sharp <nwsharp@live.com>
SEE ALSO¶
REPORTING BUGS¶
For bug reports, use the issue tracker at <https://github.com/util-linux/util-linux/issues>.
AVAILABILITY¶
The pipesz command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
2024-04-24 | util-linux 2.40.2 |