mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-26 04:31:03 +00:00
Update.
2004-07-18 Ulrich Drepper <drepper@redhat.com> * nscd/pwdcache.c (cache_addpw): Optimize case of unsuccessful lookup a bit. * nscd/grpcache.c (cache_addgr): Likewise. * nscd/hstcache.c (cache_addhst): Likewise.
This commit is contained in:
parent
6f53de74bb
commit
99bb9f426f
@ -1,3 +1,10 @@
|
||||
2004-07-18 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* nscd/pwdcache.c (cache_addpw): Optimize case of unsuccessful
|
||||
lookup a bit.
|
||||
* nscd/grpcache.c (cache_addgr): Likewise.
|
||||
* nscd/hstcache.c (cache_addhst): Likewise.
|
||||
|
||||
2004-07-10 GOTO Masanori <gotom@debian.or.jp>
|
||||
|
||||
* sysdeps/s390/s390-32/elf/start.S: Remove symbol _fp_hw.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Cache handling for group lookup.
|
||||
Copyright (C) 1998-2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -65,13 +65,6 @@ static const gr_response_header notfound =
|
||||
.gr_mem_cnt = 0,
|
||||
};
|
||||
|
||||
/* This is the struct describing how to write this record. */
|
||||
static const struct iovec iov_notfound =
|
||||
{
|
||||
.iov_base = (void *) ¬found,
|
||||
.iov_len = sizeof (notfound)
|
||||
};
|
||||
|
||||
|
||||
struct groupdata
|
||||
{
|
||||
@ -92,27 +85,27 @@ cache_addgr (struct database *db, int fd, request_header *req, void *key,
|
||||
{
|
||||
/* We have no data. This means we send the standard reply for this
|
||||
case. */
|
||||
void *copy;
|
||||
|
||||
total = sizeof (notfound);
|
||||
|
||||
written = TEMP_FAILURE_RETRY (writev (fd, &iov_notfound, 1));
|
||||
written = TEMP_FAILURE_RETRY (write (fd, ¬found, total));
|
||||
|
||||
copy = malloc (req->key_len);
|
||||
if (copy == NULL)
|
||||
error (EXIT_FAILURE, errno, _("while allocating key copy"));
|
||||
memcpy (copy, key, req->key_len);
|
||||
void *copy = malloc (req->key_len);
|
||||
/* If we cannot allocate memory simply do not cache the information. */
|
||||
if (copy != NULL)
|
||||
{
|
||||
memcpy (copy, key, req->key_len);
|
||||
|
||||
/* Compute the timeout time. */
|
||||
t += db->negtimeout;
|
||||
/* Compute the timeout time. */
|
||||
t += db->negtimeout;
|
||||
|
||||
/* Now get the lock to safely insert the records. */
|
||||
pthread_rwlock_rdlock (&db->lock);
|
||||
/* Now get the lock to safely insert the records. */
|
||||
pthread_rwlock_rdlock (&db->lock);
|
||||
|
||||
cache_add (req->type, copy, req->key_len, ¬found,
|
||||
sizeof (notfound), (void *) -1, 0, t, db, owner);
|
||||
cache_add (req->type, copy, req->key_len, ¬found,
|
||||
sizeof (notfound), (void *) -1, 0, t, db, owner);
|
||||
|
||||
pthread_rwlock_unlock (&db->lock);
|
||||
pthread_rwlock_unlock (&db->lock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Cache handling for host lookup.
|
||||
Copyright (C) 1998-2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -73,13 +73,6 @@ static const hst_response_header notfound =
|
||||
.error = HOST_NOT_FOUND
|
||||
};
|
||||
|
||||
/* This is the struct describing how to write this record. */
|
||||
static const struct iovec iov_notfound =
|
||||
{
|
||||
.iov_base = (void *) ¬found,
|
||||
.iov_len = sizeof (notfound)
|
||||
};
|
||||
|
||||
|
||||
struct hostdata
|
||||
{
|
||||
@ -100,27 +93,27 @@ cache_addhst (struct database *db, int fd, request_header *req, void *key,
|
||||
{
|
||||
/* We have no data. This means we send the standard reply for this
|
||||
case. */
|
||||
void *copy;
|
||||
|
||||
total = sizeof (notfound);
|
||||
|
||||
written = TEMP_FAILURE_RETRY (writev (fd, &iov_notfound, 1));
|
||||
written = TEMP_FAILURE_RETRY (write (fd, ¬found, total));
|
||||
|
||||
copy = malloc (req->key_len);
|
||||
if (copy == NULL)
|
||||
error (EXIT_FAILURE, errno, _("while allocating key copy"));
|
||||
memcpy (copy, key, req->key_len);
|
||||
void *copy = malloc (req->key_len);
|
||||
/* If we cannot allocate memory simply do not cache the information. */
|
||||
if (copy != NULL)
|
||||
{
|
||||
memcpy (copy, key, req->key_len);
|
||||
|
||||
/* Compute the timeout time. */
|
||||
t += db->negtimeout;
|
||||
/* Compute the timeout time. */
|
||||
t += db->negtimeout;
|
||||
|
||||
/* Now get the lock to safely insert the records. */
|
||||
pthread_rwlock_rdlock (&db->lock);
|
||||
/* Now get the lock to safely insert the records. */
|
||||
pthread_rwlock_rdlock (&db->lock);
|
||||
|
||||
cache_add (req->type, copy, req->key_len, ¬found,
|
||||
sizeof (notfound), (void *) -1, 0, t, db, owner);
|
||||
cache_add (req->type, copy, req->key_len, ¬found,
|
||||
sizeof (notfound), (void *) -1, 0, t, db, owner);
|
||||
|
||||
pthread_rwlock_unlock (&db->lock);
|
||||
pthread_rwlock_unlock (&db->lock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Cache handling for passwd lookup.
|
||||
Copyright (C) 1998-2002, 2003 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
|
||||
|
||||
@ -71,13 +71,6 @@ static const pw_response_header notfound =
|
||||
.pw_shell_len = 0
|
||||
};
|
||||
|
||||
/* This is the struct describing how to write this record. */
|
||||
static const struct iovec iov_notfound =
|
||||
{
|
||||
.iov_base = (void *) ¬found,
|
||||
.iov_len = sizeof (notfound)
|
||||
};
|
||||
|
||||
|
||||
struct passwddata
|
||||
{
|
||||
@ -98,27 +91,27 @@ cache_addpw (struct database *db, int fd, request_header *req, void *key,
|
||||
{
|
||||
/* We have no data. This means we send the standard reply for this
|
||||
case. */
|
||||
void *copy;
|
||||
|
||||
total = sizeof (notfound);
|
||||
|
||||
written = TEMP_FAILURE_RETRY (writev (fd, &iov_notfound, 1));
|
||||
written = TEMP_FAILURE_RETRY (write (fd, ¬found, total));
|
||||
|
||||
copy = malloc (req->key_len);
|
||||
if (copy == NULL)
|
||||
error (EXIT_FAILURE, errno, _("while allocating key copy"));
|
||||
memcpy (copy, key, req->key_len);
|
||||
void *copy = malloc (req->key_len);
|
||||
/* If we cannot allocate memory simply do not cache the information. */
|
||||
if (copy != NULL)
|
||||
{
|
||||
memcpy (copy, key, req->key_len);
|
||||
|
||||
/* Compute the timeout time. */
|
||||
t += db->negtimeout;
|
||||
/* Compute the timeout time. */
|
||||
t += db->negtimeout;
|
||||
|
||||
/* Now get the lock to safely insert the records. */
|
||||
pthread_rwlock_rdlock (&db->lock);
|
||||
/* Now get the lock to safely insert the records. */
|
||||
pthread_rwlock_rdlock (&db->lock);
|
||||
|
||||
cache_add (req->type, copy, req->key_len, ¬found,
|
||||
sizeof (notfound), (void *) -1, 0, t, db, owner);
|
||||
cache_add (req->type, copy, req->key_len, ¬found,
|
||||
sizeof (notfound), (void *) -1, 0, t, db, owner);
|
||||
|
||||
pthread_rwlock_unlock (&db->lock);
|
||||
pthread_rwlock_unlock (&db->lock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user