2005-08-03 Roland McGrath <roland@redhat.com>
* configure.ac: Check for struct dqblk.dqb_curblocks field.
* resource.c [LINUX] (OLD_CMD): New macro.
(quotacmds): Use it to hard-wire old O_* values, don't use macros.
(sys_quotactl): If dqb_curblocks is not there, it's called
dqb_curspace instead. Print dqb_* fields as unsigned long long.
diff --git a/configure.ac b/configure.ac
index 572adfd..405a6cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -216,6 +216,8 @@
AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
+AC_CHECK_MEMBERS([struct dqblk.dqb_curblocks],,, [#include <sys/quota.h>])
+
AC_CHECK_DECLS([sys_errlist])
AC_CHECK_DECLS([sys_siglist, _sys_siglist],,, [#include <signal.h>])
diff --git a/resource.c b/resource.c
index e346eae..1fc6155 100644
--- a/resource.c
+++ b/resource.c
@@ -529,21 +529,29 @@
if (!tcp->u_arg[3])
tprintf("NULL");
- else if (!verbose(tcp) || !OLD_COMMAND(cmd))
+ else if (!verbose(tcp) ||
+#ifdef HAVE_STRUCT_DQBLK_DQB_CURBLOCKS
+ !
+#endif
+ OLD_COMMAND(cmd))
tprintf("%#lx", tcp->u_arg[3]);
else if (umoven(tcp, tcp->u_arg[3], sizeof(struct dqblk),
(char *) &dq) < 0)
tprintf("???");
else {
tprintf("{");
- tprintf("%u, ", dq.dqb_bhardlimit);
- tprintf("%u, ", dq.dqb_bsoftlimit);
- tprintf("%u, ", dq.dqb_curblocks);
- tprintf("%u, ", dq.dqb_ihardlimit);
- tprintf("%u, ", dq.dqb_isoftlimit);
- tprintf("%u, ", dq.dqb_curinodes);
- tprintf("%lu, ", dq.dqb_btime);
- tprintf("%lu", dq.dqb_itime);
+ tprintf("%llu, ", (unsigned long long) dq.dqb_bhardlimit);
+ tprintf("%llu, ", (unsigned long long) dq.dqb_bsoftlimit);
+#ifdef HAVE_STRUCT_DQBLK_DQB_CURBLOCKS
+ tprintf("%llu, ", (unsigned long long) dq.dqb_curblocks);
+#else
+ tprintf("%llu, ", (unsigned long long) dq.dqb_curspace);
+#endif
+ tprintf("%llu, ", (unsigned long long) dq.dqb_ihardlimit);
+ tprintf("%llu, ", (unsigned long long) dq.dqb_isoftlimit);
+ tprintf("%llu, ", (unsigned long long) dq.dqb_curinodes);
+ tprintf("%llu, ", (unsigned long long) dq.dqb_btime);
+ tprintf("%llu", (unsigned long long) dq.dqb_itime);
tprintf("}");
}