From 2158ccb64cca134fe74d42199a68a965b93ff4dd Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Mon, 3 Mar 2003 12:44:05 +0000 Subject: Updated xqmstats (Nathan Scott) --- xqmstats.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'xqmstats.c') diff --git a/xqmstats.c b/xqmstats.c index 88d824b..84e8edf 100644 --- a/xqmstats.c +++ b/xqmstats.c @@ -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 #include @@ -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; -- cgit v1.2.1