xref: /csrg-svn/lib/libc/sys/quotactl.2 (revision 68511)
161183Sbostic.\" Copyright (c) 1983, 1990, 1991, 1993
261183Sbostic.\"	The Regents of the University of California.  All rights reserved.
320245Smckusick.\"
441428Smckusick.\" This code is derived from software contributed to Berkeley by
541428Smckusick.\" Robert Elz at The University of Melbourne.
620245Smckusick.\"
750487Scael.\" %sccs.include.redist.roff%
834368Sbostic.\"
9*68511Smckusick.\"	@(#)quotactl.2	8.2 (Berkeley) 03/10/95
1050487Scael.\"
1147208Scael.Dd
1247208Scael.Dt QUOTACTL 2
1350487Scael.Os
1447208Scael.Sh NAME
1547208Scael.Nm quotactl
1647208Scael.Nd manipulate filesystem quotas
1747208Scael.Sh SYNOPSIS
18*68511Smckusick.Fd #include <ufs/quota.h>	/* for ufs quotas */
1947208Scael.Ft int
2047208Scael.Fn quotactl "const char *path" "int cmd" "int id" "char *addr"
2147208Scael.Sh DESCRIPTION
2220245SmckusickThe
2347208Scael.Fn quotactl
2447208Scaelcall enables, disables and
2547208Scaelmanipulates filesystem quotas.
2647208ScaelA quota control command
2747208Scaelgiven by
2847208Scael.Fa cmd
2947208Scaeloperates on the given filename
3047208Scael.Fa path
3147208Scaelfor the given user
3247208Scael.Fa id .
3347208ScaelThe address of an optional command specific data structure,
3447208Scael.Fa addr ,
3547208Scaelmay be given; its interpretation
3647208Scaelis discussed below with each command.
3747208Scael.Pp
3841428SmckusickCurrently quotas are supported only for the ``ufs'' filesystem.
3941428SmckusickFor ``ufs'',
4041428Smckusicka command is composed of a primary command (see below)
4147208Scaeland a command type used to interpret the
4247208Scael.Fa id .
4341428SmckusickTypes are supported for interpretation of user identifiers
4441428Smckusickand group identifiers.
4541428SmckusickThe ``ufs'' specific commands are:
4647208Scael.Bl -tag -width Q_QUOTAON
4747208Scael.It Dv Q_QUOTAON
4841428SmckusickEnable disk quotas for the filesystem specified by
4947208Scael.Fa path .
5041428SmckusickThe command type specifies the type of the quotas being enabled.
5141428SmckusickThe
5247208Scael.Fa addr
5341428Smckusickargument specifies a file from which to take the quotas.
5441428SmckusickThe quota file must exist;
5541428Smckusickit is normally created with the
5647208Scael.Xr quotacheck 8
5741428Smckusickprogram.
5841428SmckusickThe
5947208Scael.Fa id
6041428Smckusickargument is unused.
6141428SmckusickOnly the super-user may turn quotas on.
6247208Scael.It Dv Q_QUOTAOFF
6341428SmckusickDisable disk quotas for the filesystem specified by
6447208Scael.Fa path .
6541428SmckusickThe command type specifies the type of the quotas being disabled.
6641428SmckusickThe
6747208Scael.Fa addr
6841428Smckusickand
6947208Scael.Fa id
7041428Smckusickarguments are unused.
7141428SmckusickOnly the super-user may turn quotas off.
7247208Scael.It Dv Q_GETQUOTA
7341428SmckusickGet disk quota limits and current usage for the user or group
7441428Smckusick(as determined by the command type) with identifier
7547208Scael.Fa id .
7647208Scael.Fa Addr
7747208Scaelis a pointer to a
7847208Scael.Fa struct dqblk
7947208Scaelstructure (defined in
8047208Scael.Ao Pa ufs/quota.h Ac ) .
8147208Scael.It Dv Q_SETQUOTA
8241428SmckusickSet disk quota limits for the user or group
8341428Smckusick(as determined by the command type) with identifier
8447208Scael.Fa id .
8547208Scael.Fa Addr
8647208Scaelis a pointer to a
8747208Scael.Fa struct dqblk
8847208Scaelstructure (defined in
8947208Scael.Ao Pa ufs/quota.h Ac ) .
9047208ScaelThe usage fields of the
9147208Scael.Fa dqblk
9247208Scaelstructure are ignored.
9320245SmckusickThis call is restricted to the super-user.
9447208Scael.It Dv Q_SETUSE
9541428SmckusickSet disk usage limits for the user or group
9641428Smckusick(as determined by the command type) with identifier
9747208Scael.Fa id .
9847208Scael.Fa Addr
9947208Scaelis a pointer to a
10047208Scael.Fa struct dqblk
10147208Scaelstructure (defined in
10247208Scael.Ao Pa ufs/quota.h Ac ) .
10341428SmckusickOnly the usage fields are used.
10420245SmckusickThis call is restricted to the super-user.
10547208Scael.It Dv Q_SYNC
10641428SmckusickUpdate the on-disk copy of quota usages.
10741428SmckusickThe command type specifies which type of quotas are to be updated.
10847208ScaelThe
10947208Scael.Fa id
11047208Scaeland
11147208Scael.Fa addr
11247208Scaelparameters are ignored.
11347208Scael.El
11447208Scael.Sh RETURN VALUES
11521082SmckusickA successful call returns 0,
11647208Scaelotherwise the value -1 is returned and the global variable
11747208Scael.Va errno
11821082Smckusickindicates the reason for the failure.
11947208Scael.Sh ERRORS
12047208ScaelA
12147208Scael.Fn quotactl
12247208Scaelcall will fail if:
12347208Scael.Bl -tag -width ENAMETOOLONGAA
12447208Scael.It Bq Er EOPNOTSUPP
12547208ScaelThe kernel has not been compiled with the
12647208Scael.Dv QUOTA
12747208Scaeloption.
12847208Scael.It Bq Er EUSERS
12941428SmckusickThe quota table cannot be expanded.
13047208Scael.It Bq Er EINVAL
13147208Scael.Fa Cmd
13241428Smckusickor the command type is invalid.
13347208Scael.It Bq Er EINVAL
13441428SmckusickA pathname contains a character with the high-order bit set.
13547208Scael.It Bq Er EACCES
13647208ScaelIn
13747208Scael.Dv Q_QUOTAON ,
13847208Scaelthe quota file is not a plain file.
13947208Scael.It Bq Er EACCES
14041428SmckusickSearch permission is denied for a component of a path prefix.
14147208Scael.It Bq Er ENOTDIR
14247208ScaelA component of a path prefix was not a directory.
14347208Scael.It Bq Er ENAMETOOLONG
14441428SmckusickA component of either pathname exceeded 255 characters,
14541428Smckusickor the entire length of either path name exceeded 1023 characters.
14647208Scael.It Bq Er ENOENT
14741428SmckusickA filename does not exist.
14847208Scael.It Bq Er ELOOP
14941428SmckusickToo many symbolic links were encountered in translating a pathname.
15047208Scael.It Bq Er EROFS
15147208ScaelIn
15247208Scael.Dv Q_QUOTAON ,
15347208Scaelthe quota file resides on a read-only filesystem.
15447208Scael.It Bq Er EIO
15550487ScaelAn
15650487Scael.Tn I/O
15750487Scaelerror occurred while reading from or writing
15841428Smckusickto a file containing quotas.
15947208Scael.It Bq Er EFAULT
16020245SmckusickAn invalid
16147208Scael.Fa addr
16247208Scaelwas supplied; the associated structure could not be copied in or out
16320245Smckusickof the kernel.
16447208Scael.It Bq Er EFAULT
16547208Scael.Fa Path
16641428Smckusickpoints outside the process's allocated address space.
16747208Scael.It Bq Er EPERM
16847208ScaelThe call was privileged and the caller was not the super-user.
16947208Scael.El
17047208Scael.Sh SEE ALSO
17147208Scael.Xr quota 1 ,
17247208Scael.Xr fstab 5 ,
17347208Scael.Xr edquota 8 ,
17447208Scael.Xr quotacheck 8 ,
17547208Scael.Xr quotaon 8 ,
17647208Scael.Xr repquota 8
17747208Scael.Sh BUGS
17828223SanneThere should be some way to integrate this call with the resource
17920245Smckusicklimit interface provided by
18047208Scael.Xr setrlimit 2
18120245Smckusickand
18247208Scael.Xr getrlimit 2 .
18347208Scael.Sh HISTORY
18447208ScaelThe
18550487Scael.Nm quotactl
18647208Scaelfunction call appeared in
18747208Scael.Bx 4.3 Reno .
188