From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <091f807138892efebadcbbde9ac80bd7@plan9.bell-labs.com> From: David Presotto To: 9fans@cse.psu.edu Subject: Re: [9fans] size on /proc files? In-Reply-To: <200303301036.h2UAaEFZ031353@localhost.localdomain> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="upas-vcfwjwqppfvltlssqmvjhyjmii" Date: Sun, 30 Mar 2003 07:34:41 -0500 Topicbox-Message-UUID: 86ed18b8-eacb-11e9-9e20-41e7f4b1d025 This is a multi-part message in MIME format. --upas-vcfwjwqppfvltlssqmvjhyjmii Content-Disposition: inline Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit 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. --upas-vcfwjwqppfvltlssqmvjhyjmii Content-Type: message/rfc822 Content-Disposition: inline Received: from plan9.cs.bell-labs.com ([135.104.9.2]) by plan9; Sun Mar 30 05:35:29 EST 2003 Received: from mail.cse.psu.edu ([130.203.4.6]) by plan9; Sun Mar 30 05:35:26 EST 2003 Received: from psuvax1.cse.psu.edu (psuvax1.cse.psu.edu [130.203.30.6]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id F25FB19A6F; Sun, 30 Mar 2003 05:35:10 -0500 (EST) Delivered-To: 9fans@cse.psu.edu Received: from skeeve.com (ads5.ads.active.net.il [192.117.127.213]) by mail.cse.psu.edu (CSE Mail Server) with ESMTP id 6C35B19A65 for <9fans@cse.psu.edu>; Sun, 30 Mar 2003 05:34:26 -0500 (EST) Received: from localhost.localdomain (skeeve [127.0.0.1]) by skeeve.com (8.12.5/8.12.5) with ESMTP id h2UAaFKj031355 for <9fans@cse.psu.edu>; Sun, 30 Mar 2003 13:36:16 +0300 Received: (from arnold@localhost) by localhost.localdomain (8.12.5/8.12.5/Submit) id h2UAaEFZ031353 for 9fans@cse.psu.edu; Sun, 30 Mar 2003 13:36:14 +0300 From: Aharon Robbins Message-Id: <200303301036.h2UAaEFZ031353@localhost.localdomain> To: 9fans@cse.psu.edu Subject: [9fans] size on /proc files? Sender: 9fans-admin@cse.psu.edu Errors-To: 9fans-admin@cse.psu.edu X-BeenThere: 9fans@cse.psu.edu X-Mailman-Version: 2.0.11 Precedence: bulk Reply-To: 9fans@cse.psu.edu List-Id: Fans of the OS Plan 9 from Bell Labs <9fans.cse.psu.edu> List-Archive: Date: Sun, 30 Mar 2003 13:36:14 +0300 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 --upas-vcfwjwqppfvltlssqmvjhyjmii--