On Tue, Mar 20, 2018 at 08:21:44PM +1100, Tim Connors wrote:
I have a very minimal system where I can't use df
because I want an
extended output df can't do, and I can't install CPAN modules (there isn't
Filesys::Df, Filesys::Statfs, etc)
I want it to take args of a given file/directory.
stat()'s first returned arg is st_dev. What's a system call that can
return current usage and total size of a dev?
stracing df shows it does a stat then a statfs, but I can't seem to access
the statfs system call from perl without Filesys::Statfs.
You could use perl's syscall function to call statfs. Basic info in:
perldoc -f syscall
man 2 statfs
You'd have to unpack the returned data struct. Maybe grep for syscall in
Filesys::Df or Filesys::Statfs to see how they do it and swipe it.
craig sanders <cas(a)taz.net.au>