Debian Codegraph @

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