summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2021-06-16 19:15:11 +0100
committerDC <devnexen@gmail.com>2021-06-17 10:44:01 +0100
commit7250a68be72501c610cf6fe4b7cee61742390b9e (patch)
treeda52581b722303c68d86690a9b96e7f62ec583dd /src
parent599ae1bc9d52e8d0ecb0f0ad9b69ec64ea87622f (diff)
downloadrust-libc-7250a68be72501c610cf6fe4b7cee61742390b9e.tar.gz
pthread_spinlock api remaining bsd systems
Diffstat (limited to 'src')
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs8
-rw-r--r--src/unix/bsd/netbsdlike/mod.rs5
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs8
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs2
4 files changed, 23 insertions, 0 deletions
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index b9bdafed4e..8092db5705 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -26,6 +26,8 @@ pub type cpuset_t = cpumask_t;
pub type cpu_set_t = cpumask_t;
pub type register_t = ::c_long;
+pub type umtx_t = ::c_int;
+pub type pthread_spinlock_t = ::uintptr_t;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum sem {}
@@ -1269,6 +1271,12 @@ extern "C" {
needle: *const ::c_void,
needlelen: ::size_t,
) -> *mut ::c_void;
+ pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: ::c_int) -> ::c_int;
+ pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> ::c_int;
+ pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> ::c_int;
+ pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> ::c_int;
+ pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> ::c_int;
+
pub fn sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *mut cpu_set_t) -> ::c_int;
pub fn sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *const cpu_set_t)
-> ::c_int;
diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs
index 7e7269fcff..7f030abc98 100644
--- a/src/unix/bsd/netbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/mod.rs
@@ -712,6 +712,11 @@ extern "C" {
lock: *mut pthread_mutex_t,
abstime: *const ::timespec,
) -> ::c_int;
+ pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: ::c_int) -> ::c_int;
+ pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> ::c_int;
+ pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> ::c_int;
+ pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> ::c_int;
+ pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> ::c_int;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
pub fn getgrouplist(
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 0aee1ec515..ee308cf7c8 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -12,6 +12,7 @@ pub type lwpid_t = ::c_uint;
pub type shmatt_t = ::c_uint;
pub type cpuid_t = u64;
pub type cpuset_t = _cpuset;
+pub type pthread_spin_t = ::c_uchar;
// elf.h
@@ -209,6 +210,12 @@ s! {
ptr_private: *mut ::c_void,
}
+ pub struct pthread_spinlock_t {
+ pts_magic: ::c_uint,
+ pts_spin: ::pthread_spin_t,
+ pts_flags: ::c_int,
+ }
+
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: u32,
@@ -2067,6 +2074,7 @@ extern "C" {
size: ::size_t,
set: *mut cpuset_t,
) -> ::c_int;
+
pub fn _cpuset_create() -> *mut cpuset_t;
pub fn _cpuset_destroy(set: *mut cpuset_t);
pub fn _cpuset_clr(cpu: cpuid_t, set: *mut cpuset_t) -> ::c_int;
diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs
index c5d45b4543..038048ef17 100644
--- a/src/unix/bsd/netbsdlike/openbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -14,6 +14,7 @@ pub type pthread_cond_t = *mut ::c_void;
pub type pthread_condattr_t = *mut ::c_void;
pub type pthread_rwlock_t = *mut ::c_void;
pub type pthread_rwlockattr_t = *mut ::c_void;
+pub type pthread_spinlock_t = ::uintptr_t;
pub type caddr_t = *mut ::c_char;
// elf.h
@@ -1530,6 +1531,7 @@ extern "C" {
pub fn pthread_main_np() -> ::c_int;
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
pub fn pthread_stackseg_np(thread: ::pthread_t, sinfo: *mut ::stack_t) -> ::c_int;
+
pub fn sysctl(
name: *const ::c_int,
namelen: ::c_uint,