Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!inuxc!pur-ee!uiucdcs!parsec!ctvax!uokvax!jab From: jab@uokvax.UUCP Newsgroups: net.unix Subject: Re: Question about ustat(2) and free dis - (nf) Message-ID: <5964@uiucdcs.UUCP> Date: Thu, 1-Mar-84 04:35:19 EST Article-I.D.: uiucdcs.5964 Posted: Thu Mar 1 04:35:19 1984 Date-Received: Sat, 3-Mar-84 08:48:43 EST Lines: 61 #R:forcm5:-12800:uokvax:6100021:000:2703 uokvax!jab Feb 21 18:49:00 1984 /***** uokvax:net.unix / forcm5!jr / 3:47 am Feb 18, 1984 */ 1) What happened to ustat? 2) What are/were it's arguments? I assume it returned a long, for the number of bytes (where -1 might mean an error of some sort). 3) How can someone do the same thing without using the ustat system call? 4) How does df(1) work? -- JR (John Rogers) UUCP: forcm5!jr, fortune!jr, proper!jr CompuServe: 70140,213 /* ---------- */ I can answer a little of that. If I had the "PWB/Unix" manual, I could answer a whole lot more! i) "ustat" was a system call that you gave a special device name and a structure to be filled in. It looked up that device in the in-core mount table and copied specific items out. As I remember, the old RJE used it a lot. (I seem to remember our local wizard, one of only of few I've ever met, bumping into this when he put RJE on our top of a V6 system.) ii) I just looked through the System III kernel, and it's there. It's under the name "utssys", although there is a C library interface: #include#include int ustat(dev, buf) int dev; /* major/minor of special device */ struct ustat *buf; The "struct ustat" contains the volume name and pack name and the number of free inodes/blocks. iii) It's on system V, also --- I stole the above C statements from a system V manual. iv) I assume that you could do the same thing FOR AN UNMOUNTED FILESYSTEM by opening that device and copying out the information from the superblock --- it's all there. For a mounted filesystem, you need to be able to get to the in-core superblock, and that's more trouble than it's worth. (Well, I suppose you could just "sync()" before getting it off the special device, but...) v) Different versions of "df" do different things. The Berkeley 2.8 "df", if I remember, went out to the disk and counted the number of free blocks! (Most of the older "df" commands do this.) On a lot of systems that don't have "ustat", you just grab the info you want out of the superblock. Peter Staubach here at OU hacked the "ustat" system call into his 2.8 pdp-11 system, and "df" does a "ustat" first, and if that fails, THEN it gets the info off the superblock. To put it mildly, it runs pretty quickly. I think I messed up the numbering scheme. Oh, well. The "ustat" system call, along with several other PWB notions, was never bought back by the people that gave us Version 7 and Unix/32V. (Version 7 begat 2.8bsd, and Unix/32V begat 3bsd and 4.Xbsd.) This explains why it wasn't in any of those versions --- the system III and system V are direct decendents of PWB, so those notions are in system {III,V}. Jeff Bowles Lisle, IL