@@ -1995,6 +1995,10 @@ fn test_linux(target: &str) {
19951995 ) ,
19961996 }
19971997
1998+ let arm = target. contains ( "arm" ) ;
1999+ let x86_64 = target. contains ( "x86_64" ) ;
2000+ let x86_32 = target. contains ( "i686" ) ;
2001+ let x32 = target. contains ( "x32" ) ;
19982002 let mips = target. contains ( "mips" ) ;
19992003 let mips32 = mips && !target. contains ( "64" ) ;
20002004
@@ -2046,7 +2050,6 @@ fn test_linux(target: &str) {
20462050 "stdio.h" ,
20472051 "stdlib.h" ,
20482052 "string.h" ,
2049- "sys/sysctl.h" ,
20502053 "sys/epoll.h" ,
20512054 "sys/eventfd.h" ,
20522055 "sys/file.h" ,
@@ -2097,15 +2100,27 @@ fn test_linux(target: &str) {
20972100
20982101 // `sys/io.h` is only available on x86*, Alpha, IA64, and 32-bit ARM:
20992102 // https://bugzilla.redhat.com/show_bug.cgi?id=1116162
2100- if target . contains ( "x86" ) || target . contains ( " arm" ) {
2103+ if x86_64 || x86_32 || arm {
21012104 headers ! { cfg: "sys/io.h" }
21022105 }
21032106
21042107 // `sys/reg.h` is only available on x86 and x86_64
2105- if target . contains ( "x86" ) {
2108+ if x86_64 || x86_32 {
21062109 headers ! { cfg: "sys/reg.h" }
21072110 }
21082111
2112+ // sysctl system call is deprecated and not available on musl
2113+ // It is also unsupported in x32:
2114+ if !( x32 || musl) {
2115+ headers ! { cfg: "sys/sysctl.h" }
2116+ }
2117+
2118+ // <execinfo.h> is not supported by musl:
2119+ // https://www.openwall.com/lists/musl/2015/04/09/3
2120+ if !musl {
2121+ headers ! { cfg: "execinfo.h" }
2122+ }
2123+
21092124 // Include linux headers at the end:
21102125 headers ! {
21112126 cfg:
@@ -2115,7 +2130,6 @@ fn test_linux(target: &str) {
21152130 "linux/fs.h" ,
21162131 "linux/futex.h" ,
21172132 "linux/genetlink.h" ,
2118- "linux/if.h" ,
21192133 "linux/if_addr.h" ,
21202134 "linux/if_alg.h" ,
21212135 "linux/if_ether.h" ,
@@ -2138,6 +2152,11 @@ fn test_linux(target: &str) {
21382152 "sys/auxv.h" ,
21392153 }
21402154
2155+ // FIXME: https://github.com/sabotage-linux/kernel-headers/issues/16
2156+ if !musl {
2157+ headers ! { cfg: "linux/if.h" }
2158+ }
2159+
21412160 // note: aio.h must be included before sys/mount.h
21422161 headers ! { cfg:
21432162 "sys/xattr.h" ,
0 commit comments