mirror of
https://github.com/isc-projects/bind9.git
synced 2026-04-23 07:07:00 -04:00
Remove isc_mem_{set,get}quota unused functions
This commit is contained in:
parent
0667fa935a
commit
3987a146be
4 changed files with 1 additions and 65 deletions
|
|
@ -359,7 +359,6 @@ main(int argc, char *argv[]) {
|
|||
dbinfo *dbi;
|
||||
dns_dbversion_t *version;
|
||||
const dns_name_t *origin;
|
||||
size_t memory_quota = 0;
|
||||
dns_trust_t trust = 0;
|
||||
unsigned int addopts;
|
||||
isc_log_t *lctx = NULL;
|
||||
|
|
@ -411,10 +410,6 @@ main(int argc, char *argv[]) {
|
|||
case 'P':
|
||||
pause_every = atoi(isc_commandline_argument);
|
||||
break;
|
||||
case 'Q':
|
||||
memory_quota = atoi(isc_commandline_argument);
|
||||
isc_mem_setquota(mctx, memory_quota);
|
||||
break;
|
||||
case 't':
|
||||
type = atoi(isc_commandline_argument);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -333,18 +333,6 @@ isc_mem_setdestroycheck(isc_mem_t *mctx,
|
|||
* destroyed and abort the program if any are present.
|
||||
*/
|
||||
|
||||
/*@{*/
|
||||
void
|
||||
isc_mem_setquota(isc_mem_t *, size_t);
|
||||
size_t
|
||||
isc_mem_getquota(isc_mem_t *);
|
||||
/*%<
|
||||
* Set/get the memory quota of 'mctx'. This is a hard limit
|
||||
* on the amount of memory that may be allocated from mctx;
|
||||
* if it is exceeded, allocations will fail.
|
||||
*/
|
||||
/*@}*/
|
||||
|
||||
size_t
|
||||
isc_mem_inuse(isc_mem_t *mctx);
|
||||
/*%<
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ struct isc__mem {
|
|||
isc_refcount_t references;
|
||||
char name[16];
|
||||
void * tag;
|
||||
size_t quota;
|
||||
size_t total;
|
||||
size_t inuse;
|
||||
size_t maxinuse;
|
||||
|
|
@ -356,18 +355,10 @@ more_basic_blocks(isc__mem_t *ctx) {
|
|||
unsigned char *first, *last;
|
||||
unsigned char **table;
|
||||
unsigned int table_size;
|
||||
size_t increment;
|
||||
int i;
|
||||
|
||||
/* Require: we hold the context lock. */
|
||||
|
||||
/*
|
||||
* Did we hit the quota for this context?
|
||||
*/
|
||||
increment = NUM_BASIC_BLOCKS * ctx->mem_target;
|
||||
if (ctx->quota != 0U && ctx->total + increment > ctx->quota)
|
||||
return (false);
|
||||
|
||||
INSIST(ctx->basic_table_count <= ctx->basic_table_size);
|
||||
if (ctx->basic_table_count == ctx->basic_table_size) {
|
||||
table_size = ctx->basic_table_size + TABLE_INCREMENT;
|
||||
|
|
@ -397,7 +388,7 @@ more_basic_blocks(isc__mem_t *ctx) {
|
|||
ctx->memalloc_failures++;
|
||||
return (false);
|
||||
}
|
||||
ctx->total += increment;
|
||||
ctx->total += NUM_BASIC_BLOCKS * ctx->mem_target;;
|
||||
ctx->basic_table[ctx->basic_table_count] = tmp;
|
||||
ctx->basic_table_count++;
|
||||
ctx->malloced += NUM_BASIC_BLOCKS * ctx->mem_target;
|
||||
|
|
@ -498,10 +489,6 @@ mem_getunlocked(isc__mem_t *ctx, size_t size) {
|
|||
/*
|
||||
* memget() was called on something beyond our upper limit.
|
||||
*/
|
||||
if (ctx->quota != 0U && ctx->total + size > ctx->quota) {
|
||||
ret = NULL;
|
||||
goto done;
|
||||
}
|
||||
ret = (ctx->memalloc)(ctx->arg, size);
|
||||
if (ret == NULL) {
|
||||
ctx->memalloc_failures++;
|
||||
|
|
@ -794,7 +781,6 @@ isc_mem_createx(size_t init_max_size, size_t target_size,
|
|||
isc_refcount_init(&ctx->references, 1);
|
||||
memset(ctx->name, 0, sizeof(ctx->name));
|
||||
ctx->tag = NULL;
|
||||
ctx->quota = 0;
|
||||
ctx->total = 0;
|
||||
ctx->inuse = 0;
|
||||
ctx->maxinuse = 0;
|
||||
|
|
@ -1506,37 +1492,6 @@ isc_mem_setdestroycheck(isc_mem_t *ctx0, bool flag) {
|
|||
MCTXUNLOCK(ctx, &ctx->lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Quotas
|
||||
*/
|
||||
|
||||
void
|
||||
isc_mem_setquota(isc_mem_t *ctx0, size_t quota) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
MCTXLOCK(ctx, &ctx->lock);
|
||||
|
||||
ctx->quota = quota;
|
||||
|
||||
MCTXUNLOCK(ctx, &ctx->lock);
|
||||
}
|
||||
|
||||
size_t
|
||||
isc_mem_getquota(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
size_t quota;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
MCTXLOCK(ctx, &ctx->lock);
|
||||
|
||||
quota = ctx->quota;
|
||||
|
||||
MCTXUNLOCK(ctx, &ctx->lock);
|
||||
|
||||
return (quota);
|
||||
}
|
||||
|
||||
size_t
|
||||
isc_mem_inuse(isc_mem_t *ctx0) {
|
||||
isc__mem_t *ctx = (isc__mem_t *)ctx0;
|
||||
|
|
|
|||
|
|
@ -364,7 +364,6 @@ isc_mem_createx
|
|||
isc_mem_destroy
|
||||
isc_mem_detach
|
||||
isc_mem_getname
|
||||
isc_mem_getquota
|
||||
isc_mem_gettag
|
||||
isc_mem_inuse
|
||||
isc_mem_isovermem
|
||||
|
|
@ -378,7 +377,6 @@ isc_mem_renderxml
|
|||
@END LIBXML2
|
||||
isc_mem_setdestroycheck
|
||||
isc_mem_setname
|
||||
isc_mem_setquota
|
||||
isc_mem_setwater
|
||||
isc_mem_stats
|
||||
isc_mem_total
|
||||
|
|
|
|||
Loading…
Reference in a new issue