Skip to content

Commit 98eb2be

Browse files
github-actions[bot]tgross35
authored andcommitted
chore: release (rust-lang#3862)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Trevor Gross <[email protected]>
1 parent 48668be commit 98eb2be

File tree

6 files changed

+1098
-69
lines changed

6 files changed

+1098
-69
lines changed

CHANGELOG.md

+31
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,37 @@
22

33
## [Unreleased]
44

5+
## [0.2.159](https://github.com/rust-lang/libc/compare/0.2.158...0.2.159) - 2024-09-24
6+
7+
### Added
8+
9+
- Android: add more `AT_*` constants in <https://github.com/rust-lang/libc/pull/3779>
10+
- Apple: add missing `NOTE_*` constants in <https://github.com/rust-lang/libc/pull/3883>
11+
- Hermit: add missing error numbers in <https://github.com/rust-lang/libc/pull/3858>
12+
- Hurd: add `__timeval` for 64-bit support in <https://github.com/rust-lang/libc/pull/3786>
13+
- Linux: add `epoll_pwait2` in <https://github.com/rust-lang/libc/pull/3868>
14+
- Linux: add `mq_notify` in <https://github.com/rust-lang/libc/pull/3849>
15+
- Linux: add missing `NFT_CT_*` constants in <https://github.com/rust-lang/libc/pull/3844>
16+
- Linux: add the `fchmodat2` syscall in <https://github.com/rust-lang/libc/pull/3588>
17+
- Linux: add the `mseal` syscall in <https://github.com/rust-lang/libc/pull/3798>
18+
- OpenBSD: add `sendmmsg` and `recvmmsg` in <https://github.com/rust-lang/libc/pull/3831>
19+
- Unix: add `IN6ADDR_ANY_INIT` and `IN6ADDR_LOOPBACK_INIT` in <https://github.com/rust-lang/libc/pull/3693>
20+
- VxWorks: add `S_ISVTX` in <https://github.com/rust-lang/libc/pull/3768>
21+
- VxWorks: add `vxCpuLib` and `taskLib` functions <https://github.com/rust-lang/libc/pull/3861>
22+
- WASIp2: add definitions for `std::net` support in <https://github.com/rust-lang/libc/pull/3892>
23+
24+
### Fixed
25+
26+
- Correctly handle version checks when `clippy-driver` is used <https://github.com/rust-lang/libc/pull/3893>
27+
28+
### Changed
29+
30+
- EspIdf: change signal constants to c_int in <https://github.com/rust-lang/libc/pull/3895>
31+
- HorizonOS: update network definitions in <https://github.com/rust-lang/libc/pull/3863>
32+
- Linux: combine `ioctl` APIs in <https://github.com/rust-lang/libc/pull/3722>
33+
- WASI: enable CI testing in <https://github.com/rust-lang/libc/pull/3869>
34+
- WASIp2: enable CI testing in <https://github.com/rust-lang/libc/pull/3870>
35+
536
## [0.2.158](https://github.com/rust-lang/libc/compare/0.2.157...0.2.158) - 2024-08-19
637

738
### Other

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libc"
3-
version = "0.2.158"
3+
version = "0.2.159"
44
authors = ["The Rust Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"

libc-test/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A test crate for the libc crate.
1414

1515
[dependencies.libc]
1616
path = ".."
17-
version = "0.2.158"
17+
version = "0.2.159"
1818
default-features = false
1919

2020
[build-dependencies]

src/wasi/mod.rs

+25-67
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use super::{Send, Sync};
2-
use core::iter::Iterator;
32

43
pub use ffi::c_void;
54

@@ -10,8 +9,15 @@ pub type c_int = i32;
109
pub type c_uint = u32;
1110
pub type c_short = i16;
1211
pub type c_ushort = u16;
13-
pub type c_long = i32;
14-
pub type c_ulong = u32;
12+
cfg_if! {
13+
if #[cfg(target_arch = "wasm64")] {
14+
pub type c_long = i64;
15+
pub type c_ulong = u64;
16+
} else {
17+
pub type c_long = i32;
18+
pub type c_ulong = u32;
19+
}
20+
}
1521
pub type c_longlong = i64;
1622
pub type c_ulonglong = u64;
1723
pub type intmax_t = i64;
@@ -28,7 +34,6 @@ pub type time_t = c_longlong;
2834
pub type c_double = f64;
2935
pub type c_float = f32;
3036
pub type ino_t = u64;
31-
pub type sigset_t = c_uchar;
3237
pub type suseconds_t = c_longlong;
3338
pub type mode_t = u32;
3439
pub type dev_t = u64;
@@ -176,11 +181,6 @@ s! {
176181
pub st_ctim: timespec,
177182
__reserved: [c_longlong; 3],
178183
}
179-
180-
pub struct fd_set {
181-
__nfds: usize,
182-
__fds: [c_int; FD_SETSIZE as usize],
183-
}
184184
}
185185

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

200+
pub const INT_MIN: c_int = -2147483648;
201+
pub const INT_MAX: c_int = 2147483647;
202+
200203
pub const EXIT_SUCCESS: c_int = 0;
201204
pub const EXIT_FAILURE: c_int = 1;
202205
pub const STDIN_FILENO: c_int = 0;
@@ -212,6 +215,8 @@ pub const F_GETFD: c_int = 1;
212215
pub const F_SETFD: c_int = 2;
213216
pub const F_GETFL: c_int = 3;
214217
pub const F_SETFL: c_int = 4;
218+
pub const F_DUPFD: c_int = 5;
219+
pub const F_DUPFD_CLOEXEC: c_int = 6;
215220
pub const FD_CLOEXEC: c_int = 1;
216221
pub const FD_SETSIZE: size_t = 1024;
217222
pub const O_APPEND: c_int = 0x0001;
@@ -245,14 +250,14 @@ pub const AT_SYMLINK_FOLLOW: c_int = 0x2;
245250
pub const AT_REMOVEDIR: c_int = 0x4;
246251
pub const UTIME_OMIT: c_long = 0xfffffffe;
247252
pub const UTIME_NOW: c_long = 0xffffffff;
248-
pub const S_IFIFO: mode_t = 0o1_0000;
253+
pub const S_IFIFO: mode_t = 49152;
249254
pub const S_IFCHR: mode_t = 8192;
250255
pub const S_IFBLK: mode_t = 24576;
251256
pub const S_IFDIR: mode_t = 16384;
252257
pub const S_IFREG: mode_t = 32768;
253258
pub const S_IFLNK: mode_t = 40960;
254259
pub const S_IFSOCK: mode_t = 49152;
255-
pub const S_IFMT: mode_t = 0o17_0000;
260+
pub const S_IFMT: mode_t = 57344;
256261
pub const S_IRWXO: mode_t = 0x7;
257262
pub const S_IXOTH: mode_t = 0x1;
258263
pub const S_IWOTH: mode_t = 0x2;
@@ -370,28 +375,15 @@ pub const EWOULDBLOCK: c_int = EAGAIN;
370375
pub const _SC_PAGESIZE: c_int = 30;
371376
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
372377
pub const _SC_IOV_MAX: c_int = 60;
378+
pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
373379
pub const _SC_SYMLOOP_MAX: c_int = 173;
374380

375-
cfg_if! {
376-
if #[cfg(libc_ctest)] {
377-
// skip these constants when this is active because `ctest` currently
378-
// panics on parsing the constants below
379-
} else {
380-
// `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82
381-
#[allow(unused_unsafe)]
382-
pub static CLOCK_MONOTONIC: clockid_t =
383-
unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) };
384-
#[allow(unused_unsafe)]
385-
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
386-
unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
387-
#[allow(unused_unsafe)]
388-
pub static CLOCK_REALTIME: clockid_t =
389-
unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) };
390-
#[allow(unused_unsafe)]
391-
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
392-
unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
393-
}
394-
}
381+
pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) };
382+
pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t =
383+
unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) };
384+
pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) };
385+
pub static CLOCK_THREAD_CPUTIME_ID: clockid_t =
386+
unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) };
395387

396388
pub const ABDAY_1: ::nl_item = 0x20000;
397389
pub const ABDAY_2: ::nl_item = 0x20001;
@@ -458,28 +450,6 @@ pub const NOEXPR: ::nl_item = 0x50001;
458450
pub const YESSTR: ::nl_item = 0x50002;
459451
pub const NOSTR: ::nl_item = 0x50003;
460452

461-
f! {
462-
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
463-
let set = &*set;
464-
let n = set.__nfds;
465-
return set.__fds[..n].iter().any(|p| *p == fd)
466-
}
467-
468-
pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
469-
let set = &mut *set;
470-
let n = set.__nfds;
471-
if !set.__fds[..n].iter().any(|p| *p == fd) {
472-
set.__nfds = n + 1;
473-
set.__fds[n] = fd;
474-
}
475-
}
476-
477-
pub fn FD_ZERO(set: *mut fd_set) -> () {
478-
(*set).__nfds = 0;
479-
return
480-
}
481-
}
482-
483453
#[cfg_attr(
484454
feature = "rustc-dep-of-std",
485455
link(
@@ -775,14 +745,6 @@ extern "C" {
775745
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
776746
pub fn nl_langinfo_l(item: ::nl_item, loc: ::locale_t) -> *mut ::c_char;
777747

778-
pub fn select(
779-
nfds: c_int,
780-
readfds: *mut fd_set,
781-
writefds: *mut fd_set,
782-
errorfds: *mut fd_set,
783-
timeout: *const timeval,
784-
) -> c_int;
785-
786748
pub fn __wasilibc_register_preopened_fd(fd: c_int, path: *const c_char) -> c_int;
787749
pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int;
788750
pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int;
@@ -880,9 +842,5 @@ extern "C" {
880842
pub fn __errno_location() -> *mut ::c_int;
881843
}
882844

883-
cfg_if! {
884-
if #[cfg(target_env = "p2")] {
885-
mod p2;
886-
pub use self::p2::*;
887-
}
888-
}
845+
mod wasix;
846+
pub use self::wasix::*;

src/wasi/p2.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
pub type sa_family_t = ::c_ushort;
22
pub type in_port_t = ::c_ushort;
33
pub type in_addr_t = ::c_uint;
4+
pub type sa_family_t = u16;
5+
pub type sa_type_t = u16;
6+
pub type pthread_t = ::c_ulong;
7+
pub type pthread_key_t = ::c_uint;
8+
pub type sighandler_t = ::size_t;
49

510
pub type socklen_t = ::c_uint;
611

0 commit comments

Comments
 (0)