9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] size on /proc files?
@ 2003-03-30 10:36 Aharon Robbins
  2003-03-30 12:34 ` David Presotto
  0 siblings, 1 reply; 5+ messages in thread
From: Aharon Robbins @ 2003-03-30 10:36 UTC (permalink / raw)
  To: 9fans

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-03-31  9:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-30 10:36 [9fans] size on /proc files? 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 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).