[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

quotactl Subroutine

Purpose

Manipulates disk quotas.

Library

Standard C Library (libc.a)

Syntax

#include <jfs/quota.h>
int quotactl (Path, Cmd, ID, Addr)
int Cmd, ID;
char *Addr, *Path;

Description

The quotactl subroutine enables, disables, and manipulates disk quotas for file systems on which quotas have been enabled.

Currently, disk quotas are supported only by the Journaled File System (JFS).

Parameters

Path Specifies the path name of any file within the mounted file system to which the quota control command is to be applied.
Cmd Specifies the quota control command to be applied and whether it is applied to a user or group quota.

For JFSs, the Cmd parameter can be constructed through use of the QCMD(Cmd, type) macro contained within the jfs/quota.h file. The Cmd parameter specifies the quota control command. The type parameter specifies either user (USRQUOTA) or group (GRPQUOTA) quota type.

The valid JFS specific quota control values for the Cmd parameter are:

Q_QUOTAON Enables disk quotas for the file system specified by the Path parameter. The Addr parameter specifies a file from which to take the quotas. The quota file must exist; it is normally created with the quotacheck command. The ID parameter is unused. Root user authority is required to enable quotas.
Q_QUOTAOFF Disables disk quotas for the file system specified by the Path parameter. The Addr and ID arguments are unused. Root user authority is required to disable quotas.
Q_GETQUOTA Gets disk quota limits and current usage for a user or group specified by the ID parameter. The Addr parameter points to a dqblk buffer to hold the returned information. The dqblk structure is defined in the jfs/quota.h file. Root user authority is required if the ID value is not the current ID of the caller.
Q_SETQUOTA Sets disk quota limits for the user or group specified by the ID parameter. The Addr parameter points to a dqblk buffer containing the new quota limits. The dqblk structure is defined in the jfs/quota.h file. Root user authority is required to set quotas.
Q_SETUSE Sets disk usage limits for the user or group specified by the ID parameter. The Addr parameter points to a dqblk buffer containing the new usage limits. The dqblk structure is defined in the jfs/quota.h file. Root user authority is required to set disk usage limits.
ID Specifies the user or group ID to which the quota control command applies. The ID parameter is interpreted by the specified quota type. The JFS file system supports quotas for IDs within the range of MINDQUID through MAXDQID.
Addr Points to the address of an optional, command specific, data structure that is copied in or out of the system. The interpretation of the Addr parameter for each quota control command is given above.

Return Values

A successful call returns 0, otherwise the value -1 is returned and the errno global variable indicates the reason for the failure.

Error Codes

A quotactl subroutine will fail when one of the following occurs:

EACCES In the Q_QUOTAON command, the quota file is not a regular file.
EACCES Search permission is denied for a component of a path prefix.
EFAULT An invalid Addr parameter is supplied; the associated structure could not be copied in or out of the kernel.
EFAULT The Path parameter points outside the process's allocated address space.
EINVAL The specified quota control command or quota type is invalid.
EINVAL Path name contains a character with the high-order bit set.
EINVAL The ID parameter is outside of the supported range (MINDQID through MAXDQID).
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 path name.
ENAMETOOLONG A component of either path name exceeded 255 characters, or the entire length of either path name exceeded 1023 characters.
ENOENT A file name does not exist.
ENOTBLK Mounted file system is not a block device.
ENOTDIR A component of a path prefix is not a directory.
EOPNOTSUPP The file system does not support quotas.
EPERM The quota control commands is privileged and the caller did not have root user authority.
EROFS In the Q_QUOTAON command, the quota file resides on a read-only file system.
EUSERS The in-core quota table cannot be expanded.

Related Information

The quotacheck command.

Disk Quota System Overview and How to Set Up the Disk Quota System in AIX Version 4.3 System Management Guide: Operating System and Devices.


[ Previous | Next | Contents | Glossary | Home | Search ]