about summary refs log tree commit diff
path: root/src/network
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2018-09-12 00:08:09 -0400
committerRich Felker <dalias@aerifal.cx>2018-09-12 14:34:37 -0400
commit5ce3737931bb411a8d167356d4d0287b53b0cbdc (patch)
tree726fc5dde9cc462316faa715158c38f0da72292d /src/network
parent0676c3a34c7bf12b33f8f5efb92476f4ffc7f20e (diff)
downloadmusl-5ce3737931bb411a8d167356d4d0287b53b0cbdc.tar.gz
musl-5ce3737931bb411a8d167356d4d0287b53b0cbdc.tar.xz
musl-5ce3737931bb411a8d167356d4d0287b53b0cbdc.zip
reduce spurious inclusion of libc.h
libc.h was intended to be a header for access to global libc state and
related interfaces, but ended up included all over the place because
it was the way to get the weak_alias macro. most of the inclusions
removed here are places where weak_alias was needed. a few were
recently introduced for hidden. some go all the way back to when
libc.h defined CANCELPT_BEGIN and _END, and all (wrongly implemented)
cancellation points had to include it.

remaining spurious users are mostly callers of the LOCK/UNLOCK macros
and files that use the LFS64 macro to define the awful *64 aliases.

in a few places, new inclusion of libc.h is added because several
internal headers no longer implicitly include libc.h.

declarations for __lockfile and __unlockfile are moved from libc.h to
stdio_impl.h so that the latter does not need libc.h. putting them in
libc.h made no sense at all, since the macros in stdio_impl.h are
needed to use them correctly anyway.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/accept.c1
-rw-r--r--src/network/accept4.c1
-rw-r--r--src/network/connect.c1
-rw-r--r--src/network/dn_expand.c1
-rw-r--r--src/network/ent.c1
-rw-r--r--src/network/getnameinfo.c1
-rw-r--r--src/network/inet_aton.c2
-rw-r--r--src/network/lookup_serv.c1
-rw-r--r--src/network/recvfrom.c1
-rw-r--r--src/network/recvmsg.c1
-rw-r--r--src/network/res_mkquery.c1
-rw-r--r--src/network/res_query.c1
-rw-r--r--src/network/res_send.c1
-rw-r--r--src/network/resolvconf.c1
-rw-r--r--src/network/sendmsg.c1
-rw-r--r--src/network/sendto.c1
16 files changed, 4 insertions, 13 deletions
diff --git a/src/network/accept.c b/src/network/accept.c
index 521e9ef9..a92406fa 100644
--- a/src/network/accept.c
+++ b/src/network/accept.c
@@ -1,6 +1,5 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "libc.h"
 
 int accept(int fd, struct sockaddr *restrict addr, socklen_t *restrict len)
 {
diff --git a/src/network/accept4.c b/src/network/accept4.c
index 285d8588..59ab1726 100644
--- a/src/network/accept4.c
+++ b/src/network/accept4.c
@@ -3,7 +3,6 @@
 #include <errno.h>
 #include <fcntl.h>
 #include "syscall.h"
-#include "libc.h"
 
 int accept4(int fd, struct sockaddr *restrict addr, socklen_t *restrict len, int flg)
 {
diff --git a/src/network/connect.c b/src/network/connect.c
index 57f01a1e..289127be 100644
--- a/src/network/connect.c
+++ b/src/network/connect.c
@@ -1,6 +1,5 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "libc.h"
 
 int connect(int fd, const struct sockaddr *addr, socklen_t len)
 {
diff --git a/src/network/dn_expand.c b/src/network/dn_expand.c
index d9b33936..eac343af 100644
--- a/src/network/dn_expand.c
+++ b/src/network/dn_expand.c
@@ -1,5 +1,4 @@
 #include <resolv.h>
-#include "libc.h"
 
 int __dn_expand(const unsigned char *base, const unsigned char *end, const unsigned char *src, char *dest, int space)
 {
diff --git a/src/network/ent.c b/src/network/ent.c
index 5abea637..c6e01230 100644
--- a/src/network/ent.c
+++ b/src/network/ent.c
@@ -1,5 +1,4 @@
 #include <netdb.h>
-#include "libc.h"
 
 void sethostent(int x)
 {
diff --git a/src/network/getnameinfo.c b/src/network/getnameinfo.c
index 84f5ed6c..f77e73ad 100644
--- a/src/network/getnameinfo.c
+++ b/src/network/getnameinfo.c
@@ -2,6 +2,7 @@
 #include <limits.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
diff --git a/src/network/inet_aton.c b/src/network/inet_aton.c
index 0f9a45f6..c65f7c2c 100644
--- a/src/network/inet_aton.c
+++ b/src/network/inet_aton.c
@@ -2,7 +2,7 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include "libc.h"
+#include <stdlib.h>
 
 int __inet_aton(const char *s0, struct in_addr *dest)
 {
diff --git a/src/network/lookup_serv.c b/src/network/lookup_serv.c
index 403b12ae..ae382778 100644
--- a/src/network/lookup_serv.c
+++ b/src/network/lookup_serv.c
@@ -3,6 +3,7 @@
 #include <netdb.h>
 #include <ctype.h>
 #include <string.h>
+#include <stdlib.h>
 #include <fcntl.h>
 #include <errno.h>
 #include "lookup.h"
diff --git a/src/network/recvfrom.c b/src/network/recvfrom.c
index 436f3447..61911663 100644
--- a/src/network/recvfrom.c
+++ b/src/network/recvfrom.c
@@ -1,6 +1,5 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "libc.h"
 
 ssize_t recvfrom(int fd, void *restrict buf, size_t len, int flags, struct sockaddr *restrict addr, socklen_t *restrict alen)
 {
diff --git a/src/network/recvmsg.c b/src/network/recvmsg.c
index 4f526659..4ca7da8b 100644
--- a/src/network/recvmsg.c
+++ b/src/network/recvmsg.c
@@ -1,7 +1,6 @@
 #include <sys/socket.h>
 #include <limits.h>
 #include "syscall.h"
-#include "libc.h"
 
 ssize_t recvmsg(int fd, struct msghdr *msg, int flags)
 {
diff --git a/src/network/res_mkquery.c b/src/network/res_mkquery.c
index ec4568ac..6fa04a5c 100644
--- a/src/network/res_mkquery.c
+++ b/src/network/res_mkquery.c
@@ -1,7 +1,6 @@
 #include <resolv.h>
 #include <string.h>
 #include <time.h>
-#include "libc.h"
 
 int __res_mkquery(int op, const char *dname, int class, int type,
 	const unsigned char *data, int datalen,
diff --git a/src/network/res_query.c b/src/network/res_query.c
index 33543dcf..2f4da2e2 100644
--- a/src/network/res_query.c
+++ b/src/network/res_query.c
@@ -1,6 +1,5 @@
 #include <resolv.h>
 #include <netdb.h>
-#include "libc.h"
 
 int res_query(const char *name, int class, int type, unsigned char *dest, int len)
 {
diff --git a/src/network/res_send.c b/src/network/res_send.c
index 6facc1bd..b9cea0bf 100644
--- a/src/network/res_send.c
+++ b/src/network/res_send.c
@@ -1,5 +1,4 @@
 #include <resolv.h>
-#include "libc.h"
 
 int __res_send(const unsigned char *msg, int msglen, unsigned char *answer, int anslen)
 {
diff --git a/src/network/resolvconf.c b/src/network/resolvconf.c
index 4c3e4c4b..ceabf080 100644
--- a/src/network/resolvconf.c
+++ b/src/network/resolvconf.c
@@ -3,6 +3,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <string.h>
+#include <stdlib.h>
 #include <netinet/in.h>
 
 int __get_resolv_conf(struct resolvconf *conf, char *search, size_t search_sz)
diff --git a/src/network/sendmsg.c b/src/network/sendmsg.c
index 5f080007..80cc5f41 100644
--- a/src/network/sendmsg.c
+++ b/src/network/sendmsg.c
@@ -3,7 +3,6 @@
 #include <string.h>
 #include <errno.h>
 #include "syscall.h"
-#include "libc.h"
 
 ssize_t sendmsg(int fd, const struct msghdr *msg, int flags)
 {
diff --git a/src/network/sendto.c b/src/network/sendto.c
index 899eecff..c598797c 100644
--- a/src/network/sendto.c
+++ b/src/network/sendto.c
@@ -1,6 +1,5 @@
 #include <sys/socket.h>
 #include "syscall.h"
-#include "libc.h"
 
 ssize_t sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
 {