xref: /dragonfly/lib/libc/sys/quotactl.2 (revision 984263bc)
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.\" 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	8.2 (Berkeley) 3/10/95
36.\" $FreeBSD: src/lib/libc/sys/quotactl.2,v 1.12.2.7 2002/05/20 09:06:37 roam Exp $
37.\"
38.Dd March 5, 1999
39.Dt QUOTACTL 2
40.Os
41.Sh NAME
42.Nm quotactl
43.Nd manipulate filesystem quotas
44.Sh LIBRARY
45.Lb libc
46.Sh SYNOPSIS
47.In sys/types.h
48.In ufs/ufs/quota.h
49.Ft int
50.Fn quotactl "const char *path" "int cmd" "int id" "void *addr"
51.Sh DESCRIPTION
52The
53.Fn quotactl
54call enables, disables and
55manipulates filesystem quotas.
56A quota control command
57given by
58.Fa cmd
59operates on the given filename
60.Fa path
61for the given user
62.Fa id .
63(NOTE: One should use the QCMD macro defined in
64.Ao Pa ufs/ufs/quota.h Ac
65to formulate the value for
66.Fa cmd . )
67The address of an optional command specific data structure,
68.Fa addr ,
69may be given; its interpretation
70is discussed below with each command.
71.Pp
72Currently quotas are supported only for the
73.Dq ufs
74filesystem.
75For
76.Dq ufs ,
77a command is composed of a primary command (see below)
78and a command type used to interpret the
79.Fa id .
80Types are supported for interpretation of user identifiers (USRQUOTA)
81and group identifiers (GRPQUOTA).
82The
83.Dq ufs
84specific commands are:
85.Bl -tag -width Q_QUOTAOFFxx
86.It Dv Q_QUOTAON
87Enable disk quotas for the filesystem specified by
88.Fa path .
89The command type specifies the type of the quotas being enabled.
90The
91.Fa addr
92argument specifies a file from which to take the quotas.
93The quota file must exist;
94it is normally created with the
95.Xr quotacheck 8
96program.
97The
98.Fa id
99argument is unused.
100Only the super-user may turn quotas on.
101.It Dv Q_QUOTAOFF
102Disable disk quotas for the filesystem specified by
103.Fa path .
104The command type specifies the type of the quotas being disabled.
105The
106.Fa addr
107and
108.Fa id
109arguments are unused.
110Only the super-user may turn quotas off.
111.It Dv Q_GETQUOTA
112Get disk quota limits and current usage for the user or group
113(as determined by the command type) with identifier
114.Fa id .
115.Fa Addr
116is a pointer to a
117.Fa struct dqblk
118structure (defined in
119.Ao Pa ufs/ufs/quota.h Ac ) .
120.It Dv Q_SETQUOTA
121Set disk quota 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/ufs/quota.h Ac ) .
129The usage fields of the
130.Fa dqblk
131structure are ignored.
132This call is restricted to the super-user.
133.It Dv Q_SETUSE
134Set disk usage limits for the user or group
135(as determined by the command type) with identifier
136.Fa id .
137.Fa Addr
138is a pointer to a
139.Fa struct dqblk
140structure (defined in
141.Ao Pa ufs/ufs/quota.h Ac ) .
142Only the usage fields are used.
143This call is restricted to the super-user.
144.It Dv Q_SYNC
145Update the on-disk copy of quota usages.
146The command type specifies which type of quotas are to be updated.
147The
148.Fa id
149and
150.Fa addr
151parameters are ignored.
152.El
153.Sh RETURN VALUES
154.Rv -std quotactl
155.Sh ERRORS
156A
157.Fn quotactl
158call will fail if:
159.Bl -tag -width Er
160.It Bq Er EOPNOTSUPP
161The kernel has not been compiled with the
162.Dv QUOTA
163option.
164.It Bq Er EUSERS
165The quota table cannot be expanded.
166.It Bq Er EINVAL
167.Fa Cmd
168or the command type is invalid.
169In
170.Dv Q_GETQUOTA
171and
172.Dv Q_SETQUOTA ,
173quotas are not currently enabled for this filesystem.
174.It Bq Er EACCES
175In
176.Dv Q_QUOTAON ,
177the quota file is not a plain file.
178.It Bq Er EACCES
179Search permission is denied for a component of a path prefix.
180.It Bq Er ENOTDIR
181A component of a path prefix was not a directory.
182.It Bq Er ENAMETOOLONG
183A component of either pathname exceeded 255 characters,
184or the entire length of either path name exceeded 1023 characters.
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 .
227