Manual Pages for Linux CentOS command on man quotactl
MyWebUniversity

Manual Pages for Linux CentOS command on man quotactl

QUOTACTL(2) Linux Programmer's Manual QUOTACTL(2)

NAME

quotactl - manipulate disk quotas SYNOPSIS

#include

#include int quotactl(int cmd, const char *special, int id, caddrt addr); DESCRIPTION

The quota system can be used to set per-user and per-group limits on the amount of disk space used on a file system. For each user and/or group, a soft limit and a hard limit can be set for each file system. The hard limit can't be exceeded. The soft limit can be exceeded, but warnings will ensue. Moreover, the user can't exceed the soft limit for more than one week (by default) at a time; after this time, the soft limit counts as a hard limit. The quotactl() call manipulates disk quotas. The cmd argument indi‐ cates a command to be applied to the user or group ID specified in id. To initialize the cmd argument, use the QCMD(subcmd, type) macro. The type value is either USRQUOTA, for user quotas, or GRPQUOTA, for group quotas. The subcmd value is described below.

The special argument is a pointer to a null-terminated string contain‐ ing the pathname of the (mounted) block special device for the file system being manipulated.

The addr argument is the address of an optional, command-specific, data structure that is copied in or out of the system. The interpretation of addr is given with each command below. The subcmd value is one of the following: QQUOTAON Turn on quotas for a file system. The id argument is the iden‐ tification number of the quota format to be used. Currently, there are three supported quota formats: QFMTVFSOLD The original quota format. QFMTVFSV0 The standard VFS v0 quota format, which can handle

32-bit UIDs and GIDs and quota limits up to 2^42 bytes and 2^32 inodes.

QFMTVFSV1 A quota format that can handle 32-bit UIDs and GIDs and quota limits of 2^64 bytes and 2^64 inodes. The addr argument points to the pathname of a file containing the quotas for the file system. The quota file must exist; it is normally created with the quotacheck(8) program. This oper‐ ation requires privilege (CAPSYSADMIN). QQUOTAOFF Turn off quotas for a file system. The addr and id arguments are ignored. This operation requires privilege (CAPSYSADMIN). QGETQUOTA Get disk quota limits and current usage for user or group id. The addr argument is a pointer to a dqblk structure defined in as follows:

/* uint64t is an unsigned 64-bit integer;

uint32t is an unsigned 32-bit integer */ struct dqblk { /* Definition since Linux 2.4.22 */ uint64t dqbbhardlimit; /* absolute limit on disk quota blocks alloc */ uint64t dqbbsoftlimit; /* preferred limit on disk quota blocks */ uint64t dqbcurspace; /* current quota block count */ uint64t dqbihardlimit; /* maximum number of allocated inodes */ uint64t dqbisoftlimit; /* preferred inode limit */ uint64t dqbcurinodes; /* current number of allocated inodes */ uint64t dqbbtime; /* time limit for excessive disk use */ uint64t dqbitime; /* time limit for excessive files */ uint32t dqbvalid; /* bit mask of QIF* constants */ }; /* Flags in dqbvalid that indicate which fields in dqblk structure are valid. */

#define QIFBLIMITS 1

#define QIFSPACE 2

#define QIFILIMITS 4

#define QIFINODES 8

#define QIFBTIME 16

#define QIFITIME 32

#define QIFLIMITS (QIFBLIMITS | QIFILIMITS)

#define QIFUSAGE (QIFSPACE | QIFINODES)

#define QIFTIMES (QIFBTIME | QIFITIME)

#define QIFALL (QIFLIMITS | QIFUSAGE | QIFTIMES) The dqbvalid field is a bit mask that is set to indicate the entries in the dqblk structure that are valid. Currently, the kernel fills in all entries of the dqblk structure and marks them as valid in the dqbvalid field. Unprivileged users may retrieve only their own quotas; a privileged user (CAPSYSADMIN) can retrieve the quotas of any user. QSETQUOTA Set quota information for user or group id, using the informa‐ tion supplied in the dqblk structure pointed to by addr. The dqbvalid field of the dqblk structure indicates which entries in the structure have been set by the caller. This operation supersedes the QSETQLIM and QSETUSE operations in the previ‐ ous quota interfaces. This operation requires privilege (CAPSYSADMIN). QGETINFO Get information (like grace times) about quotafile. The addr argument should be a pointer to a dqinfo structure. This structure is defined in as follows:

/* uint64t is an unsigned 64-bit integer;

uint32t is an unsigned 32-bit integer */ struct dqinfo { /* Defined since kernel 2.4.22 */ uint64t dqibgrace; /* Time before block soft limit becomes hard limit */ uint64t dqiigrace; /* Time before inode soft limit becomes hard limit */ uint32t dqiflags; /* Flags for quotafile (DQF*) */ uint32t dqivalid; }; /* Bits for dqiflags */ /* Quota format QFMTVFSOLD */

#define V1DQFRSQUASH 1 /* Root squash enabled */ /* Other quota formats have no dqiflags bits defined */ /* Flags in dqivalid that indicate which fields in dqinfo structure are valid. */

# define IIFBGRACE 1

# define IIFIGRACE 2

# define IIFFLAGS 4

# define IIFALL (IIFBGRACE | IIFIGRACE | IIFFLAGS) The dqivalid field in the dqinfo structure indicates the entries in the structure that are valid. Currently, the kernel fills in all entries of the dqinfo structure and marks them all as valid in the dqivalid field. The id argument is ignored. QSETINFO Set information about quotafile. The addr argument should be a pointer to a dqinfo structure. The dqivalid field of the dqinfo structure indicates the entries in the structure that have been set by the caller. This operation supersedes the QSETGRACE and QSETFLAGS operations in the previous quota interfaces. The id argument is ignored. This operation requires privilege (CAPSYSADMIN). QGETFMT Get quota format used on the specified file system. The addr

argument should be a pointer to a 4-byte buffer where the for‐ mat number will be stored.

QSYNC Update the on-disk copy of quota usages for a file system. If special is NULL, then all file systems with active quotas are sync'ed. The addr and id arguments are ignored. QGETSTATS Get statistics and other generic information about the quota subsystem. The addr argument should be a pointer to a dqstats structure in which data should be stored. This structure is defined in . The special and id arguments are ignored. This operation is obsolete and not supported by recent kernels. Files in /proc/sys/fs/quota/ carry the infor‐ mation instead. For XFS file systems making use of the XFS Quota Manager (XQM), the above commands are bypassed and the following commands are used: QXQUOTAON Turn on quotas for an XFS file system. XFS provides the abil‐ ity to turn on/off quota limit enforcement with quota account‐ ing. Therefore, XFS expects addr to be a pointer to an unsigned int that contains either the flags XFSQUOTAUDQACCT and/or XFSQUOTAUDQENFD (for user quota), or XFSQUOTAGDQACCT and/or XFSQUOTAGDQENFD (for group quota), as defined in . This operation requires privilege (CAPSYSADMIN). QXQUOTAOFF Turn off quotas for an XFS file system. As with QQUOTAON, XFS file systems expect a pointer to an unsigned int that specifies whether quota accounting and/or limit enforcement need to be turned off. This operation requires privilege (CAPSYSADMIN). QXGETQUOTA Get disk quota limits and current usage for user id. The addr argument is a pointer to an fsdiskquota structure (defined in ). Unprivileged users may retrieve only their own quotas; a privileged user (CAPSYSADMIN) may retrieve the quo‐ tas of any user. QXSETQLIM Set disk quota limits for user id. The addr argument is a pointer to an fsdiskquota structure (defined in ). This operation requires privilege (CAPSYSADMIN). QXGETQSTAT Returns an fsquotastat structure containing XFS file system specific quota information. This is useful for finding out how much space is used to store quota information, and also to get quotaon/off status of a given local XFS file system. QXQUOTARM Free the disk space taken by disk quotas. Quotas must have already been turned off. There is no command equivalent to QSYNC for XFS since sync(1) writes quota information to disk (in addition to the other file system meta‐ data that it writes out). RETURN VALUE

On success, quotactl() returns 0; on error -1 is returned, and errno is set to indicate the error. ERRORS EFAULT addr or special is invalid. EINVAL cmd or type is invalid. ENOENT The file specified by special or addr does not exist. ENOSYS The kernel has not been compiled with the CONFIGQUOTA option. ENOTBLK special is not a block device. EPERM The caller lacked the required privilege (CAPSYSADMIN) for the specified operation. ESRCH No disk quota is found for the indicated user. Quotas have not been turned on for this file system. If cmd is QSETQUOTA, quotactl() may also set errno to: ERANGE Specified limits are out of range allowed by quota format. If cmd is QQUOTAON, quotactl() may also set errno to: EACCES The quota file pointed to by addr exists, but is not a regular file; or, the quota file pointed to by addr exists, but is not on the file system pointed to by special. EBUSY QQUOTAON attempted, but another QQUOTAON had already been per‐ formed. EINVAL The quota file is corrupted. ESRCH Specified quota format was not found. SEE ALSO quota(1), getrlimit(2), quotacheck(8), quotaon(8) COLOPHON

This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can

be found at http://www.kernel.org/doc/man-pages/.

Linux 2010-06-16 QUOTACTL(2)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™