Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change the size of a named pipe on Linux?

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.

like image 458
AgentLiquid Avatar asked Jan 19 '11 18:01

AgentLiquid


People also ask

How do I change the pipe size in Linux?

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.

What is pipe size in Ulimit?

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

How do named pipes work Linux?

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.

How much data can a named pipe store?

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 "\.


1 Answers

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.

like image 87
Fred Foo Avatar answered Nov 03 '22 12:11

Fred Foo