1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

resolv: Introduce struct resolv_context [BZ #21668]

struct resolv_context objects provide a temporary resolver context
which does not change during a name lookup operation.  Only when the
outmost context is created, the stub resolver configuration is
verified to be current (at present, only against previous res_init
calls).  Subsequent attempts to obtain the context will reuse the
result of the initial verification operation.

struct resolv_context can also be extended in the future to store
data which needs to be deallocated during thread cancellation.
This commit is contained in:
Florian Weimer
2017-06-30 21:10:23 +02:00
parent 4e45d83c92
commit 352f4ff9a2
24 changed files with 1032 additions and 370 deletions

View File

@ -83,6 +83,7 @@
*/
#include <resolv-internal.h>
#include <resolv_context.h>
#include <not-cancel.h>
/* Close all open sockets. If FREE_ADDR is true, deallocate any
@ -124,6 +125,8 @@ libc_hidden_def (__res_nclose)
static void __attribute__ ((section ("__libc_thread_freeres_fn")))
res_thread_freeres (void)
{
__resolv_context_freeres ();
if (_res.nscount == 0)
/* Never called res_ninit. */
return;