Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752608AbdHIMc6 (ORCPT ); Wed, 9 Aug 2017 08:32:58 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:36344 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbdHIMc4 (ORCPT ); Wed, 9 Aug 2017 08:32:56 -0400 MIME-Version: 1.0 In-Reply-To: <20170808230041.GG10552@altlinux.org> References: <20170806164428.2273-1-mikko.rapeli@iki.fi> <20170806164428.2273-16-mikko.rapeli@iki.fi> <20170808230041.GG10552@altlinux.org> From: Arnd Bergmann Date: Wed, 9 Aug 2017 14:32:55 +0200 X-Google-Sender-Auth: 51M65ADPsmdYAtLLSX9EIDjsYPQ Message-ID: Subject: Re: [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space To: "Dmitry V. Levin" Cc: Mikko Rapeli , Linux Kernel Mailing List , Linux API , Networking Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v79CX39W019168 Content-Length: 1169 Lines: 36 On Wed, Aug 9, 2017 at 1:00 AM, Dmitry V. Levin 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 >> +#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