@@ -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" )
@@ -3423,6 +3423,7 @@ fn test_linux(target: &str) {
34233423 let x86_64_gnux32 = target. contains ( "gnux32" ) && x86_64;
34243424 let riscv64 = target. contains ( "riscv64" ) ;
34253425 let loongarch64 = target. contains ( "loongarch64" ) ;
3426+ let wasm32 = target. contains ( "wasm32" ) ;
34263427 let uclibc = target. contains ( "uclibc" ) ;
34273428
34283429 let mut cfg = ctest_cfg ( ) ;
@@ -3548,68 +3549,73 @@ fn test_linux(target: &str) {
35483549 cfg:
35493550 [ loongarch64 || riscv64] : "asm/hwcap.h" ,
35503551 "asm/mman.h" ,
3551- [ gnu] : "linux/aio_abi.h" ,
3552- "linux/can.h" ,
3553- "linux/can/raw.h" ,
3554- "linux/can/j1939.h" ,
3555- "linux/dccp.h" ,
3556- "linux/errqueue.h" ,
3557- "linux/falloc.h" ,
3558- "linux/filter.h" ,
3559- "linux/fs.h" ,
3560- "linux/futex.h" ,
3561- "linux/genetlink.h" ,
3562- "linux/if.h" ,
3563- "linux/if_addr.h" ,
3564- "linux/if_alg.h" ,
3565- "linux/if_ether.h" ,
3566- "linux/if_packet.h" ,
3567- "linux/if_tun.h" ,
3568- "linux/if_xdp.h" ,
3569- "linux/input.h" ,
3570- "linux/ipv6.h" ,
3571- "linux/kexec.h" ,
3572- "linux/keyctl.h" ,
3573- "linux/magic.h" ,
3574- "linux/memfd.h" ,
3575- "linux/membarrier.h" ,
3576- "linux/mempolicy.h" ,
3577- "linux/mman.h" ,
3578- "linux/module.h" ,
3579- "linux/mount.h" ,
3580- "linux/net_tstamp.h" ,
3581- "linux/netfilter/nfnetlink.h" ,
3582- "linux/netfilter/nfnetlink_log.h" ,
3583- "linux/netfilter/nfnetlink_queue.h" ,
3584- "linux/netfilter/nf_tables.h" ,
3585- "linux/netfilter_arp.h" ,
3586- "linux/netfilter_bridge.h" ,
3587- "linux/netfilter_ipv4.h" ,
3588- "linux/netfilter_ipv6.h" ,
3589- "linux/netfilter_ipv6/ip6_tables.h" ,
3590- "linux/netlink.h" ,
3591- "linux/openat2.h" ,
3592- // FIXME(linux): some items require Linux >= 5.6:
3593- "linux/ptp_clock.h" ,
3594- "linux/ptrace.h" ,
3595- "linux/quota.h" ,
3596- "linux/random.h" ,
3597- "linux/reboot.h" ,
3598- "linux/rtnetlink.h" ,
3599- "linux/sched.h" ,
3600- "linux/sctp.h" ,
3601- "linux/seccomp.h" ,
3602- "linux/sock_diag.h" ,
3603- "linux/sockios.h" ,
3604- "linux/tls.h" ,
3605- "linux/uinput.h" ,
3606- "linux/vm_sockets.h" ,
3607- "linux/wait.h" ,
3608- "linux/wireless.h" ,
3609- "sys/fanotify.h" ,
3610- // <sys/auxv.h> is not present on uclibc
3611- [ !uclibc] : "sys/auxv.h" ,
3612- [ gnu || musl] : "linux/close_range.h" ,
3552+ }
3553+
3554+ if !wasm32 {
3555+ headers ! {
3556+ [ gnu] : "linux/aio_abi.h" ,
3557+ "linux/can.h" ,
3558+ "linux/can/raw.h" ,
3559+ "linux/can/j1939.h" ,
3560+ "linux/dccp.h" ,
3561+ "linux/errqueue.h" ,
3562+ "linux/falloc.h" ,
3563+ "linux/filter.h" ,
3564+ "linux/fs.h" ,
3565+ "linux/futex.h" ,
3566+ "linux/genetlink.h" ,
3567+ "linux/if.h" ,
3568+ "linux/if_addr.h" ,
3569+ "linux/if_alg.h" ,
3570+ "linux/if_ether.h" ,
3571+ "linux/if_packet.h" ,
3572+ "linux/if_tun.h" ,
3573+ "linux/if_xdp.h" ,
3574+ "linux/input.h" ,
3575+ "linux/ipv6.h" ,
3576+ "linux/kexec.h" ,
3577+ "linux/keyctl.h" ,
3578+ "linux/magic.h" ,
3579+ "linux/memfd.h" ,
3580+ "linux/membarrier.h" ,
3581+ "linux/mempolicy.h" ,
3582+ "linux/mman.h" ,
3583+ "linux/module.h" ,
3584+ "linux/mount.h" ,
3585+ "linux/net_tstamp.h" ,
3586+ "linux/netfilter/nfnetlink.h" ,
3587+ "linux/netfilter/nfnetlink_log.h" ,
3588+ "linux/netfilter/nfnetlink_queue.h" ,
3589+ "linux/netfilter/nf_tables.h" ,
3590+ "linux/netfilter_arp.h" ,
3591+ "linux/netfilter_bridge.h" ,
3592+ "linux/netfilter_ipv4.h" ,
3593+ "linux/netfilter_ipv6.h" ,
3594+ "linux/netfilter_ipv6/ip6_tables.h" ,
3595+ "linux/netlink.h" ,
3596+ "linux/openat2.h" ,
3597+ // FIXME(linux): some items require Linux >= 5.6:
3598+ "linux/ptp_clock.h" ,
3599+ "linux/ptrace.h" ,
3600+ "linux/quota.h" ,
3601+ "linux/random.h" ,
3602+ "linux/reboot.h" ,
3603+ "linux/rtnetlink.h" ,
3604+ "linux/sched.h" ,
3605+ "linux/sctp.h" ,
3606+ "linux/seccomp.h" ,
3607+ "linux/sock_diag.h" ,
3608+ "linux/sockios.h" ,
3609+ "linux/tls.h" ,
3610+ "linux/uinput.h" ,
3611+ "linux/vm_sockets.h" ,
3612+ "linux/wait.h" ,
3613+ "linux/wireless.h" ,
3614+ "sys/fanotify.h" ,
3615+ // <sys/auxv.h> is not present on uclibc
3616+ [ !uclibc] : "sys/auxv.h" ,
3617+ [ gnu || musl] : "linux/close_range.h" ,
3618+ }
36133619 }
36143620
36153621 // note: aio.h must be included before sys/mount.h
@@ -4533,6 +4539,7 @@ fn test_linux_like_apis(target: &str) {
45334539 let gnu = target. contains ( "gnu" ) ;
45344540 let musl = target. contains ( "musl" ) || target. contains ( "ohos" ) ;
45354541 let linux = target. contains ( "linux" ) ;
4542+ let wali = target. contains ( "linux" ) && target. contains ( "wasm32" ) ;
45364543 let emscripten = target. contains ( "emscripten" ) ;
45374544 let android = target. contains ( "android" ) ;
45384545 assert ! ( linux || android || emscripten) ;
@@ -4582,7 +4589,7 @@ fn test_linux_like_apis(target: &str) {
45824589 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_fcntl.rs" ) ;
45834590 }
45844591
4585- if linux || android {
4592+ if ( linux && !wali ) || android {
45864593 // test termios
45874594 let mut cfg = ctest_cfg ( ) ;
45884595 cfg. header ( "asm/termbits.h" ) ;
@@ -4634,7 +4641,7 @@ fn test_linux_like_apis(target: &str) {
46344641 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_ipv6.rs" ) ;
46354642 }
46364643
4637- if linux || android {
4644+ if ( linux && !wali ) || android {
46384645 // Test Elf64_Phdr and Elf32_Phdr
46394646 // These types have a field called `p_type`, but including
46404647 // "resolve.h" defines a `p_type` macro that expands to `__p_type`
@@ -4656,7 +4663,7 @@ fn test_linux_like_apis(target: &str) {
46564663 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_elf.rs" ) ;
46574664 }
46584665
4659- if linux || android {
4666+ if ( linux && !wali ) || android {
46604667 // Test `ARPHRD_CAN`.
46614668 let mut cfg = ctest_cfg ( ) ;
46624669 cfg. header ( "linux/if_arp.h" ) ;
0 commit comments