diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-09-07 00:48:25 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-09-07 00:48:25 -0400 |
commit | b9bb8f67bbac9bab5314fb00974ad469476e936e (patch) | |
tree | 89fc3a733b4cd9a2346c5b77d8953b4f7aa9dd22 | |
parent | 780aede41913528781bbc8ff0d0e27505595f7c0 (diff) | |
download | musl-b9bb8f67bbac9bab5314fb00974ad469476e936e.zip musl-b9bb8f67bbac9bab5314fb00974ad469476e936e.tar.gz musl-b9bb8f67bbac9bab5314fb00974ad469476e936e.tar.bz2 |
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.
-rw-r--r-- | src/crypt/crypt.c (renamed from src/misc/crypt.c) | 0 | ||||
-rw-r--r-- | src/crypt/crypt_blowfish.c (renamed from src/misc/crypt_blowfish.c) | 0 | ||||
-rw-r--r-- | src/crypt/crypt_des.c (renamed from src/misc/crypt_des.c) | 0 | ||||
-rw-r--r-- | src/crypt/crypt_r.c (renamed from src/misc/crypt_r.c) | 0 | ||||
-rw-r--r-- | src/crypt/crypt_sha256.c (renamed from src/misc/crypt_sha256.c) | 0 | ||||
-rw-r--r-- | src/crypt/crypt_sha512.c (renamed from src/misc/crypt_sha512.c) | 0 | ||||
-rw-r--r-- | src/legacy/cuserid.c (renamed from src/misc/cuserid.c) | 0 | ||||
-rw-r--r-- | src/legacy/daemon.c (renamed from src/linux/daemon.c) | 0 | ||||
-rw-r--r-- | src/legacy/err.c (renamed from src/linux/err.c) | 0 | ||||
-rw-r--r-- | src/legacy/ftw.c (renamed from src/misc/ftw.c) | 0 | ||||
-rw-r--r-- | src/legacy/futimes.c (renamed from src/misc/futimes.c) | 0 | ||||
-rw-r--r-- | src/legacy/getdtablesize.c (renamed from src/linux/getdtablesize.c) | 0 | ||||
-rw-r--r-- | src/legacy/getpagesize.c (renamed from src/linux/getpagesize.c) | 0 | ||||
-rw-r--r-- | src/legacy/getpass.c (renamed from src/linux/getpass.c) | 0 | ||||
-rw-r--r-- | src/legacy/getusershell.c (renamed from src/misc/getusershell.c) | 0 | ||||
-rw-r--r-- | src/legacy/isastream.c (renamed from src/misc/isastream.c) | 0 | ||||
-rw-r--r-- | src/legacy/lutimes.c (renamed from src/misc/lutimes.c) | 0 | ||||
-rw-r--r-- | src/legacy/ulimit.c (renamed from src/misc/ulimit.c) | 0 | ||||
-rw-r--r-- | src/legacy/utmpx.c (renamed from src/stub/utmpx.c) | 0 | ||||
-rw-r--r-- | src/linux/epoll.c | 27 | ||||
-rw-r--r-- | src/linux/epoll_create.c | 7 | ||||
-rw-r--r-- | src/linux/epoll_create1.c | 7 | ||||
-rw-r--r-- | src/linux/epoll_ctl.c | 7 | ||||
-rw-r--r-- | src/linux/epoll_pwait.c | 7 | ||||
-rw-r--r-- | src/linux/epoll_wait.c | 7 | ||||
-rw-r--r-- | src/linux/eventfd.c | 11 | ||||
-rw-r--r-- | src/linux/eventfd_read.c | 7 | ||||
-rw-r--r-- | src/linux/eventfd_write.c | 7 | ||||
-rw-r--r-- | src/linux/inotify.c | 21 | ||||
-rw-r--r-- | src/linux/inotify_add_watch.c | 7 | ||||
-rw-r--r-- | src/linux/inotify_init.c | 7 | ||||
-rw-r--r-- | src/linux/inotify_init1.c | 7 | ||||
-rw-r--r-- | src/linux/inotify_rm_watch.c | 7 | ||||
-rw-r--r-- | src/linux/mount.c | 10 | ||||
-rw-r--r-- | src/linux/prlimit.c (renamed from src/misc/prlimit.c) | 0 | ||||
-rw-r--r-- | src/linux/ptrace.c (renamed from src/misc/ptrace.c) | 0 | ||||
-rw-r--r-- | src/linux/swap.c (renamed from src/linux/swapon.c) | 5 | ||||
-rw-r--r-- | src/linux/swapoff.c | 7 | ||||
-rw-r--r-- | src/linux/umount.c | 7 | ||||
-rw-r--r-- | src/linux/umount2.c | 7 | ||||
-rw-r--r-- | src/misc/gethostid.c (renamed from src/linux/gethostid.c) | 0 | ||||
-rw-r--r-- | src/misc/getopt_long.c (renamed from src/linux/getopt_long.c) | 0 | ||||
-rw-r--r-- | src/misc/initgroups.c (renamed from src/linux/initgroups.c) | 0 | ||||
-rw-r--r-- | src/misc/mntent.c (renamed from src/linux/mntent.c) | 0 | ||||
-rw-r--r-- | src/misc/syscall.c (renamed from src/linux/syscall.c) | 0 |
45 files changed, 74 insertions, 98 deletions
diff --git a/src/misc/crypt.c b/src/crypt/crypt.c index f1e310f..f1e310f 100644 --- a/src/misc/crypt.c +++ b/src/crypt/crypt.c diff --git a/src/misc/crypt_blowfish.c b/src/crypt/crypt_blowfish.c index bd37be8..bd37be8 100644 --- a/src/misc/crypt_blowfish.c +++ b/src/crypt/crypt_blowfish.c diff --git a/src/misc/crypt_des.c b/src/crypt/crypt_des.c index d7b2b15..d7b2b15 100644 --- a/src/misc/crypt_des.c +++ b/src/crypt/crypt_des.c diff --git a/src/misc/crypt_r.c b/src/crypt/crypt_r.c index 1c7f9cf..1c7f9cf 100644 --- a/src/misc/crypt_r.c +++ b/src/crypt/crypt_r.c diff --git a/src/misc/crypt_sha256.c b/src/crypt/crypt_sha256.c index 2dc27ee..2dc27ee 100644 --- a/src/misc/crypt_sha256.c +++ b/src/crypt/crypt_sha256.c diff --git a/src/misc/crypt_sha512.c b/src/crypt/crypt_sha512.c index 2c0de69..2c0de69 100644 --- a/src/misc/crypt_sha512.c +++ b/src/crypt/crypt_sha512.c diff --git a/src/misc/cuserid.c b/src/legacy/cuserid.c index 4e78798..4e78798 100644 --- a/src/misc/cuserid.c +++ b/src/legacy/cuserid.c diff --git a/src/linux/daemon.c b/src/legacy/daemon.c index 1568b1d..1568b1d 100644 --- a/src/linux/daemon.c +++ b/src/legacy/daemon.c diff --git a/src/linux/err.c b/src/legacy/err.c index 0f74853..0f74853 100644 --- a/src/linux/err.c +++ b/src/legacy/err.c diff --git a/src/misc/ftw.c b/src/legacy/ftw.c index 0429aba..0429aba 100644 --- a/src/misc/ftw.c +++ b/src/legacy/ftw.c diff --git a/src/misc/futimes.c b/src/legacy/futimes.c index f8fd1cd..f8fd1cd 100644 --- a/src/misc/futimes.c +++ b/src/legacy/futimes.c diff --git a/src/linux/getdtablesize.c b/src/legacy/getdtablesize.c index 623a6af..623a6af 100644 --- a/src/linux/getdtablesize.c +++ b/src/legacy/getdtablesize.c diff --git a/src/linux/getpagesize.c b/src/legacy/getpagesize.c index 5ede652..5ede652 100644 --- a/src/linux/getpagesize.c +++ b/src/legacy/getpagesize.c diff --git a/src/linux/getpass.c b/src/legacy/getpass.c index d439a2a..d439a2a 100644 --- a/src/linux/getpass.c +++ b/src/legacy/getpass.c diff --git a/src/misc/getusershell.c b/src/legacy/getusershell.c index 683158c..683158c 100644 --- a/src/misc/getusershell.c +++ b/src/legacy/getusershell.c diff --git a/src/misc/isastream.c b/src/legacy/isastream.c index 4dafdb0..4dafdb0 100644 --- a/src/misc/isastream.c +++ b/src/legacy/isastream.c diff --git a/src/misc/lutimes.c b/src/legacy/lutimes.c index 13dfe4e..13dfe4e 100644 --- a/src/misc/lutimes.c +++ b/src/legacy/lutimes.c diff --git a/src/misc/ulimit.c b/src/legacy/ulimit.c index 1f59e8e..1f59e8e 100644 --- a/src/misc/ulimit.c +++ b/src/legacy/ulimit.c diff --git a/src/stub/utmpx.c b/src/legacy/utmpx.c index c483e4e..c483e4e 100644 --- a/src/stub/utmpx.c +++ b/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 @@ 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); +} diff --git a/src/misc/prlimit.c b/src/linux/prlimit.c index b9dbb44..b9dbb44 100644 --- a/src/misc/prlimit.c +++ b/src/linux/prlimit.c diff --git a/src/misc/ptrace.c b/src/linux/ptrace.c index 83b8022..83b8022 100644 --- a/src/misc/ptrace.c +++ b/src/linux/ptrace.c diff --git a/src/linux/swapon.c b/src/linux/swap.c index 2b40a30..8137d51 100644 --- a/src/linux/swapon.c +++ b/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); +} 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 index ea65611..ea65611 100644 --- a/src/linux/gethostid.c +++ b/src/misc/gethostid.c diff --git a/src/linux/getopt_long.c b/src/misc/getopt_long.c index 6d3a4a6..6d3a4a6 100644 --- a/src/linux/getopt_long.c +++ b/src/misc/getopt_long.c diff --git a/src/linux/initgroups.c b/src/misc/initgroups.c index 545d185..545d185 100644 --- a/src/linux/initgroups.c +++ b/src/misc/initgroups.c diff --git a/src/linux/mntent.c b/src/misc/mntent.c index 3eafba5..3eafba5 100644 --- a/src/linux/mntent.c +++ b/src/misc/mntent.c diff --git a/src/linux/syscall.c b/src/misc/syscall.c index 1535560..1535560 100644 --- a/src/linux/syscall.c +++ b/src/misc/syscall.c |