summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgztss <[email protected]>2019-01-24 09:05:41 +0800
committergztss <[email protected]>2019-01-24 09:05:41 +0800
commit11751d60e0912a944803a8c593cc88e9819fab2e (patch)
treeb539c5ddcbbc76585208f0b15dc519e8d17d609b
parentbef1d55736d589c45fece3f0660473cc34d15029 (diff)
实现_sys_flen()函数
-rw-r--r--components/libc/compilers/armlibc/stubs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c
index 820daeff39..555108f712 100644
--- a/components/libc/compilers/armlibc/stubs.c
+++ b/components/libc/compilers/armlibc/stubs.c
@@ -265,7 +265,17 @@ void _sys_exit(int return_code)
*/
long _sys_flen(FILEHANDLE fh)
{
+ struct stat stat;
+
+ if (fh < STDERR)
+ return -1;
+
+#ifndef RT_USING_DFS
return -1;
+#else
+ fstat(fh, &stat);
+ return stat.st_size;
+#endif
}
int _sys_istty(FILEHANDLE fh)