git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15309 27425a3e-05d8-49a3-a47f-9c15f0e5edd8

This commit is contained in:
Giovanni Di Sirio 2022-01-02 10:21:27 +00:00
parent 76e03f4392
commit caad7b91b9
6 changed files with 8 additions and 9 deletions

View File

@ -123,7 +123,6 @@ LDSCRIPT= ./sandbox.ld
# setting. # setting.
CSRC = $(ALLCSRC) \ CSRC = $(ALLCSRC) \
$(TESTSRC) \ $(TESTSRC) \
$(CHIBIOS)/os/sb/various/syscalls.c \
main.c main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global # C++ sources that can be compiled in ARM or THUMB mode depending on the global

View File

@ -123,7 +123,6 @@ LDSCRIPT= ./sandbox.ld
# setting. # setting.
CSRC = $(ALLCSRC) \ CSRC = $(ALLCSRC) \
$(TESTSRC) \ $(TESTSRC) \
$(CHIBIOS)/os/sb/various/syscalls.c \
main.c main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global # C++ sources that can be compiled in ARM or THUMB mode depending on the global

View File

@ -123,7 +123,6 @@ LDSCRIPT= ./sandbox.ld
# setting. # setting.
CSRC = $(ALLCSRC) \ CSRC = $(ALLCSRC) \
$(TESTSRC) \ $(TESTSRC) \
$(CHIBIOS)/os/sb/various/syscalls.c \
main.c main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global # C++ sources that can be compiled in ARM or THUMB mode depending on the global

View File

@ -123,7 +123,6 @@ LDSCRIPT= ./sandbox.ld
# setting. # setting.
CSRC = $(ALLCSRC) \ CSRC = $(ALLCSRC) \
$(TESTSRC) \ $(TESTSRC) \
$(CHIBIOS)/os/sb/various/syscalls.c \
main.c main.c
# C++ sources that can be compiled in ARM or THUMB mode depending on the global # C++ sources that can be compiled in ARM or THUMB mode depending on the global

View File

@ -20,6 +20,8 @@
#include <fcntl.h> #include <fcntl.h>
#include <dirent.h> #include <dirent.h>
#include <reent.h>
DIR *fdopendir(int fd) { DIR *fdopendir(int fd) {
DIR *dirp; DIR *dirp;
@ -53,13 +55,13 @@ int closedir (DIR *dirp) {
} }
struct dirent *readdir (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) { while (true) {
struct dirent *dep; struct dirent *dep;
if (dirp->next == 0) { 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) { if (dirp->size <= 0) {

View File

@ -142,12 +142,13 @@ caddr_t _sbrk_r(struct _reent *r, int incr) {
return (caddr_t)prevp; 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; ssize_t n;
n = sbPosixGetdents(fd, dp, count); n = sbPosixGetdents(fd, dp, count);
if (CH_RET_IS_ERROR(n)) { if (CH_RET_IS_ERROR(n)) {
errno = CH_DECODE_ERROR(n); __errno_r(r) = CH_DECODE_ERROR(n);
return -1; return -1;
} }