* Missing include file in include/uapi/linux/errqueue.h?
@ 2016-07-09 17:36 Brooks Moses
2016-07-10 5:43 ` Brooks Moses
0 siblings, 1 reply; 4+ messages in thread
From: Brooks Moses @ 2016-07-09 17:36 UTC (permalink / raw)
To: linux-kernel, Willem de Bruijn, David S. Miller, Ian Kasprzak
Hello!
I've been attempting to qualify the Linux 4.5.2 user-space headers for
a toolchain release, and ran into what looks like a missing include
file in include/uapi/linux/errqueue.h. In particular,
https://github.com/torvalds/linux/commit/f24b9be5957b38bb420b838115040dc2031b7d0c
adds the following to this file:
+struct scm_timestamping {
+ struct timespec ts[3];
+};
However, struct timespec is defined in time.h, which isn't included
either in 4.5.2 or in current head. Is this simply a missing #include
line, or am I misunderstanding something?
I also note that this is the second user-space header in the Linux
4.5.2 release we've run into that simply fails to compile when
included by itself. Is there not a test target that tests for this?
Would it be welcome if I were to work on adding one?
Thanks,
- Brooks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Missing include file in include/uapi/linux/errqueue.h?
2016-07-09 17:36 Missing include file in include/uapi/linux/errqueue.h? Brooks Moses
@ 2016-07-10 5:43 ` Brooks Moses
2016-07-10 13:56 ` Willem de Bruijn
0 siblings, 1 reply; 4+ messages in thread
From: Brooks Moses @ 2016-07-10 5:43 UTC (permalink / raw)
To: linux-kernel, Willem de Bruijn, David S. Miller, Ian Kasprzak
On Sat, Jul 9, 2016 at 10:36 AM, Brooks Moses <bmoses@google.com> wrote:
> I've been attempting to qualify the Linux 4.5.2 user-space headers for
> a toolchain release, and ran into what looks like a missing include
> file in include/uapi/linux/errqueue.h. In particular,
> https://github.com/torvalds/linux/commit/f24b9be5957b38bb420b838115040dc2031b7d0c
> adds the following to this file:
>
> +struct scm_timestamping {
> + struct timespec ts[3];
> +};
>
> However, struct timespec is defined in time.h, which isn't included
> either in 4.5.2 or in current head. Is this simply a missing #include
> line, or am I misunderstanding something?
As a followup: Unfortunately the obvious fix -- adding "#include
<linux/time.h>" -- causes other problems, since linux/time.h is
incompatible with the glibc time.h such that including both of them
into the same compilation unit causes errors about redefined types.
And we, at least, have some programs that want to include
linux/errqueue.h and (glibc's) time.h. The fix of adding "#include
<time.h>" to linux/errqueue.h seems to work for us, but I'm not sure
that won't cause problems in the other direction for other people.
- Brooks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Missing include file in include/uapi/linux/errqueue.h?
2016-07-10 5:43 ` Brooks Moses
@ 2016-07-10 13:56 ` Willem de Bruijn
2016-07-10 15:19 ` Willem de Bruijn
0 siblings, 1 reply; 4+ messages in thread
From: Willem de Bruijn @ 2016-07-10 13:56 UTC (permalink / raw)
To: Brooks Moses
Cc: linux-kernel, David S. Miller, Ian Kasprzak, Willem de Bruijn
On Sun, Jul 10, 2016 at 1:43 AM, Brooks Moses <bmoses@google.com> wrote:
> On Sat, Jul 9, 2016 at 10:36 AM, Brooks Moses <bmoses@google.com> wrote:
>> I've been attempting to qualify the Linux 4.5.2 user-space headers for
>> a toolchain release, and ran into what looks like a missing include
>> file in include/uapi/linux/errqueue.h. In particular,
>> https://github.com/torvalds/linux/commit/f24b9be5957b38bb420b838115040dc2031b7d0c
>> adds the following to this file:
>>
>> +struct scm_timestamping {
>> + struct timespec ts[3];
>> +};
>>
>> However, struct timespec is defined in time.h, which isn't included
>> either in 4.5.2 or in current head. Is this simply a missing #include
>> line,
It is. I missed that in my original patch.
> or am I misunderstanding something?
>
> As a followup: Unfortunately the obvious fix -- adding "#include
> <linux/time.h>" -- causes other problems, since linux/time.h is
> incompatible with the glibc time.h such that including both of them
> into the same compilation unit causes errors about redefined types.
If these conflicts between libc and uapi time.h can be resolved through
include/uapi/linux/libc-compat.h, then we can apply the obvious fix of
including linux/time.h in linux/errqueue.h.
> And we, at least, have some programs that want to include
> linux/errqueue.h and (glibc's) time.h. The fix of adding "#include
> <time.h>" to linux/errqueue.h seems to work for us, but I'm not sure
> that won't cause problems in the other direction for other people.
That breaks kernel compilation.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Missing include file in include/uapi/linux/errqueue.h?
2016-07-10 13:56 ` Willem de Bruijn
@ 2016-07-10 15:19 ` Willem de Bruijn
0 siblings, 0 replies; 4+ messages in thread
From: Willem de Bruijn @ 2016-07-10 15:19 UTC (permalink / raw)
To: Willem de Bruijn
Cc: Brooks Moses, linux-kernel, David S. Miller, Ian Kasprzak
On Sun, Jul 10, 2016 at 9:56 AM, Willem de Bruijn <willemb@google.com> wrote:
> On Sun, Jul 10, 2016 at 1:43 AM, Brooks Moses <bmoses@google.com> wrote:
>> On Sat, Jul 9, 2016 at 10:36 AM, Brooks Moses <bmoses@google.com> wrote:
>>> I've been attempting to qualify the Linux 4.5.2 user-space headers for
>>> a toolchain release, and ran into what looks like a missing include
>>> file in include/uapi/linux/errqueue.h. In particular,
>>> https://github.com/torvalds/linux/commit/f24b9be5957b38bb420b838115040dc2031b7d0c
>>> adds the following to this file:
>>>
>>> +struct scm_timestamping {
>>> + struct timespec ts[3];
>>> +};
>>>
>>> However, struct timespec is defined in time.h, which isn't included
>>> either in 4.5.2 or in current head. Is this simply a missing #include
>>> line,
>
> It is. I missed that in my original patch.
>
>> or am I misunderstanding something?
>>
>> As a followup: Unfortunately the obvious fix -- adding "#include
>> <linux/time.h>" -- causes other problems, since linux/time.h is
>> incompatible with the glibc time.h such that including both of them
>> into the same compilation unit causes errors about redefined types.
>
> If these conflicts between libc and uapi time.h can be resolved through
> include/uapi/linux/libc-compat.h, then we can apply the obvious fix of
> including linux/time.h in linux/errqueue.h.
The below patch (bar whitespace mangling by gmail) avoids redefinition
conflicts for me if linux/time.h is included after time.h. The other direction
would also require changes to the userspace headers, as stated in
libc-compat.h.
>> And we, at least, have some programs that want to include
>> linux/errqueue.h and (glibc's) time.h. The fix of adding "#include
>> <time.h>" to linux/errqueue.h seems to work for us, but I'm not sure
>> that won't cause problems in the other direction for other people.
>
> That breaks kernel compilation.
A simpler other option is to explicitly include either of the time.h
files depending on the environment, similar to uapi/linux/lightnvm.h.
timespec itself is also explicitly defined in uapi/linux/coda.h, but that
won't avoid redefinition if time.h is included afterwards.
The rough libc-compat.h patch:
diff --git a/include/uapi/linux/errqueue.h b/include/uapi/linux/errqueue.h
index 07bdce1..6b1cdc6 100644
--- a/include/uapi/linux/errqueue.h
+++ b/include/uapi/linux/errqueue.h
@@ -2,6 +2,7 @@
#define _UAPI_LINUX_ERRQUEUE_H
#include <linux/types.h>
+#include <linux/time.h>
struct sock_extended_err {
__u32 ee_errno;
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index e4f048e..ef33ea9 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -146,6 +146,16 @@
#define __UAPI_DEF_XATTR 1
#endif
+#if defined(_TIME_H)
+#define __UAPI_DEF_TIMESPEC 0
+#define __UAPI_DEF_ITIMERSPEC 0
+#define __UAPI_DEF_ABSTIME 0
+#else
+#define __UAPI_DEF_TIMESPEC 1
+#define __UAPI_DEF_ITIMERSPEC 1
+#define __UAPI_DEF_ABSTIME 1
+#endif /* _TIME_H */
+
/* If we did not see any headers from any supported C libraries,
* or we are being included in the kernel, then define everything
* that we need. */
@@ -182,6 +192,11 @@
/* Definitions for xattr.h */
#define __UAPI_DEF_XATTR 1
+/* Definitions for time.h */
+#define __UAPI_DEF_TIMESPEC 1
+#define __UAPI_DEF_ITIMERSPEC 1
+#define __UAPI_DEF_ABSTIME 1
+
#endif /* __GLIBC__ */
#endif /* _UAPI_LIBC_COMPAT_H */
diff --git a/include/uapi/linux/time.h b/include/uapi/linux/time.h
index e75e1b6..7129c54 100644
--- a/include/uapi/linux/time.h
+++ b/include/uapi/linux/time.h
@@ -1,9 +1,10 @@
#ifndef _UAPI_LINUX_TIME_H
#define _UAPI_LINUX_TIME_H
+#include <linux/libc-compat.h>
#include <linux/types.h>
-
+#if __UAPI_DEF_TIMESPEC
#ifndef _STRUCT_TIMESPEC
#define _STRUCT_TIMESPEC
struct timespec {
@@ -11,6 +12,7 @@ struct timespec {
long tv_nsec; /* nanoseconds */
};
#endif
+#endif
struct timeval {
__kernel_time_t tv_sec; /* seconds */
@@ -31,10 +33,12 @@ struct timezone {
#define ITIMER_VIRTUAL 1
#define ITIMER_PROF 2
+#if __UAPI_DEF_TIMESPEC
struct itimerspec {
struct timespec it_interval; /* timer period */
struct timespec it_value; /* timer expiration */
};
+#endif
struct itimerval {
struct timeval it_interval; /* timer interval */
@@ -64,6 +68,8 @@ struct itimerval {
/*
* The various flags for setting POSIX.1b interval timers:
*/
+#if __UAPI_DEF_ABSTIME
#define TIMER_ABSTIME 0x01
+#endif
#endif /* _UAPI_LINUX_TIME_H */
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-10 15:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-09 17:36 Missing include file in include/uapi/linux/errqueue.h? Brooks Moses
2016-07-10 5:43 ` Brooks Moses
2016-07-10 13:56 ` Willem de Bruijn
2016-07-10 15:19 ` Willem de Bruijn
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.