From 49ff9a7edd9b553a109b4dbf1e85e1426e44dd78 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Tue, 12 Mar 2019 22:14:25 +0100 Subject: [PATCH] hurd: Add stubs for missing libc functions. * lib/stub/_getcwd.c: New file. * lib/stub/_getcwd.c: New file. * lib/stub/_open3.c: New file. * lib/stub/access.c: New file. * lib/stub/brk.c: New file. * lib/stub/chmod.c: New file. * lib/stub/clock_gettime.c: New file. * lib/stub/dup.c: New file. * lib/stub/dup2.c: New file. * lib/stub/execve.c: New file. * lib/stub/fork.c: New file. * lib/stub/gettimeofday.c: New file. * lib/stub/ioctl.c: New file. * lib/stub/time.c: New file. * lib/stub/unlink.c: New file. * lib/stub/waitpid.c: New file. * build-aux/configure-lib.sh (libc_SOURCES)[gnu]: Add them. --- build-aux/configure-lib.sh | 15 +++++++++++++++ lib/stdio/vfscanf.c | 1 + lib/stub/_getcwd.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/_open3.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/access.c | 33 +++++++++++++++++++++++++++++++++ lib/stub/brk.c | 33 +++++++++++++++++++++++++++++++++ lib/stub/chmod.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/clock_gettime.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/dup.c | 33 +++++++++++++++++++++++++++++++++ lib/stub/dup2.c | 33 +++++++++++++++++++++++++++++++++ lib/stub/execve.c | 33 +++++++++++++++++++++++++++++++++ lib/stub/fork.c | 33 +++++++++++++++++++++++++++++++++ lib/stub/gettimeofday.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/ioctl.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/time.c | 34 ++++++++++++++++++++++++++++++++++ lib/stub/unlink.c | 33 +++++++++++++++++++++++++++++++++ lib/stub/waitpid.c | 34 ++++++++++++++++++++++++++++++++++ 17 files changed, 519 insertions(+) create mode 100644 lib/stub/_getcwd.c create mode 100644 lib/stub/_open3.c create mode 100644 lib/stub/access.c create mode 100644 lib/stub/brk.c create mode 100644 lib/stub/chmod.c create mode 100644 lib/stub/clock_gettime.c create mode 100644 lib/stub/dup.c create mode 100644 lib/stub/dup2.c create mode 100644 lib/stub/execve.c create mode 100644 lib/stub/fork.c create mode 100644 lib/stub/gettimeofday.c create mode 100644 lib/stub/ioctl.c create mode 100644 lib/stub/time.c create mode 100644 lib/stub/unlink.c create mode 100644 lib/stub/waitpid.c diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index fa5d8db6..d16a24f2 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -159,6 +159,21 @@ if test $mes_kernel = gnu; then lib/gnu/_read.c lib/gnu/fd-read.c lib/gnu/io-read.c +lib/stub/access.c +lib/stub/brk.c +lib/stub/chmod.c +lib/stub/clock_gettime.c +lib/stub/dup2.c +lib/stub/dup.c +lib/stub/execve.c +lib/stub/fork.c +lib/stub/_getcwd.c +lib/stub/gettimeofday.c +lib/stub/ioctl.c +lib/stub/_open3.c +lib/stub/time.c +lib/stub/unlink.c +lib/stub/waitpid.c " fi diff --git a/lib/stdio/vfscanf.c b/lib/stdio/vfscanf.c index efa957a2..b1083a56 100644 --- a/lib/stdio/vfscanf.c +++ b/lib/stdio/vfscanf.c @@ -19,6 +19,7 @@ */ #include +#include #include #include diff --git a/lib/stub/_getcwd.c b/lib/stub/_getcwd.c new file mode 100644 index 00000000..8ae76b95 --- /dev/null +++ b/lib/stub/_getcwd.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 + +char * +_getcwd (char *buffer, size_t size) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("_getcwd stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/_open3.c b/lib/stub/_open3.c new file mode 100644 index 00000000..b90dea49 --- /dev/null +++ b/lib/stub/_open3.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 +_open3 (char const *file_name, int flags, int mask) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("open3 stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/access.c b/lib/stub/access.c new file mode 100644 index 00000000..f635f6e0 --- /dev/null +++ b/lib/stub/access.c @@ -0,0 +1,33 @@ +/* -*-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 + +int +access (char const *file_name, int how) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("access stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/brk.c b/lib/stub/brk.c new file mode 100644 index 00000000..7ab45a60 --- /dev/null +++ b/lib/stub/brk.c @@ -0,0 +1,33 @@ +/* -*-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 + +long +brk (void *addr) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("brk stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/chmod.c b/lib/stub/chmod.c new file mode 100644 index 00000000..1c8a7d4c --- /dev/null +++ b/lib/stub/chmod.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 +chmod (char const *file_name, mode_t mask) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("chmod stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/clock_gettime.c b/lib/stub/clock_gettime.c new file mode 100644 index 00000000..4b20c01b --- /dev/null +++ b/lib/stub/clock_gettime.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 +clock_gettime (clockid_t clk_id, struct timespec *tp) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("umask stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/dup.c b/lib/stub/dup.c new file mode 100644 index 00000000..75bc27e3 --- /dev/null +++ b/lib/stub/dup.c @@ -0,0 +1,33 @@ +/* -*-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 + +int +dup (int old) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("dup stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/dup2.c b/lib/stub/dup2.c new file mode 100644 index 00000000..c3a59391 --- /dev/null +++ b/lib/stub/dup2.c @@ -0,0 +1,33 @@ +/* -*-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 + +int +dup2 (int old, int new) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("dup2 stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/execve.c b/lib/stub/execve.c new file mode 100644 index 00000000..d1f0cc5f --- /dev/null +++ b/lib/stub/execve.c @@ -0,0 +1,33 @@ +/* -*-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 + +int +execve (char const *file_name, char *const argv[], char *const env[]) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("execve stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/fork.c b/lib/stub/fork.c new file mode 100644 index 00000000..e23a7ced --- /dev/null +++ b/lib/stub/fork.c @@ -0,0 +1,33 @@ +/* -*-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 + +int +fork () +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("fork stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/gettimeofday.c b/lib/stub/gettimeofday.c new file mode 100644 index 00000000..cf825688 --- /dev/null +++ b/lib/stub/gettimeofday.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 +gettimeofday (struct timeval *tv, struct timezone *tz) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("gettimeofday stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/ioctl.c b/lib/stub/ioctl.c new file mode 100644 index 00000000..06699aeb --- /dev/null +++ b/lib/stub/ioctl.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 +ioctl (int filedes, unsigned long command, ...) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("ioctl stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/time.c b/lib/stub/time.c new file mode 100644 index 00000000..71d846aa --- /dev/null +++ b/lib/stub/time.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 + +time_t +time (time_t *result) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("time stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/unlink.c b/lib/stub/unlink.c new file mode 100644 index 00000000..cda6c678 --- /dev/null +++ b/lib/stub/unlink.c @@ -0,0 +1,33 @@ +/* -*-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 + +int +unlink (char const *file_name) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("unlink stub\n"); + stub = 1; + errno = 0; + return 0; +} diff --git a/lib/stub/waitpid.c b/lib/stub/waitpid.c new file mode 100644 index 00000000..660b7ae6 --- /dev/null +++ b/lib/stub/waitpid.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 + +pid_t +waitpid (pid_t pid, int *status_ptr, int options) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("waitpid stub\n"); + stub = 1; + errno = 0; + return 0; +}