Implement sys/file.h
This commit is contained in:
@@ -84,6 +84,10 @@ pub fn fchown(fildes: c_int, owner: uid_t, group: gid_t) -> c_int {
|
||||
e(unsafe { syscall!(FCHOWN, fildes, owner, group) }) as c_int
|
||||
}
|
||||
|
||||
pub fn flock(fd: c_int, operation: c_int) -> c_int {
|
||||
e(unsafe { syscall!(FLOCK, fd, operation) }) as c_int
|
||||
}
|
||||
|
||||
pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int {
|
||||
let empty_cstr: *const c_char = unsafe { ::cstr_from_bytes_with_nul_unchecked(b"\0") };
|
||||
e(unsafe { syscall!(NEWFSTATAT, fildes, empty_cstr, buf, AT_EMPTY_PATH) }) as c_int
|
||||
|
||||
@@ -226,6 +226,11 @@ pub fn fcntl(fd: c_int, cmd: c_int, args: c_int) -> c_int {
|
||||
e(syscall::fcntl(fd as usize, cmd as usize, args as usize)) as c_int
|
||||
}
|
||||
|
||||
pub fn flock(_fd: c_int, _operation: c_int) -> c_int {
|
||||
// TODO: Redox does not have file locking yet
|
||||
0
|
||||
}
|
||||
|
||||
pub fn fork() -> pid_t {
|
||||
e(unsafe { syscall::clone(0) }) as pid_t
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use core::mem;
|
||||
#[cfg(target_os = "redox")]
|
||||
use syscall::data::TimeSpec as redox_timespec;
|
||||
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
|
||||
|
||||
Reference in New Issue
Block a user