diff options
author | Ulrich Drepper <drepper@gmail.com> | 2011-10-31 01:51:16 -0400 |
---|---|---|
committer | Ulrich Drepper <drepper@gmail.com> | 2011-10-31 01:51:16 -0400 |
commit | 3a2c02424d9824f5cdea4ebd32ff929b2b1f49c6 (patch) | |
tree | de7827ff96076cb4d181ed781c418601906fa772 /nscd/nscd-client.h | |
parent | 636064eb4c03397c86aa26e489e68f952bd5e53f (diff) | |
download | glibc-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-client.h')
-rw-r--r-- | nscd/nscd-client.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h index caad26a9cc..b5cd2d2c1e 100644 --- a/nscd/nscd-client.h +++ b/nscd/nscd-client.h @@ -260,12 +260,17 @@ struct hashentry /* Current persistent database version. */ -#define DB_VERSION 1 +#define DB_VERSION 2 /* Maximum time allowed between updates of the timestamp. */ #define MAPPING_TIMEOUT (5 * 60) +/* Used indices for the EXTRA_DATA element of 'database_pers_head'. + Each database has its own indices. */ +#define NSCD_HST_IDX_CONF_TIMESTAMP 0 + + /* Header of persistent database file. */ struct database_pers_head { @@ -274,6 +279,8 @@ struct database_pers_head volatile int32_t gc_cycle; volatile int32_t nscd_certainly_running; volatile nscd_time_t timestamp; + /* Room for extensions. */ + volatile uint32_t extra_data[4]; nscd_ssize_t module; nscd_ssize_t data_size; @@ -322,6 +329,12 @@ extern int __nscd_open_socket (const char *key, size_t keylen, request_type type, void *response, size_t responselen) attribute_hidden; +/* Try to get a file descriptor for the shared meory segment + containing the database. */ +extern struct mapped_database *__nscd_get_mapping (request_type type, + const char *key, + struct mapped_database **mappedp) attribute_hidden; + /* Get reference of mapping. */ extern struct mapped_database *__nscd_get_map_ref (request_type type, const char *name, @@ -371,4 +384,7 @@ extern ssize_t writeall (int fd, const void *buf, size_t len) extern ssize_t sendfileall (int tofd, int fromfd, off_t off, size_t len) attribute_hidden; +/* Get netlink timestamp counter from mapped area or zero. */ +extern uint32_t __nscd_get_nl_timestamp (void); + #endif /* nscd.h */ |