summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/aio/aio.c1
-rw-r--r--src/aio/aio_suspend.c1
-rw-r--r--src/aio/lio_listio.c1
-rw-r--r--src/conf/sysconf.c1
-rw-r--r--src/crypt/crypt_r.c1
-rw-r--r--src/ctype/isalnum.c1
-rw-r--r--src/ctype/isalpha.c1
-rw-r--r--src/ctype/isblank.c1
-rw-r--r--src/ctype/iscntrl.c1
-rw-r--r--src/ctype/isdigit.c1
-rw-r--r--src/ctype/isgraph.c1
-rw-r--r--src/ctype/islower.c1
-rw-r--r--src/ctype/isprint.c1
-rw-r--r--src/ctype/ispunct.c1
-rw-r--r--src/ctype/isspace.c1
-rw-r--r--src/ctype/isupper.c1
-rw-r--r--src/ctype/iswalnum.c1
-rw-r--r--src/ctype/iswalpha.c1
-rw-r--r--src/ctype/iswblank.c1
-rw-r--r--src/ctype/iswcntrl.c1
-rw-r--r--src/ctype/iswctype.c1
-rw-r--r--src/ctype/iswdigit.c1
-rw-r--r--src/ctype/iswgraph.c1
-rw-r--r--src/ctype/iswlower.c1
-rw-r--r--src/ctype/iswprint.c1
-rw-r--r--src/ctype/iswpunct.c1
-rw-r--r--src/ctype/iswspace.c1
-rw-r--r--src/ctype/iswupper.c1
-rw-r--r--src/ctype/iswxdigit.c1
-rw-r--r--src/ctype/isxdigit.c1
-rw-r--r--src/ctype/tolower.c1
-rw-r--r--src/ctype/toupper.c1
-rw-r--r--src/ctype/towctrans.c2
-rw-r--r--src/ctype/wctrans.c1
-rw-r--r--src/dirent/closedir.c2
-rw-r--r--src/env/__environ.c2
-rw-r--r--src/env/clearenv.c1
-rw-r--r--src/env/getenv.c1
-rw-r--r--src/env/putenv.c1
-rw-r--r--src/env/unsetenv.c1
-rw-r--r--src/errno/strerror.c1
-rw-r--r--src/fcntl/fcntl.c1
-rw-r--r--src/fenv/fesetround.c2
-rw-r--r--src/fenv/m68k/fenv.c2
-rw-r--r--src/fenv/powerpc64/fenv.c2
-rw-r--r--src/fenv/s390x/fenv.c2
-rw-r--r--src/internal/dynlink.h2
-rw-r--r--src/internal/fdpic_crt.h2
-rw-r--r--src/internal/libc.h2
-rw-r--r--src/internal/malloc_impl.h1
-rw-r--r--src/internal/sh/__shcall.c2
-rw-r--r--src/internal/stdio_impl.h4
-rw-r--r--src/internal/syscall.h2
-rw-r--r--src/ipc/msgrcv.c1
-rw-r--r--src/ipc/msgsnd.c1
-rw-r--r--src/ldso/__dlsym.c1
-rw-r--r--src/ldso/dladdr.c1
-rw-r--r--src/ldso/dlclose.c1
-rw-r--r--src/ldso/dlerror.c1
-rw-r--r--src/ldso/dlinfo.c1
-rw-r--r--src/ldso/dlopen.c1
-rw-r--r--src/ldso/tlsdesc.c1
-rw-r--r--src/legacy/euidaccess.c1
-rw-r--r--src/legacy/utmpx.c1
-rw-r--r--src/linux/cache.c1
-rw-r--r--src/linux/getdents.c2
-rw-r--r--src/linux/setfsgid.c1
-rw-r--r--src/linux/setfsuid.c1
-rw-r--r--src/linux/sysinfo.c1
-rw-r--r--src/linux/x32/sysinfo.c1
-rw-r--r--src/locale/__lctrans.c1
-rw-r--r--src/locale/dcngettext.c1
-rw-r--r--src/locale/freelocale.c1
-rw-r--r--src/locale/langinfo.c1
-rw-r--r--src/locale/newlocale.c1
-rw-r--r--src/locale/strcoll.c1
-rw-r--r--src/locale/strxfrm.c1
-rw-r--r--src/locale/textdomain.c2
-rw-r--r--src/locale/wcscoll.c1
-rw-r--r--src/locale/wcsxfrm.c1
-rw-r--r--src/malloc/memalign.c1
-rw-r--r--src/math/exp10.c1
-rw-r--r--src/math/exp10f.c1
-rw-r--r--src/math/exp10l.c1
-rw-r--r--src/math/lgamma_r.c1
-rw-r--r--src/math/lgammaf_r.c1
-rw-r--r--src/math/lgammal.c1
-rw-r--r--src/math/remainder.c1
-rw-r--r--src/math/remainderf.c1
-rw-r--r--src/math/signgam.c1
-rw-r--r--src/misc/basename.c1
-rw-r--r--src/misc/getopt.c1
-rw-r--r--src/misc/pty.c1
-rw-r--r--src/mman/madvise.c1
-rw-r--r--src/mman/mremap.c1
-rw-r--r--src/mman/munmap.c1
-rw-r--r--src/multibyte/internal.h2
-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
-rw-r--r--src/passwd/pwf.h2
-rw-r--r--src/process/execvp.c1
-rw-r--r--src/process/posix_spawn.c1
-rw-r--r--src/process/system.c1
-rw-r--r--src/process/waitid.c1
-rw-r--r--src/process/waitpid.c1
-rw-r--r--src/search/hsearch.c1
-rw-r--r--src/select/poll.c1
-rw-r--r--src/select/pselect.c1
-rw-r--r--src/select/select.c1
-rw-r--r--src/signal/signal.c1
-rw-r--r--src/signal/sigsetjmp_tail.c1
-rw-r--r--src/signal/sigsuspend.c1
-rw-r--r--src/signal/sigtimedwait.c1
-rw-r--r--src/stat/futimesat.c1
-rw-r--r--src/stdio/__fdopen.c1
-rw-r--r--src/stdio/fclose.c2
-rw-r--r--src/stdio/fgetpos.c1
-rw-r--r--src/stdio/fmemopen.c2
-rw-r--r--src/stdio/fopen.c1
-rw-r--r--src/stdio/freopen.c1
-rw-r--r--src/stdio/fscanf.c1
-rw-r--r--src/stdio/fseek.c1
-rw-r--r--src/stdio/fsetpos.c1
-rw-r--r--src/stdio/ftell.c1
-rw-r--r--src/stdio/fwscanf.c1
-rw-r--r--src/stdio/getdelim.c1
-rw-r--r--src/stdio/open_memstream.c2
-rw-r--r--src/stdio/open_wmemstream.c2
-rw-r--r--src/stdio/scanf.c1
-rw-r--r--src/stdio/sscanf.c1
-rw-r--r--src/stdio/swscanf.c1
-rw-r--r--src/stdio/tmpfile.c1
-rw-r--r--src/stdio/vfprintf.c1
-rw-r--r--src/stdio/vfwprintf.c1
-rw-r--r--src/stdio/vfwscanf.c1
-rw-r--r--src/stdio/vscanf.c1
-rw-r--r--src/stdio/vsscanf.c1
-rw-r--r--src/stdio/vswprintf.c1
-rw-r--r--src/stdio/vswscanf.c1
-rw-r--r--src/stdio/vwscanf.c1
-rw-r--r--src/stdio/wscanf.c1
-rw-r--r--src/stdlib/strtod.c1
-rw-r--r--src/stdlib/strtol.c1
-rw-r--r--src/string/memrchr.c1
-rw-r--r--src/string/stpcpy.c1
-rw-r--r--src/string/stpncpy.c1
-rw-r--r--src/string/strcasecmp.c1
-rw-r--r--src/string/strchrnul.c1
-rw-r--r--src/string/strerror_r.c1
-rw-r--r--src/string/strlcpy.c1
-rw-r--r--src/string/strncasecmp.c1
-rw-r--r--src/string/wcsdup.c1
-rw-r--r--src/temp/mkostemps.c1
-rw-r--r--src/termios/cfsetospeed.c1
-rw-r--r--src/termios/tcdrain.c1
-rw-r--r--src/thread/__syscall_cp.c1
-rw-r--r--src/thread/__tls_get_addr.c1
-rw-r--r--src/thread/pthread_attr_setinheritsched.c1
-rw-r--r--src/thread/pthread_cancel.c1
-rw-r--r--src/thread/pthread_equal.c1
-rw-r--r--src/thread/pthread_self.c1
-rw-r--r--src/thread/pthread_testcancel.c1
-rw-r--r--src/thread/x32/syscall_cp_fixup.c2
-rw-r--r--src/time/asctime_r.c1
-rw-r--r--src/time/clock_gettime.c1
-rw-r--r--src/time/clock_nanosleep.c1
-rw-r--r--src/time/gmtime_r.c1
-rw-r--r--src/time/localtime_r.c2
-rw-r--r--src/time/nanosleep.c1
-rw-r--r--src/time/strftime.c1
-rw-r--r--src/time/wcsftime.c1
-rw-r--r--src/unistd/acct.c1
-rw-r--r--src/unistd/close.c1
-rw-r--r--src/unistd/dup3.c1
-rw-r--r--src/unistd/pause.c2
-rw-r--r--src/unistd/read.c1
-rw-r--r--src/unistd/readv.c1
-rw-r--r--src/unistd/write.c1
-rw-r--r--src/unistd/writev.c1
193 files changed, 43 insertions, 177 deletions
diff --git a/src/aio/aio.c b/src/aio/aio.c
index aafd8e8c..a5f64432 100644
--- a/src/aio/aio.c
+++ b/src/aio/aio.c
@@ -7,7 +7,6 @@
#include <stdlib.h>
#include "syscall.h"
#include "atomic.h"
-#include "libc.h"
#include "pthread_impl.h"
/* The following is a threads-based implementation of AIO with minimal
diff --git a/src/aio/aio_suspend.c b/src/aio/aio_suspend.c
index b269dd0f..0b3abe56 100644
--- a/src/aio/aio_suspend.c
+++ b/src/aio/aio_suspend.c
@@ -2,7 +2,6 @@
#include <errno.h>
#include <time.h>
#include "atomic.h"
-#include "libc.h"
#include "pthread_impl.h"
int aio_suspend(const struct aiocb *const cbs[], int cnt, const struct timespec *ts)
diff --git a/src/aio/lio_listio.c b/src/aio/lio_listio.c
index bd37767e..bd645464 100644
--- a/src/aio/lio_listio.c
+++ b/src/aio/lio_listio.c
@@ -3,7 +3,6 @@
#include <unistd.h>
#include <string.h>
#include "pthread_impl.h"
-#include "libc.h"
struct lio_state {
struct sigevent *sev;
diff --git a/src/conf/sysconf.c b/src/conf/sysconf.c
index 3baaed32..5199ed29 100644
--- a/src/conf/sysconf.c
+++ b/src/conf/sysconf.c
@@ -5,7 +5,6 @@
#include <signal.h>
#include <sys/sysinfo.h>
#include "syscall.h"
-#include "libc.h"
#define JT(x) (-256|(x))
#define VER JT(1)
diff --git a/src/crypt/crypt_r.c b/src/crypt/crypt_r.c
index 5789973b..db6015e2 100644
--- a/src/crypt/crypt_r.c
+++ b/src/crypt/crypt_r.c
@@ -1,5 +1,4 @@
#include <crypt.h>
-#include "libc.h"
char *__crypt_r(const char *key, const char *salt, struct crypt_data *data)
{
diff --git a/src/ctype/isalnum.c b/src/ctype/isalnum.c
index 2214936f..8018a2bc 100644
--- a/src/ctype/isalnum.c
+++ b/src/ctype/isalnum.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
int isalnum(int c)
{
diff --git a/src/ctype/isalpha.c b/src/ctype/isalpha.c
index f155d3aa..a87a9375 100644
--- a/src/ctype/isalpha.c
+++ b/src/ctype/isalpha.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
#undef isalpha
int isalpha(int c)
diff --git a/src/ctype/isblank.c b/src/ctype/isblank.c
index 299120e9..716da23a 100644
--- a/src/ctype/isblank.c
+++ b/src/ctype/isblank.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
int isblank(int c)
{
diff --git a/src/ctype/iscntrl.c b/src/ctype/iscntrl.c
index cb4114a0..f27837ea 100644
--- a/src/ctype/iscntrl.c
+++ b/src/ctype/iscntrl.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
int iscntrl(int c)
{
diff --git a/src/ctype/isdigit.c b/src/ctype/isdigit.c
index 4d8a103e..16beddb4 100644
--- a/src/ctype/isdigit.c
+++ b/src/ctype/isdigit.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
#undef isdigit
int isdigit(int c)
diff --git a/src/ctype/isgraph.c b/src/ctype/isgraph.c
index a0aae08a..292d1983 100644
--- a/src/ctype/isgraph.c
+++ b/src/ctype/isgraph.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
#undef isgraph
int isgraph(int c)
diff --git a/src/ctype/islower.c b/src/ctype/islower.c
index 02640213..c3fa74c4 100644
--- a/src/ctype/islower.c
+++ b/src/ctype/islower.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
#undef islower
int islower(int c)
diff --git a/src/ctype/isprint.c b/src/ctype/isprint.c
index 067275fa..b950816b 100644
--- a/src/ctype/isprint.c
+++ b/src/ctype/isprint.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
#undef isprint
int isprint(int c)
diff --git a/src/ctype/ispunct.c b/src/ctype/ispunct.c
index e772d76a..a491d5dc 100644
--- a/src/ctype/ispunct.c
+++ b/src/ctype/ispunct.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
int ispunct(int c)
{
diff --git a/src/ctype/isspace.c b/src/ctype/isspace.c
index 231e9079..428813e7 100644
--- a/src/ctype/isspace.c
+++ b/src/ctype/isspace.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
#undef isspace
int isspace(int c)
diff --git a/src/ctype/isupper.c b/src/ctype/isupper.c
index 68c36f4a..bfd15acd 100644
--- a/src/ctype/isupper.c
+++ b/src/ctype/isupper.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
#undef isupper
int isupper(int c)
diff --git a/src/ctype/iswalnum.c b/src/ctype/iswalnum.c
index a6082da4..046c399c 100644
--- a/src/ctype/iswalnum.c
+++ b/src/ctype/iswalnum.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
int iswalnum(wint_t wc)
{
diff --git a/src/ctype/iswalpha.c b/src/ctype/iswalpha.c
index 00f9d81f..1c5485d2 100644
--- a/src/ctype/iswalpha.c
+++ b/src/ctype/iswalpha.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
static const unsigned char table[] = {
#include "alpha.h"
diff --git a/src/ctype/iswblank.c b/src/ctype/iswblank.c
index d9b33ef4..68c88002 100644
--- a/src/ctype/iswblank.c
+++ b/src/ctype/iswblank.c
@@ -1,6 +1,5 @@
#include <wctype.h>
#include <ctype.h>
-#include "libc.h"
int iswblank(wint_t wc)
{
diff --git a/src/ctype/iswcntrl.c b/src/ctype/iswcntrl.c
index daace82a..feccfcd5 100644
--- a/src/ctype/iswcntrl.c
+++ b/src/ctype/iswcntrl.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
int iswcntrl(wint_t wc)
{
diff --git a/src/ctype/iswctype.c b/src/ctype/iswctype.c
index 3d9c2cc7..71b09b8d 100644
--- a/src/ctype/iswctype.c
+++ b/src/ctype/iswctype.c
@@ -1,6 +1,5 @@
#include <wctype.h>
#include <string.h>
-#include "libc.h"
#define WCTYPE_ALNUM 1
#define WCTYPE_ALPHA 2
diff --git a/src/ctype/iswdigit.c b/src/ctype/iswdigit.c
index ed9a88e7..db817edf 100644
--- a/src/ctype/iswdigit.c
+++ b/src/ctype/iswdigit.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
#undef iswdigit
diff --git a/src/ctype/iswgraph.c b/src/ctype/iswgraph.c
index 0ea5ca3a..ecdf466c 100644
--- a/src/ctype/iswgraph.c
+++ b/src/ctype/iswgraph.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
int iswgraph(wint_t wc)
{
diff --git a/src/ctype/iswlower.c b/src/ctype/iswlower.c
index 79df44a3..f02a4362 100644
--- a/src/ctype/iswlower.c
+++ b/src/ctype/iswlower.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
int iswlower(wint_t wc)
{
diff --git a/src/ctype/iswprint.c b/src/ctype/iswprint.c
index 69856e0d..86f9d646 100644
--- a/src/ctype/iswprint.c
+++ b/src/ctype/iswprint.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
/* Consider all legal codepoints as printable except for:
* - C0 and C1 control characters
diff --git a/src/ctype/iswpunct.c b/src/ctype/iswpunct.c
index d8801046..f0b9ea0a 100644
--- a/src/ctype/iswpunct.c
+++ b/src/ctype/iswpunct.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
static const unsigned char table[] = {
#include "punct.h"
diff --git a/src/ctype/iswspace.c b/src/ctype/iswspace.c
index 75ae7e8e..263afa15 100644
--- a/src/ctype/iswspace.c
+++ b/src/ctype/iswspace.c
@@ -1,6 +1,5 @@
#include <wchar.h>
#include <wctype.h>
-#include "libc.h"
/* Our definition of whitespace is the Unicode White_Space property,
* minus non-breaking spaces (U+00A0, U+2007, and U+202F) and script-
diff --git a/src/ctype/iswupper.c b/src/ctype/iswupper.c
index 6e1e029c..7e486665 100644
--- a/src/ctype/iswupper.c
+++ b/src/ctype/iswupper.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
int iswupper(wint_t wc)
{
diff --git a/src/ctype/iswxdigit.c b/src/ctype/iswxdigit.c
index 1e27f1f0..62bc9e74 100644
--- a/src/ctype/iswxdigit.c
+++ b/src/ctype/iswxdigit.c
@@ -1,5 +1,4 @@
#include <wctype.h>
-#include "libc.h"
int iswxdigit(wint_t wc)
{
diff --git a/src/ctype/isxdigit.c b/src/ctype/isxdigit.c
index 0e9152a7..aab1a745 100644
--- a/src/ctype/isxdigit.c
+++ b/src/ctype/isxdigit.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
int isxdigit(int c)
{
diff --git a/src/ctype/tolower.c b/src/ctype/tolower.c
index 362d6b2b..f10132ec 100644
--- a/src/ctype/tolower.c
+++ b/src/ctype/tolower.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
int tolower(int c)
{
diff --git a/src/ctype/toupper.c b/src/ctype/toupper.c
index bbf4e06e..4e74a55c 100644
--- a/src/ctype/toupper.c
+++ b/src/ctype/toupper.c
@@ -1,5 +1,4 @@
#include <ctype.h>
-#include "libc.h"
int toupper(int c)
{
diff --git a/src/ctype/towctrans.c b/src/ctype/towctrans.c
index 12355af1..8f681018 100644
--- a/src/ctype/towctrans.c
+++ b/src/ctype/towctrans.c
@@ -1,6 +1,6 @@
#include <ctype.h>
+#include <stddef.h>
#include <wctype.h>
-#include "libc.h"
#define CASEMAP(u1,u2,l) { (u1), (l)-(u1), (u2)-(u1)+1 }
#define CASELACE(u1,u2) CASEMAP((u1),(u2),(u1)+1)
diff --git a/src/ctype/wctrans.c b/src/ctype/wctrans.c
index b1b12654..d3eda521 100644
--- a/src/ctype/wctrans.c
+++ b/src/ctype/wctrans.c
@@ -1,6 +1,5 @@
#include <wctype.h>
#include <string.h>
-#include "libc.h"
wctrans_t wctrans(const char *class)
{
diff --git a/src/dirent/closedir.c b/src/dirent/closedir.c
index 81e9591c..e794ae9c 100644
--- a/src/dirent/closedir.c
+++ b/src/dirent/closedir.c
@@ -1,7 +1,7 @@
#include <dirent.h>
#include <unistd.h>
+#include <stdlib.h>
#include "__dirent.h"
-#include "libc.h"
int closedir(DIR *dir)
{
diff --git a/src/env/__environ.c b/src/env/__environ.c
index e6c6faa5..fe8abcf9 100644
--- a/src/env/__environ.c
+++ b/src/env/__environ.c
@@ -1,4 +1,4 @@
-#include "libc.h"
+#include <unistd.h>
char **__environ = 0;
weak_alias(__environ, ___environ);
diff --git a/src/env/clearenv.c b/src/env/clearenv.c
index 2e275b43..db8e8e94 100644
--- a/src/env/clearenv.c
+++ b/src/env/clearenv.c
@@ -1,7 +1,6 @@
#define _GNU_SOURCE
#include <stdlib.h>
#include <unistd.h>
-#include "libc.h"
static void dummy(char *old, char *new) {}
weak_alias(dummy, __env_rm_add);
diff --git a/src/env/getenv.c b/src/env/getenv.c
index f2797798..a90d39cf 100644
--- a/src/env/getenv.c
+++ b/src/env/getenv.c
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "libc.h"
char *getenv(const char *name)
{
diff --git a/src/env/putenv.c b/src/env/putenv.c
index 20f96022..dce8c828 100644
--- a/src/env/putenv.c
+++ b/src/env/putenv.c
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "libc.h"
static void dummy(char *old, char *new) {}
weak_alias(dummy, __env_rm_add);
diff --git a/src/env/unsetenv.c b/src/env/unsetenv.c
index 471219e8..b14c4c92 100644
--- a/src/env/unsetenv.c
+++ b/src/env/unsetenv.c
@@ -2,7 +2,6 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
-#include "libc.h"
static void dummy(char *old, char *new) {}
weak_alias(dummy, __env_rm_add);
diff --git a/src/errno/strerror.c b/src/errno/strerror.c
index 24c94d37..e3ed771a 100644
--- a/src/errno/strerror.c
+++ b/src/errno/strerror.c
@@ -1,7 +1,6 @@
#include <errno.h>
#include <string.h>
#include "locale_impl.h"
-#include "libc.h"
#define E(a,b) ((unsigned char)a),
static const unsigned char errid[] = {
diff --git a/src/fcntl/fcntl.c b/src/fcntl/fcntl.c
index ce615d0e..d3bff5c4 100644
--- a/src/fcntl/fcntl.c
+++ b/src/fcntl/fcntl.c
@@ -3,7 +3,6 @@
#include <stdarg.h>
#include <errno.h>
#include "syscall.h"
-#include "libc.h"
int fcntl(int fd, int cmd, ...)
{
diff --git a/src/fenv/fesetround.c b/src/fenv/fesetround.c
index a85db712..50e58f11 100644
--- a/src/fenv/fesetround.c
+++ b/src/fenv/fesetround.c
@@ -1,5 +1,5 @@
#include <fenv.h>
-#include "libc.h"
+#include <features.h>
/* __fesetround wrapper for arch independent argument check */
diff --git a/src/fenv/m68k/fenv.c b/src/fenv/m68k/fenv.c
index fa853797..d0658e67 100644
--- a/src/fenv/m68k/fenv.c
+++ b/src/fenv/m68k/fenv.c
@@ -1,5 +1,5 @@
#include <fenv.h>
-#include "libc.h"
+#include <features.h>
#if __HAVE_68881__ || __mcffpu__
diff --git a/src/fenv/powerpc64/fenv.c b/src/fenv/powerpc64/fenv.c
index 9db0fb6f..90dabdc8 100644
--- a/src/fenv/powerpc64/fenv.c
+++ b/src/fenv/powerpc64/fenv.c
@@ -1,6 +1,6 @@
#define _GNU_SOURCE
#include <fenv.h>
-#include "libc.h"
+#include <features.h>
static inline double get_fpscr_f(void)
{
diff --git a/src/fenv/s390x/fenv.c b/src/fenv/s390x/fenv.c
index 72b9dbea..fd4e60c5 100644
--- a/src/fenv/s390x/fenv.c
+++ b/src/fenv/s390x/fenv.c
@@ -1,5 +1,5 @@
#include <fenv.h>
-#include "libc.h"
+#include <features.h>
static inline unsigned get_fpc(void)
{
diff --git a/src/internal/dynlink.h b/src/internal/dynlink.h
index 90b6e481..cbe0a6fe 100644
--- a/src/internal/dynlink.h
+++ b/src/internal/dynlink.h
@@ -5,7 +5,7 @@
#include <elf.h>
#include <stdint.h>
#include <stddef.h>
-#include "libc.h"
+#include <stdarg.h>
#if UINTPTR_MAX == 0xffffffff
typedef Elf32_Ehdr Ehdr;
diff --git a/src/internal/fdpic_crt.h b/src/internal/fdpic_crt.h
index 3c3f077d..7e9632bb 100644
--- a/src/internal/fdpic_crt.h
+++ b/src/internal/fdpic_crt.h
@@ -1,5 +1,5 @@
#include <stdint.h>
-#include "libc.h"
+#include <features.h>
hidden void *__fdpic_fixup(void *map, uintptr_t *a, uintptr_t *z)
{
diff --git a/src/internal/libc.h b/src/internal/libc.h
index 155a299e..83ad3983 100644
--- a/src/internal/libc.h
+++ b/src/internal/libc.h
@@ -53,8 +53,6 @@ extern hidden const char __libc_version[];
/* Designed to avoid any overhead in non-threaded processes */
hidden void __lock(volatile int *);
hidden void __unlock(volatile int *);
-hidden int __lockfile(FILE *);
-hidden void __unlockfile(FILE *);
#define LOCK(x) __lock(x)
#define UNLOCK(x) __unlock(x)
diff --git a/src/internal/malloc_impl.h b/src/internal/malloc_impl.h
index b6eacd87..59785a7f 100644
--- a/src/internal/malloc_impl.h
+++ b/src/internal/malloc_impl.h
@@ -1,7 +1,6 @@
#ifndef MALLOC_IMPL_H
#define MALLOC_IMPL_H
-#include "libc.h"
#include <sys/mman.h>
hidden void *__expand_heap(size_t *);
diff --git a/src/internal/sh/__shcall.c b/src/internal/sh/__shcall.c
index 23655904..4e073e8f 100644
--- a/src/internal/sh/__shcall.c
+++ b/src/internal/sh/__shcall.c
@@ -1,4 +1,4 @@
-#include "libc.h"
+#include <features.h>
hidden int __shcall(void *arg, int (*func)(void *))
{
diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h
index 92f7be6c..4afb7ea2 100644
--- a/src/internal/stdio_impl.h
+++ b/src/internal/stdio_impl.h
@@ -3,7 +3,6 @@
#include <stdio.h>
#include "syscall.h"
-#include "libc.h"
#define UNGET 8
@@ -54,6 +53,9 @@ extern hidden FILE *volatile __stdin_used;
extern hidden FILE *volatile __stdout_used;
extern hidden FILE *volatile __stderr_used;
+hidden int __lockfile(FILE *);
+hidden void __unlockfile(FILE *);
+
hidden size_t __stdio_read(FILE *, unsigned char *, size_t);
hidden size_t __stdio_write(FILE *, const unsigned char *, size_t);
hidden size_t __stdout_write(FILE *, const unsigned char *, size_t);
diff --git a/src/internal/syscall.h b/src/internal/syscall.h
index 3cb0a772..da70ce92 100644
--- a/src/internal/syscall.h
+++ b/src/internal/syscall.h
@@ -1,8 +1,8 @@
#ifndef _INTERNAL_SYSCALL_H
#define _INTERNAL_SYSCALL_H
+#include <features.h>
#include <sys/syscall.h>
-#include "libc.h"
#include "syscall_arch.h"
#ifndef SYSCALL_RLIM_INFINITY
diff --git a/src/ipc/msgrcv.c b/src/ipc/msgrcv.c
index ed4a448a..0a344e56 100644
--- a/src/ipc/msgrcv.c
+++ b/src/ipc/msgrcv.c
@@ -1,7 +1,6 @@
#include <sys/msg.h>
#include "syscall.h"
#include "ipc.h"
-#include "libc.h"
ssize_t msgrcv(int q, void *m, size_t len, long type, int flag)
{
diff --git a/src/ipc/msgsnd.c b/src/ipc/msgsnd.c
index 23f4a4cb..e1abde3a 100644
--- a/src/ipc/msgsnd.c
+++ b/src/ipc/msgsnd.c
@@ -1,7 +1,6 @@
#include <sys/msg.h>
#include "syscall.h"
#include "ipc.h"
-#include "libc.h"
int msgsnd(int q, const void *m, size_t len, int flag)
{
diff --git a/src/ldso/__dlsym.c b/src/ldso/__dlsym.c
index 012994a7..8ac0a334 100644
--- a/src/ldso/__dlsym.c
+++ b/src/ldso/__dlsym.c
@@ -1,6 +1,5 @@
#include <dlfcn.h>
#include "dynlink.h"
-#include "libc.h"
static void *stub_dlsym(void *restrict p, const char *restrict s, void *restrict ra)
{
diff --git a/src/ldso/dladdr.c b/src/ldso/dladdr.c
index 659ab91e..e5c80206 100644
--- a/src/ldso/dladdr.c
+++ b/src/ldso/dladdr.c
@@ -1,6 +1,5 @@
#define _GNU_SOURCE
#include <dlfcn.h>
-#include "libc.h"
static int stub_dladdr(const void *addr, Dl_info *info)
{
diff --git a/src/ldso/dlclose.c b/src/ldso/dlclose.c
index b839fe2f..e437422a 100644
--- a/src/ldso/dlclose.c
+++ b/src/ldso/dlclose.c
@@ -1,6 +1,5 @@
#include <dlfcn.h>
#include "dynlink.h"
-#include "libc.h"
int dlclose(void *p)
{
diff --git a/src/ldso/dlerror.c b/src/ldso/dlerror.c
index 7e5ec23d..06ed8542 100644
--- a/src/ldso/dlerror.c
+++ b/src/ldso/dlerror.c
@@ -3,7 +3,6 @@
#include <stdarg.h>
#include "pthread_impl.h"
#include "dynlink.h"
-#include "libc.h"
char *dlerror()
{
diff --git a/src/ldso/dlinfo.c b/src/ldso/dlinfo.c
index a8a5ad56..b55f5fe6 100644
--- a/src/ldso/dlinfo.c
+++ b/src/ldso/dlinfo.c
@@ -1,7 +1,6 @@
#define _GNU_SOURCE
#include <dlfcn.h>
#include "dynlink.h"
-#include "libc.h"
int dlinfo(void *dso, int req, void *res)
{
diff --git a/src/ldso/dlopen.c b/src/ldso/dlopen.c
index 9544741b..69372a22 100644
--- a/src/ldso/dlopen.c
+++ b/src/ldso/dlopen.c
@@ -1,6 +1,5 @@
#include <dlfcn.h>
#include "dynlink.h"
-#include "libc.h"
static void *stub_dlopen(const char *file, int mode)
{
diff --git a/src/ldso/tlsdesc.c b/src/ldso/tlsdesc.c
index caf8dc08..49a1f18c 100644
--- a/src/ldso/tlsdesc.c
+++ b/src/ldso/tlsdesc.c
@@ -1,6 +1,5 @@
#include <stddef.h>
#include <dynlink.h>
-#include "libc.h"
ptrdiff_t __tlsdesc_static()
{
diff --git a/src/legacy/euidaccess.c b/src/legacy/euidaccess.c
index 73072513..6e1f3985 100644
--- a/src/legacy/euidaccess.c
+++ b/src/legacy/euidaccess.c
@@ -1,7 +1,6 @@
#define _GNU_SOURCE
#include <unistd.h>
#include <fcntl.h>
-#include "libc.h"
int euidaccess(const char *filename, int amode)
{
diff --git a/src/legacy/utmpx.c b/src/legacy/utmpx.c
index 3c983679..7aa65da3 100644
--- a/src/legacy/utmpx.c
+++ b/src/legacy/utmpx.c
@@ -2,7 +2,6 @@
#include <utmpx.h>
#include <stddef.h>
#include <errno.h>
-#include "libc.h"
void endutxent(void)
{
diff --git a/src/linux/cache.c b/src/linux/cache.c
index 3f0abc7c..84a138a4 100644
--- a/src/linux/cache.c
+++ b/src/linux/cache.c
@@ -1,5 +1,4 @@
#include "syscall.h"
-#include "libc.h"
#ifdef SYS_cacheflush
int _flush_cache(void *addr, int len, int op)
diff --git a/src/linux/getdents.c b/src/linux/getdents.c
index 90f7556e..cab29952 100644
--- a/src/linux/getdents.c
+++ b/src/linux/getdents.c
@@ -1,5 +1,7 @@
+#define _BSD_SOURCE
#include <dirent.h>
#include "syscall.h"
+#include "libc.h"
int getdents(int fd, struct dirent *buf, size_t len)
{
diff --git a/src/linux/setfsgid.c b/src/linux/setfsgid.c
index ad804225..e29d9c00 100644
--- a/src/linux/setfsgid.c
+++ b/src/linux/setfsgid.c
@@ -1,6 +1,5 @@
#include <sys/fsuid.h>
#include "syscall.h"
-#include "libc.h"
int setfsgid(gid_t gid)
{
diff --git a/src/linux/setfsuid.c b/src/linux/setfsuid.c
index 86358731..1bae4418 100644
--- a/src/linux/setfsuid.c
+++ b/src/linux/setfsuid.c
@@ -1,6 +1,5 @@
#include <sys/fsuid.h>
#include "syscall.h"
-#include "libc.h"
int setfsuid(uid_t uid)
{
diff --git a/src/linux/sysinfo.c b/src/linux/sysinfo.c
index 4b5a798d..db86476d 100644
--- a/src/linux/sysinfo.c
+++ b/src/linux/sysinfo.c
@@ -1,6 +1,5 @@
#include <sys/sysinfo.h>
#include "syscall.h"
-#include "libc.h"
int __lsysinfo(struct sysinfo *info)
{
diff --git a/src/linux/x32/sysinfo.c b/src/linux/x32/sysinfo.c
index d1c1b148..59b3bb70 100644
--- a/src/linux/x32/sysinfo.c
+++ b/src/linux/x32/sysinfo.c
@@ -1,6 +1,5 @@
#include <sys/sysinfo.h>
#include "syscall.h"
-#include "libc.h"
#define klong long long
#define kulong unsigned long long
diff --git a/src/locale/__lctrans.c b/src/locale/__lctrans.c
index 107fe14a..9fbe762a 100644
--- a/src/locale/__lctrans.c
+++ b/src/locale/__lctrans.c
@@ -1,6 +1,5 @@
#include <locale.h>
#include "locale_impl.h"
-#include "libc.h"
static const char *dummy(const char *msg, const struct __locale_map *lm)
{
diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c
index fc1018df..eefa31a8 100644
--- a/src/locale/dcngettext.c
+++ b/src/locale/dcngettext.c
@@ -7,7 +7,6 @@
#include <sys/mman.h>
#include <ctype.h>
#include "locale_impl.h"
-#include "libc.h"
#include "atomic.h"
#include "pleval.h"
diff --git a/src/locale/freelocale.c b/src/locale/freelocale.c
index e75acd66..802b8bfe 100644
--- a/src/locale/freelocale.c
+++ b/src/locale/freelocale.c
@@ -1,6 +1,5 @@
#include <stdlib.h>
#include "locale_impl.h"
-#include "libc.h"
void freelocale(locale_t l)
{
diff --git a/src/locale/langinfo.c b/src/locale/langinfo.c
index 83be6433..14773093 100644
--- a/src/locale/langinfo.c
+++ b/src/locale/langinfo.c
@@ -1,7 +1,6 @@
#include <locale.h>
#include <langinfo.h>
#include "locale_impl.h"
-#include "libc.h"
static const char c_time[] =
"Sun\0" "Mon\0" "Tue\0" "Wed\0" "Thu\0" "Fri\0" "Sat\0"
diff --git a/src/locale/newlocale.c b/src/locale/newlocale.c
index f50bbe91..8fb006a7 100644
--- a/src/locale/newlocale.c
+++ b/src/locale/newlocale.c
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include <string.h>
#include "locale_impl.h"
-#include "libc.h"
int __loc_is_allocated(locale_t loc)
{
diff --git a/src/locale/strcoll.c b/src/locale/strcoll.c
index 84f199ff..dd3cbc48 100644
--- a/src/locale/strcoll.c
+++ b/src/locale/strcoll.c
@@ -1,7 +1,6 @@
#include <string.h>
#include <locale.h>
#include "locale_impl.h"
-#include "libc.h"
int __strcoll_l(const char *l, const char *r, locale_t loc)
{
diff --git a/src/locale/strxfrm.c b/src/locale/strxfrm.c
index 14b76a63..c66c6203 100644
--- a/src/locale/strxfrm.c
+++ b/src/locale/strxfrm.c
@@ -1,7 +1,6 @@
#include <string.h>
#include <locale.h>
#include "locale_impl.h"
-#include "libc.h"
/* collate only by code points */
size_t __strxfrm_l(char *restrict dest, const char *restrict src, size_t n, locale_t loc)
diff --git a/src/locale/textdomain.c b/src/locale/textdomain.c
index c501501d..d7275397 100644
--- a/src/locale/textdomain.c
+++ b/src/locale/textdomain.c
@@ -3,8 +3,6 @@
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
-#include "libc.h"
-#include "atomic.h"
static char *current_domain;
diff --git a/src/locale/wcscoll.c b/src/locale/wcscoll.c
index 14bb8b9f..ad2cc691 100644
--- a/src/locale/wcscoll.c
+++ b/src/locale/wcscoll.c
@@ -1,7 +1,6 @@
#include <wchar.h>
#include <locale.h>
#include "locale_impl.h"
-#include "libc.h"
/* FIXME: stub */
int __wcscoll_l(const wchar_t *l, const wchar_t *r, locale_t locale)
diff --git a/src/locale/wcsxfrm.c b/src/locale/wcsxfrm.c
index 0a0b776d..05e3e115 100644
--- a/src/locale/wcsxfrm.c
+++ b/src/locale/wcsxfrm.c
@@ -1,7 +1,6 @@
#include <wchar.h>
#include <locale.h>
#include "locale_impl.h"
-#include "libc.h"
/* collate only by code points */
size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc)
diff --git a/src/malloc/memalign.c b/src/malloc/memalign.c
index 8a6152f4..cf9dfbda 100644
--- a/src/malloc/memalign.c
+++ b/src/malloc/memalign.c
@@ -1,7 +1,6 @@
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
-#include "libc.h"
#include "malloc_impl.h"
void *__memalign(size_t align, size_t len)
diff --git a/src/math/exp10.c b/src/math/exp10.c
index 9f5e3c2c..26899eba 100644
--- a/src/math/exp10.c
+++ b/src/math/exp10.c
@@ -1,7 +1,6 @@
#define _GNU_SOURCE
#include <math.h>
#include <stdint.h>
-#include "libc.h"
double exp10(double x)
{
diff --git a/src/math/exp10f.c b/src/math/exp10f.c
index 7a8d4470..d009f0a8 100644
--- a/src/math/exp10f.c
+++ b/src/math/exp10f.c
@@ -1,7 +1,6 @@
#define _GNU_SOURCE
#include <math.h>
#include <stdint.h>
-#include "libc.h"
float exp10f(float x)
{
diff --git a/src/math/exp10l.c b/src/math/exp10l.c
index b758ebff..f3da1a08 100644
--- a/src/math/exp10l.c
+++ b/src/math/exp10l.c
@@ -1,7 +1,6 @@
#define _GNU_SOURCE
#include <float.h>
#include <math.h>
-#include "libc.h"
#include "libm.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
diff --git a/src/math/lgamma_r.c b/src/math/lgamma_r.c
index fff565d2..f9984cd0 100644
--- a/src/math/lgamma_r.c
+++ b/src/math/lgamma_r.c
@@ -79,7 +79,6 @@
*/
#include "libm.h"
-#include "libc.h"
static const double
pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
diff --git a/src/math/lgammaf_r.c b/src/math/lgammaf_r.c
index c5b43db5..3f353f19 100644
--- a/src/math/lgammaf_r.c
+++ b/src/math/lgammaf_r.c
@@ -14,7 +14,6 @@
*/
#include "libm.h"
-#include "libc.h"
static const float
pi = 3.1415927410e+00, /* 0x40490fdb */
diff --git a/src/math/lgammal.c b/src/math/lgammal.c
index 8c798123..abbd4fc6 100644
--- a/src/math/lgammal.c
+++ b/src/math/lgammal.c
@@ -87,7 +87,6 @@
#define _GNU_SOURCE
#include "libm.h"
-#include "libc.h"
#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
long double __lgammal_r(long double x, int *sg)
diff --git a/src/math/remainder.c b/src/math/remainder.c
index 6cd089c4..612155fe 100644
--- a/src/math/remainder.c
+++ b/src/math/remainder.c
@@ -1,5 +1,4 @@
#include <math.h>
-#include "libc.h"
double remainder(double x, double y)
{
diff --git a/src/math/remainderf.c b/src/math/remainderf.c
index 420d3bfc..bf1d7b28 100644
--- a/src/math/remainderf.c
+++ b/src/math/remainderf.c
@@ -1,5 +1,4 @@
#include <math.h>
-#include "libc.h"
float remainderf(float x, float y)
{
diff --git a/src/math/signgam.c b/src/math/signgam.c
index b4903a58..ee331b27 100644
--- a/src/math/signgam.c
+++ b/src/math/signgam.c
@@ -1,6 +1,5 @@
#include <math.h>
#include "libm.h"
-#include "libc.h"
int __signgam = 0;
diff --git a/src/misc/basename.c b/src/misc/basename.c
index cc4f778c..438377b6 100644
--- a/src/misc/basename.c
+++ b/src/misc/basename.c
@@ -1,6 +1,5 @@
#include <string.h>
#include <libgen.h>
-#include "libc.h"
char *basename(char *s)
{
diff --git a/src/misc/getopt.c b/src/misc/getopt.c
index 7d7b1167..864d52cd 100644
--- a/src/misc/getopt.c
+++ b/src/misc/getopt.c
@@ -3,7 +3,6 @@
#include <string.h>
#include <limits.h>
#include <stdlib.h>
-#include "libc.h"
#include "locale_impl.h"
#include "stdio_impl.h"
diff --git a/src/misc/pty.c b/src/misc/pty.c
index b395d2c0..b9cb5eaa 100644
--- a/src/misc/pty.c
+++ b/src/misc/pty.c
@@ -3,7 +3,6 @@
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
-#include "libc.h"
#include "syscall.h"
int posix_openpt(int flags)
diff --git a/src/mman/madvise.c b/src/mman/madvise.c
index f80926be..e0c7c0ec 100644
--- a/src/mman/madvise.c
+++ b/src/mman/madvise.c
@@ -1,6 +1,5 @@
#include <sys/mman.h>
#include "syscall.h"
-#include "libc.h"
int __madvise(void *addr, size_t len, int advice)
{
diff --git a/src/mman/mremap.c b/src/mman/mremap.c
index ce4e8ea1..cc6991a6 100644
--- a/src/mman/mremap.c
+++ b/src/mman/mremap.c
@@ -5,7 +5,6 @@
#include <stdint.h>
#include <stdarg.h>
#include "syscall.h"
-#include "libc.h"
static void dummy(void) { }
weak_alias(dummy, __vm_wait);
diff --git a/src/mman/munmap.c b/src/mman/munmap.c
index 3f711ee5..2bf83bbe 100644
--- a/src/mman/munmap.c
+++ b/src/mman/munmap.c
@@ -1,6 +1,5 @@
#include <sys/mman.h>
#include "syscall.h"
-#include "libc.h"
static void dummy(void) { }
weak_alias(dummy, __vm_wait);
diff --git a/src/multibyte/internal.h b/src/multibyte/internal.h
index 7d0e7828..45bbc6d0 100644
--- a/src/multibyte/internal.h
+++ b/src/multibyte/internal.h
@@ -1,7 +1,7 @@
#define bittab __fsmu8
#include <stdint.h>
-#include "libc.h"
+#include <features.h>
extern hidden const uint32_t bittab[];
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)
{
diff --git a/src/passwd/pwf.h b/src/passwd/pwf.h
index ab7e1663..95bb6e05 100644
--- a/src/passwd/pwf.h
+++ b/src/passwd/pwf.h
@@ -4,9 +4,9 @@
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
+#include <stdlib.h>
#include <string.h>
#include <limits.h>
-#include "libc.h"
hidden int __getpwent_a(FILE *f, struct passwd *pw, char **line, size_t *size, struct passwd **res);
hidden int __getpw_a(const char *name, uid_t uid, struct passwd *pw, char **buf, size_t *size, struct passwd **res);
diff --git a/src/process/execvp.c b/src/process/execvp.c
index 2dddeddb..1fdf036f 100644
--- a/src/process/execvp.c
+++ b/src/process/execvp.c
@@ -3,7 +3,6 @@
#include <unistd.h>
#include <errno.h>
#include <limits.h>
-#include "libc.h"
extern char **__environ;
diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
index 2f8ef935..5aaf829d 100644
--- a/src/process/posix_spawn.c
+++ b/src/process/posix_spawn.c
@@ -8,7 +8,6 @@
#include "syscall.h"
#include "pthread_impl.h"
#include "fdop.h"
-#include "libc.h"
struct args {
int p[2];
diff --git a/src/process/system.c b/src/process/system.c
index 9135b815..5af59b80 100644
--- a/src/process/system.c
+++ b/src/process/system.c
@@ -5,7 +5,6 @@
#include <spawn.h>
#include <errno.h>
#include "pthread_impl.h"
-#include "libc.h"
extern char **__environ;
diff --git a/src/process/waitid.c b/src/process/waitid.c
index c67feac3..d688650d 100644
--- a/src/process/waitid.c
+++ b/src/process/waitid.c
@@ -1,6 +1,5 @@
#include <sys/wait.h>
#include "syscall.h"
-#include "libc.h"
int waitid(idtype_t type, id_t id, siginfo_t *info, int options)
{
diff --git a/src/process/waitpid.c b/src/process/waitpid.c
index f75e31ef..1b65bf05 100644
--- a/src/process/waitpid.c
+++ b/src/process/waitpid.c
@@ -1,6 +1,5 @@
#include <sys/wait.h>
#include "syscall.h"
-#include "libc.h"
pid_t waitpid(pid_t pid, int *status, int options)
{
diff --git a/src/search/hsearch.c b/src/search/hsearch.c
index 1dcb4d8b..b3ac8796 100644
--- a/src/search/hsearch.c
+++ b/src/search/hsearch.c
@@ -2,7 +2,6 @@
#include <stdlib.h>
#include <string.h>
#include <search.h>
-#include "libc.h"
/*
open addressing hash table with 2^n table size
diff --git a/src/select/poll.c b/src/select/poll.c
index 9e0bcbd8..c84c8a99 100644
--- a/src/select/poll.c
+++ b/src/select/poll.c
@@ -2,7 +2,6 @@
#include <time.h>
#include <signal.h>
#include "syscall.h"
-#include "libc.h"
int poll(struct pollfd *fds, nfds_t n, int timeout)
{
diff --git a/src/select/pselect.c b/src/select/pselect.c
index 4e2d7b07..762af37f 100644
--- a/src/select/pselect.c
+++ b/src/select/pselect.c
@@ -2,7 +2,6 @@
#include <signal.h>
#include <stdint.h>
#include "syscall.h"
-#include "libc.h"
int pselect(int n, fd_set *restrict rfds, fd_set *restrict wfds, fd_set *restrict efds, const struct timespec *restrict ts, const sigset_t *restrict mask)
{
diff --git a/src/select/select.c b/src/select/select.c
index 7b5f6dcf..02fd75c3 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -3,7 +3,6 @@
#include <stdint.h>
#include <errno.h>
#include "syscall.h"
-#include "libc.h"
int select(int n, fd_set *restrict rfds, fd_set *restrict wfds, fd_set *restrict efds, struct timeval *restrict tv)
{
diff --git a/src/signal/signal.c b/src/signal/signal.c
index bcd56825..7a6dd172 100644
--- a/src/signal/signal.c
+++ b/src/signal/signal.c
@@ -1,6 +1,5 @@
#include <signal.h>
#include "syscall.h"
-#include "libc.h"
void (*signal(int sig, void (*func)(int)))(int)
{
diff --git a/src/signal/sigsetjmp_tail.c b/src/signal/sigsetjmp_tail.c
index 252529a4..f2aa2887 100644
--- a/src/signal/sigsetjmp_tail.c
+++ b/src/signal/sigsetjmp_tail.c
@@ -1,7 +1,6 @@
#include <setjmp.h>
#include <signal.h>
#include "syscall.h"
-#include "libc.h"
hidden int __sigsetjmp_tail(sigjmp_buf jb, int ret)
{
diff --git a/src/signal/sigsuspend.c b/src/signal/sigsuspend.c
index 0b42725a..36e0602c 100644
--- a/src/signal/sigsuspend.c
+++ b/src/signal/sigsuspend.c
@@ -1,6 +1,5 @@
#include <signal.h>
#include "syscall.h"
-#include "libc.h"
int sigsuspend(const sigset_t *mask)
{
diff --git a/src/signal/sigtimedwait.c b/src/signal/sigtimedwait.c
index 0739986b..7bcfe720 100644
--- a/src/signal/sigtimedwait.c
+++ b/src/signal/sigtimedwait.c
@@ -1,7 +1,6 @@
#include <signal.h>
#include <errno.h>
#include "syscall.h"
-#include "libc.h"
int sigtimedwait(const sigset_t *restrict mask, siginfo_t *restrict si, const struct timespec *restrict timeout)
{
diff --git a/src/stat/futimesat.c b/src/stat/futimesat.c
index b4eea1d3..4bdb1c29 100644
--- a/src/stat/futimesat.c
+++ b/src/stat/futimesat.c
@@ -3,7 +3,6 @@
#include <sys/stat.h>
#include <errno.h>
#include "syscall.h"
-#include "libc.h"
int __futimesat(int dirfd, const char *pathname, const struct timeval times[2])
{
diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c
index 8d6ce813..116e78e5 100644
--- a/src/stdio/__fdopen.c
+++ b/src/stdio/__fdopen.c
@@ -4,6 +4,7 @@
#include <fcntl.h>
#include <errno.h>
#include <string.h>
+#include "libc.h"
FILE *__fdopen(int fd, const char *mode)
{
diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c
index c675413d..889b96d2 100644
--- a/src/stdio/fclose.c
+++ b/src/stdio/fclose.c
@@ -1,5 +1,5 @@
#include "stdio_impl.h"
-#include "libc.h"
+#include <stdlib.h>
static void dummy(FILE *f) { }
weak_alias(dummy, __unlist_locked_file);
diff --git a/src/stdio/fgetpos.c b/src/stdio/fgetpos.c
index 6eb361e1..6b45f57f 100644
--- a/src/stdio/fgetpos.c
+++ b/src/stdio/fgetpos.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include "libc.h"
int fgetpos(FILE *restrict f, fpos_t *restrict pos)
{
diff --git a/src/stdio/fmemopen.c b/src/stdio/fmemopen.c
index 5e0eeb50..82413b2d 100644
--- a/src/stdio/fmemopen.c
+++ b/src/stdio/fmemopen.c
@@ -1,7 +1,9 @@
#include "stdio_impl.h"
#include <errno.h>
#include <string.h>
+#include <stdlib.h>
#include <inttypes.h>
+#include "libc.h"
struct cookie {
size_t pos, len, size;
diff --git a/src/stdio/fopen.c b/src/stdio/fopen.c
index 252f0824..2a20c7f2 100644
--- a/src/stdio/fopen.c
+++ b/src/stdio/fopen.c
@@ -2,6 +2,7 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
+#include "libc.h"
FILE *fopen(const char *restrict filename, const char *restrict mode)
{
diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c
index a9c83c85..6d6d21d2 100644
--- a/src/stdio/freopen.c
+++ b/src/stdio/freopen.c
@@ -1,6 +1,7 @@
#include "stdio_impl.h"
#include <fcntl.h>
#include <unistd.h>
+#include "libc.h"
/* The basic idea of this implementation is to open a new FILE,
* hack the necessary parts of the new FILE into the old one, then
diff --git a/src/stdio/fscanf.c b/src/stdio/fscanf.c
index acb8a106..f639e118 100644
--- a/src/stdio/fscanf.c
+++ b/src/stdio/fscanf.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdarg.h>
-#include "libc.h"
int fscanf(FILE *restrict f, const char *restrict fmt, ...)
{
diff --git a/src/stdio/fseek.c b/src/stdio/fseek.c
index b160b74e..26d9f7ef 100644
--- a/src/stdio/fseek.c
+++ b/src/stdio/fseek.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include "libc.h"
int __fseeko_unlocked(FILE *f, off_t off, int whence)
{
diff --git a/src/stdio/fsetpos.c b/src/stdio/fsetpos.c
index 6310424e..cea5ddbb 100644
--- a/src/stdio/fsetpos.c
+++ b/src/stdio/fsetpos.c
@@ -1,4 +1,5 @@
#include "stdio_impl.h"
+#include "libc.h"
int fsetpos(FILE *f, const fpos_t *pos)
{
diff --git a/src/stdio/ftell.c b/src/stdio/ftell.c
index bb62897a..aad352bd 100644
--- a/src/stdio/ftell.c
+++ b/src/stdio/ftell.c
@@ -1,6 +1,7 @@
#include "stdio_impl.h"
#include <limits.h>
#include <errno.h>
+#include "libc.h"
off_t __ftello_unlocked(FILE *f)
{
diff --git a/src/stdio/fwscanf.c b/src/stdio/fwscanf.c
index cb114b39..530bb7c7 100644
--- a/src/stdio/fwscanf.c
+++ b/src/stdio/fwscanf.c
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
-#include "libc.h"
int fwscanf(FILE *restrict f, const wchar_t *restrict fmt, ...)
{
diff --git a/src/stdio/getdelim.c b/src/stdio/getdelim.c
index d4b23882..26a56780 100644
--- a/src/stdio/getdelim.c
+++ b/src/stdio/getdelim.c
@@ -1,5 +1,6 @@
#include "stdio_impl.h"
#include <string.h>
+#include <stdlib.h>
#include <inttypes.h>
#include <errno.h>
diff --git a/src/stdio/open_memstream.c b/src/stdio/open_memstream.c
index 40f5ad60..600d2770 100644
--- a/src/stdio/open_memstream.c
+++ b/src/stdio/open_memstream.c
@@ -2,6 +2,8 @@
#include <errno.h>
#include <limits.h>
#include <string.h>
+#include <stdlib.h>
+#include "libc.h"
struct cookie {
char **bufp;
diff --git a/src/stdio/open_wmemstream.c b/src/stdio/open_wmemstream.c
index a7c3a645..ed1b561d 100644
--- a/src/stdio/open_wmemstream.c
+++ b/src/stdio/open_wmemstream.c
@@ -3,6 +3,8 @@
#include <errno.h>
#include <limits.h>
#include <string.h>
+#include <stdlib.h>
+#include "libc.h"
struct cookie {
wchar_t **bufp;
diff --git a/src/stdio/scanf.c b/src/stdio/scanf.c
index a740056c..bd77699c 100644
--- a/src/stdio/scanf.c
+++ b/src/stdio/scanf.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdarg.h>
-#include "libc.h"
int scanf(const char *restrict fmt, ...)
{
diff --git a/src/stdio/sscanf.c b/src/stdio/sscanf.c
index 8a2302ff..f2ac2f5d 100644
--- a/src/stdio/sscanf.c
+++ b/src/stdio/sscanf.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdarg.h>
-#include "libc.h"
int sscanf(const char *restrict s, const char *restrict fmt, ...)
{
diff --git a/src/stdio/swscanf.c b/src/stdio/swscanf.c
index d893fbac..03d572da 100644
--- a/src/stdio/swscanf.c
+++ b/src/stdio/swscanf.c
@@ -1,6 +1,5 @@
#include <stdarg.h>
#include <wchar.h>
-#include "libc.h"
int swscanf(const wchar_t *restrict s, const wchar_t *restrict fmt, ...)
{
diff --git a/src/stdio/tmpfile.c b/src/stdio/tmpfile.c
index 55d742fa..7013f645 100644
--- a/src/stdio/tmpfile.c
+++ b/src/stdio/tmpfile.c
@@ -2,6 +2,7 @@
#include <fcntl.h>
#include <stdlib.h>
#include "stdio_impl.h"
+#include "libc.h"
#define MAXTRIES 100
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 2100eb5e..9b961e7f 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
+#include <stdlib.h>
#include <wchar.h>
#include <inttypes.h>
#include <math.h>
diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index 9d774fcc..0adf0b7a 100644
--- a/src/stdio/vfwprintf.c
+++ b/src/stdio/vfwprintf.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
+#include <stdlib.h>
#include <wchar.h>
#include <inttypes.h>
diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c
index a7cd0923..7be66344 100644
--- a/src/stdio/vfwscanf.c
+++ b/src/stdio/vfwscanf.c
@@ -11,7 +11,6 @@
#include "shgetc.h"
#include "intscan.h"
#include "floatscan.h"
-#include "libc.h"
#define SIZE_hh -2
#define SIZE_h -1
diff --git a/src/stdio/vscanf.c b/src/stdio/vscanf.c
index 43892f01..9d46ab09 100644
--- a/src/stdio/vscanf.c
+++ b/src/stdio/vscanf.c
@@ -1,6 +1,5 @@
#include <stdio.h>
#include <stdarg.h>
-#include "libc.h"
int vscanf(const char *restrict fmt, va_list ap)
{
diff --git a/src/stdio/vsscanf.c b/src/stdio/vsscanf.c
index 929ffa3b..98500225 100644
--- a/src/stdio/vsscanf.c
+++ b/src/stdio/vsscanf.c
@@ -1,5 +1,4 @@
#include "stdio_impl.h"
-#include "libc.h"
static size_t do_read(FILE *f, unsigned char *buf, size_t len)
{
diff --git a/src/stdio/vswprintf.c b/src/stdio/vswprintf.c
index 38efed65..7f98c5c9 100644
--- a/src/stdio/vswprintf.c
+++ b/src/stdio/vswprintf.c
@@ -2,6 +2,7 @@
#include <limits.h>
#include <errno.h>
#include <stdint.h>
+#include <stdlib.h>
#include <wchar.h>
struct cookie {
diff --git a/src/stdio/vswscanf.c b/src/stdio/vswscanf.c
index 411dd39c..00b614bc 100644
--- a/src/stdio/vswscanf.c
+++ b/src/stdio/vswscanf.c
@@ -1,5 +1,4 @@
#include "stdio_impl.h"
-#include "libc.h"
#include <wchar.h>
static size_t wstring_read(FILE *f, unsigned char *buf, size_t len)
diff --git a/src/stdio/vwscanf.c b/src/stdio/vwscanf.c
index 63c9cce1..5a3931e1 100644
--- a/src/stdio/vwscanf.c
+++ b/src/stdio/vwscanf.c
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
-#include "libc.h"
int vwscanf(const wchar_t *restrict fmt, va_list ap)
{
diff --git a/src/stdio/wscanf.c b/src/stdio/wscanf.c
index 80412252..4dfec25d 100644
--- a/src/stdio/wscanf.c
+++ b/src/stdio/wscanf.c
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <wchar.h>
-#include "libc.h"
int wscanf(const wchar_t *restrict fmt, ...)
{
diff --git a/src/stdlib/strtod.c b/src/stdlib/strtod.c
index 461dcf85..a898b1d4 100644
--- a/src/stdlib/strtod.c
+++ b/src/stdlib/strtod.c
@@ -2,7 +2,6 @@
#include "shgetc.h"
#include "floatscan.h"
#include "stdio_impl.h"
-#include "libc.h"
static long double strtox(const char *s, char **p, int prec)
{
diff --git a/src/stdlib/strtol.c b/src/stdlib/strtol.c
index 730bf2d7..d82ecf7f 100644
--- a/src/stdlib/strtol.c
+++ b/src/stdlib/strtol.c
@@ -4,7 +4,6 @@
#include <inttypes.h>
#include <limits.h>
#include <ctype.h>
-#include "libc.h"
static unsigned long long strtox(const char *s, char **p, int base, unsigned long long lim)
{
diff --git a/src/string/memrchr.c b/src/string/memrchr.c
index a78e9d6c..e51748b8 100644
--- a/src/string/memrchr.c
+++ b/src/string/memrchr.c
@@ -1,5 +1,4 @@
#include <string.h>
-#include "libc.h"
void *__memrchr(const void *m, int c, size_t n)
{
diff --git a/src/string/stpcpy.c b/src/string/stpcpy.c
index 06623c44..54cf9ca5 100644
--- a/src/string/stpcpy.c
+++ b/src/string/stpcpy.c
@@ -1,7 +1,6 @@
#include <string.h>
#include <stdint.h>
#include <limits.h>
-#include "libc.h"
#define ALIGN (sizeof(size_t))
#define ONES ((size_t)-1/UCHAR_MAX)
diff --git a/src/string/stpncpy.c b/src/string/stpncpy.c
index 1f57a4dd..d6d92ffc 100644
--- a/src/string/stpncpy.c
+++ b/src/string/stpncpy.c
@@ -1,7 +1,6 @@
#include <string.h>
#include <stdint.h>
#include <limits.h>
-#include "libc.h"
#define ALIGN (sizeof(size_t)-1)
#define ONES ((size_t)-1/UCHAR_MAX)
diff --git a/src/string/strcasecmp.c b/src/string/strcasecmp.c
index 3cd5f2d0..002c6aa1 100644
--- a/src/string/strcasecmp.c
+++ b/src/string/strcasecmp.c
@@ -1,6 +1,5 @@
#include <strings.h>
#include <ctype.h>
-#include "libc.h"
int strcasecmp(const char *_l, const char *_r)
{
diff --git a/src/string/strchrnul.c b/src/string/strchrnul.c
index 05700ad6..f2b9ae11 100644
--- a/src/string/strchrnul.c
+++ b/src/string/strchrnul.c
@@ -1,7 +1,6 @@
#include <string.h>
#include <stdint.h>
#include <limits.h>
-#include "libc.h"
#define ALIGN (sizeof(size_t))
#define ONES ((size_t)-1/UCHAR_MAX)
diff --git a/src/string/strerror_r.c b/src/string/strerror_r.c
index da26b4fe..1dc88bb1 100644
--- a/src/string/strerror_r.c
+++ b/src/string/strerror_r.c
@@ -1,6 +1,5 @@
#include <string.h>
#include <errno.h>
-#include "libc.h"
int strerror_r(int err, char *buf, size_t buflen)
{
diff --git a/src/string/strlcpy.c b/src/string/strlcpy.c
index 193d7241..dcb22f6e 100644
--- a/src/string/strlcpy.c
+++ b/src/string/strlcpy.c
@@ -2,7 +2,6 @@
#include <string.h>
#include <stdint.h>
#include <limits.h>
-#include "libc.h"
#define ALIGN (sizeof(size_t)-1)
#define ONES ((size_t)-1/UCHAR_MAX)
diff --git a/src/string/strncasecmp.c b/src/string/strncasecmp.c
index 3af53008..e0ef93c2 100644
--- a/src/string/strncasecmp.c
+++ b/src/string/strncasecmp.c
@@ -1,6 +1,5 @@
#include <strings.h>
#include <ctype.h>
-#include "libc.h"
int strncasecmp(const char *_l, const char *_r, size_t n)
{
diff --git a/src/string/wcsdup.c b/src/string/wcsdup.c
index dd49c1b6..f398e809 100644
--- a/src/string/wcsdup.c
+++ b/src/string/wcsdup.c
@@ -1,6 +1,5 @@
#include <stdlib.h>
#include <wchar.h>
-#include "libc.h"
wchar_t *wcsdup(const wchar_t *s)
{
diff --git a/src/temp/mkostemps.c b/src/temp/mkostemps.c
index d1464b45..ef24eeae 100644
--- a/src/temp/mkostemps.c
+++ b/src/temp/mkostemps.c
@@ -4,7 +4,6 @@
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
-#include "libc.h"
int __mkostemps(char *template, int len, int flags)
{
diff --git a/src/termios/cfsetospeed.c b/src/termios/cfsetospeed.c
index b571f62e..c9cbdd9d 100644
--- a/src/termios/cfsetospeed.c
+++ b/src/termios/cfsetospeed.c
@@ -2,7 +2,6 @@
#include <termios.h>
#include <sys/ioctl.h>
#include <errno.h>
-#include "libc.h"
int cfsetospeed(struct termios *tio, speed_t speed)
{
diff --git a/src/termios/tcdrain.c b/src/termios/tcdrain.c
index 6e43afb7..c0e542b3 100644
--- a/src/termios/tcdrain.c
+++ b/src/termios/tcdrain.c
@@ -1,6 +1,5 @@
#include <termios.h>
#include <sys/ioctl.h>
-#include "libc.h"
#include "syscall.h"
int tcdrain(int fd)
diff --git a/src/thread/__syscall_cp.c b/src/thread/__syscall_cp.c
index afd82eff..af666f06 100644
--- a/src/thread/__syscall_cp.c
+++ b/src/thread/__syscall_cp.c
@@ -1,6 +1,5 @@
#include "pthread_impl.h"
#include "syscall.h"
-#include "libc.h"
hidden long __syscall_cp_c();
diff --git a/src/thread/__tls_get_addr.c b/src/thread/__tls_get_addr.c
index 013817b4..34fbc46c 100644
--- a/src/thread/__tls_get_addr.c
+++ b/src/thread/__tls_get_addr.c
@@ -1,6 +1,5 @@
#include <stddef.h>
#include "pthread_impl.h"
-#include "libc.h"
void *__tls_get_addr(tls_mod_off_t *v)
{
diff --git a/src/thread/pthread_attr_setinheritsched.c b/src/thread/pthread_attr_setinheritsched.c
index 605af973..6a648376 100644
--- a/src/thread/pthread_attr_setinheritsched.c
+++ b/src/thread/pthread_attr_setinheritsched.c
@@ -1,6 +1,5 @@
#include "pthread_impl.h"
#include "syscall.h"
-#include "libc.h"
hidden void *__start_sched(void *p)
{
diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c
index 43f8d405..2f9d5e97 100644
--- a/src/thread/pthread_cancel.c
+++ b/src/thread/pthread_cancel.c
@@ -2,7 +2,6 @@
#include <string.h>
#include "pthread_impl.h"
#include "syscall.h"
-#include "libc.h"
hidden long __cancel(), __syscall_cp_asm(), __syscall_cp_c();
diff --git a/src/thread/pthread_equal.c b/src/thread/pthread_equal.c
index 7c31482a..dbb73655 100644
--- a/src/thread/pthread_equal.c
+++ b/src/thread/pthread_equal.c
@@ -1,6 +1,5 @@
#include <pthread.h>
#include <threads.h>
-#include "libc.h"
static int __pthread_equal(pthread_t a, pthread_t b)
{
diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c
index 241a6202..bd3bf95b 100644
--- a/src/thread/pthread_self.c
+++ b/src/thread/pthread_self.c
@@ -1,6 +1,5 @@
#include "pthread_impl.h"
#include <threads.h>
-#include "libc.h"
static pthread_t __pthread_self_internal()
{
diff --git a/src/thread/pthread_testcancel.c b/src/thread/pthread_testcancel.c
index ee48e6d8..d772449d 100644
--- a/src/thread/pthread_testcancel.c
+++ b/src/thread/pthread_testcancel.c
@@ -1,5 +1,4 @@
#include "pthread_impl.h"
-#include "libc.h"
static void dummy()
{
diff --git a/src/thread/x32/syscall_cp_fixup.c b/src/thread/x32/syscall_cp_fixup.c
index b1a1faa6..4956610f 100644
--- a/src/thread/x32/syscall_cp_fixup.c
+++ b/src/thread/x32/syscall_cp_fixup.c
@@ -1,5 +1,5 @@
#include <sys/syscall.h>
-#include "libc.h"
+#include <features.h>
hidden long __syscall_cp_internal(volatile void*, long long, long long,
long long, long long, long long,
diff --git a/src/time/asctime_r.c b/src/time/asctime_r.c
index af2618de..26809ca2 100644
--- a/src/time/asctime_r.c
+++ b/src/time/asctime_r.c
@@ -3,7 +3,6 @@
#include <langinfo.h>
#include "locale_impl.h"
#include "atomic.h"
-#include "libc.h"
char *__asctime_r(const struct tm *restrict tm, char *restrict buf)
{
diff --git a/src/time/clock_gettime.c b/src/time/clock_gettime.c
index c24fe173..8fd1b8f5 100644
--- a/src/time/clock_gettime.c
+++ b/src/time/clock_gettime.c
@@ -2,7 +2,6 @@
#include <errno.h>
#include <stdint.h>
#include "syscall.h"
-#include "libc.h"
#include "atomic.h"
#ifdef VDSO_CGT_SYM
diff --git a/src/time/clock_nanosleep.c b/src/time/clock_nanosleep.c
index 9e4d9f1f..32f0c07e 100644
--- a/src/time/clock_nanosleep.c
+++ b/src/time/clock_nanosleep.c
@@ -1,7 +1,6 @@
#include <time.h>
#include <errno.h>
#include "syscall.h"
-#include "libc.h"
int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct timespec *rem)
{
diff --git a/src/time/gmtime_r.c b/src/time/gmtime_r.c
index e529799b..22aec2c2 100644
--- a/src/time/gmtime_r.c
+++ b/src/time/gmtime_r.c
@@ -1,6 +1,5 @@
#include "time_impl.h"
#include <errno.h>
-#include "libc.h"
struct tm *__gmtime_r(const time_t *restrict t, struct tm *restrict tm)
{
diff --git a/src/time/localtime_r.c b/src/time/localtime_r.c
index 2e62c29f..1a15b314 100644
--- a/src/time/localtime_r.c
+++ b/src/time/localtime_r.c
@@ -1,6 +1,6 @@
#include "time_impl.h"
#include <errno.h>
-#include "libc.h"
+#include <limits.h>
struct tm *__localtime_r(const time_t *restrict t, struct tm *restrict tm)
{
diff --git a/src/time/nanosleep.c b/src/time/nanosleep.c
index a2ff4839..1e6f3922 100644
--- a/src/time/nanosleep.c
+++ b/src/time/nanosleep.c
@@ -1,6 +1,5 @@
#include <time.h>
#include "syscall.h"
-#include "libc.h"
int nanosleep(const struct timespec *req, struct timespec *rem)
{
diff --git a/src/time/strftime.c b/src/time/strftime.c
index ba18a27c..cc53d536 100644
--- a/src/time/strftime.c
+++ b/src/time/strftime.c
@@ -6,7 +6,6 @@
#include <time.h>
#include <limits.h>
#include "locale_impl.h"
-#include "libc.h"
#include "time_impl.h"
static int is_leap(int y)
diff --git a/src/time/wcsftime.c b/src/time/wcsftime.c
index 31b30caf..8e1437b3 100644
--- a/src/time/wcsftime.c
+++ b/src/time/wcsftime.c
@@ -3,7 +3,6 @@
#include <locale.h>
#include "locale_impl.h"
#include "time_impl.h"
-#include "libc.h"
size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
{
diff --git a/src/unistd/acct.c b/src/unistd/acct.c
index f6f25a8a..308ffc38 100644
--- a/src/unistd/acct.c
+++ b/src/unistd/acct.c
@@ -1,7 +1,6 @@
#define _GNU_SOURCE
#include <unistd.h>
#include "syscall.h"
-#include "libc.h"
int acct(const char *filename)
{
diff --git a/src/unistd/close.c b/src/unistd/close.c
index fa3c6cab..5b38e019 100644
--- a/src/unistd/close.c
+++ b/src/unistd/close.c
@@ -1,7 +1,6 @@
#include <unistd.h>
#include <errno.h>
#include "syscall.h"
-#include "libc.h"
static int dummy(int fd)
{
diff --git a/src/unistd/dup3.c b/src/unistd/dup3.c
index 0eb6caf5..f919f791 100644
--- a/src/unistd/dup3.c
+++ b/src/unistd/dup3.c
@@ -3,7 +3,6 @@
#include <errno.h>
#include <fcntl.h>
#include "syscall.h"
-#include "libc.h"
int __dup3(int old, int new, int flags)
{
diff --git a/src/unistd/pause.c b/src/unistd/pause.c
index 56eb171e..90bbf4ca 100644
--- a/src/unistd/pause.c
+++ b/src/unistd/pause.c
@@ -1,7 +1,5 @@
#include <unistd.h>
-#include <signal.h>
#include "syscall.h"
-#include "libc.h"
int pause(void)
{
diff --git a/src/unistd/read.c b/src/unistd/read.c
index eb882fcc..f3589c05 100644
--- a/src/unistd/read.c
+++ b/src/unistd/read.c
@@ -1,6 +1,5 @@
#include <unistd.h>
#include "syscall.h"
-#include "libc.h"
ssize_t read(int fd, void *buf, size_t count)
{
diff --git a/src/unistd/readv.c b/src/unistd/readv.c
index e45cb484..91e6de81 100644
--- a/src/unistd/readv.c
+++ b/src/unistd/readv.c
@@ -1,6 +1,5 @@
#include <sys/uio.h>
#include "syscall.h"
-#include "libc.h"
ssize_t readv(int fd, const struct iovec *iov, int count)
{
diff --git a/src/unistd/write.c b/src/unistd/write.c
index e2f7e1f2..8fd5bc5c 100644
--- a/src/unistd/write.c
+++ b/src/unistd/write.c
@@ -1,6 +1,5 @@
#include <unistd.h>
#include "syscall.h"
-#include "libc.h"
ssize_t write(int fd, const void *buf, size_t count)
{
diff --git a/src/unistd/writev.c b/src/unistd/writev.c
index ef300ddf..5a46c951 100644
--- a/src/unistd/writev.c
+++ b/src/unistd/writev.c
@@ -1,6 +1,5 @@
#include <sys/uio.h>
#include "syscall.h"
-#include "libc.h"
ssize_t writev(int fd, const struct iovec *iov, int count)
{