__QUOTACTL(2) | System Calls Manual | __QUOTACTL(2) |
__quotactl
—
#include <sys/quota.h>
#include <sys/quotactl.h>
int
__quotactl
(const
char *path, struct
quotactl_args *args);
__quotactl
() call manipulates file system quotas.
This is an internal interface and is documented for reference purposes only.
All application and utility code should use the
libquota(3) interface.
The __quotactl
() function performs one of
several quota-related operations on the file system named by
path. The operation and arguments to that operation
are passed in the args argument. The operation is
stored in the qc_op member of
args. The arguments are placed in a union such that
the first and second arguments of the operation
QUOTACTL_EXAMPLE
are found as the members
u.example.qc_arg1 and
u.example.qc_arg2. The descriptions below will refer
to the operations as functions of the form
QUOTACTL_EXAMPLE
(int arg1,
int arg2) and elide the encoding of these arguments
into the args structure. Explicit mention of the
path argument is also omitted.
There are fourteen quota control operations. These are:
QUOTACTL_STAT
(struct quotastat
*info)quotastat
structure contains the following
members:
QUOTACTL_IDTYPESTAT
(int
idtype, struct quotaidtypestat *info)quotaidtypestat
structure contains the following members:
QUOTACTL_OBJYPESTAT
(int
objtype, struct quotaobjtypestat *info)quotaobjtypestat
structure contains the following
members:
QUOTACTL_GET
(const struct quotakey
*key, struct quotaval *val)QUOTACTL_PUT
(const struct quotakey
*key, const struct quotaval *val)QUOTACTL_DELETE
(const struct
quotakey *key)QUOTACTL_CURSOROPEN
(struct
quotakcursor *cursor)quotakcursor
structure is a semi-opaque type
holding the iteration state used by the quota implementation. The caller
is responsible for allocating and maintaining storage for the cursor.
Every cursor that is opened should be closed. It is not specified whether
a cursor remains valid if
memcpy(3) is used to move it
to a different location in user memory. It is not specified whether or how
a cursor may be duplicated. Passing an uninitialized, corrupted, or closed
cursor to operations other than
QUOTACTL_CURSOROPEN
() will produce unspecified
behavior. As per general standards for system calls such actions must not
produce undefined or materially adverse behavior in the kernel; however,
the effect on a user process may be arbitrary. The
libquota(3) interface
wraps the system call level quota cursors in a friendlier interface. See
quota_opencursor(3).QUOTACTL_CURSORCLOSE
(struct
quotakcursor *cursor)QUOTACTL_CURSORSKIPIDTYPE
(struct
quotakcursor *cursor, int idtype)QUOTACTL_CURSORGET
(struct
quotakcursor *cursor, struct quotakey *keys,
struct quotaval *vals, unsigned
maxnum, unsigned *ret)QUOTACTL_CURSORATEND
(struct
quotakcursor *cursor, int *ret)QUOTACTL_CURSORREWIND
(struct
quotakcursor *cursor)QUOTACTL_CURSORGET
() will begin again at the start
of the iteration. See
quotacursor_rewind(3).QUOTACTL_QUOTAON
(int idtype,
const char *quotafile)QUOTACTL_QUOTAON
() except in single-user mode. See
quotaon(8) for more
information. Normally quotaon 8 is run during the boot sequence after
quotacheck 8 . Also see
quota_quotaon(3).QUOTACTL_QUOTAOFF
(int
idtype)__quotactl
() returns 0. Otherwise the value
-1 is returned and an error code reflecting the reason for the failure is
placed in errno.
__quotactl
() failures include:
EFAULT
]EINVAL
]ENODEV
]ENOENT
]ENOMEM
]ENXIO
]EOPNOTSUPP
]quotactl
() function call appeared in
4.3BSD-Reno. The current
__quotactl
() interface appeared in
NetBSD 6.0.
There should be some way to integrate this call with the resource limit interface provided by setrlimit(2) and getrlimit(2).
February 11, 2012 | NetBSD 9.2 |