[EMAIL PROTECTED] wrote:
>
> Peter Pilgrim wrote:
> >
> > I am interesting in getting the disk space and partition
> > in a Java program by using JNI. What is the std UNIX API
> > call to do this? I have tried grepping the man pages
> > and got the source to kdf program but it didn't help
> > because it was executing `/usr/bin/df -k -T' and parsing
> > the output. Is there a native portable UNIX system call that
> > provides partition information and also disk space size and free
> > information?
>
> I don't know of a standard UNIX API, and I don't think that Wintel's
> notion of partitions is particularly portable. On Linux, you can get
> some of the information you want from the /proc filesystem:
>
> /proc/partitions gives you a lists of hard drive partitions and their
> sizes
>
> /proc/mounts shows you what's mounted where
>
> What you don't get from these two files is:
>
> 1) What device is serving as your root partition (/proc/mounts calls it,
> annoyingly, /dev/root)
>
> 2) How full the partition is
>
> You can also get the df.c source (it's about 800 lines of open source)
> and learn about the APIs it uses (it doesn't appear to use the /proc
> filesystem). Looks like there are some interesting APIs described in
> header files named mountlist.h and fsusage.h. If you don't have a
> convenient source, I can send it to you.
>
> You were probably hoping for a more portable answer... I'm not aware of
> one.
I had look in Advanced UNIX Environment Programming W.Richard Steven book
but could n't find anything there. I guess this is why kde utility `kdf.c'
called the `df' command directly. These header files appear to
linux specific. Looking on my Solaris box now I dont know of any
equivalent ones.
The reason I want to know it would be nice to see the Volumes concepts
like the Macintosh has mounted disks, and shared volumes. Actually
I thinking of small Java and UNIX API to allow Java apps to integrate
better with the UNIX system.
Oh Well. Can you send me the source to `df.c'anyway.
--
Adios
Peter
-----------------------------------------------------------------
import std.Disclaimer; // More Java for your Lava, Mate.
"Give the man, what he wants. £££" [on Roy Keane, Quality Player]
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]