OSDN Git Service

cleanup src/linux and src/misc trees, etc.
authorRich Felker <dalias@aerifal.cx>
Fri, 7 Sep 2012 04:48:25 +0000 (00:48 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 7 Sep 2012 04:48:25 +0000 (00:48 -0400)
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.

45 files changed:
src/crypt/crypt.c [moved from src/misc/crypt.c with 100% similarity]
src/crypt/crypt_blowfish.c [moved from src/misc/crypt_blowfish.c with 100% similarity]
src/crypt/crypt_des.c [moved from src/misc/crypt_des.c with 100% similarity]
src/crypt/crypt_r.c [moved from src/misc/crypt_r.c with 100% similarity]
src/crypt/crypt_sha256.c [moved from src/misc/crypt_sha256.c with 100% similarity]
src/crypt/crypt_sha512.c [moved from src/misc/crypt_sha512.c with 100% similarity]
src/legacy/cuserid.c [moved from src/misc/cuserid.c with 100% similarity]
src/legacy/daemon.c [moved from src/linux/daemon.c with 100% similarity]
src/legacy/err.c [moved from src/linux/err.c with 100% similarity]
src/legacy/ftw.c [moved from src/misc/ftw.c with 100% similarity]
src/legacy/futimes.c [moved from src/misc/futimes.c with 100% similarity]
src/legacy/getdtablesize.c [moved from src/linux/getdtablesize.c with 100% similarity]
src/legacy/getpagesize.c [moved from src/linux/getpagesize.c with 100% similarity]
src/legacy/getpass.c [moved from src/linux/getpass.c with 100% similarity]
src/legacy/getusershell.c [moved from src/misc/getusershell.c with 100% similarity]
src/legacy/isastream.c [moved from src/misc/isastream.c with 100% similarity]
src/legacy/lutimes.c [moved from src/misc/lutimes.c with 100% similarity]
src/legacy/ulimit.c [moved from src/misc/ulimit.c with 100% similarity]
src/legacy/utmpx.c [moved from src/stub/utmpx.c with 100% similarity]
src/linux/epoll.c [new file with mode: 0644]
src/linux/epoll_create.c [deleted file]
src/linux/epoll_create1.c [deleted file]
src/linux/epoll_ctl.c [deleted file]
src/linux/epoll_pwait.c [deleted file]
src/linux/epoll_wait.c [deleted file]
src/linux/eventfd.c
src/linux/eventfd_read.c [deleted file]
src/linux/eventfd_write.c [deleted file]
src/linux/inotify.c [new file with mode: 0644]
src/linux/inotify_add_watch.c [deleted file]
src/linux/inotify_init.c [deleted file]
src/linux/inotify_init1.c [deleted file]
src/linux/inotify_rm_watch.c [deleted file]
src/linux/mount.c
src/linux/prlimit.c [moved from src/misc/prlimit.c with 100% similarity]
src/linux/ptrace.c [moved from src/misc/ptrace.c with 100% similarity]
src/linux/swap.c [moved from src/linux/swapon.c with 64% similarity]
src/linux/swapoff.c [deleted file]
src/linux/umount.c [deleted file]
src/linux/umount2.c [deleted file]
src/misc/gethostid.c [moved from src/linux/gethostid.c with 100% similarity]
src/misc/getopt_long.c [moved from src/linux/getopt_long.c with 100% similarity]
src/misc/initgroups.c [moved from src/linux/initgroups.c with 100% similarity]
src/misc/mntent.c [moved from src/linux/mntent.c with 100% similarity]
src/misc/syscall.c [moved from src/linux/syscall.c with 100% similarity]

similarity index 100%
rename from src/misc/crypt.c
rename to src/crypt/crypt.c
similarity index 100%
rename from src/misc/crypt_des.c
rename to src/crypt/crypt_des.c
similarity index 100%
rename from src/misc/crypt_r.c
rename to src/crypt/crypt_r.c
similarity index 100%
rename from src/misc/cuserid.c
rename to src/legacy/cuserid.c
similarity index 100%
rename from src/linux/daemon.c
rename to src/legacy/daemon.c
similarity index 100%
rename from src/linux/err.c
rename to src/legacy/err.c
similarity index 100%
rename from src/misc/ftw.c
rename to src/legacy/ftw.c
similarity index 100%
rename from src/misc/futimes.c
rename to src/legacy/futimes.c
similarity index 100%
rename from src/linux/getpass.c
rename to src/legacy/getpass.c
similarity index 100%
rename from src/misc/isastream.c
rename to src/legacy/isastream.c
similarity index 100%
rename from src/misc/lutimes.c
rename to src/legacy/lutimes.c
similarity index 100%
rename from src/misc/ulimit.c
rename to src/legacy/ulimit.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 (file)
index 0000000..35f70ed
--- /dev/null
@@ -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 (file)
index 29d8299..0000000
+++ /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 (file)
index 380b5da..0000000
+++ /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 (file)
index da3e999..0000000
+++ /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 (file)
index 3ecdbb5..0000000
+++ /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 (file)
index 9d3924e..0000000
+++ /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);
-}
index cb39a7b..5306648 100644 (file)
@@ -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 (file)
index 969e661..0000000
+++ /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 (file)
index 734fa36..0000000
+++ /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 (file)
index 0000000..d3b4fa0
--- /dev/null
@@ -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 (file)
index 75f207d..0000000
+++ /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 (file)
index 0507084..0000000
+++ /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 (file)
index 6472a7b..0000000
+++ /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 (file)
index cba597e..0000000
+++ /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);
-}
index 83a8db4..34e11af 100644 (file)
@@ -5,3 +5,13 @@ int mount(const char *special, const char *dir, const char *fstype, unsigned lon
 {
        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);
+}
similarity index 100%
rename from src/misc/prlimit.c
rename to src/linux/prlimit.c
similarity index 100%
rename from src/misc/ptrace.c
rename to src/linux/ptrace.c
similarity index 64%
rename from src/linux/swapon.c
rename to src/linux/swap.c
index 2b40a30..8137d51 100644 (file)
@@ -5,3 +5,8 @@ int swapon(const char *path, int flags)
 {
        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 (file)
index 9f95e82..0000000
+++ /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 (file)
index fb9b5e7..0000000
+++ /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 (file)
index 25ad057..0000000
+++ /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);
-}
similarity index 100%
rename from src/linux/gethostid.c
rename to src/misc/gethostid.c
similarity index 100%
rename from src/linux/initgroups.c
rename to src/misc/initgroups.c
similarity index 100%
rename from src/linux/mntent.c
rename to src/misc/mntent.c
similarity index 100%
rename from src/linux/syscall.c
rename to src/misc/syscall.c