From 72c76d6b3aaa1b889df4fd7b5d68a0863b32e7c8 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sat, 27 Apr 2019 06:21:10 -0400 Subject: [PATCH] hurd: Add stubs for missing libc+tcc functions. * lib/stub/close.c: New file. * lib/stub/rmdir.c: New file. * lib/stub/stat.c: New file. * build-aux/configure-lib.sh (libc_tcc_SOURCES)[gnu]: Add them. --- build-aux/configure-lib.sh | 8 ++++++++ lib/stub/close.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/rmdir.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/stat.c | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 lib/stub/close.c create mode 100644 lib/stub/rmdir.c create mode 100644 lib/stub/stat.c diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index d16a24f2..08ad2baa 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -267,6 +267,14 @@ lib/linux/stat.c " fi +if test $mes_kernel = gnu; then + libc_tcc_SOURCES="$libc_tcc_SOURCES +lib/stub/close.c +lib/stub/rmdir.c +lib/stub/stat.c +" +fi + libc_gnu_SOURCES=" $libc_tcc_SOURCES lib/ctype/isalnum.c diff --git a/lib/stub/close.c b/lib/stub/close.c new file mode 100644 index 00000000..a7120672 --- /dev/null +++ b/lib/stub/close.c @@ -0,0 +1,34 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2019 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes 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 General Public License + * along with GNU Mes. If not, see . + */ + +#include +#include +#include + +int +close (int filedes) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("close\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/rmdir.c b/lib/stub/rmdir.c new file mode 100644 index 00000000..ded6df21 --- /dev/null +++ b/lib/stub/rmdir.c @@ -0,0 +1,34 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2019 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes 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 General Public License + * along with GNU Mes. If not, see . + */ + +#include +#include +#include + +int +rmdir (char const *file_name) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("rmdir\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/stat.c b/lib/stub/stat.c new file mode 100644 index 00000000..85514f23 --- /dev/null +++ b/lib/stub/stat.c @@ -0,0 +1,35 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2019 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes 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 General Public License + * along with GNU Mes. If not, see . + */ + +#include +#include +#include +#include + +int +stat (char const *file_name, struct stat *statbuf) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("stat\n"); + stub = 1; + errno = 0; + return 0; +}