summaryrefslogtreecommitdiff
path: root/components/libc
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2019-01-29 04:28:40 +0800
committerGitHub <[email protected]>2019-01-29 04:28:40 +0800
commitb2c2958964d429775e3da335a4f6ca5b4f9e1671 (patch)
tree25a2209ba4814d41b19e624a136ca1c7c894918f /components/libc
parentdfebb30c91875c52f16fd4e7bb9e5981fd0512b4 (diff)
parent8ff9b7795f0423eee36a19b2a36cec4e00c1e831 (diff)
Merge pull request #2289 from armink/lts-v3.1.xv3.1.2
Lts v3.1.x
Diffstat (limited to 'components/libc')
-rw-r--r--components/libc/aio/posix_aio.c3
-rw-r--r--components/libc/compilers/armlibc/stubs.c10
-rw-r--r--components/libc/mmap/posix_mmap.c2
3 files changed, 13 insertions, 2 deletions
diff --git a/components/libc/aio/posix_aio.c b/components/libc/aio/posix_aio.c
index 75e7de9ce3..3eb7634495 100644
--- a/components/libc/aio/posix_aio.c
+++ b/components/libc/aio/posix_aio.c
@@ -170,7 +170,7 @@ static void aio_read_work(struct rt_work* work, void* work_data)
if (len <= 0)
cb->aio_result = errno;
else
- cb->aio_result = 0;
+ cb->aio_result = len;
rt_hw_interrupt_enable(level);
return ;
@@ -321,6 +321,7 @@ static void aio_write_work(struct rt_work* work, void* work_data)
return;
}
+
/**
* The aio_write() function shall write aiocbp->aio_nbytes to the file associated
* with aiocbp->aio_fildes from the buffer pointed to by aiocbp->aio_buf. The
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)
diff --git a/components/libc/mmap/posix_mmap.c b/components/libc/mmap/posix_mmap.c
index 3d405aad77..a16ace8306 100644
--- a/components/libc/mmap/posix_mmap.c
+++ b/components/libc/mmap/posix_mmap.c
@@ -35,7 +35,7 @@ void *mmap(void *addr, size_t length, int prot, int flags,
cur = lseek(fd, 0, SEEK_SET);
lseek(fd, offset, SEEK_SET);
- read_bytes = read(fd, addr, length);
+ read_bytes = read(fd, mem, length);
if (read_bytes != length)
{
if (addr == RT_NULL)