Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,8 @@ fn test_netbsd(target: &str) {
// conflicting with `p_type` macro from <resolve.h>.
("Elf32_Phdr", "p_type") => true,
("Elf64_Phdr", "p_type") => true,
// pthread_spin_t is a volatile uchar
("pthread_spinlock_t", "pts_spin") => true,
_ => false,
}
});
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3001,6 +3001,12 @@ pthread_self
pthread_setschedparam
pthread_setspecific
pthread_sigmask
pthread_spin_destroy
pthread_spin_init
pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
pthread_t
ptrace
ptrdiff_t
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/dragonfly.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,12 @@ pthread_mutexattr_setpshared
pthread_rwlockattr_getpshared
pthread_rwlockattr_setpshared
pthread_set_name_np
pthread_spin_destroy
pthread_spin_init
pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
ptrace
ptrace_io_desc
pututxline
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/freebsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,12 @@ pthread_rwlockattr_getpshared
pthread_rwlockattr_setpshared
pthread_setaffinity_np
pthread_set_name_np
pthread_spin_destroy
pthread_spin_init
pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
ptrace
ptrace_io_desc
ptrace_vm_entry
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2913,6 +2913,12 @@ pthread_rwlockattr_setpshared
pthread_setaffinity_np
pthread_setschedparam
pthread_setschedprio
pthread_spin_destroy
pthread_spin_init
pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
ptrace
ptsname_r
pwrite64
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/netbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,12 @@ pthread_getattr_np
pthread_getaffinity_np
pthread_kill
pthread_mutex_timedlock
pthread_spin_destroy
pthread_spin_init
pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
pthread_setaffinity_np
pthread_setname_np
ptrace
Expand Down
6 changes: 6 additions & 0 deletions libc-test/semver/openbsd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,12 @@ pthread_kill
pthread_main_np
pthread_mutex_timedlock
pthread_set_name_np
pthread_spin_destroy
pthread_spin_init
pthread_spin_lock
pthread_spin_trylock
pthread_spin_unlock
pthread_spinlock_t
pthread_stackseg_np
ptrace
ptrace_io_desc
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions src/unix/bsd/netbsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/unix/bsd/netbsdlike/openbsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down