9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b961efc6c5e1e38cf8bd15465311bb9bc1f559e3
parent 0be390cab1d76a0e4444a993a3619fa7426c4c74
Author: Ambroise Vincent <ambroise.vincent@arm.com>
Date:   Mon, 13 May 2019 11:26:02 +0100

[libk] Stop using _read and _write

Change-Id: I53c5a92c3c230fc1c149958a9ec6afde37c058ae
Signed-off-by: Ambroise Vincent <ambroise.vincent@arm.com>

Diffstat:
Mdrivers/dummyuart.c | 7+++----
Minclude/libk.h | 1-
Msrc/libc/arch/amd64/linux/Makefile | 2--
Dsrc/libc/arch/amd64/linux/sys_read.s | 7-------
Dsrc/libc/arch/amd64/linux/sys_write.s | 7-------
Msrc/libc/arch/amd64/linux/syscall.lst | 4++--
Msrc/libc/arch/arm64/rcode/Makefile | 2--
Dsrc/libc/arch/arm64/rcode/_read.s | 4----
Dsrc/libc/arch/arm64/rcode/_write.s | 4----
Msrc/libk/Makefile | 1-
Msrc/libk/kgetc.c | 4+---
Msrc/libk/kputc.c | 4+---
Dsrc/libk/kwrite.c | 11-----------
Msrc/romfw/dlang.c | 2+-
14 files changed, 8 insertions(+), 52 deletions(-)

diff --git a/drivers/dummyuart.c b/drivers/dummyuart.c @@ -4,8 +4,7 @@ #include "dev.h" #include "uart.h" -extern int sys_read(int fd, void *buf, size_t n); -extern int sys_write(int fd, void *buf, size_t n); +#include "../src/libc/syscall.h" static int setbauds(Uart *up, long rate) @@ -22,13 +21,13 @@ dummyuartinit(Uart *up, Attr *attr) static int dummyuartread(Uart *up, void *buf, int n) { - return sys_read(0, buf, n); + return _read(0, buf, n); } static int dummyuartwrite(Uart *up, void *buf, int n) { - return sys_write(1, buf, n); + return _write(1, buf, n); } static int diff --git a/include/libk.h b/include/libk.h @@ -12,7 +12,6 @@ extern int kgetc(int fd); extern int kputc(int fd, int ch); extern int kputs(int fd, const char *s); extern int kvprint(int fd, const char *fmt, va_list va); -extern int kwrite(int fd, char *buf, int n); extern void kerror(const char *s); extern int putenv(char *name); extern int tokenize(char *line, int siz, char *tokens[], int ntoks); diff --git a/src/libc/arch/amd64/linux/Makefile b/src/libc/arch/amd64/linux/Makefile @@ -24,8 +24,6 @@ OBJS = _Exit.o \ time.o \ _sys_errlist.o \ crt.o \ - sys_read.o \ - sys_write.o all: syscall $(MAKE) objs diff --git a/src/libc/arch/amd64/linux/sys_read.s b/src/libc/arch/amd64/linux/sys_read.s @@ -1,7 +0,0 @@ - .file "sys_read.s" - - .globl sys_read -sys_read: - movq $0,%rax - syscall - jmp _cerrno diff --git a/src/libc/arch/amd64/linux/sys_write.s b/src/libc/arch/amd64/linux/sys_write.s @@ -1,7 +0,0 @@ - .file "sys_write.s" - - .globl sys_write -sys_write: - movq $1,%rax - syscall - jmp _cerrno diff --git a/src/libc/arch/amd64/linux/syscall.lst b/src/libc/arch/amd64/linux/syscall.lst @@ -1,6 +1,6 @@ #number name -0 sys_read -1 sys_write +0 _read +1 _write 2 _open 3 _close 8 _lseek diff --git a/src/libc/arch/arm64/rcode/Makefile b/src/libc/arch/arm64/rcode/Makefile @@ -5,9 +5,7 @@ include ../../../rules.mk OBJS = _Exit.o \ raise.o \ - _write.o \ _sys_errlist.o \ - _read.o \ getenv.o \ putenv.o \ crt.o \ diff --git a/src/libc/arch/arm64/rcode/_read.s b/src/libc/arch/arm64/rcode/_read.s @@ -1,4 +0,0 @@ - .globl _read - -_read: - b read diff --git a/src/libc/arch/arm64/rcode/_write.s b/src/libc/arch/arm64/rcode/_write.s @@ -1,4 +0,0 @@ - .globl _write - -_write: - b write diff --git a/src/libk/Makefile b/src/libk/Makefile @@ -11,7 +11,6 @@ OBJS = doprnt.o \ kvprint.o \ kgets.o \ kerror.o \ - kwrite.o \ tokenize.o \ kstd.o \ frombytes.o \ diff --git a/src/libk/kgetc.c b/src/libk/kgetc.c @@ -2,12 +2,10 @@ #include <libk.h> -#include "../libc/syscall.h" - int kgetc(int fd) { char ch; - return (_read(fd, &ch, 1) < 0) ? EOF : ch; + return (read(fd, &ch, 1) < 0) ? EOF : ch; } diff --git a/src/libk/kputc.c b/src/libk/kputc.c @@ -2,12 +2,10 @@ #include <libk.h> -#include "../libc/syscall.h" - int kputc(int fd, int ch) { char c = ch; - return (_write(fd, &c, 1) < 0) ? EOF : 1; + return (write(fd, &c, 1) < 0) ? EOF : 1; } diff --git a/src/libk/kwrite.c b/src/libk/kwrite.c @@ -1,11 +0,0 @@ -#include <stdio.h> - -#include <libk.h> - -#include "../libc/syscall.h" - -int -kwrite(int fd, char *buf, int n) -{ - return _write(fd, buf, n); -} diff --git a/src/romfw/dlang.c b/src/romfw/dlang.c @@ -219,7 +219,7 @@ do_cat(const struct cmd *cmd, struct args *args) goto err; while ((n = read(fd, buf, sizeof(buf))) > 0) - kwrite(kin, buf, n); + write(kin, buf, n); if (close(fd) < 0 || n < 0) goto err;