From 719a93482d5ed11dda54699285418918c3f85750 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Wed, 26 Oct 2022 15:33:12 +0200 Subject: [PATCH] DRAFT lib: Add sysconf stub. * lib/stub/sysconf.c: New file. * include/unistd.h (sysconf): Add prototype. --- build-aux/configure-lib.sh | 1 + include/unistd.h | 3 ++- lib/stub/sysconf.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 lib/stub/sysconf.c diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index df39f3ae..8f7b8cb1 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -399,6 +399,7 @@ lib/stub/sin.c lib/stub/sqrt.c lib/stub/strftime.c lib/stub/sys_siglist.c +lib/stub/sysconf.c lib/stub/system.c lib/stub/times.c lib/stub/ttyname.c diff --git a/include/unistd.h b/include/unistd.h index 86353729..2b1ac6cf 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * GNU Mes --- Maxwell Equations of Software - * Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen + * Copyright © 2017,2018,2022 Jan (janneke) Nieuwenhuizen * * This file is part of GNU Mes. * @@ -90,6 +90,7 @@ char *sbrk (ptrdiff_t delta); void *sbrk (intptr_t delta); #endif int symlink (char const *old_name, char const *new_name); +long sysconf (int name); int unlink (char const *file_name); ssize_t write (int filedes, void const *buffer, size_t size); diff --git a/lib/stub/sysconf.c b/lib/stub/sysconf.c new file mode 100644 index 00000000..8e87b379 --- /dev/null +++ b/lib/stub/sysconf.c @@ -0,0 +1,32 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2022 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 +sysconf (int name) +{ + static int stub = 0; + if (__mes_debug () && !stub) + eputs ("sysconf stub\n"); + stub = 1; + return -1; +}