summary refs log tree commit diff
path: root/nscd/nscd_helper.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-31 01:51:16 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-31 01:51:16 -0400
commit3a2c02424d9824f5cdea4ebd32ff929b2b1f49c6 (patch)
treede7827ff96076cb4d181ed781c418601906fa772 /nscd/nscd_helper.c
parent636064eb4c03397c86aa26e489e68f952bd5e53f (diff)
downloadglibc-3a2c02424d9824f5cdea4ebd32ff929b2b1f49c6.tar.gz
glibc-3a2c02424d9824f5cdea4ebd32ff929b2b1f49c6.tar.xz
glibc-3a2c02424d9824f5cdea4ebd32ff929b2b1f49c6.zip
Cache network interface information
Whenever getaddrinfo needed network interface information it used the
netlink interface to read the information every single time.  The
problem is that this information can change at any time.

The patch implements monitoring of the network interfaces through
nscd.  If no change is detected the previously read information can
be reused (which is the norm).  This timestamp information is also
made available to other processes using the shared memory segment
between nscd and those processes.
Diffstat (limited to 'nscd/nscd_helper.c')
-rw-r--r--nscd/nscd_helper.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index fe63f9a7fe..365b599892 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -277,9 +277,9 @@ __nscd_unmap (struct mapped_database *mapped)
 
 /* Try to get a file descriptor for the shared meory segment
    containing the database.  */
-static struct mapped_database *
-get_mapping (request_type type, const char *key,
-	     struct mapped_database **mappedp)
+struct mapped_database *
+__nscd_get_mapping (request_type type, const char *key,
+		    struct mapped_database **mappedp)
 {
   struct mapped_database *result = NO_MAPPING;
 #ifdef SCM_RIGHTS
@@ -449,8 +449,8 @@ __nscd_get_map_ref (request_type type, const char *name,
 	  || (cur->head->nscd_certainly_running == 0
 	      && cur->head->timestamp + MAPPING_TIMEOUT < time (NULL))
 	  || cur->head->data_size > cur->datasize)
-	cur = get_mapping (type, name,
-			   (struct mapped_database **) &mapptr->mapped);
+	cur = __nscd_get_mapping (type, name,
+				  (struct mapped_database **) &mapptr->mapped);
 
       if (__builtin_expect (cur != NO_MAPPING, 1))
 	{