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