1.\" Copyright (c) 1983, 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" This code is derived from software contributed to Berkeley by 5.\" Robert Elz at The University of Melbourne. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)quotactl.2 8.2 (Berkeley) 3/10/95 32.\" 33.Dd March 30, 2020 34.Dt QUOTACTL 2 35.Os 36.Sh NAME 37.Nm quotactl 38.Nd manipulate file system quotas 39.Sh LIBRARY 40.Lb libc 41.Sh SYNOPSIS 42.In sys/types.h 43.In ufs/ufs/quota.h 44.Ft int 45.Fn quotactl "const char *path" "int cmd" "int id" "void *addr" 46.Sh DESCRIPTION 47The 48.Fn quotactl 49system call enables, disables and 50manipulates file system quotas. 51A quota control command 52given by 53.Fa cmd 54operates on the given filename 55.Fa path 56for the given user or group 57.Fa id . 58(NOTE: One should use the QCMD macro defined in 59.In ufs/ufs/quota.h 60to formulate the value for 61.Fa cmd . ) 62The address of an optional command specific data structure, 63.Fa addr , 64may be given; its interpretation 65is discussed below with each command. 66.Pp 67For commands that use the 68.Fa id 69identifier, it must be either -1 or any positive value. 70The value of -1 indicates that the current UID or GID should be used. 71Any other negative value will return an error. 72.Pp 73Currently quotas are supported only for the 74.Dq ufs 75file system. 76For 77.Dq ufs , 78a command is composed of a primary command (see below) 79and a command type used to interpret the 80.Fa id . 81Types are supported for interpretation of user identifiers (USRQUOTA) 82and group identifiers (GRPQUOTA). 83The 84.Dq ufs 85specific commands are: 86.Bl -tag -width Q_GETQUOTASIZEx 87.It Dv Q_QUOTAON 88Enable disk quotas for the file system specified by 89.Fa path . 90The command type specifies the type of the quotas being enabled. 91The 92.Fa addr 93argument specifies a file from which to take the quotas. 94The quota file must exist; 95it is normally created with the 96.Xr quotacheck 8 97program. 98The 99.Fa id 100argument is unused. 101Only the super-user may turn quotas on. 102.It Dv Q_QUOTAOFF 103Disable disk quotas for the file system specified by 104.Fa path . 105The command type specifies the type of the quotas being disabled. 106The 107.Fa addr 108and 109.Fa id 110arguments are unused. 111Only the super-user may turn quotas off. 112.It Dv Q_GETQUOTASIZE 113Get the wordsize used to represent the quotas for the user or group 114(as determined by the command type). 115Possible values are 32 for the old-style quota file 116and 64 for the new-style quota file. 117The 118.Fa addr 119argument is a pointer to an integer into which the size is stored. 120The identifier 121.Fa id 122is not used. 123.It Dv Q_GETQUOTA 124Get disk quota limits and current usage for the user or group 125(as determined by the command type) with identifier 126.Fa id . 127The 128.Fa addr 129argument 130is a pointer to a 131.Fa struct dqblk 132structure (defined in 133.In ufs/ufs/quota.h ) . 134.It Dv Q_SETQUOTA 135Set disk quota limits for the user or group 136(as determined by the command type) with identifier 137.Fa id . 138The 139.Fa addr 140argument 141is a pointer to a 142.Fa struct dqblk 143structure (defined in 144.In ufs/ufs/quota.h ) . 145The usage fields of the 146.Fa dqblk 147structure are ignored. 148This system call is restricted to the super-user. 149.It Dv Q_SETUSE 150Set disk usage limits for the user or group 151(as determined by the command type) with identifier 152.Fa id . 153The 154.Fa addr 155argument 156is a pointer to a 157.Fa struct dqblk 158structure (defined in 159.In ufs/ufs/quota.h ) . 160Only the usage fields are used. 161This system call is restricted to the super-user. 162.It Dv Q_SYNC 163Update the on-disk copy of quota usages. 164The command type specifies which type of quotas are to be updated. 165The 166.Fa id 167and 168.Fa addr 169arguments are ignored. 170.El 171.Sh RETURN VALUES 172.Rv -std quotactl 173.Sh ERRORS 174The 175.Fn quotactl 176system call will fail if: 177.Bl -tag -width Er 178.It Bq Er EOPNOTSUPP 179The kernel has not been compiled with the 180.Dv QUOTA 181option. 182.It Bq Er EUSERS 183The quota table cannot be expanded. 184.It Bq Er EINVAL 185The 186.Fa cmd 187argument 188or the command type is invalid. 189In 190.Dv Q_GETQUOTASIZE , 191.Dv Q_GETQUOTA , 192.Dv Q_SETQUOTA , 193and 194.Dv Q_SETUSE , 195quotas are not currently enabled for this file system. 196.Pp 197The 198.Fa id 199argument to 200.Dv Q_GETQUOTA , 201.Dv Q_SETQUOTA 202or 203.Dv Q_SETUSE 204is a negative value. 205.It Bq Er EACCES 206In 207.Dv Q_QUOTAON , 208the quota file is not a plain file. 209.It Bq Er EACCES 210Search permission is denied for a component of a path prefix. 211.It Bq Er ENOTDIR 212A component of a path prefix was not a directory. 213.It Bq Er ENAMETOOLONG 214A component of either pathname exceeded 255 characters, 215or the entire length of either path name exceeded 1023 characters. 216.It Bq Er ENOENT 217A filename does not exist. 218.It Bq Er ELOOP 219Too many symbolic links were encountered in translating a pathname. 220.It Bq Er EROFS 221In 222.Dv Q_QUOTAON , 223either the file system on which quotas are to be enabled is mounted read-only 224or the quota file resides on a read-only file system. 225.It Bq Er EIO 226An 227.Tn I/O 228error occurred while reading from or writing 229to a file containing quotas. 230.It Bq Er EINTEGRITY 231Corrupted data was detected while reading from the file system. 232.It Bq Er EFAULT 233An invalid 234.Fa addr 235was supplied; the associated structure could not be copied in or out 236of the kernel. 237.It Bq Er EFAULT 238The 239.Fa path 240argument 241points outside the process's allocated address space. 242.It Bq Er EPERM 243The call was privileged and the caller was not the super-user. 244.El 245.Sh SEE ALSO 246.Xr quota 1 , 247.Xr fstab 5 , 248.Xr edquota 8 , 249.Xr quotacheck 8 , 250.Xr quotaon 8 , 251.Xr repquota 8 252.Sh HISTORY 253The 254.Fn quotactl 255system call appeared in 256.Bx 4.3 Reno . 257.Sh BUGS 258There should be some way to integrate this call with the resource 259limit interface provided by 260.Xr setrlimit 2 261and 262.Xr getrlimit 2 . 263