Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Feb 2008 22:02:06 +0200
From:      Ivan Georgiev <yngwiie@bk.ru>
To:        freebsd-hackers@freebsd.org
Subject:   quotactl returns double values
Message-ID:  <20080209220206.695e5d9b.yngwiie@bk.ru>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080209220206.695e5d9b.yngwiie>