Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1704893 > unrolled thread

[PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space

Started byMikko Rapeli <mikko.rapeli@iki.fi>
First post2017-08-06 19:10 +0200
Last post2017-08-09 14:40 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space Mikko Rapeli <mikko.rapeli@iki.fi> - 2017-08-06 19:10 +0200
    Re: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in  user space "Dmitry V. Levin" <ldv@altlinux.org> - 2017-08-09 01:10 +0200
      Re: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in  user space Arnd Bergmann <arnd@arndb.de> - 2017-08-09 14:40 +0200

#1704893 — [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space

FromMikko Rapeli <mikko.rapeli@iki.fi>
Date2017-08-06 19:10 +0200
Subject[PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space
Message-ID<ubxdU-50T-27@gated-at.bofh.it>
This libc header has sockaddr definition in user space.

Fixes user space compilation errors like these from kernel headers including
only linux/socket.h:

error: field ‘ifru_addr’ has incomplete type
struct sockaddr ifru_addr;
error: field ‘_sockaddr’ has incomplete type
struct sockaddr  _sockaddr;
error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’

With this following uapi headers now compile in user space:

rdma/rdma_user_rxe.h
linux/vm_sockets.h
linux/ncp_fs.h
linux/nfc.h
linux/phonet.h

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: netdev@vger.kernel.org
Cc: Dmitry V. Levin <ldv@altlinux.org>
---
 include/uapi/linux/socket.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
index 76ab0c68561e..8a81197cc08b 100644
--- a/include/uapi/linux/socket.h
+++ b/include/uapi/linux/socket.h
@@ -1,6 +1,10 @@
 #ifndef _UAPI_LINUX_SOCKET_H
 #define _UAPI_LINUX_SOCKET_H
 
+#ifndef __KERNEL__
+#include <sys/socket.h>
+#endif
+
 /*
  * Desired design of maximum size and alignment (see RFC2553)
  */
-- 
2.13.3

[toc] | [next] | [standalone]


#1706940 — Re: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space

From"Dmitry V. Levin" <ldv@altlinux.org>
Date2017-08-09 01:10 +0200
SubjectRe: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space
Message-ID<uclNo-6X2-23@gated-at.bofh.it>
In reply to#1704893

[Multipart message — attachments visible in raw view] — view raw

On Sun, Aug 06, 2017 at 06:44:06PM +0200, Mikko Rapeli wrote:
> This libc header has sockaddr definition in user space.
> 
> Fixes user space compilation errors like these from kernel headers including
> only linux/socket.h:
> 
> error: field ‘ifru_addr’ has incomplete type
> struct sockaddr ifru_addr;
> error: field ‘_sockaddr’ has incomplete type
> struct sockaddr  _sockaddr;
> error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’
> 
> With this following uapi headers now compile in user space:
> 
> rdma/rdma_user_rxe.h
> linux/vm_sockets.h
> linux/ncp_fs.h
> linux/nfc.h
> linux/phonet.h
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> Cc: netdev@vger.kernel.org
> Cc: Dmitry V. Levin <ldv@altlinux.org>
> ---
>  include/uapi/linux/socket.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/uapi/linux/socket.h b/include/uapi/linux/socket.h
> index 76ab0c68561e..8a81197cc08b 100644
> --- a/include/uapi/linux/socket.h
> +++ b/include/uapi/linux/socket.h
> @@ -1,6 +1,10 @@
>  #ifndef _UAPI_LINUX_SOCKET_H
>  #define _UAPI_LINUX_SOCKET_H
>  
> +#ifndef __KERNEL__
> +#include <sys/socket.h>
> +#endif

This is scary because of infamous libc vs uapi interoperability issues.
Couldn't we fix affected headers instead?


-- 
ldv

[toc] | [prev] | [next] | [standalone]


#1707315 — Re: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space

FromArnd Bergmann <arnd@arndb.de>
Date2017-08-09 14:40 +0200
SubjectRe: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space
Message-ID<ucyrg-733-35@gated-at.bofh.it>
In reply to#1706940
On Wed, Aug 9, 2017 at 1:00 AM, Dmitry V. Levin <ldv@altlinux.org> wrote:
> On Sun, Aug 06, 2017 at 06:44:06PM +0200, Mikko Rapeli wrote:
>> This libc header has sockaddr definition in user space.
>>
>> Fixes user space compilation errors like these from kernel headers including
>> only linux/socket.h:
>>
>> error: field ‘ifru_addr’ has incomplete type
>> struct sockaddr ifru_addr;
>> error: field ‘_sockaddr’ has incomplete type
>> struct sockaddr  _sockaddr;
>> error: invalid application of ‘sizeof’ to incomplete type ‘struct sockaddr’
>>
>> With this following uapi headers now compile in user space:
>>
>> rdma/rdma_user_rxe.h
>> linux/vm_sockets.h
>> linux/ncp_fs.h
>> linux/nfc.h
>> linux/phonet.h
>>

>>
>> +#ifndef __KERNEL__
>> +#include <sys/socket.h>
>> +#endif
>
> This is scary because of infamous libc vs uapi interoperability issues.
> Couldn't we fix affected headers instead?

Yes, I think that would be better. Maybe we can introduce a
'struct __kernel_sockaddr' in include/uapi/linux/socket.h to
go along with __kernel_sa_family_t and __kernel_sockaddr_storage,
and then use those types in the other kernel headers?

       Arnd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web