netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] do not typedef socklen_t on Android
@ 2020-04-21  8:15 Maciej Żenczykowski
  2020-04-28  0:06 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej Żenczykowski @ 2020-04-21  8:15 UTC (permalink / raw)
  To: Maciej Żenczykowski, Pablo Neira Ayuso, Florian Westphal
  Cc: Linux Network Development Mailing List,
	Netfilter Development Mailing List

From: Maciej Żenczykowski <maze@google.com>

This is present in bionic header files regardless of compiler
being used (likely clang)

Test: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 libiptc/libip4tc.c | 2 +-
 libiptc/libip6tc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libiptc/libip4tc.c b/libiptc/libip4tc.c
index 55540638..08147055 100644
--- a/libiptc/libip4tc.c
+++ b/libiptc/libip4tc.c
@@ -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
 
diff --git a/libiptc/libip6tc.c b/libiptc/libip6tc.c
index b7dd1e33..91676c4a 100644
--- a/libiptc/libip6tc.c
+++ b/libiptc/libip6tc.c
@@ -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
 
-- 
2.26.1.301.g55bc3eb7cb9-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] do not typedef socklen_t on Android
  2020-04-21  8:15 [PATCH] do not typedef socklen_t on Android Maciej Żenczykowski
@ 2020-04-28  0:06 ` Pablo Neira Ayuso
  2020-04-28  0:26   ` Maciej Żenczykowski
  0 siblings, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2020-04-28  0:06 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Maciej Żenczykowski, Florian Westphal,
	Linux Network Development Mailing List,
	Netfilter Development Mailing List

On Tue, Apr 21, 2020 at 01:15:49AM -0700, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> This is present in bionic header files regardless of compiler
> being used (likely clang)
> 
> Test: builds
> Signed-off-by: Maciej Żenczykowski <maze@google.com>
> ---
>  libiptc/libip4tc.c | 2 +-
>  libiptc/libip6tc.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libiptc/libip4tc.c b/libiptc/libip4tc.c
> index 55540638..08147055 100644
> --- a/libiptc/libip4tc.c
> +++ b/libiptc/libip4tc.c
> @@ -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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] do not typedef socklen_t on Android
  2020-04-28  0:06 ` Pablo Neira Ayuso
@ 2020-04-28  0:26   ` Maciej Żenczykowski
  2020-04-28 22:21     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 4+ messages in thread
From: Maciej Żenczykowski @ 2020-04-28  0:26 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Florian Westphal, Linux Network Development Mailing List,
	Netfilter Development Mailing List

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__

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] do not typedef socklen_t on Android
  2020-04-28  0:26   ` Maciej Żenczykowski
@ 2020-04-28 22:21     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2020-04-28 22:21 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Florian Westphal, Linux Network Development Mailing List,
	Netfilter Development Mailing List

On Mon, Apr 27, 2020 at 05:26:44PM -0700, Maciej Żenczykowski wrote:
> 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__

https://sourceforge.net/p/predef/wiki/Libraries/

This one also refers to the existing C library definitions which makes
more sense to me too.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-28 22:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21  8:15 [PATCH] do not typedef socklen_t on Android Maciej Żenczykowski
2020-04-28  0:06 ` Pablo Neira Ayuso
2020-04-28  0:26   ` Maciej Żenczykowski
2020-04-28 22:21     ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).