QUOTACTL(2) | System Calls Manual | QUOTACTL(2) |
quotactl
—
manipulate filesystem quotas
#include
<ufs/ufs/quota.h>
#include <unistd.h>
int
quotactl
(const
char *path, int
cmd, int id,
char *addr);
The
quotactl
()
call enables, disables and manipulates filesystem quotas. A quota control
command given by cmd operates on the given filename
path for the given user id. The
address of an optional command specific data structure,
addr, may be given; its interpretation is discussed
below with each command.
Currently quotas are supported only for the “ffs” filesystem. For “ffs”, 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 and group identifiers. The “ffs” specific commands are:
Q_QUOTAON
Q_QUOTAOFF
Q_GETQUOTA
struct
dqblk
structure.Q_SETQUOTA
struct dqblk
structure. The
usage fields of struct dqblk
structure are
ignored. This call is restricted to the superuser.Q_SETUSE
struct dqblk
structure. Only the
usage fields are used. This call is restricted to the superuser.Q_SYNC
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
A quotactl
() call will fail if:
EOPNOTSUPP
]QUOTA
option.EUSERS
]EINVAL
]EACCES
]Q_QUOTAON
, the quota file is not a plain
file.EACCES
]ENOTDIR
]ENAMETOOLONG
]NAME_MAX
characters, or an entire pathname (including the terminating NUL) exceeded
PATH_MAX
bytes.ENOENT
]ELOOP
]EROFS
]Q_QUOTAON
, the quota file resides on a
read-only filesystem.EIO
]EFAULT
]EFAULT
]EPERM
]quota(1), fstab(5), edquota(8), quotacheck(8), quotaon(8), repquota(8)
The quotactl
() function 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).
January 19, 2015 | OpenBSD-6.4 |