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

NAME

6       quotactl - manipulate disk quotas
7

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUES

125       quotactl() returns:
126
127       0      on success.
128
129       -1     on failure and sets errno to indicate the error.
130

ERRORS

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

SEE ALSO

167       quota(1), getrlimit(2), quotacheck(8), quotaon(8)
168
169
170
171                                                                   QUOTACTL(2)
Impressum