quotactl(2) System Calls Manual quotactl(2) quotactl, quotactl_fd - (libc -lc) #include /* Definition of Q_X* and XFS_QUOTA_* constants (or ; see NOTES) */ #include int quotactl(int op, const char *_Nullable special, int id, caddr_t addr); #include /* Definition of Q_X* and XFS_QUOTA_* constants (or ; see NOTES) */ #include /* Definition of SYS_* constants */ #include int syscall(SYS_quotactl_fd, int fd, int op, int id, caddr_t addr); . / . . . ( ) . quotactl() quotactl_fd() . . . op id. op QCMD(subop, type). type USRQUOTA GRPQUOTA ( Linux 4.1) PRJQUOTA . subop . quotactl() special () . quotactl_fd() fd ( O_PATH) . addr . addr . subop : Q_QUOTAON . id . : QFMT_VFS_OLD . QFMT_VFS_V0 VFS v0 32 2^42 2^32 . QFMT_VFS_V1 32 2^63 - 1 2^63 - 1 . addr . quotacheck(8) ext4 XFS . quotacheck(8). Q_QUOTAON . DQF_SYS_FILE dqi_flags Q_GETINFO. quotactl_fd() addr id Q_QUOTAON quotactl_fd() . (CAP_SYS_ADMIN). Q_QUOTAOFF . addr id. (CAP_SYS_ADMIN). Q_GETQUOTA id. addr dqblk : struct dqblk { /* Definition since Linux 2.4.22 */ uint64_t dqb_bhardlimit; /* Absolute limit on disk quota blocks alloc */ uint64_t dqb_bsoftlimit; /* Preferred limit on disk quota blocks */ uint64_t dqb_curspace; /* Current occupied space (in bytes) */ uint64_t dqb_ihardlimit; /* Maximum number of allocated inodes */ uint64_t dqb_isoftlimit; /* Preferred inode limit */ uint64_t dqb_curinodes; /* Current number of allocated inodes */ uint64_t dqb_btime; /* Time limit for excessive disk use */ uint64_t dqb_itime; /* Time limit for excessive files */ uint32_t dqb_valid; /* Bit mask of QIF_* constants */ }; /* Flags in dqb_valid that indicate which fields in dqblk structure are valid. */ #define QIF_BLIMITS 1 #define QIF_SPACE 2 #define QIF_ILIMITS 4 #define QIF_INODES 8 #define QIF_BTIME 16 #define QIF_ITIME 32 #define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) #define QIF_USAGE (QIF_SPACE | QIF_INODES) #define QIF_TIMES (QIF_BTIME | QIF_ITIME) #define QIF_ALL (QIF_LIMITS | QIF_USAGE | QIF_TIMES) dqb_valid dqblk . dqblk dqb_valid. (CAP_SYS_ADMIN) . Q_GETNEXTQUOTA ( Linux 4.6) Q_GETQUOTA id . addr nextdqblk dqblk dqb_id : struct nextdqblk { uint64_t dqb_bhardlimit; uint64_t dqb_bsoftlimit; uint64_t dqb_curspace; uint64_t dqb_ihardlimit; uint64_t dqb_isoftlimit; uint64_t dqb_curinodes; uint64_t dqb_btime; uint64_t dqb_itime; uint32_t dqb_valid; uint32_t dqb_id; }; Q_SETQUOTA id dqblk addr. dqb_valid dqblk . Q_SETQLIM Q_SETUSE . (CAP_SYS_ADMIN). Q_GETINFO ( Linux 2.4.22) ( ) . addr dqinfo. : struct dqinfo { /* Defined since Linux 2.4.22 */ uint64_t dqi_bgrace; /* Time before block soft limit becomes hard limit */ uint64_t dqi_igrace; /* Time before inode soft limit becomes hard limit */ uint32_t dqi_flags; /* Flags for quotafile (DQF_*) */ uint32_t dqi_valid; }; /* Bits for dqi_flags */ /* Quota format QFMT_VFS_OLD */ #define DQF_ROOT_SQUASH (1 << 0) /* Root squash enabled */ /* Before Linux 4.0, this had been defined privately as V1_DQF_RSQUASH */ /* Quota format QFMT_VFS_V0 / QFMT_VFS_V1 */ #define DQF_SYS_FILE (1 << 16) /* Quota stored in a system file */ /* Flags in dqi_valid that indicate which fields in dqinfo structure are valid. */ #define IIF_BGRACE 1 #define IIF_IGRACE 2 #define IIF_FLAGS 4 #define IIF_ALL (IIF_BGRACE | IIF_IGRACE | IIF_FLAGS) dqi_valid dqinfo . dqinfo dqi_valid. id. Q_SETINFO ( Linux 2.4.22) . addr dqinfo. dqi_valid dqinfo . Q_SETGRACE Q_SETFLAGS . id. (CAP_SYS_ADMIN). Q_GETFMT ( Linux 2.4.22) . addr 4 . Q_SYNC . quotactl() special NULL . (quotactl_fd() .) addr id. Q_GETSTATS ( Linux 2.4.21) . addr dqstats . . special id. Linux 2.4.22. /proc/sys/fs/quota/ . XFS XFS (XQM) : Q_XQUOTAON XFS. XFS / . XFS addr unsigned int ( ): XFS_QUOTA_UDQ_ACCT /* */ XFS_QUOTA_UDQ_ENFD /* */ XFS_QUOTA_GDQ_ACCT /* */ XFS_QUOTA_GDQ_ENFD /* */ XFS_QUOTA_PDQ_ACCT /* */ XFS_QUOTA_PDQ_ENFD /* */ (CAP_SYS_ADMIN). id. Q_XQUOTAOFF XFS. Q_QUOTAON XFS unsigned int / ( Q_XQUOTAON). (CAP_SYS_ADMIN). id. Q_XGETQUOTA id. addr fs_disk_quota : /* All the blk units are in BBs (Basic Blocks) of 512 bytes. */ #define FS_DQUOT_VERSION 1 /* fs_disk_quota.d_version */ #define XFS_USER_QUOTA (1<<0) /* User quota type */ #define XFS_PROJ_QUOTA (1<<1) /* Project quota type */ #define XFS_GROUP_QUOTA (1<<2) /* Group quota type */ struct fs_disk_quota { int8_t d_version; /* Version of this structure */ int8_t d_flags; /* XFS_{USER,PROJ,GROUP}_QUOTA */ uint16_t d_fieldmask; /* Field specifier */ uint32_t d_id; /* User, project, or group ID */ uint64_t d_blk_hardlimit; /* Absolute limit on disk blocks */ uint64_t d_blk_softlimit; /* Preferred limit on disk blocks */ uint64_t d_ino_hardlimit; /* Maximum # allocated inodes */ uint64_t d_ino_softlimit; /* Preferred inode limit */ uint64_t d_bcount; /* # disk blocks owned by the user */ uint64_t d_icount; /* # inodes owned by the user */ int32_t d_itimer; /* Zero if within inode limits */ /* If not, we refuse service */ int32_t d_btimer; /* Similar to above; for disk blocks */ uint16_t d_iwarns; /* # warnings issued with respect to # of inodes */ uint16_t d_bwarns; /* # warnings issued with respect to disk blocks */ int32_t d_padding2; /* Padding - for future use */ uint64_t d_rtb_hardlimit; /* Absolute limit on realtime (RT) disk blocks */ uint64_t d_rtb_softlimit; /* Preferred limit on RT disk blocks */ uint64_t d_rtbcount; /* # realtime blocks owned */ int32_t d_rtbtimer; /* Similar to above; for RT disk blocks */ uint16_t d_rtbwarns; /* # warnings issued with respect to RT disk blocks */ int16_t d_padding3; /* Padding - for future use */ char d_padding4[8]; /* Yet more padding */ }; (CAP_SYS_ADMIN) . Q_XGETNEXTQUOTA ( Linux 4.6) Q_XGETQUOTA ( fs_disk_quota addr) id . fs_disk_quota q_id ( Q_GETQUOTA Q_GETNEXTQUOTA) Q_XSETQLIM id. addr fs_disk_quota. (CAP_SYS_ADMIN). Q_XGETQSTAT XFS fs_quota_stat addr. / XFS . fs_quota_stat : #define FS_QSTAT_VERSION 1 /* fs_quota_stat.qs_version */ struct fs_qfilestat { uint64_t qfs_ino; /* Inode number */ uint64_t qfs_nblks; /* Number of BBs 512-byte-blocks */ uint32_t qfs_nextents; /* Number of extents */ }; struct fs_quota_stat { int8_t qs_version; /* Version number for future changes */ uint16_t qs_flags; /* XFS_QUOTA_{U,P,G}DQ_{ACCT,ENFD} */ int8_t qs_pad; /* Unused */ struct fs_qfilestat qs_uquota; /* User quota storage information */ struct fs_qfilestat qs_gquota; /* Group quota storage information */ uint32_t qs_incoredqs; /* Number of dquots in core */ int32_t qs_btimelimit; /* Limit for blocks timer */ int32_t qs_itimelimit; /* Limit for inodes timer */ int32_t qs_rtbtimelimit;/* Limit for RT blocks timer */ uint16_t qs_bwarnlimit; /* Limit for # of warnings */ uint16_t qs_iwarnlimit; /* Limit for # of warnings */ }; id . Q_XGETQSTATV XFS fs_quota_statv addr. ( ) . fs_quota_statv : #define FS_QSTATV_VERSION1 1 /* fs_quota_statv.qs_version */ struct fs_qfilestatv { uint64_t qfs_ino; /* Inode number */ uint64_t qfs_nblks; /* Number of BBs 512-byte-blocks */ uint32_t qfs_nextents; /* Number of extents */ uint32_t qfs_pad; /* Pad for 8-byte alignment */ }; struct fs_quota_statv { int8_t qs_version; /* Version for future changes */ uint8_t qs_pad1; /* Pad for 16-bit alignment */ uint16_t qs_flags; /* XFS_QUOTA_.* flags */ uint32_t qs_incoredqs; /* Number of dquots incore */ struct fs_qfilestatv qs_uquota; /* User quota information */ struct fs_qfilestatv qs_gquota; /* Group quota information */ struct fs_qfilestatv qs_pquota; /* Project quota information */ int32_t qs_btimelimit; /* Limit for blocks timer */ int32_t qs_itimelimit; /* Limit for inodes timer */ int32_t qs_rtbtimelimit; /* Limit for RT blocks timer */ uint16_t qs_bwarnlimit; /* Limit for # of warnings */ uint16_t qs_iwarnlimit; /* Limit for # of warnings */ uint64_t qs_pad2[8]; /* For future proofing */ }; qs_version ( FS_QSTAT_VERSION1 ). . id . Q_XQUOTARM ( Linux 3.16) . addr unsigned int ( d_flags fs_disk_quota) . ( op quotactl .) . id . Q_XQUOTASYNC ( Linux 2.6.15 Linux 3.4) XFS Q_SYNC Linux 3.4 sync(1) ( ). special id addr . quotactl() 0 -1 errno . EACCES op Q_QUOTAON addr special. EBUSY op Q_QUOTAON Q_QUOTAON . EFAULT addr special . EINVAL op type . EINVAL op Q_QUOTAON . EINVAL ( 5.5) op Q_XQUOTARM addr . ENOENT special addr . ENOSYS CONFIG_QUOTA. ENOTBLK special . EPERM (CAP_SYS_ADMIN) . ERANGE op Q_SETQUOTA . ESRCH . . ESRCH op Q_QUOTAON . ESRCH op Q_GETNEXTQUOTA Q_XGETNEXTQUOTA id . XFS : o ( XFS_QUOTA_[UGP]DQ_{ACCT,ENFD}) "X" FS_QUOTA_[UGP]DQ_{ACCT,ENFD}. o XFS_{USER,GROUP,PROJ}_QUOTA FS_{USER,GROUP,PROJ}_QUOTA. o dqblk_xfs.h XQM_USRQUOTA XQM_GRPQUOTA XQM_PRJQUOTA XQM_. quotactl() quotactl_fd() quotactl() . ( tmpfs). ( /proc/self/mounts bcachefs). quotactl_fd() ( ). . quotactl_fd() 5.14. quota(1), getrlimit(2), quotacheck(8), quotaon(8) 3 . . : . 6.18 19 2026 quotactl(2)