From 83addd3bcbbcaa6e2257f46a5093e9e4a6dec01c Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 6 Sep 2026 00:52:43 -0300 Subject: [PATCH] mlibc: update --- patches/frigg/jinx-working-patch.patch | 4 +- patches/mlibc/jinx-working-patch.patch | 792 +------------------------ recipes/frigg | 2 +- recipes/mlibc | 2 +- recipes/mlibc-headers | 2 +- source-recipes/frigg | 4 +- source-recipes/mlibc | 4 +- 7 files changed, 17 insertions(+), 793 deletions(-) diff --git a/patches/frigg/jinx-working-patch.patch b/patches/frigg/jinx-working-patch.patch index 8a4d58be..2ff2267c 100644 --- a/patches/frigg/jinx-working-patch.patch +++ b/patches/frigg/jinx-working-patch.patch @@ -1,5 +1,5 @@ diff --git frigg-clean/include/frg/formatting.hpp frigg-workdir/include/frg/formatting.hpp -index a6c89d39..f066c03c 100644 +index a6c89d3..f066c03 100644 --- frigg-clean/include/frg/formatting.hpp +++ frigg-workdir/include/frg/formatting.hpp @@ -341,7 +341,9 @@ namespace _fmt_basics { @@ -98,7 +98,7 @@ index a6c89d39..f066c03c 100644 #endif /* __STDC_HOSTED__ */ }; diff --git frigg-clean/include/frg/printf.hpp frigg-workdir/include/frg/printf.hpp -index bce5e241..c4558f85 100644 +index bce5e24..c4558f8 100644 --- frigg-clean/include/frg/printf.hpp +++ frigg-workdir/include/frg/printf.hpp @@ -991,7 +991,8 @@ void do_printf_floats(S &sink, Char t, format_options opts, diff --git a/patches/mlibc/jinx-working-patch.patch b/patches/mlibc/jinx-working-patch.patch index 4ecef0e4..d076bc3c 100644 --- a/patches/mlibc/jinx-working-patch.patch +++ b/patches/mlibc/jinx-working-patch.patch @@ -1,5 +1,5 @@ diff --git mlibc-clean/options/glibc/generic/stdio_ext.cpp mlibc-workdir/options/glibc/generic/stdio_ext.cpp -index ccb37257..3dfa27af 100644 +index ccb3725..3dfa27a 100644 --- mlibc-clean/options/glibc/generic/stdio_ext.cpp +++ mlibc-workdir/options/glibc/generic/stdio_ext.cpp @@ -71,14 +71,38 @@ size_t __freadahead(FILE *file_base) { @@ -53,7 +53,7 @@ index ccb37257..3dfa27af 100644 } - diff --git mlibc-clean/options/internal/include/mlibc/allocator.hpp mlibc-workdir/options/internal/include/mlibc/allocator.hpp -index a8890506..e8c74a66 100644 +index d5496df..4dac6db 100644 --- mlibc-clean/options/internal/include/mlibc/allocator.hpp +++ mlibc-workdir/options/internal/include/mlibc/allocator.hpp @@ -11,6 +11,8 @@ @@ -66,7 +66,7 @@ index a8890506..e8c74a66 100644 void unmap(uintptr_t address, size_t length); diff --git mlibc-clean/options/linux/generic/malloc.cpp mlibc-workdir/options/linux/generic/malloc.cpp -index 065de6c1..10c73955 100644 +index 065de6c..10c7395 100644 --- mlibc-clean/options/linux/generic/malloc.cpp +++ mlibc-workdir/options/linux/generic/malloc.cpp @@ -1,7 +1,13 @@ @@ -88,7 +88,7 @@ index 065de6c1..10c73955 100644 + return ptr; } diff --git mlibc-clean/options/posix/generic/monetary.cpp mlibc-workdir/options/posix/generic/monetary.cpp -index 55a567aa..d1d77873 100644 +index 55a567a..d1d7787 100644 --- mlibc-clean/options/posix/generic/monetary.cpp +++ mlibc-workdir/options/posix/generic/monetary.cpp @@ -389,6 +389,8 @@ ssize_t strfmon_internal(char *__restrict s, size_t maxsize, mlibc::localeinfo * @@ -101,7 +101,7 @@ index 55a567aa..d1d77873 100644 ); diff --git mlibc-clean/options/posix/include/bits/posix/posix_stdio.h mlibc-workdir/options/posix/include/bits/posix/posix_stdio.h -index f0d6edd1..ab57b6b1 100644 +index f0d6edd..ab57b6b 100644 --- mlibc-clean/options/posix/include/bits/posix/posix_stdio.h +++ mlibc-workdir/options/posix/include/bits/posix/posix_stdio.h @@ -63,6 +63,7 @@ char *fgetln(FILE *__stream, size_t *__size); @@ -117,785 +117,9 @@ index f0d6edd1..ab57b6b1 100644 #endif /* _MLIBC_POSIX_STDIO_H */ - -diff --git mlibc-clean/sysdeps/astral/generic/astral.cpp mlibc-workdir/sysdeps/astral/generic/astral.cpp -index a86353f3..3e1a18c2 100644 ---- mlibc-clean/sysdeps/astral/generic/astral.cpp -+++ mlibc-workdir/sysdeps/astral/generic/astral.cpp -@@ -1,13 +1,25 @@ - #include - #include -+#include - #include - - #ifndef MLIBC_BUILDING_RTLD - -+int sysctl(const int *name, size_t name_len, void *oldp, size_t *old_lenp, void *newp, size_t new_len) { -+ long ret; -+ long error = syscall(SYSCALL_SYSCTL, &ret, (uint64_t)name, name_len, (uint64_t)oldp, (uint64_t)old_lenp, (uint64_t)newp, new_len); -+ if (error) { -+ errno = error; -+ return -1; -+ } -+ -+ return 0; -+} -+ - int arch_ctl(int func, void *arg) { - long ret; - long error = syscall(SYSCALL_ARCHCTL, &ret, func, (uint64_t)arg); -- if(error) -+ if (error) - errno = error; - return error ? -1 : ret; - } -diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp -index 3b043726..84bec4d3 100644 ---- mlibc-clean/sysdeps/astral/generic/generic.cpp -+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp -@@ -1,9 +1,12 @@ - #include -+#include - #include - #include - #include -+#include - #include - #include -+#include - #include - #include - #include -@@ -11,10 +14,50 @@ - #include - #include - #include -+#include -+#include -+#include -+#include - #include - #include -+#include -+ -+typedef struct { -+ struct sockaddr addr; -+ struct sockaddr broadaddr; -+ struct sockaddr netmask; -+ struct sockaddr hwaddr; -+ short flags; -+ int mtu; -+} astral_net_info_t; -+ -+typedef struct { -+ struct ifaddrs ifa; -+ unsigned int if_index; -+ char if_name[IFNAMSIZ]; -+ struct sockaddr addr; -+ struct sockaddr broadaddr; -+ struct sockaddr netmask; -+} astral_ifaddrs_t; - - namespace mlibc { -+ int Sysdeps::operator()(int number, long *result) { -+ if (number != _SC_NPROCESSORS_CONF && number != _SC_NPROCESSORS_ONLN) -+ return EINVAL; -+ -+ int name[] = {SYS_CTL_HW, SYS_CTL_HW_CPUS_ONLINE}; -+ size_t cpus_online; -+ size_t size = sizeof(cpus_online); -+ long ret; -+ int error = syscall(SYSCALL_SYSCTL, &ret, (uint64_t)name, 2, -+ (uint64_t)&cpus_online, (uint64_t)&size, 0, 0); -+ if (error) -+ return error; -+ -+ *result = cpus_online; -+ return 0; -+ } -+ - int Sysdeps::operator()(size_t size, const gid_t *list) { - (void)size; - (void)list; -@@ -31,15 +74,333 @@ namespace mlibc { - return 0; - } - -- int Sysdeps::operator()(int fd, int layer, int number, -- void *__restrict buffer, socklen_t *__restrict size) { -+ int Sysdeps::operator()(double *samples) { -+ struct sysinfo si; -+ if(int e = sysdep(&si); e) -+ return e; -+ -+ for(int i = 0; i < 3; i++) -+ samples[i] = (double)si.loads[i] / (1 << SI_LOAD_SHIFT); -+ -+ return 0; -+ } -+ -+ int Sysdeps::operator()(struct tms *tms, clock_t *out) { -+ if(tms) { -+ tms->tms_utime = 0; -+ tms->tms_stime = 0; -+ tms->tms_cutime = 0; -+ tms->tms_cstime = 0; -+ } -+ -+ *out = 0; -+ return 0; -+ } -+ -+ int Sysdeps::operator()(int fd, off_t offset, off_t length, int advice) { -+ (void)fd; -+ (void)offset; -+ (void)length; -+ (void)advice; -+ return 0; -+ } -+ -+ int Sysdeps::operator()(const char *path, const char *name, -+ const void *val, size_t size, int flags) { -+ (void)path; -+ (void)name; -+ (void)val; - (void)size; -- (void)buffer; -- // TODO unstub -- mlibc::infoLogger() << "getsockopt: " << fd << " " << layer << " " << number << frg::endlog; -+ (void)flags; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(const char *path, const char *name, -+ const void *val, size_t size, int flags) { -+ (void)path; -+ (void)name; -+ (void)val; -+ (void)size; -+ (void)flags; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(int fd, const char *name, const void *val, -+ size_t size, int flags) { -+ (void)fd; -+ (void)name; -+ (void)val; -+ (void)size; -+ (void)flags; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(const char *path, const char *name, -+ void *val, size_t size, ssize_t *nread) { -+ (void)path; -+ (void)name; -+ (void)val; -+ (void)size; -+ (void)nread; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(const char *path, const char *name, -+ void *val, size_t size, ssize_t *nread) { -+ (void)path; -+ (void)name; -+ (void)val; -+ (void)size; -+ (void)nread; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(int fd, const char *name, void *val, -+ size_t size, ssize_t *nread) { -+ (void)fd; -+ (void)name; -+ (void)val; -+ (void)size; -+ (void)nread; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(const char *path, char *list, size_t size, -+ ssize_t *nread) { -+ (void)path; -+ (void)list; -+ (void)size; -+ (void)nread; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(const char *path, char *list, size_t size, -+ ssize_t *nread) { -+ (void)path; -+ (void)list; -+ (void)size; -+ (void)nread; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(int fd, char *list, size_t size, -+ ssize_t *nread) { -+ (void)fd; -+ (void)list; -+ (void)size; -+ (void)nread; -+ return ENOTSUP; -+ } -+ -+ int Sysdeps::operator()(void **stack_base, size_t *stack_size) { -+ *stack_size = 1024 * 1024 * 4; -+ *stack_base = (void *)(0x0000800000000000 - *stack_size); -+ return 0; -+ } -+ -+#ifndef MLIBC_BUILDING_RTLD -+ int Sysdeps::operator()(struct ifaddrs **out) { -+ struct ifaddrs *list = nullptr; -+ -+ int dirfd; -+ int error = sysdep("/dev/", O_DIRECTORY | O_RDONLY, 0, &dirfd); -+ if(error) -+ return error; -+ -+ struct dirent dent; -+ size_t bytes_read; -+ for(;;) { -+ error = sysdep(dirfd, &dent, sizeof(dent), &bytes_read); -+ if(error) -+ goto leave; -+ -+ if(bytes_read == 0) -+ break; -+ -+ struct stat st; -+ if(sysdep(fsfd_target::fd_path, dirfd, dent.d_name, AT_SYMLINK_NOFOLLOW, &st)) -+ continue; -+ -+ if(!S_ISCHR(st.st_mode) || major(st.st_rdev) != 10) -+ continue; -+ -+ if(strlen(dent.d_name) >= IFNAMSIZ) -+ continue; -+ -+ int fd; -+ error = sysdep(dirfd, dent.d_name, 0, 0, &fd); -+ if(error) -+ continue; -+ -+ astral_net_info_t net_info = {}; -+ int r; -+ error = sysdep(fd, 0x1337631, &net_info, &r); -+ if(error) { -+ sysdep(fd); -+ continue; -+ } -+ -+ astral_ifaddrs_t *next = (astral_ifaddrs_t *)calloc(1, sizeof(*next)); -+ if(!next) { -+ sysdep(fd); -+ error = ENOMEM; -+ goto leave; -+ } -+ -+ next->ifa.ifa_next = list; -+ next->if_index = minor(st.st_rdev) + 1; -+ -+ strcpy(next->if_name, dent.d_name); -+ next->ifa.ifa_name = next->if_name; -+ -+ next->ifa.ifa_flags = net_info.flags; -+ -+ if(net_info.addr.sa_family) { -+ memcpy(&next->addr, &net_info.addr, sizeof(next->addr)); -+ next->ifa.ifa_addr = &next->addr; -+ } -+ -+ if(net_info.netmask.sa_family) { -+ memcpy(&next->netmask, &net_info.netmask, sizeof(next->netmask)); -+ next->ifa.ifa_netmask = &next->netmask; -+ } -+ -+ if(net_info.broadaddr.sa_family) { -+ memcpy(&next->broadaddr, &net_info.broadaddr, sizeof(next->broadaddr)); -+ next->ifa.ifa_broadaddr = &next->broadaddr; -+ } -+ -+ next->ifa.ifa_data = nullptr; -+ -+ list = &next->ifa; -+ sysdep(fd); -+ } -+ -+ *out = list; -+ -+leave: -+ sysdep(dirfd); -+ if(error) -+ freeifaddrs(list); -+ return error; -+ } -+ -+ int Sysdeps::operator()(unsigned int index, char *name) { -+ if(!index || !name) -+ return EINVAL; -+ -+ struct ifaddrs *ifaddrs; -+ if(int e = sysdep(&ifaddrs); e) -+ return e; -+ -+ int error = ENXIO; -+ for(struct ifaddrs *it = ifaddrs; it; it = it->ifa_next) { -+ astral_ifaddrs_t *entry = (astral_ifaddrs_t *)it; -+ if(entry->if_index != index) -+ continue; -+ -+ strcpy(name, entry->if_name); -+ error = 0; -+ break; -+ } -+ -+ freeifaddrs(ifaddrs); -+ return error; -+ } -+ -+ int Sysdeps::operator()(const char *name, unsigned int *ret) { -+ if(!name) -+ return EINVAL; -+ -+ struct ifaddrs *ifaddrs; -+ if(int e = sysdep(&ifaddrs); e) -+ return e; -+ -+ int error = ENXIO; -+ for(struct ifaddrs *it = ifaddrs; it; it = it->ifa_next) { -+ astral_ifaddrs_t *entry = (astral_ifaddrs_t *)it; -+ if(strcmp(entry->if_name, name)) -+ continue; -+ -+ *ret = entry->if_index; -+ error = 0; -+ break; -+ } -+ -+ freeifaddrs(ifaddrs); -+ return error; -+ } -+ -+ int Sysdeps::operator()(struct if_nameindex **out) { -+ struct ifaddrs *ifaddrs; -+ if(int e = sysdep(&ifaddrs); e) -+ return e; -+ -+ struct ifaddrs *it = ifaddrs; -+ int count = 0; -+ while(it) { -+ ++count; -+ it = it->ifa_next; -+ } -+ -+ struct if_nameindex *arr = (struct if_nameindex *)malloc(sizeof(struct if_nameindex) * (count + 1)); -+ if(!arr) { -+ freeifaddrs(ifaddrs); -+ return ENOMEM; -+ } -+ -+ int i = 0; -+ for(struct ifaddrs *it = ifaddrs; it; it = it->ifa_next) { -+ astral_ifaddrs_t *entry = (astral_ifaddrs_t *)it; -+ -+ arr[i].if_index = entry->if_index; -+ arr[i].if_name = strdup(entry->if_name); -+ if(!arr[i].if_name) { -+ for(int j = 0; j < i; ++j) -+ free(arr[j].if_name); -+ free(arr); -+ freeifaddrs(ifaddrs); -+ return ENOMEM; -+ } -+ -+ ++i; -+ } -+ -+ arr[count].if_index = 0; -+ arr[count].if_name = nullptr; -+ -+ *out = arr; -+ freeifaddrs(ifaddrs); -+ -+ return 0; -+ } -+ -+ void Sysdeps::operator()(struct if_nameindex *ifn) { -+ if(!ifn) -+ return; -+ -+ for(auto it = ifn; it->if_index || it->if_name; ++it) -+ free(it->if_name); -+ free(ifn); -+ } -+#endif -+ -+ int Sysdeps::operator()(unsigned int initval, int flags, int *fd) { -+ long ret; -+ int error = syscall(SYSCALL_EVENTFD, &ret, initval, flags); -+ if (error) -+ return error; -+ -+ *fd = ret; - return 0; - } - -+ int Sysdeps::operator()(int fd, int layer, int number, -+ void *__restrict buffer, socklen_t *__restrict size) { -+ long ret; -+ return syscall(SYSCALL_GETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, (uint64_t)size); -+ } -+ - int Sysdeps::operator()(bool *ipv4, bool *ipv6) { - // there is no ipv6 support in the kernel currently and no way of checking for configured interfaces - *ipv4 = true; -@@ -47,6 +408,71 @@ namespace mlibc { - return 0; - } - -+ int Sysdeps::operator()(int fd) { -+ int r; -+ // unlockpt is a no-op kernel side, so use this to check for an invalid pty -+ return sysdep(fd, 0x13376167, nullptr, &r); -+ } -+ -+ int Sysdeps::operator()(const char *path, struct statfs *buf) { -+ struct statvfs stvfs; -+ int ret = sysdep(path, &stvfs); -+ if(ret) -+ return ret; -+ -+ buf->f_type = 0; /* statvfs has no f_type */ -+ buf->f_blocks = stvfs.f_blocks; -+ buf->f_bfree = stvfs.f_bfree; -+ buf->f_bavail = stvfs.f_bavail; -+ buf->f_files = stvfs.f_files; -+ buf->f_ffree = stvfs.f_ffree; -+ buf->f_fsid.__val[0] = (int)(stvfs.f_fsid & 0xFFFFFFFF); -+ buf->f_fsid.__val[1] = (int)(stvfs.f_fsid >> 32); -+ buf->f_namelen = stvfs.f_namemax; -+ buf->f_flags = stvfs.f_flag; -+ buf->f_bsize = stvfs.f_frsize; -+ buf->f_frsize = stvfs.f_bsize; -+ -+ return 0; -+ } -+ -+ int Sysdeps::operator()(int fd, struct statfs *buf) { -+ struct statvfs stvfs; -+ int ret = sysdep(fd, &stvfs); -+ if(ret) -+ return ret; -+ -+ buf->f_type = 0; /* statvfs has no f_type */ -+ buf->f_bsize = stvfs.f_bsize; -+ buf->f_bfree = stvfs.f_bfree; -+ buf->f_bavail = stvfs.f_bavail; -+ buf->f_files = stvfs.f_files; -+ buf->f_ffree = stvfs.f_ffree; -+ buf->f_fsid.__val[0] = (int)(stvfs.f_fsid & 0xFFFFFFFF); -+ buf->f_fsid.__val[1] = (int)(stvfs.f_fsid >> 32); -+ buf->f_namelen = stvfs.f_namemax; -+ buf->f_flags = stvfs.f_flag; -+ buf->f_bsize = stvfs.f_frsize; -+ buf->f_frsize = stvfs.f_bsize; -+ -+ return 0; -+ } -+ -+ int Sysdeps::operator()(const char *path, struct statvfs *out) { -+ long r; -+ return syscall(SYSCALL_FSTATVFSAT, &r, AT_FDCWD, (uint64_t)path, (uint64_t)out, 0); -+ } -+ -+ int Sysdeps::operator()(int fd, struct statvfs *out) { -+ long r; -+ return syscall(SYSCALL_FSTATVFS, &r, fd, (uint64_t)out); -+ } -+ -+ void Sysdeps::operator()() { -+ long r; -+ syscall(SYSCALL_YIELD, &r); -+ } -+ - int Sysdeps::operator()(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read) { - long r; - int error = syscall(SYSCALL_READV, &r, fd, (uint64_t)iovs, iovc); -@@ -86,6 +512,11 @@ namespace mlibc { - return e; - } - -+ int Sysdeps::operator()(int which, id_t who, int prio) { -+ long ret; -+ return syscall(SYSCALL_SETPRIORITY, &ret, which, who, prio); -+ } -+ - int Sysdeps::operator()(int sockfd, int how) { - long ret; - return syscall(SYSCALL_SHUTDOWN, &ret, sockfd, how); -@@ -487,8 +918,15 @@ namespace mlibc { - return err; - } - -+ int Sysdeps::operator()(void *tcb, const char *name) { -+ (void)tcb; -+ (void)name; -+ return 0; -+ } -+ - int Sysdeps::operator()(int fd, int layer, int number, const void *buffer, socklen_t size) { - long ret; -+ mlibc::infoLogger() << "setsockopt: fd " << fd << " layer " << layer << " number " << number << frg::endlog; - return syscall(SYSCALL_SETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, size); - } - -@@ -511,6 +949,11 @@ namespace mlibc { - return err; - } - -+ int Sysdeps::operator()(int old_dirfd, const char *old_path, int new_dirfd, const char *new_path, unsigned int flags) { -+ long ret; -+ return syscall(SYSCALL_RENAMEAT, &ret, old_dirfd, (uint64_t)old_path, new_dirfd, (uint64_t)new_path, flags); -+ } -+ - int Sysdeps::operator()(int olddirfd, const char *old_path, int newdirfd, const char *new_path) { - long ret; - return syscall(SYSCALL_RENAMEAT, &ret, olddirfd, (uint64_t)old_path, newdirfd, (uint64_t)new_path); -@@ -562,6 +1005,16 @@ namespace mlibc { - return sysdep(fd, TCSETS, (void *)attr, &res); - } - -+ int Sysdeps::operator()(int fd, struct winsize *winsz) { -+ int res; -+ return sysdep(fd, TIOCGWINSZ, (void *)winsz, &res); -+ } -+ -+ int Sysdeps::operator()(int fd, const struct winsize *winsz) { -+ int res; -+ return sysdep(fd, TIOCSWINSZ, (void *)winsz, &res); -+ } -+ - int Sysdeps::operator()(struct pollfd *fds, nfds_t count, int timeout, int *num_events) { - long ret; - long error = syscall(SYSCALL_POLL, &ret, (uint64_t)fds, count, timeout); -@@ -932,4 +1385,13 @@ namespace mlibc { - *nanos = ts.tv_nsec; - return err; - } -+ -+ int Sysdeps::operator()(int clock, time_t *secs, long *nanos) { -+ struct timespec ts; -+ long ret; -+ int err = syscall(SYSCALL_CLOCK_GETRES, &ret, clock, (uint64_t)&ts); -+ *secs = ts.tv_sec; -+ *nanos = ts.tv_nsec; -+ return err; -+ } - } // namespace mlibc -diff --git mlibc-clean/sysdeps/astral/include/astral/archctl.h mlibc-workdir/sysdeps/astral/include/astral/archctl.h -index 7e4f2a18..ecc26777 100644 ---- mlibc-clean/sysdeps/astral/include/astral/archctl.h -+++ mlibc-workdir/sysdeps/astral/include/astral/archctl.h -@@ -5,6 +5,17 @@ - #define ARCH_CTL_SET_FSBASE 1 - #define ARCH_CTL_GET_GSBASE 2 - #define ARCH_CTL_GET_FSBASE 3 -+#define ARCH_CTL_SET_SYSTRACE 4 -+#define ARCH_CTL_SET_LDT_ENTRY 5 -+ -+#define ARCH_CTL_SYSTRACE_OFF 0 -+#define ARCH_CTL_SYSTRACE_SELF 1 -+#define ARCH_CTL_SYSTRACE_ALL 2 -+ -+typedef struct { -+ uint64_t entry; -+ uint16_t seg; -+} archctl_ldt_request_t; - - #ifdef __cplusplus - extern "C" { -diff --git mlibc-clean/sysdeps/astral/include/astral/syscall.h mlibc-workdir/sysdeps/astral/include/astral/syscall.h -index a6c40676..9040d450 100644 ---- mlibc-clean/sysdeps/astral/include/astral/syscall.h -+++ mlibc-workdir/sysdeps/astral/include/astral/syscall.h -@@ -103,6 +103,14 @@ - #define SYSCALL_SYSINFO 96 - #define SYSCALL_WRITEV 97 - #define SYSCALL_READV 98 -+#define SYSCALL_YIELD 99 -+#define SYSCALL_FSTATVFS 100 -+#define SYSCALL_FSTATVFSAT 101 -+#define SYSCALL_GETSOCKOPT 102 -+#define SYSCALL_CLOCK_GETRES 103 -+#define SYSCALL_SETPRIORITY 104 -+#define SYSCALL_SYSCTL 105 -+#define SYSCALL_EVENTFD 106 - - #ifndef __MLIBC_ABI_ONLY - -diff --git mlibc-workdir/sysdeps/astral/include/astral/sysctl.h mlibc-workdir/sysdeps/astral/include/astral/sysctl.h -new file mode 100644 -index 00000000..0c70df32 ---- /dev/null -+++ mlibc-workdir/sysdeps/astral/include/astral/sysctl.h -@@ -0,0 +1,59 @@ -+#ifndef _ASTRAL_SYSCTL_H -+#define _ASTRAL_SYSCTL_H -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define SYS_CTL_NAME_MAX 6 -+ -+#define SYS_CTL_KERN 1 -+#define SYS_CTL_HW 2 -+#define SYS_CTL_KERN_PROC 1 -+#define SYS_CTL_KERN_PROC_ALL 1 -+#define SYS_CTL_KERN_CONSOLE_LOCK 2 -+#define SYS_CTL_HW_CPUS_ONLINE 1 -+ -+#define SYS_CTL_KERN_PROC_INFO_NAME_SIZE 64 -+#define SYS_CTL_KERN_PROC_INFO_TTY_NAME_SIZE 64 -+ -+typedef struct { -+ pid_t pid; -+ uid_t uid; -+ uid_t euid; -+ uid_t suid; -+ gid_t gid; -+ gid_t egid; -+ gid_t sgid; -+ size_t thread_count; -+ char name[SYS_CTL_KERN_PROC_INFO_NAME_SIZE]; -+ pid_t ppid; -+ pid_t pgid; -+ pid_t sid; -+ struct timespec start_timestamp; -+ struct timespec total_runtime; -+ int state; -+ int cpu_time; -+ int nice; -+ size_t virtual_pages; -+ size_t physical_pages; -+ char tty_name[SYS_CTL_KERN_PROC_INFO_TTY_NAME_SIZE]; -+} sysctl_proc_info_t; -+ -+#ifdef __cplusplus -+extern "C" { -+#endif -+ -+#ifndef __MLIBC_ABI_ONLY -+ -+int sysctl(const int *__name, size_t __name_len, void *__oldp, size_t *__old_lenp, void *__newp, size_t __new_len); -+ -+#endif /* !__MLIBC_ABI_ONLY */ -+ -+#ifdef __cplusplus -+} -+#endif -+ -+#endif /* _ASTRAL_SYSCTL_H */ -diff --git mlibc-clean/sysdeps/astral/include/mlibc/sysdeps.hpp mlibc-workdir/sysdeps/astral/include/mlibc/sysdeps.hpp -index 17f52e51..3527edbe 100644 ---- mlibc-clean/sysdeps/astral/include/mlibc/sysdeps.hpp -+++ mlibc-workdir/sysdeps/astral/include/mlibc/sysdeps.hpp -@@ -5,10 +5,34 @@ - namespace mlibc { - - struct AstralSysdepTags : -+ Sysconf, - SetGroups, - GetGroups, -+ GetLoadavg, -+ Times, -+ Fadvise, -+ Setxattr, -+ Lsetxattr, -+ Fsetxattr, -+ Getxattr, -+ Lgetxattr, -+ Fgetxattr, -+ Listxattr, -+ Llistxattr, -+ Flistxattr, -+ Getifaddrs, -+ IfIndextoname, -+ IfNametoindex, -+ IfNameindex, -+ IfFreeNameindex, - GetSockopt, - InetConfigured, -+ Unlockpt, -+ Statfs, -+ Fstatfs, -+ Statvfs, -+ Fstatvfs, -+ Yield, - Readv, - Writev, - Sysinfo, -@@ -66,6 +90,7 @@ struct AstralSysdepTags : - SetSid, - FutexTid, - GetTid, -+ ThreadSetname, - ThreadExit, - Clone, - Listen, -@@ -77,6 +102,7 @@ struct AstralSysdepTags : - Bind, - Socket, - Renameat, -+ Renameat2, - Rename, - Utimensat, - Fchownat, -@@ -85,6 +111,8 @@ struct AstralSysdepTags : - Sleep, - Tcgetattr, - Tcsetattr, -+ Tcgetwinsize, -+ Tcsetwinsize, - Poll, - Ppoll, - Pselect, -@@ -135,7 +163,11 @@ struct AstralSysdepTags : - VmUnmap, - Isatty, - ClockGet, -- PrepareStack -+ ClockGetres, -+ PrepareStack, -+ SetPriority, -+ GetCurrentStackInfo, -+ EventfdCreate - {}; - - template -diff --git mlibc-clean/sysdeps/astral/meson.build mlibc-workdir/sysdeps/astral/meson.build -index a8b162e1..0c066104 100644 ---- mlibc-clean/sysdeps/astral/meson.build -+++ mlibc-workdir/sysdeps/astral/meson.build -@@ -89,6 +89,7 @@ if not no_headers - install_headers( - 'include/astral/syscall.h', - 'include/astral/archctl.h', -+ 'include/astral/sysctl.h', - subdir: 'astral', - follow_symlinks: true, - ) diff --git mlibc-workdir/tests/glibc/memalign.c mlibc-workdir/tests/glibc/memalign.c new file mode 100644 -index 00000000..0b3a1581 +index 0000000..0b3a158 --- /dev/null +++ mlibc-workdir/tests/glibc/memalign.c @@ -0,0 +1,22 @@ @@ -922,10 +146,10 @@ index 00000000..0b3a1581 + return 0; +} diff --git mlibc-clean/tests/meson.build mlibc-workdir/tests/meson.build -index b2785998..16c5159b 100644 +index 85b967c..f555a1e 100644 --- mlibc-clean/tests/meson.build +++ mlibc-workdir/tests/meson.build -@@ -186,6 +186,7 @@ all_test_cases = [ +@@ -190,6 +190,7 @@ all_test_cases = [ 'glibc/rpmatch', 'glibc/strverscmp', 'glibc/memmem', diff --git a/recipes/frigg b/recipes/frigg index 31700c66..5b9eb744 100644 --- a/recipes/frigg +++ b/recipes/frigg @@ -1,6 +1,6 @@ name=frigg from_source=frigg -revision=5 +revision=6 hostdeps="xgcc xbinutils pkgconfig" imagedeps="meson ninja-build build-essential" diff --git a/recipes/mlibc b/recipes/mlibc index 28d10e00..94b90a55 100644 --- a/recipes/mlibc +++ b/recipes/mlibc @@ -1,6 +1,6 @@ name=mlibc from_source=mlibc -revision=14 +revision=16 hostdeps="xgcc xbinutils pkgconfig" builddeps="freestnd-c-hdrs freestnd-cxx-hdrs frigg libsmarter" imagedeps="meson ninja-build git build-essential binutils" diff --git a/recipes/mlibc-headers b/recipes/mlibc-headers index 7af6a0e2..32383b25 100644 --- a/recipes/mlibc-headers +++ b/recipes/mlibc-headers @@ -1,6 +1,6 @@ name=mlibc-headers from_source=mlibc -revision=8 +revision=10 imagedeps="ninja-build meson build-essential rsync" builddeps="linux-headers" diff --git a/source-recipes/frigg b/source-recipes/frigg index 624d5140..39f142f7 100644 --- a/source-recipes/frigg +++ b/source-recipes/frigg @@ -1,5 +1,5 @@ name=frigg -version=81c88917f54f90c67ea14cbd52534a9d2a1eae13 +version=b26945516a96c4bd30da6c76d7af013fd69e1a29 source_method=tarball tarball_url="https://github.com/managarm/frigg/archive/${version}.tar.gz" -tarball_sha512=718f3105383ef2e8e76c7e0f528f5822215d25b77eb34d889eacfe9cb26f255f5b9516bcc8d686c22a65047a5ea31240b683d7ef2d65b1ad15a9953232752463 +tarball_sha512=23eb26c0a1db90f7c736fac5ee7d9b603255f6bc0484eede9a4b00c59b16aded5467ce6491077a088fbf94b6d9a20acbb2674c8a84f085802abd62e7f2f4c341 diff --git a/source-recipes/mlibc b/source-recipes/mlibc index 3f8bfab2..18f11fe4 100644 --- a/source-recipes/mlibc +++ b/source-recipes/mlibc @@ -1,5 +1,5 @@ name=mlibc -version=1388414fe6d4907d54b3c47333e0e592fa34d31b +version=e45676e5a566439e6039f4dfeafc2c1f2253f99a source_method=tarball tarball_url="https://github.com/managarm/mlibc/archive/${version}.tar.gz" -tarball_sha512="56ebeb86e116a868d94c30cb95ae10df15896ad82d6e9594120abbd4b6fa832c0e8581df4401adb20f036b23091917d8fa8ac8395df815b403313953efe5cde3" +tarball_sha512="573e10fbda6bb3ec5b6e94b34495e45ac417cdf213aaafcb187591d208c6d8fde6dbb87378ee91c8bd93bd2a17808b63b013c695cd8f380b87fa04b3bbffb9ab"