]> git.saurik.com Git - apple/xnu.git/blame - bsd/man/man2/quotactl.2
xnu-1228.9.59.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
67Currently quotas are supported only for the "ffs" and "hfs" filesystems.
68A command is composed of a primary command (see below)
69and a command type used to interpret the
70.Fa id .
71Types are supported for interpretation of user identifiers
72and group identifiers.
73The specific commands are:
74.Bl -tag -width Q_QUOTASTAT
75.It Dv Q_QUOTAON
76Enable disk quotas for the filesystem specified by
77.Fa path .
78The command type specifies the type of the quotas being enabled.
79The
80.Fa addr
81argument specifies a file from which to take the quotas.
82The quota file must exist;
83it is normally created with the
84.Xr quotacheck 8
85program.
86The
87.Fa id
88argument is unused.
89Only the super-user may turn quotas on.
90.It Dv Q_QUOTAOFF
91Disable disk quotas for the filesystem specified by
92.Fa path .
93The command type specifies the type of the quotas being disabled.
94The
95.Fa addr
96and
97.Fa id
98arguments are unused.
99Only the super-user may turn quotas off.
100.It Dv Q_GETQUOTA
101Get disk quota limits and current usage for the user or group
102(as determined by the command type) with identifier
103.Fa id .
104.Fa Addr
105is a pointer to a
106.Fa struct dqblk
107structure.
108.It Dv Q_SETQUOTA
109Set disk quota limits for the user or group
110(as determined by the command type) with identifier
111.Fa id .
112.Fa Addr
113is a pointer to a
114.Fa struct dqblk
115structure.
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.
128Only the usage fields are used.
129This call is restricted to the super-user.
130.It Dv Q_SYNC
131Update the on-disk copy of quota usages.
132The command type specifies which type of quotas are to be updated.
133The
134.Fa id
135and
136.Fa addr
137parameters are ignored.
138.It Dv Q_QUOTASTAT
139Get the enable status for the filesystem specified by
140.Fa path .
141The command type specifies the type of the quotas whose
142status is being queried.
143.Fa Addr
144is a pointer to an integer. Upon return,
145this integer will hold a zero value if quotas for the
146given type are not enabled and a non-zero value if
147quotas for the given type are enabled.
148The
149.Fa id
150parameter is ignored.
151.El
152.Sh RETURN VALUES
153A successful call returns 0,
154otherwise the value -1 is returned and the global variable
155.Va errno
156indicates the reason for the failure.
157.Sh ERRORS
158A
159.Fn quotactl
160call will fail if:
161.Bl -tag -width Er
91447636 162.It Bq Er ENOTSUP
9bccf70c
A
163The kernel has not been compiled with the
164.Dv QUOTA
165option.
166.It Bq Er EUSERS
167The quota table cannot be expanded.
168.It Bq Er EINVAL
169.Fa Cmd
170or the command type is invalid.
171.It Bq Er EACCES
172In
173.Dv Q_QUOTAON ,
174the quota file is not a plain file.
175.It Bq Er EACCES
176Search permission is denied for a component of a path prefix.
177.It Bq Er ENOTDIR
178A component of a path prefix was not a directory.
179.It Bq Er ENAMETOOLONG
180A component of a pathname exceeded
181.Dv {NAME_MAX}
182characters, or an entire path name exceeded
183.Dv {PATH_MAX}
184characters.
185.It Bq Er ENOENT
186A filename does not exist.
187.It Bq Er ELOOP
188Too many symbolic links were encountered in translating a pathname.
189.It Bq Er EROFS
190In
191.Dv Q_QUOTAON ,
192the quota file resides on a read-only filesystem.
193.It Bq Er EIO
194An
195.Tn I/O
196error occurred while reading from or writing
197to a file containing quotas.
198.It Bq Er EFAULT
199An invalid
200.Fa addr
201was supplied; the associated structure could not be copied in or out
202of the kernel.
203.It Bq Er EFAULT
204.Fa Path
205points outside the process's allocated address space.
206.It Bq Er EPERM
207The call was privileged and the caller was not the super-user.
208.El
209.Sh SEE ALSO
210.Xr quota 1 ,
211.Xr fstab 5 ,
212.Xr edquota 8 ,
213.Xr quotacheck 8 ,
214.Xr quotaon 8 ,
215.Xr repquota 8
216.Sh BUGS
217There should be some way to integrate this call with the resource
218limit interface provided by
219.Xr setrlimit 2
220and
221.Xr getrlimit 2 .
222.Sh HISTORY
223The
224.Fn quotactl
225function call appeared in
226.Bx 4.3 Reno .