do not typedef socklen_t on Android
Subsystems (3)
PATCH 1/1 do not typedef socklen_t on Android
From: Maciej Żenczykowski <[email protected]>
This is present in bionic header files regardless of compiler being used (likely clang)
Test: builds
--- libiptc/libip4tc.c | 2 +- libiptc/libip6tc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
libiptc/libip4tc.c +1 -1
@@ -22,7 +22,7 @@#define inline#endif -#if !defined(__GLIBC__) || (__GLIBC__ <2 ) +#if !defined(__ANDROID__) && (!defined(__GLIBC__) || (__GLIBC__ <2 ))typedef unsigned int socklen_t ;#endif
libiptc/libip6tc.c +1 -1
@@ -23,7 +23,7 @@#define inline#endif -#if !defined(__GLIBC__) || (__GLIBC__ <2 ) +#if !defined(__ANDROID__) && (!defined(__GLIBC__) || (__GLIBC__ <2 ))typedef unsigned int socklen_t ;#endif
Signature · 1 line
2.26.1.301.g55bc3eb7cb9-goog
Pablo Neira Ayuso
maintainerQuoted 17 lines · Maciej Żenczykowski
From: Maciej Żenczykowski <[email protected]>
This is present in bionic header files regardless of compiler being used (likely clang)
Test: builds
Signed-off-by Maciej Żenczykowski <[email protected]>--- libiptc/libip4tc.c | 2 +- libiptc/libip6tc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)libiptc/libip4tc.c +0
-0
libiptc/libip4tc.c line 25
Quoted 5 lines
libiptc/libip4tc.c +1
-1@@ -22,7 +22,7 @@#define inline#endif -#if !defined(__GLIBC__) || (__GLIBC__ <2 ) +#if !defined(__ANDROID__) && (!defined(__GLIBC__) || (__GLIBC__ <2 ))
Out of curiosity: Is there documentation on this Android libc library and how this definition is used?
Thank you.
I don't know all that much about it. Mostly it just seems to work.
I'm quoting from: https://en.wikipedia.org/wiki/Bionic_(software) ;-)
Bionic is basically a BSD licensed C library for use with Linux. This differs from other BSD C libraries which require a BSD kernel, and from the GNU C Library (glibc) which uses the GNU Lesser General Public License.
For the most part it's supposed to be drop-in compatible I think, and the kernel headers (uapi) come from some recent version of Linux.
The license and smaller size are AFAIK the main benefits.
---
Got me curious and:
I'm not actually sure what defines __ANDROID__, maybe __BIONIC__ would be a better guard?
That seems to be defined in bionic/libc/include/sys/cdefs.h
https://android.googlesource.com/platform/bionic/+/master/libc/include/sys/cdefs.h#43
And the docs here:
https://android.googlesource.com/platform/bionic/+/master/docs/defines.md
do seem to suggest that __BIONIC__ is more equivalent to __GLIBC__
Pablo Neira Ayuso
maintainerQuoted 23 lines · Maciej Żenczykowski
I don't know all that much about it. Mostly it just seems to work.
I'm quoting from: https://en.wikipedia.org/wiki/Bionic_(software) ;-)
Bionic is basically a BSD licensed C library for use with Linux. This differs from other BSD C libraries which require a BSD kernel, and from the GNU C Library (glibc) which uses the GNU Lesser General Public License.
For the most part it's supposed to be drop-in compatible I think, and the kernel headers (uapi) come from some recent version of Linux.
The license and smaller size are AFAIK the main benefits.
---
Got me curious and:
I'm not actually sure what defines
__ANDROID__, maybe__BIONIC__would be a better guard?That seems to be defined in
bionic/libc/include/sys/cdefs.h
Quoted 7 lines
https://android.googlesource.com/platform/bionic/+/master/libc/include/sys/cdefs.h#43
And the docs here:
https://android.googlesource.com/platform/bionic/+/master/docs/defines.md
do seem to suggest that
__BIONIC__is more equivalent to__GLIBC__
https://sourceforge.net/p/predef/wiki/Libraries/
This one also refers to the existing C library definitions which makes more sense to me too.