From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: Aharon Robbins Message-ID: References: <200303301036.h2UAaEFZ031353@localhost.localdomain>, <091f807138892efebadcbbde9ac80bd7@plan9.bell-labs.com> Subject: Re: [9fans] size on /proc files? Date: Mon, 31 Mar 2003 09:08:38 +0000 Topicbox-Message-UUID: 87ad377e-eacb-11e9-9e20-41e7f4b1d025 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