On Wed, 02 Mar 2016 23:14:54 +0100, Thomas Klausner wrote:
From 634255a4d87a12132bb65868f5658fd14cd2bfd7 Mon Sep 17 00:00:00 2001
From: Thomas Klausner wiz@NetBSD.org Date: Wed, 2 Mar 2016 23:11:54 +0100 Subject: [PATCH] Define some types if missing.
For portability with non-Linux.
Include Linux header on Linux only.
include/local.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/include/local.h b/include/local.h index 28ed106..9728598 100644 --- a/include/local.h +++ b/include/local.h @@ -50,13 +50,52 @@ #include <sys/poll.h> #include <sys/types.h> #include <errno.h> +#if defined(__linux__) #include <linux/types.h> #include <linux/ioctl.h> +#endif
#ifndef EBADFD #define EBADFD EBADF #endif
+#ifndef __u16 +#define __u16 uint16_t +#endif +#ifndef __u32 +#define __u32 uint32_t +#endif +#ifndef __u64 +#define __u64 uint64_t +#endif +#ifndef __le16 +#define __le16 uint16_t +#endif +#ifndef __le32 +#define __le32 uint32_t +#endif +#ifndef __le64 +#define __le64 uint64_t +#endif +#ifndef u_int8_t +#define u_int8_t uint8_t +#endif +#ifndef u_int16_t +#define u_int16_t uint16_t +#endif +#ifndef u_int32_t +#define u_int32_t uint32_t +#endif +#ifndef u_int32_t +#define u_int32_t uint64_t +#endif +#ifndef __kernel_pid_t +#define __kernel_pid_t pid_t +#endif +#ifndef __kernel_off_t +#define __kernel_off_t off_t +#endif
Can we put this in include/type_compat.h or something like that, and include it in #else block of #ifdef __linux__?
As a bonus, the EBADFD definition can also go to there, too.
thanks,
Takashi