libc: reintegrate libc_resolv library
Remove getaddrinfo and freeaddrinfo from the Libc::Plugin and get rid of the extra libc_resolv library. Remove getaddrinfo/freeaddrinfo symbol hiding patch for FreeBSD sources. Remove libc_resolv from Makefiles and run scenarios. Fix #2273
This commit is contained in:
parent
170b532892
commit
8ca63d4a6e
|
@ -2,4 +2,4 @@ SRC_CC = plugin.cc
|
||||||
|
|
||||||
vpath %.cc $(REP_DIR)/src/lib/libc_lxip
|
vpath %.cc $(REP_DIR)/src/lib/libc_lxip
|
||||||
|
|
||||||
LIBS += lxip libc libc_resolv
|
LIBS += lxip libc
|
||||||
|
|
|
@ -100,7 +100,7 @@ install_config $config
|
||||||
# generic modules
|
# generic modules
|
||||||
set boot_modules {
|
set boot_modules {
|
||||||
core ld.lib.so init timer posix.lib.so
|
core ld.lib.so init timer posix.lib.so
|
||||||
libc.lib.so libm.lib.so lxip.lib.so test-lxip_http_srv libc_resolv.lib.so
|
libc.lib.so libm.lib.so lxip.lib.so test-lxip_http_srv
|
||||||
}
|
}
|
||||||
|
|
||||||
# platform-specific modules
|
# platform-specific modules
|
||||||
|
|
|
@ -100,7 +100,6 @@ install_config $config
|
||||||
set boot_modules {
|
set boot_modules {
|
||||||
core ld.lib.so init timer
|
core ld.lib.so init timer
|
||||||
libc.lib.so libm.lib.so lxip.lib.so test-lxip_udp_echo
|
libc.lib.so libm.lib.so lxip.lib.so test-lxip_udp_echo
|
||||||
libc_resolv.lib.so
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# platform-specific modules
|
# platform-specific modules
|
||||||
|
|
|
@ -89,7 +89,7 @@ install_config $config
|
||||||
|
|
||||||
append boot_modules {
|
append boot_modules {
|
||||||
core init timer } [nic_drv_binary] {
|
core init timer } [nic_drv_binary] {
|
||||||
ld.lib.so libc.lib.so libc_lock_pipe.lib.so posix.lib.so
|
ld.lib.so libc.lib.so libc_pipe.lib.so posix.lib.so
|
||||||
libm.lib.so
|
libm.lib.so
|
||||||
vfs_lxip.lib.so lxip.lib.so
|
vfs_lxip.lib.so lxip.lib.so
|
||||||
tcp_terminal
|
tcp_terminal
|
||||||
|
|
|
@ -368,7 +368,6 @@ int Plugin::fcntl(Libc::File_descriptor *sockfdo, int cmd, long val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* XXX freeaddrinfo / getaddrinfo from libc_resolv.conf */
|
|
||||||
int Plugin::getpeername(Libc::File_descriptor *sockfdo,
|
int Plugin::getpeername(Libc::File_descriptor *sockfdo,
|
||||||
struct sockaddr *addr,
|
struct sockaddr *addr,
|
||||||
socklen_t *addrlen)
|
socklen_t *addrlen)
|
||||||
|
|
|
@ -53,10 +53,6 @@ namespace Libc {
|
||||||
virtual bool supports_execve(char const *filename, char *const argv[],
|
virtual bool supports_execve(char const *filename, char *const argv[],
|
||||||
char *const envp[]);
|
char *const envp[]);
|
||||||
virtual bool supports_mkdir(const char *path, mode_t mode);
|
virtual bool supports_mkdir(const char *path, mode_t mode);
|
||||||
virtual bool supports_freeaddrinfo(struct ::addrinfo *res);
|
|
||||||
virtual bool supports_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct ::addrinfo *hints,
|
|
||||||
struct ::addrinfo **res);
|
|
||||||
virtual bool supports_open(const char *pathname, int flags);
|
virtual bool supports_open(const char *pathname, int flags);
|
||||||
virtual bool supports_pipe();
|
virtual bool supports_pipe();
|
||||||
virtual bool supports_readlink(const char *path, char *buf, ::size_t bufsiz);
|
virtual bool supports_readlink(const char *path, char *buf, ::size_t bufsiz);
|
||||||
|
@ -95,13 +91,9 @@ namespace Libc {
|
||||||
char *const envp[]);
|
char *const envp[]);
|
||||||
virtual int fstatfs(File_descriptor *, struct statfs *buf);
|
virtual int fstatfs(File_descriptor *, struct statfs *buf);
|
||||||
virtual int fcntl(File_descriptor *, int cmd, long arg);
|
virtual int fcntl(File_descriptor *, int cmd, long arg);
|
||||||
virtual void freeaddrinfo(struct ::addrinfo *res);
|
|
||||||
virtual int fstat(File_descriptor *, struct stat *buf);
|
virtual int fstat(File_descriptor *, struct stat *buf);
|
||||||
virtual int fsync(File_descriptor *);
|
virtual int fsync(File_descriptor *);
|
||||||
virtual int ftruncate(File_descriptor *, ::off_t length);
|
virtual int ftruncate(File_descriptor *, ::off_t length);
|
||||||
virtual int getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct ::addrinfo *hints,
|
|
||||||
struct ::addrinfo **res);
|
|
||||||
virtual ssize_t getdirentries(File_descriptor *, char *buf,
|
virtual ssize_t getdirentries(File_descriptor *, char *buf,
|
||||||
::size_t nbytes, ::off_t *basep);
|
::size_t nbytes, ::off_t *basep);
|
||||||
virtual int getpeername(File_descriptor *,
|
virtual int getpeername(File_descriptor *,
|
||||||
|
|
|
@ -32,10 +32,6 @@ struct Libc::Plugin_registry : List<Plugin>
|
||||||
Plugin *get_plugin_for_access(char const *pathname, int amode);
|
Plugin *get_plugin_for_access(char const *pathname, int amode);
|
||||||
Plugin *get_plugin_for_execve(char const *filename, char *const argv[],
|
Plugin *get_plugin_for_execve(char const *filename, char *const argv[],
|
||||||
char *const envp[]);
|
char *const envp[]);
|
||||||
Plugin *get_plugin_for_freeaddrinfo(struct addrinfo *res);
|
|
||||||
Plugin *get_plugin_for_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct addrinfo *hints,
|
|
||||||
struct addrinfo **res);
|
|
||||||
Plugin *get_plugin_for_mkdir(const char *path, mode_t mode);
|
Plugin *get_plugin_for_mkdir(const char *path, mode_t mode);
|
||||||
Plugin *get_plugin_for_open(const char *pathname, int flags);
|
Plugin *get_plugin_for_open(const char *pathname, int flags);
|
||||||
Plugin *get_plugin_for_pipe();
|
Plugin *get_plugin_for_pipe();
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
# C Library including string, locale
|
# C Library including string, locale
|
||||||
#
|
#
|
||||||
LIBS = libc-string libc-locale libc-stdlib libc-stdio libc-gen libc-gdtoa \
|
LIBS = libc-string libc-locale libc-stdlib libc-stdio libc-gen libc-gdtoa \
|
||||||
libc-inet libc-stdtime libc-regex libc-compat libc-setjmp libc-mem
|
libc-inet libc-stdtime libc-regex libc-compat libc-setjmp libc-mem \
|
||||||
|
libc-resolv libc-isc libc-nameser libc-net libc-rpc \
|
||||||
|
|
||||||
LIBS += base vfs
|
LIBS += base vfs
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ SRC_CC = atexit.cc dummies.cc rlimit.cc sysctl.cc \
|
||||||
plugin.cc plugin_registry.cc select.cc exit.cc environ.cc nanosleep.cc \
|
plugin.cc plugin_registry.cc select.cc exit.cc environ.cc nanosleep.cc \
|
||||||
pread_pwrite.cc readv_writev.cc poll.cc \
|
pread_pwrite.cc readv_writev.cc poll.cc \
|
||||||
libc_pdbg.cc vfs_plugin.cc rtc.cc dynamic_linker.cc signal.cc \
|
libc_pdbg.cc vfs_plugin.cc rtc.cc dynamic_linker.cc signal.cc \
|
||||||
socket_operations.cc task.cc addrinfo.cc socket_fs_plugin.cc
|
socket_operations.cc task.cc socket_fs_plugin.cc
|
||||||
|
|
||||||
CC_OPT_sysctl += -Wno-write-strings
|
CC_OPT_sysctl += -Wno-write-strings
|
||||||
|
|
||||||
|
|
|
@ -2,4 +2,4 @@ SRC_CC = init.cc plugin.cc
|
||||||
|
|
||||||
vpath %.cc $(REP_DIR)/src/lib/libc_lwip
|
vpath %.cc $(REP_DIR)/src/lib/libc_lwip
|
||||||
|
|
||||||
LIBS += lwip libc libc-resolv libc-isc libc-nameser libc-net libc-rpc
|
LIBS += lwip libc
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
LIBS = libc libc-resolv libc-isc libc-nameser libc-net libc-rpc
|
|
||||||
|
|
||||||
SRC_CC = plugin.cc
|
|
||||||
|
|
||||||
vpath %.cc $(REP_DIR)/src/lib/libc_resolv
|
|
||||||
|
|
||||||
include $(REP_DIR)/lib/mk/libc-common.inc
|
|
||||||
|
|
||||||
SHARED_LIB = yes
|
|
|
@ -2,10 +2,14 @@ ___runetype T
|
||||||
___tolower T
|
___tolower T
|
||||||
___toupper T
|
___toupper T
|
||||||
__assert T
|
__assert T
|
||||||
|
__dn_expand T
|
||||||
|
__dn_expand T
|
||||||
__error T
|
__error T
|
||||||
__flt_rounds T
|
__flt_rounds T
|
||||||
__fpclassifyd T
|
__fpclassifyd T
|
||||||
__fpclassifyf T
|
__fpclassifyf T
|
||||||
|
__h_errno T
|
||||||
|
__h_errno_set T
|
||||||
__inet_addr T
|
__inet_addr T
|
||||||
__inet_aton T
|
__inet_aton T
|
||||||
__inet_nsap_ntoa T
|
__inet_nsap_ntoa T
|
||||||
|
@ -14,6 +18,9 @@ __inet_ntop T
|
||||||
__inet_pton T
|
__inet_pton T
|
||||||
__isthreaded B 4
|
__isthreaded B 4
|
||||||
__mb_cur_max D 8
|
__mb_cur_max D 8
|
||||||
|
__res_init T
|
||||||
|
__res_query T
|
||||||
|
__res_state T
|
||||||
__srget T
|
__srget T
|
||||||
__stderrp D 8
|
__stderrp D 8
|
||||||
__stdinp D 8
|
__stdinp D 8
|
||||||
|
@ -21,6 +28,8 @@ __stdoutp D 8
|
||||||
__swbuf T
|
__swbuf T
|
||||||
__xuname T
|
__xuname T
|
||||||
_exit T
|
_exit T
|
||||||
|
_getlong T
|
||||||
|
_getshort T
|
||||||
a64l T
|
a64l T
|
||||||
abort T
|
abort T
|
||||||
abs T
|
abs T
|
||||||
|
@ -248,6 +257,8 @@ getgrnam T
|
||||||
getgrnam_r T
|
getgrnam_r T
|
||||||
getgrouplist T
|
getgrouplist T
|
||||||
getgroups W
|
getgroups W
|
||||||
|
gethostbyaddr T
|
||||||
|
gethostbyaddr_r T
|
||||||
gethostbyname W
|
gethostbyname W
|
||||||
gethostid T
|
gethostid T
|
||||||
gethostname T
|
gethostname T
|
||||||
|
@ -271,6 +282,8 @@ getpid W
|
||||||
getppid W
|
getppid W
|
||||||
getpriority W
|
getpriority W
|
||||||
getprogname W
|
getprogname W
|
||||||
|
getprotobyname T
|
||||||
|
getprotobyname_r T
|
||||||
getpwent W
|
getpwent W
|
||||||
getpwnam W
|
getpwnam W
|
||||||
getpwuid W
|
getpwuid W
|
||||||
|
@ -279,6 +292,8 @@ getrlimit W
|
||||||
getrusage W
|
getrusage W
|
||||||
gets T
|
gets T
|
||||||
getservbyname W
|
getservbyname W
|
||||||
|
getservbyport T
|
||||||
|
getservbyport_r T
|
||||||
getsid W
|
getsid W
|
||||||
getsockname T
|
getsockname T
|
||||||
getsockopt T
|
getsockopt T
|
||||||
|
@ -304,6 +319,10 @@ heapsort T
|
||||||
hsearch T
|
hsearch T
|
||||||
imaxabs T
|
imaxabs T
|
||||||
imaxdiv T
|
imaxdiv T
|
||||||
|
in6addr_any R 16
|
||||||
|
in6addr_linklocal_allnodes R 16
|
||||||
|
in6addr_loopback R 16
|
||||||
|
in6addr_nodelocal_allnodes R 16
|
||||||
index T
|
index T
|
||||||
inet_addr W
|
inet_addr W
|
||||||
inet_aton W
|
inet_aton W
|
||||||
|
@ -741,8 +760,8 @@ swscanf T
|
||||||
symlink T
|
symlink T
|
||||||
sync W
|
sync W
|
||||||
sys_errlist D 752
|
sys_errlist D 752
|
||||||
sys_nerr R
|
sys_nerr R 4
|
||||||
sys_nsig R
|
sys_nsig R 4
|
||||||
sys_siglist D 256
|
sys_siglist D 256
|
||||||
sys_signame D 256
|
sys_signame D 256
|
||||||
sysconf T
|
sysconf T
|
||||||
|
@ -901,42 +920,6 @@ __isinff T
|
||||||
__isinfl T
|
__isinfl T
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Symbols needed by libc-resolv
|
|
||||||
#
|
|
||||||
__inet_nsap_addr T
|
|
||||||
_accept T
|
|
||||||
_bind T
|
|
||||||
_close T
|
|
||||||
_connect T
|
|
||||||
_fcntl T
|
|
||||||
_fstat T
|
|
||||||
_getpeername T
|
|
||||||
_getsockname T
|
|
||||||
_getsockopt T
|
|
||||||
_listen T
|
|
||||||
_nanosleep W
|
|
||||||
_pthread_getspecific W
|
|
||||||
_pthread_key_create W
|
|
||||||
_pthread_main_np W
|
|
||||||
_pthread_mutex_trylock W
|
|
||||||
_pthread_mutex_unlock W
|
|
||||||
_pthread_once W
|
|
||||||
_pthread_rwlock_rdlock W
|
|
||||||
_pthread_rwlock_unlock W
|
|
||||||
_pthread_rwlock_wrlock W
|
|
||||||
_pthread_setspecific W
|
|
||||||
_read T
|
|
||||||
_recvfrom T
|
|
||||||
_select W
|
|
||||||
_sendto T
|
|
||||||
_setsockopt T
|
|
||||||
_sigprocmask W
|
|
||||||
_socket T
|
|
||||||
_write T
|
|
||||||
_writev T
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Public interface between Genode-component code and the libc runtime
|
# Public interface between Genode-component code and the libc runtime
|
||||||
#
|
#
|
||||||
|
@ -960,10 +943,8 @@ _ZN4Libc25File_descriptor_allocator5allocEPNS_6PluginEPNS_14Plugin_contextEi T
|
||||||
_ZN4Libc25file_descriptor_allocatorEv T
|
_ZN4Libc25file_descriptor_allocatorEv T
|
||||||
_ZN4Libc6Plugin10getsockoptEPNS_15File_descriptorEiiPvPj T
|
_ZN4Libc6Plugin10getsockoptEPNS_15File_descriptorEiiPvPj T
|
||||||
_ZN4Libc6Plugin10setsockoptEPNS_15File_descriptorEiiPKvj T
|
_ZN4Libc6Plugin10setsockoptEPNS_15File_descriptorEiiPKvj T
|
||||||
_ZN4Libc6Plugin11getaddrinfoEPKcS2_PK8addrinfoPPS3_ T
|
|
||||||
_ZN4Libc6Plugin11getpeernameEPNS_15File_descriptorEP8sockaddrPj T
|
_ZN4Libc6Plugin11getpeernameEPNS_15File_descriptorEP8sockaddrPj T
|
||||||
_ZN4Libc6Plugin11getsocknameEPNS_15File_descriptorEP8sockaddrPj T
|
_ZN4Libc6Plugin11getsocknameEPNS_15File_descriptorEP8sockaddrPj T
|
||||||
_ZN4Libc6Plugin12freeaddrinfoEP8addrinfo T
|
|
||||||
_ZN4Libc6Plugin13getdirentriesEPNS_15File_descriptorEPcmPx T
|
_ZN4Libc6Plugin13getdirentriesEPNS_15File_descriptorEPcmPx T
|
||||||
_ZN4Libc6Plugin13getdirentriesEPNS_15File_descriptorEPcmPl T
|
_ZN4Libc6Plugin13getdirentriesEPNS_15File_descriptorEPcmPl T
|
||||||
_ZN4Libc6Plugin13supports_mmapEv T
|
_ZN4Libc6Plugin13supports_mmapEv T
|
||||||
|
@ -981,8 +962,6 @@ _ZN4Libc6Plugin15supports_unlinkEPKc T
|
||||||
_ZN4Libc6Plugin16supports_symlinkEPKcS2_ T
|
_ZN4Libc6Plugin16supports_symlinkEPKcS2_ T
|
||||||
_ZN4Libc6Plugin17supports_readlinkEPKcPcj T
|
_ZN4Libc6Plugin17supports_readlinkEPKcPcj T
|
||||||
_ZN4Libc6Plugin17supports_readlinkEPKcPcm T
|
_ZN4Libc6Plugin17supports_readlinkEPKcPcm T
|
||||||
_ZN4Libc6Plugin20supports_getaddrinfoEPKcS2_PK8addrinfoPPS3_ T
|
|
||||||
_ZN4Libc6Plugin21supports_freeaddrinfoEP8addrinfo T
|
|
||||||
_ZN4Libc6Plugin3dupEPNS_15File_descriptorE T
|
_ZN4Libc6Plugin3dupEPNS_15File_descriptorE T
|
||||||
_ZN4Libc6Plugin4bindEPNS_15File_descriptorEPK8sockaddrj T
|
_ZN4Libc6Plugin4bindEPNS_15File_descriptorEPK8sockaddrj T
|
||||||
_ZN4Libc6Plugin4dup2EPNS_15File_descriptorES2_ T
|
_ZN4Libc6Plugin4dup2EPNS_15File_descriptorES2_ T
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
cefebffc6e8f129acb24de192373731461abe2f6
|
5871e71bb99dab10faab21931750c30e8a02d980
|
||||||
|
|
|
@ -43,7 +43,7 @@ $(foreach svn_export,$(svn_exports),\
|
||||||
$(foreach svn_export,$(svn_exports),\
|
$(foreach svn_export,$(svn_exports),\
|
||||||
$(eval REV($(svn_export)) := HEAD))
|
$(eval REV($(svn_export)) := HEAD))
|
||||||
|
|
||||||
PATCHES := src/lib/libc/patches/*.patch
|
PATCHES := $(sort $(wildcard $(REP_DIR)/src/lib/libc/patches/*.patch))
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -60,7 +60,6 @@ append config {
|
||||||
append boot_modules {
|
append boot_modules {
|
||||||
core init timer } [nic_drv_binary] { ram_fs vfs
|
core init timer } [nic_drv_binary] { ram_fs vfs
|
||||||
ld.lib.so libc.lib.so libm.lib.so posix.lib.so
|
ld.lib.so libc.lib.so libm.lib.so posix.lib.so
|
||||||
libc_resolv.lib.so stdcxx.lib.so libc_pipe.lib.so
|
|
||||||
vfs_lxip.lib.so lxip.lib.so
|
vfs_lxip.lib.so lxip.lib.so
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -253,7 +253,7 @@ install_config $config
|
||||||
|
|
||||||
build_boot_image "
|
build_boot_image "
|
||||||
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
|
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
|
||||||
posix.lib.so libc_resolv.lib.so lwip.lib.so lxip.lib.so test-http_clnt
|
posix.lib.so lwip.lib.so lxip.lib.so test-http_clnt
|
||||||
test-lwip_httpsrv_static nic_dump test-lxip_udp_echo test-lxip_udp_client
|
test-lwip_httpsrv_static nic_dump test-lxip_udp_echo test-lxip_udp_client
|
||||||
[nic_drv_binary] [gpio_drv] [platform_drv_boot_modules]"
|
[nic_drv_binary] [gpio_drv] [platform_drv_boot_modules]"
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ install_config $config
|
||||||
|
|
||||||
build_boot_image "
|
build_boot_image "
|
||||||
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
|
core init timer nic_router nic_bridge ld.lib.so libc.lib.so libm.lib.so
|
||||||
libc_resolv.lib.so lwip.lib.so lxip.lib.so posix.lib.so test-http_clnt
|
lwip.lib.so lxip.lib.so posix.lib.so test-http_clnt
|
||||||
test-lwip_httpsrv_static test-lxip_udp_echo test-lxip_udp_client
|
test-lwip_httpsrv_static test-lxip_udp_echo test-lxip_udp_client
|
||||||
[nic_drv_binary] [gpio_drv] [platform_drv_boot_modules]"
|
[nic_drv_binary] [gpio_drv] [platform_drv_boot_modules]"
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ install_config $config
|
||||||
set boot_modules {
|
set boot_modules {
|
||||||
core init timer linux_nic_drv ram_fs vfs
|
core init timer linux_nic_drv ram_fs vfs
|
||||||
ld.lib.so libc.lib.so libm.lib.so
|
ld.lib.so libc.lib.so libm.lib.so
|
||||||
libc_resolv.lib.so stdcxx.lib.so libc_pipe.lib.so
|
stdcxx.lib.so
|
||||||
vfs_lxip.lib.so lxip.lib.so
|
vfs_lxip.lib.so lxip.lib.so
|
||||||
test-nim_echo_server
|
test-nim_echo_server
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* \brief libc addrinfo plugin wrappers
|
|
||||||
* \author Christian Helmuth
|
|
||||||
* \date 2017-02-08
|
|
||||||
*
|
|
||||||
* Note, these functions are implemented by the libc_resolv library currently
|
|
||||||
* and can be removed when the library is merged into libc.lib.so.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2017 Genode Labs GmbH
|
|
||||||
*
|
|
||||||
* This file is part of the Genode OS framework, which is distributed
|
|
||||||
* under the terms of the GNU Affero General Public License version 3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Genode includes */
|
|
||||||
#include <base/log.h>
|
|
||||||
|
|
||||||
/* libc includes */
|
|
||||||
#include <libc-plugin/plugin_registry.h>
|
|
||||||
|
|
||||||
|
|
||||||
using namespace Libc;
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void freeaddrinfo(struct addrinfo *res)
|
|
||||||
{
|
|
||||||
Plugin *plugin;
|
|
||||||
|
|
||||||
plugin = plugin_registry()->get_plugin_for_freeaddrinfo(res);
|
|
||||||
|
|
||||||
if (!plugin) {
|
|
||||||
Genode::error("no plugin found for freeaddrinfo()");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plugin->freeaddrinfo(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" int getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct addrinfo *hints,
|
|
||||||
struct addrinfo **res)
|
|
||||||
{
|
|
||||||
Plugin *plugin;
|
|
||||||
|
|
||||||
plugin = plugin_registry()->get_plugin_for_getaddrinfo(node, service, hints, res);
|
|
||||||
|
|
||||||
if (!plugin) {
|
|
||||||
Genode::error("no plugin found for getaddrinfo()");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return plugin->getaddrinfo(node, service, hints, res);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
+++ src/lib/libc/lib/libc/net/getaddrinfo.c
|
|
||||||
@@ -329,7 +329,7 @@ do { \
|
|
||||||
((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
|
|
||||||
|
|
||||||
void
|
|
||||||
-freeaddrinfo(struct addrinfo *ai)
|
|
||||||
+libc_freeaddrinfo(struct addrinfo *ai)
|
|
||||||
{
|
|
||||||
struct addrinfo *next;
|
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ str2number(const char *p, int *portp)
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
-getaddrinfo(const char *hostname, const char *servname,
|
|
||||||
+libc_getaddrinfo(const char *hostname, const char *servname,
|
|
||||||
const struct addrinfo *hints, struct addrinfo **res)
|
|
||||||
{
|
|
||||||
struct addrinfo sentinel;
|
|
|
@ -55,20 +55,6 @@ bool Plugin::supports_execve(char const *filename, char *const argv[],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::supports_freeaddrinfo(struct ::addrinfo *)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::supports_getaddrinfo(const char *, const char *,
|
|
||||||
const struct ::addrinfo *,
|
|
||||||
struct ::addrinfo **)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::supports_mkdir(const char *, mode_t)
|
bool Plugin::supports_mkdir(const char *, mode_t)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -197,8 +183,6 @@ DUMMY(ssize_t, -1, write, (File_descriptor *, const void *, ::size_t));
|
||||||
*/
|
*/
|
||||||
DUMMY(int, -1, access, (char const *, int));
|
DUMMY(int, -1, access, (char const *, int));
|
||||||
DUMMY(int, -1, execve, (char const *, char *const[], char *const[]));
|
DUMMY(int, -1, execve, (char const *, char *const[], char *const[]));
|
||||||
DUMMY(void, , freeaddrinfo, (struct ::addrinfo *));
|
|
||||||
DUMMY(int, -1, getaddrinfo, (const char *, const char *, const struct ::addrinfo *, struct ::addrinfo **));
|
|
||||||
DUMMY(int, -1, mkdir, (const char*, mode_t));
|
DUMMY(int, -1, mkdir, (const char*, mode_t));
|
||||||
DUMMY(void *, (void *)(-1), mmap, (void *addr, ::size_t length, int prot, int flags,
|
DUMMY(void *, (void *)(-1), mmap, (void *addr, ::size_t length, int prot, int flags,
|
||||||
File_descriptor *, ::off_t offset));
|
File_descriptor *, ::off_t offset));
|
||||||
|
|
|
@ -45,16 +45,6 @@ Plugin *Plugin_registry::get_plugin_for_execve(char const *filename, char *const
|
||||||
GET_PLUGIN_FOR(execve, filename, argv, envp) }
|
GET_PLUGIN_FOR(execve, filename, argv, envp) }
|
||||||
|
|
||||||
|
|
||||||
Plugin *Plugin_registry::get_plugin_for_freeaddrinfo(struct addrinfo *res) {
|
|
||||||
GET_PLUGIN_FOR(freeaddrinfo, res) }
|
|
||||||
|
|
||||||
|
|
||||||
Plugin *Plugin_registry::get_plugin_for_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct addrinfo *hints,
|
|
||||||
struct addrinfo **res) {
|
|
||||||
GET_PLUGIN_FOR(getaddrinfo, node, service, hints, res) }
|
|
||||||
|
|
||||||
|
|
||||||
Plugin *Plugin_registry::get_plugin_for_mkdir(const char *path, mode_t mode) {
|
Plugin *Plugin_registry::get_plugin_for_mkdir(const char *path, mode_t mode) {
|
||||||
GET_PLUGIN_FOR(mkdir, path, mode) }
|
GET_PLUGIN_FOR(mkdir, path, mode) }
|
||||||
|
|
||||||
|
|
|
@ -162,60 +162,52 @@ struct Plugin : Libc::Plugin
|
||||||
*/
|
*/
|
||||||
Plugin();
|
Plugin();
|
||||||
|
|
||||||
bool supports_freeaddrinfo(struct ::addrinfo *res);
|
|
||||||
bool supports_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct ::addrinfo *hints,
|
|
||||||
struct ::addrinfo **res);
|
|
||||||
bool supports_select(int nfds,
|
bool supports_select(int nfds,
|
||||||
fd_set *readfds,
|
fd_set *readfds,
|
||||||
fd_set *writefds,
|
fd_set *writefds,
|
||||||
fd_set *exceptfds,
|
fd_set *exceptfds,
|
||||||
struct timeval *timeout);
|
struct timeval *timeout) override;
|
||||||
bool supports_socket(int domain, int type, int protocol);
|
bool supports_socket(int domain, int type, int protocol) override;
|
||||||
|
|
||||||
Libc::File_descriptor *accept(Libc::File_descriptor *sockfdo,
|
Libc::File_descriptor *accept(Libc::File_descriptor *sockfdo,
|
||||||
struct sockaddr *addr,
|
struct sockaddr *addr,
|
||||||
socklen_t *addrlen);
|
socklen_t *addrlen) override;
|
||||||
int bind(Libc::File_descriptor *sockfdo,
|
int bind(Libc::File_descriptor *sockfdo,
|
||||||
const struct sockaddr *addr,
|
const struct sockaddr *addr,
|
||||||
socklen_t addrlen);
|
socklen_t addrlen) override;
|
||||||
int close(Libc::File_descriptor *fdo);
|
int close(Libc::File_descriptor *fdo) override;
|
||||||
int connect(Libc::File_descriptor *sockfdo,
|
int connect(Libc::File_descriptor *sockfdo,
|
||||||
const struct sockaddr *addr,
|
const struct sockaddr *addr,
|
||||||
socklen_t addrlen);
|
socklen_t addrlen) override;
|
||||||
int fcntl(Libc::File_descriptor *sockfdo, int cmd, long val);
|
int fcntl(Libc::File_descriptor *sockfdo, int cmd, long val) override;
|
||||||
void freeaddrinfo(struct ::addrinfo *res);
|
|
||||||
int getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct ::addrinfo *hints,
|
|
||||||
struct ::addrinfo **res);
|
|
||||||
int getpeername(Libc::File_descriptor *sockfdo,
|
int getpeername(Libc::File_descriptor *sockfdo,
|
||||||
struct sockaddr *addr,
|
struct sockaddr *addr,
|
||||||
socklen_t *addrlen);
|
socklen_t *addrlen) override;
|
||||||
int getsockname(Libc::File_descriptor *sockfdo,
|
int getsockname(Libc::File_descriptor *sockfdo,
|
||||||
struct sockaddr *addr,
|
struct sockaddr *addr,
|
||||||
socklen_t *addrlen);
|
socklen_t *addrlen) override;
|
||||||
int getsockopt(Libc::File_descriptor *sockfdo, int level,
|
int getsockopt(Libc::File_descriptor *sockfdo, int level,
|
||||||
int optname, void *optval,
|
int optname, void *optval,
|
||||||
socklen_t *optlen);
|
socklen_t *optlen) override;
|
||||||
int ioctl(Libc::File_descriptor *sockfdo, int request, char *argp);
|
int ioctl(Libc::File_descriptor *sockfdo, int request, char *argp) override;
|
||||||
int listen(Libc::File_descriptor *sockfdo, int backlog);
|
int listen(Libc::File_descriptor *sockfdo, int backlog) override;
|
||||||
ssize_t read(Libc::File_descriptor *fdo, void *buf, ::size_t count);
|
ssize_t read(Libc::File_descriptor *fdo, void *buf, ::size_t count) override;
|
||||||
int shutdown(Libc::File_descriptor *fdo, int);
|
int shutdown(Libc::File_descriptor *fdo, int) override;
|
||||||
int select(int nfds, fd_set *readfds, fd_set *writefds,
|
int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||||
fd_set *exceptfds, struct timeval *timeout);
|
fd_set *exceptfds, struct timeval *timeout) override;
|
||||||
ssize_t send(Libc::File_descriptor *, const void *buf, ::size_t len, int flags);
|
ssize_t send(Libc::File_descriptor *, const void *buf, ::size_t len, int flags) override;
|
||||||
ssize_t sendto(Libc::File_descriptor *, const void *buf,
|
ssize_t sendto(Libc::File_descriptor *, const void *buf,
|
||||||
::size_t len, int flags,
|
::size_t len, int flags,
|
||||||
const struct sockaddr *dest_addr,
|
const struct sockaddr *dest_addr,
|
||||||
socklen_t addrlen);
|
socklen_t addrlen) override;
|
||||||
ssize_t recv(Libc::File_descriptor *, void *buf, ::size_t len, int flags);
|
ssize_t recv(Libc::File_descriptor *, void *buf, ::size_t len, int flags) override;
|
||||||
ssize_t recvfrom(Libc::File_descriptor *, void *buf, ::size_t len, int flags,
|
ssize_t recvfrom(Libc::File_descriptor *, void *buf, ::size_t len, int flags,
|
||||||
struct sockaddr *src_addr, socklen_t *addrlen);
|
struct sockaddr *src_addr, socklen_t *addrlen) override;
|
||||||
int setsockopt(Libc::File_descriptor *sockfdo, int level,
|
int setsockopt(Libc::File_descriptor *sockfdo, int level,
|
||||||
int optname, const void *optval,
|
int optname, const void *optval,
|
||||||
socklen_t optlen);
|
socklen_t optlen) override;
|
||||||
Libc::File_descriptor *socket(int domain, int type, int protocol);
|
Libc::File_descriptor *socket(int domain, int type, int protocol) override;
|
||||||
ssize_t write(Libc::File_descriptor *fdo, const void *buf, ::size_t count);
|
ssize_t write(Libc::File_descriptor *fdo, const void *buf, ::size_t count) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,20 +219,6 @@ Plugin::Plugin()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::supports_freeaddrinfo(struct ::addrinfo *)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::supports_getaddrinfo(const char *, const char *,
|
|
||||||
const struct ::addrinfo *,
|
|
||||||
struct ::addrinfo **)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Plugin::supports_select(int nfds,
|
bool Plugin::supports_select(int nfds,
|
||||||
fd_set *readfds,
|
fd_set *readfds,
|
||||||
fd_set *writefds,
|
fd_set *writefds,
|
||||||
|
@ -346,26 +324,6 @@ int Plugin::fcntl(Libc::File_descriptor *sockfdo, int cmd, long val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void libc_freeaddrinfo(struct ::addrinfo *);
|
|
||||||
|
|
||||||
void Plugin::freeaddrinfo(struct ::addrinfo *res)
|
|
||||||
{
|
|
||||||
return ::libc_freeaddrinfo(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" int libc_getaddrinfo(const char *, const char *,
|
|
||||||
const struct ::addrinfo *,
|
|
||||||
struct ::addrinfo **);
|
|
||||||
|
|
||||||
int Plugin::getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct ::addrinfo *hints,
|
|
||||||
struct ::addrinfo **res)
|
|
||||||
{
|
|
||||||
return ::libc_getaddrinfo(node, service, hints, res);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Plugin::getpeername(Libc::File_descriptor *sockfdo,
|
int Plugin::getpeername(Libc::File_descriptor *sockfdo,
|
||||||
struct sockaddr *addr,
|
struct sockaddr *addr,
|
||||||
socklen_t *addrlen)
|
socklen_t *addrlen)
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
This libc plugin uses libc's own resolv facilities to do DNS resolving
|
|
||||||
etc. pp. It is much more advanced than the functions which lwip has to
|
|
||||||
offer.
|
|
||||||
|
|
||||||
Its current use is for noux-pkgs only. ``Native'' Genode programs should
|
|
||||||
use getaddrinfo() provided by lwip for now.
|
|
|
@ -1,108 +0,0 @@
|
||||||
/*
|
|
||||||
* \brief Libc resolv
|
|
||||||
* \author Josef Soentgen
|
|
||||||
* \date 2012-07-19
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2012-2017 Genode Labs GmbH
|
|
||||||
*
|
|
||||||
* This file is part of the Genode OS framework, which is distributed
|
|
||||||
* under the terms of the GNU Affero General Public License version 3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Genode includes */
|
|
||||||
#include <base/printf.h>
|
|
||||||
#include <base/env.h>
|
|
||||||
|
|
||||||
/* libc plugin includes */
|
|
||||||
#include <libc-plugin/plugin.h>
|
|
||||||
#include <libc-plugin/fd_alloc.h>
|
|
||||||
|
|
||||||
/* libc includes */
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
|
|
||||||
|
|
||||||
extern "C" void libc_freeaddrinfo(struct ::addrinfo *);
|
|
||||||
extern "C" int libc_getaddrinfo(const char *, const char *,
|
|
||||||
const struct ::addrinfo *,
|
|
||||||
struct ::addrinfo **);
|
|
||||||
|
|
||||||
/************
|
|
||||||
** Plugin **
|
|
||||||
************/
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
struct Plugin_context : Libc::Plugin_context { };
|
|
||||||
|
|
||||||
static inline Plugin_context *context(Libc::File_descriptor *fd)
|
|
||||||
{
|
|
||||||
return static_cast<Plugin_context *>(fd->context);
|
|
||||||
}
|
|
||||||
|
|
||||||
class Plugin : public Libc::Plugin
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
Plugin_context _context;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
Plugin() { }
|
|
||||||
|
|
||||||
bool supports_freeaddrinfo(struct ::addrinfo *res)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
bool supports_getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct ::addrinfo *hints,
|
|
||||||
struct ::addrinfo **res)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getaddrinfo(const char *node, const char *service,
|
|
||||||
const struct ::addrinfo *hints,
|
|
||||||
struct ::addrinfo **res)
|
|
||||||
{
|
|
||||||
return ::libc_getaddrinfo(node, service, hints, res);
|
|
||||||
}
|
|
||||||
|
|
||||||
void freeaddrinfo(struct ::addrinfo *res)
|
|
||||||
{
|
|
||||||
return ::libc_freeaddrinfo(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
::ssize_t getdirentries(Libc::File_descriptor *fd, char *buf, ::size_t nbytes,
|
|
||||||
::off_t *basep)
|
|
||||||
{
|
|
||||||
Genode::error(__FILE__, ":", __LINE__, " ", __func__, "not implemented");
|
|
||||||
return 0UL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *mmap(void *addr, ::size_t length, int prot, int flags,
|
|
||||||
Libc::File_descriptor *, ::off_t offset)
|
|
||||||
{
|
|
||||||
Genode::error(__FILE__, ":", __LINE__, " ", __func__, "not implemented");
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int msync(void *addr, ::size_t len, int flags)
|
|
||||||
{
|
|
||||||
Genode::error(__FILE__, ":", __LINE__, " ", __func__, "not implemented");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} /* unnamed namespace */
|
|
||||||
|
|
||||||
void __attribute__((constructor)) init_libc_resolv(void)
|
|
||||||
{
|
|
||||||
static Plugin libc_resolv;
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2012-2017 Genode Labs GmbH
|
|
||||||
*
|
|
||||||
* This file is part of the Genode OS framework, which is distributed
|
|
||||||
* under the terms of the GNU Affero General Public License version 3.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
TARGET = test-libc_resolv
|
|
||||||
SRC_CC = main.cc
|
|
||||||
LIBS = posix libc_resolv
|
|
|
@ -1,6 +1,6 @@
|
||||||
TARGET = test-netty_tcp
|
TARGET = test-netty_tcp
|
||||||
SRC_CC = main.cc netty.cc
|
SRC_CC = main.cc netty.cc
|
||||||
LIBS = libc libc_resolv
|
LIBS = libc
|
||||||
|
|
||||||
INC_DIR += $(PRG_DIR)/..
|
INC_DIR += $(PRG_DIR)/..
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
TARGET = test-netty_udp
|
TARGET = test-netty_udp
|
||||||
SRC_CC = main.cc netty.cc
|
SRC_CC = main.cc netty.cc
|
||||||
LIBS = libc libc_resolv
|
LIBS = libc
|
||||||
|
|
||||||
INC_DIR += $(PRG_DIR)/..
|
INC_DIR += $(PRG_DIR)/..
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
TARGET = test-nim_echo_server
|
TARGET = test-nim_echo_server
|
||||||
LIBS = libc libc_resolv
|
LIBS = libc
|
||||||
SRC_NIM = main.nim
|
SRC_NIM = main.nim
|
||||||
|
|
||||||
# Enable extra system assertions
|
# Enable extra system assertions
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set netperf_target app/netperf/lxip
|
set netperf_target app/netperf/lxip
|
||||||
set netperf_app netserver_lxip
|
set netperf_app netserver_lxip
|
||||||
set netperf_stack { lxip.lib.so libc_resolv.lib.so }
|
set netperf_stack { lxip.lib.so }
|
||||||
set ip_match_string "ipaddr=(\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+).*\n"
|
set ip_match_string "ipaddr=(\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+).*\n"
|
||||||
|
|
|
@ -172,7 +172,7 @@ install_config $config
|
||||||
set boot_modules {
|
set boot_modules {
|
||||||
core init timer tcp_terminal nic_bridge
|
core init timer tcp_terminal nic_bridge
|
||||||
ld.lib.so noux_net libc.lib.so libm.lib.so libc_pipe.lib.so pthread.lib.so
|
ld.lib.so noux_net libc.lib.so libm.lib.so libc_pipe.lib.so pthread.lib.so
|
||||||
libc_resolv.lib.so libc_noux.lib.so lwip.lib.so netcat.tar posix.lib.so
|
libc_noux.lib.so lwip.lib.so netcat.tar posix.lib.so
|
||||||
}
|
}
|
||||||
|
|
||||||
# platform-specific modules
|
# platform-specific modules
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
NETPERF_DIR := $(call select_from_ports,netperf)/src/app/netperf
|
NETPERF_DIR := $(call select_from_ports,netperf)/src/app/netperf
|
||||||
|
|
||||||
LIBS += posix libc-resolv libc-net libc-nameser libc-isc
|
LIBS += posix
|
||||||
|
|
||||||
SRC_C = netserver.c netlib.c netsh.c nettest_bsd.c dscp.c
|
SRC_C = netserver.c netlib.c netsh.c nettest_bsd.c dscp.c
|
||||||
# omni test
|
# omni test
|
||||||
|
|
|
@ -17,7 +17,7 @@ CFLAGS += -DUSE_OPENSSL_INCL
|
||||||
#
|
#
|
||||||
CFLAGS += -D__BSD_VISIBLE
|
CFLAGS += -D__BSD_VISIBLE
|
||||||
|
|
||||||
LIBS += ncurses zlib libssl libcrypto libc_resolv
|
LIBS += ncurses zlib libssl libcrypto
|
||||||
|
|
||||||
#
|
#
|
||||||
# Make the zlib linking test succeed
|
# Make the zlib linking test succeed
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
TARGET = netcat
|
TARGET = netcat
|
||||||
|
|
||||||
LIBS = libc_resolv
|
|
||||||
|
|
||||||
include $(call select_from_repositories,mk/noux.mk)
|
include $(call select_from_repositories,mk/noux.mk)
|
||||||
|
|
|
@ -24,7 +24,7 @@ CONFIGURE_ARGS += --disable-ip6 \
|
||||||
|
|
||||||
INSTALL_TARGET = install
|
INSTALL_TARGET = install
|
||||||
|
|
||||||
LIBS += libcrypto libssl zlib libc_resolv
|
LIBS += libcrypto libssl zlib
|
||||||
|
|
||||||
built.tag: Makefile Makefile_patch
|
built.tag: Makefile Makefile_patch
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue