new quota system
[unix-history] / usr / src / lib / libc / sys / quotactl.2
CommitLineData
de49f60d 1.\" Copyright (c) 1983, 1990 Regents of the University of California.
f9ac90b4 2.\" All rights reserved.
02b31b1d 3.\"
de49f60d
KM
4.\" This code is derived from software contributed to Berkeley by
5.\" Robert Elz at The University of Melbourne.
6.\"
f9ac90b4 7.\" Redistribution and use in source and binary forms are permitted
57a981eb
KB
8.\" provided that the above copyright notice and this paragraph are
9.\" duplicated in all such forms and that any documentation,
10.\" advertising materials, and other materials related to such
11.\" distribution and use acknowledge that the software was developed
12.\" by the University of California, Berkeley. The name of the
13.\" University may not be used to endorse or promote products derived
14.\" from this software without specific prior written permission.
15.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
f9ac90b4 18.\"
de49f60d 19.\" @(#)quotactl.2 6.10 (Berkeley) %G%
02b31b1d 20.\"
de49f60d
KM
21.TH QUOTACTL 2 ""
22.UC 7
02b31b1d 23.SH NAME
de49f60d 24quotactl \- manipulate disk quotas
02b31b1d 25.SH SYNOPSIS
de49f60d 26.BI "#include <ufs/quota.h>" " /* for ``ufs'' quotas */"
02b31b1d 27.PP
de49f60d
KM
28.nf
29.B quotactl(path, cmd, id, addr)
30.B char *path;
31.B int cmd, id;
f37273f0 32.B char *addr;
02b31b1d
KM
33.fi
34.SH DESCRIPTION
35The
de49f60d
KM
36.I quotactl
37call is used to enable and disable quotas and
38to manipulate disk quotas for filesystems on
39which quotas have been enabled.
40.I Path
41is the path name of any file within the mounted filesystem
42to which the quota control command is to be applied.
02b31b1d
KM
43The
44.I cmd
de49f60d
KM
45parameter indicates a command to be applied to the
46.IR id .
47.I Addr
02b31b1d 48is the address of an optional, command specific, data structure
3096bc80 49that is copied in or out of the system. The interpretation of
02b31b1d 50.I addr
de49f60d
KM
51is given with each command.
52.PP
53Currently quotas are supported only for the ``ufs'' filesystem.
54For ``ufs'',
55a command is composed of a primary command (see below)
56and a command type that is used to interpret the
57.IR id .
58Types are supported for interpretation of user identifiers
59and group identifiers.
60The ``ufs'' specific commands are:
61.TP
62Q_QUOTAON
63Enable disk quotas for the filesystem specified by
64.IR path .
65The command type specifies the type of the quotas being enabled.
66The
67.I addr
68argument specifies a file from which to take the quotas.
69The quota file must exist;
70it is normally created with the
71.IR quotacheck (8)
72program.
73The
74.I id
75argument is unused.
76Only the super-user may turn quotas on.
02b31b1d 77.TP
de49f60d
KM
78Q_QUOTAOFF
79Disable disk quotas for the filesystem specified by
80.I path .
81The command type specifies the type of the quotas being disabled.
82The
83.I addr
84and
85.I id
86arguments are unused.
87Only the super-user may turn quotas off.
88.TP
89Q_GETQUOTA
90Get disk quota limits and current usage for the user or group
91(as determined by the command type) with identifier
92.IR id .
02b31b1d
KM
93.I Addr
94is a pointer to a struct dqblk structure (defined in
de49f60d 95.RI < ufs/quota.h >).
02b31b1d 96.TP
de49f60d
KM
97Q_SETQUOTA
98Set disk quota limits for the user or group
99(as determined by the command type) with identifier
100.IR id .
02b31b1d 101.I Addr
de49f60d
KM
102is a pointer to a struct dqblk structure (defined in
103.RI < ufs/quota.h >).
104The usage fields of the dqblk structure are ignored.
02b31b1d
KM
105This call is restricted to the super-user.
106.TP
de49f60d
KM
107Q_SETUSE
108Set disk usage limits for the user or group
109(as determined by the command type) with identifier
110.IR id .
02b31b1d 111.I Addr
de49f60d
KM
112is a pointer to a struct dqblk structure (defined in
113.RI < ufs/quota.h >).
114Only the usage fields are used.
02b31b1d
KM
115This call is restricted to the super-user.
116.TP
de49f60d
KM
117Q_SYNC
118Update the on-disk copy of quota usages.
119The command type specifies which type of quotas are to be updated.
120The \fIid\fP and \fIaddr\fP parameters are ignored.
02b31b1d 121.SH "RETURN VALUE"
47fbd25c
KM
122A successful call returns 0,
123otherwise the value \-1 is returned and the global variable
02b31b1d 124.I errno
47fbd25c 125indicates the reason for the failure.
02b31b1d 126.SH ERRORS
de49f60d 127A \fIquotactl\fP call will fail when one of the following occurs:
47fbd25c 128.TP 15
de49f60d 129[EOPNOTSUPP]
47fbd25c 130The kernel has not been compiled with the QUOTA option.
02b31b1d 131.TP 15
de49f60d
KM
132[EUSERS]
133The quota table cannot be expanded.
134.TP 15
02b31b1d
KM
135[EINVAL]
136.I Cmd
de49f60d 137or the command type is invalid.
02b31b1d 138.TP 15
de49f60d
KM
139[EINVAL]
140A pathname contains a character with the high-order bit set.
02b31b1d 141.TP 15
de49f60d
KM
142[EACCES]
143In Q_QUOTAON, the quota file is not a plain file.
144.TP 15
145[EACCES]
146Search permission is denied for a component of a path prefix.
02b31b1d 147.TP 15
de49f60d
KM
148[ENOTDIR]
149A component of a path prefix is not a directory.
150.TP 15
151[ENAMETOOLONG]
152A component of either pathname exceeded 255 characters,
153or the entire length of either path name exceeded 1023 characters.
154.TP 15
155[ENOENT]
156A filename does not exist.
157.TP 15
158[ELOOP]
159Too many symbolic links were encountered in translating a pathname.
160.TP 15
161[EROFS]
162In Q_QUOTAON, the quota file resides on a read-only filesystem.
163.TP 15
164[EIO]
165An I/O error occurred while reading from or writing
166to a file containing quotas.
02b31b1d
KM
167.TP 15
168[EFAULT]
169An invalid
170.I addr
171is supplied; the associated structure could not be copied in or out
172of the kernel.
173.TP 15
de49f60d
KM
174[EFAULT]
175.I Path
176points outside the process's allocated address space.
177.TP 15
178[EPERM]
179The call is privileged and the caller was not the super-user.
02b31b1d 180.SH "SEE ALSO"
de49f60d
KM
181quota(1),
182fstab(5),
183edquota(8), quotacheck(8), quotaon(8), repquota(8)
02b31b1d 184.SH BUGS
09cfce6f 185There should be some way to integrate this call with the resource
02b31b1d
KM
186limit interface provided by
187.IR setrlimit (2)
188and
189.IR getrlimit (2).