Skip to content

Commit 6fb7c90

Browse files
author
Andrew Salmon
committed
sys/times.h, setreuid/setregid, and sigpending
1 parent eaaa277 commit 6fb7c90

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ fn main() {
105105
cfg.header("syslog.h");
106106
cfg.header("semaphore.h");
107107
cfg.header("sys/statvfs.h");
108+
cfg.header("sys/times.h");
108109
}
109110

110111
if android {

src/unix/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,19 @@ s! {
125125
pub sival_ptr: *mut ::c_void
126126
}
127127

128+
// <sys/time.h>
128129
pub struct itimerval {
129130
pub it_interval: ::timeval,
130131
pub it_value: ::timeval,
131132
}
133+
134+
// <sys/times.h>
135+
pub struct tms {
136+
pub tms_utime: ::clock_t,
137+
pub tms_stime: ::clock_t,
138+
pub tms_cutime: ::clock_t,
139+
pub tms_cstime: ::clock_t,
140+
}
132141
}
133142

134143
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
@@ -467,6 +476,8 @@ extern {
467476
pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
468477
pub fn setsid() -> pid_t;
469478
pub fn setuid(uid: uid_t) -> ::c_int;
479+
pub fn setreuid(ruid: uid_t, euid: uid_t) -> ::c_int;
480+
pub fn setregid(rgid: gid_t, egid: gid_t) -> ::c_int;
470481
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
471482
link_name = "sleep$UNIX2003")]
472483
pub fn sleep(secs: ::c_uint) -> ::c_uint;
@@ -573,6 +584,8 @@ extern {
573584
#[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")]
574585
pub fn gettimeofday(tp: *mut ::timeval,
575586
tz: *mut ::c_void) -> ::c_int;
587+
#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
588+
pub fn times(buf: *mut ::tms) -> ::clock_t;
576589

577590
pub fn pthread_self() -> ::pthread_t;
578591
pub fn pthread_create(native: *mut ::pthread_t,
@@ -802,6 +815,8 @@ extern {
802815
set: *const sigset_t,
803816
oldset: *mut sigset_t)
804817
-> ::c_int;
818+
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
819+
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
805820

806821
#[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
807822
pub fn timegm(tm: *mut ::tm) -> time_t;

0 commit comments

Comments
 (0)