OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / original / man2 / quotactl.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" FIXME There is much that is missing and/or out of date in this page.
26 .\" (There is a quotactl.2 page in the quotactl package that seems to
27 .\" have more info than this page.)
28 .\" As things stand the page more or less documents Linux 2.2 reality:
29 .\"
30 .\" Linux 2.2 has:
31 .\"
32 .\"     Q_GETQUOTA
33 .\"     Q_GETSTATS
34 .\"     Q_QUOTAOFF
35 .\"     Q_QUOTAON
36 .\"     Q_RSQUASH (not currently documented)
37 .\"     Q_SETQLIM
38 .\"     Q_SETQUOTA
39 .\"     Q_SETUSE
40 .\"     Q_SYNC
41 .\"
42 .\" Linux 2.4 has:
43 .\"
44 .\"     Q_COMP_QUOTAOFF
45 .\"     Q_COMP_QUOTAON
46 .\"     Q_COMP_SYNC
47 .\"     Q_GETFMT
48 .\"     Q_GETINFO
49 .\"     Q_GETQUOTA
50 .\"     Q_QUOTAOFF
51 .\"     Q_QUOTAON
52 .\"     Q_SETINFO
53 .\"     Q_SETQUOTA
54 .\"     Q_SYNC
55 .\"     Q_V1_GETQUOTA Q_V1_GETSTATS Q_V1_RSQUASH Q_V1_SETQLIM
56 .\"     Q_V1_SETQUOTA Q_V1_SETUSE
57 .\"     Q_V2_GETINFO Q_V2_GETQUOTA Q_V2_SETFLAGS Q_V2_SETGRACE
58 .\"     Q_V2_SETINFO Q_V2_SETQUOTA Q_V2_SETUSE
59 .\"     Q_XGETQSTAT Q_XGETQUOTA Q_XQUOTAOFF Q_XQUOTAON Q_XQUOTARM
60 .\"     Q_XSETQLIM
61 .\"
62 .\" Linux 2.6.16 has:
63 .\"
64 .\"     Q_GETFMT
65 .\"     Q_GETINFO
66 .\"     Q_GETQUOTA
67 .\"     Q_QUOTAOFF
68 .\"     Q_QUOTAON
69 .\"     Q_SETINFO
70 .\"     Q_SETQUOTA
71 .\"     Q_SYNC
72 .\"     Q_XGETQSTAT
73 .\"     Q_XGETQUOTA
74 .\"     Q_XQUOTAOFF
75 .\"     Q_XQUOTAON
76 .\"     Q_XQUOTARM
77 .\"     Q_XQUOTASYNC
78 .\"     Q_XSETQLIM
79 .\"
80 .TH QUOTACTL 2 2007-06-01 "Linux" "Linux Programmer's Manual"
81 .SH NAME
82 quotactl \- manipulate disk quota
83 .SH SYNOPSIS
84 .nf
85 .B #include <sys/types.h>
86 .br
87 .B #include <sys/quota.h>
88 .sp
89 .BI "int quotactl(int " cmd ", const char *" special ", int " id \
90 ", caddr_t " addr );
91 .fi
92 .SH DESCRIPTION
93 The quota system defines for each user and/or group a soft limit
94 and a hard limit bounding the amount of disk space that can be
95 used on a given file system.
96 The hard limit cannot be crossed.
97 The soft limit can be crossed, but warnings will ensue.
98 Moreover,
99 the user cannot be above the soft limit for more than one week (by default)
100 at a time: after this week the soft limit counts as hard limit.
101
102 The
103 .BR quotactl ()
104 system call manipulates these quota.
105 Its first argument is
106 of the form
107 .BI QCMD( subcmd , type )
108 where
109 .I type
110 is either
111 .B USRQUOTA
112 or
113 .B GRPQUOTA
114 (for user quota and group quota, respectively), and
115 .I subcmd
116 is described below.
117
118 The second argument
119 .I special
120 is the block special device these quota apply to.
121 It must be mounted.
122
123 The third argument
124 .I id
125 is the user or group ID these quota apply to (when relevant).
126
127 The fourth argument
128 .I addr
129 is the address of a data structure, depending on the command.
130
131 The
132 .I subcmd
133 is one of
134 .TP 1.1i
135 .B Q_QUOTAON
136 Enable quota.
137 The
138 .I addr
139 argument is the pathname of the file containing
140 the quota for the file system.
141 .TP
142 .B Q_QUOTAOFF
143 Disable quota.
144 .TP
145 .B Q_GETQUOTA
146 Get limits and current usage of disk space.
147 The
148 .I addr
149 argument is a pointer to a dqblk structure (defined in
150 .IR <sys/quota.h> ).
151 .TP
152 .B Q_SETQUOTA
153 Set limits and current usage;
154 .I addr
155 is as before.
156 .TP
157 .B Q_SETQLIM
158 Set limits;
159 .I addr
160 is as before.
161 .TP
162 .B Q_SETUSE
163 Set usage.
164 .TP
165 .B Q_SYNC
166 Sync disk copy of a file system's quota.
167 .TP
168 .B Q_GETSTATS
169 Get collected stats.
170 .SH "RETURN VALUE"
171 On success,
172 .BR quotactl ()
173 returns 0.
174 On error, \-1 is returned, and
175 .I errno
176 is set appropriately.
177 .SH ERRORS
178 .TP 0.9i
179 .B EACCES
180 The quota file is not an ordinary file.
181 .TP
182 .B EBUSY
183 .B Q_QUOTAON
184 was asked, but quotas were enabled already.
185 .TP
186 .B EFAULT
187 Bad
188 .I addr
189 value.
190 .TP
191 .B EINVAL
192 .I type
193 is not a known quota type.
194 Or,
195 .I special
196 could not be found.
197 .TP
198 .B EIO
199 Cannot read or write the quota file.
200 .TP
201 .B EMFILE
202 Too many open files: cannot open quota file.
203 .TP
204 .B ENODEV
205 .I special
206 cannot be found in the mount table.
207 .TP
208 .B ENOPKG
209 The kernel was compiled without quota support.
210 .TP
211 .B ENOTBLK
212 .I special
213 is not a block special device.
214 .TP
215 .B EPERM
216 The process was not root (for the file system), and
217 .B Q_GETQUOTA
218 was asked for another
219 .I id
220 than that of the process itself, or anything other than
221 .B Q_GETSTATS
222 or
223 .B Q_SYNC
224 was asked.
225 .TP
226 .B ESRCH
227 .B Q_GETQUOTA
228 or
229 .B Q_SETQUOTA
230 or
231 .B Q_SETUSE
232 or
233 .B Q_SETQLIM
234 was asked for a file system that didn't have quota enabled.
235 .SH "CONFORMING TO"
236 BSD.
237 .SH "SEE ALSO"
238 .BR quota (1),
239 .BR getrlimit (2),
240 .BR setrlimit (2),
241 .BR ulimit (3),
242 .BR quotacheck (8),
243 .BR quotaon (8)