Skip to content

Commit e7ef0da

Browse files
authored
Merge pull request #3968 from tgross35/backport-asparagus
[0.2] Backports
2 parents 1447f78 + d607b77 commit e7ef0da

File tree

17 files changed

+908
-5
lines changed

17 files changed

+908
-5
lines changed

build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
3535

3636
// Extra values to allow for check-cfg.
3737
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
38-
("target_os", &["switch", "aix", "ohos", "hurd", "visionos"]),
38+
(
39+
"target_os",
40+
&[
41+
"switch", "aix", "ohos", "hurd", "rtems", "visionos", "nuttx",
42+
],
43+
),
3944
("target_env", &["illumos", "wasi", "aix", "ohos"]),
4045
(
4146
"target_arch",

libc-test/semver/apple.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,16 +1116,29 @@ PROC_CSM_TECS
11161116
PROC_PIDTASKALLINFO
11171117
PROC_PIDTASKINFO
11181118
PROC_PIDTHREADINFO
1119+
PTHREAD_CANCEL_ASYNCHRONOUS
1120+
PTHREAD_CANCEL_DEFERRED
1121+
PTHREAD_CANCEL_DISABLE
1122+
PTHREAD_CANCEL_ENABLE
1123+
PTHREAD_CANCELED
11191124
PTHREAD_CREATE_DETACHED
11201125
PTHREAD_CREATE_JOINABLE
1126+
PTHREAD_EXPLICIT_SCHED
1127+
PTHREAD_INHERIT_SCHED
11211128
PTHREAD_INTROSPECTION_THREAD_CREATE
11221129
PTHREAD_INTROSPECTION_THREAD_DESTROY
11231130
PTHREAD_INTROSPECTION_THREAD_START
11241131
PTHREAD_INTROSPECTION_THREAD_TERMINATE
11251132
PTHREAD_MUTEX_DEFAULT
11261133
PTHREAD_MUTEX_ERRORCHECK
1134+
PTHREAD_ONCE_INIT
1135+
PTHREAD_PRIO_INHERIT
1136+
PTHREAD_PRIO_NONE
1137+
PTHREAD_PRIO_PROTECT
11271138
PTHREAD_PROCESS_PRIVATE
11281139
PTHREAD_PROCESS_SHARED
1140+
PTHREAD_SCOPE_PROCESS
1141+
PTHREAD_SCOPE_SYSTEM
11291142
PTHREAD_STACK_MIN
11301143
PT_ATTACH
11311144
PT_ATTACHEXC
@@ -1832,6 +1845,7 @@ _WSTOPPED
18321845
__PTHREAD_CONDATTR_SIZE__
18331846
__PTHREAD_COND_SIZE__
18341847
__PTHREAD_MUTEX_SIZE__
1848+
__PTHREAD_ONCE_SIZE__
18351849
__PTHREAD_RWLOCKATTR_SIZE__
18361850
__PTHREAD_RWLOCK_SIZE__
18371851
__darwin_mcontext64
@@ -2142,8 +2156,18 @@ pseudo_AF_KEY
21422156
pseudo_AF_PIP
21432157
pseudo_AF_RTIP
21442158
pseudo_AF_XTP
2159+
pthread_atfork
2160+
pthread_attr_getdetachstate
2161+
pthread_attr_getinheritsched
21452162
pthread_attr_getschedparam
2163+
pthread_attr_getschedpolicy
2164+
pthread_attr_getscope
2165+
pthread_attr_getstackaddr
2166+
pthread_attr_setinheritsched
21462167
pthread_attr_setschedparam
2168+
pthread_attr_setschedpolicy
2169+
pthread_attr_setscope
2170+
pthread_attr_setstackaddr
21472171
pthread_cancel
21482172
pthread_condattr_getpshared
21492173
pthread_condattr_setpshared
@@ -2167,6 +2191,8 @@ pthread_kill
21672191
pthread_main_np
21682192
pthread_mutexattr_getpshared
21692193
pthread_mutexattr_setpshared
2194+
pthread_once
2195+
pthread_once_t
21702196
pthread_rwlockattr_getpshared
21712197
pthread_rwlockattr_setpshared
21722198
pthread_setname_np

libc-test/semver/emscripten.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
AT_EACCESS
12
getentropy
23
posix_fallocate64
34
getpwnam_r

libc-test/semver/linux-i686.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ fsblkcnt64_t
214214
fsfilcnt64_t
215215
getcontext
216216
greg_t
217+
ioperm
218+
iopl
217219
makecontext
218220
max_align_t
219221
mcontext_t

libc-test/semver/linux-musl.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,34 @@ MPOL_DEFAULT
1010
MPOL_INTERLEAVE
1111
MPOL_LOCAL
1212
MPOL_PREFERRED
13+
BOOT_TIME
14+
DEAD_PROCESS
1315
Elf32_Chdr
1416
Elf64_Chdr
17+
EMPTY
18+
INIT_PROCESS
1519
LIO_NOP
1620
LIO_NOWAIT
1721
LIO_READ
1822
LIO_WAIT
1923
LIO_WRITE
24+
LOGIN_PROCESS
25+
NEW_TIME
26+
OLD_TIME
2027
PF_IB
2128
PF_MPLS
2229
PF_XDP
2330
PIDFD_NONBLOCK
2431
PR_SET_VMA
2532
PR_SET_VMA_ANON_NAME
33+
RUN_LVL
2634
RWF_APPEND
2735
RWF_DSYNC
2836
RWF_HIPRI
2937
RWF_NOWAIT
3038
RWF_SYNC
3139
SOL_XDP
40+
USER_PROCESS
3241
XDP_SHARED_UMEM
3342
XDP_COPY
3443
XDP_ZEROCOPY

libc-test/semver/linux-x86_64.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ TIOCGRS485
139139
TIOCSBRK
140140
TIOCSRS485
141141
greg_t
142+
ioperm
143+
iopl
142144
max_align_t
143145
mcontext_t
144146
ucontext_t

src/unix/bsd/apple/b32/mod.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ s_no_extra_traits! {
5454
__sig: c_long,
5555
__opaque: [::c_char; 36]
5656
}
57+
58+
pub struct pthread_once_t {
59+
__sig: c_long,
60+
__opaque: [::c_char; ::__PTHREAD_ONCE_SIZE__],
61+
}
5762
}
5863

5964
cfg_if! {
@@ -82,6 +87,29 @@ cfg_if! {
8287
self.__opaque.hash(state);
8388
}
8489
}
90+
impl PartialEq for pthread_once_t {
91+
fn eq(&self, other: &pthread_once_t) -> bool {
92+
self.__sig == other.__sig
93+
&& self.__opaque
94+
.iter()
95+
.zip(other.__opaque.iter())
96+
.all(|(a,b)| a == b)
97+
}
98+
}
99+
impl Eq for pthread_once_t {}
100+
impl ::fmt::Debug for pthread_once_t {
101+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
102+
f.debug_struct("pthread_once_t")
103+
.field("__sig", &self.__sig)
104+
.finish()
105+
}
106+
}
107+
impl ::hash::Hash for pthread_once_t {
108+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
109+
self.__sig.hash(state);
110+
self.__opaque.hash(state);
111+
}
112+
}
85113
}
86114
}
87115

@@ -92,6 +120,7 @@ pub const NET_RT_MAXID: ::c_int = 10;
92120
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
93121
pub const __PTHREAD_COND_SIZE__: usize = 24;
94122
pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
123+
pub const __PTHREAD_ONCE_SIZE__: usize = 4;
95124
pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
96125
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12;
97126

@@ -103,6 +132,12 @@ pub const BIOCSRTIMEOUT: ::c_ulong = 0x8008426d;
103132
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4008426e;
104133
pub const BIOCSETFNR: ::c_ulong = 0x8008427e;
105134

135+
const _PTHREAD_ONCE_SIG_INIT: c_long = 0x30B1BCBA;
136+
pub const PTHREAD_ONCE_INIT: ::pthread_once_t = ::pthread_once_t {
137+
__sig: _PTHREAD_ONCE_SIG_INIT,
138+
__opaque: [0; 4],
139+
};
140+
106141
extern "C" {
107142
pub fn exchangedata(
108143
path1: *const ::c_char,

src/unix/bsd/apple/b64/mod.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ s_no_extra_traits! {
5454
__sig: c_long,
5555
__opaque: [::c_char; 56]
5656
}
57+
58+
pub struct pthread_once_t {
59+
__sig: c_long,
60+
__opaque: [::c_char; __PTHREAD_ONCE_SIZE__],
61+
}
5762
}
5863

5964
cfg_if! {
@@ -82,6 +87,29 @@ cfg_if! {
8287
self.__opaque.hash(state);
8388
}
8489
}
90+
impl PartialEq for pthread_once_t {
91+
fn eq(&self, other: &pthread_once_t) -> bool {
92+
self.__sig == other.__sig
93+
&& self.__opaque
94+
.iter()
95+
.zip(other.__opaque.iter())
96+
.all(|(a,b)| a == b)
97+
}
98+
}
99+
impl Eq for pthread_once_t {}
100+
impl ::fmt::Debug for pthread_once_t {
101+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
102+
f.debug_struct("pthread_once_t")
103+
.field("__sig", &self.__sig)
104+
.finish()
105+
}
106+
}
107+
impl ::hash::Hash for pthread_once_t {
108+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
109+
self.__sig.hash(state);
110+
self.__opaque.hash(state);
111+
}
112+
}
85113
}
86114
}
87115

@@ -92,6 +120,7 @@ pub const NET_RT_MAXID: ::c_int = 11;
92120
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
93121
pub const __PTHREAD_COND_SIZE__: usize = 40;
94122
pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
123+
pub const __PTHREAD_ONCE_SIZE__: usize = 8;
95124
pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
96125
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
97126

@@ -103,6 +132,12 @@ pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
103132
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
104133
pub const BIOCSETFNR: ::c_ulong = 0x8010427e;
105134

135+
const _PTHREAD_ONCE_SIG_INIT: c_long = 0x30B1BCBA;
136+
pub const PTHREAD_ONCE_INIT: ::pthread_once_t = ::pthread_once_t {
137+
__sig: _PTHREAD_ONCE_SIG_INIT,
138+
__opaque: [0; 8],
139+
};
140+
106141
extern "C" {
107142
pub fn exchangedata(
108143
path1: *const ::c_char,

src/unix/bsd/apple/mod.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3787,6 +3787,19 @@ pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 2;
37873787
pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
37883788
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
37893789
pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
3790+
pub const PTHREAD_INHERIT_SCHED: ::c_int = 1;
3791+
pub const PTHREAD_EXPLICIT_SCHED: ::c_int = 2;
3792+
pub const PTHREAD_CANCEL_ENABLE: ::c_int = 0x01;
3793+
pub const PTHREAD_CANCEL_DISABLE: ::c_int = 0x00;
3794+
pub const PTHREAD_CANCEL_DEFERRED: ::c_int = 0x02;
3795+
pub const PTHREAD_CANCEL_ASYNCHRONOUS: ::c_int = 0x00;
3796+
pub const PTHREAD_CANCELED: *mut ::c_void = 1 as *mut ::c_void;
3797+
pub const PTHREAD_SCOPE_SYSTEM: ::c_int = 1;
3798+
pub const PTHREAD_SCOPE_PROCESS: ::c_int = 2;
3799+
pub const PTHREAD_PRIO_NONE: ::c_int = 0;
3800+
pub const PTHREAD_PRIO_INHERIT: ::c_int = 1;
3801+
pub const PTHREAD_PRIO_PROTECT: ::c_int = 2;
3802+
37903803
#[cfg(target_arch = "aarch64")]
37913804
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
37923805
#[cfg(not(target_arch = "aarch64"))]
@@ -5757,6 +5770,40 @@ extern "C" {
57575770
pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int;
57585771
pub fn mach_host_self() -> mach_port_t;
57595772
pub fn mach_thread_self() -> mach_port_t;
5773+
pub fn pthread_once(
5774+
once_control: *mut ::pthread_once_t,
5775+
init_routine: ::Option<unsafe extern "C" fn()>,
5776+
) -> ::c_int;
5777+
pub fn pthread_attr_getinheritsched(
5778+
attr: *const ::pthread_attr_t,
5779+
inheritsched: *mut ::c_int,
5780+
) -> ::c_int;
5781+
pub fn pthread_attr_getschedpolicy(
5782+
attr: *const ::pthread_attr_t,
5783+
policy: *mut ::c_int,
5784+
) -> ::c_int;
5785+
pub fn pthread_attr_getscope(
5786+
attr: *const ::pthread_attr_t,
5787+
contentionscope: *mut ::c_int,
5788+
) -> ::c_int;
5789+
pub fn pthread_attr_getstackaddr(
5790+
attr: *const ::pthread_attr_t,
5791+
stackaddr: *mut *mut ::c_void,
5792+
) -> ::c_int;
5793+
pub fn pthread_attr_getdetachstate(
5794+
attr: *const ::pthread_attr_t,
5795+
detachstate: *mut ::c_int,
5796+
) -> ::c_int;
5797+
pub fn pthread_attr_setinheritsched(
5798+
attr: *mut ::pthread_attr_t,
5799+
inheritsched: ::c_int,
5800+
) -> ::c_int;
5801+
pub fn pthread_attr_setschedpolicy(attr: *mut ::pthread_attr_t, policy: ::c_int) -> ::c_int;
5802+
pub fn pthread_attr_setscope(attr: *mut ::pthread_attr_t, contentionscope: ::c_int) -> ::c_int;
5803+
pub fn pthread_attr_setstackaddr(
5804+
attr: *mut ::pthread_attr_t,
5805+
stackaddr: *mut ::c_void,
5806+
) -> ::c_int;
57605807
pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int;
57615808
pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
57625809
pub fn pthread_mach_thread_np(thread: ::pthread_t) -> ::mach_port_t;

src/unix/linux_like/emscripten/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,8 @@ pub const POSIX_MADV_RANDOM: ::c_int = 1;
775775
pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
776776
pub const POSIX_MADV_WILLNEED: ::c_int = 3;
777777

778+
pub const AT_EACCESS: ::c_int = 0x200;
779+
778780
pub const S_IEXEC: mode_t = 64;
779781
pub const S_IWRITE: mode_t = 128;
780782
pub const S_IREAD: mode_t = 256;

0 commit comments

Comments
 (0)