summaryrefslogtreecommitdiff
path: root/src/unistd.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/unistd.rs')
-rw-r--r--src/unistd.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/unistd.rs b/src/unistd.rs
index 4a7359cc..c7e88971 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -3,7 +3,7 @@
use {Errno, Error, Result, NixPath};
use fcntl::{fcntl, OFlag, O_NONBLOCK, O_CLOEXEC, FD_CLOEXEC};
use fcntl::FcntlArg::{F_SETFD, F_SETFL};
-use libc::{self, c_char, c_void, c_int, size_t, pid_t, off_t, uid_t, gid_t};
+use libc::{self, c_char, c_void, c_int, c_uint, size_t, pid_t, off_t, uid_t, gid_t};
use std::mem;
use std::ffi::CString;
use std::os::unix::io::RawFd;
@@ -366,6 +366,13 @@ pub fn pause() -> Result<()> {
Errno::result(res).map(drop)
}
+#[inline]
+// Per POSIX, does not fail:
+// http://pubs.opengroup.org/onlinepubs/009695399/functions/sleep.html#tag_03_705_05
+pub fn sleep(seconds: libc::c_uint) -> c_uint {
+ unsafe { libc::sleep(seconds) }
+}
+
#[cfg(any(target_os = "linux", target_os = "android"))]
mod linux {
use sys::syscall::{syscall, SYSPIVOTROOT};