diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 70ed1ca355300..3bfd0807ce11b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,15 +1,25 @@ Thanks for considering submitting a PR! -We have the [contribution guide](https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md). Please read it if you're new here! +We have the +[contribution guide](https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md). +Please read it if you're new here! -Here's a checklist for things that will be checked during review or continuous integration. +Here is a checklist for things that will be checked during review or continuous +integration: -- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s), e.g. edit `linux.txt` if you add an item to `src/unix/linux_like/linux/mod.rs` -- \[ ] Your PR doesn't contain any private or *unstable* values like `*LAST` or `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131)) +- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove + item(s), e.g. edit `linux.txt` if you add an item to + `src/unix/linux_like/linux/mod.rs` +- \[ ] Your PR doesn't contain any private or _unstable_ values like `*LAST` or + `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131)) +- \[ ] Provide a link to relevant source (headers or documentation) if your PR + adds or changes API. - \[ ] If your PR has a breaking change, please clarify it -- \[ ] If your PR increments version number, it must NOT contain any other changes (otherwise a release could be delayed) +- \[ ] If your PR increments version number, it must NOT contain any other + changes (otherwise a release could be delayed) - \[ ] Make sure `ci/style.sh` passes - \[ ] `cd libc-test && cargo test` - - (this might fail on your env due to environment difference between your env and CI. Ignore failures if you are not sure) + - (this might fail on your env due to environment difference between your env + and CI. Ignore local failures if you are not sure) Delete this line and everything above before opening your PR. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b6f41cc6de85e..beebff7ac4c08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,12 +3,41 @@ Welcome! If you are reading this document, it means you are interested in contributing to the `libc` crate. -## v0.2 changes +## v1.0 Roadmap -If you want to add your changes to v0.2, please submit them to the `libc-0.2` branch. -If you want to add any breaking changes, it should be submitted to the main branch, -which has changes for v0.3. -We will support and make a new release for v0.2 until we make the first release of v0.3. +`libc` has two active branches: `main` and `libc-0.2`. `main` is for active +development of the upcoming v1.0 release, and should be the target of all pull +requests. `libc-0.2` is for updates to the currently released version. + +If a pull request to `main` is a good candidate for inclusion in an `0.2.x` +release, include `@rustbot label stable-nominated` in a comment to propose this. +Good candidates will usually meet the following: + +1. The included changes are non-breaking. +2. The change applies cleanly to both branches. +3. There is a usecase that justifies inclusion in a stable release (all + additions should always have a usecase, hopefully). + +Once a `stable-nominated` PR targeting `main` has merged, it can be cherry +picked to the `libc-0.2` branch. A maintainer will likely do these cherry +picks in a batch. + +Alternatively, you can start this process yourself by creating a new branch +based on `libc-0.2` and running `git cherry-pick -xe commit-sha-on-main` (`git +cherry-pick -xe start-sha^..end-sha` if a range of commits is needed). `git` +will automatically add the "cherry picked from commit" note, but try to add a +backport note so the original PR gets crosslinked: + +``` +# ... original commit message ... + +(backport ) # add manually +(cherry picked from commit 104b6a4ae31c726814c36318dc718470cc96e167) # added by git +``` + +Once the cherry-pick is complete, open a PR targeting `libc-0.2`. + +See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details. ## Adding an API @@ -51,7 +80,7 @@ With that in mind, the steps for adding a new API are: 5. Wait for a merge! 1: Note that this list has nothing to do with any Unix or Posix -standard, it's just a list shared between all OSs that declare `#[cfg(unix)]`. +standard, it's just a list shared among all OSs that declare `#[cfg(unix)]`. ## Test before you commit diff --git a/README.md b/README.md index 4b72be03179aa..2ba6b9ced923d 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,17 @@ More detailed information about the design of this library can be found in its [rfc]: https://github.com/rust-lang/rfcs/blob/HEAD/text/1291-promote-libc.md -## v0.3 Roadmap +## v1.0 Roadmap -The main branch is now for v0.3 which has some breaking changes. +Currently, `libc` has two active branches: `main` for the upcoming v1.0 release, +and `libc-0.2` for the currently published version. By default all pull requests +should target `main`; once reviewed, they can be cherry picked to the `libc-0.2` +branch if needed. -For v0.2, please submit PRs to the `libc-0.2` branch instead. -We will stop making new v0.2 releases once we release v0.3 on crates.io. +We will stop making new v0.2 releases once v1.0 is released. -See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details. +See the section in [CONTRIBUTING.md](CONTRIBUTING.md#v10-roadmap) for more +details. ## Usage diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 20543d69bcb0f..8d85ad794ed53 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -85,3 +85,8 @@ harness = true name = "semver" path = "test/semver.rs" harness = false + +[[test]] +name = "primitive_types" +path = "test/primitive_types.rs" +harness = true diff --git a/libc-test/build.rs b/libc-test/build.rs index e6e5fcb535b09..2f45523187a51 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1550,6 +1550,7 @@ fn test_android(target: &str) { "sched.h", "semaphore.h", "signal.h", + "spawn.h", "stddef.h", "stdint.h", "stdio.h", @@ -1562,6 +1563,7 @@ fn test_android(target: &str) { "sys/fsuid.h", "sys/inotify.h", "sys/ioctl.h", + "sys/klog.h", "sys/mman.h", "sys/mount.h", "sys/personality.h", @@ -1635,6 +1637,8 @@ fn test_android(target: &str) { "linux/netfilter/nfnetlink_log.h", "linux/netfilter/nfnetlink_queue.h", "linux/netfilter/nf_tables.h", + "linux/netfilter_arp.h", + "linux/netfilter_bridge.h", "linux/netfilter_ipv4.h", "linux/netfilter_ipv6.h", "linux/netfilter_ipv6/ip6_tables.h", @@ -1707,6 +1711,10 @@ fn test_android(target: &str) { // FIXME: Somehow fails to test after removing cfg hacks: "__uint128" => true, + + // These are intended to be opaque + "posix_spawn_file_actions_t" => true, + "posix_spawnattr_t" => true, _ => false, } }); @@ -2487,6 +2495,8 @@ fn test_freebsd(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { + // This is introduced in FreeBSD 14.1 + "execvpe" => true, // The `uname` function in the `utsname.h` FreeBSD header is a C // inline function (has no symbol) that calls the `__xuname` symbol. // Therefore the function pointer comparison does not make sense for it. @@ -3342,6 +3352,7 @@ fn test_linux(target: &str) { "sys/eventfd.h", "sys/file.h", "sys/fsuid.h", + "sys/klog.h", "sys/inotify.h", "sys/ioctl.h", "sys/ipc.h", @@ -3442,6 +3453,8 @@ fn test_linux(target: &str) { "linux/netfilter/nfnetlink_log.h", "linux/netfilter/nfnetlink_queue.h", "linux/netfilter/nf_tables.h", + "linux/netfilter_arp.h", + "linux/netfilter_bridge.h", "linux/netfilter_ipv4.h", "linux/netfilter_ipv6.h", "linux/netfilter_ipv6/ip6_tables.h", @@ -3958,9 +3971,15 @@ fn test_linux(target: &str) { | "MINSIGSTKSZ" if gnu => true, - // FIXME: Linux >= 5.16 changed its value: + // FIXME: Linux >= 5.10: + // https://github.com/torvalds/linux/commit/d25e2e9388eda61b6e298585024ee3355f50c493 + "NF_INET_INGRESS" if musl => true, + + // FIXME: Linux >= 5.16: // https://github.com/torvalds/linux/commit/42df6e1d221dddc0f2acf2be37e68d553ad65f96 - "NF_NETDEV_NUMHOOKS" => true, + "NF_NETDEV_EGRESS" if musl || sparc64 => true, + // value changed + "NF_NETDEV_NUMHOOKS" if musl || sparc64 => true, // FIXME: requires Linux >= 5.6: | "RESOLVE_BENEATH" diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index e5e4777d48f36..f2f41be9e83d3 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -1098,6 +1098,17 @@ KEXEC_ON_CRASH KEXEC_PRESERVE_CONTEXT KEY_CNT KEY_MAX +KLOG_CLOSE +KLOG_OPEN +KLOG_READ +KLOG_READ_ALL +KLOG_READ_CLEAR +KLOG_CLEAR +KLOG_CONSOLE_OFF +KLOG_CONSOLE_ON +KLOG_CONSOLE_LEVEL +KLOG_SIZE_UNREAD +KLOG_SIZE_BUFFER LC_ADDRESS LC_ADDRESS_MASK LC_ALL @@ -1670,8 +1681,29 @@ NFULNL_COPY_PACKET NFULNL_MSG_CONFIG NFULNL_MSG_PACKET NF_ACCEPT +NF_ARP +NF_ARP_FORWARD +NF_ARP_IN +NF_ARP_NUMHOOKS +NF_ARP_OUT +NF_BR_BROUTING +NF_BR_FORWARD +NF_BR_LOCAL_IN +NF_BR_LOCAL_OUT +NF_BR_NUMHOOKS +NF_BR_POST_ROUTING +NF_BR_PRE_ROUTING +NF_BR_PRI_BRNF +NF_BR_PRI_FILTER_BRIDGED +NF_BR_PRI_FILTER_OTHER +NF_BR_PRI_FIRST +NF_BR_PRI_LAST +NF_BR_PRI_NAT_DST_BRIDGED +NF_BR_PRI_NAT_DST_OTHER +NF_BR_PRI_NAT_SRC NF_DROP NF_INET_FORWARD +NF_INET_INGRESS NF_INET_LOCAL_IN NF_INET_LOCAL_OUT NF_INET_NUMHOOKS @@ -1693,6 +1725,7 @@ NF_IP6_PRI_MANGLE NF_IP6_PRI_NAT_DST NF_IP6_PRI_NAT_SRC NF_IP6_PRI_RAW +NF_IP6_PRI_RAW_BEFORE_DEFRAG NF_IP6_PRI_SECURITY NF_IP6_PRI_SELINUX_FIRST NF_IP6_PRI_SELINUX_LAST @@ -1713,10 +1746,12 @@ NF_IP_PRI_MANGLE NF_IP_PRI_NAT_DST NF_IP_PRI_NAT_SRC NF_IP_PRI_RAW +NF_IP_PRI_RAW_BEFORE_DEFRAG NF_IP_PRI_SECURITY NF_IP_PRI_SELINUX_FIRST NF_IP_PRI_SELINUX_LAST NF_MAX_VERDICT +NF_NETDEV_EGRESS NF_NETDEV_INGRESS NF_NETDEV_NUMHOOKS NF_QUEUE @@ -3363,6 +3398,7 @@ itimerval key_t kill killpg +klogctl lastlog lchown lconv diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index b4e91dd083463..bb80ce86b48cf 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -256,10 +256,10 @@ COPYFILE_STATE_SRC_FD COPYFILE_STATE_SRC_FILENAME COPYFILE_STATE_STATUS_CB COPYFILE_STATE_STATUS_CTX -COPYFILE_STATE_XATTRNAME COPYFILE_STATE_WAS_CLONED -COPYFILE_VERBOSE +COPYFILE_STATE_XATTRNAME COPYFILE_UNLINK +COPYFILE_VERBOSE COPYFILE_XATTR CR0 CR1 @@ -441,6 +441,9 @@ F_LOG2PHYS F_LOG2PHYS_EXT F_NOCACHE F_NODIRECT +F_OFD_GETLK +F_OFD_SETLK +F_OFD_SETLKW F_PEOFPOSMODE F_PREALLOCATE F_PUNCHHOLE @@ -1599,7 +1602,10 @@ _CS_PATH _IOFBF _IOLBF _IONBF +_NSGetArgc +_NSGetArgv _NSGetEnviron +_NSGetProgname _POSIX_VDISABLE _PTHREAD_COND_SIG_init _PTHREAD_MUTEX_SIG_init @@ -1976,6 +1982,7 @@ posix_spawn_file_actions_t posix_spawnattr_destroy posix_spawnattr_get_qos_class_np posix_spawnattr_getarchpref_np +posix_spawnattr_getbinpref_np posix_spawnattr_getflags posix_spawnattr_getpgroup posix_spawnattr_getsigdefault @@ -1983,12 +1990,11 @@ posix_spawnattr_getsigmask posix_spawnattr_init posix_spawnattr_set_qos_class_np posix_spawnattr_setarchpref_np +posix_spawnattr_setbinpref_np posix_spawnattr_setflags posix_spawnattr_setpgroup posix_spawnattr_setsigdefault posix_spawnattr_setsigmask -posix_spawnattr_getbinpref_np -posix_spawnattr_setbinpref_np posix_spawnattr_t posix_spawnp preadv diff --git a/libc-test/semver/freebsd-x86_64.txt b/libc-test/semver/freebsd-x86_64.txt index 8edfb525633db..be73d1f7290fe 100644 --- a/libc-test/semver/freebsd-x86_64.txt +++ b/libc-test/semver/freebsd-x86_64.txt @@ -1,4 +1,5 @@ Elf64_Auxinfo +KINFO_FILE_SIZE MAP_32BIT _MC_FLAG_MASK _MC_FPFMT_NODEV diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 5a049d102114e..4e1f998f39982 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -1873,6 +1873,7 @@ eui64_hostton eui64_ntoa eui64_ntohost exect +execvpe execvP explicit_bzero extattr_delete_fd @@ -1981,6 +1982,7 @@ kcmp kevent key_t killpg +kinfo_file kinfo_getvmmap kinfo_proc kinfo_vmentry diff --git a/libc-test/semver/fuchsia.txt b/libc-test/semver/fuchsia.txt index 525b26bd62940..164916ccd554f 100644 --- a/libc-test/semver/fuchsia.txt +++ b/libc-test/semver/fuchsia.txt @@ -951,6 +951,7 @@ SOL_UDP SOL_X25 SOMAXCONN SO_BINDTODEVICE +SO_BINDTOIFINDEX SO_BSDCOMPAT SO_BUSY_POLL SO_DOMAIN diff --git a/libc-test/semver/illumos.txt b/libc-test/semver/illumos.txt new file mode 100644 index 0000000000000..d0ef608456d54 --- /dev/null +++ b/libc-test/semver/illumos.txt @@ -0,0 +1,3 @@ +pthread_attr_get_np +pthread_attr_getstackaddr +pthread_attr_setstack diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 8d564b0d82d85..c93940b82e485 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -837,13 +837,16 @@ FUTEX_OP_OPARG_SHIFT FUTEX_OP_OR FUTEX_OP_SET FUTEX_OP_XOR +FUTEX_OWNER_DIED FUTEX_PRIVATE_FLAG FUTEX_REQUEUE +FUTEX_TID_MASK FUTEX_TRYLOCK_PI FUTEX_UNLOCK_PI FUTEX_WAIT FUTEX_WAIT_BITSET FUTEX_WAIT_REQUEUE_PI +FUTEX_WAITERS FUTEX_WAKE FUTEX_WAKE_BITSET FUTEX_WAKE_OP @@ -1693,8 +1696,29 @@ NFULNL_COPY_PACKET NFULNL_MSG_CONFIG NFULNL_MSG_PACKET NF_ACCEPT +NF_ARP +NF_ARP_FORWARD +NF_ARP_IN +NF_ARP_NUMHOOKS +NF_ARP_OUT +NF_BR_BROUTING +NF_BR_FORWARD +NF_BR_LOCAL_IN +NF_BR_LOCAL_OUT +NF_BR_NUMHOOKS +NF_BR_POST_ROUTING +NF_BR_PRE_ROUTING +NF_BR_PRI_BRNF +NF_BR_PRI_FILTER_BRIDGED +NF_BR_PRI_FILTER_OTHER +NF_BR_PRI_FIRST +NF_BR_PRI_LAST +NF_BR_PRI_NAT_DST_BRIDGED +NF_BR_PRI_NAT_DST_OTHER +NF_BR_PRI_NAT_SRC NF_DROP NF_INET_FORWARD +NF_INET_INGRESS NF_INET_LOCAL_IN NF_INET_LOCAL_OUT NF_INET_NUMHOOKS @@ -1716,6 +1740,7 @@ NF_IP6_PRI_MANGLE NF_IP6_PRI_NAT_DST NF_IP6_PRI_NAT_SRC NF_IP6_PRI_RAW +NF_IP6_PRI_RAW_BEFORE_DEFRAG NF_IP6_PRI_SECURITY NF_IP6_PRI_SELINUX_FIRST NF_IP6_PRI_SELINUX_LAST @@ -1736,10 +1761,12 @@ NF_IP_PRI_MANGLE NF_IP_PRI_NAT_DST NF_IP_PRI_NAT_SRC NF_IP_PRI_RAW +NF_IP_PRI_RAW_BEFORE_DEFRAG NF_IP_PRI_SECURITY NF_IP_PRI_SELINUX_FIRST NF_IP_PRI_SELINUX_LAST NF_MAX_VERDICT +NF_NETDEV_EGRESS NF_QUEUE NF_REPEAT NF_STOLEN @@ -3636,6 +3663,7 @@ j1939_filter jrand48 key_t killpg +klogctl labs lcong48 lgetxattr diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 353b1e7356ff5..b82d9cbeca065 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -1189,6 +1189,9 @@ _cpuset_destroy _cpuset_isset _cpuset_set _cpuset_zero +_lwp_park +_lwp_unpark +_lwp_unpark_all _lwp_self abs accept4 diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt index 069508925c8ef..8f51b3ceca6fa 100644 --- a/libc-test/semver/solarish.txt +++ b/libc-test/semver/solarish.txt @@ -1 +1,14 @@ +IPV6_DONTFRAG +IPV6_PKTINFO +IPV6_RECVTCLASS +IPV6_TCLASS +IP_DONTFRAG +IP_PKTINFO +IP_TOS +IP_TTL PIPE_BUF +bind +in6_pktinfo +in_pktinfo +recvmsg +sendmsg diff --git a/libc-test/semver/unix.txt b/libc-test/semver/unix.txt index 5e84434b46bf4..03248dfec58c7 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -687,6 +687,7 @@ pthread_condattr_init pthread_condattr_t pthread_create pthread_detach +pthread_equal pthread_exit pthread_getspecific pthread_join diff --git a/libc-test/test/primitive_types.rs b/libc-test/test/primitive_types.rs new file mode 100644 index 0000000000000..c125a92a58110 --- /dev/null +++ b/libc-test/test/primitive_types.rs @@ -0,0 +1,15 @@ +use std::any::TypeId; + +macro_rules! ok { + ($($t:ident)*) => {$( + assert!(TypeId::of::() == TypeId::of::(), + "{} is wrong", stringify!($t)); + )*} +} + +#[test] +fn same() { + use std::ffi; + ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong + c_longlong c_ulonglong c_float c_double); +} diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 65d7e9005ddfe..bf4250c974106 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -2979,6 +2979,7 @@ pub const SO_MARK: ::c_int = 36; pub const SO_RXQ_OVFL: ::c_int = 40; pub const SO_PEEK_OFF: ::c_int = 42; pub const SO_BUSY_POLL: ::c_int = 46; +pub const SO_BINDTOIFINDEX: ::c_int = 62; pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; diff --git a/src/macros.rs b/src/macros.rs index aa08505239c58..7090e6d1d1538 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -61,13 +61,23 @@ macro_rules! cfg_if { }; } +/// Implement `Clone` and `Copy` for a struct, as well as `Debug`, `Eq`, `Hash`, and +/// `PartialEq` if the `extra_traits` feature is enabled. +/// +/// Use [`s_no_extra_traits`] for structs where the `extra_traits` feature does not +/// make sense, and for unions. macro_rules! s { - ($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($( + ($( + $(#[$attr:meta])* + pub $t:ident $i:ident { $($field:tt)* } + )*) => ($( s!(it: $(#[$attr])* pub $t $i { $($field)* }); )*); + (it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => ( compile_error!("unions cannot derive extra traits, use s_no_extra_traits instead"); ); + (it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => ( __item! { #[repr(C)] @@ -85,10 +95,38 @@ macro_rules! s { ); } +/// Implement `Clone` and `Copy` for a tuple struct, as well as `Debug`, `Eq`, `Hash`, +/// and `PartialEq` if the `extra_traits` feature is enabled. +/// +/// This is the same as [`s`] but works for tuple structs. +macro_rules! s_paren { + ($( + $(#[$attr:meta])* + pub struct $i:ident ( $($field:tt)* ); + )*) => ($( + __item! { + #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] + $(#[$attr])* + pub struct $i ( $($field)* ); + } + impl ::Copy for $i {} + impl ::Clone for $i { + fn clone(&self) -> $i { *self } + } + )*); +} + +/// Implement `Clone` and `Copy` for a struct with no `extra_traits` feature. +/// +/// Most items will prefer to use [`s`]. macro_rules! s_no_extra_traits { - ($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($( + ($( + $(#[$attr:meta])* + pub $t:ident $i:ident { $($field:tt)* } + )*) => ($( s_no_extra_traits!(it: $(#[$attr])* pub $t $i { $($field)* }); )*); + (it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => ( __item! { #[repr(C)] @@ -101,6 +139,7 @@ macro_rules! s_no_extra_traits { fn clone(&self) -> $i { *self } } ); + (it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => ( __item! { #[repr(C)] @@ -116,14 +155,26 @@ macro_rules! s_no_extra_traits { ); } +/// Specify that an enum should have no traits that aren't specified in the macro +/// invocation, i.e. no `Clone` or `Copy`. macro_rules! missing { - ($($(#[$attr:meta])* pub enum $i:ident {})*) => ($( - $(#[$attr])* #[allow(missing_copy_implementations)] pub enum $i { } + ($( + $(#[$attr:meta])* + pub enum $i:ident {} + )*) => ($( + $(#[$attr])* + #[allow(missing_copy_implementations)] + pub enum $i { } )*); } +/// Implement `Clone` and `Copy` for an enum, as well as `Debug`, `Eq`, `Hash`, and +/// `PartialEq` if the `extra_traits` feature is enabled. macro_rules! e { - ($($(#[$attr:meta])* pub enum $i:ident { $($field:tt)* })*) => ($( + ($( + $(#[$attr:meta])* + pub enum $i:ident { $($field:tt)* } + )*) => ($( __item! { #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] $(#[$attr])* @@ -136,89 +187,80 @@ macro_rules! e { )*); } -macro_rules! s_paren { - ($($(#[$attr:meta])* pub struct $i:ident ( $($field:tt)* ); )* ) => ($( - __item! { - #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] - $(#[$attr])* - pub struct $i ( $($field)* ); - } - impl ::Copy for $i {} - impl ::Clone for $i { - fn clone(&self) -> $i { *self } - } - )*); -} - cfg_if! { if #[cfg(feature = "const-extern-fn")] { + /// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled. macro_rules! f { - ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - pub $($constness)* unsafe extern fn $i($($arg: $argty),* - ) -> $ret { + pub $($constness)* unsafe extern fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) } + /// Define a safe function that is const as long as `const-extern-fn` is enabled. macro_rules! safe_f { - ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - pub $($constness)* extern fn $i($($arg: $argty),* - ) -> $ret { + pub $($constness)* extern fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) } + /// A nonpublic function that is const as long as `const-extern-fn` is enabled. macro_rules! const_fn { - ($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - $($constness)* fn $i($($arg: $argty),* - ) -> $ret { + $($constness)* fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) } - } else { + /// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled. macro_rules! f { - ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - pub unsafe extern fn $i($($arg: $argty),* - ) -> $ret { + pub unsafe extern fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) } + /// Define a safe function that is const as long as `const-extern-fn` is enabled. macro_rules! safe_f { - ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* pub extern fn $i($($arg: $argty),* @@ -228,16 +270,17 @@ cfg_if! { )*) } + /// A nonpublic function that is const as long as `const-extern-fn` is enabled. macro_rules! const_fn { - ($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - fn $i($($arg: $argty),* - ) -> $ret { + fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 1e2dedee9bffb..bcd3f242d802a 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -574,7 +574,7 @@ cfg_if! { } impl Eq for __sigaction_sa_union {} impl ::fmt::Debug for __sigaction_sa_union { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("__sigaction_sa_union") .field("__su_handler", unsafe { &self.__su_handler }) .field("__su_sigaction", unsafe { &self.__su_sigaction }) @@ -600,7 +600,7 @@ cfg_if! { } impl Eq for sigaction {} impl ::fmt::Debug for sigaction { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("sigaction"); struct_formatter.field("sa_union", &self.sa_union); struct_formatter.field("sa_mask", &self.sa_mask); @@ -627,7 +627,7 @@ cfg_if! { } impl Eq for __poll_ctl_ext_u {} impl ::fmt::Debug for __poll_ctl_ext_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("__poll_ctl_ext_u") .field("addr", unsafe { &self.addr }) .field("data32", unsafe { &self.data32 }) @@ -658,7 +658,7 @@ cfg_if! { } impl Eq for poll_ctl_ext {} impl ::fmt::Debug for poll_ctl_ext { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("poll_ctl_ext"); struct_formatter.field("version", &self.version); struct_formatter.field("command", &self.command); diff --git a/src/unix/aix/powerpc64.rs b/src/unix/aix/powerpc64.rs index deec291b28dca..ff5f77a74a2f6 100644 --- a/src/unix/aix/powerpc64.rs +++ b/src/unix/aix/powerpc64.rs @@ -307,7 +307,7 @@ cfg_if! { } impl Eq for siginfo_t {} impl ::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("siginfo_t"); struct_formatter.field("si_signo", &self.si_signo); struct_formatter.field("si_errno", &self.si_errno); @@ -347,7 +347,7 @@ cfg_if! { } impl Eq for _kernel_simple_lock {} impl ::fmt::Debug for _kernel_simple_lock { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("_kernel_simple_lock") .field("_slock", unsafe { &self._slock }) .field("_slockp", unsafe { &self._slockp }) @@ -374,7 +374,7 @@ cfg_if! { } impl Eq for fileops_t {} impl ::fmt::Debug for fileops_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("fileops_t"); struct_formatter.field("fo_rw", &self.fo_rw); struct_formatter.field("fo_ioctl", &self.fo_ioctl); @@ -415,7 +415,7 @@ cfg_if! { } impl Eq for file {} impl ::fmt::Debug for file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("file"); struct_formatter.field("f_flag", &self.f_flag); struct_formatter.field("f_count", &self.f_count); @@ -466,7 +466,7 @@ cfg_if! { } impl Eq for __ld_info_file {} impl ::fmt::Debug for __ld_info_file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("__ld_info_file") .field("_ldinfo_fd", unsafe { &self._ldinfo_fd }) .field("_ldinfo_fp", unsafe { &self._ldinfo_fp }) @@ -498,7 +498,7 @@ cfg_if! { } impl Eq for ld_info {} impl ::fmt::Debug for ld_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("ld_info"); struct_formatter.field("ldinfo_next", &self.ldinfo_next); struct_formatter.field("ldinfo_flags", &self.ldinfo_flags); @@ -535,7 +535,7 @@ cfg_if! { } impl Eq for __pollfd_ext_u {} impl ::fmt::Debug for __pollfd_ext_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("__pollfd_ext_u") .field("addr", unsafe { &self.addr }) .field("data32", unsafe { &self.data32 }) @@ -563,7 +563,7 @@ cfg_if! { } impl Eq for pollfd_ext {} impl ::fmt::Debug for pollfd_ext { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("pollfd_ext"); struct_formatter.field("fd", &self.fd); struct_formatter.field("events", &self.events); diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index ff3326475970d..9951f2314153d 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -3592,6 +3592,10 @@ pub const F_GLOBAL_NOCACHE: ::c_int = 55; pub const F_NODIRECT: ::c_int = 62; pub const F_LOG2PHYS_EXT: ::c_int = 65; pub const F_BARRIERFSYNC: ::c_int = 85; +// See https://github.com/apple/darwin-xnu/blob/main/bsd/sys/fcntl.h +pub const F_OFD_SETLK: ::c_int = 90; /* Acquire or release open file description lock */ +pub const F_OFD_SETLKW: ::c_int = 91; /* (as F_OFD_SETLK but blocking if conflicting lock) */ +pub const F_OFD_GETLK: ::c_int = 92; /* Examine OFD lock */ pub const F_PUNCHHOLE: ::c_int = 99; pub const F_TRIM_ACTIVE_FILE: ::c_int = 100; pub const F_SPECULATIVE_READ: ::c_int = 101; @@ -6266,7 +6270,11 @@ extern "C" { pub fn CCRandomGenerateBytes(bytes: *mut ::c_void, size: ::size_t) -> ::CCRNGStatus; pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + // crt_externs.h + pub fn _NSGetArgv() -> *mut *mut *mut ::c_char; + pub fn _NSGetArgc() -> *mut ::c_int; pub fn _NSGetEnviron() -> *mut *mut *mut ::c_char; + pub fn _NSGetProgname() -> *mut *mut ::c_char; pub fn vm_allocate( target_task: vm_map_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index a2942913b95d1..307ca87127f31 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1621,6 +1621,23 @@ s_no_extra_traits! { pub cause: sctp_error_cause, pub hmac_id: u16, } + + pub struct kinfo_file { + pub kf_structsize: ::c_int, + pub kf_type: ::c_int, + pub kf_fd: ::c_int, + pub kf_ref_count: ::c_int, + pub kf_flags: ::c_int, + _kf_pad0: ::c_int, + pub kf_offset: i64, + _priv: [::uintptr_t; 38], // FIXME if needed + pub kf_status: u16, + _kf_pad1: u16, + _kf_ispare0: ::c_int, + pub kf_cap_rights: ::cap_rights_t, + _kf_cap_spare: u64, + pub kf_path: [::c_char; ::PATH_MAX as usize], + } } cfg_if! { @@ -2529,6 +2546,52 @@ cfg_if! { {self.hmac_id}.hash(state); } } + + impl PartialEq for kinfo_file { + fn eq(&self, other: &kinfo_file) -> bool { + self.kf_structsize == other.kf_structsize && + self.kf_type == other.kf_type && + self.kf_fd == other.kf_fd && + self.kf_ref_count == other.kf_ref_count && + self.kf_flags == other.kf_flags && + self.kf_offset == other.kf_offset && + self.kf_status == other.kf_status && + self.kf_cap_rights == other.kf_cap_rights && + self.kf_path + .iter() + .zip(other.kf_path.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for kinfo_file {} + impl ::fmt::Debug for kinfo_file { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("kinfo_file") + .field("kf_structsize", &self.kf_structsize) + .field("kf_type", &self.kf_type) + .field("kf_fd", &self.kf_fd) + .field("kf_ref_count", &self.kf_ref_count) + .field("kf_flags", &self.kf_flags) + .field("kf_offset", &self.kf_offset) + .field("kf_status", &self.kf_status) + .field("kf_cap_rights", &self.kf_cap_rights) + .field("kf_path", &&self.kf_path[..]) + .finish() + } + } + impl ::hash::Hash for kinfo_file { + fn hash(&self, state: &mut H) { + self.kf_structsize.hash(state); + self.kf_type.hash(state); + self.kf_fd.hash(state); + self.kf_ref_count.hash(state); + self.kf_flags.hash(state); + self.kf_offset.hash(state); + self.kf_status.hash(state); + self.kf_cap_rights.hash(state); + self.kf_path.hash(state); + } + } } } @@ -5534,6 +5597,12 @@ 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/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 29689c910689f..3e3e5cc9f34fb 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -190,3 +190,5 @@ cfg_if! { } pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 + +pub const KINFO_FILE_SIZE: ::c_int = 1392; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index c94695ed06cfb..aa33345f3113f 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -91,23 +91,6 @@ s_no_extra_traits! { pub a_type: ::c_long, pub a_un: __c_anonymous_elf64_auxv_union, } - - pub struct kinfo_file { - pub kf_structsize: ::c_int, - pub kf_type: ::c_int, - pub kf_fd: ::c_int, - pub kf_ref_count: ::c_int, - pub kf_flags: ::c_int, - _kf_pad0: ::c_int, - pub kf_offset: i64, - _priv: [::uintptr_t; 38], // FIXME if needed - pub kf_status: u16, - _kf_pad1: u16, - _kf_ispare0: ::c_int, - pub kf_cap_rights: ::cap_rights_t, - _kf_cap_spare: u64, - pub kf_path: [::c_char; ::PATH_MAX as usize], - } } cfg_if! { @@ -232,52 +215,6 @@ cfg_if! { .finish() } } - - impl PartialEq for kinfo_file { - fn eq(&self, other: &kinfo_file) -> bool { - self.kf_structsize == other.kf_structsize && - self.kf_type == other.kf_type && - self.kf_fd == other.kf_fd && - self.kf_ref_count == other.kf_ref_count && - self.kf_flags == other.kf_flags && - self.kf_offset == other.kf_offset && - self.kf_status == other.kf_status && - self.kf_cap_rights == other.kf_cap_rights && - self.kf_path - .iter() - .zip(other.kf_path.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for kinfo_file {} - impl ::fmt::Debug for kinfo_file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("kinfo_file") - .field("kf_structsize", &self.kf_structsize) - .field("kf_type", &self.kf_type) - .field("kf_fd", &self.kf_fd) - .field("kf_ref_count", &self.kf_ref_count) - .field("kf_flags", &self.kf_flags) - .field("kf_offset", &self.kf_offset) - .field("kf_status", &self.kf_status) - .field("kf_cap_rights", &self.kf_cap_rights) - .field("kf_path", &&self.kf_path[..]) - .finish() - } - } - impl ::hash::Hash for kinfo_file { - fn hash(&self, state: &mut H) { - self.kf_structsize.hash(state); - self.kf_type.hash(state); - self.kf_fd.hash(state); - self.kf_ref_count.hash(state); - self.kf_flags.hash(state); - self.kf_offset.hash(state); - self.kf_status.hash(state); - self.kf_cap_rights.hash(state); - self.kf_path.hash(state); - } - } } } @@ -297,5 +234,7 @@ pub const _MC_FPOWNED_NONE: c_long = 0x20000; pub const _MC_FPOWNED_FPU: c_long = 0x20001; pub const _MC_FPOWNED_PCB: c_long = 0x20002; +pub const KINFO_FILE_SIZE: ::c_int = 1392; + mod align; pub use self::align::*; diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index e2b5121b03911..83e675ca3474d 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -128,7 +128,7 @@ s_no_extra_traits! { pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, - pub sun_path: [c_char; 104] + pub sun_path: [::c_char; 104] } pub struct utsname { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 47ade8c087fd2..7c58e85c4434c 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -2862,6 +2862,22 @@ extern "C" { pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; pub fn reboot(mode: ::c_int, bootstr: *mut ::c_char) -> ::c_int; + + #[link_name = "___lwp_park60"] + pub fn _lwp_park( + clock: ::clockid_t, + flags: ::c_int, + ts: *const ::timespec, + unpark: ::lwpid_t, + hint: *const ::c_void, + unparkhint: *mut ::c_void, + ) -> ::c_int; + pub fn _lwp_unpark(lwp: ::lwpid_t, hint: *const ::c_void) -> ::c_int; + pub fn _lwp_unpark_all( + targets: *const ::lwpid_t, + ntargets: ::size_t, + hint: *const ::c_void, + ) -> ::c_int; } #[link(name = "rt")] diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 4480cf4c4231a..af7cdb69bc5ea 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -48,6 +48,10 @@ pub type Elf64_Xword = u64; pub type eventfd_t = u64; +// these structs sit behind a heap allocation on Android +pub type posix_spawn_file_actions_t = *mut ::c_void; +pub type posix_spawnattr_t = *mut ::c_void; + s! { pub struct stack_t { pub ss_sp: *mut ::c_void, @@ -2312,9 +2316,11 @@ pub const NF_INET_FORWARD: ::c_int = 2; pub const NF_INET_LOCAL_OUT: ::c_int = 3; pub const NF_INET_POST_ROUTING: ::c_int = 4; pub const NF_INET_NUMHOOKS: ::c_int = 5; +pub const NF_INET_INGRESS: ::c_int = NF_INET_NUMHOOKS; pub const NF_NETDEV_INGRESS: ::c_int = 0; -pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; +pub const NF_NETDEV_EGRESS: ::c_int = 1; +pub const NF_NETDEV_NUMHOOKS: ::c_int = 2; pub const NFPROTO_UNSPEC: ::c_int = 0; pub const NFPROTO_INET: ::c_int = 1; @@ -2326,6 +2332,31 @@ pub const NFPROTO_IPV6: ::c_int = 10; pub const NFPROTO_DECNET: ::c_int = 12; pub const NFPROTO_NUMPROTO: ::c_int = 13; +// linux/netfilter_arp.h +pub const NF_ARP: ::c_int = 0; +pub const NF_ARP_IN: ::c_int = 0; +pub const NF_ARP_OUT: ::c_int = 1; +pub const NF_ARP_FORWARD: ::c_int = 2; +pub const NF_ARP_NUMHOOKS: ::c_int = 3; + +// linux/netfilter_bridge.h +pub const NF_BR_PRE_ROUTING: ::c_int = 0; +pub const NF_BR_LOCAL_IN: ::c_int = 1; +pub const NF_BR_FORWARD: ::c_int = 2; +pub const NF_BR_LOCAL_OUT: ::c_int = 3; +pub const NF_BR_POST_ROUTING: ::c_int = 4; +pub const NF_BR_BROUTING: ::c_int = 5; +pub const NF_BR_NUMHOOKS: ::c_int = 6; + +pub const NF_BR_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_BR_PRI_NAT_DST_BRIDGED: ::c_int = -300; +pub const NF_BR_PRI_FILTER_BRIDGED: ::c_int = -200; +pub const NF_BR_PRI_BRNF: ::c_int = 0; +pub const NF_BR_PRI_NAT_DST_OTHER: ::c_int = 100; +pub const NF_BR_PRI_FILTER_OTHER: ::c_int = 200; +pub const NF_BR_PRI_NAT_SRC: ::c_int = 300; +pub const NF_BR_PRI_LAST: ::c_int = ::INT_MAX; + // linux/netfilter_ipv4.h pub const NF_IP_PRE_ROUTING: ::c_int = 0; pub const NF_IP_LOCAL_IN: ::c_int = 1; @@ -2335,6 +2366,7 @@ pub const NF_IP_POST_ROUTING: ::c_int = 4; pub const NF_IP_NUMHOOKS: ::c_int = 5; pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP_PRI_RAW_BEFORE_DEFRAG: ::c_int = -450; pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400; pub const NF_IP_PRI_RAW: ::c_int = -300; pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225; @@ -2358,6 +2390,7 @@ pub const NF_IP6_POST_ROUTING: ::c_int = 4; pub const NF_IP6_NUMHOOKS: ::c_int = 5; pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP6_PRI_RAW_BEFORE_DEFRAG: ::c_int = -450; pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400; pub const NF_IP6_PRI_RAW: ::c_int = -300; pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225; @@ -3503,6 +3536,18 @@ pub const AT_RSEQ_ALIGN: ::c_ulong = 28; pub const AT_EXECFN: ::c_ulong = 31; pub const AT_MINSIGSTKSZ: ::c_ulong = 51; +pub const KLOG_CLOSE: ::c_int = 0; +pub const KLOG_OPEN: ::c_int = 1; +pub const KLOG_READ: ::c_int = 2; +pub const KLOG_READ_ALL: ::c_int = 3; +pub const KLOG_READ_CLEAR: ::c_int = 4; +pub const KLOG_CLEAR: ::c_int = 5; +pub const KLOG_CONSOLE_OFF: ::c_int = 6; +pub const KLOG_CONSOLE_ON: ::c_int = 7; +pub const KLOG_CONSOLE_LEVEL: ::c_int = 8; +pub const KLOG_SIZE_UNREAD: ::c_int = 9; +pub const KLOG_SIZE_BUFFER: ::c_int = 10; + // Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the // following are only available on newer Linux versions than the versions // currently used in CI in some configurations, so we define them here. @@ -4091,6 +4136,8 @@ 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/gnu/b64/riscv64/align.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs index 48d152a5721ec..5b33f2375d39c 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs @@ -42,3 +42,20 @@ s_no_extra_traits! { pub __glibc_reserved: [::c_uint; 3], } } + +s! { + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 63a4cc2c499fb..ba68965174c09 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -469,13 +469,14 @@ s! { // to false. So I'm just removing these, and if uClibc changes // the #if block in the future to include the following fields, these // will probably need including here. tsidea, skrap - #[cfg(not(target_env = "uclibc"))] + // QNX (NTO) platform does not define these fields + #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_adds: ::c_ulonglong, - #[cfg(not(target_env = "uclibc"))] + #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_subs: ::c_ulonglong, - #[cfg(not(target_env = "uclibc"))] + #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_tls_modid: ::size_t, - #[cfg(not(target_env = "uclibc"))] + #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_tls_data: *mut ::c_void, } @@ -3289,20 +3290,47 @@ pub const NF_INET_FORWARD: ::c_int = 2; pub const NF_INET_LOCAL_OUT: ::c_int = 3; pub const NF_INET_POST_ROUTING: ::c_int = 4; pub const NF_INET_NUMHOOKS: ::c_int = 5; +pub const NF_INET_INGRESS: ::c_int = NF_INET_NUMHOOKS; + +pub const NF_NETDEV_INGRESS: ::c_int = 0; +pub const NF_NETDEV_EGRESS: ::c_int = 1; +pub const NF_NETDEV_NUMHOOKS: ::c_int = 2; // Some NFPROTO are not compatible with musl and are defined in submodules. pub const NFPROTO_UNSPEC: ::c_int = 0; +pub const NFPROTO_INET: ::c_int = 1; pub const NFPROTO_IPV4: ::c_int = 2; pub const NFPROTO_ARP: ::c_int = 3; +pub const NFPROTO_NETDEV: ::c_int = 5; pub const NFPROTO_BRIDGE: ::c_int = 7; pub const NFPROTO_IPV6: ::c_int = 10; pub const NFPROTO_DECNET: ::c_int = 12; pub const NFPROTO_NUMPROTO: ::c_int = 13; -pub const NFPROTO_INET: ::c_int = 1; -pub const NFPROTO_NETDEV: ::c_int = 5; -pub const NF_NETDEV_INGRESS: ::c_int = 0; -pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; +// linux/netfilter_arp.h +pub const NF_ARP: ::c_int = 0; +pub const NF_ARP_IN: ::c_int = 0; +pub const NF_ARP_OUT: ::c_int = 1; +pub const NF_ARP_FORWARD: ::c_int = 2; +pub const NF_ARP_NUMHOOKS: ::c_int = 3; + +// linux/netfilter_bridge.h +pub const NF_BR_PRE_ROUTING: ::c_int = 0; +pub const NF_BR_LOCAL_IN: ::c_int = 1; +pub const NF_BR_FORWARD: ::c_int = 2; +pub const NF_BR_LOCAL_OUT: ::c_int = 3; +pub const NF_BR_POST_ROUTING: ::c_int = 4; +pub const NF_BR_BROUTING: ::c_int = 5; +pub const NF_BR_NUMHOOKS: ::c_int = 6; + +pub const NF_BR_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_BR_PRI_NAT_DST_BRIDGED: ::c_int = -300; +pub const NF_BR_PRI_FILTER_BRIDGED: ::c_int = -200; +pub const NF_BR_PRI_BRNF: ::c_int = 0; +pub const NF_BR_PRI_NAT_DST_OTHER: ::c_int = 100; +pub const NF_BR_PRI_FILTER_OTHER: ::c_int = 200; +pub const NF_BR_PRI_NAT_SRC: ::c_int = 300; +pub const NF_BR_PRI_LAST: ::c_int = ::INT_MAX; // linux/netfilter_ipv4.h pub const NF_IP_PRE_ROUTING: ::c_int = 0; @@ -3313,6 +3341,7 @@ pub const NF_IP_POST_ROUTING: ::c_int = 4; pub const NF_IP_NUMHOOKS: ::c_int = 5; pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP_PRI_RAW_BEFORE_DEFRAG: ::c_int = -450; pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400; pub const NF_IP_PRI_RAW: ::c_int = -300; pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225; @@ -3336,6 +3365,7 @@ pub const NF_IP6_POST_ROUTING: ::c_int = 4; pub const NF_IP6_NUMHOOKS: ::c_int = 5; pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP6_PRI_RAW_BEFORE_DEFRAG: ::c_int = -450; pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400; pub const NF_IP6_PRI_RAW: ::c_int = -300; pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225; @@ -4578,6 +4608,7 @@ pub const FAN_NOFD: ::c_int = -1; pub const FAN_NOPIDFD: ::c_int = FAN_NOFD; pub const FAN_EPIDFD: ::c_int = -2; +// linux/futex.h pub const FUTEX_WAIT: ::c_int = 0; pub const FUTEX_WAKE: ::c_int = 1; pub const FUTEX_FD: ::c_int = 2; @@ -4597,6 +4628,10 @@ pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); +pub const FUTEX_WAITERS: u32 = 0x80000000; +pub const FUTEX_OWNER_DIED: u32 = 0x40000000; +pub const FUTEX_TID_MASK: u32 = 0x3fffffff; + pub const FUTEX_BITSET_MATCH_ANY: ::c_int = 0xffffffff; pub const FUTEX_OP_SET: ::c_int = 0; @@ -6088,6 +6123,8 @@ extern "C" { len: ::size_t, flags: ::c_uint, ) -> ::ssize_t; + + pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int; } // LFS64 extensions diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/align.rs b/src/unix/linux_like/linux/musl/b64/riscv64/align.rs index 48d152a5721ec..5b33f2375d39c 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/align.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/align.rs @@ -42,3 +42,20 @@ s_no_extra_traits! { pub __glibc_reserved: [::c_uint; 3], } } + +s! { + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} diff --git a/src/unix/mod.rs b/src/unix/mod.rs index b67b5a93e3541..6cc072a739e6c 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -590,7 +590,10 @@ extern "C" { #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_socket" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")] pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] @@ -598,7 +601,10 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "connect$UNIX2003" )] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_connect" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")] pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int; #[cfg_attr( @@ -648,7 +654,10 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "socketpair$UNIX2003" )] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_socketpair" + )] pub fn socketpair( domain: ::c_int, type_: ::c_int, @@ -660,7 +669,10 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "sendto$UNIX2003" )] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_sendto" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")] pub fn sendto( socket: ::c_int, @@ -1030,6 +1042,7 @@ extern "C" { pub fn times(buf: *mut ::tms) -> ::clock_t; pub fn pthread_self() -> ::pthread_t; + pub fn pthread_equal(t1: ::pthread_t, t2: ::pthread_t) -> ::c_int; #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "pthread_join$UNIX2003" @@ -1137,7 +1150,10 @@ extern "C" { pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int; - #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_getsockopt" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")] pub fn getsockopt( sockfd: ::c_int, @@ -1156,7 +1172,10 @@ extern "C" { pub fn dlclose(handle: *mut ::c_void) -> ::c_int; #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_getaddrinfo" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")] pub fn getaddrinfo( node: *const c_char, diff --git a/src/unix/newlib/espidf/mod.rs b/src/unix/newlib/espidf/mod.rs index 409d7ad9bd784..e2e98ee9c394a 100644 --- a/src/unix/newlib/espidf/mod.rs +++ b/src/unix/newlib/espidf/mod.rs @@ -89,6 +89,16 @@ pub const MSG_EOR: ::c_int = 0x08; pub const PTHREAD_STACK_MIN: ::size_t = 768; +pub const SIGABRT: ::size_t = 1; +pub const SIGFPE: ::size_t = 1; +pub const SIGILL: ::size_t = 1; +pub const SIGINT: ::size_t = 1; +pub const SIGSEGV: ::size_t = 1; +pub const SIGTERM: ::size_t = 1; +pub const SIGHUP: ::size_t = 1; +pub const SIGQUIT: ::size_t = 1; +pub const NSIG: ::size_t = 2; + extern "C" { pub fn pthread_create( native: *mut ::pthread_t, diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index f00d710bbac02..84aa3830bc5f2 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -2864,9 +2864,9 @@ safe_f! { // Network related functions are provided by libsocket and regex // functions are provided by libregex. +// In QNX <=7.0, libregex functions were included in libc itself. #[link(name = "socket")] -#[link(name = "regex")] - +#[cfg_attr(not(target_env = "nto70"), link(name = "regex"))] extern "C" { pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; @@ -3339,7 +3339,10 @@ extern "C" { pub fn dl_iterate_phdr( callback: ::Option< unsafe extern "C" fn( - info: *const dl_phdr_info, + // The original .h file declares this as *const, but for consistency with other platforms, + // changing this to *mut to make it easier to use. + // Maybe in v0.3 all platforms should use this as a *const. + info: *mut dl_phdr_info, size: ::size_t, data: *mut ::c_void, ) -> ::c_int, diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 404f013da2f98..ef3862ee41b34 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -81,6 +81,21 @@ extern "C" { ) -> ::c_int; pub fn pset_getloadavg(pset: ::psetid_t, load: *mut ::c_double, num: ::c_int) -> ::c_int; + pub fn pthread_attr_get_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int; + pub fn pthread_attr_getstackaddr( + attr: *const ::pthread_attr_t, + stackaddr: *mut *mut ::c_void, + ) -> ::c_int; + pub fn pthread_attr_setstack( + attr: *mut ::pthread_attr_t, + stackaddr: *mut ::c_void, + stacksize: ::size_t, + ) -> ::c_int; + pub fn pthread_attr_setstackaddr( + attr: *mut ::pthread_attr_t, + stackaddr: *mut ::c_void, + ) -> ::c_int; + pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index ab8070dd3f077..27f3bf920c116 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -120,6 +120,17 @@ s! { pub __sin6_src_id: u32 } + pub struct in_pktinfo { + pub ipi_ifindex: ::c_uint, + pub ipi_spec_dst: ::in_addr, + pub ipi_addr: ::in_addr, + } + + pub struct in6_pktinfo { + pub ipi6_addr: ::in6_addr, + pub ipi6_ifindex: ::c_uint, + } + pub struct passwd { pub pw_name: *mut ::c_char, pub pw_passwd: *mut ::c_char, @@ -1224,14 +1235,20 @@ pub const CLD_STOPPED: ::c_int = 5; pub const CLD_CONTINUED: ::c_int = 6; pub const IP_RECVDSTADDR: ::c_int = 0x7; +pub const IP_PKTINFO: ::c_int = 0x1a; +pub const IP_DONTFRAG: ::c_int = 0x1b; pub const IP_SEC_OPT: ::c_int = 0x22; pub const IPV6_UNICAST_HOPS: ::c_int = 0x5; pub const IPV6_MULTICAST_IF: ::c_int = 0x6; pub const IPV6_MULTICAST_HOPS: ::c_int = 0x7; pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8; +pub const IPV6_PKTINFO: ::c_int = 0xb; pub const IPV6_RECVPKTINFO: ::c_int = 0x12; +pub const IPV6_RECVTCLASS: ::c_int = 0x19; +pub const IPV6_DONTFRAG: ::c_int = 0x21; pub const IPV6_SEC_OPT: ::c_int = 0x22; +pub const IPV6_TCLASS: ::c_int = 0x26; pub const IPV6_V6ONLY: ::c_int = 0x27; cfg_if! { @@ -1761,8 +1778,9 @@ pub const SOCK_SEQPACKET: ::c_int = 6; pub const IP_MULTICAST_IF: ::c_int = 16; pub const IP_MULTICAST_TTL: ::c_int = 17; pub const IP_MULTICAST_LOOP: ::c_int = 18; -pub const IP_TTL: ::c_int = 4; pub const IP_HDRINCL: ::c_int = 2; +pub const IP_TOS: ::c_int = 3; +pub const IP_TTL: ::c_int = 4; pub const IP_ADD_MEMBERSHIP: ::c_int = 19; pub const IP_DROP_MEMBERSHIP: ::c_int = 20; pub const IPV6_JOIN_GROUP: ::c_int = 9; @@ -2855,15 +2873,15 @@ extern "C" { ) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; - #[cfg_attr(target_os = "illumos", link_name = "__xnet_bind")] + #[link_name = "__xnet_bind"] pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int; pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; - #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendmsg")] + #[link_name = "__xnet_sendmsg"] pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t; - #[cfg_attr(target_os = "illumos", link_name = "__xnet_recvmsg")] + #[link_name = "__xnet_recvmsg"] pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; pub fn accept4( fd: ::c_int, diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 7da4ec05bd828..def1cccfa58ce 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -91,6 +91,7 @@ pub type SEM_ID_KERNEL = ::OBJ_HANDLE; pub type RTP_ID = ::OBJ_HANDLE; pub type SD_ID = ::OBJ_HANDLE; pub type CONDVAR_ID = ::OBJ_HANDLE; +pub type STATUS = ::OBJ_HANDLE; // From vxTypes.h pub type _Vx_usr_arg_t = isize; @@ -613,6 +614,7 @@ pub const PTHREAD_STACK_MIN: usize = 4096; pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30; // ERRNO STUFF +pub const ERROR: ::c_int = -1; pub const OK: ::c_int = 0; pub const EPERM: ::c_int = 1; /* Not owner */ pub const ENOENT: ::c_int = 2; /* No such file or directory */ @@ -720,6 +722,33 @@ pub const S_nfsLib_NFSERR_SERVERFAULT: ::c_int = EIO; pub const S_nfsLib_NFSERR_BADTYPE: ::c_int = M_nfsStat | nfsstat::NFSERR_BADTYPE as ::c_int; pub const S_nfsLib_NFSERR_JUKEBOX: ::c_int = M_nfsStat | nfsstat::NFSERR_JUKEBOX as ::c_int; +// internal offset values for below constants +const taskErrorBase: ::c_int = 0x00030000; +const semErrorBase: ::c_int = 0x00160000; +const objErrorBase: ::c_int = 0x003d0000; + +// taskLibCommon.h +pub const S_taskLib_NAME_NOT_FOUND: ::c_int = taskErrorBase + 0x0065; +pub const S_taskLib_TASK_HOOK_TABLE_FULL: ::c_int = taskErrorBase + 0x0066; +pub const S_taskLib_TASK_HOOK_NOT_FOUND: ::c_int = taskErrorBase + 0x0067; +pub const S_taskLib_ILLEGAL_PRIORITY: ::c_int = taskErrorBase + 0x0068; + +// FIXME: could also be useful for TASK_DESC type +pub const VX_TASK_NAME_LENGTH: ::c_int = 31; + +// semLibCommon.h +pub const S_semLib_INVALID_STATE: ::c_int = semErrorBase + 0x0065; +pub const S_semLib_INVALID_OPTION: ::c_int = semErrorBase + 0x0066; +pub const S_semLib_INVALID_QUEUE_TYPE: ::c_int = semErrorBase + 0x0067; +pub const S_semLib_INVALID_OPERATION: ::c_int = semErrorBase + 0x0068; + +// objLibCommon.h +pub const S_objLib_OBJ_ID_ERROR: ::c_int = objErrorBase + 0x0001; +pub const S_objLib_OBJ_UNAVAILABLE: ::c_int = objErrorBase + 0x0002; +pub const S_objLib_OBJ_DELETED: ::c_int = objErrorBase + 0x0003; +pub const S_objLib_OBJ_TIMEOUT: ::c_int = objErrorBase + 0x0004; +pub const S_objLib_OBJ_NO_METHOD: ::c_int = objErrorBase + 0x0005; + // in.h pub const IPPROTO_IP: ::c_int = 0; pub const IPPROTO_IPV6: ::c_int = 41; diff --git a/triagebot.toml b/triagebot.toml index 8b989c8db5058..f11f0ae9c2316 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1,6 +1,9 @@ [relabel] allow-unauthenticated = [ - "C-*", "O-*", "S-*" + "C-*", + "O-*", + "S-*", + "stable-nominated", ] [autolabel."S-waiting-on-review"] @@ -10,7 +13,10 @@ new_pr = true contributing_url = "https://github.com/rust-lang/libc/blob/HEAD/CONTRIBUTING.md" [assign.owners] -"*" = ["@JohnTitor"] +"*" = [ + "@JohnTitor", + "@tgross35", +] [mentions."src/unix/bsd/netbsdlike/openbsd"] message = "Some changes occurred in OpenBSD module"