summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-07-07 07:27:44 +0000
committerEric Andersen <andersen@codepoet.org>2002-07-07 07:27:44 +0000
commit41fd2375c869daed4c5c90ee3ce902019ef70d57 (patch)
tree8c27de61518b0790928cf9bb944f5899306235b7 /libc
parent45f1824dc839fb6401cd6e061924a604438b2bed (diff)
Cleanup namespace leaks by prepending __ to global stuff to
indicate it is (alledgedly) private. -Erik
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/addr.c12
-rw-r--r--libc/inet/ntop.c9
-rw-r--r--libc/inet/resolv.c231
-rw-r--r--libc/inet/socketcalls.c36
-rw-r--r--libc/sysdeps/linux/common/syscalls.c5
5 files changed, 143 insertions, 150 deletions
diff --git a/libc/inet/addr.c b/libc/inet/addr.c
index 9abf7c44d..7751b6bc2 100644
--- a/libc/inet/addr.c
+++ b/libc/inet/addr.c
@@ -72,8 +72,7 @@ struct in_addr *inp;
#endif
#ifdef L_inet_addr
-unsigned long inet_addr(cp)
-const char *cp;
+unsigned long inet_addr(const char *cp)
{
struct in_addr a;
@@ -117,8 +116,7 @@ char *inet_ntoa(struct in_addr in)
* Formulate an Internet address from network + host. Used in
* building addresses stored in the ifnet structure.
*/
-struct in_addr inet_makeaddr(net, host)
-unsigned long net, host;
+struct in_addr inet_makeaddr(unsigned long net, unsigned long host)
{
unsigned long addr;
@@ -142,8 +140,7 @@ unsigned long net, host;
* internet address; handles class a/b/c network
* number formats.
*/
-unsigned long inet_lnaof(in)
-struct in_addr in;
+unsigned long inet_lnaof(struct in_addr in)
{
unsigned long i = ntohl(in.s_addr);
@@ -163,8 +160,7 @@ struct in_addr in;
* address; handles class a/b/c network #'s.
*/
u_int32_t
-inet_netof(in)
- struct in_addr in;
+inet_netof(struct in_addr in)
{
u_int32_t i = ntohl(in.s_addr);
diff --git a/libc/inet/ntop.c b/libc/inet/ntop.c
index 144e790b1..b7e831d49 100644
--- a/libc/inet/ntop.c
+++ b/libc/inet/ntop.c
@@ -54,10 +54,7 @@
* Paul Vixie, 1996.
*/
static const char *
-inet_ntop4(src, dst, size)
- const u_char *src;
- char *dst;
- size_t size;
+inet_ntop4(const u_char *src, char *dst, size_t size)
{
char tmp[sizeof ("255.255.255.255") + 1] = "\0";
int octet;
@@ -202,9 +199,7 @@ inet_ntop6(src, dst, size)
* Paul Vixie, 1996.
*/
static int
-inet_pton4(src, dst)
- const char *src;
- u_char *dst;
+inet_pton4(const char *src, u_char *dst)
{
int saw_digit, octets, ch;
u_char tmp[4], *tp;
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index 2033036f7..96feedbbe 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -84,10 +84,10 @@
/* Global stuff... */
-extern int nameservers;
-extern char * nameserver[MAX_SERVERS];
-extern int searchdomains;
-extern char * searchdomain[MAX_SEARCH];
+extern int __nameservers;
+extern char * __nameserver[MAX_SERVERS];
+extern int __searchdomains;
+extern char * __searchdomain[MAX_SEARCH];
@@ -124,47 +124,47 @@ enum etc_hosts_action {
};
/* function prototypes */
-extern int get_hosts_byname_r(const char * name, int type,
+extern int __get_hosts_byname_r(const char * name, int type,
struct hostent * result_buf,
char * buf, size_t buflen,
struct hostent ** result,
int * h_errnop);
-extern int get_hosts_byaddr_r(const char * addr, int len, int type,
+extern int __get_hosts_byaddr_r(const char * addr, int len, int type,
struct hostent * result_buf,
char * buf, size_t buflen,
struct hostent ** result,
int * h_errnop);
extern void __open_etc_hosts(FILE **fp);
-extern int read_etc_hosts_r(FILE *fp, const char * name, int type,
+extern int __read_etc_hosts_r(FILE *fp, const char * name, int type,
enum etc_hosts_action action,
struct hostent * result_buf,
char * buf, size_t buflen,
struct hostent ** result,
int * h_errnop);
-extern int connect_dns(char *dns);
-extern int dns_lookup(const char * name, int type, int nscount,
+extern int __connect_dns(char *dns);
+extern int __dns_lookup(const char * name, int type, int nscount,
char ** nsip, unsigned char ** outpacket, struct resolv_answer * a);
-extern int encode_dotted(const char * dotted, unsigned char * dest, int maxlen);
-extern int decode_dotted(const unsigned char * message, int offset,
+extern int __encode_dotted(const char * dotted, unsigned char * dest, int maxlen);
+extern int __decode_dotted(const unsigned char * message, int offset,
char * dest, int maxlen);
-extern int length_dotted(const unsigned char * message, int offset);
-extern int encode_header(struct resolv_header * h, unsigned char * dest, int maxlen);
-extern int decode_header(unsigned char * data, struct resolv_header * h);
-extern int encode_question(struct resolv_question * q,
+extern int __length_dotted(const unsigned char * message, int offset);
+extern int __encode_header(struct resolv_header * h, unsigned char * dest, int maxlen);
+extern int __decode_header(unsigned char * data, struct resolv_header * h);
+extern int __encode_question(struct resolv_question * q,
unsigned char * dest, int maxlen);
-extern int decode_question(unsigned char * message, int offset,
+extern int __decode_question(unsigned char * message, int offset,
struct resolv_question * q);
-extern int encode_answer(struct resolv_answer * a,
+extern int __encode_answer(struct resolv_answer * a,
unsigned char * dest, int maxlen);
-extern int decode_answer(unsigned char * message, int offset,
+extern int __decode_answer(unsigned char * message, int offset,
struct resolv_answer * a);
-extern int length_question(unsigned char * message, int offset);
-extern int open_nameservers(void);
+extern int __length_question(unsigned char * message, int offset);
+extern int __open_nameservers(void);
#ifdef L_encodeh
-int encode_header(struct resolv_header *h, unsigned char *dest, int maxlen)
+int __encode_header(struct resolv_header *h, unsigned char *dest, int maxlen)
{
if (maxlen < HFIXEDSZ)
return -1;
@@ -191,7 +191,7 @@ int encode_header(struct resolv_header *h, unsigned char *dest, int maxlen)
#endif
#ifdef L_decodeh
-int decode_header(unsigned char *data, struct resolv_header *h)
+int __decode_header(unsigned char *data, struct resolv_header *h)
{
h->id = (data[0] << 8) | data[1];
h->qr = (data[2] & 0x80) ? 1 : 0;
@@ -215,7 +215,7 @@ int decode_header(unsigned char *data, struct resolv_header *h)
This routine is fairly dumb, and doesn't attempt to compress
the data */
-int encode_dotted(const char *dotted, unsigned char *dest, int maxlen)
+int __encode_dotted(const char *dotted, unsigned char *dest, int maxlen)
{
int used = 0;
@@ -249,7 +249,7 @@ int encode_dotted(const char *dotted, unsigned char *dest, int maxlen)
/* Decode a dotted string from nameserver transport-level encoding.
This routine understands compressed data. */
-int decode_dotted(const unsigned char *data, int offset,
+int __decode_dotted(const unsigned char *data, int offset,
char *dest, int maxlen)
{
int l;
@@ -295,7 +295,7 @@ int decode_dotted(const unsigned char *data, int offset,
#ifdef L_lengthd
-int length_dotted(const unsigned char *data, int offset)
+int __length_dotted(const unsigned char *data, int offset)
{
int orig_offset = offset;
int l;
@@ -318,12 +318,12 @@ int length_dotted(const unsigned char *data, int offset)
#endif
#ifdef L_encodeq
-int encode_question(struct resolv_question *q,
+int __encode_question(struct resolv_question *q,
unsigned char *dest, int maxlen)
{
int i;
- i = encode_dotted(q->dotted, dest, maxlen);
+ i = __encode_dotted(q->dotted, dest, maxlen);
if (i < 0)
return i;
@@ -343,13 +343,13 @@ int encode_question(struct resolv_question *q,
#endif
#ifdef L_decodeq
-int decode_question(unsigned char *message, int offset,
+int __decode_question(unsigned char *message, int offset,
struct resolv_question *q)
{
char temp[256];
int i;
- i = decode_dotted(message, offset, temp, sizeof(temp));
+ i = __decode_dotted(message, offset, temp, sizeof(temp));
if (i < 0)
return i;
@@ -364,11 +364,11 @@ int decode_question(unsigned char *message, int offset,
#endif
#ifdef L_lengthq
-int length_question(unsigned char *message, int offset)
+int __length_question(unsigned char *message, int offset)
{
int i;
- i = length_dotted(message, offset);
+ i = __length_dotted(message, offset);
if (i < 0)
return i;
@@ -377,11 +377,11 @@ int length_question(unsigned char *message, int offset)
#endif
#ifdef L_encodea
-int encode_answer(struct resolv_answer *a, unsigned char *dest, int maxlen)
+int __encode_answer(struct resolv_answer *a, unsigned char *dest, int maxlen)
{
int i;
- i = encode_dotted(a->dotted, dest, maxlen);
+ i = __encode_dotted(a->dotted, dest, maxlen);
if (i < 0)
return i;
@@ -408,13 +408,13 @@ int encode_answer(struct resolv_answer *a, unsigned char *dest, int maxlen)
#endif
#ifdef L_decodea
-int decode_answer(unsigned char *message, int offset,
+int __decode_answer(unsigned char *message, int offset,
struct resolv_answer *a)
{
char temp[256];
int i;
- i = decode_dotted(message, offset, temp, sizeof(temp));
+ i = __decode_dotted(message, offset, temp, sizeof(temp));
if (i < 0)
return i;
@@ -440,7 +440,7 @@ int decode_answer(unsigned char *message, int offset,
#endif
#ifdef L_encodep
-int encode_packet(struct resolv_header *h,
+int __encode_packet(struct resolv_header *h,
struct resolv_question **q,
struct resolv_answer **an,
struct resolv_answer **ns,
@@ -450,7 +450,7 @@ int encode_packet(struct resolv_header *h,
int i, total = 0;
int j;
- i = encode_header(h, dest, maxlen);
+ i = __encode_header(h, dest, maxlen);
if (i < 0)
return i;
@@ -459,7 +459,7 @@ int encode_packet(struct resolv_header *h,
total += i;
for (j = 0; j < h->qdcount; j++) {
- i = encode_question(q[j], dest, maxlen);
+ i = __encode_question(q[j], dest, maxlen);
if (i < 0)
return i;
dest += i;
@@ -468,7 +468,7 @@ int encode_packet(struct resolv_header *h,
}
for (j = 0; j < h->ancount; j++) {
- i = encode_answer(an[j], dest, maxlen);
+ i = __encode_answer(an[j], dest, maxlen);
if (i < 0)
return i;
dest += i;
@@ -476,7 +476,7 @@ int encode_packet(struct resolv_header *h,
total += i;
}
for (j = 0; j < h->nscount; j++) {
- i = encode_answer(ns[j], dest, maxlen);
+ i = __encode_answer(ns[j], dest, maxlen);
if (i < 0)
return i;
dest += i;
@@ -484,7 +484,7 @@ int encode_packet(struct resolv_header *h,
total += i;
}
for (j = 0; j < h->arcount; j++) {
- i = encode_answer(ar[j], dest, maxlen);
+ i = __encode_answer(ar[j], dest, maxlen);
if (i < 0)
return i;
dest += i;
@@ -497,14 +497,14 @@ int encode_packet(struct resolv_header *h,
#endif
#ifdef L_decodep
-int decode_packet(unsigned char *data, struct resolv_header *h)
+int __decode_packet(unsigned char *data, struct resolv_header *h)
{
- return decode_header(data, h);
+ return __decode_header(data, h);
}
#endif
#ifdef L_formquery
-int form_query(int id, const char *name, int type, unsigned char *packet,
+int __form_query(int id, const char *name, int type, unsigned char *packet,
int maxlen)
{
struct resolv_header h;
@@ -519,11 +519,11 @@ int form_query(int id, const char *name, int type, unsigned char *packet,
q.qtype = type;
q.qclass = C_IN; /* CLASS_IN */
- i = encode_header(&h, packet, maxlen);
+ i = __encode_header(&h, packet, maxlen);
if (i < 0)
return i;
- j = encode_question(&q, packet + i, maxlen - i);
+ j = __encode_question(&q, packet + i, maxlen - i);
if (j < 0)
return j;
@@ -531,8 +531,8 @@ int form_query(int id, const char *name, int type, unsigned char *packet,
}
#endif
-#ifdef L_connect_dns
-int connect_dns(char *nsip)
+#ifdef L___connect_dns
+int __connect_dns(char *nsip)
{
int fd, rc;
struct sockaddr_in sa;
@@ -582,13 +582,13 @@ static pthread_mutex_t mylock = PTHREAD_MUTEX_INITIALIZER;
# define UNLOCK
#endif
-/* Just for the record, having to lock dns_lookup() just for these two globals
+/* Just for the record, having to lock __dns_lookup() just for these two globals
* is pretty lame. I think these two variables can probably be de-global-ized,
* which should eliminate the need for doing locking here... Needs a closer
* look anyways. */
static int ns=0, id=1;
-int dns_lookup(const char *name, int type, int nscount, char **nsip,
+int __dns_lookup(const char *name, int type, int nscount, char **nsip,
unsigned char **outpacket, struct resolv_answer *a)
{
int i, j, len, fd, pos;
@@ -624,22 +624,22 @@ int dns_lookup(const char *name, int type, int nscount, char **nsip,
DPRINTF("encoding header\n", h.rd);
- i = encode_header(&h, packet, PACKETSZ);
+ i = __encode_header(&h, packet, PACKETSZ);
if (i < 0)
goto fail;
strncpy(lookup,name,MAXDNAME);
- if (variant < searchdomains && strchr(lookup, '.') == NULL)
+ if (variant < __searchdomains && strchr(lookup, '.') == NULL)
{
strncat(lookup,".", MAXDNAME);
- strncat(lookup,searchdomain[variant], MAXDNAME);
+ strncat(lookup,__searchdomain[variant], MAXDNAME);
}
DPRINTF("lookup name: %s\n", lookup);
q.dotted = (char *)lookup;
q.qtype = type;
q.qclass = C_IN; /* CLASS_IN */
- j = encode_question(&q, packet+i, PACKETSZ-i);
+ j = __encode_question(&q, packet+i, PACKETSZ-i);
if (j < 0)
goto fail;
@@ -648,7 +648,7 @@ int dns_lookup(const char *name, int type, int nscount, char **nsip,
DPRINTF("On try %d, sending query to port %d of machine %s\n",
retries, NAMESERVER_PORT, nsip[ns]);
- fd = connect_dns(nsip[ns]);
+ fd = __connect_dns(nsip[ns]);
if (fd < 0) {
if (errno == ENETUNREACH) {
/* routing error, presume not transient */
@@ -680,7 +680,7 @@ int dns_lookup(const char *name, int type, int nscount, char **nsip,
/* too short ! */
goto again;
- decode_header(packet, &h);
+ __decode_header(packet, &h);
DPRINTF("id = %d, qr = %d\n", h.id, h.qr);
@@ -703,7 +703,7 @@ int dns_lookup(const char *name, int type, int nscount, char **nsip,
for (j = 0; j < h.qdcount; j++) {
DPRINTF("Skipping question %d at %d\n", j, pos);
- i = length_question(packet, pos);
+ i = __length_question(packet, pos);
DPRINTF("Length of question %d is %d\n", j, i);
if (i < 0)
goto again;
@@ -713,7 +713,7 @@ int dns_lookup(const char *name, int type, int nscount, char **nsip,
for (j=0;j<h.ancount;j++)
{
- i = decode_answer(packet, pos, a);
+ i = __decode_answer(packet, pos, a);
if (i<0) {
DPRINTF("failed decode %d\n", i);
@@ -745,12 +745,12 @@ int dns_lookup(const char *name, int type, int nscount, char **nsip,
/* if there are other nameservers, give them a go,
otherwise return with error */
variant = 0;
- if (retries >= nscount*(searchdomains+1))
+ if (retries >= nscount*(__searchdomains+1))
goto fail;
again:
/* if there are searchdomains, try them or fallback as passed */
- if (variant < searchdomains) {
+ if (variant < __searchdomains) {
/* next search */
variant++;
} else {
@@ -774,17 +774,17 @@ fail:
#ifdef L_opennameservers
-int nameservers;
-char * nameserver[MAX_SERVERS];
-int searchdomains;
-char * searchdomain[MAX_SEARCH];
+int __nameservers;
+char * __nameserver[MAX_SERVERS];
+int __searchdomains;
+char * __searchdomain[MAX_SEARCH];
/*
* we currently read formats not quite the same as that on normal
* unix systems, we can have a list of nameservers after the keyword.
*/
-int open_nameservers()
+int __open_nameservers()
{
FILE *fp;
int i;
@@ -792,7 +792,7 @@ int open_nameservers()
char szBuffer[128], *p, *argv[RESOLV_ARGS];
int argc;
- if (nameservers > 0)
+ if (__nameservers > 0)
return 0;
if ((fp = fopen("/etc/resolv.conf", "r")) ||
@@ -814,20 +814,20 @@ int open_nameservers()
}
if (strcmp(argv[0], "nameserver") == 0) {
- for (i = 1; i < argc && nameservers < MAX_SERVERS; i++) {
- nameserver[nameservers++] = strdup(argv[i]);
+ for (i = 1; i < argc && __nameservers < MAX_SERVERS; i++) {
+ __nameserver[__nameservers++] = strdup(argv[i]);
DPRINTF("adding nameserver %s\n", argv[i]);
}
}
/* domain and search are mutually exclusive, the last one wins */
if (strcmp(argv[0],"domain")==0 || strcmp(argv[0],"search")==0) {
- while (searchdomains > 0) {
- free(searchdomain[--searchdomains]);
- searchdomain[searchdomains] = NULL;
+ while (__searchdomains > 0) {
+ free(__searchdomain[--__searchdomains]);
+ __searchdomain[__searchdomains] = NULL;
}
- for (i=1; i < argc && searchdomains < MAX_SEARCH; i++) {
- searchdomain[searchdomains++] = strdup(argv[i]);
+ for (i=1; i < argc && __searchdomains < MAX_SEARCH; i++) {
+ __searchdomain[__searchdomains++] = strdup(argv[i]);
DPRINTF("adding search %s\n", argv[i]);
}
}
@@ -836,7 +836,7 @@ int open_nameservers()
} else {
DPRINTF("failed to open %s\n", "resolv.conf");
}
- DPRINTF("nameservers = %d\n", nameservers);
+ DPRINTF("nameservers = %d\n", __nameservers);
return 0;
}
#endif
@@ -844,15 +844,15 @@ int open_nameservers()
#ifdef L_closenameservers
-void close_nameservers(void)
+void __close_nameservers(void)
{
- while (nameservers > 0) {
- free(nameserver[--nameservers]);
- nameserver[nameservers] = NULL;
+ while (__nameservers > 0) {
+ free(__nameserver[--__nameservers]);
+ __nameserver[__nameservers] = NULL;
}
- while (searchdomains > 0) {
- free(searchdomain[--searchdomains]);
- searchdomain[searchdomains] = NULL;
+ while (__searchdomains > 0) {
+ free(__searchdomain[--__searchdomains]);
+ __searchdomain[__searchdomains] = NULL;
}
}
#endif
@@ -926,7 +926,7 @@ int res_init(void)
__res = rp;
}
- (void) open_nameservers();
+ __open_nameservers();
rp->retrans = RES_TIMEOUT;
rp->retry = 4;
rp->options = RES_INIT;
@@ -942,25 +942,25 @@ int res_init(void)
/** rp->rhook = NULL; **/
/** rp->_u._ext.nsinit = 0; **/
- if(searchdomains) {
+ if(__searchdomains) {
int i;
- for(i=0; i<searchdomains; i++) {
- rp->dnsrch[i] = searchdomain[i];
+ for(i=0; i<__searchdomains; i++) {
+ rp->dnsrch[i] = __searchdomain[i];
}
}
- if(nameservers) {
+ if(__nameservers) {
int i;
struct in_addr a;
- for(i=0; i<nameservers; i++) {
- if (inet_aton(nameserver[i], &a)) {
+ for(i=0; i<__nameservers; i++) {
+ if (inet_aton(__nameserver[i], &a)) {
rp->nsaddr_list[i].sin_addr = a;
rp->nsaddr_list[i].sin_family = AF_INET;
rp->nsaddr_list[i].sin_port = htons(NAMESERVER_PORT);
}
}
}
- rp->nscount = nameservers;
+ rp->nscount = __nameservers;
return(0);
}
@@ -998,14 +998,14 @@ int res_query(const char *dname, int class, int type,
struct resolv_answer a;
int i;
- open_nameservers();
+ __open_nameservers();
if (!dname || class != 1 /* CLASS_IN */)
return(-1);
memset((char *) &a, '\0', sizeof(a));
- i = dns_lookup(dname, type, nameservers, nameserver, &packet, &a);
+ i = __dns_lookup(dname, type, __nameservers, __nameserver, &packet, &a);
if (i < 0)
return(-1);
@@ -1046,7 +1046,7 @@ struct hostent *gethostbyaddr (const void *addr, socklen_t len, int type)
#endif
-#ifdef L_read_etc_hosts_r
+#ifdef L___read_etc_hosts_r
void __open_etc_hosts(FILE **fp)
{
@@ -1056,7 +1056,7 @@ void __open_etc_hosts(FILE **fp)
return;
}
-int read_etc_hosts_r(FILE * fp, const char * name, int type,
+int __read_etc_hosts_r(FILE * fp, const char * name, int type,
enum etc_hosts_action action,
struct hostent * result_buf,
char * buf, size_t buflen,
@@ -1253,7 +1253,7 @@ struct hostent *gethostent (void)
}
}
- read_etc_hosts_r(__gethostent_fp, NULL, AF_INET, GETHOSTENT,
+ __read_etc_hosts_r(__gethostent_fp, NULL, AF_INET, GETHOSTENT,
&h, buf, sizeof(buf), &host, &h_errno);
if (__stay_open==0) {
fclose(__gethostent_fp);
@@ -1263,21 +1263,21 @@ struct hostent *gethostent (void)
}
#endif
-#ifdef L_get_hosts_byname_r
+#ifdef L___get_hosts_byname_r
-int get_hosts_byname_r(const char * name, int type,
+int __get_hosts_byname_r(const char * name, int type,
struct hostent * result_buf,
char * buf, size_t buflen,
struct hostent ** result,
int * h_errnop)
{
- return(read_etc_hosts_r(NULL, name, type, GET_HOSTS_BYNAME, result_buf, buf, buflen, result, h_errnop));
+ return(__read_etc_hosts_r(NULL, name, type, GET_HOSTS_BYNAME, result_buf, buf, buflen, result, h_errnop));
}
#endif
-#ifdef L_get_hosts_byaddr_r
+#ifdef L___get_hosts_byaddr_r
-int get_hosts_byaddr_r(const char * addr, int len, int type,
+int __get_hosts_byaddr_r(const char * addr, int len, int type,
struct hostent * result_buf,
char * buf, size_t buflen,
struct hostent ** result,
@@ -1306,7 +1306,8 @@ int get_hosts_byaddr_r(const char * addr, int len, int type,
inet_ntop(type, addr, ipaddr, sizeof(ipaddr));
- return(read_etc_hosts_r(NULL, ipaddr, type, GET_HOSTS_BYADDR, result_buf, buf, buflen, result, h_errnop));
+ return(__read_etc_hosts_r(NULL, ipaddr, type, GET_HOSTS_BYADDR,
+ result_buf, buf, buflen, result, h_errnop));
}
#endif
@@ -1519,14 +1520,14 @@ int gethostbyname_r(const char * name,
int i;
int nest = 0;
- open_nameservers();
+ __open_nameservers();
*result=NULL;
if (!name)
return EINVAL;
/* do /etc/hosts first */
- if ((i=get_hosts_byname_r(name, AF_INET, result_buf,
+ if ((i=__get_hosts_byname_r(name, AF_INET, result_buf,
buf, buflen, result, h_errnop))==0)
return i;
switch (*h_errnop) {
@@ -1577,11 +1578,11 @@ int gethostbyname_r(const char * name,
for (;;) {
- i = dns_lookup(buf, T_A, nameservers, nameserver, &packet, &a);
+ i = __dns_lookup(buf, T_A, __nameservers, __nameserver, &packet, &a);
if (i < 0) {
*h_errnop = HOST_NOT_FOUND;
- DPRINTF("dns_lookup\n");
+ DPRINTF("__dns_lookup\n");
return TRY_AGAIN;
}
@@ -1590,12 +1591,12 @@ int gethostbyname_r(const char * name,
if (a.atype == T_CNAME) { /* CNAME */
DPRINTF("Got a CNAME in gethostbyname()\n");
- i = decode_dotted(packet, a.rdoffset, buf, buflen);
+ i = __decode_dotted(packet, a.rdoffset, buf, buflen);
free(packet);
if (i < 0) {
*h_errnop = NO_RECOVERY;
- DPRINTF("decode_dotted\n");
+ DPRINTF("__decode_dotted\n");
return -1;
}
if (++nest > MAX_RECURSE) {
@@ -1658,14 +1659,14 @@ int gethostbyname2_r(const char *name, int family,
if (family != AF_INET6)
return EINVAL;
- open_nameservers();
+ __open_nameservers();
*result=NULL;
if (!name)
return EINVAL;
/* do /etc/hosts first */
- if ((i=get_hosts_byname_r(name, family, result_buf,
+ if ((i=__get_hosts_byname_r(name, family, result_buf,
buf, buflen, result, h_errnop))==0)
return i;
switch (*h_errnop) {
@@ -1711,7 +1712,7 @@ int gethostbyname2_r(const char *name, int family,
for (;;) {
- i = dns_lookup(buf, T_AAAA, nameservers, nameserver, &packet, &a);
+ i = __dns_lookup(buf, T_AAAA, __nameservers, __nameserver, &packet, &a);
if (i < 0) {
*h_errnop = HOST_NOT_FOUND;
@@ -1723,7 +1724,7 @@ int gethostbyname2_r(const char *name, int family,
if (a.atype == T_CNAME) { /* CNAME */
DPRINTF("Got a CNAME in gethostbyname()\n");
- i = decode_dotted(packet, a.rdoffset, buf, buflen);
+ i = __decode_dotted(packet, a.rdoffset, buf, buflen);
free(packet);
if (i < 0) {
@@ -1797,7 +1798,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
}
/* do /etc/hosts first */
- if ((i=get_hosts_byaddr_r(addr, len, type, result_buf,
+ if ((i=__get_hosts_byaddr_r(addr, len, type, result_buf,
buf, buflen, result, h_errnop))==0)
return i;
switch (*h_errnop) {
@@ -1808,7 +1809,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
return i;
}
- open_nameservers();
+ __open_nameservers();
#ifdef __UCLIBC_HAS_IPV6__
qp=buf;
@@ -1878,7 +1879,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
for (;;) {
- i = dns_lookup(buf, T_PTR, nameservers, nameserver, &packet, &a);
+ i = __dns_lookup(buf, T_PTR, __nameservers, __nameserver, &packet, &a);
if (i < 0) {
*h_errnop = HOST_NOT_FOUND;
@@ -1890,7 +1891,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
if (a.atype == T_CNAME) { /* CNAME */
DPRINTF("Got a CNAME in gethostbyaddr()\n");
- i = decode_dotted(packet, a.rdoffset, buf, buflen);
+ i = __decode_dotted(packet, a.rdoffset, buf, buflen);
free(packet);
if (i < 0) {
@@ -1903,7 +1904,7 @@ int gethostbyaddr_r (const void *addr, socklen_t len, int type,
}
continue;
} else if (a.atype == T_PTR) { /* ADDRESS */
- i = decode_dotted(packet, a.rdoffset, buf, buflen);
+ i = __decode_dotted(packet, a.rdoffset, buf, buflen);
free(packet);
result_buf->h_name = buf;
diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c
index 3701e6c71..770af49db 100644
--- a/libc/inet/socketcalls.c
+++ b/libc/inet/socketcalls.c
@@ -5,7 +5,7 @@
#include <sys/socket.h>
#ifdef __NR_socketcall
-extern int socketcall(int call, unsigned long *args);
+extern int __socketcall(int call, unsigned long *args);
/* Various socketcall numbers */
#define SYS_SOCKET 1
@@ -40,7 +40,7 @@ int __libc_accept(int s, struct sockaddr *addr, socklen_t * addrlen)
args[0] = s;
args[1] = (unsigned long) addr;
args[2] = (unsigned long) addrlen;
- return socketcall(SYS_ACCEPT, args);
+ return __socketcall(SYS_ACCEPT, args);
}
#endif
weak_alias(__libc_accept, accept);
@@ -57,7 +57,7 @@ int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen)
args[0] = sockfd;
args[1] = (unsigned long) myaddr;
args[2] = addrlen;
- return socketcall(SYS_BIND, args);
+ return __socketcall(SYS_BIND, args);
}
#endif
#endif
@@ -74,7 +74,7 @@ int __libc_connect(int sockfd, const struct sockaddr *saddr, socklen_t addrlen)
args[0] = sockfd;
args[1] = (unsigned long) saddr;
args[2] = addrlen;
- return socketcall(SYS_CONNECT, args);
+ return __socketcall(SYS_CONNECT, args);
}
#endif
weak_alias(__libc_connect, connect);
@@ -91,7 +91,7 @@ int getpeername(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
args[0] = sockfd;
args[1] = (unsigned long) addr;
args[2] = (unsigned long) paddrlen;
- return socketcall(SYS_GETPEERNAME, args);
+ return __socketcall(SYS_GETPEERNAME, args);
}
#endif
#endif
@@ -107,7 +107,7 @@ int getsockname(int sockfd, struct sockaddr *addr, socklen_t * paddrlen)
args[0] = sockfd;
args[1] = (unsigned long) addr;
args[2] = (unsigned long) paddrlen;
- return socketcall(SYS_GETSOCKNAME, args);
+ return __socketcall(SYS_GETSOCKNAME, args);
}
#endif
#endif
@@ -126,7 +126,7 @@ int getsockopt(int fd, int level, int optname, __ptr_t optval,
args[2] = optname;
args[3] = (unsigned long) optval;
args[4] = (unsigned long) optlen;
- return (socketcall(SYS_GETSOCKOPT, args));
+ return (__socketcall(SYS_GETSOCKOPT, args));
}
#endif
#endif
@@ -141,7 +141,7 @@ int listen(int sockfd, int backlog)
args[0] = sockfd;
args[1] = backlog;
- return socketcall(SYS_LISTEN, args);
+ return __socketcall(SYS_LISTEN, args);
}
#endif
#endif
@@ -160,7 +160,7 @@ ssize_t __libc_recv(int sockfd, __ptr_t buffer, size_t len, int flags)
args[1] = (unsigned long) buffer;
args[2] = len;
args[3] = flags;
- return (socketcall(SYS_RECV, args));
+ return (__socketcall(SYS_RECV, args));
}
#endif
weak_alias(__libc_recv, recv);
@@ -184,7 +184,7 @@ ssize_t __libc_recvfrom(int sockfd, __ptr_t buffer, size_t len, int flags,
args[3] = flags;
args[4] = (unsigned long) to;
args[5] = (unsigned long) tolen;
- return (socketcall(SYS_RECVFROM, args));
+ return (__socketcall(SYS_RECVFROM, args));
}
#endif
weak_alias(__libc_recvfrom, recvfrom);
@@ -202,7 +202,7 @@ ssize_t __libc_recvmsg(int sockfd, struct msghdr *msg, int flags)
args[0] = sockfd;
args[1] = (unsigned long) msg;
args[2] = flags;
- return (socketcall(SYS_RECVMSG, args));
+ return (__socketcall(SYS_RECVMSG, args));
}
#endif
weak_alias(__libc_recvmsg, recvmsg);
@@ -222,7 +222,7 @@ ssize_t __libc_send(int sockfd, const void *buffer, size_t len, int flags)
args[1] = (unsigned long) buffer;
args[2] = len;
args[3] = flags;
- return (socketcall(SYS_SEND, args));
+ return (__socketcall(SYS_SEND, args));
}
#endif
weak_alias(__libc_send, send);
@@ -240,7 +240,7 @@ ssize_t __libc_sendmsg(int sockfd, const struct msghdr *msg, int flags)
args[0] = sockfd;
args[1] = (unsigned long) msg;
args[2] = flags;
- return (socketcall(SYS_SENDMSG, args));
+ return (__socketcall(SYS_SENDMSG, args));
}
#endif
weak_alias(__libc_sendmsg, sendmsg);
@@ -264,7 +264,7 @@ ssize_t __libc_sendto(int sockfd, const void *buffer, size_t len, int flags,
args[3] = flags;
args[4] = (unsigned long) to;
args[5] = tolen;
- return (socketcall(SYS_SENDTO, args));
+ return (__socketcall(SYS_SENDTO, args));
}
#endif
weak_alias(__libc_sendto, sendto);
@@ -285,7 +285,7 @@ int setsockopt(int fd, int level, int optname, const void *optval,
args[2] = optname;
args[3] = (unsigned long) optval;
args[4] = optlen;
- return (socketcall(SYS_SETSOCKOPT, args));
+ return (__socketcall(SYS_SETSOCKOPT, args));
}
#endif
#endif
@@ -301,7 +301,7 @@ int shutdown(int sockfd, int how)
args[0] = sockfd;
args[1] = how;
- return (socketcall(SYS_SHUTDOWN, args));
+ return (__socketcall(SYS_SHUTDOWN, args));
}
#endif
#endif
@@ -317,7 +317,7 @@ int socket(int family, int type, int protocol)
args[0] = family;
args[1] = type;
args[2] = (unsigned long) protocol;
- return socketcall(SYS_SOCKET, args);
+ return __socketcall(SYS_SOCKET, args);
}
#endif
#endif
@@ -334,7 +334,7 @@ int socketpair(int family, int type, int protocol, int sockvec[2])
args[1] = type;
args[2] = protocol;
args[3] = (unsigned long) sockvec;
- return socketcall(SYS_SOCKETPAIR, args);
+ return __socketcall(SYS_SOCKETPAIR, args);
}
#endif
#endif
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index 487df4adb..ce1bffe26 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -936,9 +936,10 @@ _syscall2(int, fstatfs, int, fd, struct statfs *, buf);
#endif
//#define __NR_socketcall 102
-#ifdef L_socketcall
+#ifdef L___socketcall
#ifdef __NR_socketcall
-_syscall2(int, socketcall, int, call, unsigned long *, args);
+#define __NR___socketcall __NR_socketcall
+_syscall2(int, __socketcall, int, call, unsigned long *, args);
#endif
#endif