diff options
author | jkar8572 <jkar8572> | 2003-03-03 12:44:05 +0000 |
---|---|---|
committer | jkar8572 <jkar8572> | 2003-03-03 12:44:05 +0000 |
commit | 2158ccb64cca134fe74d42199a68a965b93ff4dd (patch) | |
tree | ff28538c5bb168eb7c5d62119259d0719ccb0e8e /xqmstats.c | |
parent | f15de44817354eade928b52f5c9f9653e24a0920 (diff) | |
download | linuxquota-2158ccb64cca134fe74d42199a68a965b93ff4dd.tar.gz |
Updated xqmstats (Nathan Scott)
Diffstat (limited to 'xqmstats.c')
-rw-r--r-- | xqmstats.c | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -2,7 +2,7 @@ * Display XFS quota manager statistics from /proc. */ -#ident "Copyright (c) 2001 Silicon Graphics, Inc." +#ident "Copyright (c) 2001-2003 Silicon Graphics, Inc." #include <stdio.h> #include <unistd.h> @@ -12,6 +12,7 @@ #define XQMFILE "/proc/fs/xfs/xqm" #define STATFILE "/proc/fs/xfs/stat" +#define XQMSTATS "/proc/fs/xfs/xqmstat" char *progname; @@ -26,10 +27,16 @@ int main(int argc, char **argv) memset(values, 0, sizeof(unsigned) * 8); - if ((stats = fopen(STATFILE, "r")) == NULL || (xqm = fopen(XQMFILE, "r")) == NULL) { + if ((xqm = fopen(XQMFILE, "r")) == NULL) { errstr(_("The running kernel does not support XFS\n")); return 1; } + if ((stats = fopen(XQMSTATS, "r")) == NULL) { + if ((stats = fopen(STATFILE, "r")) == NULL) { + errstr(_("The running kernel does not support XFS\n")); + return 1; + } + } while (!feof(stats)) { fgets(buffer, 256, stats); if (sscanf(buffer, "qm %u %u %u %u %u %u %u %u\n", @@ -48,9 +55,11 @@ int main(int argc, char **argv) printf(_(" shake reclaims: %u\n"), values[6]); printf(_(" inact reclaims: %u\n"), values[7]); } - if (fscanf(xqm, "%u %u %u %u\n", &values[0], &values[1], &values[2], &values[3]) == 4) - printf(_("Maximum %u dquots (currently %u incore, %u on freelist)\n"), values[0], - values[1], values[3]); + if (fscanf(xqm, "%u %u %u %u\n", + &values[0], &values[1], &values[2], &values[3]) == 4) + printf( + _("Maximum %u dquots (currently %u incore, %u on freelist)\n"), + values[0], values[1], values[3]); fclose(stats); fclose(xqm); return 0; |