1 .\" $NetBSD: __quotactl.2,v 1.3 2012/02/13 19:50:15 dholland Exp $
3 .\" Copyright (c) 1983, 1990, 1991, 1993
4 .\" The Regents of the University of California. All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" Robert Elz at The University of Melbourne.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
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. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" @(#)quotactl.2 8.2 (Berkeley) 3/10/95
40 .Nd manipulate file system quotas
47 .Fn __quotactl "const char *path" "struct quotactl_args *args"
51 call manipulates file system quotas.
52 This is an internal interface and is documented for reference purposes
54 All application and utility code should use the
60 function performs one of several quota-related operations on the file
63 The operation and arguments to that operation are passed in the
66 The operation is stored in the
70 The arguments are placed in a union such that the first and second
71 arguments of the operation
73 are found as the members
76 .Fa u.example.qc_arg2 .
77 The descriptions below will refer to the operations as functions of
79 .Fn QUOTACTL_EXAMPLE "int arg1" "int arg2"
80 and elide the encoding of these arguments into the
83 Explicit mention of the
85 argument is also omitted.
87 There are fourteen quota control operations.
89 .Bl -tag -width abcdef
90 .\" ************************************************************
91 .It Fn QUOTACTL_STAT "struct quotastat *info"
92 Information about the quota implementation on the selected volume is
97 structure contains the following members:
98 .Bl -tag -width qs_restrictions
100 A human-readable string describing the underlying implementation of
102 This is suitable for display to users
103 .Pq and system administrators
104 but should not be interpreted by software.
106 .Xr quota_getimplname 3 .
108 The number of ID types supported by this implementation.
110 .Xr quota_getnumidtypes 3 .
112 The number of object types supported by this implementation.
114 .Xr quota_getnumobjtypes 3 .
116 Flags identifying specific semantic limitations of the implementation.
118 .Xr quota_getrestrictions 3 .
120 .\" ************************************************************
121 .It Fn QUOTACTL_IDTYPESTAT "int idtype" "struct quotaidtypestat *info"
122 Information about a particular ID type on the selected volume is
127 structure contains the following members:
128 .Bl -tag -width qs_restrictions
130 The name of the ID type.
132 .Xr quota_idtype_getname 3 .
134 .\" ************************************************************
135 .It Fn QUOTACTL_OBJYPESTAT "int objtype" "struct quotaobjtypestat *info"
136 Information about a particular object type on the selected volume is
141 structure contains the following members:
142 .Bl -tag -width qs_restrictions
144 The name of the object type.
146 .Xr quota_objtype_getname 3 .
148 A flag that is nonzero if the object type is something measured in
151 .Xr quota_objtype_isbytes 3 .
153 .\" ************************************************************
154 .It Fn QUOTACTL_GET "const struct quotakey *key" "struct quotaval *val"
157 the quota information selected by
161 .\" ************************************************************
162 .It Fn QUOTACTL_PUT "const struct quotakey *key" "const struct quotaval *val"
163 The quota information selected by
165 is updated to the values provided in
167 Note that the current usage information, which is file system
168 meta-data, cannot be updated via this interface.
169 If the usage information is incorrect a tool such as
173 with file-system-specific knowledge must be used to repair the
177 .\" ************************************************************
178 .It Fn QUOTACTL_DELETE "const struct quotakey *key"
179 The quota information selected by
184 .\" ************************************************************
185 .It Fn QUOTACTL_CURSOROPEN "struct quotakcursor *cursor"
186 A cursor for iterating the quota information is created.
189 structure is a semi-opaque type holding the iteration state used by
190 the quota implementation.
191 The caller is responsible for allocating and maintaining storage for
193 Every cursor that is opened should be closed.
194 It is not specified whether a cursor remains valid if
196 is used to move it to a different location in user memory.
197 It is not specified whether or how a cursor may be duplicated.
198 Passing an uninitialized, corrupted, or closed cursor to operations
200 .Fn QUOTACTL_CURSOROPEN
201 will produce unspecified behavior.
202 As per general standards for system calls such actions must not
203 produce undefined or materially adverse behavior in the kernel;
204 however, the effect on a user process may be arbitrary.
207 interface wraps the system call level quota cursors in a friendlier
210 .Xr quota_opencursor 3 .
211 .\" ************************************************************
212 .It Fn QUOTACTL_CURSORCLOSE "struct quotakcursor *cursor"
213 The cursor passed in is closed.
215 .Xr quotacursor_close 3 .
216 .\" ************************************************************
217 .It Fn QUOTACTL_CURSORSKIPIDTYPE "struct quotakcursor *cursor" "int idtype"
218 This operation provides a hint that iteration can skip over a
220 The implementation is not obliged to honor the hint.
222 .Xr quotacursor_skipidtype 3 .
223 .\" ************************************************************
224 .It Fn QUOTACTL_CURSORGET "struct quotakcursor *cursor" "struct quotakey *keys" "struct quotaval *vals" "unsigned maxnum" "unsigned *ret"
225 This operation retrieves data at the current cursor position and
229 quota records are retrieved and stored into the arrays named by
233 The number of records retrieved is stored into the variable pointed to
237 .Xr quotacursor_get 3
239 .Xr quotacursor_getn 3 .
240 .\" ************************************************************
241 .It Fn QUOTACTL_CURSORATEND "struct quotakcursor *cursor" "int *ret"
242 This operation generates a nonzero value if the cursor has reached the
243 end of the available quota information and zero otherwise.
244 The generated value is stored into the variable pointed to by
247 .Xr quotacursor_atend 3 .
248 .\" ************************************************************
249 .It Fn QUOTACTL_CURSORREWIND "struct quotakcursor *cursor"
250 This operation updates the cursor state so that further calls to
251 .Fn QUOTACTL_CURSORGET
252 will begin again at the start of the iteration.
254 .Xr quotacursor_rewind 3 .
255 .\" ************************************************************
256 .It Fn QUOTACTL_QUOTAON "int idtype" "const char *quotafile"
257 This operation is accepted only by old-style
259 quota implementations.
260 Quotas for the ID type named by
262 are switched on, and the file
264 is used to hold the quota information.
265 This operation can also be used when quotas are already switched on
266 to change the file used to hold the quota information.
267 Note however that as the current usage information in the file must be
268 consistent with the current state of the file system, in general it is
271 except in single-user mode.
274 for more information.
277 is run during the boot sequence after
280 .Xr quota_quotaon 3 .
281 .\" ************************************************************
282 .It Fn QUOTACTL_QUOTAOFF "int idtype"
283 This operation is accepted only by old-style
285 quota implementations.
286 Quotas for the ID type named by
289 Once quotas are switched off the file system behaves as if no quotas
293 is run during the shutdown sequence.
295 .Xr quota_quotaoff 3 .
296 .\" ************************************************************
302 Otherwise the value \-1 is returned and an error code reflecting the
303 reason for the failure is placed in
310 A pointer points outside the process's allocated address space.
312 The operation code was out of range; or
313 a requested ID or object type was out of range; or
314 a corrupted or invalid cursor was passed in.
316 The requested action was inappropriate for
317 .Pq or not supported by
320 No quota information exists for the requested key.
322 Memory could not be allocated within the kernel.
324 The target file system type is capable of supporting quotas, but
325 quotas are not enabled on the selected volume.
327 The target file system does not support quotas.
341 function call appeared in
345 interface appeared in
348 As of this writing the error returns that occur in practice are not
349 always completely consistent with the intent documented above.
351 There should be some way to integrate this call with the resource
352 limit interface provided by