diff options
author | Markus Jais <markusjais@gmx.de> | 2015-02-06 22:48:30 +0100 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2015-02-12 21:08:09 -0800 |
commit | f898b825566ab0738dbfa3a1a45010d37060aed0 (patch) | |
tree | 4b330e3940410d2b2f73e76429d1387eddcc419f /src | |
parent | 39439700f0c12a197b0207acb53458fdc813b54b (diff) | |
download | nix-f898b825566ab0738dbfa3a1a45010d37060aed0.zip |
Add a test for sys::stat function
Diffstat (limited to 'src')
-rw-r--r-- | src/unistd.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/unistd.rs b/src/unistd.rs index d3838e9f..93272342 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -14,7 +14,7 @@ pub use self::linux::*; mod ffi { use super::{IovecR,IovecW}; use libc::{c_char, c_int, size_t, ssize_t}; - pub use libc::{close, read, write, pipe, ftruncate}; + pub use libc::{close, read, write, pipe, ftruncate, unlink}; pub use libc::funcs::posix88::unistd::fork; use fcntl::Fd; @@ -425,6 +425,15 @@ pub fn isatty(fd: Fd) -> NixResult<bool> { } } +pub fn unlink<P: NixPath>(path: P) -> NixResult<()> { + let res = try!(path.with_nix_path(|ptr| { + unsafe { + ffi::unlink(ptr) + } + })); + from_ffi(res) +} + #[cfg(target_os = "linux")] mod linux { use syscall::{syscall, SYSPIVOTROOT}; |