QUOTACTL(4I) Ioctl Requests QUOTACTL(4I)

quotactlmanipulate disk quotas

#include <sys/fs/ufs_quota.h>

int ioctl(int fd, Q_QUOTACTL, struct quotctl *qp);

This () call manipulates disk quotas. fd is the file descriptor returned by the open(2) system call after opening the quotas file (located in the root directory of the filesystem running quotas). Q_QUOTACTL is defined in /usr/include/sys/fs/ufs_quota.h. qp is the address of the quotctl structure which is defined as

struct quotctl {
  int op;
  uid_t uid;
  caddr_t addr;
};

op indicates an operation to be applied to the user uid. (See below.) addr is the address of an optional, command specific, data structure which is copied in or out of the system. The interpretation of addr is given with each value of op below.

Turn on quotas for a file system. addr points to the full pathname of the quotas file. uid is ignored. It is recommended that uid have the value of 0. This call is restricted to the super-user.
Turn off quotas for a file system. addr and uid are ignored. It is recommended that addr have the value of and uid have the value of 0. This call is restricted to the super-user.
Get disk quota limits and current usage for user uid. addr is a pointer to a dqblk structure (defined in <sys/fs/ufs_quota.h>). Only the super-user may get the quotas of a user other than himself.
Set disk quota limits and current usage for user uid. addr is a pointer to a dqblk structure (defined in <sys/fs/ufs_quota.h>). This call is restricted to the super-user.
Set disk quota limits for user uid. addr is a pointer to a dqblk structure (defined in <sys/fs/ufs_quota.h>). This call is restricted to the super-user.
Update the on-disk copy of quota usages for this file system. addr and uid are ignored.
Update the on-disk copy of quota usages for all file systems with active quotas. addr and uid are ignored.

This Fn ioctl returns:

on success.
−1
on failure and sets errno to indicate the error.

/usr/include/sys/fs/ufs_quota.h
quota-related structure/function definitions and defines

addr is invalid.
The kernel has not been compiled with the option. op is invalid.
The quotas file specified by addr does not exist.
The call is privileged and the calling process did not assert {} in the effective set.
No disk quota is found for the indicated user. Quotas have not been turned on for this file system.
The quota table is full.

If op is Q_QUOTAON, ioctl() may set errno to:

The quota file pointed to by addr exists but is not a regular file. The quota file pointed to by addr exists but is not on the file system pointed to by special.
Internal I/O error while attempting to read the quotas file pointed to by addr.

getrlimit(2), mount(2), quota(8), quotacheck(8), quotaon(8)

There should be some way to integrate this call with the resource limit interface provided by setrlimit(2) and getrlimit(2).

This call is incompatible with Melbourne quotas.

October 28, 2017 OmniOS