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: Re: [9fans] size on /proc files?
Date: Mon, 31 Mar 2003 09:08:38 +0000	[thread overview]
Message-ID: <newscache$xkckch$o34$1@lnews.actcom.co.il> (raw)
In-Reply-To: <091f807138892efebadcbbde9ac80bd7@plan9.bell-labs.com>

David,

I don't know that I advocate actually changing any OS code.  I was just
curious what Plan 9 does.  It came up because someone did

	gawk '/devfs/ { print }' /proc/filesystems

and that failed.  My changed code would now work as-is under Plan 9, so I'll
leave it at that.  I may even remove the test, and just rely exclusively
on a zero return from read() to indicate EOF.  (rob would probably tell me
that's what I should have done in the first place. I think I even tried
that and it didn't work, which indicates that I need to rethink the code
some more.)

Thanks,

Arnold

P.S., just out of curiousity, can someone feeling charitable try to configure
and compile gawk under Plan 9? I'm curious if it would work, at least under
the APE. ftp://ftp.gnu.org/gnu/gawk/gawk-3.1.2.tar.gz. `configure --disable-nls'
is probably better than plain configure. If it fails, don't feel obligated
to submit patches or sink a lot of time into it. Thanks.

In article <091f807138892efebadcbbde9ac80bd7@plan9.bell-labs.com>,
David Presotto <9fans@cse.psu.edu> wrote:
>-=-=-=-=-=-
>
>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.
>-=-=-=-=-=-
>
>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
>-=-=-=-=-=-


-- 
Aharon (Arnold) Robbins --- Pioneer Consulting Ltd.	arnold@skeeve.com
P.O. Box 354		Home Phone: +972  8 979-0381	Fax: +1 928 569 9018
Nof Ayalon		Cell Phone: +972 51  297-545
D.N. Shimshon 99785	ISRAEL


      parent reply	other threads:[~2003-03-31  9:08 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
2003-03-30 12:48   ` David Presotto
2003-03-30 14:48   ` Russ Cox
2003-03-31  9:08   ` Aharon Robbins [this message]

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='newscache$xkckch$o34$1@lnews.actcom.co.il' \
    --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).