change makefiles, use own dirent.h

This commit is contained in:
Marian Ohligs 2011-11-08 12:50:29 +01:00
parent dfc0f6026f
commit d51e4c32c4
3 changed files with 43 additions and 2 deletions

View file

@ -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

View file

@ -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 <sys/types.h>
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

View file

@ -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;