[606] in testers

home help back first fref pref prev next nref lref last post

time limits on quota

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Wed Jan 10 19:59:02 1990

From: jnrees@ATHENA.MIT.EDU
Date: Wed, 10 Jan 90 19:58:32 -0500
To: testers@ATHENA.MIT.EDU

As per Richard's suggestion, I am submitting this here...

I noticed that all users on cyrus:/u3 who were over their quota had an
extraordinary amount of time left to get below their soft quota (on
the order of 250 months).  With a little experimenting, I discovered
that every user was getting 252.2 months instead of the normal 7 days.

It's not documented in any man pages that I could find, but I remember
mar pointing out a comment in some source code to me.  If you make
either the Q_SETQUOTA or Q_SETQLIM call with quotactl with uid=0, the
time limit in the dqblk structure is the new initial time limit used
when users go over their quota.  I then wrote a 35 line kludge to make
this call and fix cyrus:/u3.

#-------------------------------------------------------------------
#include <stdio.h>
#include <ctype.h>
#include <sys/param.h>
#include <sys/time.h>
#include <ufs/quota.h>

/* argv[1] is the block special device */
/* argv[2] is the number of days to set as the time limit */
  
main(int argc, char **argv)
{
  char *device = argv[1];
  int days, returnval, time_limit;
  struct dqblk db;
  
  sscanf(argv[2], "%d", &days);
  time_limit = (days *24*60*60);

  db.dqb_bhardlimit = 0;
  db.dqb_bsoftlimit = 0;
  db.dqb_curblocks = 0;
  db.dqb_fhardlimit = 0;
  db.dqb_fsoftlimit = 0;
  db.dqb_curfiles = 0;
  db.dqb_btimelimit = time_limit;
  db.dqb_btimelimit = time_limit;

  if (returnval = quotactl(Q_SETQLIM, device, 0, &db))
    fprintf(stderr, "ouch! %d\n", returnval);
}
#--------------------------------------------------------------------  

home help back first fref pref prev next nref lref last post