NAME
quotactl — manipulate disk quotas
SYNOPSIS
#include <sys/quota.h>
int quotactl(int cmd, const char *special, id_t id, void *addr);
DESCRIPTION
quotactl()
manipulates disk quotas.
cmd
indicates a command to be applied to the user or group
ID
id.
A command is composed of a primary command and a type
that is used to interpret the
id
parameter.
Types supported are
USRQUOTA
for users and
GRPQUOTA
for groups.
To set the type of quota use the
QCMD(cmd, type)
macro.
Parameter
special
is a pointer to a null-terminated string containing the path name
of the block special device for the file system being manipulated.
The block special device must be mounted.
The parameter
addr
is the address of an optional, command-specific, data structure
which is copied in or out of the system.
The interpretation of
addr
is explained with each command below:
- Q_QUOTAON
Turn on quotas for a file system.
The parameter
addr
points to the path name of file containing the quotas for the file system.
The quota file must exist; it is normally created using
the
quotacheck
command (see
quotacheck(1M)).
The
id
parameter is ignored.
This call is restricted to users having appropriate privileges.
- Q_QUOTAOFF
Turn off quotas for a file system.
The
addr
and
id
parameters are ignored.
This call is restricted to the user with appropriate privileges.
- Q_GETQUOTA
Get disk quota limits and current usage for user or group
id.
addr
is a pointer to a
dqblk
structure (defined in
<sys/quota.h>).
Only users having appropriate privileges
can get the quotas of a user other than himself.
- Q_GETQUOTA64
Get 64-bit disk quota limits and current usage for user or group
id.
addr
is a pointer to a
dqblk64
structure (defined in
<sys/quota.h>).
Only users having appropriate privileges
can get the quotas of a user other than himself.
VxFS 3.5 will only track usage for
dqb64_curblocks
up to to 2 TB.
- Q_SETQUOTA
Set disk quota limits and current usage of files and blocks for user or group
id.
Note
vxfs
does not allow the current usage fields to be changed.
addr
is a pointer to a
dqblk
structure (defined in
<sys/quota.h>).
This call is restricted to users with appropriate privileges.
- Q_SETQUOTA64
Set 64-bit disk quota limits and current usage of files and blocks for user or group
id.
Note
vxfs
does not allow the current usage fields to be changed.
addr
is a pointer to a
dqblk64
structure (defined in
<sys/quota.h>).
This call is restricted to users with the appropriate privileges.
- Q_SETQLIM
Set disk quota limits for user or group
id.
The parameter
addr
is a pointer to a
dqblk
structure (defined in
<sys/quota.h>).
This call is restricted to users with appropriate privileges.
- Q_SETQLIM64
Set 64-bit disk quota limits for user or group
id.
The parameter
addr
is a pointer to a
dqblk64
structure (defined in
<sys/quota.h>).
This call is restricted to users with the appropriate privileges.
- Q_QUOTAINFO
Retrieve information about quotas supported by file system
id.
The parameter
addr
is a pointer to a
uint64_t
flags word. The meaning of the various bit fields are defined in
<sys/quota.h>.
- Q_SYNC
Update the on-disk copy of quota usages for a file system.
If
special
is null, all file systems with active quotas are synced.
The parameters
addr
and
id
are ignored.
RETURN VALUE
Upon successful completion,
quotactl()
returns 0; otherwise, it returns -1 and sets
errno
to indicate the error.
ERRORS
quotactl()
fails when any of the following occurs:
- EACCES
The quota file pointed to by
addr
exists but is either not a regular file
or is not on the file system pointed to by
special.
- EBUSY
Q_QUOTAON
attempted while another
Q_QUOTAON
or
Q_QUOTAOFF
is in progress.
- EDQUOT
User's disk quota block limit has been reached for this file system.
- EFAULT
The
addr
or
special
parameter points to an invalid address.
Reliable detection of this error is implementation-dependent.
- EINVAL
The parameters
cmd
and/or
id
are invalid.
- ENODEV
The parameter
special
contains a type of file system
that does not support quotas.
Currently, quotas are
supported on
HFS
and
VxFS
file systems.
- ENOENT
The file specified by
special
or
addr
does not exist.
- ENOSYS
The kernel has not been configured with the disk quota subsystem.
- ENOTBLK
The parameter
special
is not a block device.
- EOPNOTSUPP
Type of quota not supported on the file system.
- EOVERFLOW
64-bit values will overflow 32-bit fields, either in the
dqblk
struct
in the user level (for
Q_GETQUOTA)
or in a 32-bit file system in the kernel (for
Q_SETQUOTA64
and
Q_SETQLIM64).
- EPERM
The call is privileged and the calling process does not have
appropriate privileges.
- ESRCH
No disc quota is found for the indicated user or quotas
have not been turned on for this file system.
WARNINGS
The
quotactl()
system call is incompatible with the 4.2/4.3 BSD implementation
of Melbourne quotas which uses a different system call interface and
on-disk data structure.
Use
Q_GETQUOTA64,
Q_SETQUOTA64,
and
Q_SETQLIM64
commands for 64-bit field values.
AUTHOR
quotactl()
was developed by HP and Sun Microsystems, Inc.