From 352ee1c37d04efd59dd067bbf151e3af33fe5cc6 Mon Sep 17 00:00:00 2001
From: gnzlbg <gonzalobg88@gmail.com>
Date: Tue, 14 May 2019 16:55:23 +0200
Subject: [PATCH] Include Linux headers after sys headers

---
 libc-test/build.rs | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/libc-test/build.rs b/libc-test/build.rs
index c4595ebd..94735f0d 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -2274,19 +2274,6 @@ fn test_linux(target: &str) {
                "langinfo.h",
                "limits.h",
                "link.h",
-               "linux/falloc.h",
-               "linux/fs.h",
-               "linux/genetlink.h",
-               "linux/if_alg.h",
-               "linux/if_ether.h",
-               "linux/if_tun.h",
-               "linux/input.h",
-               "linux/module.h",
-               "linux/net_tstamp.h",
-               "linux/netlink.h",
-               "linux/random.h",
-               "linux/seccomp.h",
-               "linux/sockios.h",
                "locale.h",
                "malloc.h",
                "mntent.h",
@@ -2362,6 +2349,24 @@ fn test_linux(target: &str) {
                "errno.h",
     }
 
+    // Include linux headers at the end:
+    headers! {
+        cfg:
+        "linux/falloc.h",
+        "linux/fs.h",
+        "linux/genetlink.h",
+        "linux/if_alg.h",
+        "linux/if_ether.h",
+        "linux/if_tun.h",
+        "linux/input.h",
+        "linux/module.h",
+        "linux/net_tstamp.h",
+        "linux/netlink.h",
+        "linux/random.h",
+        "linux/seccomp.h",
+        "linux/sockios.h",
+    }
+
     if x86_64 {
         headers! { cfg: "sys/io.h" };
     }
-- 
GitLab