The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: michael@kjorling.se (Michael Kjörling)
Subject: [TUHS] fstat(2) on pipes?
Date: Mon, 15 Aug 2016 16:56:45 +0000	[thread overview]
Message-ID: <20160815165645.GE655@yeono.kjorling.se> (raw)
In-Reply-To: <1471274085.1099635.695741217.6472725F@webmail.messagingengine.com>

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

On 15 Aug 2016 11:14 -0400, from random832 at fastmail.com (Random832):
> On Mon, Aug 15, 2016, at 10:04, Noel Chiappa wrote:
>> But back to the original topic, it sounds like there's a huge amount
>> of variance in the semantics of doing fstat() on a pipe. V6 doesn't
>> special-case it in any way, but it sounds as if other systems do.
> 
> I expect that the single important thing, the only thing that most
> applications will rely on, is it returning successfully and indicating
> that the file type is fifo.

On Linux/glibc, based on the fstat(2) man page, it looks like the size
field is undefined for a FIFO:

> The st_size field gives the size of the file (if it is a regular
> file or a symbolic link) in bytes. The size of a symbolic link is
> the length of the pathname it contains, without a terminating null
> byte.

The mode field is used to hold the type of file:

> The following POSIX macros are defined to check the file type using
> the st_mode field:
> 
> ...
>     S_ISFIFO(m) FIFO (named pipe)?
> ...
> 
> The following flags are defined for the st_mode field:
> ...
>     S_IFIFO    0010000   FIFO
> ...

The above from Debian Wheezy.

-- 
Michael Kjörling • https://michael.kjorling.se • michael at kjorling.se
                 “People who think they know everything really annoy
                 those of us who know we don’t.” (Bjarne Stroustrup)


  reply	other threads:[~2016-08-15 16:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-15 14:04 Noel Chiappa
2016-08-15 15:14 ` Random832
2016-08-15 16:56   ` Michael Kjörling [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-08-15 17:47 Norman Wilson
2016-08-15  0:27 Noel Chiappa
2016-08-15  0:59 ` Warren Toomey
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

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=20160815165645.GE655@yeono.kjorling.se \
    --to=michael@kjorling.se \
    /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).