The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: wkt@tuhs.org (Warren Toomey)
Subject: [TUHS] fstat(2) on pipes?
Date: Mon, 15 Aug 2016 10:54:52 +1000	[thread overview]
Message-ID: <20160815005452.GA21951@minnie.tuhs.org> (raw)
In-Reply-To: <alpine.BSF.2.11.1608151037130.10703@aneurin.horsfall.org>

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:

fstat()
{
   ...
   /* 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);
}

stat1()
{
   ...
   ds.st_size = ip->i_size - pipeadj;
}

Cheers, Warren


  reply	other threads:[~2016-08-15  0:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15  0:11 Warren Toomey
2016-08-15  0:41 ` Dave Horsfall
2016-08-15  0:54   ` Warren Toomey [this message]
2016-08-15 17:53 ` Clem Cole
2016-08-15  0:27 Noel Chiappa
2016-08-15  0:59 ` Warren Toomey
2016-08-15 14:04 Noel Chiappa
2016-08-15 15:14 ` Random832
2016-08-15 16:56   ` Michael Kjörling
2016-08-15 17:47 Norman Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160815005452.GA21951@minnie.tuhs.org \
    --to=wkt@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).