Merge branch 'master' of ssh://gapil.gnulinux.it/srv/git/gapil
[gapil.git] / listati / get_quota.c
1 PyObject * get_quota(int who, int id, const char *dev) 
2 {
3   struct dqblk dq;
4   
5   if (!quotactl(QCMD(Q_GETQUOTA,who), dev, id, (caddr_t) &dq)) {
6     return Py_BuildValue("({s:K,s:(KK),s:K},{s:K,s:(KK),s:K})",
7                          "used", dq.dqb_curspace,
8                          "quota", dq.dqb_bsoftlimit, dq.dqb_bhardlimit,
9                          "grace", dq.dqb_btime,
10                          "used", dq.dqb_curinodes,
11                          "quota", dq.dqb_isoftlimit, dq.dqb_ihardlimit,
12                          "grace", dq.dqb_itime );
13   } else {
14     PyErr_SetFromErrno(PyExc_OSError);
15     return NULL;
16   }
17 }