QUOTACTL(2) Linux Programmer's Manual QUOTACTL(2)
NAME
quotactl - manipulate disk quota(1,8)
SYNOPSIS
#include <sys/types.h>
#include <sys/quota.h>
int quotactl(int cmd, const char *special, int id, caddr_t addr);
#include <linux/unistd.h>
_syscall4(int, quotactl, int, cmd, const char *, special , int, id,
caddr_t, addr);
DESCRIPTION
The quota(1,8) system defines for each user and/or group a soft limit and a
hard limit bounding the amount of disk space that can be used on a
given file(1,n) system. The hard limit cannot be crossed. The soft limit
can be crossed, but warnings will ensue. Moreover, the user cannot be
above the soft limit for more than one week (by default) at a time:
after this week the soft limit counts as hard limit.
The quotactl system call manipulates these quota. Its first argument is
of the form QCMD(subcmd,type) where type is either USRQUOTA or GRPQUOTA
(for user quota(1,8) and group quota(1,8), respectively), and subcmd is described
below.
The second argument special is the block special device these quota(1,8)
apply to. It must be mounted.
The third argument id is the user or group ID these quota(1,8) apply to
(when relevant).
The fourth argument addr is the address of a data structure, depending
on the command.
The subcmd is one of
Q_QUOTAON Enable quota. The addr argument is the pathname of the file(1,n)
containing the quota(1,8) for the filesystem.
Q_QUOTAOFF Disable quota.
Q_GETQUOTA Get limits and current usage of disk space. The addr argu-
ment is a pointer to a dqblk structure (defined in(1,8)
<sys/quota.h>).
Q_SETQUOTA Set limits and current usage; addr is as before.
Q_SETQLIM Set limits; addr is as before.
Q_SETUSE Set usage.
Q_SYNC Sync disk copy of a filesystem's quota.
Q_GETSTATS Get collected stats.
RETURN VALUE
On success, quotactl returns 0. On error(8,n), -1 is returned, and errno is
set(7,n,1 builtins) appropriately.
ERRORS
EACCES The quota(1,8) file(1,n) is not an ordinary file.
EBUSY Q_QUOTAON was asked, but quota(1,8) were enabled already.
EFAULT Bad addr value.
EINVAL type is not a known quota(1,8) type. Or, special could not be
found.
EIO Cannot read(2,n,1 builtins) or write(1,2) the quota(1,8) file.
EMFILE Too many open(2,3,n) files: cannot open(2,3,n) quota(1,8) file.
ENODEV special cannot be found in(1,8) the mount(2,8) table.
ENOPKG The kernel was compiled without quota(1,8) support.
ENOTBLK special is not a block special device.
EPERM The process was not root (for the file(1,n) system), and Q_GETQUOTA
was asked for another id than that of the process itself, or
anything other than Q_GETSTATS or Q_SYNC was asked.
ESRCH Q_GETQUOTA or Q_SETQUOTA or Q_SETUSE or Q_SETQLIM was asked
for a file(1,n) system that didn't have quota(1,8) enabled.
CONFORMING TO
BSD
SEE ALSO
quota(1,8)(1), getrlimit(2), setrlimit(2), ulimit(3), quotacheck(8), quo-
taon(8)
Linux 1.3.88 1996-04-14 QUOTACTL(2)