1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

resolv: Move res_query functions into libc

This switches to public symbols without __ prefixes, due to improved
namespace management in glibc.

The script was used with --no-new-version to move the symbols
__res_nquery, __res_nquerydomain, __res_nsearch, __res_query,
__res_querydomain, __res_search, res_query, res_querydomain,
res_search.  The public symbols res_nquery, res_nquerydomain,
res_nsearch, res_ownok, res_query, res_querydomain, res_search
were added with make update-all-abi.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
Florian Weimer
2021-07-19 07:55:27 +02:00
parent 21a497cc58
commit ea9878ec27
69 changed files with 520 additions and 280 deletions

View File

@@ -57,6 +57,7 @@ routines := \
res_mkquery \
res_nameinquery \
res_queriesmatch \
res_query \
res_randomid \
res_send \
resolv_conf \
@@ -156,7 +157,6 @@ libresolv-routines := \
res_debug \
res_hostalias \
res_isourserver \
res_query \
resolv-deprecated \
# libresolv-routines

View File

@@ -18,6 +18,9 @@ libc {
hstrerror;
res_init;
res_mkquery;
res_query;
res_querydomain;
res_search;
}
GLIBC_2.2 {
__dn_expand;
@@ -26,7 +29,13 @@ libc {
__res_nclose;
__res_ninit;
__res_nmkquery;
__res_nquery;
__res_nquerydomain;
__res_nsearch;
__res_nsend;
__res_query;
__res_querydomain;
__res_search;
__res_state;
_res_hconf;
}
@@ -69,8 +78,14 @@ libc {
res_mailok;
res_mkquery;
res_nmkquery;
res_nquery;
res_nquerydomain;
res_nsearch;
res_nsend;
res_ownok;
res_query;
res_querydomain;
res_search;
res_send;
}
GLIBC_PRIVATE {
@@ -97,6 +112,8 @@ libc {
__ns_name_unpack;
__res_context_hostalias;
__res_context_mkquery;
__res_context_query;
__res_context_search;
__res_context_send;
__res_get_nsaddr;
__res_iclose;
@@ -157,20 +174,11 @@ libresolv {
res_gethostbyaddr;
res_gethostbyname2;
res_gethostbyname;
res_query;
res_querydomain;
res_search;
res_send_setqhook;
res_send_setrhook;
}
GLIBC_2.2 {
__res_hostalias;
__res_nquery;
__res_nquerydomain;
__res_nsearch;
__res_query;
__res_querydomain;
__res_search;
}
GLIBC_2.3.2 {
__p_rcode;
@@ -201,8 +209,6 @@ libresolv {
GLIBC_PRIVATE {
__ns_get16;
__ns_get32;
__res_context_query;
__res_context_search;
}
}

View File

@@ -276,7 +276,7 @@ __res_context_query (struct resolv_context *ctx, const char *name,
success:
return (n);
}
libresolv_hidden_def (__res_context_query)
libc_hidden_def (__res_context_query)
/* Common part of res_nquery and res_query. */
static int
@@ -296,23 +296,34 @@ context_query_common (struct resolv_context *ctx,
}
int
res_nquery(res_state statp,
const char *name, /* domain name */
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer buffer */
___res_nquery (res_state statp,
const char *name, /* Domain name. */
int class, int type, /* Class and type of query. */
unsigned char *answer, /* Buffer to put answer. */
int anslen) /* Size of answer buffer. */
{
return context_query_common
(__resolv_context_get_override (statp), name, class, type, answer, anslen);
}
versioned_symbol (libc, ___res_nquery, res_nquery, GLIBC_2_34);
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34)
compat_symbol (libresolv, ___res_nquery, __res_nquery, GLIBC_2_2);
#endif
int
res_query (const char *name, int class, int type,
unsigned char *answer, int anslen)
___res_query (const char *name, int class, int type,
unsigned char *answer, int anslen)
{
return context_query_common
(__resolv_context_get (), name, class, type, answer, anslen);
}
versioned_symbol (libc, ___res_query, res_query, GLIBC_2_34);
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
compat_symbol (libresolv, ___res_query, res_query, GLIBC_2_0);
#endif
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34)
compat_symbol (libresolv, ___res_query, __res_query, GLIBC_2_2);
#endif
/* Formulate a normal query, send, and retrieve answer in supplied
buffer. Return the size of the response on success, -1 on error.
@@ -515,7 +526,7 @@ __res_context_search (struct resolv_context *ctx,
RES_SET_H_ERRNO(statp, TRY_AGAIN);
return (-1);
}
libresolv_hidden_def (__res_context_search)
libc_hidden_def (__res_context_search)
/* Common part of res_nsearch and res_search. */
static int
@@ -535,23 +546,34 @@ context_search_common (struct resolv_context *ctx,
}
int
res_nsearch(res_state statp,
const char *name, /* domain name */
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
___res_nsearch (res_state statp,
const char *name, /* Domain name. */
int class, int type, /* Class and type of query. */
unsigned char *answer, /* Buffer to put answer. */
int anslen) /* Size of answer. */
{
return context_search_common
(__resolv_context_get_override (statp), name, class, type, answer, anslen);
}
versioned_symbol (libc, ___res_nsearch, res_nsearch, GLIBC_2_34);
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34)
compat_symbol (libresolv, ___res_nsearch, __res_nsearch, GLIBC_2_2);
#endif
int
res_search (const char *name, int class, int type,
unsigned char *answer, int anslen)
___res_search (const char *name, int class, int type,
unsigned char *answer, int anslen)
{
return context_search_common
(__resolv_context_get (), name, class, type, answer, anslen);
}
versioned_symbol (libc, ___res_search, res_search, GLIBC_2_34);
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
compat_symbol (libresolv, ___res_search, res_search, GLIBC_2_0);
#endif
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34)
compat_symbol (libresolv, ___res_search, __res_search, GLIBC_2_2);
#endif
/* Perform a call on res_query on the concatenation of name and
domain. */
@@ -615,31 +637,33 @@ context_querydomain_common (struct resolv_context *ctx,
}
int
res_nquerydomain(res_state statp,
const char *name,
const char *domain,
int class, int type, /* class and type of query */
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
___res_nquerydomain (res_state statp,
const char *name,
const char *domain,
int class, int type, /* Class and type of query. */
unsigned char *answer, /* Buffer to put answer. */
int anslen) /* Size of answer. */
{
return context_querydomain_common
(__resolv_context_get_override (statp),
name, domain, class, type, answer, anslen);
}
versioned_symbol (libc, ___res_nquerydomain, res_nquerydomain, GLIBC_2_34);
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34)
compat_symbol (libresolv, ___res_nquerydomain, __res_nquerydomain, GLIBC_2_2);
#endif
int
res_querydomain (const char *name, const char *domain, int class, int type,
unsigned char *answer, int anslen)
___res_querydomain (const char *name, const char *domain, int class, int type,
unsigned char *answer, int anslen)
{
return context_querydomain_common
(__resolv_context_get (), name, domain, class, type, answer, anslen);
}
#if SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
# undef res_query
# undef res_querydomain
# undef res_search
weak_alias (__res_query, res_query);
weak_alias (__res_querydomain, res_querydomain);
weak_alias (__res_search, res_search);
versioned_symbol (libc, ___res_querydomain, res_querydomain, GLIBC_2_34);
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_0, GLIBC_2_2)
compat_symbol (libresolv, ___res_querydomain, res_querydomain, GLIBC_2_0);
#endif
#if OTHER_SHLIB_COMPAT (libresolv, GLIBC_2_2, GLIBC_2_34)
compat_symbol (libresolv, ___res_querydomain, __res_querydomain, GLIBC_2_2);
#endif

View File

@@ -62,13 +62,13 @@ libc_hidden_proto (__res_context_mkquery)
int __res_context_search (struct resolv_context *, const char *, int, int,
unsigned char *, int, unsigned char **,
unsigned char **, int *, int *, int *);
libresolv_hidden_proto (__res_context_search)
libc_hidden_proto (__res_context_search)
/* Main resolver query function for use within glibc. */
int __res_context_query (struct resolv_context *, const char *, int, int,
unsigned char *, int, unsigned char **,
unsigned char **, int *, int *, int *);
libresolv_hidden_proto (__res_context_query)
libc_hidden_proto (__res_context_query)
/* Internal function used to implement the query and search
functions. */

View File

@@ -168,9 +168,6 @@ __END_DECLS
#define res_close __res_close
#define res_init __res_init
#define res_isourserver __res_isourserver
#define res_query __res_query
#define res_querydomain __res_querydomain
#define res_search __res_search
#ifdef _LIBC
# define __RESOLV_DEPRECATED
@@ -227,9 +224,6 @@ __END_DECLS
#define res_nameinquery __res_nameinquery
#define res_nclose __res_nclose
#define res_ninit __res_ninit
#define res_nquery __res_nquery
#define res_nquerydomain __res_nquerydomain
#define res_nsearch __res_nsearch
#define res_queriesmatch __res_queriesmatch
#define res_randomid __res_randomid
#define sym_ntop __sym_ntop