diff --git a/src/fixed_width_ints.rs b/src/fixed_width_ints.rs index f24fa5dd2d1d7..16aabf2a8d594 100644 --- a/src/fixed_width_ints.rs +++ b/src/fixed_width_ints.rs @@ -59,28 +59,29 @@ cfg_if! { /// C __uint128_t (alternate name for [__uint128][]) pub type __uint128_t = u128; - macro_rules! static_assert_eq { - ($a:expr, $b:expr) => { - const _: [(); $a] = [(); $b]; - }; - } - // NOTE: if you add more platforms to here, you may need to cfg // these consts. They should always match the platform's values // for `sizeof(__int128)` and `_Alignof(__int128)`. const _SIZE_128: usize = 16; const _ALIGN_128: usize = 16; - // Since Rust doesn't officially guarantee that these types - // have compatible ABIs, we const assert that these values have the - // known size/align of the target platform's libc. If rustc ever - // tries to regress things, it will cause a compilation error. + // FIXME(ctest): ctest doesn't handle `_` as an identifier so these tests are temporarily + // disabled. + // macro_rules! static_assert_eq { + // ($a:expr, $b:expr) => { + // const _: [(); $a] = [(); $b]; + // }; + // } // - // This isn't a bullet-proof solution because e.g. it doesn't - // catch the fact that llvm and gcc disagree on how x64 __int128 - // is actually *passed* on the stack (clang underaligns it for - // the same reason that rustc *never* properly aligns it). - // FIXME: temporarily disabled because of a ctest2 bug. + // // Since Rust doesn't officially guarantee that these types + // // have compatible ABIs, we const assert that these values have the + // // known size/align of the target platform's libc. If rustc ever + // // tries to regress things, it will cause a compilation error. + // // + // // This isn't a bullet-proof solution because e.g. it doesn't + // // catch the fact that llvm and gcc disagree on how x64 __int128 + // // is actually *passed* on the stack (clang underaligns it for + // // the same reason that rustc *never* properly aligns it). // static_assert_eq!(core::mem::size_of::<__int128>(), _SIZE_128); // static_assert_eq!(core::mem::align_of::<__int128>(), _ALIGN_128); @@ -93,9 +94,9 @@ cfg_if! { // static_assert_eq!(core::mem::size_of::<__uint128_t>(), _SIZE_128); // static_assert_eq!(core::mem::align_of::<__uint128_t>(), _ALIGN_128); } else if #[cfg(all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos")))] { - /// /// C `__int128_t` + /// C `__int128_t` pub type __int128_t = i128; - /// /// C `__uint128_t` + /// C `__uint128_t` pub type __uint128_t = u128; } } diff --git a/src/macros.rs b/src/macros.rs index e64f035576e60..16e2281d51158 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -167,6 +167,36 @@ macro_rules! e { )*); } +// This is a pretty horrible hack to allow us to conditionally mark +// some functions as 'const', without requiring users of this macro +// to care about the "const-extern-fn" feature. +// +// When 'const-extern-fn' is enabled, we emit the captured 'const' keyword +// in the expanded function. +// +// When 'const-extern-fn' is disabled, we always emit a plain 'pub unsafe extern fn'. +// Note that the expression matched by the macro is exactly the same - this allows +// users of this macro to work whether or not 'const-extern-fn' is enabled +// +// Unfortunately, we need to duplicate most of this macro between the 'cfg_if' blocks. +// This is because 'const unsafe extern fn' won't even parse on older compilers, +// so we need to avoid emitting it at all of 'const-extern-fn'. +// +// Specifically, moving the 'cfg_if' into the macro body will *not* work. +// Doing so would cause the '#[cfg(feature = "const-extern-fn")]' to be emitted +// into user code. The 'cfg' gate will not stop Rust from trying to parse the +// 'pub const unsafe extern fn', so users would get a compiler error even when +// the 'const-extern-fn' feature is disabled +// +// Note that users of this macro need to place 'const' in a weird position +// (after the closing ')' for the arguments, but before the return type). +// This was the only way I could satisfy the following two requirements: +// 1. Avoid ambiguity errors from 'macro_rules!' (which happen when writing '$foo:ident fn' +// 2. Allow users of this macro to mix 'pub fn foo' and 'pub const fn bar' within the same +// 'f!' block + +// FIXME(ctest): ctest can't handle `const extern` functions, we should be able to remove this +// cfg completely. cfg_if! { if #[cfg(feature = "const-extern-fn")] { /// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled. @@ -243,8 +273,7 @@ cfg_if! { )*) => ($( #[inline] $(#[$attr])* - pub extern fn $i($($arg: $argty),* - ) -> $ret { + pub extern fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) diff --git a/src/unix/bsd/apple/b64/aarch64/mod.rs b/src/unix/bsd/apple/b64/aarch64/mod.rs index ce34e78c87ca7..dd22fcb2507b1 100644 --- a/src/unix/bsd/apple/b64/aarch64/mod.rs +++ b/src/unix/bsd/apple/b64/aarch64/mod.rs @@ -6,7 +6,7 @@ s! { __private: [::uintptr_t; 18], // FIXME: needs arm64 auth pointers support } - pub struct ucontext_t { + pub struct ucontext_t { pub uc_onstack: ::c_int, pub uc_sigmask: ::sigset_t, pub uc_stack: ::stack_t, diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 8dc4d42c4bab2..15da080c9fd95 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1175,6 +1175,7 @@ s! { pub ifs6_pfx_expiry_cnt: ::u_quad_t, pub ifs6_defrtr_expiry_cnt: ::u_quad_t, } + pub struct icmp6_ifstat { pub ifs6_in_msg: ::u_quad_t, pub ifs6_in_error: ::u_quad_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/arm.rs b/src/unix/bsd/freebsdlike/freebsd/arm.rs index c0c547a8b985b..07cac6a331547 100644 --- a/src/unix/bsd/freebsdlike/freebsd/arm.rs +++ b/src/unix/bsd/freebsdlike/freebsd/arm.rs @@ -51,8 +51,10 @@ cfg_if! { } pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; + pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e; + pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4 pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 37d11d64d0468..35229d65058e8 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1723,13 +1723,12 @@ cfg_if! { && self.cr_uid == other.cr_uid && self.cr_ngroups == other.cr_ngroups && self.cr_groups == other.cr_groups - && self.cr_pid__c_anonymous_union - == other.cr_pid__c_anonymous_union + && self.cr_pid__c_anonymous_union == other.cr_pid__c_anonymous_union } } impl Eq for xucred {} impl ::fmt::Debug for xucred { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("xucred") .field("cr_version", &self.cr_version) .field("cr_uid", &self.cr_uid) @@ -4904,16 +4903,16 @@ pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC; pub const TFD_TIMER_ABSTIME: ::c_int = 0x01; pub const TFD_TIMER_CANCEL_ON_SET: ::c_int = 0x02; +// sys/unistd.h + +pub const CLOSE_RANGE_CLOEXEC: ::c_uint = 1 << 2; + pub const KCMP_FILE: ::c_int = 100; pub const KCMP_FILEOBJ: ::c_int = 101; pub const KCMP_FILES: ::c_int = 102; pub const KCMP_SIGHAND: ::c_int = 103; pub const KCMP_VM: ::c_int = 104; -// sys/unistd.h - -pub const CLOSE_RANGE_CLOEXEC: ::c_uint = 1 << 2; - pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int { a << 24 } @@ -5632,6 +5631,12 @@ extern "C" { pub fn closefrom(lowfd: ::c_int); pub fn close_range(lowfd: ::c_uint, highfd: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn execvpe( + file: *const ::c_char, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; + pub fn kcmp( pid1: ::pid_t, pid2: ::pid_t, @@ -5639,12 +5644,6 @@ extern "C" { idx1: ::c_ulong, idx2: ::c_ulong, ) -> ::c_int; - - pub fn execvpe( - file: *const ::c_char, - argv: *const *const ::c_char, - envp: *const *const ::c_char, - ) -> ::c_int; } #[link(name = "memstat")] diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs index 9690cb13cd310..e37272680d43c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc.rs @@ -70,6 +70,7 @@ cfg_if! { } pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1; + pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e; pub const MAP_32BIT: ::c_int = 0x00080000; diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs index 08e7ad12c9c9b..372639f1d1cce 100644 --- a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs @@ -70,8 +70,10 @@ cfg_if! { } pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; + pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e; + pub const MAP_32BIT: ::c_int = 0x00080000; pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; diff --git a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs index 542c95b54453c..8be949df01583 100644 --- a/src/unix/bsd/freebsdlike/freebsd/riscv64.rs +++ b/src/unix/bsd/freebsdlike/freebsd/riscv64.rs @@ -36,8 +36,6 @@ s_no_extra_traits! { } } -pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1; - cfg_if! { if #[cfg(feature = "extra_traits")] { impl PartialEq for gpregs { @@ -142,6 +140,8 @@ cfg_if! { } } +pub(crate) const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1; + pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d; pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e; pub const MAP_32BIT: ::c_int = 0x00080000; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 4b2b68b336221..c20c80f8d2ecb 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1045,11 +1045,10 @@ cfg_if! { } } - impl Eq for statfs { } + impl Eq for statfs {} impl ::fmt::Debug for statfs { - fn fmt(&self, f: &mut ::fmt::Formatter) - -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { f.debug_struct("statfs") .field("f_flags", &self.f_flags) .field("f_bsize", &self.f_bsize) diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index 77aa1cf16ae43..6546031f7293f 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -1328,6 +1328,7 @@ extern "C" { pathString: *mut ::c_char, length: i32, ) -> status_t; + pub fn get_cpuid(info: *mut cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t; } diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs index bc815fba392e5..67bd0bb3abd4c 100644 --- a/src/unix/linux_like/android/b32/arm.rs +++ b/src/unix/linux_like/android/b32/arm.rs @@ -48,7 +48,7 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, pub uc_sigmask__c_anonymous_union: __c_anonymous_uc_sigmask, /* The kernel adds extra padding after uc_sigmask to match - * glibc sigset_t on ARM. */ + * glibc sigset_t on ARM. */ __padding: [c_char; 120], __align: [::c_longlong; 0], uc_regspace: [::c_ulong; 128], diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index b543bb739e0e5..912b59b67ab4b 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -4153,6 +4153,8 @@ extern "C" { pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int; pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char; + pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int; + pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int; pub fn renameat2( olddirfd: ::c_int, @@ -4168,8 +4170,6 @@ extern "C" { mask: ::c_uint, statxbuf: *mut statx, ) -> ::c_int; - - pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index cfd0c14cfe91e..9441e6350e745 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1,5 +1,7 @@ //! Linux-specific definitions for linux-like values +use core::mem; + pub type useconds_t = u32; pub type dev_t = u64; pub type socklen_t = u32; @@ -422,7 +424,7 @@ s! { pub direction: ::__u16, pub trigger: ff_trigger, pub replay: ff_replay, - // FIXME this is actually a union + // FIXME(1.0): this is actually a union #[cfg(target_pointer_width = "64")] pub u: [u64; 4], #[cfg(target_pointer_width = "32")] @@ -930,23 +932,27 @@ s! { pub disabled: __u8, pub flags: __u16, } + pub struct iw_point { pub pointer: *mut ::c_void, pub length: __u16, pub flags: __u16, } + pub struct iw_freq { pub m: __s32, pub e: __s16, pub i: __u8, pub flags: __u8, } + pub struct iw_quality { pub qual: __u8, pub level: __u8, pub noise: __u8, pub updated: __u8, } + pub struct iw_discarded { pub nwid: __u32, pub code: __u32, @@ -954,9 +960,11 @@ s! { pub retries: __u32, pubmisc: __u32, } + pub struct iw_missed { pub beacon: __u32, } + pub struct iw_scan_req { pub scan_type: __u8, pub essid_len: __u8, @@ -968,6 +976,7 @@ s! { pub max_channel_time: __u32, pub channel_list: [iw_freq; IW_MAX_FREQUENCIES], } + pub struct iw_encode_ext { pub ext_flags: __u32, pub tx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE], @@ -977,22 +986,26 @@ s! { pub key_len: __u16, pub key: [__u8;0], } + pub struct iw_pmksa { pub cmd: __u32, pub bssid: ::sockaddr, pub pmkid: [__u8; IW_PMKID_LEN], } + pub struct iw_pmkid_cand { pub flags: __u32, pub index: __u32, pub bssid: ::sockaddr, } + pub struct iw_statistics { pub status: __u16, pub qual: iw_quality, pub discard: iw_discarded, pub miss: iw_missed, } + pub struct iw_range { pub throughput: __u32, pub min_nwid: __u32, @@ -1038,6 +1051,7 @@ s! { pub freq: [iw_freq; IW_MAX_FREQUENCIES], pub enc_capa: __u32, } + pub struct iw_priv_args { pub cmd: __u32, pub set_args: __u16, @@ -1127,16 +1141,19 @@ cfg_if! { pub low: iw_quality, pub high: iw_quality, } + pub struct iw_mlme { pub cmd: __u16, pub reason_code: __u16, pub addr: ::sockaddr, } + pub struct iw_michaelmicfailure { pub flags: __u32, pub src_addr: ::sockaddr, pub tsc: [__u8; IW_ENCODE_SEQ_MAX_SIZE], } + pub struct __c_anonymous_elf32_rela { pub r_offset: Elf32_Addr, pub r_info: Elf32_Word, @@ -1251,7 +1268,10 @@ s_no_extra_traits! { pub ifcu_req: *mut ::ifreq, } + /// Structure used in SIOCGIFCONF request. Used to retrieve interface configuration for + /// machine (useful for programs which must know all networks accessible). pub struct ifconf { + /// Size of buffer pub ifc_len: ::c_int, pub ifc_ifcu: __c_anonymous_ifc_ifcu, } @@ -1400,6 +1420,13 @@ s_no_extra_traits! { size: [u8; ::__SIZEOF_PTHREAD_BARRIER_T], } + // linux/net_tstamp.h + #[allow(missing_debug_implementations)] + pub struct sock_txtime { + pub clockid: ::clockid_t, + pub flags: ::__u32, + } + // linux/can.h #[repr(align(8))] #[allow(missing_debug_implementations)] @@ -1433,19 +1460,7 @@ s_no_extra_traits! { pub af: u32, pub data: [u8; CANXL_MAX_DLEN], } -} - -s_no_extra_traits! { - // linux/net_tstamp.h - #[allow(missing_debug_implementations)] - pub struct sock_txtime { - pub clockid: ::clockid_t, - pub flags: ::__u32, - } -} -s_no_extra_traits! { - // linux/can.h #[allow(missing_debug_implementations)] pub union __c_anonymous_sockaddr_can_can_addr { pub tp: __c_anonymous_sockaddr_can_tp, @@ -1458,9 +1473,7 @@ s_no_extra_traits! { pub can_ifindex: ::c_int, pub can_addr: __c_anonymous_sockaddr_can_can_addr, } -} -s_no_extra_traits! { // linux/wireless.h pub union iwreq_data { pub name: [c_char; ::IFNAMSIZ], @@ -1933,6 +1946,7 @@ cfg_if! { self.sched_period.hash(state); } } + impl ::fmt::Debug for iwreq_data { fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { f.debug_struct("iwreq_data") @@ -2700,6 +2714,7 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { size: [0; __SIZEOF_PTHREAD_RWLOCK_T], }; + pub const PTHREAD_BARRIER_SERIAL_THREAD: ::c_int = -1; pub const PTHREAD_ONCE_INIT: pthread_once_t = 0; pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; @@ -3517,16 +3532,19 @@ pub const TP_STATUS_TS_SOFTWARE: ::__u32 = 1 << 29; pub const TP_STATUS_TS_SYS_HARDWARE: ::__u32 = 1 << 30; pub const TP_STATUS_TS_RAW_HARDWARE: ::__u32 = 1 << 31; +pub const TP_FT_REQ_FILL_RXHASH: ::__u32 = 1; + pub const TPACKET_ALIGNMENT: usize = 16; -pub const TPACKET_HDRLEN: usize = ((core::mem::size_of::<::tpacket_hdr>() + TPACKET_ALIGNMENT - 1) + +pub const TPACKET_HDRLEN: usize = ((mem::size_of::<::tpacket_hdr>() + TPACKET_ALIGNMENT - 1) + & !(TPACKET_ALIGNMENT - 1)) + + mem::size_of::<::sockaddr_ll>(); +pub const TPACKET2_HDRLEN: usize = ((mem::size_of::<::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1) & !(TPACKET_ALIGNMENT - 1)) - + core::mem::size_of::<::sockaddr_ll>(); -pub const TPACKET2_HDRLEN: usize = - ((core::mem::size_of::<::tpacket2_hdr>() + TPACKET_ALIGNMENT - 1) & !(TPACKET_ALIGNMENT - 1)) - + core::mem::size_of::<::sockaddr_ll>(); -pub const TPACKET3_HDRLEN: usize = - ((core::mem::size_of::<::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1) & !(TPACKET_ALIGNMENT - 1)) - + core::mem::size_of::<::sockaddr_ll>(); + + mem::size_of::<::sockaddr_ll>(); +pub const TPACKET3_HDRLEN: usize = ((mem::size_of::<::tpacket3_hdr>() + TPACKET_ALIGNMENT - 1) + & !(TPACKET_ALIGNMENT - 1)) + + mem::size_of::<::sockaddr_ll>(); // linux/netfilter.h pub const NF_DROP: ::c_int = 0; @@ -5046,7 +5064,7 @@ pub const CANXL_SEC: ::c_int = 0x01; pub const CAN_MTU: usize = ::mem::size_of::(); pub const CANFD_MTU: usize = ::mem::size_of::(); pub const CANXL_MTU: usize = ::mem::size_of::(); -// FIXME: use `core::mem::offset_of!` once that is available +// FIXME(offset_of): use `core::mem::offset_of!` once that is available // https://github.com/rust-lang/rfcs/pull/3308 // pub const CANXL_HDR_SIZE: usize = core::mem::offset_of!(canxl_frame, data); pub const CANXL_HDR_SIZE: usize = 12; @@ -5561,7 +5579,6 @@ f! { (x + TPACKET_ALIGNMENT - 1) & !(TPACKET_ALIGNMENT - 1) } - pub fn BPF_RVAL(code: ::__u32) -> ::__u32 { code & 0x18 } diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 17ee6e591088b..ffdc253565347 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -316,6 +316,7 @@ pub const INADDR_NONE: in_addr_t = 4294967295; pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr { s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], }; + pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr { s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], }; @@ -900,6 +901,7 @@ extern "C" { pub fn close(fd: ::c_int) -> ::c_int; pub fn dup(fd: ::c_int) -> ::c_int; pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int; + pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; @@ -910,6 +912,7 @@ extern "C" { envp: *const *mut c_char, ) -> ::c_int; pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> ::c_int; + pub fn fork() -> pid_t; pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index a7d05919195f4..f410970ff7c3d 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -1,5 +1,7 @@ -// [wasi-libc](https://github.com/WebAssembly/wasi-libc) definitions. -// `wasi-libc` project provides multiple libraries including emulated features, but we list only basic features with `libc.a` here. +//! [wasi-libc](https://github.com/WebAssembly/wasi-libc) definitions. +//! +//! `wasi-libc` project provides multiple libraries including emulated features, but we list only +//! basic features with `libc.a` here. use super::{Send, Sync}; use c_void;