summaryrefslogtreecommitdiff
path: root/include/sys
diff options
context:
space:
mode:
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/bitypes.h94
-rw-r--r--include/sys/cdefs.h36
-rw-r--r--include/sys/dir.h17
-rw-r--r--include/sys/errno.h1
-rw-r--r--include/sys/fcntl.h1
-rw-r--r--include/sys/file.h35
-rw-r--r--include/sys/ioctl.h17
-rw-r--r--include/sys/mman.h35
-rw-r--r--include/sys/mount.h17
-rw-r--r--include/sys/param.h46
-rw-r--r--include/sys/resource.h73
-rw-r--r--include/sys/signal.h1
-rw-r--r--include/sys/socket.h135
-rw-r--r--include/sys/socketcall.h22
-rw-r--r--include/sys/socketio.h1
-rw-r--r--include/sys/socketvar.h8
-rw-r--r--include/sys/stat.h192
-rw-r--r--include/sys/syscall.h182
-rw-r--r--include/sys/syslog.h200
-rw-r--r--include/sys/termios.h4
-rw-r--r--include/sys/time.h81
-rw-r--r--include/sys/times.h21
-rw-r--r--include/sys/types.h4
-rw-r--r--include/sys/uio.h65
-rw-r--r--include/sys/un.h1
-rw-r--r--include/sys/utsname.h18
-rw-r--r--include/sys/vfs.h17
-rw-r--r--include/sys/vm86.h125
-rw-r--r--include/sys/wait.h146
29 files changed, 1595 insertions, 0 deletions
diff --git a/include/sys/bitypes.h b/include/sys/bitypes.h
new file mode 100644
index 000000000..e2ac0ab45
--- /dev/null
+++ b/include/sys/bitypes.h
@@ -0,0 +1,94 @@
+/*
+ * bitypes.h,v 1.4 1995/08/24 01:58:54 hjl Exp
+ */
+
+/*
+ * ++Copyright++ 1993
+ * -
+ * Copyright (c) 1993 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * --Copyright--
+ */
+
+/*
+#ifdef __USE_BSD
+*/
+
+/*
+#ifndef __BIT_TYPES_DEFINED__
+# if (defined(BSD) && (BSD >= 199306)) || \
+ (defined(_BSDI_VERSION) && (_BSDI_VERSION >= 199312))
+# define __BIT_TYPES_DEFINED__
+# endif
+#endif
+*/
+
+#ifndef __BIT_TYPES_DEFINED__
+#define __BIT_TYPES_DEFINED__
+
+ /*
+ * Basic integral types. Omit the typedef if
+ * not possible for a machine/compiler combination.
+ */
+ typedef /*signed*/ char int8_t;
+ typedef unsigned char u_int8_t;
+ typedef short int16_t;
+ typedef unsigned short u_int16_t;
+ typedef int int32_t;
+ typedef unsigned int u_int32_t;
+
+# if __GNUC__ >= 2 && !defined(__STRICT_ANSI__)
+ typedef long long int64_t;
+ typedef unsigned long long u_int64_t;
+# endif
+
+#endif /* __BIT_TYPES_DEFINED__ */
+
+/* #endif __USE_BSD */
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
new file mode 100644
index 000000000..0afc8830f
--- /dev/null
+++ b/include/sys/cdefs.h
@@ -0,0 +1,36 @@
+
+#ifndef __SYS_CDEFS_H
+#define __SYS_CDEFS_H
+#include <features.h>
+
+#if defined (__STDC__) && __STDC__
+
+#define __CONCAT(x,y) x ## y
+#define __STRING(x) #x
+
+/* This is not a typedef so `const __ptr_t' does the right thing. */
+#define __ptr_t void *
+typedef long double __long_double_t;
+
+#else
+
+#define __CONCAT(x,y) x/**/y
+#define __STRING(x) "x"
+
+#define __ptr_t char *
+
+#ifndef __HAS_NO_FLOATS__
+typedef double __long_double_t;
+#endif
+
+#endif
+
+/* No C++ */
+#define __BEGIN_DECLS
+#define __END_DECLS
+
+/* GNUish things */
+#define __CONSTVALUE
+#define __CONSTVALUE2
+
+#endif
diff --git a/include/sys/dir.h b/include/sys/dir.h
new file mode 100644
index 000000000..1c2cea7df
--- /dev/null
+++ b/include/sys/dir.h
@@ -0,0 +1,17 @@
+#ifdef _SYS_DIRENT_H
+#error "Can't include both sys/dir.h and sys/dirent.h"
+#define _SYS_DIR_H
+#endif
+
+#ifndef _SYS_DIR_H
+#define _SYS_DIR_H
+
+#include <dirent.h>
+
+#define direct dirent
+
+#undef DIRSIZ
+#define DIRSIZ(dp) ((sizeof (struct direct) - (MAXNAMLEN+1)) + \
+ (((dp)->d_namlen+1 + 3) &~ 3))
+
+#endif
diff --git a/include/sys/errno.h b/include/sys/errno.h
new file mode 100644
index 000000000..339f4fc10
--- /dev/null
+++ b/include/sys/errno.h
@@ -0,0 +1 @@
+#include <errno.h>
diff --git a/include/sys/fcntl.h b/include/sys/fcntl.h
new file mode 100644
index 000000000..cd304557e
--- /dev/null
+++ b/include/sys/fcntl.h
@@ -0,0 +1 @@
+#include <fcntl.h>
diff --git a/include/sys/file.h b/include/sys/file.h
new file mode 100644
index 000000000..2401b155a
--- /dev/null
+++ b/include/sys/file.h
@@ -0,0 +1,35 @@
+#ifndef _SYS_FILE_H
+#define _SYS_FILE_H
+
+#include <features.h>
+#include <fcntl.h>
+
+#ifndef L_SET
+
+#define L_SET 0 /* absolute offset */
+#define L_INCR 1 /* relative to current offset */
+#define L_XTND 2 /* relative to end of file */
+
+#endif
+
+#ifndef LOCK_SH
+
+/* Operations for the `flock' call. */
+#define LOCK_SH 1 /* Shared lock. */
+#define LOCK_EX 2 /* Exclusive lock. */
+#define LOCK_UN 8 /* Unlock. */
+
+/* Can be OR'd in to one of the above. */
+#define LOCK_NB 4 /* Don't block when locking. */
+
+#endif
+
+__BEGIN_DECLS
+
+/* Apply or remove an advisory lock, according to OPERATION,
+ on the file FD refers to. */
+extern int flock __P ((int __fd, int __operation));
+
+__END_DECLS
+
+#endif
diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h
new file mode 100644
index 000000000..11dd06edb
--- /dev/null
+++ b/include/sys/ioctl.h
@@ -0,0 +1,17 @@
+#ifndef _SYS_IOCTL_H
+#define _SYS_IOCTL_H
+
+#include <linux/ioctl.h>
+#include <features.h>
+#include <termios.h>
+#include <sys/socketio.h>
+
+__BEGIN_DECLS
+
+extern int ioctl __P ((int __fildes, int __cmd, ...));
+extern int __ioctl __P ((int __fildes, int __cmd, ...));
+
+__END_DECLS
+
+
+#endif
diff --git a/include/sys/mman.h b/include/sys/mman.h
new file mode 100644
index 000000000..8dc79d909
--- /dev/null
+++ b/include/sys/mman.h
@@ -0,0 +1,35 @@
+#ifndef _SYS_MMAN_H
+#define _SYS_MMAN_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <linux/mman.h>
+
+#ifndef MAP_ANON
+#define MAP_ANON MAP_ANONYMOUS /* idem */
+#endif
+#ifndef MAP_FILE
+#define MAP_FILE 0x00 /* The 'normal' way: mapped from file */
+#endif
+
+__BEGIN_DECLS
+
+extern __ptr_t mmap __P((__ptr_t __addr, size_t __len,
+ int __prot, int __flags, int __fd, off_t __off));
+extern int munmap __P((__ptr_t __addr, size_t __len));
+extern int mprotect __P ((__const __ptr_t __addr, size_t __len, int __prot));
+
+extern int msync __P((__ptr_t __addr, size_t __len, int __flags));
+
+extern int mlock __P((__const __ptr_t __addr, size_t __len));
+extern int munlock __P((__const __ptr_t __addr, size_t __len));
+
+extern int mlockall __P((int __flags));
+extern int munlockall __P((void));
+
+extern __ptr_t mremap __P((__ptr_t __addr, size_t __old_len,
+ size_t __new_len, int __may_move));
+
+__END_DECLS
+
+#endif /* _SYS_MMAN_H */
diff --git a/include/sys/mount.h b/include/sys/mount.h
new file mode 100644
index 000000000..a0765e2ee
--- /dev/null
+++ b/include/sys/mount.h
@@ -0,0 +1,17 @@
+#ifndef _SYS_MOUNT_H
+#define _SYS_MOUNT_H
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+extern int mount __P ((__const char* __specialfile,
+ __const char* __dir,__const char* __filesystemype,
+ unsigned long __rwflag,__const void *__data));
+
+extern int umount __P ((__const char* __specialfile));
+
+
+__END_DECLS
+
+#endif
diff --git a/include/sys/param.h b/include/sys/param.h
new file mode 100644
index 000000000..906a0a230
--- /dev/null
+++ b/include/sys/param.h
@@ -0,0 +1,46 @@
+/* Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk>
+ * This file is part of the Linux-8086 C library and is distributed
+ * under the GNU Library General Public License.
+ */
+
+#ifndef _PARAM_H
+#define _PARAM_H
+
+#include <features.h>
+#include <limits.h>
+#include <linux/limits.h>
+#include <linux/param.h>
+
+#include <sys/types.h>
+
+#define MAXPATHLEN PATH_MAX
+
+#ifndef NR_OPEN
+#define NR_OPEN 32
+#endif
+#ifndef NR_FILE
+#define NR_FILE 32
+#endif
+
+/* Bit map related macros. */
+#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
+#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
+#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
+#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
+
+/* Macros for counting and rounding. */
+#ifndef howmany
+#define howmany(x, y) (((x)+((y)-1))/(y))
+#endif
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+#define powerof2(x) ((((x)-1)&(x))==0)
+
+/* Macros for min/max. */
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#define MAX(a,b) (((a)>(b))?(a):(b))
+
+
+/* Unit of `st_blocks'. */
+#define DEV_BSIZE 512
+
+#endif /* _PARAM_H */
diff --git a/include/sys/resource.h b/include/sys/resource.h
new file mode 100644
index 000000000..19ed06f50
--- /dev/null
+++ b/include/sys/resource.h
@@ -0,0 +1,73 @@
+/*
+ * Resource control/accounting header file for linux-86
+ */
+
+#ifndef _SYS_RESOURCE_H
+#define _SYS_RESOURCE_H
+
+#include <features.h>
+#include <sys/time.h>
+#include <limits.h>
+
+#define RUSAGE_SELF 0
+#define RUSAGE_CHILDREN (-1)
+#define RUSAGE_BOTH (-2) /* sys_wait4() uses this */
+
+struct rusage {
+ struct timeval ru_utime; /* user time used */
+ struct timeval ru_stime; /* system time used */
+ long ru_maxrss; /* maximum resident set size */
+ long ru_ixrss; /* integral shared memory size */
+ long ru_idrss; /* integral unshared data size */
+ long ru_isrss; /* integral unshared stack size */
+ long ru_minflt; /* page reclaims */
+ long ru_majflt; /* page faults */
+ long ru_nswap; /* swaps */
+ long ru_inblock; /* block input operations */
+ long ru_oublock; /* block output operations */
+ long ru_msgsnd; /* messages sent */
+ long ru_msgrcv; /* messages received */
+ long ru_nsignals; /* signals received */
+ long ru_nvcsw; /* voluntary context switches */
+ long ru_nivcsw; /* involuntary " */
+};
+
+#define RLIM_INFINITY ((long)(~0UL>>1))
+
+struct rlimit {
+ long rlim_cur;
+ long rlim_max;
+};
+
+#define PRIO_MIN (-20)
+#define PRIO_MAX 20
+
+#define PRIO_PROCESS 0
+#define PRIO_PGRP 1
+#define PRIO_USER 2
+
+#define RLIMIT_CPU 0 /* CPU time in ms */
+#define RLIMIT_FSIZE 1 /* Maximum filesize */
+#define RLIMIT_DATA 2 /* max data size */
+#define RLIMIT_STACK 3 /* max stack size */
+#define RLIMIT_CORE 4 /* max core file size */
+#define RLIMIT_RSS 5 /* max resident set size */
+#define RLIMIT_NPROC 6 /* max number of processes */
+#define RLIMIT_NOFILE 7 /* max number of open files */
+#define RLIMIT_MEMLOCK 8 /* max locked-in-memory address space */
+
+#define RLIM_NLIMITS 9
+
+extern int getrlimit __P ((int __resource,
+ struct rlimit *__rlp));
+extern int setrlimit __P ((int __resource,
+ __const struct rlimit *__rlp));
+
+extern int getpriority __P((int __which, int __who));
+extern int setpriority __P((int __which, int __who,
+ int __prio));
+
+extern int __getrusage __P ((int __who, struct rusage *__rusage));
+extern int getrusage __P ((int __who, struct rusage *__rusage));
+
+#endif /* _SYS_RESOURCE_H */
diff --git a/include/sys/signal.h b/include/sys/signal.h
new file mode 100644
index 000000000..2e602dad8
--- /dev/null
+++ b/include/sys/signal.h
@@ -0,0 +1 @@
+#include <signal.h>
diff --git a/include/sys/socket.h b/include/sys/socket.h
new file mode 100644
index 000000000..5dcef2d1b
--- /dev/null
+++ b/include/sys/socket.h
@@ -0,0 +1,135 @@
+#ifndef _SYS_SOCKET_H
+#define _SYS_SOCKET_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <linux/socket.h>
+
+#ifdef _MIT_POSIX_THREADS
+#include <pthread/mit/posix.h>
+#endif
+
+__BEGIN_DECLS
+
+/* struct msghdr is not defined in linux 1.2. This will allow sendmsg
+ and recvmsg in libc 5.2.9 to compile under 1.2.x and shouldn't cause
+ any problem for 1.3.x */
+struct msghdr;
+
+/* Create a new socket of type TYPE in domain DOMAIN, using
+ protocol PROTOCOL. If PROTOCOL is zero, one is chosen
+ automatically. Returns a file descriptor for the new socket,
+ or -1 for errors. */
+int socket __P ((int __family, int __type, int __protocol));
+
+/* Create two new sockets, of type TYPE in domain DOMAIN and using
+ protocol PROTOCOL, which are connected to each other, and put file
+ descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
+ one will be chosen automatically. Returns 0 on success, -1
+ for errors. */
+int socketpair __P ((int __family, int __type, int __protocol,
+ int __sockvec[2]));
+
+/* Give the socket FD the local address ADDR (which is LEN bytes
+ long). */
+int bind __P ((int __sockfd, __const struct sockaddr *__my_addr,
+ int __addrlen));
+
+/* Open a connection on socket FD to peer at ADDR (which LEN bytes
+ long). For connectionless socket types, just set the default
+ address to send to and the only address from which to accept
+ transmissions. Return 0 on success, -1 for errors. */
+int connect __P ((int __sockfd, __const struct sockaddr *__serv_addr,
+ int __addrlen));
+
+/* Prepare to accept connections on socket FD.
+ N connection requests will be queued before further requests are
+ refused. Returns 0 on success, -1 for errors. */
+int listen __P ((int __sockfd, int __n));
+
+/* Await a connection on socket FD.
+ When a connection arrives, open a new socket to communicate with it,
+ set *ADDR (which is *ADDR_LEN bytes long) to the address of the
+ connecting peer and *ADDR_LEN to the address's actual length, and
+ return the new socket's descriptor, or -1 for errors. */
+int accept __P ((int __sockfd, __const struct sockaddr *__peer,
+ int *__paddrlen));
+
+/* Put the current value for socket FD's option OPTNAME at protocol
+ level LEVEL into OPTVAL (which is *OPTLEN bytes long), and set
+ *OPTLEN to the value's actual length. Returns 0 on success, -1 for
+ errors. */
+int getsockopt __P ((int __s, int __level, int __optname,
+ void *__optval, int *__optlen));
+
+/* Set socket FD's option OPTNAME at protocol level LEVEL
+ to *OPTVAL (which is OPTLEN bytes long).
+ Returns 0 on success, -1 for errors. */
+int setsockopt __P ((int __s, int __level, int __optname,
+ __const void *__optval, int optlen));
+
+/* Put the local address of FD into *ADDR and its length in *LEN. */
+int getsockname __P ((int __sockfd, struct sockaddr *__addr,
+ int *__paddrlen));
+
+/* Put the address of the peer connected to socket FD into *ADDR
+ (which is *LEN bytes long), and its actual length into *LEN. */
+int getpeername __P ((int __sockfd, struct sockaddr *__peer,
+ int *__paddrlen));
+
+/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
+int send __P ((int __sockfd, __const void *__buff, size_t __len,
+ unsigned int __flags));
+
+/* Read N bytes into BUF from socket FD.
+ Returns the number read or -1 for errors. */
+int recv __P ((int __sockfd, void *__buff, size_t __len,
+ unsigned int __flags));
+
+/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
+ ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
+int sendto __P ((int __sockfd, __const void *__buff, size_t __len,
+ unsigned int __flags, __const struct sockaddr *__to,
+ int __tolen));
+
+/* Read N bytes into BUF through socket FD.
+ If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address
+ of the sender, and store the actual size of the address in
+ *ADDR_LEN. Returns the number of bytes read or -1 for errors. */
+int recvfrom __P ((int __sockfd, void *__buff, size_t __len,
+ unsigned int __flags, struct sockaddr *__from,
+ int *__fromlen));
+
+/* Send a message described MESSAGE on socket FD.
+ Returns the number of bytes sent, or -1 for errors. */
+extern int sendmsg __P ((int __fd, __const struct msghdr *__message,
+ unsigned int __flags));
+
+/* Receive a message as described by MESSAGE from socket FD.
+ Returns the number of bytes read or -1 for errors. */
+extern int recvmsg __P ((int __fd, struct msghdr *__message,
+ unsigned int __flags));
+
+/* Shut down all or part of the connection open on socket FD.
+ HOW determines what to shut down:
+ 0 = No more receptions;
+ 1 = No more transmissions;
+ 2 = No more receptions or transmissions.
+ Returns 0 on success, -1 for errors. */
+int shutdown __P ((int __sockfd, int __how));
+
+
+/* belongs here or elsewhere? */
+int rcmd __P ((char **__ahost, unsigned short __inport,
+ __const char *__locuser, __const char *__remuser,
+ __const char *__cmd, int *__fd2p));
+int rresvport __P ((int *__port));
+int ruserok __P ((__const char *__rhost, int __superuser,
+ __const char *__ruser, __const char *__luser));
+int rexec __P ((char **__ahost, int __inport, __const char *__user,
+ __const char *__passwd, __const char *__cmd,
+ int *__fd2p));
+
+__END_DECLS
+
+#endif /* _SYS_SOCKET_H */
diff --git a/include/sys/socketcall.h b/include/sys/socketcall.h
new file mode 100644
index 000000000..52e958395
--- /dev/null
+++ b/include/sys/socketcall.h
@@ -0,0 +1,22 @@
+#ifndef _SYS_SOCKETCALL_H
+#define _SYS_SOCKETCALL_H
+
+#define SYS_SOCKET 1
+#define SYS_BIND 2
+#define SYS_CONNECT 3
+#define SYS_LISTEN 4
+#define SYS_ACCEPT 5
+#define SYS_GETSOCKNAME 6
+#define SYS_GETPEERNAME 7
+#define SYS_SOCKETPAIR 8
+#define SYS_SEND 9
+#define SYS_RECV 10
+#define SYS_SENDTO 11
+#define SYS_RECVFROM 12
+#define SYS_SHUTDOWN 13
+#define SYS_SETSOCKOPT 14
+#define SYS_GETSOCKOPT 15
+#define SYS_SENDMSG 16
+#define SYS_RECVMSG 17
+
+#endif _SYS_SOCKETCALL_H
diff --git a/include/sys/socketio.h b/include/sys/socketio.h
new file mode 100644
index 000000000..332bcf0dc
--- /dev/null
+++ b/include/sys/socketio.h
@@ -0,0 +1 @@
+#include <linux/sockios.h>
diff --git a/include/sys/socketvar.h b/include/sys/socketvar.h
new file mode 100644
index 000000000..283356534
--- /dev/null
+++ b/include/sys/socketvar.h
@@ -0,0 +1,8 @@
+/*
+ * This seems the best way to handle this. sys/socket.h already has
+ * all the right bits in it. In fact there isn't a single useful thing
+ * in the BSD net-2 sys/socketvar.h anyway but people persist in including
+ * it...
+ * Alan
+ */
+#include <sys/socket.h>
diff --git a/include/sys/stat.h b/include/sys/stat.h
new file mode 100644
index 000000000..e486d755c
--- /dev/null
+++ b/include/sys/stat.h
@@ -0,0 +1,192 @@
+#ifndef _SYS_STAT_H
+#define _SYS_STAT_H
+
+#include <features.h>
+#include <sys/types.h>
+#undef __NOT_KERNEL
+#define __NOT_KERNEL
+#include <linux/stat.h>
+#undef __NOT_KERNEL
+
+#ifdef __SVR4_I386_ABI_L1__
+#include <sys/time.h> /* For timestruc_t */
+#endif /* __SVR4_I386_ABI_L1__ */
+
+__BEGIN_DECLS
+
+struct stat {
+ dev_t st_dev;
+
+#ifdef __SVR4_I386_ABI_L1__
+ long st_pad1[3];
+#else
+ unsigned short __pad1;
+#endif
+
+ ino_t st_ino;
+ umode_t st_mode;
+ nlink_t st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ dev_t st_rdev;
+
+#ifdef __SVR4_I386_ABI_L1__
+ long st_pad2[2];
+#else
+ unsigned short __pad2;
+#endif
+
+ off_t st_size;
+
+#ifdef __SVR4_I386_ABI_L1__
+ timestruc_t st_atim;
+ timestruc_t st_mtim;
+ timestruc_t st_ctim;
+ long st_blksize;
+ long st_blocks;
+
+#define FSTYPSZ 16
+
+ char st_fstype[FSTYPSZ];
+ long st_pad4[8];
+
+#define st_atime st_atim.tv_sec
+#define st_mtime st_mtim.tv_sec
+#define st_ctime st_ctim.tv_sec
+
+#else /*! __SVR4_I386_ABI_L1__*/
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ time_t st_atime;
+ unsigned long __unused1;
+ time_t st_mtime;
+ unsigned long __unused2;
+ time_t st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+#endif /*! __SVR4_I386_ABI_L1__*/
+};
+
+
+#define LINUX_MKNOD_VERSION 1 /* SVr4 */
+#define LINUX_STAT_VERSION 1 /* SVr4 */
+
+extern int _fxstat __P ((int __ver, int __fildes,
+ struct stat *__stat_buf));
+
+extern int _xstat __P ((int __ver, __const char *__filename,
+ struct stat *__stat_buf));
+
+extern int _lxstat __P ((int __ver, __const char *__filename,
+ struct stat *__stat_buf));
+
+#ifdef _MIT_POSIX_THREADS
+extern int __machdep_sys__fxstat __P ((int __ver, int __fd,
+ struct stat *__stat_buf));
+#endif
+
+extern int _xmknod __P ((int __ver, __const char *__path,
+ mode_t __mode, dev_t *__dev));
+
+/* Some synonyms used historically in the kernel and elsewhere */
+#define S_IREAD S_IRUSR /* read permission, owner */
+#define S_IWRITE S_IWUSR /* write permission, owner */
+#define S_IEXEC S_IXUSR /* execute/search permission, owner */
+
+extern int __chmod __P ((__const char *__path, mode_t __mode));
+extern int chmod __P ((__const char *__path, mode_t __mode));
+
+extern int __fchmod __P ((int __fildes, mode_t __mode));
+extern int fchmod __P ((int __fildes, mode_t __mode));
+
+extern int __mkdir __P ((__const char *__path, mode_t __mode));
+extern int mkdir __P ((__const char *__path, mode_t __mode));
+
+extern int mkfifo __P ((__const char *__path, mode_t __mode));
+
+#if 1
+
+extern int __fstat __P ((int __fildes, struct stat *__stat_buf));
+extern int fstat __P ((int __fildes, struct stat *__stat_buf));
+
+extern int __stat __P ((__const char *__filename,
+ struct stat *__stat_buf));
+extern int stat __P ((__const char *__filename,
+ struct stat *__stat_buf));
+
+extern int __lstat __P ((__const char *__filename,
+ struct stat *__stat_buf));
+extern int lstat __P ((__const char *__filename,
+ struct stat *__stat_buf));
+
+extern int __mknod __P ((__const char *__path, mode_t __mode,
+ dev_t __dev));
+extern int mknod __P ((__const char *__path, mode_t __mode,
+ dev_t __dev));
+#endif /* #if 0 */
+
+extern mode_t __umask __P ((mode_t __mask));
+extern mode_t umask __P ((mode_t __mask));
+
+__END_DECLS
+
+#if 0
+
+static __inline__ int __stat(__const char * __path, struct stat * __statbuf)
+{
+ return _xstat(LINUX_STAT_VERSION, __path, __statbuf);
+}
+
+static __inline__ int stat(__const char * __path, struct stat * __statbuf)
+{
+ return _xstat(LINUX_STAT_VERSION, __path, __statbuf);
+}
+
+static __inline__ int __lstat(__const char * __path, struct stat * __statbuf)
+{
+ return _lxstat(LINUX_STAT_VERSION, __path, __statbuf);
+}
+
+static __inline__ int lstat(__const char * __path, struct stat * __statbuf)
+{
+ return _lxstat(LINUX_STAT_VERSION, __path, __statbuf);
+}
+
+static __inline__ int __fstat(int __fd, struct stat * __statbuf)
+{
+ return _fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
+}
+
+static __inline__ int fstat(int __fd, struct stat * __statbuf)
+{
+ return _fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
+}
+
+static __inline__ int __mknod(__const char * __path, mode_t __mode, dev_t __dev)
+{
+ return _xmknod(LINUX_MKNOD_VERSION, __path, __mode, &__dev);
+}
+
+static __inline__ int mknod(__const char * __path, mode_t __mode, dev_t __dev)
+{
+ return _xmknod(LINUX_MKNOD_VERSION, __path, __mode, &__dev);
+}
+
+#ifdef _MIT_POSIX_THREADS
+
+static __inline__ int __machdep_sys_fstat(int __fd, struct stat * __statbuf)
+{
+ return __machdep_sys__fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
+}
+
+static __inline__ int machdep_sys_fstat(int __fd, struct stat * __statbuf)
+{
+ return __machdep_sys__fxstat(LINUX_STAT_VERSION, __fd, __statbuf);
+}
+
+#endif
+
+#endif
+
+#endif
diff --git a/include/sys/syscall.h b/include/sys/syscall.h
new file mode 100644
index 000000000..f4ca99f18
--- /dev/null
+++ b/include/sys/syscall.h
@@ -0,0 +1,182 @@
+#ifndef _SYS_SYSCALL_H
+#define _SYS_SYSCALL_H
+
+#define SYS_setup 0 /* Used only by init, to get system going. */
+#define SYS_exit 1
+#define SYS_fork 2
+#define SYS_read 3
+#define SYS_write 4
+#define SYS_open 5
+#define SYS_close 6
+#define SYS_waitpid 7
+#define SYS_creat 8
+#define SYS_link 9
+#define SYS_unlink 10
+#define SYS_execve 11
+#define SYS_chdir 12
+#define SYS_time 13
+#define SYS_mknod 14
+#define SYS_prev_mknod 14
+#define SYS_chmod 15
+#define SYS_chown 16
+#define SYS_break 17
+#define SYS_oldstat 18
+#define SYS_lseek 19
+#define SYS_getpid 20
+#define SYS_mount 21
+#define SYS_umount 22
+#define SYS_setuid 23
+#define SYS_getuid 24
+#define SYS_stime 25
+#define SYS_ptrace 26
+#define SYS_alarm 27
+#define SYS_oldfstat 28
+#define SYS_pause 29
+#define SYS_utime 30
+#define SYS_stty 31
+#define SYS_gtty 32
+#define SYS_access 33
+#define SYS_nice 34
+#define SYS_ftime 35
+#define SYS_sync 36
+#define SYS_kill 37
+#define SYS_rename 38
+#define SYS_mkdir 39
+#define SYS_rmdir 40
+#define SYS_dup 41
+#define SYS_pipe 42
+#define SYS_times 43
+#define SYS_prof 44
+#define SYS_brk 45
+#define SYS_setgid 46
+#define SYS_getgid 47
+#define SYS_signal 48
+#define SYS_geteuid 49
+#define SYS_getegid 50
+#define SYS_acct 51
+#define SYS_phys 52
+#define SYS_lock 53
+#define SYS_ioctl 54
+#define SYS_fcntl 55
+#define SYS_mpx 56
+#define SYS_setpgid 57
+#define SYS_ulimit 58
+#define SYS_oldolduname 59
+#define SYS_umask 60
+#define SYS_chroot 61
+#define SYS_prev_ustat 62
+#define SYS_dup2 63
+#define SYS_getppid 64
+#define SYS_getpgrp 65
+#define SYS_setsid 66
+#define SYS_sigaction 67
+#define SYS_siggetmask 68
+#define SYS_sigsetmask 69
+#define SYS_setreuid 70
+#define SYS_setregid 71
+#define SYS_sigsuspend 72
+#define SYS_sigpending 73
+#define SYS_sethostname 74
+#define SYS_setrlimit 75
+#define SYS_getrlimit 76
+#define SYS_getrusage 77
+#define SYS_gettimeofday 78
+#define SYS_settimeofday 79
+#define SYS_getgroups 80
+#define SYS_setgroups 81
+#define SYS_select 82
+#define SYS_symlink 83
+#define SYS_oldlstat 84
+#define SYS_readlink 85
+#define SYS_uselib 86
+#define SYS_swapon 87
+#define SYS_reboot 88
+#define SYS_readdir 89
+#define SYS_mmap 90
+#define SYS_munmap 91
+#define SYS_truncate 92
+#define SYS_ftruncate 93
+#define SYS_fchmod 94
+#define SYS_fchown 95
+#define SYS_getpriority 96
+#define SYS_setpriority 97
+#define SYS_profil 98
+#define SYS_statfs 99
+#define SYS_fstatfs 100
+#define SYS_ioperm 101
+#define SYS_socketcall 102
+#define SYS_klog 103
+#define SYS_setitimer 104
+#define SYS_getitimer 105
+#define SYS_prev_stat 106
+#define SYS_prev_lstat 107
+#define SYS_prev_fstat 108
+#define SYS_stat 106
+#define SYS_lstat 107
+#define SYS_fstat 108
+#define SYS_olduname 109
+#define SYS_iopl 110
+#define SYS_vhangup 111
+#define SYS_idle 112
+#define SYS_vm86old 113
+#define SYS_wait4 114
+#define SYS_swapoff 115
+#define SYS_sysinfo 116
+#define SYS_ipc 117
+#define SYS_fsync 118
+#define SYS_sigreturn 119
+#define SYS_clone 120
+#define SYS_setdomainname 121
+#define SYS_uname 122
+#define SYS_modify_ldt 123
+#define SYS_adjtimex 124
+#define SYS_mprotect 125
+#define SYS_sigprocmask 126
+#define SYS_create_module 127
+#define SYS_init_module 128
+#define SYS_delete_module 129
+#define SYS_get_kernel_syms 130
+#define SYS_quotactl 131
+#define SYS_getpgid 132
+#define SYS_fchdir 133
+#define SYS_bdflush 134
+#define SYS_sysfs 135
+#define SYS_personality 136
+#define SYS_afs_syscall 137 /* Syscall for Andrew File System */
+#define SYS_setfsuid 138
+#define SYS_setfsgid 139
+#define SYS__llseek 140
+#define SYS_getdents 141
+#define SYS__newselect 142
+#define SYS_flock 143
+#define SYS_syscall_flock SYS_flock
+#define SYS_msync 144
+#define SYS_readv 145
+#define SYS_syscall_readv SYS_readv
+#define SYS_writev 146
+#define SYS_syscall_writev SYS_writev
+#define SYS_getsid 147
+#define SYS_fdatasync 148
+#define SYS__sysctl 149
+#define SYS_mlock 150
+#define SYS_munlock 151
+#define SYS_mlockall 152
+#define SYS_munlockall 153
+#define SYS_sched_setparam 154
+#define SYS_sched_getparam 155
+#define SYS_sched_setscheduler 156
+#define SYS_sched_getscheduler 157
+#define SYS_sched_yield 158
+#define SYS_sched_get_priority_max 159
+#define SYS_sched_get_priority_min 160
+#define SYS_sched_rr_get_interval 161
+#define SYS_nanosleep 162
+#define SYS_mremap 163
+#define SYS_setresuid 164
+#define SYS_getresuid 165
+#define SYS_vm86 166
+#define SYS_query_module 167
+#define SYS_poll 168
+#define SYS_syscall_poll SYS_poll
+
+#endif /* <sys/syscall.h> */
diff --git a/include/sys/syslog.h b/include/sys/syslog.h
new file mode 100644
index 000000000..38d74a03b
--- /dev/null
+++ b/include/sys/syslog.h
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)syslog.h 7.20 (Berkeley) 2/23/91
+ */
+
+#ifndef _SYS_LOG_H
+#define _SYS_LOG_H
+
+#include <features.h>
+
+#define _PATH_LOG "/dev/log"
+
+/*
+ * priorities/facilities are encoded into a single 32-bit quantity, where the
+ * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
+ * (0-big number). Both the priorities and the facilities map roughly
+ * one-to-one to strings in the syslogd(8) source code. This mapping is
+ * included in this file.
+ *
+ * priorities (these are ordered)
+ */
+#define LOG_EMERG 0 /* system is unusable */
+#define LOG_ALERT 1 /* action must be taken immediately */
+#define LOG_CRIT 2 /* critical conditions */
+#define LOG_ERR 3 /* error conditions */
+#define LOG_WARNING 4 /* warning conditions */
+#define LOG_NOTICE 5 /* normal but significant condition */
+#define LOG_INFO 6 /* informational */
+#define LOG_DEBUG 7 /* debug-level messages */
+
+#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */
+ /* extract priority */
+#define LOG_PRI(p) ((p) & LOG_PRIMASK)
+#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri))
+
+#ifdef SYSLOG_NAMES
+#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */
+ /* mark "facility" */
+#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0)
+typedef struct _code {
+ char *c_name;
+ int c_val;
+} CODE;
+
+CODE prioritynames[] = {
+ { "alert", LOG_ALERT },
+ { "crit", LOG_CRIT },
+ { "debug", LOG_DEBUG },
+ { "emerg", LOG_EMERG },
+ { "err", LOG_ERR },
+ { "error", LOG_ERR }, /* DEPRECATED */
+ { "info", LOG_INFO },
+ { "none", INTERNAL_NOPRI }, /* INTERNAL */
+ { "notice", LOG_NOTICE },
+ { "panic", LOG_EMERG }, /* DEPRECATED */
+ { "warn", LOG_WARNING }, /* DEPRECATED */
+ { "warning", LOG_WARNING },
+ { NULL, -1 }
+};
+#endif
+
+/* facility codes */
+#define LOG_KERN (0<<3) /* kernel messages */
+#define LOG_USER (1<<3) /* random user-level messages */
+#define LOG_MAIL (2<<3) /* mail system */
+#define LOG_DAEMON (3<<3) /* system daemons */
+#define LOG_AUTH (4<<3) /* security/authorization messages */
+#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
+#define LOG_LPR (6<<3) /* line printer subsystem */
+#define LOG_NEWS (7<<3) /* network news subsystem */
+#define LOG_UUCP (8<<3) /* UUCP subsystem */
+#define LOG_CRON (9<<3) /* clock daemon */
+#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
+
+ /* other codes through 15 reserved for system use */
+#define LOG_LOCAL0 (16<<3) /* reserved for local use */
+#define LOG_LOCAL1 (17<<3) /* reserved for local use */
+#define LOG_LOCAL2 (18<<3) /* reserved for local use */
+#define LOG_LOCAL3 (19<<3) /* reserved for local use */
+#define LOG_LOCAL4 (20<<3) /* reserved for local use */
+#define LOG_LOCAL5 (21<<3) /* reserved for local use */
+#define LOG_LOCAL6 (22<<3) /* reserved for local use */
+#define LOG_LOCAL7 (23<<3) /* reserved for local use */
+
+#define LOG_NFACILITIES 24 /* current number of facilities */
+#define LOG_FACMASK 0x03f8 /* mask to extract facility part */
+ /* facility of pri */
+#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
+
+#ifdef SYSLOG_NAMES
+CODE facilitynames[] = {
+ { "auth", LOG_AUTH },
+ { "authpriv", LOG_AUTHPRIV },
+ { "cron", LOG_CRON },
+ { "daemon", LOG_DAEMON },
+ { "kern", LOG_KERN },
+ { "lpr", LOG_LPR },
+ { "mail", LOG_MAIL },
+ { "mark", INTERNAL_MARK }, /* INTERNAL */
+ { "news", LOG_NEWS },
+ { "security", LOG_AUTH }, /* DEPRECATED */
+ { "syslog", LOG_SYSLOG },
+ { "user", LOG_USER },
+ { "uucp", LOG_UUCP },
+ { "local0", LOG_LOCAL0 },
+ { "local1", LOG_LOCAL1 },
+ { "local2", LOG_LOCAL2 },
+ { "local3", LOG_LOCAL3 },
+ { "local4", LOG_LOCAL4 },
+ { "local5", LOG_LOCAL5 },
+ { "local6", LOG_LOCAL6 },
+ { "local7", LOG_LOCAL7 },
+ { NULL, -1 }
+};
+#endif
+
+#ifdef KERNEL
+#define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */
+#endif
+
+/*
+ * arguments to setlogmask.
+ */
+#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */
+#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */
+
+/*
+ * Option flags for openlog.
+ *
+ * LOG_ODELAY no longer does anything.
+ * LOG_NDELAY is the inverse of what it used to be.
+ */
+#define LOG_PID 0x01 /* log the pid with each message */
+#define LOG_CONS 0x02 /* log on the console if errors in sending */
+#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */
+#define LOG_NDELAY 0x08 /* don't delay open */
+#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */
+#define LOG_PERROR 0x20 /* log to stderr as well */
+
+#ifndef KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
+#ifdef __GNUC__
+/* This define avoids name pollution if we're using GNU stdarg.h */
+#define __need___va_list
+#include <stdarg.h>
+#endif
+
+void closelog __P((void));
+void openlog __P((__const char *, int, int));
+int setlogmask __P((int));
+void syslog __P((int, __const char *, ...))
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5)
+ __attribute__ ((format (printf, 2, 0)))
+#endif
+ ;
+#ifdef __GNUC_VA_LIST
+void vsyslog __P((int, __const char *, __gnuc_va_list));
+#else
+void vsyslog __P(());
+#endif
+
+__END_DECLS
+
+#endif /* !KERNEL */
+
+#endif /* _SYS_LOG_H */
diff --git a/include/sys/termios.h b/include/sys/termios.h
new file mode 100644
index 000000000..3e18805ab
--- /dev/null
+++ b/include/sys/termios.h
@@ -0,0 +1,4 @@
+#ifndef _SYS_TERMIOS_H
+#define _SYS_TERMIOS_H
+#include <termios.h>
+#endif
diff --git a/include/sys/time.h b/include/sys/time.h
new file mode 100644
index 000000000..98e51c07c
--- /dev/null
+++ b/include/sys/time.h
@@ -0,0 +1,81 @@
+#ifndef _SYS_TIME_H
+#define _SYS_TIME_H
+
+#include <features.h>
+#include <linux/types.h>
+#include <linux/time.h>
+
+#define DST_NONE 0 /* not on dst */
+#define DST_USA 1 /* USA style dst */
+#define DST_AUST 2 /* Australian style dst */
+#define DST_WET 3 /* Western European dst */
+#define DST_MET 4 /* Middle European dst */
+#define DST_EET 5 /* Eastern European dst */
+#define DST_CAN 6 /* Canada */
+#define DST_GB 7 /* Great Britain and Eire */
+#define DST_RUM 8 /* Rumania */
+#define DST_TUR 9 /* Turkey */
+#define DST_AUSTALT 10 /* Australian style with shift in 1986 */
+
+#ifdef __SVR4_I386_ABI_L1__
+typedef struct timestruc {
+ time_t tv_sec;
+ long tv_nsec;
+} timestruc_t;
+#endif /* __SVR4_I386_ABI_L1__ */
+
+/*
+ * Operations on timevals.
+ *
+ * NB: timercmp does not work for >= or <=.
+ *
+ */
+#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#define timercmp(tvp, uvp, cmp) \
+ (((tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) \
+ || (tvp)->tv_sec cmp (uvp)->tv_sec)
+#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
+
+#include <time.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+extern int __gettimeofday __P ((struct timeval * __tp,
+ struct timezone * __tz));
+extern int gettimeofday __P ((struct timeval * __tp,
+ struct timezone * __tz));
+extern int __settimeofday __P ((__const struct timeval *__tv,
+ __const struct timezone *__tz));
+extern int settimeofday __P ((__const struct timeval *__tv,
+ __const struct timezone *__tz));
+
+extern int __select __P ((int __width, fd_set * __readfds,
+ fd_set * __writefds, fd_set * __exceptfds,
+ struct timeval * __timeout));
+extern int select __P ((int __width, fd_set * __readfds,
+ fd_set * __writefds, fd_set * __exceptfds,
+ struct timeval * __timeout));
+
+extern int __getitimer __P ((int __which,
+ struct itimerval *__value));
+extern int getitimer __P ((int __which,
+ struct itimerval *__value));
+extern int __setitimer __P ((int __which,
+ __const struct itimerval *__value,
+ struct itimerval *__ovalue));
+extern int setitimer __P ((int __which,
+ __const struct itimerval *__value,
+ struct itimerval *__ovalue));
+
+extern int __adjtime __P ((struct timeval * __itv,
+ struct timeval * __otv));
+extern int adjtime __P ((struct timeval * __itv,
+ struct timeval * __otv));
+
+extern int __utimes __P((char *__path, struct timeval *tvp));
+extern int utimes __P((char *__path, struct timeval *tvp));
+
+__END_DECLS
+
+#endif /*_SYS_TIME_H*/
diff --git a/include/sys/times.h b/include/sys/times.h
new file mode 100644
index 000000000..b6defa877
--- /dev/null
+++ b/include/sys/times.h
@@ -0,0 +1,21 @@
+#ifndef _SYS_TIMES_H
+#define _SYS_TIMES_H
+
+#include <features.h>
+#include <sys/types.h>
+#include <time.h>
+
+struct tms {
+ clock_t tms_utime;
+ clock_t tms_stime;
+ clock_t tms_cutime;
+ clock_t tms_cstime;
+};
+
+__BEGIN_DECLS
+
+extern clock_t times __P ((struct tms * __tp));
+
+__END_DECLS
+
+#endif
diff --git a/include/sys/types.h b/include/sys/types.h
new file mode 100644
index 000000000..4a5cdfab6
--- /dev/null
+++ b/include/sys/types.h
@@ -0,0 +1,4 @@
+#include <stddef.h>
+#include <sys/bitypes.h>
+#include <linux/types.h>
+#include <gnu/types.h>
diff --git a/include/sys/uio.h b/include/sys/uio.h
new file mode 100644
index 000000000..87120e6ff
--- /dev/null
+++ b/include/sys/uio.h
@@ -0,0 +1,65 @@
+/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+#ifndef _SYS_UIO_H
+
+#define _SYS_UIO_H 1
+#include <features.h>
+
+__BEGIN_DECLS
+
+#define __need_size_t
+#include <stddef.h>
+
+/* That is a klude for Linux. */
+#ifdef __linux__
+#include <linux/socket.h>
+#endif
+
+#ifndef __LINUX_UIO_H
+
+/* Structure describing a section of memory. */
+
+struct iovec
+{
+ /* Starting address. */
+ __ptr_t iov_base;
+ /* Length in bytes. */
+ size_t iov_len;
+};
+
+#endif
+
+/* Read data from file descriptor FD, and put the result in the
+ buffers described by VECTOR, which is a vector of COUNT `struct iovec's.
+ The buffers are filled in the order specified.
+ Operates just like `read' (see <unistd.h>) except that data are
+ put in VECTOR instead of a contiguous buffer. */
+int readv __P ((int __fd, __const struct iovec * __vector, size_t __count));
+
+/* Write data pointed by the buffers described by VECTOR, which
+ is a vector of COUNT `struct iovec's, to file descriptor FD.
+ The data is written in the order specified.
+ Operates just like `write' (see <unistd.h>) except that the data
+ are taken from VECTOR instead of a contiguous buffer. */
+int writev __P ((int __fd, __const struct iovec * __vector, size_t __count));
+
+
+__END_DECLS
+
+#endif /* sys/uio.h */
diff --git a/include/sys/un.h b/include/sys/un.h
new file mode 100644
index 000000000..efb674cc3
--- /dev/null
+++ b/include/sys/un.h
@@ -0,0 +1 @@
+#include <linux/un.h>
diff --git a/include/sys/utsname.h b/include/sys/utsname.h
new file mode 100644
index 000000000..0cbc37f2a
--- /dev/null
+++ b/include/sys/utsname.h
@@ -0,0 +1,18 @@
+#ifndef __SYS_UTSNAME_H
+#define __SYS_UTSNAME_H
+
+#include <features.h>
+#include <sys/param.h>
+
+struct utsname {
+ char sysname[65];
+ char nodename[65];
+ char release[65];
+ char version[65];
+ char machine[65];
+ char domainname[65];
+};
+
+extern int uname __P ((struct utsname * __utsbuf));
+
+#endif
diff --git a/include/sys/vfs.h b/include/sys/vfs.h
new file mode 100644
index 000000000..1018591b9
--- /dev/null
+++ b/include/sys/vfs.h
@@ -0,0 +1,17 @@
+#ifndef _SYS_VFS_H
+#define _SYS_VFS_H
+
+#include <features.h>
+#include <linux/vfs.h>
+
+__BEGIN_DECLS
+
+extern int __statfs __P ((__const char *__path, struct statfs *__buf));
+extern int statfs __P ((__const char *__path, struct statfs *__buf));
+
+extern int __fstatfs __P ((int __fildes, struct statfs *__buf));
+extern int fstatfs __P ((int __fildes, struct statfs *__buf));
+
+__END_DECLS
+
+#endif /*_SYS_VFS_H */
diff --git a/include/sys/vm86.h b/include/sys/vm86.h
new file mode 100644
index 000000000..851814e13
--- /dev/null
+++ b/include/sys/vm86.h
@@ -0,0 +1,125 @@
+#if !__AS386_16__
+
+#ifndef _SYS_VM86_H
+#define _SYS_VM86_H
+
+#include <features.h>
+#ifndef _LINUX_VM86_H
+#define _LINUX_VM86_H
+
+/*
+ * I'm guessing at the VIF/VIP flag usage, but hope that this is how
+ * the Pentium uses them. Linux will return from vm86 mode when both
+ * VIF and VIP is set.
+ *
+ * On a Pentium, we could probably optimize the virtual flags directly
+ * in the eflags register instead of doing it "by hand" in vflags...
+ *
+ * Linus
+ */
+
+#define TF_MASK 0x00000100
+#define IF_MASK 0x00000200
+#define IOPL_MASK 0x00003000
+#define NT_MASK 0x00004000
+#define VM_MASK 0x00020000
+#define AC_MASK 0x00040000
+#define VIF_MASK 0x00080000 /* virtual interrupt flag */
+#define VIP_MASK 0x00100000 /* virtual interrupt pending */
+#define ID_MASK 0x00200000
+
+#define BIOSSEG 0x0f000
+
+#define CPU_086 0
+#define CPU_186 1
+#define CPU_286 2
+#define CPU_386 3
+#define CPU_486 4
+#define CPU_586 5
+
+/*
+ * Return values for the 'vm86()' system call
+ */
+#define VM86_TYPE(retval) ((retval) & 0xff)
+#define VM86_ARG(retval) ((retval) >> 8)
+
+#define VM86_SIGNAL 0 /* return due to signal */
+#define VM86_UNKNOWN 1 /* unhandled GP fault - IO-instruction or similar */
+#define VM86_INTx 2 /* int3/int x instruction (ARG = x) */
+#define VM86_STI 3 /* sti/popf/iret instruction enabled virtual interrupts */
+
+/*
+ * This is the stack-layout when we have done a "SAVE_ALL" from vm86
+ * mode - the main change is that the old segment descriptors aren't
+ * useful any more and are forced to be zero by the kernel (and the
+ * hardware when a trap occurs), and the real segment descriptors are
+ * at the end of the structure. Look at ptrace.h to see the "normal"
+ * setup.
+ */
+
+struct vm86_regs {
+/*
+ * normal regs, with special meaning for the segment descriptors..
+ */
+ long ebx;
+ long ecx;
+ long edx;
+ long esi;
+ long edi;
+ long ebp;
+ long eax;
+ long __null_ds;
+ long __null_es;
+ long __null_fs;
+ long __null_gs;
+ long orig_eax;
+ long eip;
+ unsigned short cs, __csh;
+ long eflags;
+ long esp;
+ unsigned short ss, __ssh;
+/*
+ * these are specific to v86 mode:
+ */
+ unsigned short es, __esh;
+ unsigned short ds, __dsh;
+ unsigned short fs, __fsh;
+ unsigned short gs, __gsh;
+};
+
+struct revectored_struct {
+ unsigned long __map[8]; /* 256 bits */
+};
+
+struct vm86_struct {
+ struct vm86_regs regs;
+ unsigned long flags;
+ unsigned long screen_bitmap;
+ unsigned long cpu_type;
+ struct revectored_struct int_revectored;
+ struct revectored_struct int21_revectored;
+};
+
+/*
+ * flags masks
+ */
+#define VM86_SCREEN_BITMAP 0x0001
+
+#ifdef __KERNEL__
+
+void handle_vm86_fault(struct vm86_regs *, long);
+void handle_vm86_debug(struct vm86_regs *, long);
+
+#endif
+
+#endif
+
+__BEGIN_DECLS
+
+extern vm86(struct vm86_struct * __info);
+
+__END_DECLS
+
+#endif /*_SYS_VM86_H */
+
+#endif
diff --git a/include/sys/wait.h b/include/sys/wait.h
new file mode 100644
index 000000000..95f1b2eab
--- /dev/null
+++ b/include/sys/wait.h
@@ -0,0 +1,146 @@
+/* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB. If
+not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
+
+/*
+ * POSIX Standard: 3.2.1 Wait for Process Termination <sys/wait.h>
+ */
+
+#ifndef _SYS_WAIT_H
+
+#define _SYS_WAIT_H 1
+#include <features.h>
+
+__BEGIN_DECLS
+
+#include <gnu/types.h>
+
+/* This will define the `W*' macros for the flag
+ bits to `waitpid', `wait3', and `wait4'. */
+#include <waitflags.h>
+
+#ifdef __USE_BSD
+
+/* Lots of hair to allow traditional BSD use of `union wait'
+ as well as POSIX.1 use of `int' for the status word. */
+
+#ifdef __GNUC__
+#define __WAIT_INT(status) \
+ (__extension__ ({ union { __typeof(status) __in; int __i; } __u; \
+ __u.__in = (status); __u.__i; }))
+#else
+#define __WAIT_INT(status) (*(int *) &(status))
+#endif
+
+/* This is the type of the argument to `wait'. With GCC 2.6.1 and later,
+ the funky union causes redeclarations with either `int *' or `union wait
+ *' to be allowed without complaint. __WAIT_STATUS_DEFN is the type used
+ in the actual function definitions. */
+
+/* g++ in gcc 2.6.1 doesn't work. Maybe 2.7.x. H.J. */
+#if !defined (__GNUC__) || defined (__cplusplus) || \
+ __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) || \
+ (defined(_MIT_POSIX_THREADS) && _MIT_POSIX_THREADS > 0)
+#define __WAIT_STATUS __ptr_t
+#define __WAIT_STATUS_DEFN __ptr_t
+#else
+/* This works in GCC 2.6.1 and later. */
+typedef union
+ {
+ union wait *__uptr;
+ int *__iptr;
+ } __WAIT_STATUS __attribute__ ((transparent_union));
+#define __WAIT_STATUS_DEFN int *
+#endif
+
+#else /* Don't use BSD. */
+
+#define __WAIT_INT(status) (status)
+#define __WAIT_STATUS int *
+
+#endif /* Use BSD. */
+
+/* This will define all the `__W*' macros. */
+#include <waitstatus.h>
+
+#define WEXITSTATUS(status) __WEXITSTATUS(__WAIT_INT(status))
+#define WTERMSIG(status) __WTERMSIG(__WAIT_INT(status))
+#define WSTOPSIG(status) __WSTOPSIG(__WAIT_INT(status))
+#define WIFEXITED(status) __WIFEXITED(__WAIT_INT(status))
+#define WIFSIGNALED(status) __WIFSIGNALED(__WAIT_INT(status))
+#define WIFSTOPPED(status) __WIFSTOPPED(__WAIT_INT(status))
+
+#ifdef __USE_BSD
+#define WCOREDUMP(status) __WCOREDUMP(__WAIT_INT(status))
+#define W_EXITCODE(ret, sig) __W_EXITCODE(ret, sig)
+#define W_STOPCODE(sig) __W_STOPCODE(sig)
+#endif
+
+
+/* Wait for a child to die. When one does, put its status in *STAT_LOC
+ and return its process ID. For errors, return (pid_t) -1. */
+extern __pid_t __wait __P ((__WAIT_STATUS __stat_loc));
+extern __pid_t wait __P ((__WAIT_STATUS __stat_loc));
+
+#ifdef __USE_BSD
+/* Special values for the PID argument to `waitpid' and `wait4'. */
+#define WAIT_ANY (-1) /* Any process. */
+#define WAIT_MYPGRP 0 /* Any process in my process group. */
+#endif
+
+/* Wait for a child matching PID to die.
+ If PID is greater than 0, match any process whose process ID is PID.
+ If PID is (pid_t) -1, match any process.
+ If PID is (pid_t) 0, match any process with the
+ same process group as the current process.
+ If PID is less than -1, match any process whose
+ process group is the absolute value of PID.
+ If the WNOHANG bit is set in OPTIONS, and that child
+ is not already dead, return (pid_t) 0. If successful,
+ return PID and store the dead child's status in STAT_LOC.
+ Return (pid_t) -1 for errors. If the WUNTRACED bit is
+ set in OPTIONS, return status for stopped children; otherwise don't. */
+extern __pid_t __waitpid __P ((__pid_t __pid, int *__stat_loc,
+ int __options));
+extern __pid_t waitpid __P ((__pid_t __pid, int *__stat_loc,
+ int __options));
+#ifdef __USE_BSD
+/* This being here makes the prototypes valid whether or not
+ we have already included <sys/resource.h> to define `struct rusage'. */
+struct rusage;
+
+/* Wait for a child to exit. When one does, put its status in *STAT_LOC and
+ return its process ID. For errors return (pid_t) -1. If USAGE is not
+ nil, store information about the child's resource usage there. If the
+ WUNTRACED bit is set in OPTIONS, return status for stopped children;
+ otherwise don't. */
+extern __pid_t __wait3 __P ((__WAIT_STATUS __stat_loc,
+ int __options, struct rusage * __usage));
+extern __pid_t wait3 __P ((__WAIT_STATUS __stat_loc,
+ int __options, struct rusage * __usage));
+
+/* PID is like waitpid. Other args are like wait3. */
+extern __pid_t __wait4 __P ((__pid_t __pid, __WAIT_STATUS __stat_loc,
+ int __options, struct rusage *__usage));
+extern __pid_t wait4 __P ((__pid_t __pid, __WAIT_STATUS __stat_loc,
+ int __options, struct rusage *__usage));
+#endif /* Use BSD. */
+
+
+__END_DECLS
+
+#endif /* sys/wait.h */