From d950421358385dda7cbbdcb4a52ab44b00f8014e Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Wed, 30 Jan 2013 20:20:59 +0100 Subject: [PATCH] Implement pread(2) and pwrite(2). --- libc/read.cpp | 7 ++++--- libc/write.cpp | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libc/read.cpp b/libc/read.cpp index 542213f4..23eb71c8 100644 --- a/libc/read.cpp +++ b/libc/read.cpp @@ -36,8 +36,9 @@ retry: return result; } -extern "C" ssize_t pread(int, void*, size_t, off_t) +DEFN_SYSCALL4(ssize_t, sys_pread, SYSCALL_PREAD, int, void*, size_t, off_t); + +extern "C" ssize_t pread(int fd, void* buf, size_t count, off_t offset) { - errno = ENOSYS; - return -1; + return sys_pread(fd, buf, count, offset); } diff --git a/libc/write.cpp b/libc/write.cpp index 9d099de8..ced30e71 100644 --- a/libc/write.cpp +++ b/libc/write.cpp @@ -36,8 +36,9 @@ retry: return result; } -extern "C" ssize_t pwrite(int, const void*, size_t, off_t) +DEFN_SYSCALL4(ssize_t, sys_pwrite, SYSCALL_PWRITE, int, const void*, size_t, off_t); + +extern "C" ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset) { - errno = ENOSYS; - return -1; + return sys_pwrite(fd, buf, count, offset); }