@@ -14,7 +14,7 @@ fn src_hotfix_dir() -> PathBuf {
14
14
fn do_cc ( ) {
15
15
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
16
16
if cfg ! ( unix) {
17
- let exclude = [ "redox" , "wasi" ] ;
17
+ let exclude = [ "redox" , "wasi" , "wali" ] ;
18
18
if !exclude. iter ( ) . any ( |x| target. contains ( x) ) {
19
19
let mut cmsg = cc:: Build :: new ( ) ;
20
20
@@ -26,7 +26,7 @@ fn do_cc() {
26
26
cmsg. compile ( "cmsg" ) ;
27
27
}
28
28
29
- if target. contains ( "linux" )
29
+ if ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) )
30
30
|| target. contains ( "android" )
31
31
|| target. contains ( "emscripten" )
32
32
|| target. contains ( "fuchsia" )
@@ -35,10 +35,10 @@ fn do_cc() {
35
35
cc:: Build :: new ( ) . file ( "src/makedev.c" ) . compile ( "makedev" ) ;
36
36
}
37
37
}
38
- if target. contains ( "android" ) || target. contains ( "linux" ) {
38
+ if target. contains ( "android" ) || ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) ) {
39
39
cc:: Build :: new ( ) . file ( "src/errqueue.c" ) . compile ( "errqueue" ) ;
40
40
}
41
- if target. contains ( "linux" )
41
+ if ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) )
42
42
|| target. contains ( "l4re" )
43
43
|| target. contains ( "android" )
44
44
|| target. contains ( "emscripten" )
@@ -3509,6 +3509,7 @@ fn test_linux(target: &str) {
3509
3509
let x86_64_gnux32 = target. contains ( "gnux32" ) && x86_64;
3510
3510
let riscv64 = target. contains ( "riscv64" ) ;
3511
3511
let loongarch64 = target. contains ( "loongarch64" ) ;
3512
+ let wasm32 = target. contains ( "wasm32" ) ;
3512
3513
let uclibc = target. contains ( "uclibc" ) ;
3513
3514
3514
3515
let mut cfg = ctest_cfg ( ) ;
@@ -3634,68 +3635,73 @@ fn test_linux(target: &str) {
3634
3635
cfg:
3635
3636
[ loongarch64 || riscv64] : "asm/hwcap.h" ,
3636
3637
"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
+ }
3699
3705
}
3700
3706
3701
3707
// note: aio.h must be included before sys/mount.h
@@ -4632,6 +4638,7 @@ fn test_linux_like_apis(target: &str) {
4632
4638
let gnu = target. contains ( "gnu" ) ;
4633
4639
let musl = target. contains ( "musl" ) || target. contains ( "ohos" ) ;
4634
4640
let linux = target. contains ( "linux" ) ;
4641
+ let wali = target. contains ( "linux" ) && target. contains ( "wasm32" ) ;
4635
4642
let emscripten = target. contains ( "emscripten" ) ;
4636
4643
let android = target. contains ( "android" ) ;
4637
4644
assert ! ( linux || android || emscripten) ;
@@ -4681,7 +4688,7 @@ fn test_linux_like_apis(target: &str) {
4681
4688
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_fcntl.rs" ) ;
4682
4689
}
4683
4690
4684
- if linux || android {
4691
+ if ( linux && !wali ) || android {
4685
4692
// test termios
4686
4693
let mut cfg = ctest_cfg ( ) ;
4687
4694
cfg. header ( "asm/termbits.h" ) ;
@@ -4733,7 +4740,7 @@ fn test_linux_like_apis(target: &str) {
4733
4740
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_ipv6.rs" ) ;
4734
4741
}
4735
4742
4736
- if linux || android {
4743
+ if ( linux && !wali ) || android {
4737
4744
// Test Elf64_Phdr and Elf32_Phdr
4738
4745
// These types have a field called `p_type`, but including
4739
4746
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
@@ -4755,7 +4762,7 @@ fn test_linux_like_apis(target: &str) {
4755
4762
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_elf.rs" ) ;
4756
4763
}
4757
4764
4758
- if linux || android {
4765
+ if ( linux && !wali ) || android {
4759
4766
// Test `ARPHRD_CAN`.
4760
4767
let mut cfg = ctest_cfg ( ) ;
4761
4768
cfg. header ( "linux/if_arp.h" ) ;
0 commit comments