2 #include <sys/socket.h>
5 float strtof(const char *nptr, char **endptr)
7 return (float)strtod(nptr, endptr);
10 double atof(const char *nptr)
12 return strtod(nptr, NULL);
17 return (__n < 0) ? -__n : __n;
22 return (__n < 0L) ? -__n : __n;
25 long long llabs(long long __n)
27 return (__n < 0LL) ? -__n : __n;
32 return (int)lrand48();
35 void srand(unsigned int __s)
45 void srandom(unsigned int __s)
50 /* from __cmsg_nxthdr.cpp */
52 * The function __cmsg_nxthd() is missing in Android 4.4, but the Android NDK
53 * header files in the version we are using are referencing it and we use it in
54 * our code, this functions was added in version 5.0. To make IoTivity
55 * dynamically loadable at load time on Android KitKat 4.4 add this functions
56 * as a weak symbol, so it will be used if the c lib does not provide it, like
57 * on Android < 5.0 This code was taken from these two resources:
58 * https://raw.githubusercontent.com/android/platform_bionic/master/libc/bionic/__cmsg_nxthdr.cpp
59 * https://github.com/android/platform_bionic/commit/ff64831b0965c16c95c9f81a148f30a6ef3a6c64
61 struct cmsghdr* __attribute__((weak)) __cmsg_nxthdr(struct msghdr* msg, struct cmsghdr* cmsg)
64 ptr = (struct cmsghdr*)(((unsigned char*) cmsg) + CMSG_ALIGN(cmsg->cmsg_len));
65 size_t len = (unsigned long)((char*)(ptr+1) - (char*) msg->msg_control);
66 if (len > msg->msg_controllen) {