about summary refs log tree commit diff
path: root/include/sys
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-12 00:22:29 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-12 00:22:29 -0500
commit0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 (patch)
tree6eaef0d8a720fa3da580de87b647fff796fe80b3 /include/sys
downloadmusl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.gz
musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.tar.xz
musl-0b44a0315b47dd8eced9f3b7f31580cf14bbfc01.zip
initial check-in, version 0.5.0 v0.5.0
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/epoll.h61
-rw-r--r--include/sys/file.h21
-rw-r--r--include/sys/ioctl.h14
-rw-r--r--include/sys/ipc.h23
-rw-r--r--include/sys/kd.h8
-rw-r--r--include/sys/klog.h14
-rw-r--r--include/sys/mman.h37
-rw-r--r--include/sys/mount.h28
-rw-r--r--include/sys/msg.h36
-rw-r--r--include/sys/param.h15
-rw-r--r--include/sys/poll.h1
-rw-r--r--include/sys/prctl.h64
-rw-r--r--include/sys/procfs.h81
-rw-r--r--include/sys/ptrace.h77
-rw-r--r--include/sys/reboot.h18
-rw-r--r--include/sys/reg.h9
-rw-r--r--include/sys/resource.h74
-rw-r--r--include/sys/select.h34
-rw-r--r--include/sys/sem.h69
-rw-r--r--include/sys/shm.h18
-rw-r--r--include/sys/signalfd.h40
-rw-r--r--include/sys/socket.h64
-rw-r--r--include/sys/soundcard.h1
-rw-r--r--include/sys/stat.h90
-rw-r--r--include/sys/statfs.h10
-rw-r--r--include/sys/statvfs.h30
-rw-r--r--include/sys/stropts.h1
-rw-r--r--include/sys/swap.h11
-rw-r--r--include/sys/sysctl.h9
-rw-r--r--include/sys/sysinfo.h29
-rw-r--r--include/sys/sysmacros.h6
-rw-r--r--include/sys/time.h49
-rw-r--r--include/sys/times.h17
-rw-r--r--include/sys/types.h56
-rw-r--r--include/sys/ucontext.h1
-rw-r--r--include/sys/uio.h14
-rw-r--r--include/sys/un.h13
-rw-r--r--include/sys/user.h15
-rw-r--r--include/sys/utsname.h21
-rw-r--r--include/sys/vfs.h1
-rw-r--r--include/sys/vt.h1
-rw-r--r--include/sys/wait.h28
42 files changed, 1209 insertions, 0 deletions
diff --git a/include/sys/epoll.h b/include/sys/epoll.h
new file mode 100644
index 00000000..3530a9ac
--- /dev/null
+++ b/include/sys/epoll.h
@@ -0,0 +1,61 @@
+#ifndef	_SYS_EPOLL_H
+#define	_SYS_EPOLL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define EPOLL_CLOEXEC 02000000
+#define EPOLL_NONBLOCK 04000
+
+enum EPOLL_EVENTS { __EPOLL_DUMMY };
+#define EPOLLIN 0x001
+#define EPOLLPRI 0x002
+#define EPOLLOUT 0x004
+#define EPOLLRDNORM 0x040
+#define EPOLLRDBAND 0x080
+#define EPOLLWRNORM 0x100
+#define EPOLLWRBAND 0x200
+#define EPOLLMSG 0x400
+#define EPOLLERR 0x008
+#define EPOLLHUP 0x010
+#define EPOLLRDHUP 0x2000
+#define EPOLLONESHOT (1U<<30)
+#define EPOLLET (1U<<31)
+
+#define EPOLL_CTL_ADD 1
+#define EPOLL_CTL_DEL 2
+#define EPOLL_CTL_MOD 3
+
+typedef union epoll_data {
+	void *ptr;
+	int fd;
+	uint32_t u32;
+	uint64_t u64;
+} epoll_data_t;
+
+struct epoll_event {
+	uint32_t events;
+	epoll_data_t data;
+} __attribute__ ((__packed__));
+
+
+int epoll_create(int);
+int epoll_create1(int);
+int epoll_ctl(int, int, int, struct epoll_event *);
+int epoll_wait(int, struct epoll_event *, int, int);
+int epoll_pwait(int, struct epoll_event *, int, int, const sigset_t *);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* sys/epoll.h */
diff --git a/include/sys/file.h b/include/sys/file.h
new file mode 100644
index 00000000..8b2eb01a
--- /dev/null
+++ b/include/sys/file.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_FILE_H
+#define _SYS_FILE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+
+#define LOCK_SH	1
+#define LOCK_EX	2
+#define LOCK_NB	4
+#define LOCK_UN	8
+
+extern int flock(int, int);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
new file mode 100644
index 00000000..d0415b3d
--- /dev/null
+++ b/include/sys/ioctl.h
@@ -0,0 +1,14 @@
+#ifndef	_SYS_IOCTL_H
+#define	_SYS_IOCTL_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <bits/ioctl.h>
+
+int ioctl (int, int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/ipc.h b/include/sys/ipc.h
new file mode 100644
index 00000000..9de9f3e7
--- /dev/null
+++ b/include/sys/ipc.h
@@ -0,0 +1,23 @@
+#ifndef _SYS_IPC_H
+#define _SYS_IPC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_key_t
+
+#include <bits/alltypes.h>
+
+#include <bits/ipc.h>
+
+key_t ftok (const char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/include/sys/kd.h b/include/sys/kd.h
new file mode 100644
index 00000000..793fd59f
--- /dev/null
+++ b/include/sys/kd.h
@@ -0,0 +1,8 @@
+#ifndef _SYS_KD_H
+#define _SYS_KD_H
+
+#define _LINUX_TYPES_H
+#include <linux/kd.h>
+#undef _LINUX_TYPES_H
+
+#endif
diff --git a/include/sys/klog.h b/include/sys/klog.h
new file mode 100644
index 00000000..aa66684e
--- /dev/null
+++ b/include/sys/klog.h
@@ -0,0 +1,14 @@
+#ifndef	_SYS_KLOG_H
+#define	_SYS_KLOG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int klogctl (int, char *, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/sys/mman.h b/include/sys/mman.h
new file mode 100644
index 00000000..6aede8bd
--- /dev/null
+++ b/include/sys/mman.h
@@ -0,0 +1,37 @@
+#ifndef	_SYS_MMAN_H
+#define	_SYS_MMAN_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_mode_t
+#define __NEED_size_t
+#define __NEED_off_t
+
+#include <bits/alltypes.h>
+
+#include <bits/mman.h>
+
+void *mmap (void *, size_t, int, int, int, off_t);
+int munmap (void *, size_t);
+
+int mprotect (void *, size_t, int);
+int msync (void *, size_t, int);
+
+int posix_madvise (void *, size_t, int);
+
+int mlock (const void *, size_t);
+int munlock (const void *, size_t);
+int mlockall (int);
+int munlockall (void);
+
+/* linux extension */
+void *mremap (void *, size_t, size_t, int, ...);
+
+int shm_open (const char *, int, mode_t);
+int shm_unlink (const char *);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/mount.h b/include/sys/mount.h
new file mode 100644
index 00000000..2c685f67
--- /dev/null
+++ b/include/sys/mount.h
@@ -0,0 +1,28 @@
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#define MS_RDONLY      1
+#define MS_NOSUID      2
+#define MS_NODEV       4
+#define MS_NOEXEC      8
+#define MS_SYNCHRONOUS 16
+#define MS_REMOUNT     32
+#define MS_MANDLOCK    64
+#define S_WRITE        128
+#define S_APPEND       256
+#define S_IMMUTABLE    512
+#define MS_NOATIME     1024
+#define MS_NODIRATIME  2048
+#define MS_BIND        4096
+#define MS_MOVE        8192
+#define MS_SILENT      32768
+
+#define MS_MGC_VAL 0xc0ed0000
+
+#define MNT_FORCE 1
+
+int mount(const char *, const char *, const char *, unsigned long, const void *);
+int umount(const char *);
+int umount2(const char *, int);
+
+#endif
diff --git a/include/sys/msg.h b/include/sys/msg.h
new file mode 100644
index 00000000..9fc42bcd
--- /dev/null
+++ b/include/sys/msg.h
@@ -0,0 +1,36 @@
+#ifndef _SYS_MSG_H
+#define _SYS_MSG_H
+
+#include <sys/ipc.h>
+
+#define __NEED_pid_t
+#define __NEED_key_t
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+
+#include <bits/alltypes.h>
+
+typedef unsigned long msgqnum_t;
+typedef unsigned long msglen_t;
+
+struct msqid_ds
+{
+	struct ipc_perm msg_perm;
+	time_t msg_stime;
+	time_t msg_rtime;
+	time_t msg_ctime;
+	msgqnum_t msg_qnum;
+	msglen_t msg_qbytes;
+	pid_t msg_lspid;
+	pid_t msd_lrpid;
+};
+
+#define MSG_NOERROR 010000
+
+int msgctl (int, int, struct msqid_ds *);
+int msgget (key_t, int);
+int msgrcv (int, void *, size_t, long, int);
+int msgsnd (int, const void *, size_t, int);
+
+#endif
diff --git a/include/sys/param.h b/include/sys/param.h
new file mode 100644
index 00000000..ded4a16b
--- /dev/null
+++ b/include/sys/param.h
@@ -0,0 +1,15 @@
+#undef MAXSYMLINKS
+#define MAXSYMLINKS 20
+
+#undef MAXHOSTNAMELEN
+#define MAXHOSTNAMELEN 64
+
+#undef MAXNAMLEN
+#define MAXNAMLEN NAME_MAX
+
+#undef MAXPATHLEN
+#define MAXPATHLEN PATH_MAX
+
+#include <sys/resource.h>
+#include <endian.h>
+#include <limits.h>
diff --git a/include/sys/poll.h b/include/sys/poll.h
new file mode 100644
index 00000000..779ec774
--- /dev/null
+++ b/include/sys/poll.h
@@ -0,0 +1 @@
+#include <poll.h>
diff --git a/include/sys/prctl.h b/include/sys/prctl.h
new file mode 100644
index 00000000..cd34848a
--- /dev/null
+++ b/include/sys/prctl.h
@@ -0,0 +1,64 @@
+#ifndef _SYS_PRCTL_H
+#define _SYS_PRCTL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PR_SET_PDEATHSIG  1
+#define PR_GET_PDEATHSIG  2
+#define PR_GET_DUMPABLE   3
+#define PR_SET_DUMPABLE   4
+#define PR_GET_UNALIGN   5
+#define PR_SET_UNALIGN   6
+#define PR_UNALIGN_NOPRINT 1
+#define PR_UNALIGN_SIGBUS 2
+#define PR_GET_KEEPCAPS   7
+#define PR_SET_KEEPCAPS   8
+#define PR_GET_FPEMU  9
+#define PR_SET_FPEMU 10
+#define PR_FPEMU_NOPRINT 1
+#define PR_FPEMU_SIGFPE 2
+#define PR_GET_FPEXC 11
+#define PR_SET_FPEXC 12
+#define PR_FP_EXC_SW_ENABLE 0x80
+#define PR_FP_EXC_DIV  0x010000
+#define PR_FP_EXC_OVF  0x020000
+#define PR_FP_EXC_UND  0x040000
+#define PR_FP_EXC_RES  0x080000
+#define PR_FP_EXC_INV  0x100000
+#define PR_FP_EXC_DISABLED 0
+#define PR_FP_EXC_NONRECOV 1
+#define PR_FP_EXC_ASYNC 2
+#define PR_FP_EXC_PRECISE 3
+#define PR_GET_TIMING   13
+#define PR_SET_TIMING   14
+#define PR_TIMING_STATISTICAL  0
+#define PR_TIMING_TIMESTAMP    1
+#define PR_SET_NAME    15
+#define PR_GET_NAME    16
+#define PR_GET_ENDIAN 19
+#define PR_SET_ENDIAN 20
+#define PR_ENDIAN_BIG
+#define PR_ENDIAN_LITTLE
+#define PR_ENDIAN_PPC_LITTLE
+#define PR_GET_SECCOMP 21
+#define PR_SET_SECCOMP 22
+#define PR_CAPBSET_READ 23
+#define PR_CAPBSET_DROP 24
+#define PR_GET_TSC 25
+#define PR_SET_TSC 26
+#define PR_TSC_ENABLE 1
+#define PR_TSC_SIGSEGV 2
+#define PR_GET_SECUREBITS 27
+#define PR_SET_SECUREBITS 28
+#define PR_SET_TIMERSLACK 29
+#define PR_GET_TIMERSLACK 30
+
+int prctl (int, ...);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#endif
diff --git a/include/sys/procfs.h b/include/sys/procfs.h
new file mode 100644
index 00000000..20b4847c
--- /dev/null
+++ b/include/sys/procfs.h
@@ -0,0 +1,81 @@
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+typedef unsigned long elf_greg_t;
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+#if __WORDSIZE == 32
+typedef struct user_fpregs_struct elf_fpregset_t;
+typedef struct user_fpxregs_struct elf_fpxregset_t;
+#else
+typedef struct user_fpregs_struct elf_fpregset_t;
+#endif
+
+struct elf_siginfo {
+	int si_signo;
+	int si_code;
+	int si_errno;
+};
+
+struct elf_prstatus {
+	struct elf_siginfo pr_info;
+	short int pr_cursig;
+	unsigned long int pr_sigpend;
+	unsigned long int pr_sighold;
+	pid_t pr_pid;
+	pid_t pr_ppid;
+	pid_t pr_pgrp;
+	pid_t pr_sid;
+	struct timeval pr_utime;
+	struct timeval pr_stime;
+	struct timeval pr_cutime;
+	struct timeval pr_cstime;
+	elf_gregset_t pr_reg;
+	int pr_fpvalid;
+};
+
+
+#define ELF_PRARGSZ 80
+
+struct elf_prpsinfo
+	{
+	char pr_state;
+	char pr_sname;
+	char pr_zomb;
+	char pr_nice;
+	unsigned long int pr_flag;
+#if __WORDSIZE == 32
+	unsigned short int pr_uid;
+	unsigned short int pr_gid;
+#else
+	unsigned int pr_uid;
+	unsigned int pr_gid;
+#endif
+	int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+	char pr_fname[16];
+	char pr_psargs[ELF_PRARGSZ];
+};
+
+
+typedef void *psaddr_t;
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+typedef pid_t lwpid_t;
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/ptrace.h b/include/sys/ptrace.h
new file mode 100644
index 00000000..0459d1b6
--- /dev/null
+++ b/include/sys/ptrace.h
@@ -0,0 +1,77 @@
+#ifndef _SYS_PTRACE_H
+#define _SYS_PTRACE_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PTRACE_TRACEME 0
+#define PT_TRACE_ME PTRACE_TRACEME
+
+#define PTRACE_PEEKTEXT 1
+#define PTRACE_PEEKDATA 2
+#define PTRACE_PEEKUSER 3
+#define PTRACE_POKETEXT 4
+#define PTRACE_POKEDATA 5
+#define PTRACE_POKEUSER 6
+#define PTRACE_CONT 7
+#define PTRACE_KILL 8
+#define PTRACE_SINGLESTEP 9
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+#define PTRACE_GETFPREGS 14
+#define PTRACE_SETFPREGS 15
+#define PTRACE_ATTACH 16
+#define PTRACE_DETACH 17
+#define PTRACE_GETFPXREGS 18
+#define PTRACE_SETFPXREGS 19
+#define PTRACE_SYSCALL 24
+#define PTRACE_SETOPTIONS 0x4200
+#define PTRACE_GETEVENTMSG 0x4201
+#define PTRACE_GETSIGINFO 0x4202
+#define PTRACE_SETSIGINFO 0x4203
+
+#define PT_READ_I PTRACE_PEEKTEXT
+#define PT_READ_D PTRACE_PEEKDATA
+#define PT_READ_U PTRACE_PEEKUSER
+#define PT_WRITE_I PTRACE_POKETEXT
+#define PT_WRITE_D PTRACE_POKEDATA
+#define PT_WRITE_U PTRACE_POKEUSER
+#define PT_CONTINUE PTRACE_CONT
+#define PT_KILL PTRACE_KILL
+#define PT_STEP PTRACE_SINGLESTEP
+#define PT_GETREGS PTRACE_GETREGS
+#define PT_SETREGS PTRACE_SETREGS
+#define PT_GETFPREGS PTRACE_GETFPREGS
+#define PT_SETFPREGS PTRACE_SETFPREGS
+#define PT_ATTACH PTRACE_ATTACH
+#define PT_DETACH PTRACE_DETACH
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+#define PT_SYSCALL PTRACE_SYSCALL
+#define PT_SETOPTIONS PTRACE_SETOPTIONS
+#define PT_GETEVENTMSG PTRACE_GETEVENTMSG
+#define PT_GETSIGINFO PTRACE_GETSIGINFO
+#define PT_SETSIGINFO PTRACE_SETSIGINFO
+
+#define PTRACE_O_TRACESYSGOOD   0x00000001
+#define PTRACE_O_TRACEFORK      0x00000002
+#define PTRACE_O_TRACEVFORK     0x00000004
+#define PTRACE_O_TRACECLONE     0x00000008
+#define PTRACE_O_TRACEEXEC      0x00000010
+#define PTRACE_O_TRACEVFORKDONE 0x00000020
+#define PTRACE_O_TRACEEXIT      0x00000040
+#define PTRACE_O_MASK           0x0000007f
+
+#define PTRACE_EVENT_FORK 1
+#define PTRACE_EVENT_VFORK 2
+#define PTRACE_EVENT_CLONE 3
+#define PTRACE_EVENT_EXEC 4
+#define PTRACE_EVENT_VFORK_DONE 5
+#define PTRACE_EVENT_EXIT 6
+
+long int ptrace(int, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/reboot.h b/include/sys/reboot.h
new file mode 100644
index 00000000..26cc3088
--- /dev/null
+++ b/include/sys/reboot.h
@@ -0,0 +1,18 @@
+#ifndef _SYS_REBOOT_H
+#define _SYS_REBOOT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RB_AUTOBOOT     0x01234567
+#define RB_HALT_SYSTEM  0xcdef0123
+#define RB_ENABLE_CAD   0x89abcdef
+#define RB_DISABLE_CAD  0
+#define RB_POWER_OFF    0x4321fedc
+
+int reboot(int);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/reg.h b/include/sys/reg.h
new file mode 100644
index 00000000..ebf3fff4
--- /dev/null
+++ b/include/sys/reg.h
@@ -0,0 +1,9 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+
+#include <limits.h>
+#include <unistd.h>
+
+#include <bits/reg.h>
+
+#endif
diff --git a/include/sys/resource.h b/include/sys/resource.h
new file mode 100644
index 00000000..99e383c4
--- /dev/null
+++ b/include/sys/resource.h
@@ -0,0 +1,74 @@
+#ifndef	_SYS_RESOURCE_H
+#define	_SYS_RESOURCE_H
+
+#define __NEED_id_t
+#define __NEED_time_t
+#define __NEED_struct_timeval
+#define __NEED_struct_rusage
+
+#include <bits/alltypes.h>
+
+typedef unsigned long long rlim_t;
+
+struct rlimit
+{
+	rlim_t rlim_cur;
+	rlim_t rlim_max;
+};
+
+struct rusage
+{
+	struct timeval ru_utime;
+	struct timeval ru_stime;
+	/* linux extentions, but useful */
+	long	ru_maxrss;
+	long	ru_ixrss;
+	long	ru_idrss;
+	long	ru_isrss;
+	long	ru_minflt;
+	long	ru_majflt;
+	long	ru_nswap;
+	long	ru_inblock;
+	long	ru_oublock;
+	long	ru_msgsnd;
+	long	ru_msgrcv;
+	long	ru_nsignals;
+	long	ru_nvcsw;
+	long	ru_nivcsw;
+	/* room for more... */
+	long    __reserved[16];
+};
+
+int getrlimit (int, struct rlimit *);
+int setrlimit (int, const struct rlimit *);
+int getrusage (int, struct rusage *);
+
+int getpriority (int, id_t);
+int setpriority (int, id_t, int);
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP    1
+#define PRIO_USER    2
+
+#define RUSAGE_SELF     0
+#define RUSAGE_CHILDREN 1
+
+#define RLIM_INFINITY (~0ULL)
+#define RLIM_SAVED_CUR RLIM_INFINITY
+#define RLIM_SAVED_MAX RLIM_INFINITY
+
+#define RLIMIT_CPU     0
+#define RLIMIT_FSIZE   1
+#define RLIMIT_DATA    2
+#define RLIMIT_STACK   3
+#define RLIMIT_CORE    4
+#define RLIMIT_RSS     5
+#define RLIMIT_NOFILE  7
+#define RLIMIT_AS      9
+#define RLIMIT_NPROC   6
+#define RLIMIT_MEMLOCK 8
+#define RLIMIT_LOCKS   10
+
+
+
+#endif
diff --git a/include/sys/select.h b/include/sys/select.h
new file mode 100644
index 00000000..c44eada4
--- /dev/null
+++ b/include/sys/select.h
@@ -0,0 +1,34 @@
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+#define __NEED_time_t
+#define __NEED_struct_timeval
+#define __NEED_struct_timespec
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+#define FD_SETSIZE 1024
+
+typedef struct
+{
+	unsigned long fds_bits[FD_SETSIZE / 8 / sizeof(long)];
+} fd_set;
+
+#define FD_ZERO(s) do { int __i; unsigned long *__b=(s)->fds_bits; for(__i=sizeof (fd_set)/sizeof (long); __i; __i--) *__b++=0; } while(0)
+#define FD_SET(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] |= (1<<((d)%(8*sizeof(long)))))
+#define FD_CLR(d, s)   ((s)->fds_bits[(d)/(8*sizeof(long))] &= ~(1<<((d)%(8*sizeof(long)))))
+#define FD_ISSET(d, s) ((s)->fds_bits[(d)/(8*sizeof(long))] & (1<<((d)%(8*sizeof(long)))))
+
+int select (int, fd_set *, fd_set *, fd_set *, struct timeval *);
+int pselect (int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/sem.h b/include/sys/sem.h
new file mode 100644
index 00000000..15d8b685
--- /dev/null
+++ b/include/sys/sem.h
@@ -0,0 +1,69 @@
+#ifndef _SYS_SEM_H
+#define _SYS_SEM_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+
+#define SEM_UNDO	0x1000
+#define GETPID		11
+#define GETVAL		12
+#define GETALL		13
+#define GETNCNT		14
+#define GETZCNT		15
+#define SETVAL		16
+#define SETALL		17
+
+struct semid_ds {
+	struct ipc_perm sem_perm;
+	long sem_otime;
+	unsigned long __unused1;
+	long sem_ctime;
+	unsigned long __unused2;
+	unsigned long sem_nsems;
+	unsigned long __unused3;
+	unsigned long __unused4;
+};
+
+#define _SEM_SEMUN_UNDEFINED 1
+
+#define SEM_STAT 18
+#define SEM_INFO 19
+
+struct  seminfo {
+	int semmap;
+	int semmni;
+	int semmns;
+	int semmnu;
+	int semmsl;
+	int semopm;
+	int semume;
+	int semusz;
+	int semvmx;
+	int semaem;
+};
+
+struct sembuf {
+	unsigned short sem_num;
+	short sem_op;
+	short sem_flg;
+};
+
+int semctl(int, int, int, ...);
+int semget(key_t, int, int);
+int semop(int, struct sembuf *, size_t);
+
+#ifdef _GNU_SOURCE
+#define __NEED_struct_timespec
+#include <bits/alltypes.h>
+int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/shm.h b/include/sys/shm.h
new file mode 100644
index 00000000..6ebb9412
--- /dev/null
+++ b/include/sys/shm.h
@@ -0,0 +1,18 @@
+#ifndef _SYS_SHM_H
+#define _SYS_SHM_H
+
+#define __NEED_time_t
+#define __NEED_size_t
+#define __NEED_pid_t
+
+#include <bits/alltypes.h>
+
+#include <sys/ipc.h>
+#include <bits/shm.h>
+
+void *shmat(int, const void *, int);
+int shmctl(int, int, struct shmid_ds *);
+int shmdt(const void *);
+int shmget(key_t, size_t, int);
+
+#endif
diff --git a/include/sys/signalfd.h b/include/sys/signalfd.h
new file mode 100644
index 00000000..895664bf
--- /dev/null
+++ b/include/sys/signalfd.h
@@ -0,0 +1,40 @@
+#ifndef _SYS_SIGNALFD_H
+#define _SYS_SIGNALFD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define __NEED_sigset_t
+
+#include <bits/alltypes.h>
+
+int signalfd(int, const sigset_t *, int);
+
+struct signalfd_siginfo {
+	uint32_t  ssi_signo;
+	int32_t   ssi_errno;
+	int32_t   ssi_code;
+	uint32_t  ssi_pid;
+	uint32_t  ssi_uid;
+	int32_t   ssi_fd;
+	uint32_t  ssi_tid;
+	uint32_t  ssi_band;
+	uint32_t  ssi_overrun;
+	uint32_t  ssi_trapno;
+	int32_t   ssi_status;
+	int32_t   ssi_int;
+	uintptr_t ssi_ptr;
+	uint64_t  ssi_utime;
+	uint64_t  ssi_stime;
+	uint64_t  ssi_addr;
+	uint8_t   pad[128-12*4-sizeof(void *)-3*8];
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/sys/socket.h b/include/sys/socket.h
new file mode 100644
index 00000000..78c93056
--- /dev/null
+++ b/include/sys/socket.h
@@ -0,0 +1,64 @@
+#ifndef	_SYS_SOCKET_H
+#define	_SYS_SOCKET_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_socklen_t
+#define __NEED_sa_family_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_uid_t
+#define __NEED_pid_t
+#define __NEED_gid_t
+
+#include <bits/alltypes.h>
+
+#include <bits/socket.h>
+
+struct sockaddr
+{
+	sa_family_t sa_family;
+	char sa_data[14];
+};
+
+struct sockaddr_storage
+{
+	sa_family_t ss_family;
+	long long __ss_align;
+	char __ss_padding[128 - sizeof(sa_family_t) - sizeof(long long)];
+};
+
+int socket (int, int, int);
+int socketpair (int, int, int, int [2]);
+
+int shutdown (int, int);
+
+int bind (int, const struct sockaddr *, socklen_t);
+int connect (int, const struct sockaddr *, socklen_t);
+int listen (int, int);
+int accept (int, struct sockaddr *, socklen_t *);
+
+int getsockname (int, struct sockaddr *, socklen_t *);
+int getpeername (int, struct sockaddr *, socklen_t *);
+
+ssize_t send (int, const void *, size_t, int);
+ssize_t recv (int, void *, size_t, int);
+ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
+ssize_t recvfrom (int, void *, size_t, int, struct sockaddr *, socklen_t *);
+ssize_t sendmsg (int, const struct msghdr *, int);
+ssize_t recvmsg (int, struct msghdr *, int);
+
+int getsockopt (int, int, int, void *, socklen_t *);
+int setsockopt (int, int, int, const void *, socklen_t);
+
+int sockatmark (int);
+
+#define SHUT_RD 0
+#define SHUT_WR 1
+#define SHUT_RDWR 2
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/soundcard.h b/include/sys/soundcard.h
new file mode 100644
index 00000000..fade986f
--- /dev/null
+++ b/include/sys/soundcard.h
@@ -0,0 +1 @@
+#include <linux/soundcard.h>
diff --git a/include/sys/stat.h b/include/sys/stat.h
new file mode 100644
index 00000000..36575b0e
--- /dev/null
+++ b/include/sys/stat.h
@@ -0,0 +1,90 @@
+#ifndef	_SYS_STAT_H
+#define	_SYS_STAT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_dev_t
+#define __NEED_ino_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_off_t
+#define __NEED_time_t
+#define __NEED_blksize_t
+#define __NEED_blkcnt_t
+
+#include <bits/alltypes.h>
+
+#include <bits/stat.h>
+
+#define S_IFMT  0170000
+
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFBLK 0060000
+#define S_IFREG 0100000
+#define S_IFIFO 0010000
+#define S_IFLNK 0120000
+#define S_IFSOCK 0140000
+
+#define S_TYPEISMQ(buf)  0
+#define S_TYPEISSEM(buf) 0
+#define S_TYPEISSHM(buf) 0
+#define S_TYPEISTMO(buf) 0
+
+#define S_ISDIR(mode)  (((mode) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(mode)  (((mode) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(mode)  (((mode) & S_IFMT) == S_IFBLK)
+#define S_ISREG(mode)  (((mode) & S_IFMT) == S_IFREG)
+#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
+#define S_ISLNK(mode)  (((mode) & S_IFMT) == S_IFLNK)
+#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+
+#define S_ISUID 04000
+#define S_ISGID 02000
+#define S_ISVTX 01000
+
+#define S_IREAD  0400
+#define S_IWRITE 0200
+#define S_IEXEC  0100
+
+#define S_IRUSR 0400
+#define S_IWUSR 0200
+#define S_IXUSR 0100
+#define S_IRWXU 0700
+
+#define S_IRGRP 0040
+#define S_IWGRP 0020
+#define S_IXGRP 0010
+#define S_IRWXG 0070
+
+#define S_IROTH 0004
+#define S_IWOTH 0002
+#define S_IXOTH 0001
+#define S_IRWXO 0007
+
+
+int stat(const char *, struct stat *);
+int fstat(int, struct stat *);
+int lstat(const char *, struct stat *);
+int fstatat(int, const char *, struct stat *, int);
+int chmod(const char *, mode_t);
+int fchmod(int, mode_t);
+int fchmodat(int, const char *, mode_t, int);
+mode_t umask(mode_t);
+int mkdir(const char *, mode_t);
+int mknod(const char *, mode_t, dev_t);
+int mkfifo(const char *, mode_t);
+int mkdirat(int, const char *, mode_t);
+int mknodat(int, const char *, mode_t, dev_t);
+int mkfifoat(int, const char *, mode_t);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/include/sys/statfs.h b/include/sys/statfs.h
new file mode 100644
index 00000000..7eaa7e7c
--- /dev/null
+++ b/include/sys/statfs.h
@@ -0,0 +1,10 @@
+#ifndef	_SYS_STATFS_H
+#define	_SYS_STATFS_H
+
+#include <sys/statvfs.h>
+
+#define statfs statvfs
+#define fstatfs fstatvfs
+#define f_namelen f_namemax
+
+#endif
diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h
new file mode 100644
index 00000000..6479be6f
--- /dev/null
+++ b/include/sys/statvfs.h
@@ -0,0 +1,30 @@
+#ifndef	_SYS_STATVFS_H
+#define	_SYS_STATVFS_H
+
+
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+#include <bits/alltypes.h>
+
+#include <bits/statfs.h>
+
+int statvfs (const char *, struct statvfs *);
+int fstatvfs (int, struct statvfs *);
+
+#define ST_RDONLY 1
+#define ST_NOSUID 2
+
+#if 0
+#define ST_NODEV  4
+#define ST_NOEXEC 8
+#define ST_SYNCHRONOUS 16
+#define ST_MANDLOCK    64
+#define ST_WRITE       128
+#define ST_APPEND      256
+#define ST_IMMUTABLE   512
+#define ST_NOATIME     1024
+#define ST_NODIRATIME  2048
+#endif
+
+
+#endif
diff --git a/include/sys/stropts.h b/include/sys/stropts.h
new file mode 100644
index 00000000..5b5bc02f
--- /dev/null
+++ b/include/sys/stropts.h
@@ -0,0 +1 @@
+#include <stropts.h>
diff --git a/include/sys/swap.h b/include/sys/swap.h
new file mode 100644
index 00000000..c5824f1d
--- /dev/null
+++ b/include/sys/swap.h
@@ -0,0 +1,11 @@
+#ifndef _SYS_SWAP_H
+#define _SYS_SWAP_H
+
+#define	SWAP_FLAG_PREFER        0x8000
+#define	SWAP_FLAG_PRIO_MASK     0x7fff
+#define	SWAP_FLAG_PRIO_SHIFT    0
+
+int swapon (const char *, int);
+int swapoff (const char *);
+
+#endif
diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h
new file mode 100644
index 00000000..af5ca8ba
--- /dev/null
+++ b/include/sys/sysctl.h
@@ -0,0 +1,9 @@
+#ifndef	_SYS_SYSCTL_H
+#define	_SYS_SYSCTL_H
+
+#define __NEED_size_t
+#include <bits/alltypes.h>
+
+int sysctl (int *, int, void *, size_t *, void *, size_t);
+
+#endif
diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h
new file mode 100644
index 00000000..ca52088a
--- /dev/null
+++ b/include/sys/sysinfo.h
@@ -0,0 +1,29 @@
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H
+
+/* ?? */
+#define SI_LOAD_SHIFT 16
+
+struct sysinfo {
+	unsigned long long uptime;
+	unsigned long loads[3];
+	unsigned long procs;
+	unsigned long long totalram;
+	unsigned long long freeram;
+	unsigned long long sharedram;
+	unsigned long long bufferram;
+	unsigned long long totalswap;
+	unsigned long long freeswap;
+	unsigned long long totalhigh;
+	unsigned long long freehigh;
+	unsigned long mem_unit;
+	char __reserved[256];
+};
+
+int sysinfo (struct sysinfo *);
+int get_nprocs_conf (void);
+int get_nprocs (void);
+long long get_phys_pages (void);
+long long get_avphys_pages (void);
+
+#endif
diff --git a/include/sys/sysmacros.h b/include/sys/sysmacros.h
new file mode 100644
index 00000000..79eba3be
--- /dev/null
+++ b/include/sys/sysmacros.h
@@ -0,0 +1,6 @@
+#ifndef _SYSMACROS_H
+#define _SYSMACROS_H
+
+#include <bits/sysmacros.h>
+
+#endif
diff --git a/include/sys/time.h b/include/sys/time.h
new file mode 100644
index 00000000..9b3bfb99
--- /dev/null
+++ b/include/sys/time.h
@@ -0,0 +1,49 @@
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* All symbols from select.h except pselect are required anyway... */
+#include <sys/select.h>
+
+#define __NEED_time_t
+#define __NEED_suseconds_t
+#define __NEED_timeval
+
+#include <bits/alltypes.h>
+
+
+
+int gettimeofday (struct timeval *, void *);
+
+/* extensions */
+int settimeofday (const struct timeval *, void *);
+int adjtime (const struct timeval *, struct timeval *);
+
+
+#define ITIMER_REAL    0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF    2
+
+struct itimerval
+{
+	struct timeval it_interval;
+	struct timeval it_value;
+};
+
+int getitimer (int, struct itimerval *);
+int setitimer (int, const struct itimerval *, struct itimerval *);
+int utimes (const char *, const struct timeval [2]);
+
+#ifdef _GNU_SOURCE
+struct timezone {
+	int tz_minuteswest;
+	int tz_dsttime;
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/times.h b/include/sys/times.h
new file mode 100644
index 00000000..aca743d3
--- /dev/null
+++ b/include/sys/times.h
@@ -0,0 +1,17 @@
+#ifndef	_SYS_TIMES_H
+#define	_SYS_TIMES_H
+
+#define __NEED_clock_t
+#include <bits/alltypes.h>
+
+struct tms
+{
+	clock_t tms_utime;
+	clock_t tms_stime;
+	clock_t tms_cutime;
+	clock_t tms_cstime;
+};
+
+clock_t times (struct tms *);
+
+#endif
diff --git a/include/sys/types.h b/include/sys/types.h
new file mode 100644
index 00000000..8be19e6b
--- /dev/null
+++ b/include/sys/types.h
@@ -0,0 +1,56 @@
+#ifndef	_SYS_TYPES_H
+#define	_SYS_TYPES_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_loff_t
+#define __NEED_ino_t
+#define __NEED_dev_t
+#define __NEED_uid_t
+#define __NEED_gid_t
+#define __NEED_mode_t
+#define __NEED_nlink_t
+#define __NEED_off_t
+#define __NEED_pid_t
+#define __NEED_size_t
+#define __NEED_ssize_t
+#define __NEED_time_t
+#define __NEED_timer_t
+#define __NEED_clockid_t
+
+#define __NEED_int8_t
+#define __NEED_int16_t
+#define __NEED_int32_t
+#define __NEED_int64_t
+
+#define __NEED_u_int8_t
+#define __NEED_u_int16_t
+#define __NEED_u_int32_t
+#define __NEED_u_int64_t
+
+#define __NEED_register_t
+
+#define __NEED_blkcnt_t
+#define __NEED_fsblkcnt_t
+#define __NEED_fsfilcnt_t
+
+#define __NEED_id_t
+#define __NEED_key_t
+#define __NEED_clock_t
+#define __NEED_useconds_t
+#define __NEED_suseconds_t
+#define __NEED_blksize_t
+
+#include <bits/alltypes.h>
+
+#ifdef _GNU_SOURCE
+typedef unsigned long caddr_t;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/include/sys/ucontext.h b/include/sys/ucontext.h
new file mode 100644
index 00000000..5fdbd63d
--- /dev/null
+++ b/include/sys/ucontext.h
@@ -0,0 +1 @@
+#include <ucontext.h>
diff --git a/include/sys/uio.h b/include/sys/uio.h
new file mode 100644
index 00000000..7b068c0c
--- /dev/null
+++ b/include/sys/uio.h
@@ -0,0 +1,14 @@
+#ifndef _SYS_UIO_H
+#define _SYS_UIO_H
+
+#define __NEED_size_t
+#define __NEED_ssize_t
+
+#include <bits/alltypes.h>
+
+#include <bits/uio.h>
+
+ssize_t readv (int, const struct iovec *, int);
+ssize_t writev (int, const struct iovec *, int);
+
+#endif
diff --git a/include/sys/un.h b/include/sys/un.h
new file mode 100644
index 00000000..769dac6b
--- /dev/null
+++ b/include/sys/un.h
@@ -0,0 +1,13 @@
+#ifndef	_SYS_UN_H
+#define	_SYS_UN_H
+
+#define __NEED_sa_family_t
+#include <bits/alltypes.h>
+
+struct sockaddr_un
+{
+	sa_family_t sun_family;
+	char sun_path[108];
+};
+
+#endif
diff --git a/include/sys/user.h b/include/sys/user.h
new file mode 100644
index 00000000..24ac9400
--- /dev/null
+++ b/include/sys/user.h
@@ -0,0 +1,15 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <limits.h>
+#include <unistd.h>
+
+#include <bits/user.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/include/sys/utsname.h b/include/sys/utsname.h
new file mode 100644
index 00000000..383e8251
--- /dev/null
+++ b/include/sys/utsname.h
@@ -0,0 +1,21 @@
+#ifndef	_SYS_UTSNAME_H
+#define	_SYS_UTSNAME_H
+
+struct utsname
+{
+	char sysname[65];
+	char nodename[65];
+	char release[65];
+	char version[65];
+	char machine[65];
+#ifdef _GNU_SOURCE
+	char domainname[65];
+#else
+	char __domainname[65];
+#endif
+};
+
+int uname (struct utsname *);
+
+
+#endif
diff --git a/include/sys/vfs.h b/include/sys/vfs.h
new file mode 100644
index 00000000..a899db27
--- /dev/null
+++ b/include/sys/vfs.h
@@ -0,0 +1 @@
+#include <sys/statfs.h>
diff --git a/include/sys/vt.h b/include/sys/vt.h
new file mode 100644
index 00000000..834abfbc
--- /dev/null
+++ b/include/sys/vt.h
@@ -0,0 +1 @@
+#include <linux/vt.h>
diff --git a/include/sys/wait.h b/include/sys/wait.h
new file mode 100644
index 00000000..a1851530
--- /dev/null
+++ b/include/sys/wait.h
@@ -0,0 +1,28 @@
+#ifndef	_SYS_WAIT_H
+#define	_SYS_WAIT_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define __NEED_pid_t
+#define __NEED_id_t
+#define __NEED_time_t
+#define __NEED_struct_timeval
+#define __NEED_siginfo_t
+#include <bits/alltypes.h>
+
+typedef int idtype_t;
+
+pid_t wait (int *);
+int waitid (idtype_t, id_t, siginfo_t *, int);
+pid_t waitpid (pid_t, int *, int );
+//pid_t wait3 (int *, int, struct rusage *);
+//pid_t wait4 (pid_t, int *, int, struct rusage *);
+
+#include <bits/wait.h>
+#include <bits/wexitstatus.h>
+
+#ifdef __cplusplus
+}
+#endif
+#endif