From f20878c5922972f50e17811354b71603826f120b Mon Sep 17 00:00:00 2001
From: Tom Almeida <tommoa256@gmail.com>
Date: Thu, 15 Mar 2018 15:21:52 +0800
Subject: [PATCH] Added lseek to syscalls

---
 src/platform/src/linux/mod.rs | 4 ++++
 src/platform/src/redox/mod.rs | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/platform/src/linux/mod.rs b/src/platform/src/linux/mod.rs
index 8915e6fe..6868ac3a 100644
--- a/src/platform/src/linux/mod.rs
+++ b/src/platform/src/linux/mod.rs
@@ -119,6 +119,10 @@ pub fn link(path1: *const c_char, path2: *const c_char) -> c_int {
     e(unsafe { syscall!(LINKAT, AT_FDCWD, path1, AT_FDCWD, path2, 0) }) as c_int
 }
 
+pub fn lseek(fildes: c_int, offset: off_t, whence: c_int) -> off_t {
+    e(unsafe { syscall!(LSEEK, fildes, offset, whence) }) as off_t
+}
+
 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int {
     e(unsafe { syscall!(MKDIRAT, AT_FDCWD, path, mode) }) as c_int
 }
diff --git a/src/platform/src/redox/mod.rs b/src/platform/src/redox/mod.rs
index e663a1b2..869e52b4 100644
--- a/src/platform/src/redox/mod.rs
+++ b/src/platform/src/redox/mod.rs
@@ -125,6 +125,10 @@ pub fn link(path1: *const c_char, path2: *const c_char) -> c_int {
     e(unsafe { syscall::link(path1.as_ptr(), path2.as_ptr()) }) as c_int
 }
 
+pub fn lseek(fd: c_int, offset: isize, whence: usize) -> c_int {
+    e(syscall::lseek(fd as usize, offset, whence)) as c_int
+}
+
 pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int {
     let flags = O_CREAT | O_EXCL | O_CLOEXEC | O_DIRECTORY | mode as usize & 0o777;
     let path = unsafe { c_str(path) };
-- 
GitLab