Thread (1 message) 1 message, 1 author, 2020-01-29

Re: Including both linux/time.h and linux/input.h causes failure

From: Carlos O'Donell <hidden>
Date: 2020-01-29 17:16:26

On 1/29/20 10:14 AM, Elichai Turkel wrote:
Hi,
The following header: <wrapper.h>:
#include <linux/input.h>
#include <linux/time.h>
Will cause the compiler to fail because of redefinition of a lot of
time related structs, that are declared once in `linux/time.h` and
then again via `bits/types/struct_timeval.h` which is included through
`linux/input.h > sys/time.h -> bits/types/struct_timeval.h`
 
This is another header-coordination issue between the kernel and libc.

In this case it's linux/time.h vs. sys/time.h.

"Synchronizing Headers"
https://sourceware.org/glibc/wiki/Synchronizing_Headers
- Just added your case.

It's not immediate clear to me if the UAPI header is clean enough to
use directly in glibc or not, and that's often the simplest way to fix
things.

When you can't just use the kernel header definitions then you have
to work through the conflict and decide if you want to allow both headers
to be potentially included and in which orders to support it.

Why do you need both headers included?

-- 
Cheers,
Carlos.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help