public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Eric S. Raymond" <esr@thyrsus.com>
To: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Documenting stat(2)
Date: Thu, 18 Jan 2001 00:28:12 -0500	[thread overview]
Message-ID: <20010118002812.A19810@thyrsus.com> (raw)

I'm trying to pin down and document the behavior of the size field in
stat(2) on Linux and under various stat emulations on Windows and the
Mac.  What I find out will be documented where it will do some good (in
particular I'll send a stat.2 man page patch to Andries Brouwer).

Here is what I think I know about stat(2) that isn't in the
Linux man pages:

* For a plain file or directory (S_IFREG or S_IFDIR), the st_size
field reports the size of the file in bytes.

* For a symlink (S_IFLNK) it reports the size of the link file, not the
size of the file the link points to. 

* For a socket or FIFO (S_IFSOCK, S_IFIFO) it reports the count of bytes
waiting to be read. 

* For a block special device (S_IFBLK) it returns 0.

I don't know what it should be expected to return for terminal or
other special devices.  My guess is number of characters waiting
in clists.

Can anyone verify, correct, or expand on the above?  Reply to 
esr@thyrsus.com, please, and thanks in advance.

(Among other things, this may turn into a substantial improvement
in the documented capabilities of Perl and Python.)
-- 
		<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>

The spirit of resistance to government is so valuable on certain
occasions, that I wish it always to be kept alive.  It will often be
exercised when wrong, but better so than not to be exercised at all.
I like a little rebellion now and then.  It is like a storm in the
Atmosphere.
	-- Thomas Jefferson, letter to Abigail Adams, 1787
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

             reply	other threads:[~2001-01-18  5:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-18  5:28 Eric S. Raymond [this message]
2001-01-18  6:46 ` Documenting stat(2) Linus Torvalds
2001-01-18 12:56 ` Felix von Leitner
  -- strict thread matches above, loose matches on Subject: below --
2001-01-18  7:05 dmeyer
2001-01-18 11:53 ` Padraig Brady
2001-01-18 15:54   ` dmeyer
2001-01-18 20:52   ` Igmar Palsenberg
2001-01-19  1:00     ` Mike Castle
2001-01-20 19:39       ` Igmar Palsenberg
2001-01-19 10:18   ` Andreas Schwab

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=20010118002812.A19810@thyrsus.com \
    --to=esr@thyrsus.com \
    --cc=linux-kernel@vger.kernel.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