Browse Source

Fix tests

Jeremy Soller 7 years ago
parent
commit
4198055d4a
3 changed files with 7 additions and 7 deletions
  1. 4 4
      src/platform/src/linux/mod.rs
  2. 2 2
      src/platform/src/redox/mod.rs
  3. 1 1
      tests/Makefile

+ 4 - 4
src/platform/src/linux/mod.rs

@@ -118,12 +118,12 @@ pub fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
     e(unsafe { syscall!(OPENAT, AT_FDCWD, path, oflag, mode) }) as c_int
 }
 
-pub fn pipe(fildes: [c_int; 2]) -> c_int {
-    e(unsafe { syscall!(PIPE2, fildes.as_ptr(), 0) }) as c_int
+pub fn pipe(mut fildes: [c_int; 2]) -> c_int {
+    e(unsafe { syscall!(PIPE2, fildes.as_mut_ptr(), 0) }) as c_int
 }
 
-pub fn read(fildes: c_int, buf: &[u8]) -> ssize_t {
-    e(unsafe { syscall!(READ, fildes, buf.as_ptr(), buf.len()) }) as ssize_t
+pub fn read(fildes: c_int, buf: &mut [u8]) -> ssize_t {
+    e(unsafe { syscall!(READ, fildes, buf.as_mut_ptr(), buf.len()) }) as ssize_t
 }
 
 pub fn write(fildes: c_int, buf: &[u8]) -> ssize_t {

+ 2 - 2
src/platform/src/redox/mod.rs

@@ -123,9 +123,9 @@ pub fn open(path: *const c_char, oflag: c_int, mode: mode_t) -> c_int {
     e(syscall::open(path, (oflag as usize) | (mode as usize))) as c_int
 }
 
-pub fn pipe(fds: [c_int; 2]) -> c_int {
+pub fn pipe(mut fds: [c_int; 2]) -> c_int {
     let mut usize_fds: [usize; 2] = [0; 2];
-    let res = e(syscall::pipe2(&mut usize_fds));
+    let res = e(syscall::pipe2(&mut usize_fds, 0));
     fds[0] = usize_fds[0] as c_int;
     fds[1] = usize_fds[1] as c_int;
     res as c_int

+ 1 - 1
tests/Makefile

@@ -40,4 +40,4 @@ GCCTAIL=\
 	../openlibm/libopenlibm.a
 
 %: %.c
-	gcc -no-pie -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"
+	gcc -fno-stack-protector -Wall $(GCCHEAD) "$<" $(GCCTAIL) -o "$@"