The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: clemc@ccc.com (Clem Cole)
Subject: [TUHS] fstat(2) on pipes?
Date: Mon, 15 Aug 2016 13:53:28 -0400	[thread overview]
Message-ID: <CAC20D2PcxqfWzEsKc_Z3TKptOQFsorD2sUfKSXd2=_ccNz_fBg@mail.gmail.com> (raw)
In-Reply-To: <20160815001140.GA16138@minnie.tuhs.org>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1594 bytes --]

​Yet Another Example of UNIX A != UNIX B​

IIRC from the /usr/group and later POSIX discussions, the only thing that
is for sure on the stat structure with a PIPE is that it's marked as such.

That said, I just grabbed my copy of the SVID (Vol 1 pages 126-127)

st_size "For ordinary files, this field is the address of the end of file.
  For pipes and FIFO's, this field is the count of the data currently in
the file.   For block-special & char special, this field is undefined."

As for st_ino and st_dev -- the SVID says the ino "uniquely identifies the
file in a given file system," and dev uniquely identifies the file system
that contains the file."

It further states: "The pair of fields st_ino and st_dev uniquely
identifies ordinary files."     And then later says "No other significance
is associated with this value."


So..... clearly returning an error is wrong.   I don't think the Linux
scheme hurts anything....


On Sun, Aug 14, 2016 at 8:11 PM, Warren Toomey <wkt at tuhs.org> wrote:

> All, sorry this is slightly off-topic. I'm trying to
> find out what fstat(2) returns when the file descriptor
> is a pipe. The POSIX/Open Group documentation doesn't
> really specify what should be returned. Does anybody have
> any pointers?
>
> Thanks, Warren
>
> P.S. Why? xv6 has fstat() but returns an error if the
> file descriptor isn't associated with an i-node. I'm
> trying to work out if/how to fix it.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20160815/e8a2a75e/attachment.html>


  parent reply	other threads:[~2016-08-15 17:53 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
2016-08-15 17:53 ` Clem Cole [this message]
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='CAC20D2PcxqfWzEsKc_Z3TKptOQFsorD2sUfKSXd2=_ccNz_fBg@mail.gmail.com' \
    --to=clemc@ccc.com \
    /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).