From d51e4c32c4aa930b3d5e614bf8cadd2e0549a833 Mon Sep 17 00:00:00 2001 From: Marian Ohligs Date: Tue, 8 Nov 2011 12:50:29 +0100 Subject: [PATCH] change makefiles, use own dirent.h --- newlib/src/libgloss/metalsvm/Makefile.in | 5 +++ .../libgloss/metalsvm/include/sys/dirent.h | 36 +++++++++++++++++++ newlib/src/libgloss/metalsvm/opendir.c | 4 +-- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 newlib/src/libgloss/metalsvm/include/sys/dirent.h diff --git a/newlib/src/libgloss/metalsvm/Makefile.in b/newlib/src/libgloss/metalsvm/Makefile.in index d72709e7..cc213e2e 100644 --- a/newlib/src/libgloss/metalsvm/Makefile.in +++ b/newlib/src/libgloss/metalsvm/Makefile.in @@ -70,6 +70,8 @@ METALSVM_OBJS = chown.o errno.o fork.o gettod.o kill.o open.o sbrk.o times.o wri #### Host specific Makefile fragment comes in here. @host_makefile_frag@ +INCLUDES += -I$(srcdir)/include + %.o : %.asm $(NASM) $(NASMFLAGS) -o $@ $< @@ -113,6 +115,9 @@ install: $($(CPU)_INSTALL) $(INSTALL_DATA) $(CRT0) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(CRT0) $(INSTALL_DATA) $(METALSVM_BSP) $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$(METALSVM_BSP) $(INSTALL_DATA) ${srcdir}/link.ld $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/link.ld + for i in ${srcdir}/include/sys/*.h; do \ + ${INSTALL_DATA} $$i ${DESTDIR}${tooldir}/include/sys/`basename $$i`; \ + done; clean mostlyclean: rm -f *.o *.a diff --git a/newlib/src/libgloss/metalsvm/include/sys/dirent.h b/newlib/src/libgloss/metalsvm/include/sys/dirent.h new file mode 100644 index 00000000..72804217 --- /dev/null +++ b/newlib/src/libgloss/metalsvm/include/sys/dirent.h @@ -0,0 +1,36 @@ +#ifndef _SYS_DIRENT_H +# define _SYS_DIRENT_H + +/* + * This file was written to be compatible with the BSD directory + * routines, so it looks like it. But it was written from scratch. + * Sean Eric Fagan, sef@Kithrup.COM + */ + +typedef struct _dirdesc { + int dd_fd; + long dd_loc; + long dd_size; + char *dd_buf; + int dd_len; + long dd_seek; +} DIR; + +# define __dirfd(dp) ((dp)->dd_fd) + +DIR *opendir (const char *); +struct dirent *readdir (DIR *); +void rewinddir (DIR *); +int closedir (DIR *); + +#include + +struct dirent { + long d_ino; + off_t d_off; + unsigned short d_reclen; + /* we need better syntax for variable-sized arrays */ + char d_name[1]; +}; + +#endif diff --git a/newlib/src/libgloss/metalsvm/opendir.c b/newlib/src/libgloss/metalsvm/opendir.c index c44052fa..948b57b0 100644 --- a/newlib/src/libgloss/metalsvm/opendir.c +++ b/newlib/src/libgloss/metalsvm/opendir.c @@ -52,10 +52,10 @@ _DEFUN (opendir, (name), DIR *dirp; int fd; - fd = open(name, 0) + fd = open(name, 0); if (fd < 0) return NULL; - dirp = (DIR *)malloc(sizeof(DIR)) + dirp = (DIR *)malloc(sizeof(DIR)); if (dirp == NULL) { close (fd); return NULL;