System V IPC code from Danny Boulet, chewed on a bit by the NetBSD group
[unix-history] / lib / libc / sys / quotactl.2
CommitLineData
15637ed4
RG
1.\" Copyright (c) 1983, 1990, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Robert Elz at The University of Melbourne.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\" must display the following acknowledgement:
17.\" This product includes software developed by the University of
18.\" California, Berkeley and its contributors.
19.\" 4. Neither the name of the University nor the names of its contributors
20.\" may be used to endorse or promote products derived from this software
21.\" without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33.\" SUCH DAMAGE.
34.\"
35.\" @(#)quotactl.2 6.13 (Berkeley) 7/23/91
36.\"
37.Dd July 23, 1991
38.Dt QUOTACTL 2
39.Os
40.Sh NAME
41.Nm quotactl
42.Nd manipulate filesystem quotas
43.Sh SYNOPSIS
44.Ft #include <ufs/quota.h> /* for ufs quotas */
45.Ft int
46.Fn quotactl "const char *path" "int cmd" "int id" "char *addr"
47.Sh DESCRIPTION
48The
49.Fn quotactl
50call enables, disables and
51manipulates filesystem quotas.
52A quota control command
53given by
54.Fa cmd
55operates on the given filename
56.Fa path
57for the given user
58.Fa id .
59The address of an optional command specific data structure,
60.Fa addr ,
61may be given; its interpretation
62is discussed below with each command.
63.Pp
64Currently quotas are supported only for the ``ufs'' filesystem.
65For ``ufs'',
66a command is composed of a primary command (see below)
67and a command type used to interpret the
68.Fa id .
69Types are supported for interpretation of user identifiers
70and group identifiers.
71The ``ufs'' specific commands are:
72.Bl -tag -width Q_QUOTAON
73.It Dv Q_QUOTAON
74Enable disk quotas for the filesystem specified by
75.Fa path .
76The command type specifies the type of the quotas being enabled.
77The
78.Fa addr
79argument specifies a file from which to take the quotas.
80The quota file must exist;
81it is normally created with the
82.Xr quotacheck 8
83program.
84The
85.Fa id
86argument is unused.
87Only the super-user may turn quotas on.
88.It Dv Q_QUOTAOFF
89Disable disk quotas for the filesystem specified by
90.Fa path .
91The command type specifies the type of the quotas being disabled.
92The
93.Fa addr
94and
95.Fa id
96arguments are unused.
97Only the super-user may turn quotas off.
98.It Dv Q_GETQUOTA
99Get disk quota limits and current usage for the user or group
100(as determined by the command type) with identifier
101.Fa id .
102.Fa Addr
103is a pointer to a
104.Fa struct dqblk
105structure (defined in
106.Ao Pa ufs/quota.h Ac ) .
107.It Dv Q_SETQUOTA
108Set disk quota limits for the user or group
109(as determined by the command type) with identifier
110.Fa id .
111.Fa Addr
112is a pointer to a
113.Fa struct dqblk
114structure (defined in
115.Ao Pa ufs/quota.h Ac ) .
116The usage fields of the
117.Fa dqblk
118structure are ignored.
119This call is restricted to the super-user.
120.It Dv Q_SETUSE
121Set disk usage limits for the user or group
122(as determined by the command type) with identifier
123.Fa id .
124.Fa Addr
125is a pointer to a
126.Fa struct dqblk
127structure (defined in
128.Ao Pa ufs/quota.h Ac ) .
129Only the usage fields are used.
130This call is restricted to the super-user.
131.It Dv Q_SYNC
132Update the on-disk copy of quota usages.
133The command type specifies which type of quotas are to be updated.
134The
135.Fa id
136and
137.Fa addr
138parameters are ignored.
139.El
140.Sh RETURN VALUES
141A successful call returns 0,
142otherwise the value -1 is returned and the global variable
143.Va errno
144indicates the reason for the failure.
145.Sh ERRORS
146A
147.Fn quotactl
148call will fail if:
149.Bl -tag -width ENAMETOOLONGAA
150.It Bq Er EOPNOTSUPP
151The kernel has not been compiled with the
152.Dv QUOTA
153option.
154.It Bq Er EUSERS
155The quota table cannot be expanded.
156.It Bq Er EINVAL
157.Fa Cmd
158or the command type is invalid.
159.It Bq Er EINVAL
160A pathname contains a character with the high-order bit set.
161.It Bq Er EACCES
162In
163.Dv Q_QUOTAON ,
164the quota file is not a plain file.
165.It Bq Er EACCES
166Search permission is denied for a component of a path prefix.
167.It Bq Er ENOTDIR
168A component of a path prefix was not a directory.
169.It Bq Er ENAMETOOLONG
170A component of either pathname exceeded 255 characters,
171or the entire length of either path name exceeded 1023 characters.
172.It Bq Er ENOENT
173A filename does not exist.
174.It Bq Er ELOOP
175Too many symbolic links were encountered in translating a pathname.
176.It Bq Er EROFS
177In
178.Dv Q_QUOTAON ,
179the quota file resides on a read-only filesystem.
180.It Bq Er EIO
181An
182.Tn I/O
183error occurred while reading from or writing
184to a file containing quotas.
185.It Bq Er EFAULT
186An invalid
187.Fa addr
188was supplied; the associated structure could not be copied in or out
189of the kernel.
190.It Bq Er EFAULT
191.Fa Path
192points outside the process's allocated address space.
193.It Bq Er EPERM
194The call was privileged and the caller was not the super-user.
195.El
196.Sh SEE ALSO
197.Xr quota 1 ,
198.Xr fstab 5 ,
199.Xr edquota 8 ,
200.Xr quotacheck 8 ,
201.Xr quotaon 8 ,
202.Xr repquota 8
203.Sh BUGS
204There should be some way to integrate this call with the resource
205limit interface provided by
206.Xr setrlimit 2
207and
208.Xr getrlimit 2 .
209.Sh HISTORY
210The
211.Nm quotactl
212function call appeared in
213.Bx 4.3 Reno .