libc: patch in more missing features

This commit is contained in:
Ehmry - 2020-12-02 17:30:43 +01:00
parent 1c057662e6
commit df948cc6d8

View File

@ -1,29 +1,38 @@
commit f3a7fb548c8600a6e290d306b933725ebc546cd0
Author: Emery Hemingway <ehmry@posteo.net>
Date: Wed May 6 04:38:35 2020 +0530
From 017abdc7a59acf7e76109b7fd285f9856b4a9eee Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 6 May 2020 04:38:35 +0530
Subject: [PATCH 1/7] libc: add siginterrupt dummy
libc: add siginterrupt dummy
---
repos/libports/src/lib/libc/signal.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/repos/libports/src/lib/libc/signal.cc b/repos/libports/src/lib/libc/signal.cc
index dc9af2d443..784257c48e 100644
index a08854a8c0..2d2def34d3 100644
--- a/repos/libports/src/lib/libc/signal.cc
+++ b/repos/libports/src/lib/libc/signal.cc
@@ -131,6 +131,9 @@ extern "C" int sigaction(int signum, const struct sigaction *act, struct sigacti
}
+extern "C" int siginterrupt(int sig, int flag) { return 0; };
+
+
extern "C" int _sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction")));
extern "C" int __sys_sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction")));
extern "C" int __libc_sigaction(int, const struct sigaction *, struct sigaction *) __attribute__((weak, alias("sigaction")));
--
2.29.2
commit 65244c99c250767922b9afca9663ddcb7a7753f8
Author: Emery Hemingway <ehmry@posteo.net>
Date: Wed May 6 04:59:56 2020 +0530
libc: add upstream mbsinit
From e73c873a6e329eef4dede312e0bd0e597c93adde Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 6 May 2020 04:59:56 +0530
Subject: [PATCH 2/7] libc: add upstream mbsinit
---
repos/libports/lib/mk/libc-locale.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/repos/libports/lib/mk/libc-locale.mk b/repos/libports/lib/mk/libc-locale.mk
index 8e75e59589..2bb98b1456 100644
@ -35,23 +44,30 @@ index 8e75e59589..2bb98b1456 100644
setlocale.c xlocale.c setrunelocale.c \
- ascii.c big5.c euc.co gb18030.c gb2312.c gbk.c mbsinit.c mskanji.c utf8.c \
+ ascii.c big5.c euc.co gb18030.c gb2312.c gbk.c mskanji.c utf8.c \
SRC_C = $(filter-out $(FILTER_OUT),$(notdir $(wildcard $(LIBC_LOCALE_DIR)/*.c)))
--
2.29.2
commit 81fc78f8e0ac66a7275e149f7f7fdc5f4f1f2979
Author: Emery Hemingway <ehmry@posteo.net>
Date: Wed May 27 16:35:16 2020 +0530
libc: add mlock and munlock dummies
From 98d8ef8e3fa37076fab524b6830229f347c89feb Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 27 May 2020 16:35:16 +0530
Subject: [PATCH 3/7] libc: add mlock and munlock dummies
---
repos/libports/src/lib/libc/dummies.cc | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/repos/libports/src/lib/libc/dummies.cc b/repos/libports/src/lib/libc/dummies.cc
index 37c2c83f89..bc2f15a90a 100644
index b01d95f717..f676b4979c 100644
--- a/repos/libports/src/lib/libc/dummies.cc
+++ b/repos/libports/src/lib/libc/dummies.cc
@@ -221,5 +221,15 @@ int __attribute__((weak)) madvise(void *addr, size_t length, int advice)
@@ -218,5 +218,15 @@ int __attribute__((weak)) madvise(void *addr, size_t length, int advice)
const struct res_sym __p_type_syms[] = { };
+#define DUMMY_EPERM(ret_type, ret_val, name, args) __attribute__((weak)) \
+ret_type name args \
+{ \
@ -63,15 +79,22 @@ index 37c2c83f89..bc2f15a90a 100644
+DUMMY_EPERM(int, -1, munlock, (const void *, size_t));
+
} /* extern "C" */
--
2.29.2
commit f45e11626aca92be04bc9c8ed74f010ff62862dd
Author: Emery Hemingway <ehmry@posteo.net>
Date: Fri May 29 09:26:50 2020 +0530
libc: return 0 from getpgrp and getppid dummies
From a17d8387a9bbc7d340ed42cfcdc0adedce16f4dd Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Fri, 29 May 2020 09:26:50 +0530
Subject: [PATCH 4/7] libc: return 0 from getpgrp and getppid dummies
---
repos/libports/src/lib/libc/dummies.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/repos/libports/src/lib/libc/dummies.cc b/repos/libports/src/lib/libc/dummies.cc
index 150640ddf3..e511897600 100644
index f676b4979c..9c568dcc77 100644
--- a/repos/libports/src/lib/libc/dummies.cc
+++ b/repos/libports/src/lib/libc/dummies.cc
@@ -109,8 +109,8 @@ DUMMY(char *, 0, _getlogin, (void))
@ -85,10 +108,14 @@ index 150640ddf3..e511897600 100644
DUMMY(int , -1, getpriority, (int, int))
DUMMY(int , -1, getrusage, (int, rusage *))
DUMMY_SILENT(uid_t , 0, getuid, (void))
From 73a27bd29a3dddc9cad8fbbc6303dd09776e5bdb Mon Sep 17 00:00:00 2001
--
2.29.2
From 9f3375cdca705e3271f209de76beb19354a150e8 Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Thu, 26 Nov 2020 12:47:30 +0100
Subject: [PATCH] libc: always set argv and envp to valid arrays
Subject: [PATCH 5/7] libc: always set argv and envp to valid arrays
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@ -149,3 +176,110 @@ index 76645d82cb..ca9a8fd38a 100644
--
2.29.2
From dd89c66247bf751c87b09fffc7af15c04a59fd91 Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Wed, 2 Dec 2020 16:31:59 +0100
Subject: [PATCH 6/7] libc: implement if_nametoindex
---
.../libports/src/lib/libc/socket_fs_plugin.cc | 50 ++++++++++++++++++-
1 file changed, 49 insertions(+), 1 deletion(-)
diff --git a/repos/libports/src/lib/libc/socket_fs_plugin.cc b/repos/libports/src/lib/libc/socket_fs_plugin.cc
index d5db46ff83..fabaf68b5c 100644
--- a/repos/libports/src/lib/libc/socket_fs_plugin.cc
+++ b/repos/libports/src/lib/libc/socket_fs_plugin.cc
@@ -33,6 +33,8 @@
#include <stdio.h>
#include <sys/ioctl.h>
#include <ifaddrs.h>
+#include <sys/types.h>
+#include <sys/socket.h>
#include <net/if.h>
/* libc-internal includes */
@@ -1128,7 +1130,53 @@ extern "C" int getifaddrs(struct ifaddrs **ifap)
}
-extern "C" void freeifaddrs(struct ifaddrs *) { }
+extern "C" void freeifaddrs(struct ifaddrs *)
+{
+}
+
+
+static char const * static_if_name = "eth0";
+
+
+extern "C" unsigned int
+if_nametoindex(const char *ifname)
+{
+ return ::strcmp(ifname, static_if_name) ? 0 : 1;
+}
+
+
+extern "C" char *
+if_indextoname(unsigned int ifindex, char *ifname)
+{
+ if (ifindex == 1) {
+ strncpy(ifname, static_if_name, IFNAMSIZ);
+ return ifname;
+ }
+ return NULL;
+}
+
+
+extern "C" struct if_nameindex *
+if_nameindex(void)
+{
+ static struct if_nameindex if_ni_array[2] = {
+ {
+ .if_index = 1,
+ .if_name = (char *)static_if_name
+ },
+ {
+ .if_index = 0,
+ .if_name = NULL
+ }
+ };
+
+ return if_ni_array;
+}
+
+
+extern "C" void if_freenameindex(struct if_nameindex *ptr)
+{
+}
/****************************
--
2.29.2
From 1f249e18ea3972911c1405deb40afd85b8d64dea Mon Sep 17 00:00:00 2001
From: Emery Hemingway <ehmry@posteo.net>
Date: Thu, 4 Jun 2020 01:03:37 +0530
Subject: [PATCH 7/7] libc: add readpassphrase
This symbol is already in the stub library.
---
repos/libports/lib/mk/libc-gen.inc | 1 -
1 file changed, 1 deletion(-)
diff --git a/repos/libports/lib/mk/libc-gen.inc b/repos/libports/lib/mk/libc-gen.inc
index ab0ce929aa..1c7f84e800 100644
--- a/repos/libports/lib/mk/libc-gen.inc
+++ b/repos/libports/lib/mk/libc-gen.inc
@@ -40,7 +40,6 @@ FILTER_OUT_C += \
getentropy.c \
getutxent.c \
pututxline.c \
- readpassphrase.c \
scandir_b.c \
sem_new.c \
signal.c \
--
2.29.2