Skip to content

Instantly share code, notes, and snippets.

@nicdoye

nicdoye/inodes.c

Created Jan 28, 2013
Embed
What would you like to do?
List number of inodes for file system and how many spare.
#include <stdio.h>
#include <stdlib.h>
#include <sys/statvfs.h>
int main(int argc, char **argv)
{
struct statvfs _statvfs;
if ( argc != 2 )
{
printf("Just the one argument please\n");
exit(1);
}
if ( statvfs( argv[1] , &_statvfs ) != 0 ) {
printf("Something went wrong. Is %s a valid mount point?\n", argv[1]);
exit(2);
}
printf("inodes\t%lld\nfree\t%lld\nufree\t%lld\n",
(long long) _statvfs.f_files,
(long long) _statvfs.f_ffree,
(long long) _statvfs.f_favail );
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.