diff options
author | Florian Weimer <fweimer@redhat.com> | 2017-07-03 21:06:23 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2017-07-03 21:06:23 +0200 |
commit | aef16cc8a4c670036d45590877d411a97f01e0cd (patch) | |
tree | 4403f1962170ce92087a6e1af62dbb92e15d27f6 /resolv/resolv_conf.h | |
parent | a1c4eb8794e789b5055d7ceb13b2b3231abf5e26 (diff) | |
download | glibc-aef16cc8a4c670036d45590877d411a97f01e0cd.tar.gz glibc-aef16cc8a4c670036d45590877d411a97f01e0cd.tar.xz glibc-aef16cc8a4c670036d45590877d411a97f01e0cd.zip |
resolv: Automatically reload a changed /etc/resolv.conf file [BZ #984]
This commit enhances the stub resolver to reload the configuration in the per-thread _res object if the /etc/resolv.conf file has changed. The resolver checks whether the application has modified _res and will not overwrite the _res object in that case. The struct resolv_context mechanism is used to check the configuration file only once per name lookup.
Diffstat (limited to 'resolv/resolv_conf.h')
-rw-r--r-- | resolv/resolv_conf.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/resolv/resolv_conf.h b/resolv/resolv_conf.h index 7ca80cdeba..0ff8bd7e92 100644 --- a/resolv/resolv_conf.h +++ b/resolv/resolv_conf.h @@ -35,11 +35,6 @@ struct resolv_sortlist_entry object. */ struct resolv_conf { - /* Used to propagate the effect of res_init across threads. This - member is mutable and prevents sharing of the same struct - resolv_conf object among multiple struct __res_state objects. */ - unsigned long long int initstamp; - /* Reference counter. The object is deallocated once it reaches zero. For internal use within resolv_conf only. */ size_t __refcount; @@ -69,6 +64,18 @@ struct resolv_conf struct __res_state; +/* Read /etc/resolv.conf and return a configuration object, or NULL if + /etc/resolv.conf cannot be read due to memory allocation errors. + If PREINIT is not NULL, some configuration values are taken from the + struct __res_state object. */ +struct resolv_conf *__resolv_conf_load (struct __res_state *preinit) + attribute_hidden __attribute__ ((warn_unused_result)); + +/* Return a configuration object for the current /etc/resolv.conf + settings, or NULL on failure. The object is cached. */ +struct resolv_conf *__resolv_conf_get_current (void) + attribute_hidden __attribute__ ((warn_unused_result)); + /* Return the extended resolver state for *RESP, or NULL if it cannot be determined. A call to this function must be paired with a call to __resolv_conf_put. */ |