| libuser Reference Manual |
|---|
quota — Functions for manipulating disk quotas.
int quota_on (void); int quota_off (void); char** quota_get_specials_user (void); char** quota_get_specials_group (void); void quota_free_specials (char **specials); int quota_get_user (uid_t uid, const char *special, int32_t *inode_usage, int32_t *inode_soft, int32_t *inode_hard, int32_t *inode_grace, int32_t *block_usage, int32_t *block_soft, int32_t *block_hard, int32_t *block_grace); int quota_set_user (uid_t uid, const char *special, int32_t inode_soft, int32_t inode_hard, int32_t inode_grace, int32_t block_soft, int32_t block_hard, int32_t block_grace); int quota_get_group (gid_t gid, const char *special, int32_t *inode_usage, int32_t *inode_soft, int32_t *inode_hard, int32_t *inode_grace, int32_t *block_usage, int32_t *block_soft, int32_t *block_hard, int32_t *block_grace); int quota_set_group (gid_t gid, const char *special, int32_t inode_soft, int32_t inode_hard, int32_t inode_grace, int32_t block_soft, int32_t block_hard, int32_t block_grace);
quota.h declares functions which are useful for querying and manipulating user and group disk quotas under Linux. These routines are not portable to other operating systems.
int quota_on (void);
Enables enforcing quotas on filesystems where quotas are configured.
| Returns : | 0 on success, -1 on error |
int quota_off (void);
Disables enforcing quotas on filesystems where quotas are configured.
| Returns : | 0 on success, -1 on error |
char** quota_get_specials_user (void);
Gets a list of currently mounted filesystems which have user quotas enabled.
| Returns : | If sucessful, a NULL-terminated array of device names that should be freed by quota_free_specials(). On error returns NULL. |
char** quota_get_specials_group (void);
Gets a list of currently mounted filesystems which have group quotas enabled.
| Returns : | If sucessful, a NULL-terminated array of device names that should be freed by quota_free_specials(). On error returns NULL. |
void quota_free_specials (char **specials);
Frees the array returned by quota_get_specials_user() or quota_get_specials_group()
| specials : | array to be freed |
int quota_get_user (uid_t uid,
const char *special,
int32_t *inode_usage,
int32_t *inode_soft,
int32_t *inode_hard,
int32_t *inode_grace,
int32_t *block_usage,
int32_t *block_soft,
int32_t *block_hard,
int32_t *block_grace);Gets information about user quota on a device.
| uid : | UID to get information about |
| special : | block device name |
| inode_usage : | number of used inodes |
| inode_soft : | soft inode limit |
| inode_hard : | hard inode limit |
| inode_grace : | inode grace time in seconds |
| block_usage : | number of used blocks (each block is 1 kB) |
| block_soft : | soft block limit |
| block_hard : | hard block limit |
| block_grace : | block grace time in seconds |
| Returns : | 0 on success, -1 on failure |
int quota_set_user (uid_t uid,
const char *special,
int32_t inode_soft,
int32_t inode_hard,
int32_t inode_grace,
int32_t block_soft,
int32_t block_hard,
int32_t block_grace);Sets user quota on a device.
| uid : | UID to get information about |
| special : | block device name |
| inode_soft : | soft inode limit |
| inode_hard : | hard inode limit |
| inode_grace : | inode grace time in seconds |
| block_soft : | soft block limit |
| block_hard : | hard block limit |
| block_grace : | block grace time in seconds |
| Returns : | 0 on success, -1 on failure |
int quota_get_group (gid_t gid,
const char *special,
int32_t *inode_usage,
int32_t *inode_soft,
int32_t *inode_hard,
int32_t *inode_grace,
int32_t *block_usage,
int32_t *block_soft,
int32_t *block_hard,
int32_t *block_grace);Gets information about group quota on a device.
| gid : | GID to get information about |
| special : | block device name |
| inode_usage : | number of used inodes |
| inode_soft : | soft inode limit |
| inode_hard : | hard inode limit |
| inode_grace : | inode grace time in seconds |
| block_usage : | number of used blocks (each block is 1 kB) |
| block_soft : | soft block limit |
| block_hard : | hard block limit |
| block_grace : | block grace time in seconds |
| Returns : | 0 on success, -1 on failure |
int quota_set_group (gid_t gid,
const char *special,
int32_t inode_soft,
int32_t inode_hard,
int32_t inode_grace,
int32_t block_soft,
int32_t block_hard,
int32_t block_grace);Sets group quota on a device.
| gid : | GID to get information about |
| special : | block device name |
| inode_soft : | soft inode limit |
| inode_hard : | hard inode limit |
| inode_grace : | inode grace time in seconds |
| block_soft : | soft block limit |
| block_hard : | hard block limit |
| block_grace : | block grace time in seconds |
| Returns : | 0 on success, -1 on failure |
| << prompt | user >> |