Index Index for
Section 2
Index Alphabetical
listing for Q
Bottom of page Bottom of
page

quotactl(2)

NAME

quotactl - Manipulate disk quotas

SYNOPSIS

#include <sys/quota.h> int quotactl( char *path, int cmd, int id, char *addr );

PARAMETERS

path Specifies the pathname of any file within the mounted file system. cmd Specifies a command for interpreting the id parameter. id Specifies the user or group identifier. addr Specifies the address of an optional, command-specific data structure that is copied in or out of the system. The interpretation of the addr parameter is given with each command.

DESCRIPTION

The quotactl() function is used to enable and disable quotas and to manipulate disk quotas for file systems on which quotas have been enabled. Quotas are supported for the UNIX file system (UFS) and the Advanced File System (AdvFS). A command is composed of a primary command (see below) and a command type that is used to interpret the id parameter. Types are supported for interpretation of user identifiers (type USRQUOTA) and group identifiers (type GRPQUOTA). The cmd argument is composed from a type and a specific command with the QCMD macro. For example, to get the quota limits and usage for a group, the cmd argument would be formed by: cmd=QCMD(Q_GETQUOTA, GRPQUOTA); Note that block sizes are in DEV_BSIZE (that is, 512) byte blocks. The specific commands are: Q_QUOTAON Enable disk quotas for the file system specified by the path parameter. The command type specifies the type of the quotas being enabled. The addr parameter specifies a file from which to take the quotas. The quota file must exist; it is normally created with the quotacheck program. The id parameter is unused. Only users with superuser privilege can turn on quotas. Q_QUOTAOFF Disable disk quotas for the file system specified by the path parameter. The command type specifies the type of the quotas being disabled. The addr and id parameters are unused. Only users with superuser privilege can turn off quotas. Q_GETQUOTA Get disk quota limits and current usage for the user or group (as determined by the command type) with identifier id. The addr parameter points to a dqblk32 structure, which is defined in the <quota.h> header file. Quotas must be enabled on the file system for this command to work. Q_SETQUOTA Set disk quota limits for the user or group (as determined by the command type) with identifier id. The addr parameter points to a dqblk32 structure, which is defined in the <quota.h> header file. Quotas must be enabled on the file system for this command to work. The usage fields of the dqblk32 structure are ignored. This function is restricted to processes with superuser privilege. Q_SETUSE Set disk usage limits for the user or group (as determined by the command type) with identifier id. The addr parameter points to a dqblk32 structure, which is defined in the <quota.h> header file. Only the usage fields are used. This function is restricted to processes with superuser privilege. Q_SYNC Update the on-disk copy of quota usages. The command type specifies which type of quotas are to be updated. The id and addr parameters are ignored. Q_QUOTAINFO Returns quota information for the file system, including flags that specify whether user quotas or group quotas are enabled and whether large quotas are supported. The addr parameter points to an int value, and the flags are defined in the <quota.h> header file. Q_GETQUOTA64 Get disk quota limits and current usage for the user or group (as determined by the command type) with identifier id. The addr parameter points to a dQBlk64 structure, which is defined in the <quota.h> header file. Q_SETQUOTA64 Set disk quota limits for the user or group (as determined by the command type) with identifier id. The addr parameter points to a dQBlk64 structure, which is defined in the <quota.h> header file. Q_SETUSE64 Set disk usage limits for the user or group (as determined by the command type) with identifier id. The addr parameter points to a dQBlk64 structure, which is defined in the <quota.h> header file.

NOTES

AdvFS file domains created by Tru64 UNIX Version 5.0 or higher systems can support filesets with increased user and group quota limits, as the on-disk structure that holds the limits has increased from 4 bytes to 8 bytes. However, AdvFS file domains created by Tru64 UNIX systems earlier than Version 5.0 can only support filesets with the smaller user and group quota limits. For example, if you add a fileset to an AdvFS file domain that itself was created by Digital UNIX Version 4.0, the fileset has the smaller user and group quota limits. The root user can exceed user and group quotas.

RETURN VALUES

Upon successful completion, 0 (zero) is returned. Otherwise, -1 is returned and errno is set to indicate the error.

ERRORS

If the quotactl() function fails, errno may be set to one of the following values: [EACCES] Q_QUOTAON: the quota file is not a plain file. Search permission is denied for a component of a path prefix. [EBUSY] Q_QUOTAOFF: an attempt has been made to remove a file during this operation. [EROFS] Q_QUOTAON: the quota file resides on a read-only file system. [EDQUOT] Q_GETQUOTA: one or more of the quota limits being returned is larger than 2 Tb. Q_SETQUOTA64 or Q_SETUSE64: an attempt has been made to set one or more of the quota limits larger than 4 bytes on a fileset that does not support larger quota limits. [EFAULT] An invalid addr is supplied; the associated structure could not be copied in or out of the kernel. The path parameter points outside the process's allocated address space. [EINVAL] The cmd parameter or the command type is invalid. A pathname contains a character with the high-order bit set. Q_GETQUOTA or Q_SETQUOTA: the command was attempted on a file system that did not have quotas enabled. [EIO] An I/O error occurred while reading from or writing to a file containing quotas. [ELOOP] Too many symbolic links were encountered in translating a pathname. [ENAMETOOLONG] A component of the pathname exceeded NAME_MAX, or the entire length of the pathname exceeded PATH_MAX. [ENOENT] A file name does not exist. [ENOTDIR] A component of a path prefix is not a directory. [EOPNOTSUPP] The kernel has not been compiled with the QUOTA option. [EPERM] The call is privileged and the caller does not have appropriate privilege. [EUSERS] The quota table cannot be expanded.

SEE ALSO

Commands: quota(1), edquota(8), quotacheck(8), quotaon(8), repquota(8)

Index Index for
Section 2
Index Alphabetical
listing for Q
Top of page Top of
page