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.
This commit is contained in:
Rich Felker 2012-09-07 00:48:25 -04:00
parent 780aede419
commit b9bb8f67bb
45 changed files with 74 additions and 98 deletions

27
src/linux/epoll.c Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

@ -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
src/linux/inotify.c Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

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

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

View File

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

View File

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

View File

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