I know that for the current version of the Linux kernel, the size of named pipes is 64K. Is it possible to increase this size at all?
I know I can switch to sockets, but first I'd like to see if I can solve an intermittent buffer-overflow problem by just increasing the named-pipe size.
Since Linux 2.6. 35, the default pipe capacity is 16 pages, but the capacity can be queried and set using the fcntl(2) F_GETPIPE_SZ and F_SETPIPE_SZ operations.
The pipe size is advertized by ulimit is still 4kB on Kernel 3.2 (the one I have here). My question was about PIPE_BUF, which is what janneb answered: PIPE_BUF is a constant and is the maximum size of a write which will be atomic when performed (i.e., thread-safe ;)).
A FIFO, also known as a named pipe, is a special file similar to a pipe but with a name on the filesystem. Multiple processes can access this special file for reading and writing like any ordinary file. Thus, the name works only as a reference point for processes that need to use a name in the filesystem.
Therefore it's recommended that named pipe transactions be limited to 64 kilobytes of data. Windows 10, version 1709: Pipes are only supported within an app-container; ie, from one UWP process to another UWP process that's part of the same app. Also, named pipes must use the syntax "\.
With recent kernels (>= 2.6.35), you can change the size of a pipe with
fcntl(fd, F_SETPIPE_SZ, size)
where size
is a long
. The maximum size is in /proc/sys/fs/pipe-max-size
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With