4.3BSD-Reno/src/lib/libc/sys/quotactl.2

Compare this file to the similar file:
Show the results in this format:

.\" 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.
.\"
.\" Redistribution and use in source and binary forms are permitted provided
.\" that: (1) source distributions retain this entire copyright notice and
.\" comment, and (2) distributions including binaries display the following
.\" acknowledgement:  ``This product includes software developed by the
.\" University of California, Berkeley and its contributors'' in the
.\" documentation or other materials provided with the distribution and in
.\" all advertising materials mentioning features or use of this software.
.\" Neither the name of the University nor the names of its contributors may
.\" be used to endorse or promote products derived from this software without
.\" specific prior written permission.
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
.\"
.\"	@(#)quotactl.2	6.11 (Berkeley) 6/23/90
.\"
.TH QUOTACTL 2 "June 23, 1990"
.UC 7
.SH NAME
quotactl \- manipulate disk quotas
.SH SYNOPSIS
.BI "#include <ufs/quota.h>" "	/* for ``ufs'' quotas */"
.PP
.nf
.B quotactl(path, cmd, id, addr)
.B char *path;
.B int cmd, id;
.B char *addr;
.fi
.SH DESCRIPTION
The
.I quotactl
call is used to enable and disable quotas and
to manipulate disk quotas for filesystems on
which quotas have been enabled.
.I Path
is the path name of any file within the mounted filesystem
to which the quota control command is to be applied.
The
.I cmd
parameter indicates a command to be applied to the
.IR id .
.I Addr
is the address of an optional, command specific, data structure
that is copied in or out of the system.  The interpretation of
.I addr
is given with each command.
.PP
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
.IR id .
Types are supported for interpretation of user identifiers
and group identifiers.
The ``ufs'' specific commands are:
.TP
Q_QUOTAON
Enable disk quotas for the filesystem specified by
.IR path .
The command type specifies the type of the quotas being enabled.
The
.I addr
argument specifies a file from which to take the quotas.
The quota file must exist;
it is normally created with the 
.IR quotacheck (8)
program.
The
.I id
argument is unused.
Only the super-user may turn quotas on.
.TP
Q_QUOTAOFF
Disable disk quotas for the filesystem specified by
.I path .
The command type specifies the type of the quotas being disabled.
The
.I addr
and
.I id
arguments are unused.
Only the super-user may turn quotas off.
.TP
Q_GETQUOTA
Get disk quota limits and current usage for the user or group
(as determined by the command type) with identifier
.IR id .
.I Addr
is a pointer to a struct dqblk structure (defined in 
.RI < ufs/quota.h >).
.TP
Q_SETQUOTA
Set disk quota limits for the user or group
(as determined by the command type) with identifier
.IR id .
.I Addr
is a pointer to a struct dqblk structure (defined in 
.RI < ufs/quota.h >).
The usage fields of the dqblk structure are ignored.
This call is restricted to the super-user.
.TP
Q_SETUSE
Set disk usage limits for the user or group
(as determined by the command type) with identifier
.IR id .
.I Addr
is a pointer to a struct dqblk structure (defined in
.RI < ufs/quota.h >).
Only the usage fields are used.
This call is restricted to the super-user.
.TP
Q_SYNC
Update the on-disk copy of quota usages.
The command type specifies which type of quotas are to be updated.
The \fIid\fP and \fIaddr\fP parameters are ignored.
.SH "RETURN VALUE"
A successful call returns 0,
otherwise the value \-1 is returned and the global variable
.I errno
indicates the reason for the failure.
.SH ERRORS
A \fIquotactl\fP call will fail when one of the following occurs:
.TP 15
[EOPNOTSUPP]
The kernel has not been compiled with the QUOTA option.
.TP 15
[EUSERS]
The quota table cannot be expanded.
.TP 15
[EINVAL]
.I Cmd
or the command type is invalid.
.TP 15
[EINVAL]
A pathname contains a character with the high-order bit set.
.TP 15
[EACCES]
In Q_QUOTAON, the quota file is not a plain file.
.TP 15
[EACCES]
Search permission is denied for a component of a path prefix.
.TP 15
[ENOTDIR]
A component of a path prefix is not a directory.
.TP 15
[ENAMETOOLONG]
A component of either pathname exceeded 255 characters,
or the entire length of either path name exceeded 1023 characters.
.TP 15
[ENOENT]
A filename does not exist.
.TP 15
[ELOOP]
Too many symbolic links were encountered in translating a pathname.
.TP 15
[EROFS]
In Q_QUOTAON, the quota file resides on a read-only filesystem.
.TP 15
[EIO]
An I/O error occurred while reading from or writing
to a file containing quotas.
.TP 15
[EFAULT]
An invalid
.I addr
is supplied; the associated structure could not be copied in or out
of the kernel.
.TP 15
[EFAULT]
.I Path
points outside the process's allocated address space.
.TP 15
[EPERM]
The call is privileged and the caller was not the super-user.
.SH "SEE ALSO"
quota(1),
fstab(5),
edquota(8), quotacheck(8), quotaon(8), repquota(8)
.SH BUGS
There should be some way to integrate this call with the resource
limit interface provided by
.IR setrlimit (2)
and
.IR getrlimit (2).