Description
Before Android NDK r14b, each android api version has their own libc headers set which were not totally correct.
Since Android NDK r14b, Google unified the headers so that they apply to all api version (using #ifdef
when needed to differentiate between mismatching versions). These new headers are directly taken from the bionic source which was not apparently the case before.
Unfortunately, this crate was based on these not unified headers and contain some incompatibilities with the new correct headers.
For now, we manage to update the NDK used to r15b by skipping the tests of the functions and structs that have changed. But ideally, we should update these functions to match the new headers for the next major version of libc.
So, for new symbols, please do not look into $NDK_PATH/platforms/android-xx/arch-arm/usr/include
for reference but into $NDK_PATH/sysroot/usr/include
as this path contains the new headers.
Here is a list of the changes written in C that we need to cover for the next major release:
-
int getpriotity(int, int)
-->int getpriority(int, id_t)
(id_t
isuin32_t
and is already defined aslibc::id_t
) -
int setpriority(int, int, int)
-->int setpriority(int, id_t, int)
-
int personality (unsigned long)
-->personality(unsigned int)
-
stat
struct is probably a bit harder to fix:
These fields:long st_atime; unsigned long st_atime_nsec; long st_mtime; unsigned long st_mtime_nsec; long st_ctime; unsigned long st_ctime_nsec;
became:
struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim;
where
timespec
is defined as:struct timespec { time_t tv_sec; long tv_nsec; };
and some
#define
allow to still have fields likest_mtime_nsec
:#define st_atime st_atim.tv_sec #define st_mtime st_mtim.tv_sec #define st_ctime st_ctim.tv_sec #define st_atime_nsec st_atim.tv_nsec #define st_mtime_nsec st_mtim.tv_nsec #define st_ctime_nsec st_ctim.tv_nsec #define st_atimensec st_atim.tv_nsec #define st_mtimensec st_mtim.tv_nsec #define st_ctimensec st_ctim.tv_nsec
It means we could just keep the
stat
struct as is and just change the types of*_mtime
and*_nsec
to match the nex types and drop the new fieldsst_atim
(without final e) andst_atimensec
an alike (without the underscore beforensec
) or find a way to present the field with different names. -
int strerror_r(int, char*, size_t)
-->char* strerror_r(int, char*, size_t)
The old function is still present and accessible through the symbolstrerror_r
, the new one is accessible through_gnu_strerror_r
. The solution is more probably simply just to ignore the new function and letstrerror_r
as is. -
int madvise(const void*, size_t, int)
-->int madvise(void*, size_t, int)
-
int msync(const void*, size_t, int)
-->int msync(void*, size_t, int)
-
int mprotect(const void*, size_t, int)
-->int mprotect(void*, size_t, int)
-
ssize_t recvfrom(int, void*, size_t, int, const struct sockaddr*, socklen_t*)
-->ssize_t recvfrom(int, void*, size_t, int, struct sockaddr*, socklen_t*)
-
int bind(int, const struct sockaddr*, int)
-->int bind(int, const struct sockaddr*, socklen_t)
(only applies to android 64 bits, do not know why we bounded it correctly in 32 bits) -
int writev(int, const struct iovec *, int)
-->ssize_t writev(int, const struct iovec*, int)
(same remark, only applies to android 64 bits) -
int readv(int, const struct iovec *, int)
-->ssize_t readv(int, const struct iovec*, int)
(same remark) -
int sendmsg(int, const struct msghdr*, int)
-->ssize_t sendmsg(int, const struct msghdr*, int)
(same remark) -
int recvmsg(int, struct msghdr*, int)
-->ssize_t recvmsg(int, struct msghdr*, int)
(same remark)