---
 sys/amd64/include/pcb.h |    1 
 sys/i386/include/npx.h  |    2 
 sys/i386/include/pcb.h  |    2 
 sys/i386/include/pmap.h |    7 ++
 sys/net/if_arp.h        |   14 +++++
 sys/net/if_dl.h         |   14 ++---
 sys/nfsclient/nfs.h     |    5 ++
 sys/sys/callout.h       |    2 
 sys/sys/dvdio.h         |    2 
 sys/sys/extattr.h       |   52 ++++++++++-----------
 sys/sys/filedesc.h      |    1 
 sys/sys/jail.h          |   16 ++++--
 sys/sys/linker.h        |   22 +++++----
 sys/sys/lock.h          |    1 
 sys/sys/memrange.h      |    7 ++
 sys/sys/pciio.h         |    2 
 sys/sys/procfs.h        |    4 +
 sys/sys/resourcevar.h   |    2 
 sys/sys/rtprio.h        |   12 +++-
 sys/sys/signalvar.h     |   10 +++-
 sys/sys/sysctl.h        |  116 +++++++++++++++++++++++++++++++++++++++++++++---
 sys/sys/timepps.h       |    2 
 sys/sys/timex.h         |   21 +++++---
 sys/sys/ucred.h         |    3 +
 sys/vm/vm.h             |    2 
 sys/vm/vm_map.h         |    6 ++
 26 files changed, 262 insertions(+), 66 deletions(-)

--- a/sys/i386/include/npx.h
+++ b/sys/i386/include/npx.h
@@ -41,6 +41,8 @@
 #ifndef _MACHINE_NPX_H_
 #define	_MACHINE_NPX_H_
 
+#include <sys/types.h>
+
 /* Environment information of floating point unit */
 struct env87 {
 	long	en_cw;		/* control word (16bits) */
--- a/sys/amd64/include/pcb.h
+++ b/sys/amd64/include/pcb.h
@@ -40,6 +40,7 @@
 /*
  * AMD64 process control block
  */
+#include <stdint.h>
 #include <machine/fpu.h>
 #include <machine/segments.h>
 
--- a/sys/i386/include/pcb.h
+++ b/sys/i386/include/pcb.h
@@ -36,6 +36,8 @@
 #ifndef _I386_PCB_H_
 #define _I386_PCB_H_
 
+#include <sys/types.h>
+#include <stdint.h>
 /*
  * Intel 386 process control block
  */
--- a/sys/i386/include/pmap.h
+++ b/sys/i386/include/pmap.h
@@ -44,6 +44,13 @@
 #ifndef _MACHINE_PMAP_H_
 #define	_MACHINE_PMAP_H_
 
+
+#include <vm/vm.h>
+
+#ifndef	_PMAP_VM_
+#include <vm/pmap.h>
+#endif
+
 /*
  * Page-directory and page-table entries follow this format, with a few
  * of the fields not present here and there, depending on a lot of things.
--- a/sys/net/if_arp.h
+++ b/sys/net/if_arp.h
@@ -33,6 +33,11 @@
 #ifndef _NET_IF_ARP_H_
 #define	_NET_IF_ARP_H_
 
+/* Define the types u_char, u_short.  */
+#include <sys/types.h>
+/* Define 'struct sockaddr'.  */
+#include <sys/socket.h>
+
 /*
  * Address Resolution Protocol.
  *
@@ -74,6 +79,15 @@ struct	arphdr {
 
 #define ar_sha(ap)	(((caddr_t)((ap)+1)) +   0)
 #define ar_spa(ap)	(((caddr_t)((ap)+1)) +   (ap)->ar_hln)
+#define ar_tha(ap)	(((caddr_t)((ap)+1)) +   (ap)->ar_hln + (ap)->ar_pln)
+#define ar_tpa(ap)	(((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln)
+
+#define arphdr_len2(ar_hln, ar_pln)					\
+	(sizeof(struct arphdr) + 2*(ar_hln) + 2*(ar_pln))
+#define arphdr_len(ap)	(arphdr_len2((ap)->ar_hln, (ap)->ar_pln))
+
+#define ar_sha(ap)	(((caddr_t)((ap)+1)) +   0)
+#define ar_spa(ap)	(((caddr_t)((ap)+1)) +   (ap)->ar_hln)
 #define ar_tha(ap)	(((caddr_t)((ap)+1)) +   (ap)->ar_hln + (ap)->ar_pln)
 #define ar_tpa(ap)	(((caddr_t)((ap)+1)) + 2*(ap)->ar_hln + (ap)->ar_pln)
 
--- a/sys/net/if_dl.h
+++ b/sys/net/if_dl.h
@@ -33,6 +33,10 @@
 #ifndef _NET_IF_DL_H_
 #define _NET_IF_DL_H_
 
+#include <features.h>
+
+#include <sys/types.h>
+
 /*
  * A Link-Level Sockaddr may specify the interface in one of two
  * ways: either by means of a system-provided index number (computed
@@ -68,15 +72,9 @@ struct sockaddr_dl {
 
 #define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
 
-#ifndef _KERNEL
-
-#include <sys/cdefs.h>
-
 __BEGIN_DECLS
-void	link_addr(const char *, struct sockaddr_dl *);
-char	*link_ntoa(const struct sockaddr_dl *);
+extern void link_addr (const char *, struct sockaddr_dl *);
+extern char *link_ntoa (const struct sockaddr_dl *);
 __END_DECLS
 
-#endif /* !_KERNEL */
-
 #endif
--- a/sys/nfsclient/nfs.h
+++ b/sys/nfsclient/nfs.h
@@ -36,6 +36,11 @@
 #ifndef _NFSCLIENT_NFS_H_
 #define _NFSCLIENT_NFS_H_
 
+#ifndef _KERNEL
+#include <sys/types.h>
+#include <sys/ucred.h>
+
+#endif
 #ifdef _KERNEL
 #include "opt_nfs.h"
 #endif
--- a/sys/sys/callout.h
+++ b/sys/sys/callout.h
@@ -38,6 +38,8 @@
 #ifndef _SYS_CALLOUT_H_
 #define _SYS_CALLOUT_H_
 
+#include <features.h>
+
 #include <sys/queue.h>
 
 struct lock_object;
--- a/sys/sys/dvdio.h
+++ b/sys/sys/dvdio.h
@@ -31,6 +31,8 @@
 #ifndef _SYS_DVDIO_H_
 #define _SYS_DVDIO_H_
 
+#include <sys/types.h>
+
 struct dvd_layer {
 	u_int8_t book_type	:4;
 	u_int8_t book_version	:4;
--- a/sys/sys/extattr.h
+++ b/sys/sys/extattr.h
@@ -68,36 +68,36 @@ int	extattr_check_cred(struct vnode *vp,
 	    struct ucred *cred, struct thread *td, accmode_t accmode);
 
 #else
-#include <sys/cdefs.h>
+#include <features.h>
 
 struct iovec;
 
 __BEGIN_DECLS
-int	extattrctl(const char *_path, int _cmd, const char *_filename,
-	    int _attrnamespace, const char *_attrname);
-int	extattr_delete_fd(int _fd, int _attrnamespace, const char *_attrname);
-int	extattr_delete_file(const char *_path, int _attrnamespace,
-	    const char *_attrname);
-int	extattr_delete_link(const char *_path, int _attrnamespace,
-	    const char *_attrname);
-ssize_t	extattr_get_fd(int _fd, int _attrnamespace, const char *_attrname,
-	    void *_data, size_t _nbytes);
-ssize_t	extattr_get_file(const char *_path, int _attrnamespace,
-	    const char *_attrname, void *_data, size_t _nbytes);
-ssize_t	extattr_get_link(const char *_path, int _attrnamespace,
-	    const char *_attrname, void *_data, size_t _nbytes);
-ssize_t	extattr_list_fd(int _fd, int _attrnamespace, void *_data,
-	    size_t _nbytes);
-ssize_t	extattr_list_file(const char *_path, int _attrnamespace, void *_data,
-	    size_t _nbytes);
-ssize_t	extattr_list_link(const char *_path, int _attrnamespace, void *_data,
-	    size_t _nbytes);
-int	extattr_set_fd(int _fd, int _attrnamespace, const char *_attrname,
-	    const void *_data, size_t _nbytes);
-int	extattr_set_file(const char *_path, int _attrnamespace,
-	    const char *_attrname, const void *_data, size_t _nbytes);
-int	extattr_set_link(const char *_path, int _attrnamespace,
-	    const char *_attrname, const void *_data, size_t _nbytes);
+extern int	extattrctl(const char *_path, int _cmd, const char *_filename,
+	    int _attrnamespace, const char *_attrname) __THROW;
+extern int	extattr_delete_fd(int _fd, int _attrnamespace, const char *_attrname) __THROW;
+extern int	extattr_delete_file(const char *_path, int _attrnamespace,
+	    const char *_attrname) __THROW;
+extern int	extattr_delete_link(const char *_path, int _attrnamespace,
+	    const char *_attrname) __THROW;
+extern ssize_t	extattr_get_fd(int _fd, int _attrnamespace, const char *_attrname,
+	    void *_data, size_t _nbytes) __THROW;
+extern ssize_t	extattr_get_file(const char *_path, int _attrnamespace,
+	    const char *_attrname, void *_data, size_t _nbytes) __THROW;
+extern ssize_t	extattr_get_link(const char *_path, int _attrnamespace,
+	    const char *_attrname, void *_data, size_t _nbytes) __THROW;
+extern ssize_t	extattr_list_fd(int _fd, int _attrnamespace, void *_data,
+	    size_t _nbytes) __THROW;
+extern ssize_t	extattr_list_file(const char *_path, int _attrnamespace, void *_data,
+	    size_t _nbytes) __THROW;
+extern ssize_t	extattr_list_link(const char *_path, int _attrnamespace, void *_data,
+	    size_t _nbytes) __THROW;
+extern int	extattr_set_fd(int _fd, int _attrnamespace, const char *_attrname,
+	    const void *_data, size_t _nbytes) __THROW;
+extern int	extattr_set_file(const char *_path, int _attrnamespace,
+	    const char *_attrname, const void *_data, size_t _nbytes) __THROW;
+extern int	extattr_set_link(const char *_path, int _attrnamespace,
+	    const char *_attrname, const void *_data, size_t _nbytes) __THROW;
 __END_DECLS
 
 #endif /* !_KERNEL */
--- a/sys/sys/filedesc.h
+++ b/sys/sys/filedesc.h
@@ -33,6 +33,7 @@
 #ifndef _SYS_FILEDESC_H_
 #define	_SYS_FILEDESC_H_
 
+#include <sys/types.h>
 #include <sys/queue.h>
 #include <sys/event.h>
 #include <sys/lock.h>
--- a/sys/sys/jail.h
+++ b/sys/sys/jail.h
@@ -39,6 +39,10 @@ struct jail_v0 {
 };
 #endif
 
+#include <features.h>
+#include <sys/types.h>
+#include <sys/_types.h>
+
 struct jail {
 	uint32_t	version;
 	char		*path;
@@ -108,11 +112,13 @@ struct xprison {
 
 struct iovec;
 
-int jail(struct jail *);
-int jail_set(struct iovec *, unsigned int, int);
-int jail_get(struct iovec *, unsigned int, int);
-int jail_attach(int);
-int jail_remove(int);
+__BEGIN_DECLS
+extern int jail(struct jail *) __THROW;
+extern int jail_set(struct iovec *, unsigned int, int) __THROW;
+extern int jail_get(struct iovec *, unsigned int, int) __THROW;
+extern int jail_attach(int) __THROW;
+extern int jail_remove(int) __THROW;
+__END_DECLS
 
 #else /* _KERNEL */
 
--- a/sys/sys/linker.h
+++ b/sys/sys/linker.h
@@ -189,6 +189,13 @@ int linker_search_symbol_name(caddr_t va
 /* HWPMC helper */
 void *linker_hwpmc_list_objects(void);
 
+#else
+
+#include <features.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+
 #endif	/* _KERNEL */
 
 /*
@@ -332,14 +339,13 @@ struct kld_sym_lookup {
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
-int	kldload(const char* _file);
-int	kldunload(int _fileid);
-int	kldunloadf(int _fileid, int flags);
-int	kldfind(const char* _file);
-int	kldnext(int _fileid);
-int	kldstat(int _fileid, struct kld_file_stat* _stat);
-int	kldfirstmod(int _fileid);
-int	kldsym(int _fileid, int _cmd, void *_data);
+extern int kldload (__const char *__file) __THROW;
+extern int kldunload (int __fileid) __THROW;
+extern int kldfind (__const char *__file) __THROW;
+extern int kldnext (int __fileid) __THROW;
+extern int kldstat (int __fileid, struct kld_file_stat *__statp) __THROW;
+extern int kldfirstmod (int __fileid) __THROW;
+extern int kldsym (int __fileid, int __cmd, void*__data) __THROW;
 __END_DECLS
 
 #endif
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -32,6 +32,7 @@
 #ifndef _SYS_LOCK_H_
 #define _SYS_LOCK_H_
 
+#include <sys/types.h>
 #include <sys/queue.h>
 #include <sys/_lock.h>
 
--- a/sys/sys/memrange.h
+++ b/sys/sys/memrange.h
@@ -4,6 +4,11 @@
  * $FreeBSD$
  */
 
+#ifndef _SYS_MEMRANGE_H_
+#define _SYS_MEMRANGE_H_
+
+#include <sys/types.h>
+
 /* Memory range attributes */
 #define MDF_UNCACHEABLE		(1<<0)	/* region not cached */
 #define MDF_WRITECOMBINE	(1<<1)	/* region supports "write combine" action */
@@ -69,3 +74,5 @@ extern int mem_range_attr_get(struct mem
 extern int mem_range_attr_set(struct mem_range_desc *mrd, int *arg);
 
 #endif
+
+#endif /* _SYS_MEMRANGE_H_ */
--- a/sys/sys/pciio.h
+++ b/sys/sys/pciio.h
@@ -31,6 +31,8 @@
 #ifndef _SYS_PCIIO_H_
 #define	_SYS_PCIIO_H_
 
+#include <sys/types.h>
+#include <stdint.h>
 #include <sys/ioccom.h>
 
 #define PCI_MAXNAMELEN	16
--- a/sys/sys/procfs.h
+++ b/sys/sys/procfs.h
@@ -82,4 +82,8 @@ typedef struct prpsinfo {
 
 typedef uint64_t psaddr_t;	/* An address in the target process. */
 
+/* We don't have any differences between processes and threads,
+   therefore have only one PID type.  */
+typedef __pid_t lwpid_t;
+
 #endif /* _SYS_PROCFS_H_ */
--- a/sys/sys/resourcevar.h
+++ b/sys/sys/resourcevar.h
@@ -35,6 +35,8 @@
 
 #include <sys/resource.h>
 #include <sys/queue.h>
+#include <sys/time.h>
+#include <sys/types.h>
 #ifdef _KERNEL
 #include <sys/_lock.h>
 #include <sys/_mutex.h>
--- a/sys/sys/rtprio.h
+++ b/sys/sys/rtprio.h
@@ -36,6 +36,10 @@
 
 #include <sys/priority.h>
 
+#include <features.h>
+
+#include <sys/types.h>
+
 /*
  * Process realtime-priority specifications to rtprio.
  */
@@ -65,7 +69,6 @@
 #define RTP_LOOKUP		0
 #define RTP_SET			1
 
-#ifndef LOCORE
 /*
  * Scheduling class information.
  */
@@ -79,14 +82,15 @@ struct thread;
 int	rtp_to_pri(struct rtprio *, struct thread *);
 void	pri_to_rtp(struct thread *, struct rtprio *);
 #endif
-#endif
 
 #ifndef _KERNEL
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
-int	rtprio(int, pid_t, struct rtprio *);
-int	rtprio_thread(int, lwpid_t, struct rtprio *);
+extern int    rtprio(int, pid_t, struct rtprio *) __THROW;
+#ifdef _LIBC
+extern int    __rtprio(int, pid_t, struct rtprio *);
+#endif
 __END_DECLS
 #endif	/* !_KERNEL */
 #endif	/* !_SYS_RTPRIO_H_ */
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -43,6 +43,9 @@
  * not exported to user programs.
  */
 
+#define	_SIG_WORDS	4
+#define	_SIG_MAXSIG	128
+
 /*
  * Logical process signal actions and state, needed only within the process
  * The mapping between sigacts and proc structures is 1:1 except for rfork()
@@ -95,6 +98,7 @@ struct osigaction {
 typedef void __osiginfohandler_t(int, osiginfo_t *, void *);
 #endif /* _KERNEL && COMPAT_43 */
 
+#if 0
 /* additional signal action values, used only temporarily/internally */
 #define	SIG_CATCH	((__sighandler_t *)2)
 /* #define SIG_HOLD        ((__sighandler_t *)3) See signal.h */
@@ -181,7 +185,7 @@ __sigisempty(sigset_t *set)
 	int i;
 
 	for (i = 0; i < _SIG_WORDS; i++) {
-		if (set->__bits[i])
+		if (set->__sigbits[i])
 			return (0);
 	}
 	return (1);
@@ -193,7 +197,7 @@ __sigseteq(sigset_t *set1, sigset_t *set
 	int i;
 
 	for (i = 0; i < _SIG_WORDS; i++) {
-		if (set1->__bits[i] != set2->__bits[i])
+		if (set1->__sigbits[i] != set2->__sigbits[i])
 			return (0);
 	}
 	return (1);
@@ -208,6 +212,8 @@ struct osigevent {
 	union sigval sigev_value;	/* Signal value */
 };
 
+#endif
+
 typedef struct ksiginfo {
 	TAILQ_ENTRY(ksiginfo)	ksi_link;
 	siginfo_t		ksi_info;
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -36,7 +36,103 @@
 #ifndef _SYS_SYSCTL_H_
 #define	_SYS_SYSCTL_H_
 
-#include <sys/queue.h>
+#include <features.h>
+#include <vm/vm_param.h>
+
+/****************************************  Stolen from sys/mount.h */
+
+/*
+ * Sysctl CTL_VFS definitions.
+ *
+ * Second level identifier specifies which filesystem. Second level
+ * identifier VFS_VFSCONF returns information about all filesystems.
+ * Second level identifier VFS_GENERIC is non-terminal.
+ */
+#define	VFS_VFSCONF		0	/* get configured filesystems */
+#define	VFS_GENERIC		0	/* generic filesystem information */
+/*
+ * Third level identifiers for VFS_GENERIC are given below; third
+ * level identifiers for specific filesystems are given in their
+ * mount specific header files.
+ */
+#define VFS_MAXTYPENUM	1	/* int: highest defined filesystem type */
+#define VFS_CONF	2	/* struct: vfsconf for filesystem given
+				   as next argument */
+
+/****************************************  End of sys/mount.h */
+
+/****************************************  Stolen from sys/socket.h */
+/*
+ * Definitions for network related sysctl, CTL_NET.
+ *
+ * Second level is protocol family.
+ * Third level is protocol number.
+ *
+ * Further levels are defined by the individual families below.
+ */
+#define NET_MAXID	AF_MAX
+
+#define CTL_NET_NAMES { \
+	{ 0, 0 }, \
+	{ "unix", CTLTYPE_NODE }, \
+	{ "inet", CTLTYPE_NODE }, \
+	{ "implink", CTLTYPE_NODE }, \
+	{ "pup", CTLTYPE_NODE }, \
+	{ "chaos", CTLTYPE_NODE }, \
+	{ "xerox_ns", CTLTYPE_NODE }, \
+	{ "iso", CTLTYPE_NODE }, \
+	{ "emca", CTLTYPE_NODE }, \
+	{ "datakit", CTLTYPE_NODE }, \
+	{ "ccitt", CTLTYPE_NODE }, \
+	{ "ibm_sna", CTLTYPE_NODE }, \
+	{ "decnet", CTLTYPE_NODE }, \
+	{ "dec_dli", CTLTYPE_NODE }, \
+	{ "lat", CTLTYPE_NODE }, \
+	{ "hylink", CTLTYPE_NODE }, \
+	{ "appletalk", CTLTYPE_NODE }, \
+	{ "route", CTLTYPE_NODE }, \
+	{ "link_layer", CTLTYPE_NODE }, \
+	{ "xtp", CTLTYPE_NODE }, \
+	{ "coip", CTLTYPE_NODE }, \
+	{ "cnt", CTLTYPE_NODE }, \
+	{ "rtip", CTLTYPE_NODE }, \
+	{ "ipx", CTLTYPE_NODE }, \
+	{ "sip", CTLTYPE_NODE }, \
+	{ "pip", CTLTYPE_NODE }, \
+	{ "isdn", CTLTYPE_NODE }, \
+	{ "key", CTLTYPE_NODE }, \
+	{ "inet6", CTLTYPE_NODE }, \
+	{ "natm", CTLTYPE_NODE }, \
+	{ "atm", CTLTYPE_NODE }, \
+	{ "hdrcomplete", CTLTYPE_NODE }, \
+	{ "netgraph", CTLTYPE_NODE }, \
+	{ "snp", CTLTYPE_NODE }, \
+	{ "scp", CTLTYPE_NODE }, \
+}
+
+/*
+ * PF_ROUTE - Routing table
+ *
+ * Three additional levels are defined:
+ *	Fourth: address family, 0 is wildcard
+ *	Fifth: type of info, defined below
+ *	Sixth: flag(s) to mask with for NET_RT_FLAGS
+ */
+#define NET_RT_DUMP	1		/* dump; may limit to a.f. */
+#define NET_RT_FLAGS	2		/* by flags, e.g. RESOLVING */
+#define NET_RT_IFLIST	3		/* survey interface list */
+#define	NET_RT_IFMALIST	4		/* return multicast address list */
+#define	NET_RT_MAXID	5
+
+#define CTL_NET_RT_NAMES { \
+	{ 0, 0 }, \
+	{ "dump", CTLTYPE_STRUCT }, \
+	{ "flags", CTLTYPE_STRUCT }, \
+	{ "iflist", CTLTYPE_STRUCT }, \
+	{ "ifmalist", CTLTYPE_STRUCT }, \
+}
+/****************************************  End of sys/socket.h */
+
 
 struct thread;
 /*
@@ -387,7 +483,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 #define	KERN_SECURELVL	 	 9	/* int: system security level */
 #define	KERN_HOSTNAME		10	/* string: hostname */
 #define	KERN_HOSTID		11	/* int: host identifier */
-#define	KERN_CLOCKRATE		12	/* struct: struct clockrate */
+#define	KERN_CLOCKRATE		12	/* struct: struct clockinfo */
 #define	KERN_VNODE		13	/* struct: vnode structures */
 #define	KERN_PROC		14	/* struct: process entries */
 #define	KERN_FILE		15	/* struct: file entries */
@@ -712,13 +808,21 @@ void	sysctl_unlock(void);
 int	sysctl_wire_old_buffer(struct sysctl_req *req, size_t len);
 
 #else	/* !_KERNEL */
-#include <sys/cdefs.h>
+#define __need_size_t
+#include <stddef.h>
 
 __BEGIN_DECLS
-int	sysctl(int *, u_int, void *, size_t *, void *, size_t);
-int	sysctlbyname(const char *, void *, size_t *, void *, size_t);
-int	sysctlnametomib(const char *, int *, size_t *);
+extern int	sysctl(int *, u_int, void *, size_t *, void *, size_t) __THROW;
+extern int	sysctlbyname(const char *, void *, size_t *, void *, size_t) __THROW;
+extern int	sysctlnametomib(const char *, int *, size_t *) __THROW;
+#ifdef _LIBC
+extern int __sysctlbyname (const char *__name,
+			   void *__oldval, size_t *__oldlenp,
+			   void *__newval, size_t __newlen) __THROW;
+extern int __sysctlnametomib (const char *__name, int *mibp, size_t *sizep) __THROW;
+#endif
 __END_DECLS
+
 #endif	/* _KERNEL */
 
 #endif	/* !_SYS_SYSCTL_H_ */
--- a/sys/sys/timepps.h
+++ b/sys/sys/timepps.h
@@ -15,6 +15,8 @@
 #ifndef _SYS_TIMEPPS_H_
 #define _SYS_TIMEPPS_H_
 
+#include <stddef.h>
+#include <sys/time.h>
 #include <sys/ioccom.h>
 #include <sys/time.h>
 
--- a/sys/sys/timex.h
+++ b/sys/sys/timex.h
@@ -95,11 +95,9 @@
  */
 #ifndef _SYS_TIMEX_H_
 #define _SYS_TIMEX_H_ 1
-#define NTP_API		4	/* NTP API version */
 
-#ifndef MSDOS			/* Microsoft specific */
-#include <sys/syscall.h>
-#endif /* MSDOS */
+#include <features.h>
+#include <time.h>
 
 /*
  * The following defines establish the performance envelope of the
@@ -176,7 +174,13 @@
  * Note: The time member is in microseconds if STA_NANO is zero and
  * nanoseconds if not.
  */
-struct ntptimeval {
+struct ntptimeval3 {
+	struct timespec time;	/* current time (ns) (ro) */
+	long maxerror;		/* maximum error (us) (ro) */
+	long esterror;		/* estimated error (us) (ro) */
+	int time_state;		/* time status */
+};
+struct ntptimeval4 {
 	struct timespec time;	/* current time (ns) (ro) */
 	long maxerror;		/* maximum error (us) (ro) */
 	long esterror;		/* estimated error (us) (ro) */
@@ -225,9 +229,12 @@ void	ntp_update_second(int64_t *adjustme
 #else /* !_KERNEL */
 #include <sys/cdefs.h>
 
+#define NTP_API		4	/* NTP API version */
+#define ntptimeval	ntptimeval4
+
 __BEGIN_DECLS
-int	ntp_adjtime(struct timex *);
-int	ntp_gettime(struct ntptimeval *);
+extern int	ntp_adjtime(struct timex *) __THROW;
+extern int	ntp_gettime(struct ntptimeval *) __THROW;
 __END_DECLS
 #endif /* _KERNEL */
 
--- a/sys/sys/ucred.h
+++ b/sys/sys/ucred.h
@@ -33,6 +33,9 @@
 #ifndef _SYS_UCRED_H_
 #define	_SYS_UCRED_H_
 
+#include <sys/types.h>
+#include <sys/param.h>
+#include <time.h>
 #include <bsm/audit.h>
 
 /*
--- a/sys/vm/vm.h
+++ b/sys/vm/vm.h
@@ -63,6 +63,8 @@
 
 #include <machine/vm.h>
 
+#include <sys/_types.h>
+
 typedef char vm_inherit_t;	/* inheritance codes */
 
 #define	VM_INHERIT_SHARE	((vm_inherit_t) 0)
--- a/sys/vm/vm_map.h
+++ b/sys/vm/vm_map.h
@@ -70,6 +70,12 @@
 #include <sys/sx.h>
 #include <sys/_mutex.h>
 
+#include <sys/types.h>
+
+#include <machine/pmap.h>
+#include <vm/vm.h>
+#include <sys/lock.h>
+
 /*
  *	Types defined:
  *
