xref: /dragonfly/lib/libc/sys/quotactl.2 (revision dc71b7ab)
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. 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: src/lib/libc/sys/quotactl.2,v 1.12.2.7 2002/05/20 09:06:37 roam Exp $
33.\" $DragonFly: src/lib/libc/sys/quotactl.2,v 1.4 2006/05/26 19:39:37 swildner Exp $
34.\"
35.Dd March 5, 1999
36.Dt QUOTACTL 2
37.Os
38.Sh NAME
39.Nm quotactl
40.Nd manipulate filesystem quotas
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In sys/types.h
45.In ufs/ufs/quota.h
46.Ft int
47.Fn quotactl "const char *path" "int cmd" "int id" "void *addr"
48.Sh DESCRIPTION
49The
50.Fn quotactl
51call enables, disables and
52manipulates filesystem quotas.
53A quota control command
54given by
55.Fa cmd
56operates on the given filename
57.Fa path
58for the given user
59.Fa id .
60(NOTE: One should use the QCMD macro defined in
61.In ufs/ufs/quota.h
62to formulate the value for
63.Fa cmd . )
64The address of an optional command specific data structure,
65.Fa addr ,
66may be given; its interpretation
67is discussed below with each command.
68.Pp
69Currently quotas are supported only for the
70.Dq ufs
71filesystem.
72For
73.Dq ufs ,
74a command is composed of a primary command (see below)
75and a command type used to interpret the
76.Fa id .
77Types are supported for interpretation of user identifiers (USRQUOTA)
78and group identifiers (GRPQUOTA).
79The
80.Dq ufs
81specific commands are:
82.Bl -tag -width Q_QUOTAOFFxx
83.It Dv Q_QUOTAON
84Enable disk quotas for the filesystem specified by
85.Fa path .
86The command type specifies the type of the quotas being enabled.
87The
88.Fa addr
89argument specifies a file from which to take the quotas.
90The quota file must exist;
91it is normally created with the
92.Xr quotacheck 8
93program.
94The
95.Fa id
96argument is unused.
97Only the super-user may turn quotas on.
98.It Dv Q_QUOTAOFF
99Disable disk quotas for the filesystem specified by
100.Fa path .
101The command type specifies the type of the quotas being disabled.
102The
103.Fa addr
104and
105.Fa id
106arguments are unused.
107Only the super-user may turn quotas off.
108.It Dv Q_GETQUOTA
109Get disk quota limits and current usage 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 (defined in
116.In ufs/ufs/quota.h ) .
117.It Dv Q_SETQUOTA
118Set disk quota limits for the user or group
119(as determined by the command type) with identifier
120.Fa id .
121.Fa Addr
122is a pointer to a
123.Fa struct dqblk
124structure (defined in
125.In ufs/ufs/quota.h ) .
126The usage fields of the
127.Fa dqblk
128structure are ignored.
129This call is restricted to the super-user.
130.It Dv Q_SETUSE
131Set disk usage limits for the user or group
132(as determined by the command type) with identifier
133.Fa id .
134.Fa Addr
135is a pointer to a
136.Fa struct dqblk
137structure (defined in
138.In ufs/ufs/quota.h ) .
139Only the usage fields are used.
140This call is restricted to the super-user.
141.It Dv Q_SYNC
142Update the on-disk copy of quota usages.
143The command type specifies which type of quotas are to be updated.
144The
145.Fa id
146and
147.Fa addr
148parameters are ignored.
149.El
150.Sh RETURN VALUES
151.Rv -std quotactl
152.Sh ERRORS
153A
154.Fn quotactl
155call will fail if:
156.Bl -tag -width Er
157.It Bq Er EOPNOTSUPP
158The kernel has not been compiled with the
159.Dv QUOTA
160option.
161.It Bq Er EUSERS
162The quota table cannot be expanded.
163.It Bq Er EINVAL
164.Fa Cmd
165or the command type is invalid.
166In
167.Dv Q_GETQUOTA
168and
169.Dv Q_SETQUOTA ,
170quotas are not currently enabled for this filesystem.
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 either pathname exceeded 255 characters,
181or the entire length of either path name exceeded 1023 characters.
182.It Bq Er ENOENT
183A filename does not exist.
184.It Bq Er ELOOP
185Too many symbolic links were encountered in translating a pathname.
186.It Bq Er EROFS
187In
188.Dv Q_QUOTAON ,
189the quota file resides on a read-only filesystem.
190.It Bq Er EIO
191An
192.Tn I/O
193error occurred while reading from or writing
194to a file containing quotas.
195.It Bq Er EFAULT
196An invalid
197.Fa addr
198was supplied; the associated structure could not be copied in or out
199of the kernel.
200.It Bq Er EFAULT
201.Fa Path
202points outside the process's allocated address space.
203.It Bq Er EPERM
204The call was privileged and the caller was not the super-user.
205.El
206.Sh SEE ALSO
207.Xr quota 1 ,
208.Xr fstab 5 ,
209.Xr edquota 8 ,
210.Xr quotacheck 8 ,
211.Xr quotaon 8 ,
212.Xr repquota 8
213.Sh HISTORY
214The
215.Fn quotactl
216function call appeared in
217.Bx 4.3 Reno .
218.Sh BUGS
219There should be some way to integrate this call with the resource
220limit interface provided by
221.Xr setrlimit 2
222and
223.Xr getrlimit 2 .
224