Skip to content

Commit 69da605

Browse files
committed
Auto merge of #605 - Uplifting:unix, r=alexcrichton
fill out common unix syscalls i'm expecting a few build failures, particularly from brk/sbrk.
2 parents f1fc19f + f1b62c3 commit 69da605

File tree

7 files changed

+32
-1
lines changed

7 files changed

+32
-1
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/bsd/apple/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,9 @@ extern {
16991699
link_name = "waitid$UNIX2003")]
17001700
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
17011701
options: ::c_int) -> ::c_int;
1702-
1702+
pub fn brk(addr: *const ::c_void) -> *mut ::c_void;
1703+
pub fn sbrk(increment: ::c_int) -> *mut ::c_void;
1704+
pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
17031705
}
17041706

17051707
cfg_if! {

src/unix/bsd/freebsdlike/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,7 @@ extern {
10281028
nfds: ::nfds_t,
10291029
timeout: *const ::timespec,
10301030
sigmask: *const sigset_t) -> ::c_int;
1031+
pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
10311032
}
10321033

10331034
cfg_if! {

src/unix/bsd/netbsdlike/netbsd/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ extern {
719719
pub fn newlocale(mask: ::c_int,
720720
locale: *const ::c_char,
721721
base: ::locale_t) -> ::locale_t;
722+
#[link_name = "__settimeofday50"]
723+
pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
722724
}
723725

724726
mod other;

src/unix/mod.rs

Lines changed: 13 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;
@@ -573,6 +582,8 @@ extern {
573582
#[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")]
574583
pub fn gettimeofday(tp: *mut ::timeval,
575584
tz: *mut ::c_void) -> ::c_int;
585+
#[cfg_attr(target_os = "netbsd", link_name = "__times13")]
586+
pub fn times(buf: *mut ::tms) -> ::clock_t;
576587

577588
pub fn pthread_self() -> ::pthread_t;
578589
pub fn pthread_create(native: *mut ::pthread_t,
@@ -802,6 +813,8 @@ extern {
802813
set: *const sigset_t,
803814
oldset: *mut sigset_t)
804815
-> ::c_int;
816+
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
817+
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
805818

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

src/unix/notbsd/linux/mips/mips64.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pub type rlim_t = ::c_ulong;
1212
pub type suseconds_t = i64;
1313
pub type time_t = i64;
1414
pub type wchar_t = i32;
15+
pub type clock_t = i64;
1516

1617
s! {
1718
pub struct aiocb {

src/unix/notbsd/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,8 @@ extern {
835835
rqtp: *const ::timespec,
836836
rmtp: *mut ::timespec) -> ::c_int;
837837
pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
838+
pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
839+
838840
pub fn prctl(option: ::c_int, ...) -> ::c_int;
839841
pub fn pthread_getattr_np(native: ::pthread_t,
840842
attr: *mut ::pthread_attr_t) -> ::c_int;
@@ -853,6 +855,9 @@ extern {
853855
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
854856
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
855857
pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
858+
pub fn sched_setparam(pid: ::pid_t, param: *const sched_param) -> ::c_int;
859+
pub fn sched_getparam(pid: ::pid_t, param: *mut sched_param) -> ::c_int;
860+
pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
856861
pub fn epoll_create(size: ::c_int) -> ::c_int;
857862
pub fn epoll_create1(flags: ::c_int) -> ::c_int;
858863
pub fn epoll_ctl(epfd: ::c_int,
@@ -981,6 +986,12 @@ extern {
981986
pub fn clearenv() -> ::c_int;
982987
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
983988
options: ::c_int) -> ::c_int;
989+
pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
990+
pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int;
991+
pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int;
992+
pub fn acct(filename: *const ::c_char) -> ::c_int;
993+
pub fn brk(addr: *mut ::c_void) -> ::c_int;
994+
pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
984995
}
985996

986997
cfg_if! {

0 commit comments

Comments
 (0)