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