PIPE_BUF Was: [Nagios-devel] Logging for critical messgaes

Stanley Hopcroft Stanley.Hopcroft at IPAustralia.Gov.AU
Sat Dec 20 01:07:03 UTC 2003

On Fri, Dec 12, 2003 at 11:48:40AM -0500, Al Tobey wrote:
> On Solaris: grep PIPE_BUF /usr/include/limits.h
> Linux: grep PIPE_BUF /usr/include/linux/limits.h
> Others: find /usr/include -type f -exec grep PIPE_BUF {} \;

  .. snip  

> Maybe it'd be worthwhile to teach configure how to discover this value
> and set it up instead of defaulting to the LCD.  Another option could be
> to call flock() where possible and ignore the atomic write size.  This
> is what I do in Nagios::Cmd.

To sum up :-

1 use min(PIPE_BUF_Sol, PIPE_BUF_Linux, PIPE_BUF_SysV, ..) 
  or the POSIX minimum value (512) for 'conforming implementations'.

1.1 Another approach (perhaps) to having configure determine a platform
dependent value - and therefore take advantage of local large values -
is the pathconfig() function

. make a fifo

. long local_pipe_buf = pathconf(my_fifo, _PC_PIPE_BUF);

(from 'Advanced Programming in the Unix Environment' ch 2).

2 Don't bother about atomicity promises from kernels; do it in
userland by each process using flock() with LOCK_EX to guarantee that
only one process is writing at a time and can therefore write as much as
it wants to

Thanks again for the crisp, educational thread and thank you Al for what
looks like a superb Perl module for Nagios.

Yours sincerely.

Stanley Hopcroft

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.

More information about the Nagios-devel mailing list