xref: /original-bsd/lib/libc/sys/quotactl.2 (revision d24b829c)
Copyright (c) 1983, 1990 Regents of the University of California.
All rights reserved.

This code is derived from software contributed to Berkeley by
Robert Elz at The University of Melbourne.

%sccs.include.redist.man%

@(#)quotactl.2 6.11 (Berkeley) 06/23/90

QUOTACTL 2 ""
C 7
NAME
quotactl - manipulate disk quotas
SYNOPSIS
"#include <ufs/quota.h>" " /* for ``ufs'' quotas */"

 quotactl(path, cmd, id, addr)  char *path;  int cmd, id;  char *addr; 
DESCRIPTION
The quotactl call is used to enable and disable quotas and to manipulate disk quotas for filesystems on which quotas have been enabled. Path is the path name of any file within the mounted filesystem to which the quota control command is to be applied. The cmd parameter indicates a command to be applied to the id . Addr 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.

Currently quotas are supported only for the ``ufs'' filesystem. For ``ufs'', a command is composed of a primary command (see below) and a command type that is used to interpret the id . Types are supported for interpretation of user identifiers and group identifiers. The ``ufs'' specific commands are:

Q_QUOTAON Enable disk quotas for the filesystem specified by path . The command type specifies the type of the quotas being enabled. The addr argument specifies a file from which to take the quotas. The quota file must exist; it is normally created with the quotacheck (8) program. The id argument is unused. Only the super-user may turn quotas on.

Q_QUOTAOFF Disable disk quotas for the filesystem specified by path . The command type specifies the type of the quotas being disabled. The addr and id arguments are unused. Only the super-user may turn quotas off.

Q_GETQUOTA Get disk quota limits and current usage for the user or group (as determined by the command type) with identifier id . Addr is a pointer to a struct dqblk structure (defined in < ufs/quota.h >).

Q_SETQUOTA Set disk quota limits for the user or group (as determined by the command type) with identifier id . Addr is a pointer to a struct dqblk structure (defined in < ufs/quota.h >). The usage fields of the dqblk structure are ignored. This call is restricted to the super-user.

Q_SETUSE Set disk usage limits for the user or group (as determined by the command type) with identifier id . Addr is a pointer to a struct dqblk structure (defined in < ufs/quota.h >). Only the usage fields are used. This call is restricted to the super-user.

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.

"RETURN VALUE"
A successful call returns 0, otherwise the value -1 is returned and the global variable errno indicates the reason for the failure.
ERRORS
A quotactl call will fail when one of the following occurs:

15 [EOPNOTSUPP] The kernel has not been compiled with the QUOTA option.

15 [EUSERS] The quota table cannot be expanded.

15 [EINVAL] Cmd or the command type is invalid.

15 [EINVAL] A pathname contains a character with the high-order bit set.

15 [EACCES] In Q_QUOTAON, the quota file is not a plain file.

15 [EACCES] Search permission is denied for a component of a path prefix.

15 [ENOTDIR] A component of a path prefix is not a directory.

15 [ENAMETOOLONG] A component of either pathname exceeded 255 characters, or the entire length of either path name exceeded 1023 characters.

15 [ENOENT] A filename does not exist.

15 [ELOOP] Too many symbolic links were encountered in translating a pathname.

15 [EROFS] In Q_QUOTAON, the quota file resides on a read-only filesystem.

15 [EIO] An I/O error occurred while reading from or writing to a file containing quotas.

15 [EFAULT] An invalid addr is supplied; the associated structure could not be copied in or out of the kernel.

15 [EFAULT] Path points outside the process's allocated address space.

15 [EPERM] The call is privileged and the caller was not the super-user.

"SEE ALSO"
quota(1), fstab(5), edquota(8), quotacheck(8), quotaon(8), repquota(8)
BUGS
There should be some way to integrate this call with the resource limit interface provided by setrlimit (2) and getrlimit (2).