Debian Codegraph @

upstream/mageia-cauldron/man2/quotactl.2

raw
1 .\" Copyright 1996, Andries E. Brouwer <[email protected]>
2 .\" Copyright 2010, Jan Kara <[email protected]>
3 .\" Copyright 2010, Michael Kerrisk <[email protected]>
4 .\" Copyright, the authors of the Linux man-pages project
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .TH quotactl 2 2026-02-08 "Linux man-pages 6.17"
9 .SH NAME
10 quotactl, quotactl_fd \- manipulate disk quotas
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc ,\~ \-lc )
14 .SH SYNOPSIS
15 .nf
16 .B #include <sys/quota.h>
17 .BR "#include <xfs/xqm.h>" " /* Definition of " Q_X* " and " XFS_QUOTA_* \
18 " constants"
19 .RB " (or " <linux/dqblk_xfs.h> "; see NOTES) */"
20 .P
21 .BI "int quotactl(int " op ", const char *_Nullable " special ", int " id ,
22 .BI " caddr_t " addr );
23 .P
24 .BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
25 .B #include <unistd.h>
26 .P
27 .BI "int syscall(SYS_quotactl_fd, int " fd ", int " op ", int " id \
28 ", caddr_t " addr );
29 .fi
30 .P
31 .IR Note :
32 glibc provides no wrapper for
33 .BR quotactl_fd (),
34 necessitating the use of
35 .BR syscall (2).
36 .SH DESCRIPTION
37 The quota system can be used to set per-user, per-group, and per-project limits
38 on the amount of disk space used on a filesystem.
39 For each user and/or group,
40 a soft limit and a hard limit can be set for each filesystem.
41 The hard limit can't be exceeded.
42 The soft limit can be exceeded, but warnings will ensue.
43 Moreover, the user can't exceed the soft limit for more than grace period
44 duration (one week by default) at a time;
45 after this, the soft limit counts as a hard limit.
46 .P
47 The
48 .BR quotactl ()
49 and
50 .BR quotactl_fd ()
51 calls manipulate disk quotas.
52 The difference between these functions is
53 the way the filesystem being manipulated is specified,
54 see description of the arguments below.
55 See NOTES for why one variant might be preferred over the other.
56 .P
57 The
58 .I op
59 argument indicates an operation to be applied to the user or
60 group ID specified in
61 .IR id .
62 To initialize the
63 .I op
64 argument, use the
65 .I QCMD(subop, type)
66 macro.
67 The
68 .I type
69 value is either
70 .BR USRQUOTA ,
71 for user quotas,
72 .BR GRPQUOTA ,
73 for group quotas, or (since Linux 4.1)
74 .\" 847aac644e92e5624f2c153bab409bf713d5ff9a
75 .BR PRJQUOTA ,
76 for project quotas.
77 The
78 .I subop
79 value is described below.
80 .P
81 For
82 .BR quotactl (),
83 the
84 .I special
85 argument is a pointer to a null-terminated string containing the pathname
86 of the (mounted) block special device for the filesystem being manipulated.
87 .P
88 For
89 .BR quotactl_fd (),
90 the
91 .I fd
92 argument is a file descriptor (which may be opened with the
93 .B O_PATH
94 flag) referring to a file or directory on the filesystem being manipulated.
95 .P
96 The
97 .I addr
98 argument is the address of an optional, operation-specific, data structure
99 that is copied in or out of the system.
100 The interpretation of
101 .I addr
102 is given with each operation below.
103 .P
104 The
105 .I subop
106 value is one of the following operations:
107 .TP
108 .B Q_QUOTAON
109 Turn on quotas for a filesystem.
110 The
111 .I id
112 argument is the identification number of the quota format to be used.
113 Currently, there are three supported quota formats:
114 .RS
115 .TP 13
116 .B QFMT_VFS_OLD
117 The original quota format.
118 .TP
119 .B QFMT_VFS_V0
120 The standard VFS v0 quota format, which can handle 32-bit UIDs and GIDs
121 and quota limits up to 2\[ha]42 bytes and 2\[ha]32 inodes.
122 .TP
123 .B QFMT_VFS_V1
124 A quota format that can handle 32-bit UIDs and GIDs
125 and quota limits of 2\[ha]63 \- 1 bytes and 2\[ha]63 \- 1 inodes.
126 .RE
127 .IP
128 The
129 .I addr
130 argument points to the pathname of a file containing the quotas for
131 the filesystem.
132 The quota file must exist;
133 it is normally created with the
134 .BR quotacheck (8)
135 program
136 .IP
137 Quota information can be also stored in hidden system inodes
138 for ext4, XFS, and other filesystems if the filesystem is configured so.
139 In this case, there are no visible quota files and there is no need to
140 use
141 .BR quotacheck (8).
142 Quota information is always kept consistent by the filesystem and the
143 .B Q_QUOTAON
144 operation serves only to enable enforcement of quota limits.
145 The presence of hidden
146 system inodes with quota information is indicated by the
147 .B DQF_SYS_FILE
148 flag in the
149 .I dqi_flags
150 field returned by the
151 .B Q_GETINFO
152 operation.
153 .IP
154 The
155 .BR quotactl_fd ()
156 variant of this system call ignores the
157 .I addr
158 and
159 .I id
160 arguments, so the
161 .B Q_QUOTAON
162 operation of
163 .BR quotactl_fd ()
164 is only suitable for work with hidden system inodes.
165 .IP
166 This operation requires privilege
167 .RB ( CAP_SYS_ADMIN ).
168 .TP
169 .B Q_QUOTAOFF
170 Turn off quotas for a filesystem.
171 The
172 .I addr
173 and
174 .I id
175 arguments are ignored.
176 This operation requires privilege
177 .RB ( CAP_SYS_ADMIN ).
178 .TP
179 .B Q_GETQUOTA
180 Get disk quota limits and current usage for user or group
181 .IR id .
182 The
183 .I addr
184 argument is a pointer to a
185 .I dqblk
186 structure defined in
187 .I <sys/quota.h>
188 as follows:
189 .IP
190 .in +4n
191 .EX
192 /* uint64_t is an unsigned 64\-bit integer;
193 uint32_t is an unsigned 32\-bit integer */
194 \&
195 struct dqblk { /* Definition since Linux 2.4.22 */
196 uint64_t dqb_bhardlimit; /* Absolute limit on disk
197 quota blocks alloc */
198 uint64_t dqb_bsoftlimit; /* Preferred limit on
199 disk quota blocks */
200 uint64_t dqb_curspace; /* Current occupied space
201 (in bytes) */
202 uint64_t dqb_ihardlimit; /* Maximum number of
203 allocated inodes */
204 uint64_t dqb_isoftlimit; /* Preferred inode limit */
205 uint64_t dqb_curinodes; /* Current number of
206 allocated inodes */
207 uint64_t dqb_btime; /* Time limit for excessive
208 disk use */
209 uint64_t dqb_itime; /* Time limit for excessive
210 files */
211 uint32_t dqb_valid; /* Bit mask of QIF_*
212 constants */
213 };
214 \&
215 /* Flags in dqb_valid that indicate which fields in
216 dqblk structure are valid. */
217 \&
218 #define QIF_BLIMITS 1
219 #define QIF_SPACE 2
220 #define QIF_ILIMITS 4
221 #define QIF_INODES 8
222 #define QIF_BTIME 16
223 #define QIF_ITIME 32
224 #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
225 #define QIF_USAGE (QIF_SPACE | QIF_INODES)
226 #define QIF_TIMES (QIF_BTIME | QIF_ITIME)
227 #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES)
228 .EE
229 .in
230 .IP
231 The
232 .I dqb_valid
233 field is a bit mask that is set to indicate the entries in the
234 .I dqblk
235 structure that are valid.
236 Currently, the kernel fills in all entries of the
237 .I dqblk
238 structure and marks them as valid in the
239 .I dqb_valid
240 field.
241 Unprivileged users may retrieve only their own quotas;
242 a privileged user
243 .RB ( CAP_SYS_ADMIN )
244 can retrieve the quotas of any user.
245 .TP
246 .BR Q_GETNEXTQUOTA " (since Linux 4.6)"
247 .\" commit 926132c0257a5a8d149a6a395cc3405e55420566
248 This operation is the same as
249 .BR Q_GETQUOTA ,
250 but it returns quota information for the next ID greater than or equal to
251 .I id
252 that has a quota set.
253 .IP
254 The
255 .I addr
256 argument is a pointer to a
257 .I nextdqblk
258 structure whose fields are as for the
259 .IR dqblk ,
260 except for the addition of a
261 .I dqb_id
262 field that is used to return the ID for which
263 quota information is being returned:
264 .IP
265 .in +4n
266 .EX
267 struct nextdqblk {
268 uint64_t dqb_bhardlimit;
269 uint64_t dqb_bsoftlimit;
270 uint64_t dqb_curspace;
271 uint64_t dqb_ihardlimit;
272 uint64_t dqb_isoftlimit;
273 uint64_t dqb_curinodes;
274 uint64_t dqb_btime;
275 uint64_t dqb_itime;
276 uint32_t dqb_valid;
277 uint32_t dqb_id;
278 };
279 .EE
280 .in
281 .TP
282 .B Q_SETQUOTA
283 Set quota information for user or group
284 .IR id ,
285 using the information supplied in the
286 .I dqblk
287 structure pointed to by
288 .IR addr .
289 The
290 .I dqb_valid
291 field of the
292 .I dqblk
293 structure indicates which entries in the structure have been set by the caller.
294 This operation supersedes the
295 .B Q_SETQLIM
296 and
297 .B Q_SETUSE
298 operations in the previous quota interfaces.
299 This operation requires privilege
300 .RB ( CAP_SYS_ADMIN ).
301 .TP
302 .BR Q_GETINFO " (since Linux 2.4.22)"
303 Get information (like grace times) about quotafile.
304 The
305 .I addr
306 argument should be a pointer to a
307 .I dqinfo
308 structure.
309 This structure is defined in
310 .I <sys/quota.h>
311 as follows:
312 .IP
313 .in +4n
314 .EX
315 /* uint64_t is an unsigned 64\-bit integer;
316 uint32_t is an unsigned 32\-bit integer */
317 \&
318 struct dqinfo { /* Defined since Linux 2.4.22 */
319 uint64_t dqi_bgrace; /* Time before block soft limit
320 becomes hard limit */
321 uint64_t dqi_igrace; /* Time before inode soft limit
322 becomes hard limit */
323 uint32_t dqi_flags; /* Flags for quotafile
324 (DQF_*) */
325 uint32_t dqi_valid;
326 };
327 \&
328 /* Bits for dqi_flags */
329 \&
330 /* Quota format QFMT_VFS_OLD */
331 \&
332 #define DQF_ROOT_SQUASH (1 << 0) /* Root squash enabled */
333 /* Before Linux 4.0, this had been defined
334 privately as V1_DQF_RSQUASH */
335 \&
336 /* Quota format QFMT_VFS_V0 / QFMT_VFS_V1 */
337 \&
338 #define DQF_SYS_FILE (1 << 16) /* Quota stored in
339 a system file */
340 \&
341 /* Flags in dqi_valid that indicate which fields in
342 dqinfo structure are valid. */
343 \&
344 #define IIF_BGRACE 1
345 #define IIF_IGRACE 2
346 #define IIF_FLAGS 4
347 #define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS)
348 .EE
349 .in
350 .IP
351 The
352 .I dqi_valid
353 field in the
354 .I dqinfo
355 structure indicates the entries in the structure that are valid.
356 Currently, the kernel fills in all entries of the
357 .I dqinfo
358 structure and marks them all as valid in the
359 .I dqi_valid
360 field.
361 The
362 .I id
363 argument is ignored.
364 .TP
365 .BR Q_SETINFO " (since Linux 2.4.22)"
366 Set information about quotafile.
367 The
368 .I addr
369 argument should be a pointer to a
370 .I dqinfo
371 structure.
372 The
373 .I dqi_valid
374 field of the
375 .I dqinfo
376 structure indicates the entries in the structure
377 that have been set by the caller.
378 This operation supersedes the
379 .B Q_SETGRACE
380 and
381 .B Q_SETFLAGS
382 operations in the previous quota interfaces.
383 The
384 .I id
385 argument is ignored.
386 This operation requires privilege
387 .RB ( CAP_SYS_ADMIN ).
388 .TP
389 .BR Q_GETFMT " (since Linux 2.4.22)"
390 Get quota format used on the specified filesystem.
391 The
392 .I addr
393 argument should be a pointer to a 4-byte buffer
394 where the format number will be stored.
395 .TP
396 .B Q_SYNC
397 Update the on-disk copy of quota usages for a filesystem.
398 For
399 .BR quotactl (),
400 if
401 .I special
402 is NULL, then all filesystems with active quotas are sync'ed.
403 .RB ( quotactl_fd ()
404 always sync's only one filesystem.)
405 In both cases, the
406 .I addr
407 and
408 .I id
409 arguments are ignored.
410 .TP
411 .BR Q_GETSTATS " (supported up to Linux 2.4.21)"
412 Get statistics and other generic information about the quota subsystem.
413 The
414 .I addr
415 argument should be a pointer to a
416 .I dqstats
417 structure in which data should be stored.
418 This structure is defined in
419 .IR <sys/quota.h> .
420 The
421 .I special
422 and
423 .I id
424 arguments are ignored.
425 .IP
426 This operation is obsolete and was removed in Linux 2.4.22.
427 Files in
428 .I /proc/sys/fs/quota/
429 carry the information instead.
430 .P
431 For XFS filesystems making use of the XFS Quota Manager (XQM),
432 the above operations are bypassed and the following operations are used:
433 .TP
434 .B Q_XQUOTAON
435 Turn on quotas for an XFS filesystem.
436 XFS provides the ability to turn on/off quota limit enforcement
437 with quota accounting.
438 Therefore, XFS expects
439 .I addr
440 to be a pointer to an
441 .I "unsigned int"
442 that contains a bitwise combination of the following flags (defined in
443 .IR <xfs/xqm.h> ):
444 .IP
445 .in +4n
446 .EX
447 XFS_QUOTA_UDQ_ACCT /* User quota accounting */
448 XFS_QUOTA_UDQ_ENFD /* User quota limits enforcement */
449 XFS_QUOTA_GDQ_ACCT /* Group quota accounting */
450 XFS_QUOTA_GDQ_ENFD /* Group quota limits enforcement */
451 XFS_QUOTA_PDQ_ACCT /* Project quota accounting */
452 XFS_QUOTA_PDQ_ENFD /* Project quota limits enforcement */
453 .EE
454 .in
455 .IP
456 This operation requires privilege
457 .RB ( CAP_SYS_ADMIN ).
458 The
459 .I id
460 argument is ignored.
461 .TP
462 .B Q_XQUOTAOFF
463 Turn off quotas for an XFS filesystem.
464 As with
465 .BR Q_QUOTAON ,
466 XFS filesystems expect a pointer to an
467 .I "unsigned int"
468 that specifies whether quota accounting and/or limit enforcement need
469 to be turned off (using the same flags as for
470 .B Q_XQUOTAON
471 operation).
472 This operation requires privilege
473 .RB ( CAP_SYS_ADMIN ).
474 The
475 .I id
476 argument is ignored.
477 .TP
478 .B Q_XGETQUOTA
479 Get disk quota limits and current usage for user
480 .IR id .
481 The
482 .I addr
483 argument is a pointer to an
484 .I fs_disk_quota
485 structure, which is defined in
486 .I <xfs/xqm.h>
487 as follows:
488 .IP
489 .in +4n
490 .EX
491 /* All the blk units are in BBs (Basic Blocks) of
492 512 bytes. */
493 \&
494 #define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */
495 \&
496 #define XFS_USER_QUOTA (1<<0) /* User quota type */
497 #define XFS_PROJ_QUOTA (1<<1) /* Project quota type */
498 #define XFS_GROUP_QUOTA (1<<2) /* Group quota type */
499 \&
500 struct fs_disk_quota {
501 int8_t d_version; /* Version of this structure */
502 int8_t d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */
503 uint16_t d_fieldmask; /* Field specifier */
504 uint32_t d_id; /* User, project, or group ID */
505 uint64_t d_blk_hardlimit; /* Absolute limit on
506 disk blocks */
507 uint64_t d_blk_softlimit; /* Preferred limit on
508 disk blocks */
509 uint64_t d_ino_hardlimit; /* Maximum # allocated
510 inodes */
511 uint64_t d_ino_softlimit; /* Preferred inode limit */
512 uint64_t d_bcount; /* # disk blocks owned by
513 the user */
514 uint64_t d_icount; /* # inodes owned by the user */
515 int32_t d_itimer; /* Zero if within inode limits */
516 /* If not, we refuse service */
517 int32_t d_btimer; /* Similar to above; for
518 disk blocks */
519 uint16_t d_iwarns; /* # warnings issued with
520 respect to # of inodes */
521 uint16_t d_bwarns; /* # warnings issued with
522 respect to disk blocks */
523 int32_t d_padding2; /* Padding \- for future use */
524 uint64_t d_rtb_hardlimit; /* Absolute limit on realtime
525 (RT) disk blocks */
526 uint64_t d_rtb_softlimit; /* Preferred limit on RT
527 disk blocks */
528 uint64_t d_rtbcount; /* # realtime blocks owned */
529 int32_t d_rtbtimer; /* Similar to above; for RT
530 disk blocks */
531 uint16_t d_rtbwarns; /* # warnings issued with
532 respect to RT disk blocks */
533 int16_t d_padding3; /* Padding \- for future use */
534 char d_padding4[8]; /* Yet more padding */
535 };
536 .EE
537 .in
538 .IP
539 Unprivileged users may retrieve only their own quotas;
540 a privileged user
541 .RB ( CAP_SYS_ADMIN )
542 may retrieve the quotas of any user.
543 .TP
544 .BR Q_XGETNEXTQUOTA " (since Linux 4.6)"
545 .\" commit 8b37524962b9c54423374717786198f5c0820a28
546 This operation is the same as
547 .BR Q_XGETQUOTA ,
548 but it returns (in the
549 .I fs_disk_quota
550 structure pointed by
551 .IR addr )
552 quota information for the next ID greater than or equal to
553 .I id
554 that has a quota set.
555 Note that since
556 .I fs_disk_quota
557 already has
558 .I q_id
559 field, no separate structure type is needed (in contrast with
560 .B Q_GETQUOTA
561 and
562 .B Q_GETNEXTQUOTA
563 operations)
564 .TP
565 .B Q_XSETQLIM
566 Set disk quota limits for user
567 .IR id .
568 The
569 .I addr
570 argument is a pointer to an
571 .I fs_disk_quota
572 structure.
573 This operation requires privilege
574 .RB ( CAP_SYS_ADMIN ).
575 .TP
576 .B Q_XGETQSTAT
577 Returns XFS filesystem-specific quota information in the
578 .I fs_quota_stat
579 structure pointed by
580 .IR addr .
581 This is useful for finding out how much space is used to store quota
582 information, and also to get the quota on/off status of a given local XFS
583 filesystem.
584 The
585 .I fs_quota_stat
586 structure itself is defined as follows:
587 .IP
588 .in +4n
589 .EX
590 #define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */
591 \&
592 struct fs_qfilestat {
593 uint64_t qfs_ino; /* Inode number */
594 uint64_t qfs_nblks; /* Number of BBs
595 512\-byte\-blocks */
596 uint32_t qfs_nextents; /* Number of extents */
597 };
598 \&
599 struct fs_quota_stat {
600 int8_t qs_version; /* Version number for
601 future changes */
602 uint16_t qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */
603 int8_t qs_pad; /* Unused */
604 struct fs_qfilestat qs_uquota; /* User quota storage
605 information */
606 struct fs_qfilestat qs_gquota; /* Group quota storage
607 information */
608 uint32_t qs_incoredqs; /* Number of dquots in core */
609 int32_t qs_btimelimit; /* Limit for blocks timer */
610 int32_t qs_itimelimit; /* Limit for inodes timer */
611 int32_t qs_rtbtimelimit;/* Limit for RT
612 blocks timer */
613 uint16_t qs_bwarnlimit; /* Limit for # of warnings */
614 uint16_t qs_iwarnlimit; /* Limit for # of warnings */
615 };
616 .EE
617 .in
618 .IP
619 The
620 .I id
621 argument is ignored.
622 .TP
623 .B Q_XGETQSTATV
624 Returns XFS filesystem-specific quota information in the
625 .I fs_quota_statv
626 pointed to by
627 .IR addr .
628 This version of the operation uses a structure with proper versioning support,
629 along with appropriate layout (all fields are naturally aligned) and
630 padding to avoiding special compat handling;
631 it also provides the ability to get statistics regarding
632 the project quota file.
633 The
634 .I fs_quota_statv
635 structure itself is defined as follows:
636 .IP
637 .in +4n
638 .EX
639 #define FS_QSTATV_VERSION1 1 /* fs_quota_statv.qs_version */
640 \&
641 struct fs_qfilestatv {
642 uint64_t qfs_ino; /* Inode number */
643 uint64_t qfs_nblks; /* Number of BBs
644 512\-byte\-blocks */
645 uint32_t qfs_nextents; /* Number of extents */
646 uint32_t qfs_pad; /* Pad for 8\-byte alignment */
647 };
648 \&
649 struct fs_quota_statv {
650 int8_t qs_version; /* Version for future
651 changes */
652 uint8_t qs_pad1; /* Pad for 16\-bit alignment */
653 uint16_t qs_flags; /* XFS_QUOTA_.* flags */
654 uint32_t qs_incoredqs; /* Number of dquots incore */
655 struct fs_qfilestatv qs_uquota; /* User quota
656 information */
657 struct fs_qfilestatv qs_gquota; /* Group quota
658 information */
659 struct fs_qfilestatv qs_pquota; /* Project quota
660 information */
661 int32_t qs_btimelimit; /* Limit for blocks timer */
662 int32_t qs_itimelimit; /* Limit for inodes timer */
663 int32_t qs_rtbtimelimit; /* Limit for RT blocks
664 timer */
665 uint16_t qs_bwarnlimit; /* Limit for # of warnings */
666 uint16_t qs_iwarnlimit; /* Limit for # of warnings */
667 uint64_t qs_pad2[8]; /* For future proofing */
668 };
669 .EE
670 .in
671 .IP
672 The
673 .I qs_version
674 field of the structure should be filled with the version of the structure
675 supported by the callee (for now, only
676 .I FS_QSTAT_VERSION1
677 is supported).
678 The kernel will fill the structure in accordance with
679 version provided.
680 The
681 .I id
682 argument is ignored.
683 .TP
684 .BR Q_XQUOTARM " (buggy until Linux 3.16)"
685 .\" 9da93f9b7cdf8ab28da6b364cdc1fafc8670b4dc
686 Free the disk space taken by disk quotas.
687 The
688 .I addr
689 argument should be a pointer to an
690 .I "unsigned int"
691 value containing flags (the same as in
692 .I d_flags
693 field of
694 .I fs_disk_quota
695 structure)
696 which identify what types of quota
697 should be removed.
698 (Note that the quota type passed in the
699 .I op
700 argument is ignored, but should remain valid in order to pass preliminary
701 quotactl syscall handler checks.)
702 .IP
703 Quotas must have already been turned off.
704 The
705 .I id
706 argument is ignored.
707 .TP
708 .BR Q_XQUOTASYNC " (since Linux 2.6.15; no-op since Linux 3.4)"
709 .\" Added in commit ee34807a65aa0c5911dc27682863afca780a003e
710 This operation was an XFS quota equivalent to
711 .BR Q_SYNC ,
712 but it is no-op since Linux 3.4,
713 .\" 4b217ed9e30f94b6e8e5e262020ef0ceab6113af
714 as
715 .BR sync (1)
716 writes quota information to disk now
717 (in addition to the other filesystem metadata that it writes out).
718 The
719 .IR special ", " id " and " addr
720 arguments are ignored.
721 .SH RETURN VALUE
722 On success,
723 .BR quotactl ()
724 returns 0;
725 on error,
726 \-1 is returned,
727 and
728 .I errno
729 is set to indicate the error.
730 .SH ERRORS
731 .TP
732 .B EACCES
733 .I op
734 is
735 .BR Q_QUOTAON ,
736 and the quota file pointed to by
737 .I addr
738 exists, but is not a regular file or
739 is not on the filesystem pointed to by
740 .IR special .
741 .TP
742 .B EBUSY
743 .I op
744 is
745 .BR Q_QUOTAON ,
746 but another
747 .B Q_QUOTAON
748 had already been performed.
749 .TP
750 .B EFAULT
751 .I addr
752 or
753 .I special
754 is invalid.
755 .TP
756 .B EINVAL
757 .I op
758 or
759 .I type
760 is invalid.
761 .TP
762 .B EINVAL
763 .I op
764 is
765 .BR Q_QUOTAON ,
766 but the specified quota file is corrupted.
767 .TP
768 .BR EINVAL " (since Linux 5.5)"
769 .\" 3dd4d40b420846dd35869ccc8f8627feef2cff32
770 .I op
771 is
772 .BR Q_XQUOTARM ,
773 but
774 .I addr
775 does not point to valid quota types.
776 .TP
777 .B ENOENT
778 The file specified by
779 .I special
780 or
781 .I addr
782 does not exist.
783 .TP
784 .B ENOSYS
785 The kernel has not been compiled with the
786 .B CONFIG_QUOTA
787 option.
788 .TP
789 .B ENOTBLK
790 .I special
791 is not a block device.
792 .TP
793 .B EPERM
794 The caller lacked the required privilege
795 .RB ( CAP_SYS_ADMIN )
796 for the specified operation.
797 .TP
798 .B ERANGE
799 .I op
800 is
801 .BR Q_SETQUOTA ,
802 but the specified limits are out of the range allowed by the quota format.
803 .TP
804 .B ESRCH
805 No disk quota is found for the indicated user.
806 Quotas have not been turned on for this filesystem.
807 .TP
808 .B ESRCH
809 .I op
810 is
811 .BR Q_QUOTAON ,
812 but the specified quota format was not found.
813 .TP
814 .B ESRCH
815 .I op
816 is
817 .B Q_GETNEXTQUOTA
818 or
819 .BR Q_XGETNEXTQUOTA ,
820 but there is no ID greater than or equal to
821 .I id
822 that has an active quota.
823 .SH NOTES
824 .SS Alternative XFS header
825 Instead of
826 .I <xfs/xqm.h>
827 one can use
828 .IR <linux/dqblk_xfs.h> ,
829 taking into account that there are several naming discrepancies:
830 .IP \[bu] 3
831 Quota enabling flags (of format
832 .BR XFS_QUOTA_[UGP]DQ_{ACCT,ENFD} )
833 are defined without a leading "X", as
834 .BR FS_QUOTA_[UGP]DQ_{ACCT,ENFD} .
835 .IP \[bu]
836 The same is true for
837 .B XFS_{USER,GROUP,PROJ}_QUOTA
838 quota type flags, which are defined as
839 .BR FS_{USER,GROUP,PROJ}_QUOTA .
840 .IP \[bu]
841 The
842 .I dqblk_xfs.h
843 header file defines its own
844 .BR XQM_USRQUOTA ,
845 .BR XQM_GRPQUOTA ,
846 and
847 .B XQM_PRJQUOTA
848 constants for the available quota types,
849 but their values are the same as for
850 constants without the
851 .B XQM_
852 prefix.
853 .SS quotactl() versus quotactl_fd()
854 The original
855 .BR quotactl ()
856 variant of this system call requires specifying
857 the block device containing the filesystem to operate on.
858 This makes it impossible to use
859 in cases where the filesystem has no backing block device
860 (e.g., tmpfs).
861 Even when the block device does exist,
862 it might be difficult to locate
863 (requires scanning
864 .I /proc/self/mounts
865 and even some filesystem-specific parsing in the case of,
866 for example,
867 bcachefs).
868 .BR quotactl_fd ()
869 instead works on the mount point,
870 which avoids this limitation and is simpler to use
871 (since the filesystem to manipulate
872 is typically specified by its mount point anyway).
873 .SH STANDARDS
874 Linux.
875 .SH HISTORY
876 .TP
877 .BR quotactl_fd ()
878 Linux 5.14.
879 .SH SEE ALSO
880 .BR quota (1),
881 .BR getrlimit (2),
882 .BR quotacheck (8),
883 .BR quotaon (8)