summaryrefslogtreecommitdiffstats
path: root/man2/quotactl.2
blob: b6b1d5a1f26aa3b410c6c7e65f762794464aad56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\" 
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.  The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\" 
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.TH QUOTACTL 2 1996-04-14 "Linux 1.3.88" "Linux Programmer's Manual"
.SH NAME
quotactl \- manipulate disk quota
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.B #include <sys/quota.h>
.sp
.BI "int quotactl(int " cmd ", const char *" special ", int " id ,
.BI "caddr_t " addr );
.sp
.B #include <linux/unistd.h>
.sp
.BI "_syscall4(int, quotactl, int, " cmd ", const char *, " special
.BI ", int, " id ", caddr_t, " addr );
.SH DESCRIPTION
The quota system defines for each user and/or group a soft limit
and a hard limit bounding the amount of disk space that can be
used on a given file system.  The hard limit cannot be crossed.
The soft limit can be crossed, but warnings will ensue. Moreover,
the user cannot be above the soft limit for more than one week (by default)
at a time: after this week the soft limit counts as hard limit.

The
.B quotactl
system call manipulates these quota. Its first argument is
of the form
.BI QCMD( subcmd , type )
where
.I type
is either
.B USRQUOTA
or
.B GRPQUOTA
(for user quota and group quota, respectively), and
.I subcmd
is described below.

The second argument
.I special
is the block special device these quota apply to.
It must be mounted.

The third argument
.I id
is the user or group ID these quota apply to (when relevant).

The fourth argument
.I addr
is the address of a data structure, depending on the command.

The
.I subcmd
is one of
.TP 1.1i
.B Q_QUOTAON
Enable quota. The
.I addr
argument is the pathname of the file containing
the quota for the filesystem.
.TP
.B Q_QUOTAOFF
Disable quota.
.TP
.B Q_GETQUOTA
Get limits and current usage of disk space. The
.I addr
argument is a pointer to a dqblk structure (defined in
.IR <sys/quota.h> ).
.TP
.B Q_SETQUOTA
Set limits and current usage;
.I addr
is as before.
.TP
.B Q_SETQLIM
Set limits;
.I addr
is as before.
.TP
.B Q_SETUSE
Set usage.
.TP
.B Q_SYNC
Sync disk copy of a filesystem's quota.
.TP
.B Q_GETSTATS
Get collected stats.

.SH "RETURN VALUE"
On success,
.B quotactl
returns 0. On error, \-1 is returned, and
.I errno
is set appropriately.
.SH ERRORS
.TP 0.9i
.B EACCES
The quota file is not an ordinary file.
.TP
.B EBUSY
.B Q_QUOTAON
was asked, but quota were enabled already.
.TP
.B EFAULT
Bad
.I addr
value.
.TP
.B EINVAL
.I type
is not a known quota type. Or,
.I special
could not be found.
.TP
.B EIO
Cannot read or write the quota file.
.TP
.B EMFILE
Too many open files: cannot open quota file.
.TP
.B ENODEV
.I special
cannot be found in the mount table.
.TP
.B ENOPKG
The kernel was compiled without quota support.
.TP
.B ENOTBLK
.I special
is not a block special device.
.TP
.B EPERM
The process was not root (for the file system), and
.B Q_GETQUOTA
was asked for another
.I id
than that of the process itself, or anything other than
.B Q_GETSTATS
or
.B Q_SYNC
was asked.
.TP
.B ESRCH
.B Q_GETQUOTA
or
.B Q_SETQUOTA
or
.B Q_SETUSE
or
.B Q_SETQLIM
was asked for a file system that didn't have quota enabled.
.SH "CONFORMING TO"
BSD
.SH "SEE ALSO"
.BR quota (1),
.BR getrlimit (2),
.BR setrlimit (2),
.BR ulimit (3),
.BR quotacheck (8),
.BR quotaon (8)