Print this page
10531 Convert quotactl(7I) to mandoc
   1 '\" te
   2 .\"  Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved
   3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   6 .TH QUOTACTL 7I "Jun 14, 2004"
   7 .SH NAME
   8 quotactl \- manipulate disk quotas
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 #include <sys/fs/ufs_quota.h>
  13 int ioctl(int \fIfd\fR, Q_QUOTACTL, struct quotcl *\fIqp\fR)
  14 .fi
  15 
  16 .SH DESCRIPTION
  17 .sp
  18 .LP
  19 This \fBioctl()\fR call manipulates disk quotas. \fIfd\fR is the file
  20 descriptor returned by the \fBopen()\fR system call after opening the
  21 \fBquotas\fR file (located in the root directory of the filesystem running
  22 quotas.) \fBQ_QUOTACTL\fR is defined in \fB/usr/include/sys/fs/ufs_quota.h\fR.
  23 \fIqp\fR is the address of the \fBquotctl\fR structure which is defined as
  24 .sp
  25 .in +2
  26 .nf


















  27 struct quotctl {
  28   int op;
  29   uid_t uid;
  30   caddr_t addr;
  31 };
  32 .fi
  33 .in -2
  34 
  35 .sp
  36 .LP
  37 \fIop\fR indicates an operation to be applied to the user \fBID\fR \fIuid\fR.
  38 (See below.) \fIaddr\fR is the address of an optional, command specific, data
  39 structure which is copied in or out of the system. The interpretation of
  40 \fIaddr\fR is given with each value of \fIop\fR below.
  41 .sp
  42 .ne 2
  43 .na
  44 \fB\fBQ_QUOTAON\fR\fR
  45 .ad
  46 .RS 14n
  47 Turn on quotas for a file system. \fIaddr\fR points to the full pathname of the
  48 \fBquotas\fR file. \fIuid\fR is ignored. It is recommended that \fIuid\fR have
  49 the value of \fB0\fR. This call is restricted to the super-user.
  50 .RE
  51 
  52 .sp
  53 .ne 2
  54 .na
  55 \fB\fBQ_QUOTAOFF\fR\fR
  56 .ad
  57 .RS 14n
  58 Turn off quotas for a file system. \fIaddr\fR and \fIuid\fR are ignored. It is
  59 recommended that \fIaddr\fR have the value of \fINULL\fR and \fIuid\fR have the
  60 value of \fB0\fR. This call is restricted to the super-user.
  61 .RE
  62 
  63 .sp
  64 .ne 2
  65 .na
  66 \fB\fBQ_GETQUOTA\fR\fR
  67 .ad
  68 .RS 14n
  69 Get disk quota limits and current usage for user \fIuid\fR. \fIaddr\fR is a
  70 pointer to a \fBdqblk\fR structure (defined in \fB<sys/fs/ufs_quota.h>\fR).



















  71 Only the super-user may get the quotas of a user other than himself.
  72 .RE
  73 
  74 .sp
  75 .ne 2
  76 .na
  77 \fB\fBQ_SETQUOTA\fR\fR
  78 .ad
  79 .RS 14n
  80 Set disk quota limits and current usage for user \fIuid\fR. \fIaddr\fR is a
  81 pointer to a \fBdqblk\fR structure (defined in \fBsys/fs/ufs_quota.h\fR). This
  82 call is restricted to the super-user.
  83 .RE
  84 
  85 .sp
  86 .ne 2
  87 .na
  88 \fB\fBQ_SETQLIM\fR\fR
  89 .ad
  90 .RS 14n
  91 Set disk quota limits for user \fIuid\fR. \fIaddr\fR is a pointer to a
  92 \fBdqblk\fR structure (defined in \fBsys/fs/ufs_quota.h\fR). This call is
  93 restricted to the super-user.
  94 .RE
  95 
  96 .sp
  97 .ne 2
  98 .na
  99 \fB\fBQ_SYNC\fR\fR
 100 .ad
 101 .RS 14n
 102 Update the on-disk copy of quota usages for this file system. \fIaddr\fR and
 103 \fIuid\fR are ignored.
 104 .RE
 105 
 106 .sp
 107 .ne 2
 108 .na
 109 \fB\fBQ_ALLSYNC\fR\fR
 110 .ad
 111 .RS 14n
 112 Update the on-disk copy of quota usages for all file systems with active
 113 quotas. \fIaddr\fR and \fIuid\fR are ignored.
 114 .RE
 115 
 116 .SH RETURN VALUES
 117 .sp
 118 .LP
 119 This \fBioctl()\fR returns:
 120 .sp
 121 .ne 2
 122 .na
 123 \fB\fB0\fR\fR
 124 .ad
 125 .RS 9n
 126 on success.
 127 .RE
 128 
 129 .sp
 130 .ne 2
 131 .na
 132 \fB\fB\(mi1\fR\fR
 133 .ad
 134 .RS 9n
 135 on failure and sets \fBerrno\fR to indicate the error.
 136 .RE
 137 
 138 .SH ERRORS
 139 .sp
 140 .ne 2
 141 .na
 142 \fB\fBEFAULT\fR\fR
 143 .ad
 144 .RS 10n
 145 \fIaddr\fR is invalid.
 146 .RE
 147 
 148 .sp
 149 .ne 2
 150 .na
 151 \fB\fBEINVAL\fR\fR
 152 .ad
 153 .RS 10n
 154 The kernel has not been compiled with the \fBQUOTA\fR option. \fIop\fR is
 155 invalid.
 156 .RE
 157 
 158 .sp
 159 .ne 2
 160 .na
 161 \fB\fBENOENT\fR\fR
 162 .ad
 163 .RS 10n
 164 The \fBquotas\fR file specified by \fIaddr\fR does not exist.
 165 .RE
 166 
 167 .sp
 168 .ne 2
 169 .na
 170 \fB\fBEPERM\fR\fR
 171 .ad
 172 .RS 10n
 173 The call is privileged and the calling process did not assert
 174 {PRIV_SYS_MOUNT} in the effective set.
 175 .RE
 176 
 177 .sp
 178 .ne 2
 179 .na
 180 \fB\fBESRCH\fR\fR
 181 .ad
 182 .RS 10n
 183 No disk quota is found for the indicated user. Quotas have not been turned on
 184 for this file system.
 185 .RE
 186 
 187 .sp
 188 .ne 2
 189 .na
 190 \fB\fBEUSERS\fR\fR
 191 .ad
 192 .RS 10n
 193 The quota table is full.
 194 .RE
 195 
 196 .sp
 197 .LP
 198 If \fIop\fR is \fBQ_QUOTAON\fR, \fBioctl()\fR may set \fBerrno\fR to:
 199 .sp
 200 .ne 2
 201 .na
 202 \fB\fBEACCES\fR\fR
 203 .ad
 204 .RS 10n
 205 The quota file pointed to by \fIaddr\fR exists but is not a regular file. The
 206 quota file pointed to by \fIaddr\fR exists but is not on the file system
 207 pointed to by \fIspecial\fR.
 208 .RE
 209 
 210 .sp
 211 .ne 2
 212 .na
 213 \fB\fBEIO\fR\fR
 214 .ad
 215 .RS 10n
 216 Internal I/O error while attempting to read the \fBquotas\fR file pointed to by
 217 \fIaddr\fR.
 218 .RE
 219 
 220 .SH FILES
 221 .sp
 222 .ne 2
 223 .na
 224 \fB\fB/usr/include/sys/fs/ufs_quota.h\fR\fR
 225 .ad
 226 .sp .6
 227 .RS 4n
 228 quota-related structure/function definitions and defines
 229 .RE
 230 
 231 .SH SEE ALSO
 232 .sp
 233 .LP
 234 \fBquota\fR(1M), \fBquotacheck\fR(1M), \fBquotaon\fR(1M), \fBgetrlimit\fR(2),
 235 \fBmount\fR(2)
 236 .SH BUGS
 237 .sp
 238 .LP
 239 There should be some way to integrate this call with the resource limit
 240 interface provided by \fBsetrlimit()\fR and \fBgetrlimit\fR(2).
 241 .sp
 242 .LP


 243 This call is incompatible with Melbourne quotas.

   1 .\"  Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved
   2 .\" Copyright (c) 2017, Joyent, Inc.
   3 .\" The contents of this file are subject to the terms of the
   4 .\" Common Development and Distribution License (the "License").
   5 .\" You may not use this file except in compliance with the License.
   6 .\"
   7 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   8 .\" or http://www.opensolaris.org/os/licensing.
   9 .\" See the License for the specific language governing permissions
  10 .\" and limitations under the License.
  11 .\"
  12 .\" When distributing Covered Code, include this CDDL HEADER in each
  13 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  14 .\" If applicable, add the following below this CDDL HEADER, with the
  15 .\" fields enclosed by brackets "[]" replaced with your own identifying
  16 .\" information: Portions Copyright [yyyy] [name of copyright owner]
  17 .Dd October 28, 2017
  18 .Dt QUOTACTL 7I
  19 .Os
  20 .Sh NAME
  21 .Nm quotactl
  22 .Nd manipulate disk quotas
  23 .Sh SYNOPSIS
  24 .In sys/fs/ufs_quota.h
  25 .Fn "int ioctl" "int fd" "Q_QUOTACTL" "struct quotctl *qp"
  26 .Sh DESCRIPTION
  27 This
  28 .Fn ioctl
  29 call manipulates disk quotas.
  30 .Fa fd
  31 is the file descriptor returned by the
  32 .Xr open 2
  33 system call after opening the
  34 .Pa quotas
  35 file (located in the root directory of the filesystem running quotas).
  36 .Dv Q_QUOTACTL
  37 is defined in
  38 .Pa /usr/include/sys/fs/ufs_quota.h .
  39 .Fa qp
  40 is the address of the
  41 .Vt quotctl
  42 structure which is defined as
  43 .Bd -literal -offset 2n
  44 struct quotctl {
  45   int op;
  46   uid_t uid;
  47   caddr_t addr;
  48 };
  49 .Ed
  50 .Pp
  51 .Fa op
  52 indicates an operation to be applied to the user
  53 .Sy ID
  54 .Fa uid .
  55 .Po
  56 See below.
  57 .Pc
  58 .Fa addr
  59 is the address of an optional, command specific, data
  60 structure which is copied in or out of the system.
  61 The interpretation of
  62 .Fa addr
  63 is given with each value of
  64 .Fa op
  65 below.
  66 .Bl -tag -width Q_GETQUOTA
  67 .It Sy Q_QUOTAON
  68 Turn on quotas for a file system.
  69 .Fa addr
  70 points to the full pathname of the
  71 .Pa quotas
  72 file.
  73 .Fa uid
  74 is ignored.
  75 It is recommended that
  76 .Fa uid
  77 have the value of
  78 .Sy 0 .
  79 This call is restricted to the super-user.
  80 .It Dv Q_QUOTAOFF
  81 Turn off quotas for a file system.
  82 .Fa addr
  83 and
  84 .Fa uid
  85 are ignored.
  86 It is
  87 recommended that
  88 .Fa addr
  89 have the value of
  90 .Sy NULL
  91 and
  92 .Fa uid
  93 have the value of
  94 .Sy 0 .
  95 This call is restricted to the super-user.
  96 .It Dv Q_GETQUOTA
  97 Get disk quota limits and current usage for user
  98 .Fa uid .
  99 .Fa addr
 100 is a pointer to a
 101 .Vt dqblk
 102 structure
 103 .Po
 104 defined in
 105 .In sys/fs/ufs_quota.h
 106 .Pc .
 107 Only the super-user may get the quotas of a user other than himself.
 108 .It Dv Q_SETQUOTA
 109 Set disk quota limits and current usage for user
 110 .Fa uid .
 111 .Fa addr
 112 is a pointer to a
 113 .Vt dqblk
 114 structure
 115 .Po
 116 defined in
 117 .In sys/fs/ufs_quota.h
 118 .Pc .
 119 This call is restricted to the super-user.
 120 .It Dv Q_SETQLIM
 121 Set disk quota limits for user
 122 .Fa uid .
 123 .Fa addr
 124 is a pointer to a
 125 .Vt dqblk
 126 structure
 127 .Po
 128 defined in
 129 .In sys/fs/ufs_quota.h
 130 .Pc .
 131 This call is restricted to the super-user.
 132 .It Dv Q_SYNC
 133 Update the on-disk copy of quota usages for this file system.
 134 .Fa addr
 135 and
 136 .Fa uid
 137 are ignored.
 138 .It Dv Q_ALLSYNC









 139 Update the on-disk copy of quota usages for all file systems with active
 140 quotas.
 141 .Fa addr
 142 and
 143 .Fa uid
 144 are ignored.
 145 .El
 146 .Sh RETURN VALUES
 147 This
 148 Fn ioctl
 149 returns:
 150 .Bl -tag -width xx
 151 .It Sy 0

 152 on success.
 153 .It Sy \(mi1
 154 on failure and sets
 155 .Va errno
 156 to indicate the error.
 157 .El
 158 .Sh FILES
 159 .Bl -tag -width x
 160 .It Pa /usr/include/sys/fs/ufs_quota.h
 161 quota-related structure/function definitions and defines
 162 .El
 163 .Sh ERRORS
 164 .Bl -tag -width EFAULT
 165 .It Er EFAULT
 166 .Fa addr
 167 is invalid.
 168 .It Er EINVAL
 169 The kernel has not been compiled with the
 170 .Sy QUOTA
 171 option.
 172 .Fa op
 173 is invalid.
 174 .It Er ENOENT
 175 The
 176 .Pa quotas
 177 file specified by
 178 .Fa addr
 179 does not exist.
 180 .It Er EPERM


















 181 The call is privileged and the calling process did not assert
 182 .Brq Sy PRIV_SYS_MOUNT
 183 in the effective set.
 184 .It Er ESRCH
 185 No disk quota is found for the indicated user.
 186 Quotas have not been turned on for this file system.
 187 .It Er EUSERS













 188 The quota table is full.
 189 .El
 190 .Pp
 191 If
 192 .Fa op
 193 is
 194 .Dv Q_QUOTAON ,
 195 .Fn ioctl
 196 may set
 197 .Va errno
 198 to:
 199 .Bl -tag -width EACCES
 200 .It Er EACCES
 201 The quota file pointed to by
 202 .Fa addr
 203 exists but is not a regular file.
 204 The quota file pointed to by
 205 .Fa addr
 206 exists but is not on the file system pointed to by
 207 .Fa special .
 208 .It Er EIO
 209 Internal I/O error while attempting to read the
 210 .Pa quotas
 211 file pointed to by
 212 .Fa addr .
 213 .El
 214 .Sh SEE ALSO
 215 .Xr quota 1M ,
 216 .Xr quotacheck 1M ,
 217 .Xr quotaon 1M ,
 218 .Xr getrlimit 2 ,
 219 .Xr mount 2
 220 .Sh BUGS













 221 There should be some way to integrate this call with the resource limit
 222 interface provided by
 223 .Xr setrlimit 2
 224 and
 225 .Xr getrlimit 2 .
 226 .Pp
 227 This call is incompatible with Melbourne quotas.