summaryrefslogtreecommitdiff
path: root/lib/mlibc/options/linux
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mlibc/options/linux')
-rw-r--r--lib/mlibc/options/linux/generic/capabilities.cpp19
-rw-r--r--lib/mlibc/options/linux/generic/cpuset.cpp71
-rw-r--r--lib/mlibc/options/linux/generic/ifaddrs.cpp15
-rw-r--r--lib/mlibc/options/linux/generic/linux-unistd.cpp33
-rw-r--r--lib/mlibc/options/linux/generic/malloc.cpp7
-rw-r--r--lib/mlibc/options/linux/generic/mntent-stubs.cpp98
-rw-r--r--lib/mlibc/options/linux/generic/module.cpp24
-rw-r--r--lib/mlibc/options/linux/generic/pty-stubs.cpp101
-rw-r--r--lib/mlibc/options/linux/generic/sched.cpp50
-rw-r--r--lib/mlibc/options/linux/generic/sys-epoll.cpp58
-rw-r--r--lib/mlibc/options/linux/generic/sys-eventfd.cpp45
-rw-r--r--lib/mlibc/options/linux/generic/sys-fsuid.cpp12
-rw-r--r--lib/mlibc/options/linux/generic/sys-inotify-stubs.cpp47
-rw-r--r--lib/mlibc/options/linux/generic/sys-klog.cpp16
-rw-r--r--lib/mlibc/options/linux/generic/sys-mount.cpp29
-rw-r--r--lib/mlibc/options/linux/generic/sys-prctl-stubs.cpp25
-rw-r--r--lib/mlibc/options/linux/generic/sys-ptrace-stubs.cpp36
-rw-r--r--lib/mlibc/options/linux/generic/sys-quota.cpp7
-rw-r--r--lib/mlibc/options/linux/generic/sys-random-stubs.cpp21
-rw-r--r--lib/mlibc/options/linux/generic/sys-reboot.cpp13
-rw-r--r--lib/mlibc/options/linux/generic/sys-sendfile-stubs.cpp9
-rw-r--r--lib/mlibc/options/linux/generic/sys-signalfd.cpp17
-rw-r--r--lib/mlibc/options/linux/generic/sys-statfs-stubs.cpp26
-rw-r--r--lib/mlibc/options/linux/generic/sys-swap.cpp24
-rw-r--r--lib/mlibc/options/linux/generic/sys-sysinfo.cpp15
-rw-r--r--lib/mlibc/options/linux/generic/sys-timerfd.cpp33
-rw-r--r--lib/mlibc/options/linux/generic/sys-xattr.cpp122
-rw-r--r--lib/mlibc/options/linux/generic/utmp-stubs.cpp116
-rw-r--r--lib/mlibc/options/linux/generic/utmpx.cpp45
-rw-r--r--lib/mlibc/options/linux/include/bits/linux/cpu_set.h49
-rw-r--r--lib/mlibc/options/linux/include/bits/linux/linux_sched.h59
-rw-r--r--lib/mlibc/options/linux/include/bits/linux/linux_unistd.h21
-rw-r--r--lib/mlibc/options/linux/include/ifaddrs.h35
-rw-r--r--lib/mlibc/options/linux/include/lastlog.h2
-rw-r--r--lib/mlibc/options/linux/include/linux/libc-compat.h61
-rw-r--r--lib/mlibc/options/linux/include/malloc.h32
-rw-r--r--lib/mlibc/options/linux/include/memory.h9
-rw-r--r--lib/mlibc/options/linux/include/mlibc/linux-sysdeps.hpp82
-rw-r--r--lib/mlibc/options/linux/include/mntent.h50
-rw-r--r--lib/mlibc/options/linux/include/module.h25
-rw-r--r--lib/mlibc/options/linux/include/netpacket/packet.h40
-rw-r--r--lib/mlibc/options/linux/include/pty.h23
-rw-r--r--lib/mlibc/options/linux/include/scsi/scsi.h18
-rw-r--r--lib/mlibc/options/linux/include/scsi/scsi_ioctl.h6
-rw-r--r--lib/mlibc/options/linux/include/scsi/sg.h77
-rw-r--r--lib/mlibc/options/linux/include/sys/epoll.h66
-rw-r--r--lib/mlibc/options/linux/include/sys/eventfd.h29
-rw-r--r--lib/mlibc/options/linux/include/sys/fsuid.h22
-rw-r--r--lib/mlibc/options/linux/include/sys/inotify.h63
-rw-r--r--lib/mlibc/options/linux/include/sys/klog.h18
-rw-r--r--lib/mlibc/options/linux/include/sys/mount.h90
-rw-r--r--lib/mlibc/options/linux/include/sys/prctl.h128
-rw-r--r--lib/mlibc/options/linux/include/sys/ptrace.h55
-rw-r--r--lib/mlibc/options/linux/include/sys/quota.h24
-rw-r--r--lib/mlibc/options/linux/include/sys/random.h26
-rw-r--r--lib/mlibc/options/linux/include/sys/reboot.h20
-rw-r--r--lib/mlibc/options/linux/include/sys/sendfile.h22
-rw-r--r--lib/mlibc/options/linux/include/sys/signalfd.h48
-rw-r--r--lib/mlibc/options/linux/include/sys/statfs.h22
-rw-r--r--lib/mlibc/options/linux/include/sys/swap.h24
-rw-r--r--lib/mlibc/options/linux/include/sys/sysinfo.h34
-rw-r--r--lib/mlibc/options/linux/include/sys/sysmacros.h35
-rw-r--r--lib/mlibc/options/linux/include/sys/timerfd.h32
-rw-r--r--lib/mlibc/options/linux/include/sys/vfs.h16
-rw-r--r--lib/mlibc/options/linux/include/sys/vt.h6
-rw-r--r--lib/mlibc/options/linux/include/sys/xattr.h38
-rw-r--r--lib/mlibc/options/linux/include/utmp.h84
-rw-r--r--lib/mlibc/options/linux/include/utmpx.h68
-rw-r--r--lib/mlibc/options/linux/include/values.h39
-rw-r--r--lib/mlibc/options/linux/meson.build96
70 files changed, 0 insertions, 2828 deletions
diff --git a/lib/mlibc/options/linux/generic/capabilities.cpp b/lib/mlibc/options/linux/generic/capabilities.cpp
deleted file mode 100644
index 871822a..0000000
--- a/lib/mlibc/options/linux/generic/capabilities.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <mlibc/debug.hpp>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int capset(void *, void *) {
- mlibc::infoLogger() << "mlibc: capset is a no-op!" << frg::endlog;
- return 0;
-}
-
-int capget(void *, void *) {
- mlibc::infoLogger() << "mlibc: capget is a no-op!" << frg::endlog;
- return 0;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/lib/mlibc/options/linux/generic/cpuset.cpp b/lib/mlibc/options/linux/generic/cpuset.cpp
deleted file mode 100644
index d0292b7..0000000
--- a/lib/mlibc/options/linux/generic/cpuset.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <limits.h>
-#include <sched.h>
-#include <stdlib.h>
-#include <string.h>
-
-cpu_set_t *__mlibc_cpu_alloc(int num_cpus) {
- return reinterpret_cast<cpu_set_t *>(calloc(1, CPU_ALLOC_SIZE(num_cpus)));
-}
-
-#define CPU_MASK_BITS (CHAR_BIT * sizeof(__cpu_mask))
-
-size_t __mlibc_cpu_alloc_size(int num_cpus) {
- /* calculate the (unaligned) remainder that doesn't neatly fit in one __cpu_mask; 0 or 1 */
- size_t remainder = ((num_cpus % CPU_MASK_BITS) + CPU_MASK_BITS - 1) / CPU_MASK_BITS;
- return sizeof(__cpu_mask) * (num_cpus / CPU_MASK_BITS + remainder);
-}
-
-void __mlibc_cpu_zero(const size_t setsize, cpu_set_t *set) {
- memset(set, 0, CPU_ALLOC_SIZE(setsize));
-}
-
-void __mlibc_cpu_set(const int cpu, const size_t setsize, cpu_set_t *set) {
- if(cpu >= static_cast<int>(setsize * CHAR_BIT)) {
- return;
- }
-
- unsigned char *ptr = reinterpret_cast<unsigned char *>(set);
- size_t off = cpu / CHAR_BIT;
- size_t mask = 1 << (cpu % CHAR_BIT);
-
- ptr[off] |= mask;
-}
-
-void __mlibc_cpu_clear(const int cpu, const size_t setsize, cpu_set_t *set) {
- if(cpu >= static_cast<int>(setsize * CHAR_BIT)) {
- return;
- }
-
- unsigned char *ptr = reinterpret_cast<unsigned char *>(set);
- size_t off = cpu / CHAR_BIT;
- size_t mask = 1 << (cpu % CHAR_BIT);
-
- ptr[off] &= ~mask;
-}
-
-
-int __mlibc_cpu_isset(const int cpu, const size_t setsize, const cpu_set_t *set) {
- if(cpu >= static_cast<int>(setsize * CHAR_BIT)) {
- return false;
- }
-
- const unsigned char *ptr = reinterpret_cast<const unsigned char *>(set);
- size_t off = cpu / CHAR_BIT;
- size_t mask = 1 << (cpu % CHAR_BIT);
-
- return (ptr[off] & mask);
-}
-
-int __mlibc_cpu_count(const size_t setsize, const cpu_set_t *set) {
- size_t count = 0;
- const unsigned char *ptr = reinterpret_cast<const unsigned char *>(set);
-
- for(size_t i = 0; i < setsize; i++) {
- for(size_t bit = 0; bit < CHAR_BIT; bit++) {
- if((1 << bit) & ptr[i])
- count++;
- }
- }
-
- return count;
-}
diff --git a/lib/mlibc/options/linux/generic/ifaddrs.cpp b/lib/mlibc/options/linux/generic/ifaddrs.cpp
deleted file mode 100644
index 67dfbc6..0000000
--- a/lib/mlibc/options/linux/generic/ifaddrs.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <bits/ensure.h>
-#include <mlibc/debug.hpp>
-#include <ifaddrs.h>
-#include <errno.h>
-
-int getifaddrs(struct ifaddrs **) {
- mlibc::infoLogger() << "mlibc: getifaddrs fails unconditionally!" << frg::endlog;
- errno = ENOSYS;
- return -1;
-}
-
-void freeifaddrs(struct ifaddrs *) {
- mlibc::infoLogger() << "mlibc: freeifaddrs is a stub!" << frg::endlog;
- return;
-}
diff --git a/lib/mlibc/options/linux/generic/linux-unistd.cpp b/lib/mlibc/options/linux/generic/linux-unistd.cpp
deleted file mode 100644
index ec13f72..0000000
--- a/lib/mlibc/options/linux/generic/linux-unistd.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <bits/linux/linux_unistd.h>
-#include <bits/ensure.h>
-
-#include <errno.h>
-#include <mlibc/posix-sysdeps.hpp>
-#include <unistd.h>
-
-int dup3(int oldfd, int newfd, int flags) {
- if(oldfd == newfd) {
- errno = EINVAL;
- return -1;
- }
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_dup2, -1);
- if(int e = mlibc::sys_dup2(oldfd, flags, newfd); e) {
- errno = e;
- return -1;
- }
- return newfd;
-}
-
-int vhangup(void) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
-
-int getdtablesize(void){
- return sysconf(_SC_OPEN_MAX);
-}
-
-int syncfs(int) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
diff --git a/lib/mlibc/options/linux/generic/malloc.cpp b/lib/mlibc/options/linux/generic/malloc.cpp
deleted file mode 100644
index 065de6c..0000000
--- a/lib/mlibc/options/linux/generic/malloc.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <bits/ensure.h>
-#include <malloc.h>
-
-void *memalign(size_t, size_t) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
diff --git a/lib/mlibc/options/linux/generic/mntent-stubs.cpp b/lib/mlibc/options/linux/generic/mntent-stubs.cpp
deleted file mode 100644
index 35c0e92..0000000
--- a/lib/mlibc/options/linux/generic/mntent-stubs.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-
-#include <errno.h>
-#include <mntent.h>
-#include <stdio.h>
-#include <limits.h>
-#include <string.h>
-#include <bits/ensure.h>
-
-namespace {
-
-char *internal_buf;
-size_t internal_bufsize;
-
-}
-
-#define SENTINEL (char *)&internal_buf
-
-FILE *setmntent(const char *name, const char *mode) {
- return fopen(name, mode);
-}
-
-struct mntent *getmntent(FILE *f) {
- static struct mntent mnt;
- return getmntent_r(f, &mnt, SENTINEL, 0);
-}
-
-int addmntent(FILE *f, const struct mntent *mnt) {
- if(fseek(f, 0, SEEK_END)) {
- return 1;
- }
- return fprintf(f, "%s\t%s\t%s\t%s\t%d\t%d\n",
- mnt->mnt_fsname, mnt->mnt_dir, mnt->mnt_type, mnt->mnt_opts,
- mnt->mnt_freq, mnt->mnt_passno) < 0;
-}
-
-int endmntent(FILE *f) {
- if(f) {
- fclose(f);
- }
- return 1;
-}
-
-char *hasmntopt(const struct mntent *mnt, const char *opt) {
- return strstr(mnt->mnt_opts, opt);
-}
-
-/* Adapted from musl */
-struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen) {
- int n[8];
- bool use_internal = (linebuf == SENTINEL);
- int len;
- size_t i;
-
- mnt->mnt_freq = 0;
- mnt->mnt_passno = 0;
-
- do {
- if(use_internal) {
- getline(&internal_buf, &internal_bufsize, f);
- linebuf = internal_buf;
- } else {
- fgets(linebuf, buflen, f);
- }
- if(feof(f) || ferror(f)) {
- return 0;
- }
- if(!strchr(linebuf, '\n')) {
- fscanf(f, "%*[^\n]%*[\n]");
- errno = ERANGE;
- return 0;
- }
-
- len = strlen(linebuf);
- if(len > INT_MAX) {
- continue;
- }
-
- for(i = 0; i < sizeof n / sizeof *n; i++) {
- n[i] = len;
- }
-
- sscanf(linebuf, " %n%*s%n %n%*s%n %n%*s%n %n%*s%n %d %d",
- n, n + 1, n + 2, n + 3, n + 4, n + 5, n + 6, n + 7,
- &mnt->mnt_freq, &mnt->mnt_passno);
- } while(linebuf[n[0]] == '#' || n[1] == len);
-
- linebuf[n[1]] = 0;
- linebuf[n[3]] = 0;
- linebuf[n[5]] = 0;
- linebuf[n[7]] = 0;
-
- mnt->mnt_fsname = linebuf + n[0];
- mnt->mnt_dir = linebuf + n[2];
- mnt->mnt_type = linebuf + n[4];
- mnt->mnt_opts = linebuf + n[6];
-
- return mnt;
-}
diff --git a/lib/mlibc/options/linux/generic/module.cpp b/lib/mlibc/options/linux/generic/module.cpp
deleted file mode 100644
index 53b6dc8..0000000
--- a/lib/mlibc/options/linux/generic/module.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <errno.h>
-#include <module.h>
-
-#include <bits/ensure.h>
-#include <mlibc/debug.hpp>
-#include <mlibc/linux-sysdeps.hpp>
-
-int init_module(void *module, unsigned long length, const char *args) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_init_module, -1);
- if(int e = mlibc::sys_init_module(module, length, args); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int delete_module(const char *name, unsigned flags) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_delete_module, -1);
- if(int e = mlibc::sys_delete_module(name, flags); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
diff --git a/lib/mlibc/options/linux/generic/pty-stubs.cpp b/lib/mlibc/options/linux/generic/pty-stubs.cpp
deleted file mode 100644
index 8d95027..0000000
--- a/lib/mlibc/options/linux/generic/pty-stubs.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-
-#include <asm/ioctls.h>
-#include <bits/ensure.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <pty.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-#include <mlibc/debug.hpp>
-#include <mlibc/linux-sysdeps.hpp>
-
-int openpty(int *mfd, int *sfd, char *name, const struct termios *ios, const struct winsize *win) {
- int ptmx_fd;
- if(int e = mlibc::sys_open("/dev/ptmx", O_RDWR | O_NOCTTY, 0, &ptmx_fd); e) {
- errno = e;
- goto fail;
- }
-
- char spath[32];
- if(!name)
- name = spath;
- if(ptsname_r(ptmx_fd, name, 32))
- goto fail;
-
- int pts_fd;
- unlockpt(ptmx_fd);
- if(int e = mlibc::sys_open(name, O_RDWR | O_NOCTTY, 0, &pts_fd); e) {
- errno = e;
- goto fail;
- }
-
- if(ios)
- tcsetattr(ptmx_fd, TCSAFLUSH, ios);
-
- if(win)
- ioctl(ptmx_fd, TIOCSWINSZ, (void*)win);
-
- *mfd = ptmx_fd;
- *sfd = pts_fd;
- return 0;
-
-fail:
- mlibc::sys_close(ptmx_fd);
- return -1;
-}
-
-int login_tty(int fd) {
- if(setsid() == -1)
- return -1;
- if(ioctl(fd, TIOCSCTTY, 0))
- return -1;
-
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_dup2, -1);
- if(int e = mlibc::sys_dup2(fd, 0, STDIN_FILENO); e) {
- errno = e;
- return -1;
- }
- if(int e = mlibc::sys_dup2(fd, 0, STDOUT_FILENO); e) {
- errno = e;
- return -1;
- }
- if(int e = mlibc::sys_dup2(fd, 0, STDERR_FILENO); e) {
- errno = e;
- return -1;
- }
-
- if(int e = mlibc::sys_close(fd); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int forkpty(int *mfd, char *name, const struct termios *ios, const struct winsize *win) {
- int sfd;
- if(openpty(mfd, &sfd, name, ios, win))
- return -1;
-
- pid_t child;
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_fork, -1);
- if(int e = mlibc::sys_fork(&child); e) {
- errno = e;
- return -1;
- }
-
- if(!child) {
- if(login_tty(sfd))
- mlibc::panicLogger() << "mlibc: TTY login fail in forkpty() child" << frg::endlog;
- }else{
- if(int e = mlibc::sys_close(sfd); e) {
- errno = e;
- return -1;
- }
- }
-
- return child;
-}
-
diff --git a/lib/mlibc/options/linux/generic/sched.cpp b/lib/mlibc/options/linux/generic/sched.cpp
deleted file mode 100644
index 760a9f5..0000000
--- a/lib/mlibc/options/linux/generic/sched.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <bits/ensure.h>
-#include <errno.h>
-#include <sched.h>
-
-#include <mlibc/linux-sysdeps.hpp>
-#include <mlibc/posix-sysdeps.hpp>
-
-int sched_getcpu(void) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_getcpu, -1);
- int cpu;
- if(int e = mlibc::sys_getcpu(&cpu); e) {
- errno = e;
- return -1;
- }
- return cpu;
-}
-
-int setns(int, int) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
-
-int sched_getscheduler(pid_t) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
-
-int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_getaffinity, -1);
- if(int e = mlibc::sys_getaffinity(pid, cpusetsize, mask); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int unshare(int) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
-
-int sched_setaffinity(pid_t, size_t, const cpu_set_t *) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
-
-int clone(int (*)(void *), void *, int, void *, ...) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
diff --git a/lib/mlibc/options/linux/generic/sys-epoll.cpp b/lib/mlibc/options/linux/generic/sys-epoll.cpp
deleted file mode 100644
index 799d1a9..0000000
--- a/lib/mlibc/options/linux/generic/sys-epoll.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-
-#include <errno.h>
-#include <sys/epoll.h>
-
-#include <bits/ensure.h>
-#include <mlibc/linux-sysdeps.hpp>
-#include <stddef.h>
-
-int epoll_create(int) {
- int fd;
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_epoll_create, -1);
- if(int e = mlibc::sys_epoll_create(0, &fd); e) {
- errno = e;
- return -1;
- }
- return fd;
-}
-
-int epoll_pwait(int epfd, struct epoll_event *evnts, int n, int timeout,
- const sigset_t *sigmask) {
- int raised;
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_epoll_pwait, -1);
- if(int e = mlibc::sys_epoll_pwait(epfd, evnts, n, timeout, sigmask, &raised)) {
- errno = e;
- return -1;
- }
- return raised;
-}
-
-int epoll_create1(int flags) {
- int fd;
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_epoll_create, -1);
- if(int e = mlibc::sys_epoll_create(flags, &fd); e) {
- errno = e;
- return -1;
- }
- return fd;
-}
-
-int epoll_ctl(int epfd, int mode, int fd, struct epoll_event *ev) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_epoll_ctl, -1);
- if(int e = mlibc::sys_epoll_ctl(epfd, mode, fd, ev); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int epoll_wait(int epfd, struct epoll_event *evnts, int n, int timeout) {
- int raised;
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_epoll_pwait, -1);
- if(int e = mlibc::sys_epoll_pwait(epfd, evnts, n, timeout, NULL, &raised)) {
- errno = e;
- return -1;
- }
- return raised;
-}
-
diff --git a/lib/mlibc/options/linux/generic/sys-eventfd.cpp b/lib/mlibc/options/linux/generic/sys-eventfd.cpp
deleted file mode 100644
index 1d83d8c..0000000
--- a/lib/mlibc/options/linux/generic/sys-eventfd.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <sys/eventfd.h>
-#include <errno.h>
-
-#include <bits/ensure.h>
-#include <mlibc/linux-sysdeps.hpp>
-
-int eventfd(unsigned int initval, int flags) {
- int fd = 0;
-
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_eventfd_create, -1);
- if (int e = mlibc::sys_eventfd_create(initval, flags, &fd); e) {
- errno = e;
- return -1;
- }
-
- return fd;
-}
-
-int eventfd_read(int fd, eventfd_t *value) {
- ssize_t bytes_read;
- if (int e = mlibc::sys_read(fd, value, 8, &bytes_read); e) {
- errno = e;
- return -1;
- }
-
- if (bytes_read != 8) {
- return -1;
- }
-
- return 0;
-}
-
-int eventfd_write(int fd, eventfd_t value) {
- ssize_t bytes_written;
- if (int e = mlibc::sys_write(fd, &value, 8, &bytes_written); e) {
- errno = e;
- return -1;
- }
-
- if (bytes_written != 8) {
- return -1;
- }
-
- return 0;
-}
diff --git a/lib/mlibc/options/linux/generic/sys-fsuid.cpp b/lib/mlibc/options/linux/generic/sys-fsuid.cpp
deleted file mode 100644
index 653456c..0000000
--- a/lib/mlibc/options/linux/generic/sys-fsuid.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <bits/ensure.h>
-#include <sys/fsuid.h>
-
-int setfsuid(uid_t) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
-
-int setfsgid(gid_t) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
diff --git a/lib/mlibc/options/linux/generic/sys-inotify-stubs.cpp b/lib/mlibc/options/linux/generic/sys-inotify-stubs.cpp
deleted file mode 100644
index 0bc25c9..0000000
--- a/lib/mlibc/options/linux/generic/sys-inotify-stubs.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-
-#include <errno.h>
-#include <sys/inotify.h>
-
-#include <bits/ensure.h>
-#include <mlibc/debug.hpp>
-#include <mlibc/linux-sysdeps.hpp>
-
-int inotify_init(void) {
- int fd;
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_inotify_create, -1);
- if(int e = mlibc::sys_inotify_create(0, &fd); e) {
- errno = e;
- return -1;
- }
- return fd;
-}
-
-int inotify_init1(int flags) {
- int fd;
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_inotify_create, -1);
- if(int e = mlibc::sys_inotify_create(flags, &fd); e) {
- errno = e;
- return -1;
- }
- return fd;
-}
-
-int inotify_add_watch(int ifd, const char *path, uint32_t mask) {
- int wd;
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_inotify_add_watch, -1);
- if(int e = mlibc::sys_inotify_add_watch(ifd, path, mask, &wd); e) {
- errno = e;
- return -1;
- }
- return wd;
-}
-
-int inotify_rm_watch(int ifd, int wd) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_inotify_rm_watch, -1);
- if(int e = mlibc::sys_inotify_rm_watch(ifd, wd); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
diff --git a/lib/mlibc/options/linux/generic/sys-klog.cpp b/lib/mlibc/options/linux/generic/sys-klog.cpp
deleted file mode 100644
index 059e292..0000000
--- a/lib/mlibc/options/linux/generic/sys-klog.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <errno.h>
-#include <sys/klog.h>
-
-#include <bits/ensure.h>
-
-#include <mlibc/linux-sysdeps.hpp>
-
-int klogctl(int type, char *bufp, int len) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_klogctl, -1);
- int out;
- if (int e = mlibc::sys_klogctl(type, bufp, len, &out); e) {
- errno = e;
- return -1;
- }
- return out;
-}
diff --git a/lib/mlibc/options/linux/generic/sys-mount.cpp b/lib/mlibc/options/linux/generic/sys-mount.cpp
deleted file mode 100644
index 4783183..0000000
--- a/lib/mlibc/options/linux/generic/sys-mount.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-
-#include <errno.h>
-#include <sys/mount.h>
-
-#include <bits/ensure.h>
-#include <mlibc/linux-sysdeps.hpp>
-
-int mount(const char *source, const char *target,
- const char *fstype, unsigned long flags, const void *data) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_mount, -1);
- if(int e = mlibc::sys_mount(source, target, fstype, flags, data); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int umount(const char *target) {
- return umount2(target, 0);
-}
-
-int umount2(const char *target, int flags) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_umount2, -1);
- if(int e = mlibc::sys_umount2(target, flags); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
diff --git a/lib/mlibc/options/linux/generic/sys-prctl-stubs.cpp b/lib/mlibc/options/linux/generic/sys-prctl-stubs.cpp
deleted file mode 100644
index 5280332..0000000
--- a/lib/mlibc/options/linux/generic/sys-prctl-stubs.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-
-#include <stdarg.h>
-#include <errno.h>
-#include <bits/ensure.h>
-#include <sys/prctl.h>
-
-#include <mlibc/debug.hpp>
-
-#include "mlibc/linux-sysdeps.hpp"
-
-int prctl(int op, ...) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_prctl, -1);
-
- int val;
- va_list ap;
- va_start(ap, op);
- if(int e = mlibc::sys_prctl(op, ap, &val); e) {
- errno = e;
- return -1;
- }
- va_end(ap);
-
- return val;
-}
-
diff --git a/lib/mlibc/options/linux/generic/sys-ptrace-stubs.cpp b/lib/mlibc/options/linux/generic/sys-ptrace-stubs.cpp
deleted file mode 100644
index 8c836c5..0000000
--- a/lib/mlibc/options/linux/generic/sys-ptrace-stubs.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-
-#include <sys/ptrace.h>
-#include <stdarg.h>
-#include <errno.h>
-
-#include <bits/ensure.h>
-#include <mlibc/debug.hpp>
-#include <mlibc/linux-sysdeps.hpp>
-
-long ptrace(int req, ...) {
- va_list ap;
-
- va_start(ap, req);
- auto pid = va_arg(ap, pid_t);
- auto addr = va_arg(ap, void *);
- auto data = va_arg(ap, void *);
- va_end(ap);
-
- long ret;
- if(req > 0 && req < 4) {
- data = &ret;
- }
-
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_ptrace, -1);
- long out;
- if(int e = mlibc::sys_ptrace(req, pid, addr, data, &out); e) {
- errno = e;
- return -1;
- } else if(req > 0 && req < 4) {
- errno = 0;
- return ret;
- }
-
- return out;
-}
-
diff --git a/lib/mlibc/options/linux/generic/sys-quota.cpp b/lib/mlibc/options/linux/generic/sys-quota.cpp
deleted file mode 100644
index 27c0e6d..0000000
--- a/lib/mlibc/options/linux/generic/sys-quota.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <bits/ensure.h>
-#include <sys/quota.h>
-
-int quotactl(int, const char *, int, caddr_t) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
diff --git a/lib/mlibc/options/linux/generic/sys-random-stubs.cpp b/lib/mlibc/options/linux/generic/sys-random-stubs.cpp
deleted file mode 100644
index 5e5057f..0000000
--- a/lib/mlibc/options/linux/generic/sys-random-stubs.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-
-#include <sys/random.h>
-#include <bits/ensure.h>
-
-#include <mlibc/debug.hpp>
-#include <mlibc/posix-sysdeps.hpp>
-
-#include <errno.h>
-
-ssize_t getrandom(void *buffer, size_t max_size, unsigned int flags) {
- if(flags & ~(GRND_RANDOM | GRND_NONBLOCK)) {
- errno = EINVAL;
- return -1;
- }
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_getentropy, -1);
- if(int e = mlibc::sys_getentropy(buffer, max_size); e) {
- errno = e;
- return -1;
- }
- return max_size;
-}
diff --git a/lib/mlibc/options/linux/generic/sys-reboot.cpp b/lib/mlibc/options/linux/generic/sys-reboot.cpp
deleted file mode 100644
index c9b503f..0000000
--- a/lib/mlibc/options/linux/generic/sys-reboot.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <errno.h>
-#include <sys/reboot.h>
-#include <bits/ensure.h>
-#include <mlibc/linux-sysdeps.hpp>
-
-int reboot(int what) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_reboot, -1);
- if (int e = mlibc::sys_reboot(what); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
diff --git a/lib/mlibc/options/linux/generic/sys-sendfile-stubs.cpp b/lib/mlibc/options/linux/generic/sys-sendfile-stubs.cpp
deleted file mode 100644
index 25cd0a0..0000000
--- a/lib/mlibc/options/linux/generic/sys-sendfile-stubs.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#include <sys/sendfile.h>
-#include <bits/ensure.h>
-
-ssize_t sendfile(int, int, off_t *, size_t) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
-
diff --git a/lib/mlibc/options/linux/generic/sys-signalfd.cpp b/lib/mlibc/options/linux/generic/sys-signalfd.cpp
deleted file mode 100644
index 28cfea0..0000000
--- a/lib/mlibc/options/linux/generic/sys-signalfd.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-
-#include <errno.h>
-#include <sys/signalfd.h>
-
-#include <bits/ensure.h>
-#include <mlibc/linux-sysdeps.hpp>
-
-int signalfd(int fd, const sigset_t *mask, int flags) {
- __ensure(fd == -1);
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_signalfd_create, -1);
- if(int e = mlibc::sys_signalfd_create(mask, flags, &fd); e) {
- errno = e;
- return -1;
- }
- return fd;
-}
-
diff --git a/lib/mlibc/options/linux/generic/sys-statfs-stubs.cpp b/lib/mlibc/options/linux/generic/sys-statfs-stubs.cpp
deleted file mode 100644
index 6152ef2..0000000
--- a/lib/mlibc/options/linux/generic/sys-statfs-stubs.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-#include <errno.h>
-#include <sys/statfs.h>
-#include <bits/ensure.h>
-
-#include <mlibc/debug.hpp>
-#include <mlibc/linux-sysdeps.hpp>
-
-int statfs(const char *path, struct statfs *buf) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_statfs, -1);
- if(int e = mlibc::sys_statfs(path, buf); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int fstatfs(int fd, struct statfs *buf) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_fstatfs, -1);
- if (int e = mlibc::sys_fstatfs(fd, buf); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
diff --git a/lib/mlibc/options/linux/generic/sys-swap.cpp b/lib/mlibc/options/linux/generic/sys-swap.cpp
deleted file mode 100644
index 44ddf98..0000000
--- a/lib/mlibc/options/linux/generic/sys-swap.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <errno.h>
-#include <sys/swap.h>
-
-#include <bits/ensure.h>
-#include <mlibc/debug.hpp>
-#include <mlibc/linux-sysdeps.hpp>
-
-int swapon(const char *path, int flags) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_swapon, -1);
- if(int e = mlibc::sys_swapon(path, flags); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int swapoff(const char *path) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_swapoff, -1);
- if(int e = mlibc::sys_swapoff(path); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
diff --git a/lib/mlibc/options/linux/generic/sys-sysinfo.cpp b/lib/mlibc/options/linux/generic/sys-sysinfo.cpp
deleted file mode 100644
index 950c38a..0000000
--- a/lib/mlibc/options/linux/generic/sys-sysinfo.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <errno.h>
-#include <sys/sysinfo.h>
-
-#include <bits/ensure.h>
-#include <mlibc/debug.hpp>
-#include <mlibc/linux-sysdeps.hpp>
-
-int sysinfo(struct sysinfo *info) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_sysinfo, -1);
- if(int e = mlibc::sys_sysinfo(info); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
diff --git a/lib/mlibc/options/linux/generic/sys-timerfd.cpp b/lib/mlibc/options/linux/generic/sys-timerfd.cpp
deleted file mode 100644
index 80bca1b..0000000
--- a/lib/mlibc/options/linux/generic/sys-timerfd.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-
-#include <errno.h>
-#include <sys/timerfd.h>
-
-#include <bits/ensure.h>
-#include <mlibc/debug.hpp>
-#include <mlibc/linux-sysdeps.hpp>
-
-int timerfd_create(int clockid, int flags) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_timerfd_create, -1);
- int fd;
- if(int e = mlibc::sys_timerfd_create(clockid, flags, &fd); e) {
- errno = e;
- return -1;
- }
- return fd;
-}
-
-int timerfd_settime(int fd, int flags, const struct itimerspec *value,
- struct itimerspec *oldvalue) {
- MLIBC_CHECK_OR_ENOSYS(mlibc::sys_timerfd_settime, -1);
- if(int e = mlibc::sys_timerfd_settime(fd, flags, value, oldvalue); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int timerfd_gettime(int, struct itimerspec *) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
-}
-
diff --git a/lib/mlibc/options/linux/generic/sys-xattr.cpp b/lib/mlibc/options/linux/generic/sys-xattr.cpp
deleted file mode 100644
index c8d598f..0000000
--- a/lib/mlibc/options/linux/generic/sys-xattr.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <errno.h>
-#include <sys/xattr.h>
-
-#include <mlibc/linux-sysdeps.hpp>
-#include <bits/ensure.h>
-
-int setxattr(const char *path, const char *name, const void *val, size_t size,
- int flags) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_setxattr, -1);
-
- if (int e = sysdep(path, name, val, size, flags); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int lsetxattr(const char *path, const char *name, const void *val, size_t size,
- int flags) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_lsetxattr, -1);
-
- if (int e = sysdep(path, name, val, size, flags); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-int fsetxattr(int fd, const char *name, const void *val, size_t size,
- int flags) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_fsetxattr, -1);
-
- if (int e = sysdep(fd, name, val, size, flags); e) {
- errno = e;
- return -1;
- }
- return 0;
-}
-
-ssize_t getxattr(const char *path, const char *name, void *val, size_t size) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_getxattr, -1);
-
- ssize_t nread;
- if (int e = sysdep(path, name, val, size, &nread); e) {
- errno = e;
- return -1;
- }
-
- return nread;
-}
-
-ssize_t lgetxattr(const char *path, const char *name, void *val, size_t size) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_lgetxattr, -1);
-
- ssize_t nread;
- if (int e = sysdep(path, name, val, size, &nread); e) {
- errno = e;
- return -1;
- }
-
- return nread;
-}
-
-ssize_t fgetxattr(int fd, const char *name, void *val, size_t size) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_fgetxattr, -1);
-
- ssize_t nread;
- if (int e = sysdep(fd, name, val, size, &nread); e) {
- errno = e;
- return -1;
- }
-
- return nread;
-}
-
-int removexattr(const char *path, const char *name) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_removexattr, -1);
- return sysdep(path, name);
-}
-
-int lremovexattr(const char *path, const char *name) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_lremovexattr, -1);
- return sysdep(path, name);
-}
-
-int fremovexattr(int fd, const char *name) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_fremovexattr, -1);
- return sysdep(fd, name);
-}
-
-ssize_t listxattr(const char *path, char *list, size_t size) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_listxattr, -1);
-
- ssize_t nread;
- if (int e = sysdep(path, list, size, &nread); e) {
- errno = e;
- return -1;
- }
- return nread;
-}
-
-ssize_t llistxattr(const char *path, char *list, size_t size) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_llistxattr, -1);
-
- ssize_t nread;
- if (int e = sysdep(path, list, size, &nread); e) {
- errno = e;
- return -1;
- }
- return nread;
-}
-
-ssize_t flistxattr(int fd, char *list, size_t size) {
- auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_flistxattr, -1);
-
- ssize_t nread;
- if (int e = sysdep(fd, list, size, &nread); e) {
- errno = e;
- return -1;
- }
- return nread;
-}
diff --git a/lib/mlibc/options/linux/generic/utmp-stubs.cpp b/lib/mlibc/options/linux/generic/utmp-stubs.cpp
deleted file mode 100644
index 658dfd3..0000000
--- a/lib/mlibc/options/linux/generic/utmp-stubs.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-#include <utmp.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <bits/ensure.h>
-#include <mlibc/debug.hpp>
-
-/*
- * The code in this file is largely based on glibc.
- * This includes:
- * - setutent
- * - read_last_entry
- * - getutent
- * - getutent_r
- * - endutent
- */
-static int fd = -1;
-static off_t offset;
-
-static struct utmp last_entry;
-
-void setutent(void) {
- if(fd < 0) {
- fd = open("/run/utmp", O_RDONLY | O_LARGEFILE | O_CLOEXEC);
- if(fd == -1) {
- return;
- }
- }
-
- lseek(fd, 0, SEEK_SET);
- offset = 0;
-}
-
-static ssize_t read_last_entry(void) {
- struct utmp buf;
- ssize_t bytes_read = pread(fd, &buf, sizeof(buf), offset);
-
- if(bytes_read < 0) {
- return -1;
- } else if(bytes_read != sizeof(buf)) {
- // EOF
- return 0;
- } else {
- last_entry = buf;
- offset += sizeof(buf);
- return 1;
- }
-}
-
-struct utmp *getutent(void) {
- struct utmp *result;
- static struct utmp *buf;
- if(buf == NULL) {
- buf = (struct utmp *)malloc(sizeof(struct utmp));
- if(buf == NULL) {
- return NULL;
- }
- }
-
- if(getutent_r(buf, &result) < 0) {
- return NULL;
- }
- return result;
-}
-
-int getutent_r(struct utmp *buf, struct utmp **res) {
- int saved_errno = errno;
-
- if(fd < 0) {
- setutent();
- }
-
- ssize_t bytes_read = read_last_entry();
-
- if(bytes_read <= 0) {
- if(bytes_read == 0) {
- errno = saved_errno;
- *res = NULL;
- return -1;
- }
- }
-
- memcpy(buf, &last_entry, sizeof(struct utmp));
- *res = buf;
-
- return 0;
-}
-
-void endutent(void) {
- if(fd >= 0) {
- close(fd);
- fd = -1;
- }
-}
-
-struct utmp *pututline(const struct utmp *) {
- mlibc::infoLogger() << "\e[31mmlibc: pututline() is a stub!\e[39m" << frg::endlog;
- return NULL;
-}
-
-struct utmp *getutline(const struct utmp *) {
- mlibc::infoLogger() << "\e[31mmlibc: getutline() is a stub!\e[39m" << frg::endlog;
- return NULL;
-}
-
-int utmpname(const char *) {
- mlibc::infoLogger() << "\e[31mmlibc: utmpname() is a stub!\e[39m" << frg::endlog;
- return -1;
-}
-
-struct utmp *getutid(const struct utmp *) {
- mlibc::infoLogger() << "\e[31mmlibc: getutid() is a stub!\e[39m" << frg::endlog;
- return NULL;
-}
diff --git a/lib/mlibc/options/linux/generic/utmpx.cpp b/lib/mlibc/options/linux/generic/utmpx.cpp
deleted file mode 100644
index 4742567..0000000
--- a/lib/mlibc/options/linux/generic/utmpx.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <bits/ensure.h>
-#include <stddef.h>
-#include <errno.h>
-#include <utmpx.h>
-#include <mlibc/debug.hpp>
-
-void updwtmpx(const char *, const struct utmpx *) {
- // Empty as musl does
- mlibc::infoLogger() << "\e[31mmlibc: updwtmpx() is a stub\e[39m" << frg::endlog;
-}
-
-void endutxent(void) {
- // Empty as musl does
- mlibc::infoLogger() << "\e[31mmlibc: endutxent() is a stub\e[39m" << frg::endlog;
-}
-
-void setutxent(void) {
- // Empty as musl does
- mlibc::infoLogger() << "\e[31mmlibc: setutxent() is a stub\e[39m" << frg::endlog;
-}
-
-struct utmpx *getutxent(void) {
- // return NULL as musl does
- mlibc::infoLogger() << "\e[31mmlibc: getutxent() is a stub\e[39m" << frg::endlog;
- return NULL;
-}
-
-struct utmpx *pututxline(const struct utmpx *) {
- // return NULL as musl does
- mlibc::infoLogger() << "\e[31mmlibc: pututxline() is a stub\e[39m" << frg::endlog;
- return NULL;
-}
-
-int utmpxname(const char *) {
- // return -1 as musl does
- mlibc::infoLogger() << "\e[31mmlibc: utmpxname() is a stub\e[39m" << frg::endlog;
- errno = ENOSYS;
- return -1;
-}
-
-struct utmpx *getutxid(const struct utmpx *) {
- // return NULL as musl does
- mlibc::infoLogger() << "\e[31mmlibc: getutxid() is a stub\e[39m" << frg::endlog;
- return NULL;
-}
diff --git a/lib/mlibc/options/linux/include/bits/linux/cpu_set.h b/lib/mlibc/options/linux/include/bits/linux/cpu_set.h
deleted file mode 100644
index f3c753e..0000000
--- a/lib/mlibc/options/linux/include/bits/linux/cpu_set.h
+++ /dev/null
@@ -1,49 +0,0 @@
-#ifndef _LINUX_CPU_SET_H
-#define _LINUX_CPU_SET_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <bits/cpu_set.h>
-#include <bits/size_t.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#ifndef __MLIBC_ABI_ONLY
-
-cpu_set_t *__mlibc_cpu_alloc(int num_cpus);
-size_t __mlibc_cpu_alloc_size(int num_cpus);
-
-void __mlibc_cpu_zero(const size_t setsize, cpu_set_t *set);
-void __mlibc_cpu_set(const int cpu, const size_t setsize, cpu_set_t *set);
-void __mlibc_cpu_clear(const int cpu, const size_t setsize, cpu_set_t *set);
-int __mlibc_cpu_isset(const int cpu, const size_t setsize, const cpu_set_t *set);
-int __mlibc_cpu_count(const size_t setsize, const cpu_set_t *set);
-
-#define CPU_ALLOC_SIZE(n) __mlibc_cpu_alloc_size((n))
-#define CPU_ALLOC(n) __mlibc_cpu_alloc((n))
-#define CPU_FREE(set) free((set))
-
-#define CPU_ZERO_S(setsize, set) __mlibc_cpu_zero((setsize), (set))
-#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t), set)
-
-#define CPU_SET_S(cpu, setsize, set) __mlibc_cpu_set((cpu), (setsize), (set))
-#define CPU_SET(cpu, set) CPU_SET_S(cpu, sizeof(cpu_set_t), set)
-
-#define CPU_CLR_S(cpu, setsize, set) __mlibc_cpu_clear((cpu), (setsize), (set))
-#define CPU_CLR(cpu, set) CPU_CLR_S(cpu, sizeof(cpu_set_t), set)
-
-#define CPU_ISSET_S(cpu, setsize, set) __mlibc_cpu_isset((cpu), (setsize), (set))
-#define CPU_ISSET(cpu, set) CPU_ISSET_S(cpu, sizeof(cpu_set_t), set)
-
-#define CPU_COUNT_S(setsize, set) __mlibc_cpu_count((setsize), (set))
-#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t), set)
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LINUX_CPU_SET_H */
diff --git a/lib/mlibc/options/linux/include/bits/linux/linux_sched.h b/lib/mlibc/options/linux/include/bits/linux/linux_sched.h
deleted file mode 100644
index 6a1209a..0000000
--- a/lib/mlibc/options/linux/include/bits/linux/linux_sched.h
+++ /dev/null
@@ -1,59 +0,0 @@
-
-#ifndef _LINUX_SCHED_H
-#define _LINUX_SCHED_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <abi-bits/pid_t.h>
-#include <bits/size_t.h>
-#include <bits/linux/cpu_set.h>
-
-#define CLONE_VM 0x00000100
-#define CLONE_FS 0x00000200
-#define CLONE_FILES 0x00000400
-#define CLONE_SIGHAND 0x00000800
-#define CLONE_PTRACE 0x00002000
-#define CLONE_VFORK 0x00004000
-#define CLONE_PARENT 0x00008000
-#define CLONE_THREAD 0x00010000
-#define CLONE_NEWNS 0x00020000
-#define CLONE_SYSVSEM 0x00040000
-#define CLONE_SETTLS 0x00080000
-#define CLONE_PARENT_SETTID 0x00100000
-#define CLONE_CHILD_CLEARTID 0x00200000
-#define CLONE_DETACHED 0x00400000
-#define CLONE_UNTRACED 0x00800000
-#define CLONE_CHILD_SETTID 0x01000000
-#define CLONE_NEWCGROUP 0x02000000
-#define CLONE_NEWUTS 0x04000000
-#define CLONE_NEWIPC 0x08000000
-#define CLONE_NEWUSER 0x10000000
-#define CLONE_NEWPID 0x20000000
-#define CLONE_NEWNET 0x40000000
-#define CLONE_IO 0x80000000
-
-#ifndef __MLIBC_ABI_ONLY
-
-int sched_getscheduler(pid_t pid);
-int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *mask);
-int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
-
-int unshare(int flags);
-int clone(int (*)(void *), void *, int, void *, ...);
-
-/* Glibc extension */
-int sched_getcpu(void);
-
-#if defined(_GNU_SOURCE)
-int setns(int fd, int nstype);
-#endif /* _GNU_SOURCE */
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _LINUX_SCHED_H */
diff --git a/lib/mlibc/options/linux/include/bits/linux/linux_unistd.h b/lib/mlibc/options/linux/include/bits/linux/linux_unistd.h
deleted file mode 100644
index 77534ba..0000000
--- a/lib/mlibc/options/linux/include/bits/linux/linux_unistd.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _LINUX_UNISTD_H
-#define _LINUX_UNISTD_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MLIBC_ABI_ONLY
-
-int dup3(int fd, int newfd, int flags);
-int vhangup(void);
-int getdtablesize(void);
-int syncfs(int fd);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LINUX_UNISTD_H
diff --git a/lib/mlibc/options/linux/include/ifaddrs.h b/lib/mlibc/options/linux/include/ifaddrs.h
deleted file mode 100644
index 2604e3e..0000000
--- a/lib/mlibc/options/linux/include/ifaddrs.h
+++ /dev/null
@@ -1,35 +0,0 @@
-
-#ifndef _IFADDRS_H
-#define _IFADDRS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-// Struct definitions taken from musl
-struct ifaddrs {
- struct ifaddrs *ifa_next;
- char *ifa_name;
- unsigned ifa_flags;
- struct sockaddr *ifa_addr;
- struct sockaddr *ifa_netmask;
- struct sockaddr *ifa_broadaddr;
- struct sockaddr *ifa_dstaddr;
- void *ifa_data;
-};
-
-#ifndef __MLIBC_ABI_ONLY
-
-int getifaddrs(struct ifaddrs **);
-void freeifaddrs(struct ifaddrs *);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _IFADDRS_H
diff --git a/lib/mlibc/options/linux/include/lastlog.h b/lib/mlibc/options/linux/include/lastlog.h
deleted file mode 100644
index 0930aaf..0000000
--- a/lib/mlibc/options/linux/include/lastlog.h
+++ /dev/null
@@ -1,2 +0,0 @@
-// Maches glibc
-#include <utmp.h> \ No newline at end of file
diff --git a/lib/mlibc/options/linux/include/linux/libc-compat.h b/lib/mlibc/options/linux/include/linux/libc-compat.h
deleted file mode 100644
index 696f4af..0000000
--- a/lib/mlibc/options/linux/include/linux/libc-compat.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef _LINUX_LIBC_COMPAT_H
-#define _LINUX_LIBC_COMPAT_H
-
-#if defined(_NET_IF_H)
-
-#define __UAPI_DEF_IF_IFCONF 0
-#define __UAPI_DEF_IF_IFMAP 0
-#define __UAPI_DEF_IF_IFNAMSIZ 0
-#define __UAPI_DEF_IF_IFREQ 0
-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 0
-
-#else // _NET_IF_H
-
-#define __UAPI_DEF_IF_IFCONF 1
-#define __UAPI_DEF_IF_IFMAP 1
-#define __UAPI_DEF_IF_IFNAMSIZ 1
-#define __UAPI_DEF_IF_IFREQ 1
-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS 1
-#define __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO 1
-
-#endif //_NET_IF_H
-
-#if defined(_NETINET_IN_H)
-
-#define __UAPI_DEF_IN_ADDR 0
-#define __UAPI_DEF_IN_CLASS 0
-#define __UAPI_DEF_IN_IPPROTO 0
-#define __UAPI_DEF_IN_PKTINFO 0
-#define __UAPI_DEF_IP_MREQ 0
-#define __UAPI_DEF_SOCKADDR_IN 0
-
-#define __UAPI_DEF_IN6_ADDR 0
-#define __UAPI_DEF_IN6_ADDR_ALT 1
-#define __UAPI_DEF_IN6_PKTINFO 0
-#define __UAPI_DEF_IP6_MTUINFO 0
-#define __UAPI_DEF_IPPROTO_V6 0
-#define __UAPI_DEF_IPV6_MREQ 0
-#define __UAPI_DEF_IPV6_OPTIONS 0
-#define __UAPI_DEF_SOCKADDR_IN6 0
-
-#else
-
-#define __UAPI_DEF_IN_ADDR 1
-#define __UAPI_DEF_IN_CLASS 1
-#define __UAPI_DEF_IN_IPPROTO 1
-#define __UAPI_DEF_IN_PKTINFO 1
-#define __UAPI_DEF_IP_MREQ 1
-#define __UAPI_DEF_SOCKADDR_IN 1
-
-#define __UAPI_DEF_IN6_ADDR 1
-#define __UAPI_DEF_IN6_ADDR_ALT 1
-#define __UAPI_DEF_IN6_PKTINFO 1
-#define __UAPI_DEF_IP6_MTUINFO 1
-#define __UAPI_DEF_IPPROTO_V6 1
-#define __UAPI_DEF_IPV6_MREQ 1
-#define __UAPI_DEF_IPV6_OPTIONS 1
-#define __UAPI_DEF_SOCKADDR_IN6 1
-
-#endif /* _NETINET_IN_H */
-
-#endif // _LINUX_LIBC_COMPAT_H
diff --git a/lib/mlibc/options/linux/include/malloc.h b/lib/mlibc/options/linux/include/malloc.h
deleted file mode 100644
index b03f9b4..0000000
--- a/lib/mlibc/options/linux/include/malloc.h
+++ /dev/null
@@ -1,32 +0,0 @@
-
-#ifndef _MALLOC_H
-#define _MALLOC_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <bits/size_t.h>
-#include <mlibc-config.h>
-
-#ifndef __MLIBC_ABI_ONLY
-
-// [7.22.3] Memory management functions
-void *calloc(size_t count, size_t size);
-void free(void *pointer);
-void *malloc(size_t size);
-void *realloc(void *pointer, size_t size);
-void *memalign(size_t, size_t);
-
-#if __MLIBC_GLIBC_OPTION
-#include <bits/glibc/glibc_malloc.h>
-#endif
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _MALLOC_H
-
diff --git a/lib/mlibc/options/linux/include/memory.h b/lib/mlibc/options/linux/include/memory.h
deleted file mode 100644
index 586822b..0000000
--- a/lib/mlibc/options/linux/include/memory.h
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#ifndef _MEMORY_H
-#define _MEMORY_H
-
-// This is a linux extension
-#include <string.h>
-
-#endif // _MEMORY_H
-
diff --git a/lib/mlibc/options/linux/include/mlibc/linux-sysdeps.hpp b/lib/mlibc/options/linux/include/mlibc/linux-sysdeps.hpp
deleted file mode 100644
index b18544a..0000000
--- a/lib/mlibc/options/linux/include/mlibc/linux-sysdeps.hpp
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef MLIBC_LINUX_SYSDEPS
-#define MLIBC_LINUX_SYSDEPS
-
-#include <sched.h>
-#include <stdarg.h>
-#include <sys/epoll.h>
-#include <sys/sysinfo.h>
-#include <sys/statfs.h>
-#include <poll.h>
-#include <abi-bits/pid_t.h>
-#include <abi-bits/mode_t.h>
-#include <bits/ssize_t.h>
-#include <bits/size_t.h>
-
-namespace [[gnu::visibility("hidden")]] mlibc {
-
-int sys_open(const char *pathname, int flags, mode_t mode, int *fd);
-int sys_close(int fd);
-int sys_read(int fd, void *buf, size_t count, ssize_t *bytes_read);
-int sys_write(int fd, const void *buf, size_t count, ssize_t *bytes_written);
-int sys_ioctl(int fd, unsigned long request, void *arg, int *result);
-
-[[gnu::weak]] int sys_dup2(int fd, int flags, int newfd);
-[[gnu::weak]] int sys_fork(pid_t *child);
-[[gnu::weak]] int sys_inotify_create(int flags, int *fd);
-[[gnu::weak]] int sys_inotify_add_watch(int ifd, const char *path, uint32_t mask, int *wd);
-[[gnu::weak]] int sys_inotify_rm_watch(int ifd, int wd);
-[[gnu::weak]] int sys_epoll_create(int flags, int *fd);
-[[gnu::weak]] int sys_epoll_ctl(int epfd, int mode, int fd, struct epoll_event *ev);
-[[gnu::weak]] int sys_epoll_pwait(int epfd, struct epoll_event *ev, int n,
- int timeout, const sigset_t *sigmask, int *raised);
-[[gnu::weak]] int sys_mount(const char *source, const char *target,
- const char *fstype, unsigned long flags, const void *data);
-[[gnu::weak]] int sys_umount2(const char *target, int flags);
-[[gnu::weak]] int sys_eventfd_create(unsigned int initval, int flags, int *fd);
-[[gnu::weak]] int sys_timerfd_create(int clockid, int flags, int *fd);
-[[gnu::weak]] int sys_timerfd_settime(int fd, int flags,
- const struct itimerspec *value, struct itimerspec *oldvalue);
-[[gnu::weak]] int sys_signalfd_create(const sigset_t *, int flags, int *fd);
-[[gnu::weak]] int sys_reboot(int cmd);
-[[gnu::weak]] int sys_ptrace(long req, pid_t pid, void *addr, void *data, long *out);
-[[gnu::weak]] int sys_prctl(int option, va_list va, int *out);
-[[gnu::weak]] int sys_init_module(void *module, unsigned long length, const char *args);
-[[gnu::weak]] int sys_delete_module(const char *name, unsigned flags);
-[[gnu::weak]] int sys_klogctl(int type, char *bufp, int len, int *out);
-[[gnu::weak]] int sys_getcpu(int *cpu);
-
-[[gnu::weak]] int sys_sysinfo(struct sysinfo *info);
-[[gnu::weak]] int sys_swapon(const char *path, int flags);
-[[gnu::weak]] int sys_swapoff(const char *path);
-
-[[gnu::weak]] int sys_setxattr(const char *path, const char *name,
- const void *val, size_t size, int flags);
-[[gnu::weak]] int sys_lsetxattr(const char *path, const char *name,
- const void *val, size_t size, int flags);
-[[gnu::weak]] int sys_fsetxattr(int fd, const char *name, const void *val,
- size_t size, int flags);
-
-[[gnu::weak]] int sys_getxattr(const char *path, const char *name,
- void *val, size_t size, ssize_t *nread);
-[[gnu::weak]] int sys_lgetxattr(const char *path, const char *name,
- void *val, size_t size, ssize_t *nread);
-[[gnu::weak]] int sys_fgetxattr(int fd, const char *name, void *val,
- size_t size, ssize_t *nread);
-
-[[gnu::weak]] int sys_listxattr(const char *path, char *list, size_t size,
- ssize_t *nread);
-[[gnu::weak]] int sys_llistxattr(const char *path, char *list, size_t size,
- ssize_t *nread);
-[[gnu::weak]] int sys_flistxattr(int fd, char *list, size_t size,
- ssize_t *nread);
-
-[[gnu::weak]] int sys_removexattr(const char *path, const char *name);
-[[gnu::weak]] int sys_lremovexattr(const char *path, const char *name);
-[[gnu::weak]] int sys_fremovexattr(int fd, const char *name);
-
-[[gnu::weak]] int sys_statfs(const char *path, struct statfs *buf);
-[[gnu::weak]] int sys_fstatfs(int fd, struct statfs *buf);
-
-} // namespace mlibc
-
-#endif // MLIBX_LINUX_SYSDEPS
diff --git a/lib/mlibc/options/linux/include/mntent.h b/lib/mlibc/options/linux/include/mntent.h
deleted file mode 100644
index bafd289..0000000
--- a/lib/mlibc/options/linux/include/mntent.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef _MNTENT_H
-#define _MNTENT_H
-
-#include <stdio.h>
-
-// TODO: Refer to _PATH_MOUNTED
-#define MOUNTED "/etc/mtab"
-
-/* Generic mount options */
-#define MNTOPT_DEFAULTS "defaults" /* Use all default options. */
-#define MNTOPT_RO "ro" /* Read only. */
-#define MNTOPT_RW "rw" /* Read/write. */
-#define MNTOPT_SUID "suid" /* Set uid allowed. */
-#define MNTOPT_NOSUID "nosuid" /* No set uid allowed. */
-#define MNTOPT_NOAUTO "noauto" /* Do not auto mount. */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct mntent {
- char *mnt_fsname;
- char *mnt_dir;
- char *mnt_type;
- char *mnt_opts;
- int mnt_freq;
- int mnt_passno;
-};
-
-#ifndef __MLIBC_ABI_ONLY
-
-FILE *setmntent(const char *, const char *);
-
-struct mntent *getmntent(FILE *);
-
-int addmntent(FILE *, const struct mntent *);
-
-int endmntent(FILE *);
-
-char *hasmntopt(const struct mntent *, const char *);
-
-struct mntent *getmntent_r(FILE *, struct mntent *, char *, int);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _MNTENT_H
diff --git a/lib/mlibc/options/linux/include/module.h b/lib/mlibc/options/linux/include/module.h
deleted file mode 100644
index ef715a4..0000000
--- a/lib/mlibc/options/linux/include/module.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _MODULE_H
-#define _MODULE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MLIBC_ABI_ONLY
-
-/*
- * Musl adds these, even though they aren't specified, but doesn't export them.
- * See https://github.com/bminor/musl/commit/2169265ec6c902cd460bf96a1a0b5103657a4954
- * for more information and the rationale behind it.
- * For our infrastructure, we expose them, and make it call into the sysdeps.
- */
-int init_module(void *module, unsigned long len, const char *args);
-int delete_module(const char *name, unsigned flags);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _MODULE_H
diff --git a/lib/mlibc/options/linux/include/netpacket/packet.h b/lib/mlibc/options/linux/include/netpacket/packet.h
deleted file mode 100644
index 1fa0917..0000000
--- a/lib/mlibc/options/linux/include/netpacket/packet.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef _NETPACKET_PACKET_H
-#define _NETPACKET_PACKET_H
-
-#include <abi-bits/packet.h>
-
-/* Packet types */
-#define PACKET_HOST 0
-#define PACKET_BROADCAST 1
-#define PACKET_MULTICAST 2
-#define PACKET_OTHERHOST 3
-#define PACKET_OUTGOING 4
-#define PACKET_LOOPBACK 5
-#define PACKET_FASTROUTE 6
-
-struct sockaddr_ll {
- unsigned short int sll_family;
- unsigned short int sll_protocol;
- int sll_ifindex;
- unsigned short int sll_hatype;
- unsigned char sll_pkttype;
- unsigned char sll_halen;
- unsigned char sll_addr[8];
-};
-
-struct packet_mreq {
- int mr_ifindex;
- unsigned short int mr_type;
- unsigned short int mr_alen;
- unsigned char mr_address[8];
-};
-
-#define PACKET_ADD_MEMBERSHIP 1
-#define PACKET_DROP_MEMBERSHIP 2
-
-#define PACKET_MR_MULTICAST 0
-#define PACKET_MR_PROMISC 1
-#define PACKET_MR_ALLMULTI 2
-#define PACKET_MR_UNICAST 3
-
-#endif // _NETPACKET_PACKET_H
diff --git a/lib/mlibc/options/linux/include/pty.h b/lib/mlibc/options/linux/include/pty.h
deleted file mode 100644
index 562fbb8..0000000
--- a/lib/mlibc/options/linux/include/pty.h
+++ /dev/null
@@ -1,23 +0,0 @@
-
-#ifndef _PTY_H
-#define _PTY_H
-
-#include <termios.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MLIBC_ABI_ONLY
-
-int openpty(int *, int *, char *, const struct termios *, const struct winsize *);
-int forkpty(int *, char *, const struct termios *, const struct winsize *);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _PTY_H
-
diff --git a/lib/mlibc/options/linux/include/scsi/scsi.h b/lib/mlibc/options/linux/include/scsi/scsi.h
deleted file mode 100644
index f7f92d8..0000000
--- a/lib/mlibc/options/linux/include/scsi/scsi.h
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#ifndef _LINUX_SCSI_SCSI_H
-#define _LINUX_SCSI_SCSI_H
-
-#define RECOVERED_ERROR 0x01
-#define ILLEGAL_REQUEST 0x05
-#define UNIT_ATTENTION 0x06
-#define INQUIRY 0x12
-#define START_STOP 0x1b
-#define ALLOW_MEDIUM_REMOVAL 0x1e
-
-#define SCSI_IOCTL_GET_IDLUN 0x5382
-#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
-#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
-#define SCSI_IOCTL_PROBE_HOST 0x5385
-
-#endif // _LINUX_SCSI_SCSI_H
-
diff --git a/lib/mlibc/options/linux/include/scsi/scsi_ioctl.h b/lib/mlibc/options/linux/include/scsi/scsi_ioctl.h
deleted file mode 100644
index 16c7cfa..0000000
--- a/lib/mlibc/options/linux/include/scsi/scsi_ioctl.h
+++ /dev/null
@@ -1,6 +0,0 @@
-
-#ifndef _LINUX_SCSI_SCSI_IOCTL_H
-#define _LINUX_SCSI_SCSI_IOCTL_H
-
-#endif // _LINUX_SCSI_SCSI_IOCTL_H
-
diff --git a/lib/mlibc/options/linux/include/scsi/sg.h b/lib/mlibc/options/linux/include/scsi/sg.h
deleted file mode 100644
index a9dfc7a..0000000
--- a/lib/mlibc/options/linux/include/scsi/sg.h
+++ /dev/null
@@ -1,77 +0,0 @@
-
-#ifndef _LINUX_SCSI_SG_H
-#define _LINUX_SCSI_SG_H
-
-#define SG_IO 0x2285
-
-#define SG_GET_VERSION_NUM 0x2282
-
-#define SG_FLAG_DIRECT_IO 1
-#define SG_FLAG_LUN_INHIBIT 2
-
-#define SG_INFO_OK 0x0
-#define SG_INFO_OK_MASK 0x1
-
-#define SG_DXFER_NONE (-1)
-#define SG_DXFER_TO_DEV (-2)
-#define SG_DXFER_FROM_DEV (-3)
-#define SG_DXFER_TO_FROM_DEV (-4)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct sg_io_hdr {
- int interface_id;
- int dxfer_direction;
- unsigned char cmd_len;
- unsigned char mx_sb_len;
- unsigned short iovec_count;
- unsigned int dxfer_len;
- void *dxferp;
- unsigned char *cmdp;
- unsigned char *sbp;
- unsigned int timeout;
- unsigned int flags;
- int pack_id;
- void *usr_ptr;
- unsigned char status;
- unsigned char masked_status;
- unsigned char msg_status;
- unsigned char sb_len_wr;
- unsigned short host_status;
- unsigned short driver_status;
- int resid;
- unsigned int duration;
- unsigned int info;
-} sg_io_hdr_t;
-
-struct sg_scsi_id {
- int host_no;
- int channel;
- int scsi_id;
- int lun;
- int scsi_type;
- short int h_cmd_per_lun;
- short int d_queue_depth;
- int unused[2];
-};
-
-typedef struct sg_req_info {
- char req_state;
- char orphan;
- char sg_io_owned;
- char problem;
- int pack_id;
- void *usr_ptr;
- unsigned int duration;
-
- int unused;
-} sg_req_info_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _LINUX_SCSI_SG_H
-
diff --git a/lib/mlibc/options/linux/include/sys/epoll.h b/lib/mlibc/options/linux/include/sys/epoll.h
deleted file mode 100644
index f84da7a..0000000
--- a/lib/mlibc/options/linux/include/sys/epoll.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef _SYS_EPOLL_H
-#define _SYS_EPOLL_H
-
-#include <stdint.h>
-#include <abi-bits/signal.h>
-#include <abi-bits/epoll.h>
-#include <abi-bits/fcntl.h>
-
-#define EPOLL_NONBLOCK O_NONBLOCK
-
-// These constants match the Linux definitions.
-#define EPOLLIN 0x001
-#define EPOLLPRI 0x002
-#define EPOLLOUT 0x004
-#define EPOLLRDNORM 0x040
-#define EPOLLRDBAND 0x080
-#define EPOLLWRNORM 0x100
-#define EPOLLWRBAND 0x200
-#define EPOLLMSG 0x400
-#define EPOLLERR 0x008
-#define EPOLLHUP 0x010
-#define EPOLLRDHUP 0x2000
-#define EPOLLEXCLUSIVE (1U << 28)
-#define EPOLLWAKEUP (1U << 29)
-#define EPOLLONESHOT (1U << 30)
-#define EPOLLET (1U << 31)
-
-#define EPOLL_CTL_ADD 1
-#define EPOLL_CTL_DEL 2
-#define EPOLL_CTL_MOD 3
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef union epoll_data {
- void *ptr;
- int fd;
- uint32_t u32;
- uint64_t u64;
-} epoll_data_t;
-
-struct epoll_event {
- uint32_t events;
- epoll_data_t data;
-}
-#ifdef __x86_64__
-__attribute__((__packed__))
-#endif
-;
-
-#ifndef __MLIBC_ABI_ONLY
-
-int epoll_create(int);
-int epoll_create1(int);
-int epoll_ctl(int, int, int, struct epoll_event *);
-int epoll_wait(int, struct epoll_event *, int, int);
-int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_EPOLL_H
diff --git a/lib/mlibc/options/linux/include/sys/eventfd.h b/lib/mlibc/options/linux/include/sys/eventfd.h
deleted file mode 100644
index 454a8c1..0000000
--- a/lib/mlibc/options/linux/include/sys/eventfd.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef _SYS_EVENTFD_H
-#define _SYS_EVENTFD_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <fcntl.h>
-
-typedef uint64_t eventfd_t;
-
-#define EFD_SEMAPHORE 1
-#define EFD_CLOEXEC O_CLOEXEC
-#define EFD_NONBLOCK O_NONBLOCK
-
-#ifndef __MLIBC_ABI_ONLY
-
-int eventfd(unsigned int, int);
-int eventfd_read(int, eventfd_t *);
-int eventfd_write(int, eventfd_t);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_EVENTFD_H
diff --git a/lib/mlibc/options/linux/include/sys/fsuid.h b/lib/mlibc/options/linux/include/sys/fsuid.h
deleted file mode 100644
index 9df9efc..0000000
--- a/lib/mlibc/options/linux/include/sys/fsuid.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _SYS_FSUID_H
-#define _SYS_FSUID_H
-
-#include <abi-bits/uid_t.h>
-#include <abi-bits/gid_t.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MLIBC_ABI_ONLY
-
-int setfsuid(uid_t uid);
-int setfsgid(gid_t gid);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_FSUID_H
diff --git a/lib/mlibc/options/linux/include/sys/inotify.h b/lib/mlibc/options/linux/include/sys/inotify.h
deleted file mode 100644
index 3c48403..0000000
--- a/lib/mlibc/options/linux/include/sys/inotify.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef _SYS_INOTIFY_H
-#define _SYS_INOTIFY_H
-
-#include <stdint.h>
-#include <abi-bits/fcntl.h>
-#include <abi-bits/inotify.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define IN_ACCESS 0x1
-#define IN_ATTRIB 0x4
-#define IN_CLOSE_WRITE 0x8
-#define IN_CLOSE_NOWRITE 0x10
-#define IN_CREATE 0x100
-#define IN_DELETE 0x200
-#define IN_DELETE_SELF 0x400
-#define IN_MODIFY 0x2
-#define IN_MOVE_SELF 0x800
-#define IN_MOVED_FROM 0x40
-#define IN_MOVED_TO 0x80
-#define IN_OPEN 0x20
-#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO)
-#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
-#define IN_DONT_FOLLOW 0x2000000
-#define IN_EXCL_UNLINK 0x4000000
-#define IN_MASK_ADD 0x20000000
-#define IN_ONESHOT 0x80000000
-#define IN_ONLYDIR 0x1000000
-#define IN_IGNORED 0x8000
-#define IN_ISDIR 0x40000000
-#define IN_Q_OVERFLOW 0x4000
-#define IN_UNMOUNT 0x2000
-
-#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
- IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
- IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
- IN_MOVE_SELF)
-
-struct inotify_event {
- int wd;
- unsigned int mask;
- unsigned int cookie;
- unsigned int len;
- char name[];
-};
-
-#ifndef __MLIBC_ABI_ONLY
-
-int inotify_init(void);
-int inotify_init1(int);
-int inotify_add_watch(int, const char *, uint32_t);
-int inotify_rm_watch(int, int);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_SYS_INOTIFY_H
-
diff --git a/lib/mlibc/options/linux/include/sys/klog.h b/lib/mlibc/options/linux/include/sys/klog.h
deleted file mode 100644
index 520bdd1..0000000
--- a/lib/mlibc/options/linux/include/sys/klog.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _SYS_KLOG_H
-#define _SYS_KLOG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MLIBC_ABI_ONLY
-
-int klogctl(int type, char *bufp, int len);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SYS_KLOG_H */
diff --git a/lib/mlibc/options/linux/include/sys/mount.h b/lib/mlibc/options/linux/include/sys/mount.h
deleted file mode 100644
index 2486128..0000000
--- a/lib/mlibc/options/linux/include/sys/mount.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef _SYS_MOUNT_H
-#define _SYS_MOUNT_H
-
-#include <asm/ioctl.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MS_RDONLY 1
-#define MS_NOSUID 2
-#define MS_NODEV 4
-#define MS_NOEXEC 8
-#define MS_SYNCHRONOUS 16
-#define MS_REMOUNT 32
-#define MS_MANDLOCK 64
-#define MS_DIRSYNC 128
-#define MS_NOSYMFOLLOW 256
-#define MS_NOATIME 1024
-#define MS_NODIRATIME 2048
-#define MS_BIND 4096
-#define MS_MOVE 8192
-#define MS_REC 16384
-#define MS_SILENT 32768
-#define MS_POSIXACL (1 << 16)
-#define MS_UNBINDABLE (1 << 17)
-#define MS_PRIVATE (1 << 18)
-#define MS_SLAVE (1 << 19)
-#define MS_SHARED (1 << 20)
-#define MS_RELATIME (1 << 21)
-#define MS_KERNMOUNT (1 << 22)
-#define MS_I_VERSION (1 << 23)
-#define MS_STRICTATIME (1 << 24)
-#define MS_LAZYTIME (1 << 25)
-#define MS_NOREMOTELOCK (1 << 27)
-#define MS_NOSEC (1 << 28)
-#define MS_BORN (1 << 29)
-#define MS_ACTIVE (1 << 30)
-#define MS_NOUSER (1 << 31)
-
-#define MNT_FORCE 1
-#define MNT_DETACH 2
-#define MNT_EXPIRE 4
-#define UMOUNT_NOFOLLOW 8
-
-#undef BLKROSET
-#define BLKROSET _IO(0x12, 93)
-#undef BLKROGET
-#define BLKROGET _IO(0x12, 94)
-#undef BLKRRPART
-#define BLKRRPART _IO(0x12, 95)
-#undef BLKGETSIZE
-#define BLKGETSIZE _IO(0x12, 96)
-#undef BLKFLSBUF
-#define BLKFLSBUF _IO(0x12, 97)
-#undef BLKRASET
-#define BLKRASET _IO(0x12, 98)
-#undef BLKRAGET
-#define BLKRAGET _IO(0x12, 99)
-#undef BLKFRASET
-#define BLKFRASET _IO(0x12, 100)
-#undef BLKFRAGET
-#define BLKFRAGET _IO(0x12, 101)
-#undef BLKSECTSET
-#define BLKSECTSET _IO(0x12, 102)
-#undef BLKSECTGET
-#define BLKSECTGET _IO(0x12, 103)
-#undef BLKSSZGET
-#define BLKSSZGET _IO(0x12, 104)
-#undef BLKBSZGET
-#define BLKBSZGET _IOR(0x12, 112, size_t)
-#undef BLKBSZSET
-#define BLKBSZSET _IOW(0x12, 113, size_t)
-#undef BLKGETSIZE64
-#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
-
-#ifndef __MLIBC_ABI_ONLY
-
-int mount(const char *source, const char *target,
- const char *fstype, unsigned long flags, const void *data);
-int umount(const char *target);
-int umount2(const char *target, int flags);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_MOUNT_H
diff --git a/lib/mlibc/options/linux/include/sys/prctl.h b/lib/mlibc/options/linux/include/sys/prctl.h
deleted file mode 100644
index de987c1..0000000
--- a/lib/mlibc/options/linux/include/sys/prctl.h
+++ /dev/null
@@ -1,128 +0,0 @@
-
-#ifndef _SYS_PRCTL_H
-#define _SYS_PRCTL_H
-
-#include <stdint.h>
-
-#define PR_SET_PDEATHSIG 1
-#define PR_GET_PDEATHSIG 2
-#define PR_GET_DUMPABLE 3
-#define PR_SET_DUMPABLE 4
-#define PR_GET_UNALIGN 5
-#define PR_SET_UNALIGN 6
-#define PR_UNALIGN_NOPRINT 1
-#define PR_UNALIGN_SIGBUS 2
-#define PR_GET_KEEPCAPS 7
-#define PR_SET_KEEPCAPS 8
-#define PR_GET_FPEMU 9
-#define PR_SET_FPEMU 10
-#define PR_FPEMU_NOPRINT 1
-#define PR_FPEMU_SIGFPE 2
-#define PR_GET_FPEXC 11
-#define PR_SET_FPEXC 12
-#define PR_FP_EXC_SW_ENABLE 0x80
-#define PR_FP_EXC_DIV 0x010000
-#define PR_FP_EXC_OVF 0x020000
-#define PR_FP_EXC_UND 0x040000
-#define PR_FP_EXC_RES 0x080000
-#define PR_FP_EXC_INV 0x100000
-#define PR_FP_EXC_DISABLED 0
-#define PR_FP_EXC_NONRECOV 1
-#define PR_FP_EXC_ASYNC 2
-#define PR_FP_EXC_PRECISE 3
-#define PR_GET_TIMING 13
-#define PR_SET_TIMING 14
-#define PR_TIMING_STATISTICAL 0
-#define PR_TIMING_TIMESTAMP 1
-#define PR_SET_NAME 15
-#define PR_GET_NAME 16
-#define PR_GET_ENDIAN 19
-#define PR_SET_ENDIAN 20
-#define PR_ENDIAN_BIG 0
-#define PR_ENDIAN_LITTLE 1
-#define PR_ENDIAN_PPC_LITTLE 2
-#define PR_GET_SECCOMP 21
-#define PR_SET_SECCOMP 22
-#define PR_CAPBSET_READ 23
-#define PR_CAPBSET_DROP 24
-#define PR_GET_TSC 25
-#define PR_SET_TSC 26
-#define PR_TSC_ENABLE 1
-#define PR_TSC_SIGSEGV 2
-#define PR_GET_SECUREBITS 27
-#define PR_SET_SECUREBITS 28
-#define PR_SET_TIMERSLACK 29
-#define PR_GET_TIMERSLACK 30
-
-#define PR_TASK_PERF_EVENTS_DISABLE 31
-#define PR_TASK_PERF_EVENTS_ENABLE 32
-
-#define PR_MCE_KILL 33
-#define PR_MCE_KILL_CLEAR 0
-#define PR_MCE_KILL_SET 1
-#define PR_MCE_KILL_LATE 0
-#define PR_MCE_KILL_EARLY 1
-#define PR_MCE_KILL_DEFAULT 2
-#define PR_MCE_KILL_GET 34
-
-#define PR_SET_MM 35
-#define PR_SET_MM_START_CODE 1
-#define PR_SET_MM_END_CODE 2
-#define PR_SET_MM_START_DATA 3
-#define PR_SET_MM_END_DATA 4
-#define PR_SET_MM_START_STACK 5
-#define PR_SET_MM_START_BRK 6
-#define PR_SET_MM_BRK 7
-#define PR_SET_MM_ARG_START 8
-#define PR_SET_MM_ARG_END 9
-#define PR_SET_MM_ENV_START 10
-#define PR_SET_MM_ENV_END 11
-#define PR_SET_MM_AUXV 12
-#define PR_SET_MM_EXE_FILE 13
-#define PR_SET_MM_MAP 14
-#define PR_SET_MM_MAP_SIZE 15
-
-#define PR_SET_PTRACER 0x59616d61
-#define PR_SET_PTRACER_ANY (-1UL)
-
-#define PR_SET_CHILD_SUBREAPER 36
-#define PR_GET_CHILD_SUBREAPER 37
-
-#define PR_SET_NO_NEW_PRIVS 38
-#define PR_GET_NO_NEW_PRIVS 39
-
-#define PR_GET_TID_ADDRESS 40
-
-#define PR_SET_THP_DISABLE 41
-#define PR_GET_THP_DISABLE 42
-
-#define PR_MPX_ENABLE_MANAGEMENT 43
-#define PR_MPX_DISABLE_MANAGEMENT 44
-
-#define PR_SET_FP_MODE 45
-#define PR_GET_FP_MODE 46
-#define PR_FP_MODE_FR (1 << 0)
-#define PR_FP_MODE_FRE (1 << 1)
-
-#define PR_CAP_AMBIENT 47
-#define PR_CAP_AMBIENT_IS_SET 1
-#define PR_CAP_AMBIENT_RAISE 2
-#define PR_CAP_AMBIENT_LOWER 3
-#define PR_CAP_AMBIENT_CLEAR_ALL 4
-
-#ifndef __MLIBC_ABI_ONLY
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int prctl (int, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#endif // _SYS_PRCTL_H
-
diff --git a/lib/mlibc/options/linux/include/sys/ptrace.h b/lib/mlibc/options/linux/include/sys/ptrace.h
deleted file mode 100644
index e98d38a..0000000
--- a/lib/mlibc/options/linux/include/sys/ptrace.h
+++ /dev/null
@@ -1,55 +0,0 @@
-
-#ifndef _SYS_PTRACE_H
-#define _SYS_PTRACE_H
-
-#include <abi-bits/ptrace.h>
-#include <stdint.h>
-
-#define PTRACE_TRACEME 0
-#define PT_TRACE_ME PTRACE_TRACEME
-
-#define PT_READ_I PTRACE_PEEKTEXT
-#define PT_READ_D PTRACE_PEEKDATA
-#define PT_READ_U PTRACE_PEEKUSER
-#define PT_WRITE_I PTRACE_POKETEXT
-#define PT_WRITE_D PTRACE_POKEDATA
-#define PT_WRITE_U PTRACE_POKEUSER
-#define PT_CONTINUE PTRACE_CONT
-#define PT_KILL PTRACE_KILL
-#define PT_STEP PTRACE_SINGLESTEP
-#define PT_GETREGS PTRACE_GETREGS
-#define PT_SETREGS PTRACE_SETREGS
-#define PT_GETFPREGS PTRACE_GETFPREGS
-#define PT_SETFPREGS PTRACE_SETFPREGS
-#define PT_ATTACH PTRACE_ATTACH
-#define PT_DETACH PTRACE_DETACH
-#define PT_GETFPXREGS PTRACE_GETFPXREGS
-#define PT_SETFPXREGS PTRACE_SETFPXREGS
-#define PT_SYSCALL PTRACE_SYSCALL
-#define PT_SETOPTIONS PTRACE_SETOPTIONS
-#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
-#define PT_GETSIGINFO PTRACE_GETSIGINFO
-#define PT_SETSIGINFO PTRACE_SETSIGINFO
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct ptrace_peeksiginfo_args {
- uint64_t offset;
- uint32_t flags;
- int32_t nr;
-};
-
-#ifndef __MLIBC_ABI_ONLY
-
-long ptrace(int, ...);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_PTRACE_H
-
diff --git a/lib/mlibc/options/linux/include/sys/quota.h b/lib/mlibc/options/linux/include/sys/quota.h
deleted file mode 100644
index f668d9b..0000000
--- a/lib/mlibc/options/linux/include/sys/quota.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _SYS_QUOTA_H
-#define _SYS_QUOTA_H
-
-#include <sys/types.h>
-
-#define SUBCMDMASK 0x00ff
-#define SUBCMDSHIFT 8
-#define QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK))
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MLIBC_ABI_ONLY
-
-int quotactl(int cmd, const char *special, int id, caddr_t addr);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_QUOTA_H
diff --git a/lib/mlibc/options/linux/include/sys/random.h b/lib/mlibc/options/linux/include/sys/random.h
deleted file mode 100644
index 0b24b74..0000000
--- a/lib/mlibc/options/linux/include/sys/random.h
+++ /dev/null
@@ -1,26 +0,0 @@
-
-#ifndef _SYS_RANDOM_H
-#define _SYS_RANDOM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define GRND_RANDOM 1
-#define GRND_NONBLOCK 2
-
-#include <bits/ssize_t.h>
-#include <bits/size_t.h>
-
-#ifndef __MLIBC_ABI_ONLY
-
-ssize_t getrandom(void *, size_t, unsigned int);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //_SYS_RANDOM_H
-
diff --git a/lib/mlibc/options/linux/include/sys/reboot.h b/lib/mlibc/options/linux/include/sys/reboot.h
deleted file mode 100644
index 6c4e495..0000000
--- a/lib/mlibc/options/linux/include/sys/reboot.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef MLIBC_SYS_REBOOT_H
-#define MLIBC_SYS_REBOOT_H
-
-#include <abi-bits/reboot.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MLIBC_ABI_ONLY
-
-int reboot(int arg);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // MLIBC_SYS_REBOOT_H
diff --git a/lib/mlibc/options/linux/include/sys/sendfile.h b/lib/mlibc/options/linux/include/sys/sendfile.h
deleted file mode 100644
index 32b17ce..0000000
--- a/lib/mlibc/options/linux/include/sys/sendfile.h
+++ /dev/null
@@ -1,22 +0,0 @@
-
-#ifndef _SYS_SENDFILE_H_
-#define _SYS_SENDFILE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <unistd.h>
-
-#ifndef __MLIBC_ABI_ONLY
-
-ssize_t sendfile(int, int, off_t *, size_t);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_SENDFILE_H_
-
diff --git a/lib/mlibc/options/linux/include/sys/signalfd.h b/lib/mlibc/options/linux/include/sys/signalfd.h
deleted file mode 100644
index adf7c1b..0000000
--- a/lib/mlibc/options/linux/include/sys/signalfd.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef _SYS_SIGNALFD_H
-#define _SYS_SIGNALFD_H
-
-// TODO: Define sigset separately and remove this include.
-#include <signal.h>
-// musl includes those. Restructure this so we do not need them?
-#include <stdint.h>
-#include <fcntl.h>
-
-#define SFD_CLOEXEC O_CLOEXEC
-#define SFD_NONBLOCK O_NONBLOCK
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct signalfd_siginfo {
- uint32_t ssi_signo;
- int32_t ssi_errno;
- int32_t ssi_code;
- uint32_t ssi_pid;
- uint32_t ssi_uid;
- int32_t ssi_fd;
- uint32_t ssi_tid;
- uint32_t ssi_band;
- uint32_t ssi_overrun;
- uint32_t ssi_trapno;
- int32_t ssi_status;
- int32_t ssi_int;
- uint64_t ssi_ptr;
- uint64_t ssi_utime;
- uint64_t ssi_stime;
- uint64_t ssi_addr;
- uint16_t ssi_addr_lsb;
- uint8_t pad[128-12*4-4*8-2];
-};
-
-#ifndef __MLIBC_ABI_ONLY
-
-int signalfd(int, const sigset_t *, int);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_SIGNALFD_H
diff --git a/lib/mlibc/options/linux/include/sys/statfs.h b/lib/mlibc/options/linux/include/sys/statfs.h
deleted file mode 100644
index 07ae693..0000000
--- a/lib/mlibc/options/linux/include/sys/statfs.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _SYS_STATFS_H
-#define _SYS_STATFS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <abi-bits/statfs.h>
-
-#ifndef __MLIBC_ABI_ONLY
-
-int statfs(const char *, struct statfs *);
-int fstatfs(int, struct statfs *);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_STATFS_H
-
diff --git a/lib/mlibc/options/linux/include/sys/swap.h b/lib/mlibc/options/linux/include/sys/swap.h
deleted file mode 100644
index 79e89c6..0000000
--- a/lib/mlibc/options/linux/include/sys/swap.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef _SYS_SWAP_H
-#define _SYS_SWAP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define SWAP_FLAG_PREFER 0x8000
-#define SWAP_FLAG_PRIO_MASK 0x7fff
-#define SWAP_FLAG_PRIO_SHIFT 0
-#define SWAP_FLAG_DISCARD 0x10000
-
-#ifndef __MLIBC_ABI_ONLY
-
-int swapon(const char *, int);
-int swapoff(const char *);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _SYS_SWAP_H */
diff --git a/lib/mlibc/options/linux/include/sys/sysinfo.h b/lib/mlibc/options/linux/include/sys/sysinfo.h
deleted file mode 100644
index 917f861..0000000
--- a/lib/mlibc/options/linux/include/sys/sysinfo.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef _SYS_SYSINFO_H
-#define _SYS_SYSINFO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct sysinfo {
- long uptime;
- unsigned long loads[3];
- unsigned long totalram;
- unsigned long freeram;
- unsigned long sharedram;
- unsigned long bufferram;
- unsigned long totalswap;
- unsigned long freeswap;
- unsigned short procs;
- unsigned long totalhigh;
- unsigned long freehigh;
- unsigned int mem_unit;
- char _f[20 - 2 * sizeof(long) - sizeof(int)]; // Padding to 64 bytes according to my man page
-};
-
-#ifndef __MLIBC_ABI_ONLY
-
-int sysinfo(struct sysinfo *);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_SYSINFO_H
diff --git a/lib/mlibc/options/linux/include/sys/sysmacros.h b/lib/mlibc/options/linux/include/sys/sysmacros.h
deleted file mode 100644
index 230858b..0000000
--- a/lib/mlibc/options/linux/include/sys/sysmacros.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef _SYS_SYSMACROS_H
-#define _SYS_SYSMACROS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <bits/inline-definition.h>
-
-__MLIBC_INLINE_DEFINITION unsigned int __mlibc_dev_major(
- unsigned long long int __dev) {
- return ((__dev >> 8) & 0xfff) | ((unsigned int)(__dev >> 32) & ~0xfff);
-}
-
-__MLIBC_INLINE_DEFINITION unsigned int __mlibc_dev_minor(
- unsigned long long int __dev) {
- return (__dev & 0xff) | ((unsigned int)(__dev >> 12) & ~0xff);
-}
-
-__MLIBC_INLINE_DEFINITION unsigned long long int __mlibc_dev_makedev(
- unsigned int __major, unsigned int __minor) {
- return ((__minor & 0xff) | ((__major & 0xfff) << 8)
- | (((unsigned long long int)(__minor & ~0xff)) << 12)
- | (((unsigned long long int)(__major & ~0xfff)) << 32));
-}
-
-#define major(dev) __mlibc_dev_major(dev)
-#define minor(dev) __mlibc_dev_minor(dev)
-#define makedev(major, minor) __mlibc_dev_makedev(major, minor)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_SYSMACROS_H
diff --git a/lib/mlibc/options/linux/include/sys/timerfd.h b/lib/mlibc/options/linux/include/sys/timerfd.h
deleted file mode 100644
index b8a2932..0000000
--- a/lib/mlibc/options/linux/include/sys/timerfd.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef _SYS_TIMERFD_H
-#define _SYS_TIMERFD_H
-
-// musl includes those. Refactor and remove them?
-#include <time.h>
-#include <fcntl.h>
-
-#define TFD_NONBLOCK O_NONBLOCK
-#define TFD_CLOEXEC O_CLOEXEC
-
-#define TFD_TIMER_ABSTIME 1
-#define TFD_TIMER_CANCEL_ON_SET (1 << 1)
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct itimerspec;
-
-#ifndef __MLIBC_ABI_ONLY
-
-int timerfd_create(int, int);
-int timerfd_settime(int, int, const struct itimerspec *, struct itimerspec *);
-int timerfd_gettime(int, struct itimerspec *);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_TIMERFD_H
diff --git a/lib/mlibc/options/linux/include/sys/vfs.h b/lib/mlibc/options/linux/include/sys/vfs.h
deleted file mode 100644
index 61a6aa3..0000000
--- a/lib/mlibc/options/linux/include/sys/vfs.h
+++ /dev/null
@@ -1,16 +0,0 @@
-
-#ifndef _SYS_VFS_H
-#define _SYS_VFS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/statfs.h>
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _SYS_VFS_H
-
diff --git a/lib/mlibc/options/linux/include/sys/vt.h b/lib/mlibc/options/linux/include/sys/vt.h
deleted file mode 100644
index d9dfbd9..0000000
--- a/lib/mlibc/options/linux/include/sys/vt.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _SYS_VT_H
-#define _SYS_VT_H
-
-#include <abi-bits/vt.h>
-
-#endif // _SYS_VT_H
diff --git a/lib/mlibc/options/linux/include/sys/xattr.h b/lib/mlibc/options/linux/include/sys/xattr.h
deleted file mode 100644
index e54c58c..0000000
--- a/lib/mlibc/options/linux/include/sys/xattr.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef _MLIBC_LINUX_SYS_XATTR_H
-#define _MLIBC_LINUX_SYS_XATTR_H
-
-#include <sys/types.h>
-#include <abi-bits/xattr.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef __MLIBC_ABI_ONLY
-
-int setxattr(const char *path, const char *name, const void *val, size_t size,
- int flags);
-int lsetxattr(const char *path, const char *name, const void *val, size_t size,
- int flags);
-int fsetxattr(int fd, const char *name, const void *val, size_t size,
- int flags);
-
-ssize_t getxattr(const char *path, const char *name, void *val, size_t size);
-ssize_t lgetxattr(const char *path, const char *name, void *val, size_t size);
-ssize_t fgetxattr(int fd, const char *name, void *val, size_t size);
-
-ssize_t listxattr(const char *path, char *list, size_t size);
-ssize_t llistxattr(const char *path, char *list, size_t size);
-ssize_t flistxattr(int fd, char *list, size_t size);
-
-int removexattr(const char *path, const char *name);
-int lremovexattr(const char *path, const char *name);
-int fremovexattr(int fd, const char *name);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _MLIBC_LINUX_SYS_XATTR_H */
diff --git a/lib/mlibc/options/linux/include/utmp.h b/lib/mlibc/options/linux/include/utmp.h
deleted file mode 100644
index e83d7a5..0000000
--- a/lib/mlibc/options/linux/include/utmp.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef _UTMP_H
-#define _UTMP_H
-
-#include <abi-bits/pid_t.h>
-#include <bits/posix/timeval.h>
-#include <bits/types.h>
-#include <paths.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define EMPTY 0
-#define RUN_LVL 1
-#define BOOT_TIME 2
-#define NEW_TIME 3
-#define OLD_TIME 4
-#define INIT_PROCESS 5
-#define LOGIN_PROCESS 6
-#define USER_PROCESS 7
-#define DEAD_PROCESS 8
-#define ACCOUNTING 9
-
-#define UT_LINESIZE 32
-#define UT_NAMESIZE 32
-#define UT_HOSTSIZE 256
-
-#define WTMP_FILE _PATH_WTMP
-#define WTMP_FILENAME _PATH_WTMP
-
-#define UTMP_FILE _PATH_UTMP
-#define UTMP_FILENAME _PATH_UTMP
-
-struct exit_status {
- short int e_termination;
- short int e_exit;
-};
-
-struct utmp {
- short ut_type;
- pid_t ut_pid;
- char ut_line[UT_LINESIZE];
- char ut_id[4];
- char ut_user[UT_NAMESIZE];
- char ut_host[UT_HOSTSIZE];
- struct exit_status ut_exit;
- long ut_session;
- struct timeval ut_tv;
- __mlibc_int32 ut_addr_v6[4];
- char __unused[20];
-};
-
-struct lastlog {
- time_t ll_time;
- char ll_line[UT_LINESIZE];
- char ll_host[UT_HOSTSIZE];
-};
-
-/* Hacks for compability reasons */
-#define ut_name ut_user
-#ifndef _NO_UT_TIME
-#define ut_time ut_tv.tv_sec
-#endif
-#define ut_xtime ut_tv.tv_sec
-#define ut_addr ut_addr_v6[0]
-
-#ifndef __MLIBC_ABI_ONLY
-
-void setutent(void);
-struct utmp *getutent(void);
-int getutent_r(struct utmp *, struct utmp **);
-void endutent(void);
-struct utmp *pututline(const struct utmp *);
-struct utmp *getutline(const struct utmp *);
-struct utmp *getutid(const struct utmp *);
-int utmpname(const char *);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _UTMP_H
diff --git a/lib/mlibc/options/linux/include/utmpx.h b/lib/mlibc/options/linux/include/utmpx.h
deleted file mode 100644
index 32629dd..0000000
--- a/lib/mlibc/options/linux/include/utmpx.h
+++ /dev/null
@@ -1,68 +0,0 @@
-
-#ifndef _UTMPX_H
-#define _UTMPX_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <abi-bits/pid_t.h>
-#include <bits/posix/timeval.h>
-
-// Struct definition taken from musl
-struct utmpx {
- short ut_type;
- short __ut_pad1;
- pid_t ut_pid;
- char ut_line[32];
- char ut_id[4];
- char ut_user[32];
- char ut_host[256];
- struct {
- short __e_termination;
- short __e_exit;
- } ut_exit;
- int ut_session, __ut_pad2;
- struct timeval ut_tv;
- unsigned ut_addr_v6[4];
- char __unused[20];
-};
-
-#define e_exit __e_exit
-#define e_termination __e_termination
-
-#ifndef __MLIBC_ABI_ONLY
-
-void updwtmpx(const char *, const struct utmpx *);
-int utmpxname(const char *);
-struct utmpx *pututxline(const struct utmpx *);
-struct utmpx *getutxent(void);
-struct utmpx *getutxid(const struct utmpx *id);
-void setutxent(void);
-void endutxent(void);
-
-#endif /* !__MLIBC_ABI_ONLY */
-
-#define EMPTY 0
-#define RUN_LVL 1
-#define BOOT_TIME 2
-#define NEW_TIME 3
-#define OLD_TIME 4
-#define INIT_PROCESS 5
-#define LOGIN_PROCESS 6
-#define USER_PROCESS 7
-#define DEAD_PROCESS 8
-
-#ifdef _GNU_SOURCE
-#define ACCOUNTING 9
-#endif
-
-#define __UT_HOSTSIZE 256
-#define __UT_NAMESIZE 32
-#define __UT_LINESIZE 32
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _UTMPX_H
diff --git a/lib/mlibc/options/linux/include/values.h b/lib/mlibc/options/linux/include/values.h
deleted file mode 100644
index 55a50cd..0000000
--- a/lib/mlibc/options/linux/include/values.h
+++ /dev/null
@@ -1,39 +0,0 @@
-
-#ifndef _VALUES_H
-#define _VALUES_H
-
-#include <limits.h>
-#include <float.h>
-
-#define CHARBITS (sizeof(char) * 8)
-#define SHORTBITS (sizeof(short) * 8)
-#define INTBITS (sizeof(int) * 8)
-#define LONGBITS (sizeof(long) * 8)
-#define PTRBITS (sizeof(char *) * 8)
-#define DOUBLEBITS (sizeof(double) * 8)
-#define FLOATBITS (sizeof(float) * 8)
-
-#define MINSHORT SHRT_MIN
-#define MININT INT_MIN
-#define MINLONG LONG_MIN
-
-#define MAXSHORT SHRT_MAX
-#define MAXINT INT_MAX
-#define MAXLONG LONG_MAX
-
-#define HIBITS MINSHORT
-#define HIBITL MINLONG
-
-#define MAXDOUBLE DBL_MAX
-#define MAXFLOAT FLT_MAX
-#define MINDOUBLE DBL_MIN
-#define MINFLOAT FLT_MIN
-#define DMINEXP DBL_MIN_EXP
-#define FMINEXP FLT_MIN_EXP
-#define DMAXEXP DBL_MAX_EXP
-#define FMAXEXP FLT_MAX_EXP
-
-#define BITSPERBYTE CHAR_BIT
-
-#endif // _VALUES_H
-
diff --git a/lib/mlibc/options/linux/meson.build b/lib/mlibc/options/linux/meson.build
deleted file mode 100644
index eb8fefc..0000000
--- a/lib/mlibc/options/linux/meson.build
+++ /dev/null
@@ -1,96 +0,0 @@
-
-if disable_linux_option
- subdir_done()
-endif
-libc_sources += files(
- 'generic/mntent-stubs.cpp',
- 'generic/pty-stubs.cpp',
- 'generic/sys-epoll.cpp',
- 'generic/sys-inotify-stubs.cpp',
- 'generic/sys-mount.cpp',
- 'generic/sys-prctl-stubs.cpp',
- 'generic/sys-ptrace-stubs.cpp',
- 'generic/sys-random-stubs.cpp',
- 'generic/sys-sendfile-stubs.cpp',
- 'generic/sys-signalfd.cpp',
- 'generic/sys-timerfd.cpp',
- 'generic/sys-eventfd.cpp',
- 'generic/sys-reboot.cpp',
- 'generic/sys-xattr.cpp',
- 'generic/utmp-stubs.cpp',
- 'generic/utmpx.cpp',
- 'generic/linux-unistd.cpp',
- 'generic/malloc.cpp',
- 'generic/sys-fsuid.cpp',
- 'generic/ifaddrs.cpp',
- 'generic/sys-sysinfo.cpp',
- 'generic/module.cpp',
- 'generic/sys-klog.cpp',
- 'generic/sched.cpp',
- 'generic/sys-quota.cpp',
- 'generic/capabilities.cpp',
- 'generic/cpuset.cpp',
- 'generic/sys-swap.cpp',
- 'generic/sys-statfs-stubs.cpp',
-)
-
-if not no_headers
- install_headers(
- 'include/ifaddrs.h',
- 'include/malloc.h',
- 'include/memory.h',
- 'include/mntent.h',
- 'include/pty.h',
- 'include/utmp.h',
- 'include/utmpx.h',
- 'include/values.h',
- 'include/lastlog.h',
- 'include/module.h',
- )
- install_headers(
- 'include/bits/linux/linux_unistd.h',
- 'include/bits/linux/linux_sched.h',
- 'include/bits/linux/cpu_set.h',
- subdir: 'bits/linux'
- )
- install_headers(
- 'include/netpacket/packet.h',
- subdir: 'netpacket'
- )
- # libc provides these, not the kernel, so the Linux option shall provide them too.
- install_headers(
- 'include/scsi/scsi.h',
- 'include/scsi/scsi_ioctl.h',
- 'include/scsi/sg.h',
- subdir: 'scsi'
- )
- install_headers(
- 'include/sys/epoll.h',
- 'include/sys/inotify.h',
- 'include/sys/mount.h',
- 'include/sys/prctl.h',
- 'include/sys/ptrace.h',
- 'include/sys/random.h',
- 'include/sys/sendfile.h',
- 'include/sys/signalfd.h',
- 'include/sys/sysmacros.h',
- 'include/sys/timerfd.h',
- 'include/sys/eventfd.h',
- 'include/sys/reboot.h',
- 'include/sys/fsuid.h',
- 'include/sys/vt.h',
- 'include/sys/sysinfo.h',
- 'include/sys/klog.h',
- 'include/sys/xattr.h',
- 'include/sys/quota.h',
- 'include/sys/swap.h',
- 'include/sys/statfs.h',
- 'include/sys/vfs.h',
- subdir: 'sys'
- )
- install_headers(
- 'include/linux/libc-compat.h',
- subdir: 'linux'
- )
-endif
-