]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - lib/libc/sys/quotactl.2
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / lib / libc / sys / quotactl.2
1 .\" Copyright (c) 1983, 1990, 1991, 1993
2 .\"     The Regents of the University of California.  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 .\" 4. Neither the name of the University nor the names of its contributors
16 .\"    may be used to endorse or promote products derived from this software
17 .\"    without specific prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" SUCH DAMAGE.
30 .\"
31 .\"     @(#)quotactl.2  8.2 (Berkeley) 3/10/95
32 .\" $FreeBSD$
33 .\"
34 .Dd March 5, 1999
35 .Dt QUOTACTL 2
36 .Os
37 .Sh NAME
38 .Nm quotactl
39 .Nd manipulate file system quotas
40 .Sh LIBRARY
41 .Lb libc
42 .Sh SYNOPSIS
43 .In sys/types.h
44 .In ufs/ufs/quota.h
45 .Ft int
46 .Fn quotactl "const char *path" "int cmd" "int id" "void *addr"
47 .Sh DESCRIPTION
48 The
49 .Fn quotactl
50 system call enables, disables and
51 manipulates file system quotas.
52 A quota control command
53 given by
54 .Fa cmd
55 operates on the given filename
56 .Fa path
57 for the given user or group
58 .Fa id .
59 (NOTE: One should use the QCMD macro defined in
60 .In ufs/ufs/quota.h
61 to formulate the value for
62 .Fa cmd . )
63 The address of an optional command specific data structure,
64 .Fa addr ,
65 may be given; its interpretation
66 is discussed below with each command.
67 .Pp
68 For commands that use the
69 .Fa id
70 identifier, it must be either -1 or any positive value.
71 The value of -1 indicates that the current UID or GID should be used.
72 Any other negative value will return an error.
73 .Pp
74 Currently quotas are supported only for the
75 .Dq ufs
76 file system.
77 For
78 .Dq ufs ,
79 a command is composed of a primary command (see below)
80 and a command type used to interpret the
81 .Fa id .
82 Types are supported for interpretation of user identifiers (USRQUOTA)
83 and group identifiers (GRPQUOTA).
84 The
85 .Dq ufs
86 specific commands are:
87 .Bl -tag -width Q_QUOTAOFFxx
88 .It Dv Q_QUOTAON
89 Enable disk quotas for the file system specified by
90 .Fa path .
91 The command type specifies the type of the quotas being enabled.
92 The
93 .Fa addr
94 argument specifies a file from which to take the quotas.
95 The quota file must exist;
96 it is normally created with the
97 .Xr quotacheck 8
98 program.
99 The
100 .Fa id
101 argument is unused.
102 Only the super-user may turn quotas on.
103 .It Dv Q_QUOTAOFF
104 Disable disk quotas for the file system specified by
105 .Fa path .
106 The command type specifies the type of the quotas being disabled.
107 The
108 .Fa addr
109 and
110 .Fa id
111 arguments are unused.
112 Only the super-user may turn quotas off.
113 .It Dv Q_GETQUOTA
114 Get disk quota limits and current usage for the user or group
115 (as determined by the command type) with identifier
116 .Fa id .
117 The
118 .Fa addr
119 argument
120 is a pointer to a
121 .Fa struct dqblk
122 structure (defined in
123 .In ufs/ufs/quota.h ) .
124 .It Dv Q_SETQUOTA
125 Set disk quota limits for the user or group
126 (as determined by the command type) with identifier
127 .Fa id .
128 The
129 .Fa addr
130 argument
131 is a pointer to a
132 .Fa struct dqblk
133 structure (defined in
134 .In ufs/ufs/quota.h ) .
135 The usage fields of the
136 .Fa dqblk
137 structure are ignored.
138 This system call is restricted to the super-user.
139 .It Dv Q_SETUSE
140 Set disk usage limits for the user or group
141 (as determined by the command type) with identifier
142 .Fa id .
143 The
144 .Fa addr
145 argument
146 is a pointer to a
147 .Fa struct dqblk
148 structure (defined in
149 .In ufs/ufs/quota.h ) .
150 Only the usage fields are used.
151 This system call is restricted to the super-user.
152 .It Dv Q_SYNC
153 Update the on-disk copy of quota usages.
154 The command type specifies which type of quotas are to be updated.
155 The
156 .Fa id
157 and
158 .Fa addr
159 arguments are ignored.
160 .El
161 .Sh RETURN VALUES
162 .Rv -std quotactl
163 .Sh ERRORS
164 The
165 .Fn quotactl
166 system call will fail if:
167 .Bl -tag -width Er
168 .It Bq Er EOPNOTSUPP
169 The kernel has not been compiled with the
170 .Dv QUOTA
171 option.
172 .It Bq Er EUSERS
173 The quota table cannot be expanded.
174 .It Bq Er EINVAL
175 The
176 .Fa cmd
177 argument
178 or the command type is invalid.
179 In
180 .Dv Q_GETQUOTA
181 and
182 .Dv Q_SETQUOTA ,
183 quotas are not currently enabled for this file system.
184 .Pp
185 The
186 .Fa id
187 argument to
188 .Dv Q_GETQUOTA ,
189 .Dv Q_SETQUOTA 
190 or
191 .Dv Q_SETUSE
192 is a negative value.
193 .It Bq Er EACCES
194 In
195 .Dv Q_QUOTAON ,
196 the quota file is not a plain file.
197 .It Bq Er EACCES
198 Search permission is denied for a component of a path prefix.
199 .It Bq Er ENOTDIR
200 A component of a path prefix was not a directory.
201 .It Bq Er ENAMETOOLONG
202 A component of either pathname exceeded 255 characters,
203 or the entire length of either path name exceeded 1023 characters.
204 .It Bq Er ENOENT
205 A filename does not exist.
206 .It Bq Er ELOOP
207 Too many symbolic links were encountered in translating a pathname.
208 .It Bq Er EROFS
209 In
210 .Dv Q_QUOTAON ,
211 the quota file resides on a read-only file system.
212 .It Bq Er EIO
213 An
214 .Tn I/O
215 error occurred while reading from or writing
216 to a file containing quotas.
217 .It Bq Er EFAULT
218 An invalid
219 .Fa addr
220 was supplied; the associated structure could not be copied in or out
221 of the kernel.
222 .It Bq Er EFAULT
223 The
224 .Fa path
225 argument
226 points outside the process's allocated address space.
227 .It Bq Er EPERM
228 The call was privileged and the caller was not the super-user.
229 .El
230 .Sh SEE ALSO
231 .Xr quota 1 ,
232 .Xr fstab 5 ,
233 .Xr edquota 8 ,
234 .Xr quotacheck 8 ,
235 .Xr quotaon 8 ,
236 .Xr repquota 8
237 .Sh HISTORY
238 The
239 .Fn quotactl
240 system call appeared in
241 .Bx 4.3 Reno .
242 .Sh BUGS
243 There should be some way to integrate this call with the resource
244 limit interface provided by
245 .Xr setrlimit 2
246 and
247 .Xr getrlimit 2 .