mkfifo and constants
This commit is contained in:
@@ -142,6 +142,10 @@ pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int {
|
||||
e(unsafe { syscall!(MKDIRAT, AT_FDCWD, path, mode) }) as c_int
|
||||
}
|
||||
|
||||
pub fn mkfifo(path: *const c_char mode: mode_t) -> c_int {
|
||||
e(unsafe { syscall!(MKNODAT, AT_FDCWD, path, mode, 0) })
|
||||
}
|
||||
|
||||
pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> c_int {
|
||||
e(unsafe { syscall!(NANOSLEEP, rqtp, rmtp) }) as c_int
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use core::ptr;
|
||||
use core::slice;
|
||||
use core::mem;
|
||||
use syscall;
|
||||
use syscall::flag::*;
|
||||
use syscall::data::TimeSpec as redox_timespec;
|
||||
@@ -199,6 +198,18 @@ pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mkfifo(path: *const c_char, mode: mode_t) -> c_int {
|
||||
let flags = O_CREAT | MODE_FIFO | mode as usize & 0o777;
|
||||
let path = unsafe { c_str(path) };
|
||||
match syscall::open(path, flags) {
|
||||
Ok(fd) => {
|
||||
let _ = syscall::close(fd);
|
||||
0
|
||||
}
|
||||
Err(err) => e(Err(err)) as c_int,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn nanosleep(rqtp: *const timespec, rmtp: *mut timespec) -> c_int {
|
||||
let redox_rqtp = unsafe { redox_timespec::from(&*rqtp) };
|
||||
let mut redox_rmtp: redox_timespec;
|
||||
|
||||
Reference in New Issue
Block a user