9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Presotto <presotto@closedmind.org>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] size on /proc files?
Date: Sun, 30 Mar 2003 07:34:41 -0500	[thread overview]
Message-ID: <091f807138892efebadcbbde9ac80bd7@plan9.bell-labs.com> (raw)
In-Reply-To: <200303301036.h2UAaEFZ031353@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 173 bytes --]

We're equally stupid, though we could to a bit better.  The register
files and status files show the real lengths but the text and mem
file don't.  I'll see what I can do.

[-- Attachment #2: Type: message/rfc822, Size: 2193 bytes --]

From: Aharon Robbins <arnold@skeeve.com>
To: 9fans@cse.psu.edu
Subject: [9fans] size on /proc files?
Date: Sun, 30 Mar 2003 13:36:14 +0300
Message-ID: <200303301036.h2UAaEFZ031353@localhost.localdomain>

Just out of curiousity, what does ls -l on special files in /proc report?
On linux, e.g., /proc/filesystems shows up as a regular file, but of size
zero.  Yet when you cat it you get information.

This behavior broke the current gawk, where I'd rewritten the get_a_record
routines; they had a check:

	if (S_ISREG(sbuf.st_mode) && total > sbuf.st_size)
		flag |= AT_EOF;

I had to change this to

	if (S_ISREG(sbuf.st_mode) && sbuf.st_size > 0
	    && total > sbuf.st_size) ....

I am annoyed at the Linux behavior, but understand that the contents
of these "files" can change dynamically, making the reporting of a size
for stat difficult or impossible.

So, I was just curious how Plan 9 handles it.

Thanks,

Arnold Robbins

  reply	other threads:[~2003-03-30 12:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-30 10:36 Aharon Robbins
2003-03-30 12:34 ` David Presotto [this message]
2003-03-30 12:48   ` David Presotto
2003-03-30 14:48   ` Russ Cox
2003-03-31  9:08   ` Aharon Robbins

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=091f807138892efebadcbbde9ac80bd7@plan9.bell-labs.com \
    --to=presotto@closedmind.org \
    --cc=9fans@cse.psu.edu \
    /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).