diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2012-06-07 05:52:51 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-06-07 19:15:05 -0400 |
commit | 9b97be19ee67206ed22d89a4d32d5701e2005b32 (patch) | |
tree | b25b4839c356bb84fc7dbe72372f267d3481f7ae /wirish | |
parent | 50cf479bc593bfcf68debac2812bcf7ce2862c52 (diff) | |
download | librambutan-9b97be19ee67206ed22d89a4d32d5701e2005b32.tar.gz librambutan-9b97be19ee67206ed22d89a4d32d5701e2005b32.zip |
wirish/syscalls.c: Weaken I/O related function defs.
For overriding.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'wirish')
-rw-r--r-- | wirish/syscalls.c | 24 |
1 files 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; } |