@@ -14,7 +14,7 @@ fn src_hotfix_dir() -> PathBuf {
1414fn do_cc ( ) {
1515 let target = env:: var ( "TARGET" ) . unwrap ( ) ;
1616 if cfg ! ( unix) {
17- let exclude = [ "redox" , "wasi" ] ;
17+ let exclude = [ "redox" , "wasi" , "wali" ] ;
1818 if !exclude. iter ( ) . any ( |x| target. contains ( x) ) {
1919 let mut cmsg = cc:: Build :: new ( ) ;
2020
@@ -26,7 +26,7 @@ fn do_cc() {
2626 cmsg. compile ( "cmsg" ) ;
2727 }
2828
29- if target. contains ( "linux" )
29+ if ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) )
3030 || target. contains ( "android" )
3131 || target. contains ( "emscripten" )
3232 || target. contains ( "fuchsia" )
@@ -35,10 +35,10 @@ fn do_cc() {
3535 cc:: Build :: new ( ) . file ( "src/makedev.c" ) . compile ( "makedev" ) ;
3636 }
3737 }
38- if target. contains ( "android" ) || target. contains ( "linux" ) {
38+ if target. contains ( "android" ) || ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) ) {
3939 cc:: Build :: new ( ) . file ( "src/errqueue.c" ) . compile ( "errqueue" ) ;
4040 }
41- if target. contains ( "linux" )
41+ if ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) )
4242 || target. contains ( "l4re" )
4343 || target. contains ( "android" )
4444 || target. contains ( "emscripten" )
@@ -3509,6 +3509,7 @@ fn test_linux(target: &str) {
35093509 let x86_64_gnux32 = target. contains ( "gnux32" ) && x86_64;
35103510 let riscv64 = target. contains ( "riscv64" ) ;
35113511 let loongarch64 = target. contains ( "loongarch64" ) ;
3512+ let wasm32 = target. contains ( "wasm32" ) ;
35123513 let uclibc = target. contains ( "uclibc" ) ;
35133514
35143515 let mut cfg = ctest_cfg ( ) ;
@@ -3634,68 +3635,73 @@ fn test_linux(target: &str) {
36343635 cfg:
36353636 [ loongarch64 || riscv64] : "asm/hwcap.h" ,
36363637 "asm/mman.h" ,
3637- [ gnu] : "linux/aio_abi.h" ,
3638- "linux/can.h" ,
3639- "linux/can/raw.h" ,
3640- "linux/can/j1939.h" ,
3641- "linux/dccp.h" ,
3642- "linux/errqueue.h" ,
3643- "linux/falloc.h" ,
3644- "linux/filter.h" ,
3645- "linux/fs.h" ,
3646- "linux/futex.h" ,
3647- "linux/genetlink.h" ,
3648- "linux/if.h" ,
3649- "linux/if_addr.h" ,
3650- "linux/if_alg.h" ,
3651- "linux/if_ether.h" ,
3652- "linux/if_packet.h" ,
3653- "linux/if_tun.h" ,
3654- "linux/if_xdp.h" ,
3655- "linux/input.h" ,
3656- "linux/ipv6.h" ,
3657- "linux/kexec.h" ,
3658- "linux/keyctl.h" ,
3659- "linux/magic.h" ,
3660- "linux/memfd.h" ,
3661- "linux/membarrier.h" ,
3662- "linux/mempolicy.h" ,
3663- "linux/mman.h" ,
3664- "linux/module.h" ,
3665- "linux/mount.h" ,
3666- "linux/net_tstamp.h" ,
3667- "linux/netfilter/nfnetlink.h" ,
3668- "linux/netfilter/nfnetlink_log.h" ,
3669- "linux/netfilter/nfnetlink_queue.h" ,
3670- "linux/netfilter/nf_tables.h" ,
3671- "linux/netfilter_arp.h" ,
3672- "linux/netfilter_bridge.h" ,
3673- "linux/netfilter_ipv4.h" ,
3674- "linux/netfilter_ipv6.h" ,
3675- "linux/netfilter_ipv6/ip6_tables.h" ,
3676- "linux/netlink.h" ,
3677- "linux/openat2.h" ,
3678- // FIXME(linux): some items require Linux >= 5.6:
3679- "linux/ptp_clock.h" ,
3680- "linux/ptrace.h" ,
3681- "linux/quota.h" ,
3682- "linux/random.h" ,
3683- "linux/reboot.h" ,
3684- "linux/rtnetlink.h" ,
3685- "linux/sched.h" ,
3686- "linux/sctp.h" ,
3687- "linux/seccomp.h" ,
3688- "linux/sock_diag.h" ,
3689- "linux/sockios.h" ,
3690- "linux/tls.h" ,
3691- "linux/uinput.h" ,
3692- "linux/vm_sockets.h" ,
3693- "linux/wait.h" ,
3694- "linux/wireless.h" ,
3695- "sys/fanotify.h" ,
3696- // <sys/auxv.h> is not present on uclibc
3697- [ !uclibc] : "sys/auxv.h" ,
3698- [ gnu || musl] : "linux/close_range.h" ,
3638+ }
3639+
3640+ if !wasm32 {
3641+ headers ! { cfg:
3642+ [ gnu] : "linux/aio_abi.h" ,
3643+ "linux/can.h" ,
3644+ "linux/can/raw.h" ,
3645+ "linux/can/j1939.h" ,
3646+ "linux/dccp.h" ,
3647+ "linux/errqueue.h" ,
3648+ "linux/falloc.h" ,
3649+ "linux/filter.h" ,
3650+ "linux/fs.h" ,
3651+ "linux/futex.h" ,
3652+ "linux/genetlink.h" ,
3653+ "linux/if.h" ,
3654+ "linux/if_addr.h" ,
3655+ "linux/if_alg.h" ,
3656+ "linux/if_ether.h" ,
3657+ "linux/if_packet.h" ,
3658+ "linux/if_tun.h" ,
3659+ "linux/if_xdp.h" ,
3660+ "linux/input.h" ,
3661+ "linux/ipv6.h" ,
3662+ "linux/kexec.h" ,
3663+ "linux/keyctl.h" ,
3664+ "linux/magic.h" ,
3665+ "linux/memfd.h" ,
3666+ "linux/membarrier.h" ,
3667+ "linux/mempolicy.h" ,
3668+ "linux/mman.h" ,
3669+ "linux/module.h" ,
3670+ "linux/mount.h" ,
3671+ "linux/net_tstamp.h" ,
3672+ "linux/netfilter/nfnetlink.h" ,
3673+ "linux/netfilter/nfnetlink_log.h" ,
3674+ "linux/netfilter/nfnetlink_queue.h" ,
3675+ "linux/netfilter/nf_tables.h" ,
3676+ "linux/netfilter_arp.h" ,
3677+ "linux/netfilter_bridge.h" ,
3678+ "linux/netfilter_ipv4.h" ,
3679+ "linux/netfilter_ipv6.h" ,
3680+ "linux/netfilter_ipv6/ip6_tables.h" ,
3681+ "linux/netlink.h" ,
3682+ "linux/openat2.h" ,
3683+ // FIXME(linux): some items require Linux >= 5.6:
3684+ "linux/ptp_clock.h" ,
3685+ "linux/ptrace.h" ,
3686+ "linux/quota.h" ,
3687+ "linux/random.h" ,
3688+ "linux/reboot.h" ,
3689+ "linux/rtnetlink.h" ,
3690+ "linux/sched.h" ,
3691+ "linux/sctp.h" ,
3692+ "linux/seccomp.h" ,
3693+ "linux/sock_diag.h" ,
3694+ "linux/sockios.h" ,
3695+ "linux/tls.h" ,
3696+ "linux/uinput.h" ,
3697+ "linux/vm_sockets.h" ,
3698+ "linux/wait.h" ,
3699+ "linux/wireless.h" ,
3700+ "sys/fanotify.h" ,
3701+ // <sys/auxv.h> is not present on uclibc
3702+ [ !uclibc] : "sys/auxv.h" ,
3703+ [ gnu || musl] : "linux/close_range.h" ,
3704+ }
36993705 }
37003706
37013707 // note: aio.h must be included before sys/mount.h
@@ -4632,6 +4638,7 @@ fn test_linux_like_apis(target: &str) {
46324638 let gnu = target. contains ( "gnu" ) ;
46334639 let musl = target. contains ( "musl" ) || target. contains ( "ohos" ) ;
46344640 let linux = target. contains ( "linux" ) ;
4641+ let wali = target. contains ( "linux" ) && target. contains ( "wasm32" ) ;
46354642 let emscripten = target. contains ( "emscripten" ) ;
46364643 let android = target. contains ( "android" ) ;
46374644 assert ! ( linux || android || emscripten) ;
@@ -4681,7 +4688,7 @@ fn test_linux_like_apis(target: &str) {
46814688 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_fcntl.rs" ) ;
46824689 }
46834690
4684- if linux || android {
4691+ if ( linux && !wali ) || android {
46854692 // test termios
46864693 let mut cfg = ctest_cfg ( ) ;
46874694 cfg. header ( "asm/termbits.h" ) ;
@@ -4733,7 +4740,7 @@ fn test_linux_like_apis(target: &str) {
47334740 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_ipv6.rs" ) ;
47344741 }
47354742
4736- if linux || android {
4743+ if ( linux && !wali ) || android {
47374744 // Test Elf64_Phdr and Elf32_Phdr
47384745 // These types have a field called `p_type`, but including
47394746 // "resolve.h" defines a `p_type` macro that expands to `__p_type`
@@ -4755,7 +4762,7 @@ fn test_linux_like_apis(target: &str) {
47554762 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_elf.rs" ) ;
47564763 }
47574764
4758- if linux || android {
4765+ if ( linux && !wali ) || android {
47594766 // Test `ARPHRD_CAN`.
47604767 let mut cfg = ctest_cfg ( ) ;
47614768 cfg. header ( "linux/if_arp.h" ) ;
0 commit comments