Ver Fonte

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.
Rich Felker há 12 anos atrás
pai
commit
b9bb8f67bb

+ 0 - 0
src/misc/crypt.c → src/crypt/crypt.c


+ 0 - 0
src/misc/crypt_blowfish.c → src/crypt/crypt_blowfish.c


+ 0 - 0
src/misc/crypt_des.c → src/crypt/crypt_des.c


+ 0 - 0
src/misc/crypt_r.c → src/crypt/crypt_r.c


+ 0 - 0
src/misc/crypt_sha256.c → src/crypt/crypt_sha256.c


+ 0 - 0
src/misc/crypt_sha512.c → src/crypt/crypt_sha512.c


+ 0 - 0
src/misc/cuserid.c → src/legacy/cuserid.c


+ 0 - 0
src/linux/daemon.c → src/legacy/daemon.c


+ 0 - 0
src/linux/err.c → src/legacy/err.c


+ 0 - 0
src/misc/ftw.c → src/legacy/ftw.c


+ 0 - 0
src/misc/futimes.c → src/legacy/futimes.c


+ 0 - 0
src/linux/getdtablesize.c → src/legacy/getdtablesize.c


+ 0 - 0
src/linux/getpagesize.c → src/legacy/getpagesize.c


+ 0 - 0
src/linux/getpass.c → src/legacy/getpass.c


+ 0 - 0
src/misc/getusershell.c → src/legacy/getusershell.c


+ 0 - 0
src/misc/isastream.c → src/legacy/isastream.c


+ 0 - 0
src/misc/lutimes.c → src/legacy/lutimes.c


+ 0 - 0
src/misc/ulimit.c → src/legacy/ulimit.c


+ 0 - 0
src/stub/utmpx.c → src/legacy/utmpx.c


+ 27 - 0
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);
+}

+ 0 - 7
src/linux/epoll_create.c

@@ -1,7 +0,0 @@
-#include <sys/epoll.h>
-#include "syscall.h"
-
-int epoll_create(int size)
-{
-	return syscall(SYS_epoll_create, size);
-}

+ 0 - 7
src/linux/epoll_create1.c

@@ -1,7 +0,0 @@
-#include <sys/epoll.h>
-#include "syscall.h"
-
-int epoll_create1(int flags)
-{
-	return syscall(SYS_epoll_create1, flags);
-}

+ 0 - 7
src/linux/epoll_ctl.c

@@ -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);
-}

+ 0 - 7
src/linux/epoll_pwait.c

@@ -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);
-}

+ 0 - 7
src/linux/epoll_wait.c

@@ -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);
-}

+ 11 - 0
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;
+}

+ 0 - 7
src/linux/eventfd_read.c

@@ -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;
-}

+ 0 - 7
src/linux/eventfd_write.c

@@ -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;
-}

+ 21 - 0
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);
+}

+ 0 - 7
src/linux/inotify_add_watch.c

@@ -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);
-}

+ 0 - 7
src/linux/inotify_init.c

@@ -1,7 +0,0 @@
-#include <sys/inotify.h>
-#include "syscall.h"
-
-int inotify_init()
-{
-	return syscall(SYS_inotify_init);
-}

+ 0 - 7
src/linux/inotify_init1.c

@@ -1,7 +0,0 @@
-#include <sys/inotify.h>
-#include "syscall.h"
-
-int inotify_init1(int flags)
-{
-	return syscall(SYS_inotify_init1, flags);
-}

+ 0 - 7
src/linux/inotify_rm_watch.c

@@ -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);
-}

+ 10 - 0
src/linux/mount.c

@@ -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);
+}

+ 0 - 0
src/misc/prlimit.c → src/linux/prlimit.c


+ 0 - 0
src/misc/ptrace.c → src/linux/ptrace.c


+ 5 - 0
src/linux/swapon.c → src/linux/swap.c

@@ -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);
+}

+ 0 - 7
src/linux/swapoff.c

@@ -1,7 +0,0 @@
-#include <sys/swap.h>
-#include "syscall.h"
-
-int swapoff(const char *path)
-{
-	return syscall(SYS_swapoff, path);
-}

+ 0 - 7
src/linux/umount.c

@@ -1,7 +0,0 @@
-#include <sys/mount.h>
-#include "syscall.h"
-
-int umount(const char *special)
-{
-	return syscall(SYS_umount2, special, 0);
-}

+ 0 - 7
src/linux/umount2.c

@@ -1,7 +0,0 @@
-#include <sys/mount.h>
-#include "syscall.h"
-
-int umount2(const char *special, int flags)
-{
-	return syscall(SYS_umount2, special, flags);
-}

+ 0 - 0
src/linux/gethostid.c → src/misc/gethostid.c


+ 0 - 0
src/linux/getopt_long.c → src/misc/getopt_long.c


+ 0 - 0
src/linux/initgroups.c → src/misc/initgroups.c


+ 0 - 0
src/linux/mntent.c → src/misc/mntent.c


+ 0 - 0
src/linux/syscall.c → src/misc/syscall.c