Hello. I have a minor programming problem that some of you may have the answer
to. I have written a program to monitor the free disk space on a group
of file systems that the user specifies and report on significant drops,
etc. I read up on the getmnt system call and am using the information
returned in it. My intention is that the user would specify the mount
point of the file system to be monitored. As it turns out, if you pass
getmnt anything underneath the mount point you still get the info for
the whole file system. For instance, if /usr is mouonted on its own
partition and you getmnt on /usr/share info on /usr is returned.
This is fine behaviour, but consider the case of a separate partition
called, say, /scratch. This gets monitored properly. If /scratch is
now umounted the underlying directory /scratch is revealed, and the next
call to getmnt returns info on / instead of telling me that /scratch is
no longer mounted. This shows up as a huge drop in space on /scratch!
I could code around it if something would tell me if the file system I
pass to getmnt is actually a mount point or not. If it ever stops being
a mount point then I flag the file system as being unmounted until it
comes back on line (is mounted again). Thus there are no spurious
reports of drops in disk space and the correct condition is detected.
Does anyone have a suggestion on how to go about getting this
information? Or perhaps even a better way of detecting this condition
and handling it? Thanks.
I'm running Ultrix 4.2 on a DECstation 5000-200.
Larry Bleau
Physics Dept
University of Maryland
301-405-6180 or -6048
P.S. I haven't yet tried umount-ing a remote file system to see if I
handle that case properly; that should be interesting.