xref: /illumos-gate/usr/src/man/man4i/quotactl.4i (revision 4adf43b0b51d2123d4add8287f0e31facb0cbab1)
1.\"  Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved
2.\" Copyright (c) 2017, Joyent, Inc.
3.\" The contents of this file are subject to the terms of the
4.\" Common Development and Distribution License (the "License").
5.\" You may not use this file except in compliance with the License.
6.\"
7.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8.\" or http://www.opensolaris.org/os/licensing.
9.\" See the License for the specific language governing permissions
10.\" and limitations under the License.
11.\"
12.\" When distributing Covered Code, include this CDDL HEADER in each
13.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14.\" If applicable, add the following below this CDDL HEADER, with the
15.\" fields enclosed by brackets "[]" replaced with your own identifying
16.\" information: Portions Copyright [yyyy] [name of copyright owner]
17.Dd October 28, 2017
18.Dt QUOTACTL 4I
19.Os
20.Sh NAME
21.Nm quotactl
22.Nd manipulate disk quotas
23.Sh SYNOPSIS
24.In sys/fs/ufs_quota.h
25.Fn "int ioctl" "int fd" "Q_QUOTACTL" "struct quotctl *qp"
26.Sh DESCRIPTION
27This
28.Fn ioctl
29call manipulates disk quotas.
30.Fa fd
31is the file descriptor returned by the
32.Xr open 2
33system call after opening the
34.Pa quotas
35file (located in the root directory of the filesystem running quotas).
36.Dv Q_QUOTACTL
37is defined in
38.Pa /usr/include/sys/fs/ufs_quota.h .
39.Fa qp
40is the address of the
41.Vt quotctl
42structure which is defined as
43.Bd -literal -offset 2n
44struct quotctl {
45  int op;
46  uid_t uid;
47  caddr_t addr;
48};
49.Ed
50.Pp
51.Fa op
52indicates an operation to be applied to the user
53.Sy ID
54.Fa uid .
55.Po
56See below.
57.Pc
58.Fa addr
59is the address of an optional, command specific, data
60structure which is copied in or out of the system.
61The interpretation of
62.Fa addr
63is given with each value of
64.Fa op
65below.
66.Bl -tag -width Q_GETQUOTA
67.It Sy Q_QUOTAON
68Turn on quotas for a file system.
69.Fa addr
70points to the full pathname of the
71.Pa quotas
72file.
73.Fa uid
74is ignored.
75It is recommended that
76.Fa uid
77have the value of
78.Sy 0 .
79This call is restricted to the super-user.
80.It Dv Q_QUOTAOFF
81Turn off quotas for a file system.
82.Fa addr
83and
84.Fa uid
85are ignored.
86It is
87recommended that
88.Fa addr
89have the value of
90.Sy NULL
91and
92.Fa uid
93have the value of
94.Sy 0 .
95This call is restricted to the super-user.
96.It Dv Q_GETQUOTA
97Get disk quota limits and current usage for user
98.Fa uid .
99.Fa addr
100is a pointer to a
101.Vt dqblk
102structure
103.Po
104defined in
105.In sys/fs/ufs_quota.h
106.Pc .
107Only the super-user may get the quotas of a user other than himself.
108.It Dv Q_SETQUOTA
109Set disk quota limits and current usage for user
110.Fa uid .
111.Fa addr
112is a pointer to a
113.Vt dqblk
114structure
115.Po
116defined in
117.In sys/fs/ufs_quota.h
118.Pc .
119This call is restricted to the super-user.
120.It Dv Q_SETQLIM
121Set disk quota limits for user
122.Fa uid .
123.Fa addr
124is a pointer to a
125.Vt dqblk
126structure
127.Po
128defined in
129.In sys/fs/ufs_quota.h
130.Pc .
131This call is restricted to the super-user.
132.It Dv Q_SYNC
133Update the on-disk copy of quota usages for this file system.
134.Fa addr
135and
136.Fa uid
137are ignored.
138.It Dv Q_ALLSYNC
139Update the on-disk copy of quota usages for all file systems with active
140quotas.
141.Fa addr
142and
143.Fa uid
144are ignored.
145.El
146.Sh RETURN VALUES
147This
148Fn ioctl
149returns:
150.Bl -tag -width xx
151.It Sy 0
152on success.
153.It Sy \(mi1
154on failure and sets
155.Va errno
156to indicate the error.
157.El
158.Sh FILES
159.Bl -tag -width x
160.It Pa /usr/include/sys/fs/ufs_quota.h
161quota-related structure/function definitions and defines
162.El
163.Sh ERRORS
164.Bl -tag -width EFAULT
165.It Er EFAULT
166.Fa addr
167is invalid.
168.It Er EINVAL
169The kernel has not been compiled with the
170.Sy QUOTA
171option.
172.Fa op
173is invalid.
174.It Er ENOENT
175The
176.Pa quotas
177file specified by
178.Fa addr
179does not exist.
180.It Er EPERM
181The call is privileged and the calling process did not assert
182.Brq Sy PRIV_SYS_MOUNT
183in the effective set.
184.It Er ESRCH
185No disk quota is found for the indicated user.
186Quotas have not been turned on for this file system.
187.It Er EUSERS
188The quota table is full.
189.El
190.Pp
191If
192.Fa op
193is
194.Dv Q_QUOTAON ,
195.Fn ioctl
196may set
197.Va errno
198to:
199.Bl -tag -width EACCES
200.It Er EACCES
201The quota file pointed to by
202.Fa addr
203exists but is not a regular file.
204The quota file pointed to by
205.Fa addr
206exists but is not on the file system pointed to by
207.Fa special .
208.It Er EIO
209Internal I/O error while attempting to read the
210.Pa quotas
211file pointed to by
212.Fa addr .
213.El
214.Sh SEE ALSO
215.Xr getrlimit 2 ,
216.Xr mount 2 ,
217.Xr quota 8 ,
218.Xr quotacheck 8 ,
219.Xr quotaon 8
220.Sh BUGS
221There should be some way to integrate this call with the resource limit
222interface provided by
223.Xr setrlimit 2
224and
225.Xr getrlimit 2 .
226.Pp
227This call is incompatible with Melbourne quotas.
228