From 025678147e83b00604ee298149e671552242234f Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Sat, 19 Aug 2017 00:08:48 +0200 Subject: [PATCH] jehanne: fix sys/dirent.h (still BROKEN) --- newlib/libc/sys/jehanne/Makefile.am | 2 +- newlib/libc/sys/jehanne/closedir.c | 23 ----------------------- newlib/libc/sys/jehanne/sys/dirent.h | 20 ++++++++++++++++---- 3 files changed, 17 insertions(+), 28 deletions(-) delete mode 100644 newlib/libc/sys/jehanne/closedir.c diff --git a/newlib/libc/sys/jehanne/Makefile.am b/newlib/libc/sys/jehanne/Makefile.am index 70e96e811..09de372f2 100644 --- a/newlib/libc/sys/jehanne/Makefile.am +++ b/newlib/libc/sys/jehanne/Makefile.am @@ -11,7 +11,7 @@ extra_objs = endif lib_a_SOURCES = getenv_r.c getenv.c malloc.c mallocr.c free.c freer.c \ - calloc.c callocr.c realloc.c reallocr.c closedir.c + calloc.c callocr.c realloc.c reallocr.c lib_a_LIBADD = $(extra_objs) EXTRA_lib_a_SOURCES = libposix_conf.c syscalls.c diff --git a/newlib/libc/sys/jehanne/closedir.c b/newlib/libc/sys/jehanne/closedir.c deleted file mode 100644 index ae5e3200e..000000000 --- a/newlib/libc/sys/jehanne/closedir.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This file is part of Jehanne. - * - * Copyright (C) 2017 Giacomo Tesio - * - * This is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, version 3 of the License. - * - * Jehanne is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Jehanne. If not, see . - */ -int -closedir(DIR *) -{ - /* TODO: implement */ - return -1; -} diff --git a/newlib/libc/sys/jehanne/sys/dirent.h b/newlib/libc/sys/jehanne/sys/dirent.h index f2df95ebf..03107cf6e 100644 --- a/newlib/libc/sys/jehanne/sys/dirent.h +++ b/newlib/libc/sys/jehanne/sys/dirent.h @@ -18,16 +18,28 @@ #ifndef _SYS_DIRENT_H #define _SYS_DIRENT_H +#define MAXNAMLEN 127 /* sizeof(struct dirent.d_name)-1 */ + struct dirent { ino_t d_ino; - char d_name[256]; + char d_name[MAXNAMLEN+1]; }; -#define d_fileno d_ino /* Cheap backwards compatibility. */ -#define dirent64 dirent +typedef struct { + int dd_fd; /* Directory file. */ + int dd_loc; /* Position in buffer. */ + int dd_seek; + char *dd_buf; /* Pointer to buffer. */ + int dd_len; /* Buffer size. */ + int dd_size; /* Data size in buffer. */ +} DIR; -typedef struct DIR DIR; +#define d_fileno d_ino /* Cheap backwards compatibility. */ + +#ifdef __USE_LARGEFILE64 +#define dirent64 dirent +#endif DIR *opendir(const char *); struct dirent *readdir(DIR *);