summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 99e2a2f)
raw | patch | inline | side by side (parent: 99e2a2f)
author | Elliott Hughes <enh@google.com> | |
Wed, 2 Jul 2014 23:27:20 +0000 (16:27 -0700) | ||
committer | Elliott Hughes <enh@google.com> | |
Wed, 2 Jul 2014 23:27:20 +0000 (16:27 -0700) |
The res_init.c changes bring us a bit closer to upstream too, though
there's still work to be done there. Some of the remaining differences
look like bugs we'd want to fix, so we should definitely try to come
back to that.
Change-Id: I50baa148e967c90d55d711e9904ad54c7d724d4d
there's still work to be done there. Some of the remaining differences
look like bugs we'd want to fix, so we should definitely try to come
back to that.
Change-Id: I50baa148e967c90d55d711e9904ad54c7d724d4d
diff --git a/libc/Android.mk b/libc/Android.mk
index 0f9cf6a8174546d9ddb78ea9dfef7fc3ac5ec954..078be59426c9f38f68fbe7da08a1c8d968e5eef2 100644 (file)
--- a/libc/Android.mk
+++ b/libc/Android.mk
-I$(LOCAL_PATH)/upstream-netbsd/lib/libc/include \
-I$(LOCAL_PATH)/upstream-netbsd/android/include \
-include netbsd-compat.h \
- -Wno-error \
LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags)
index 5ea528e299078d94dd6bd552fea4515a6e5524bc..c95c9b045367565fdee7d43c98af2d1a6a21d20e 100644 (file)
getservbyname(const char *name, const char *proto)
{
res_static rs = __res_get_static();
- struct servent* s;
if (rs == NULL || proto == NULL || name == NULL) {
errno = EINVAL;
index fad7e236a401fa456354b7685744e8afbc15a02a..7dcaafb01d7f5e82199ab111ea9e575a4427707f 100644 (file)
getservbyport(int port, const char *proto)
{
res_static rs = __res_get_static();
- struct servent* s;
if (rs == NULL || proto == NULL) {
errno = EINVAL;
index 9df97cdfc6c3b087d51f7d2aefadede77b11cd6c..77a1b4d1978a5a1133cb98c880f0fbec48030d07 100644 (file)
register char **pp = statp->dnsrch;
register int *p = info->dnsrch_offset;
while (pp < statp->dnsrch + MAXDNSRCH && *p != -1) {
- *pp++ = &statp->defdname + *p++;
+ *pp++ = &statp->defdname[0] + *p++;
}
}
pthread_mutex_unlock(&_res_cache_list_lock);
index 158466ee9a135bd992606493b98ef714bfccc542..f1cbed8ac332c82fa91c083ab74790d70df3a211 100644 (file)
#include <sys/system_properties.h>
#endif /* ANDROID_CHANGES */
-#ifndef MIN
-#define MIN(x,y) ((x)<(y)?(x):(y))
-#endif
-
/* ensure that sockaddr_in6 and IN6ADDR_ANY_INIT are declared / defined */
#ifdef ANDROID_CHANGES
#include "resolv_netid.h"
static void res_setoptions __P((res_state, const char *, const char *));
+#ifdef RESOLVSORT
static const char sort_mask[] = "/&";
#define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL)
-static u_int32_t net_mask __P((struct in_addr));
+static uint32_t net_mask(struct in_addr);
+#endif
#if !defined(isascii) /* XXX - could be a function */
# define isascii(c) (!(c & 0200))
/* This function has to be reachable by res_data.c but not publicly. */
int
__res_vinit(res_state statp, int preinit) {
+#if !defined(__ANDROID__)
register FILE *fp;
+#endif
register char *cp, **pp;
+#if !defined(__ANDROID__)
register int n;
+#endif
char buf[BUFSIZ];
int nserv = 0; /* number of nameserver records read from file */
+#if !defined(__ANDROID__)
int haveenv = 0;
+#endif
int havesearch = 0;
+#ifdef RESOLVSORT
int nsort = 0;
+#endif
+#if !defined(__ANDROID__)
char *net;
+#endif
int dots;
union res_sockaddr_union u[2];
statp->nsort = 0;
res_setservers(statp, u, nserv);
-#if 0 /* IGNORE THE ENVIRONMENT */
+#if !defined(__ANDROID__) /* IGNORE THE ENVIRONMENT */
/* Allow user to override the local domain definition */
if ((cp = getenv("LOCALDOMAIN")) != NULL) {
(void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
}
}
+#ifdef RESOLVSORT
/* XXX - should really support CIDR which means explicit masks always. */
-static u_int32_t
-net_mask(in) /* XXX - should really use system's version of this */
- struct in_addr in;
+static uint32_t
+net_mask(struct in_addr in) /*!< XXX - should really use system's version of this */
{
- register u_int32_t i = ntohl(in.s_addr);
+ register uint32_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return (htonl(IN_CLASSA_NET));
return (htonl(IN_CLASSB_NET));
return (htonl(IN_CLASSC_NET));
}
+#endif
#ifdef ANDROID_CHANGES
static int
}
/* read from the random device, returning -1 on failure (or too many retries)*/
- u_int retry = 5;
- for (retry; retry > 0; retry--) {
+ for (u_int retry = 5; retry > 0; retry--) {
int retval = read(random_device, random_value, sizeof(u_int));
if (retval == sizeof(u_int)) {
*random_value &= 0xffff;
return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
}
-/*
+/*%
* This routine is for closing the socket if a virtual circuit is used and
* the program wants to close it. This provides support for endhostent()
* which expects to close the socket.
* This routine is not expected to be user visible.
*/
void
-res_nclose(res_state statp) {
+res_nclose(res_state statp)
+{
int ns;
if (statp->_vcsock >= 0) {
}
void
-res_ndestroy(res_state statp) {
+res_ndestroy(res_state statp)
+{
res_nclose(statp);
if (statp->_u._ext.ext != NULL)
free(statp->_u._ext.ext);
}
const char *
-res_get_nibblesuffix(res_state statp) {
+res_get_nibblesuffix(res_state statp)
+{
if (statp->_u._ext.ext)
return (statp->_u._ext.ext->nsuffix);
return ("ip6.arpa");
}
const char *
-res_get_nibblesuffix2(res_state statp) {
+res_get_nibblesuffix2(res_state statp)
+{
if (statp->_u._ext.ext)
return (statp->_u._ext.ext->nsuffix2);
return ("ip6.int");
}
void
-res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) {
+res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt)
+{
int i, nserv;
size_t size;
@@ -718,10 +731,8 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) {
if (size <= sizeof(statp->nsaddr_list[nserv]))
memcpy(&statp->nsaddr_list[nserv],
&set->sin, size);
-#ifdef notdef
else
statp->nsaddr_list[nserv].sin_family = 0;
-#endif
nserv++;
break;
@@ -750,10 +761,11 @@ res_setservers(res_state statp, const union res_sockaddr_union *set, int cnt) {
}
int
-res_getservers(res_state statp, union res_sockaddr_union *set, int cnt) {
+res_getservers(res_state statp, union res_sockaddr_union *set, int cnt)
+{
int i;
size_t size;
- u_int16_t family;
+ uint16_t family;
for (i = 0; i < statp->nscount && i < cnt; i++) {
if (statp->_u._ext.ext)
index b6a990abb8c179227ad582538da59ed5f4cafeab..4a010d53e9c0560b1d82bcddd45e3d55967615c3 100644 (file)
struct sockaddr_storage peer;
socklen_t size = sizeof peer;
unsigned old_mark;
- int mark_size = sizeof(old_mark);
+ socklen_t mark_size = sizeof(old_mark);
if (getpeername(statp->_vcsock,
(struct sockaddr *)(void *)&peer, &size) < 0 ||
!sock_eq((struct sockaddr *)(void *)&peer, nsap) ||