From 361a06f284d9e072a061543935b381335cccc427 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Tue, 26 Nov 2019 00:35:41 +0100 Subject: [PATCH] libc: move read and write to jehanne_ namespace (where they actually belong) --- sys/include/lib9.h | 4 +++- sys/include/libc.h | 3 +++ sys/src/lib/c/9sys/read.c | 5 ++--- sys/src/lib/c/9sys/write.c | 5 ++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sys/include/lib9.h b/sys/include/lib9.h index f0a9683..984c2d7 100644 --- a/sys/include/lib9.h +++ b/sys/include/lib9.h @@ -1,7 +1,7 @@ /* * This file is part of Jehanne. * - * Copyright (C) 2017 Giacomo Tesio + * Copyright (C) 2017-2019 Giacomo Tesio * * Jehanne is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -309,3 +309,5 @@ #define sizeD2M jehanne_sizeD2M #define dirmodefmt jehanne_dirmodefmt #define chartorune jehanne_chartorune +#define read(fd, buf, size) jehanne_pread(fd, buf, size, -1) +#define write(fd, buf, size) jehanne_pwrite(fd, buf, size, -1) diff --git a/sys/include/libc.h b/sys/include/libc.h index 03604ae..c824d23 100644 --- a/sys/include/libc.h +++ b/sys/include/libc.h @@ -614,6 +614,9 @@ extern Waitmsg* jehanne_wait(void); extern int jehanne_waitpid(void); extern int jehanne_wstat(const char*, uint8_t*, int); +extern int32_t jehanne_read(int, void*, int32_t); +extern int32_t jehanne_write(int, const void*, int32_t); + extern Dir* jehanne_dirstat(const char*); extern Dir* jehanne_dirfstat(int); extern int jehanne_dirwstat(const char*, Dir*); diff --git a/sys/src/lib/c/9sys/read.c b/sys/src/lib/c/9sys/read.c index 4ba8218..ff70b11 100644 --- a/sys/src/lib/c/9sys/read.c +++ b/sys/src/lib/c/9sys/read.c @@ -15,12 +15,11 @@ * You should have received a copy of the GNU General Public License * along with Jehanne. If not, see . */ -#define PORTABLE_SYSCALLS #include #include int -read(int fd, void* buf, int nbytes) +jehanne_read(int fd, void* buf, int nbytes) { - return pread(fd, buf, nbytes, ~0LL); + return sys_pread(fd, buf, nbytes, ~0LL); } diff --git a/sys/src/lib/c/9sys/write.c b/sys/src/lib/c/9sys/write.c index 81dc315..2611695 100644 --- a/sys/src/lib/c/9sys/write.c +++ b/sys/src/lib/c/9sys/write.c @@ -15,12 +15,11 @@ * You should have received a copy of the GNU General Public License * along with Jehanne. If not, see . */ -#define PORTABLE_SYSCALLS #include #include int -write(int fd, const void* buf, int nbytes) +jehanne_write(int fd, const void* buf, int nbytes) { - return pwrite(fd, buf, nbytes, ~0LL); + return sys_pwrite(fd, buf, nbytes, ~0LL); }