about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-08-22 07:34:59 +0000
committerJakub Jelinek <jakub@redhat.com>2005-08-22 07:34:59 +0000
commit8b0a52444c889fd368f51ba37ad401b6ca5d40f1 (patch)
treee61c0a96c4f02a2ae41a4a6b8b291cd0adfa75be /nscd
parent964f44e4d838ce28ae848f228c7212cf609ace3c (diff)
downloadglibc-8b0a52444c889fd368f51ba37ad401b6ca5d40f1.tar.gz
glibc-8b0a52444c889fd368f51ba37ad401b6ca5d40f1.tar.xz
glibc-8b0a52444c889fd368f51ba37ad401b6ca5d40f1.zip
Updated to fedora-glibc-20050822T0727
Diffstat (limited to 'nscd')
-rw-r--r--nscd/cache.c34
-rw-r--r--nscd/connections.c12
-rw-r--r--nscd/nscd_stat.c13
3 files changed, 45 insertions, 14 deletions
diff --git a/nscd/cache.c b/nscd/cache.c
index 800b7ecf27..a3f669bf8c 100644
--- a/nscd/cache.c
+++ b/nscd/cache.c
@@ -21,6 +21,7 @@
 #include <atomic.h>
 #include <errno.h>
 #include <error.h>
+#include <inttypes.h>
 #include <limits.h>
 #include <stdlib.h>
 #include <string.h>
@@ -203,9 +204,9 @@ prune_cache (struct database_dyn *table, time_t now)
      the entries also in this case.  */
   if (table->check_file)
     {
-      struct stat st;
+      struct stat64 st;
 
-      if (stat (table->filename, &st) < 0)
+      if (stat64 (table->filename, &st) < 0)
 	{
 	  char buf[128];
 	  /* We cannot stat() the file, disable file checking if the
@@ -238,6 +239,10 @@ prune_cache (struct database_dyn *table, time_t now)
   char *const data = table->data;
   bool any = false;
 
+  if (__builtin_expect (debug_level > 2, 0))
+    dbg_log (_("pruning %s cache; time %ld"),
+	     dbnames[table - dbs], (long int) now);
+
   do
     {
       ref_t run = table->head->array[--cnt];
@@ -247,6 +252,25 @@ prune_cache (struct database_dyn *table, time_t now)
 	  struct hashentry *runp = (struct hashentry *) (data + run);
 	  struct datahead *dh = (struct datahead *) (data + runp->packet);
 
+	  /* Some debug support.  */
+	  if (__builtin_expect (debug_level > 2, 0))
+	    {
+	      char buf[INET6_ADDRSTRLEN];
+	      const char *str;
+
+	      if (runp->type == GETHOSTBYADDR || runp->type == GETHOSTBYADDRv6)
+		{
+		  inet_ntop (runp->type == GETHOSTBYADDR ? AF_INET : AF_INET6,
+			     data + runp->key, buf, sizeof (buf));
+		  str = buf;
+		}
+	      else
+		str = data + runp->key;
+
+	      dbg_log (_("considering %s entry \"%s\", timeout %" PRIu64),
+		       serv2str[runp->type], str, dh->timeout);
+	    }
+
 	  /* Check whether the entry timed out.  */
 	  if (dh->timeout < now)
 	    {
@@ -401,7 +425,7 @@ prune_cache (struct database_dyn *table, time_t now)
       /* Make sure the data is saved to disk.  */
       if (table->persistent)
 	msync (table->head,
-	       table->data + table->head->first_free - (char *) table->head,
+	       data + table->head->first_free - (char *) table->head,
 	       MS_ASYNC);
 
       /* One extra pass if we do debugging.  */
@@ -417,11 +441,11 @@ prune_cache (struct database_dyn *table, time_t now)
 	      if (runp->type == GETHOSTBYADDR || runp->type == GETHOSTBYADDRv6)
 		{
 		  inet_ntop (runp->type == GETHOSTBYADDR ? AF_INET : AF_INET6,
-			     table->data + runp->key, buf, sizeof (buf));
+			     data + runp->key, buf, sizeof (buf));
 		  str = buf;
 		}
 	      else
-		str = table->data + runp->key;
+		str = data + runp->key;
 
 	      dbg_log ("remove %s entry \"%s\"", serv2str[runp->type], str);
 
diff --git a/nscd/connections.c b/nscd/connections.c
index 42a36d39c0..33cde99cdf 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -710,9 +710,9 @@ cannot set socket to close on exec: %s; disabling paranoia mode"),
 	if (dbs[cnt].check_file)
 	  {
 	    /* We need the modification date of the file.  */
-	    struct stat st;
+	    struct stat64 st;
 
-	    if (stat (dbs[cnt].filename, &st) < 0)
+	    if (stat64 (dbs[cnt].filename, &st) < 0)
 	      {
 		/* We cannot stat() the file, disable file checking.  */
 		dbg_log (_("cannot stat() file `%s': %s"),
@@ -1459,7 +1459,7 @@ fd_ready (int fd)
 	{
 	  /* We got another thread.  */
 	  ++nthreads;
-	  /* The new thread might new a kick.  */
+	  /* The new thread might need a kick.  */
 	  do_signal = true;
 	}
 
@@ -1644,8 +1644,7 @@ main_loop_epoll (int efd)
 	else
 	  {
 	    /* Remove the descriptor from the epoll descriptor.  */
-	    struct epoll_event ev = { 0, };
-	    (void) epoll_ctl (efd, EPOLL_CTL_DEL, revs[cnt].data.fd, &ev);
+	    (void) epoll_ctl (efd, EPOLL_CTL_DEL, revs[cnt].data.fd, NULL);
 
 	    /* Get a worked to handle the request.  */
 	    fd_ready (revs[cnt].data.fd);
@@ -1667,8 +1666,7 @@ main_loop_epoll (int efd)
 	if (cnt != sock && starttime[cnt] != 0 && starttime[cnt] < laststart)
 	  {
 	    /* We are waiting for this one for too long.  Close it.  */
-	    struct epoll_event ev = {0, };
-	    (void) epoll_ctl (efd, EPOLL_CTL_DEL, cnt, &ev);
+	    (void) epoll_ctl (efd, EPOLL_CTL_DEL, cnt, NULL);
 
 	    (void) close (cnt);
 
diff --git a/nscd/nscd_stat.c b/nscd/nscd_stat.c
index 8bf50f39f4..43f6266c6e 100644
--- a/nscd/nscd_stat.c
+++ b/nscd/nscd_stat.c
@@ -75,6 +75,10 @@ struct statdata
   int debug_level;
   time_t runtime;
   unsigned long int client_queued;
+  int nthreads;
+  int max_nthreads;
+  int paranoia;
+  time_t restart_interval;
   int ndbs;
   struct dbstat dbs[lastdb];
 #ifdef HAVE_SELINUX
@@ -93,6 +97,10 @@ send_stats (int fd, struct database_dyn dbs[lastdb])
   data.debug_level = debug_level;
   data.runtime = time (NULL) - start_time;
   data.client_queued = client_queued;
+  data.nthreads = nthreads;
+  data.max_nthreads = max_nthreads;
+  data.paranoia = paranoia;
+  data.restart_interval = restart_interval;
   data.ndbs = lastdb;
 
   for (cnt = 0; cnt < lastdb; ++cnt)
@@ -230,8 +238,9 @@ receive_print_stats (void)
 	    "%15lu  number of times clients had to wait\n"
 	    "%15s  paranoia mode enabled\n"
 	    "%15lu  restart internal\n"),
-	  nthreads, max_nthreads, data.client_queued,
-	  paranoia ? yesstr : nostr, (unsigned long int) restart_interval);
+	  data.nthreads, data.max_nthreads, data.client_queued,
+	  data.paranoia ? yesstr : nostr,
+	  (unsigned long int) data.restart_interval);
 
   for (i = 0; i < lastdb; ++i)
     {