quota.c File Reference

#include <config.h>
#include <stddef.h>
#include <isc/quota.h>
#include <isc/util.h>

Go to the source code of this file.

Functions

isc_result_t isc_quota_init (isc_quota_t *quota, int max)
 Initialize a quota object.
void isc_quota_destroy (isc_quota_t *quota)
 Destroy a quota object.
void isc_quota_soft (isc_quota_t *quota, int soft)
 Set a soft quota.
void isc_quota_max (isc_quota_t *quota, int max)
 Re-set a maximum quota.
isc_result_t isc_quota_reserve (isc_quota_t *quota)
 Attempt to reserve one unit of 'quota'.
void isc_quota_release (isc_quota_t *quota)
 Release one unit of quota.
isc_result_t isc_quota_attach (isc_quota_t *quota, isc_quota_t **p)
 Like isc_quota_reserve, and also attaches '*p' to the quota if successful (ISC_R_SUCCESS or ISC_R_SOFTQUOTA).
void isc_quota_detach (isc_quota_t **p)
 Like isc_quota_release, and also detaches '*p' from the quota.


Detailed Description

Definition in file quota.c.


Function Documentation

isc_result_t isc_quota_init ( isc_quota_t quota,
int  max 
)

Initialize a quota object.

Returns: ISC_R_SUCCESS Other error Lock creation failed.

Definition at line 30 of file quota.c.

References isc_mutex_init, isc_quota::lock, isc_quota::max, isc_quota::soft, and isc_quota::used.

Referenced by ns_server_create().

void isc_quota_destroy ( isc_quota_t quota  ) 

Destroy a quota object.

Definition at line 38 of file quota.c.

References DESTROYLOCK, INSIST, isc_quota::lock, isc_quota::max, isc_quota::soft, and isc_quota::used.

Referenced by ns_server_destroy().

void isc_quota_soft ( isc_quota_t quota,
int  soft 
)

Set a soft quota.

Definition at line 47 of file quota.c.

References isc_quota::lock, LOCK, isc_quota::soft, and UNLOCK.

Referenced by load_configuration().

void isc_quota_max ( isc_quota_t quota,
int  max 
)

Re-set a maximum quota.

Definition at line 54 of file quota.c.

References isc_quota::lock, LOCK, isc_quota::max, and UNLOCK.

Referenced by configure_server_quota().

isc_result_t isc_quota_reserve ( isc_quota_t quota  ) 

Attempt to reserve one unit of 'quota'.

Returns:

Definition at line 61 of file quota.c.

References ISC_R_QUOTA, ISC_R_SOFTQUOTA, ISC_R_SUCCESS, isc_quota::lock, LOCK, isc_quota::max, isc_quota::soft, UNLOCK, and isc_quota::used.

Referenced by client_request(), and isc_quota_attach().

void isc_quota_release ( isc_quota_t quota  ) 

Release one unit of quota.

Definition at line 77 of file quota.c.

References INSIST, isc_quota::lock, LOCK, UNLOCK, and isc_quota::used.

Referenced by isc_quota_detach().

isc_result_t isc_quota_attach ( isc_quota_t quota,
isc_quota_t **  p 
)

Like isc_quota_reserve, and also attaches '*p' to the quota if successful (ISC_R_SUCCESS or ISC_R_SOFTQUOTA).

Definition at line 85 of file quota.c.

References INSIST, isc_quota_reserve(), ISC_R_SOFTQUOTA, and ISC_R_SUCCESS.

Referenced by client_newconn(), ns_xfr_start(), query_prefetch(), and query_recurse().

void isc_quota_detach ( isc_quota_t **  p  ) 

Like isc_quota_release, and also detaches '*p' from the quota.

Definition at line 96 of file quota.c.

References INSIST, and isc_quota_release().

Referenced by exit_check(), ns_client_endrequest(), ns_xfr_start(), query_recurse(), and xfrout_ctx_destroy().


Generated on Tue Apr 28 17:41:18 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha