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