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.\" 4. 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.\" $FreeBSD: stable/10/lib/libc/sys/quotactl.2 233648 2012-03-29 05:02:12Z eadler $ 33.\" 34.Dd March 5, 1999 35.Dt QUOTACTL 2 36.Os 37.Sh NAME 38.Nm quotactl 39.Nd manipulate file system quotas 40.Sh LIBRARY 41.Lb libc 42.Sh SYNOPSIS 43.In sys/types.h 44.In ufs/ufs/quota.h 45.Ft int 46.Fn quotactl "const char *path" "int cmd" "int id" "void *addr" 47.Sh DESCRIPTION 48The 49.Fn quotactl 50system call enables, disables and 51manipulates file system quotas. 52A quota control command 53given by 54.Fa cmd 55operates on the given filename 56.Fa path 57for the given user or group 58.Fa id . 59(NOTE: One should use the QCMD macro defined in 60.In ufs/ufs/quota.h 61to formulate the value for 62.Fa cmd . ) 63The address of an optional command specific data structure, 64.Fa addr , 65may be given; its interpretation 66is discussed below with each command. 67.Pp 68For commands that use the 69.Fa id 70identifier, it must be either -1 or any positive value. 71The value of -1 indicates that the current UID or GID should be used. 72Any other negative value will return an error. 73.Pp 74Currently quotas are supported only for the 75.Dq ufs 76file system. 77For 78.Dq ufs , 79a command is composed of a primary command (see below) 80and a command type used to interpret the 81.Fa id . 82Types are supported for interpretation of user identifiers (USRQUOTA) 83and group identifiers (GRPQUOTA). 84The 85.Dq ufs 86specific commands are: 87.Bl -tag -width Q_GETQUOTASIZEx 88.It Dv Q_QUOTAON 89Enable disk quotas for the file system specified by 90.Fa path . 91The command type specifies the type of the quotas being enabled. 92The 93.Fa addr 94argument specifies a file from which to take the quotas. 95The quota file must exist; 96it is normally created with the 97.Xr quotacheck 8 98program. 99The 100.Fa id 101argument is unused. 102Only the super-user may turn quotas on. 103.It Dv Q_QUOTAOFF 104Disable disk quotas for the file system specified by 105.Fa path . 106The command type specifies the type of the quotas being disabled. 107The 108.Fa addr 109and 110.Fa id 111arguments are unused. 112Only the super-user may turn quotas off. 113.It Dv Q_GETQUOTASIZE 114Get the wordsize used to represent the quotas for the user or group 115(as determined by the command type). 116Possible values are 32 for the old-style quota file 117and 64 for the new-style quota file. 118The 119.Fa addr 120argument is a pointer to an integer into which the size is stored. 121The identifier 122.Fa id 123is not used. 124.It Dv Q_GETQUOTA 125Get disk quota limits and current usage for the user or group 126(as determined by the command type) with identifier 127.Fa id . 128The 129.Fa addr 130argument 131is a pointer to a 132.Fa struct dqblk 133structure (defined in 134.In ufs/ufs/quota.h ) . 135.It Dv Q_SETQUOTA 136Set disk quota limits for the user or group 137(as determined by the command type) with identifier 138.Fa id . 139The 140.Fa addr 141argument 142is a pointer to a 143.Fa struct dqblk 144structure (defined in 145.In ufs/ufs/quota.h ) . 146The usage fields of the 147.Fa dqblk 148structure are ignored. 149This system call is restricted to the super-user. 150.It Dv Q_SETUSE 151Set disk usage limits for the user or group 152(as determined by the command type) with identifier 153.Fa id . 154The 155.Fa addr 156argument 157is a pointer to a 158.Fa struct dqblk 159structure (defined in 160.In ufs/ufs/quota.h ) . 161Only the usage fields are used. 162This system call is restricted to the super-user. 163.It Dv Q_SYNC 164Update the on-disk copy of quota usages. 165The command type specifies which type of quotas are to be updated. 166The 167.Fa id 168and 169.Fa addr 170arguments are ignored. 171.El 172.Sh RETURN VALUES 173.Rv -std quotactl 174.Sh ERRORS 175The 176.Fn quotactl 177system call will fail if: 178.Bl -tag -width Er 179.It Bq Er EOPNOTSUPP 180The kernel has not been compiled with the 181.Dv QUOTA 182option. 183.It Bq Er EUSERS 184The quota table cannot be expanded. 185.It Bq Er EINVAL 186The 187.Fa cmd 188argument 189or the command type is invalid. 190In 191.Dv Q_GETQUOTASIZE , 192.Dv Q_GETQUOTA , 193.Dv Q_SETQUOTA , 194and 195.Dv Q_SETUSE , 196quotas are not currently enabled for this file system. 197.Pp 198The 199.Fa id 200argument to 201.Dv Q_GETQUOTA , 202.Dv Q_SETQUOTA 203or 204.Dv Q_SETUSE 205is a negative value. 206.It Bq Er EACCES 207In 208.Dv Q_QUOTAON , 209the quota file is not a plain file. 210.It Bq Er EACCES 211Search permission is denied for a component of a path prefix. 212.It Bq Er ENOTDIR 213A component of a path prefix was not a directory. 214.It Bq Er ENAMETOOLONG 215A component of either pathname exceeded 255 characters, 216or the entire length of either path name exceeded 1023 characters. 217.It Bq Er ENOENT 218A filename does not exist. 219.It Bq Er ELOOP 220Too many symbolic links were encountered in translating a pathname. 221.It Bq Er EROFS 222In 223.Dv Q_QUOTAON , 224either the file system on which quotas are to be enabled is mounted read-only 225or the quota file resides on a read-only file system. 226.It Bq Er EIO 227An 228.Tn I/O 229error occurred while reading from or writing 230to a file containing quotas. 231.It Bq Er EFAULT 232An invalid 233.Fa addr 234was supplied; the associated structure could not be copied in or out 235of the kernel. 236.It Bq Er EFAULT 237The 238.Fa path 239argument 240points outside the process's allocated address space. 241.It Bq Er EPERM 242The call was privileged and the caller was not the super-user. 243.El 244.Sh SEE ALSO 245.Xr quota 1 , 246.Xr fstab 5 , 247.Xr edquota 8 , 248.Xr quotacheck 8 , 249.Xr quotaon 8 , 250.Xr repquota 8 251.Sh HISTORY 252The 253.Fn quotactl 254system call appeared in 255.Bx 4.3 Reno . 256.Sh BUGS 257There should be some way to integrate this call with the resource 258limit interface provided by 259.Xr setrlimit 2 260and 261.Xr getrlimit 2 . 262