summaryrefslogtreecommitdiff
path: root/nscd/cache.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-02-13 20:36:37 +0000
committerUlrich Drepper <drepper@redhat.com>2009-02-13 20:36:37 +0000
commit20e498bdb0608ae6ca431cb49d66d2ed6f5304f5 (patch)
tree55ff7b1aeaaefd6e82c5370ed0fdd91673cd92e5 /nscd/cache.c
parentd8111eac5422eded7a8680ca198eb5d149a38550 (diff)
downloadglibc-20e498bdb0608ae6ca431cb49d66d2ed6f5304f5.tar.gz
[BZ #5381]
2009-02-13 Ulrich Drepper <drepper@redhat.com> [BZ #5381] * nscd/nscd.h: Remove definitions and declarations for mem_in_flight. Change mempool_alloc prototype. * nscd/mem.c (gc): Don't handle mem_in_flight. (mempool_alloc): Third parameter now only indicates whether this is the first call (to allocate data) or not. If it is, get db rdlock. Release it on error. Don't handle mem_in_flight. * nscd/aicache.c (addhstaiX): Mark he parameter as const. Adjust third parameter of mempool_alloc calls. Nothing to do here in case mempool_alloc fails. Avoid local variable shadowing parameter. No need to get db rdlock before calling cache_add. * nscd/cache.c (cache_add): Adjust call to mempool_alloc. There is no mem_in_flight array anymore. * nscd/connections.c: Remove definition and handling of mem_in_flight. * nscd/grpcache.c (cache_addgr): Adjust third parameter of mempool_alloc calls. Mark he parameter as const. Nothing to do here in case mempool_alloc fails. No need to get db rdlock before calling cache_add. * nscd/hstcache.c (cache_addhst): Likewise. * nscd/initgrcache.c (addinitgroupsX): Likewise. * nscd/servicescache.c (cache_addserv): Likewise. * nscd/pwdcache.c (cache_addpw): Likewise. Remove some debugging code.
Diffstat (limited to 'nscd/cache.c')
-rw-r--r--nscd/cache.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/nscd/cache.c b/nscd/cache.c
index cd6e6b4440..ab842efc29 100644
--- a/nscd/cache.c
+++ b/nscd/cache.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 1999, 2003-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 1999, 2003-2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
@@ -155,21 +155,15 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet,
unsigned long int hash = __nis_hash (key, len) % table->head->module;
struct hashentry *newp;
- newp = mempool_alloc (table, sizeof (struct hashentry), IDX_record_data);
+ newp = mempool_alloc (table, sizeof (struct hashentry), 0);
/* If we cannot allocate memory, just do not do anything. */
if (newp == NULL)
{
- ++table->head->addfailed;
-
/* If necessary mark the entry as unusable so that lookups will
not use it. */
if (first)
packet->usable = false;
- /* Mark the in-flight memory as unused. */
- for (enum in_flight idx = 0; idx < IDX_record_data; ++idx)
- mem_in_flight.block[idx].dbidx = -1;
-
return -1;
}
@@ -234,10 +228,6 @@ cache_add (int type, const void *key, size_t len, struct datahead *packet,
pthread_cond_signal (&table->prune_cond);
}
- /* Mark the in-flight memory as unused. */
- for (enum in_flight idx = 0; idx < IDX_last; ++idx)
- mem_in_flight.block[idx].dbidx = -1;
-
return 0;
}