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