[igt-dev] [PATCH i-g-t 12/29] Include Linux specific headers only on Linux

D Scott Phillips d.scott.phillips at intel.com
Wed Dec 11 00:52:18 UTC 2019


Include Linux specific headers like sys/sysmacros.h or
linux/limits.h with a defined(__linux__) guard, for compatibility
with other platforms.

Signed-off-by: D Scott Phillips <d.scott.phillips at intel.com>
---
 lib/igt_debugfs.c | 2 ++
 lib/igt_device.c  | 2 ++
 lib/igt_sysfs.c   | 2 ++
 runner/job_list.c | 2 ++
 tools/aubdump.c   | 2 ++
 5 files changed, 10 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 34b2e4ee..5a9c8c3c 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -25,7 +25,9 @@
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
+#if defined(__linux__)
 #include <sys/sysmacros.h>
+#endif
 #include <dirent.h>
 #include <errno.h>
 #include <stdio.h>
diff --git a/lib/igt_device.c b/lib/igt_device.c
index 07bb0a0d..01a9eff4 100644
--- a/lib/igt_device.c
+++ b/lib/igt_device.c
@@ -25,7 +25,9 @@
 #include <fcntl.h>
 
 #include <sys/stat.h>
+#if defined(__linux__)
 #include <sys/sysmacros.h>
+#endif
 #include "igt.h"
 #include "igt_device.h"
 #include "igt_sysfs.h"
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index 61293a4e..5b3f817c 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -24,7 +24,9 @@
 
 #include <inttypes.h>
 #include <sys/stat.h>
+#if defined(__linux__)
 #include <sys/sysmacros.h>
+#endif
 #include <sys/mount.h>
 #include <errno.h>
 #include <stdarg.h>
diff --git a/runner/job_list.c b/runner/job_list.c
index bc10a1bf..8014a58c 100644
--- a/runner/job_list.c
+++ b/runner/job_list.c
@@ -1,7 +1,9 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#if defined(__linux__)
 #include <linux/limits.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 00e19712..25c28e62 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -30,7 +30,9 @@
 #include <stdarg.h>
 #include <fcntl.h>
 #include <sys/types.h>
+#if defined(__linux__)
 #include <sys/sysmacros.h>
+#endif
 #include <sys/stat.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
-- 
2.23.0



More information about the igt-dev mailing list