Skip to content

Commit

Permalink
Merge branch 'rust-lang:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Brijeshkrishna committed Nov 26, 2023
2 parents bdaad5e + 3195caf commit 539a194
Show file tree
Hide file tree
Showing 16 changed files with 372 additions and 16 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/bors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
contents: read # to fetch code (actions/checkout)

name: macOS
runs-on: macos-12
runs-on: macos-13
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -125,15 +125,12 @@ jobs:
max-parallel: 12
matrix:
target: [
# FIXME: Mysterious failures in CI, see
# https://github.com/rust-lang/libc/issues/2081
# aarch64-linux-android,
aarch64-linux-android,
aarch64-unknown-linux-gnu,
aarch64-unknown-linux-musl,
arm-linux-androideabi,
arm-unknown-linux-gnueabihf,
arm-unknown-linux-musleabihf,
asmjs-unknown-emscripten,
i686-linux-android,
i686-unknown-linux-musl,
powerpc-unknown-linux-gnu,
Expand Down Expand Up @@ -262,9 +259,9 @@ jobs:
max-parallel: 4
matrix:
target:
- { toolchain: stable, os: macos-12 }
- { toolchain: beta, os: macos-12 }
- { toolchain: nightly, os: macos-12 }
- { toolchain: stable, os: macos-13 }
- { toolchain: beta, os: macos-13 }
- { toolchain: nightly, os: macos-13 }
# Use macOS 11 for older toolchains as newer Xcode donesn't work well.
# FIXME: Disabled due to:
# error: failed to parse registry's information for: serde
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

macos:
name: macOS
runs-on: macos-12
runs-on: macos-13
strategy:
fail-fast: true
matrix:
Expand Down
3 changes: 2 additions & 1 deletion libc-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ version = "0.2.150"
default-features = false

[build-dependencies]
cc = "1.0.61"
# FIXME: 1.0.84 has a bug about macOS version detection.
cc = "=1.0.83"
# FIXME: Use fork ctest until the maintainer gets back.
ctest2 = "0.4.3"

Expand Down
44 changes: 39 additions & 5 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ fn test_apple(target: &str) {
"sys/proc_info.h",
"sys/ptrace.h",
"sys/quota.h",
"sys/random.h",
"sys/resource.h",
"sys/sem.h",
"sys/shm.h",
Expand Down Expand Up @@ -1544,6 +1545,7 @@ fn test_android(target: &str) {
t => panic!("unsupported target: {}", t),
};
let x86 = target.contains("i686") || target.contains("x86_64");
let aarch64 = target.contains("aarch64");

let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None);
Expand Down Expand Up @@ -1879,6 +1881,12 @@ fn test_android(target: &str) {
| "SW_MAX"
| "SW_CNT" => true,

// FIXME: aarch64 env cannot find it:
| "PTRACE_GETREGS"
| "PTRACE_SETREGS" if aarch64 => true,
// FIXME: The value has been changed on r26b:
| "SYS_syscalls" if aarch64 => true,

_ => false,
}
});
Expand Down Expand Up @@ -3694,6 +3702,10 @@ fn test_linux(target: &str) {
if name.starts_with("RLIM64") {
return true;
}
// CI fails because musl targets use Linux v4 kernel
if name.starts_with("NI_IDN") {
return true;
}
}
match name {
// These constants are not available if gnu headers have been included
Expand Down Expand Up @@ -4644,6 +4656,7 @@ fn test_haiku(target: &str) {
("sigaction", "sa_sigaction") => true,
("sigevent", "sigev_value") => true,
("fpu_state", "_fpreg") => true,
("cpu_topology_node_info", "data") => true,
// these fields have a simplified data definition in libc
("fpu_state", "_xmm") => true,
("savefpu", "_fp_ymm") => true,
Expand All @@ -4664,13 +4677,33 @@ fn test_haiku(target: &str) {
cfg.type_name(move |ty, is_struct, is_union| {
match ty {
// Just pass all these through, no need for a "struct" prefix
"area_info" | "port_info" | "port_message_info" | "team_info" | "sem_info"
| "team_usage_info" | "thread_info" | "cpu_info" | "system_info"
| "object_wait_info" | "image_info" | "attr_info" | "index_info" | "fs_info"
| "FILE" | "DIR" | "Dl_info" => ty.to_string(),
"area_info"
| "port_info"
| "port_message_info"
| "team_info"
| "sem_info"
| "team_usage_info"
| "thread_info"
| "cpu_info"
| "system_info"
| "object_wait_info"
| "image_info"
| "attr_info"
| "index_info"
| "fs_info"
| "FILE"
| "DIR"
| "Dl_info"
| "topology_level_type"
| "cpu_topology_node_info"
| "cpu_topology_root_info"
| "cpu_topology_package_info"
| "cpu_topology_core_info" => ty.to_string(),

// enums don't need a prefix
"directory_which" | "path_base_directory" => ty.to_string(),
"directory_which" | "path_base_directory" | "cpu_platform" | "cpu_vendor" => {
ty.to_string()
}

// is actually a union
"sigval" => format!("union sigval"),
Expand All @@ -4689,6 +4722,7 @@ fn test_haiku(target: &str) {
"type_" if struct_ == "sem_t" => "type".to_string(),
"type_" if struct_ == "attr_info" => "type".to_string(),
"type_" if struct_ == "index_info" => "type".to_string(),
"type_" if struct_ == "cpu_topology_node_info" => "type".to_string(),
"image_type" if struct_ == "image_info" => "type".to_string(),
s => s.to_string(),
}
Expand Down
1 change: 0 additions & 1 deletion libc-test/semver/TODO-unix.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# These symbols are no-op or missing on these targets:
# * asmjs-unknown-emscripten
# * wasm32-unknown-emscripten
getpwuid_r
pthread_atfork
Expand Down
8 changes: 8 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,14 @@ FIONCLEX
FIONREAD
FLUSHO
FOPEN_MAX
FS_IOC_GETFLAGS
FS_IOC_SETFLAGS
FS_IOC_GETVERSION
FS_IOC_SETVERSION
FS_IOC32_GETFLAGS
FS_IOC32_SETFLAGS
FS_IOC32_GETVERSION
FS_IOC32_SETVERSION
FUTEX_CLOCK_REALTIME
FUTEX_CMD_MASK
FUTEX_CMP_REQUEUE
Expand Down
5 changes: 5 additions & 0 deletions libc-test/semver/apple.txt
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ IPV6_HOPLIMIT
IPV6_JOIN_GROUP
IPV6_LEAVE_GROUP
IPV6_PKTINFO
IPV6_RECVHOPLIMIT
IPV6_RECVPKTINFO
IPV6_RECVTCLASS
IPV6_TCLASS
Expand All @@ -649,6 +650,7 @@ IP_PKTINFO
IP_RECVDSTADDR
IP_RECVIF
IP_RECVTOS
IP_RECVTTL
IP_TOS
ITIMER_PROF
ITIMER_REAL
Expand Down Expand Up @@ -1915,6 +1917,7 @@ getattrlistbulk
getdate
getdomainname
getdtablesize
getentropy
getfsstat
getgrent
getgrgid
Expand Down Expand Up @@ -2264,6 +2267,8 @@ uselocale
utimensat
utmpx
utmpxname
vm_allocate
vm_deallocate
vm_inherit_t
vm_map_t
vm_prot_t
Expand Down
16 changes: 16 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,14 @@ FIONCLEX
FIONREAD
FLUSHO
FOPEN_MAX
FS_IOC_GETFLAGS
FS_IOC_SETFLAGS
FS_IOC_GETVERSION
FS_IOC_SETVERSION
FS_IOC32_GETFLAGS
FS_IOC32_SETFLAGS
FS_IOC32_GETVERSION
FS_IOC32_SETVERSION
FUTEX_BITSET_MATCH_ANY
FUTEX_CLOCK_REALTIME
FUTEX_CMD_MASK
Expand Down Expand Up @@ -1978,6 +1986,8 @@ PTHREAD_PRIO_INHERIT
PTHREAD_PRIO_PROTECT
PTHREAD_PROCESS_PRIVATE
PTHREAD_PROCESS_SHARED
PTHREAD_INHERIT_SCHED
PTHREAD_EXPLICIT_SCHED
PTHREAD_STACK_MIN
PTHREAD_ONCE_INIT
PTRACE_ATTACH
Expand Down Expand Up @@ -3647,6 +3657,12 @@ priority_t
pread64
preadv
pthread_attr_getguardsize
pthread_attr_getinheritsched
pthread_attr_setinheritsched
pthread_attr_getschedpolicy
pthread_attr_setschedpolicy
pthread_attr_getschedparam
pthread_attr_setschedparam
pthread_attr_getstack
pthread_attr_setguardsize
pthread_cancel
Expand Down
10 changes: 10 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4075,6 +4075,7 @@ pub const IP_RECVDSTADDR: ::c_int = 7;
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
pub const IP_RECVIF: ::c_int = 20;
pub const IP_RECVTTL: ::c_int = 24;
pub const IP_BOUND_IF: ::c_int = 25;
pub const IP_PKTINFO: ::c_int = 26;
pub const IP_RECVTOS: ::c_int = 27;
Expand All @@ -4084,6 +4085,7 @@ pub const IPV6_LEAVE_GROUP: ::c_int = 13;
pub const IPV6_CHECKSUM: ::c_int = 26;
pub const IPV6_RECVTCLASS: ::c_int = 35;
pub const IPV6_TCLASS: ::c_int = 36;
pub const IPV6_RECVHOPLIMIT: ::c_int = 37;
pub const IPV6_PKTINFO: ::c_int = 46;
pub const IPV6_HOPLIMIT: ::c_int = 47;
pub const IPV6_RECVPKTINFO: ::c_int = 61;
Expand Down Expand Up @@ -6260,6 +6262,7 @@ extern "C" {
pub fn sethostid(hostid: ::c_long);

pub fn CCRandomGenerateBytes(bytes: *mut ::c_void, size: ::size_t) -> ::CCRNGStatus;
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;

pub fn _NSGetExecutablePath(buf: *mut ::c_char, bufsize: *mut u32) -> ::c_int;
pub fn _NSGetEnviron() -> *mut *mut *mut ::c_char;
Expand All @@ -6278,6 +6281,13 @@ extern "C" {
inheritance: ::vm_inherit_t,
) -> ::kern_return_t;

pub fn vm_allocate(
target_task: vm_map_t,
address: *mut vm_address_t,
size: vm_size_t,
flags: ::c_int,
) -> ::kern_return_t;

pub fn vm_deallocate(
target_task: vm_map_t,
address: vm_address_t,
Expand Down
Loading

0 comments on commit 539a194

Please sign in to comment.