* v1.24, 12 Mar 1997, Rewritten code for console checking (I *hate* bloody Digital!!!)
* v1.25, 2002-04-28, Initial port to Debian GNU/Linux, limited functionality
* v1.26, 2003-12-05, quota for Linux. Only new style quotactl() on i386.
+ * v1.27, 2009-05-20, x86_64 version
*
* Written by Zlatko Calusic
* Linux port Zoran Dzelajlija
+ * Linux amd64 port Ivan Rako
*
* SRCE, University Computing Centre, Croatia
* CARNet, Croatian Academic and Research Network
struct dqblk qval;
struct stat statbuf;
#elif defined(__linux__)
- #if defined(__i386__)
+ #if defined(__i386__) || defined(__x86_64__)
struct if_dqblk qval; /* sys/quota.h is wrong for 2.4.23/i386 */
#elif defined(__sparc__)
struct dqblk qval; /* 2.4.23/sparc is different */
priv(OFF);
time(&now);
if (qval.dqb_bsoftlimit && (
- #if defined (__i386__)
+ #if defined(__i386__) || defined(__x86_64__)
qval.dqb_curspace
- #elif defined (__sparc__)
+ #elif defined(__sparc__)
+ qval.dqb_curblocks
+ #endif
+ /1024) >= qval.dqb_bsoftlimit) {
+ if (!qval.dqb_btime)
+ qval.dqb_btime = now + MAX_DQ_TIME;
+ }
+ else
+ qval.dqb_btime = 0;
+ if (qval.dqb_isoftlimit && qval.dqb_curinodes >= qval.dqb_isoftlimit) {
+ if (!qval.dqb_itime)
+ qval.dqb_itime = now + MAX_DQ_TIME;
+ }
+ else
+ qval.dqb_itime = 0;
+ } else {
+ priv(OFF);
+ fputs("Ne mogu utvrditi trenutne vrijednosti quote!\n", stderr);
+ waitkey();
+ return;
+ }
+ #endif
+
+ #ifdef __x86_64__
+ /* get previous quota values and update times */
+ priv(ON);
+ if (!quotactl(QCMD(Q_GETQUOTA, USRQUOTA), devname, pwd->pw_uid, (caddr_t) &qval)) {
+ priv(OFF);
+ time(&now);
+ if (qval.dqb_bsoftlimit && (
+ #if defined(__i386__) || defined(__x86_64__)
+ qval.dqb_curspace
+ #elif defined(__sparc__)
qval.dqb_curblocks
#endif
/1024) >= qval.dqb_bsoftlimit) {
if (!soft)
fputs("Korisnik ce imati neogranicen pristup diskovnom prostoru!\n", stderr);
#if defined(__linux__)
- #if defined(__i386__)
+ #if defined(__i386__) || defined(__x86_64__)
/* Actually most of these are u_int64_t. */
qval.dqb_bsoftlimit = (u_int32_t) soft;
qval.dqb_bhardlimit = (u_int32_t) hard;
qval.dqb_isoftlimit = qval.dqb_ihardlimit = (u_int32_t) 0;
qval.dqb_btime = (time_t) now + MAX_DQ_TIME;
qval.dqb_itime = (time_t) now + MAX_IQ_TIME;
- #if defined(__i386__)
+ #if defined(__i386__) || defined(__x86_64__)
/* Set limits and times */
qval.dqb_valid = QIF_LIMITS | QIF_TIMES;
#endif
priv(ON);
if (!
- #if defined (__i386__)
+ #if defined(__i386__) || defined(__x86_64__)
quotactl(QCMD(Q_SETQUOTA, USRQUOTA), devname, pwd->pw_uid, (caddr_t) &qval)
#elif defined (__sparc__)
quotactl(QCMD(Q_SETQLIM, USRQUOTA), devname, pwd->pw_uid, (caddr_t) &qval)