summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/asr/Makefile.inc34
-rw-r--r--lib/libc/asr/asr.c7
-rw-r--r--lib/libc/asr/asr.h92
-rw-r--r--lib/libc/asr/asr_debug.c5
-rw-r--r--lib/libc/asr/asr_run.35
-rw-r--r--lib/libc/asr/asr_utils.c5
-rw-r--r--lib/libc/asr/getaddrinfo.c7
-rw-r--r--lib/libc/asr/getaddrinfo_async.c6
-rw-r--r--lib/libc/asr/gethostnamadr.c7
-rw-r--r--lib/libc/asr/gethostnamadr_async.c5
-rw-r--r--lib/libc/asr/getnameinfo.c7
-rw-r--r--lib/libc/asr/getnameinfo_async.c5
-rw-r--r--lib/libc/asr/getnetnamadr.c7
-rw-r--r--lib/libc/asr/getnetnamadr_async.c5
-rw-r--r--lib/libc/asr/getrrsetbyname.c7
-rw-r--r--lib/libc/asr/getrrsetbyname_async.c9
-rw-r--r--lib/libc/asr/res_init.c6
-rw-r--r--lib/libc/asr/res_mkquery.c6
-rw-r--r--lib/libc/asr/res_query.c7
-rw-r--r--lib/libc/asr/res_search_async.c6
-rw-r--r--lib/libc/asr/res_send.c7
-rw-r--r--lib/libc/asr/res_send_async.c6
22 files changed, 93 insertions, 158 deletions
diff --git a/lib/libc/asr/Makefile.inc b/lib/libc/asr/Makefile.inc
index ffb3f3f0bd9..813ce2ed483 100644
--- a/lib/libc/asr/Makefile.inc
+++ b/lib/libc/asr/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.6 2013/08/08 06:55:42 jmc Exp $
+# $OpenBSD: Makefile.inc,v 1.7 2014/03/26 18:13:15 eric Exp $
# asr sources
.PATH: ${LIBCSRCDIR}/asr
@@ -8,19 +8,19 @@ SRCS+= asr.c asr_debug.c asr_utils.c \
gethostnamadr_async.c getnetnamadr_async.c \
getaddrinfo_async.c getnameinfo_async.c
-MLINKS+ = \
- asr_resolver.3 asr_resolver_done.3 \
- asr_resolver.3 asr_async_run.3 \
- asr_resolver.3 asr_async_run_sync.3 \
- asr_resolver.3 asr_async_abort.3 \
- asr_resolver.3 res_send_async.3 \
- asr_resolver.3 res_query_async.3 \
- asr_resolver.3 res_search_async.3 \
- asr_resolver.3 getrrsetbyname_async.3 \
- asr_resolver.3 gethostbyname_async.3 \
- asr_resolver.3 gethostbyname2_async.3 \
- asr_resolver.3 gethostbyaddr_async.3 \
- asr_resolver.3 getnetbyname_async.3 \
- asr_resolver.3 getnetbyaddr_async.3 \
- asr_resolver.3 getaddrinfo_async.3 \
- asr_resolver.3 getnameinfo_async.3
+MAN+= asr_run.3
+
+MLINKS+= \
+ asr_run.3 asr_run_sync.3 \
+ asr_run.3 asr_abort.3 \
+ asr_run.3 res_send_async.3 \
+ asr_run.3 res_query_async.3 \
+ asr_run.3 res_search_async.3 \
+ asr_run.3 getrrsetbyname_async.3 \
+ asr_run.3 gethostbyname_async.3 \
+ asr_run.3 gethostbyname2_async.3 \
+ asr_run.3 gethostbyaddr_async.3 \
+ asr_run.3 getnetbyname_async.3 \
+ asr_run.3 getnetbyaddr_async.3 \
+ asr_run.3 getaddrinfo_async.3 \
+ asr_run.3 getnameinfo_async.3
diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c
index 8edbf10a6d2..eceec10804f 100644
--- a/lib/libc/asr/asr.c
+++ b/lib/libc/asr/asr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr.c,v 1.32 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: asr.c,v 1.33 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2010-2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,15 +16,17 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
+#include <netdb.h>
+#include <asr.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
-#include <netdb.h>
#include <resolv.h>
#include <poll.h>
#include <stdio.h>
@@ -32,7 +34,6 @@
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
#ifndef ASR_OPT_THREADSAFE
diff --git a/lib/libc/asr/asr.h b/lib/libc/asr/asr.h
deleted file mode 100644
index 9a1d792220a..00000000000
--- a/lib/libc/asr/asr.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* $OpenBSD: asr.h,v 1.8 2014/03/25 19:48:11 eric Exp $ */
-/*
- * Copyright (c) 2012-2014 Eric Faurot <eric@openbsd.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-
-/*
- * Expected fd conditions
- */
-#define ASR_WANT_READ 1
-#define ASR_WANT_WRITE 2
-
-/*
- * Structure through which asynchronous query results are returned when
- * calling asr_run().
- */
-struct asr_result {
- /* Fields set if the query is not done yet (asr_run returns 0) */
- int ar_cond; /* ASR_WANT_READ or ASR_WANT_WRITE */
- int ar_fd; /* the fd waiting for io condition */
- int ar_timeout; /* time to wait for in milliseconds */
-
- /* Error fields. Depends on the query type. */
- int ar_errno;
- int ar_h_errno;
- int ar_gai_errno;
- int ar_rrset_errno;
-
- /* Result for res_*_async() calls */
- int ar_count; /* number of answers in the dns reply */
- int ar_rcode; /* response code in the dns reply */
- void *ar_data; /* raw reply packet (must be freed) */
- int ar_datalen; /* reply packet length */
- struct sockaddr_storage ar_ns; /* nameserver that responded */
-
- /* Result for other calls. Must be freed properly. */
- struct addrinfo *ar_addrinfo;
- struct rrsetinfo *ar_rrsetinfo;
- struct hostent *ar_hostent;
- struct netent *ar_netent;
-};
-
-/*
- * Asynchronous query management.
- */
-
-/* Forward declaration. The API uses opaque pointers as query handles. */
-struct asr_query;
-
-int asr_run(struct asr_query *, struct asr_result *);
-int asr_run_sync(struct asr_query *, struct asr_result *);
-void asr_abort(struct asr_query *);
-
-/*
- * Asynchronous version of the resolver functions. Similar prototypes, with
- * an extra context parameter at the end which must currently be set to NULL.
- * All functions return a handle suitable for use with the management functions
- * above.
- */
-struct asr_query *res_send_async(const unsigned char *, int, void *);
-struct asr_query *res_query_async(const char *, int, int, void *);
-struct asr_query *res_search_async(const char *, int, int, void *);
-
-struct asr_query *getrrsetbyname_async(const char *, unsigned int, unsigned int,
- unsigned int, void *);
-
-struct asr_query *gethostbyname_async(const char *, void *);
-struct asr_query *gethostbyname2_async(const char *, int, void *);
-struct asr_query *gethostbyaddr_async(const void *, socklen_t, int, void *);
-
-struct asr_query *getnetbyname_async(const char *, void *);
-struct asr_query *getnetbyaddr_async(in_addr_t, int, void *);
-
-struct asr_query *getaddrinfo_async(const char *, const char *,
- const struct addrinfo *, void *);
-struct asr_query *getnameinfo_async(const struct sockaddr *, socklen_t, char *,
- size_t, char *, size_t, int, void *);
diff --git a/lib/libc/asr/asr_debug.c b/lib/libc/asr/asr_debug.c
index cfab567704e..46d7310e880 100644
--- a/lib/libc/asr/asr_debug.c
+++ b/lib/libc/asr/asr_debug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr_debug.c,v 1.16 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: asr_debug.c,v 1.17 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -20,10 +20,11 @@
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
+#include <netdb.h>
+#include <asr.h>
#include <resolv.h>
-#include "asr.h"
#include "asr_private.h"
static const char *rcodetostr(uint16_t);
diff --git a/lib/libc/asr/asr_run.3 b/lib/libc/asr/asr_run.3
index 1327b36cae9..6f0f314c690 100644
--- a/lib/libc/asr/asr_run.3
+++ b/lib/libc/asr/asr_run.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: asr_run.3,v 1.1 2014/03/26 10:57:19 eric Exp $
+.\" $OpenBSD: asr_run.3,v 1.2 2014/03/26 18:13:15 eric Exp $
.\"
.\" Copyright (c) 2012-2014, Eric Faurot <eric@openbsd.org>
.\"
@@ -34,6 +34,9 @@
.Nm getnameinfo_async
.Nd asynchronous resolver functions
.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netdb.h
.In asr.h
.Ft int
.Fn asr_run "struct asr_query *aq" "struct asr_result *ar"
diff --git a/lib/libc/asr/asr_utils.c b/lib/libc/asr/asr_utils.c
index 7a9d15663f7..2d90f1c8fb4 100644
--- a/lib/libc/asr/asr_utils.c
+++ b/lib/libc/asr/asr_utils.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asr_utils.c,v 1.11 2014/03/14 11:07:33 eric Exp $ */
+/* $OpenBSD: asr_utils.c,v 1.12 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2009-2012 Eric Faurot <eric@faurot.net>
*
@@ -21,7 +21,9 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
+#include <netdb.h>
+#include <asr.h>
#include <ctype.h>
#include <errno.h>
#include <stdint.h>
@@ -30,7 +32,6 @@
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
static int dname_check_label(const char *, size_t);
diff --git a/lib/libc/asr/getaddrinfo.c b/lib/libc/asr/getaddrinfo.c
index 074a824c1be..f5080572163 100644
--- a/lib/libc/asr/getaddrinfo.c
+++ b/lib/libc/asr/getaddrinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo.c,v 1.4 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getaddrinfo.c,v 1.5 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,13 +16,14 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <asr.h>
#include <errno.h>
#include <resolv.h>
-#include "asr.h"
-
int
getaddrinfo(const char *hostname, const char *servname,
const struct addrinfo *hints, struct addrinfo **res)
diff --git a/lib/libc/asr/getaddrinfo_async.c b/lib/libc/asr/getaddrinfo_async.c
index bf7328803a5..1f1d19c74df 100644
--- a/lib/libc/asr/getaddrinfo_async.c
+++ b/lib/libc/asr/getaddrinfo_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getaddrinfo_async.c,v 1.25 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getaddrinfo_async.c,v 1.26 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,6 +16,7 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -26,7 +27,9 @@
#include <rpcsvc/ypclnt.h>
#include "ypinternal.h"
#endif
+#include <netdb.h>
+#include <asr.h>
#include <err.h>
#include <errno.h>
#include <resolv.h> /* for res_hnok */
@@ -34,7 +37,6 @@
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
struct match {
diff --git a/lib/libc/asr/gethostnamadr.c b/lib/libc/asr/gethostnamadr.c
index a7561f132e3..e07abadb443 100644
--- a/lib/libc/asr/gethostnamadr.c
+++ b/lib/libc/asr/gethostnamadr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gethostnamadr.c,v 1.10 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: gethostnamadr.c,v 1.11 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012,2013 Eric Faurot <eric@openbsd.org>
*
@@ -16,16 +16,17 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <asr.h>
#include <errno.h>
#include <resolv.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include "asr.h"
-
static int _gethostbyname(const char *, int, struct hostent *, char *, size_t,
int *);
static int _fillhostent(const struct hostent *, struct hostent *, char *,
diff --git a/lib/libc/asr/gethostnamadr_async.c b/lib/libc/asr/gethostnamadr_async.c
index 7d27be9eedb..674bcb476a9 100644
--- a/lib/libc/asr/gethostnamadr_async.c
+++ b/lib/libc/asr/gethostnamadr_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gethostnamadr_async.c,v 1.27 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: gethostnamadr_async.c,v 1.28 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -26,7 +26,9 @@
#include <rpcsvc/ypclnt.h>
#include "ypinternal.h"
#endif
+#include <netdb.h>
+#include <asr.h>
#include <ctype.h>
#include <err.h>
#include <errno.h>
@@ -35,7 +37,6 @@
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
#define MAXALIASES 16
diff --git a/lib/libc/asr/getnameinfo.c b/lib/libc/asr/getnameinfo.c
index 4ca82dae098..60b5b17ceb6 100644
--- a/lib/libc/asr/getnameinfo.c
+++ b/lib/libc/asr/getnameinfo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnameinfo.c,v 1.4 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getnameinfo.c,v 1.5 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,13 +16,14 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <asr.h>
#include <errno.h>
#include <resolv.h>
-#include "asr.h"
-
int
getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host,
size_t hostlen, char *serv, size_t servlen, int flags)
diff --git a/lib/libc/asr/getnameinfo_async.c b/lib/libc/asr/getnameinfo_async.c
index 6f8965c0b7c..50d65fc38bc 100644
--- a/lib/libc/asr/getnameinfo_async.c
+++ b/lib/libc/asr/getnameinfo_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnameinfo_async.c,v 1.8 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getnameinfo_async.c,v 1.9 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -21,14 +21,15 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
+#include <netdb.h>
+#include <asr.h>
#include <err.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
static int getnameinfo_async_run(struct asr_query *, struct asr_result *);
diff --git a/lib/libc/asr/getnetnamadr.c b/lib/libc/asr/getnetnamadr.c
index 07ed822d02d..f3b552ab059 100644
--- a/lib/libc/asr/getnetnamadr.c
+++ b/lib/libc/asr/getnetnamadr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnetnamadr.c,v 1.7 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getnetnamadr.c,v 1.8 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,15 +16,16 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <asr.h>
#include <errno.h>
#include <resolv.h>
#include <stdlib.h>
#include <string.h>
-#include "asr.h"
-
static void _fillnetent(const struct netent *, struct netent *, char *buf,
size_t);
diff --git a/lib/libc/asr/getnetnamadr_async.c b/lib/libc/asr/getnetnamadr_async.c
index 6a948a52cb5..ce3e8cf0526 100644
--- a/lib/libc/asr/getnetnamadr_async.c
+++ b/lib/libc/asr/getnetnamadr_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnetnamadr_async.c,v 1.13 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getnetnamadr_async.c,v 1.14 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -20,7 +20,9 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
+#include <netdb.h>
+#include <asr.h>
#include <err.h>
#include <errno.h>
#include <resolv.h> /* for res_hnok */
@@ -28,7 +30,6 @@
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
#define MAXALIASES 16
diff --git a/lib/libc/asr/getrrsetbyname.c b/lib/libc/asr/getrrsetbyname.c
index 359f1dd416b..424725ec30b 100644
--- a/lib/libc/asr/getrrsetbyname.c
+++ b/lib/libc/asr/getrrsetbyname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getrrsetbyname.c,v 1.4 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getrrsetbyname.c,v 1.5 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,14 +16,15 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <asr.h>
#include <errno.h>
#include <resolv.h>
#include <stdlib.h>
-#include "asr.h"
-
int
getrrsetbyname(const char *name, unsigned int class, unsigned int type,
unsigned int flags, struct rrsetinfo **res)
diff --git a/lib/libc/asr/getrrsetbyname_async.c b/lib/libc/asr/getrrsetbyname_async.c
index 3f23d7bf3cd..8bc81e628c0 100644
--- a/lib/libc/asr/getrrsetbyname_async.c
+++ b/lib/libc/asr/getrrsetbyname_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getrrsetbyname_async.c,v 1.6 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getrrsetbyname_async.c,v 1.7 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,19 +16,20 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
+#include <netdb.h>
+#include <asr.h>
#include <err.h>
#include <errno.h>
-#include <netdb.h>
#include <resolv.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
static int getrrsetbyname_async_run(struct asr_query *, struct asr_result *);
@@ -169,7 +170,7 @@ getrrsetbyname_async_run(struct asr_query *as, struct asr_result *ar)
/* The rest of this file is taken from the orignal implementation. */
-/* $OpenBSD: getrrsetbyname_async.c,v 1.6 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: getrrsetbyname_async.c,v 1.7 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2001 Jakob Schlyter. All rights reserved.
diff --git a/lib/libc/asr/res_init.c b/lib/libc/asr/res_init.c
index 9fa0529baab..309f779aac1 100644
--- a/lib/libc/asr/res_init.c
+++ b/lib/libc/asr/res_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_init.c,v 1.3 2014/01/15 02:25:34 sthen Exp $ */
+/* $OpenBSD: res_init.c,v 1.4 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,13 +16,15 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <arpa/nameser.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <asr.h>
#include <resolv.h>
#include <string.h>
-#include "asr.h"
#include "asr_private.h"
#include "thread_private.h"
diff --git a/lib/libc/asr/res_mkquery.c b/lib/libc/asr/res_mkquery.c
index 9f2aa0de883..27ed21e4d4a 100644
--- a/lib/libc/asr/res_mkquery.c
+++ b/lib/libc/asr/res_mkquery.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_mkquery.c,v 1.7 2014/03/14 11:07:33 eric Exp $ */
+/* $OpenBSD: res_mkquery.c,v 1.8 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,14 +16,16 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/nameser.h> /* for MAXDNAME */
+#include <netdb.h>
+#include <asr.h>
#include <errno.h>
#include <resolv.h>
#include <string.h>
-#include "asr.h"
#include "asr_private.h"
/* This function is apparently needed by some ports. */
diff --git a/lib/libc/asr/res_query.c b/lib/libc/asr/res_query.c
index 2c6b198e464..3cdec90b944 100644
--- a/lib/libc/asr/res_query.c
+++ b/lib/libc/asr/res_query.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_query.c,v 1.7 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: res_query.c,v 1.8 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,15 +16,16 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <asr.h>
#include <errno.h>
#include <resolv.h>
#include <string.h>
#include <stdlib.h>
-#include "asr.h"
-
int
res_query(const char *name, int class, int type, u_char *ans, int anslen)
{
diff --git a/lib/libc/asr/res_search_async.c b/lib/libc/asr/res_search_async.c
index f08557db527..d040655bc28 100644
--- a/lib/libc/asr/res_search_async.c
+++ b/lib/libc/asr/res_search_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_search_async.c,v 1.12 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: res_search_async.c,v 1.13 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,16 +16,18 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <arpa/nameser.h>
+#include <netdb.h>
+#include <asr.h>
#include <err.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
static int res_search_async_run(struct asr_query *, struct asr_result *);
diff --git a/lib/libc/asr/res_send.c b/lib/libc/asr/res_send.c
index b00510c4943..32c940815af 100644
--- a/lib/libc/asr/res_send.c
+++ b/lib/libc/asr/res_send.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_send.c,v 1.7 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: res_send.c,v 1.8 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,15 +16,16 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
+#include <netdb.h>
+#include <asr.h>
#include <errno.h>
#include <resolv.h>
#include <string.h>
#include <stdlib.h>
-#include "asr.h"
-
int
res_send(const u_char *buf, int buflen, u_char *ans, int anslen)
{
diff --git a/lib/libc/asr/res_send_async.c b/lib/libc/asr/res_send_async.c
index a9d4f696b11..9afc8d06363 100644
--- a/lib/libc/asr/res_send_async.c
+++ b/lib/libc/asr/res_send_async.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_send_async.c,v 1.21 2014/03/25 19:48:11 eric Exp $ */
+/* $OpenBSD: res_send_async.c,v 1.22 2014/03/26 18:13:15 eric Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@openbsd.org>
*
@@ -16,10 +16,13 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
#include <sys/uio.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
+#include <netdb.h>
+#include <asr.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -29,7 +32,6 @@
#include <string.h>
#include <unistd.h>
-#include "asr.h"
#include "asr_private.h"
#define OP_QUERY (0)