acache.c revision 24875d713b228dd51e542c71e75ac9fa2f982e0e
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * Permission to use, copy, modify, and distribute this software for any
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * purpose with or without fee is hereby granted, provided that the above
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * copyright notice and this permission notice appear in all copies.
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington * PERFORMANCE OF THIS SOFTWARE.
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington/* $Id: acache.c,v 1.6 2004/12/29 22:42:57 marka Exp $ */
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington#define ACACHE_MAGIC ISC_MAGIC('A', 'C', 'H', 'E')
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington#define DNS_ACACHE_VALID(acache) ISC_MAGIC_VALID(acache, ACACHE_MAGIC)
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington#define ACACHEENTRY_MAGIC ISC_MAGIC('A', 'C', 'E', 'T')
408633bd04e39e50951d6800f8bbc9838adac6d1Brian Wellington#define DNS_ACACHEENTRY_VALID(entry) ISC_MAGIC_VALID(entry, ACACHEENTRY_MAGIC)
#define ATRACE(m)
#define AATRACE(a, m)
* (XXX simply derived from definitions in cache.c There may be better
typedef struct dbentry {
} dbentry_t;
struct acache_cleaner {
* Locks overmem_event, overmem. (See cache.c)
from named.conf,
struct dns_acache {
unsigned int magic;
int live_cleaners;
unsigned int dbentries;
struct dns_acacheentry {
unsigned int magic;
void *cbarg;
static inline isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
for (i = 0; i < DBBUCKETS; i++) {
static inline isc_result_t
int bucket;
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
static isc_result_t
int result;
goto fail;
acache);
goto cleanup;
goto cleanup;
goto cleanup;
goto cleanup;
return (ISC_R_SUCCESS);
fail:
return (result);
* in named.conf.
static inline isc_boolean_t
return (ISC_TRUE);
return (ISC_TRUE);
if (r < passed)
return (ISC_TRUE);
return (ISC_FALSE);
int n_entries;
while (n_entries-- > 0) {
if (is_stale) {
if (is_stale)
if (want_cleaning)
if (should_free)
return (ISC_R_NOMEMORY);
return (ISC_R_UNEXPECTED);
goto cleanup;
for (i = 0; i < DBBUCKETS; i++)
goto cleanup;
return (ISC_R_SUCCESS);
return (result);
unsigned int refs;
if (refs == 0) {
if (should_free)
int bucket;
goto end;
goto end;
end:
return (result);
int bucket;
return (ISC_R_NOTFOUND);
return (ISC_R_SUCCESS);
return (ISC_R_NOMEMORY);
return (ISC_R_UNEXPECTED);
return (ISC_R_SUCCESS);
goto fail;
return (result);
fail:
return (result);
if (close_version)
goto fail;
goto fail;
sizeof(*crdataset));
goto fail;
link);
goto fail;
goto fail;
return (ISC_R_SUCCESS);
fail:
return (result);
unsigned int refs;
if (refs == 0) {
goto unlock;
* This function was derived from cache.c:dns_cache_setcachesize(). See the