git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15309 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
76e03f4392
commit
caad7b91b9
|
@ -123,7 +123,6 @@ LDSCRIPT= ./sandbox.ld
|
|||
# setting.
|
||||
CSRC = $(ALLCSRC) \
|
||||
$(TESTSRC) \
|
||||
$(CHIBIOS)/os/sb/various/syscalls.c \
|
||||
main.c
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
|
|
|
@ -123,7 +123,6 @@ LDSCRIPT= ./sandbox.ld
|
|||
# setting.
|
||||
CSRC = $(ALLCSRC) \
|
||||
$(TESTSRC) \
|
||||
$(CHIBIOS)/os/sb/various/syscalls.c \
|
||||
main.c
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
|
|
|
@ -123,7 +123,6 @@ LDSCRIPT= ./sandbox.ld
|
|||
# setting.
|
||||
CSRC = $(ALLCSRC) \
|
||||
$(TESTSRC) \
|
||||
$(CHIBIOS)/os/sb/various/syscalls.c \
|
||||
main.c
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
|
|
|
@ -123,7 +123,6 @@ LDSCRIPT= ./sandbox.ld
|
|||
# setting.
|
||||
CSRC = $(ALLCSRC) \
|
||||
$(TESTSRC) \
|
||||
$(CHIBIOS)/os/sb/various/syscalls.c \
|
||||
main.c
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <reent.h>
|
||||
|
||||
DIR *fdopendir(int fd) {
|
||||
DIR *dirp;
|
||||
|
||||
|
@ -53,13 +55,13 @@ int closedir (DIR *dirp) {
|
|||
}
|
||||
|
||||
struct dirent *readdir (DIR *dirp) {
|
||||
extern int getdents(int fd, void *dp, int count);
|
||||
extern int _getdents_r(struct _reent *r, int fd, void *dp, int count);
|
||||
|
||||
while (true) {
|
||||
struct dirent *dep;
|
||||
|
||||
if (dirp->next == 0) {
|
||||
dirp->size = getdents(dirp->fd, dirp->buf, DIR_BUF_SIZE);
|
||||
dirp->size = _getdents_r(_REENT, dirp->fd, dirp->buf, DIR_BUF_SIZE);
|
||||
}
|
||||
|
||||
if (dirp->size <= 0) {
|
||||
|
|
|
@ -134,7 +134,7 @@ caddr_t _sbrk_r(struct _reent *r, int incr) {
|
|||
prevp = p;
|
||||
if ((p + incr > &__heap_end__) ||
|
||||
(p + incr < &__heap_base__)) {
|
||||
__errno_r(r) = ENOMEM;
|
||||
__errno_r(r) = ENOMEM;
|
||||
return (caddr_t)-1;
|
||||
}
|
||||
|
||||
|
@ -142,12 +142,13 @@ caddr_t _sbrk_r(struct _reent *r, int incr) {
|
|||
return (caddr_t)prevp;
|
||||
}
|
||||
|
||||
int getdents(int fd, void *dp, int count) {
|
||||
__attribute__((used))
|
||||
int _getdents_r(struct _reent *r, int fd, void *dp, int count) {
|
||||
ssize_t n;
|
||||
|
||||
n = sbPosixGetdents(fd, dp, count);
|
||||
if (CH_RET_IS_ERROR(n)) {
|
||||
errno = CH_DECODE_ERROR(n);
|
||||
__errno_r(r) = CH_DECODE_ERROR(n);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue