On Wed, Jun 5, 2019 at 3:21 AM Arnd Bergmann <arnd@xxxxxxxx> wrote: > > > > > > > > There are two ways to define fixed-width type. > > > > > > > > [1] #include <linux/types.h>, __u8, __u16, __u32, __u64 > > > > > > > > vs > > > > > > > > [2] #include <stdint.h>, uint8_t, uint16_t, uint32_t, uint64_t > > > > > > > > > > > > Both are used in UAPI headers. > > > > IIRC, <stdint.h> was standardized by C99. > > > > > > > > So, we have already relied on C99 in user-space too. > > A related problem is that using the stdint.h types requires > including stdint.h first, but the C library requires that including > one standard header does not include another one recursively. > > So if sys/socket.h includes linux/socket.h, that must not include > stdint.h or any other header file that does so. This means we cannot reliably use uint{8,16,32,64}_t in UAPI headers. [1] If we include <stdint.h> from linux/foo.h If sys/foo.h includes <linux/foo.h> and <stdint.h>, it violates the C library requirement. [2] If we do not include <stdint.h> from linux/foo.h If sys/foo.h includes <linux/foo.h>, but not <stdint.h>, we get 'unknown type name' errors. -- Best Regards Masahiro Yamada