QUOTACTL(2)
π QUOTACTL(2) β the file system quota whisperer π
okay so bestie, this is a section 2 page from the System Calls Manual, and we're talking about quotactl β the syscall that runs your file system quotas. enabling them, disabling them, reading them, writing them. it's giving backstage-pass-to-the-quota-table energy. π
πΈ NAME πΈ
quotactl β manipulate file system quotas
π LIBRARY π
Standard C Library (libc, -lc)
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <ufs/ufs/quota.h>
int
quotactl(const char *path, int cmd, int id, void *addr);
π¦ DESCRIPTION π¦
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 theQCMDmacro defined in<ufs/ufs/quota.h>to formulate the value forcmd.) β this is not optional advice, bestie, this is the way. don't hand-roll yourcmdvalues. π
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. (so like. -2? -500? no ma'am. 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β Enable disk quotas for the file system specified bypath. The command type specifies the type of the quotas being enabled. Theaddrargument specifies a file from which to take the quotas. The quota file must exist; it is normally created with thequotacheck(8)program. Theidargument is unused. Only the super-user may turn quotas on. πQ_QUOTAOFFβ Disable disk quotas for the file system specified bypath. The command type specifies the type of the quotas being disabled. Theaddrandidarguments are unused. Only the super-user may turn quotas off. πQ_GETQUOTASIZEβ Get the wordsize used to represent the quotas for the user or group (as determined by the command type). Possible values are32for the old-style quota file and64for the new-style quota file. Theaddrargument is a pointer to an integer into which the size is stored. The identifieridis not used.Q_GETQUOTAβ Get disk quota limits and current usage for the user or group (as determined by the command type) with identifierid. Theaddrargument is a pointer to astruct dqblkstructure (defined in<ufs/ufs/quota.h>).Q_SETQUOTAβ Set disk quota limits for the user or group (as determined by the command type) with identifierid. Theaddrargument is a pointer to astruct dqblkstructure (defined in<ufs/ufs/quota.h>). The usage fields of thedqblkstructure are ignored. This system call is restricted to the super-user. πQ_SETUSEβ Set disk usage limits for the user or group (as determined by the command type) with identifierid. Theaddrargument is a pointer to astruct dqblkstructure (defined in<ufs/ufs/quota.h>). Only the usage fields are used. This system call is restricted to the super-user. πQ_SYNCβ Update the on-disk copy of quota usages. The command type specifies which type of quotas are to be updated. Theidandaddrarguments are ignored.
π«Ά RETURN VALUES π«Ά
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.
zero means slay. negative one means check errno, bestie. π
π ERRORS π
The quotactl() system call will fail if:
[EOPNOTSUPP]β The kernel has not been compiled with theQUOTAoption. (you literally cannot, it's not in there π«)[EUSERS]β The quota table cannot be expanded.[EINVAL]β Thecmdargument or the command type is invalid. InQ_GETQUOTASIZE,Q_GETQUOTA,Q_SETQUOTA, andQ_SETUSE, quotas are not currently enabled for this file system.- The
idargument toQ_GETQUOTA,Q_SETQUOTAorQ_SETUSEis a negative value.
- The
[EACCES]β InQ_QUOTAON, the quota file is not a plain file.[EACCES]β Search permission is denied for a component of a path prefix.[ENOTDIR]β A component of a path prefix was not a directory.[ENAMETOOLONG]β A component of either pathname exceeded 255 characters, or the entire length of either path name exceeded 1023 characters.[ENOENT]β A filename does not exist.[ELOOP]β Too many symbolic links were encountered in translating a pathname.[EROFS]β InQ_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]β An I/O error occurred while reading from or writing to a file containing quotas.[EINTEGRITY]β Corrupted data was detected while reading from the file system.[EFAULT]β An invalidaddrwas supplied; the associated structure could not be copied in or out of the kernel.[EFAULT]β Thepathargument points outside the process's allocated address space.[EPERM]β The call was privileged and the caller was not the super-user.
heads up: two of these are literally the same errno (EFAULT) for two different reasons, and that's just how it is. not me being confused, that's the actual page. π
π SEE ALSO π
quota(1), fstab(5), edquota(8), quotacheck(8), quotaon(8), repquota(8)
π HISTORY π
The quotactl() system call appeared in 4.3BSD-Reno. vintage. iconic. π
π BUGS π
There should be some way to integrate this call with the resource limit interface provided by setrlimit(2) and getrlimit(2).
okay that's the whole page, bestie. this beauty came out of Debian, dated March 30, 2020 β go forth and quota responsibly, and remember: super-user only for the turning-on-and-off parts. πβ¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1983, 1990, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms