Merge pull request #40 from MggMuggins/master

Implement fcntl
This commit is contained in:
Jeremy Soller
2018-03-08 19:24:54 -07:00
committed by GitHub
3 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ pub extern "C" fn creat(path: *const c_char, mode: mode_t) -> c_int {
#[no_mangle]
pub extern "C" fn fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int {
unimplemented!();
platform::fcntl(fildes, cmd, arg)
}
#[no_mangle]
+4
View File
@@ -62,6 +62,10 @@ pub fn fchdir(fildes: c_int) -> c_int {
e(unsafe { syscall!(FCHDIR, fildes) }) as c_int
}
pub fn fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int {
e(unsafe { syscall!(FCNTL, fildes, cmd, arg) }) as c_int
}
pub fn fork() -> pid_t {
e(unsafe { syscall!(FORK) }) as pid_t
}
+4
View File
@@ -63,6 +63,10 @@ pub fn fchdir(fd: c_int) -> c_int {
}
}
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 fork() -> pid_t {
e(unsafe { syscall::clone(0) }) as pid_t
}