[TUHS] fstat(2) on pipes?

Warren Toomey wkt at tuhs.org
Mon Aug 15 10:54:52 AEST 2016

On Mon, Aug 15, 2016 at 10:41:02AM +1000, Dave Horsfall wrote:
> Probably not much use to you, but back in Ed6 I did modify it to return
> the amount of data in the pipe.

7th Ed seems to return the amount of free space in the pipe, if I read
the code correctly:

   /* Call stat1() with the current offset in the pipe */
   stat1(fp->f_inode, uap->sb, fp->f_flag&FPIPE? fp->f_un.f_offset: 0);

   ds.st_size = ip->i_size - pipeadj;

Cheers, Warren

More information about the TUHS mailing list