Date: Thu, 7 Jan 2016 17:30:41 +0100 From: Jilles Tjoelker <jilles@stack.nl> To: Malcolm Matalka <mmatalka@gmail.com> Cc: freebsd-hackers@freebsd.org Subject: Re: Can PIPE_BUF be increased? Message-ID: <20160107163041.GA35588@stack.nl> In-Reply-To: <CAKziXDWHPPMvkypAOxj7krG90aBX3cuNCYyaNDn5PdB=1ng4-Q@mail.gmail.com> References: <86ziwho1jg.fsf@gmail.com> <CAKziXDWHPPMvkypAOxj7krG90aBX3cuNCYyaNDn5PdB=1ng4-Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 07, 2016 at 04:27:56PM +0100, Malcolm Matalka wrote: > Den 7 jan 2016 4:24 em skrev "Malcolm Matalka" <mmatalka@gmail.com>: > > As far as I can tell, PIPE_BUF is 512 bytes by default. Using > > getconf and looking at the header files /usr/include. I'm writing a > > program that would benefit from a larger PIPE_BUF, is it possible to > > change this value? It looks like Linux and OS X have a higher > > default and OS X will do some magic to increase the size if > > necessary. I haven't found anything indicating the same in FreeBSD. > I realized I might not be clear enough here: I'm trying to increase > the number if bytes i can write to a pipe atomically. An active pipe buffer is always at least 4096 bytes, so this value can be increased somewhat without increasing memory usage. Going all the way to 4096 is probably unwise since it may require -- in low memory situations -- the buffer to be emptied completely before select/poll/kqueue report the pipe as writable again. You will need to recompile the kernel and filesystem and ABI compatibility modules after making the change in sys/sys/syslimits.h. FreeBSD automatically resizes pipe buffers and copies large (>= 8192 bytes) blocking writes directly from sender to receiver, but this does not provide atomicity guarantees. -- Jilles Tjoelker
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160107163041.GA35588>