Date: Thu, 07 Jan 2016 17:09:37 +0000 From: Malcolm Matalka <mmatalka@gmail.com> To: Jilles Tjoelker <jilles@stack.nl> Cc: freebsd-hackers@freebsd.org Subject: Re: Can PIPE_BUF be increased? Message-ID: <86vb75nwoe.fsf@gmail.com> In-Reply-To: <20160107163041.GA35588@stack.nl> (Jilles Tjoelker's message of "Thu, 7 Jan 2016 17:30:41 %2B0100") References: <86ziwho1jg.fsf@gmail.com> <CAKziXDWHPPMvkypAOxj7krG90aBX3cuNCYyaNDn5PdB=1ng4-Q@mail.gmail.com> <20160107163041.GA35588@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
Jilles Tjoelker <jilles@stack.nl> writes: > 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. If I understand you correctly, I cannot do anything, with strong guarantees, without recompiling the kernel? Thank you for the answer! /Malcolm
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86vb75nwoe.fsf>