Auto merge of #524 - mersinvald:pshared_attrs, r=alexcrichton

Added *_setpshared and *_getpshared bindings

Adding bindings to posix pthreads functions vital for IPC via shared memory.

That's my first PR into libc and I'm not proficient in unix systems programming, so I would really appreciate if someone reviewed it in case I missed something regardrless of the passed tests.
Thanks!
This commit is contained in:
bors 2017-02-17 05:41:18 +00:00
commit 532d80cdc1
3 changed files with 24 additions and 0 deletions

View File

@ -1460,6 +1460,14 @@ extern {
pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int;
pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void;
pub fn pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t;
pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
pshared: ::c_int) -> ::c_int;
pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
pshared: *mut ::c_int) -> ::c_int;
pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::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

@ -872,6 +872,14 @@ extern {
pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
stackaddr: *mut *mut ::c_void,
stacksize: *mut ::size_t) -> ::c_int;
pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
pshared: ::c_int) -> ::c_int;
pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
pshared: *mut ::c_int) -> ::c_int;
pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::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

@ -845,6 +845,10 @@ extern {
clock_id: *mut clockid_t) -> ::c_int;
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
clock_id: clockid_t) -> ::c_int;
pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
pshared: ::c_int) -> ::c_int;
pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
pshared: *mut ::c_int) -> ::c_int;
pub fn sched_getaffinity(pid: ::pid_t,
cpusetsize: ::size_t,
cpuset: *mut cpu_set_t) -> ::c_int;
@ -859,6 +863,10 @@ extern {
flg: ::c_int) -> ::c_int;
pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
abstime: *const ::timespec) -> ::c_int;
pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
pub fn ptsname_r(fd: ::c_int,
buf: *mut ::c_char,
buflen: ::size_t) -> ::c_int;