Skip to content

Commit 5d7f90c

Browse files
committed
Auto merge of #2455 - awidegreen:add_pthread_mutex_robust_support, r=JohnTitor
Adds pthread_mutexattr_[g|s]etrobust and pthread_mutex_consistent bindings Adds pthread_mutexattr_[g|s]etrobust and pthread_mutex_consistent bindings FreeBSD: https://cgit.freebsd.org/src/tree/include/pthread.h?id=65436b2e1207a98a1c752c14f8c059238c0eafda#n140 Linux: https://sourceware.org/git?p=glibc.git;a=blob;f=sysdeps/htl/bits/pthreadtypes.h;h=74127aea488a69af8fb63b8f353307e5d401a62b;hb=HEAD#l83
2 parents 6172388 + 5ddd015 commit 5d7f90c

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

libc-test/semver/freebsd.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1650,9 +1650,12 @@ pthread_getcpuclockid
16501650
pthread_getthreadid_np
16511651
pthread_kill
16521652
pthread_main_np
1653+
pthread_mutex_consistent
16531654
pthread_mutex_timedlock
16541655
pthread_mutexattr_getpshared
16551656
pthread_mutexattr_setpshared
1657+
pthread_mutexattr_getrobust
1658+
pthread_mutexattr_setrobust
16561659
pthread_rwlockattr_getpshared
16571660
pthread_rwlockattr_setpshared
16581661
pthread_setaffinity_np

libc-test/semver/linux.txt

+3
Original file line numberDiff line numberDiff line change
@@ -2897,9 +2897,12 @@ pthread_getattr_np
28972897
pthread_getcpuclockid
28982898
pthread_getschedparam
28992899
pthread_kill
2900+
pthread_mutex_consistent
29002901
pthread_mutex_timedlock
29012902
pthread_mutexattr_getpshared
29022903
pthread_mutexattr_setpshared
2904+
pthread_mutexattr_getrobust
2905+
pthread_mutexattr_setrobust
29032906
pthread_rwlockattr_setpshared
29042907
pthread_setaffinity_np
29052908
pthread_setschedparam

src/unix/bsd/freebsdlike/freebsd/mod.rs

+13
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,8 @@ pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
609609

610610
pub const PTHREAD_STACK_MIN: ::size_t = MINSIGSTKSZ;
611611
pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
612+
pub const PTHREAD_MUTEX_STALLED: ::c_int = 0;
613+
pub const PTHREAD_MUTEX_ROBUST: ::c_int = 1;
612614
pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + 32768;
613615
pub const SF_NODISKIO: ::c_int = 0x00000001;
614616
pub const SF_MNOWAIT: ::c_int = 0x00000002;
@@ -1808,6 +1810,17 @@ extern "C" {
18081810
cpusetp: *const cpuset_t,
18091811
) -> ::c_int;
18101812

1813+
pub fn pthread_mutex_consistent(mutex: *mut ::pthread_mutex_t) -> ::c_int;
1814+
1815+
pub fn pthread_mutexattr_getrobust(
1816+
attr: *mut ::pthread_mutexattr_t,
1817+
robust: *mut ::c_int,
1818+
) -> ::c_int;
1819+
pub fn pthread_mutexattr_setrobust(
1820+
attr: *mut ::pthread_mutexattr_t,
1821+
robust: ::c_int,
1822+
) -> ::c_int;
1823+
18111824
pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: ::c_int) -> ::c_int;
18121825
pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> ::c_int;
18131826
pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> ::c_int;

src/unix/linux_like/linux/mod.rs

+11
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,8 @@ pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
14911491
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
14921492
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
14931493
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
1494+
pub const PTHREAD_MUTEX_STALLED: ::c_int = 0;
1495+
pub const PTHREAD_MUTEX_ROBUST: ::c_int = 1;
14941496
pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
14951497
pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
14961498
pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
@@ -3619,6 +3621,7 @@ extern "C" {
36193621
timeout: *const ::timespec,
36203622
sigmask: *const sigset_t,
36213623
) -> ::c_int;
3624+
pub fn pthread_mutex_consistent(mutex: *mut pthread_mutex_t) -> ::c_int;
36223625
pub fn pthread_mutex_timedlock(
36233626
lock: *mut pthread_mutex_t,
36243627
abstime: *const ::timespec,
@@ -3734,6 +3737,14 @@ extern "C" {
37343737
attr: *const pthread_mutexattr_t,
37353738
pshared: *mut ::c_int,
37363739
) -> ::c_int;
3740+
pub fn pthread_mutexattr_getrobust(
3741+
attr: *const pthread_mutexattr_t,
3742+
robustness: *mut ::c_int,
3743+
) -> ::c_int;
3744+
pub fn pthread_mutexattr_setrobust(
3745+
attr: *mut pthread_mutexattr_t,
3746+
robustness: ::c_int,
3747+
) -> ::c_int;
37373748
pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
37383749
pub fn faccessat(
37393750
dirfd: ::c_int,

0 commit comments

Comments
 (0)