Date: Wed, 17 Jan 2001 18:10:39 -0600 From: Ben Weaver <sid67@tranquility.net> To: questions@freebsd.org Subject: values in struct dqblk returned by quotactl Message-ID: <20010117181039.A16102@tranquility.net>
next in thread | raw e-mail | index | archive | help
Hey all, I just had a quick question about the quotactl(3) function and the values it returns in the dqblk structure defined in ufs/ufs/quota.h. From reading the manpage for quotactl, it seems that it is designed to be a way to read and set quotas for users and groups, among other things. I wrote a small C program (see bottom) to use this function, but everything it returns in the dqblk structure seems to be 2x what the actual values are when I use the quota(1) command. I looked at the source for the quota(1) command, and it appears to grab the quota information directly from the users.quota file (see /usr/src/usr.bin/quota.c getufsquota()). Do I have the wrong impression of the quotactl function, or is there some reason why the values returned are twice what they should be? Thanks, -Ben #include <stdio.h> #include <pwd.h> #include <sys/types.h> #include <ufs/ufs/quota.h> #include <unistd.h> #include <err.h> int main ( ) { struct passwd *entry; struct dqblk quota; entry = getpwnam ("sid67"); if (quotactl ("/home", QCMD(Q_GETQUOTA, USRQUOTA), entry->pw_uid, "a)) { err (1, NULL); exit (1); } printf ("Soft Limit: %d Hard Limit: %d Current: %d\n", quota.dqb_bsoftlimit, quota.dqb_bhardlimit, quota.dqb_curblocks); exit (0); } The output of this program: Soft Limit: 10240 Hard Limit: 20480 Current: 2 The output of the quota sid67 command: Disk quotas for user bweaver (uid 2601): Filesystem blocks quota limit grace files quota limit grace /home 131 5120 10240 17 0 0 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010117181039.A16102>