Move getaddrinfo from 'posix' into 'nss'

getaddrinfo is an entry point for nss functionality.  This commit moves
it from 'sysdeps/posix' to 'nss', gets rid of the stub in 'posix', and
moves all associated tests as well.
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Arjun Shankar 2023-10-02 14:55:27 +02:00
parent 1d74d2f042
commit 7f602256ab
14 changed files with 22 additions and 54 deletions

View File

@ -127,6 +127,7 @@ endif
# hosts routines: # hosts routines:
routines += \ routines += \
getaddrinfo \
gethstbyad \ gethstbyad \
gethstbyad_r \ gethstbyad_r \
gethstbynm \ gethstbynm \
@ -138,6 +139,7 @@ routines += \
# routines # routines
ifeq ($(have-thread-library),yes) ifeq ($(have-thread-library),yes)
CFLAGS-getaddrinfo.c += -fexceptions
CFLAGS-gethstbyad.c += -fexceptions CFLAGS-gethstbyad.c += -fexceptions
CFLAGS-gethstbyad_r.c += -fexceptions CFLAGS-gethstbyad_r.c += -fexceptions
CFLAGS-gethstbynm.c += -fexceptions CFLAGS-gethstbynm.c += -fexceptions
@ -300,7 +302,13 @@ others-extras = $(makedb-modules)
extra-objs += $(makedb-modules:=.o) extra-objs += $(makedb-modules:=.o)
tests-static = tst-field tests-static = tst-field
tests-internal = tst-field
tests-internal := \
tst-field \
tst-rfc3484 \
tst-rfc3484-2 \
tst-rfc3484-3 \
# tests-internal
tests := \ tests := \
bug17079 \ bug17079 \
@ -309,6 +317,9 @@ tests := \
test-rpcent \ test-rpcent \
testgrp \ testgrp \
tst-fgetsgent_r \ tst-fgetsgent_r \
tst-getaddrinfo \
tst-getaddrinfo2 \
tst-getaddrinfo3 \
tst-gethnm \ tst-gethnm \
tst-getpw \ tst-getpw \
tst-gshadow \ tst-gshadow \
@ -327,7 +338,11 @@ tests := \
tst-shadow \ tst-shadow \
# tests # tests
xtests = bug-erange xtests := \
bug-erange \
tst-getaddrinfo4 \
tst-getaddrinfo5 \
# xtests
tests-container := \ tests-container := \
tst-initgroups1 \ tst-initgroups1 \

View File

@ -19,6 +19,7 @@ libc {
fgetspent; fgetspent_r; fgetspent; fgetspent_r;
# g* # g*
getaddrinfo;
getaliasbyname; getaliasbyname_r; getaliasent; getaliasent_r; getaliasbyname; getaliasbyname_r; getaliasent; getaliasent_r;
getgrent; getgrent_r; getgrgid; getgrgid_r; getgrnam; getgrnam_r; getgrent; getgrent_r; getgrgid; getgrgid_r; getgrnam; getgrnam_r;
getgroups; getgroups;

View File

@ -57,7 +57,7 @@ _res_hconf_init (void)
} }
#undef USE_NSCD #undef USE_NSCD
#include "../sysdeps/posix/getaddrinfo.c" #include "getaddrinfo.c"
nss_action_list __nss_hosts_database attribute_hidden; nss_action_list __nss_hosts_database attribute_hidden;

View File

@ -57,7 +57,7 @@ _res_hconf_init (void)
} }
#undef USE_NSCD #undef USE_NSCD
#include "../sysdeps/posix/getaddrinfo.c" #include "getaddrinfo.c"
nss_action_list __nss_hosts_database attribute_hidden; nss_action_list __nss_hosts_database attribute_hidden;

View File

@ -57,7 +57,7 @@ _res_hconf_init (void)
} }
#undef USE_NSCD #undef USE_NSCD
#include "../sysdeps/posix/getaddrinfo.c" #include "getaddrinfo.c"
nss_action_list __nss_hosts_database attribute_hidden; nss_action_list __nss_hosts_database attribute_hidden;

View File

@ -88,7 +88,6 @@ routines := \
fpathconf \ fpathconf \
gai_strerror \ gai_strerror \
get_child_max \ get_child_max \
getaddrinfo \
getegid \ getegid \
geteuid \ geteuid \
getgid \ getgid \
@ -287,9 +286,6 @@ tests := \
tst-fnmatch7 \ tst-fnmatch7 \
tst-fork \ tst-fork \
tst-gai_strerror \ tst-gai_strerror \
tst-getaddrinfo \
tst-getaddrinfo2 \
tst-getaddrinfo3 \
tst-getopt_long1 \ tst-getopt_long1 \
tst-glob-tilde \ tst-glob-tilde \
tst-glob_symlinks \ tst-glob_symlinks \
@ -351,9 +347,6 @@ tests-internal := \
bug-regex5 \ bug-regex5 \
bug-regex20 \ bug-regex20 \
bug-regex33 \ bug-regex33 \
tst-rfc3484 \
tst-rfc3484-2 \
tst-rfc3484-3 \
# tests-internal # tests-internal
tests-container := \ tests-container := \
@ -368,8 +361,6 @@ tests-time64 := \
# tests-time64 # tests-time64
xtests := \ xtests := \
tst-getaddrinfo4 \
tst-getaddrinfo5 \
tst-sched_rr_get_interval \ tst-sched_rr_get_interval \
# xtests # xtests
@ -556,7 +547,6 @@ $(objpfx)config-name.h: $(..)scripts/config-uname.sh $(common-objpfx)config.make
'$(config-machine)-$(config-vendor)' > $@.new '$(config-machine)-$(config-vendor)' > $@.new
mv -f $@.new $@ mv -f $@.new $@
CFLAGS-getaddrinfo.c += -fexceptions
CFLAGS-pause.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-pause.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-pread.c += -fexceptions -fasynchronous-unwind-tables CFLAGS-pread.c += -fexceptions -fasynchronous-unwind-tables
CFLAGS-pread64.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes) CFLAGS-pread64.c += -fexceptions -fasynchronous-unwind-tables $(config-cflags-wno-ignored-attributes)

View File

@ -34,7 +34,7 @@ libc {
fnmatch; fork; fpathconf; freeaddrinfo; fnmatch; fork; fpathconf; freeaddrinfo;
# g* # g*
getaddrinfo; getdtablesize; getegid; geteuid; getgid; getopt; getopt_long; getdtablesize; getegid; geteuid; getgid; getopt; getopt_long;
getopt_long_only; getpgid; getpgrp; getpid; getppid; getsid; getuid; glob; getopt_long_only; getpgid; getpgrp; getpid; getppid; getsid; getuid; glob;
glob_pattern_p; globfree; group_member; glob_pattern_p; globfree; group_member;

View File

@ -1,38 +0,0 @@
/* Stub version of getaddrinfo function.
Copyright (C) 1996-2023 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<https://www.gnu.org/licenses/>. */
#include <errno.h>
#include <netdb.h>
int
getaddrinfo (const char *name, const char *service, const struct addrinfo *req,
struct addrinfo **pai)
{
__set_errno (ENOSYS);
return EAI_SYSTEM;
}
stub_warning (getaddrinfo)
libc_hidden_def (getaddrinfo)
void
freeaddrinfo (struct addrinfo *ai)
{
/* Nothing. */
}
stub_warning (freeaddrinfo)
libc_hidden_def (freeaddrinfo)