libc/sysdeps: dup3: fix typo in comment

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
buildsys: clean up path scrubbing a bit

This just makes it easier to read -- no functional changes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
buildsys: allow the toolchain to search its dirs for kernel headers

Setting KERNEL_HEADERS up to the exact path all the time is a pita,
especially when the toolchain is often times already configured to
do the right thing.  So if the user has set that to "", don't force
any specific paths.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
buildsys: gen_bits_syscall_h: remove top_builddir references

This script hasn't used this var in a while (it writes to stdout), so
drop all mention/usage of it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
buildsys: gen_bits_syscall_h: clean up script

Just style changes here to make it more readable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
buildsys: gen_bits_syscall_h: do not leave undefined SYS_xxx around

If we end up doing '#undef __NR_xxx', we don't want to leave the
corresponding SYS_xxx symbol defined.  So undef it too.

For example, with the ARM EABI layer, we have a bunch of legacy
syscalls that we define early on and then later undefine (such
as __NR_utime).  But we left SYS_utime defined so code that tests
for that define before using it would be broken (since it'd be
defined to a non-existent symbol).

URL: https://bugs.gentoo.org/425006
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
libc/sysdeps: sync bits/in.h with glibc

URL: https://bugs.busybox.net/show_bug.cgi?id=5888
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
libc/inet: pull in stddef.h for NULL

Fixes a build error:
In file included from libc/inet/recv.c:8:0:
libc/inet/socketcalls.c: In function '__recv_nocancel':
libc/inet/socketcalls.c:203:57: error: 'NULL' undeclared (first use in this function)

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
libc: atexit: reuse free slots at the end of exit functions table

Continuosly dlopen and dlclose of shared object will cause a memory leak
in atexit function. This fix reuse free slots at the end of the list.

For further detail see https://bugs.busybox.net/show_bug.cgi?id=2455

Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com>
Tested-by: Filippo Arcidiacono <filippo.arcidiacono@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
libpthread: Fix handling of SUBARCH includes

TARGET_SUBARCH can only ever be set if TARGET_ARCH is set.
Only include SUBARCH includes if SUBARCH is non-empty.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
buildsys: switch libc to kbuild-style

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
mman: rename MAP_UNINITIALIZE to MAP_UNINITIALIZED

The name was changed to include a trailing 'D' when it went into the
kernel.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>