Skip to content

Commit

Permalink
chore: release (rust-lang#3862)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Trevor Gross <[email protected]>
  • Loading branch information
2 people authored and charmitro committed Feb 28, 2025
1 parent 48668be commit 98eb2be
Show file tree
Hide file tree
Showing 6 changed files with 1,098 additions and 69 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

## [Unreleased]

## [0.2.159](https://github.com/rust-lang/libc/compare/0.2.158...0.2.159) - 2024-09-24

### Added

- Android: add more `AT_*` constants in <https://github.com/rust-lang/libc/pull/3779>
- Apple: add missing `NOTE_*` constants in <https://github.com/rust-lang/libc/pull/3883>
- Hermit: add missing error numbers in <https://github.com/rust-lang/libc/pull/3858>
- Hurd: add `__timeval` for 64-bit support in <https://github.com/rust-lang/libc/pull/3786>
- Linux: add `epoll_pwait2` in <https://github.com/rust-lang/libc/pull/3868>
- Linux: add `mq_notify` in <https://github.com/rust-lang/libc/pull/3849>
- Linux: add missing `NFT_CT_*` constants in <https://github.com/rust-lang/libc/pull/3844>
- Linux: add the `fchmodat2` syscall in <https://github.com/rust-lang/libc/pull/3588>
- Linux: add the `mseal` syscall in <https://github.com/rust-lang/libc/pull/3798>
- OpenBSD: add `sendmmsg` and `recvmmsg` in <https://github.com/rust-lang/libc/pull/3831>
- Unix: add `IN6ADDR_ANY_INIT` and `IN6ADDR_LOOPBACK_INIT` in <https://github.com/rust-lang/libc/pull/3693>
- VxWorks: add `S_ISVTX` in <https://github.com/rust-lang/libc/pull/3768>
- VxWorks: add `vxCpuLib` and `taskLib` functions <https://github.com/rust-lang/libc/pull/3861>
- WASIp2: add definitions for `std::net` support in <https://github.com/rust-lang/libc/pull/3892>

### Fixed

- Correctly handle version checks when `clippy-driver` is used <https://github.com/rust-lang/libc/pull/3893>

### Changed

- EspIdf: change signal constants to c_int in <https://github.com/rust-lang/libc/pull/3895>
- HorizonOS: update network definitions in <https://github.com/rust-lang/libc/pull/3863>
- Linux: combine `ioctl` APIs in <https://github.com/rust-lang/libc/pull/3722>
- WASI: enable CI testing in <https://github.com/rust-lang/libc/pull/3869>
- WASIp2: enable CI testing in <https://github.com/rust-lang/libc/pull/3870>

## [0.2.158](https://github.com/rust-lang/libc/compare/0.2.157...0.2.158) - 2024-08-19

### Other
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "libc"
version = "0.2.158"
version = "0.2.159"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A test crate for the libc crate.

[dependencies.libc]
path = ".."
version = "0.2.158"
version = "0.2.159"
default-features = false

[build-dependencies]
Expand Down
92 changes: 25 additions & 67 deletions src/wasi/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::{Send, Sync};
use core::iter::Iterator;

pub use ffi::c_void;

Expand All @@ -10,8 +9,15 @@ pub type c_int = i32;
pub type c_uint = u32;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_long = i32;
pub type c_ulong = u32;
cfg_if! {
if #[cfg(target_arch = "wasm64")] {
pub type c_long = i64;
pub type c_ulong = u64;
} else {
pub type c_long = i32;
pub type c_ulong = u32;
}
}
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
Expand All @@ -28,7 +34,6 @@ pub type time_t = c_longlong;
pub type c_double = f64;
pub type c_float = f32;
pub type ino_t = u64;
pub type sigset_t = c_uchar;
pub type suseconds_t = c_longlong;
pub type mode_t = u32;
pub type dev_t = u64;
Expand Down Expand Up @@ -176,11 +181,6 @@ s! {
pub st_ctim: timespec,
__reserved: [c_longlong; 3],
}

pub struct fd_set {
__nfds: usize,
__fds: [c_int; FD_SETSIZE as usize],
}
}

// Declare dirent outside of s! so that it doesn't implement Copy, Eq, Hash,
Expand All @@ -197,6 +197,9 @@ pub struct dirent {
pub d_name: [c_char; 0],
}

pub const INT_MIN: c_int = -2147483648;
pub const INT_MAX: c_int = 2147483647;

pub const EXIT_SUCCESS: c_int = 0;
pub const EXIT_FAILURE: c_int = 1;
pub const STDIN_FILENO: c_int = 0;
Expand All @@ -212,6 +215,8 @@ pub const F_GETFD: c_int = 1;
pub const F_SETFD: c_int = 2;
pub const F_GETFL: c_int = 3;
pub const F_SETFL: c_int = 4;
pub const F_DUPFD: c_int = 5;
pub const F_DUPFD_CLOEXEC: c_int = 6;
pub const FD_CLOEXEC: c_int = 1;
pub const FD_SETSIZE: size_t = 1024;
pub const O_APPEND: c_int = 0x0001;
Expand Down Expand Up @@ -245,14 +250,14 @@ pub const AT_SYMLINK_FOLLOW: c_int = 0x2;
pub const AT_REMOVEDIR: c_int = 0x4;
pub const UTIME_OMIT: c_long = 0xfffffffe;
pub const UTIME_NOW: c_long = 0xffffffff;
pub const S_IFIFO: mode_t = 0o1_0000;
pub const S_IFIFO: mode_t = 49152;
pub const S_IFCHR: mode_t = 8192;
pub const S_IFBLK: mode_t = 24576;
pub const S_IFDIR: mode_t = 16384;
pub const S_IFREG: mode_t = 32768;
pub const S_IFLNK: mode_t = 40960;
pub const S_IFSOCK: mode_t = 49152;
pub const S_IFMT: mode_t = 0o17_0000;
pub const S_IFMT: mode_t = 57344;
pub const S_IRWXO: mode_t = 0x7;
pub const S_IXOTH: mode_t = 0x1;
pub const S_IWOTH: mode_t = 0x2;
Expand Down Expand Up @@ -370,28 +375,15 @@ pub const EWOULDBLOCK: c_int = EAGAIN;
pub const _SC_PAGESIZE: c_int = 30;
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
pub const _SC_IOV_MAX: c_int = 60;
pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
pub const _SC_SYMLOOP_MAX: c_int = 173;

cfg_if! {
if #[cfg(libc_ctest)] {
// skip these constants when this is active because `ctest` currently
// panics on parsing the constants below
} else {
// `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82
#[allow(unused_unsafe)]
pub static CLOCK_MONOTONIC: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) };
#[allow(unused_unsafe)]
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
#[allow(unused_unsafe)]
pub static CLOCK_REALTIME: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) };
#[allow(unused_unsafe)]
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
}
}
pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) };
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) };
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };

pub const ABDAY_1: ::nl_item = 0x20000;
pub const ABDAY_2: ::nl_item = 0x20001;
Expand Down Expand Up @@ -458,28 +450,6 @@ pub const NOEXPR: ::nl_item = 0x50001;
pub const YESSTR: ::nl_item = 0x50002;
pub const NOSTR: ::nl_item = 0x50003;

f! {
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
let set = &*set;
let n = set.__nfds;
return set.__fds[..n].iter().any(|p| *p == fd)
}

pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
let set = &mut *set;
let n = set.__nfds;
if !set.__fds[..n].iter().any(|p| *p == fd) {
set.__nfds = n + 1;
set.__fds[n] = fd;
}
}

pub fn FD_ZERO(set: *mut fd_set) -> () {
(*set).__nfds = 0;
return
}
}

#[cfg_attr(
feature = "rustc-dep-of-std",
link(
Expand Down Expand Up @@ -775,14 +745,6 @@ extern "C" {
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
pub fn nl_langinfo_l(item: ::nl_item, loc: ::locale_t) -> *mut ::c_char;

pub fn select(
nfds: c_int,
readfds: *mut fd_set,
writefds: *mut fd_set,
errorfds: *mut fd_set,
timeout: *const timeval,
) -> c_int;

pub fn __wasilibc_register_preopened_fd(fd: c_int, path: *const c_char) -> c_int;
pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int;
pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int;
Expand Down Expand Up @@ -880,9 +842,5 @@ extern "C" {
pub fn __errno_location() -> *mut ::c_int;
}

cfg_if! {
if #[cfg(target_env = "p2")] {
mod p2;
pub use self::p2::*;
}
}
mod wasix;
pub use self::wasix::*;
5 changes: 5 additions & 0 deletions src/wasi/p2.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
pub type sa_family_t = ::c_ushort;
pub type in_port_t = ::c_ushort;
pub type in_addr_t = ::c_uint;
pub type sa_family_t = u16;
pub type sa_type_t = u16;
pub type pthread_t = ::c_ulong;
pub type pthread_key_t = ::c_uint;
pub type sighandler_t = ::size_t;

pub type socklen_t = ::c_uint;

Expand Down
Loading

0 comments on commit 98eb2be

Please sign in to comment.