quotactl(2) quotactl(2) NAME quotactl - manipulate disk quotas SYNOPSIS #include <sys/types.h> #include <sys/quota.h> int quotactl (int cmd, char *special, int uid, caddr_t addr); DESCRIPTION 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 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 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 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 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 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 the superuser. Q_SYNC 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 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 Q_XSETQLIM 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 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 Free the disk space taken by disk quotas. Quotas must have already been turned off. RETURN VALUE Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS A quotactl(2) call will fail when one of the following occurs: EINVAL cmd is invalid. ESRCH Quotas have not been turned on for this filesystem. EPERM The call is privileged and the caller was not the superuser. ENODEV special is not a mounted EFS or XFS filesystem. ENOTBLK special is not a block device. EACCES (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. ENOSPC The quota table is full. Doesn't apply to XFS filesystems since XFS dynamically allocates space for quota information. EEXIST 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. ENOENT The file specified by special or addr does not exist. EFAULT addr or special are invalid. ENOTSUP cmd is not supported by the given filesystem. BUGS 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. SEE ALSO quota(1), quotacheck(1M), quotaon(1M), mount(2) Page 3