From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,d5f1800da7e00146,start X-Google-Attributes: gidfee84,public From: Mark Nelson Subject: Problem with quotactl Date: 1997/05/04 Message-ID: <336D0DD3.28551810@ramius.demon.co.uk>#1/1 X-Deja-AN: 239347750 X-NNTP-Posting-Host: ramius.demon.co.uk Newsgroups: comp.unix.osf.osf1 Hi I'm trying to port a program from a sun running 4.1.3 to OSF1, the uname output of the development machine is OSF1 leo V3.2 41 alpha and the output of the uname command machine on which the program will eventually run is OSF1 scorpio.tees.ac.uk V3.2 148 alpha. To access the quota information I am using the quotactl system call, which according to the man page it takes the following parameters - quotactl(device,QCMD(GETQUOTA,USRQUOTA),uid,"a); Unfortunatly when I run the program I get error 22 returned when I try to do a getquota call. Below is the output of program - # df /usr Filesystem 512-blocks Used Avail Capacity Mounted on /dev/rz0g 1603526 1126522 316650 78% /usr # ./a.out /dev/rz0g cmt17 1 3 417 -2147404728 1023 3 1 setting Quota error 22 returned from quotactl(Q_SETQUOTA) Below is the source code, any help is greatfully received Can anyoue replying mail me at work on Mark.Nelson@tees.ac.uk Thanks /* * * * * change_quota * * Based loosly on the forcequota written by Gary Quinn, this version has * been modified to work on all SCM supported machines, currently Sun's, * Alpha's and SG's * * (c) Mark Nelson - 18-April-1997 * * * */ #include #include #include #include #include #define TRUE 1 #define FALSE 0 int main(int argc, char *argvstruct dqblk quota; struct passwd *passwd_details; int result,uid,loop,len; /* * * * * Validate the parameters, check to see if the user exists * and the hard and soft limits are numeric. * * * */ if (argc!=5) { fprintf(stderr,"Usage : %s directory userid soft hard\n",argv[0]); return(0); } len=strlen(argv[3]); for(loop=0;looppw_uid); result = quotactl(argv[1],QCMD(Q_GETQUOTA,USRQUOTA),passwd_details->pw_uid,&qu ota); uid=passwd_details->pw_uid; /* sun code result = quotactl(Q_GETQUOTA,argv[1],(int)uid,"a); */ printf("%d %d\n",quota.dqb_bhardlimit,quota.dqb_bsoftlimit); if (result == -1) /* error */ { printf("error %d returned from quotactl(Q_GETQUOTA)\n",errno); return -2; } else { quota.dqb_bhardlimit = atoi(argv[4]); /* 1 block = 1K */ quota.dqb_bsoftlimit = atoi(argv[3]); printf("%d %d\n",quota.dqb_bhardlimit,quota.dqb_bsoftlimit); puts("setting Quota"); result = quotactl(argv[1],QCMD(Q_SETQUOTA,USRQUOTA),passwd_details->pw_ui d,"a); if (result == -1) /* error */ { fprintf(stderr,"error %d returned from quotactl(Q_SETQUOTA)\n",errno); return -3; } } } Mark. Mark Nelson - mark@ramius.demon.co.uk