Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-17 Thread Hauke Mehrtens
On 03/16/2017 09:26 AM, Mikko Rapeli wrote:
> On Thu, Mar 16, 2017 at 07:59:12AM +, David Woodhouse wrote:
>> On Sun, 2017-03-12 at 23:00 +0100, Hauke Mehrtens wrote:
>>> __USE_MISC is glibc specific and not available in musl libc. Only do
>>> this check when glibc is used. This fixes a problem with musl libc.
>>> ...
>>> -/* Coordinate with glibc net/if.h header. */
>>> -#if defined(_NET_IF_H) && defined(__USE_MISC)
>>> +/* Coordinate with libc net/if.h header. */
>>> +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
>>
>> I *really* don't like building up a plethora of knowledge about
>> specific libc implementations in the kernel. As a general rule, if we
>> have *anything* that depends on __GLIBC__ then we are Doing It Wrong™.
> 
> Kernel does not depend on glibc but uapi headers check for some defintions
> so that userspace code can include both libc and kernel header files
> without compiler errors.
> 
> This interface between kernel and libc header files is messy due to long
> history of copying header files from kernel to libc implementations etc
> and thus this kind of ifdef magic with in depth knowledge of various
> libc's defintions is currently unavoidable.

I agree with you David.
Should I change my patch?

The check for __USE_MISC was added in this commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f0a3fdca794d1e68ae284ef4caefe681f7c18e89

musl does not define it, but still adds the defines which glibc adds
when __USE_MISC is set.

Hauke


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-17 Thread Hauke Mehrtens
On 03/16/2017 09:26 AM, Mikko Rapeli wrote:
> On Thu, Mar 16, 2017 at 07:59:12AM +, David Woodhouse wrote:
>> On Sun, 2017-03-12 at 23:00 +0100, Hauke Mehrtens wrote:
>>> __USE_MISC is glibc specific and not available in musl libc. Only do
>>> this check when glibc is used. This fixes a problem with musl libc.
>>> ...
>>> -/* Coordinate with glibc net/if.h header. */
>>> -#if defined(_NET_IF_H) && defined(__USE_MISC)
>>> +/* Coordinate with libc net/if.h header. */
>>> +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
>>
>> I *really* don't like building up a plethora of knowledge about
>> specific libc implementations in the kernel. As a general rule, if we
>> have *anything* that depends on __GLIBC__ then we are Doing It Wrong™.
> 
> Kernel does not depend on glibc but uapi headers check for some defintions
> so that userspace code can include both libc and kernel header files
> without compiler errors.
> 
> This interface between kernel and libc header files is messy due to long
> history of copying header files from kernel to libc implementations etc
> and thus this kind of ifdef magic with in depth knowledge of various
> libc's defintions is currently unavoidable.

I agree with you David.
Should I change my patch?

The check for __USE_MISC was added in this commit:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f0a3fdca794d1e68ae284ef4caefe681f7c18e89

musl does not define it, but still adds the defines which glibc adds
when __USE_MISC is set.

Hauke


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-16 Thread Mikko Rapeli
On Thu, Mar 16, 2017 at 07:59:12AM +, David Woodhouse wrote:
> On Sun, 2017-03-12 at 23:00 +0100, Hauke Mehrtens wrote:
> > __USE_MISC is glibc specific and not available in musl libc. Only do
> > this check when glibc is used. This fixes a problem with musl libc.
> > ...
> > -/* Coordinate with glibc net/if.h header. */
> > -#if defined(_NET_IF_H) && defined(__USE_MISC)
> > +/* Coordinate with libc net/if.h header. */
> > +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
> 
> I *really* don't like building up a plethora of knowledge about
> specific libc implementations in the kernel. As a general rule, if we
> have *anything* that depends on __GLIBC__ then we are Doing It Wrong™.

Kernel does not depend on glibc but uapi headers check for some defintions
so that userspace code can include both libc and kernel header files
without compiler errors.

This interface between kernel and libc header files is messy due to long
history of copying header files from kernel to libc implementations etc
and thus this kind of ifdef magic with in depth knowledge of various
libc's defintions is currently unavoidable.

-Mikko


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-16 Thread Mikko Rapeli
On Thu, Mar 16, 2017 at 07:59:12AM +, David Woodhouse wrote:
> On Sun, 2017-03-12 at 23:00 +0100, Hauke Mehrtens wrote:
> > __USE_MISC is glibc specific and not available in musl libc. Only do
> > this check when glibc is used. This fixes a problem with musl libc.
> > ...
> > -/* Coordinate with glibc net/if.h header. */
> > -#if defined(_NET_IF_H) && defined(__USE_MISC)
> > +/* Coordinate with libc net/if.h header. */
> > +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
> 
> I *really* don't like building up a plethora of knowledge about
> specific libc implementations in the kernel. As a general rule, if we
> have *anything* that depends on __GLIBC__ then we are Doing It Wrong™.

Kernel does not depend on glibc but uapi headers check for some defintions
so that userspace code can include both libc and kernel header files
without compiler errors.

This interface between kernel and libc header files is messy due to long
history of copying header files from kernel to libc implementations etc
and thus this kind of ifdef magic with in depth knowledge of various
libc's defintions is currently unavoidable.

-Mikko


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-16 Thread David Woodhouse
On Sun, 2017-03-12 at 23:00 +0100, Hauke Mehrtens wrote:
> __USE_MISC is glibc specific and not available in musl libc. Only do
> this check when glibc is used. This fixes a problem with musl libc.
> ...
> -/* Coordinate with glibc net/if.h header. */
> -#if defined(_NET_IF_H) && defined(__USE_MISC)
> +/* Coordinate with libc net/if.h header. */
> +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))

I *really* don't like building up a plethora of knowledge about
specific libc implementations in the kernel. As a general rule, if we
have *anything* that depends on __GLIBC__ then we are Doing It Wrong™.

smime.p7s
Description: S/MIME cryptographic signature


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-16 Thread David Woodhouse
On Sun, 2017-03-12 at 23:00 +0100, Hauke Mehrtens wrote:
> __USE_MISC is glibc specific and not available in musl libc. Only do
> this check when glibc is used. This fixes a problem with musl libc.
> ...
> -/* Coordinate with glibc net/if.h header. */
> -#if defined(_NET_IF_H) && defined(__USE_MISC)
> +/* Coordinate with libc net/if.h header. */
> +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))

I *really* don't like building up a plethora of knowledge about
specific libc implementations in the kernel. As a general rule, if we
have *anything* that depends on __GLIBC__ then we are Doing It Wrong™.

smime.p7s
Description: S/MIME cryptographic signature


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-13 Thread Mikko Rapeli
On Sun, Mar 12, 2017 at 11:00:38PM +0100, Hauke Mehrtens wrote:
> __USE_MISC is glibc specific and not available in musl libc. Only do
> this check when glibc is used. This fixes a problem with musl libc.

> Signed-off-by: Hauke Mehrtens 

Acked-by: Mikko Rapeli 

> ---
>  include/uapi/linux/libc-compat.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/libc-compat.h 
> b/include/uapi/linux/libc-compat.h
> index 49a8cc3138ae..ce2fa8a4ced6 100644
> --- a/include/uapi/linux/libc-compat.h
> +++ b/include/uapi/linux/libc-compat.h
> @@ -51,8 +51,8 @@
>  /* We have included libc headers... */
>  #if !defined(__KERNEL__)
>  
> -/* Coordinate with glibc net/if.h header. */
> -#if defined(_NET_IF_H) && defined(__USE_MISC)
> +/* Coordinate with libc net/if.h header. */
> +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
>  
>  /* GLIBC headers included first so don't define anything
>   * that would already be defined. */
> -- 
> 2.11.0
> 


Re: [PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-13 Thread Mikko Rapeli
On Sun, Mar 12, 2017 at 11:00:38PM +0100, Hauke Mehrtens wrote:
> __USE_MISC is glibc specific and not available in musl libc. Only do
> this check when glibc is used. This fixes a problem with musl libc.

> Signed-off-by: Hauke Mehrtens 

Acked-by: Mikko Rapeli 

> ---
>  include/uapi/linux/libc-compat.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/libc-compat.h 
> b/include/uapi/linux/libc-compat.h
> index 49a8cc3138ae..ce2fa8a4ced6 100644
> --- a/include/uapi/linux/libc-compat.h
> +++ b/include/uapi/linux/libc-compat.h
> @@ -51,8 +51,8 @@
>  /* We have included libc headers... */
>  #if !defined(__KERNEL__)
>  
> -/* Coordinate with glibc net/if.h header. */
> -#if defined(_NET_IF_H) && defined(__USE_MISC)
> +/* Coordinate with libc net/if.h header. */
> +#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
>  
>  /* GLIBC headers included first so don't define anything
>   * that would already be defined. */
> -- 
> 2.11.0
> 


[PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-12 Thread Hauke Mehrtens
__USE_MISC is glibc specific and not available in musl libc. Only do
this check when glibc is used. This fixes a problem with musl libc.

Signed-off-by: Hauke Mehrtens 
---
 include/uapi/linux/libc-compat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 49a8cc3138ae..ce2fa8a4ced6 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -51,8 +51,8 @@
 /* We have included libc headers... */
 #if !defined(__KERNEL__)
 
-/* Coordinate with glibc net/if.h header. */
-#if defined(_NET_IF_H) && defined(__USE_MISC)
+/* Coordinate with libc net/if.h header. */
+#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
 
 /* GLIBC headers included first so don't define anything
  * that would already be defined. */
-- 
2.11.0



[PATCH 3/4] uapi glibc compat: Do not check for __USE_MISC

2017-03-12 Thread Hauke Mehrtens
__USE_MISC is glibc specific and not available in musl libc. Only do
this check when glibc is used. This fixes a problem with musl libc.

Signed-off-by: Hauke Mehrtens 
---
 include/uapi/linux/libc-compat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 49a8cc3138ae..ce2fa8a4ced6 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -51,8 +51,8 @@
 /* We have included libc headers... */
 #if !defined(__KERNEL__)
 
-/* Coordinate with glibc net/if.h header. */
-#if defined(_NET_IF_H) && defined(__USE_MISC)
+/* Coordinate with libc net/if.h header. */
+#if defined(_NET_IF_H) && (!defined(__GLIBC__) || defined(__USE_MISC))
 
 /* GLIBC headers included first so don't define anything
  * that would already be defined. */
-- 
2.11.0