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 /src | |
parent | 780aede41913528781bbc8ff0d0e27505595f7c0 (diff) | |
download | musl-b9bb8f67bbac9bab5314fb00974ad469476e936e.tar.gz musl-b9bb8f67bbac9bab5314fb00974ad469476e936e.tar.bz2 musl-b9bb8f67bbac9bab5314fb00974ad469476e936e.tar.xz musl-b9bb8f67bbac9bab5314fb00974ad469476e936e.zip |
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.
Diffstat (limited to 'src')
-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 f1e310f6..f1e310f6 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 bd37be84..bd37be84 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 d7b2b15a..d7b2b15a 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 1c7f9cf0..1c7f9cf0 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 2dc27ee7..2dc27ee7 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 2c0de698..2c0de698 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 4e78798d..4e78798d 100644 --- a/src/misc/cuserid.c +++ b/src/legacy/cuserid.c diff --git a/src/linux/daemon.c b/src/legacy/daemon.c index 1568b1dc..1568b1dc 100644 --- a/src/linux/daemon.c +++ b/src/legacy/daemon.c diff --git a/src/linux/err.c b/src/legacy/err.c index 0f748538..0f748538 100644 --- a/src/linux/err.c +++ b/src/legacy/err.c diff --git a/src/misc/ftw.c b/src/legacy/ftw.c index 0429aba4..0429aba4 100644 --- a/src/misc/ftw.c +++ b/src/legacy/ftw.c diff --git a/src/misc/futimes.c b/src/legacy/futimes.c index f8fd1cde..f8fd1cde 100644 --- a/src/misc/futimes.c +++ b/src/legacy/futimes.c diff --git a/src/linux/getdtablesize.c b/src/legacy/getdtablesize.c index 623a6af3..623a6af3 100644 --- a/src/linux/getdtablesize.c +++ b/src/legacy/getdtablesize.c diff --git a/src/linux/getpagesize.c b/src/legacy/getpagesize.c index 5ede652b..5ede652b 100644 --- a/src/linux/getpagesize.c +++ b/src/legacy/getpagesize.c diff --git a/src/linux/getpass.c b/src/legacy/getpass.c index d439a2a5..d439a2a5 100644 --- a/src/linux/getpass.c +++ b/src/legacy/getpass.c diff --git a/src/misc/getusershell.c b/src/legacy/getusershell.c index 683158c8..683158c8 100644 --- a/src/misc/getusershell.c +++ b/src/legacy/getusershell.c diff --git a/src/misc/isastream.c b/src/legacy/isastream.c index 4dafdb08..4dafdb08 100644 --- a/src/misc/isastream.c +++ b/src/legacy/isastream.c diff --git a/src/misc/lutimes.c b/src/legacy/lutimes.c index 13dfe4ef..13dfe4ef 100644 --- a/src/misc/lutimes.c +++ b/src/legacy/lutimes.c diff --git a/src/misc/ulimit.c b/src/legacy/ulimit.c index 1f59e8e6..1f59e8e6 100644 --- a/src/misc/ulimit.c +++ b/src/legacy/ulimit.c diff --git a/src/stub/utmpx.c b/src/legacy/utmpx.c index c483e4ed..c483e4ed 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 00000000..35f70ed1 --- /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 29d82999..00000000 --- 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 380b5dad..00000000 --- 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 da3e999b..00000000 --- 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 3ecdbb59..00000000 --- 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 9d3924e0..00000000 --- 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 cb39a7ba..53066487 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 969e6615..00000000 --- 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 734fa367..00000000 --- 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 00000000..d3b4fa0b --- /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 75f207d7..00000000 --- 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 05070846..00000000 --- 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 6472a7b2..00000000 --- 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 cba597eb..00000000 --- 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 83a8db44..34e11af1 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 b9dbb446..b9dbb446 100644 --- a/src/misc/prlimit.c +++ b/src/linux/prlimit.c diff --git a/src/misc/ptrace.c b/src/linux/ptrace.c index 83b8022b..83b8022b 100644 --- a/src/misc/ptrace.c +++ b/src/linux/ptrace.c diff --git a/src/linux/swapon.c b/src/linux/swap.c index 2b40a30b..8137d51e 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 9f95e82d..00000000 --- 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 fb9b5e73..00000000 --- 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 25ad057c..00000000 --- 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 ea65611a..ea65611a 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 6d3a4a6e..6d3a4a6e 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 545d1859..545d1859 100644 --- a/src/linux/initgroups.c +++ b/src/misc/initgroups.c diff --git a/src/linux/mntent.c b/src/misc/mntent.c index 3eafba5e..3eafba5e 100644 --- a/src/linux/mntent.c +++ b/src/misc/mntent.c diff --git a/src/linux/syscall.c b/src/misc/syscall.c index 15355609..15355609 100644 --- a/src/linux/syscall.c +++ b/src/misc/syscall.c |