diff --git a/base/usr/include/unistd.h b/base/usr/include/unistd.h index ad1320f6..355a44e2 100644 --- a/base/usr/include/unistd.h +++ b/base/usr/include/unistd.h @@ -106,4 +106,7 @@ extern long pathconf(const char *path, int name); extern int getgroups(int size, gid_t list[]); +ssize_t pread(int fd, void *buf, size_t count, off_t offset); +ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); + _End_C_Header diff --git a/libc/unistd/pread.c b/libc/unistd/pread.c new file mode 100644 index 00000000..89343e0a --- /dev/null +++ b/libc/unistd/pread.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +DEFN_SYSCALL4(pread, SYS_PREAD, int, void *, size_t, off_t); + +ssize_t pread(int fd, void *buf, size_t count, off_t offset) { + __sets_errno(syscall_pread(fd,buf,count,offset)); +} + diff --git a/libc/unistd/pwrite.c b/libc/unistd/pwrite.c new file mode 100644 index 00000000..c8577bf4 --- /dev/null +++ b/libc/unistd/pwrite.c @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +DEFN_SYSCALL4(pwrite, SYS_PWRITE, int, const void *, size_t, off_t); + +ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) { + __sets_errno(syscall_pwrite(fd,buf,count,offset)); +} +