Add pthread_rwlockattr APIs

This commit is contained in:
main() 2017-06-28 16:05:15 +02:00
parent 4dd672704a
commit b2de1fd5e1
20 changed files with 77 additions and 1 deletions

View File

@ -14,6 +14,7 @@ pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
pub const __PTHREAD_COND_SIZE__: usize = 24;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458;

View File

@ -14,6 +14,7 @@ pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
pub const __PTHREAD_COND_SIZE__: usize = 40;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;

View File

@ -146,6 +146,11 @@ s! {
__opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
}
pub struct pthread_rwlockattr_t {
__sig: ::c_long,
__opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
}
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_errno: ::c_int,
@ -804,6 +809,8 @@ pub const _SC_XOPEN_UNIX: ::c_int = 115;
pub const _SC_XOPEN_VERSION: ::c_int = 116;
pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;
pub const PTHREAD_PROCESS_PRIVATE: usize = 2;
pub const PTHREAD_PROCESS_SHARED: usize = 1;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
@ -1603,6 +1610,10 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
val: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
val: ::c_int) -> ::c_int;
pub fn __error() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::c_int) -> ::c_int;

View File

@ -7,6 +7,7 @@ pub type pthread_mutexattr_t = *mut ::c_void;
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_key_t = ::c_int;
pub type tcflag_t = ::c_uint;
pub type speed_t = ::c_uint;
@ -466,6 +467,8 @@ pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
pub const POSIX_MADV_WILLNEED: ::c_int = 3;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
@ -1059,6 +1062,10 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
val: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
val: ::c_int) -> ::c_int;
pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;

View File

@ -165,6 +165,11 @@ s! {
ptma_private: *mut ::c_void,
}
pub struct pthread_rwlockattr_t {
ptra_magic: ::c_uint,
ptra_private: *mut ::c_void,
}
pub struct pthread_cond_t {
ptc_magic: ::c_uint,
ptc_lock: ::c_uchar,

View File

@ -13,6 +13,7 @@ pub type pthread_mutexattr_t = *mut ::c_void;
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;
s! {
pub struct dirent {

View File

@ -23,6 +23,7 @@ pub type useconds_t = u32;
pub type socklen_t = u32;
pub type pthread_t = ::uintptr_t;
pub type pthread_mutexattr_t = ::uintptr_t;
pub type pthread_rwlockattr_t = ::uintptr_t;
pub type sigset_t = u64;
pub type fsblkcnt_t = i64;
pub type fsfilcnt_t = i64;

View File

@ -647,6 +647,10 @@ extern {
pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> ::c_int;
pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_rwlock_init$UNIX2003")]
pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t,
attr: *const pthread_rwlockattr_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_rwlock_destroy$UNIX2003")]
pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
@ -665,6 +669,9 @@ extern {
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_rwlock_unlock$UNIX2003")]
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t)
-> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_sigmask$UNIX2003")]
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,

View File

@ -12,6 +12,7 @@ pub type nlink_t = u32;
pub type useconds_t = u32;
pub type pthread_t = ::c_long;
pub type pthread_mutexattr_t = ::c_long;
pub type pthread_rwlockattr_t = ::c_long;
pub type pthread_condattr_t = ::c_long;
pub type fsfilcnt_t = ::c_ulong;
pub type fsblkcnt_t = ::c_ulong;

View File

@ -229,6 +229,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;

View File

@ -215,6 +215,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
pub const RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff;

View File

@ -104,6 +104,14 @@ s! {
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
pub struct pthread_rwlockattr_t {
#[cfg(any(target_env = "musl"))]
__align: [::c_int; 0],
#[cfg(not(any(target_env = "musl")))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
}
pub struct pthread_cond_t {
#[cfg(any(target_env = "musl"))]
__align: [*const ::c_void; 0],
@ -647,6 +655,8 @@ pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
pub const PTHREAD_PROCESS_PRIVATE: usize = 0;
pub const PTHREAD_PROCESS_SHARED: usize = 1;
pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
pub const SCHED_OTHER: ::c_int = 0;

View File

@ -160,6 +160,7 @@ pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
pub const CPU_SETSIZE: ::c_int = 128;

View File

@ -263,6 +263,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;

View File

@ -47,6 +47,7 @@ s! {
}
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
cfg_if! {
if #[cfg(target_arch = "aarch64")] {

View File

@ -576,6 +576,10 @@ extern {
pub fn pthread_setaffinity_np(thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *const ::cpu_set_t) -> ::c_int;
pub fn pthread_rwlockattr_getkind_np(attr: *const ::pthread_rwlockattr_t,
val: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_setkind_np(attr: *mut ::pthread_rwlockattr_t,
val: ::c_int) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
}

View File

@ -314,6 +314,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
pub const EADDRINUSE: ::c_int = 98;
pub const EADDRNOTAVAIL: ::c_int = 99;

View File

@ -992,6 +992,10 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
val: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
val: ::c_int) -> ::c_int;
pub fn ptsname_r(fd: ::c_int,
buf: *mut ::c_char,
buflen: ::size_t) -> ::c_int;

View File

@ -169,6 +169,10 @@ s! {
__pthread_rwlock_writercv: ::pthread_cond_t
}
pub struct pthread_rwlockattr_t {
__pthread_rwlockattrp: *mut ::c_void,
}
pub struct dirent {
pub d_ino: ::ino_t,
pub d_off: ::off_t,
@ -769,7 +773,7 @@ pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x40;
pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const PTHREAD_PROCESS_PRIVATE: u16 = 0;
pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
pub const PTHREAD_STACK_MIN: ::size_t = 4096;
pub const SIGSTKSZ: ::size_t = 8192;

View File

@ -257,6 +257,11 @@ s! {
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
pub struct pthread_rwlockattr_t {
__lockkind: ::c_int,
__pshared: ::c_int,
}
pub struct pthread_cond_t {
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
@ -1577,6 +1582,14 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_getkind_np(attr: *const pthread_rwlockattr_t,
val: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_setkind_np(attr: *mut pthread_rwlockattr_t,
val: ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
val: *mut ::c_int) -> ::c_int;
pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
val: ::c_int) -> ::c_int;
pub fn ptsname_r(fd: ::c_int,
buf: *mut ::c_char,
buflen: ::size_t) -> ::c_int;