summaryrefslogtreecommitdiffstats
path: root/usr/include/sys
diff options
context:
space:
mode:
Diffstat (limited to 'usr/include/sys')
-rw-r--r--usr/include/sys/auxv.h17
-rw-r--r--usr/include/sys/capability.h11
-rw-r--r--usr/include/sys/dirent.h32
-rw-r--r--usr/include/sys/elf32.h117
-rw-r--r--usr/include/sys/elf64.h117
-rw-r--r--usr/include/sys/elfcommon.h202
-rw-r--r--usr/include/sys/file.h9
-rw-r--r--usr/include/sys/fsuid.h14
-rw-r--r--usr/include/sys/inotify.h16
-rw-r--r--usr/include/sys/ioctl.h18
-rw-r--r--usr/include/sys/klog.h24
-rw-r--r--usr/include/sys/md.h34
-rw-r--r--usr/include/sys/mman.h26
-rw-r--r--usr/include/sys/mount.h71
-rw-r--r--usr/include/sys/param.h11
-rw-r--r--usr/include/sys/poll.h20
-rw-r--r--usr/include/sys/prctl.h11
-rw-r--r--usr/include/sys/reboot.h25
-rw-r--r--usr/include/sys/resource.h48
-rw-r--r--usr/include/sys/select.h17
-rw-r--r--usr/include/sys/sendfile.h14
-rw-r--r--usr/include/sys/socket.h270
-rw-r--r--usr/include/sys/splice.h19
-rw-r--r--usr/include/sys/stat.h96
-rw-r--r--usr/include/sys/statfs.h1
-rw-r--r--usr/include/sys/syscall.h13
-rw-r--r--usr/include/sys/sysconf.h40
-rw-r--r--usr/include/sys/sysinfo.h13
-rw-r--r--usr/include/sys/sysmacros.h37
-rw-r--r--usr/include/sys/time.h117
-rw-r--r--usr/include/sys/times.h14
-rw-r--r--usr/include/sys/types.h108
-rw-r--r--usr/include/sys/uio.h15
-rw-r--r--usr/include/sys/un.h11
-rw-r--r--usr/include/sys/utime.h11
-rw-r--r--usr/include/sys/utsname.h23
-rw-r--r--usr/include/sys/vfs.h132
-rw-r--r--usr/include/sys/wait.h28
38 files changed, 1802 insertions, 0 deletions
diff --git a/usr/include/sys/auxv.h b/usr/include/sys/auxv.h
new file mode 100644
index 0000000..fc98ed4
--- /dev/null
+++ b/usr/include/sys/auxv.h
@@ -0,0 +1,17 @@
+#ifndef _SYS_AUXV_H
+#define _SYS_AUXV_H
+
+#include <klibc/compiler.h>
+#include <klibc/extern.h>
+#include <elf.h>
+
+#define _AUXVAL_MAX AT_SYSINFO_EHDR
+
+__extern unsigned long __auxval[_AUXVAL_MAX];
+
+__static_inline unsigned long getauxval(unsigned long __t)
+{
+ return (__t >= _AUXVAL_MAX) ? 0 : __auxval[__t];
+}
+
+#endif /* _SYS_AUXV_H */
diff --git a/usr/include/sys/capability.h b/usr/include/sys/capability.h
new file mode 100644
index 0000000..8b92984
--- /dev/null
+++ b/usr/include/sys/capability.h
@@ -0,0 +1,11 @@
+#ifndef _SYS_CAPABILITY_H
+#define _SYS_CAPABILITY_H
+
+#include <sys/types.h>
+#include <klibc/extern.h>
+#include <linux/capability.h>
+
+__extern int capget(cap_user_header_t, cap_user_data_t);
+__extern int capset(cap_user_header_t, const cap_user_data_t);
+
+#endif /* _SYS_CAPABILITY_H */
diff --git a/usr/include/sys/dirent.h b/usr/include/sys/dirent.h
new file mode 100644
index 0000000..18b7a33
--- /dev/null
+++ b/usr/include/sys/dirent.h
@@ -0,0 +1,32 @@
+/*
+ * sys/dirent.h
+ */
+
+#ifndef _SYS_DIRENT_H
+#define _SYS_DIRENT_H
+
+#include <stdint.h>
+
+/* The kernel calls this struct dirent64 */
+struct dirent {
+ uint64_t d_ino;
+ int64_t d_off;
+ unsigned short d_reclen;
+ unsigned char d_type;
+ char d_name[256];
+};
+
+/* File types to use for d_type */
+#define DT_UNKNOWN 0
+#define DT_FIFO 1
+#define DT_CHR 2
+#define DT_DIR 4
+#define DT_BLK 6
+#define DT_REG 8
+#define DT_LNK 10
+#define DT_SOCK 12
+#define DT_WHT 14
+
+__extern int getdents(unsigned int, struct dirent *, unsigned int);
+
+#endif /* _SYS_DIRENT_H */
diff --git a/usr/include/sys/elf32.h b/usr/include/sys/elf32.h
new file mode 100644
index 0000000..6da2ddb
--- /dev/null
+++ b/usr/include/sys/elf32.h
@@ -0,0 +1,117 @@
+/*
+ * sys/elf32.h
+ */
+
+#ifndef _SYS_ELF32_H
+#define _SYS_ELF32_H
+
+#include <sys/elfcommon.h>
+
+/* ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */
+typedef uint16_t Elf32_Half;
+typedef int16_t Elf32_SHalf;
+typedef uint32_t Elf32_Word;
+typedef int32_t Elf32_Sword;
+typedef uint64_t Elf32_Xword;
+typedef int64_t Elf32_Sxword;
+
+typedef uint32_t Elf32_Off;
+typedef uint32_t Elf32_Addr;
+typedef uint16_t Elf32_Section;
+
+/* Dynamic header */
+
+typedef struct elf32_dyn {
+ Elf32_Sword d_tag;
+ union {
+ Elf32_Sword d_val;
+ Elf32_Addr d_ptr;
+ } d_un;
+} Elf32_Dyn;
+
+/* Relocations */
+
+#define ELF32_R_SYM(x) ((x) >> 8)
+#define ELF32_R_TYPE(x) ((x) & 0xff)
+
+typedef struct elf32_rel {
+ Elf32_Addr r_offset;
+ Elf32_Word r_info;
+} Elf32_Rel;
+
+typedef struct elf32_rela {
+ Elf32_Addr r_offset;
+ Elf32_Word r_info;
+ Elf32_Sword r_addend;
+} Elf32_Rela;
+
+/* Symbol */
+
+typedef struct elf32_sym {
+ Elf32_Word st_name;
+ Elf32_Addr st_value;
+ Elf32_Word st_size;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf32_Half st_shndx;
+} Elf32_Sym;
+
+/* Main file header */
+
+typedef struct elf32_hdr {
+ unsigned char e_ident[EI_NIDENT];
+ Elf32_Half e_type;
+ Elf32_Half e_machine;
+ Elf32_Word e_version;
+ Elf32_Addr e_entry;
+ Elf32_Off e_phoff;
+ Elf32_Off e_shoff;
+ Elf32_Word e_flags;
+ Elf32_Half e_ehsize;
+ Elf32_Half e_phentsize;
+ Elf32_Half e_phnum;
+ Elf32_Half e_shentsize;
+ Elf32_Half e_shnum;
+ Elf32_Half e_shstrndx;
+} Elf32_Ehdr;
+
+/* Program header */
+
+typedef struct elf32_phdr {
+ Elf32_Word p_type;
+ Elf32_Off p_offset;
+ Elf32_Addr p_vaddr;
+ Elf32_Addr p_paddr;
+ Elf32_Word p_filesz;
+ Elf32_Word p_memsz;
+ Elf32_Word p_flags;
+ Elf32_Word p_align;
+} Elf32_Phdr;
+
+/* Section header */
+
+typedef struct elf32_shdr {
+ Elf32_Word sh_name;
+ Elf32_Word sh_type;
+ Elf32_Word sh_flags;
+ Elf32_Addr sh_addr;
+ Elf32_Off sh_offset;
+ Elf32_Word sh_size;
+ Elf32_Word sh_link;
+ Elf32_Word sh_info;
+ Elf32_Word sh_addralign;
+ Elf32_Word sh_entsize;
+} Elf32_Shdr;
+
+/* Note header */
+typedef struct elf32_note {
+ Elf32_Word n_namesz; /* Name size */
+ Elf32_Word n_descsz; /* Content size */
+ Elf32_Word n_type; /* Content type */
+} Elf32_Nhdr;
+
+/* How to extract and insert information held in the st_info field. */
+#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
+#define ELF32_ST_TYPE(val) ((val) & 0xf)
+
+#endif /* _SYS_ELF32_H */
diff --git a/usr/include/sys/elf64.h b/usr/include/sys/elf64.h
new file mode 100644
index 0000000..877b7cd
--- /dev/null
+++ b/usr/include/sys/elf64.h
@@ -0,0 +1,117 @@
+/*
+ * sys/elf64.h
+ */
+
+#ifndef _SYS_ELF64_H
+#define _SYS_ELF64_H
+
+#include <sys/elfcommon.h>
+
+/* ELF standard typedefs (yet more proof that <stdint.h> was way overdue) */
+typedef uint16_t Elf64_Half;
+typedef int16_t Elf64_SHalf;
+typedef uint32_t Elf64_Word;
+typedef int32_t Elf64_Sword;
+typedef uint64_t Elf64_Xword;
+typedef int64_t Elf64_Sxword;
+
+typedef uint64_t Elf64_Off;
+typedef uint64_t Elf64_Addr;
+typedef uint16_t Elf64_Section;
+
+/* Dynamic header */
+
+typedef struct elf64_dyn {
+ Elf64_Sxword d_tag;
+ union {
+ Elf64_Xword d_val;
+ Elf64_Addr d_ptr;
+ } d_un;
+} Elf64_Dyn;
+
+/* Relocations */
+
+#define ELF64_R_SYM(x) ((x) >> 32)
+#define ELF64_R_TYPE(x) ((x) & 0xffffffff)
+
+typedef struct elf64_rel {
+ Elf64_Addr r_offset;
+ Elf64_Xword r_info;
+} Elf64_Rel;
+
+typedef struct elf64_rela {
+ Elf64_Addr r_offset;
+ Elf64_Xword r_info;
+ Elf64_Sxword r_addend;
+} Elf64_Rela;
+
+/* Symbol */
+
+typedef struct elf64_sym {
+ Elf64_Word st_name;
+ unsigned char st_info;
+ unsigned char st_other;
+ Elf64_Half st_shndx;
+ Elf64_Addr st_value;
+ Elf64_Xword st_size;
+} Elf64_Sym;
+
+/* Main file header */
+
+typedef struct elf64_hdr {
+ unsigned char e_ident[EI_NIDENT];
+ Elf64_Half e_type;
+ Elf64_Half e_machine;
+ Elf64_Word e_version;
+ Elf64_Addr e_entry;
+ Elf64_Off e_phoff;
+ Elf64_Off e_shoff;
+ Elf64_Word e_flags;
+ Elf64_Half e_ehsize;
+ Elf64_Half e_phentsize;
+ Elf64_Half e_phnum;
+ Elf64_Half e_shentsize;
+ Elf64_Half e_shnum;
+ Elf64_Half e_shstrndx;
+} Elf64_Ehdr;
+
+/* Program header */
+
+typedef struct elf64_phdr {
+ Elf64_Word p_type;
+ Elf64_Word p_flags;
+ Elf64_Off p_offset;
+ Elf64_Addr p_vaddr;
+ Elf64_Addr p_paddr;
+ Elf64_Xword p_filesz;
+ Elf64_Xword p_memsz;
+ Elf64_Xword p_align;
+} Elf64_Phdr;
+
+/* Section header */
+
+typedef struct elf64_shdr {
+ Elf64_Word sh_name;
+ Elf64_Word sh_type;
+ Elf64_Xword sh_flags;
+ Elf64_Addr sh_addr;
+ Elf64_Off sh_offset;
+ Elf64_Xword sh_size;
+ Elf64_Word sh_link;
+ Elf64_Word sh_info;
+ Elf64_Xword sh_addralign;
+ Elf64_Xword sh_entsize;
+} Elf64_Shdr;
+
+/* Note header */
+typedef struct elf64_note {
+ Elf64_Word n_namesz; /* Name size */
+ Elf64_Word n_descsz; /* Content size */
+ Elf64_Word n_type; /* Content type */
+} Elf64_Nhdr;
+
+/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
+
+#endif /* _SYS_ELF64_H */
diff --git a/usr/include/sys/elfcommon.h b/usr/include/sys/elfcommon.h
new file mode 100644
index 0000000..603b0ce
--- /dev/null
+++ b/usr/include/sys/elfcommon.h
@@ -0,0 +1,202 @@
+/*
+ * sys/elfcommon.h
+ */
+
+#ifndef _SYS_ELFCOMMON_H
+#define _SYS_ELFCOMMON_H
+
+#include <stdint.h>
+
+/* Segment types */
+#define PT_NULL 0
+#define PT_LOAD 1
+#define PT_DYNAMIC 2
+#define PT_INTERP 3
+#define PT_NOTE 4
+#define PT_SHLIB 5
+#define PT_PHDR 6
+#define PT_LOOS 0x60000000
+#define PT_HIOS 0x6fffffff
+#define PT_LOPROC 0x70000000
+#define PT_HIPROC 0x7fffffff
+#define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */
+
+/* ELF file types */
+#define ET_NONE 0
+#define ET_REL 1
+#define ET_EXEC 2
+#define ET_DYN 3
+#define ET_CORE 4
+#define ET_LOPROC 0xff00
+#define ET_HIPROC 0xffff
+
+/* ELF machine types */
+#define EM_NONE 0
+#define EM_M32 1
+#define EM_SPARC 2
+#define EM_386 3
+#define EM_68K 4
+#define EM_88K 5
+#define EM_486 6 /* Not used in Linux at least */
+#define EM_860 7
+#define EM_MIPS 8 /* R3k, bigendian(?) */
+#define EM_MIPS_RS4_BE 10 /* R4k BE */
+#define EM_PARISC 15
+#define EM_SPARC32PLUS 18
+#define EM_PPC 20
+#define EM_PPC64 21
+#define EM_S390 22
+#define EM_SH 42
+#define EM_SPARCV9 43 /* v9 = SPARC64 */
+#define EM_H8_300H 47
+#define EM_H8S 48
+#define EM_IA_64 50 /* Itanic */
+#define EM_X86_64 62
+#define EM_CRIS 76
+#define EM_V850 87
+#define EM_ALPHA 0x9026 /* Interrim Alpha that stuck around */
+#define EM_CYGNUS_V850 0x9080 /* Old v850 ID used by Cygnus */
+#define EM_S390_OLD 0xA390 /* Obsolete interrim value for S/390 */
+
+/* Dynamic type values */
+#define DT_NULL 0
+#define DT_NEEDED 1
+#define DT_PLTRELSZ 2
+#define DT_PLTGOT 3
+#define DT_HASH 4
+#define DT_STRTAB 5
+#define DT_SYMTAB 6
+#define DT_RELA 7
+#define DT_RELASZ 8
+#define DT_RELAENT 9
+#define DT_STRSZ 10
+#define DT_SYMENT 11
+#define DT_INIT 12
+#define DT_FINI 13
+#define DT_SONAME 14
+#define DT_RPATH 15
+#define DT_SYMBOLIC 16
+#define DT_REL 17
+#define DT_RELSZ 18
+#define DT_RELENT 19
+#define DT_PLTREL 20
+#define DT_DEBUG 21
+#define DT_TEXTREL 22
+#define DT_JMPREL 23
+#define DT_LOPROC 0x70000000
+#define DT_HIPROC 0x7fffffff
+
+/* Auxilliary table entries */
+#define AT_NULL 0 /* end of vector */
+#define AT_IGNORE 1 /* entry should be ignored */
+#define AT_EXECFD 2 /* file descriptor of program */
+#define AT_PHDR 3 /* program headers for program */
+#define AT_PHENT 4 /* size of program header entry */
+#define AT_PHNUM 5 /* number of program headers */
+#define AT_PAGESZ 6 /* system page size */
+#define AT_BASE 7 /* base address of interpreter */
+#define AT_FLAGS 8 /* flags */
+#define AT_ENTRY 9 /* entry point of program */
+#define AT_NOTELF 10 /* program is not ELF */
+#define AT_UID 11 /* real uid */
+#define AT_EUID 12 /* effective uid */
+#define AT_GID 13 /* real gid */
+#define AT_EGID 14 /* effective gid */
+#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
+#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
+#define AT_CLKTCK 17 /* frequency at which times() increments */
+/* 18..22 = ? */
+#define AT_SECURE 23 /* secure mode boolean */
+#define AT_SYSINFO 32 /* vdso entry point address */
+#define AT_SYSINFO_EHDR 33 /* vdso header address */
+
+/* Program header permission flags */
+#define PF_X 0x1
+#define PF_W 0x2
+#define PF_R 0x4
+
+/* Section header types */
+#define SHT_NULL 0
+#define SHT_PROGBITS 1
+#define SHT_SYMTAB 2
+#define SHT_STRTAB 3
+#define SHT_RELA 4
+#define SHT_HASH 5
+#define SHT_DYNAMIC 6
+#define SHT_NOTE 7
+#define SHT_NOBITS 8
+#define SHT_REL 9
+#define SHT_SHLIB 10
+#define SHT_DYNSYM 11
+#define SHT_NUM 12
+#define SHT_LOPROC 0x70000000
+#define SHT_HIPROC 0x7fffffff
+#define SHT_LOUSER 0x80000000
+#define SHT_HIUSER 0xffffffff
+
+/* Section header flags */
+#define SHF_WRITE 0x1
+#define SHF_ALLOC 0x2
+#define SHF_EXECINSTR 0x4
+#define SHF_MASKPROC 0xf0000000
+
+/* Special section numbers */
+#define SHN_UNDEF 0
+#define SHN_LORESERVE 0xff00
+#define SHN_LOPROC 0xff00
+#define SHN_HIPROC 0xff1f
+#define SHN_ABS 0xfff1
+#define SHN_COMMON 0xfff2
+#define SHN_HIRESERVE 0xffff
+
+/* End of a chain. */
+#define STN_UNDEF 0
+
+/* Lenght of magic at the start of a file */
+#define EI_NIDENT 16
+
+/* Magic number constants... */
+#define EI_MAG0 0 /* e_ident[] indexes */
+#define EI_MAG1 1
+#define EI_MAG2 2
+#define EI_MAG3 3
+#define EI_CLASS 4
+#define EI_DATA 5
+#define EI_VERSION 6
+#define EI_OSABI 7
+#define EI_PAD 8
+
+#define ELFMAG0 0x7f /* EI_MAG */
+#define ELFMAG1 'E'
+#define ELFMAG2 'L'
+#define ELFMAG3 'F'
+#define ELFMAG "\177ELF"
+#define SELFMAG 4
+
+#define ELFCLASSNONE 0 /* EI_CLASS */
+#define ELFCLASS32 1
+#define ELFCLASS64 2
+#define ELFCLASSNUM 3
+
+#define ELFDATANONE 0 /* e_ident[EI_DATA] */
+#define ELFDATA2LSB 1
+#define ELFDATA2MSB 2
+
+#define EV_NONE 0 /* e_version, EI_VERSION */
+#define EV_CURRENT 1
+#define EV_NUM 2
+
+#define ELFOSABI_NONE 0
+#define ELFOSABI_LINUX 3
+
+/* Legal values for ST_BIND subfield of st_info (symbol binding). */
+#define STB_LOCAL 0 /* Local symbol */
+#define STB_GLOBAL 1 /* Global symbol */
+#define STB_WEAK 2 /* Weak symbol */
+#define STB_NUM 3 /* Number of defined types. */
+#define STB_LOOS 10 /* Start of OS-specific */
+#define STB_HIOS 12 /* End of OS-specific */
+#define STB_LOPROC 13 /* Start of processor-specific */
+#define STB_HIPROC 15 /* End of processor-specific */
+
+#endif /* _SYS_ELFCOMMON_H */
diff --git a/usr/include/sys/file.h b/usr/include/sys/file.h
new file mode 100644
index 0000000..7b580f3
--- /dev/null
+++ b/usr/include/sys/file.h
@@ -0,0 +1,9 @@
+#ifndef _SYS_FILE_H
+#define _SYS_FILE_H
+
+/* LOCK_ definitions */
+#include <fcntl.h>
+
+__extern int flock(int, int);
+
+#endif /* _SYS_FILE_H */
diff --git a/usr/include/sys/fsuid.h b/usr/include/sys/fsuid.h
new file mode 100644
index 0000000..d64e28b
--- /dev/null
+++ b/usr/include/sys/fsuid.h
@@ -0,0 +1,14 @@
+/*
+ * sys/fsuid.h
+ */
+
+#ifndef _SYS_FSUID_H
+#define _SYS_FSUID_H
+
+#include <klibc/extern.h>
+#include <sys/types.h>
+
+__extern int setfsuid(uid_t);
+__extern int setfsgid(gid_t);
+
+#endif /* _SYS_FSUID_H */
diff --git a/usr/include/sys/inotify.h b/usr/include/sys/inotify.h
new file mode 100644
index 0000000..e08cb05
--- /dev/null
+++ b/usr/include/sys/inotify.h
@@ -0,0 +1,16 @@
+/*
+ * sys/inotify.h
+ */
+
+#ifndef _SYS_INOTIFY_H
+#define _SYS_INOTIFY_H
+
+#include <sys/types.h>
+#include <linux/inotify.h>
+#include <klibc/extern.h>
+
+__extern int inotify_init(void);
+__extern int inotify_add_watch(int, const char *, __u32);
+__extern int inotify_rm_watch(int, __u32);
+
+#endif /* _SYS_INOTIFY_H */
diff --git a/usr/include/sys/ioctl.h b/usr/include/sys/ioctl.h
new file mode 100644
index 0000000..7b0b687
--- /dev/null
+++ b/usr/include/sys/ioctl.h
@@ -0,0 +1,18 @@
+/*
+ * sys/ioctl.h
+ */
+
+#ifndef _SYS_IOCTL_H
+#define _SYS_IOCTL_H
+
+#include <sys/types.h>
+#include <klibc/extern.h>
+#include <linux/ioctl.h>
+#include <asm/ioctls.h>
+
+/* the SIOCxxx I/O are hidden */
+#include <linux/sockios.h>
+
+__extern int ioctl(int, int, void *);
+
+#endif /* _SYS_IOCTL_H */
diff --git a/usr/include/sys/klog.h b/usr/include/sys/klog.h
new file mode 100644
index 0000000..02c7217
--- /dev/null
+++ b/usr/include/sys/klog.h
@@ -0,0 +1,24 @@
+/*
+ * sys/klog.h
+ */
+
+#ifndef _SYS_KLOG_H
+#define _SYS_KLOG_H
+
+#include <klibc/extern.h>
+
+#define KLOG_CLOSE 0
+#define KLOG_OPEN 1
+#define KLOG_READ 2
+#define KLOG_READ_ALL 3
+#define KLOG_READ_CLEAR 4
+#define KLOG_CLEAR 5
+#define KLOG_DISABLE 6
+#define KLOG_ENABLE 7
+#define KLOG_SETLEVEL 8
+#define KLOG_UNREADSIZE 9
+#define KLOG_WRITE 10
+
+__extern int klogctl(int, char *, int);
+
+#endif /* _SYS_KLOG_H */
diff --git a/usr/include/sys/md.h b/usr/include/sys/md.h
new file mode 100644
index 0000000..63be3d8
--- /dev/null
+++ b/usr/include/sys/md.h
@@ -0,0 +1,34 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2006 H. Peter Anvin - All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
+ * Boston MA 02111-1307, USA; either version 2 of the License, or
+ * (at your option) any later version; incorporated herein by reference.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * sys/md.h
+ *
+ * Defines for the Linux md functionality. Some of this stuff is
+ * userspace-visible but lives in md_k.h, which is user-space unsafe.
+ * Sigh.
+ */
+
+#ifndef _SYS_MD_H
+#define _SYS_MD_H
+
+#include <sys/types.h>
+
+#define LEVEL_MULTIPATH (-4)
+#define LEVEL_LINEAR (-1)
+#define LEVEL_FAULTY (-5)
+#define MAX_MD_DEVS 256 /* Max number of md dev */
+
+#include <linux/raid/md_u.h>
+#include <linux/raid/md_p.h>
+
+#endif /* _SYS_MD_H */
diff --git a/usr/include/sys/mman.h b/usr/include/sys/mman.h
new file mode 100644
index 0000000..3fd626e
--- /dev/null
+++ b/usr/include/sys/mman.h
@@ -0,0 +1,26 @@
+/*
+ * sys/mman.h
+ */
+
+#ifndef _SYS_MMAN_H
+#define _SYS_MMAN_H
+
+#include <klibc/extern.h>
+#include <sys/types.h>
+#include <linux/mman.h>
+
+#define MAP_FAILED ((void *)-1)
+
+__extern void *mmap(void *, size_t, int, int, int, off_t);
+__extern int munmap(void *, size_t);
+__extern void *mremap(void *, size_t, size_t, unsigned long);
+__extern int shm_open(const char *, int, mode_t);
+__extern int shm_unlink(const char *);
+__extern int msync(const void *, size_t, int);
+__extern int mprotect(const void *, size_t, int);
+__extern int mlockall(int);
+__extern int munlockall(void);
+__extern int mlock(const void *, size_t);
+__extern int munlock(const void *, size_t);
+
+#endif /* _SYS_MMAN_H */
diff --git a/usr/include/sys/mount.h b/usr/include/sys/mount.h
new file mode 100644
index 0000000..9d6b0ee
--- /dev/null
+++ b/usr/include/sys/mount.h
@@ -0,0 +1,71 @@
+/*
+ * sys/mount.h
+ */
+
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#include <klibc/extern.h>
+#include <sys/ioctl.h>
+
+/*
+ * These are the fs-independent mount-flags: up to 32 flags are supported
+ */
+#define MS_RDONLY 0x0001 /* Mount read-only */
+#define MS_NOSUID 0x0002 /* Ignore suid and sgid bits */
+#define MS_NODEV 0x0004 /* Disallow access to device special files */
+#define MS_NOEXEC 0x0008 /* Disallow program execution */
+#define MS_SYNCHRONOUS 0x0010 /* Writes are synced at once */
+#define MS_REMOUNT 0x0020 /* Alter flags of a mounted FS */
+#define MS_MANDLOCK 0x0040 /* Allow mandatory locks on an FS */
+#define MS_DIRSYNC 0x0080 /* Directory modifications are synchronous */
+#define MS_NOATIME 0x0400 /* Do not update access times. */
+#define MS_NODIRATIME 0x0800 /* Do not update directory access times */
+#define MS_BIND 0x1000
+#define MS_MOVE 0x2000
+#define MS_REC 0x4000
+#define MS_VERBOSE 0x8000
+#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
+#define MS_ONE_SECOND (1<<17) /* fs has 1 sec a/m/ctime resolution */
+#define MS_ACTIVE (1<<30)
+#define MS_NOUSER (1<<31)
+
+/*
+ * Superblock flags that can be altered by MS_REMOUNT
+ */
+#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|MS_NODIRATIME)
+
+/*
+ * Old magic mount flag and mask
+ */
+#define MS_MGC_VAL 0xC0ED0000
+#define MS_MGC_MSK 0xffff0000
+
+/*
+ * umount2() flags
+ */
+#define MNT_FORCE 1 /* Forcibly unmount */
+#define MNT_DETACH 2 /* Detach from tree only */
+#define MNT_EXPIRE 4 /* Mark for expiry */
+
+/*
+ * Block device ioctls
+ */
+#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */
+#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */
+#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */
+#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */
+#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */
+#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */
+#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */
+
+/*
+ * Prototypes
+ */
+__extern int mount(const char *, const char *,
+ const char *, unsigned long, const void *);
+__extern int umount(const char *);
+__extern int umount2(const char *, int);
+__extern int pivot_root(const char *, const char *);
+
+#endif /* _SYS_MOUNT_H */
diff --git a/usr/include/sys/param.h b/usr/include/sys/param.h
new file mode 100644
index 0000000..fb3b2e4
--- /dev/null
+++ b/usr/include/sys/param.h
@@ -0,0 +1,11 @@
+/*
+ * sys/param.h
+ */
+
+#ifndef _SYS_PARAM_H
+#define _SYS_PARAM_H
+
+#include <limits.h>
+#include <linux/param.h>
+
+#endif /* _SYS_PARAM_H */
diff --git a/usr/include/sys/poll.h b/usr/include/sys/poll.h
new file mode 100644
index 0000000..f0c60c2
--- /dev/null
+++ b/usr/include/sys/poll.h
@@ -0,0 +1,20 @@
+/*
+ * poll.h
+ */
+
+#ifndef _POLL_H
+#define _POLL_H
+
+#include <klibc/extern.h>
+#include <sys/time.h>
+#include <signal.h>
+#include <linux/poll.h>
+
+/* POSIX specifies "int" for the timeout, Linux seems to use long... */
+
+typedef unsigned int nfds_t;
+__extern int poll(struct pollfd *, nfds_t, long);
+__extern int ppoll(struct pollfd *, nfds_t, struct timespec *,
+ const sigset_t *);
+
+#endif /* _POLL_H */
diff --git a/usr/include/sys/prctl.h b/usr/include/sys/prctl.h
new file mode 100644
index 0000000..b0f41f5
--- /dev/null
+++ b/usr/include/sys/prctl.h
@@ -0,0 +1,11 @@
+#ifndef _SYS_PRCTL_H
+#define _SYS_PRCTL_H
+
+#include <sys/types.h>
+#include <klibc/extern.h>
+#include <linux/prctl.h>
+
+/* glibc has this as a varadic function, so join the club... */
+__extern int prctl(int, ...);
+
+#endif /* _SYS_PRCTL_H */
diff --git a/usr/include/sys/reboot.h b/usr/include/sys/reboot.h
new file mode 100644
index 0000000..b46a1c5
--- /dev/null
+++ b/usr/include/sys/reboot.h
@@ -0,0 +1,25 @@
+/*
+ * sys/reboot.h
+ */
+
+#ifndef _SYS_REBOOT_H
+#define _SYS_REBOOT_H
+
+#include <klibc/extern.h>
+#include <linux/reboot.h>
+
+/* glibc names these constants differently; allow both versions */
+
+#define RB_AUTOBOOT LINUX_REBOOT_CMD_RESTART
+#define RB_HALT_SYSTEM LINUX_REBOOT_CMD_HALT
+#define RB_ENABLE_CAD LINUX_REBOOT_CMD_CAD_ON
+#define RB_DISABLE_CAD LINUX_REBOOT_CMD_CAD_OFF
+#define RB_POWER_OFF LINUX_REBOOT_CMD_POWER_OFF
+
+/* two-arguments version of reboot */
+__extern int reboot(int, void *);
+
+/* Native four-argument system call */
+__extern int __reboot(int, int, int, void *);
+
+#endif /* _SYS_REBOOT_H */
diff --git a/usr/include/sys/resource.h b/usr/include/sys/resource.h
new file mode 100644
index 0000000..e43a69d
--- /dev/null
+++ b/usr/include/sys/resource.h
@@ -0,0 +1,48 @@
+/*
+ * sys/resource.h
+ */
+
+#ifndef _SYS_RESOURCE_H
+#define _SYS_RESOURCE_H
+
+#include <klibc/extern.h>
+#include <sys/types.h>
+#include <sys/time.h>
+
+#define RUSAGE_SELF 0
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_BOTH (-2)
+#define RUSAGE_THREAD 1
+
+struct rusage {
+ struct timeval_old ru_utime; /* user time used */
+ struct timeval_old ru_stime; /* system time used */
+ __kernel_long_t ru_maxrss; /* maximum resident set size */
+ __kernel_long_t ru_ixrss; /* integral shared memory size */
+ __kernel_long_t ru_idrss; /* integral unshared data size */
+ __kernel_long_t ru_isrss; /* integral unshared stack size */
+ __kernel_long_t ru_minflt; /* page reclaims */
+ __kernel_long_t ru_majflt; /* page faults */
+ __kernel_long_t ru_nswap; /* swaps */
+ __kernel_long_t ru_inblock; /* block input operations */
+ __kernel_long_t ru_oublock; /* block output operations */
+ __kernel_long_t ru_msgsnd; /* messages sent */
+ __kernel_long_t ru_msgrcv; /* messages received */
+ __kernel_long_t ru_nsignals; /* signals received */
+ __kernel_long_t ru_nvcsw; /* voluntary context switches */
+ __kernel_long_t ru_nivcsw; /* involuntary " */
+};
+
+#define PRIO_MIN (-20)
+#define PRIO_MAX 20
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP 1
+#define PRIO_USER 2
+
+__extern int getpriority(int, int);
+__extern int setpriority(int, int, int);
+
+__extern int getrusage(int, struct rusage *);
+
+#endif /* _SYS_RESOURCE_H */
diff --git a/usr/include/sys/select.h b/usr/include/sys/select.h
new file mode 100644
index 0000000..cc4e00e
--- /dev/null
+++ b/usr/include/sys/select.h
@@ -0,0 +1,17 @@
+/*
+ * sys/select.h
+ */
+
+#ifndef _SYS_SELECT_H
+#define _SYS_SELECT_H
+
+#include <klibc/extern.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <signal.h>
+
+__extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
+__extern int pselect(int, fd_set *, fd_set *, fd_set *,
+ const struct timespec *, const sigset_t *);
+
+#endif /* _SYS_SELECT_H */
diff --git a/usr/include/sys/sendfile.h b/usr/include/sys/sendfile.h
new file mode 100644
index 0000000..a745f10
--- /dev/null
+++ b/usr/include/sys/sendfile.h
@@ -0,0 +1,14 @@
+/*
+ * sys/sendfile.h
+ */
+
+#ifndef _SYS_SENDFILE_H
+#define _SYS_SENDFILE_H
+
+#include <klibc/extern.h>
+#include <stddef.h>
+#include <sys/types.h>
+
+__extern ssize_t sendfile(int, int, off_t *, size_t, off_t);
+
+#endif /* _SYS_SENDFILE_H */
diff --git a/usr/include/sys/socket.h b/usr/include/sys/socket.h
new file mode 100644
index 0000000..d0ba9eb
--- /dev/null
+++ b/usr/include/sys/socket.h
@@ -0,0 +1,270 @@
+/*
+ * sys/socket.h
+ */
+
+#ifndef _SYS_SOCKET_H
+#define _SYS_SOCKET_H
+
+#include <sys/types.h>
+#include <klibc/extern.h>
+#include <klibc/compiler.h>
+#include <klibc/sysconfig.h>
+#include <linux/socket.h>
+#include <linux/uio.h>
+#include <asm/socket.h>
+#if _KLIBC_HAS_ARCHSOCKET_H
+#include <klibc/archsocket.h>
+#endif
+
+/* Great job, guys! These are *architecture-specific* ABI constants,
+ that are hidden under #ifdef __KERNEL__... what a brilliant idea!
+ These are the "common" definitions; if not appropriate, override
+ them in <klibc/archsocket.h>. */
+
+#ifndef SOCK_STREAM
+# define SOCK_STREAM 1
+# define SOCK_DGRAM 2
+# define SOCK_RAW 3
+# define SOCK_RDM 4
+# define SOCK_SEQPACKET 5
+# define SOCK_PACKET 10
+# define SOCK_CLOEXEC 02000000
+# define SOCK_NONBLOCK 04000
+#endif
+
+/* The maximum backlock queue length. */
+#define SOMAXCONN 128
+
+#ifndef AF_INET
+#define AF_UNSPEC 0
+#define AF_UNIX 1 /* Unix domain sockets */
+#define AF_LOCAL 1 /* POSIX name for AF_UNIX */
+#define AF_INET 2 /* Internet IP Protocol */
+#define AF_AX25 3 /* Amateur Radio AX.25 */
+#define AF_IPX 4 /* Novell IPX */
+#define AF_APPLETALK 5 /* AppleTalk DDP */
+#define AF_NETROM 6 /* Amateur Radio NET/ROM */
+#define AF_BRIDGE 7 /* Multiprotocol bridge */
+#define AF_ATMPVC 8 /* ATM PVCs */
+#define AF_X25 9 /* Reserved for X.25 project */
+#define AF_INET6 10 /* IP version 6 */
+#define AF_ROSE 11 /* Amateur Radio X.25 PLP */
+#define AF_DECnet 12 /* Reserved for DECnet project */
+#define AF_NETBEUI 13 /* Reserved for 802.2LLC project*/
+#define AF_SECURITY 14 /* Security callback pseudo AF */
+#define AF_KEY 15 /* PF_KEY key management API */
+#define AF_NETLINK 16
+#define AF_ROUTE AF_NETLINK /* Alias to emulate 4.4BSD */
+#define AF_PACKET 17 /* Packet family */
+#define AF_ASH 18 /* Ash */
+#define AF_ECONET 19 /* Acorn Econet */
+#define AF_ATMSVC 20 /* ATM SVCs */
+#define AF_RDS 21 /* RDS sockets */
+#define AF_SNA 22 /* Linux SNA Project (nutters!) */
+#define AF_IRDA 23 /* IRDA sockets */
+#define AF_PPPOX 24 /* PPPoX sockets */
+#define AF_WANPIPE 25 /* Wanpipe API Sockets */
+#define AF_LLC 26 /* Linux LLC */
+#define AF_CAN 29 /* Controller Area Network */
+#define AF_TIPC 30 /* TIPC sockets */
+#define AF_BLUETOOTH 31 /* Bluetooth sockets */
+#define AF_IUCV 32 /* IUCV sockets */
+#define AF_RXRPC 33 /* RxRPC sockets */
+#define AF_ISDN 34 /* mISDN sockets */
+#define AF_PHONET 35 /* Phonet sockets */
+#define AF_IEEE802154 36 /* IEEE802154 sockets */
+#define AF_MAX 37 /* For now.. */
+#endif // !AF_INET
+
+#ifndef PF_UNSPEC
+#define PF_UNSPEC AF_UNSPEC
+#define PF_UNIX AF_UNIX
+#define PF_LOCAL AF_LOCAL
+#define PF_INET AF_INET
+#define PF_AX25 AF_AX25
+#define PF_IPX AF_IPX
+#define PF_APPLETALK AF_APPLETALK
+#define PF_NETROM AF_NETROM
+#define PF_BRIDGE AF_BRIDGE
+#define PF_ATMPVC AF_ATMPVC
+#define PF_X25 AF_X25
+#define PF_INET6 AF_INET6
+#define PF_ROSE AF_ROSE
+#define PF_DECnet AF_DECnet
+#define PF_NETBEUI AF_NETBEUI
+#define PF_SECURITY AF_SECURITY
+#define PF_KEY AF_KEY
+#define PF_NETLINK AF_NETLINK
+#define PF_ROUTE AF_ROUTE
+#define PF_PACKET AF_PACKET
+#define PF_ASH AF_ASH
+#define PF_ECONET AF_ECONET
+#define PF_ATMSVC AF_ATMSVC
+#define PF_RDS AF_RDS
+#define PF_SNA AF_SNA
+#define PF_IRDA AF_IRDA
+#define PF_PPPOX AF_PPPOX
+#define PF_WANPIPE AF_WANPIPE
+#define PF_LLC AF_LLC
+#define PF_CAN AF_CAN
+#define PF_TIPC AF_TIPC
+#define PF_BLUETOOTH AF_BLUETOOTH
+#define PF_IUCV AF_IUCV
+#define PF_RXRPC AF_RXRPC
+#define PF_ISDN AF_ISDN
+#define PF_PHONET AF_PHONET
+#define PF_IEEE802154 AF_IEEE802154
+#define PF_MAX AF_MAX
+#endif // !PF_UNSPEC
+
+#ifndef MSG_OOB
+#define MSG_OOB 1
+#define MSG_PEEK 2
+#define MSG_DONTROUTE 4
+#define MSG_TRYHARD 4 /* Synonym for MSG_DONTROUTE for DECnet */
+#define MSG_CTRUNC 8
+#define MSG_PROBE 0x10 /* Do not send. Only probe path f.e. for MTU */
+#define MSG_TRUNC 0x20
+#define MSG_DONTWAIT 0x40 /* Nonblocking io */
+#define MSG_EOR 0x80 /* End of record */
+#define MSG_WAITALL 0x100 /* Wait for a full request */
+#define MSG_FIN 0x200
+#define MSG_SYN 0x400
+#define MSG_CONFIRM 0x800 /* Confirm path validity */
+#define MSG_RST 0x1000
+#define MSG_ERRQUEUE 0x2000 /* Fetch message from error queue */
+#define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */
+#define MSG_MORE 0x8000 /* Sender will send more */
+
+#define MSG_EOF MSG_FIN
+
+#define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file
+ descriptor received through
+ SCM_RIGHTS */
+#if defined(CONFIG_COMPAT)
+#define MSG_CMSG_COMPAT 0x80000000 /* This message needs 32 bit fixups */
+#else
+#define MSG_CMSG_COMPAT 0 /* We never have 32 bit fixups */
+#endif
+#endif // !MSG_OOB
+
+/* These types is hidden under __KERNEL__ in kernel sources */
+typedef unsigned short sa_family_t;
+struct sockaddr {
+ sa_family_t sa_family; /* address family, AF_xxx */
+ char sa_data[14]; /* 14 bytes of protocol address */
+};
+typedef int socklen_t;
+struct msghdr {
+ void *msg_name;
+ int msg_namelen;
+ struct iovec *msg_iov;
+ size_t msg_iovlen;
+ void *msg_control;
+ size_t msg_controllen;
+ unsigned msg_flags;
+};
+
+/* Ancillary data structures and cmsg macros are also hidden under __KERNEL__ */
+#ifndef CMSG_FIRSTHDR
+/*
+ * POSIX 1003.1g - ancillary data object information
+ * Ancillary data consits of a sequence of pairs of
+ * (cmsghdr, cmsg_data[])
+ */
+
+struct cmsghdr {
+ __kernel_size_t cmsg_len; /* data byte count, including hdr */
+ int cmsg_level; /* originating protocol */
+ int cmsg_type; /* protocol-specific type */
+};
+
+/*
+ * Ancilliary data object information MACROS
+ * Table 5-14 of POSIX 1003.1g
+ */
+
+#define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg))
+#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg))
+
+#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
+
+#define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
+#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
+#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+
+#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ? \
+ (struct cmsghdr *)(ctl) : \
+ (struct cmsghdr *)NULL)
+#define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
+#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \
+ (cmsg)->cmsg_len <= (unsigned long) \
+ ((mhdr)->msg_controllen - \
+ ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
+
+/*
+ * Get the next cmsg header
+ *
+ * PLEASE, do not touch this function. If you think, that it is
+ * incorrect, grep kernel sources and think about consequences
+ * before trying to improve it.
+ *
+ * Now it always returns valid, not truncated ancillary object
+ * HEADER. But caller still MUST check, that cmsg->cmsg_len is
+ * inside range, given by msg->msg_controllen before using
+ * ancillary object DATA. --ANK (980731)
+ */
+
+static inline struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
+ struct cmsghdr *__cmsg)
+{
+ struct cmsghdr * __ptr;
+
+ __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
+ if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
+ return (struct cmsghdr *)0;
+
+ return __ptr;
+}
+
+static inline struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
+{
+ return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
+}
+
+/* "Socket"-level control message types: */
+
+#define SCM_RIGHTS 0x01 /* rw: access rights (array of int) */
+#define SCM_CREDENTIALS 0x02 /* rw: struct ucred */
+#define SCM_SECURITY 0x03 /* rw: security label */
+
+struct ucred {
+ __u32 pid;
+ __u32 uid;
+ __u32 gid;
+};
+#endif /* CMSG_FIRSTHDR */
+
+
+__extern int socket(int, int, int);
+__extern int bind(int, const struct sockaddr *, int);
+__extern int connect(int, const struct sockaddr *, socklen_t);
+__extern int listen(int, int);
+__extern int accept(int, struct sockaddr *, socklen_t *);
+__extern int accept4(int, struct sockaddr *, socklen_t *, int);
+__extern int getsockname(int, struct sockaddr *, socklen_t *);
+__extern int getpeername(int, struct sockaddr *, socklen_t *);
+__extern int socketpair(int, int, int, int *);
+__extern int send(int, const void *, size_t, unsigned int);
+__extern int sendto(int, const void *, size_t, int, const struct sockaddr *,
+ socklen_t);
+__extern int recv(int, void *, size_t, unsigned int);
+__extern int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *,
+ socklen_t *);
+__extern int shutdown(int, int);
+__extern int setsockopt(int, int, int, const void *, socklen_t);
+__extern int getsockopt(int, int, int, void *, socklen_t *);
+__extern int sendmsg(int, const struct msghdr *, unsigned int);
+__extern int recvmsg(int, struct msghdr *, unsigned int);
+
+#endif /* _SYS_SOCKET_H */
diff --git a/usr/include/sys/splice.h b/usr/include/sys/splice.h
new file mode 100644
index 0000000..1fa26d9
--- /dev/null
+++ b/usr/include/sys/splice.h
@@ -0,0 +1,19 @@
+/*
+ * sys/splice.h
+ */
+
+#ifndef _SYS_SPLICE_H
+#define _SYS_SPLICE_H
+
+/* move pages instead of copying */
+#define SPLICE_F_MOVE 1
+/* don't block on the pipe splicing (but we may still block on the fd
+ we splice from/to, of course */
+#define SPLICE_F_NONBLOCK 2
+/* expect more data */
+#define SPLICE_F_MORE 4
+
+__extern int splice(int, off_t *, int, off_t *, size_t, unsigned int);
+__extern int tee(int, int, size_t, unsigned int);
+
+#endif /* _SYS_SPLICE_H */
diff --git a/usr/include/sys/stat.h b/usr/include/sys/stat.h
new file mode 100644
index 0000000..861b462
--- /dev/null
+++ b/usr/include/sys/stat.h
@@ -0,0 +1,96 @@
+/*
+ * sys/stat.h
+ */
+
+#ifndef _SYS_STAT_H
+#define _SYS_STAT_H
+
+#include <klibc/extern.h>
+#include <sys/types.h>
+#include <sys/time.h> /* For struct timespec */
+#include <linux/stat.h>
+
+/* 2.6.21 kernels have once again hidden a bunch of stuff... */
+#ifndef S_IFMT
+
+#define S_IFMT 00170000
+#define S_IFSOCK 0140000
+#define S_IFLNK 0120000
+#define S_IFREG 0100000
+#define S_IFBLK 0060000
+#define S_IFDIR 0040000
+#define S_IFCHR 0020000
+#define S_IFIFO 0010000
+#define S_ISUID 0004000
+#define S_ISGID 0002000
+#define S_ISVTX 0001000
+
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
+
+#define S_IRWXU 00700
+#define S_IRUSR 00400
+#define S_IWUSR 00200
+#define S_IXUSR 00100
+
+#define S_IRWXG 00070
+#define S_IRGRP 00040
+#define S_IWGRP 00020
+#define S_IXGRP 00010
+
+#define S_IRWXO 00007
+#define S_IROTH 00004
+#define S_IWOTH 00002
+#define S_IXOTH 00001
+
+#endif
+
+#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
+#define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
+#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
+#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
+#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
+
+/* struct stat with 64-bit time, not used by kernel UAPI */
+struct stat {
+ dev_t st_dev;
+ ino_t st_ino;
+ mode_t st_mode;
+ unsigned int st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+ off_t st_size;
+ int st_blksize;
+ off_t st_blocks;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+};
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
+__extern int stat(const char *, struct stat *);
+__extern int fstat(int, struct stat *);
+__extern int fstatat(int, const char *, struct stat *, int);
+__extern int lstat(const char *, struct stat *);
+__extern int statx(int, const char *, int, unsigned int, struct statx *);
+__extern mode_t umask(mode_t);
+__extern int mknod(const char *, mode_t, dev_t);
+__extern int mknodat(int, const char *, mode_t, dev_t);
+__extern int mkfifo(const char *, mode_t);
+__extern int utimensat(int, const char *, const struct timespec *, int);
+__extern int fchmodat(int, const char *, mode_t, int);
+
+__extern_inline int mkfifo(const char *__p, mode_t __m)
+{
+ return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t) 0);
+}
+
+#endif /* _SYS_STAT_H */
diff --git a/usr/include/sys/statfs.h b/usr/include/sys/statfs.h
new file mode 100644
index 0000000..53b3b5e
--- /dev/null
+++ b/usr/include/sys/statfs.h
@@ -0,0 +1 @@
+#include <sys/vfs.h>
diff --git a/usr/include/sys/syscall.h b/usr/include/sys/syscall.h
new file mode 100644
index 0000000..8fe0142
--- /dev/null
+++ b/usr/include/sys/syscall.h
@@ -0,0 +1,13 @@
+/*
+ * sys/syscall.h
+ *
+ * Generic system call interface macros
+ */
+#ifndef _SYS_SYSCALL_H
+#define _SYS_SYSCALL_H
+
+#include <errno.h>
+#include <sys/types.h>
+#include <asm/unistd.h>
+
+#endif /* _SYS_SYSCALL_H */
diff --git a/usr/include/sys/sysconf.h b/usr/include/sys/sysconf.h
new file mode 100644
index 0000000..13ababc
--- /dev/null
+++ b/usr/include/sys/sysconf.h
@@ -0,0 +1,40 @@
+/*
+ * sys/sysconf.h
+ *
+ * sysconf() macros and demultiplex
+ * This file is included in <unistd.h>
+ *
+ * Add things here as needed, we don't really want to add things wildly.
+ * For things that require a lot of code, create an out-of-line function
+ * and put it in a .c file in the sysconf directory.
+ */
+
+#ifndef _SYS_SYSCONF_H
+#define _SYS_SYSCONF_H
+
+#ifndef _UNISTD_H
+# include <unistd.h>
+#endif
+#include <errno.h>
+
+enum sysconf {
+ _SC_PAGESIZE = 1,
+};
+
+__extern long sysconf(int);
+
+__must_inline long __sysconf_inline(int __val)
+{
+ switch (__val) {
+ case _SC_PAGESIZE:
+ return getpagesize();
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
+
+#define sysconf(x) \
+ (__builtin_constant_p(x) ? __sysconf_inline(x) : sysconf(x))
+
+#endif /* _SYS_SYSCONF_H */
diff --git a/usr/include/sys/sysinfo.h b/usr/include/sys/sysinfo.h
new file mode 100644
index 0000000..8469ba0
--- /dev/null
+++ b/usr/include/sys/sysinfo.h
@@ -0,0 +1,13 @@
+/*
+ * sys/sysinfo.h
+ */
+
+#ifndef _SYS_SYSINFO_H
+#define _SYS_SYSINFO_H
+
+#include <sys/types.h>
+#include <linux/kernel.h>
+
+extern int sysinfo(struct sysinfo *info);
+
+#endif /* _SYS_SYSINFO_H */
diff --git a/usr/include/sys/sysmacros.h b/usr/include/sys/sysmacros.h
new file mode 100644
index 0000000..efb476c
--- /dev/null
+++ b/usr/include/sys/sysmacros.h
@@ -0,0 +1,37 @@
+/*
+ * sys/sysmacros.h
+ *
+ * Constructs to create and pick apart dev_t. The double-underscore
+ * versions are macros so they can be used as constants.
+ */
+
+#ifndef _SYS_SYSMACROS_H
+#define _SYS_SYSMACROS_H
+
+#include <klibc/compiler.h>
+#include <sys/types.h>
+
+#define __major(__d) ((int)(((__d) >> 8) & 0xfffU))
+__static_inline int _major(dev_t __d)
+{
+ return __major(__d);
+}
+#define major(__d) _major(__d)
+
+#define __minor(__d) ((int)(((__d) & 0xffU)|(((__d) >> 12) & 0xfff00U)))
+__static_inline int _minor(dev_t __d)
+{
+ return __minor(__d);
+}
+#define minor(__d) _minor(__d)
+
+#define __makedev(__ma, __mi) \
+ ((dev_t)((((__ma) & 0xfffU) << 8)| \
+ ((__mi) & 0xffU)|(((__mi) & 0xfff00U) << 12)))
+__static_inline dev_t _makedev(int __ma, int __mi)
+{
+ return __makedev(__ma, __mi);
+}
+#define makedev(__ma, __mi) _makedev(__ma, __mi)
+
+#endif /* _SYS_SYSMACROS_H */
diff --git a/usr/include/sys/time.h b/usr/include/sys/time.h
new file mode 100644
index 0000000..423d3d5
--- /dev/null
+++ b/usr/include/sys/time.h
@@ -0,0 +1,117 @@
+/*
+ * sys/time.h
+ */
+
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+
+#include <klibc/extern.h>
+#include <klibc/endian.h>
+#include <stddef.h>
+#include <sys/types.h>
+
+/* struct timespec as used by current kernel UAPI (time64 on 32-bit) */
+struct timespec {
+ __kernel_time64_t tv_sec;
+#if __BYTE_ORDER == __BIG_ENDIAN && __BITS_PER_LONG == 32
+ int :32;
+#endif
+ long tv_nsec;
+#if __BYTE_ORDER == __LITTLE_ENDIAN && __BITS_PER_LONG == 32
+ int :32;
+#endif
+};
+
+/* struct timeval with 64-bit time, not used by kernel UAPI */
+struct timeval {
+ __kernel_time64_t tv_sec;
+ __kernel_suseconds_t tv_usec;
+};
+
+/* struct timeval as used by old kernel UAPI */
+struct timeval_old {
+ __kernel_time_t tv_sec;
+ __kernel_suseconds_t tv_usec;
+};
+
+struct itimerspec {
+ struct timespec it_interval;
+ struct timespec it_value;
+};
+
+struct itimerval {
+ struct timeval_old it_interval;
+ struct timeval_old it_value;
+};
+
+struct timezone {
+ int tz_minuteswest;
+ int tz_dsttime;
+};
+
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF 2
+
+#define CLOCK_REALTIME 0
+#define CLOCK_MONOTONIC 1
+#define CLOCK_PROCESS_CPUTIME_ID 2
+#define CLOCK_THREAD_CPUTIME_ID 3
+#define CLOCK_MONOTONIC_RAW 4
+#define CLOCK_REALTIME_COARSE 5
+#define CLOCK_MONOTONIC_COARSE 6
+#define CLOCK_BOOTTIME 7
+#define CLOCK_REALTIME_ALARM 8
+#define CLOCK_BOOTTIME_ALARM 9
+#define CLOCK_TAI 11
+
+#define TIMER_ABSTIME 0x01
+
+/* The 2.6.20 Linux headers always #define FD_ZERO __FD_ZERO, etc, in
+ <linux/time.h> but not all architectures define the
+ double-underscore ones, except __NFDBITS, __FD_SETSIZE and
+ __FDSET_LONGS which are defined in <linux/posix_types.h>.
+
+ Unfortunately, some architectures define the double-underscore ones
+ as inlines, so we can't use a simple #ifdef test. Thus, the only
+ safe option remaining is to #undef the top-level macros. */
+
+#undef FD_ZERO
+#undef FD_SET
+#undef FD_CLR
+#undef FD_ISSET
+#undef FD_SETSIZE
+
+__extern void *memset(void *, int, size_t);
+static inline void FD_ZERO(fd_set *__fdsetp)
+{
+ memset(__fdsetp, 0, sizeof(fd_set));
+}
+static inline void FD_SET(int __fd, fd_set *__fdsetp)
+{
+ __fdsetp->fds_bits[__fd/BITS_PER_LONG] |=
+ (1UL << (__fd % BITS_PER_LONG));
+}
+static inline void FD_CLR(int __fd, fd_set *__fdsetp)
+{
+ __fdsetp->fds_bits[__fd/BITS_PER_LONG] &=
+ ~(1UL << (__fd % BITS_PER_LONG));
+}
+static inline int FD_ISSET(int __fd, fd_set *__fdsetp)
+{
+ return (__fdsetp->fds_bits[__fd/BITS_PER_LONG] >>
+ (__fd % BITS_PER_LONG)) & 1;
+}
+
+#define FD_SETSIZE __FD_SETSIZE
+
+__extern int gettimeofday(struct timeval *, struct timezone *);
+__extern int settimeofday(const struct timeval *, const struct timezone *);
+__extern int clock_gettime(clockid_t, struct timespec *);
+__extern int clock_settime(clockid_t, const struct timespec *);
+__extern int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *);
+__extern int getitimer(int, struct itimerval *);
+__extern int setitimer(int, const struct itimerval *, struct itimerval *);
+__extern int utimes(const char *, const struct timeval[2]);
+
+#endif /* _SYS_TIME_H */
diff --git a/usr/include/sys/times.h b/usr/include/sys/times.h
new file mode 100644
index 0000000..16be69a
--- /dev/null
+++ b/usr/include/sys/times.h
@@ -0,0 +1,14 @@
+/*
+ * sys/times.h
+ */
+
+#ifndef _SYS_TIMES_H
+#define _SYS_TIMES_H
+
+#include <klibc/extern.h>
+#include <sys/types.h>
+#include <linux/times.h>
+
+__extern clock_t times(struct tms *);
+
+#endif /* _SYS_TIMES_H */
diff --git a/usr/include/sys/types.h b/usr/include/sys/types.h
new file mode 100644
index 0000000..d698ae5
--- /dev/null
+++ b/usr/include/sys/types.h
@@ -0,0 +1,108 @@
+/*
+ * sys/types.h
+ */
+
+#ifndef _SYS_TYPES_H
+#define _SYS_TYPES_H
+
+#include <klibc/compiler.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#define _SSIZE_T
+/* __SIZE_TYPE__ defined either by GCC or <stddef.h> */
+#define unsigned /* nothing, temporarily */
+typedef signed __SIZE_TYPE__ ssize_t;
+#undef unsigned
+
+#include <linux/posix_types.h>
+#include <asm/types.h>
+
+/* Keeps linux/types.h from getting included elsewhere */
+#define _LINUX_TYPES_H
+
+typedef __kernel_fd_set fd_set;
+typedef uint32_t dev_t;
+typedef __kernel_ino_t ino_t;
+typedef __kernel_mode_t mode_t;
+typedef __kernel_loff_t off_t;
+typedef __kernel_loff_t loff_t;
+typedef __kernel_pid_t pid_t;
+typedef __kernel_daddr_t daddr_t;
+typedef __kernel_key_t key_t;
+typedef __kernel_suseconds_t suseconds_t;
+/* typedef __kernel_timer_t timer_t; */
+typedef int timer_t;
+typedef __kernel_clockid_t clockid_t;
+
+typedef __kernel_uid32_t uid_t;
+typedef __kernel_gid32_t gid_t;
+
+typedef __kernel_fsid_t fsid_t;
+
+/*
+ * The following typedefs are also protected by individual ifdefs for
+ * historical reasons:
+ */
+#ifndef _TIME_T
+#define _TIME_T
+typedef __kernel_time64_t time_t;
+#endif
+
+#ifndef _CLOCK_T
+#define _CLOCK_T
+typedef __kernel_clock_t clock_t;
+#endif
+
+#ifndef _CADDR_T
+#define _CADDR_T
+typedef __kernel_caddr_t caddr_t;
+#endif
+
+/* BSD */
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+typedef unsigned long u_long;
+
+/* SysV */
+typedef unsigned char unchar;
+typedef unsigned short ushort;
+typedef unsigned int uint;
+typedef unsigned long ulong;
+
+/* More BSD */
+typedef uint8_t u_int8_t;
+typedef uint16_t u_int16_t;
+typedef uint32_t u_int32_t;
+typedef uint64_t u_int64_t;
+
+typedef __u16 __bitwise __le16;
+typedef __u16 __bitwise __be16;
+typedef __u32 __bitwise __le32;
+typedef __u32 __bitwise __be32;
+typedef __u64 __bitwise __le64;
+typedef __u64 __bitwise __be64;
+
+typedef __u16 __bitwise __sum16;
+typedef __u32 __bitwise __sum32;
+typedef __u64 __bitwise __sum64;
+typedef __u32 __bitwise __wsum;
+
+#define __aligned_u64 __u64 __attribute__((aligned(8)))
+#define __aligned_be64 __be64 __attribute__((aligned(8)))
+#define __aligned_le64 __le64 __attribute__((aligned(8)))
+
+/*
+ * Some headers seem to require this...
+ */
+#ifndef BITS_PER_LONG
+# define BITS_PER_LONG _BITSIZE
+#endif
+
+/*
+ * Some apps want this in <sys/types.h>
+ */
+#include <sys/sysmacros.h>
+
+#endif
diff --git a/usr/include/sys/uio.h b/usr/include/sys/uio.h
new file mode 100644
index 0000000..ee341fb
--- /dev/null
+++ b/usr/include/sys/uio.h
@@ -0,0 +1,15 @@
+/*
+ * sys/uio.h
+ */
+
+#ifndef _SYS_UIO_H
+#define _SYS_UIO_H
+
+#include <klibc/extern.h>
+#include <sys/types.h>
+#include <linux/uio.h>
+
+__extern int readv(int, const struct iovec *, int);
+__extern int writev(int, const struct iovec *, int);
+
+#endif /* _SYS_UIO_H */
diff --git a/usr/include/sys/un.h b/usr/include/sys/un.h
new file mode 100644
index 0000000..e599f67
--- /dev/null
+++ b/usr/include/sys/un.h
@@ -0,0 +1,11 @@
+/*
+ * <sys/un.h>
+ */
+
+#ifndef _SYS_UN_H
+#define _SYS_UN_H
+
+#include <sys/socket.h>
+#include <linux/un.h>
+
+#endif /* _SYS_UN_H */
diff --git a/usr/include/sys/utime.h b/usr/include/sys/utime.h
new file mode 100644
index 0000000..55415db
--- /dev/null
+++ b/usr/include/sys/utime.h
@@ -0,0 +1,11 @@
+/*
+ * sys/utime.h
+ */
+
+#ifndef _SYS_UTIME_H
+#define _SYS_UTIME_H
+
+#include <sys/types.h>
+#include <linux/utime.h>
+
+#endif /* _SYS_UTIME_H */
diff --git a/usr/include/sys/utsname.h b/usr/include/sys/utsname.h
new file mode 100644
index 0000000..fd55c0b
--- /dev/null
+++ b/usr/include/sys/utsname.h
@@ -0,0 +1,23 @@
+/*
+ * sys/utsname.h
+ */
+
+#ifndef _SYS_UTSNAME_H
+#define _SYS_UTSNAME_H
+
+#include <klibc/extern.h>
+
+#define SYS_NMLN 65
+
+struct utsname {
+ char sysname[SYS_NMLN];
+ char nodename[SYS_NMLN];
+ char release[SYS_NMLN];
+ char version[SYS_NMLN];
+ char machine[SYS_NMLN];
+ char domainname[SYS_NMLN];
+};
+
+__extern int uname(struct utsname *);
+
+#endif /* _SYS_UTSNAME_H */
diff --git a/usr/include/sys/vfs.h b/usr/include/sys/vfs.h
new file mode 100644
index 0000000..6fb1eab
--- /dev/null
+++ b/usr/include/sys/vfs.h
@@ -0,0 +1,132 @@
+/*
+ * sys/vfs.h
+ */
+
+#ifndef _SYS_VFS_H
+#define _SYS_VFS_H
+
+#include <stdint.h>
+#include <klibc/extern.h>
+#include <sys/types.h>
+#include <bitsize.h>
+#include <klibc/sysconfig.h>
+
+/* struct statfs64 -- there seems to be two standards -
+ one for 32 and one for 64 bits, and they're incompatible.
+ Worse, some 64-bit platforms seem to use the 32-bit layout.
+ Of course, there is no includable header that does this well. */
+
+#if _KLIBC_STATFS_F_TYPE_64
+
+struct statfs {
+ uint64_t f_type;
+ uint64_t f_bsize;
+ uint64_t f_blocks;
+ uint64_t f_bfree;
+ uint64_t f_bavail;
+ uint64_t f_files;
+ uint64_t f_ffree;
+ __kernel_fsid_t f_fsid;
+ uint64_t f_namelen;
+ uint64_t f_frsize;
+ uint64_t f_spare[5];
+};
+
+#elif _KLIBC_STATFS_F_TYPE_32B
+
+struct statfs {
+ uint32_t f_type;
+ uint32_t f_bsize;
+ uint32_t f_frsize;
+ uint32_t __pad;
+ uint64_t f_blocks;
+ uint64_t f_bfree;
+ uint64_t f_files;
+ uint64_t f_ffree;
+ uint64_t f_bavail;
+ __kernel_fsid_t f_fsid;
+ uint32_t f_namelen;
+ uint32_t f_spare[6];
+};
+
+#else /* not _KLIBC_STATFS_F_TYPE_64 */
+
+struct statfs {
+ uint32_t f_type;
+ uint32_t f_bsize;
+ uint64_t f_blocks;
+ uint64_t f_bfree;
+ uint64_t f_bavail;
+ uint64_t f_files;
+ uint64_t f_ffree;
+ __kernel_fsid_t f_fsid;
+ uint32_t f_namelen;
+ uint32_t f_frsize;
+ uint32_t f_spare[5];
+};
+
+#endif /* _KLIBC_STATFS_F_TYPE_64 */
+
+__extern int statfs(const char *, struct statfs *);
+__extern int fstatfs(int, struct statfs *);
+
+/* Various filesystem types */
+#define ADFS_SUPER_MAGIC 0xadf5
+#define AFFS_SUPER_MAGIC 0xadff
+#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */
+#define AUTOFS_SUPER_MAGIC 0x0187
+#define BFS_MAGIC 0x1BADFACE
+#define CAPIFS_SUPER_MAGIC 0x434e
+#define CIFS_MAGIC_NUMBER 0xFF534D42
+#define CODA_SUPER_MAGIC 0x73757245
+#define CRAMFS_MAGIC 0x28cd3d45
+#define DEVFS_SUPER_MAGIC 0x1373
+#define DEVPTS_SUPER_MAGIC 0x1cd1
+#define EFS_SUPER_MAGIC 0x414A53
+#define EVENTPOLLFS_MAGIC 0x03111965
+#define EXT2_SUPER_MAGIC 0xEF53
+#define EXT3_SUPER_MAGIC 0xEF53
+#define GADGETFS_MAGIC 0xaee71ee7
+#define HFSPLUS_SUPER_MAGIC 0x482b
+#define HFS_MFS_SUPER_MAGIC 0xD2D7 /* MFS MDB (super block) */
+#define HFS_SUPER_MAGIC 0x4244 /* "BD": HFS MDB (super block) */
+#define HPFS_SUPER_MAGIC 0xf995e849
+#define HUGETLBFS_MAGIC 0x958458f6
+#define HWGFS_MAGIC 0x12061983
+#define IBMASMFS_MAGIC 0x66726f67
+#define ISOFS_SUPER_MAGIC 0x9660
+#define JFFS2_SUPER_MAGIC 0x72b6
+#define JFFS_MAGIC_BITMASK 0x34383931 /* "1984" */
+#define JFFS_MAGIC_SB_BITMASK 0x07c0 /* 1984 */
+#define JFS_SUPER_MAGIC 0x3153464a /* "JFS1" */
+#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */
+#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */
+#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */
+#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */
+#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
+#define NCP_SUPER_MAGIC 0x564c
+#define NFS_SUPER_MAGIC 0x6969
+#define NFS_SUPER_MAGIC 0x6969
+#define OPENPROM_SUPER_MAGIC 0x9fa1
+#define OPROFILEFS_MAGIC 0x6f70726f
+#define PFMFS_MAGIC 0xa0b4d889
+#define PIPEFS_MAGIC 0x50495045
+#define PROC_SUPER_MAGIC 0x9fa0
+#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
+#define RAMFS_MAGIC 0x858458f6
+#define REISERFS_SUPER_MAGIC 0x52654973
+#define ROMFS_MAGIC 0x7275
+#define SMB_SUPER_MAGIC 0x517B
+#define SOCKFS_MAGIC 0x534F434B
+#define SYSFS_MAGIC 0x62656572
+#define TMPFS_MAGIC 0x01021994
+#define UDF_SUPER_MAGIC 0x15013346
+#define UFS_MAGIC 0x00011954
+#define UFS_MAGIC_4GB 0x05231994 /* fs > 4 GB && fs_featurebits */
+#define UFS_MAGIC_FEA 0x00195612 /* fs_featurebits supported */
+#define UFS_MAGIC_LFN 0x00095014 /* fs supports filenames > 14 chars */
+#define UFS_MAGIC_SEC 0x00612195 /* B1 security fs */
+#define USBDEVICE_SUPER_MAGIC 0x9fa2
+#define VXFS_SUPER_MAGIC 0xa501FCF5
+
+#endif /* _SYS_VFS_H */
diff --git a/usr/include/sys/wait.h b/usr/include/sys/wait.h
new file mode 100644
index 0000000..0f5efaf
--- /dev/null
+++ b/usr/include/sys/wait.h
@@ -0,0 +1,28 @@
+/*
+ * sys/wait.h
+ */
+
+#ifndef _SYS_WAIT_H
+#define _SYS_WAIT_H
+
+#include <klibc/extern.h>
+#include <sys/types.h>
+#include <sys/resource.h>
+
+#include <linux/wait.h>
+
+#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
+#define WTERMSIG(s) ((s) & 0x7f)
+#define WIFEXITED(s) (WTERMSIG(s) == 0)
+#define WIFSTOPPED(s) (WTERMSIG(s) == 0x7f)
+/* Ugly hack to avoid multiple evaluation of "s" */
+#define WIFSIGNALED(s) (WTERMSIG((s)+1) >= 2)
+#define WCOREDUMP(s) ((s) & 0x80)
+#define WSTOPSIG(s) WEXITSTATUS(s)
+
+__extern pid_t wait(int *);
+__extern pid_t waitpid(pid_t, int *, int);
+__extern pid_t wait3(int *, int, struct rusage *);
+__extern pid_t wait4(pid_t, int *, int, struct rusage *);
+
+#endif /* _SYS_WAIT_H */