user: implement mlibc as the libc, finally.

It's finally done..

Signed-off-by: kaguya <vpshinomiya@protonmail.com>
This commit is contained in:
kaguya
2026-05-02 03:31:49 -04:00
parent 2fa39ad85a
commit 9a9b91c940
2387 changed files with 152741 additions and 315 deletions
@@ -0,0 +1,40 @@
#include <errno.h>
#include <net/if.h>
#include <stdlib.h>
#include <bits/ensure.h>
#include <mlibc/debug.hpp>
#include <mlibc/posix-sysdeps.hpp>
void if_freenameindex(struct if_nameindex *) {
mlibc::infoLogger() << "mlibc: if_freenameindex is a no-op" << frg::endlog;
}
char *if_indextoname(unsigned int index, char *name) {
auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_if_indextoname, NULL);
if(int e = sysdep(index, name); e) {
errno = e;
return nullptr;
}
return name;
}
struct if_nameindex *if_nameindex(void) {
mlibc::infoLogger() << "mlibc: if_nameindex() is a no-op" << frg::endlog;
errno = ENOSYS;
return nullptr;
}
unsigned int if_nametoindex(const char *name) {
auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_if_nametoindex, 0);
unsigned int ret = 0;
if(int e = sysdep(name, &ret); e) {
errno = e;
return 0;
}
return ret;
}