@@ -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" )
@@ -3437,6 +3437,7 @@ fn test_linux(target: &str) {
3437
3437
let x86_64_gnux32 = target. contains ( "gnux32" ) && x86_64;
3438
3438
let riscv64 = target. contains ( "riscv64" ) ;
3439
3439
let loongarch64 = target. contains ( "loongarch64" ) ;
3440
+ let wasm32 = target. contains ( "wasm32" ) ;
3440
3441
let uclibc = target. contains ( "uclibc" ) ;
3441
3442
3442
3443
let mut cfg = ctest_cfg ( ) ;
@@ -3562,68 +3563,73 @@ fn test_linux(target: &str) {
3562
3563
cfg:
3563
3564
[ loongarch64 || riscv64] : "asm/hwcap.h" ,
3564
3565
"asm/mman.h" ,
3565
- [ gnu] : "linux/aio_abi.h" ,
3566
- "linux/can.h" ,
3567
- "linux/can/raw.h" ,
3568
- "linux/can/j1939.h" ,
3569
- "linux/dccp.h" ,
3570
- "linux/errqueue.h" ,
3571
- "linux/falloc.h" ,
3572
- "linux/filter.h" ,
3573
- "linux/fs.h" ,
3574
- "linux/futex.h" ,
3575
- "linux/genetlink.h" ,
3576
- "linux/if.h" ,
3577
- "linux/if_addr.h" ,
3578
- "linux/if_alg.h" ,
3579
- "linux/if_ether.h" ,
3580
- "linux/if_packet.h" ,
3581
- "linux/if_tun.h" ,
3582
- "linux/if_xdp.h" ,
3583
- "linux/input.h" ,
3584
- "linux/ipv6.h" ,
3585
- "linux/kexec.h" ,
3586
- "linux/keyctl.h" ,
3587
- "linux/magic.h" ,
3588
- "linux/memfd.h" ,
3589
- "linux/membarrier.h" ,
3590
- "linux/mempolicy.h" ,
3591
- "linux/mman.h" ,
3592
- "linux/module.h" ,
3593
- "linux/mount.h" ,
3594
- "linux/net_tstamp.h" ,
3595
- "linux/netfilter/nfnetlink.h" ,
3596
- "linux/netfilter/nfnetlink_log.h" ,
3597
- "linux/netfilter/nfnetlink_queue.h" ,
3598
- "linux/netfilter/nf_tables.h" ,
3599
- "linux/netfilter_arp.h" ,
3600
- "linux/netfilter_bridge.h" ,
3601
- "linux/netfilter_ipv4.h" ,
3602
- "linux/netfilter_ipv6.h" ,
3603
- "linux/netfilter_ipv6/ip6_tables.h" ,
3604
- "linux/netlink.h" ,
3605
- "linux/openat2.h" ,
3606
- // FIXME(linux): some items require Linux >= 5.6:
3607
- "linux/ptp_clock.h" ,
3608
- "linux/ptrace.h" ,
3609
- "linux/quota.h" ,
3610
- "linux/random.h" ,
3611
- "linux/reboot.h" ,
3612
- "linux/rtnetlink.h" ,
3613
- "linux/sched.h" ,
3614
- "linux/sctp.h" ,
3615
- "linux/seccomp.h" ,
3616
- "linux/sock_diag.h" ,
3617
- "linux/sockios.h" ,
3618
- "linux/tls.h" ,
3619
- "linux/uinput.h" ,
3620
- "linux/vm_sockets.h" ,
3621
- "linux/wait.h" ,
3622
- "linux/wireless.h" ,
3623
- "sys/fanotify.h" ,
3624
- // <sys/auxv.h> is not present on uclibc
3625
- [ !uclibc] : "sys/auxv.h" ,
3626
- [ gnu || musl] : "linux/close_range.h" ,
3566
+ }
3567
+
3568
+ if !wasm32 {
3569
+ headers ! { cfg:
3570
+ [ gnu] : "linux/aio_abi.h" ,
3571
+ "linux/can.h" ,
3572
+ "linux/can/raw.h" ,
3573
+ "linux/can/j1939.h" ,
3574
+ "linux/dccp.h" ,
3575
+ "linux/errqueue.h" ,
3576
+ "linux/falloc.h" ,
3577
+ "linux/filter.h" ,
3578
+ "linux/fs.h" ,
3579
+ "linux/futex.h" ,
3580
+ "linux/genetlink.h" ,
3581
+ "linux/if.h" ,
3582
+ "linux/if_addr.h" ,
3583
+ "linux/if_alg.h" ,
3584
+ "linux/if_ether.h" ,
3585
+ "linux/if_packet.h" ,
3586
+ "linux/if_tun.h" ,
3587
+ "linux/if_xdp.h" ,
3588
+ "linux/input.h" ,
3589
+ "linux/ipv6.h" ,
3590
+ "linux/kexec.h" ,
3591
+ "linux/keyctl.h" ,
3592
+ "linux/magic.h" ,
3593
+ "linux/memfd.h" ,
3594
+ "linux/membarrier.h" ,
3595
+ "linux/mempolicy.h" ,
3596
+ "linux/mman.h" ,
3597
+ "linux/module.h" ,
3598
+ "linux/mount.h" ,
3599
+ "linux/net_tstamp.h" ,
3600
+ "linux/netfilter/nfnetlink.h" ,
3601
+ "linux/netfilter/nfnetlink_log.h" ,
3602
+ "linux/netfilter/nfnetlink_queue.h" ,
3603
+ "linux/netfilter/nf_tables.h" ,
3604
+ "linux/netfilter_arp.h" ,
3605
+ "linux/netfilter_bridge.h" ,
3606
+ "linux/netfilter_ipv4.h" ,
3607
+ "linux/netfilter_ipv6.h" ,
3608
+ "linux/netfilter_ipv6/ip6_tables.h" ,
3609
+ "linux/netlink.h" ,
3610
+ "linux/openat2.h" ,
3611
+ // FIXME(linux): some items require Linux >= 5.6:
3612
+ "linux/ptp_clock.h" ,
3613
+ "linux/ptrace.h" ,
3614
+ "linux/quota.h" ,
3615
+ "linux/random.h" ,
3616
+ "linux/reboot.h" ,
3617
+ "linux/rtnetlink.h" ,
3618
+ "linux/sched.h" ,
3619
+ "linux/sctp.h" ,
3620
+ "linux/seccomp.h" ,
3621
+ "linux/sock_diag.h" ,
3622
+ "linux/sockios.h" ,
3623
+ "linux/tls.h" ,
3624
+ "linux/uinput.h" ,
3625
+ "linux/vm_sockets.h" ,
3626
+ "linux/wait.h" ,
3627
+ "linux/wireless.h" ,
3628
+ "sys/fanotify.h" ,
3629
+ // <sys/auxv.h> is not present on uclibc
3630
+ [ !uclibc] : "sys/auxv.h" ,
3631
+ [ gnu || musl] : "linux/close_range.h" ,
3632
+ }
3627
3633
}
3628
3634
3629
3635
// note: aio.h must be included before sys/mount.h
@@ -4556,6 +4562,7 @@ fn test_linux_like_apis(target: &str) {
4556
4562
let gnu = target. contains ( "gnu" ) ;
4557
4563
let musl = target. contains ( "musl" ) || target. contains ( "ohos" ) ;
4558
4564
let linux = target. contains ( "linux" ) ;
4565
+ let wali = target. contains ( "linux" ) && target. contains ( "wasm32" ) ;
4559
4566
let emscripten = target. contains ( "emscripten" ) ;
4560
4567
let android = target. contains ( "android" ) ;
4561
4568
assert ! ( linux || android || emscripten) ;
@@ -4605,7 +4612,7 @@ fn test_linux_like_apis(target: &str) {
4605
4612
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_fcntl.rs" ) ;
4606
4613
}
4607
4614
4608
- if linux || android {
4615
+ if ( linux && !wali ) || android {
4609
4616
// test termios
4610
4617
let mut cfg = ctest_cfg ( ) ;
4611
4618
cfg. header ( "asm/termbits.h" ) ;
@@ -4657,7 +4664,7 @@ fn test_linux_like_apis(target: &str) {
4657
4664
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_ipv6.rs" ) ;
4658
4665
}
4659
4666
4660
- if linux || android {
4667
+ if ( linux && !wali ) || android {
4661
4668
// Test Elf64_Phdr and Elf32_Phdr
4662
4669
// These types have a field called `p_type`, but including
4663
4670
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
@@ -4679,7 +4686,7 @@ fn test_linux_like_apis(target: &str) {
4679
4686
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_elf.rs" ) ;
4680
4687
}
4681
4688
4682
- if linux || android {
4689
+ if ( linux && !wali ) || android {
4683
4690
// Test `ARPHRD_CAN`.
4684
4691
let mut cfg = ctest_cfg ( ) ;
4685
4692
cfg. header ( "linux/if_arp.h" ) ;
0 commit comments