title: How to get remaining buffer size of a Named Pipe(FIFO) in linux
body: <p>In my application I am  using Linux Named Pipe for a streaming data transfer. One application(app1) writes stream data to this FIFO, and other application(app2) reads from it.</p>
  
  <p>When FIFO size is full, partial record will be written out to FIFO from app1, as <strong>Pipe's buffer size(4096 bytes)</strong> filled up. By this records are getting merged with some other record. So <strong><code>I want to know what is the remaining size in pipe buffer</code></strong>, before writing a record. With this I can compare current record size with remaining size in pipe buffer, If record size is more, then App1 will wait and write full complete record whenever pipe becomes free, as App2 will be reading continuously.
  I have tried using this, but no use:</p>
  
  <pre><code>fcntl(fd, F_GETPIPE_SZ );
  </code></pre>
  
  <p>Also is there a way to check this remaining pipe's buffer size using C or C++?</p>