quotactl - manipulate disk quotas
int quotactl (int cmd, char *special, int uid, caddr_t addr);
The quotactl(2) call manipulates disk quotas for local EFS and XFS
filesystems. cmd indicates a command to be applied to the user ID uid.
special is a pointer to a null-terminated string containing the pathname
of the block special device for the filesystem being manipulated. The
block special device must be mounted as an EFS or XFS filesystem (see
mount(2)). 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 given with each command below.
Q_QUOTAON [Toc] [Back]
Turn on quotas for a filesystem. In EFS, addr points to the pathname
of the file containing the quotas for the filesystem. This quotas
file must exist. In contrast, XFS provides the ability to turn
on/off quota limit enforcement with quota accounting. Therefore, XFS
expects the addr to be a pointer to an unsigned int that contains
the flags XFS_QUOTA_UDQ_ACCT and/or XFS_QUOTA_UDQ_ENFD defined in
<sys/quota.h>. This call is restricted to the superuser.
Q_QUOTAOFF [Toc] [Back]
Turn off quotas for a filesystem. As in Q_QUOTAON, XFS filesystems
expect a pointer to an unsigned int that specifies whether quota
accounting and/or limit enforcement need to be turned off. The uid
field is ignored. EFS ignores the addr field as well. This call is
restricted to the superuser.
Q_GETQUOTA [Toc] [Back]
Get disk quota limits and current usage for user uid. addr is a
pointer to a dqblk structure (defined in <sys/quota.h> ). Only the
superuser may get the quotas of a user other than himself.
Q_SETQUOTA [Toc] [Back]
Set disk quota limits and current usage for user uid. addr is a
pointer to a dqblk structure (defined in <sys/quota.h> ). This call
is restricted to the superuser, and is not supported in XFS.
Q_SETQLIM [Toc] [Back]
Set disk quota limits for user uid. addr is a pointer to a dqblk
structure (defined in <sys/quota.h> ). This call is restricted to
Q_SYNC [Toc] [Back]
Update the on-disk copy of quota usages for an EFS filesystem. If
special is null then all filesystems with active quotas are sync'ed.
addr and uid are ignored. This option is not supported in XFS since
sync(1M) writes quota information to disk as well.
Q_ACTIVATE [Toc] [Back]
If quotas are not already enabled, this call will permit queries and
updates to be made to the quota file without enabling quotas. addr
points to the pathname of the file containing the quotas for the EFS
filesystem. The quota file must exist. This command is not
applicable to XFS filesystems.
Q_XGETQUOTA [Toc] [Back]
These are extensions to Q_GETQUOTA and Q_SETQLIM respectively to
support the added functionalities of XFS filesystems. Instead of a
dqblk structure, these commands expect a fs_disk_quota structure
defined in <sys/quota.h>.
Q_GETQSTAT [Toc] [Back]
Returns a fs_quota_stat structure containing XFS filesystem specific
quota information. This is useful in finding out how much space is
spent to store quota information, and also to get quotaon/off status
of a given local XFS filesystem.
Q_QUOTARM [Toc] [Back]
Free the disk space taken by disk quotas. Quotas must have already
been turned off.
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and errno is set to indicate the error.
A quotactl(2) call will fail when one of the following occurs:
cmd is invalid.
Quotas have not been turned on for this filesystem.
The call is privileged and the caller was not the superuser.
special is not a mounted EFS or XFS filesystem.
special is not a block device.
(Q_QUOTAON) The quota file pointed to by addr exists but is either
not a regular file or is not on the EFS filesystem pointed to by
special or is not owned by root.
The quota table is full. Doesn't apply to XFS filesystems since XFS
dynamically allocates space for quota information.
Q_QUOTAON attempted on a filesystem where quotas have already been
turned on or Q_QUOTAOFF attempted on a filesystem where quotas have
not been turned on.
The file specified by special or addr does not exist.
addr or special are invalid.
cmd is not supported by the given filesystem.
XFS currently does not support the Q_GETQUOTA and Q_SETQLIM commands.
EFS does not support commands such as Q_XGETQUOTA and Q_XSETQLIM that
take in a fs_disk_quota structure.
quota(1), quotacheck(1M), quotaon(1M), mount(2)
PPPPaaaaggggeeee 3333 [ Back ]