Prechádzať zdrojové kódy

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.
Dan Robertson 7 rokov pred
rodič
commit
f83ff041cc
3 zmenil súbory, kde vykonal 4 pridanie a 2 odobranie
  1. 3 2
      src/platform/src/linux/mod.rs
  2. 1 0
      tests/.gitignore
  3. BIN
      tests/fcntl

+ 3 - 2
src/platform/src/linux/mod.rs

@@ -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 - 0
tests/.gitignore

@@ -11,6 +11,7 @@
 /dup.out
 /error
 /fchdir
+/fcntl
 /fsync
 /ftruncate
 /ftruncate.out

BIN
tests/fcntl