quotactl returns double values
Ivan Georgiev
yngwiie at bk.ru
Sat Feb 9 20:08:23 UTC 2008
Hello,
I was just playing, trying to see how quotactl works,
but in all my tries the values returned are doubled,
here is an example:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <ufs/ufs/quota.h>
#include <errno.h>
int main(int argc, char* argv[]) {
struct dqblk *my_st;
const char* path = "/usr";
int uid;
my_st = malloc(sizeof(struct dqblk));
uid = atoi(argv[1]);
if((quotactl(path,QCMD(Q_GETQUOTA,USRQUOTA),uid,my_st)) < 0) {
free(my_st);
perror("error");
exit(-1);
}
printf("User Hard Limit : %d\n \
Actual Usage : %d\n", my_st->dqb_bhardlimit, \
my_st->dqb_curblocks);
free(my_st);
return 0;
}
the values stored in my_st->dqb_bhardlimit and my_st->dqb_curblocks
are the real values times two, the hard limit on the user is 102400K,
but my_st->dqb_bhardlimit holds 204800K.
Could someone please tell me what i am doing wrong.
Thanks in advance.
Regards:
Ivan
More information about the freebsd-hackers
mailing list