From 88c7f535fbe80d96cf5ee15a3a2aa1bd1c535e1f Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Mon, 16 Jul 2001 03:24:49 +0000 Subject: Fixed quotastats(8) Grace times are now set when limits are set and usage is over limit. Added LARGEFILE flag to CFLAGS. --- quotastats.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'quotastats.c') diff --git a/quotastats.c b/quotastats.c index 522f6a6..a584b72 100644 --- a/quotastats.c +++ b/quotastats.c @@ -10,7 +10,7 @@ * * Author: Marco van Wieringen * - * Version: $Id: quotastats.c,v 1.2 2001/05/02 09:32:22 jkar8572 Exp $ + * Version: $Id: quotastats.c,v 1.3 2001/07/16 03:24:49 jkar8572 Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -21,13 +21,27 @@ #include #include #include +#include +#include #include "pot.h" #include "quota.h" +#include "quotaio_v1.h" +#include "dqblk_v1.h" static inline int get_stats(struct dqstats *dqstats) { - return quotactl(QCMD(Q_GETSTATS, 0), (char *)NULL, 0, (caddr_t)dqstats); + struct v1_dqstats old_dqstats; + + if (quotactl(QCMD(Q_GETSTATS, 0), NULL, 0, (caddr_t)dqstats) < 0) { + if (errno != EINVAL) + return -1; + if (quotactl(QCMD(Q_V1_GETSTATS, 0), NULL, 0, (caddr_t)&old_dqstats) < 0) + return -1; + memcpy(dqstats, &old_dqstats, sizeof(old_dqstats)); + dqstats->version = 0; + } + return 0; } static inline int print_stats(struct dqstats *dqstats) -- cgit v1.2.3