From 9b97be19ee67206ed22d89a4d32d5701e2005b32 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Thu, 7 Jun 2012 05:52:51 -0400 Subject: wirish/syscalls.c: Weaken I/O related function defs. For overriding. Signed-off-by: Marti Bolivar --- wirish/syscalls.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/wirish/syscalls.c b/wirish/syscalls.c index d365e15..4c5ce8a 100644 --- a/wirish/syscalls.c +++ b/wirish/syscalls.c @@ -74,46 +74,46 @@ caddr_t _sbrk(int incr) { return ret; } -int _open(const char *path, int flags, ...) { +__weak int _open(const char *path, int flags, ...) { return 1; } -int _close(int fd) { +__weak int _close(int fd) { return 0; } -int _fstat(int fd, struct stat *st) { +__weak int _fstat(int fd, struct stat *st) { st->st_mode = S_IFCHR; return 0; } -int _isatty(int fd) { +__weak int _isatty(int fd) { return 1; } -int isatty(int fd) { +__weak int isatty(int fd) { return 1; } -int _lseek(int fd, off_t pos, int whence) { +__weak int _lseek(int fd, off_t pos, int whence) { return -1; } -unsigned char getch(void) { +__weak unsigned char getch(void) { return 0; } -int _read(int fd, char *buf, size_t cnt) { +__weak int _read(int fd, char *buf, size_t cnt) { *buf = getch(); return 1; } -void putch(unsigned char c) { +__weak void putch(unsigned char c) { } -void cgets(char *s, int bufsize) { +__weak void cgets(char *s, int bufsize) { char *p; int c; int i; @@ -153,7 +153,7 @@ void cgets(char *s, int bufsize) { return; } -int _write(int fd, const char *buf, size_t cnt) { +__weak int _write(int fd, const char *buf, size_t cnt) { int i; for (i = 0; i < cnt; i++) @@ -163,7 +163,7 @@ int _write(int fd, const char *buf, size_t cnt) { } /* Override fgets() in newlib with a version that does line editing */ -char *fgets(char *s, int bufsize, void *f) { +__weak char *fgets(char *s, int bufsize, void *f) { cgets(s, bufsize); return s; } -- cgit v1.2.3