Replace a few more str(n)dupa by str(n)dup + free

strdup and strndup still don't exist on bionic, so we need to do the
alloc() call ourselves or free the memory by hand.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Add a local implementation of ifaddrs.h

This adds a local ifaddrs implementation to be used on Bionic or other C
libraries that don't come with a getifaddrs implementation.

This code was written by Kenneth MacKay and is under a two-clause BSD
license (copyright information in the file headers).

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Replace all calls to rindex by strrchr

The two functions are identical but strrchr also works on Bionic.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Export the local getmntent_r implementation

New code now uses getmntent_r so we need it exported so that it can be
used when building on bionic.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Define BLKGETSIZE64 and LO_FLAGS_AUTOCLEAR

Those two aren't always around (specifically on bionic), so add some
defines in case they aren't already defined.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Android now uses a sane clone() definition

The current Android NDK provides a clone() defintion that's identical to
eglibc's so we can drop the ifdef from that one.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Add arm defines for __NR_signalfd(4)

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Add missing syscall.h include to utils.h

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>