mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 04:50:07 +00:00
nscd cleanups
Cleanup and optimize last patch. Add timeout fixes also to the services cache.
This commit is contained in:
parent
445b4a53ea
commit
99231d9abe
@ -1,3 +1,12 @@
|
|||||||
|
2011-07-01 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
* nscd/pwdcache.c (cache_addpw): Cleanup. Add branch prediction.
|
||||||
|
* nscd/initgrcache.c (addinitgroupsX): Likewise.
|
||||||
|
* nscd/hstcache.c (cache_addhst): Likewise.
|
||||||
|
* nscd/grpcache.c (cache_addgr): Likewise.
|
||||||
|
* nscd/aicache.c (addhstaiX): Likewise
|
||||||
|
* nscd/servicescache.c (cache_addserv): Handle zero negtimeout.
|
||||||
|
|
||||||
2011-07-01 Thorsten Kukuk <kukuk@suse.de>
|
2011-07-01 Thorsten Kukuk <kukuk@suse.de>
|
||||||
|
|
||||||
* nscd/pwdcache.c (cache_addpw): Handle zero negtimeout.
|
* nscd/pwdcache.c (cache_addpw): Handle zero negtimeout.
|
||||||
|
@ -512,14 +512,15 @@ next_nip:
|
|||||||
TEMP_FAILURE_RETRY (send (fd, ¬found, total, MSG_NOSIGNAL));
|
TEMP_FAILURE_RETRY (send (fd, ¬found, total, MSG_NOSIGNAL));
|
||||||
|
|
||||||
/* If we cannot permanently store the result, so be it. */
|
/* If we cannot permanently store the result, so be it. */
|
||||||
if (db->negtimeout == 0)
|
if (__builtin_expect (db->negtimeout == 0, 0))
|
||||||
{
|
{
|
||||||
/* Mark the old entry as obsolete. */
|
/* Mark the old entry as obsolete. */
|
||||||
if (dh != NULL)
|
if (dh != NULL)
|
||||||
dh->usable = false;
|
dh->usable = false;
|
||||||
dataset = NULL;
|
dataset = NULL;
|
||||||
}
|
}
|
||||||
else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
|
else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||||
|
+ req->key_len), 1)) != NULL)
|
||||||
{
|
{
|
||||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||||
dataset->head.recsize = total;
|
dataset->head.recsize = total;
|
||||||
|
@ -142,13 +142,14 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
|
|||||||
all_written = false;
|
all_written = false;
|
||||||
|
|
||||||
/* If we cannot permanently store the result, so be it. */
|
/* If we cannot permanently store the result, so be it. */
|
||||||
if (db->negtimeout == 0)
|
if (__builtin_expect (db->negtimeout == 0, 0))
|
||||||
{
|
{
|
||||||
/* Mark the old entry as obsolete. */
|
/* Mark the old entry as obsolete. */
|
||||||
if (dh != NULL)
|
if (dh != NULL)
|
||||||
dh->usable = false;
|
dh->usable = false;
|
||||||
}
|
}
|
||||||
else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
|
else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||||
|
+ req->key_len), 1)) != NULL)
|
||||||
{
|
{
|
||||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||||
dataset->head.recsize = total;
|
dataset->head.recsize = total;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Cache handling for host lookup.
|
/* Cache handling for host lookup.
|
||||||
Copyright (C) 2004, 2005, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
|
Copyright (C) 2004-2006, 2008, 2009, 2011 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
|
Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
|
||||||
|
|
||||||
@ -203,13 +203,14 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
|
|||||||
MSG_NOSIGNAL));
|
MSG_NOSIGNAL));
|
||||||
|
|
||||||
/* If we cannot permanently store the result, so be it. */
|
/* If we cannot permanently store the result, so be it. */
|
||||||
if (db->negtimeout == 0)
|
if (__builtin_expect (db->negtimeout == 0, 0))
|
||||||
{
|
{
|
||||||
/* Mark the old entry as obsolete. */
|
/* Mark the old entry as obsolete. */
|
||||||
if (dh != NULL)
|
if (dh != NULL)
|
||||||
dh->usable = false;
|
dh->usable = false;
|
||||||
}
|
}
|
||||||
else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
|
else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||||
|
+ req->key_len), 1)) != NULL)
|
||||||
{
|
{
|
||||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||||
dataset->head.recsize = total;
|
dataset->head.recsize = total;
|
||||||
|
@ -125,13 +125,14 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
|
|||||||
MSG_NOSIGNAL));
|
MSG_NOSIGNAL));
|
||||||
|
|
||||||
/* If we cannot permanently store the result, so be it. */
|
/* If we cannot permanently store the result, so be it. */
|
||||||
if (db->negtimeout == 0)
|
if (__builtin_expect (db->negtimeout == 0, 0))
|
||||||
{
|
{
|
||||||
/* Mark the old entry as obsolete. */
|
/* Mark the old entry as obsolete. */
|
||||||
if (dh != NULL)
|
if (dh != NULL)
|
||||||
dh->usable = false;
|
dh->usable = false;
|
||||||
}
|
}
|
||||||
else if ((dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len, 1)) != NULL)
|
else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||||
|
+ req->key_len), 1)) != NULL)
|
||||||
{
|
{
|
||||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||||
dataset->head.recsize = total;
|
dataset->head.recsize = total;
|
||||||
|
@ -108,10 +108,15 @@ cache_addserv (struct database_dyn *db, int fd, request_header *req,
|
|||||||
written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
written = TEMP_FAILURE_RETRY (send (fd, ¬found, total,
|
||||||
MSG_NOSIGNAL));
|
MSG_NOSIGNAL));
|
||||||
|
|
||||||
dataset = mempool_alloc (db, sizeof (struct dataset) + req->key_len,
|
|
||||||
1);
|
|
||||||
/* If we cannot permanently store the result, so be it. */
|
/* If we cannot permanently store the result, so be it. */
|
||||||
if (dataset != NULL)
|
if (__builtin_expect (db->negtimeout == 0, 0))
|
||||||
|
{
|
||||||
|
/* Mark the old entry as obsolete. */
|
||||||
|
if (dh != NULL)
|
||||||
|
dh->usable = false;
|
||||||
|
}
|
||||||
|
else if ((dataset = mempool_alloc (db, (sizeof (struct dataset)
|
||||||
|
+ req->key_len), 1)) != NULL)
|
||||||
{
|
{
|
||||||
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
dataset->head.allocsize = sizeof (struct dataset) + req->key_len;
|
||||||
dataset->head.recsize = total;
|
dataset->head.recsize = total;
|
||||||
|
Loading…
Reference in New Issue
Block a user