From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11126 Path: news.gmane.org!.POSTED!not-for-mail From: Carlos O'Donell Newsgroups: gmane.linux.lib.musl.general,gmane.linux.kernel,gmane.linux.kernel.api Subject: Re: [PATCH resent] uapi libc compat: allow non-glibc to opt out of uapi definitions Date: Wed, 8 Mar 2017 19:51:29 -0500 Organization: Red Hat Message-ID: References: <20161111120820.GA435@nyan> <20170309001435.GJ2082@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1489020708 15796 195.159.176.226 (9 Mar 2017 00:51:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 9 Mar 2017 00:51:48 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 To: linux-kernel@vger.kernel.org, "David S. Miller" , linux-api@vger.kernel.org, musl@lists.openwall.com, Rich Felker Original-X-From: musl-return-11141-gllmg-musl=m.gmane.org@lists.openwall.com Thu Mar 09 01:51:44 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1clmIt-00039Z-RR for gllmg-musl@m.gmane.org; Thu, 09 Mar 2017 01:51:39 +0100 Original-Received: (qmail 27882 invoked by uid 550); 9 Mar 2017 00:51:44 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 27861 invoked from network); 9 Mar 2017 00:51:43 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding; bh=4xJ+/l2ctwlElA4ep8hZHehuBFVJFYJKy3+XZJG/fEY=; b=XdGzQyYgpbw8T6RdDkbLLnKPksTgHON7EWO8aEg804fGm8oJmxwVb+LMB/rgrkX2bl +YdkhLv0mANa2mYU8sGIx/xg0KxUK3BMewXySvmMX1cQxb345Sr9nbL77V3y3J4EdUjE ZrMVZJnRO6rc+7A/RhYwQw7+Q3GRGDHn1N8RQz3jOoYOJiwDOVK5OCwslS10tLuGeZen dO+J2smj7Zfg0FmU3MKr2eJ7wKJbK6GhBNeOac45sDJh9bAZtlKaUGJtbepkCys7lVu4 KfJs/c4Cp3d14co7Qi4WMhBate1F1SuU34QvldtmK22x6TEEazjTinExudCpSbw6Mjot itbw== X-Gm-Message-State: AMke39kTJ0RtK8MePoH4M+9ru38r3pDy/BltzOSGF0g4QLsO5VSwuGuwvz3vC6lYM4y0kmqn X-Received: by 10.200.48.209 with SMTP id w17mr12237312qta.179.1489020691818; Wed, 08 Mar 2017 16:51:31 -0800 (PST) In-Reply-To: <20170309001435.GJ2082@port70.net> Xref: news.gmane.org gmane.linux.lib.musl.general:11126 gmane.linux.kernel:2426767 gmane.linux.kernel.api:22436 Archived-At: On 03/08/2017 07:14 PM, Szabolcs Nagy wrote: > * Carlos O'Donell [2017-03-08 10:53:00 -0500]: >> On 11/11/2016 07:08 AM, Felix Janda wrote: >>> fixes the following compiler errors when is included >>> after musl : >>> >>> ./linux/in6.h:32:8: error: redefinition of 'struct in6_addr' >>> ./linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6' >>> ./linux/in6.h:59:8: error: redefinition of 'struct ipv6_mreq' >> >> Do you have plans for fixing the error when the inclusion order is the other way? > > the other way (linux header included first) is > problematic because linux headers don't follow > all the standards the libc follows, they violate > namespace rules in their struct definitions, so > the libc definitions are necessarily incompatible > with them and thus different translation units can > end up refering to the same object through > incompatible types which is undefined. > (even if the abi matches and thus works across > the syscall interface, a sufficiently smart > toolchain can break such code at link time, > and since the libc itself uses its own definitons > that's what user code should use too). > > there should be a way to include standard conform > libc headers and linux headers into the same tu, > at least the case when all conflicting definitions > come from the libc should work and i think that > should be the scope of these libc-compat.h changes. > (of course if glibc tries to support arbitrary > interleavings then the changes should not break that) You can get non-standard defines even when including the linux headers _after_ libc headers because linux headers should rightly continue to define things that are required for linux-specific applications. IMO the fact that the UAPI headers may cause problems with standards conformance is orthogonal to the discussion of _how_ we fix inclusion order issues. Some of the network headers can be used in relative safety and need to be used for some applications. It is those cases where I'd like to see an inclusion guard design that works for both inclusion orders. -- Cheers, Carlos.