diff --git mlibc-clean/abis/linux/in.h mlibc-workdir/abis/linux/in.h index 87bc25f..d7370d0 100644 --- mlibc-clean/abis/linux/in.h +++ mlibc-workdir/abis/linux/in.h @@ -109,6 +109,9 @@ struct group_source_req { #define IPPORT_RESERVED 1024 +#define IP_MULTICAST_TTL 33 +#define IPV6_MULTICAST_HOPS 18 + #define IPPROTO_IP 0 #define IPPROTO_HOPOPTS 0 #define IPPROTO_ICMP 1 diff --git mlibc-clean/options/ansi/generic/environment.cpp mlibc-workdir/options/ansi/generic/environment.cpp index 5625592..36b42ee 100644 --- mlibc-clean/options/ansi/generic/environment.cpp +++ mlibc-workdir/options/ansi/generic/environment.cpp @@ -111,8 +111,10 @@ namespace mlibc { int putenv(char *string) { frg::string_view view{string}; size_t s = view.find_first('='); - if(s == size_t(-1)) - __ensure(!"Environment strings need to contain an equals sign"); + if(s == size_t(-1)) { + unsetenv(string); + return 0; + } update_vector(); assign_variable(view.sub_string(0, s), string, true); diff --git mlibc-clean/options/ansi/generic/string.cpp mlibc-workdir/options/ansi/generic/string.cpp index 8defd0e..d6cb65b 100644 --- mlibc-clean/options/ansi/generic/string.cpp +++ mlibc-workdir/options/ansi/generic/string.cpp @@ -406,7 +406,6 @@ char *strerror(int e) { case ENOPROTOOPT: s = "Protocol not available (ENOPROTOOPT)"; break; case ENOTEMPTY: s = "Directory not empty (ENOTEMPTY)"; break; case ENOTRECOVERABLE: s = "Sate not recoverable (ENOTRECOVERABLE)"; break; - case ENOTSUP: s = "Operation not supported (ENOTSUP)"; break; case ENOTTY: s = "Inappropriate ioctl for device (ENOTTY)"; break; case EOVERFLOW: s = "Value too large for defined datatype (EOVERFLOW)"; break; #if EOPNOTSUPP != ENOTSUP diff --git mlibc-clean/options/crypt/generic/crypt.cpp mlibc-workdir/options/crypt/generic/crypt.cpp index 65e0d23..95b060c 100644 --- mlibc-clean/options/crypt/generic/crypt.cpp +++ mlibc-workdir/options/crypt/generic/crypt.cpp @@ -1,7 +1,8 @@ #include #include +#include -char *crypt(const char *, const char *) { +char *crypt(const char *passwd, const char *) { __ensure(!"Not implemented"); __builtin_unreachable(); } diff --git mlibc-clean/options/glibc/generic/execinfo.cpp mlibc-workdir/options/glibc/generic/execinfo.cpp index 3474615..e034881 100644 --- mlibc-clean/options/glibc/generic/execinfo.cpp +++ mlibc-workdir/options/glibc/generic/execinfo.cpp @@ -1,9 +1,10 @@ #include #include +#include int backtrace(void **, int) { - __ensure(!"Not implemented"); - __builtin_unreachable(); + mlibc::infoLogger() << "libc: backtrace() is not implemented!\n" << frg::endlog; + return 0; } char **backtrace_symbols(void *const *, int) { diff --git mlibc-clean/options/posix/generic/dlfcn.cpp mlibc-workdir/options/posix/generic/dlfcn.cpp index fc34a3b..b1a95a9 100644 --- mlibc-clean/options/posix/generic/dlfcn.cpp +++ mlibc-workdir/options/posix/generic/dlfcn.cpp @@ -1,4 +1,4 @@ - +#define _GNU_SOURCE #include #include diff --git mlibc-clean/options/posix/generic/unistd.cpp mlibc-workdir/options/posix/generic/unistd.cpp index 444ad22..d1ca86e 100644 --- mlibc-clean/options/posix/generic/unistd.cpp +++ mlibc-workdir/options/posix/generic/unistd.cpp @@ -484,8 +484,9 @@ int lockf(int fd, int op, off_t size) { } int nice(int) { - __ensure(!"Not implemented"); - __builtin_unreachable(); + return EPERM; + //__ensure(!"Not implemented"); + //__builtin_unreachable(); } long pathconf(const char *, int name) { diff --git mlibc-clean/options/rtld/generic/main.cpp mlibc-workdir/options/rtld/generic/main.cpp index 9219ef0..1ff679c 100644 --- mlibc-clean/options/rtld/generic/main.cpp +++ mlibc-workdir/options/rtld/generic/main.cpp @@ -17,6 +17,8 @@ #include "elf.hpp" #include "linker.hpp" +#define _GNU_SOURCE + #if __MLIBC_POSIX_OPTION #include #endif diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp index 2a504ab..61c3bf0 100644 --- mlibc-clean/sysdeps/astral/generic/generic.cpp +++ mlibc-workdir/sysdeps/astral/generic/generic.cpp @@ -31,6 +31,12 @@ namespace mlibc { return 0; } + int sys_getcpu(int *cpu) { + *cpu = 0; + // TODO unstub + return 0; + } + int sys_getsockopt(int fd, int layer, int number, void *__restrict buffer, socklen_t *__restrict size) { (void)size; @@ -161,7 +167,18 @@ namespace mlibc { *bytes_written = writec; return error; } - + + int sys_getrlimit(int resource, struct rlimit *limit) { + switch(resource) { + case RLIMIT_NOFILE: + limit->rlim_cur = RLIM_INFINITY; + limit->rlim_max = RLIM_INFINITY; + return 0; + default: + return EINVAL; + } + } + #ifndef MLIBC_BUILDING_RTLD typedef struct { @@ -487,6 +504,12 @@ namespace mlibc { return ret; } + pid_t sys_gettid() { + long ret; + syscall(SYSCALL_GETTID, &ret); + return ret; + } + #ifndef MLIBC_BUILDING_RTLD [[noreturn]] void sys_thread_exit() {