diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-01-17 20:13:01 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-01-17 20:13:01 +0000 |
commit | 217e398585984539142aca07b977915968cb9593 (patch) | |
tree | 680ea46e9c5ce693d4fc31beed0b75b82ac445f3 /c | |
parent | added class to initial id macro (diff) | |
download | rtems-217e398585984539142aca07b977915968cb9593.tar.bz2 |
Modified fstat and stat to be consistent with isatty in that all three
now pretend that everything is a tty. This insures that newlib makes
the console output line buffered.
Diffstat (limited to 'c')
-rw-r--r-- | c/src/lib/libc/syscalls.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/c/src/lib/libc/syscalls.c b/c/src/lib/libc/syscalls.c index 1b70ea8d11..1ffd586d79 100644 --- a/c/src/lib/libc/syscalls.c +++ b/c/src/lib/libc/syscalls.c @@ -23,22 +23,38 @@ #include <sys/types.h> #include <sys/stat.h> -int -__fstat(int _fd, struct stat* _sbuf) +/* + * check this newlib bug?: + * + * newlib/libc/stdio/makebuf.c: + * + * 2nd ifdef uses 1024 instead of BUFSIZ + * 2nd check lets fp blksize be 0 + * finally look at the malloc + */ + +/* + * fstat, stat, and isatty must lie consistently and report that everything + * is a tty or stdout will not be line buffered. + */ + +int __fstat(int _fd, struct stat* _sbuf) { - return -1; + _sbuf->st_mode = S_IFCHR; +#ifdef HAVE_BLKSIZE + _sbuf->st_blksize = 0; +#endif + return 0; } -int -__isatty(int _fd) +int __isatty(int _fd) { return 1; } int stat( const char *path, struct stat *buf ) { - /* always fail */ - return -1; + return __fstat( 0, buf ); } int link( const char *existing, const char *new ) |