Name
quotactl — manipulate disk quota
Synopsis
int
quotactl( |
int |
cmd, |
| |
const char * |
special, |
| |
int |
id, |
| |
caddr_t |
addr); |
DESCRIPTION
The quota 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 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 and group quota,
respectively), and subcmd is described
below.
The second argument special is the block special
device these quota apply to. It must be mounted.
The third argument id is the user or group ID
these quota 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 containing the quota for the
filesystem.
Q_QUOTAOFF
-
Disable quota.
Q_GETQUOTA
-
Get limits and current usage of disk space. The
addr argument
is a pointer to a dqblk structure (defined in
<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, −1 is returned, and errno is set appropriately.
ERRORS
- EACCES
-
The quota file is not an ordinary file.
- EBUSY
-
Q_QUOTAON was asked,
but quotas were enabled already.
- EFAULT
-
Bad addr
value.
- EINVAL
-
type is
not a known quota type. Or, special could not be
found.
- EIO
-
Cannot read or write the quota file.
- EMFILE
-
Too many open files: cannot open quota file.
- ENODEV
-
special
cannot be found in the mount table.
- ENOPKG
-
The kernel was compiled without quota support.
- ENOTBLK
-
special is
not a block special device.
- EPERM
-
The process was not root (for the file 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 system
that didn't have quota enabled.
SEE ALSO
quota(1), getrlimit(2), setrlimit(2), ulimit(3), quotacheck(8), quotaon(8)
Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Since the Linux kernel and libraries are constantly changing, this
manual page may be incorrect or out-of-date. The author(s) assume no
responsibility for errors or omissions, or for damages resulting from
the use of the information contained herein. The author(s) may not
have taken the same level of care in the production of this manual,
which is licensed free of charge, as they might when working
professionally.
Formatted or processed versions of this manual, if unaccompanied by
the source, must acknowledge the copyright and authors of this work.
FIXME There is much that is missing and/or out of date in this page.
As things stand the page more or less documents Linux 2.2 reality:
Linux 2.2 has:
Q_GETQUOTA
Q_GETSTATS
Q_QUOTAOFF
Q_QUOTAON
Q_RSQUASH (not currently documented)
Q_SETQLIM
Q_SETQUOTA
Q_SETUSE
Q_SYNC
Linux 2.4 has:
Q_COMP_QUOTAOFF
Q_COMP_QUOTAON
Q_COMP_SYNC
Q_GETFMT
Q_GETINFO
Q_GETQUOTA
Q_QUOTAOFF
Q_QUOTAON
Q_SETINFO
Q_SETQUOTA
Q_SYNC
Q_V1_GETQUOTA Q_V1_GETSTATS Q_V1_RSQUASH Q_V1_SETQLIM
Q_V1_SETQUOTA Q_V1_SETUSE
Q_V2_GETINFO Q_V2_GETQUOTA Q_V2_SETFLAGS Q_V2_SETGRACE
Q_V2_SETINFO Q_V2_SETQUOTA Q_V2_SETUSE
Q_XGETQSTAT Q_XGETQUOTA Q_XQUOTAOFF Q_XQUOTAON Q_XQUOTARM
Q_XSETQLIM
Linux 2.6.16 has:
Q_GETFMT
Q_GETINFO
Q_GETQUOTA
Q_QUOTAOFF
Q_QUOTAON
Q_SETINFO
Q_SETQUOTA
Q_SYNC
Q_XGETQSTAT
Q_XGETQUOTA
Q_XQUOTAOFF
Q_XQUOTAON
Q_XQUOTARM
Q_XQUOTASYNC
Q_XSETQLIM
|