Aarch64: Update syscall usage

Don't use syscalls that are non-existent on Aarch64 linux boxes. The
FORK and RMDIR syscalls are no longer present and the CLONE and UNLINKAT
syscalls are used instead.
This commit is contained in:
Dan Robertson
2018-03-09 03:59:30 +00:00
committed by Dan Robertson
parent 4da873ae79
commit f83ff041cc
3 changed files with 4 additions and 2 deletions
+3 -2
View File
@@ -4,6 +4,7 @@ use errno;
use types::*;
const AT_FDCWD: c_int = -100;
const AT_REMOVEDIR: c_int = 0x200;
pub fn e(sys: usize) -> usize {
if (sys as isize) < 0 && (sys as isize) >= -256 {
@@ -67,7 +68,7 @@ pub fn fcntl(fildes: c_int, cmd: c_int, arg: c_int) -> c_int {
}
pub fn fork() -> pid_t {
e(unsafe { syscall!(FORK) }) as pid_t
e(unsafe { syscall!(CLONE, 17, 0) }) as pid_t
}
pub fn fsync(fildes: c_int) -> c_int {
@@ -135,7 +136,7 @@ pub fn read(fildes: c_int, buf: &mut [u8]) -> ssize_t {
}
pub fn rmdir(path: *const c_char) -> c_int {
e(unsafe { syscall!(RMDIR, path) }) as c_int
e(unsafe { syscall!(UNLINKAT, AT_FDCWD, path, AT_REMOVEDIR) }) as c_int
}
pub fn write(fildes: c_int, buf: &[u8]) -> ssize_t {
+1
View File
@@ -11,6 +11,7 @@
/dup.out
/error
/fchdir
/fcntl
/fsync
/ftruncate
/ftruncate.out
BIN
View File
Binary file not shown.