diff --git a/src/new/bionic_libc/pthread.rs b/src/new/bionic_libc/pthread.rs index ab2657c5a3a4c..4997547ff0905 100644 --- a/src/new/bionic_libc/pthread.rs +++ b/src/new/bionic_libc/pthread.rs @@ -1,12 +1,17 @@ //! Header: `unistd.h` -pub use crate::new::common::linux_like::pthread::pthread_setname_np; +pub use crate::new::common::linux_like::pthread::{ + pthread_getattr_np, + pthread_setname_np, +}; pub use crate::new::common::posix::pthread::{ pthread_atfork, pthread_attr_getguardsize, pthread_attr_getinheritsched, + pthread_attr_getstack, pthread_attr_setguardsize, pthread_attr_setinheritsched, + pthread_attr_setstack, pthread_barrier_destroy, pthread_barrier_init, pthread_barrier_wait, @@ -14,13 +19,19 @@ pub use crate::new::common::posix::pthread::{ pthread_barrierattr_getpshared, pthread_barrierattr_init, pthread_barrierattr_setpshared, + pthread_condattr_getclock, pthread_condattr_getpshared, + pthread_condattr_setclock, + pthread_condattr_setpshared, pthread_create, pthread_getcpuclockid, pthread_getschedparam, pthread_kill, pthread_mutex_timedlock, pthread_mutexattr_getpshared, + pthread_mutexattr_setpshared, + pthread_rwlockattr_getpshared, + pthread_rwlockattr_setpshared, pthread_setschedparam, pthread_sigmask, pthread_spin_destroy, diff --git a/src/new/common/linux_like/mod.rs b/src/new/common/linux_like/mod.rs index b6700d8d0a84e..9c41fe256ceff 100644 --- a/src/new/common/linux_like/mod.rs +++ b/src/new/common/linux_like/mod.rs @@ -1,4 +1,9 @@ //! API that primarily comes from Linux but is also used other platforms (e.g. Android). -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "l4re", + target_os = "linux" +))] pub(crate) mod pthread; diff --git a/src/new/common/linux_like/pthread.rs b/src/new/common/linux_like/pthread.rs index 1cb042668031f..165f3254e79da 100644 --- a/src/new/common/linux_like/pthread.rs +++ b/src/new/common/linux_like/pthread.rs @@ -8,6 +8,8 @@ extern "C" { cpuset: *mut crate::cpu_set_t, ) -> c_int; + pub fn pthread_getattr_np(native: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int; + #[cfg(target_os = "linux")] pub fn pthread_getname_np(thread: crate::pthread_t, name: *mut c_char, len: size_t) -> c_int; diff --git a/src/new/common/posix/mod.rs b/src/new/common/posix/mod.rs index 6008881d7469c..9e92165656daa 100644 --- a/src/new/common/posix/mod.rs +++ b/src/new/common/posix/mod.rs @@ -3,6 +3,11 @@ //! These can be found at: . // FIXME(pthread): eventually all platforms should use this module -#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))] +#[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "l4re", + target_os = "linux" +))] pub(crate) mod pthread; pub(crate) mod unistd; diff --git a/src/new/common/posix/pthread.rs b/src/new/common/posix/pthread.rs index 894957edc88c6..d32d50e7fd746 100644 --- a/src/new/common/posix/pthread.rs +++ b/src/new/common/posix/pthread.rs @@ -12,62 +12,86 @@ extern "C" { child: Option, ) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_attr_getguardsize( attr: *const crate::pthread_attr_t, guardsize: *mut size_t, ) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_attr_getinheritsched( attr: *const crate::pthread_attr_t, inheritsched: *mut c_int, ) -> c_int; - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "l4re", target_os = "linux"))] pub fn pthread_attr_getschedparam( attr: *const crate::pthread_attr_t, param: *mut crate::sched_param, ) -> c_int; - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "l4re", target_os = "linux"))] pub fn pthread_attr_getschedpolicy( attr: *const crate::pthread_attr_t, policy: *mut c_int, ) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "linux", + target_os = "l4re" + ))] + pub fn pthread_attr_getstack( + attr: *const crate::pthread_attr_t, + stackaddr: *mut *mut c_void, + stacksize: *mut size_t, + ) -> c_int; + + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_attr_setinheritsched( attr: *mut crate::pthread_attr_t, inheritsched: c_int, ) -> c_int; - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "l4re", target_os = "linux"))] pub fn pthread_attr_setschedparam( attr: *mut crate::pthread_attr_t, param: *const crate::sched_param, ) -> c_int; - #[cfg(target_os = "linux")] + #[cfg(any(target_os = "l4re", target_os = "linux"))] pub fn pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "linux", + target_os = "l4re" + ))] + pub fn pthread_attr_setstack( + attr: *mut crate::pthread_attr_t, + stackaddr: *mut c_void, + stacksize: size_t, + ) -> c_int; + + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_barrier_destroy(barrier: *mut crate::pthread_barrier_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_barrier_init( barrier: *mut crate::pthread_barrier_t, attr: *const crate::pthread_barrierattr_t, count: c_uint, ) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_barrier_wait(barrier: *mut crate::pthread_barrier_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_barrierattr_destroy(attr: *mut crate::pthread_barrierattr_t) -> c_int; #[cfg(any(target_os = "android", target_os = "linux"))] @@ -76,25 +100,63 @@ extern "C" { shared: *mut c_int, ) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_barrierattr_init(attr: *mut crate::pthread_barrierattr_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_barrierattr_setpshared( attr: *mut crate::pthread_barrierattr_t, shared: c_int, ) -> c_int; - #[cfg(all(target_os = "linux", not(target_env = "ohos")))] + #[cfg(any(target_os = "l4re", all(target_os = "linux", not(target_env = "ohos"))))] pub fn pthread_cancel(thread: crate::pthread_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "linux", + target_os = "l4re" + ))] + pub fn pthread_condattr_getclock( + attr: *const crate::pthread_condattr_t, + clock_id: *mut crate::clockid_t, + ) -> c_int; + + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_condattr_getpshared( attr: *const crate::pthread_condattr_t, pshared: *mut c_int, ) -> c_int; - #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))] + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "linux", + target_os = "l4re" + ))] + pub fn pthread_condattr_setclock( + attr: *mut crate::pthread_condattr_t, + clock_id: crate::clockid_t, + ) -> c_int; + + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "linux", + target_os = "l4re" + ))] + pub fn pthread_condattr_setpshared( + attr: *mut crate::pthread_condattr_t, + pshared: c_int, + ) -> c_int; + + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "l4re", + target_os = "linux" + ))] pub fn pthread_create( native: *mut crate::pthread_t, attr: *const crate::pthread_attr_t, @@ -105,7 +167,7 @@ extern "C" { #[cfg(any(target_os = "android", target_os = "linux"))] pub fn pthread_getcpuclockid(thread: crate::pthread_t, clk_id: *mut crate::clockid_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_getschedparam( native: crate::pthread_t, policy: *mut c_int, @@ -114,13 +176,13 @@ extern "C" { // FIXME(reorg): In recent POSIX versions, this is a signal.h function and not required // in pthread. - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int; #[cfg(all(target_os = "linux", not(target_env = "ohos")))] pub fn pthread_mutex_consistent(mutex: *mut crate::pthread_mutex_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] #[cfg_attr(gnu_time_bits64, link_name = "__pthread_mutex_timedlock64")] pub fn pthread_mutex_timedlock( lock: *mut crate::pthread_mutex_t, @@ -133,7 +195,7 @@ extern "C" { protocol: *mut c_int, ) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_mutexattr_getpshared( attr: *const crate::pthread_mutexattr_t, pshared: *mut c_int, @@ -151,16 +213,49 @@ extern "C" { protocol: c_int, ) -> c_int; + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "linux", + target_os = "l4re" + ))] + pub fn pthread_mutexattr_setpshared( + attr: *mut crate::pthread_mutexattr_t, + pshared: c_int, + ) -> c_int; + #[cfg(all(target_os = "linux", not(target_env = "ohos")))] pub fn pthread_mutexattr_setrobust( attr: *mut crate::pthread_mutexattr_t, robustness: c_int, ) -> c_int; - #[cfg(target_os = "linux")] + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "linux", + target_os = "l4re" + ))] + pub fn pthread_rwlockattr_getpshared( + attr: *const crate::pthread_rwlockattr_t, + val: *mut c_int, + ) -> c_int; + + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "linux", + target_os = "l4re" + ))] + pub fn pthread_rwlockattr_setpshared( + attr: *mut crate::pthread_rwlockattr_t, + val: c_int, + ) -> c_int; + + #[cfg(any(target_os = "l4re", target_os = "linux"))] pub fn pthread_once(control: *mut crate::pthread_once_t, routine: extern "C" fn()) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_setschedparam( native: crate::pthread_t, policy: c_int, @@ -172,25 +267,25 @@ extern "C" { // FIXME(reorg): In recent POSIX versions, this is a signal.h function and not required // in pthread. - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_sigmask( how: c_int, set: *const crate::sigset_t, oldset: *mut crate::sigset_t, ) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_spin_destroy(lock: *mut crate::pthread_spinlock_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_spin_init(lock: *mut crate::pthread_spinlock_t, pshared: c_int) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_spin_lock(lock: *mut crate::pthread_spinlock_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_spin_trylock(lock: *mut crate::pthread_spinlock_t) -> c_int; - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))] pub fn pthread_spin_unlock(lock: *mut crate::pthread_spinlock_t) -> c_int; } diff --git a/src/new/emscripten/pthread.rs b/src/new/emscripten/pthread.rs index 11da53ef4e243..21982b7979d43 100644 --- a/src/new/emscripten/pthread.rs +++ b/src/new/emscripten/pthread.rs @@ -1,3 +1,14 @@ //! Header: `pthread.h` -pub use crate::new::common::posix::pthread::pthread_create; +pub use crate::new::common::linux_like::pthread::pthread_getattr_np; +pub use crate::new::common::posix::pthread::{ + pthread_attr_getstack, + pthread_attr_setstack, + pthread_condattr_getclock, + pthread_condattr_setclock, + pthread_condattr_setpshared, + pthread_create, + pthread_mutexattr_setpshared, + pthread_rwlockattr_getpshared, + pthread_rwlockattr_setpshared, +}; diff --git a/src/new/glibc/sysdeps/nptl/pthread.rs b/src/new/glibc/sysdeps/nptl/pthread.rs index 5548aed823180..27b17285b53ba 100644 --- a/src/new/glibc/sysdeps/nptl/pthread.rs +++ b/src/new/glibc/sysdeps/nptl/pthread.rs @@ -4,6 +4,7 @@ pub use crate::new::common::linux_like::pthread::{ pthread_getaffinity_np, + pthread_getattr_np, pthread_getname_np, pthread_setaffinity_np, pthread_setname_np, @@ -14,10 +15,12 @@ pub use crate::new::common::posix::pthread::{ pthread_attr_getinheritsched, pthread_attr_getschedparam, pthread_attr_getschedpolicy, + pthread_attr_getstack, pthread_attr_setguardsize, pthread_attr_setinheritsched, pthread_attr_setschedparam, pthread_attr_setschedpolicy, + pthread_attr_setstack, pthread_barrier_destroy, pthread_barrier_init, pthread_barrier_wait, @@ -26,7 +29,10 @@ pub use crate::new::common::posix::pthread::{ pthread_barrierattr_init, pthread_barrierattr_setpshared, pthread_cancel, + pthread_condattr_getclock, pthread_condattr_getpshared, + pthread_condattr_setclock, + pthread_condattr_setpshared, pthread_create, pthread_getcpuclockid, pthread_getschedparam, @@ -37,8 +43,11 @@ pub use crate::new::common::posix::pthread::{ pthread_mutexattr_getpshared, pthread_mutexattr_getrobust, pthread_mutexattr_setprotocol, + pthread_mutexattr_setpshared, pthread_mutexattr_setrobust, pthread_once, + pthread_rwlockattr_getpshared, + pthread_rwlockattr_setpshared, pthread_setschedparam, pthread_setschedprio, pthread_sigmask, diff --git a/src/new/mod.rs b/src/new/mod.rs index 72e838fee6ecb..2d71b73a79315 100644 --- a/src/new/mod.rs +++ b/src/new/mod.rs @@ -207,7 +207,12 @@ cfg_if! { cfg_if! { if #[cfg(target_family = "unix")] { // FIXME(pthread): eventually all platforms should use this module - #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))] + #[cfg(any( + target_os = "android", + target_os = "emscripten", + target_os = "l4re", + target_os = "linux" + ))] pub use pthread::*; pub use unistd::*; } diff --git a/src/new/musl/pthread.rs b/src/new/musl/pthread.rs index 7db80b0bbf716..0d578bc9665dc 100644 --- a/src/new/musl/pthread.rs +++ b/src/new/musl/pthread.rs @@ -4,6 +4,7 @@ pub use crate::new::common::linux_like::pthread::{ pthread_getaffinity_np, + pthread_getattr_np, pthread_getname_np, pthread_setaffinity_np, pthread_setname_np, @@ -14,10 +15,12 @@ pub use crate::new::common::posix::pthread::{ pthread_attr_getinheritsched, pthread_attr_getschedparam, pthread_attr_getschedpolicy, + pthread_attr_getstack, pthread_attr_setguardsize, pthread_attr_setinheritsched, pthread_attr_setschedparam, pthread_attr_setschedpolicy, + pthread_attr_setstack, pthread_barrier_destroy, pthread_barrier_init, pthread_barrier_wait, @@ -25,7 +28,10 @@ pub use crate::new::common::posix::pthread::{ pthread_barrierattr_getpshared, pthread_barrierattr_init, pthread_barrierattr_setpshared, + pthread_condattr_getclock, pthread_condattr_getpshared, + pthread_condattr_setclock, + pthread_condattr_setpshared, pthread_create, pthread_getcpuclockid, pthread_getschedparam, @@ -34,7 +40,10 @@ pub use crate::new::common::posix::pthread::{ pthread_mutexattr_getprotocol, pthread_mutexattr_getpshared, pthread_mutexattr_setprotocol, + pthread_mutexattr_setpshared, pthread_once, + pthread_rwlockattr_getpshared, + pthread_rwlockattr_setpshared, pthread_setschedparam, pthread_setschedprio, pthread_sigmask, diff --git a/src/new/uclibc/mod.rs b/src/new/uclibc/mod.rs index f51ef6cc7ecee..6bf83ef2e1d38 100644 --- a/src/new/uclibc/mod.rs +++ b/src/new/uclibc/mod.rs @@ -3,6 +3,5 @@ //! * About: //! * Headers: (mirror) -#[cfg(target_os = "linux")] pub(crate) mod pthread; pub(crate) mod unistd; diff --git a/src/new/uclibc/pthread.rs b/src/new/uclibc/pthread.rs index 8163be7916aec..bd7075d1ce2ef 100644 --- a/src/new/uclibc/pthread.rs +++ b/src/new/uclibc/pthread.rs @@ -1,44 +1,60 @@ //! Header: `pthread.h` +//! +//! Note that The l4re port of uclibc doesn't yet support all `pthread_*` API that is +//! available upstream. +pub use crate::new::common::linux_like::pthread::pthread_getattr_np; +#[cfg(not(target_os = "l4re"))] pub use crate::new::common::linux_like::pthread::{ pthread_getaffinity_np, pthread_getname_np, pthread_setaffinity_np, pthread_setname_np, }; +#[cfg(not(target_os = "l4re"))] pub use crate::new::common::posix::pthread::{ pthread_atfork, + pthread_barrierattr_getpshared, + pthread_getcpuclockid, + pthread_mutex_consistent, + pthread_mutexattr_getprotocol, + pthread_mutexattr_getrobust, + pthread_mutexattr_setprotocol, + pthread_mutexattr_setrobust, + pthread_setschedprio, +}; +pub use crate::new::common::posix::pthread::{ pthread_attr_getguardsize, pthread_attr_getinheritsched, pthread_attr_getschedparam, pthread_attr_getschedpolicy, + pthread_attr_getstack, pthread_attr_setguardsize, pthread_attr_setinheritsched, pthread_attr_setschedparam, pthread_attr_setschedpolicy, + pthread_attr_setstack, pthread_barrier_destroy, pthread_barrier_init, pthread_barrier_wait, pthread_barrierattr_destroy, - pthread_barrierattr_getpshared, pthread_barrierattr_init, pthread_barrierattr_setpshared, pthread_cancel, + pthread_condattr_getclock, pthread_condattr_getpshared, + pthread_condattr_setclock, + pthread_condattr_setpshared, pthread_create, - pthread_getcpuclockid, pthread_getschedparam, pthread_kill, - pthread_mutex_consistent, pthread_mutex_timedlock, - pthread_mutexattr_getprotocol, pthread_mutexattr_getpshared, - pthread_mutexattr_getrobust, - pthread_mutexattr_setprotocol, - pthread_mutexattr_setrobust, + pthread_mutexattr_setpshared, pthread_once, + pthread_rwlockattr_getpshared, + pthread_rwlockattr_setpshared, pthread_setschedparam, - pthread_setschedprio, pthread_sigmask, pthread_spin_destroy, pthread_spin_init, diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index e0198f16c5b5d..f4fd1c804144a 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1880,17 +1880,6 @@ extern "C" { pub fn dirfd(dirp: *mut crate::DIR) -> c_int; - pub fn pthread_getattr_np(native: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int; - pub fn pthread_attr_getstack( - attr: *const crate::pthread_attr_t, - stackaddr: *mut *mut c_void, - stacksize: *mut size_t, - ) -> c_int; - pub fn pthread_attr_setstack( - attr: *mut crate::pthread_attr_t, - stackaddr: *mut c_void, - stacksize: size_t, - ) -> c_int; pub fn memalign(align: size_t, size: size_t) -> *mut c_void; pub fn setgroups(ngroups: size_t, ptr: *const crate::gid_t) -> c_int; pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int; @@ -1915,21 +1904,7 @@ extern "C" { pub fn newlocale(mask: c_int, locale: *const c_char, base: crate::locale_t) -> crate::locale_t; pub fn uselocale(loc: crate::locale_t) -> crate::locale_t; pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int; - pub fn pthread_condattr_getclock( - attr: *const pthread_condattr_t, - clock_id: *mut clockid_t, - ) -> c_int; - pub fn pthread_condattr_setclock( - attr: *mut pthread_condattr_t, - clock_id: crate::clockid_t, - ) -> c_int; - pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: c_int) -> c_int; - pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int; - pub fn pthread_rwlockattr_getpshared( - attr: *const pthread_rwlockattr_t, - val: *mut c_int, - ) -> c_int; - pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: c_int) -> c_int; + pub fn ptsname_r(fd: c_int, buf: *mut c_char, buflen: size_t) -> c_int; pub fn clearenv() -> c_int; pub fn waitid(