9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <200303301036.h2UAaEFZ031353@localhost.localdomain> (raw)

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 10:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-30 10:36 Aharon Robbins [this message]
2003-03-30 12:34 ` David Presotto
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=200303301036.h2UAaEFZ031353@localhost.localdomain \
    --to=arnold@skeeve.com \
    --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).