Skip to content

Commit b0240bf

Browse files
authored
Merge pull request #4465 from tgross35/backport-cayenne
[0.2] Backports
2 parents a5eab58 + e56ab23 commit b0240bf

File tree

39 files changed

+534
-285
lines changed

39 files changed

+534
-285
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ jobs:
232232
steps:
233233
- uses: actions/checkout@v4
234234
- name: test on Solaris
235-
uses: vmactions/solaris-vm@v1
235+
uses: vmactions/solaris-vm@v1.1.3
236236
with:
237237
release: "11.4-gcc"
238238
usesh: true

Cargo.toml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
[package]
22
name = "libc"
33
version = "0.2.172"
4-
authors = ["The Rust Project Developers"]
5-
license = "MIT OR Apache-2.0"
6-
readme = "README.md"
7-
edition = "2021"
8-
repository = "https://github.com/rust-lang/libc"
9-
homepage = "https://github.com/rust-lang/libc"
10-
documentation = "https://docs.rs/libc/"
114
keywords = ["libc", "ffi", "bindings", "operating", "system"]
125
categories = ["external-ffi-bindings", "no-std", "os"]
13-
build = "build.rs"
146
exclude = ["/ci/*", "/.github/*", "/.cirrus.yml", "/triagebot.toml"]
7+
description = "Raw FFI bindings to platform libraries like libc."
8+
publish = false # On the main branch, we don't want to publish anything
9+
authors = ["The Rust Project Developers"]
10+
edition = "2021"
11+
license = "MIT OR Apache-2.0"
12+
repository = "https://github.com/rust-lang/libc"
1513
rust-version = "1.63"
16-
description = """
17-
Raw FFI bindings to platform libraries like libc.
18-
"""
1914

2015
[package.metadata.docs.rs]
2116
features = ["extra_traits"]

build.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,13 @@ fn which_freebsd() -> Option<i32> {
241241
}
242242

243243
fn emcc_version_code() -> Option<u64> {
244-
let output = Command::new("emcc").arg("-dumpversion").output().ok()?;
244+
let emcc = if cfg!(target_os = "windows") {
245+
"emcc.bat"
246+
} else {
247+
"emcc"
248+
};
249+
250+
let output = Command::new(emcc).arg("-dumpversion").output().ok()?;
245251
if !output.status.success() {
246252
return None;
247253
}

libc-test/Cargo.toml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
[package]
22
name = "libc-test"
3-
version = "0.2.155"
4-
edition = "2021"
3+
version = "0.1.0"
4+
description = "A test crate for the libc crate."
5+
publish = false
56
authors = ["The Rust Project Developers"]
7+
edition = "2021"
68
license = "MIT OR Apache-2.0"
7-
build = "build.rs"
8-
publish = false
99
repository = "https://github.com/rust-lang/libc"
10-
homepage = "https://github.com/rust-lang/libc"
11-
description = """
12-
A test crate for the libc crate.
13-
"""
1410

1511
[dependencies]
1612
cfg-if = "1.0.0"

libc-test/build.rs

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4123,6 +4123,10 @@ fn test_linux(target: &str) {
41234123
// Might differ between kernel versions
41244124
"open_how" => true,
41254125

4126+
// Linux >= 6.13 (pidfd_info.exit_code: Linux >= 6.15)
4127+
// Might differ between kernel versions
4128+
"pidfd_info" => true,
4129+
41264130
"sctp_initmsg" | "sctp_sndrcvinfo" | "sctp_sndinfo" | "sctp_rcvinfo"
41274131
| "sctp_nxtinfo" | "sctp_prinfo" | "sctp_authinfo" => true,
41284132

@@ -4229,6 +4233,7 @@ fn test_linux(target: &str) {
42294233
|| name.starts_with("OPEN_TREE_")
42304234
|| name.starts_with("P_")
42314235
|| name.starts_with("PF_")
4236+
|| name.starts_with("PIDFD_")
42324237
|| name.starts_with("RLIMIT_")
42334238
|| name.starts_with("RTEXT_FILTER_")
42344239
|| name.starts_with("SOL_")
@@ -4297,6 +4302,10 @@ fn test_linux(target: &str) {
42974302
if loongarch64 && (name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC") {
42984303
return true;
42994304
}
4305+
// FIXME: Requires >= 6.3 (6.6) kernel headers
4306+
if name == "PR_GET_MDWE" || name == "PR_MDWE_NO_INHERIT" || name == "PR_MDWE_REFUSE_EXEC_GAIN" || name == "PR_SET_MDWE" {
4307+
return true;
4308+
}
43004309
// FIXME(musl): Requires musl >= 1.2
43014310
if name == "SO_PREFER_BUSY_POLL"
43024311
|| name == "SO_BUSY_POLL_BUDGET"
@@ -4432,6 +4441,30 @@ fn test_linux(target: &str) {
44324441

44334442
// headers conflicts with linux/pidfd.h
44344443
"PIDFD_NONBLOCK" => true,
4444+
// Linux >= 6.9
4445+
"PIDFD_THREAD"
4446+
| "PIDFD_SIGNAL_THREAD"
4447+
| "PIDFD_SIGNAL_THREAD_GROUP"
4448+
| "PIDFD_SIGNAL_PROCESS_GROUP" => true,
4449+
// Linux >= 6.11
4450+
"PIDFD_GET_CGROUP_NAMESPACE"
4451+
| "PIDFD_GET_IPC_NAMESPACE"
4452+
| "PIDFD_GET_MNT_NAMESPACE"
4453+
| "PIDFD_GET_NET_NAMESPACE"
4454+
| "PIDFD_GET_PID_NAMESPACE"
4455+
| "PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE"
4456+
| "PIDFD_GET_TIME_NAMESPACE"
4457+
| "PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE"
4458+
| "PIDFD_GET_USER_NAMESPACE"
4459+
| "PIDFD_GET_UTS_NAMESPACE" => true,
4460+
// Linux >= 6.13
4461+
"PIDFD_GET_INFO"
4462+
| "PIDFD_INFO_PID"
4463+
| "PIDFD_INFO_CREDS"
4464+
| "PIDFD_INFO_CGROUPID"
4465+
| "PIDFD_INFO_SIZE_VER0" => true,
4466+
// Linux >= 6.15
4467+
"PIDFD_INFO_EXIT" | "PIDFD_SELF" | "PIDFD_SELF_PROCESS" => true,
44354468

44364469
// is a private value for kernel usage normally
44374470
"FUSE_SUPER_MAGIC" => true,
@@ -4554,6 +4587,9 @@ fn test_linux(target: &str) {
45544587
true
45554588
}
45564589

4590+
// FIXME(linux): Requires >= 6.6 kernel headers.
4591+
"PR_MDWE_NO_INHERIT" => true,
4592+
45574593
// FIXME(linux): Requires >= 6.8 kernel headers.
45584594
"XDP_UMEM_TX_SW_CSUM"
45594595
| "XDP_TXMD_FLAGS_TIMESTAMP"
@@ -4851,7 +4887,9 @@ fn test_linux(target: &str) {
48514887
(struct_ == "statvfs" && field == "__f_spare") ||
48524888
(struct_ == "statvfs64" && field == "__f_spare") ||
48534889
// the `xsk_tx_metadata_union` field is an anonymous union
4854-
(struct_ == "xsk_tx_metadata" && field == "xsk_tx_metadata_union")
4890+
(struct_ == "xsk_tx_metadata" && field == "xsk_tx_metadata_union") ||
4891+
// FIXME(musl): After musl 1.2.0, the type becomes `int` instead of `long`.
4892+
(struct_ == "utmpx" && field == "ut_session")
48554893
});
48564894

48574895
cfg.skip_roundtrip(move |s| match s {

libc-test/semver/linux-musl.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ OLD_TIME
2828
PF_IB
2929
PF_MPLS
3030
PF_XDP
31-
PIDFD_NONBLOCK
3231
PR_SET_VMA
3332
PR_SET_VMA_ANON_NAME
3433
RUN_LVL

libc-test/semver/linux.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,6 +2084,7 @@ PACKET_FANOUT_QM
20842084
PACKET_FANOUT_RND
20852085
PACKET_FANOUT_ROLLOVER
20862086
PACKET_HOST
2087+
PACKET_IGNORE_OUTGOING
20872088
PACKET_KERNEL
20882089
PACKET_LOOPBACK
20892090
PACKET_LOSS
@@ -2171,6 +2172,32 @@ PF_WANPIPE
21712172
PF_WQ_WORKER
21722173
PF_X
21732174
PF_X25
2175+
PIDFD_GET_CGROUP_NAMESPACE
2176+
PIDFD_GET_INFO
2177+
PIDFD_GET_IPC_NAMESPACE
2178+
PIDFD_GET_MNT_NAMESPACE
2179+
PIDFD_GET_NET_NAMESPACE
2180+
PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE
2181+
PIDFD_GET_PID_NAMESPACE
2182+
PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE
2183+
PIDFD_GET_TIME_NAMESPACE
2184+
PIDFD_GET_USER_NAMESPACE
2185+
PIDFD_GET_UTS_NAMESPACE
2186+
PIDFD_INFO_CGROUPID
2187+
PIDFD_INFO_CREDS
2188+
PIDFD_INFO_EXIT
2189+
PIDFD_INFO_PID
2190+
PIDFD_INFO_SIZE_VER0
2191+
PIDFD_NONBLOCK
2192+
PIDFD_SIGNAL_PROCESS_GROUP
2193+
PIDFD_SIGNAL_THREAD
2194+
PIDFD_SIGNAL_THREAD_GROUP
2195+
PIDFD_THREAD
2196+
PIDTYPE_MAX
2197+
PIDTYPE_PGID
2198+
PIDTYPE_PID
2199+
PIDTYPE_SID
2200+
PIDTYPE_TGID
21742201
PIPE_BUF
21752202
PM_STR
21762203
POLLRDBAND
@@ -2229,6 +2256,7 @@ PR_GET_FPEMU
22292256
PR_GET_FPEXC
22302257
PR_GET_FP_MODE
22312258
PR_GET_KEEPCAPS
2259+
PR_GET_MDWE
22322260
PR_GET_NAME
22332261
PR_GET_NO_NEW_PRIVS
22342262
PR_GET_PDEATHSIG
@@ -2247,6 +2275,8 @@ PR_MCE_KILL_EARLY
22472275
PR_MCE_KILL_GET
22482276
PR_MCE_KILL_LATE
22492277
PR_MCE_KILL_SET
2278+
PR_MDWE_NO_INHERIT
2279+
PR_MDWE_REFUSE_EXEC_GAIN
22502280
PR_MPX_DISABLE_MANAGEMENT
22512281
PR_MPX_ENABLE_MANAGEMENT
22522282
PR_SCHED_CORE
@@ -2265,6 +2295,7 @@ PR_SET_FPEMU
22652295
PR_SET_FPEXC
22662296
PR_SET_FP_MODE
22672297
PR_SET_KEEPCAPS
2298+
PR_SET_MDWE
22682299
PR_SET_MM
22692300
PR_SET_MM_ARG_END
22702301
PR_SET_MM_ARG_START
@@ -4038,6 +4069,8 @@ packet_mreq
40384069
pause
40394070
personality
40404071
pgn_t
4072+
pid_type
4073+
pidfd_info
40414074
pipe2
40424075
popen
40434076
posix_fadvise

libc-test/semver/redox.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ O_SHLOCK
135135
O_SYMLINK
136136
PTHREAD_STACK_MIN
137137
SA_RESTORER
138+
SCM_RIGHTS
138139
SIGIO
139140
SIGPWR
140141
SIGSTKFLT

libc-test/semver/windows.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,15 @@ c_void
174174
calloc
175175
chdir
176176
chmod
177+
clock
177178
clock_t
178179
close
179180
commit
180181
connect
181182
creat
183+
ctime
182184
dev_t
185+
difftime
183186
dup
184187
dup2
185188
errno_t
@@ -214,7 +217,11 @@ fsetpos
214217
fstat
215218
ftell
216219
fwrite
220+
get_daylight
221+
get_dstbias
217222
get_osfhandle
223+
get_timezone
224+
get_tzname
218225
getchar
219226
getcwd
220227
getenv
@@ -326,6 +333,7 @@ tm
326333
tmpfile
327334
tolower
328335
toupper
336+
tzset
329337
uint16_t
330338
uint32_t
331339
uint64_t

src/fuchsia/mod.rs

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,9 +1452,9 @@ pub const GRPQUOTA: c_int = 1;
14521452

14531453
pub const SIGIOT: c_int = 6;
14541454

1455-
pub const S_ISUID: crate::mode_t = 0o4000;
1456-
pub const S_ISGID: crate::mode_t = 0o2000;
1457-
pub const S_ISVTX: crate::mode_t = 0o1000;
1455+
pub const S_ISUID: mode_t = 0o4000;
1456+
pub const S_ISGID: mode_t = 0o2000;
1457+
pub const S_ISVTX: mode_t = 0o1000;
14581458

14591459
pub const IF_NAMESIZE: size_t = 16;
14601460
pub const IFNAMSIZ: size_t = IF_NAMESIZE;
@@ -1585,26 +1585,26 @@ pub const O_RDONLY: c_int = 0;
15851585
pub const O_WRONLY: c_int = 1;
15861586
pub const O_RDWR: c_int = 2;
15871587

1588-
pub const S_IFIFO: crate::mode_t = 0o1_0000;
1589-
pub const S_IFCHR: crate::mode_t = 0o2_0000;
1590-
pub const S_IFBLK: crate::mode_t = 0o6_0000;
1591-
pub const S_IFDIR: crate::mode_t = 0o4_0000;
1592-
pub const S_IFREG: crate::mode_t = 0o10_0000;
1593-
pub const S_IFLNK: crate::mode_t = 0o12_0000;
1594-
pub const S_IFSOCK: crate::mode_t = 0o14_0000;
1595-
pub const S_IFMT: crate::mode_t = 0o17_0000;
1596-
pub const S_IRWXU: crate::mode_t = 0o0700;
1597-
pub const S_IXUSR: crate::mode_t = 0o0100;
1598-
pub const S_IWUSR: crate::mode_t = 0o0200;
1599-
pub const S_IRUSR: crate::mode_t = 0o0400;
1600-
pub const S_IRWXG: crate::mode_t = 0o0070;
1601-
pub const S_IXGRP: crate::mode_t = 0o0010;
1602-
pub const S_IWGRP: crate::mode_t = 0o0020;
1603-
pub const S_IRGRP: crate::mode_t = 0o0040;
1604-
pub const S_IRWXO: crate::mode_t = 0o0007;
1605-
pub const S_IXOTH: crate::mode_t = 0o0001;
1606-
pub const S_IWOTH: crate::mode_t = 0o0002;
1607-
pub const S_IROTH: crate::mode_t = 0o0004;
1588+
pub const S_IFIFO: mode_t = 0o1_0000;
1589+
pub const S_IFCHR: mode_t = 0o2_0000;
1590+
pub const S_IFBLK: mode_t = 0o6_0000;
1591+
pub const S_IFDIR: mode_t = 0o4_0000;
1592+
pub const S_IFREG: mode_t = 0o10_0000;
1593+
pub const S_IFLNK: mode_t = 0o12_0000;
1594+
pub const S_IFSOCK: mode_t = 0o14_0000;
1595+
pub const S_IFMT: mode_t = 0o17_0000;
1596+
pub const S_IRWXU: mode_t = 0o0700;
1597+
pub const S_IXUSR: mode_t = 0o0100;
1598+
pub const S_IWUSR: mode_t = 0o0200;
1599+
pub const S_IRUSR: mode_t = 0o0400;
1600+
pub const S_IRWXG: mode_t = 0o0070;
1601+
pub const S_IXGRP: mode_t = 0o0010;
1602+
pub const S_IWGRP: mode_t = 0o0020;
1603+
pub const S_IRGRP: mode_t = 0o0040;
1604+
pub const S_IRWXO: mode_t = 0o0007;
1605+
pub const S_IXOTH: mode_t = 0o0001;
1606+
pub const S_IWOTH: mode_t = 0o0002;
1607+
pub const S_IROTH: mode_t = 0o0004;
16081608
pub const F_OK: c_int = 0;
16091609
pub const R_OK: c_int = 4;
16101610
pub const W_OK: c_int = 2;
@@ -3726,12 +3726,7 @@ extern "C" {
37263726
pub fn rewinddir(dirp: *mut crate::DIR);
37273727

37283728
pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int;
3729-
pub fn fchmodat(
3730-
dirfd: c_int,
3731-
pathname: *const c_char,
3732-
mode: crate::mode_t,
3733-
flags: c_int,
3734-
) -> c_int;
3729+
pub fn fchmodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, flags: c_int) -> c_int;
37353730
pub fn fchown(fd: c_int, owner: crate::uid_t, group: crate::gid_t) -> c_int;
37363731
pub fn fchownat(
37373732
dirfd: c_int,
@@ -3748,7 +3743,7 @@ extern "C" {
37483743
newpath: *const c_char,
37493744
flags: c_int,
37503745
) -> c_int;
3751-
pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
3746+
pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
37523747
pub fn readlinkat(
37533748
dirfd: c_int,
37543749
pathname: *const c_char,
@@ -3966,7 +3961,7 @@ extern "C" {
39663961
pub fn gmtime(time_p: *const time_t) -> *mut tm;
39673962
pub fn localtime(time_p: *const time_t) -> *mut tm;
39683963

3969-
pub fn mknod(pathname: *const c_char, mode: crate::mode_t, dev: crate::dev_t) -> c_int;
3964+
pub fn mknod(pathname: *const c_char, mode: mode_t, dev: crate::dev_t) -> c_int;
39703965
pub fn uname(buf: *mut crate::utsname) -> c_int;
39713966
pub fn gethostname(name: *mut c_char, len: size_t) -> c_int;
39723967
pub fn getservbyname(name: *const c_char, proto: *const c_char) -> *mut servent;
@@ -4086,8 +4081,7 @@ extern "C" {
40864081

40874082
pub fn fdopendir(fd: c_int) -> *mut crate::DIR;
40884083

4089-
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t, dev: dev_t)
4090-
-> c_int;
4084+
pub fn mknodat(dirfd: c_int, pathname: *const c_char, mode: mode_t, dev: dev_t) -> c_int;
40914085
pub fn pthread_condattr_getclock(
40924086
attr: *const pthread_condattr_t,
40934087
clock_id: *mut clockid_t,
@@ -4214,7 +4208,7 @@ extern "C" {
42144208
pub fn setfsuid(uid: crate::uid_t) -> c_int;
42154209

42164210
// Not available now on Android
4217-
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: crate::mode_t) -> c_int;
4211+
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
42184212
pub fn if_nameindex() -> *mut if_nameindex;
42194213
pub fn if_freenameindex(ptr: *mut if_nameindex);
42204214
pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int;

0 commit comments

Comments
 (0)