Skip to content

Commit b61fe73

Browse files
committed
Merge remote-tracking branch 'rust-lang/master' into horizon-getrandom-and-fixes
# Conflicts: # src/unix/mod.rs # src/unix/newlib/horizon/mod.rs
2 parents c820866 + 55cc85f commit b61fe73

File tree

25 files changed

+241
-15
lines changed

25 files changed

+241
-15
lines changed

libc-test/build.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2921,6 +2921,8 @@ fn test_linux(target: &str) {
29212921
"asm/mman.h",
29222922
"linux/can.h",
29232923
"linux/can/raw.h",
2924+
// FIXME: requires kernel headers >= 5.4.1.
2925+
[!musl]: "linux/can/j1939.h",
29242926
"linux/dccp.h",
29252927
"linux/errqueue.h",
29262928
"linux/falloc.h",
@@ -3046,6 +3048,11 @@ fn test_linux(target: &str) {
30463048
// For internal use only, to define architecture specific ioctl constants with a libc specific type.
30473049
"Ioctl" => true,
30483050

3051+
// FIXME: requires >= 5.4.1 kernel headers
3052+
"pgn_t" if musl => true,
3053+
"priority_t" if musl => true,
3054+
"name_t" if musl => true,
3055+
30493056
_ => false,
30503057
}
30513058
});
@@ -3107,6 +3114,9 @@ fn test_linux(target: &str) {
31073114
// Might differ between kernel versions
31083115
"open_how" => true,
31093116

3117+
// FIXME: requires >= 5.4.1 kernel headers
3118+
"j1939_filter" if musl => true,
3119+
31103120
_ => false,
31113121
}
31123122
});
@@ -3141,6 +3151,12 @@ fn test_linux(target: &str) {
31413151
|| name.starts_with("TCP_")
31423152
|| name.starts_with("UINPUT_")
31433153
|| name.starts_with("VMADDR_")
3154+
// FIXME: Requires >= 5.4.1 kernel headers
3155+
|| name.starts_with("J1939")
3156+
// FIXME: Requires >= 5.4.1 kernel headers
3157+
|| name.starts_with("SO_J1939")
3158+
// FIXME: Requires >= 5.4.1 kernel headers
3159+
|| name.starts_with("SCM_J1939")
31443160
{
31453161
return true;
31463162
}
@@ -3237,6 +3253,18 @@ fn test_linux(target: &str) {
32373253
| "CAN_RAW_FILTER_MAX"
32383254
| "CAN_NPROTO" => true,
32393255

3256+
// FIXME: Requires recent kernel headers (5.15)
3257+
| "J1939_NLA_TOTAL_SIZE"
3258+
| "J1939_NLA_PGN"
3259+
| "J1939_NLA_SRC_NAME"
3260+
| "J1939_NLA_DEST_NAME"
3261+
| "J1939_NLA_SRC_ADDR"
3262+
| "J1939_NLA_DEST_ADDR"
3263+
| "J1939_EE_INFO_RX_RTS"
3264+
| "J1939_EE_INFO_RX_DPO"
3265+
| "J1939_EE_INFO_RX_ABORT"
3266+
| "SOL_CAN_J1939" => true,
3267+
32403268
// FIXME: Requires recent kernel headers (5.8):
32413269
"STATX_MNT_ID" => true,
32423270

@@ -3649,6 +3677,7 @@ fn test_haiku(target: &str) {
36493677
let mut cfg = ctest_cfg();
36503678
cfg.flag("-Wno-deprecated-declarations");
36513679
cfg.define("__USE_GNU", Some("1"));
3680+
cfg.define("_GNU_SOURCE", None);
36523681

36533682
// POSIX API
36543683
headers! { cfg:
@@ -3751,13 +3780,17 @@ fn test_haiku(target: &str) {
37513780
"uchar.h",
37523781
"unistd.h",
37533782
"utime.h",
3783+
"utmpx.h",
37543784
"wchar.h",
37553785
"wchar_t.h",
37563786
"wctype.h"
37573787
}
37583788

37593789
// BSD Extensions
37603790
headers! { cfg:
3791+
"ifaddrs.h",
3792+
"libutil.h",
3793+
"link.h",
37613794
"pty.h",
37623795
}
37633796

@@ -3803,6 +3836,11 @@ fn test_haiku(target: &str) {
38033836
// with mem::zeroed(), so skip the automated test
38043837
"image_info" | "thread_info" => true,
38053838

3839+
"Elf64_Phdr" => true,
3840+
3841+
// is an union
3842+
"cpuid_info" => true,
3843+
38063844
_ => false,
38073845
}
38083846
});
@@ -3839,6 +3877,8 @@ fn test_haiku(target: &str) {
38393877
// translated into a struct argument
38403878
"find_path" => true,
38413879

3880+
"get_cpuid" => true,
3881+
38423882
_ => false,
38433883
}
38443884
});

libc-test/semver/linux.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,24 @@ ITIMER_PROF
988988
ITIMER_REAL
989989
ITIMER_VIRTUAL
990990
IUTF8
991+
J1939_IDLE_ADDR
992+
J1939_MAX_UNICAST_ADDR
993+
J1939_NLA_BYTES_ACKED
994+
J1939_NLA_DEST_ADDR
995+
J1939_NLA_DEST_NAME
996+
J1939_NLA_PAD
997+
J1939_NLA_PGN
998+
J1939_NLA_SRC_ADDR
999+
J1939_NLA_SRC_NAME
1000+
J1939_NLA_TOTAL_SIZE
1001+
J1939_NO_ADDR
1002+
J1939_NO_NAME
1003+
J1939_NO_PGN
1004+
J1939_PGN_ADDRESS_CLAIMED
1005+
J1939_PGN_ADDRESS_COMMANDED
1006+
J1939_PGN_MAX
1007+
J1939_PGN_PDU1_MAX
1008+
J1939_PGN_REQUEST
9911009
KEYCTL_ASSUME_AUTHORITY
9921010
KEYCTL_CHOWN
9931011
KEYCTL_CLEAR
@@ -1947,6 +1965,10 @@ SCHED_RESET_ON_FORK
19471965
SCHED_RR
19481966
SCM_CREDENTIALS
19491967
SCM_RIGHTS
1968+
SCM_J1939_DEST_ADDR
1969+
SCM_J1939_DEST_NAME
1970+
SCM_J1939_ERRQUEUE
1971+
SCM_J1939_PRIO
19501972
SCM_TIMESTAMP
19511973
SCM_TIMESTAMPING
19521974
SECCOMP_FILTER_FLAG_LOG
@@ -2049,6 +2071,7 @@ SOL_ALG
20492071
SOL_ATM
20502072
SOL_BLUETOOTH
20512073
SOL_CAN_BASE
2074+
SOL_CAN_J1939
20522075
SOL_CAN_RAW
20532076
SOL_DCCP
20542077
SOL_DECNET
@@ -2075,6 +2098,10 @@ SO_EE_ORIGIN_NONE
20752098
SO_EE_ORIGIN_TIMESTAMPING
20762099
SO_EE_ORIGIN_TXSTATUS
20772100
SO_MARK
2101+
SO_J1939_ERRQUEUE
2102+
SO_J1939_FILTER
2103+
SO_J1939_PROMISC
2104+
SO_J1939_SEND_PRIO
20782105
SO_ORIGINAL_DST
20792106
SO_PASSCRED
20802107
SO_PASSSEC
@@ -2801,6 +2828,7 @@ ip_mreqn
28012828
ip_mreq_source
28022829
ipc_perm
28032830
itimerspec
2831+
j1939_filter
28042832
key_t
28052833
killpg
28062834
labs
@@ -2854,6 +2882,7 @@ msgqnum_t
28542882
msgrcv
28552883
msgsnd
28562884
msqid_ds
2885+
name_t
28572886
newlocale
28582887
nice
28592888
nl_item
@@ -2872,6 +2901,7 @@ openpty
28722901
packet_mreq
28732902
pause
28742903
personality
2904+
pgn_t
28752905
pipe2
28762906
popen
28772907
posix_fadvise
@@ -2904,6 +2934,7 @@ posix_spawnattr_t
29042934
posix_spawnp
29052935
ppoll
29062936
prctl
2937+
priority_t
29072938
pread64
29082939
preadv
29092940
pthread_attr_getguardsize

libc-test/semver/openbsd.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ ENOTBLK
156156
ENOMEDIUM
157157
ENOTRECOVERABLE
158158
ENOTSUP
159+
ENTER
159160
EOF
160161
EOWNERDEAD
161162
EPROCLIM
@@ -189,6 +190,7 @@ EV_SYSFLAGS
189190
EXTA
190191
EXTB
191192
EXTPROC
193+
FIND
192194
Elf32_Addr
193195
Elf32_Half
194196
Elf32_Lword
@@ -993,6 +995,9 @@ getthrid
993995
glob
994996
glob_t
995997
globfree
998+
hcreate
999+
hdestroy
1000+
hsearch
9961001
id_t
9971002
if_data
9981003
if_freenameindex

src/solid/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,8 @@ extern "C" {
535535
pub fn strtod_l(arg1: *const c_char, arg2: *mut *mut c_char, arg3: locale_t) -> f64;
536536
pub fn strtof_l(arg1: *const c_char, arg2: *mut *mut c_char, arg3: locale_t) -> f32;
537537
pub fn strtold_l(arg1: *const c_char, arg2: *mut *mut c_char, arg3: locale_t) -> f64;
538-
pub fn _Exit(arg1: c_int);
539-
pub fn abort();
538+
pub fn _Exit(arg1: c_int) -> !;
539+
pub fn abort() -> !;
540540
pub fn abs(arg1: c_int) -> c_int;
541541
pub fn atexit(arg1: ::Option<unsafe extern "C" fn()>) -> c_int;
542542
pub fn atoi(arg1: *const c_char) -> c_int;
@@ -553,7 +553,7 @@ extern "C" {
553553
) -> *mut c_void;
554554
pub fn calloc(arg1: size_t, arg2: size_t) -> *mut c_void;
555555
pub fn div(arg1: c_int, arg2: c_int) -> div_t;
556-
pub fn exit(arg1: c_int);
556+
pub fn exit(arg1: c_int) -> !;
557557
pub fn free(arg1: *mut c_void);
558558
pub fn getenv(arg1: *const c_char) -> *mut c_char;
559559
pub fn labs(arg1: c_long) -> c_long;

src/unix/bsd/netbsdlike/openbsd/mod.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ pub type Elf64_Sxword = i64;
3535
pub type Elf64_Word = u32;
3636
pub type Elf64_Xword = u64;
3737

38+
// search.h
39+
40+
pub type ENTRY = entry;
41+
pub type ACTION = ::c_uint;
42+
3843
cfg_if! {
3944
if #[cfg(target_pointer_width = "64")] {
4045
type Elf_Addr = Elf64_Addr;
@@ -423,6 +428,12 @@ s! {
423428
pub struct ptrace_thread_state {
424429
pub pts_tid: ::pid_t,
425430
}
431+
432+
// search.h
433+
pub struct entry {
434+
pub key: *mut ::c_char,
435+
pub data: *mut ::c_void,
436+
}
426437
}
427438

428439
impl siginfo_t {
@@ -1471,6 +1482,10 @@ pub const PTRACE_FORK: ::c_int = 0x0002;
14711482

14721483
pub const WCONTINUED: ::c_int = 8;
14731484

1485+
// search.h
1486+
pub const FIND: ::ACTION = 0;
1487+
pub const ENTER: ::ACTION = 1;
1488+
14741489
const_fn! {
14751490
{const} fn _ALIGN(p: usize) -> usize {
14761491
(p + _ALIGNBYTES) & !_ALIGNBYTES
@@ -1652,6 +1667,9 @@ extern "C" {
16521667
width: ::size_t,
16531668
compar: ::Option<unsafe extern "C" fn(*const ::c_void, *const ::c_void) -> ::c_int>,
16541669
) -> *mut ::c_void;
1670+
pub fn hcreate(nelt: ::size_t) -> ::c_int;
1671+
pub fn hdestroy();
1672+
pub fn hsearch(entry: ::ENTRY, action: ::ACTION) -> *mut ::ENTRY;
16551673
}
16561674

16571675
#[link(name = "execinfo")]

src/unix/haiku/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ pub type fd_mask = u32;
3333

3434
pub type Elf32_Addr = u32;
3535
pub type Elf32_Half = u16;
36-
pub type Elf32_Lword = u64;
3736
pub type Elf32_Off = u32;
3837
pub type Elf32_Sword = i32;
3938
pub type Elf32_Word = u32;
4039

4140
pub type Elf64_Addr = u64;
4241
pub type Elf64_Half = u16;
43-
pub type Elf64_Lword = u64;
4442
pub type Elf64_Off = u64;
4543
pub type Elf64_Sword = i32;
4644
pub type Elf64_Sxword = i64;
@@ -120,12 +118,12 @@ s! {
120118

121119
pub struct ifaddrs {
122120
pub ifa_next: *mut ifaddrs,
123-
pub ifa_name: *mut ::c_char,
121+
pub ifa_name: *const ::c_char,
124122
pub ifa_flags: ::c_uint,
125123
pub ifa_addr: *mut ::sockaddr,
126124
pub ifa_netmask: *mut ::sockaddr,
127125
pub ifa_dstaddr: *mut ::sockaddr,
128-
pub ida_data: *mut ::c_void,
126+
pub ifa_data: *mut ::c_void,
129127
}
130128

131129
pub struct fd_set {
@@ -1530,7 +1528,12 @@ extern "C" {
15301528
) -> ::c_int;
15311529

15321530
pub fn getspent() -> *mut spwd;
1533-
pub fn getspent_r(pwd: *mut spwd, buf: *mut ::c_char, bufferSize: ::size_t) -> ::c_int;
1531+
pub fn getspent_r(
1532+
pwd: *mut spwd,
1533+
buf: *mut ::c_char,
1534+
bufferSize: ::size_t,
1535+
res: *mut *mut spwd,
1536+
) -> ::c_int;
15341537
pub fn setspent();
15351538
pub fn endspent();
15361539
pub fn getspnam(name: *const ::c_char) -> *mut spwd;

src/unix/haiku/native.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ extern "C" {
879879
pub fn rename_thread(thread: thread_id, newName: *const ::c_char) -> status_t;
880880
pub fn set_thread_priority(thread: thread_id, newPriority: i32) -> status_t;
881881
pub fn suggest_thread_priority(
882-
task_flags: be_task_flags,
882+
what: u32,
883883
period: i32,
884884
jitter: ::bigtime_t,
885885
length: ::bigtime_t,
@@ -936,8 +936,6 @@ extern "C" {
936936
pub fn debugger(message: *const ::c_char);
937937
pub fn disable_debugger(state: ::c_int) -> ::c_int;
938938

939-
pub fn get_cpuid(info: *mut cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t;
940-
941939
pub fn get_system_info(info: *mut system_info) -> status_t;
942940
pub fn get_cpu_info(firstCPU: u32, cpuCount: u32, info: *mut cpu_info) -> status_t;
943941
pub fn is_computer_on() -> i32;
@@ -1084,6 +1082,14 @@ extern "C" {
10841082
) -> status_t;
10851083
}
10861084

1085+
cfg_if! {
1086+
if #[cfg(libc_union)] {
1087+
extern "C" {
1088+
pub fn get_cpuid(info: *mut cpuid_info, eaxRegister: u32, cpuNum: u32) -> status_t;
1089+
}
1090+
}
1091+
}
1092+
10871093
// The following functions are defined as macros in C/C++
10881094
pub unsafe fn get_area_info(id: area_id, info: *mut area_info) -> status_t {
10891095
_get_area_info(id, info, core::mem::size_of::<area_info>() as usize)

src/unix/linux_like/linux/gnu/b32/arm/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,7 @@ pub const SYS_pkey_mprotect: ::c_long = 394;
815815
pub const SYS_pkey_alloc: ::c_long = 395;
816816
pub const SYS_pkey_free: ::c_long = 396;
817817
pub const SYS_statx: ::c_long = 397;
818+
pub const SYS_rseq: ::c_long = 398;
818819
pub const SYS_pidfd_send_signal: ::c_long = 424;
819820
pub const SYS_io_uring_setup: ::c_long = 425;
820821
pub const SYS_io_uring_enter: ::c_long = 426;

src/unix/linux_like/linux/gnu/b32/mips/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ pub const SYS_pkey_mprotect: ::c_long = 4000 + 363;
516516
pub const SYS_pkey_alloc: ::c_long = 4000 + 364;
517517
pub const SYS_pkey_free: ::c_long = 4000 + 365;
518518
pub const SYS_statx: ::c_long = 4000 + 366;
519+
pub const SYS_rseq: ::c_long = 4000 + 367;
519520
pub const SYS_pidfd_send_signal: ::c_long = 4000 + 424;
520521
pub const SYS_io_uring_setup: ::c_long = 4000 + 425;
521522
pub const SYS_io_uring_enter: ::c_long = 4000 + 426;

src/unix/linux_like/linux/gnu/b32/powerpc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ pub const SYS_preadv2: ::c_long = 380;
794794
pub const SYS_pwritev2: ::c_long = 381;
795795
pub const SYS_kexec_file_load: ::c_long = 382;
796796
pub const SYS_statx: ::c_long = 383;
797+
pub const SYS_rseq: ::c_long = 387;
797798
pub const SYS_pidfd_send_signal: ::c_long = 424;
798799
pub const SYS_io_uring_setup: ::c_long = 425;
799800
pub const SYS_io_uring_enter: ::c_long = 426;

0 commit comments

Comments
 (0)