QUOTACTL(2) | System Calls Manual | QUOTACTL(2) |
quotactl
—
manipulate file system quotas
Standard C Library (libc, -lc)
#include
<sys/types.h>
#include <ufs/ufs/quota.h>
int
quotactl
(const
char *path, int
cmd, int id,
void *addr);
The
quotactl
()
system call enables, disables and manipulates file system quotas. A quota
control command given by cmd operates on the given
filename path for the given user or group
id. (NOTE: One should use the QCMD macro defined in
<ufs/ufs/quota.h>
to
formulate the value for cmd.) The address of an
optional command specific data structure, addr, may be
given; its interpretation is discussed below with each command.
For commands that use the id identifier, it must be either -1 or any positive value. The value of -1 indicates that the current UID or GID should be used. Any other negative value will return an error.
Currently quotas are supported only for the “ufs” file system. For “ufs”, a command is composed of a primary command (see below) and a command type used to interpret the id. Types are supported for interpretation of user identifiers (USRQUOTA) and group identifiers (GRPQUOTA). The “ufs” specific commands are:
Q_QUOTAON
Q_QUOTAOFF
Q_GETQUOTASIZE
Q_GETQUOTA
<ufs/ufs/quota.h>
).Q_SETQUOTA
<ufs/ufs/quota.h>
). The
usage fields of the dqblk structure are ignored.
This system call is restricted to the super-user.Q_SETUSE
<ufs/ufs/quota.h>
). Only
the usage fields are used. This system call is restricted to the
super-user.Q_SYNC
The quotactl
() function returns the
value 0 if successful; otherwise the value -1 is returned and
the global variable errno is set to indicate the
error.
The quotactl
() system call will fail
if:
EOPNOTSUPP
]QUOTA
option.EUSERS
]EINVAL
]Q_GETQUOTASIZE
,
Q_GETQUOTA
, Q_SETQUOTA
,
and Q_SETUSE
, quotas are not currently enabled for
this file system.
The id argument to
Q_GETQUOTA
, Q_SETQUOTA
or Q_SETUSE
is a negative value.
EACCES
]Q_QUOTAON
, the quota file is not a plain
file.EACCES
]ENOTDIR
]ENAMETOOLONG
]ENOENT
]ELOOP
]EROFS
]Q_QUOTAON
, either the file system on which
quotas are to be enabled is mounted read-only or the quota file resides on
a read-only file system.EIO
]EFAULT
]EFAULT
]EPERM
]quota(1), fstab(5), edquota(8), quotacheck(8), quotaon(8), repquota(8)
The quotactl
() system call appeared in
4.3BSD-Reno.
There should be some way to integrate this call with the resource limit interface provided by setrlimit(2) and getrlimit(2).
March 5, 1999 | Debian |