From 8fbd328317c7399e804ac0a98920b97fa36707a5 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Fri, 18 Aug 2017 01:02:24 +0200 Subject: [PATCH] jehanne: first try to enable posix (BROKEN) --- newlib/configure.host | 1 + newlib/libc/sys/jehanne/Makefile.am | 2 +- newlib/libc/sys/jehanne/closedir.c | 23 ++++++++++++ newlib/libc/sys/jehanne/sys/dirent.h | 53 ++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 newlib/libc/sys/jehanne/closedir.c create mode 100644 newlib/libc/sys/jehanne/sys/dirent.h diff --git a/newlib/configure.host b/newlib/configure.host index 5051d622c..cc64031ee 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -390,6 +390,7 @@ case "${host}" in *-*-jehanne*) sys_dir=jehanne syscall_dir=syscalls + posix_dir=posix newlib_cflags="${newlib_cflags} -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED" newlib_cflags="${newlib_cflags} -fno-omit-frame-pointer" default_newlib_io_c99_formats="yes" diff --git a/newlib/libc/sys/jehanne/Makefile.am b/newlib/libc/sys/jehanne/Makefile.am index 09de372f2..70e96e811 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 + calloc.c callocr.c realloc.c reallocr.c closedir.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 new file mode 100644 index 000000000..ae5e3200e --- /dev/null +++ b/newlib/libc/sys/jehanne/closedir.c @@ -0,0 +1,23 @@ +/* + * 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 new file mode 100644 index 000000000..f2df95ebf --- /dev/null +++ b/newlib/libc/sys/jehanne/sys/dirent.h @@ -0,0 +1,53 @@ +/* + * 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 . + */ +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H + +struct dirent +{ + ino_t d_ino; + char d_name[256]; +}; + +#define d_fileno d_ino /* Cheap backwards compatibility. */ +#define dirent64 dirent + +typedef struct DIR DIR; + +DIR *opendir(const char *); +struct dirent *readdir(DIR *); +int readdir_r(DIR *__restrict, struct dirent *__restrict, + struct dirent **__restrict); +void rewinddir(DIR *); +int dirfd(DIR *); +DIR *fdopendir(int); +int closedir(DIR *); + +#ifndef _POSIX_SOURCE +long telldir (DIR *); +void seekdir (DIR *, off_t loc); + +int scandir (const char *__dir, + struct dirent ***__namelist, + int (*select) (const struct dirent *), + int (*compar) (const struct dirent **, const struct dirent **)); + +int alphasort (const struct dirent **__a, const struct dirent **__b); +#endif /* _POSIX_SOURCE */ + +#endif