HPlogo HP-UX Reference > Q

quotactl(2)

HP-UX 11i Version 2: December 2007 Update
» 

Technical documentation

 » Table of Contents

 » Index

NAME

quotactl() — manipulate disk quotas

SYNOPSIS

#include <sys/quota.h>

int quotactl(int cmd, const char *special, uid_t uid, void *addr);

DESCRIPTION

quotactl() manipulates disk quotas. cmd indicates a command to be applied to the user ID uid. Parameter special is a pointer to a null-terminated string containing the path name of the block special device for the file system being manipulated. The block special device must be mounted. The parameter 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 explained with each command below:

Q_QUOTAON

Turn on quotas for a file system. The parameter addr points to the path name of file containing the quotas for the file system. The quota file must exist; it is normally created using the quotacheck command (see quotacheck(1M)). The uid parameter is ignored. This call is restricted to users having appropriate privileges.

Q_QUOTAOFF

Turn off quotas for a file system. The addr and uid parameters are ignored. This call is restricted to the user with appropriate privileges.

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 users having appropriate privileges can get the quotas of a user other than himself.

Q_GETQUOTA64

Get 64-bit disk quota limits and current usage for user uid. addr is a pointer to a dqblk64 structure (defined in <sys/quota.h>). Only users having appropriate privileges can get the quotas of a user other than himself. VxFS 3.5 will only track usage for dqb64_curblocks up to to 2 TB.

Q_SETQUOTA

Set disk quota limits and current usage of files and blocks for user uid. Note vxfs does not allow the current usage fields to be changed. addr is a pointer to a dqblk structure (defined in <sys/quota.h>). This call is restricted to users with appropriate privileges.

Q_SETQUOTA64

Set 64-bit disk quota limits and current usage of files and blocks for user uid. Note vxfs does not allow the current usage fields to be changed. addr is a pointer to a dqblk64 structure (defined in <sys/quota.h>). This call is restricted to users with the appropriate privileges.

Q_SETQLIM

Set disk quota limits for user uid. The parameter addr is a pointer to a dqblk structure (defined in <sys/quota.h>). This call is restricted to users with appropriate privileges.

Q_SETQLIM64

Set 64-bit disk quota limits for user uid. The parameter addr is a pointer to a dqblk64 structure (defined in <sys/quota.h>). This call is restricted to users with the appropriate privileges.

Q_QUOTAINFO

Retrieve information about quotas supported by file system uid. The parameter addr is a pointer to a uint64_t flags word. The meanings of the various bit fields are defined in <sys/quota.h>.

Q_SYNC

Update the on-disk copy of quota usages for a file system. If special is null, all file systems with active quotas are synced. The parameters addr and uid are ignored.

RETURN VALUE

Upon successful completion, quotactl() returns 0. Otherwise, it returns -1 and sets errno to indicate the error.

ERRORS

quotactl() fails when any of the following occurs:

ENOSYS

The kernel has not been configured with the disk quota subsystem.

EINVAL

The parameters cmd and/or uid are invalid.

ESRCH

No disc quota is found for the indicated user or quotas have not been turned on for this file system.

EPERM

The call is privileged and the calling process does not have appropriate privileges.

ENODEV

The parameter special contains a type of file system that does not support quotas. Currently, quotas are supported on HFS and VxFS file systems.

ENOTBLK

The parameter 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 file system pointed to by special.

EBUSY

Q_QUOTAON attempted while another Q_QUOTAON or Q_QUOTAOFF is in progress.

ENOENT

The file specified by special or addr does not exist.

EFAULT

The addr or special parameter points to an invalid address. Reliable detection of this error is implementation-dependent.

EDQUOT

User's disk quota block limit has been reached for this file system.

EOVERFLOW

64-bit values will overflow 32-bit fields, either in the dqblk struct in the user level (for Q_GETQUOTA) or in a 32-bit file system in the kernal (for Q_SETQUOTA64 and Q_SETQLIM64).

WARNINGS

The quotactl() system call is incompatible with the 4.2/4.3 BSD implementation of Melbourne quotas which uses a different system call interface and on-disk data structure.

Use Q_GETQUOTA64, Q_SETQUOTA64, and Q_SETQLIM64 commands for 64-bit field values.

AUTHOR

quotactl() was developed by HP and Sun Microsystems, Inc.