Main Page   Compound List   File List   Compound Members   File Members  

user_quota.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <linux/quota.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <mntent.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

Defines

#define MIN(A, B)   (((A)<(B))?(A):(B))
#define MAX_IQ_TIME   (7 * 24 * 60 * 60)
#define MAX_DQ_TIME   (7 * 24 * 60 * 60)

Functions

char** quota_get_specials_user ()
char** quota_get_specials_group ()
void quota_free_specials (char **specials)
int quota_on ()
int quota_off ()
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)

Detailed Description


Function Documentation

void quota_free_specials ( char ** specials )
 

quota_free_specials:

Parameters:
specials   A list of specials which must be destroyed.

This function frees an array of strings returned by a previous call to quota_get_specials_user() or quota_get_specials_group().

Returns:
nothing.

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 )
 

quota_get_group:

Parameters:
gid   The GID of the group for which quotas should be queried.
special   The device node of the filesystem on which quotas are to be read.
inode_soft   Will contain the group's inode quota.
inode_hard   Will contain the group's inode limit.
inode_usage   Will contain the group's current inode usage.
inode_grace   Will contain the amount of time the group can use more than the quota and still be able to use more inodes.
block_soft   Will contain the group's block quota.
block_hard   Will contain the group's block limit.
block_usage   Will contain the group's current block usage.
block_grace   Will contain the amount of time the group can use more than the quota and still be able to use more blocks.

Queries quotas for the given group on a given filesystem.

Returns:
0 on success, assorted other values on failure.

char** quota_get_specials_group ( void )
 

quota_get_specials_group:

Queries the list of mounted filesystems and returns an array of strings containing the names of the devices which can enforce group quotas.

Returns:
a list of values which should be freed by calling quota_free_specials().

char** quota_get_specials_user ( void )
 

quota_get_specials_user:

Queries the list of mounted filesystems and returns an array of strings containing the names of the devices which can enforce user quotas.

Returns:
A list of values which should be freed by calling quota_free_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 )
 

quota_get_user:

Parameters:
uid   The UID of the user whose quotas should be queried.
special   The device node of the filesystem on which quotas are to be read.
inode_soft   Will contain the user's inode quota.
inode_hard   Will contain the user's inode limit.
inode_usage   Will contain the user's current inode usage.
inode_grace   Will contain the amount of time the user can use more than his quota and still be able to use more inodes.
block_soft   Will contain the user's block quota.
block_hard   Will contain the user's block limit.
block_usage   Will contain the user's current block usage.
block_grace   Will contain the amount of time the user can use more than his quota and still be able to use more blocks.

Queries quotas for the given user on a given filesystem.

Returns:
0 on success, assorted other values on failure.

int quota_off ( void )
 

quota_off:

Disables quotas on all currently-mounted filesystems which support them.

Returns:
0 on success, assorted other values on failure.

int quota_on ( void )
 

quota_on:

Enables quotas on all currently-mounted filesystems which support them.

Returns:
0 on success, assorted other values 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 )
 

quota_set_group:

Parameters:
gid   The GID of the group for which quotas should be set.
special   The device node of the filesystem on which quotas are to be set.
inode_soft   Will contain the group's inode quota.
inode_hard   Will contain the group's inode limit.
inode_grace   Will contain the amount of time the group can use more than the quota and still be able to use more inodes.
block_soft   Will contain the group's block quota.
block_hard   Will contain the group's block limit.
block_grace   Will contain the amount of time the group can use more than the quota and still be able to use more blocks.

Sets quotas for the given group on a given filesystem.

Returns:
0 on success, assorted other values 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 )
 

quota_set_user:

Parameters:
uid   The UID of the user for whom quotas should be set.
special   The device node of the filesystem on which quotas are to be set.
inode_soft   Will contain the user's inode quota.
inode_hard   Will contain the user's inode limit.
inode_grace   Will contain the amount of time the user can use more than his quota and still be able to use more inodes.
block_soft   Will contain the user's block quota.
block_hard   Will contain the user's block limit.
block_grace   Will contain the amount of time the user can use more than his quota and still be able to use more blocks.

Sets quotas for the given user on a given filesystem.

Returns:
0 on success, assorted other values on failure.


Generated at Wed Oct 12 09:20:53 2005 for libuser by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001