[lkml]   [2017]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space
>> > +#ifdef __KERNEL__
>> > +#include <linux/time.h>
>> > +#else
>> > +#include <time.h>
>> > +#endif /* __KERNEL__ */
>> This will break applications that include <linux/time.h> manually.
>> I previously sent a patch to use libc-compat to make compilation succeed
>> when both are included in the case where <linux/time.h> is included after
>> <time.h>.
>> The inverse will require changes to the libc header to avoid redefining
>> symbols already defined by <linux/time.h>
>> The second patch in that 2-patch set included <linux/time.h>
>> unconditionally after the fix. This broke builds that also included
>> <time.h> in the wrong order. I did not resubmit the first patch as a
>> stand-alone, as it is not sufficient to avoid breakage.
> I wasn't aware of your change, but I was about to send this to fix the
> case when glibc <time.h> is included before <linux/time.h>:

There are a few differences between the two. Including <time.h> does not
unconditionally define all the symbols. Some are conditional on additional
state, such as __timespec_defined.

> but you also ran into problems where <linux/time.h> is included before
> <time.h> which need fixes in libc header side.
> So how to proceed with these?

The libc-compat change is a good fix that can be submitted on its own.

> I don't like leaving a few dozen non-compiling header files into uapi.

I agree, but I do not see a simple solution.

Unless libc has the analogous change, including either <time.h> or
<linux/time.h> in userspace can unfortunately cause breakage.

The added include if __KERNEL__ is defined should be safe, though.

 \ /
  Last update: 2017-08-06 23:25    [W:0.053 / U:3.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site