0

Is there a file system usage measurement in any /sys or /proc files? Similarly for processes, besides diskstats is there a way to read a single number that reports total disk capacity consumed?

I ask because I need it for a low profile program and don't want the overhead of a system call - I'm aware of $df and $du, if necessary I'll read the source code for the answer but hoping if there is an alternative someone will know!

CarlH
  • 111
  • 3

1 Answers1

4

You don't need read code of the df, just run it under the strace.

So, seems like df uses the statfs syscall, not read something in /proc or /sys.

But reading of files happens with system calls, so you cannot avoid any overhead.

Anton Danilov
  • 5,082
  • 2
  • 13
  • 23