xref: /original-bsd/lib/libc/sys/quotactl.2 (revision fac0c393)
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.\" %sccs.include.redist.roff%
8.\"
9.\"	@(#)quotactl.2	8.2 (Berkeley) 03/10/95
10.\"
11.Dd
12.Dt QUOTACTL 2
13.Os
14.Sh NAME
15.Nm quotactl
16.Nd manipulate filesystem quotas
17.Sh SYNOPSIS
18.Fd #include <ufs/quota.h>	/* for ufs quotas */
19.Ft int
20.Fn quotactl "const char *path" "int cmd" "int id" "char *addr"
21.Sh DESCRIPTION
22The
23.Fn quotactl
24call enables, disables and
25manipulates filesystem quotas.
26A quota control command
27given by
28.Fa cmd
29operates on the given filename
30.Fa path
31for the given user
32.Fa id .
33The address of an optional command specific data structure,
34.Fa addr ,
35may be given; its interpretation
36is discussed below with each command.
37.Pp
38Currently quotas are supported only for the ``ufs'' filesystem.
39For ``ufs'',
40a command is composed of a primary command (see below)
41and a command type used to interpret the
42.Fa id .
43Types are supported for interpretation of user identifiers
44and group identifiers.
45The ``ufs'' specific commands are:
46.Bl -tag -width Q_QUOTAON
47.It Dv Q_QUOTAON
48Enable disk quotas for the filesystem specified by
49.Fa path .
50The command type specifies the type of the quotas being enabled.
51The
52.Fa addr
53argument specifies a file from which to take the quotas.
54The quota file must exist;
55it is normally created with the
56.Xr quotacheck 8
57program.
58The
59.Fa id
60argument is unused.
61Only the super-user may turn quotas on.
62.It Dv Q_QUOTAOFF
63Disable disk quotas for the filesystem specified by
64.Fa path .
65The command type specifies the type of the quotas being disabled.
66The
67.Fa addr
68and
69.Fa id
70arguments are unused.
71Only the super-user may turn quotas off.
72.It Dv Q_GETQUOTA
73Get disk quota limits and current usage for the user or group
74(as determined by the command type) with identifier
75.Fa id .
76.Fa Addr
77is a pointer to a
78.Fa struct dqblk
79structure (defined in
80.Ao Pa ufs/quota.h Ac ) .
81.It Dv Q_SETQUOTA
82Set disk quota limits for the user or group
83(as determined by the command type) with identifier
84.Fa id .
85.Fa Addr
86is a pointer to a
87.Fa struct dqblk
88structure (defined in
89.Ao Pa ufs/quota.h Ac ) .
90The usage fields of the
91.Fa dqblk
92structure are ignored.
93This call is restricted to the super-user.
94.It Dv Q_SETUSE
95Set disk usage limits for the user or group
96(as determined by the command type) with identifier
97.Fa id .
98.Fa Addr
99is a pointer to a
100.Fa struct dqblk
101structure (defined in
102.Ao Pa ufs/quota.h Ac ) .
103Only the usage fields are used.
104This call is restricted to the super-user.
105.It Dv Q_SYNC
106Update the on-disk copy of quota usages.
107The command type specifies which type of quotas are to be updated.
108The
109.Fa id
110and
111.Fa addr
112parameters are ignored.
113.El
114.Sh RETURN VALUES
115A successful call returns 0,
116otherwise the value -1 is returned and the global variable
117.Va errno
118indicates the reason for the failure.
119.Sh ERRORS
120A
121.Fn quotactl
122call will fail if:
123.Bl -tag -width ENAMETOOLONGAA
124.It Bq Er EOPNOTSUPP
125The kernel has not been compiled with the
126.Dv QUOTA
127option.
128.It Bq Er EUSERS
129The quota table cannot be expanded.
130.It Bq Er EINVAL
131.Fa Cmd
132or the command type is invalid.
133.It Bq Er EINVAL
134A pathname contains a character with the high-order bit set.
135.It Bq Er EACCES
136In
137.Dv Q_QUOTAON ,
138the quota file is not a plain file.
139.It Bq Er EACCES
140Search permission is denied for a component of a path prefix.
141.It Bq Er ENOTDIR
142A component of a path prefix was not a directory.
143.It Bq Er ENAMETOOLONG
144A component of either pathname exceeded 255 characters,
145or the entire length of either path name exceeded 1023 characters.
146.It Bq Er ENOENT
147A filename does not exist.
148.It Bq Er ELOOP
149Too many symbolic links were encountered in translating a pathname.
150.It Bq Er EROFS
151In
152.Dv Q_QUOTAON ,
153the quota file resides on a read-only filesystem.
154.It Bq Er EIO
155An
156.Tn I/O
157error occurred while reading from or writing
158to a file containing quotas.
159.It Bq Er EFAULT
160An invalid
161.Fa addr
162was supplied; the associated structure could not be copied in or out
163of the kernel.
164.It Bq Er EFAULT
165.Fa Path
166points outside the process's allocated address space.
167.It Bq Er EPERM
168The call was privileged and the caller was not the super-user.
169.El
170.Sh SEE ALSO
171.Xr quota 1 ,
172.Xr fstab 5 ,
173.Xr edquota 8 ,
174.Xr quotacheck 8 ,
175.Xr quotaon 8 ,
176.Xr repquota 8
177.Sh BUGS
178There should be some way to integrate this call with the resource
179limit interface provided by
180.Xr setrlimit 2
181and
182.Xr getrlimit 2 .
183.Sh HISTORY
184The
185.Nm quotactl
186function call appeared in
187.Bx 4.3 Reno .
188