lkml.org 
[lkml]   [2021]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] uapi: Make __{u,s}64 match {u,}int64_t in userspace
    Hi!
    > I am all for matching __uN / __sN to uintN_t / intN_t in userspace, but may I suggest the technically simpler and guaranteed-to-be-accurate
    >
    > /*
    > - * int-ll64 is used everywhere now.
    > + * int-ll64 is used everywhere in kernel now.
    > + * In user space match <stdint.h>.
    > */
    > +#ifdef __KERNEL__
    > # include <asm-generic/int-ll64.h>
    > +#elif __has_include (<bits/types.h>)
    > +# include <bits/types.h>
    > +typedef __int8_t __s8;
    > +typedef __uint8_t __u8;
    > +typedef __int16_t __s16;
    > +typedef __uint16_t __u16;
    > +typedef __int32_t __s32;
    > +typedef __uint32_t __u32;
    > +typedef __int64_t __s64;
    > +typedef __uint64_t __u64;
    > +#else
    > +# include <stdint.h>
    > +typedef int8_t __s8;
    > +typedef uint8_t __u8;
    > +typedef int16_t __s16;
    > +typedef uint16_t __u16;
    > +typedef int32_t __s32;
    > +typedef uint32_t __u32;
    > +typedef int64_t __s64;
    > +typedef uint64_t __u64;
    > +#endif
    >
    > The middle clause could be dropped if we are okay with all uapi headers potentially exposing the non-implementation-namespace names defined by <stdint.h>. I do not know what the musl libc equivalent of <bits/types.h> is.

    If it's okay to depend on a header defined by a libc this is better
    solution.

    --
    Cyril Hrubis
    chrubis@suse.cz

    \
     
     \ /
      Last update: 2021-11-23 10:14    [W:4.610 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site