written by Kirk McKusick and Sam Leffler; add Berkeley specific header
[unix-history] / usr / src / lib / libc / sys / quotactl.2
CommitLineData
02b31b1d 1.\" Copyright (c) 1983 Regents of the University of California.
f9ac90b4 2.\" All rights reserved.
02b31b1d 3.\"
f9ac90b4 4.\" Redistribution and use in source and binary forms are permitted
57a981eb
KB
5.\" provided that the above copyright notice and this paragraph are
6.\" duplicated in all such forms and that any documentation,
7.\" advertising materials, and other materials related to such
8.\" distribution and use acknowledge that the software was developed
9.\" by the University of California, Berkeley. The name of the
10.\" University may not be used to endorse or promote products derived
11.\" from this software without specific prior written permission.
12.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14.\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
f9ac90b4 15.\"
57a981eb 16.\" @(#)quotactl.2 6.9 (Berkeley) %G%
02b31b1d 17.\"
1bf2a285 18.TH QUOTA 2 ""
02b31b1d
KM
19.UC 5
20.SH NAME
21quota \- manipulate disk quotas
22.SH SYNOPSIS
23.nf
24.B #include <sys/quota.h>
25.PP
26.B quota(cmd, uid, arg, addr)
27.B int cmd, uid, arg;
f37273f0 28.B char *addr;
02b31b1d
KM
29.fi
30.SH DESCRIPTION
31The
32.I quota
33call manipulates disk quotas for file systems
3096bc80 34that have had quotas enabled with
02b31b1d
KM
35.IR setquota (2).
36The
37.I cmd
38parameter indicates a command to be applied to
39the user ID
40.IR uid .
41.I Arg
42is a command specific argument and
43.I addr
44is the address of an optional, command specific, data structure
3096bc80 45that is copied in or out of the system. The interpretation of
02b31b1d
KM
46.I arg
47and
48.I addr
49is given with each command below.
50.TP
51Q_SETDLIM
52Set disc quota limits and current usage for the user with ID
53.IR uid .
54.I Arg
55is a major-minor device indicating a particular file system.
56.I Addr
57is a pointer to a struct dqblk structure (defined in
58.RI < sys/quota.h >).
59This call is restricted to the super-user.
60.TP
61Q_GETDLIM
62Get disc quota limits and current usage for the user with ID
63.IR uid .
64The remaining parameters are as for Q_SETDLIM.
65.TP
66Q_SETDUSE
67Set disc usage limits for the user with ID
68.IR uid .
69.I Arg
70is a major-minor device indicating a particular file system.
71.I Addr
72is a pointer to a struct dqusage structure (defined in
73.RI < sys/quota.h >).
74This call is restricted to the super-user.
75.TP
76Q_SYNC
77Update the on-disc copy of quota usages.
efa9f401
KM
78.I Arg
79is a major-minor device indicating the file system to be sync'ed.
80If the
81.I arg
3096bc80 82parameter is specified as NODEV, all file systems that have
efa9f401
KM
83disc quotas will be sync'ed.
84The \fIuid\fP and \fIaddr\fP parameters are ignored.
02b31b1d
KM
85.TP
86Q_SETUID
87Change the calling process's quota limits to those of the
88user with ID
89.IR uid .
90The
91.I arg
92and
93.I addr
94parameters are ignored. This call is restricted to the super-user.
95.TP
96Q_SETWARN
97Alter the disc usage warning limits for the user with ID
98.IR uid .
99.I Arg
100is a major-minor device indicating a particular file system.
101.I Addr
102is a pointer to a struct dqwarn structure (defined in
103.RI < sys/quota.h >).
104This call is restricted to the super-user.
105.TP
106Q_DOWARN
107Warn the user with user ID
108.I uid
109about excessive disc usage.
110This call causes the system to check its current disc usage
111information and print a message on the terminal of
112the caller for each file system on which the user is over quota.
12b5d9d5
JL
113If the user is under quota, his warning count is reset to MAX_*_WARN
114(defined in
115.RI < sys/quota.h >).
02b31b1d
KM
116If the
117.I arg
3096bc80 118parameter is specified as NODEV, all file systems that have
02b31b1d
KM
119disc quotas will be checked. Otherwise,
120.I arg
121indicates a specific major-minor device to be checked.
122This call is restricted to the super-user.
123.SH "RETURN VALUE"
47fbd25c
KM
124A successful call returns 0,
125otherwise the value \-1 is returned and the global variable
02b31b1d 126.I errno
47fbd25c 127indicates the reason for the failure.
02b31b1d 128.SH ERRORS
47fbd25c
KM
129A \fIquota\fP call will fail when one of the following occurs:
130.TP 15
131[EINVAL]
132The kernel has not been compiled with the QUOTA option.
02b31b1d
KM
133.TP 15
134[EINVAL]
135.I Cmd
136is invalid.
137.TP 15
138[ESRCH]
139No disc quota is found for the indicated user.
140.TP 15
141[EPERM]
142The call is priviledged and the caller was not the super-user.
143.TP 15
47fbd25c 144[ENODEV]
02b31b1d
KM
145The
146.I arg
147parameter is being interpreted as a major-minor
148device and it indicates an unmounted file system.
149.TP 15
150[EFAULT]
151An invalid
152.I addr
153is supplied; the associated structure could not be copied in or out
154of the kernel.
155.TP 15
156[EUSERS]
157The quota table is full.
158.SH "SEE ALSO"
159setquota(2), quotaon(8), quotacheck(8)
160.SH BUGS
09cfce6f 161There should be some way to integrate this call with the resource
02b31b1d
KM
162limit interface provided by
163.IR setrlimit (2)
164and
165.IR getrlimit (2).
166.PP
167The Australian spelling of
168.I disk
169is used throughout the quota facilities in honor of
170the implementors.