cleanup src/linux and src/misc trees, etc.
previously, it was pretty much random which one of these trees a given
function appeared in. they have now been organized into:
src/linux: non-POSIX linux syscalls (possibly shard with other nixen)
src/legacy: various obsolete/legacy functions, mostly wrappers
src/misc: still mostly uncategorized; some misc POSIX, some nonstd
src/crypt: crypt hash functions
further cleanup will be done later.
diff --git a/src/misc/crypt.c b/src/crypt/crypt.c
similarity index 100%
rename from src/misc/crypt.c
rename to src/crypt/crypt.c
diff --git a/src/misc/crypt_blowfish.c b/src/crypt/crypt_blowfish.c
similarity index 100%
rename from src/misc/crypt_blowfish.c
rename to src/crypt/crypt_blowfish.c
diff --git a/src/misc/crypt_des.c b/src/crypt/crypt_des.c
similarity index 100%
rename from src/misc/crypt_des.c
rename to src/crypt/crypt_des.c
diff --git a/src/misc/crypt_r.c b/src/crypt/crypt_r.c
similarity index 100%
rename from src/misc/crypt_r.c
rename to src/crypt/crypt_r.c
diff --git a/src/misc/crypt_sha256.c b/src/crypt/crypt_sha256.c
similarity index 100%
rename from src/misc/crypt_sha256.c
rename to src/crypt/crypt_sha256.c
diff --git a/src/misc/crypt_sha512.c b/src/crypt/crypt_sha512.c
similarity index 100%
rename from src/misc/crypt_sha512.c
rename to src/crypt/crypt_sha512.c
diff --git a/src/misc/cuserid.c b/src/legacy/cuserid.c
similarity index 100%
rename from src/misc/cuserid.c
rename to src/legacy/cuserid.c
diff --git a/src/linux/daemon.c b/src/legacy/daemon.c
similarity index 100%
rename from src/linux/daemon.c
rename to src/legacy/daemon.c
diff --git a/src/linux/err.c b/src/legacy/err.c
similarity index 100%
rename from src/linux/err.c
rename to src/legacy/err.c
diff --git a/src/misc/ftw.c b/src/legacy/ftw.c
similarity index 100%
rename from src/misc/ftw.c
rename to src/legacy/ftw.c
diff --git a/src/misc/futimes.c b/src/legacy/futimes.c
similarity index 100%
rename from src/misc/futimes.c
rename to src/legacy/futimes.c
diff --git a/src/linux/getdtablesize.c b/src/legacy/getdtablesize.c
similarity index 100%
rename from src/linux/getdtablesize.c
rename to src/legacy/getdtablesize.c
diff --git a/src/linux/getpagesize.c b/src/legacy/getpagesize.c
similarity index 100%
rename from src/linux/getpagesize.c
rename to src/legacy/getpagesize.c
diff --git a/src/linux/getpass.c b/src/legacy/getpass.c
similarity index 100%
rename from src/linux/getpass.c
rename to src/legacy/getpass.c
diff --git a/src/misc/getusershell.c b/src/legacy/getusershell.c
similarity index 100%
rename from src/misc/getusershell.c
rename to src/legacy/getusershell.c
diff --git a/src/misc/isastream.c b/src/legacy/isastream.c
similarity index 100%
rename from src/misc/isastream.c
rename to src/legacy/isastream.c
diff --git a/src/misc/lutimes.c b/src/legacy/lutimes.c
similarity index 100%
rename from src/misc/lutimes.c
rename to src/legacy/lutimes.c
diff --git a/src/misc/ulimit.c b/src/legacy/ulimit.c
similarity index 100%
rename from src/misc/ulimit.c
rename to src/legacy/ulimit.c
diff --git a/src/stub/utmpx.c b/src/legacy/utmpx.c
similarity index 100%
rename from src/stub/utmpx.c
rename to src/legacy/utmpx.c
diff --git a/src/linux/epoll.c b/src/linux/epoll.c
new file mode 100644
index 0000000..35f70ed
--- /dev/null
+++ b/src/linux/epoll.c
@@ -0,0 +1,27 @@
+#include <sys/epoll.h>
+#include "syscall.h"
+
+int epoll_create(int size)
+{
+ return syscall(SYS_epoll_create, size);
+}
+
+int epoll_create1(int flags)
+{
+ return syscall(SYS_epoll_create1, flags);
+}
+
+int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev)
+{
+ return syscall(SYS_epoll_ctl, fd, op, fd2, ev);
+}
+
+int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t *sigs)
+{
+ return syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, __SYSCALL_SSLEN);
+}
+
+int epoll_wait(int fd, struct epoll_event *ev, int cnt, int to)
+{
+ return syscall(SYS_epoll_wait, fd, ev, cnt, to);
+}
diff --git a/src/linux/epoll_create.c b/src/linux/epoll_create.c
deleted file mode 100644
index 29d8299..0000000
--- a/src/linux/epoll_create.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/epoll.h>
-#include "syscall.h"
-
-int epoll_create(int size)
-{
- return syscall(SYS_epoll_create, size);
-}
diff --git a/src/linux/epoll_create1.c b/src/linux/epoll_create1.c
deleted file mode 100644
index 380b5da..0000000
--- a/src/linux/epoll_create1.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/epoll.h>
-#include "syscall.h"
-
-int epoll_create1(int flags)
-{
- return syscall(SYS_epoll_create1, flags);
-}
diff --git a/src/linux/epoll_ctl.c b/src/linux/epoll_ctl.c
deleted file mode 100644
index da3e999..0000000
--- a/src/linux/epoll_ctl.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/epoll.h>
-#include "syscall.h"
-
-int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev)
-{
- return syscall(SYS_epoll_ctl, fd, op, fd2, ev);
-}
diff --git a/src/linux/epoll_pwait.c b/src/linux/epoll_pwait.c
deleted file mode 100644
index 3ecdbb5..0000000
--- a/src/linux/epoll_pwait.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/epoll.h>
-#include "syscall.h"
-
-int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t *sigs)
-{
- return syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, __SYSCALL_SSLEN);
-}
diff --git a/src/linux/epoll_wait.c b/src/linux/epoll_wait.c
deleted file mode 100644
index 9d3924e..0000000
--- a/src/linux/epoll_wait.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/epoll.h>
-#include "syscall.h"
-
-int epoll_wait(int fd, struct epoll_event *ev, int cnt, int to)
-{
- return syscall(SYS_epoll_wait, fd, ev, cnt, to);
-}
diff --git a/src/linux/eventfd.c b/src/linux/eventfd.c
index cb39a7b..5306648 100644
--- a/src/linux/eventfd.c
+++ b/src/linux/eventfd.c
@@ -1,7 +1,18 @@
#include <sys/eventfd.h>
+#include <unistd.h>
#include "syscall.h"
int eventfd(unsigned int count, int flags)
{
return syscall(flags ? SYS_eventfd2 : SYS_eventfd, count, flags);
}
+
+int eventfd_read(int fd, eventfd_t *value)
+{
+ return (sizeof(*value) == read(fd, value, sizeof(*value))) ? 0 : -1;
+}
+
+int eventfd_write(int fd, eventfd_t value)
+{
+ return (sizeof(value) == write(fd, &value, sizeof(value))) ? 0 : -1;
+}
diff --git a/src/linux/eventfd_read.c b/src/linux/eventfd_read.c
deleted file mode 100644
index 969e661..0000000
--- a/src/linux/eventfd_read.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/eventfd.h>
-#include <unistd.h>
-
-int eventfd_read(int fd, eventfd_t *value)
-{
- return (sizeof(*value) == read(fd, value, sizeof(*value))) ? 0 : -1;
-}
diff --git a/src/linux/eventfd_write.c b/src/linux/eventfd_write.c
deleted file mode 100644
index 734fa36..0000000
--- a/src/linux/eventfd_write.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/eventfd.h>
-#include <unistd.h>
-
-int eventfd_write(int fd, eventfd_t value)
-{
- return (sizeof(value) == write(fd, &value, sizeof(value))) ? 0 : -1;
-}
diff --git a/src/linux/inotify.c b/src/linux/inotify.c
new file mode 100644
index 0000000..d3b4fa0
--- /dev/null
+++ b/src/linux/inotify.c
@@ -0,0 +1,21 @@
+#include <sys/inotify.h>
+#include "syscall.h"
+
+int inotify_init()
+{
+ return syscall(SYS_inotify_init);
+}
+int inotify_init1(int flags)
+{
+ return syscall(SYS_inotify_init1, flags);
+}
+
+int inotify_add_watch(int fd, const char *pathname, uint32_t mask)
+{
+ return syscall(SYS_inotify_add_watch, fd, pathname, mask);
+}
+
+int inotify_rm_watch(int fd, uint32_t wd)
+{
+ return syscall(SYS_inotify_rm_watch, fd, wd);
+}
diff --git a/src/linux/inotify_add_watch.c b/src/linux/inotify_add_watch.c
deleted file mode 100644
index 75f207d..0000000
--- a/src/linux/inotify_add_watch.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/inotify.h>
-#include "syscall.h"
-
-int inotify_add_watch(int fd, const char *pathname, uint32_t mask)
-{
- return syscall(SYS_inotify_add_watch, fd, pathname, mask);
-}
diff --git a/src/linux/inotify_init.c b/src/linux/inotify_init.c
deleted file mode 100644
index 0507084..0000000
--- a/src/linux/inotify_init.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/inotify.h>
-#include "syscall.h"
-
-int inotify_init()
-{
- return syscall(SYS_inotify_init);
-}
diff --git a/src/linux/inotify_init1.c b/src/linux/inotify_init1.c
deleted file mode 100644
index 6472a7b..0000000
--- a/src/linux/inotify_init1.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/inotify.h>
-#include "syscall.h"
-
-int inotify_init1(int flags)
-{
- return syscall(SYS_inotify_init1, flags);
-}
diff --git a/src/linux/inotify_rm_watch.c b/src/linux/inotify_rm_watch.c
deleted file mode 100644
index cba597e..0000000
--- a/src/linux/inotify_rm_watch.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/inotify.h>
-#include "syscall.h"
-
-int inotify_rm_watch(int fd, uint32_t wd)
-{
- return syscall(SYS_inotify_rm_watch, fd, wd);
-}
diff --git a/src/linux/mount.c b/src/linux/mount.c
index 83a8db4..34e11af 100644
--- a/src/linux/mount.c
+++ b/src/linux/mount.c
@@ -5,3 +5,13 @@
{
return syscall(SYS_mount, special, dir, fstype, flags, data);
}
+
+int umount(const char *special)
+{
+ return syscall(SYS_umount2, special, 0);
+}
+
+int umount2(const char *special, int flags)
+{
+ return syscall(SYS_umount2, special, flags);
+}
diff --git a/src/misc/prlimit.c b/src/linux/prlimit.c
similarity index 100%
rename from src/misc/prlimit.c
rename to src/linux/prlimit.c
diff --git a/src/misc/ptrace.c b/src/linux/ptrace.c
similarity index 100%
rename from src/misc/ptrace.c
rename to src/linux/ptrace.c
diff --git a/src/linux/swapon.c b/src/linux/swap.c
similarity index 64%
rename from src/linux/swapon.c
rename to src/linux/swap.c
index 2b40a30..8137d51 100644
--- a/src/linux/swapon.c
+++ b/src/linux/swap.c
@@ -5,3 +5,8 @@
{
return syscall(SYS_swapon, path, flags);
}
+
+int swapoff(const char *path)
+{
+ return syscall(SYS_swapoff, path);
+}
diff --git a/src/linux/swapoff.c b/src/linux/swapoff.c
deleted file mode 100644
index 9f95e82..0000000
--- a/src/linux/swapoff.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/swap.h>
-#include "syscall.h"
-
-int swapoff(const char *path)
-{
- return syscall(SYS_swapoff, path);
-}
diff --git a/src/linux/umount.c b/src/linux/umount.c
deleted file mode 100644
index fb9b5e7..0000000
--- a/src/linux/umount.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/mount.h>
-#include "syscall.h"
-
-int umount(const char *special)
-{
- return syscall(SYS_umount2, special, 0);
-}
diff --git a/src/linux/umount2.c b/src/linux/umount2.c
deleted file mode 100644
index 25ad057..0000000
--- a/src/linux/umount2.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/mount.h>
-#include "syscall.h"
-
-int umount2(const char *special, int flags)
-{
- return syscall(SYS_umount2, special, flags);
-}
diff --git a/src/linux/gethostid.c b/src/misc/gethostid.c
similarity index 100%
rename from src/linux/gethostid.c
rename to src/misc/gethostid.c
diff --git a/src/linux/getopt_long.c b/src/misc/getopt_long.c
similarity index 100%
rename from src/linux/getopt_long.c
rename to src/misc/getopt_long.c
diff --git a/src/linux/initgroups.c b/src/misc/initgroups.c
similarity index 100%
rename from src/linux/initgroups.c
rename to src/misc/initgroups.c
diff --git a/src/linux/mntent.c b/src/misc/mntent.c
similarity index 100%
rename from src/linux/mntent.c
rename to src/misc/mntent.c
diff --git a/src/linux/syscall.c b/src/misc/syscall.c
similarity index 100%
rename from src/linux/syscall.c
rename to src/misc/syscall.c