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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mostly I need the uid_t type for syscalls(getuid/setuid)
Which is defined in sys/types.h but that header also includes time
related stuff.

For context I'm writing a libc equivilant library (in rust).

Thanks,
Elichai.

On Wed, Jan 29, 2020 at 7:16 PM Carlos O'Donell <codonell@xxxxxxxxxx> wrote:
>
> 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.
>


-- 
PGP: 5607C93B5F86650C



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux