1QUOTACTL(2)                   System Calls Manual                  QUOTACTL(2)
2
3
4

NAME

6       quotactl - manipulate disk quotas
7

SYNOPSIS

9       #include <linux/quota.h>
10       #include <xfs/xqm.h>
11       #include <linux/dqblk_v1.h>
12       #include <linux/dqblk_v2.h>
13
14       long quotactl(int cmd, char ∗special, qid_t id, caddr_t addr)
15

DESCRIPTION

17       The  quotactl()  call manipulates disk quotas.  cmd indicates a command
18       to be applied to UID id or GID id.  To set the type of  quota  use  the
19       QCMD(cmd,  type)  macro.   special  is  a  pointer to a null-terminated
20       string containing the path name of the block  special  device  for  the
21       filesystem being manipulated.  addr is the address of an optional, com‐
22       mand specific, data structure which is copied in or out of the  system.
23       The interpretation of addr is given with each command below.
24
25       Q_QUOTAON      Turn  on quotas for a filesystem.  id is the identifica‐
26                      tion number of the quota format to be used. Format  num‐
27                      bers  are defined in the header file of appropriate for‐
28                      mat. Currently there are  two  supported  quota  formats
29                      whose  numbers  are  defined  by  constants QFMT_VFS_OLD
30                      (original quota format)  and  QFMT_VFS_V0  (new  VFS  v0
31                      quota  format).   addr  points  to the path name of file
32                      containing the quotas for  the  filesystem.   The  quota
33                      file  must  exist;  it is normally created with the quo‐
34                      tacheck(8) program.  This  call  is  restricted  to  the
35                      super-user.
36
37       Q_QUOTAOFF     Turn  off  quotas  for  a  filesystem.   addr and id are
38                      ignored.  This call is restricted to the super-user.
39
40       Q_GETQUOTA     Get disk quota limits and  current  usage  for  user  or
41                      group  id.   addr  is a pointer to an if_dqblk structure
42                      (defined  in  <linux/quota.h>).   The  field   dqb_valid
43                      defines  the entries in the structure which are set cor‐
44                      rectly. On Q_GETQUOTA call all entries are  valid.  Only
45                      the  super-user  may get the quotas of a user other than
46                      himself.
47
48       Q_SETQUOTA     Set current quota information  for  user  or  group  id.
49                      addr  is  a pointer to an if_dqblk structure (defined in
50                      <linux/quota.h>).  The  field  dqb_valid  defines  which
51                      entries  in  the quota structure are valid and should be
52                      set. The constants for dqb_valid field  are  defined  in
53                      the  <linux/quota.h>  header  file.  This call obsoletes
54                      calls Q_SETQLIM  and  Q_SETUSE  in  the  previous  quota
55                      interfaces. This call is restricted to the super-user.
56
57       Q_GETINFO      Get  information  (like  grace  times)  about quotafile.
58                      addr should be  a  pointer  to  an  if_dqinfo  structure
59                      (defined  in  <linux/quota.h>).   The dqi_valid field in
60                      the structure defines entries in it which are valid.  On
61                      Q_GETINFO  call  all entries are valid.  Parameter id is
62                      ignored.
63
64       Q_SETINFO      Set information  about  quotafile.   addr  should  be  a
65                      pointer    to    if_dqinfo    structure    (defined   in
66                      <linux/quota.h>).  The  field  dqi_valid  defines  which
67                      entries in the quota info structure are valid and should
68                      be set. The constants for dqi_valid field are defined in
69                      the  <linux/quota.h>  header  file.  This call obsoletes
70                      calls Q_SETGRACE and Q_SETFLAGS in  the  previous  quota
71                      interfaces.  Parameter  id is ignored. This operation is
72                      restricted to super-user.
73
74       Q_GETFMT       Get quota format used on the specified filesystem.  addr
75                      should be a pointer to a memory (4 bytes) where the for‐
76                      mat number will be stored.
77
78       Q_SYNC         Update the on-disk copy of quota usages for  a  filesys‐
79                      tem.   If  special  is  null  then  all filesystems with
80                      active quotas are sync'ed.  addr and id are ignored.
81
82       Q_GETSTATS     Get statistics and other generic information about quota
83                      subsystem.   addr  should be a pointer to dqstats struc‐
84                      ture (defined in <linux/quota.h>) in which  data  should
85                      be stored.  special and id are ignored.
86
87       For  XFS  filesystems  making  use  of the XFS Quota Manager (XQM), the
88       above commands are bypassed and the following commands are used:
89
90       Q_XQUOTAON     Turn on quotas for an XFS filesystem.  XFS provides  the
91                      ability  to  turn  on/off  quota  limit enforcement with
92                      quota accounting.  Therefore, XFS expects the addr to be
93                      a  pointer  to  an unsigned int that contains either the
94                      flags XFS_QUOTA_UDQ_ACCT and/or XFS_QUOTA_UDQ_ENFD  (for
95                      user     quota),     or     XFS_QUOTA_GDQ_ACCT    and/or
96                      XFS_QUOTA_GDQ_ENFD (for  group  quota),  as  defined  in
97                      <xfs/xqm.h>.  This call is restricted to the superuser.
98
99       Q_XQUOTAOFF    Turn off quotas for an XFS filesystem.  As in Q_QUOTAON,
100                      XFS filesystems expect a pointer to an unsigned int that
101                      specifies whether quota accounting and/or limit enforce‐
102                      ment need to be turned off.  This call is restricted  to
103                      the superuser.
104
105       Q_XGETQUOTA    Get  disk  quota  limits  and current usage for user id.
106                      addr is a pointer to a fs_disk_quota structure  (defined
107                      in  <xfs/xqm.h>).  Only the superuser may get the quotas
108                      of a user other than himself.
109
110       Q_XSETQLIM     Set disk quota limits for user id.  addr is a pointer to
111                      a  fs_disk_quota  structure  (defined  in  <xfs/xqm.h>).
112                      This call is restricted to the superuser.
113
114       Q_XGETQSTAT    Returns  a  fs_quota_stat   structure   containing   XFS
115                      filesystem  specific  quota information.  This is useful
116                      in finding out how much space is spent  to  store  quota
117                      information,  and  also  to  get quotaon/off status of a
118                      given local XFS filesystem.
119
120       Q_XQUOTARM     Free the disk space taken by disk quotas.   Quotas  must
121                      have already been turned off.
122
123       There  is  no command equivalent to Q_SYNC for XFS since sync(1) writes
124       quota information to disk (in addition to the other filesystem metadata
125       it writes out).
126

RETURN VALUES

128       quotactl() returns:
129
130       0      on success.
131
132       -1     on failure and sets errno to indicate the error.
133

ERRORS

135       EFAULT         addr or special are invalid.
136
137       ENOSYS         The kernel has not been compiled with the QUOTA option.
138
139       EINVAL
140
141                      cmd or type is invalid.
142
143       ENOENT         The file specified by special or addr does not exist.
144
145       ENOTBLK        special is not a block device.
146
147       EPERM          The call is privileged and the caller was not the super-
148                      user.
149
150       ESRCH          No disc quota is found for the indicated user.
151
152                      Quotas have not been turned on for this filesystem.
153
154       If cmd is Q_QUOTAON, quotactl() may set errno to:
155
156       EACCES         The quota file pointed to by addr exists but  is  not  a
157                      regular file.
158
159                      The  quota  file pointed to by addr exists but is not on
160                      the filesystem pointed to by special.
161
162       EINVAL         The quota file is corrupted.
163
164       ESRCH          Specified quota format was not found.
165
166       EBUSY          Q_QUOTAON attempted while another Q_QUOTAON has  already
167                      taken place.
168

SEE ALSO

170       quota(1), getrlimit(2), quotacheck(8), quotaon(8)
171
172
173
174                                                                   QUOTACTL(2)
Impressum