[Midnightbsd-cvs] src: sys/sys: Sync with freebsd7

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Sep 15 21:18:28 EDT 2008


Log Message:
-----------
Sync with freebsd7

Modified Files:
--------------
    src/sys/sys:
        _lock.h (r1.1.1.1 -> r1.2)
        _mutex.h (r1.1.1.1 -> r1.2)
        _timeval.h (r1.1.1.1 -> r1.2)
        _types.h (r1.1.1.1 -> r1.2)
        acct.h (r1.1.1.1 -> r1.2)
        acl.h (r1.1.1.1 -> r1.2)
        aio.h (r1.1.1.1 -> r1.2)
        ata.h (r1.3 -> r1.4)
        bio.h (r1.1.1.1 -> r1.2)
        buf.h (r1.1.1.1 -> r1.2)
        bufobj.h (r1.1.1.1 -> r1.2)
        bus.h (r1.3 -> r1.4)
        bus_dma.h (r1.1.1.1 -> r1.2)
        callout.h (r1.1.1.1 -> r1.2)
        clock.h (r1.1.1.1 -> r1.2)
        condvar.h (r1.1.1.1 -> r1.2)
        conf.h (r1.1.1.1 -> r1.2)
        cons.h (r1.1.1.1 -> r1.2)
        consio.h (r1.1.1.1 -> r1.2)
        cpu.h (r1.1.1.1 -> r1.2)
        digiio.h (r1.1.1.1 -> r1.2)
        dirent.h (r1.1.1.1 -> r1.2)
        disk.h (r1.1.1.1 -> r1.2)
        disklabel.h (r1.1.1.1 -> r1.2)
        domain.h (r1.1.1.1 -> r1.2)
        elf32.h (r1.1.1.2 -> r1.2)
        elf64.h (r1.1.1.2 -> r1.2)
        elf_common.h (r1.1.1.2 -> r1.2)
        elf_generic.h (r1.1.1.2 -> r1.2)
        event.h (r1.1.1.1 -> r1.2)
        eventhandler.h (r1.1.1.1 -> r1.2)
        extattr.h (r1.1.1.1 -> r1.2)
        file.h (r1.1.1.1 -> r1.2)
        filedesc.h (r1.1.1.1 -> r1.2)
        filio.h (r1.1.1.1 -> r1.2)
        firmware.h (r1.1.1.1 -> r1.2)
        gmon.h (r1.1.1.1 -> r1.2)
        gpt.h (r1.1.1.1 -> r1.2)
        hash.h (r1.1 -> r1.2)
        iconv.h (r1.1.1.1 -> r1.2)
        imgact.h (r1.1.1.1 -> r1.2)
        imgact_elf.h (r1.1.1.2 -> r1.2)
        interrupt.h (r1.2 -> r1.3)
        ioccom.h (r1.1.1.1 -> r1.2)
        ioctl.h (r1.1.1.1 -> r1.2)
        ioctl_compat.h (r1.1.1.1 -> r1.2)
        jail.h (r1.1.1.1 -> r1.2)
        kbio.h (r1.1.1.1 -> r1.2)
        kernel.h (r1.1.1.1 -> r1.2)
        kerneldump.h (r1.1.1.1 -> r1.2)
        kobj.h (r1.1.1.1 -> r1.2)
        ktr.h (r1.1.1.2 -> r1.2)
        ktrace.h (r1.1.1.2 -> r1.2)
        libkern.h (r1.1.1.1 -> r1.2)
        limits.h (r1.1.1.1 -> r1.2)
        link_elf.h (r1.1.1.1 -> r1.2)
        linker.h (r1.1.1.2 -> r1.2)
        lock.h (r1.1.1.2 -> r1.2)
        lockf.h (r1.1.1.1 -> r1.2)
        lockmgr.h (r1.2 -> r1.3)
        mac.h (r1.1.1.1 -> r1.2)
        malloc.h (r1.1.1.1 -> r1.2)
        mbuf.h (r1.3 -> r1.4)
        mchain.h (r1.1.1.1 -> r1.2)
        md5.h (r1.2 -> r1.3)
        mdioctl.h (r1.1.1.1 -> r1.2)
        module.h (r1.1.1.1 -> r1.2)
        mount.h (r1.2 -> r1.3)
        mouse.h (r1.1.1.1 -> r1.2)
        msgbuf.h (r1.1.1.1 -> r1.2)
        mutex.h (r1.1.1.2 -> r1.2)
        namei.h (r1.1.1.1 -> r1.2)
        pciio.h (r1.1.1.1 -> r1.2)
        pcpu.h (r1.1.1.1 -> r1.2)
        pioctl.h (r1.1.1.1 -> r1.2)
        pmc.h (r1.1.1.1 -> r1.2)
        pmckern.h (r1.1.1.1 -> r1.2)
        pmclog.h (r1.1.1.1 -> r1.2)
        priority.h (r1.1.1.1 -> r1.2)
        proc.h (r1.4 -> r1.5)
        protosw.h (r1.1.1.1 -> r1.2)
        ptrace.h (r1.1.1.1 -> r1.2)
        queue.h (r1.1.1.1 -> r1.2)
        refcount.h (r1.1.1.1 -> r1.2)
        resource.h (r1.1.1.1 -> r1.2)
        resourcevar.h (r1.1.1.1 -> r1.2)
        rman.h (r1.1.1.1 -> r1.2)
        rtprio.h (r1.1.1.1 -> r1.2)
        runq.h (r1.1.1.1 -> r1.2)
        sched.h (r1.1.1.1 -> r1.2)
        select.h (r1.1.1.2 -> r1.2)
        sem.h (r1.1.1.1 -> r1.2)
        serial.h (r1.1.1.1 -> r1.2)
        shm.h (r1.1.1.1 -> r1.2)
        signal.h (r1.1.1.1 -> r1.2)
        signalvar.h (r1.1.1.1 -> r1.2)
        sleepqueue.h (r1.2 -> r1.3)
        smp.h (r1.1.1.1 -> r1.2)
        snoop.h (r1.1.1.1 -> r1.2)
        socket.h (r1.1.1.1 -> r1.2)
        socketvar.h (r1.2 -> r1.3)
        sockio.h (r1.1.1.2 -> r1.2)
        soundcard.h (r1.1.1.2 -> r1.2)
        stack.h (r1.1 -> r1.2)
        stat.h (r1.1.1.1 -> r1.2)
        sx.h (r1.2 -> r1.3)
        syscall.h (r1.2 -> r1.3)
        syscall.mk (r1.2 -> r1.3)
        syscallsubr.h (r1.1.1.2 -> r1.2)
        sysctl.h (r1.2 -> r1.3)
        sysent.h (r1.1.1.1 -> r1.2)
        syslimits.h (r1.1.1.1 -> r1.2)
        sysproto.h (r1.1.1.1 -> r1.2)
        systm.h (r1.3 -> r1.4)
        taskqueue.h (r1.2 -> r1.3)
        thr.h (r1.1.1.1 -> r1.2)
        time.h (r1.1.1.1 -> r1.2)
        timers.h (r1.1.1.1 -> r1.2)
        timespec.h (r1.1.1.1 -> r1.2)
        tree.h (r1.1.1.1 -> r1.2)
        tty.h (r1.1.1.1 -> r1.2)
        ttychars.h (r1.1.1.1 -> r1.2)
        ttycom.h (r1.1.1.1 -> r1.2)
        ttydev.h (r1.1.1.1 -> r1.2)
        turnstile.h (r1.1.1.1 -> r1.2)
        types.h (r1.1.1.1 -> r1.2)
        ucontext.h (r1.1.1.1 -> r1.2)
        ucred.h (r1.1.1.1 -> r1.2)
        uio.h (r1.1.1.1 -> r1.2)
        umtx.h (r1.1.1.2 -> r1.2)
        unistd.h (r1.1.1.1 -> r1.2)
        unpcb.h (r1.1.1.1 -> r1.2)
        user.h (r1.1.1.1 -> r1.2)
        uuid.h (r1.1.1.1 -> r1.2)
        vmmeter.h (r1.1.1.1 -> r1.2)
        vnode.h (r1.2 -> r1.3)
        wait.h (r1.1.1.1 -> r1.2)
        watchdog.h (r1.1.1.1 -> r1.2)

-------------- next part --------------
Index: serial.h
===================================================================
RCS file: /home/cvs/src/sys/sys/serial.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/serial.h -L sys/sys/serial.h -u -r1.1.1.1 -r1.2
--- sys/sys/serial.h
+++ sys/sys/serial.h
@@ -27,7 +27,7 @@
  * (both async and sync), but which do not necessarily have anything to
  * do with tty processing.
  *
- * $FreeBSD: src/sys/sys/serial.h,v 1.2 2004/06/25 10:56:43 phk Exp $
+ * $FreeBSD: src/sys/sys/serial.h,v 1.5 2006/03/30 17:24:42 marcel Exp $
  */
 
 #ifndef _SYS_SERIAL_H_
@@ -40,25 +40,53 @@
  * that identity is enforced with CTASSERT at the bottom of kern/tty.c
  * Both the modem bits and delta bits must fit in 16 bit.
  */
-#define		SER_DTR	0x0001		/* data terminal ready */
-#define		SER_RTS	0x0002		/* request to send */
-#define		SER_STX	0x0004		/* secondary transmit */
-#define		SER_SRX	0x0008		/* secondary receive */
-#define		SER_CTS	0x0010		/* clear to send */
-#define		SER_DCD	0x0020		/* data carrier detect */
-#define		SER_RI 	0x0040		/* ring indicate */
-#define		SER_DSR	0x0080		/* data set ready */
+#define	SER_DTR		0x0001		/* data terminal ready */
+#define	SER_RTS		0x0002		/* request to send */
+#define	SER_STX		0x0004		/* secondary transmit */
+#define	SER_SRX		0x0008		/* secondary receive */
+#define	SER_CTS		0x0010		/* clear to send */
+#define	SER_DCD		0x0020		/* data carrier detect */
+#define	SER_RI	 	0x0040		/* ring indicate */
+#define	SER_DSR		0x0080		/* data set ready */
+
+#define	SER_MASK_STATE	0x00ff
 
 /* Delta bits, used to indicate which signals should/was affected */
-#define		SER_DELTA(x)	((x) << 8)
+#define	SER_DELTA(x)	((x) << 8)
+
+#define	SER_DDTR	SER_DELTA(SER_DTR)
+#define	SER_DRTS	SER_DELTA(SER_RTS)
+#define	SER_DSTX	SER_DELTA(SER_STX)
+#define	SER_DSRX	SER_DELTA(SER_SRX)
+#define	SER_DCTS	SER_DELTA(SER_CTS)
+#define	SER_DDCD	SER_DELTA(SER_DCD)
+#define	SER_DRI		SER_DELTA(SER_RI)
+#define	SER_DDSR	SER_DELTA(SER_DSR)
+
+#define	SER_MASK_DELTA	SER_DELTA(SER_MASK_STATE)
+
+#ifdef _KERNEL
+/*
+ * Specification of interrupt sources typical for serial ports. These are
+ * useful when some umbrella driver like scc(4) has enough knowledge of
+ * the hardware to obtain the set of pending interrupts but does not itself
+ * handle the interrupt. Each interrupt source can be given an interrupt
+ * resource for which inferior drivers can install handlers. The lower 16
+ * bits are kept free for the signals above.
+ */
+#define	SER_INT_OVERRUN	0x010000
+#define	SER_INT_BREAK	0x020000
+#define	SER_INT_RXREADY	0x040000
+#define	SER_INT_SIGCHG	0x080000
+#define	SER_INT_TXIDLE	0x100000
+
+#define	SER_INT_MASK	0xff0000
+#define	SER_INT_SIGMASK	(SER_MASK_DELTA | SER_MASK_STATE)
+
+#ifndef LOCORE
+typedef int serdev_intr_t(void*);
+#endif
 
-#define		SER_DDTR SER_DELTA(SER_DTR)
-#define		SER_DRTS SER_DELTA(SER_RTS)
-#define		SER_DSTX SER_DELTA(SER_STX)
-#define		SER_DSRX SER_DELTA(SER_SRX)
-#define		SER_DCTS SER_DELTA(SER_CTS)
-#define		SER_DDCD SER_DELTA(SER_DCD)
-#define		SER_DRI  SER_DELTA(SER_RI)
-#define		SER_DDSR SER_DELTA(SER_DSR)
+#endif	/* _KERNEL */
 
 #endif /* !_SYS_SERIAL_H_ */
Index: lockmgr.h
===================================================================
RCS file: /home/cvs/src/sys/sys/lockmgr.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/lockmgr.h -L sys/sys/lockmgr.h -u -r1.2 -r1.3
--- sys/sys/lockmgr.h
+++ sys/sys/lockmgr.h
@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)lock.h	8.12 (Berkeley) 5/19/95
- * $FreeBSD: src/sys/sys/lockmgr.h,v 1.47.2.1 2006/03/13 03:07:09 jeff Exp $
+ * $FreeBSD: src/sys/sys/lockmgr.h,v 1.53 2007/03/30 18:07:24 jhb Exp $
  */
 
 #ifndef	_SYS_LOCKMGR_H_
@@ -40,6 +40,8 @@
 #ifdef	DEBUG_LOCKS
 #include <sys/stack.h> /* XXX */
 #endif
+#include <sys/queue.h>
+#include <sys/_lock.h>
 
 struct	mtx;
 
@@ -49,20 +51,23 @@
  * can be gained.
  */
 struct lock {
+	struct lock_object lk_object;   /* common lock properties */
 	struct	mtx *lk_interlock;	/* lock on remaining fields */
 	u_int	lk_flags;		/* see below */
 	int	lk_sharecount;		/* # of accepted shared locks */
 	int	lk_waitcount;		/* # of processes sleeping for lock */
 	short	lk_exclusivecount;	/* # of recursive exclusive locks */
 	short	lk_prio;		/* priority at which to sleep */
-	const char *lk_wmesg;		/* resource sleeping (for tsleep) */
 	int	lk_timo;		/* maximum sleep time (for tsleep) */
 	struct thread *lk_lockholder;	/* thread of exclusive lock holder */
 	struct	lock *lk_newlock;	/* lock taking over this lock */
+
 #ifdef	DEBUG_LOCKS
 	struct stack lk_stack;
 #endif
 };
+
+#define lk_wmesg lk_object.lo_name
 /*
  * Lock request types:
  *   LK_SHARED - get one of many possible shared locks. If a process
@@ -197,11 +202,17 @@
 			int timo, int flags);
 void	lockdestroy(struct lock *);
 
-int	lockmgr(struct lock *, u_int flags,
-			struct mtx *, struct thread *p);
+int	_lockmgr(struct lock *, u_int flags,
+		 struct mtx *, struct thread *p, char *file, int line);
 void	transferlockers(struct lock *, struct lock *);
 void	lockmgr_printinfo(struct lock *);
 int	lockstatus(struct lock *, struct thread *);
 int	lockcount(struct lock *);
+int	lockwaiters(struct lock *);
+
+#define lockmgr(lock, flags, mtx, td) _lockmgr((lock), (flags), (mtx), (td), __FILE__, __LINE__)
+#ifdef DDB
+int	lockmgr_chain(struct thread *td, struct thread **ownerp);
+#endif
 
 #endif /* !_SYS_LOCKMGR_H_ */
Index: malloc.h
===================================================================
RCS file: /home/cvs/src/sys/sys/malloc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/malloc.h -L sys/sys/malloc.h -u -r1.1.1.1 -r1.2
--- sys/sys/malloc.h
+++ sys/sys/malloc.h
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)malloc.h	8.5 (Berkeley) 5/3/95
- * $FreeBSD: src/sys/sys/malloc.h,v 1.80.2.1 2005/07/23 17:11:33 rwatson Exp $
+ * $FreeBSD: src/sys/sys/malloc.h,v 1.83 2005/12/30 11:45:07 pjd Exp $
  */
 
 #ifndef _SYS_MALLOC_H_
@@ -145,7 +145,7 @@
 	SYSINIT(type##_init, SI_SUB_KMEM, SI_ORDER_SECOND, malloc_init,	\
 	    type);							\
 	SYSUNINIT(type##_uninit, SI_SUB_KMEM, SI_ORDER_ANY,		\
-	    malloc_uninit, type);
+	    malloc_uninit, type)
 
 #define	MALLOC_DECLARE(type) \
 	extern struct malloc_type type[1]
@@ -189,6 +189,8 @@
 	    int flags);
 void	*reallocf(void *addr, unsigned long size, struct malloc_type *type,
 	    int flags);
+
+struct malloc_type *malloc_desc2type(const char *desc);
 #endif /* _KERNEL */
 
 #endif /* !_SYS_MALLOC_H_ */
Index: umtx.h
===================================================================
RCS file: /home/cvs/src/sys/sys/umtx.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/umtx.h -L sys/sys/umtx.h -u -r1.1.1.2 -r1.2
--- sys/sys/umtx.h
+++ sys/sys/umtx.h
@@ -23,13 +23,14 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/umtx.h,v 1.16.2.1 2006/01/16 05:48:40 davidxu Exp $
+ * $FreeBSD: src/sys/sys/umtx.h,v 1.29 2007/06/06 07:35:08 davidxu Exp $
  *
  */
 
 #ifndef _SYS_UMTX_H_
 #define	_SYS_UMTX_H_
 
+#include <sys/_types.h>
 #include <sys/limits.h>
 
 /* 
@@ -40,25 +41,57 @@
 #define	UMTX_CONTESTED	LONG_MIN
 
 struct umtx {
-	void	*u_owner;	/* Owner of the mutex. */
+	volatile u_long	u_owner;	/* Owner of the mutex. */
+};
+
+#define USYNC_PROCESS_SHARED	0x0001	/* Process shared sync objs */
+
+#define	UMUTEX_UNOWNED		0x0
+#define	UMUTEX_CONTESTED	0x80000000U
+
+#define	UMUTEX_ERROR_CHECK	0x0002	/* Error-checking mutex */
+#define	UMUTEX_PRIO_INHERIT	0x0004	/* Priority inherited mutex */
+#define	UMUTEX_PRIO_PROTECT	0x0008	/* Priority protect mutex */
+
+struct umutex {
+	volatile __lwpid_t	m_owner;	/* Owner of the mutex */
+	uint32_t		m_flags;	/* Flags of the mutex */
+	uint32_t		m_ceilings[2];	/* Priority protect ceiling */
+	uint32_t		m_spare[4];
+};
+
+struct ucond {
+	volatile uint32_t	c_has_waiters;	/* Has waiters in kernel */
+	uint32_t		c_flags;	/* Flags of the condition variable */
+	uint32_t		c_spare[2];	/* Spare space */
 };
 
 /* op code for _umtx_op */
-#define UMTX_OP_LOCK		0
-#define UMTX_OP_UNLOCK		1
-#define UMTX_OP_WAIT		2
-#define UMTX_OP_WAKE		3
+#define	UMTX_OP_LOCK		0
+#define	UMTX_OP_UNLOCK		1
+#define	UMTX_OP_WAIT		2
+#define	UMTX_OP_WAKE		3
+#define	UMTX_OP_MUTEX_TRYLOCK	4
+#define	UMTX_OP_MUTEX_LOCK	5
+#define	UMTX_OP_MUTEX_UNLOCK	6
+#define	UMTX_OP_SET_CEILING	7
+#define	UMTX_OP_CV_WAIT		8
+#define	UMTX_OP_CV_SIGNAL	9
+#define	UMTX_OP_CV_BROADCAST	10
+#define	UMTX_OP_MAX		11
+
+/* flags for UMTX_OP_CV_WAIT */
+#define UMTX_CHECK_UNPARKING	0x01
 
 #ifndef _KERNEL
 
+int _umtx_op(void *obj, int op, u_long val, void *uaddr, void *uaddr2);
+
 /*
- * System calls for acquiring and releasing contested mutexes.
+ * Old (deprecated) userland mutex system calls.
  */
-/* deprecated becaues it can only use thread id */
 int _umtx_lock(struct umtx *mtx);
-/* deprecated becaues it can only use thread id */
 int _umtx_unlock(struct umtx *mtx);
-int _umtx_op(struct umtx *umtx, int op, long id, void *uaddr, void *uaddr2);
 
 /*
  * Standard api.  Try uncontested acquire/release and asks the
@@ -70,73 +103,77 @@
 	umtx->u_owner = UMTX_UNOWNED;
 }
 
-static __inline long
+static __inline u_long
 umtx_owner(struct umtx *umtx)
 {
-	return ((long)umtx->u_owner & ~LONG_MIN);
+	return (umtx->u_owner & ~LONG_MIN);
 }
 
 static __inline int
-umtx_lock(struct umtx *umtx, long id)
+umtx_lock(struct umtx *umtx, u_long id)
 {
-	if (atomic_cmpset_acq_ptr(&umtx->u_owner, (void *)UMTX_UNOWNED,
-	    (void *)id) == 0)
+	if (atomic_cmpset_acq_long(&umtx->u_owner, UMTX_UNOWNED, id) == 0)
 		if (_umtx_lock(umtx) == -1)
 			return (errno);
 	return (0);
 }
 
 static __inline int
-umtx_trylock(struct umtx *umtx, long id)
+umtx_trylock(struct umtx *umtx, u_long id)
 {
-	if (atomic_cmpset_acq_ptr(&umtx->u_owner, (void *)UMTX_UNOWNED,
-	    (void *)id) == 0)
+	if (atomic_cmpset_acq_long(&umtx->u_owner, UMTX_UNOWNED, id) == 0)
 		return (EBUSY);
 	return (0);
 }
 
 static __inline int
-umtx_timedlock(struct umtx *umtx, long id, const struct timespec *timeout)
+umtx_timedlock(struct umtx *umtx, u_long id, const struct timespec *timeout)
 {
-	if (atomic_cmpset_acq_ptr(&umtx->u_owner, (void *)UMTX_UNOWNED,
-	    (void *)id) == 0)
-		if (_umtx_op(umtx, UMTX_OP_LOCK, id, 0, (void *)timeout) == -1)
+	if (atomic_cmpset_acq_long(&umtx->u_owner, UMTX_UNOWNED, id) == 0)
+		if (_umtx_op(umtx, UMTX_OP_LOCK, id, 0,
+		    __DECONST(void *, timeout)) == -1)
 			return (errno);
 	return (0);
 }
 
 static __inline int
-umtx_unlock(struct umtx *umtx, long id)
+umtx_unlock(struct umtx *umtx, u_long id)
 {
-	if (atomic_cmpset_rel_ptr(&umtx->u_owner, (void *)id,
-	    (void *)UMTX_UNOWNED) == 0)
+	if (atomic_cmpset_rel_long(&umtx->u_owner, id, UMTX_UNOWNED) == 0)
 		if (_umtx_unlock(umtx) == -1)
 			return (errno);
 	return (0);
 }
 
 static __inline int
-umtx_wait(struct umtx *umtx, long id, const struct timespec *timeout)
+umtx_wait(u_long *p, long val, const struct timespec *timeout)
 {
-	if (_umtx_op(umtx, UMTX_OP_WAIT, id, 0, (void *)timeout) == -1)
+	if (_umtx_op(p, UMTX_OP_WAIT, val, 0,
+	    __DECONST(void *, timeout)) == -1)
 		return (errno);
 	return (0);
 }
 
 /* Wake threads waiting on a user address. */
 static __inline int
-umtx_wake(struct umtx *umtx, int nr_wakeup)
+umtx_wake(u_long *p, int nr_wakeup)
 {
-	if (_umtx_op(umtx, UMTX_OP_WAKE, nr_wakeup, 0, 0) == -1)
+	if (_umtx_op(p, UMTX_OP_WAKE, nr_wakeup, 0, 0) == -1)
 		return (errno);
 	return (0);
 }
+
 #else
 
+struct thread;
+
 struct umtx_q *umtxq_alloc(void);
 void umtxq_free(struct umtx_q *);
-struct thread;
 int kern_umtx_wake(struct thread *td, void *uaddr, int n_wake);
-
+void umtx_pi_adjust(struct thread *td, u_char oldpri);
+void umtx_thread_init(struct thread *td);
+void umtx_thread_fini(struct thread *td);
+void umtx_thread_alloc(struct thread *td);
+void umtx_thread_exit(struct thread *td);
 #endif /* !_KERNEL */
 #endif /* !_SYS_UMTX_H_ */
Index: bus_dma.h
===================================================================
RCS file: /home/cvs/src/sys/sys/bus_dma.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/bus_dma.h -L sys/sys/bus_dma.h -u -r1.1.1.1 -r1.2
--- sys/sys/bus_dma.h
+++ sys/sys/bus_dma.h
@@ -67,11 +67,13 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
-/* $FreeBSD: src/sys/sys/bus_dma.h,v 1.29 2005/03/15 14:57:29 jmg Exp $ */
+/* $FreeBSD: src/sys/sys/bus_dma.h,v 1.30 2006/09/03 00:26:17 jmg Exp $ */
 
 #ifndef _BUS_DMA_H_
 #define _BUS_DMA_H_
 
+#include <sys/_bus_dma.h>
+
 /*
  * Machine independent interface for mapping physical addresses to peripheral
  * bus 'physical' addresses, and assisting with DMA operations.
@@ -108,30 +110,12 @@
 /*
  * Operations performed by bus_dmamap_sync().
  */
-typedef int bus_dmasync_op_t;
 #define	BUS_DMASYNC_PREREAD	1
 #define	BUS_DMASYNC_POSTREAD	2
 #define	BUS_DMASYNC_PREWRITE	4
 #define	BUS_DMASYNC_POSTWRITE	8
 
 /*
- *	bus_dma_tag_t
- *
- *	A machine-dependent opaque type describing the characteristics
- *	of how to perform DMA mappings.  This structure encapsultes
- *	information concerning address and alignment restrictions, number
- *	of S/G segments, amount of data per S/G segment, etc.
- */
-typedef struct bus_dma_tag	*bus_dma_tag_t;
-
-/*
- *	bus_dmamap_t
- *
- *	DMA mapping instance information.
- */
-typedef struct bus_dmamap	*bus_dmamap_t;
-
-/*
  *	bus_dma_segment_t
  *
  *	Describes a single contiguous DMA transaction.  Values
@@ -149,17 +133,6 @@
 typedef int bus_dma_filter_t(void *, bus_addr_t);
 
 /*
- * A function that performs driver-specific synchronization on behalf of
- * busdma.
- */
-typedef enum {
-	BUS_DMA_LOCK	= 0x01,
-	BUS_DMA_UNLOCK	= 0x02,
-} bus_dma_lock_op_t;
-
-typedef void bus_dma_lock_t(void *, bus_dma_lock_op_t);
-
-/*
  * Generic helper function for manipulating mutexes.
  */
 void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op);
Index: resource.h
===================================================================
RCS file: /home/cvs/src/sys/sys/resource.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/resource.h -L sys/sys/resource.h -u -r1.1.1.1 -r1.2
--- sys/sys/resource.h
+++ sys/sys/resource.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)resource.h	8.4 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/sys/resource.h,v 1.29 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/resource.h,v 1.31 2007/06/01 01:12:45 jeff Exp $
  */
 
 #ifndef _SYS_RESOURCE_H_
@@ -50,40 +50,38 @@
 /*
  * Resource utilization information.
  *
- * Locking key:
- *      c - locked by proc mtx
- *      j - locked by sched_lock mtx
- *      n - not locked, lazy
+ * All fields are only modified by curthread and
+ * no locks are required to read.
  */
 
 #define	RUSAGE_SELF	0
 #define	RUSAGE_CHILDREN	-1
 
 struct rusage {
-	struct timeval ru_utime;	/* (n) user time used */
-	struct timeval ru_stime;	/* (n) system time used */
-	long	ru_maxrss;		/* (j) max resident set size */
+	struct timeval ru_utime;	/* user time used */
+	struct timeval ru_stime;	/* system time used */
+	long	ru_maxrss;		/* max resident set size */
 #define	ru_first	ru_ixrss
-	long	ru_ixrss;		/* (j) integral shared memory size */
-	long	ru_idrss;		/* (j) integral unshared data " */
-	long	ru_isrss;		/* (j) integral unshared stack " */
-	long	ru_minflt;		/* (c) page reclaims */
-	long	ru_majflt;		/* (c) page faults */
-	long	ru_nswap;		/* (c + j) swaps */
-	long	ru_inblock;		/* (n) block input operations */
-	long	ru_oublock;		/* (n) block output operations */
-	long	ru_msgsnd;		/* (n) messages sent */
-	long	ru_msgrcv;		/* (n) messages received */
-	long	ru_nsignals;		/* (c) signals received */
-	long	ru_nvcsw;		/* (j) voluntary context switches */
-	long	ru_nivcsw;		/* (j) involuntary " */
+	long	ru_ixrss;		/* integral shared memory size */
+	long	ru_idrss;		/* integral unshared data " */
+	long	ru_isrss;		/* integral unshared stack " */
+	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	ru_last		ru_nivcsw
 };
 
 /*
  * Resource limits
  */
-#define	RLIMIT_CPU	0		/* cpu time in milliseconds */
+#define	RLIMIT_CPU	0		/* maximum cpu time in seconds */
 #define	RLIMIT_FSIZE	1		/* maximum file size */
 #define	RLIMIT_DATA	2		/* data size */
 #define	RLIMIT_STACK	3		/* stack size */
Index: mouse.h
===================================================================
RCS file: /home/cvs/src/sys/sys/mouse.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/mouse.h -L sys/sys/mouse.h -u -r1.1.1.1 -r1.2
--- sys/sys/mouse.h
+++ sys/sys/mouse.h
@@ -20,7 +20,7 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/mouse.h,v 1.23 2005/04/13 07:25:45 mdodd Exp $
+ * $FreeBSD: src/sys/sys/mouse.h,v 1.25 2006/12/18 18:48:28 keramida Exp $
  */
 
 #ifndef _SYS_MOUSE_H_
@@ -41,7 +41,7 @@
 #define MOUSE_READSTATE		_IOWR('M', 8, mousedata_t)
 #define MOUSE_READDATA		_IOWR('M', 9, mousedata_t)
 
-#if notyet
+#ifdef notyet
 #define MOUSE_SETRESOLUTION	_IOW('M', 10, int)
 #define MOUSE_SETSCALING	_IOW('M', 11, int)
 #define MOUSE_SETRATE		_IOW('M', 12, int)
@@ -175,7 +175,7 @@
 #define MOUSE_PROTO_HITTAB	8	/* Hitachi Tablet 3 bytes */
 #define MOUSE_PROTO_GLIDEPOINT	9	/* ALPS GlidePoint, 3/4 bytes */
 #define MOUSE_PROTO_INTELLI	10	/* MS IntelliMouse, 4 bytes */
-#define MOUSE_PROTO_THINK	11	/* Kensignton Thinking Mouse, 3/4 bytes */
+#define MOUSE_PROTO_THINK	11	/* Kensington Thinking Mouse, 3/4 bytes */
 #define MOUSE_PROTO_SYSMOUSE	12	/* /dev/sysmouse */
 #define MOUSE_PROTO_X10MOUSEREM	13	/* X10 MouseRemote, 3 bytes */
 #define MOUSE_PROTO_KIDSPAD	14	/* Genius Kidspad */
Index: smp.h
===================================================================
RCS file: /home/cvs/src/sys/sys/smp.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/smp.h -L sys/sys/smp.h -u -r1.1.1.1 -r1.2
--- sys/sys/smp.h
+++ sys/sys/smp.h
@@ -6,7 +6,7 @@
  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
  * ----------------------------------------------------------------------------
  *
- * $FreeBSD: src/sys/sys/smp.h,v 1.84 2005/04/30 20:01:00 dwhite Exp $
+ * $FreeBSD: src/sys/sys/smp.h,v 1.85 2005/10/24 21:04:19 jhb Exp $
  */
 
 #ifndef _SYS_SMP_H_
@@ -102,9 +102,6 @@
 void	smp_rendezvous_action(void);
 extern	struct mtx smp_ipi_mtx;
 
-#ifdef KDB_STOP_NMI
-int	stop_cpus_nmi(cpumask_t);
-#endif 
 #endif /* SMP */
 void	smp_rendezvous(void (*)(void *), 
 		       void (*)(void *),
Index: time.h
===================================================================
RCS file: /home/cvs/src/sys/sys/time.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/time.h -L sys/sys/time.h -u -r1.1.1.1 -r1.2
--- sys/sys/time.h
+++ sys/sys/time.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)time.h	8.5 (Berkeley) 5/4/95
- * $FreeBSD: src/sys/sys/time.h,v 1.69 2005/04/02 12:33:27 das Exp $
+ * $FreeBSD: src/sys/sys/time.h,v 1.73 2006/10/03 04:01:30 jb Exp $
  */
 
 #ifndef _SYS_TIME_H_
@@ -238,6 +238,14 @@
 #define CLOCK_VIRTUAL	1
 #define CLOCK_PROF	2
 #define CLOCK_MONOTONIC	4
+#define CLOCK_UPTIME	5		/* FreeBSD-specific. */
+#define CLOCK_UPTIME_PRECISE	7	/* FreeBSD-specific. */
+#define CLOCK_UPTIME_FAST	8	/* FreeBSD-specific. */
+#define CLOCK_REALTIME_PRECISE	9	/* FreeBSD-specific. */
+#define CLOCK_REALTIME_FAST	10	/* FreeBSD-specific. */
+#define CLOCK_MONOTONIC_PRECISE	11	/* FreeBSD-specific. */
+#define CLOCK_MONOTONIC_FAST	12	/* FreeBSD-specific. */
+#define CLOCK_SECOND	13		/* FreeBSD-specific. */
 #endif
 
 #ifndef TIMER_ABSTIME
@@ -296,6 +304,8 @@
 void	timevaladd(struct timeval *t1, const struct timeval *t2);
 void	timevalsub(struct timeval *t1, const struct timeval *t2);
 int	tvtohz(struct timeval *tv);
+uint64_t	dtrace_gethrtime(void);
+uint64_t	dtrace_gethrestime(void);
 #else /* !_KERNEL */
 #include <time.h>
 
@@ -314,4 +324,27 @@
 
 #endif /* !_KERNEL */
 
+/*
+ * Solaris compatibility definitions.
+ */
+#ifdef _SOLARIS_C_SOURCE
+/*
+ *  Definitions for commonly used resolutions.
+ */
+#define SEC		1
+#define MILLISEC	1000
+#define MICROSEC	1000000
+#define NANOSEC		1000000000
+
+typedef longlong_t	hrtime_t;
+
+#ifndef _KERNEL
+static __inline hrtime_t gethrtime(void) {
+	struct timespec ts;
+	clock_gettime(CLOCK_UPTIME,&ts);
+	return (((u_int64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec);
+}
+#endif
+#endif /* _SOLARIS_C_SOURCE */
+
 #endif /* !_SYS_TIME_H_ */
Index: uuid.h
===================================================================
RCS file: /home/cvs/src/sys/sys/uuid.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/uuid.h -L sys/sys/uuid.h -u -r1.1.1.1 -r1.2
--- sys/sys/uuid.h
+++ sys/sys/uuid.h
@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/uuid.h,v 1.4 2005/01/07 02:29:24 imp Exp $
+ * $FreeBSD: src/sys/sys/uuid.h,v 1.6 2005/10/07 13:37:10 marcel Exp $
  */
 
 #ifndef _SYS_UUID_H_
@@ -56,9 +56,13 @@
 
 struct sbuf;
 
+struct uuid *kern_uuidgen(struct uuid *, size_t);
+
 int snprintf_uuid(char *, size_t, struct uuid *);
 int printf_uuid(struct uuid *);
 int sbuf_printf_uuid(struct sbuf *, struct uuid *);
+int parse_uuid(const char *, struct uuid *);
+
 void be_uuid_dec(void const *buf, struct uuid *uuid);
 void be_uuid_enc(void *buf, struct uuid const *uuid);
 void le_uuid_dec(void const *buf, struct uuid *uuid);
Index: pmc.h
===================================================================
RCS file: /home/cvs/src/sys/sys/pmc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/pmc.h -L sys/sys/pmc.h -u -r1.1.1.1 -r1.2
--- sys/sys/pmc.h
+++ sys/sys/pmc.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003-2005, Joseph Koshy
+ * Copyright (c) 2003-2006, Joseph Koshy
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/pmc.h,v 1.8 2005/07/09 17:29:36 jkoshy Exp $
+ * $FreeBSD: src/sys/sys/pmc.h,v 1.11 2006/03/28 16:20:29 jkoshy Exp $
  */
 
 #ifndef _SYS_PMC_H_
@@ -50,9 +50,9 @@
  *
  * The patch version is incremented for every bug fix.
  */
-#define	PMC_VERSION_MAJOR	0x01
-#define	PMC_VERSION_MINOR	0x02
-#define	PMC_VERSION_PATCH	0x0003
+#define	PMC_VERSION_MAJOR	0x02
+#define	PMC_VERSION_MINOR	0x00
+#define	PMC_VERSION_PATCH	0x0000
 
 #define	PMC_VERSION		(PMC_VERSION_MAJOR << 24 |		\
 	PMC_VERSION_MINOR << 16 | PMC_VERSION_PATCH)
@@ -533,12 +533,11 @@
 #include <sys/malloc.h>
 #include <sys/sysctl.h>
 
-#define	PMC_REQUEST_POOL_SIZE			32
 #define	PMC_HASH_SIZE				16
 #define	PMC_MTXPOOL_SIZE			32
 #define	PMC_LOG_BUFFER_SIZE			4
 #define	PMC_NLOGBUFFERS				16
-#define	PMC_NSAMPLES				16
+#define	PMC_NSAMPLES				32
 
 #define PMC_SYSCTL_NAME_PREFIX "kern." PMC_MODULE_NAME "."
 
@@ -894,7 +893,7 @@
 /* driver statistics */
 extern struct pmc_op_getdriverstats pmc_stats;
 
-#if	DEBUG
+#if	defined(DEBUG) && DEBUG
 
 /* debug flags, major flag groups */
 struct pmc_debugflags {
Index: sockio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sockio.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/sockio.h -L sys/sys/sockio.h -u -r1.1.1.2 -r1.2
--- sys/sys/sockio.h
+++ sys/sys/sockio.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)sockio.h	8.1 (Berkeley) 3/28/94
- * $FreeBSD: src/sys/sys/sockio.h,v 1.28.2.1 2006/02/15 03:37:15 ps Exp $
+ * $FreeBSD: src/sys/sys/sockio.h,v 1.31 2006/07/09 06:04:00 sam Exp $
  */
 
 #ifndef _SYS_SOCKIO_H_
@@ -114,7 +114,13 @@
 								  parameters */
 
 #define	SIOCIFCREATE	_IOWR('i', 122, struct ifreq)	/* create clone if */
+#define	SIOCIFCREATE2	_IOWR('i', 124, struct ifreq)	/* create clone if */
 #define	SIOCIFDESTROY	 _IOW('i', 121, struct ifreq)	/* destroy clone if */
 #define	SIOCIFGCLONERS	_IOWR('i', 120, struct if_clonereq) /* get cloners */
 
+#define	SIOCAIFGROUP	 _IOW('i', 135, struct ifgroupreq) /* add an ifgroup */
+#define	SIOCGIFGROUP	_IOWR('i', 136, struct ifgroupreq) /* get ifgroups */
+#define	SIOCDIFGROUP	 _IOW('i', 137, struct ifgroupreq) /* delete ifgroup */
+#define	SIOCGIFGMEMB	_IOWR('i', 138, struct ifgroupreq) /* get members */
+
 #endif /* !_SYS_SOCKIO_H_ */
Index: eventhandler.h
===================================================================
RCS file: /home/cvs/src/sys/sys/eventhandler.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/eventhandler.h -L sys/sys/eventhandler.h -u -r1.1.1.1 -r1.2
--- sys/sys/eventhandler.h
+++ sys/sys/eventhandler.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/eventhandler.h,v 1.33 2004/12/06 10:53:39 jkoshy Exp $
+ * $FreeBSD: src/sys/sys/eventhandler.h,v 1.37.2.1 2007/12/14 13:41:09 rrs Exp $
  */
 
 #ifndef SYS_EVENTHANDLER_H
@@ -104,6 +104,17 @@
 };									\
 struct __hack
 
+#define EVENTHANDLER_DEFINE(name, func, arg, priority)			\
+	static eventhandler_tag name ## _tag;				\
+	static void name ## _evh_init(void *ctx)			\
+	{								\
+		name ## _tag = EVENTHANDLER_REGISTER(name, func, ctx,	\
+		    priority);						\
+	}								\
+	SYSINIT(name ## _evh_init, SI_SUB_CONFIGURE, SI_ORDER_ANY,	\
+	    name ## _evh_init, arg)					\
+	struct __hack
+
 #define EVENTHANDLER_INVOKE(name, ...)					\
 do {									\
 	struct eventhandler_list *_el;					\
@@ -156,19 +167,47 @@
 #define	LOWMEM_PRI_DEFAULT	EVENTHANDLER_PRI_FIRST
 EVENTHANDLER_DECLARE(vm_lowmem, vm_lowmem_handler_t);
 
+/* Low vnodes event */
+typedef void (*vfs_lowvnodes_handler_t)(void *, int);
+EVENTHANDLER_DECLARE(vfs_lowvnodes, vfs_lowvnodes_handler_t);
+
 /*
  * Process events
  * process_fork and exit handlers are called without Giant.
  * exec handlers are called with Giant, but that is by accident.
  */
 struct proc;
+struct image_params;
 
 typedef void (*exitlist_fn)(void *, struct proc *);
 typedef void (*forklist_fn)(void *, struct proc *, struct proc *, int);
-typedef void (*execlist_fn)(void *, struct proc *);
-
+typedef void (*execlist_fn)(void *, struct proc *, struct image_params *);
+typedef void (*proc_ctor_fn)(void *, struct proc *);
+typedef void (*proc_dtor_fn)(void *, struct proc *);
+typedef void (*proc_init_fn)(void *, struct proc *);
+typedef void (*proc_fini_fn)(void *, struct proc *);
+EVENTHANDLER_DECLARE(process_ctor, proc_ctor_fn);
+EVENTHANDLER_DECLARE(process_dtor, proc_dtor_fn);
+EVENTHANDLER_DECLARE(process_init, proc_init_fn);
+EVENTHANDLER_DECLARE(process_fini, proc_fini_fn);
 EVENTHANDLER_DECLARE(process_exit, exitlist_fn);
 EVENTHANDLER_DECLARE(process_fork, forklist_fn);
 EVENTHANDLER_DECLARE(process_exec, execlist_fn);
 
+struct thread;
+typedef void (*thread_ctor_fn)(void *, struct thread *);
+typedef void (*thread_dtor_fn)(void *, struct thread *);
+typedef void (*thread_fini_fn)(void *, struct thread *);
+typedef void (*thread_init_fn)(void *, struct thread *);
+EVENTHANDLER_DECLARE(thread_ctor, thread_ctor_fn);
+EVENTHANDLER_DECLARE(thread_dtor, thread_dtor_fn);
+EVENTHANDLER_DECLARE(thread_init, thread_init_fn);
+EVENTHANDLER_DECLARE(thread_fini, thread_fini_fn);
+
+typedef void (*uma_zone_chfn)(void *);
+EVENTHANDLER_DECLARE(nmbclusters_change, uma_zone_chfn);
+EVENTHANDLER_DECLARE(maxsockets_change, uma_zone_chfn);
+
+typedef void(*schedtail_fn)(void *, struct proc *);
+EVENTHANDLER_DECLARE(schedtail, schedtail_fn);
 #endif /* SYS_EVENTHANDLER_H */
Index: uio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/uio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/uio.h -L sys/sys/uio.h -u -r1.1.1.1 -r1.2
--- sys/sys/uio.h
+++ sys/sys/uio.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)uio.h	8.5 (Berkeley) 2/22/94
- * $FreeBSD: src/sys/sys/uio.h,v 1.39 2005/07/07 18:17:55 jhb Exp $
+ * $FreeBSD: src/sys/sys/uio.h,v 1.40 2006/11/29 19:08:45 alfred Exp $
  */
 
 #ifndef _SYS_UIO_H_
@@ -61,13 +61,13 @@
 #ifdef _KERNEL
 
 struct uio {
-	struct	iovec *uio_iov;
-	int	uio_iovcnt;
-	off_t	uio_offset;
-	int	uio_resid;
-	enum	uio_seg uio_segflg;
-	enum	uio_rw uio_rw;
-	struct	thread *uio_td;
+	struct	iovec *uio_iov;		/* scatter/gather list */
+	int	uio_iovcnt;		/* length of scatter/gather list */
+	off_t	uio_offset;		/* offset in target object */
+	int	uio_resid;		/* remaining bytes to process */
+	enum	uio_seg uio_segflg;	/* address space */
+	enum	uio_rw uio_rw;		/* operation */
+	struct	thread *uio_td;		/* owner */
 };
 
 /*
Index: kbio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/kbio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/kbio.h -L sys/sys/kbio.h -u -r1.1.1.1 -r1.2
--- sys/sys/kbio.h
+++ sys/sys/kbio.h
@@ -1,5 +1,5 @@
 /*-
- * $FreeBSD: src/sys/sys/kbio.h,v 1.7.14.1 2005/07/20 18:56:21 emax Exp $
+ * $FreeBSD: src/sys/sys/kbio.h,v 1.11 2006/09/27 19:57:02 ru Exp $
  */
 
 #ifndef	_SYS_KBIO_H_
@@ -15,16 +15,16 @@
 #define K_XLATE		1		/* keyboard returns ascii 	*/
 #define K_CODE		2		/* keyboard returns keycodes 	*/
 #define KDGKBMODE 	_IOR('K', 6, int)
-#define KDSKBMODE 	_IO('K', 7 /*, int */)
+#define KDSKBMODE 	_IOWINT('K', 7)
 
 /* make tone */
-#define KDMKTONE	_IO('K', 8 /*, int */)
+#define KDMKTONE	_IOWINT('K', 8)
 
 /* see console.h for the definitions of the following ioctls */
-#if notdef
+#ifdef notdef
 #define KDGETMODE	_IOR('K', 9, int)
-#define KDSETMODE	_IO('K', 10 /*, int */)
-#define KDSBORDER	_IO('K', 13 /*, int */)
+#define KDSETMODE	_IOWINT('K', 10)
+#define KDSBORDER	_IOWINT('K', 13)
 #endif
 
 /* get/set keyboard lock state */
@@ -34,14 +34,14 @@
 #define ALKED		8		/* AltGr locked			*/
 #define LOCK_MASK	(CLKED | NLKED | SLKED | ALKED)
 #define KDGKBSTATE	_IOR('K', 19, int)
-#define KDSKBSTATE	_IO('K', 20 /*, int */)
+#define KDSKBSTATE	_IOWINT('K', 20)
 
 /* enable/disable I/O access */
 #define KDENABIO	_IO('K', 60)
 #define KDDISABIO	_IO('K', 61)
 
 /* make sound */
-#define KIOCSOUND	_IO('K', 63 /*, int */)
+#define KIOCSOUND	_IOWINT('K', 63)
 
 /* get keyboard model */
 #define KB_OTHER	0		/* keyboard not known 		*/
@@ -55,10 +55,10 @@
 #define LED_SCR		4		/* Scroll lock LED 		*/
 #define LED_MASK	(LED_CAP | LED_NUM | LED_SCR)
 #define KDGETLED	_IOR('K', 65, int)
-#define KDSETLED	_IO('K', 66 /*, int */)
+#define KDSETLED	_IOWINT('K', 66)
 
 /* set keyboard repeat rate (obsolete, use KDSETREPEAT below) */
-#define KDSETRAD	_IO('K', 67 /*, int */)
+#define KDSETRAD	_IOWINT('K', 67)
 
 struct keyboard_info {
 	int		kb_index;	/* kbdio index#			*/
@@ -75,7 +75,7 @@
 #define KBRELKBD	_IOW('K', 69, keyboard_info_t)	/* release keyboard */
 
 /* see console.h for the definition of the following ioctl */
-#if notdef
+#ifdef notdef
 #define KDRASTER	_IOW('K', 100, scr_size_t)
 #endif
 
@@ -216,7 +216,7 @@
 
 #define GETFKEY		_IOWR('k', 0, fkeyarg_t)
 #define SETFKEY		_IOWR('k', 1, fkeyarg_t)
-#if notdef		/* see console.h */
+#ifdef notdef		/* see console.h */
 #define GIO_SCRNMAP	_IOR('k', 2, scrmap_t)
 #define PIO_SCRNMAP	_IOW('k', 3, scrmap_t)
 #endif
Index: pcpu.h
===================================================================
RCS file: /home/cvs/src/sys/sys/pcpu.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/pcpu.h -L sys/sys/pcpu.h -u -r1.1.1.1 -r1.2
--- sys/sys/pcpu.h
+++ sys/sys/pcpu.h
@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/pcpu.h,v 1.16 2005/04/26 17:07:40 jhb Exp $
+ * $FreeBSD: src/sys/sys/pcpu.h,v 1.22 2007/06/06 07:35:08 davidxu Exp $
  */
 
 #ifndef _SYS_PCPU_H_
@@ -60,7 +60,7 @@
 	struct thread	*pc_fpcurthread;	/* Fp state owner */
 	struct thread	*pc_deadthread;		/* Zombie thread or NULL */
 	struct pcb	*pc_curpcb;		/* Current pcb */
-	struct bintime	pc_switchtime;	
+	uint64_t	pc_switchtime;	
 	int		pc_switchticks;
 	u_int		pc_cpuid;		/* This cpu number */
 	cpumask_t	pc_cpumask;		/* This cpu mask */
@@ -87,21 +87,6 @@
 #endif
 
 /*
- * MI PCPU support functions
- *
- * PCPU_LAZY_INC() -	Lazily increment a per-cpu stats counter, without
- *			guarenteeing atomicity or even necessarily consistency.
- *
- *			XXX we need to create MD primitives to support
- *			this to guarentee at least some level of consistency,
- *			i.e., to prevent us from totally corrupting the 
- *			counters due to preemption in a multi-instruction
- *			increment sequence for architectures that do not
- *			support single-instruction memory increments.
- */
-#define PCPU_LAZY_INC(var)	(++*PCPU_PTR(var))
-
-/*
  * Machine dependent callouts.  cpu_pcpu_init() is responsible for
  * initializing machine dependent fields of struct pcpu, and
  * db_show_mdpcpu() is responsible for handling machine dependent
Index: socketvar.h
===================================================================
RCS file: /home/cvs/src/sys/sys/socketvar.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/socketvar.h -L sys/sys/socketvar.h -u -r1.2 -r1.3
--- sys/sys/socketvar.h
+++ sys/sys/socketvar.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)socketvar.h	8.3 (Berkeley) 2/19/95
- * $FreeBSD: src/sys/sys/socketvar.h,v 1.141 2005/07/09 12:24:40 jhb Exp $
+ * $FreeBSD: src/sys/sys/socketvar.h,v 1.158.4.1 2008/02/02 12:44:14 rwatson Exp $
  */
 
 #ifndef _SYS_SOCKETVAR_H_
@@ -37,6 +37,7 @@
 #include <sys/selinfo.h>		/* for struct selinfo */
 #include <sys/_lock.h>
 #include <sys/_mutex.h>
+#include <sys/_sx.h>
 
 /*
  * Kernel structure per socket.
@@ -77,7 +78,7 @@
  * We allow connections to queue up based on current queue lengths
  * and limit on number of queued connections for this socket.
  */
-	struct	socket *so_head;	/* (e) back pointer to accept socket */
+	struct	socket *so_head;	/* (e) back pointer to listen socket */
 	TAILQ_HEAD(, socket) so_incomp;	/* (e) queue of partial unaccepted connections */
 	TAILQ_HEAD(, socket) so_comp;	/* (e) queue of complete unaccepted connections */
 	TAILQ_ENTRY(socket) so_list;	/* (e) list of unaccepted connections */
@@ -97,12 +98,15 @@
 	struct sockbuf {
 		struct	selinfo sb_sel;	/* process selecting read/write */
 		struct	mtx sb_mtx;	/* sockbuf lock */
+		struct	sx sb_sx;	/* prevent I/O interlacing */
 		short	sb_state;	/* (c/d) socket state on sockbuf */
 #define	sb_startzero	sb_mb
 		struct	mbuf *sb_mb;	/* (c/d) the mbuf chain */
 		struct	mbuf *sb_mbtail; /* (c/d) the last mbuf in the chain */
 		struct	mbuf *sb_lastrecord;	/* (c/d) first mbuf of last
 						 * record in socket buffer */
+		struct	mbuf *sb_sndptr; /* (c/d) pointer into mbuf chain */
+		u_int	sb_sndptroff;	/* (c/d) byte offset of ptr into chain */
 		u_int	sb_cc;		/* (c/d) actual chars in buffer */
 		u_int	sb_hiwat;	/* (c/d) max actual char count */
 		u_int	sb_mbcnt;	/* (c/d) chars of mbufs used */
@@ -119,23 +123,21 @@
 /*
  * Constants for sb_flags field of struct sockbuf.
  */
-#define	SB_LOCK		0x01		/* lock on data queue */
-#define	SB_WANT		0x02		/* someone is waiting to lock */
 #define	SB_WAIT		0x04		/* someone is waiting for data/space */
 #define	SB_SEL		0x08		/* someone is selecting */
 #define	SB_ASYNC	0x10		/* ASYNC I/O, need signals */
 #define	SB_UPCALL	0x20		/* someone wants an upcall */
 #define	SB_NOINTR	0x40		/* operations not interruptible */
-#define SB_AIO		0x80		/* AIO operations queued */
-#define SB_KNOTE	0x100		/* kernel note attached */
-#define SB_AUTOSIZE	0x800		/* automatically size socket buffer */
+#define	SB_AIO		0x80		/* AIO operations queued */
+#define	SB_KNOTE	0x100		/* kernel note attached */
+#define	SB_AUTOSIZE	0x800		/* automatically size socket buffer */
 
 	void	(*so_upcall)(struct socket *, void *, int);
 	void	*so_upcallarg;
 	struct	ucred *so_cred;		/* (a) user credentials */
 	struct	label *so_label;	/* (b) MAC label for socket */
 	struct	label *so_peerlabel;	/* (b) cached MAC label for peer */
-	/* NB: generation count must not be first; easiest to make it last. */
+	/* NB: generation count must not be first. */
 	so_gen_t so_gencnt;		/* (h) generation count */
 	void	*so_emuldata;		/* (b) private data for emulators */
  	struct so_accf {
@@ -209,6 +211,14 @@
 #define	SS_ASYNC		0x0200	/* async i/o notify */
 #define	SS_ISCONFIRMING		0x0400	/* deciding to accept connection req */
 #define	SS_ISDISCONNECTED	0x2000	/* socket disconnected from peer */
+/*
+ * Protocols can mark a socket as SS_PROTOREF to indicate that, following
+ * pru_detach, they still want the socket to persist, and will free it
+ * themselves when they are done.  Protocols should only ever call sofree()
+ * following setting this flag in pru_detach(), and never otherwise, as
+ * sofree() bypasses socket reference counting.
+ */
+#define	SS_PROTOREF		0x4000	/* strong protocol reference */
 
 /*
  * Socket state bits now stored in the socket buffer state field.
@@ -262,6 +272,13 @@
  */
 
 /*
+ * Flags to sblock().
+ */
+#define	SBL_WAIT	0x00000001	/* Wait if not immediately available. */
+#define	SBL_NOINTR	0x00000002	/* Force non-interruptible sleep. */
+#define	SBL_VALID	(SBL_WAIT | SBL_NOINTR)
+
+/*
  * Do we need to notify the other side when I/O is possible?
  */
 #define	sb_notify(sb)	(((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \
@@ -298,8 +315,7 @@
 /* adjust counters in sb reflecting allocation of m */
 #define	sballoc(sb, m) { \
 	(sb)->sb_cc += (m)->m_len; \
-	if ((m)->m_type != MT_DATA && (m)->m_type != MT_HEADER && \
-	    (m)->m_type != MT_OOBDATA) \
+	if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \
 		(sb)->sb_ctl += (m)->m_len; \
 	(sb)->sb_mbcnt += MSIZE; \
 	if ((m)->m_flags & M_EXT) \
@@ -309,32 +325,18 @@
 /* adjust counters in sb reflecting freeing of m */
 #define	sbfree(sb, m) { \
 	(sb)->sb_cc -= (m)->m_len; \
-	if ((m)->m_type != MT_DATA && (m)->m_type != MT_HEADER && \
-	    (m)->m_type != MT_OOBDATA) \
+	if ((m)->m_type != MT_DATA && (m)->m_type != MT_OOBDATA) \
 		(sb)->sb_ctl -= (m)->m_len; \
 	(sb)->sb_mbcnt -= MSIZE; \
 	if ((m)->m_flags & M_EXT) \
 		(sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
-}
-
-/*
- * Set lock on sockbuf sb; sleep if lock is already held.
- * Unless SB_NOINTR is set on sockbuf, sleep is interruptible.
- * Returns error without lock if sleep is interrupted.
- */
-#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \
-		(((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \
-		((sb)->sb_flags |= SB_LOCK), 0)
-
-/* release lock on sockbuf sb */
-#define	sbunlock(sb) do { \
-	SOCKBUF_LOCK_ASSERT(sb); \
-	(sb)->sb_flags &= ~SB_LOCK; \
-	if ((sb)->sb_flags & SB_WANT) { \
-		(sb)->sb_flags &= ~SB_WANT; \
-		wakeup(&(sb)->sb_flags); \
+	if ((sb)->sb_sndptr == (m)) { \
+		(sb)->sb_sndptr = NULL; \
+		(sb)->sb_sndptroff = 0; \
 	} \
-} while (0)
+	if ((sb)->sb_sndptroff != 0) \
+		(sb)->sb_sndptroff -= (m)->m_len; \
+}
 
 /*
  * soref()/sorele() ref-count the socket structure.  Note that you must
@@ -472,26 +474,27 @@
 void	sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n);
 struct mbuf *
 	sbcreatecontrol(caddr_t p, int size, int type, int level);
+void	sbdestroy(struct sockbuf *sb, struct socket *so);
 void	sbdrop(struct sockbuf *sb, int len);
 void	sbdrop_locked(struct sockbuf *sb, int len);
 void	sbdroprecord(struct sockbuf *sb);
 void	sbdroprecord_locked(struct sockbuf *sb);
 void	sbflush(struct sockbuf *sb);
 void	sbflush_locked(struct sockbuf *sb);
-void	sbinsertoob(struct sockbuf *sb, struct mbuf *m0);
-void	sbinsertoob_locked(struct sockbuf *sb, struct mbuf *m0);
 void	sbrelease(struct sockbuf *sb, struct socket *so);
 void	sbrelease_locked(struct sockbuf *sb, struct socket *so);
 int	sbreserve(struct sockbuf *sb, u_long cc, struct socket *so,
 	    struct thread *td);
 int	sbreserve_locked(struct sockbuf *sb, u_long cc, struct socket *so,
 	    struct thread *td);
+struct mbuf *
+	sbsndptr(struct sockbuf *sb, u_int off, u_int len, u_int *moff);
 void	sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb);
 int	sbwait(struct sockbuf *sb);
-int	sb_lock(struct sockbuf *sb);
-int	soabort(struct socket *so);
+int	sblock(struct sockbuf *sb, int flags);
+void	sbunlock(struct sockbuf *sb);
+void	soabort(struct socket *so);
 int	soaccept(struct socket *so, struct sockaddr **nam);
-struct	socket *soalloc(int mflags);
 int	socheckuid(struct socket *so, uid_t uid);
 int	sobind(struct socket *so, struct sockaddr *nam, struct thread *td);
 void	socantrcvmore(struct socket *so);
@@ -504,7 +507,6 @@
 int	socow_setup(struct mbuf *m0, struct uio *uio);
 int	socreate(int dom, struct socket **aso, int type, int proto,
 	    struct ucred *cred, struct thread *td);
-void	sodealloc(struct socket *so);
 int	sodisconnect(struct socket *so);
 struct	sockaddr *sodupsockaddr(const struct sockaddr *sa, int mflags);
 void	sofree(struct socket *so);
@@ -515,7 +517,7 @@
 void	soisdisconnected(struct socket *so);
 void	soisdisconnecting(struct socket *so);
 int	solisten(struct socket *so, int backlog, struct thread *td);
-void	solisten_proto(struct socket *so);
+void	solisten_proto(struct socket *so, int backlog);
 int	solisten_proto_check(struct socket *so);
 struct socket *
 	sonewconn(struct socket *head, int connstatus);
@@ -529,13 +531,24 @@
 
 int	sopoll(struct socket *so, int events, struct ucred *active_cred,
 	    struct thread *td);
+int	sopoll_generic(struct socket *so, int events,
+	    struct ucred *active_cred, struct thread *td);
 int	soreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio,
 	    struct mbuf **mp0, struct mbuf **controlp, int *flagsp);
+int	soreceive_generic(struct socket *so, struct sockaddr **paddr,
+	    struct uio *uio, struct mbuf **mp0, struct mbuf **controlp,
+	    int *flagsp);
 int	soreserve(struct socket *so, u_long sndcc, u_long rcvcc);
 void	sorflush(struct socket *so);
 int	sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
 	    struct mbuf *top, struct mbuf *control, int flags,
 	    struct thread *td);
+int	sosend_dgram(struct socket *so, struct sockaddr *addr,
+	    struct uio *uio, struct mbuf *top, struct mbuf *control,
+	    int flags, struct thread *td);
+int	sosend_generic(struct socket *so, struct sockaddr *addr,
+	    struct uio *uio, struct mbuf *top, struct mbuf *control,
+	    int flags, struct thread *td);
 int	sosetopt(struct socket *so, struct sockopt *sopt);
 int	soshutdown(struct socket *so, int how);
 void	sotoxsocket(struct socket *so, struct xsocket *xso);
Index: module.h
===================================================================
RCS file: /home/cvs/src/sys/sys/module.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/module.h -L sys/sys/module.h -u -r1.1.1.1 -r1.2
--- sys/sys/module.h
+++ sys/sys/module.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/module.h,v 1.21 2004/07/13 19:36:59 phk Exp $
+ * $FreeBSD: src/sys/sys/module.h,v 1.22 2006/04/17 19:44:44 jhb Exp $
  */
 
 #ifndef _SYS_MODULE_H_
@@ -147,6 +147,7 @@
 int	module_getid(module_t);
 module_t	module_getfnext(module_t);
 void	module_setspecific(module_t, modspecific_t *);
+struct linker_file *module_file(module_t);
 
 #ifdef	MOD_DEBUG
 extern int mod_debug;
Index: user.h
===================================================================
RCS file: /home/cvs/src/sys/sys/user.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/user.h -L sys/sys/user.h -u -r1.1.1.1 -r1.2
--- sys/sys/user.h
+++ sys/sys/user.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)user.h	8.2 (Berkeley) 9/23/93
- * $FreeBSD: src/sys/sys/user.h,v 1.66 2005/06/09 19:09:02 gad Exp $
+ * $FreeBSD: src/sys/sys/user.h,v 1.70 2007/09/17 05:27:21 jeff Exp $
  */
 
 #ifndef _SYS_USER_H_
@@ -82,14 +82,11 @@
 #define	KI_NSPARE_LONG	12
 #define	KI_NSPARE_PTR	7
 
-#ifdef __alpha__
-#define	KINFO_PROC_SIZE	1088
-#endif
 #ifdef __amd64__
 #define	KINFO_PROC_SIZE	1088
 #endif
 #ifdef __arm__
-#define	KINFO_PROC_SIZE	768		/* value has not been tested... */
+#define	KINFO_PROC_SIZE	792
 #endif
 #ifdef __ia64__
 #define	KINFO_PROC_SIZE 1088
@@ -109,7 +106,7 @@
 
 #define	WMESGLEN	8		/* size of returned wchan message */
 #define	LOCKNAMELEN	8		/* size of returned lock name */
-#define	OCOMMLEN	16		/* size of returned ki_ocomm name */
+#define	OCOMMLEN	16		/* size of returned thread name */
 #define	COMMLEN		19		/* size of returned ki_comm name */
 #define	KI_EMULNAMELEN	16		/* size of returned ki_emul */
 #define	KI_NGROUPS	16		/* number of groups in ki_groups */
@@ -172,7 +169,7 @@
 	char	ki_rqindex;		/* Run queue index */
 	u_char	ki_oncpu;		/* Which cpu we are on */
 	u_char	ki_lastcpu;		/* Last cpu we were on */
-	char	ki_ocomm[OCOMMLEN+1];	/* command name */
+	char	ki_ocomm[OCOMMLEN+1];	/* thread name */
 	char	ki_wmesg[WMESGLEN+1];	/* wchan message */
 	char	ki_login[LOGNAMELEN+1];	/* setlogin name */
 	char	ki_lockname[LOCKNAMELEN+1]; /* lock name */
@@ -210,6 +207,12 @@
 #define	ki_childstime	ki_rusage_ch.ru_stime
 #define	ki_childutime	ki_rusage_ch.ru_utime
 
+/*
+ *  Legacy PS_ flag.  This moved to p_flag but is maintained for
+ *  compatibility.
+ */
+#define	PS_INMEM	0x00001		/* Loaded into memory. */
+
 /* ki_sessflag values */
 #define	KI_CTTY		0x00000001	/* controlling tty vnode active */
 #define	KI_SLEADER	0x00000002	/* session leader */
Index: syscall.mk
===================================================================
RCS file: /home/cvs/src/sys/sys/syscall.mk,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/syscall.mk -L sys/sys/syscall.mk -u -r1.2 -r1.3
--- sys/sys/syscall.mk
+++ sys/sys/syscall.mk
@@ -1,7 +1,7 @@
 # FreeBSD system call names.
 # DO NOT EDIT-- this file is automatically generated.
-# $FreeBSD: src/sys/sys/syscall.mk,v 1.133.2.2 2006/03/17 01:47:33 rwatson Exp $
-# created from FreeBSD: src/sys/kern/syscalls.master,v 1.198.2.2 2006/03/17 01:47:06 rwatson Exp 
+# $FreeBSD: src/sys/sys/syscall.mk,v 1.166 2007/08/16 05:32:26 davidxu Exp $
+# created from FreeBSD: src/sys/kern/syscalls.master,v 1.232 2007/07/04 22:47:37 peter Exp 
 MIASM =  \
 	syscall.o \
 	exit.o \
@@ -19,6 +19,7 @@
 	chmod.o \
 	chown.o \
 	break.o \
+	freebsd4_getfsstat.o \
 	getpid.o \
 	mount.o \
 	unmount.o \
@@ -107,6 +108,8 @@
 	setsid.o \
 	quotactl.o \
 	nfssvc.o \
+	freebsd4_statfs.o \
+	freebsd4_fstatfs.o \
 	lgetfh.o \
 	getfh.o \
 	getdomainname.o \
@@ -117,8 +120,8 @@
 	semsys.o \
 	msgsys.o \
 	shmsys.o \
-	pread.o \
-	pwrite.o \
+	freebsd6_pread.o \
+	freebsd6_pwrite.o \
 	ntp_adjtime.o \
 	setgid.o \
 	setegid.o \
@@ -131,11 +134,11 @@
 	getrlimit.o \
 	setrlimit.o \
 	getdirentries.o \
-	mmap.o \
+	freebsd6_mmap.o \
 	__syscall.o \
-	lseek.o \
-	truncate.o \
-	ftruncate.o \
+	freebsd6_lseek.o \
+	freebsd6_truncate.o \
+	freebsd6_ftruncate.o \
 	__sysctl.o \
 	mlock.o \
 	munlock.o \
@@ -157,6 +160,11 @@
 	clock_gettime.o \
 	clock_settime.o \
 	clock_getres.o \
+	ktimer_create.o \
+	ktimer_delete.o \
+	ktimer_settime.o \
+	ktimer_gettime.o \
+	ktimer_getoverrun.o \
 	nanosleep.o \
 	ntp_gettime.o \
 	minherit.o \
@@ -164,6 +172,9 @@
 	openbsd_poll.o \
 	issetugid.o \
 	lchown.o \
+	aio_read.o \
+	aio_write.o \
+	lio_listio.o \
 	getdents.o \
 	lchmod.o \
 	netbsd_lchown.o \
@@ -174,6 +185,7 @@
 	nlstat.o \
 	preadv.o \
 	pwritev.o \
+	freebsd4_fhstatfs.o \
 	fhopen.o \
 	fhstat.o \
 	modnext.o \
@@ -193,9 +205,9 @@
 	aio_suspend.o \
 	aio_cancel.o \
 	aio_error.o \
-	aio_read.o \
-	aio_write.o \
-	lio_listio.o \
+	oaio_read.o \
+	oaio_write.o \
+	olio_listio.o \
 	yield.o \
 	mlockall.o \
 	munlockall.o \
@@ -209,11 +221,14 @@
 	sched_get_priority_min.o \
 	sched_rr_get_interval.o \
 	utrace.o \
+	freebsd4_sendfile.o \
 	kldsym.o \
 	jail.o \
 	sigprocmask.o \
 	sigsuspend.o \
+	freebsd4_sigaction.o \
 	sigpending.o \
+	freebsd4_sigreturn.o \
 	sigtimedwait.o \
 	sigwaitinfo.o \
 	__acl_get_file.o \
@@ -312,4 +327,26 @@
 	setaudit_addr.o \
 	auditctl.o \
 	_umtx_op.o \
-	thr_new.o
+	thr_new.o \
+	sigqueue.o \
+	kmq_open.o \
+	kmq_setattr.o \
+	kmq_timedreceive.o \
+	kmq_timedsend.o \
+	kmq_notify.o \
+	kmq_unlink.o \
+	abort2.o \
+	thr_set_name.o \
+	aio_fsync.o \
+	rtprio_thread.o \
+	sctp_peeloff.o \
+	sctp_generic_sendmsg.o \
+	sctp_generic_sendmsg_iov.o \
+	sctp_generic_recvmsg.o \
+	pread.o \
+	pwrite.o \
+	mmap.o \
+	lseek.o \
+	truncate.o \
+	ftruncate.o \
+	thr_kill2.o
Index: mutex.h
===================================================================
RCS file: /home/cvs/src/sys/sys/mutex.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/mutex.h -L sys/sys/mutex.h -u -r1.1.1.2 -r1.2
--- sys/sys/mutex.h
+++ sys/sys/mutex.h
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  *
  *	from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $
- * $FreeBSD: src/sys/sys/mutex.h,v 1.79.2.2 2005/08/05 20:21:46 jhb Exp $
+ * $FreeBSD: src/sys/sys/mutex.h,v 1.101.2.1 2007/11/21 02:21:55 attilio Exp $
  */
 
 #ifndef _SYS_MUTEX_H_
@@ -39,6 +39,7 @@
 
 #ifdef _KERNEL
 #include <sys/pcpu.h>
+#include <sys/lock_profile.h>
 #include <machine/atomic.h>
 #include <machine/cpufunc.h>
 #endif	/* _KERNEL_ */
@@ -56,6 +57,7 @@
 #define MTX_SPIN	0x00000001	/* Spin lock (disables interrupts) */
 #define MTX_RECURSE	0x00000004	/* Option: lock allowed to recurse */
 #define	MTX_NOWITNESS	0x00000008	/* Don't do any witness checking. */
+#define MTX_NOPROFILE   0x00000020	/* Don't profile this lock */
 
 /*
  * Option flags passed to certain lock/unlock routines, through the use
@@ -71,7 +73,12 @@
 #define	MTX_RECURSED	0x00000001	/* lock recursed (for MTX_DEF only) */
 #define	MTX_CONTESTED	0x00000002	/* lock contested (for MTX_DEF only) */
 #define MTX_UNOWNED	0x00000004	/* Cookie for free mutex */
-#define	MTX_FLAGMASK	~(MTX_RECURSED | MTX_CONTESTED)
+#define	MTX_FLAGMASK	(MTX_RECURSED | MTX_CONTESTED | MTX_UNOWNED)
+
+/*
+ * Value stored in mutex->mtx_lock to denote a destroyed mutex.
+ */
+#define	MTX_DESTROYED	(MTX_CONTESTED | MTX_UNOWNED)
 
 #endif	/* _KERNEL */
 
@@ -118,6 +125,14 @@
 #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
 void	_mtx_assert(struct mtx *m, int what, const char *file, int line);
 #endif
+void	_thread_lock_flags(struct thread *, int, const char *, int);
+
+#define	thread_lock(tdp)						\
+    _thread_lock_flags((tdp), 0, __FILE__, __LINE__)
+#define	thread_lock_flags(tdp, opt)					\
+    _thread_lock_flags((tdp), (opt), __FILE__, __LINE__)
+#define	thread_unlock(tdp)						\
+       mtx_unlock_spin((tdp)->td_lock)
 
 /*
  * We define our machine-independent (unoptimized) mutex micro-operations
@@ -149,9 +164,11 @@
 #ifndef _get_sleep_lock
 #define _get_sleep_lock(mp, tid, opts, file, line) do {			\
 	uintptr_t _tid = (uintptr_t)(tid);				\
-									\
-	if (!_obtain_lock((mp), _tid))					\
+	if (!_obtain_lock((mp), _tid)) {				\
 		_mtx_lock_sleep((mp), _tid, (opts), (file), (line));	\
+	} else 								\
+              	lock_profile_obtain_lock_success(&(mp)->lock_object, 0,	\
+		    0, (file), (line));					\
 } while (0)
 #endif
 
@@ -164,16 +181,18 @@
  */
 #ifndef _get_spin_lock
 #ifdef SMP
-#define _get_spin_lock(mp, tid, opts, file, line) do {			\
+#define _get_spin_lock(mp, tid, opts, file, line) do {	\
 	uintptr_t _tid = (uintptr_t)(tid);				\
-									\
 	spinlock_enter();						\
 	if (!_obtain_lock((mp), _tid)) {				\
 		if ((mp)->mtx_lock == _tid)				\
 			(mp)->mtx_recurse++;				\
-		else							\
+		else {							\
 			_mtx_lock_spin((mp), _tid, (opts), (file), (line)); \
-	}								\
+		}							\
+	} else 								\
+              	lock_profile_obtain_lock_success(&(mp)->lock_object, 0,	\
+		    0, (file), (line));					\
 } while (0)
 #else /* SMP */
 #define _get_spin_lock(mp, tid, opts, file, line) do {			\
@@ -218,9 +237,11 @@
 #define _rel_spin_lock(mp) do {						\
 	if (mtx_recursed((mp)))						\
 		(mp)->mtx_recurse--;					\
-	else								\
+	else {								\
+		lock_profile_release_lock(&(mp)->lock_object);          \
 		_release_lock_quick((mp));				\
-	spinlock_exit();						\
+	}                                                               \
+	spinlock_exit();				                \
 } while (0)
 #else /* SMP */
 #define _rel_spin_lock(mp) do {						\
@@ -320,19 +341,22 @@
 #define mtx_trylock_flags(m, opts)					\
 	_mtx_trylock((m), (opts), LOCK_FILE, LOCK_LINE)
 
-#define	mtx_initialized(m)	((m)->mtx_object.lo_flags & LO_INITIALIZED)
+#define	mtx_sleep(chan, mtx, pri, wmesg, timo)				\
+	_sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo))
+
+#define	mtx_initialized(m)	lock_initalized(&(m)->lock_object)
 
-#define mtx_owned(m)	(((m)->mtx_lock & MTX_FLAGMASK) == (uintptr_t)curthread)
+#define mtx_owned(m)	(((m)->mtx_lock & ~MTX_FLAGMASK) == (uintptr_t)curthread)
 
 #define mtx_recursed(m)	((m)->mtx_recurse != 0)
 
-#define mtx_name(m)	((m)->mtx_object.lo_name)
+#define mtx_name(m)	((m)->lock_object.lo_name)
 
 /*
  * Global locks.
  */
-extern struct mtx sched_lock;
 extern struct mtx Giant;
+extern struct mtx blocked_lock;
 
 /*
  * Giant lock manipulation and clean exit macros.
@@ -344,61 +368,28 @@
 #ifndef DROP_GIANT
 #define DROP_GIANT()							\
 do {									\
-	int _giantcnt;							\
+	int _giantcnt = 0;						\
 	WITNESS_SAVE_DECL(Giant);					\
 									\
-	if (mtx_owned(&Giant))						\
-		WITNESS_SAVE(&Giant.mtx_object, Giant);			\
-	for (_giantcnt = 0; mtx_owned(&Giant); _giantcnt++)		\
-		mtx_unlock(&Giant)
+	if (mtx_owned(&Giant)) {					\
+		WITNESS_SAVE(&Giant.lock_object, Giant);		\
+		for (_giantcnt = 0; mtx_owned(&Giant); _giantcnt++)	\
+			mtx_unlock(&Giant);				\
+	}
 
 #define PICKUP_GIANT()							\
-	mtx_assert(&Giant, MA_NOTOWNED);				\
-	while (_giantcnt--)						\
-		mtx_lock(&Giant);					\
-	if (mtx_owned(&Giant))						\
-		WITNESS_RESTORE(&Giant.mtx_object, Giant);		\
+	PARTIAL_PICKUP_GIANT();						\
 } while (0)
 
 #define PARTIAL_PICKUP_GIANT()						\
 	mtx_assert(&Giant, MA_NOTOWNED);				\
-	while (_giantcnt--)						\
-		mtx_lock(&Giant);					\
-	if (mtx_owned(&Giant))						\
-		WITNESS_RESTORE(&Giant.mtx_object, Giant)
+	if (_giantcnt > 0) {						\
+		while (_giantcnt--)					\
+			mtx_lock(&Giant);				\
+		WITNESS_RESTORE(&Giant.lock_object, Giant);		\
+	}
 #endif
 
-/*
- * Network MPSAFE temporary workarounds.  When debug_mpsafenet
- * is 1 the network is assumed to operate without Giant on the
- * input path and protocols that require Giant must collect it
- * on entry.  When 0 Giant is grabbed in the network interface
- * ISR's and in the netisr path and there is no need to grab
- * the Giant lock.  Note that, unlike GIANT_PICKUP() and
- * GIANT_DROP(), these macros directly wrap mutex operations
- * without special recursion handling.
- *
- * This mechanism is intended as temporary until everything of
- * importance is properly locked.  Note: the semantics for
- * NET_{LOCK,UNLOCK}_GIANT() are not the same as DROP_GIANT()
- * and PICKUP_GIANT(), as they are plain mutex operations
- * without a recursion counter.
- */
-extern	int debug_mpsafenet;		/* defined in net/netisr.c */
-#define	NET_LOCK_GIANT() do {						\
-	if (!debug_mpsafenet)						\
-		mtx_lock(&Giant);					\
-} while (0)
-#define	NET_UNLOCK_GIANT() do {						\
-	if (!debug_mpsafenet)						\
-		mtx_unlock(&Giant);					\
-} while (0)
-#define	NET_ASSERT_GIANT() do {						\
-	if (!debug_mpsafenet)						\
-		mtx_assert(&Giant, MA_OWNED);				\
-} while (0)
-#define	NET_CALLOUT_MPSAFE	(debug_mpsafenet ? CALLOUT_MPSAFE : 0)
-
 #define	UGAR(rval) do {							\
 	int _val = (rval);						\
 	mtx_unlock(&Giant);						\
@@ -430,10 +421,10 @@
  * _mtx_assert() must build.
  */
 #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
-#define MA_OWNED	0x01
-#define MA_NOTOWNED	0x02
-#define MA_RECURSED	0x04
-#define MA_NOTRECURSED	0x08
+#define MA_OWNED	LA_XLOCKED
+#define MA_NOTOWNED	LA_UNLOCKED
+#define MA_RECURSED	LA_RECURSED
+#define MA_NOTRECURSED	LA_NOTRECURSED
 #endif
 
 #ifdef INVARIANTS
Index: extattr.h
===================================================================
RCS file: /home/cvs/src/sys/sys/extattr.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/extattr.h -L sys/sys/extattr.h -u -r1.1.1.1 -r1.2
--- sys/sys/extattr.h
+++ sys/sys/extattr.h
@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/extattr.h,v 1.12 2003/06/04 04:04:24 rwatson Exp $
+ * $FreeBSD: src/sys/sys/extattr.h,v 1.18 2007/03/16 19:18:49 rwatson Exp $
  */
 /*
  * Developed by the TrustedBSD Project.
@@ -35,11 +35,28 @@
 #ifndef _SYS_EXTATTR_H_
 #define	_SYS_EXTATTR_H_
 
+/*
+ * Defined name spaces for extended attributes.  Numeric constants are passed
+ * via system calls, but a user-friendly string is also defined.
+ */
+#define	EXTATTR_NAMESPACE_EMPTY		0x00000000
+#define	EXTATTR_NAMESPACE_EMPTY_STRING	"empty"
 #define	EXTATTR_NAMESPACE_USER		0x00000001
 #define	EXTATTR_NAMESPACE_USER_STRING	"user"
 #define	EXTATTR_NAMESPACE_SYSTEM	0x00000002
 #define	EXTATTR_NAMESPACE_SYSTEM_STRING	"system"
 
+/*
+ * The following macro is designed to initialize an array that maps
+ * extended-attribute namespace values to their names, e.g.:
+ *
+ * char *extattr_namespace_names[] = EXTATTR_NAMESPACE_NAMES;
+ */
+#define EXTATTR_NAMESPACE_NAMES { \
+	EXTATTR_NAMESPACE_EMPTY_STRING, \
+	EXTATTR_NAMESPACE_USER_STRING, \
+	EXTATTR_NAMESPACE_SYSTEM_STRING }
+
 #ifdef _KERNEL
 
 #define	EXTATTR_MAXNAMELEN	NAME_MAX
Index: filedesc.h
===================================================================
RCS file: /home/cvs/src/sys/sys/filedesc.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/filedesc.h -L sys/sys/filedesc.h -u -r1.1.1.1 -r1.2
--- sys/sys/filedesc.h
+++ sys/sys/filedesc.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)filedesc.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/filedesc.h,v 1.72.2.1 2005/10/09 03:13:49 delphij Exp $
+ * $FreeBSD: src/sys/sys/filedesc.h,v 1.78 2007/05/31 11:51:52 kib Exp $
  */
 
 #ifndef _SYS_FILEDESC_H_
@@ -35,9 +35,9 @@
 
 #include <sys/queue.h>
 #include <sys/event.h>
+#include <sys/lock.h>
 #include <sys/priority.h>
-#include <sys/_lock.h>
-#include <sys/_mutex.h>
+#include <sys/sx.h>
 
 #include <machine/_limits.h>
 
@@ -60,10 +60,7 @@
 	u_short	fd_cmask;		/* mask for file creation */
 	u_short	fd_refcnt;		/* thread reference count */
 	u_short	fd_holdcnt;		/* hold count on structure + mutex */
-
-	struct	mtx fd_mtx;		/* protects members of this struct */
-	int	fd_locked;		/* long lock flag */
-	int	fd_wanted;		/* "" */
+	struct	sx fd_sx;		/* protects members of this struct */
 	struct	kqlist fd_kqlist;	/* list of kqueues on this filedesc */
 	int	fd_holdleaderscount;	/* block fdfree() for shared close() */
 	int	fd_holdleaderswakeup;	/* fdfree() needs wakeup */
@@ -96,61 +93,18 @@
 #ifdef _KERNEL
 
 /* Lock a file descriptor table. */
-#define	FILEDESC_LOCK(fd)								\
-	do {										\
-		mtx_lock(&(fd)->fd_mtx);						\
-		(fd)->fd_wanted++;							\
-		while ((fd)->fd_locked)							\
-			msleep(&(fd)->fd_locked, &(fd)->fd_mtx, PLOCK, "fdesc", 0);	\
-		(fd)->fd_locked = 2;							\
-		(fd)->fd_wanted--;							\
-		mtx_unlock(&(fd)->fd_mtx);						\
-	} while (0)
-
-#define	FILEDESC_UNLOCK(fd)								\
-	do {										\
-		mtx_lock(&(fd)->fd_mtx);						\
-		KASSERT((fd)->fd_locked == 2,						\
-		    ("fdesc locking mistake %d should be %d", (fd)->fd_locked, 2));	\
-		(fd)->fd_locked = 0;							\
-		if ((fd)->fd_wanted)							\
-			wakeup(&(fd)->fd_locked);					\
-		mtx_unlock(&(fd)->fd_mtx);						\
-	} while (0)
-
-#define	FILEDESC_LOCK_FAST(fd)								\
-	do {										\
-		mtx_lock(&(fd)->fd_mtx);						\
-		(fd)->fd_wanted++;							\
-		while ((fd)->fd_locked)							\
-			msleep(&(fd)->fd_locked, &(fd)->fd_mtx, PLOCK, "fdesc", 0);	\
-		(fd)->fd_locked = 1;							\
-		(fd)->fd_wanted--;							\
-	} while (0)
-
-#define	FILEDESC_UNLOCK_FAST(fd)							\
-	do {										\
-		KASSERT((fd)->fd_locked == 1,						\
-		    ("fdesc locking mistake %d should be %d", (fd)->fd_locked, 1));	\
-		(fd)->fd_locked = 0;							\
-		if ((fd)->fd_wanted)							\
-			wakeup(&(fd)->fd_locked);					\
-		mtx_unlock(&(fd)->fd_mtx);						\
-	} while (0)
-
-#ifdef INVARIANT_SUPPORT
-#define	FILEDESC_LOCK_ASSERT(fd, arg)							\
-	do {										\
-		if ((arg) == MA_OWNED)							\
-			KASSERT((fd)->fd_locked != 0, ("fdesc locking mistake"));	\
-		else									\
-			KASSERT((fd)->fd_locked == 0, ("fdesc locking mistake"));	\
-	} while (0)
-#else
-#define	FILEDESC_LOCK_ASSERT(fd, arg)
-#endif
-
-#define	FILEDESC_LOCK_DESC	"filedesc structure"
+#define	FILEDESC_LOCK_INIT(fdp)	sx_init(&(fdp)->fd_sx, "filedesc structure")
+#define	FILEDESC_LOCK_DESTROY(fdp)	sx_destroy(&(fdp)->fd_sx)
+#define	FILEDESC_LOCK(fdp)	(&(fdp)->fd_sx)
+#define	FILEDESC_XLOCK(fdp)	sx_xlock(&(fdp)->fd_sx)
+#define	FILEDESC_XUNLOCK(fdp)	sx_xunlock(&(fdp)->fd_sx)
+#define	FILEDESC_SLOCK(fdp)	sx_slock(&(fdp)->fd_sx)
+#define	FILEDESC_SUNLOCK(fdp)	sx_sunlock(&(fdp)->fd_sx)
+
+#define	FILEDESC_LOCK_ASSERT(fdp)	sx_assert(&(fdp)->fd_sx, SX_LOCKED | \
+					    SX_NOTRECURSED)
+#define	FILEDESC_XLOCK_ASSERT(fdp)	sx_assert(&(fdp)->fd_sx, SX_XLOCKED | \
+					    SX_NOTRECURSED)
 
 struct thread;
 
Index: syslimits.h
===================================================================
RCS file: /home/cvs/src/sys/sys/syslimits.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/syslimits.h -L sys/sys/syslimits.h -u -r1.1.1.1 -r1.2
--- sys/sys/syslimits.h
+++ sys/sys/syslimits.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)syslimits.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/syslimits.h,v 1.21 2005/03/02 21:33:29 joerg Exp $
+ * $FreeBSD: src/sys/sys/syslimits.h,v 1.23 2007/05/29 15:14:46 cognet Exp $
  */
 
 #ifndef _SYS_SYSLIMITS_H_
@@ -46,11 +46,7 @@
  * Do not add any new variables here.  (See the comment at the end of
  * the file for why.)
  */
-#if defined(__arm__) || defined(__powerpc__)
-#define	ARG_MAX			65536	/* max bytes for an exec function */
-#else
 #define	ARG_MAX			262144	/* max bytes for an exec function */
-#endif
 #ifndef CHILD_MAX
 #define	CHILD_MAX		   40	/* max simultaneous processes */
 #endif
Index: soundcard.h
===================================================================
RCS file: /home/cvs/src/sys/sys/soundcard.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/soundcard.h -L sys/sys/soundcard.h -u -r1.1.1.2 -r1.2
--- sys/sys/soundcard.h
+++ sys/sys/soundcard.h
@@ -3,7 +3,7 @@
  */
 
 /*-
- * Copyright by Hannu Savolainen 1993
+ * Copyright by Hannu Savolainen 1993 / 4Front Technologies 1993-2006
  * Modified for the new FreeBSD sound driver by Luigi Rizzo, 1997
  *
  * Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,13 @@
  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/soundcard.h,v 1.44.2.1 2005/12/30 19:55:52 netchild Exp $
+ * $FreeBSD: src/sys/sys/soundcard.h,v 1.48 2006/11/26 11:55:48 netchild Exp $
+ */
+
+/*
+ * Unless coordinating changes with 4Front Technologies, do NOT make any
+ * modifications to ioctl commands, types, etc. that would break
+ * compatibility with the OSS API.
  */
 
 #ifndef _SYS_SOUNDCARD_H_
@@ -719,8 +725,6 @@
 	int caps;
 };
 
-#define MIDI_CAP_MPU401		1		/* MPU-401 intelligent mode */
-
 struct midi_info {
 	char		name[30];
 	int		device;		/* 0-N. INITIALIZE BEFORE CALLING */
@@ -1437,4 +1441,438 @@
 #define SOUND_PCM_MAPINBUF	SNDCTL_DSP_MAPINBUF
 #define SOUND_PCM_MAPOUTBUF	SNDCTL_DSP_MAPOUTBUF
 
+/***********************************************************************/
+
+/**
+ * XXX OSSv4 defines -- some bits taken straight out of the new
+ * sys/soundcard.h bundled with recent OSS releases.
+ *
+ * NB:  These macros and structures will be reorganized and inserted
+ * 	in appropriate places throughout this file once the code begins
+ * 	to take shape.
+ *
+ * @todo reorganize layout more like the 4Front version
+ * @todo ask about maintaining __SIOWR vs. _IOWR ioctl cmd defines
+ */
+
+/**
+ * @note The @c OSSV4_EXPERIMENT macro is meant to wrap new development code
+ * in the sound system relevant to adopting 4Front's OSSv4 specification.
+ * Users should not enable this!  Really!
+ */
+#if 0
+# define OSSV4_EXPERIMENT 1
+#else
+# undef OSSV4_EXPERIMENT
+#endif
+
+#ifdef SOUND_VERSION
+# undef SOUND_VERSION
+# define SOUND_VERSION	0x040000
+#endif	/* !SOUND_VERSION */
+
+#define OSS_LONGNAME_SIZE	64
+#define OSS_LABEL_SIZE		16
+#define OSS_DEVNODE_SIZE        32
+typedef char oss_longname_t[OSS_LONGNAME_SIZE];
+typedef char oss_label_t[OSS_LABEL_SIZE];
+typedef char oss_devnode_t[OSS_DEVNODE_SIZE];
+
+typedef struct audio_errinfo
+{
+	int		play_underruns;
+	int		rec_overruns;
+	unsigned int	play_ptradjust;
+	unsigned int	rec_ptradjust;
+	int		play_errorcount;
+	int		rec_errorcount;
+	int		play_lasterror;
+	int		rec_lasterror;
+	long		play_errorparm;
+	long		rec_errorparm;
+	int		filler[16];
+} audio_errinfo;
+
+#define SNDCTL_DSP_GETPLAYVOL           _IOR ('P', 24, int)
+#define SNDCTL_DSP_SETPLAYVOL           _IOWR('P', 24, int)
+#define SNDCTL_DSP_GETERROR             _IOR ('P', 25, audio_errinfo)
+
+
+/*
+ ****************************************************************************
+ * Sync groups for audio devices
+ */
+typedef struct oss_syncgroup
+{
+  int id;
+  int mode;
+  int filler[16];
+} oss_syncgroup;
+
+#define SNDCTL_DSP_SYNCGROUP            _IOWR('P', 28, oss_syncgroup)
+#define SNDCTL_DSP_SYNCSTART            _IOW ('P', 29, int)
+
+/*
+ **************************************************************************
+ * "cooked" mode enables software based conversions for sample rate, sample
+ * format (bits) and number of channels (mono/stereo). These conversions are
+ * required with some devices that support only one sample rate or just stereo
+ * to let the applications to use other formats. The cooked mode is enabled by
+ * default. However it's necessary to disable this mode when mmap() is used or
+ * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an
+ * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_
+ * since normally this call will return erno=EINVAL.
+ *
+ * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing
+ * anything else. Otherwise the call will not have any effect.
+ */
+#define SNDCTL_DSP_COOKEDMODE           _IOW ('P', 30, int)
+
+/*
+ **************************************************************************
+ * SNDCTL_DSP_SILENCE and SNDCTL_DSP_SKIP are new calls in OSS 3.99.0
+ * that can be used to implement pause/continue during playback (no effect
+ * on recording).
+ */
+#define SNDCTL_DSP_SILENCE              _IO  ('P', 31)
+#define SNDCTL_DSP_SKIP                 _IO  ('P', 32)
+
+/*
+ ****************************************************************************
+ * Abort transfer (reset) functions for input and output
+ */
+#define SNDCTL_DSP_HALT_INPUT		_IO  ('P', 33)
+#define SNDCTL_DSP_RESET_INPUT	SNDCTL_DSP_HALT_INPUT	/* Old name */
+#define SNDCTL_DSP_HALT_OUTPUT		_IO  ('P', 34)
+#define SNDCTL_DSP_RESET_OUTPUT	SNDCTL_DSP_HALT_OUTPUT	/* Old name */
+
+/*
+ ****************************************************************************
+ * Low water level control
+ */
+#define SNDCTL_DSP_LOW_WATER		_IOW ('P', 34, int)
+
+/** @todo Get rid of OSS_NO_LONG_LONG references? */
+
+/*
+ ****************************************************************************
+ * 64 bit pointer support. Only available in environments that support
+ * the 64 bit (long long) integer type.
+ */
+#ifndef OSS_NO_LONG_LONG
+typedef struct
+{
+  long long samples;
+  int fifo_samples;
+  int filler[32];		/* For future use */
+} oss_count_t;
+
+#define SNDCTL_DSP_CURRENT_IPTR		_IOR ('P', 35, oss_count_t)
+#define SNDCTL_DSP_CURRENT_OPTR		_IOR ('P', 36, oss_count_t)
+#endif
+
+/*
+ ****************************************************************************
+ * Interface for selecting recording sources and playback output routings.
+ */
+#define SNDCTL_DSP_GET_RECSRC_NAMES     _IOR ('P', 37, oss_mixer_enuminfo)
+#define SNDCTL_DSP_GET_RECSRC           _IOR ('P', 38, int)
+#define SNDCTL_DSP_SET_RECSRC           _IOWR('P', 38, int)
+
+#define SNDCTL_DSP_GET_PLAYTGT_NAMES    _IOR ('P', 39, oss_mixer_enuminfo)
+#define SNDCTL_DSP_GET_PLAYTGT          _IOR ('P', 40, int)
+#define SNDCTL_DSP_SET_PLAYTGT          _IOWR('P', 40, int)
+#define SNDCTL_DSP_GETRECVOL            _IOR ('P', 41, int)
+#define SNDCTL_DSP_SETRECVOL            _IOWR('P', 41, int)
+
+/*
+ ***************************************************************************
+ * Some calls for setting the channel assignment with multi channel devices
+ * (see the manual for details).                                                 */
+#define SNDCTL_DSP_GET_CHNORDER         _IOR ('P', 42, unsigned long long)
+#define SNDCTL_DSP_SET_CHNORDER         _IOWR('P', 42, unsigned long long)
+#       define CHID_UNDEF       0
+#       define CHID_L           1                                               #       define CHID_R           2
+#       define CHID_C           3
+#       define CHID_LFE         4
+#       define CHID_LS          5
+#       define CHID_RS          6
+#       define CHID_LR          7
+#       define CHID_RR          8
+#define CHNORDER_UNDEF          0x0000000000000000ULL
+#define CHNORDER_NORMAL         0x0000000087654321ULL
+
+#define MAX_PEAK_CHANNELS	128
+typedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS];
+#define SNDCTL_DSP_GETIPEAKS		_IOR('P', 43, oss_peaks_t)
+#define SNDCTL_DSP_GETOPEAKS		_IOR('P', 44, oss_peaks_t)
+#define SNDCTL_DSP_POLICY               _IOW('P', 45, int)    /* See the manual */
+
+/*
+ * OSS_SYSIFO is obsolete. Use SNDCTL_SYSINFO insteads.
+ */
+#define OSS_GETVERSION                  _IOR ('M', 118, int)
+
+/**
+ * @brief	Argument for SNDCTL_SYSINFO ioctl.
+ *
+ * For use w/ the SNDCTL_SYSINFO ioctl available on audio (/dev/dsp*),
+ * mixer, and MIDI devices.
+ */
+typedef struct oss_sysinfo
+{
+	char	product[32];	/* For example OSS/Free, OSS/Linux or
+				   OSS/Solaris */
+	char	version[32];	/* For example 4.0a */
+	int	versionnum;	/* See OSS_GETVERSION */
+	char	options[128];	/* Reserved */
+
+	int	numaudios;	/* # of audio/dsp devices */
+	int	openedaudio[8];	/* Bit mask telling which audio devices
+				   are busy */
+
+	int	numsynths;	/* # of availavle synth devices */
+	int	nummidis;	/* # of available MIDI ports */
+	int	numtimers;	/* # of available timer devices */
+	int	nummixers;	/* # of mixer devices */
+
+	int	openedmidi[8];	/* Bit mask telling which midi devices
+				   are busy */
+	int	numcards;	/* Number of sound cards in the system */
+	int	filler[241];	/* For future expansion (set to -1) */
+} oss_sysinfo;
+
+typedef struct oss_mixext
+{
+  int dev;			/* Mixer device number */
+  int ctrl;			/* Controller number */
+  int type;			/* Entry type */
+#	define MIXT_DEVROOT	 0	/* Device root entry */
+#	define MIXT_GROUP	 1	/* Controller group */
+#	define MIXT_ONOFF	 2	/* OFF (0) or ON (1) */
+#	define MIXT_ENUM	 3	/* Enumerated (0 to maxvalue) */
+#	define MIXT_MONOSLIDER	 4	/* Mono slider (0 to 100) */
+#	define MIXT_STEREOSLIDER 5	/* Stereo slider (dual 0 to 100) */
+#	define MIXT_MESSAGE	 6	/* (Readable) textual message */
+#	define MIXT_MONOVU	 7	/* VU meter value (mono) */
+#	define MIXT_STEREOVU	 8	/* VU meter value (stereo) */
+#	define MIXT_MONOPEAK	 9	/* VU meter peak value (mono) */
+#	define MIXT_STEREOPEAK	10	/* VU meter peak value (stereo) */
+#	define MIXT_RADIOGROUP	11	/* Radio button group */
+#	define MIXT_MARKER	12	/* Separator between normal and extension entries */
+#	define MIXT_VALUE	13	/* Decimal value entry */
+#	define MIXT_HEXVALUE	14	/* Hexadecimal value entry */
+#	define MIXT_MONODB	15	/* Mono atten. slider (0 to -144) */
+#	define MIXT_STEREODB	16	/* Stereo atten. slider (dual 0 to -144) */
+#	define MIXT_SLIDER	17	/* Slider (mono) with full integer range */
+#	define MIXT_3D		18
+
+  /* Possible value range (minvalue to maxvalue) */
+  /* Note that maxvalue may also be smaller than minvalue */
+  int maxvalue;
+  int minvalue;
+
+  int flags;
+#	define MIXF_READABLE	0x00000001	/* Has readable value */
+#	define MIXF_WRITEABLE	0x00000002	/* Has writeable value */
+#	define MIXF_POLL	0x00000004	/* May change itself */
+#	define MIXF_HZ		0x00000008	/* Herz scale */
+#	define MIXF_STRING	0x00000010	/* Use dynamic extensions for value */
+#	define MIXF_DYNAMIC	0x00000010	/* Supports dynamic extensions */
+#	define MIXF_OKFAIL	0x00000020	/* Interpret value as 1=OK, 0=FAIL */
+#	define MIXF_FLAT	0x00000040	/* Flat vertical space requirements */
+#	define MIXF_LEGACY	0x00000080	/* Legacy mixer control group */
+  char id[16];			/* Mnemonic ID (mainly for internal use) */
+  int parent;			/* Entry# of parent (group) node (-1 if root) */
+
+  int dummy;			/* Internal use */
+
+  int timestamp;
+
+  char data[64];		/* Misc data (entry type dependent) */
+  unsigned char enum_present[32];	/* Mask of allowed enum values */
+  int control_no;		/* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */
+  /* (-1 means not indicated) */
+
+/*
+ * The desc field is reserved for internal purposes of OSS. It should not be 
+ * used by applications.
+ */
+  unsigned int desc;
+#define MIXEXT_SCOPE_MASK			0x0000003f
+#define MIXEXT_SCOPE_OTHER			0x00000000
+#define MIXEXT_SCOPE_INPUT			0x00000001
+#define MIXEXT_SCOPE_OUTPUT			0x00000002
+#define MIXEXT_SCOPE_MONITOR			0x00000003
+#define MIXEXT_SCOPE_RECSWITCH			0x00000004
+
+  char extname[32];
+  int update_counter;
+  int filler[7];
+} oss_mixext;
+
+typedef struct oss_mixext_root
+{
+  char id[16];
+  char name[48];
+} oss_mixext_root;
+
+typedef struct oss_mixer_value
+{
+  int dev;
+  int ctrl;
+  int value;
+  int flags;			/* Reserved for future use. Initialize to 0 */
+  int timestamp;		/* Must be set to oss_mixext.timestamp */
+  int filler[8];		/* Reserved for future use. Initialize to 0 */
+} oss_mixer_value;
+
+#define OSS_ENUM_MAXVALUE       255
+typedef struct oss_mixer_enuminfo
+{
+	int	dev;
+	int	ctrl;
+	int	nvalues;
+	int	version;                  /* Read the manual */
+	short	strindex[OSS_ENUM_MAXVALUE];
+	char	strings[3000];
+} oss_mixer_enuminfo;
+
+#define OPEN_READ       PCM_ENABLE_INPUT
+#define OPEN_WRITE      PCM_ENABLE_OUTPUT
+#define OPEN_READWRITE  (OPEN_READ|OPEN_WRITE)
+
+/**
+ * @brief	Argument for SNDCTL_AUDIOINFO ioctl.
+ *
+ * For use w/ the SNDCTL_AUDIOINFO ioctl available on audio (/dev/dsp*)
+ * devices.
+ */
+typedef struct oss_audioinfo
+{
+	int	dev;		/* Audio device number */
+	char	name[64];
+	int	busy;		/* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
+	int	pid;
+	int	caps;		/* DSP_CAP_INPUT, DSP_CAP_OUTPUT */
+	int	iformats;
+	int	oformats;
+	int	magic;		/* Reserved for internal use */
+	char 	cmd[64];	/* Command using the device (if known) */
+	int	card_number;
+	int	port_number;
+	int	mixer_dev;
+	int	real_device;	/* Obsolete field. Replaced by devnode */
+	int	enabled;	/* 1=enabled, 0=device not ready at this
+				   moment */
+	int	flags;		/* For internal use only - no practical
+				   meaning */
+	int	min_rate;	/* Sample rate limits */
+	int	max_rate;
+	int	min_channels;	/* Number of channels supported */
+	int	max_channels;
+	int	binding;	/* DSP_BIND_FRONT, etc. 0 means undefined */
+	int	rate_source;
+	char	handle[32];
+	#define OSS_MAX_SAMPLE_RATES	20	/* Cannot be changed  */
+	unsigned int nrates;
+	unsigned int rates[OSS_MAX_SAMPLE_RATES]; /* Please read the manual before using these */
+	oss_longname_t	song_name;	/* Song name (if given) */
+	oss_label_t	label;		/* Device label (if given) */
+	int		latency;	/* In usecs, -1=unknown */
+	oss_devnode_t	devnode;	/* Device special file name (inside
+					   /dev) */
+	int filler[186];
+} oss_audioinfo;
+
+typedef struct oss_mixerinfo
+{
+  int dev;
+  char id[16];
+  char name[32];
+  int modify_counter;
+  int card_number;
+  int port_number;
+  char handle[32];
+  int magic;			/* Reserved */
+  int enabled;			/* Reserved */
+  int caps;
+#define MIXER_CAP_VIRTUAL				0x00000001
+  int flags;			/* Reserved */
+  int nrext;
+  /*
+   * The priority field can be used to select the default (motherboard)
+   * mixer device. The mixer with the highest priority is the
+   * most preferred one. -2 or less means that this device cannot be used
+   * as the default mixer.
+   */
+  int priority;
+  int filler[254];		/* Reserved */
+} oss_mixerinfo;
+
+typedef struct oss_midi_info
+{
+  int dev;			/* Midi device number */
+  char name[64];
+  int busy;			/* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
+  int pid;
+  char cmd[64];			/* Command using the device (if known) */
+  int caps;
+#define MIDI_CAP_MPU401		0x00000001	/**** OBSOLETE ****/
+#define MIDI_CAP_INPUT		0x00000002
+#define MIDI_CAP_OUTPUT		0x00000004
+#define MIDI_CAP_INOUT		(MIDI_CAP_INPUT|MIDI_CAP_OUTPUT)
+#define MIDI_CAP_VIRTUAL	0x00000008	/* Pseudo device */
+#define MIDI_CAP_MTCINPUT	0x00000010	/* Supports SNDCTL_MIDI_MTCINPUT */
+#define MIDI_CAP_CLIENT		0x00000020	/* Virtual client side device */
+#define MIDI_CAP_SERVER		0x00000040	/* Virtual server side device */
+#define MIDI_CAP_INTERNAL	0x00000080	/* Internal (synth) device */
+#define MIDI_CAP_EXTERNAL	0x00000100	/* external (MIDI port) device */
+#define MIDI_CAP_PTOP		0x00000200	/* Point to point link to one device */
+#define MIDI_CAP_MTC		0x00000400	/* MTC/SMPTE (control) device */
+  int magic;			/* Reserved for internal use */
+  int card_number;
+  int port_number;
+  int enabled;			/* 1=enabled, 0=device not ready at this moment */
+  int flags;			/* For internal use only - no practical meaning */
+  char handle[32];
+  oss_longname_t song_name;	/* Song name (if known) */
+  oss_label_t label;		/* Device label (if given) */
+  int latency;			/* In usecs, -1=unknown */
+  int filler[244];
+} oss_midi_info;
+
+typedef struct oss_card_info
+{
+  int card;
+  char shortname[16];
+  char longname[128];
+  int flags;
+  int filler[256];
+} oss_card_info;
+
+#define SNDCTL_SYSINFO          _IOR ('X', 1, oss_sysinfo)
+#define OSS_SYSINFO             SNDCTL_SYSINFO /* Old name */
+
+#define SNDCTL_MIX_NRMIX	_IOR ('X', 2, int)
+#define SNDCTL_MIX_NREXT	_IOWR('X', 3, int)
+#define SNDCTL_MIX_EXTINFO	_IOWR('X', 4, oss_mixext)
+#define SNDCTL_MIX_READ		_IOWR('X', 5, oss_mixer_value)
+#define SNDCTL_MIX_WRITE	_IOWR('X', 6, oss_mixer_value)
+
+#define SNDCTL_AUDIOINFO	_IOWR('X', 7, oss_audioinfo)
+#define SNDCTL_MIX_ENUMINFO	_IOWR('X', 8, oss_mixer_enuminfo)
+#define SNDCTL_MIDIINFO		_IOWR('X', 9, oss_midi_info)
+#define SNDCTL_MIXERINFO	_IOWR('X',10, oss_mixerinfo)
+#define SNDCTL_CARDINFO		_IOWR('X',11, oss_card_info)
+
+/*
+ * Few more "globally" available ioctl calls.
+ */
+#define SNDCTL_SETSONG          _IOW ('Y', 2, oss_longname_t)
+#define SNDCTL_GETSONG          _IOR ('Y', 2, oss_longname_t)
+#define SNDCTL_SETNAME          _IOW ('Y', 3, oss_longname_t)
+#define SNDCTL_SETLABEL         _IOW ('Y', 4, oss_label_t)
+#define SNDCTL_GETLABEL         _IOR ('Y', 4, oss_label_t)
+
 #endif	/* !_SYS_SOUNDCARD_H_ */
Index: mount.h
===================================================================
RCS file: /home/cvs/src/sys/sys/mount.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/mount.h -L sys/sys/mount.h -u -r1.2 -r1.3
--- sys/sys/mount.h
+++ sys/sys/mount.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)mount.h	8.21 (Berkeley) 5/20/95
- * $FreeBSD: src/sys/sys/mount.h,v 1.197.2.3 2006/03/13 03:07:14 jeff Exp $
+ * $FreeBSD: src/sys/sys/mount.h,v 1.228 2007/09/12 16:31:32 kib Exp $
  */
 
 #ifndef _SYS_MOUNT_H_
@@ -135,7 +135,7 @@
  * put on a doubly linked list.
  *
  * Lock reference:
- * 	m - mountlist_mtx
+ *	m - mountlist_mtx
  *	i - interlock
  *	l - mnt_lock
  *
@@ -143,19 +143,24 @@
  *
  */
 struct mount {
+	struct lock	mnt_lock;		/* mount structure lock */
+	struct mtx	mnt_mtx;		/* mount structure interlock */
+	int		mnt_gen;		/* struct mount generation */
+#define	mnt_startzero	mnt_list
 	TAILQ_ENTRY(mount) mnt_list;		/* (m) mount list */
 	struct vfsops	*mnt_op;		/* operations on fs */
 	struct vfsconf	*mnt_vfc;		/* configuration info */
 	struct vnode	*mnt_vnodecovered;	/* vnode we mounted on */
 	struct vnode	*mnt_syncer;		/* syncer vnode */
+	int		mnt_ref;		/* (i) Reference count */
 	struct vnodelst	mnt_nvnodelist;		/* (i) list of vnodes */
-	struct lock	mnt_lock;		/* mount structure lock */
-	struct mtx	mnt_mtx;		/* mount structure interlock */
+	int		mnt_nvnodelistsize;	/* (i) # of vnodes */
 	int		mnt_writeopcount;	/* (i) write syscalls pending */
-	u_int		mnt_flag;		/* flags shared with user */
+	int		mnt_kern_flag;		/* (i) kernel only flags */
+	u_int		mnt_flag;		/* (i) flags shared with user */
+	u_int		mnt_noasync;		/* (i) # noasync overrides */
 	struct vfsoptlist *mnt_opt;		/* current mount options */
 	struct vfsoptlist *mnt_optnew;		/* new options passed to fs */
-	int		mnt_kern_flag;		/* (i) kernel only flags */
 	int		mnt_maxsymlinklen;	/* max size of short symlink */
 	struct statfs	mnt_stat;		/* cache of filesystem stats */
 	struct ucred	*mnt_cred;		/* credentials of mounter */
@@ -163,16 +168,15 @@
 	time_t		mnt_time;		/* last time written*/
 	int		mnt_iosize_max;		/* max size for clusters, etc */
 	struct netexport *mnt_export;		/* export list */
-	struct label	*mnt_mntlabel;		/* MAC label for the mount */
-	struct label	*mnt_fslabel;		/* MAC label for the fs */
-	int		mnt_nvnodelistsize;	/* (i) # of vnodes */
+	struct label	*mnt_label;		/* MAC label for the fs */
 	u_int		mnt_hashseed;		/* Random seed for vfs_hash */
 	int		mnt_markercnt;		/* marker vnodes in use */
 	int		mnt_holdcnt;		/* hold count */
 	int		mnt_holdcntwaiters;	/* waits on hold count */
 	int		mnt_secondary_writes;   /* (i) # of secondary writes */
 	int		mnt_secondary_accwrites;/* (i) secondary wr. starts */
-	int		mnt_ref;		/* (i) Reference count */
+#define	mnt_endzero	mnt_gjprovider
+	char		*mnt_gjprovider;	/* gjournal provider name */
 };
 
 struct vnode *__mnt_vnode_next(struct vnode **mvp, struct mount *mp);
@@ -184,7 +188,7 @@
 		(vp) != NULL; vp = __mnt_vnode_next(&(mvp), (mp)))
 
 #define MNT_VNODE_FOREACH_ABORT_ILOCKED(mp, mvp)			\
-	__mnt_vnode_markerfree(&(mvp), (mp)) 
+	__mnt_vnode_markerfree(&(mvp), (mp))
 
 #define MNT_VNODE_FOREACH_ABORT(mp, mvp)				\
         do {								\
@@ -213,13 +217,12 @@
 #define	MNT_SYNCHRONOUS	0x00000002	/* filesystem written synchronously */
 #define	MNT_NOEXEC	0x00000004	/* can't exec from filesystem */
 #define	MNT_NOSUID	0x00000008	/* don't honor setuid bits on fs */
-#define	MNT_NODEV	0		/* Deprecated option */
 #define	MNT_UNION	0x00000020	/* union with underlying filesystem */
 #define	MNT_ASYNC	0x00000040	/* filesystem written asynchronously */
 #define	MNT_SUIDDIR	0x00100000	/* special handling of SUID on dirs */
 #define	MNT_SOFTDEP	0x00200000	/* soft updates being done */
 #define	MNT_NOSYMFOLLOW	0x00400000	/* do not follow symlinks */
-#define	MNT_JAILDEVFS	0x02000000	/* jail-friendly DEVFS behaviour */
+#define	MNT_GJOURNAL	0x02000000	/* GEOM journal support enabled */
 #define	MNT_MULTILABEL	0x04000000	/* MAC support for individual objects */
 #define	MNT_ACLS	0x08000000	/* ACL support enabled */
 #define	MNT_NOATIME	0x10000000	/* disable update of file access time */
@@ -260,20 +263,22 @@
 			MNT_ROOTFS	| MNT_NOATIME	| MNT_NOCLUSTERR| \
 			MNT_NOCLUSTERW	| MNT_SUIDDIR	| MNT_SOFTDEP	| \
 			MNT_IGNORE	| MNT_EXPUBLIC	| MNT_NOSYMFOLLOW | \
-			MNT_JAILDEVFS	| MNT_MULTILABEL | MNT_ACLS)
+			MNT_GJOURNAL	| MNT_MULTILABEL | MNT_ACLS)
 
 /* Mask of flags that can be updated. */
 #define	MNT_UPDATEMASK (MNT_NOSUID	| MNT_NOEXEC	| \
 			MNT_SYNCHRONOUS	| MNT_UNION	| MNT_ASYNC	| \
 			MNT_NOATIME | \
-			MNT_NOSYMFOLLOW	| MNT_IGNORE	| MNT_JAILDEVFS	| \
+			MNT_NOSYMFOLLOW	| MNT_IGNORE	| \
 			MNT_NOCLUSTERR	| MNT_NOCLUSTERW | MNT_SUIDDIR	| \
 			MNT_ACLS	| MNT_USER)
 
 /*
  * External filesystem command modifier flags.
  * Unmount can use the MNT_FORCE flag.
- * XXX These are not STATES and really should be somewhere else.
+ * XXX: These are not STATES and really should be somewhere else.
+ * XXX: MNT_BYFSID collides with MNT_ACLS, but because MNT_ACLS is only used for
+ *      mount(2) and MNT_BYFSID is only used for unmount(2) it's harmless.
  */
 #define	MNT_UPDATE	0x00010000	/* not a real mount, just an update */
 #define	MNT_DELEXPORT	0x00020000	/* delete export host lists */
@@ -284,6 +289,10 @@
 #define MNT_CMDFLAGS   (MNT_UPDATE	| MNT_DELEXPORT	| MNT_RELOAD	| \
 			MNT_FORCE	| MNT_SNAPSHOT	| MNT_BYFSID)
 /*
+ * Still available.
+ */
+#define	MNT_SPARE_0x00000010	0x00000010
+/*
  * Internal filesystem control flags stored in mnt_kern_flag.
  *
  * MNTK_UNMOUNT locks the mount entry so that name lookup cannot proceed
@@ -294,8 +303,15 @@
  * dounmount() is still waiting to lock the mountpoint. This allows
  * the filesystem to cancel operations that might otherwise deadlock
  * with the unmount attempt (used by NFS).
+ *
+ * MNTK_NOINSMNTQ is strict subset of MNTK_UNMOUNT. They are separated
+ * to allow for failed unmount attempt to restore the syncer vnode for
+ * the mount.
  */
 #define MNTK_UNMOUNTF	0x00000001	/* forced unmount in progress */
+#define MNTK_ASYNC	0x00000002	/* filtered async flag */
+#define MNTK_SOFTDEP	0x00000004	/* async disabled by softdep */
+#define MNTK_NOINSMNTQ	0x00000008	/* insmntque is not allowed */
 #define MNTK_UNMOUNT	0x01000000	/* unmount in progress */
 #define	MNTK_MWAIT	0x02000000	/* waiting for unmount to finish */
 #define	MNTK_SUSPEND	0x08000000	/* request write suspension */
@@ -303,6 +319,7 @@
 #define	MNTK_SUSPENDED	0x10000000	/* write operations are suspended */
 #define	MNTK_MPSAFE	0x20000000	/* Filesystem is MPSAFE. */
 #define	MNTK_NOKNOTE	0x80000000	/* Don't send KNOTEs from VOP hooks */
+#define MNTK_LOOKUP_SHARED	0x40000000 /* FS supports shared lock lookups */
 
 /*
  * Sysctl CTL_VFS definitions.
@@ -411,21 +428,22 @@
 #define	VFCF_STATIC	0x00010000	/* statically compiled into kernel */
 #define	VFCF_NETWORK	0x00020000	/* may get data over the network */
 #define	VFCF_READONLY	0x00040000	/* writes are not implemented */
-#define VFCF_SYNTHETIC	0x00080000	/* data does not represent real files */
+#define	VFCF_SYNTHETIC	0x00080000	/* data does not represent real files */
 #define	VFCF_LOOPBACK	0x00100000	/* aliases some other mounted FS */
-#define	VFCF_UNICODE	0x00200000	/* stores file names as Unicode*/
+#define	VFCF_UNICODE	0x00200000	/* stores file names as Unicode */
+#define	VFCF_JAIL	0x00400000	/* can be mounted from within a jail */
 
 typedef uint32_t fsctlop_t;
 
 struct vfsidctl {
 	int		vc_vers;	/* should be VFSIDCTL_VERS1 (below) */
-	fsid_t		vc_fsid;	/* fsid to operate on. */
+	fsid_t		vc_fsid;	/* fsid to operate on */
 	char		vc_fstypename[MFSNAMELEN];
 					/* type of fs 'nfs' or '*' */
 	fsctlop_t	vc_op;		/* operation VFS_CTL_* (below) */
-	void		*vc_ptr;	/* pointer to data structure. */
-	size_t		vc_len;		/* sizeof said structure. */
-	u_int32_t	vc_spare[12];	/* spare (must be zero). */
+	void		*vc_ptr;	/* pointer to data structure */
+	size_t		vc_len;		/* sizeof said structure */
+	u_int32_t	vc_spare[12];	/* spare (must be zero) */
 };
 
 /* vfsidctl API version. */
@@ -503,7 +521,7 @@
 typedef int vfs_root_t(struct mount *mp, int flags, struct vnode **vpp,
 		    struct thread *td);
 typedef	int vfs_quotactl_t(struct mount *mp, int cmds, uid_t uid,
-		    caddr_t arg, struct thread *td);
+		    void *arg, struct thread *td);
 typedef	int vfs_statfs_t(struct mount *mp, struct statfs *sbp,
 		    struct thread *td);
 typedef	int vfs_sync_t(struct mount *mp, int waitfor, struct thread *td);
@@ -512,7 +530,6 @@
 typedef	int vfs_fhtovp_t(struct mount *mp, struct fid *fhp, struct vnode **vpp);
 typedef	int vfs_checkexp_t(struct mount *mp, struct sockaddr *nam,
 		    int *extflagsp, struct ucred **credanonp);
-typedef	int vfs_vptofh_t(struct vnode *vp, struct fid *fhp);
 typedef	int vfs_init_t(struct vfsconf *);
 typedef	int vfs_uninit_t(struct vfsconf *);
 typedef	int vfs_extattrctl_t(struct mount *mp, int cmd,
@@ -533,7 +550,6 @@
 	vfs_vget_t		*vfs_vget;
 	vfs_fhtovp_t		*vfs_fhtovp;
 	vfs_checkexp_t		*vfs_checkexp;
-	vfs_vptofh_t		*vfs_vptofh;
 	vfs_init_t		*vfs_init;
 	vfs_uninit_t		*vfs_uninit;
 	vfs_extattrctl_t	*vfs_extattrctl;
@@ -553,7 +569,6 @@
 	(*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP)
 #define VFS_FHTOVP(MP, FIDP, VPP) \
 	(*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, VPP)
-#define	VFS_VPTOFH(VP, FIDP)	  (*(VP)->v_mount->mnt_op->vfs_vptofh)(VP, FIDP)
 #define VFS_CHECKEXP(MP, NAM, EXFLG, CRED) \
 	(*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED)
 #define VFS_EXTATTRCTL(MP, C, FN, NS, N, P) \
@@ -563,13 +578,22 @@
 
 extern int mpsafe_vfs;
 
-#define	VFS_NEEDSGIANT(MP)						\
+#define	VFS_NEEDSGIANT_(MP)						\
     (!mpsafe_vfs || ((MP) != NULL && ((MP)->mnt_kern_flag & MNTK_MPSAFE) == 0))
 
+#define	VFS_NEEDSGIANT(MP) __extension__				\
+({									\
+	struct mount *_mp;						\
+	_mp = (MP);							\
+	VFS_NEEDSGIANT_(_mp);						\
+})
+
 #define	VFS_LOCK_GIANT(MP) __extension__				\
 ({									\
 	int _locked;							\
-	if (VFS_NEEDSGIANT((MP))) {					\
+	struct mount *_mp;						\
+	_mp = (MP);							\
+	if (VFS_NEEDSGIANT_(_mp)) {					\
 		mtx_lock(&Giant);					\
 		_locked = 1;						\
 	} else								\
@@ -577,9 +601,11 @@
 	_locked;							\
 })
 #define	VFS_UNLOCK_GIANT(locked)	if ((locked)) mtx_unlock(&Giant);
-#define	VFS_ASSERT_GIANT(MP) do 					\
+#define	VFS_ASSERT_GIANT(MP) do						\
 {									\
-	if (VFS_NEEDSGIANT((MP)))					\
+	struct mount *_mp;						\
+	_mp = (MP);							\
+	if (VFS_NEEDSGIANT_(_mp))					\
 		mtx_assert(&Giant, MA_OWNED);				\
 } while (0)
 
@@ -632,9 +658,13 @@
 struct mntarg *mount_argb(struct mntarg *ma, int flag, const char *name);
 struct mntarg *mount_argf(struct mntarg *ma, const char *name, const char *fmt, ...);
 struct mntarg *mount_argsu(struct mntarg *ma, const char *name, const void *val, int len);
+void	statfs_scale_blocks(struct statfs *sf, long max_size);
 struct vfsconf *vfs_byname(const char *);
 struct vfsconf *vfs_byname_kld(const char *, struct thread *td, int *);
+void	vfs_mount_destroy(struct mount *);
 void	vfs_event_signal(fsid_t *, u_int32_t, intptr_t);
+void	vfs_freeopts(struct vfsoptlist *opts);
+void	vfs_deleteopt(struct vfsoptlist *opts, const char *name);
 int	vfs_flagopt(struct vfsoptlist *opts, const char *name, u_int *w, u_int val);
 int	vfs_getopt(struct vfsoptlist *, const char *, void **, int *);
 char	*vfs_getopts(struct vfsoptlist *, const char *, int *error);
@@ -652,10 +682,13 @@
 struct cdev *vfs_getrootfsid(struct mount *);
 struct	mount *vfs_getvfs(fsid_t *);      /* return vfs given fsid */
 int	vfs_modevent(module_t, int, void *);
+void	vfs_mount_error(struct mount *, const char *, ...);
 void	vfs_mountroot(void);			/* mount our root filesystem */
 void	vfs_mountedfrom(struct mount *, const char *from);
 void	vfs_ref(struct mount *);
 void	vfs_rel(struct mount *);
+struct mount *vfs_mount_alloc(struct vnode *, struct vfsconf *, const char *,
+	    struct thread *);
 int	vfs_suser(struct mount *, struct thread *);
 void	vfs_unbusy(struct mount *, struct thread *);
 void	vfs_unmountall(void);
@@ -676,7 +709,6 @@
 vfs_vget_t		vfs_stdvget;
 vfs_fhtovp_t		vfs_stdfhtovp;
 vfs_checkexp_t		vfs_stdcheckexp;
-vfs_vptofh_t		vfs_stdvptofh;
 vfs_init_t		vfs_stdinit;
 vfs_uninit_t		vfs_stduninit;
 vfs_extattrctl_t	vfs_stdextattrctl;
Index: kernel.h
===================================================================
RCS file: /home/cvs/src/sys/sys/kernel.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/kernel.h -L sys/sys/kernel.h -u -r1.1.1.1 -r1.2
--- sys/sys/kernel.h
+++ sys/sys/kernel.h
@@ -39,7 +39,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)kernel.h	8.3 (Berkeley) 1/21/94
- * $FreeBSD: src/sys/sys/kernel.h,v 1.126.2.1 2005/11/12 20:55:59 csjp Exp $
+ * $FreeBSD: src/sys/sys/kernel.h,v 1.136 2007/07/27 11:59:57 rwatson Exp $
  */
 
 #ifndef _SYS_KERNEL_H_
@@ -56,10 +56,9 @@
 
 /* 1.1 */
 extern unsigned long hostid;
+extern char hostuuid[64];
 extern char hostname[MAXHOSTNAMELEN];
-extern int hostnamelen;
 extern char domainname[MAXHOSTNAMELEN];
-extern int domainnamelen;
 extern char kernelname[MAXPATHLEN];
 
 extern int tick;			/* usec per tick (1000000 / hz) */
@@ -69,10 +68,9 @@
 extern int profhz;			/* profiling clock's frequency */
 extern int profprocs;			/* number of process's profiling */
 extern int ticks;
+#ifndef _SOLARIS_C_SOURCE
 extern int lbolt;			/* once a second sleep address */
-
-extern int tz_minuteswest;
-extern int tz_dsttime;
+#endif
 
 #endif /* _KERNEL */
 
@@ -90,8 +88,8 @@
  *
  * The SI_SUB_RUN_SCHEDULER value must have the highest lexical value.
  *
- * The SI_SUB_CONSOLE and SI_SUB_SWAP values represent values used by
- * the BSD 4.4Lite but not by FreeBSD; they are maintained in dependent
+ * The SI_SUB_SWAP values represent a value used by
+ * the BSD 4.4Lite but not by FreeBSD; it is maintained in dependent
  * order to support porting.
  *
  * The SI_SUB_PROTO_BEGIN and SI_SUB_PROTO_END bracket a range of
@@ -104,7 +102,6 @@
 	SI_SUB_DUMMY		= 0x0000000,	/* not executed; for linker*/
 	SI_SUB_DONE		= 0x0000001,	/* processed*/
 	SI_SUB_TUNABLES		= 0x0700000,	/* establish tunable values */
-	SI_SUB_CONSOLE		= 0x0800000,	/* console*/
 	SI_SUB_COPYRIGHT	= 0x0800001,	/* first use of console*/
 	SI_SUB_SETTINGS		= 0x0880000,	/* check and recheck settings */
 	SI_SUB_MTX_POOL_STATIC	= 0x0900000,	/* static mutex pool */
@@ -160,6 +157,7 @@
 	SI_SUB_MOUNT_ROOT	= 0xb400000,	/* root mount*/
 	SI_SUB_SWAP		= 0xc000000,	/* swap */
 	SI_SUB_INTRINSIC_POST	= 0xd000000,	/* proc 0 cleanup*/
+	SI_SUB_SYSCALLS		= 0xd800000,	/* register system calls */
 	SI_SUB_KTHREAD_INIT	= 0xe000000,	/* init process*/
 	SI_SUB_KTHREAD_PAGE	= 0xe400000,	/* pageout daemon*/
 	SI_SUB_KTHREAD_VM	= 0xe800000,	/* vm daemon*/
@@ -345,11 +343,6 @@
 #define	TUNABLE_STR_FETCH(path, var, size)			\
 	getenv_string((path), (var), (size))
 
-void	net_warn_not_mpsafe(const char *component);
-#define	NET_NEEDS_GIANT(component)					\
-	SYSINIT(__CONCAT(__net_warn_not_mpsafe_, __LINE__),		\
-	    SI_SUB_SETTINGS, SI_ORDER_SECOND, net_warn_not_mpsafe, component);
-
 struct intr_config_hook {
 	TAILQ_ENTRY(intr_config_hook) ich_links;
 	void	(*ich_func)(void *arg);
Index: ata.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ata.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -L sys/sys/ata.h -L sys/sys/ata.h -u -r1.3 -r1.4
--- sys/sys/ata.h
+++ sys/sys/ata.h
@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/ata.h,v 1.26.2.3 2006/01/25 08:13:43 sos Exp $
+ * $FreeBSD: src/sys/sys/ata.h,v 1.36.2.1 2007/11/15 16:29:33 scottl Exp $
  */
 
 #ifndef _SYS_ATA_H_
@@ -157,6 +157,15 @@
 #define ATA_SUPPORT_FLUSHCACHE48        0x2000
 
 /*084/087*/ u_int16_t   extension;
+#define ATA_SUPPORT_SMARTTEST		0x0001
+#define ATA_SUPPORT_SMARTLOG		0x0002
+#define ATA_SUPPORT_MEDIASN		0x0004
+#define ATA_SUPPORT_MEDIAPASS		0x0008
+#define ATA_SUPPORT_STREAMING		0x0010
+#define ATA_SUPPORT_GENLOG		0x0020
+#define ATA_SUPPORT_WRITEDMAFUAEXT	0x0040
+#define ATA_SUPPORT_WRITEDMAQFUAEXT	0x0080
+#define ATA_SUPPORT_64BITWWN		0x0100
 	} __packed support, enabled;
 
 /*088*/ u_int16_t       udmamodes;              /* UltraDMA modes */
@@ -219,6 +228,7 @@
 #define ATA_USB1		0x81
 #define ATA_USB2		0x82
 
+
 /* ATA commands */
 #define ATA_NOP                         0x00    /* NOP */
 #define         ATA_NF_FLUSHQUEUE       0x00    /* flush queued cmd's */
@@ -242,6 +252,7 @@
 #define ATA_PACKET_CMD                  0xa0    /* packet command */
 #define ATA_ATAPI_IDENTIFY              0xa1    /* get ATAPI params*/
 #define ATA_SERVICE                     0xa2    /* service command */
+#define ATA_SMART_CMD                   0xb0    /* SMART command */
 #define ATA_CFA_ERASE                   0xc0    /* CFA erase */
 #define ATA_READ_MUL                    0xc4    /* read multi */
 #define ATA_WRITE_MUL                   0xc5    /* write multi */
@@ -321,7 +332,7 @@
 #define ATAPI_CLOSE_TRACK               0x5b    /* close track/session */
 #define ATAPI_READ_BUFFER_CAPACITY      0x5c    /* get buffer capicity */
 #define ATAPI_SEND_CUE_SHEET            0x5d    /* send CUE sheet */
-#define ATAPI_SERVICE_ACTION_IN		0x96	/* get service data */
+#define ATAPI_SERVICE_ACTION_IN         0x96	/* get service data */
 #define ATAPI_BLANK                     0xa1    /* blank the media */
 #define ATAPI_SEND_KEY                  0xa3    /* send DVD key structure */
 #define ATAPI_REPORT_KEY                0xa4    /* get DVD key structure */
@@ -350,44 +361,44 @@
 
 /* ATAPI request sense structure */
 struct atapi_sense {
-     u_int8_t    error;                          /* current or deferred errors */
-#define ATA_SENSE_VALID                 0x80
-  	 
-     u_int8_t    segment;                        /* segment number */
-     u_int8_t    key;                            /* sense key */
-#define ATA_SENSE_KEY_MASK              0x0f    /* sense key mask */
-#define ATA_SENSE_NO_SENSE              0x00    /* no specific sense key info */
-#define ATA_SENSE_RECOVERED_ERROR       0x01    /* command OK, data recovered */
-#define ATA_SENSE_NOT_READY             0x02    /* no access to drive */
-#define ATA_SENSE_MEDIUM_ERROR          0x03    /* non-recovered data error */
-#define ATA_SENSE_HARDWARE_ERROR        0x04    /* non-recoverable HW failure */
-#define ATA_SENSE_ILLEGAL_REQUEST       0x05    /* invalid command param(s) */
-#define ATA_SENSE_UNIT_ATTENTION        0x06    /* media changed */
-#define ATA_SENSE_DATA_PROTECT          0x07    /* write protect */
-#define ATA_SENSE_BLANK_CHECK           0x08    /* blank check */
-#define ATA_SENSE_VENDOR_SPECIFIC       0x09    /* vendor specific skey */
-#define ATA_SENSE_COPY_ABORTED          0x0a    /* copy aborted */
-#define ATA_SENSE_ABORTED_COMMAND       0x0b    /* command aborted, try again */
-#define ATA_SENSE_EQUAL                 0x0c    /* equal */
-#define ATA_SENSE_VOLUME_OVERFLOW       0x0d    /* volume overflow */
-#define ATA_SENSE_MISCOMPARE            0x0e    /* data dont match the medium */
-#define ATA_SENSE_RESERVED              0x0f
-#define ATA_SENSE_ILI                   0x20;
-#define ATA_SENSE_EOM                   0x40;
-#define ATA_SENSE_FILEMARK              0x80;
-  	 
-     u_int32_t   cmd_info;               /* cmd information */
-     u_int8_t    sense_length;           /* additional sense len (n-7) */
-     u_int32_t   cmd_specific_info;      /* additional cmd spec info */
-     u_int8_t    asc;                    /* additional sense code */
-     u_int8_t    ascq;                   /* additional sense code qual */
-     u_int8_t    replaceable_unit_code;  /* replaceable unit code */
-     u_int8_t    specific;               /* sense key specific */
-#define ATA_SENSE_SPEC_VALID    0x80
-#define ATA_SENSE_SPEC_MASK     0x7f
-  	 
-     u_int8_t    specific1;              /* sense key specific */
-     u_int8_t    specific2;              /* sense key specific */
+    u_int8_t	error;				/* current or deferred errors */
+#define	ATA_SENSE_VALID			0x80
+
+    u_int8_t	segment;			/* segment number */
+    u_int8_t	key;				/* sense key */
+#define ATA_SENSE_KEY_MASK		0x0f    /* sense key mask */
+#define ATA_SENSE_NO_SENSE		0x00    /* no specific sense key info */
+#define ATA_SENSE_RECOVERED_ERROR 	0x01    /* command OK, data recovered */
+#define ATA_SENSE_NOT_READY		0x02    /* no access to drive */
+#define ATA_SENSE_MEDIUM_ERROR		0x03    /* non-recovered data error */
+#define ATA_SENSE_HARDWARE_ERROR	0x04    /* non-recoverable HW failure */
+#define ATA_SENSE_ILLEGAL_REQUEST	0x05    /* invalid command param(s) */
+#define ATA_SENSE_UNIT_ATTENTION	0x06    /* media changed */
+#define ATA_SENSE_DATA_PROTECT		0x07    /* write protect */
+#define ATA_SENSE_BLANK_CHECK		0x08    /* blank check */
+#define ATA_SENSE_VENDOR_SPECIFIC	0x09    /* vendor specific skey */
+#define ATA_SENSE_COPY_ABORTED		0x0a    /* copy aborted */
+#define ATA_SENSE_ABORTED_COMMAND	0x0b    /* command aborted, try again */
+#define ATA_SENSE_EQUAL			0x0c    /* equal */
+#define ATA_SENSE_VOLUME_OVERFLOW	0x0d    /* volume overflow */
+#define ATA_SENSE_MISCOMPARE		0x0e    /* data dont match the medium */
+#define ATA_SENSE_RESERVED		0x0f
+#define	ATA_SENSE_ILI			0x20;
+#define	ATA_SENSE_EOM			0x40;
+#define	ATA_SENSE_FILEMARK		0x80;
+
+    u_int32_t   cmd_info;		/* cmd information */
+    u_int8_t	sense_length;		/* additional sense len (n-7) */
+    u_int32_t   cmd_specific_info;	/* additional cmd spec info */
+    u_int8_t    asc;			/* additional sense code */
+    u_int8_t    ascq;			/* additional sense code qual */
+    u_int8_t    replaceable_unit_code;	/* replaceable unit code */
+    u_int8_t	specific;		/* sense key specific */
+#define	ATA_SENSE_SPEC_VALID	0x80
+#define	ATA_SENSE_SPEC_MASK	0x7f
+	
+    u_int8_t	specific1;		/* sense key specific */
+    u_int8_t	specific2;		/* sense key specific */
 } __packed;
 
 struct ata_ioc_request {
@@ -400,7 +411,7 @@
 	} ata;
 	struct {
 	    char                ccb[16];
-            struct atapi_sense  sense;
+	    struct atapi_sense	sense;
 	} atapi;
     } u;
     caddr_t             data;
@@ -445,10 +456,26 @@
 	    int                 disks[16];
 };
 
+struct ata_ioc_raid_status {
+	    int                 lun;
+	    int                 type;
+	    int                 interleave;
+	    int                 status;
+	    int                 progress;
+	    int                 total_disks;
+	    struct {
+		    int		state;
+#define AR_DISK_ONLINE			0x01
+#define AR_DISK_PRESENT			0x02
+#define AR_DISK_SPARE			0x04
+		    int		lun;
+	    } disks[16];
+};
+
 /* ATA RAID ioctl calls */
 #define IOCATARAIDCREATE        _IOWR('a', 200, struct ata_ioc_raid_config)
 #define IOCATARAIDDELETE        _IOW('a', 201, int)
-#define IOCATARAIDSTATUS        _IOWR('a', 202, struct ata_ioc_raid_config)
+#define IOCATARAIDSTATUS        _IOWR('a', 202, struct ata_ioc_raid_status)
 #define IOCATARAIDADDSPARE      _IOW('a', 203, struct ata_ioc_raid_config)
 #define IOCATARAIDREBUILD       _IOW('a', 204, int)
 
Index: proc.h
===================================================================
RCS file: /home/cvs/src/sys/sys/proc.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -L sys/sys/proc.h -L sys/sys/proc.h -u -r1.4 -r1.5
--- sys/sys/proc.h
+++ sys/sys/proc.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)proc.h	8.15 (Berkeley) 5/19/95
- * $FreeBSD: src/sys/sys/proc.h,v 1.432.2.5 2006/03/10 19:37:35 jhb Exp $
+ * $FreeBSD: src/sys/sys/proc.h,v 1.491.2.1.2.1 2008/01/19 18:15:06 kib Exp $
  */
 
 #ifndef _SYS_PROC_H_
@@ -49,8 +49,10 @@
 #include <sys/priority.h>
 #include <sys/rtprio.h>			/* XXX. */
 #include <sys/runq.h>
+#include <sys/resource.h>
 #include <sys/sigio.h>
 #include <sys/signal.h>
+#include <sys/signalvar.h>
 #ifndef _KERNEL
 #include <sys/time.h>			/* For structs itimerval, timeval. */
 #else
@@ -132,7 +134,7 @@
  *      g - process group mtx
  *      h - callout_lock mtx
  *      i - by curproc or the master session mtx
- *      j - locked by sched_lock mtx
+ *      j - locked by proc slock
  *      k - only accessed by curthread
  *	k*- only accessed by curthread and from an interrupt
  *      l - the attaching proc or attaching proc parent
@@ -142,37 +144,41 @@
  *      p - select lock (sellock)
  *      q - td_contested lock
  *      r - p_peers lock
+ *      t - thread lock
  *      x - created at fork, only changes during single threading in exec
- *      z - zombie threads/ksegroup lock
+ *      z - zombie threads lock
  *
  * If the locking key specifies two identifiers (for example, p_pptr) then
  * either lock is sufficient for read access, but both locks must be held
  * for write access.
  */
-struct kg_sched;
+struct kaudit_record;
+struct td_sched;
 struct nlminfo;
 struct kaioinfo;
 struct p_sched;
+struct proc;
 struct sleepqueue;
-struct td_sched;
+struct thread;
 struct trapframe;
 struct turnstile;
+struct mqueue_notifier;
 
 /*
- * Here we define the three structures used for process information.
+ * Here we define the two structures used for process information.
  *
  * The first is the thread. It might be thought of as a "Kernel
  * Schedulable Entity Context".
  * This structure contains all the information as to where a thread of
  * execution is now, or was when it was suspended, why it was suspended,
  * and anything else that will be needed to restart it when it is
- * rescheduled. Always associated with a KSE when running, but can be
- * reassigned to an equivalent KSE when being restarted for
- * load balancing. Each of these is associated with a kernel stack
- * and a pcb.
+ * rescheduled. It includes a scheduler specific substructure that is different
+ * for each scheduler.
  *
- * It is important to remember that a particular thread structure may only
- * exist as long as the system call or kernel entrance (e.g. by pagefault)
+ * M:N notes.
+ * It is important to remember that when using M:N threading, 
+ * a particular thread structure may only exist as long as
+ * the system call or kernel entrance (e.g. by pagefault)
  * which it is currently executing. It should therefore NEVER be referenced
  * by pointers in long lived structures that live longer than a single
  * request. If several threads complete their work at the same time,
@@ -184,90 +190,49 @@
  * get one when it needs a new one. There is also a system
  * cache of free threads. Threads have priority and partake in priority
  * inheritance schemes.
- */
-struct thread;
-
-/*
- * The KSEGRP is allocated resources across a number of CPUs.
- * (Including a number of CPUxQUANTA. It parcels these QUANTA up among
- * its threads, each of which should be running in a different CPU.
- * BASE priority and total available quanta are properties of a KSEGRP.
- * Multiple KSEGRPs in a single process compete against each other
- * for total quanta in the same way that a forked child competes against
- * it's parent process.
- */
-struct ksegrp;
-
-/*
- * A process is the owner of all system resources allocated to a task
- * except CPU quanta.
- * All KSEGs under one process see, and have the same access to, these
- * resources (e.g. files, memory, sockets, credential, kqueues).
- * A process may compete for CPU cycles on the same basis as a
- * forked process cluster by spawning several KSEGRPs.
- */
-struct proc;
-
-/***************
- * In pictures:
- With a single run queue used by all processors:
-
- RUNQ: --->KSE---KSE--...               SLEEPQ:[]---THREAD---THREAD---THREAD
-	     \      \                          []---THREAD
-      KSEG---THREAD--THREAD--THREAD            []
-					       []---THREAD---THREAD
-
-  (processors run THREADs from the KSEG until they are exhausted or
-  the KSEG exhausts its quantum)
-
-With PER-CPU run queues:
-KSEs on the separate run queues directly
-They would be given priorities calculated from the KSEG.
-
  *
- *****************/
+ * The second is the proc (process) which owns all the resources of a process
+ * other than CPU cycles, which are parceled out to the threads.
+ */
 
 /*
  * Kernel runnable context (thread).
  * This is what is put to sleep and reactivated.
- * The first KSE available in the correct group will run this thread.
- * If several are available, use the one on the same CPU as last time.
- * When waiting to be run, threads are hung off the KSEGRP in priority order.
- * With N runnable and queued KSEs in the KSEGRP, the first N threads
- * are linked to them. Other threads are not yet assigned.
+ * Thread context.  Processes may have multiple threads.
  */
 struct thread {
+	struct mtx	*volatile td_lock; /* replaces sched lock */
 	struct proc	*td_proc;	/* (*) Associated process. */
-	struct ksegrp	*td_ksegrp;	/* (*) Associated KSEG. */
 	TAILQ_ENTRY(thread) td_plist;	/* (*) All threads in this proc. */
-	TAILQ_ENTRY(thread) td_kglist;	/* (*) All threads in this ksegrp. */
 
 	/* The two queues below should someday be merged. */
-	TAILQ_ENTRY(thread) td_slpq;	/* (j) Sleep queue. */
-	TAILQ_ENTRY(thread) td_lockq;	/* (j) Lock queue. */
-	TAILQ_ENTRY(thread) td_runq;	/* (j/z) Run queue(s). XXXKSE */
+	TAILQ_ENTRY(thread) td_slpq;	/* (t) Sleep queue. */
+	TAILQ_ENTRY(thread) td_lockq;	/* (t) Lock queue. */
 
 	TAILQ_HEAD(, selinfo) td_selq;	/* (p) List of selinfos. */
 	struct sleepqueue *td_sleepqueue; /* (k) Associated sleep queue. */
 	struct turnstile *td_turnstile;	/* (k) Associated turnstile. */
 	struct umtx_q   *td_umtxq;	/* (c?) Link for when we're blocked. */
 	lwpid_t		td_tid;		/* (b) Thread ID. */
+	sigqueue_t	td_sigqueue;	/* (c) Sigs arrived, not delivered. */
+#define	td_siglist	td_sigqueue.sq_signals
 
 /* Cleared during fork1() or thread_schedule_upcall(). */
 #define	td_startzero td_flags
-	int		td_flags;	/* (j) TDF_* flags. */
-	int		td_inhibitors;	/* (j) Why can not run. */
+	int		td_flags;	/* (t) TDF_* flags. */
+	int		td_inhibitors;	/* (t) Why can not run. */
 	int		td_pflags;	/* (k) Private thread (TDP_*) flags. */
 	int		td_dupfd;	/* (k) Ret value from fdopen. XXX */
-	void		*td_wchan;	/* (j) Sleep address. */
-	const char	*td_wmesg;	/* (j) Reason for sleep. */
-	u_char		td_lastcpu;	/* (j) Last cpu we were on. */
-	u_char		td_oncpu;	/* (j) Which cpu we are on. */
+	int		td_sqqueue;	/* (t) Sleepqueue queue blocked on. */
+	void		*td_wchan;	/* (t) Sleep address. */
+	const char	*td_wmesg;	/* (t) Reason for sleep. */
+	u_char		td_lastcpu;	/* (t) Last cpu we were on. */
+	u_char		td_oncpu;	/* (t) Which cpu we are on. */
 	volatile u_char td_owepreempt;  /* (k*) Preempt on last critical_exit */
-	short		td_locks;	/* (k) DEBUG: lockmgr count of locks. */
-	struct turnstile *td_blocked;	/* (j) Lock process is blocked on. */
-	void		*td_ithd;	/* (n) Unused, kept to preserve ABI. */
-	const char	*td_lockname;	/* (j) Name of lock blocked on. */
+	short		td_locks;	/* (k) Count of non-spin locks. */
+	u_char		td_tsqueue;	/* (t) Turnstile queue blocked on. */
+	struct turnstile *td_blocked;	/* (t) Lock thread is blocked on. */
+	const char	*td_lockname;	/* (t) Name of lock blocked on. */
 	LIST_HEAD(, turnstile) td_contested;	/* (q) Contested locks. */
 	struct lock_list_entry *td_sleeplocks; /* (k) Held sleep locks. */
 	int		td_intr_nesting_level; /* (k) Interrupt recursion. */
@@ -275,26 +240,36 @@
 	struct kse_thr_mailbox *td_mailbox; /* (*) Userland mailbox address. */
 	struct ucred	*td_ucred;	/* (k) Reference to credentials. */
 	struct thread	*td_standin;	/* (k + a) Use this for an upcall. */
-	struct kse_upcall *td_upcall;	/* (k + j) Upcall structure. */
-	u_int64_t	td_sticks;	/* (k) Statclock hits in system mode. */
+	struct kse_upcall *td_upcall;	/* (k + t) Upcall structure. */
+	u_int		td_estcpu;	/* (t) estimated cpu utilization */
+	u_int		td_slptick;	/* (t) Time at sleep. */
+	struct rusage	td_ru;		/* (t) rusage information */
+	uint64_t	td_runtime;	/* (t) How many cpu ticks we've run. */
+	u_int 		td_pticks;	/* (t) Statclock hits for profiling */
+	u_int		td_sticks;	/* (t) Statclock hits in system mode. */
+	u_int		td_iticks;	/* (t) Statclock hits in intr mode. */
+	u_int		td_uticks;	/* (t) Statclock hits in user mode. */
 	u_int		td_uuticks;	/* (k) Statclock hits (usr), for UTS. */
 	u_int		td_usticks;	/* (k) Statclock hits (sys), for UTS. */
-	int		td_intrval;	/* (j) Return value of TDF_INTERRUPT. */
+	int		td_intrval;	/* (t) Return value of TDF_INTERRUPT. */
 	sigset_t	td_oldsigmask;	/* (k) Saved mask from pre sigpause. */
 	sigset_t	td_sigmask;	/* (c) Current signal mask. */
-	sigset_t	td_siglist;	/* (c) Sigs arrived, not delivered. */
 	volatile u_int	td_generation;	/* (k) For detection of preemption */
 	stack_t		td_sigstk;	/* (k) Stack ptr and on-stack flag. */
 	int		td_kflags;	/* (c) Flags for KSE threading. */
 	int		td_xsig;	/* (c) Signal for ptrace */
 	u_long		td_profil_addr;	/* (k) Temporary addr until AST. */
 	u_int		td_profil_ticks; /* (k) Temporary ticks until AST. */
+	char		td_name[MAXCOMLEN + 1];	/* (*) Thread name. */
 #define	td_endzero td_base_pri
 
 /* Copied during fork1() or thread_sched_upcall(). */
 #define	td_startcopy td_endzero
-	u_char		td_base_pri;	/* (j) Thread base kernel priority. */
-	u_char		td_priority;	/* (j) Thread active priority. */
+	u_char		td_base_pri;	/* (t) Thread base kernel priority. */
+	u_char		td_priority;	/* (t) Thread active priority. */
+	u_char		td_pri_class;	/* (t) Scheduling class. */
+	u_char		td_user_pri;	/* (t) User pri from estcpu and nice. */
+	u_char		td_base_user_pri; /* (t) Base user pri */
 #define	td_endcopy td_pcb
 
 /*
@@ -308,7 +283,7 @@
 		TDS_CAN_RUN,
 		TDS_RUNQ,
 		TDS_RUNNING
-	} td_state;
+	} td_state;			/* (t) thread state */
 	register_t	td_retval[2];	/* (k) Syscall aux returns. */
 	struct callout	td_slpcallout;	/* (h) Callout for sleep. */
 	struct trapframe *td_frame;	/* (k) */
@@ -321,39 +296,55 @@
 	volatile u_int	td_critnest;	/* (k*) Critical section nest level. */
 	struct mdthread td_md;		/* (k) Any machine-dependent fields. */
 	struct td_sched	*td_sched;	/* (*) Scheduler-specific data. */
+	struct kaudit_record	*td_ar;	/* (k) Active audit record, if any. */
+	int		td_syscalls;	/* per-thread syscall count (used by NFS :)) */
 };
 
+struct mtx *thread_lock_block(struct thread *);
+void thread_lock_unblock(struct thread *, struct mtx *);
+void thread_lock_set(struct thread *, struct mtx *);
+#define	THREAD_LOCK_ASSERT(td, type)					\
+do {									\
+	struct mtx *__m = (td)->td_lock;				\
+	if (__m != &blocked_lock)					\
+		mtx_assert(__m, (type));				\
+} while (0)
+
 /*
  * Flags kept in td_flags:
  * To change these you MUST have the scheduler lock.
  */
 #define	TDF_BORROWING	0x00000001 /* Thread is borrowing pri from another. */
 #define	TDF_INPANIC	0x00000002 /* Caused a panic, let it drive crashdump. */
+#define	TDF_INMEM	0x00000004 /* Thread's stack is in memory. */
 #define	TDF_SINTR	0x00000008 /* Sleep is interruptible. */
 #define	TDF_TIMEOUT	0x00000010 /* Timing out during sleep. */
 #define	TDF_IDLETD	0x00000020 /* This is a per-CPU idle thread. */
 #define	TDF_SELECT	0x00000040 /* Selecting; wakeup/waiting danger. */
 #define	TDF_SLEEPABORT	0x00000080 /* sleepq_abort was called. */
-#define	TDF_TSNOBLOCK	0x00000100 /* Don't block on a turnstile due to race. */
-#define	TDF_UNUSED9	0x00000200 /* --available -- */
+#define	TDF_UNUSEDx100	0x00000100 /* --available-- */
+#define	TDF_UBORROWING	0x00000200 /* Thread is borrowing user pri. */
 #define	TDF_BOUNDARY	0x00000400 /* Thread suspended at user boundary */
 #define	TDF_ASTPENDING	0x00000800 /* Thread has some asynchronous events. */
 #define	TDF_TIMOFAIL	0x00001000 /* Timeout from sleep after we were awake. */
 #define	TDF_INTERRUPT	0x00002000 /* Thread is marked as interrupted. */
-#define	TDF_UNUSED14	0x00004000 /* --available -- */
-#define	TDF_UNUSED15	0x00008000 /* --available -- */
+#define	TDF_UPIBLOCKED	0x00004000 /* Thread blocked on user PI mutex. */
+#define	TDF_UNUSED15	0x00008000 /* --available-- */
 #define	TDF_NEEDRESCHED	0x00010000 /* Thread needs to yield. */
 #define	TDF_NEEDSIGCHK	0x00020000 /* Thread may need signal delivery. */
 #define	TDF_XSIG	0x00040000 /* Thread is exchanging signal under trace */
-#define	TDF_UMTXQ	0x00080000 /* Thread is sleeping on a umtx. */
+#define	TDF_UNUSED19	0x00080000 /* Thread is sleeping on a umtx. */
 #define	TDF_THRWAKEUP	0x00100000 /* Libthr thread must not suspend itself. */
 #define	TDF_DBSUSPEND	0x00200000 /* Thread is suspended by debugger */
-#define	TDF_UNUSED22	0x00400000 /* --available -- */
-#define	TDF_UNUSED23	0x00800000 /* --available -- */
+#define	TDF_SWAPINREQ	0x00400000 /* Swapin request due to wakeup. */
+#define	TDF_UNUSED23	0x00800000 /* --available-- */
 #define	TDF_SCHED0	0x01000000 /* Reserved for scheduler private use */
 #define	TDF_SCHED1	0x02000000 /* Reserved for scheduler private use */
 #define	TDF_SCHED2	0x04000000 /* Reserved for scheduler private use */
 #define	TDF_SCHED3	0x08000000 /* Reserved for scheduler private use */
+#define	TDF_ALRMPEND	0x10000000 /* Pending SIGVTALRM needs to be posted. */
+#define	TDF_PROFPEND	0x20000000 /* Pending SIGPROF needs to be posted. */
+#define	TDF_MACPEND	0x40000000 /* AST-based MAC event pending. */
 
 /*
  * "Private" flags kept in td_pflags:
@@ -378,6 +369,8 @@
 #define	TDP_GEOM	0x00010000 /* Settle GEOM before finishing syscall */
 #define	TDP_SOFTDEP	0x00020000 /* Stuck processing softdep worklist */
 #define	TDP_NORUNNINGBUF 0x00040000 /* Ignore runningbufspace check */
+#define	TDP_WAKEUP	0x00080000 /* Don't sleep in umtx cond_wait */
+#define	TDP_INBDFLUSH	0x00100000 /* Already in BO_BDFLUSH, do not recurse */
 
 /*
  * Reasons that the current thread can not be run yet.
@@ -392,7 +385,7 @@
 /*
  * flags (in kflags) related to M:N threading.
  */
-#define	TDK_KSEREL	0x0001	/* Blocked in msleep on kg->kg_completed. */
+#define	TDK_KSEREL	0x0001	/* Blocked in msleep on p->p_completed. */
 #define	TDK_KSERELSIG	0x0002	/* Blocked in msleep on p->p_siglist. */
 #define	TDK_WAKEUP	0x0004	/* Thread has been woken by kse_wakeup. */
 
@@ -410,6 +403,13 @@
 #define	TD_ON_RUNQ(td)		((td)->td_state == TDS_RUNQ)
 #define	TD_CAN_RUN(td)		((td)->td_state == TDS_CAN_RUN)
 #define	TD_IS_INHIBITED(td)	((td)->td_state == TDS_INHIBITED)
+#define	TD_ON_UPILOCK(td)	((td)->td_flags & TDF_UPIBLOCKED)
+#if 0
+#define TD_IS_IDLETHREAD(td)	((td) == pcpu(idlethread))
+#else
+#define TD_IS_IDLETHREAD(td)	((td)->td_flags & TDF_IDLETD)
+#endif
+
 
 #define	TD_SET_INHIB(td, inhib) do {			\
 	(td)->td_state = TDS_INHIBITED;			\
@@ -444,8 +444,8 @@
  * an upcall on return to userland the thread exports its context and exits.
  */
 struct kse_upcall {
-	TAILQ_ENTRY(kse_upcall) ku_link;	/* List of upcalls in KSEG. */
-	struct ksegrp		*ku_ksegrp;	/* Associated KSEG. */
+	TAILQ_ENTRY(kse_upcall) ku_link;	/* List of upcalls in proc. */
+	struct proc		*ku_proc;	/* Associated proc. */
 	struct thread		*ku_owner;	/* Owning thread. */
 	int			ku_flags;	/* KUF_* flags. */
 	struct kse_mailbox	*ku_mailbox;	/* Userland mailbox address. */
@@ -458,36 +458,6 @@
 #define	KUF_EXITING	0x00002		/* Upcall structure is exiting. */
 
 /*
- * Kernel-scheduled entity group (KSEG).  The scheduler considers each KSEG to
- * be an indivisible unit from a time-sharing perspective, though each KSEG may
- * contain multiple KSEs.
- */
-struct ksegrp {
-	struct proc	*kg_proc;	/* (*) Proc that contains this KSEG. */
-	TAILQ_ENTRY(ksegrp) kg_ksegrp;	/* (*) Queue of KSEGs in kg_proc. */
-	TAILQ_HEAD(, thread) kg_threads;/* (td_kglist) All threads. */
-	TAILQ_HEAD(, thread) kg_runq;	/* (td_runq) waiting RUNNABLE threads */
-	TAILQ_HEAD(, kse_upcall) kg_upcalls;	/* All upcalls in the group. */
-
-#define	kg_startzero kg_estcpu
-	u_int		kg_estcpu;	/* (j) Sum of the same field in KSEs. */
-	u_int		kg_slptime;	/* (j) How long completely blocked. */
-	int		kg_numupcalls;	/* (j) Num upcalls. */
-	int		kg_upsleeps;	/* (c) Num threads in kse_release(). */
-	struct kse_thr_mailbox *kg_completed; /* (c) Completed thread mboxes. */
-	int		kg_nextupcall;	/* (n) Next upcall time. */
-	int		kg_upquantum;	/* (n) Quantum to schedule an upcall. */
-#define	kg_endzero kg_pri_class
-
-#define	kg_startcopy	kg_endzero
-	u_char		kg_pri_class;	/* (j) Scheduling class. */
-	u_char		kg_user_pri;	/* (j) User pri from estcpu and nice. */
-#define	kg_endcopy kg_numthreads
-	int		kg_numthreads;	/* (j) Num threads in total. */
-	struct kg_sched	*kg_sched;	/* (*) Scheduler-specific data. */
-};
-
-/*
  * XXX: Does this belong in resource.h or resourcevar.h instead?
  * Resource usage extension.  The times in rusage structs in the kernel are
  * never up to date.  The actual times are kept as runtimes and tick counts
@@ -498,30 +468,31 @@
  * Locking: (cj) means (j) for p_rux and (c) for p_crux.
  */
 struct rusage_ext {
-	struct bintime	rux_runtime;    /* (cj) Real time. */
+	u_int64_t	rux_runtime;    /* (cj) Real time. */
 	u_int64_t	rux_uticks;     /* (cj) Statclock hits in user mode. */
 	u_int64_t	rux_sticks;     /* (cj) Statclock hits in sys mode. */
 	u_int64_t	rux_iticks;     /* (cj) Statclock hits in intr mode. */
 	u_int64_t	rux_uu;         /* (c) Previous user time in usec. */
 	u_int64_t	rux_su;         /* (c) Previous sys time in usec. */
-	u_int64_t	rux_iu;         /* (c) Previous intr time in usec. */
+	u_int64_t	rux_tu;         /* (c) Previous total time in usec. */
 };
 
 /*
- * The old fashionned process. May have multiple threads, KSEGRPs
- * and KSEs. Starts off with a single embedded KSEGRP and THREAD.
+ * The old fashionned process. May have multiple threads.
+ *  Starts off with a single embedded THREAD.
  */
 struct proc {
 	LIST_ENTRY(proc) p_list;	/* (d) List of all processes. */
-	TAILQ_HEAD(, ksegrp) p_ksegrps;	/* (c)(kg_ksegrp) All KSEGs. */
-	TAILQ_HEAD(, thread) p_threads;	/* (j)(td_plist) Threads. (shortcut) */
-	TAILQ_HEAD(, thread) p_suspended; /* (td_runq) Suspended threads. */
+	TAILQ_HEAD(, thread) p_threads;	/* (j) all threads. */
+	TAILQ_HEAD(, kse_upcall) p_upcalls; /* (j) All upcalls in the proc. */
+	struct mtx	p_slock;	/* process spin lock */
 	struct ucred	*p_ucred;	/* (c) Process owner's identity. */
 	struct filedesc	*p_fd;		/* (b) Open files. */
 	struct filedesc_to_leader *p_fdtol; /* (b) Tracking node */
 					/* Accumulated stats for all threads? */
 	struct pstats	*p_stats;	/* (b) Accounting/statistics (CPU). */
 	struct plimit	*p_limit;	/* (c) Process limits. */
+	struct callout	p_limco;	/* (c) Limit callout handle */
 	struct sigacts	*p_sigacts;	/* (x) Signal actions, state (CPU). */
 
 	/*
@@ -529,13 +500,11 @@
 	 * See the td_ or ke_ versions of the same flags.
 	 */
 	int		p_flag;		/* (c) P_* flags. */
-	int		p_sflag;	/* (j) PS_* flags. */
 	enum {
 		PRS_NEW = 0,		/* In creation */
 		PRS_NORMAL,		/* threads can be run. */
 		PRS_ZOMBIE
 	} p_state;			/* (j/c) S* process status. */
-
 	pid_t		p_pid;		/* (b) Process identifier. */
 	LIST_ENTRY(proc) p_hash;	/* (d) Hash chain. */
 	LIST_ENTRY(proc) p_pglist;	/* (g + e) List of processes in pgrp. */
@@ -543,22 +512,25 @@
 	LIST_ENTRY(proc) p_sibling;	/* (e) List of sibling processes. */
 	LIST_HEAD(, proc) p_children;	/* (e) Pointer to list of children. */
 	struct mtx	p_mtx;		/* (n) Lock for this struct. */
+	struct ksiginfo *p_ksi;	/* Locked by parent proc lock */
+	sigqueue_t	p_sigqueue;	/* (c) Sigs not delivered to a td. */
+#define p_siglist	p_sigqueue.sq_signals
 
 /* The following fields are all zeroed upon creation in fork. */
 #define	p_startzero	p_oppid
 	pid_t		p_oppid;	/* (c + e) Save ppid in ptrace. XXX */
 	struct vmspace	*p_vmspace;	/* (b) Address space. */
-	u_int		p_swtime;	/* (j) Time swapped in or out. */
+	u_int		p_swtick;	/* (j) Tick when swapped in or out. */
 	struct itimerval p_realtimer;	/* (c) Alarm timer. */
+	struct rusage	p_ru;		/* (a) Exit information. */
 	struct rusage_ext p_rux;	/* (cj) Internal resource usage. */
 	struct rusage_ext p_crux;	/* (c) Internal child resource usage. */
 	int		p_profthreads;	/* (c) Num threads in addupc_task. */
-	int		p_maxthrwaits;	/* (c) Max threads num waiters */
+	volatile int	p_exitthreads;	/* (j) Number of threads exiting */
 	int		p_traceflag;	/* (o) Kernel trace points. */
 	struct vnode	*p_tracevp;	/* (c + o) Trace to vnode. */
 	struct ucred	*p_tracecred;	/* (o) Credentials to trace with. */
 	struct vnode	*p_textvp;	/* (b) Vnode of executable. */
-	sigset_t	p_siglist;	/* (c) Sigs not delivered to a td. */
 	char		p_lock;		/* (c) Proclock (prevent swap) count. */
 	struct sigiolst	p_sigiolst;	/* (c) List of sigio sources. */
 	int		p_sigparent;	/* (c) Signal to parent on exit. */
@@ -571,21 +543,29 @@
 	struct nlminfo	*p_nlminfo;	/* (?) Only used by/for lockd. */
 	struct kaioinfo	*p_aioinfo;	/* (c) ASYNC I/O info. */
 	struct thread	*p_singlethread;/* (c + j) If single threading this is it */
-	int		p_suspcount;	/* (c) Num threads in suspended mode. */
+	int		p_suspcount;	/* (j) Num threads in suspended mode. */
 	struct thread	*p_xthread;	/* (c) Trap thread */
 	int		p_boundary_count;/* (c) Num threads at user boundary */
-	struct ksegrp	*p_procscopegrp;
+	int		p_pendingcnt;	/* how many signals are pending */
+	struct itimers	*p_itimers;	/* (c) POSIX interval timers. */
+	int		p_numupcalls;	/* (j) Num upcalls. */
+	int		p_upsleeps;	/* (c) Num threads in kse_release(). */
+	struct kse_thr_mailbox *p_completed; /* (c) Completed thread mboxes. */
+	int		p_nextupcall;	/* (n) Next upcall time. */
+	int		p_upquantum;	/* (n) Quantum to schedule an upcall. */
 /* End area that is zeroed on creation. */
 #define	p_endzero	p_magic
 
 /* The following fields are all copied upon creation in fork. */
 #define	p_startcopy	p_endzero
 	u_int		p_magic;	/* (b) Magic number. */
+	int		p_osrel;	/* (x) osreldate for the
+					       binary (from ELF note, if any) */
 	char		p_comm[MAXCOMLEN + 1];	/* (b) Process name. */
 	struct pgrp	*p_pgrp;	/* (c + e) Pointer to process group. */
 	struct sysentvec *p_sysent;	/* (b) Syscall dispatch info. */
 	struct pargs	*p_args;	/* (c) Process arguments. */
-	rlim_t		p_cpulimit;	/* (j) Current CPU limit in seconds. */
+	rlim_t		p_cpulimit;	/* (c) Current CPU limit in seconds. */
 	signed char	p_nice;		/* (c + j) Process "nice" value. */
 /* End area that is copied on creation. */
 #define	p_endcopy	p_xstat
@@ -593,16 +573,16 @@
 	u_short		p_xstat;	/* (c) Exit status; also stop sig. */
 	struct knlist	p_klist;	/* (c) Knotes attached to this proc. */
 	int		p_numthreads;	/* (j) Number of threads. */
-	int		p_numksegrps;	/* (c) Number of ksegrps. */
 	struct mdproc	p_md;		/* Any machine-dependent fields. */
 	struct callout	p_itcallout;	/* (h + c) Interval timer callout. */
 	u_short		p_acflag;	/* (c) Accounting flags. */
-	struct rusage	*p_ru;		/* (a) Exit information. XXX */
 	struct proc	*p_peers;	/* (r) */
 	struct proc	*p_leader;	/* (b) */
 	void		*p_emuldata;	/* (c) Emulator state data. */
 	struct label	*p_label;	/* (*) Proc (not subject) MAC label. */
 	struct p_sched	*p_sched;	/* (*) Scheduler-specific data. */
+	STAILQ_HEAD(, ktr_request)	p_ktr;	/* (o) KTR event queue. */
+	LIST_HEAD(, mqueue_notifier)	p_mqnotifier; /* (c) mqueue notifiers.*/
 };
 
 #define	p_session	p_pgrp->pg_session
@@ -610,6 +590,9 @@
 
 #define	NOCPU	0xff		/* For when we aren't on a CPU. */
 
+#define	PROC_SLOCK(p)	mtx_lock_spin(&(p)->p_slock)
+#define	PROC_SUNLOCK(p)	mtx_unlock_spin(&(p)->p_slock)
+#define	PROC_SLOCK_ASSERT(p, type)	mtx_assert(&(p)->p_slock, (type))
 
 /* These flags are kept in p_flag. */
 #define	P_ADVLOCK	0x00001	/* Process may hold a POSIX advisory lock. */
@@ -640,20 +623,13 @@
 #define	P_JAILED	0x1000000 /* Process is in jail. */
 #define	P_INEXEC	0x4000000 /* Process is in execve(). */
 #define	P_STATCHILD	0x8000000 /* Child process stopped or exited. */
+#define	P_INMEM		0x10000000 /* Loaded into memory. */
+#define	P_SWAPPINGOUT	0x20000000 /* Process is being swapped out. */
+#define	P_SWAPPINGIN	0x40000000 /* Process is being swapped in. */
 
 #define	P_STOPPED	(P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE)
 #define	P_SHOULDSTOP(p)	((p)->p_flag & P_STOPPED)
 
-/* These flags are kept in p_sflag and are protected with sched_lock. */
-#define	PS_INMEM	0x00001	/* Loaded into memory. */
-#define	PS_XCPU		0x00002 /* Exceeded CPU limit. */
-#define	PS_ALRMPEND	0x00020	/* Pending SIGVTALRM needs to be posted. */
-#define	PS_PROFPEND	0x00040	/* Pending SIGPROF needs to be posted. */
-#define	PS_SWAPINREQ	0x00100	/* Swapin request due to wakeup. */
-#define	PS_SWAPPINGOUT	0x00200	/* Process is being swapped out. */
-#define	PS_SWAPPINGIN	0x04000	/* Process is being swapped in. */
-#define	PS_MACPEND	0x08000	/* AST-based MAC event pending. */
-
 /*
  * These were process status values (p_stat), now they are only used in
  * legacy conversion code.
@@ -675,19 +651,12 @@
 #define	SW_INVOL	0x0002		/* Involuntary switch. */
 #define SW_PREEMPT	0x0004		/* The invol switch is a preemption */
 
-/* Flags for setrunqueue().  Why are we setting this thread on the run queue? */
-#define SRQ_BORING	0x0000		/* No special circumstances. */
-#define SRQ_YIELDING	0x0001		/* We are yielding (from mi_switch). */
-#define SRQ_OURSELF	0x0002		/* It is ourself (from mi_switch). */
-#define SRQ_INTR	0x0004		/* It is probably urgent. */
-#define SRQ_PREEMPTED	0x0008		/* has been preempted.. be kind */
-
 /* How values for thread_single(). */
 #define	SINGLE_NO_EXIT	0
 #define	SINGLE_EXIT	1
 #define	SINGLE_BOUNDARY	2
 
-/* XXXKSE: Missing values for thread_suspsend_check(). */
+/* XXXKSE: Missing values for thread_suspend_check(). */
 
 #ifdef MALLOC_DECLARE
 MALLOC_DECLARE(M_PARGS);
@@ -699,18 +668,13 @@
 
 #define	FOREACH_PROC_IN_SYSTEM(p)					\
 	LIST_FOREACH((p), &allproc, p_list)
-#define	FOREACH_KSEGRP_IN_PROC(p, kg)					\
-	TAILQ_FOREACH((kg), &(p)->p_ksegrps, kg_ksegrp)
-#define	FOREACH_THREAD_IN_GROUP(kg, td)					\
-	TAILQ_FOREACH((td), &(kg)->kg_threads, td_kglist)
-#define	FOREACH_UPCALL_IN_GROUP(kg, ku)					\
-	TAILQ_FOREACH((ku), &(kg)->kg_upcalls, ku_link)
 #define	FOREACH_THREAD_IN_PROC(p, td)					\
 	TAILQ_FOREACH((td), &(p)->p_threads, td_plist)
+#define	FOREACH_UPCALL_IN_PROC(p, ku)					\
+	TAILQ_FOREACH((ku), &(p)->p_upcalls, ku_link)
 
 /* XXXKSE the following lines should probably only be used in 1:1 code: */
 #define	FIRST_THREAD_IN_PROC(p)	TAILQ_FIRST(&(p)->p_threads)
-#define	FIRST_KSEGRP_IN_PROC(p)	TAILQ_FIRST(&(p)->p_ksegrps)
 
 /*
  * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t,
@@ -733,7 +697,7 @@
 } while (0)
 #define	_STOPEVENT(p, e, v) do {					\
 	PROC_LOCK_ASSERT(p, MA_OWNED);					\
-	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &p->p_mtx.mtx_object, \
+	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, &p->p_mtx.lock_object, \
  	    "checking stopevent %d", (e));				\
 	if ((p)->p_stops & (e))						\
 		stopevent((p), (e), (v));				\
@@ -778,9 +742,12 @@
 	KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc,		\
 	    ("PHOLD of exiting process"));				\
 	(p)->p_lock++;							\
-	if (((p)->p_sflag & PS_INMEM) == 0)				\
+	if (((p)->p_flag & P_INMEM) == 0)				\
 		faultin((p));						\
 } while (0)
+#define PROC_ASSERT_HELD(p) do {					\
+	KASSERT((p)->p_lock > 0, ("process not held"));			\
+} while (0)
 
 #define	PRELE(p) do {							\
 	PROC_LOCK((p));							\
@@ -793,6 +760,9 @@
 	if (((p)->p_flag & P_WEXIT) && (p)->p_lock == 0)		\
 		wakeup(&(p)->p_lock);					\
 } while (0)
+#define PROC_ASSERT_NOT_HELD(p) do {					\
+	KASSERT((p)->p_lock == 0, ("process held"));			\
+} while (0)
 
 /* Check whether a thread is safe to be swapped out. */
 #define	thread_safetoswapout(td) (TD_IS_SLEEPING(td) || TD_IS_SUSPENDED(td))
@@ -810,10 +780,6 @@
 	curthread->td_pflags &= ~TDP_NOSLEEPING;			\
 } while (0)
 
-/* Lock and unlock process arguments. */
-#define	PARGS_LOCK(p)		mtx_lock(&pargs_ref_lock)
-#define	PARGS_UNLOCK(p)		mtx_unlock(&pargs_ref_lock)
-
 #define	PIDHASH(pid)	(&pidhashtbl[(pid) & pidhash])
 extern LIST_HEAD(pidhashhead, proc) *pidhashtbl;
 extern u_long pidhash;
@@ -824,9 +790,7 @@
 
 extern struct sx allproc_lock;
 extern struct sx proctree_lock;
-extern struct mtx pargs_ref_lock;
 extern struct mtx ppeers_lock;
-extern struct ksegrp ksegrp0;		/* Primary ksegrp in proc0. */
 extern struct proc proc0;		/* Process slot for swapper. */
 extern struct thread thread0;		/* Primary thread in proc0. */
 extern struct vmspace vmspace0;		/* VM space for proc0. */
@@ -835,7 +799,6 @@
 extern int nprocs, maxproc;		/* Current and max number of procs. */
 extern int maxprocperuid;		/* Max procs per uid. */
 extern u_long ps_arg_cache_limit;
-extern int sched_quantum;		/* Scheduling quantum in ticks. */
 
 LIST_HEAD(proclist, proc);
 TAILQ_HEAD(procqueue, proc);
@@ -850,7 +813,6 @@
 struct	pgrp *pgfind(pid_t);		/* Find process group by id. */
 struct	proc *zpfind(pid_t);		/* Find zombie process by id. */
 
-void	adjustrunqueue(struct thread *, int newpri);
 void	ast(struct trapframe *framep);
 struct	thread *choosethread(void);
 int	cr_cansignal(struct ucred *cred, struct proc *proc, int signum);
@@ -878,7 +840,8 @@
 void	pargs_free(struct pargs *pa);
 void	pargs_hold(struct pargs *pa);
 void	procinit(void);
-void	proc_linkup(struct proc *p, struct ksegrp *kg, struct thread *td);
+void	proc_linkup0(struct proc *p, struct thread *td);
+void	proc_linkup(struct proc *p, struct thread *td);
 void	proc_reparent(struct proc *child, struct proc *newparent);
 struct	pstats *pstats_alloc(void);
 void	pstats_fork(struct pstats *src, struct pstats *dst);
@@ -887,7 +850,6 @@
 int	securelevel_gt(struct ucred *cr, int level);
 void	sessrele(struct session *);
 void	setrunnable(struct thread *);
-void	setrunqueue(struct thread *, int flags);
 void	setsugid(struct proc *p);
 int	sigonstack(size_t sp);
 void	sleepinit(void);
@@ -895,10 +857,10 @@
 void	threadinit(void);
 void	cpu_idle(void);
 extern	void (*cpu_idle_hook)(void);	/* Hook to machdep CPU idler. */
-void	cpu_switch(struct thread *old, struct thread *new);
-void	cpu_throw(struct thread *old, struct thread *new) __dead2;
+void	cpu_switch(struct thread *, struct thread *, struct mtx *);
+void	cpu_throw(struct thread *, struct thread *) __dead2;
 void	unsleep(struct thread *);
-void	userret(struct thread *, struct trapframe *, u_int);
+void	userret(struct thread *, struct trapframe *);
 
 void	cpu_exit(struct thread *);
 void	exit1(struct thread *, int) __dead2;
@@ -906,38 +868,38 @@
 void	cpu_set_fork_handler(struct thread *, void (*)(void *), void *);
 
 /* New in KSE. */
-struct	ksegrp *ksegrp_alloc(void);
-void	ksegrp_free(struct ksegrp *kg);
-void	ksegrp_stash(struct ksegrp *kg);
-void	kse_GC(void);
+#ifdef KSE
+void	kse_unlink(struct thread *);
 void	kseinit(void);
+void	upcall_reap(void);
+void	upcall_remove(struct thread *td);
+#endif
 void	cpu_set_upcall(struct thread *td, struct thread *td0);
 void	cpu_set_upcall_kse(struct thread *, void (*)(void *), void *, stack_t *);
 int	cpu_set_user_tls(struct thread *, void *tls_base);
 void	cpu_thread_clean(struct thread *);
 void	cpu_thread_exit(struct thread *);
 void	cpu_thread_setup(struct thread *td);
-void	cpu_thread_siginfo(int sig, u_long code, siginfo_t *si);
 void	cpu_thread_swapin(struct thread *);
 void	cpu_thread_swapout(struct thread *);
-void	ksegrp_link(struct ksegrp *kg, struct proc *p);
-void	ksegrp_unlink(struct ksegrp *kg);
 struct	thread *thread_alloc(void);
 void	thread_continued(struct proc *p);
 void	thread_exit(void) __dead2;
 int	thread_export_context(struct thread *td, int willexit);
 void	thread_free(struct thread *td);
-void	thread_link(struct thread *td, struct ksegrp *kg);
+void	thread_link(struct thread *td, struct proc *p);
 void	thread_reap(void);
-struct thread *thread_schedule_upcall(struct thread *td, struct kse_upcall *ku);
-void	thread_signal_add(struct thread *td, int sig);
+void	thread_signal_add(struct thread *td, ksiginfo_t *);
 int	thread_single(int how);
 void	thread_single_end(void);
-int	thread_sleep_check(struct thread *td);
 void	thread_stash(struct thread *td);
 int	thread_statclock(int user);
 void	thread_stopped(struct proc *p);
+void	childproc_stopped(struct proc *child, int reason);
+void	childproc_continued(struct proc *child);
+void	childproc_exited(struct proc *child);
 int	thread_suspend_check(int how);
+void	thread_suspend_switch(struct thread *);
 void	thread_suspend_one(struct thread *td);
 struct thread *thread_switchout(struct thread *td, int flags,
 	    struct thread *newtd);
@@ -948,13 +910,8 @@
 int	thread_userret(struct thread *td, struct trapframe *frame);
 void	thread_user_enter(struct thread *td);
 void	thread_wait(struct proc *p);
+struct thread	*thread_find(struct proc *p, lwpid_t tid);
 void	thr_exit1(void);
-struct kse_upcall *upcall_alloc(void);
-void	upcall_free(struct kse_upcall *ku);
-void	upcall_link(struct kse_upcall *ku, struct ksegrp *kg);
-void	upcall_unlink(struct kse_upcall *ku);
-void	upcall_remove(struct thread *td);
-void	upcall_stash(struct kse_upcall *ke);
 
 #endif	/* _KERNEL */
 
Index: mac.h
===================================================================
RCS file: /home/cvs/src/sys/sys/mac.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/mac.h -L sys/sys/mac.h -u -r1.1.1.1 -r1.2
--- sys/sys/mac.h
+++ sys/sys/mac.h
@@ -1,7 +1,7 @@
 /*-
  * Copyright (c) 1999-2002 Robert N. M. Watson
  * Copyright (c) 2001-2005 Networks Associates Technology, Inc.
- * Copyright (c) 2005 SPARTA, Inc.
+ * Copyright (c) 2005-2006 SPARTA, Inc.
  * All rights reserved.
  *
  * This software was developed by Robert Watson for the TrustedBSD Project.
@@ -35,20 +35,18 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/mac.h,v 1.67.2.2 2005/10/05 10:31:05 rwatson Exp $
+ * $FreeBSD: src/sys/sys/mac.h,v 1.74 2007/02/06 16:24:57 rwatson Exp $
  */
 /*
- * Userland/kernel interface for Mandatory Access Control.
+ * Userland interface for Mandatory Access Control.  Loosely based on the
+ * POSIX.1e API.  More information may be found at:
  *
- * The POSIX.1e implementation page may be reached at:
- * http://www.trustedbsd.org/
+ * http://www.TrustedBSD.org/
  */
 
 #ifndef _SYS_MAC_H_
 #define	_SYS_MAC_H_
 
-#include <sys/_label.h>
-
 #ifndef _POSIX_MAC
 #define	_POSIX_MAC
 #endif
@@ -61,6 +59,10 @@
 #define	MAC_MAX_LABEL_ELEMENT_DATA	4096
 #define	MAC_MAX_LABEL_BUF_LEN		8192
 
+/*
+ * struct mac is the data structure used to carry MAC labels in system calls
+ * and ioctls between userspace and the kernel.
+ */
 struct mac {
 	size_t		 m_buflen;
 	char		*m_string;
@@ -72,14 +74,13 @@
 
 /*
  * Location of the userland MAC framework configuration file.  mac.conf
- * binds policy names to shared libraries that understand those policies,
- * as well as setting defaults for MAC-aware applications.
+ * set defaults for MAC-aware applications.
  */
 #define	MAC_CONFFILE	"/etc/mac.conf"
 
 /*
- * Extended non-POSIX.1e interfaces that offer additional services
- * available from the userland and kernel MAC frameworks.
+ * Extended non-POSIX.1e interfaces that offer additional services available
+ * from the userland and kernel MAC frameworks.
  */
 __BEGIN_DECLS
 int	 mac_execve(char *fname, char **argv, char **envv, mac_t _label);
@@ -105,371 +106,6 @@
 int	 mac_to_text(mac_t mac, char **_text);
 __END_DECLS
 
-#else /* _KERNEL */
-
-/*
- * Kernel functions to manage and evaluate labels.
- */
-struct bpf_d;
-struct cdev;
-struct componentname;
-struct devfs_dirent;
-struct ifnet;
-struct ifreq;
-struct inpcb;
-struct image_params;
-struct inpcb;
-struct ipq;
-struct ksem;
-struct m_tag;
-struct mbuf;
-struct mount;
-struct msg;
-struct msqid_kernel;
-struct proc;
-struct semid_kernel;
-struct shmid_kernel;
-struct sockaddr;
-struct socket;
-struct sysctl_oid;
-struct sysctl_req;
-struct pipepair;
-struct thread;
-struct timespec;
-struct ucred;
-struct uio;
-struct vattr;
-struct vnode;
-
-#include <sys/acl.h>			/* XXX acl_type_t */
-
-struct vop_setlabel_args;
-
-/*
- * Label operations.
- */
-void	mac_init_bpfdesc(struct bpf_d *);
-void	mac_init_cred(struct ucred *);
-void	mac_init_devfsdirent(struct devfs_dirent *);
-void	mac_init_ifnet(struct ifnet *);
-int	mac_init_inpcb(struct inpcb *, int flag);
-void	mac_init_sysv_msgmsg(struct msg *);
-void	mac_init_sysv_msgqueue(struct msqid_kernel*);
-void	mac_init_sysv_sem(struct semid_kernel*);
-void	mac_init_sysv_shm(struct shmid_kernel*);
-int	mac_init_ipq(struct ipq *, int flag);
-int	mac_init_socket(struct socket *, int flag);
-void	mac_init_pipe(struct pipepair *);
-void	mac_init_posix_sem(struct ksem *);
-int	mac_init_mbuf(struct mbuf *mbuf, int flag);
-int	mac_init_mbuf_tag(struct m_tag *, int flag);
-void	mac_init_mount(struct mount *);
-void	mac_init_proc(struct proc *);
-void	mac_init_vnode(struct vnode *);
-void	mac_copy_mbuf(struct mbuf *m_from, struct mbuf *m_to);
-void	mac_copy_mbuf_tag(struct m_tag *, struct m_tag *);
-void	mac_copy_vnode_label(struct label *, struct label *label);
-void	mac_destroy_bpfdesc(struct bpf_d *);
-void	mac_destroy_cred(struct ucred *);
-void	mac_destroy_devfsdirent(struct devfs_dirent *);
-void	mac_destroy_ifnet(struct ifnet *);
-void	mac_destroy_inpcb(struct inpcb *);
-void	mac_destroy_sysv_msgmsg(struct msg *);
-void	mac_destroy_sysv_msgqueue(struct msqid_kernel *);
-void	mac_destroy_sysv_sem(struct semid_kernel *);
-void	mac_destroy_sysv_shm(struct shmid_kernel *);
-void	mac_destroy_ipq(struct ipq *);
-void	mac_destroy_socket(struct socket *);
-void	mac_destroy_pipe(struct pipepair *);
-void	mac_destroy_posix_sem(struct ksem *);
-void	mac_destroy_proc(struct proc *);
-void	mac_destroy_mbuf_tag(struct m_tag *);
-void	mac_destroy_mount(struct mount *);
-void	mac_destroy_vnode(struct vnode *);
-
-struct label	*mac_cred_label_alloc(void);
-void		 mac_cred_label_free(struct label *label);
-struct label	*mac_vnode_label_alloc(void);
-void		 mac_vnode_label_free(struct label *label);
-
-/*
- * Labeling event operations: file system objects, and things that
- * look a lot like file system objects.
- */
-void	mac_associate_vnode_devfs(struct mount *mp, struct devfs_dirent *de,
-	    struct vnode *vp);
-int	mac_associate_vnode_extattr(struct mount *mp, struct vnode *vp);
-void	mac_associate_vnode_singlelabel(struct mount *mp, struct vnode *vp);
-void	mac_create_devfs_device(struct ucred *cred, struct mount *mp,
-	    struct cdev *dev, struct devfs_dirent *de);
-void	mac_create_devfs_directory(struct mount *mp, char *dirname,
-	    int dirnamelen, struct devfs_dirent *de);
-void	mac_create_devfs_symlink(struct ucred *cred, struct mount *mp,
-	    struct devfs_dirent *dd, struct devfs_dirent *de);
-int	mac_create_vnode_extattr(struct ucred *cred, struct mount *mp,
-	    struct vnode *dvp, struct vnode *vp, struct componentname *cnp);
-void	mac_create_mount(struct ucred *cred, struct mount *mp);
-void	mac_relabel_vnode(struct ucred *cred, struct vnode *vp,
-	    struct label *newlabel);
-void	mac_update_devfsdirent(struct mount *mp, struct devfs_dirent *de,
-	    struct vnode *vp);
-
-/*
- * Labeling event operations: IPC objects.
- */
-void	mac_create_mbuf_from_socket(struct socket *so, struct mbuf *m);
-void	mac_create_socket(struct ucred *cred, struct socket *socket);
-void	mac_create_socket_from_socket(struct socket *oldsocket,
-	    struct socket *newsocket);
-void	mac_set_socket_peer_from_mbuf(struct mbuf *mbuf,
-	    struct socket *socket);
-void	mac_set_socket_peer_from_socket(struct socket *oldsocket,
-	    struct socket *newsocket);
-void	mac_create_pipe(struct ucred *cred, struct pipepair *pp);
-
-/*
- * Labeling event operations: System V IPC primitives
- */
-void	mac_create_sysv_msgmsg(struct ucred *cred,
-	    struct msqid_kernel *msqkptr, struct msg *msgptr);
-void	mac_create_sysv_msgqueue(struct ucred *cred,
-	    struct msqid_kernel *msqkptr);
-void	mac_create_sysv_sem(struct ucred *cred,
-	    struct semid_kernel *semakptr);
-void	mac_create_sysv_shm(struct ucred *cred,
-	    struct shmid_kernel *shmsegptr);
-
-/*
- * Labeling event operations: POSIX (global/inter-process) semaphores.
- */
-void 	mac_create_posix_sem(struct ucred *cred, struct ksem *ksemptr);
-
-
-/*
- * Labeling event operations: network objects.
- */
-void	mac_create_bpfdesc(struct ucred *cred, struct bpf_d *bpf_d);
-void	mac_create_ifnet(struct ifnet *ifp);
-void	mac_create_inpcb_from_socket(struct socket *so, struct inpcb *inp);
-void	mac_create_ipq(struct mbuf *fragment, struct ipq *ipq);
-void	mac_create_datagram_from_ipq(struct ipq *ipq, struct mbuf *datagram);
-void	mac_create_fragment(struct mbuf *datagram, struct mbuf *fragment);
-void	mac_create_mbuf_from_inpcb(struct inpcb *inp, struct mbuf *m);
-void	mac_create_mbuf_linklayer(struct ifnet *ifnet, struct mbuf *m);
-void	mac_create_mbuf_from_bpfdesc(struct bpf_d *bpf_d, struct mbuf *m);
-void	mac_create_mbuf_from_ifnet(struct ifnet *ifnet, struct mbuf *m);
-void	mac_create_mbuf_multicast_encap(struct mbuf *oldmbuf,
-	    struct ifnet *ifnet, struct mbuf *newmbuf);
-void	mac_create_mbuf_netlayer(struct mbuf *oldmbuf, struct mbuf *newmbuf);
-int	mac_fragment_match(struct mbuf *fragment, struct ipq *ipq);
-void	mac_reflect_mbuf_icmp(struct mbuf *m);
-void	mac_reflect_mbuf_tcp(struct mbuf *m);
-void	mac_update_ipq(struct mbuf *fragment, struct ipq *ipq);
-void	mac_inpcb_sosetlabel(struct socket *so, struct inpcb *inp);
-
-/*
- * Labeling event operations: processes.
- */
-void	mac_copy_cred(struct ucred *cr1, struct ucred *cr2);
-int	mac_execve_enter(struct image_params *imgp, struct mac *mac_p);
-void	mac_execve_exit(struct image_params *imgp);
-void	mac_execve_transition(struct ucred *old, struct ucred *new,
-	    struct vnode *vp, struct label *interpvnodelabel,
-	    struct image_params *imgp);
-int	mac_execve_will_transition(struct ucred *old, struct vnode *vp,
-	    struct label *interpvnodelabel, struct image_params *imgp);
-void	mac_create_proc0(struct ucred *cred);
-void	mac_create_proc1(struct ucred *cred);
-void	mac_thread_userret(struct thread *td);
-
-/*
- * Label cleanup operation: This is the inverse complement for the
- * mac_create and associate type of hooks. This hook lets the policy
- * module(s) perform a cleanup/flushing operation on the label
- * associated with the objects, without freeing up the space allocated.
- * This hook is useful in cases where it is desirable to remove any
- * labeling reference when recycling any object to a pool. This hook
- * does not replace the mac_destroy hooks.
- */
-void	mac_cleanup_sysv_msgmsg(struct msg *msgptr);
-void	mac_cleanup_sysv_msgqueue(struct msqid_kernel *msqkptr);
-void	mac_cleanup_sysv_sem(struct semid_kernel *semakptr);
-void	mac_cleanup_sysv_shm(struct shmid_kernel *shmsegptr);
-
-/* Access control checks. */
-int	mac_check_bpfdesc_receive(struct bpf_d *bpf_d, struct ifnet *ifnet);
-int	mac_check_cred_visible(struct ucred *u1, struct ucred *u2);
-int	mac_check_ifnet_transmit(struct ifnet *ifnet, struct mbuf *m);
-int	mac_check_inpcb_deliver(struct inpcb *inp, struct mbuf *m);
-int	mac_check_sysv_msgmsq(struct ucred *cred, struct msg *msgptr,
-	    struct msqid_kernel *msqkptr);
-int	mac_check_sysv_msgrcv(struct ucred *cred, struct msg *msgptr);
-int	mac_check_sysv_msgrmid(struct ucred *cred, struct msg *msgptr);
-int	mac_check_sysv_msqget(struct ucred *cred,
-	    struct msqid_kernel *msqkptr);
-int	mac_check_sysv_msqsnd(struct ucred *cred,
-	    struct msqid_kernel *msqkptr);
-int	mac_check_sysv_msqrcv(struct ucred *cred,
-	    struct msqid_kernel *msqkptr);
-int	mac_check_sysv_msqctl(struct ucred *cred,
-	    struct msqid_kernel *msqkptr, int cmd);
-int	mac_check_sysv_semctl(struct ucred *cred,
-	    struct semid_kernel *semakptr, int cmd);
-int	mac_check_sysv_semget(struct ucred *cred,
-	   struct semid_kernel *semakptr);
-int	mac_check_sysv_semop(struct ucred *cred,struct semid_kernel *semakptr,
-	    size_t accesstype);
-int	mac_check_sysv_shmat(struct ucred *cred,
-	    struct shmid_kernel *shmsegptr, int shmflg);
-int	mac_check_sysv_shmctl(struct ucred *cred,
-	    struct shmid_kernel *shmsegptr, int cmd);
-int	mac_check_sysv_shmdt(struct ucred *cred,
-	    struct shmid_kernel *shmsegptr);
-int	mac_check_sysv_shmget(struct ucred *cred,
-	    struct shmid_kernel *shmsegptr, int shmflg);
-int	mac_check_kenv_dump(struct ucred *cred);
-int	mac_check_kenv_get(struct ucred *cred, char *name);
-int	mac_check_kenv_set(struct ucred *cred, char *name, char *value);
-int	mac_check_kenv_unset(struct ucred *cred, char *name);
-int	mac_check_kld_load(struct ucred *cred, struct vnode *vp);
-int	mac_check_kld_stat(struct ucred *cred);
-int	mac_check_kld_unload(struct ucred *cred);
-int	mac_check_mount_stat(struct ucred *cred, struct mount *mp);
-int	mac_check_pipe_ioctl(struct ucred *cred, struct pipepair *pp,
-	    unsigned long cmd, void *data);
-int	mac_check_pipe_poll(struct ucred *cred, struct pipepair *pp);
-int	mac_check_pipe_read(struct ucred *cred, struct pipepair *pp);
-int	mac_check_pipe_stat(struct ucred *cred, struct pipepair *pp);
-int	mac_check_pipe_write(struct ucred *cred, struct pipepair *pp);
-int	mac_check_posix_sem_destroy(struct ucred *cred, struct ksem *ksemptr);
-int	mac_check_posix_sem_getvalue(struct ucred *cred,struct ksem *ksemptr);
-int	mac_check_posix_sem_open(struct ucred *cred, struct ksem *ksemptr);
-int	mac_check_posix_sem_post(struct ucred *cred, struct ksem *ksemptr);
-int	mac_check_posix_sem_unlink(struct ucred *cred, struct ksem *ksemptr);
-int	mac_check_posix_sem_wait(struct ucred *cred, struct ksem *ksemptr);
-int	mac_check_proc_debug(struct ucred *cred, struct proc *proc);
-int	mac_check_proc_sched(struct ucred *cred, struct proc *proc);
-int	mac_check_proc_setuid(struct proc *proc,  struct ucred *cred,
-	    uid_t uid);
-int	mac_check_proc_seteuid(struct proc *proc, struct ucred *cred,
-	    uid_t euid);
-int	mac_check_proc_setgid(struct proc *proc, struct ucred *cred,
-	    gid_t gid);
-int	mac_check_proc_setegid(struct proc *proc, struct ucred *cred,
-	    gid_t egid);
-int	mac_check_proc_setgroups(struct proc *proc, struct ucred *cred,
-	    int ngroups, gid_t *gidset);
-int	mac_check_proc_setreuid(struct proc *proc, struct ucred *cred,
-	    uid_t ruid, uid_t euid);
-int	mac_check_proc_setregid(struct proc *proc, struct ucred *cred,
-	    gid_t rgid, gid_t egid);
-int	mac_check_proc_setresuid(struct proc *proc, struct ucred *cred,
-	    uid_t ruid, uid_t euid, uid_t suid);
-int	mac_check_proc_setresgid(struct proc *proc, struct ucred *cred,
-	    gid_t rgid, gid_t egid, gid_t sgid);
-int	mac_check_proc_signal(struct ucred *cred, struct proc *proc,
-	    int signum);
-int	mac_check_proc_wait(struct ucred *cred, struct proc *proc);
-int	mac_check_socket_accept(struct ucred *cred, struct socket *so);
-int	mac_check_socket_bind(struct ucred *cred, struct socket *so,
-	    struct sockaddr *sockaddr);
-int	mac_check_socket_connect(struct ucred *cred, struct socket *so,
-	    struct sockaddr *sockaddr);
-int	mac_check_socket_create(struct ucred *cred, int domain, int type,
-	    int protocol);
-int	mac_check_socket_deliver(struct socket *so, struct mbuf *m);
-int	mac_check_socket_listen(struct ucred *cred, struct socket *so);
-int	mac_check_socket_poll(struct ucred *cred, struct socket *so);
-int	mac_check_socket_receive(struct ucred *cred, struct socket *so);
-int	mac_check_socket_send(struct ucred *cred, struct socket *so);
-int	mac_check_socket_stat(struct ucred *cred, struct socket *so);
-int	mac_check_socket_visible(struct ucred *cred, struct socket *so);
-int	mac_check_sysarch_ioperm(struct ucred *cred);
-int	mac_check_system_acct(struct ucred *cred, struct vnode *vp);
-int	mac_check_system_nfsd(struct ucred *cred);
-int	mac_check_system_reboot(struct ucred *cred, int howto);
-int	mac_check_system_settime(struct ucred *cred);
-int	mac_check_system_swapon(struct ucred *cred, struct vnode *vp);
-int	mac_check_system_swapoff(struct ucred *cred, struct vnode *vp);
-int	mac_check_system_sysctl(struct ucred *cred, struct sysctl_oid *oidp,
-	    void *arg1, int arg2, struct sysctl_req *req);
-int	mac_check_vnode_access(struct ucred *cred, struct vnode *vp,
-	    int acc_mode);
-int	mac_check_vnode_chdir(struct ucred *cred, struct vnode *dvp);
-int	mac_check_vnode_chroot(struct ucred *cred, struct vnode *dvp);
-int	mac_check_vnode_create(struct ucred *cred, struct vnode *dvp,
-	    struct componentname *cnp, struct vattr *vap);
-int	mac_check_vnode_delete(struct ucred *cred, struct vnode *dvp,
-	    struct vnode *vp, struct componentname *cnp);
-int	mac_check_vnode_deleteacl(struct ucred *cred, struct vnode *vp,
-	    acl_type_t type);
-int	mac_check_vnode_deleteextattr(struct ucred *cred, struct vnode *vp,
-	    int attrnamespace, const char *name);
-int	mac_check_vnode_exec(struct ucred *cred, struct vnode *vp,
-	    struct image_params *imgp);
-int	mac_check_vnode_getacl(struct ucred *cred, struct vnode *vp,
-	    acl_type_t type);
-int	mac_check_vnode_getextattr(struct ucred *cred, struct vnode *vp,
-	    int attrnamespace, const char *name, struct uio *uio);
-int	mac_check_vnode_link(struct ucred *cred, struct vnode *dvp,
-	    struct vnode *vp, struct componentname *cnp);
-int	mac_check_vnode_listextattr(struct ucred *cred, struct vnode *vp,
-	    int attrnamespace);
-int	mac_check_vnode_lookup(struct ucred *cred, struct vnode *dvp,
- 	    struct componentname *cnp);
-int	mac_check_vnode_mmap(struct ucred *cred, struct vnode *vp,
-	    int prot, int flags);
-int	mac_check_vnode_mprotect(struct ucred *cred, struct vnode *vp,
-	    int prot);
-int	mac_check_vnode_open(struct ucred *cred, struct vnode *vp,
-	    int acc_mode);
-int	mac_check_vnode_poll(struct ucred *active_cred,
-	    struct ucred *file_cred, struct vnode *vp);
-int	mac_check_vnode_read(struct ucred *active_cred,
-	    struct ucred *file_cred, struct vnode *vp);
-int	mac_check_vnode_readdir(struct ucred *cred, struct vnode *vp);
-int	mac_check_vnode_readlink(struct ucred *cred, struct vnode *vp);
-int	mac_check_vnode_rename_from(struct ucred *cred, struct vnode *dvp,
-	    struct vnode *vp, struct componentname *cnp);
-int	mac_check_vnode_rename_to(struct ucred *cred, struct vnode *dvp,
-	    struct vnode *vp, int samedir, struct componentname *cnp);
-int	mac_check_vnode_revoke(struct ucred *cred, struct vnode *vp);
-int	mac_check_vnode_setacl(struct ucred *cred, struct vnode *vp,
-	    acl_type_t type, struct acl *acl);
-int	mac_check_vnode_setextattr(struct ucred *cred, struct vnode *vp,
-	    int attrnamespace, const char *name, struct uio *uio);
-int	mac_check_vnode_setflags(struct ucred *cred, struct vnode *vp,
-	    u_long flags);
-int	mac_check_vnode_setmode(struct ucred *cred, struct vnode *vp,
-	    mode_t mode);
-int	mac_check_vnode_setowner(struct ucred *cred, struct vnode *vp,
-	    uid_t uid, gid_t gid);
-int	mac_check_vnode_setutimes(struct ucred *cred, struct vnode *vp,
-	    struct timespec atime, struct timespec mtime);
-int	mac_check_vnode_stat(struct ucred *active_cred,
-	    struct ucred *file_cred, struct vnode *vp);
-int	mac_check_vnode_write(struct ucred *active_cred,
-	    struct ucred *file_cred, struct vnode *vp);
-int	mac_getsockopt_label(struct ucred *cred, struct socket *so,
-	    struct mac *extmac);
-int	mac_getsockopt_peerlabel(struct ucred *cred, struct socket *so,
-	    struct mac *extmac);
-int	mac_ioctl_ifnet_get(struct ucred *cred, struct ifreq *ifr,
-	    struct ifnet *ifnet);
-int	mac_ioctl_ifnet_set(struct ucred *cred, struct ifreq *ifr,
-	    struct ifnet *ifnet);
-int	mac_setsockopt_label(struct ucred *cred, struct socket *so,
-	    struct mac *extmac);
-int	mac_pipe_label_set(struct ucred *cred, struct pipepair *pp,
-	    struct label *label);
-void	mac_cred_mmapped_drop_perms(struct thread *td, struct ucred *cred);
-
-/*
- * Calls to help various file systems implement labeling functionality
- * using their existing EA implementation.
- */
-int	vop_stdsetlabel_ea(struct vop_setlabel_args *ap);
-
 #endif /* !_KERNEL */
 
 #endif /* !_SYS_MAC_H_ */
Index: dirent.h
===================================================================
RCS file: /home/cvs/src/sys/sys/dirent.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/dirent.h -L sys/sys/dirent.h -u -r1.1.1.1 -r1.2
--- sys/sys/dirent.h
+++ sys/sys/dirent.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)dirent.h	8.3 (Berkeley) 8/10/94
- * $FreeBSD: src/sys/sys/dirent.h,v 1.14 2004/04/07 04:19:49 imp Exp $
+ * $FreeBSD: src/sys/sys/dirent.h,v 1.15 2006/08/16 09:34:56 maxim Exp $
  */
 
 #ifndef	_SYS_DIRENT_H_
@@ -82,7 +82,7 @@
 
 /*
  * The _GENERIC_DIRSIZ macro gives the minimum record length which will hold
- * the directory entry.  This requires the amount of space in struct direct
+ * the directory entry.  This returns the amount of space in struct direct
  * without the d_name field, plus enough space for the name with a terminating
  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  *
Index: libkern.h
===================================================================
RCS file: /home/cvs/src/sys/sys/libkern.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/libkern.h -L sys/sys/libkern.h -u -r1.1.1.1 -r1.2
--- sys/sys/libkern.h
+++ sys/sys/libkern.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)libkern.h	8.1 (Berkeley) 6/10/93
- * $FreeBSD: src/sys/sys/libkern.h,v 1.49.2.1 2005/08/16 08:10:59 pjd Exp $
+ * $FreeBSD: src/sys/sys/libkern.h,v 1.56 2007/04/10 21:42:12 wkoszek Exp $
  */
 
 #ifndef _SYS_LIBKERN_H_
@@ -58,6 +58,8 @@
 static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); }
 static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); }
 static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); }
+static __inline off_t omax(off_t a, off_t b) { return (a > b ? a : b); }
+static __inline off_t omin(off_t a, off_t b) { return (a < b ? a : b); }
 
 static __inline int abs(int a) { return (a < 0 ? -a : a); }
 static __inline long labs(long a) { return (a < 0 ? -a : a); }
@@ -108,6 +110,7 @@
 char	*strncpy(char * __restrict, const char * __restrict, size_t);
 char	*strsep(char **, const char *delim);
 size_t	 strspn(const char *, const char *);
+char	*strstr(const char *, const char *);
 int	 strvalid(const char *, size_t);
 
 extern uint32_t crc32_tab[];
@@ -115,7 +118,7 @@
 static __inline uint32_t
 crc32_raw(const void *buf, size_t size, uint32_t crc)
 {
-	const uint8_t *p = buf;
+	const uint8_t *p = (const uint8_t *)buf;
 
 	while (size--)
 		crc = crc32_tab[(crc ^ *p++) & 0xFF] ^ (crc >> 8);
@@ -150,6 +153,18 @@
 	return (b);
 }
 
+static __inline char *
+strchr(const char *p, int ch)
+{
+	return (index(p, ch));
+}
+
+static __inline char *
+strrchr(const char *p, int ch)
+{
+	return (rindex(p, ch));
+}
+
 /* fnmatch() return values. */
 #define	FNM_NOMATCH	1	/* Match failed. */
 
Index: sysproto.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sysproto.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/sysproto.h -L sys/sys/sysproto.h -u -r1.1.1.1 -r1.2
--- sys/sys/sysproto.h
+++ sys/sys/sysproto.h
@@ -2,8 +2,8 @@
  * System call prototypes.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/sys/sysproto.h,v 1.177.2.1 2005/11/21 01:36:28 csjp Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.198.2.1 2005/11/21 01:12:37 csjp Exp 
+ * $FreeBSD: src/sys/sys/sysproto.h,v 1.215 2007/08/16 05:32:26 davidxu Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.232 2007/07/04 22:47:37 peter Exp 
  */
 
 #ifndef _SYS_SYSPROTO_H_
@@ -11,12 +11,11 @@
 
 #include <sys/signal.h>
 #include <sys/acl.h>
-#include <sys/thr.h>
-#include <sys/umtx.h>
-#include <posix4/_semaphore.h>
-
+#include <sys/_semaphore.h>
 #include <sys/ucontext.h>
 
+#include <bsm/audit_kevents.h>
+
 struct proc;
 
 struct thread;
@@ -535,14 +534,14 @@
 	char a3_l_[PADL_(int)]; int a3; char a3_r_[PADR_(int)];
 	char a4_l_[PADL_(int)]; int a4; char a4_r_[PADR_(int)];
 };
-struct pread_args {
+struct freebsd6_pread_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
 	char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
 	char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
 	char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
 	char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
 };
-struct pwrite_args {
+struct freebsd6_pwrite_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
 	char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
 	char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
@@ -595,7 +594,7 @@
 	char count_l_[PADL_(u_int)]; u_int count; char count_r_[PADR_(u_int)];
 	char basep_l_[PADL_(long *)]; long * basep; char basep_r_[PADR_(long *)];
 };
-struct mmap_args {
+struct freebsd6_mmap_args {
 	char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
 	char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
 	char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
@@ -604,18 +603,18 @@
 	char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
 	char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)];
 };
-struct lseek_args {
+struct freebsd6_lseek_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
 	char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
 	char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
 	char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
 };
-struct truncate_args {
+struct freebsd6_truncate_args {
 	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
 	char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
 	char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)];
 };
-struct ftruncate_args {
+struct freebsd6_ftruncate_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
 	char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)];
 	char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)];
@@ -719,6 +718,27 @@
 	char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];
 	char tp_l_[PADL_(struct timespec *)]; struct timespec * tp; char tp_r_[PADR_(struct timespec *)];
 };
+struct ktimer_create_args {
+	char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)];
+	char evp_l_[PADL_(struct sigevent *)]; struct sigevent * evp; char evp_r_[PADR_(struct sigevent *)];
+	char timerid_l_[PADL_(int *)]; int * timerid; char timerid_r_[PADR_(int *)];
+};
+struct ktimer_delete_args {
+	char timerid_l_[PADL_(int)]; int timerid; char timerid_r_[PADR_(int)];
+};
+struct ktimer_settime_args {
+	char timerid_l_[PADL_(int)]; int timerid; char timerid_r_[PADR_(int)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+	char value_l_[PADL_(const struct itimerspec *)]; const struct itimerspec * value; char value_r_[PADR_(const struct itimerspec *)];
+	char ovalue_l_[PADL_(struct itimerspec *)]; struct itimerspec * ovalue; char ovalue_r_[PADR_(struct itimerspec *)];
+};
+struct ktimer_gettime_args {
+	char timerid_l_[PADL_(int)]; int timerid; char timerid_r_[PADR_(int)];
+	char value_l_[PADL_(struct itimerspec *)]; struct itimerspec * value; char value_r_[PADR_(struct itimerspec *)];
+};
+struct ktimer_getoverrun_args {
+	char timerid_l_[PADL_(int)]; int timerid; char timerid_r_[PADR_(int)];
+};
 struct nanosleep_args {
 	char rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)];
 	char rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)];
@@ -747,6 +767,18 @@
 	char uid_l_[PADL_(int)]; int uid; char uid_r_[PADR_(int)];
 	char gid_l_[PADL_(int)]; int gid; char gid_r_[PADR_(int)];
 };
+struct aio_read_args {
+	char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];
+};
+struct aio_write_args {
+	char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];
+};
+struct lio_listio_args {
+	char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];
+	char acb_list_l_[PADL_(struct aiocb *const *)]; struct aiocb *const * acb_list; char acb_list_r_[PADR_(struct aiocb *const *)];
+	char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)];
+	char sig_l_[PADL_(struct sigevent *)]; struct sigevent * sig; char sig_r_[PADR_(struct sigevent *)];
+};
 struct getdents_args {
 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
 	char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)];
@@ -852,17 +884,17 @@
 struct aio_error_args {
 	char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];
 };
-struct aio_read_args {
-	char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];
+struct oaio_read_args {
+	char aiocbp_l_[PADL_(struct oaiocb *)]; struct oaiocb * aiocbp; char aiocbp_r_[PADR_(struct oaiocb *)];
 };
-struct aio_write_args {
-	char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];
+struct oaio_write_args {
+	char aiocbp_l_[PADL_(struct oaiocb *)]; struct oaiocb * aiocbp; char aiocbp_r_[PADR_(struct oaiocb *)];
 };
-struct lio_listio_args {
+struct olio_listio_args {
 	char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];
-	char acb_list_l_[PADL_(struct aiocb *const *)]; struct aiocb *const * acb_list; char acb_list_r_[PADR_(struct aiocb *const *)];
+	char acb_list_l_[PADL_(struct oaiocb *const *)]; struct oaiocb *const * acb_list; char acb_list_r_[PADR_(struct oaiocb *const *)];
 	char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)];
-	char sig_l_[PADL_(struct sigevent *)]; struct sigevent * sig; char sig_r_[PADR_(struct sigevent *)];
+	char sig_l_[PADL_(struct osigevent *)]; struct osigevent * sig; char sig_r_[PADR_(struct osigevent *)];
 };
 struct yield_args {
 	register_t dummy;
@@ -1309,7 +1341,7 @@
 };
 struct ksem_timedwait_args {
 	char id_l_[PADL_(semid_t)]; semid_t id; char id_r_[PADR_(semid_t)];
-	char abstime_l_[PADL_(struct timespec *)]; struct timespec * abstime; char abstime_r_[PADR_(struct timespec *)];
+	char abstime_l_[PADL_(const struct timespec *)]; const struct timespec * abstime; char abstime_r_[PADR_(const struct timespec *)];
 };
 struct thr_suspend_args {
 	char timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)];
@@ -1351,20 +1383,143 @@
 	char length_l_[PADL_(u_int)]; u_int length; char length_r_[PADR_(u_int)];
 };
 struct auditctl_args {
-	char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)];
 	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
 };
 struct _umtx_op_args {
-	char umtx_l_[PADL_(struct umtx *)]; struct umtx * umtx; char umtx_r_[PADR_(struct umtx *)];
+	char obj_l_[PADL_(void *)]; void * obj; char obj_r_[PADR_(void *)];
 	char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
-	char id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)];
-	char uaddr_l_[PADL_(void *)]; void * uaddr; char uaddr_r_[PADR_(void *)];
+	char val_l_[PADL_(u_long)]; u_long val; char val_r_[PADR_(u_long)];
+	char uaddr1_l_[PADL_(void *)]; void * uaddr1; char uaddr1_r_[PADR_(void *)];
 	char uaddr2_l_[PADL_(void *)]; void * uaddr2; char uaddr2_r_[PADR_(void *)];
 };
 struct thr_new_args {
 	char param_l_[PADL_(struct thr_param *)]; struct thr_param * param; char param_r_[PADR_(struct thr_param *)];
 	char param_size_l_[PADL_(int)]; int param_size; char param_size_r_[PADR_(int)];
 };
+struct sigqueue_args {
+	char pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];
+	char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)];
+	char value_l_[PADL_(void *)]; void * value; char value_r_[PADR_(void *)];
+};
+struct kmq_open_args {
+	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+	char mode_l_[PADL_(mode_t)]; mode_t mode; char mode_r_[PADR_(mode_t)];
+	char attr_l_[PADL_(const struct mq_attr *)]; const struct mq_attr * attr; char attr_r_[PADR_(const struct mq_attr *)];
+};
+struct kmq_setattr_args {
+	char mqd_l_[PADL_(int)]; int mqd; char mqd_r_[PADR_(int)];
+	char attr_l_[PADL_(const struct mq_attr *)]; const struct mq_attr * attr; char attr_r_[PADR_(const struct mq_attr *)];
+	char oattr_l_[PADL_(struct mq_attr *)]; struct mq_attr * oattr; char oattr_r_[PADR_(struct mq_attr *)];
+};
+struct kmq_timedreceive_args {
+	char mqd_l_[PADL_(int)]; int mqd; char mqd_r_[PADR_(int)];
+	char msg_ptr_l_[PADL_(char *)]; char * msg_ptr; char msg_ptr_r_[PADR_(char *)];
+	char msg_len_l_[PADL_(size_t)]; size_t msg_len; char msg_len_r_[PADR_(size_t)];
+	char msg_prio_l_[PADL_(unsigned *)]; unsigned * msg_prio; char msg_prio_r_[PADR_(unsigned *)];
+	char abs_timeout_l_[PADL_(const struct timespec *)]; const struct timespec * abs_timeout; char abs_timeout_r_[PADR_(const struct timespec *)];
+};
+struct kmq_timedsend_args {
+	char mqd_l_[PADL_(int)]; int mqd; char mqd_r_[PADR_(int)];
+	char msg_ptr_l_[PADL_(const char *)]; const char * msg_ptr; char msg_ptr_r_[PADR_(const char *)];
+	char msg_len_l_[PADL_(size_t)]; size_t msg_len; char msg_len_r_[PADR_(size_t)];
+	char msg_prio_l_[PADL_(unsigned)]; unsigned msg_prio; char msg_prio_r_[PADR_(unsigned)];
+	char abs_timeout_l_[PADL_(const struct timespec *)]; const struct timespec * abs_timeout; char abs_timeout_r_[PADR_(const struct timespec *)];
+};
+struct kmq_notify_args {
+	char mqd_l_[PADL_(int)]; int mqd; char mqd_r_[PADR_(int)];
+	char sigev_l_[PADL_(const struct sigevent *)]; const struct sigevent * sigev; char sigev_r_[PADR_(const struct sigevent *)];
+};
+struct kmq_unlink_args {
+	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
+};
+struct abort2_args {
+	char why_l_[PADL_(const char *)]; const char * why; char why_r_[PADR_(const char *)];
+	char nargs_l_[PADL_(int)]; int nargs; char nargs_r_[PADR_(int)];
+	char args_l_[PADL_(void **)]; void ** args; char args_r_[PADR_(void **)];
+};
+struct thr_set_name_args {
+	char id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)];
+	char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)];
+};
+struct aio_fsync_args {
+	char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)];
+	char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)];
+};
+struct rtprio_thread_args {
+	char function_l_[PADL_(int)]; int function; char function_r_[PADR_(int)];
+	char lwpid_l_[PADL_(lwpid_t)]; lwpid_t lwpid; char lwpid_r_[PADR_(lwpid_t)];
+	char rtp_l_[PADL_(struct rtprio *)]; struct rtprio * rtp; char rtp_r_[PADR_(struct rtprio *)];
+};
+struct sctp_peeloff_args {
+	char sd_l_[PADL_(int)]; int sd; char sd_r_[PADR_(int)];
+	char name_l_[PADL_(uint32_t)]; uint32_t name; char name_r_[PADR_(uint32_t)];
+};
+struct sctp_generic_sendmsg_args {
+	char sd_l_[PADL_(int)]; int sd; char sd_r_[PADR_(int)];
+	char msg_l_[PADL_(caddr_t)]; caddr_t msg; char msg_r_[PADR_(caddr_t)];
+	char mlen_l_[PADL_(int)]; int mlen; char mlen_r_[PADR_(int)];
+	char to_l_[PADL_(caddr_t)]; caddr_t to; char to_r_[PADR_(caddr_t)];
+	char tolen_l_[PADL_(__socklen_t)]; __socklen_t tolen; char tolen_r_[PADR_(__socklen_t)];
+	char sinfo_l_[PADL_(struct sctp_sndrcvinfo *)]; struct sctp_sndrcvinfo * sinfo; char sinfo_r_[PADR_(struct sctp_sndrcvinfo *)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+};
+struct sctp_generic_sendmsg_iov_args {
+	char sd_l_[PADL_(int)]; int sd; char sd_r_[PADR_(int)];
+	char iov_l_[PADL_(struct iovec *)]; struct iovec * iov; char iov_r_[PADR_(struct iovec *)];
+	char iovlen_l_[PADL_(int)]; int iovlen; char iovlen_r_[PADR_(int)];
+	char to_l_[PADL_(caddr_t)]; caddr_t to; char to_r_[PADR_(caddr_t)];
+	char tolen_l_[PADL_(__socklen_t)]; __socklen_t tolen; char tolen_r_[PADR_(__socklen_t)];
+	char sinfo_l_[PADL_(struct sctp_sndrcvinfo *)]; struct sctp_sndrcvinfo * sinfo; char sinfo_r_[PADR_(struct sctp_sndrcvinfo *)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+};
+struct sctp_generic_recvmsg_args {
+	char sd_l_[PADL_(int)]; int sd; char sd_r_[PADR_(int)];
+	char iov_l_[PADL_(struct iovec *)]; struct iovec * iov; char iov_r_[PADR_(struct iovec *)];
+	char iovlen_l_[PADL_(int)]; int iovlen; char iovlen_r_[PADR_(int)];
+	char from_l_[PADL_(struct sockaddr *)]; struct sockaddr * from; char from_r_[PADR_(struct sockaddr *)];
+	char fromlenaddr_l_[PADL_(__socklen_t *)]; __socklen_t * fromlenaddr; char fromlenaddr_r_[PADR_(__socklen_t *)];
+	char sinfo_l_[PADL_(struct sctp_sndrcvinfo *)]; struct sctp_sndrcvinfo * sinfo; char sinfo_r_[PADR_(struct sctp_sndrcvinfo *)];
+	char msg_flags_l_[PADL_(int *)]; int * msg_flags; char msg_flags_r_[PADR_(int *)];
+};
+struct pread_args {
+	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+	char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)];
+	char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+	char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
+};
+struct pwrite_args {
+	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+	char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)];
+	char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)];
+	char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
+};
+struct mmap_args {
+	char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)];
+	char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)];
+	char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)];
+	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
+	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+	char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)];
+};
+struct lseek_args {
+	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+	char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)];
+	char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)];
+};
+struct truncate_args {
+	char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+	char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)];
+};
+struct ftruncate_args {
+	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
+	char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)];
+};
+struct thr_kill2_args {
+	char pid_l_[PADL_(pid_t)]; pid_t pid; char pid_r_[PADR_(pid_t)];
+	char id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)];
+	char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)];
+};
 int	nosys(struct thread *, struct nosys_args *);
 void	sys_exit(struct thread *, struct sys_exit_args *);
 int	fork(struct thread *, struct fork_args *);
@@ -1479,8 +1634,8 @@
 int	semsys(struct thread *, struct semsys_args *);
 int	msgsys(struct thread *, struct msgsys_args *);
 int	shmsys(struct thread *, struct shmsys_args *);
-int	pread(struct thread *, struct pread_args *);
-int	pwrite(struct thread *, struct pwrite_args *);
+int	freebsd6_pread(struct thread *, struct freebsd6_pread_args *);
+int	freebsd6_pwrite(struct thread *, struct freebsd6_pwrite_args *);
 int	ntp_adjtime(struct thread *, struct ntp_adjtime_args *);
 int	setgid(struct thread *, struct setgid_args *);
 int	setegid(struct thread *, struct setegid_args *);
@@ -1493,10 +1648,10 @@
 int	getrlimit(struct thread *, struct __getrlimit_args *);
 int	setrlimit(struct thread *, struct __setrlimit_args *);
 int	getdirentries(struct thread *, struct getdirentries_args *);
-int	mmap(struct thread *, struct mmap_args *);
-int	lseek(struct thread *, struct lseek_args *);
-int	truncate(struct thread *, struct truncate_args *);
-int	ftruncate(struct thread *, struct ftruncate_args *);
+int	freebsd6_mmap(struct thread *, struct freebsd6_mmap_args *);
+int	freebsd6_lseek(struct thread *, struct freebsd6_lseek_args *);
+int	freebsd6_truncate(struct thread *, struct freebsd6_truncate_args *);
+int	freebsd6_ftruncate(struct thread *, struct freebsd6_ftruncate_args *);
 int	__sysctl(struct thread *, struct sysctl_args *);
 int	mlock(struct thread *, struct mlock_args *);
 int	munlock(struct thread *, struct munlock_args *);
@@ -1519,6 +1674,11 @@
 int	clock_gettime(struct thread *, struct clock_gettime_args *);
 int	clock_settime(struct thread *, struct clock_settime_args *);
 int	clock_getres(struct thread *, struct clock_getres_args *);
+int	ktimer_create(struct thread *, struct ktimer_create_args *);
+int	ktimer_delete(struct thread *, struct ktimer_delete_args *);
+int	ktimer_settime(struct thread *, struct ktimer_settime_args *);
+int	ktimer_gettime(struct thread *, struct ktimer_gettime_args *);
+int	ktimer_getoverrun(struct thread *, struct ktimer_getoverrun_args *);
 int	nanosleep(struct thread *, struct nanosleep_args *);
 int	ntp_gettime(struct thread *, struct ntp_gettime_args *);
 int	minherit(struct thread *, struct minherit_args *);
@@ -1526,6 +1686,9 @@
 int	openbsd_poll(struct thread *, struct openbsd_poll_args *);
 int	issetugid(struct thread *, struct issetugid_args *);
 int	lchown(struct thread *, struct lchown_args *);
+int	aio_read(struct thread *, struct aio_read_args *);
+int	aio_write(struct thread *, struct aio_write_args *);
+int	lio_listio(struct thread *, struct lio_listio_args *);
 int	getdents(struct thread *, struct getdents_args *);
 int	lchmod(struct thread *, struct lchmod_args *);
 int	lutimes(struct thread *, struct lutimes_args *);
@@ -1553,9 +1716,9 @@
 int	aio_suspend(struct thread *, struct aio_suspend_args *);
 int	aio_cancel(struct thread *, struct aio_cancel_args *);
 int	aio_error(struct thread *, struct aio_error_args *);
-int	aio_read(struct thread *, struct aio_read_args *);
-int	aio_write(struct thread *, struct aio_write_args *);
-int	lio_listio(struct thread *, struct lio_listio_args *);
+int	oaio_read(struct thread *, struct oaio_read_args *);
+int	oaio_write(struct thread *, struct oaio_write_args *);
+int	olio_listio(struct thread *, struct olio_listio_args *);
 int	yield(struct thread *, struct yield_args *);
 int	mlockall(struct thread *, struct mlockall_args *);
 int	munlockall(struct thread *, struct munlockall_args *);
@@ -1674,6 +1837,28 @@
 int	auditctl(struct thread *, struct auditctl_args *);
 int	_umtx_op(struct thread *, struct _umtx_op_args *);
 int	thr_new(struct thread *, struct thr_new_args *);
+int	sigqueue(struct thread *, struct sigqueue_args *);
+int	kmq_open(struct thread *, struct kmq_open_args *);
+int	kmq_setattr(struct thread *, struct kmq_setattr_args *);
+int	kmq_timedreceive(struct thread *, struct kmq_timedreceive_args *);
+int	kmq_timedsend(struct thread *, struct kmq_timedsend_args *);
+int	kmq_notify(struct thread *, struct kmq_notify_args *);
+int	kmq_unlink(struct thread *, struct kmq_unlink_args *);
+int	abort2(struct thread *, struct abort2_args *);
+int	thr_set_name(struct thread *, struct thr_set_name_args *);
+int	aio_fsync(struct thread *, struct aio_fsync_args *);
+int	rtprio_thread(struct thread *, struct rtprio_thread_args *);
+int	sctp_peeloff(struct thread *, struct sctp_peeloff_args *);
+int	sctp_generic_sendmsg(struct thread *, struct sctp_generic_sendmsg_args *);
+int	sctp_generic_sendmsg_iov(struct thread *, struct sctp_generic_sendmsg_iov_args *);
+int	sctp_generic_recvmsg(struct thread *, struct sctp_generic_recvmsg_args *);
+int	pread(struct thread *, struct pread_args *);
+int	pwrite(struct thread *, struct pwrite_args *);
+int	mmap(struct thread *, struct mmap_args *);
+int	lseek(struct thread *, struct lseek_args *);
+int	truncate(struct thread *, struct truncate_args *);
+int	ftruncate(struct thread *, struct ftruncate_args *);
+int	thr_kill2(struct thread *, struct thr_kill2_args *);
 
 #ifdef COMPAT_43
 
@@ -1893,6 +2078,352 @@
 
 #endif /* COMPAT_FREEBSD4 */
 
+
+#ifdef COMPAT_FREEBSD6
+
+
+#endif /* COMPAT_FREEBSD6 */
+
+#define	SYS_AUE_syscall	AUE_NULL
+#define	SYS_AUE_exit	AUE_EXIT
+#define	SYS_AUE_fork	AUE_FORK
+#define	SYS_AUE_read	AUE_NULL
+#define	SYS_AUE_write	AUE_NULL
+#define	SYS_AUE_open	AUE_OPEN_RWTC
+#define	SYS_AUE_close	AUE_CLOSE
+#define	SYS_AUE_wait4	AUE_WAIT4
+#define	SYS_AUE_link	AUE_LINK
+#define	SYS_AUE_unlink	AUE_UNLINK
+#define	SYS_AUE_chdir	AUE_CHDIR
+#define	SYS_AUE_fchdir	AUE_FCHDIR
+#define	SYS_AUE_mknod	AUE_MKNOD
+#define	SYS_AUE_chmod	AUE_CHMOD
+#define	SYS_AUE_chown	AUE_CHOWN
+#define	SYS_AUE_break	AUE_NULL
+#define	SYS_AUE_getpid	AUE_GETPID
+#define	SYS_AUE_mount	AUE_MOUNT
+#define	SYS_AUE_unmount	AUE_UMOUNT
+#define	SYS_AUE_setuid	AUE_SETUID
+#define	SYS_AUE_getuid	AUE_GETUID
+#define	SYS_AUE_geteuid	AUE_GETEUID
+#define	SYS_AUE_ptrace	AUE_PTRACE
+#define	SYS_AUE_recvmsg	AUE_RECVMSG
+#define	SYS_AUE_sendmsg	AUE_SENDMSG
+#define	SYS_AUE_recvfrom	AUE_RECVFROM
+#define	SYS_AUE_accept	AUE_ACCEPT
+#define	SYS_AUE_getpeername	AUE_GETPEERNAME
+#define	SYS_AUE_getsockname	AUE_GETSOCKNAME
+#define	SYS_AUE_access	AUE_ACCESS
+#define	SYS_AUE_chflags	AUE_CHFLAGS
+#define	SYS_AUE_fchflags	AUE_FCHFLAGS
+#define	SYS_AUE_sync	AUE_SYNC
+#define	SYS_AUE_kill	AUE_KILL
+#define	SYS_AUE_getppid	AUE_GETPPID
+#define	SYS_AUE_dup	AUE_DUP
+#define	SYS_AUE_pipe	AUE_PIPE
+#define	SYS_AUE_getegid	AUE_GETEGID
+#define	SYS_AUE_profil	AUE_PROFILE
+#define	SYS_AUE_ktrace	AUE_KTRACE
+#define	SYS_AUE_getgid	AUE_GETGID
+#define	SYS_AUE_getlogin	AUE_GETLOGIN
+#define	SYS_AUE_setlogin	AUE_SETLOGIN
+#define	SYS_AUE_acct	AUE_ACCT
+#define	SYS_AUE_sigaltstack	AUE_SIGALTSTACK
+#define	SYS_AUE_ioctl	AUE_IOCTL
+#define	SYS_AUE_reboot	AUE_REBOOT
+#define	SYS_AUE_revoke	AUE_REVOKE
+#define	SYS_AUE_symlink	AUE_SYMLINK
+#define	SYS_AUE_readlink	AUE_READLINK
+#define	SYS_AUE_execve	AUE_EXECVE
+#define	SYS_AUE_umask	AUE_UMASK
+#define	SYS_AUE_chroot	AUE_CHROOT
+#define	SYS_AUE_msync	AUE_MSYNC
+#define	SYS_AUE_vfork	AUE_VFORK
+#define	SYS_AUE_sbrk	AUE_SBRK
+#define	SYS_AUE_sstk	AUE_SSTK
+#define	SYS_AUE_vadvise	AUE_O_VADVISE
+#define	SYS_AUE_munmap	AUE_MUNMAP
+#define	SYS_AUE_mprotect	AUE_MPROTECT
+#define	SYS_AUE_madvise	AUE_MADVISE
+#define	SYS_AUE_mincore	AUE_MINCORE
+#define	SYS_AUE_getgroups	AUE_GETGROUPS
+#define	SYS_AUE_setgroups	AUE_SETGROUPS
+#define	SYS_AUE_getpgrp	AUE_GETPGRP
+#define	SYS_AUE_setpgid	AUE_SETPGRP
+#define	SYS_AUE_setitimer	AUE_SETITIMER
+#define	SYS_AUE_swapon	AUE_SWAPON
+#define	SYS_AUE_getitimer	AUE_GETITIMER
+#define	SYS_AUE_getdtablesize	AUE_GETDTABLESIZE
+#define	SYS_AUE_dup2	AUE_DUP2
+#define	SYS_AUE_fcntl	AUE_FCNTL
+#define	SYS_AUE_select	AUE_SELECT
+#define	SYS_AUE_fsync	AUE_FSYNC
+#define	SYS_AUE_setpriority	AUE_SETPRIORITY
+#define	SYS_AUE_socket	AUE_SOCKET
+#define	SYS_AUE_connect	AUE_CONNECT
+#define	SYS_AUE_getpriority	AUE_GETPRIORITY
+#define	SYS_AUE_bind	AUE_BIND
+#define	SYS_AUE_setsockopt	AUE_SETSOCKOPT
+#define	SYS_AUE_listen	AUE_LISTEN
+#define	SYS_AUE_gettimeofday	AUE_GETTIMEOFDAY
+#define	SYS_AUE_getrusage	AUE_GETRUSAGE
+#define	SYS_AUE_getsockopt	AUE_GETSOCKOPT
+#define	SYS_AUE_readv	AUE_READV
+#define	SYS_AUE_writev	AUE_WRITEV
+#define	SYS_AUE_settimeofday	AUE_SETTIMEOFDAY
+#define	SYS_AUE_fchown	AUE_FCHOWN
+#define	SYS_AUE_fchmod	AUE_FCHMOD
+#define	SYS_AUE_setreuid	AUE_SETREUID
+#define	SYS_AUE_setregid	AUE_SETREGID
+#define	SYS_AUE_rename	AUE_RENAME
+#define	SYS_AUE_flock	AUE_FLOCK
+#define	SYS_AUE_mkfifo	AUE_MKFIFO
+#define	SYS_AUE_sendto	AUE_SENDTO
+#define	SYS_AUE_shutdown	AUE_SHUTDOWN
+#define	SYS_AUE_socketpair	AUE_SOCKETPAIR
+#define	SYS_AUE_mkdir	AUE_MKDIR
+#define	SYS_AUE_rmdir	AUE_RMDIR
+#define	SYS_AUE_utimes	AUE_UTIMES
+#define	SYS_AUE_adjtime	AUE_ADJTIME
+#define	SYS_AUE_setsid	AUE_SETSID
+#define	SYS_AUE_quotactl	AUE_QUOTACTL
+#define	SYS_AUE_nfssvc	AUE_NFS_SVC
+#define	SYS_AUE_lgetfh	AUE_LGETFH
+#define	SYS_AUE_getfh	AUE_NFS_GETFH
+#define	SYS_AUE_getdomainname	AUE_SYSCTL
+#define	SYS_AUE_setdomainname	AUE_SYSCTL
+#define	SYS_AUE_uname	AUE_NULL
+#define	SYS_AUE_sysarch	AUE_SYSARCH
+#define	SYS_AUE_rtprio	AUE_RTPRIO
+#define	SYS_AUE_semsys	AUE_SEMSYS
+#define	SYS_AUE_msgsys	AUE_MSGSYS
+#define	SYS_AUE_shmsys	AUE_SHMSYS
+#define	SYS_AUE_freebsd6_pread	AUE_PREAD
+#define	SYS_AUE_freebsd6_pwrite	AUE_PWRITE
+#define	SYS_AUE_ntp_adjtime	AUE_NTP_ADJTIME
+#define	SYS_AUE_setgid	AUE_SETGID
+#define	SYS_AUE_setegid	AUE_SETEGID
+#define	SYS_AUE_seteuid	AUE_SETEUID
+#define	SYS_AUE_stat	AUE_STAT
+#define	SYS_AUE_fstat	AUE_FSTAT
+#define	SYS_AUE_lstat	AUE_LSTAT
+#define	SYS_AUE_pathconf	AUE_PATHCONF
+#define	SYS_AUE_fpathconf	AUE_FPATHCONF
+#define	SYS_AUE_getrlimit	AUE_GETRLIMIT
+#define	SYS_AUE_setrlimit	AUE_SETRLIMIT
+#define	SYS_AUE_getdirentries	AUE_GETDIRENTRIES
+#define	SYS_AUE_freebsd6_mmap	AUE_MMAP
+#define	SYS_AUE_freebsd6_lseek	AUE_LSEEK
+#define	SYS_AUE_freebsd6_truncate	AUE_TRUNCATE
+#define	SYS_AUE_freebsd6_ftruncate	AUE_FTRUNCATE
+#define	SYS_AUE___sysctl	AUE_SYSCTL
+#define	SYS_AUE_mlock	AUE_MLOCK
+#define	SYS_AUE_munlock	AUE_MUNLOCK
+#define	SYS_AUE_undelete	AUE_UNDELETE
+#define	SYS_AUE_futimes	AUE_FUTIMES
+#define	SYS_AUE_getpgid	AUE_GETPGID
+#define	SYS_AUE_poll	AUE_POLL
+#define	SYS_AUE_lkmnosys	AUE_NULL
+#define	SYS_AUE___semctl	AUE_SEMCTL
+#define	SYS_AUE_semget	AUE_SEMGET
+#define	SYS_AUE_semop	AUE_SEMOP
+#define	SYS_AUE_msgctl	AUE_MSGCTL
+#define	SYS_AUE_msgget	AUE_MSGGET
+#define	SYS_AUE_msgsnd	AUE_MSGSND
+#define	SYS_AUE_msgrcv	AUE_MSGRCV
+#define	SYS_AUE_shmat	AUE_SHMAT
+#define	SYS_AUE_shmctl	AUE_SHMCTL
+#define	SYS_AUE_shmdt	AUE_SHMDT
+#define	SYS_AUE_shmget	AUE_SHMGET
+#define	SYS_AUE_clock_gettime	AUE_NULL
+#define	SYS_AUE_clock_settime	AUE_CLOCK_SETTIME
+#define	SYS_AUE_clock_getres	AUE_NULL
+#define	SYS_AUE_ktimer_create	AUE_NULL
+#define	SYS_AUE_ktimer_delete	AUE_NULL
+#define	SYS_AUE_ktimer_settime	AUE_NULL
+#define	SYS_AUE_ktimer_gettime	AUE_NULL
+#define	SYS_AUE_ktimer_getoverrun	AUE_NULL
+#define	SYS_AUE_nanosleep	AUE_NULL
+#define	SYS_AUE_ntp_gettime	AUE_NULL
+#define	SYS_AUE_minherit	AUE_MINHERIT
+#define	SYS_AUE_rfork	AUE_RFORK
+#define	SYS_AUE_openbsd_poll	AUE_POLL
+#define	SYS_AUE_issetugid	AUE_ISSETUGID
+#define	SYS_AUE_lchown	AUE_LCHOWN
+#define	SYS_AUE_aio_read	AUE_NULL
+#define	SYS_AUE_aio_write	AUE_NULL
+#define	SYS_AUE_lio_listio	AUE_NULL
+#define	SYS_AUE_getdents	AUE_O_GETDENTS
+#define	SYS_AUE_lchmod	AUE_LCHMOD
+#define	SYS_AUE_lutimes	AUE_LUTIMES
+#define	SYS_AUE_nstat	AUE_STAT
+#define	SYS_AUE_nfstat	AUE_FSTAT
+#define	SYS_AUE_nlstat	AUE_LSTAT
+#define	SYS_AUE_preadv	AUE_PREADV
+#define	SYS_AUE_pwritev	AUE_PWRITEV
+#define	SYS_AUE_fhopen	AUE_FHOPEN
+#define	SYS_AUE_fhstat	AUE_FHSTAT
+#define	SYS_AUE_modnext	AUE_NULL
+#define	SYS_AUE_modstat	AUE_NULL
+#define	SYS_AUE_modfnext	AUE_NULL
+#define	SYS_AUE_modfind	AUE_NULL
+#define	SYS_AUE_kldload	AUE_MODLOAD
+#define	SYS_AUE_kldunload	AUE_MODUNLOAD
+#define	SYS_AUE_kldfind	AUE_NULL
+#define	SYS_AUE_kldnext	AUE_NULL
+#define	SYS_AUE_kldstat	AUE_NULL
+#define	SYS_AUE_kldfirstmod	AUE_NULL
+#define	SYS_AUE_getsid	AUE_GETSID
+#define	SYS_AUE_setresuid	AUE_SETRESUID
+#define	SYS_AUE_setresgid	AUE_SETRESGID
+#define	SYS_AUE_aio_return	AUE_NULL
+#define	SYS_AUE_aio_suspend	AUE_NULL
+#define	SYS_AUE_aio_cancel	AUE_NULL
+#define	SYS_AUE_aio_error	AUE_NULL
+#define	SYS_AUE_oaio_read	AUE_NULL
+#define	SYS_AUE_oaio_write	AUE_NULL
+#define	SYS_AUE_olio_listio	AUE_NULL
+#define	SYS_AUE_yield	AUE_NULL
+#define	SYS_AUE_mlockall	AUE_MLOCKALL
+#define	SYS_AUE_munlockall	AUE_MUNLOCKALL
+#define	SYS_AUE___getcwd	AUE_GETCWD
+#define	SYS_AUE_sched_setparam	AUE_NULL
+#define	SYS_AUE_sched_getparam	AUE_NULL
+#define	SYS_AUE_sched_setscheduler	AUE_NULL
+#define	SYS_AUE_sched_getscheduler	AUE_NULL
+#define	SYS_AUE_sched_yield	AUE_NULL
+#define	SYS_AUE_sched_get_priority_max	AUE_NULL
+#define	SYS_AUE_sched_get_priority_min	AUE_NULL
+#define	SYS_AUE_sched_rr_get_interval	AUE_NULL
+#define	SYS_AUE_utrace	AUE_NULL
+#define	SYS_AUE_kldsym	AUE_NULL
+#define	SYS_AUE_jail	AUE_JAIL
+#define	SYS_AUE_sigprocmask	AUE_SIGPROCMASK
+#define	SYS_AUE_sigsuspend	AUE_SIGSUSPEND
+#define	SYS_AUE_sigpending	AUE_SIGPENDING
+#define	SYS_AUE_sigtimedwait	AUE_SIGWAIT
+#define	SYS_AUE_sigwaitinfo	AUE_NULL
+#define	SYS_AUE___acl_get_file	AUE_NULL
+#define	SYS_AUE___acl_set_file	AUE_NULL
+#define	SYS_AUE___acl_get_fd	AUE_NULL
+#define	SYS_AUE___acl_set_fd	AUE_NULL
+#define	SYS_AUE___acl_delete_file	AUE_NULL
+#define	SYS_AUE___acl_delete_fd	AUE_NULL
+#define	SYS_AUE___acl_aclcheck_file	AUE_NULL
+#define	SYS_AUE___acl_aclcheck_fd	AUE_NULL
+#define	SYS_AUE_extattrctl	AUE_EXTATTRCTL
+#define	SYS_AUE_extattr_set_file	AUE_EXTATTR_SET_FILE
+#define	SYS_AUE_extattr_get_file	AUE_EXTATTR_GET_FILE
+#define	SYS_AUE_extattr_delete_file	AUE_EXTATTR_DELETE_FILE
+#define	SYS_AUE_aio_waitcomplete	AUE_NULL
+#define	SYS_AUE_getresuid	AUE_GETRESUID
+#define	SYS_AUE_getresgid	AUE_GETRESGID
+#define	SYS_AUE_kqueue	AUE_KQUEUE
+#define	SYS_AUE_kevent	AUE_NULL
+#define	SYS_AUE_lkmressys	AUE_NULL
+#define	SYS_AUE_extattr_set_fd	AUE_EXTATTR_SET_FD
+#define	SYS_AUE_extattr_get_fd	AUE_EXTATTR_GET_FD
+#define	SYS_AUE_extattr_delete_fd	AUE_EXTATTR_DELETE_FD
+#define	SYS_AUE___setugid	AUE_NULL
+#define	SYS_AUE_nfsclnt	AUE_NULL
+#define	SYS_AUE_eaccess	AUE_EACCESS
+#define	SYS_AUE_nmount	AUE_NMOUNT
+#define	SYS_AUE_kse_exit	AUE_NULL
+#define	SYS_AUE_kse_wakeup	AUE_NULL
+#define	SYS_AUE_kse_create	AUE_NULL
+#define	SYS_AUE_kse_thr_interrupt	AUE_NULL
+#define	SYS_AUE_kse_release	AUE_NULL
+#define	SYS_AUE___mac_get_proc	AUE_NULL
+#define	SYS_AUE___mac_set_proc	AUE_NULL
+#define	SYS_AUE___mac_get_fd	AUE_NULL
+#define	SYS_AUE___mac_get_file	AUE_NULL
+#define	SYS_AUE___mac_set_fd	AUE_NULL
+#define	SYS_AUE___mac_set_file	AUE_NULL
+#define	SYS_AUE_kenv	AUE_NULL
+#define	SYS_AUE_lchflags	AUE_LCHFLAGS
+#define	SYS_AUE_uuidgen	AUE_NULL
+#define	SYS_AUE_sendfile	AUE_SENDFILE
+#define	SYS_AUE_mac_syscall	AUE_NULL
+#define	SYS_AUE_getfsstat	AUE_GETFSSTAT
+#define	SYS_AUE_statfs	AUE_STATFS
+#define	SYS_AUE_fstatfs	AUE_FSTATFS
+#define	SYS_AUE_fhstatfs	AUE_FHSTATFS
+#define	SYS_AUE_ksem_close	AUE_NULL
+#define	SYS_AUE_ksem_post	AUE_NULL
+#define	SYS_AUE_ksem_wait	AUE_NULL
+#define	SYS_AUE_ksem_trywait	AUE_NULL
+#define	SYS_AUE_ksem_init	AUE_NULL
+#define	SYS_AUE_ksem_open	AUE_NULL
+#define	SYS_AUE_ksem_unlink	AUE_NULL
+#define	SYS_AUE_ksem_getvalue	AUE_NULL
+#define	SYS_AUE_ksem_destroy	AUE_NULL
+#define	SYS_AUE___mac_get_pid	AUE_NULL
+#define	SYS_AUE___mac_get_link	AUE_NULL
+#define	SYS_AUE___mac_set_link	AUE_NULL
+#define	SYS_AUE_extattr_set_link	AUE_EXTATTR_SET_LINK
+#define	SYS_AUE_extattr_get_link	AUE_EXTATTR_GET_LINK
+#define	SYS_AUE_extattr_delete_link	AUE_EXTATTR_DELETE_LINK
+#define	SYS_AUE___mac_execve	AUE_NULL
+#define	SYS_AUE_sigaction	AUE_SIGACTION
+#define	SYS_AUE_sigreturn	AUE_SIGRETURN
+#define	SYS_AUE_getcontext	AUE_NULL
+#define	SYS_AUE_setcontext	AUE_NULL
+#define	SYS_AUE_swapcontext	AUE_NULL
+#define	SYS_AUE_swapoff	AUE_SWAPOFF
+#define	SYS_AUE___acl_get_link	AUE_NULL
+#define	SYS_AUE___acl_set_link	AUE_NULL
+#define	SYS_AUE___acl_delete_link	AUE_NULL
+#define	SYS_AUE___acl_aclcheck_link	AUE_NULL
+#define	SYS_AUE_sigwait	AUE_SIGWAIT
+#define	SYS_AUE_thr_create	AUE_NULL
+#define	SYS_AUE_thr_exit	AUE_NULL
+#define	SYS_AUE_thr_self	AUE_NULL
+#define	SYS_AUE_thr_kill	AUE_NULL
+#define	SYS_AUE__umtx_lock	AUE_NULL
+#define	SYS_AUE__umtx_unlock	AUE_NULL
+#define	SYS_AUE_jail_attach	AUE_NULL
+#define	SYS_AUE_extattr_list_fd	AUE_EXTATTR_LIST_FD
+#define	SYS_AUE_extattr_list_file	AUE_EXTATTR_LIST_FILE
+#define	SYS_AUE_extattr_list_link	AUE_EXTATTR_LIST_LINK
+#define	SYS_AUE_kse_switchin	AUE_NULL
+#define	SYS_AUE_ksem_timedwait	AUE_NULL
+#define	SYS_AUE_thr_suspend	AUE_NULL
+#define	SYS_AUE_thr_wake	AUE_NULL
+#define	SYS_AUE_kldunloadf	AUE_MODUNLOAD
+#define	SYS_AUE_audit	AUE_AUDIT
+#define	SYS_AUE_auditon	AUE_AUDITON
+#define	SYS_AUE_getauid	AUE_GETAUID
+#define	SYS_AUE_setauid	AUE_SETAUID
+#define	SYS_AUE_getaudit	AUE_GETAUDIT
+#define	SYS_AUE_setaudit	AUE_SETAUDIT
+#define	SYS_AUE_getaudit_addr	AUE_GETAUDIT_ADDR
+#define	SYS_AUE_setaudit_addr	AUE_SETAUDIT_ADDR
+#define	SYS_AUE_auditctl	AUE_AUDITCTL
+#define	SYS_AUE__umtx_op	AUE_NULL
+#define	SYS_AUE_thr_new	AUE_NULL
+#define	SYS_AUE_sigqueue	AUE_NULL
+#define	SYS_AUE_kmq_open	AUE_NULL
+#define	SYS_AUE_kmq_setattr	AUE_NULL
+#define	SYS_AUE_kmq_timedreceive	AUE_NULL
+#define	SYS_AUE_kmq_timedsend	AUE_NULL
+#define	SYS_AUE_kmq_notify	AUE_NULL
+#define	SYS_AUE_kmq_unlink	AUE_NULL
+#define	SYS_AUE_abort2	AUE_NULL
+#define	SYS_AUE_thr_set_name	AUE_NULL
+#define	SYS_AUE_aio_fsync	AUE_NULL
+#define	SYS_AUE_rtprio_thread	AUE_RTPRIO
+#define	SYS_AUE_sctp_peeloff	AUE_NULL
+#define	SYS_AUE_sctp_generic_sendmsg	AUE_NULL
+#define	SYS_AUE_sctp_generic_sendmsg_iov	AUE_NULL
+#define	SYS_AUE_sctp_generic_recvmsg	AUE_NULL
+#define	SYS_AUE_pread	AUE_PREAD
+#define	SYS_AUE_pwrite	AUE_PWRITE
+#define	SYS_AUE_mmap	AUE_MMAP
+#define	SYS_AUE_lseek	AUE_LSEEK
+#define	SYS_AUE_truncate	AUE_TRUNCATE
+#define	SYS_AUE_ftruncate	AUE_FTRUNCATE
+#define	SYS_AUE_thr_kill2	AUE_KILL
+
 #undef PAD_
 #undef PADL_
 #undef PADR_
Index: consio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/consio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/consio.h -L sys/sys/consio.h -u -r1.1.1.1 -r1.2
--- sys/sys/consio.h
+++ sys/sys/consio.h
@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/consio.h,v 1.17 2005/05/15 07:35:49 nyan Exp $
+ * $FreeBSD: src/sys/sys/consio.h,v 1.18 2006/09/27 19:57:01 ru Exp $
  */
 
 #ifndef	_SYS_CONSIO_H_
@@ -51,10 +51,10 @@
 #define KD_TEXT1	2		/* set text mode !restore fonts */
 #define KD_PIXEL	3		/* set pixel mode		*/
 #define KDGETMODE	_IOR('K', 9, int)
-#define KDSETMODE	_IO('K', 10 /*, int */)
+#define KDSETMODE	_IOWINT('K', 10)
 
 /* set border color */
-#define KDSBORDER	_IO('K', 13 /*, int */)
+#define KDSBORDER	_IOWINT('K', 13)
 
 /* set up raster(pixel) text mode */
 struct _scr_size {
@@ -255,10 +255,10 @@
 #define CONS_FINDMODE	_IOWR('c', 103, video_info_t)
 
 /* set the frame buffer window origin (equivalent to FBIO_SETWINORG) */
-#define CONS_SETWINORG	_IO('c', 104 /*, u_int */) 
+#define CONS_SETWINORG	_IOWINT('c', 104)
 
 /* use the specified keyboard */
-#define CONS_SETKBD	_IO('c', 110 /*, int */)
+#define CONS_SETKBD	_IOWINT('c', 110)
 
 /* release the current keyboard */
 #define CONS_RELKBD	_IO('c', 111)
@@ -320,13 +320,13 @@
 #define VT_FALSE	0
 #define VT_TRUE		1
 #define VT_ACKACQ	2
-#define VT_RELDISP	_IO('v', 4 /*, int */)
+#define VT_RELDISP	_IOWINT('v', 4)
 
 /* activate the specified vty */
-#define VT_ACTIVATE	_IO('v', 5 /*, int */)
+#define VT_ACTIVATE	_IOWINT('v', 5)
 
 /* wait until the specified vty is activate */
-#define VT_WAITACTIVE	_IO('v', 6 /*, int */)
+#define VT_WAITACTIVE	_IOWINT('v', 6)
 
 /* get the currently active vty */
 #define VT_GETACTIVE	_IOR('v', 7, int)
Index: condvar.h
===================================================================
RCS file: /home/cvs/src/sys/sys/condvar.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/condvar.h -L sys/sys/condvar.h -u -r1.1.1.1 -r1.2
--- sys/sys/condvar.h
+++ sys/sys/condvar.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/condvar.h,v 1.12 2004/05/05 21:57:44 jhb Exp $
+ * $FreeBSD: src/sys/sys/condvar.h,v 1.14 2007/03/21 22:22:13 jhb Exp $
  */
 
 #ifndef	_SYS_CONDVAR_H_
@@ -32,7 +32,7 @@
 #ifndef	LOCORE
 #include <sys/queue.h>
 
-struct mtx;
+struct lock_object;
 struct thread;
 
 TAILQ_HEAD(cv_waitq, thread);
@@ -52,14 +52,26 @@
 void	cv_init(struct cv *cvp, const char *desc);
 void	cv_destroy(struct cv *cvp);
 
-void	cv_wait(struct cv *cvp, struct mtx *mp);
-int	cv_wait_sig(struct cv *cvp, struct mtx *mp);
-int	cv_timedwait(struct cv *cvp, struct mtx *mp, int timo);
-int	cv_timedwait_sig(struct cv *cvp, struct mtx *mp, int timo);
+void	_cv_wait(struct cv *cvp, struct lock_object *lock);
+void	_cv_wait_unlock(struct cv *cvp, struct lock_object *lock);
+int	_cv_wait_sig(struct cv *cvp, struct lock_object *lock);
+int	_cv_timedwait(struct cv *cvp, struct lock_object *lock, int timo);
+int	_cv_timedwait_sig(struct cv *cvp, struct lock_object *lock, int timo);
 
 void	cv_signal(struct cv *cvp);
 void	cv_broadcastpri(struct cv *cvp, int pri);
 
+#define	cv_wait(cvp, lock)						\
+	_cv_wait((cvp), &(lock)->lock_object)
+#define	cv_wait_unlock(cvp, lock)					\
+	_cv_wait_unlock((cvp), &(lock)->lock_object)
+#define	cv_wait_sig(cvp, lock)						\
+	_cv_wait_sig((cvp), &(lock)->lock_object)
+#define	cv_timedwait(cvp, lock, timo)					\
+	_cv_timedwait((cvp), &(lock)->lock_object, (timo))
+#define	cv_timedwait_sig(cvp, lock, timo)				\
+	_cv_timedwait_sig((cvp), &(lock)->lock_object, (timo))
+
 #define cv_broadcast(cvp)	cv_broadcastpri(cvp, -1)
 
 #define	cv_wmesg(cvp)		((cvp)->cv_description)
Index: conf.h
===================================================================
RCS file: /home/cvs/src/sys/sys/conf.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/conf.h -L sys/sys/conf.h -u -r1.1.1.1 -r1.2
--- sys/sys/conf.h
+++ sys/sys/conf.h
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)conf.h	8.5 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/sys/conf.h,v 1.222.2.3 2005/09/26 14:36:54 phk Exp $
+ * $FreeBSD: src/sys/sys/conf.h,v 1.233.4.1 2008/01/30 21:21:51 ru Exp $
  */
 
 #ifndef _SYS_CONF_H_
@@ -50,6 +50,7 @@
 struct snapdata;
 struct devfs_dirent;
 struct cdevsw;
+struct file;
 
 struct cdev {
 	struct cdev_priv	*si_priv;
@@ -105,6 +106,7 @@
 struct uio;
 struct knote;
 struct clonedevs;
+struct vnode;
 
 /*
  * Note: d_thread_t is provided as a transition aid for those drivers
@@ -125,7 +127,7 @@
 typedef struct thread d_thread_t;
 
 typedef int d_open_t(struct cdev *dev, int oflags, int devtype, struct thread *td);
-typedef int d_fdopen_t(struct cdev *dev, int oflags, struct thread *td, int fdidx);
+typedef int d_fdopen_t(struct cdev *dev, int oflags, struct thread *td, struct file *fp);
 typedef int d_close_t(struct cdev *dev, int fflag, int devtype, struct thread *td);
 typedef void d_strategy_t(struct bio *bp);
 typedef int d_ioctl_t(struct cdev *dev, u_long cmd, caddr_t data,
@@ -165,7 +167,6 @@
 /*
  * Flags for d_flags which the drivers can set.
  */
-#define	D_MEMDISK	0x00010000	/* memory type disk */
 #define	D_TRACKCLOSE	0x00080000	/* track all closes */
 #define D_MMAP_ANON	0x00100000	/* special treatment in vm_mmap.c */
 #define D_PSEUDO	0x00200000	/* make_dev() can return NULL */
@@ -240,11 +241,16 @@
 void clone_cleanup(struct clonedevs **);
 #define CLONE_UNITMASK 0xfffff
 #define CLONE_FLAG0 (CLONE_UNITMASK + 1)
-int clone_create(struct clonedevs **, struct cdevsw *, int *unit, struct cdev **dev, u_int extra);
+int clone_create(struct clonedevs **, struct cdevsw *, int *unit, struct cdev **dev, int extra);
 
 int	count_dev(struct cdev *_dev);
 void	destroy_dev(struct cdev *_dev);
+int	destroy_dev_sched(struct cdev *dev);
+int	destroy_dev_sched_cb(struct cdev *dev, void (*cb)(void *), void *arg);
+void	destroy_dev_drain(struct cdevsw *csw);
+void	drain_dev_clone_events(void);
 struct cdevsw *dev_refthread(struct cdev *_dev);
+struct cdevsw *devvn_refthread(struct vnode *vp, struct cdev **devp);
 void	dev_relthread(struct cdev *_dev);
 void	dev_depends(struct cdev *_pdev, struct cdev *_cdev);
 void	dev_ref(struct cdev *dev);
@@ -256,6 +262,12 @@
 struct cdev *make_dev_cred(struct cdevsw *_devsw, int _minor,
 		struct ucred *_cr, uid_t _uid, gid_t _gid, int _perms,
 		const char *_fmt, ...) __printflike(7, 8);
+#define MAKEDEV_REF     0x1
+#define MAKEDEV_WHTOUT	0x2
+struct cdev *make_dev_credf(int _flags,
+		struct cdevsw *_devsw, int _minornr,
+		struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,
+		const char *_fmt, ...) __printflike(8, 9);
 struct cdev *make_dev_alias(struct cdev *_pdev, const char *_fmt, ...) __printflike(2, 3);
 int	dev2unit(struct cdev *_dev);
 void	dev_lock(void);
@@ -292,6 +304,7 @@
 };
 
 int set_dumper(struct dumperinfo *);
+int dump_write(struct dumperinfo *, void *, vm_offset_t, off_t, size_t);
 void dumpsys(struct dumperinfo *);
 extern int dumping;		/* system is dumping */
 
Index: systm.h
===================================================================
RCS file: /home/cvs/src/sys/sys/systm.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -L sys/sys/systm.h -L sys/sys/systm.h -u -r1.3 -r1.4
--- sys/sys/systm.h
+++ sys/sys/systm.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)systm.h	8.7 (Berkeley) 3/29/95
- * $FreeBSD: src/sys/sys/systm.h,v 1.234.2.1 2005/08/30 15:14:39 pjd Exp $
+ * $FreeBSD: src/sys/sys/systm.h,v 1.260.2.1 2007/12/06 14:19:43 kib Exp $
  */
 
 #ifndef _SYS_SYSTM_H_
@@ -46,7 +46,6 @@
 #include <sys/stdint.h>		/* for people using printf mainly */
 
 extern int securelevel;		/* system security level (see init(8)) */
-extern int suser_enabled;	/* suser() is permitted to return 0 */
 
 extern int cold;		/* nonzero if we are doing a cold boot */
 extern int rebooting;		/* boot() has been called. */
@@ -83,8 +82,11 @@
 	}								\
 } while (0)
 #else
-#define	KASSERT(exp,msg)
-#define	VNASSERT(exp, vp, msg)
+#define	KASSERT(exp,msg) do { \
+} while (0)
+
+#define	VNASSERT(exp, vp, msg) do { \
+} while (0)
 #endif
 
 #ifndef CTASSERT		/* Allow lint to override */
@@ -99,10 +101,11 @@
  * in two files.
  * XXX most of these variables should be const.
  */
+extern int osreldate;
 extern int envmode;
 extern int hintmode;		/* 0 = off. 1 = config, 2 = fallback */
 extern int dynamic_kenv;
-extern struct sx kenv_lock;
+extern struct mtx kenv_lock;
 extern char *kern_envp;
 extern char static_env[];
 extern char static_hints[];	/* by config for now */
@@ -113,7 +116,7 @@
  * General function declarations.
  */
 
-struct clockframe;
+struct lock_object;
 struct malloc_type;
 struct mtx;
 struct proc;
@@ -132,7 +135,12 @@
 int	eopnotsupp(void);
 int	ureadc(int, struct uio *);
 void	hashdestroy(void *, struct malloc_type *, u_long);
-void	*hashinit(int count, struct malloc_type *type, u_long *hashmask);
+void	*hashinit(int count, struct malloc_type *type, u_long *hashmark);
+void	*hashinit_flags(int count, struct malloc_type *type,
+    u_long *hashmask, int flags);
+#define	HASH_NOWAIT	0x00000001
+#define	HASH_WAITOK	0x00000002
+
 void	*phashinit(int count, struct malloc_type *type, u_long *nentries);
 void	g_waitidle(void);
 
@@ -204,27 +212,28 @@
 int	suword16(void *base, int word);
 int	suword32(void *base, int32_t word);
 int	suword64(void *base, int64_t word);
-intptr_t casuptr(intptr_t *p, intptr_t old, intptr_t new);
+uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval);
+u_long	 casuword(volatile u_long *p, u_long oldval, u_long newval);
 
 void	realitexpire(void *);
 
-void	hardclock(struct clockframe *frame);
-void	hardclock_process(struct clockframe *frame);
+/*
+ * Cyclic clock function type definition used to hook the cyclic 
+ * subsystem into the appropriate timer interrupt.
+ */
+typedef	void (*cyclic_clock_func_t)(void);
+
+void	hardclock(int usermode, uintfptr_t pc);
+void	hardclock_cpu(int usermode);
 void	softclock(void *);
-void	statclock(struct clockframe *frame);
-void	profclock(struct clockframe *frame);
+void	statclock(int usermode);
+void	profclock(int usermode, uintfptr_t pc);
 
 void	startprofclock(struct proc *);
 void	stopprofclock(struct proc *);
 void	cpu_startprofclock(void);
 void	cpu_stopprofclock(void);
 
-/* flags for suser() and suser_cred() */
-#define SUSER_ALLOWJAIL	1
-#define SUSER_RUID	2
-
-int	suser(struct thread *td);
-int	suser_cred(struct ucred *cred, int flag);
 int	cr_cansee(struct ucred *u1, struct ucred *u2);
 int	cr_canseesocket(struct ucred *cred, struct socket *so);
 
@@ -239,6 +248,12 @@
 int	unsetenv(const char *name);
 int	testenv(const char *name);
 
+typedef uint64_t (cpu_tick_f)(void);
+void set_cputicker(cpu_tick_f *func, uint64_t freq, unsigned var);
+extern cpu_tick_f *cpu_ticks;
+uint64_t cpu_tickrate(void);
+uint64_t cputick2usec(uint64_t tick);
+
 #ifdef APM_FIXUP_CALLTODO
 struct timeval;
 void	adjust_timeout_calltodo(struct timeval *time_change);
@@ -251,16 +266,9 @@
 void	cpu_initclocks(void);
 void	usrinfoinit(void);
 
-/* Finalize the world. */
+/* Finalize the world */
 void	shutdown_nice(int);
 
-/*
- * Kernel to clock driver interface.
- */
-void	inittodr(time_t base);
-void	resettodr(void);
-void	startrtclock(void);
-
 /* Timeouts */
 typedef void timeout_t(void *);	/* timeout function type */
 #define CALLOUT_HANDLE_INITIALIZER(handle)	\
@@ -272,7 +280,7 @@
 caddr_t	kern_timeout_callwheel_alloc(caddr_t v);
 void	kern_timeout_callwheel_init(void);
 
-/* Stubs for obsolete functions that used to be for interrupt  management */
+/* Stubs for obsolete functions that used to be for interrupt management */
 static __inline void		spl0(void)		{ return; }
 static __inline intrmask_t	splbio(void)		{ return 0; }
 static __inline intrmask_t	splcam(void)		{ return 0; }
@@ -294,10 +302,15 @@
  * Common `proc' functions are declared here so that proc.h can be included
  * less often.
  */
-int	msleep(void *chan, struct mtx *mtx, int pri, const char *wmesg,
-	    int timo);
-int	msleep_spin(void *chan, struct mtx *mtx, const char *wmesg, int timo); 
-#define	tsleep(chan, pri, wmesg, timo)	msleep(chan, NULL, pri, wmesg, timo)
+int	_sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg,
+	    int timo) __nonnull(1);
+#define	msleep(chan, mtx, pri, wmesg, timo)				\
+	_sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (timo))
+int	msleep_spin(void *chan, struct mtx *mtx, const char *wmesg, int timo)
+	    __nonnull(1);
+int	pause(const char *wmesg, int timo);
+#define	tsleep(chan, pri, wmesg, timo)					\
+	_sleep((chan), NULL, (pri), (wmesg), (timo))
 void	wakeup(void *chan) __nonnull(1);
 void	wakeup_one(void *chan) __nonnull(1);
 
@@ -320,6 +333,8 @@
 
 struct root_hold_token *root_mount_hold(const char *identifier);
 void root_mount_rel(struct root_hold_token *h);
+void root_mount_wait(void);
+int root_mounted(void);
 
 
 /*
@@ -328,6 +343,8 @@
 struct unrhdr;
 struct unrhdr *new_unrhdr(int low, int high, struct mtx *mutex);
 void delete_unrhdr(struct unrhdr *uh);
+void clean_unrhdr(struct unrhdr *uh);
+void clean_unrhdrl(struct unrhdr *uh);
 int alloc_unr(struct unrhdr *uh);
 int alloc_unrl(struct unrhdr *uh);
 void free_unr(struct unrhdr *uh, u_int item);
@@ -378,9 +395,9 @@
 
 	x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1);
 	x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2);
-	x = (x & 0x0f0f0f0f) + ((x & 0xf0f0f0f0) >> 4);
-	x = (x & 0x00ff00ff) + ((x & 0xff00ff00) >> 8);
-	x = (x & 0x0000ffff) + ((x & 0xffff0000) >> 16);
+	x = (x + (x >> 4)) & 0x0f0f0f0f;
+	x = (x + (x >> 8));
+	x = (x + (x >> 16)) & 0x000000ff;
 	return (x);
 }
 
Index: acl.h
===================================================================
RCS file: /home/cvs/src/sys/sys/acl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/acl.h -L sys/sys/acl.h -u -r1.1.1.1 -r1.2
--- sys/sys/acl.h
+++ sys/sys/acl.h
@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/acl.h,v 1.28.2.1 2005/11/12 20:55:59 csjp Exp $
+ * $FreeBSD: src/sys/sys/acl.h,v 1.30 2007/03/16 13:39:04 rwatson Exp $
  */
 /* 
  * Developed by the TrustedBSD Project.
@@ -119,17 +119,17 @@
 extern uma_zone_t	acl_zone;
 
 /*
- * POSIX.1e ACLs are capable of expressing the read, write, and execute
- * bits of the POSIX mode field.  We provide two masks: one that defines
- * the bits the ACL will replace in the mode, and the other that defines
- * the bits that must be preseved when an ACL is updating a mode.
+ * POSIX.1e ACLs are capable of expressing the read, write, and execute bits
+ * of the POSIX mode field.  We provide two masks: one that defines the bits
+ * the ACL will replace in the mode, and the other that defines the bits that
+ * must be preseved when an ACL is updating a mode.
  */
 #define	ACL_OVERRIDE_MASK	(S_IRWXU | S_IRWXG | S_IRWXO)
 #define	ACL_PRESERVE_MASK	(~ACL_OVERRIDE_MASK)
 
 /*
- * File system independent code to move back and forth between POSIX mode
- * and POSIX.1e ACL representations.
+ * File system independent code to move back and forth between POSIX mode and
+ * POSIX.1e ACL representations.
  */
 acl_perm_t		acl_posix1e_mode_to_perm(acl_tag_t tag, mode_t mode);
 struct acl_entry	acl_posix1e_mode_to_entry(acl_tag_t tag, uid_t uid,
@@ -150,8 +150,8 @@
 #else /* !_KERNEL */
 
 /*
- * Syscall interface -- use the library calls instead as the syscalls
- * have strict acl entry ordering requirements.
+ * Syscall interface -- use the library calls instead as the syscalls have
+ * strict acl entry ordering requirements.
  */
 __BEGIN_DECLS
 int	__acl_aclcheck_fd(int _filedes, acl_type_t _type, struct acl *_aclp);
@@ -171,10 +171,10 @@
 __END_DECLS
 
 /*
- * Supported POSIX.1e ACL manipulation and assignment/retrieval API
- * _np calls are local extensions that reflect an environment capable of
- * opening file descriptors of directories, and allowing additional
- * ACL type for different filesystems (i.e., AFS).
+ * Supported POSIX.1e ACL manipulation and assignment/retrieval API _np calls
+ * are local extensions that reflect an environment capable of opening file
+ * descriptors of directories, and allowing additional ACL type for different
+ * filesystems (i.e., AFS).
  */
 __BEGIN_DECLS
 int	acl_add_perm(acl_permset_t _permset_d, acl_perm_t _perm);
Index: lock.h
===================================================================
RCS file: /home/cvs/src/sys/sys/lock.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/lock.h -L sys/sys/lock.h -u -r1.1.1.2 -r1.2
--- sys/sys/lock.h
+++ sys/sys/lock.h
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  *
  *	from BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $
- * $FreeBSD: src/sys/sys/lock.h,v 1.52.2.1 2005/12/20 19:28:24 jhb Exp $
+ * $FreeBSD: src/sys/sys/lock.h,v 1.68 2007/04/03 17:57:50 kmacy Exp $
  */
 
 #ifndef _SYS_LOCK_H_
@@ -45,12 +45,21 @@
  * an error to perform any type of context switch while holding a spin lock.
  * Also, for an individual lock to be recursable, its class must allow
  * recursion and the lock itself must explicitly allow recursion.
+ *
+ * The 'lc_ddb_show' function pointer is used to dump class-specific
+ * data for the 'show lock' DDB command.  The 'lc_lock' and
+ * 'lc_unlock' function pointers are used in sleep(9) and cv_wait(9)
+ * to lock and unlock locks while blocking on a sleep queue.  The
+ * return value of 'lc_unlock' will be passed to 'lc_lock' on resume
+ * to allow communication of state between the two routines.
  */
 
 struct lock_class {
 	const	char *lc_name;
 	u_int	lc_flags;
 	void	(*lc_ddb_show)(struct lock_object *lock);
+	void	(*lc_lock)(struct lock_object *lock, int how);
+	int	(*lc_unlock)(struct lock_object *lock);
 };
 
 #define	LC_SLEEPLOCK	0x00000001	/* Sleep lock. */
@@ -67,6 +76,19 @@
 #define	LO_SLEEPABLE	0x00100000	/* Lock may be held while sleeping. */
 #define	LO_UPGRADABLE	0x00200000	/* Lock may be upgraded/downgraded. */
 #define	LO_DUPOK	0x00400000	/* Don't check for duplicate acquires */
+#define	LO_ENROLLPEND	0x00800000	/* On the pending enroll list. */
+#define	LO_CLASSMASK	0x0f000000	/* Class index bitmask. */
+#define LO_NOPROFILE    0x10000000      /* Don't profile this lock */
+
+/*
+ * Lock classes are statically assigned an index into the gobal lock_classes
+ * array.  Debugging code looks up the lock class for a given lock object
+ * by indexing the array.
+ */
+#define	LO_CLASSSHIFT		24
+#define	LO_CLASSINDEX(lock)	((((lock)->lo_flags) & LO_CLASSMASK) >> LO_CLASSSHIFT)
+#define	LOCK_CLASS(lock)	(lock_classes[LO_CLASSINDEX((lock))])
+#define	LOCK_CLASS_MAX		(LO_CLASSMASK >> LO_CLASSSHIFT)
 
 #define	LI_RECURSEMASK	0x0000ffff	/* Recursion depth of lock instance. */
 #define	LI_EXCLUSIVE	0x00010000	/* Exclusive lock instance. */
@@ -94,7 +116,7 @@
  * Lock instances.  A lock instance is the data associated with a lock while
  * it is held by witness.  For example, a lock instance will hold the
  * recursion count of a lock.  Lock instances are held in lists.  Spin locks
- * are held in a per-cpu list while sleep locks are held in per-process list.
+ * are held in a per-cpu list while sleep locks are held in per-thread list.
  */
 struct lock_instance {
 	struct	lock_object *li_lock;
@@ -104,9 +126,9 @@
 };
 
 /*
- * A simple list type used to build the list of locks held by a process
+ * A simple list type used to build the list of locks held by a thread
  * or CPU.  We can't simply embed the list in struct lock_object since a
- * lock may be held by more than one process if it is a shared lock.  Locks
+ * lock may be held by more than one thread if it is a shared lock.  Locks
  * are added to the head of the list, so we fill up each list entry from
  * "the back" logically.  To ease some of the arithmetic, we actually fill
  * in each list entry the normal way (childer[0] then children[1], etc.) but
@@ -130,7 +152,7 @@
  * calling conventions for this debugging code in modules so that modules can
  * work with both debug and non-debug kernels.
  */
-#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || defined(INVARIANT_SUPPORT) || defined(KTR) || defined(MUTEX_PROFILING)
+#if defined(KLD_MODULE) || defined(WITNESS) || defined(INVARIANTS) || defined(INVARIANT_SUPPORT) || defined(KTR) || defined(LOCK_PROFILING)
 #define	LOCK_DEBUG	1
 #else
 #define	LOCK_DEBUG	0
@@ -165,25 +187,27 @@
 #define	LOCK_LOG_LOCK(opname, lo, flags, recurse, file, line) do {	\
 	if (LOCK_LOG_TEST((lo), (flags)))				\
 		CTR5(KTR_LOCK, opname " (%s) %s r = %d at %s:%d",	\
-		    (lo)->lo_class->lc_name, (lo)->lo_name,		\
+		    LOCK_CLASS(lo)->lc_name, (lo)->lo_name,		\
 		    (u_int)(recurse), (file), (line));			\
 } while (0)
 
 #define	LOCK_LOG_TRY(opname, lo, flags, result, file, line) do {	\
 	if (LOCK_LOG_TEST((lo), (flags)))				\
 		CTR5(KTR_LOCK, "TRY_" opname " (%s) %s result=%d at %s:%d",\
-		    (lo)->lo_class->lc_name, (lo)->lo_name,		\
+		    LOCK_CLASS(lo)->lc_name, (lo)->lo_name,		\
 		    (u_int)(result), (file), (line));			\
 } while (0)
 
 #define	LOCK_LOG_INIT(lo, flags) do {					\
 	if (LOCK_LOG_TEST((lo), (flags)))				\
 		CTR4(KTR_LOCK, "%s: %p (%s) %s", __func__, (lo),	\
- 		    (lo)->lo_class->lc_name, (lo)->lo_name);		\
+ 		    LOCK_CLASS(lo)->lc_name, (lo)->lo_name);		\
 } while (0)
 
 #define	LOCK_LOG_DESTROY(lo, flags)	LOCK_LOG_INIT(lo, flags)
 
+#define	lock_initalized(lo)	((lo)->lo_flags & LO_INITIALIZED)
+
 /*
  * Helpful macros for quickly coming up with assertions with informative
  * panic messages.
@@ -197,7 +221,14 @@
 extern struct lock_class lock_class_mtx_sleep;
 extern struct lock_class lock_class_mtx_spin;
 extern struct lock_class lock_class_sx;
+extern struct lock_class lock_class_rw;
+extern struct lock_class lock_class_lockmgr;
 
+extern struct lock_class *lock_classes[];
+
+void	lock_init(struct lock_object *, struct lock_class *,
+    const char *, const char *, int);
+void	lock_destroy(struct lock_object *);
 void	spinlock_enter(void);
 void	spinlock_exit(void);
 void	witness_init(struct lock_object *);
@@ -249,6 +280,9 @@
 #define	WITNESS_UNLOCK(lock, flags, file, line)				\
 	witness_unlock((lock), (flags), (file), (line))
 
+#define	WITNESS_CHECK(flags, lock, fmt, ...)				\
+	witness_warn((flags), (lock), (fmt), ## __VA_ARGS__)
+
 #define	WITNESS_WARN(flags, lock, fmt, ...)				\
 	witness_warn((flags), (lock), (fmt), ## __VA_ARGS__)
 
@@ -269,14 +303,15 @@
 	witness_line(lock)
 
 #else	/* WITNESS */
-#define	WITNESS_INIT(lock)	((lock)->lo_flags |= LO_INITIALIZED)
-#define	WITNESS_DESTROY(lock)	((lock)->lo_flags &= ~LO_INITIALIZED)
+#define	WITNESS_INIT(lock)
+#define	WITNESS_DESTROY(lock)
 #define	WITNESS_DEFINEORDER(lock1, lock2)	0
 #define	WITNESS_CHECKORDER(lock, flags, file, line)
 #define	WITNESS_LOCK(lock, flags, file, line)
 #define	WITNESS_UPGRADE(lock, flags, file, line)
 #define	WITNESS_DOWNGRADE(lock, flags, file, line)
 #define	WITNESS_UNLOCK(lock, flags, file, line)
+#define	WITNESS_CHECK(flags, lock, fmt, ...)	0
 #define	WITNESS_WARN(flags, lock, fmt, ...)
 #define	WITNESS_SAVE_DECL(n)
 #define	WITNESS_SAVE(lock, n)
@@ -289,16 +324,12 @@
  * Helper macros to allow developers to add explicit lock order checks
  * wherever they please without having to actually grab a lock to do so.
  */
-#define	witness_check_mutex(m)						\
-	WITNESS_CHECKORDER(&(m)->mtx_object, LOP_EXCLUSIVE, LOCK_FILE,	\
+#define	witness_check(l)						\
+	WITNESS_CHECKORDER(&(l)->lock_object, LOP_EXCLUSIVE, LOCK_FILE,	\
 	    LOCK_LINE)
 
-#define	witness_check_shared_sx(sx)					\
-	WITNESS_CHECKORDER(&(sx)->sx_object, 0, LOCK_FILE, LOCK_LINE)
+#define	witness_check_shared(l)						\
+	WITNESS_CHECKORDER(&(l)->lock_object, 0, LOCK_FILE, LOCK_LINE)
 	
-#define	witness_check_exclusive_sx(sx)					\
-	WITNESS_CHECKORDER(&(sx)->sx_object, LOP_EXCLUSIVE, LOCK_FILE,	\
-	    LOCK_LINE)
-
 #endif	/* _KERNEL */
 #endif	/* _SYS_LOCK_H_ */
Index: sysctl.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sysctl.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/sysctl.h -L sys/sys/sysctl.h -u -r1.2 -r1.3
--- sys/sys/sysctl.h
+++ sys/sys/sysctl.h
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)sysctl.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/sysctl.h,v 1.138.2.1 2006/03/01 21:08:53 andre Exp $
+ * $FreeBSD: src/sys/sys/sysctl.h,v 1.148 2007/06/04 18:14:28 dwmalone Exp $
  */
 
 #ifndef _SYS_SYSCTL_H_
@@ -170,6 +170,7 @@
 int sysctl_handle_int(SYSCTL_HANDLER_ARGS);
 int sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS);
 int sysctl_handle_long(SYSCTL_HANDLER_ARGS);
+int sysctl_handle_quad(SYSCTL_HANDLER_ARGS);
 int sysctl_handle_intptr(SYSCTL_HANDLER_ARGS);
 int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
 int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
@@ -205,15 +206,21 @@
 #define SYSCTL_NODE_CHILDREN(parent, name) \
 	sysctl_##parent##_##name##_children
 
+#ifndef NO_SYSCTL_DESCR
+#define __DESCR(d) d
+#else
+#define __DESCR(d) ""
+#endif
+
 /* This constructs a "raw" MIB oid. */
 #define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
 	static struct sysctl_oid sysctl__##parent##_##name = {		 \
 		&sysctl_##parent##_children, { 0 },			 \
-		nbr, kind, a1, a2, #name, handler, fmt, 0, descr };	 \
+		nbr, kind, a1, a2, #name, handler, fmt, 0, __DESCR(descr) }; \
 	DATA_SET(sysctl_set, sysctl__##parent##_##name)
 
 #define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
-	sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr)
+	sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr))
 
 /* This constructs a node from which other oids can hang. */
 #define SYSCTL_NODE(parent, nbr, name, access, handler, descr)		    \
@@ -224,7 +231,7 @@
 
 #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr)	    \
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access),	    \
-	0, 0, handler, "N", descr)
+	0, 0, handler, "N", __DESCR(descr))
 
 /* Oid for a string.  len can be 0 to indicate '\0' termination. */
 #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
@@ -233,7 +240,7 @@
 
 #define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr)  \
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access),	    \
-	arg, len, sysctl_handle_string, "A", descr)
+	arg, len, sysctl_handle_string, "A", __DESCR(descr))
 
 /* Oid for an int.  If ptr is NULL, val is returned. */
 #define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
@@ -242,7 +249,7 @@
 
 #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr)	    \
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_INT|(access),	    \
-	ptr, val, sysctl_handle_int, "I", descr)
+	ptr, val, sysctl_handle_int, "I", __DESCR(descr))
 
 /* Oid for an unsigned int.  If ptr is NULL, val is returned. */
 #define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \
@@ -251,7 +258,15 @@
 
 #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr)    \
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|(access),	    \
-	ptr, val, sysctl_handle_int, "IU", descr)
+	ptr, val, sysctl_handle_int, "IU", __DESCR(descr))
+
+#define SYSCTL_XINT(parent, nbr, name, access, ptr, val, descr) \
+	SYSCTL_OID(parent, nbr, name, CTLTYPE_UINT|(access), \
+		ptr, val, sysctl_handle_int, "IX", descr)
+
+#define SYSCTL_ADD_XINT(ctx, parent, nbr, name, access, ptr, val, descr)    \
+	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_UINT|(access),	    \
+	ptr, val, sysctl_handle_int, "IX", __DESCR(descr))
 
 /* Oid for a long.  The pointer must be non NULL. */
 #define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
@@ -260,16 +275,24 @@
 
 #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr)	    \
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_LONG|(access),	    \
-	ptr, 0, sysctl_handle_long, "L", descr)
+	ptr, 0, sysctl_handle_long, "L", __DESCR(descr))
 
 /* Oid for an unsigned long.  The pointer must be non NULL. */
 #define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \
 	SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|(access), \
-		ptr, val, sysctl_handle_long, "LU", descr)
+		ptr, val, sysctl_handle_long, "LU", __DESCR(descr))
 
 #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr)	    \
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access),	    \
-	ptr, 0, sysctl_handle_long, "LU", descr)
+	ptr, 0, sysctl_handle_long, "LU", __DESCR(descr))
+
+#define SYSCTL_XLONG(parent, nbr, name, access, ptr, val, descr) \
+	SYSCTL_OID(parent, nbr, name, CTLTYPE_ULONG|(access), \
+		ptr, val, sysctl_handle_long, "LX", __DESCR(descr))
+
+#define SYSCTL_ADD_XLONG(ctx, parent, nbr, name, access, ptr, descr)	    \
+	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|(access),	    \
+	ptr, 0, sysctl_handle_long, "LX", __DESCR(descr))
 
 /* Oid for an opaque object.  Specified by a pointer and a length. */
 #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
@@ -278,7 +301,7 @@
 
 #define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr)\
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),	    \
-	ptr, len, sysctl_handle_opaque, fmt, descr)
+	ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr))
 
 /* Oid for a struct.  Specified by a pointer and a type. */
 #define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
@@ -288,7 +311,7 @@
 
 #define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
 	sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access),	    \
-	ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, descr)
+	ptr, sizeof(struct type), sysctl_handle_opaque, "S," #type, __DESCR(descr))
 
 /* Oid for a procedure.  Specified by a pointer and an arg. */
 #define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
@@ -297,7 +320,7 @@
 
 #define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
 	sysctl_add_oid(ctx, parent, nbr, name, (access),			    \
-	ptr, arg, handler, fmt, descr)
+	ptr, arg, handler, fmt, __DESCR(descr))
 
 #endif /* _KERNEL */
 
@@ -367,7 +390,9 @@
 #define	KERN_USRSTACK		33	/* int: address of USRSTACK */
 #define	KERN_LOGSIGEXIT		34	/* int: do we log sigexit procs? */
 #define	KERN_IOV_MAX		35	/* int: value of UIO_MAXIOV */
-#define KERN_MAXID		36	/* number of valid kern ids */
+#define	KERN_HOSTUUID		36	/* string: host UUID identifier */
+#define	KERN_ARND		37	/* int: from arc4rand() */
+#define	KERN_MAXID		38	/* number of valid kern ids */
 
 #define CTL_KERN_NAMES { \
 	{ 0, 0 }, \
@@ -405,6 +430,7 @@
 	{ "usrstack", CTLTYPE_INT }, \
 	{ "logsigexit", CTLTYPE_INT }, \
 	{ "iov_max", CTLTYPE_INT }, \
+	{ "hostuuid", CTLTYPE_STRING }, \
 }
 
 /*
@@ -591,8 +617,11 @@
  */
 extern struct sysctl_oid_list sysctl__children;
 SYSCTL_DECL(_kern);
+SYSCTL_DECL(_kern_ipc);
 SYSCTL_DECL(_sysctl);
 SYSCTL_DECL(_vm);
+SYSCTL_DECL(_vm_stats);
+SYSCTL_DECL(_vm_stats_misc);
 SYSCTL_DECL(_vfs);
 SYSCTL_DECL(_net);
 SYSCTL_DECL(_debug);
@@ -602,6 +631,9 @@
 SYSCTL_DECL(_machdep);
 SYSCTL_DECL(_user);
 SYSCTL_DECL(_compat);
+SYSCTL_DECL(_regression);
+SYSCTL_DECL(_security);
+SYSCTL_DECL(_security_bsd);
 
 extern char	machine[];
 extern char	osrelease[];
Index: refcount.h
===================================================================
RCS file: /home/cvs/src/sys/sys/refcount.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/refcount.h -L sys/sys/refcount.h -u -r1.1.1.1 -r1.2
--- sys/sys/refcount.h
+++ sys/sys/refcount.h
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/refcount.h,v 1.1.2.1 2005/10/06 18:13:19 jhb Exp $
+ * $FreeBSD: src/sys/sys/refcount.h,v 1.1 2005/09/27 18:01:33 jhb Exp $
  */
 
 #ifndef __SYS_REFCOUNT_H__
Index: aio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/aio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/aio.h -L sys/sys/aio.h -u -r1.1.1.1 -r1.2
--- sys/sys/aio.h
+++ sys/sys/aio.h
@@ -13,7 +13,7 @@
  * bad that happens because of using this software isn't the responsibility
  * of the author.  This software is distributed AS-IS.
  *
- * $FreeBSD: src/sys/sys/aio.h,v 1.30 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/aio.h,v 1.32 2006/03/23 08:47:28 davidxu Exp $
  */
 
 #ifndef _SYS_AIO_H_
@@ -36,6 +36,9 @@
 #define	LIO_NOP			0x0
 #define LIO_WRITE		0x1
 #define	LIO_READ		0x2
+#ifdef _KERNEL
+#define	LIO_SYNC		0x3
+#endif
 
 /*
  * LIO modes
@@ -66,10 +69,11 @@
 	off_t	aio_offset;		/* File offset for I/O */
 	volatile void *aio_buf;         /* I/O buffer in process space */
 	size_t	aio_nbytes;		/* Number of bytes for I/O */
-	struct	sigevent aio_sigevent;	/* Signal to deliver */
+	char 	__spare__[sizeof(int) * 2 + sizeof(void *)]; /* osigevent. */
 	int	aio_lio_opcode;		/* LIO opcode */
 	int	aio_reqprio;		/* Request priority -- ignored */
 	struct	__aiocb_private	_aiocb_private;
+	struct	sigevent aio_sigevent;	/* Signal to deliver */
 } aiocb_t;
 
 #ifndef _KERNEL
@@ -120,6 +124,7 @@
 
 int	aio_waitcomplete(struct aiocb **, struct timespec *);
 
+int	aio_fsync(int op, struct aiocb *aiocbp);
 __END_DECLS
 
 #else
Index: file.h
===================================================================
RCS file: /home/cvs/src/sys/sys/file.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/file.h -L sys/sys/file.h -u -r1.1.1.1 -r1.2
--- sys/sys/file.h
+++ sys/sys/file.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)file.h	8.3 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/sys/file.h,v 1.70 2005/02/10 12:27:58 phk Exp $
+ * $FreeBSD: src/sys/sys/file.h,v 1.73 2007/01/05 19:59:46 jhb Exp $
  */
 
 #ifndef _SYS_FILE_H_
@@ -58,6 +58,7 @@
 #define	DTYPE_FIFO	4	/* fifo (named pipe) */
 #define	DTYPE_KQUEUE	5	/* event queue */
 #define	DTYPE_CRYPTO	6	/* crypto */
+#define	DTYPE_MQUEUE	7	/* posix message queue */
 
 #ifdef _KERNEL
 
@@ -116,11 +117,18 @@
 
 	/* DFLAG_SEEKABLE specific fields */
 	off_t	f_offset;
-
+	short     f_vnread_flags; /* 
+				   * (f) home grown sleep lock for f_offset
+				   * Used only for shared vnode locking in
+				   * vnread()
+				   */
+#define  FOFFSET_LOCKED       0x1
+#define  FOFFSET_LOCK_WAITING 0x2		 
 	/* DTYPE_SOCKET specific fields */
 	short	f_gcflag;	/* used by thread doing fd garbage collection */
 #define	FMARK		0x1	/* mark during gc() */
 #define	FDEFER		0x2	/* defer for next gc pass */
+#define	FWAIT		0x4	/* gc is scanning message buffers */
 	int	f_msgcount;	/* (f) references from message queue */
 
 	/* DTYPE_VNODE specific fields */
Index: ioctl_compat.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ioctl_compat.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ioctl_compat.h -L sys/sys/ioctl_compat.h -u -r1.1.1.1 -r1.2
--- sys/sys/ioctl_compat.h
+++ sys/sys/ioctl_compat.h
@@ -32,16 +32,19 @@
  * SUCH DAMAGE.
  *
  *	@(#)ioctl_compat.h	8.4 (Berkeley) 1/21/94
- * $FreeBSD: src/sys/sys/ioctl_compat.h,v 1.8 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/ioctl_compat.h,v 1.10 2007/04/27 11:19:05 benjsc Exp $
  */
 
 #ifndef _SYS_IOCTL_COMPAT_H_
 #define	_SYS_IOCTL_COMPAT_H_
 
-#ifndef BURN_BRIDGES
 #include <sys/ttychars.h>
 #include <sys/ttydev.h>
 
+#ifdef USE_OLD_TTY
+#warning "Old BSD tty API used and depends on COMPAT_43TTY. Use termios.h instead"
+#endif
+
 struct tchars {
 	char	t_intrc;	/* interrupt */
 	char	t_quitc;	/* quit */
@@ -162,5 +165,4 @@
 #define	NETLDISC	1
 #define	NTTYDISC	2
 
-#endif /* BURN_BRIDGES */
 #endif /* !_SYS_IOCTL_COMPAT_H_ */
Index: syscall.h
===================================================================
RCS file: /home/cvs/src/sys/sys/syscall.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/syscall.h -L sys/sys/syscall.h -u -r1.2 -r1.3
--- sys/sys/syscall.h
+++ sys/sys/syscall.h
@@ -2,8 +2,8 @@
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/sys/syscall.h,v 1.178.2.2 2006/03/17 01:47:33 rwatson Exp $
- * created from FreeBSD: src/sys/kern/syscalls.master,v 1.198.2.2 2006/03/17 01:47:06 rwatson Exp 
+ * $FreeBSD: src/sys/sys/syscall.h,v 1.211 2007/08/16 05:32:26 davidxu Exp $
+ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.232 2007/07/04 22:47:37 peter Exp 
  */
 
 #define	SYS_syscall	0
@@ -24,7 +24,7 @@
 #define	SYS_chmod	15
 #define	SYS_chown	16
 #define	SYS_break	17
-				/* 18 is old getfsstat */
+#define	SYS_freebsd4_getfsstat	18
 				/* 19 is old lseek */
 #define	SYS_getpid	20
 #define	SYS_mount	21
@@ -156,8 +156,8 @@
 				/* 150 is old getsockname */
 #define	SYS_nfssvc	155
 				/* 156 is old getdirentries */
-				/* 157 is old statfs */
-				/* 158 is old fstatfs */
+#define	SYS_freebsd4_statfs	157
+#define	SYS_freebsd4_fstatfs	158
 #define	SYS_lgetfh	160
 #define	SYS_getfh	161
 #define	SYS_getdomainname	162
@@ -168,8 +168,8 @@
 #define	SYS_semsys	169
 #define	SYS_msgsys	170
 #define	SYS_shmsys	171
-#define	SYS_pread	173
-#define	SYS_pwrite	174
+#define	SYS_freebsd6_pread	173
+#define	SYS_freebsd6_pwrite	174
 #define	SYS_ntp_adjtime	176
 #define	SYS_setgid	181
 #define	SYS_setegid	182
@@ -182,11 +182,11 @@
 #define	SYS_getrlimit	194
 #define	SYS_setrlimit	195
 #define	SYS_getdirentries	196
-#define	SYS_mmap	197
+#define	SYS_freebsd6_mmap	197
 #define	SYS___syscall	198
-#define	SYS_lseek	199
-#define	SYS_truncate	200
-#define	SYS_ftruncate	201
+#define	SYS_freebsd6_lseek	199
+#define	SYS_freebsd6_truncate	200
+#define	SYS_freebsd6_ftruncate	201
 #define	SYS___sysctl	202
 #define	SYS_mlock	203
 #define	SYS_munlock	204
@@ -208,6 +208,11 @@
 #define	SYS_clock_gettime	232
 #define	SYS_clock_settime	233
 #define	SYS_clock_getres	234
+#define	SYS_ktimer_create	235
+#define	SYS_ktimer_delete	236
+#define	SYS_ktimer_settime	237
+#define	SYS_ktimer_gettime	238
+#define	SYS_ktimer_getoverrun	239
 #define	SYS_nanosleep	240
 #define	SYS_ntp_gettime	248
 #define	SYS_minherit	250
@@ -215,6 +220,9 @@
 #define	SYS_openbsd_poll	252
 #define	SYS_issetugid	253
 #define	SYS_lchown	254
+#define	SYS_aio_read	255
+#define	SYS_aio_write	256
+#define	SYS_lio_listio	257
 #define	SYS_getdents	272
 #define	SYS_lchmod	274
 #define	SYS_netbsd_lchown	275
@@ -225,7 +233,7 @@
 #define	SYS_nlstat	280
 #define	SYS_preadv	289
 #define	SYS_pwritev	290
-				/* 297 is old fhstatfs */
+#define	SYS_freebsd4_fhstatfs	297
 #define	SYS_fhopen	298
 #define	SYS_fhstat	299
 #define	SYS_modnext	300
@@ -246,9 +254,9 @@
 #define	SYS_aio_suspend	315
 #define	SYS_aio_cancel	316
 #define	SYS_aio_error	317
-#define	SYS_aio_read	318
-#define	SYS_aio_write	319
-#define	SYS_lio_listio	320
+#define	SYS_oaio_read	318
+#define	SYS_oaio_write	319
+#define	SYS_olio_listio	320
 #define	SYS_yield	321
 				/* 322 is obsolete thr_sleep */
 				/* 323 is obsolete thr_wakeup */
@@ -264,14 +272,14 @@
 #define	SYS_sched_get_priority_min	333
 #define	SYS_sched_rr_get_interval	334
 #define	SYS_utrace	335
-				/* 336 is old sendfile */
+#define	SYS_freebsd4_sendfile	336
 #define	SYS_kldsym	337
 #define	SYS_jail	338
 #define	SYS_sigprocmask	340
 #define	SYS_sigsuspend	341
-				/* 342 is old sigaction */
+#define	SYS_freebsd4_sigaction	342
 #define	SYS_sigpending	343
-				/* 344 is old sigreturn */
+#define	SYS_freebsd4_sigreturn	344
 #define	SYS_sigtimedwait	345
 #define	SYS_sigwaitinfo	346
 #define	SYS___acl_get_file	347
@@ -371,4 +379,26 @@
 #define	SYS_auditctl	453
 #define	SYS__umtx_op	454
 #define	SYS_thr_new	455
-#define	SYS_MAXSYSCALL	456
+#define	SYS_sigqueue	456
+#define	SYS_kmq_open	457
+#define	SYS_kmq_setattr	458
+#define	SYS_kmq_timedreceive	459
+#define	SYS_kmq_timedsend	460
+#define	SYS_kmq_notify	461
+#define	SYS_kmq_unlink	462
+#define	SYS_abort2	463
+#define	SYS_thr_set_name	464
+#define	SYS_aio_fsync	465
+#define	SYS_rtprio_thread	466
+#define	SYS_sctp_peeloff	471
+#define	SYS_sctp_generic_sendmsg	472
+#define	SYS_sctp_generic_sendmsg_iov	473
+#define	SYS_sctp_generic_recvmsg	474
+#define	SYS_pread	475
+#define	SYS_pwrite	476
+#define	SYS_mmap	477
+#define	SYS_lseek	478
+#define	SYS_truncate	479
+#define	SYS_ftruncate	480
+#define	SYS_thr_kill2	481
+#define	SYS_MAXSYSCALL	482
Index: thr.h
===================================================================
RCS file: /home/cvs/src/sys/sys/thr.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/thr.h -L sys/sys/thr.h -u -r1.1.1.1 -r1.2
--- sys/sys/thr.h
+++ sys/sys/thr.h
@@ -23,13 +23,21 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/thr.h,v 1.6 2005/04/23 02:36:07 davidxu Exp $
+ * $FreeBSD: src/sys/sys/thr.h,v 1.14 2007/08/16 05:26:42 davidxu Exp $
  *
  */
 
 #ifndef _SYS_THR_H_
 #define	_SYS_THR_H_
 
+#include <sys/_types.h>
+#include <sys/sched.h>
+
+#ifndef _SIZE_T_DECLARED
+typedef __size_t	size_t;
+#define _SIZE_T_DECLARED
+#endif
+
 /* Create the thread in the suspended state. */
 #define	THR_SUSPENDED		0x0001
 /* Create the system scope thread. */
@@ -45,21 +53,30 @@
     long	*child_tid;		/* address to store new TID. */
     long	*parent_tid;		/* parent accesses the new TID here. */
     int		flags;			/* thread flags. */
-    void	*spare[4];		/* TODO: cpu affinity mask etc. */
+    struct rtprio	*rtp;		/* Real-time scheduling priority */
+    void	*spare[3];		/* TODO: cpu affinity mask etc. */
 };
 
 /* 
  * See pthread_*
  */
 #ifndef _KERNEL
+#include <sys/ucontext.h>
+
+#ifndef _PID_T_DECLARED
+typedef __pid_t		pid_t;
+#define _PID_T_DECLARED
+#endif
 
 int thr_create(ucontext_t *ctx, long *id, int flags);
 int thr_new(struct thr_param *param, int param_size);
 int thr_self(long *id);
 void thr_exit(long *state);
 int thr_kill(long id, int sig);
+int thr_kill2(pid_t pid, long id, int sig);
 int thr_suspend(const struct timespec *timeout);
 int thr_wake(long id);
+int thr_set_name(long id, const char *name);
 
 #endif /* !_KERNEL */
 
Index: syscallsubr.h
===================================================================
RCS file: /home/cvs/src/sys/sys/syscallsubr.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/syscallsubr.h -L sys/sys/syscallsubr.h -u -r1.1.1.2 -r1.2
--- sys/sys/syscallsubr.h
+++ sys/sys/syscallsubr.h
@@ -22,7 +22,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/syscallsubr.h,v 1.31.2.1 2005/12/28 19:30:41 ps Exp $
+ * $FreeBSD: src/sys/sys/syscallsubr.h,v 1.46 2007/06/07 19:45:19 jhb Exp $
  */
 
 #ifndef _SYS_SYSCALLSUBR_H_
@@ -34,6 +34,7 @@
 #include <sys/mac.h>
 #include <sys/mount.h>
 
+struct file;
 struct itimerval;
 struct image_args;
 struct mbuf;
@@ -41,13 +42,18 @@
 struct msqid_ds;
 struct rlimit;
 struct rusage;
+union semun;
 struct sockaddr;
 struct stat;
 struct kevent;
 struct kevent_copyops;
+struct sendfile_args;
+struct thr_param;
 
 int	kern___getcwd(struct thread *td, u_char *buf, enum uio_seg bufseg,
 	    u_int buflen);
+int	kern_accept(struct thread *td, int s, struct sockaddr **name,
+	    socklen_t *namelen, struct file **fp);
 int	kern_access(struct thread *td, char *path, enum uio_seg pathseg,
 	    int flags);
 int	kern_adjtime(struct thread *td, struct timeval *delta,
@@ -66,7 +72,10 @@
 	    struct timespec *ats);
 int	kern_clock_settime(struct thread *td, clockid_t clock_id,
 	    struct timespec *ats);
+int	kern_close(struct thread *td, int fd);
 int	kern_connect(struct thread *td, int fd, struct sockaddr *sa);
+int	kern_eaccess(struct thread *td, char *path, enum uio_seg pathseg,
+	    int flags);
 int	kern_execve(struct thread *td, struct image_args *args,
 	    struct mac *mac_p);
 int	kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg);
@@ -77,12 +86,20 @@
 	    enum uio_seg tptrseg);
 int	kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
 	    enum uio_seg bufseg, int flags);
+int	kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups);
 int	kern_getitimer(struct thread *, u_int, struct itimerval *);
+int	kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
+	    socklen_t *alen);
 int	kern_getrusage(struct thread *td, int who, struct rusage *rup);
+int	kern_getsockname(struct thread *td, int fd, struct sockaddr **sa,
+	    socklen_t *alen);
 int	kern_getsockopt(struct thread *td, int s, int level, int name,
 	    void *optval, enum uio_seg valseg, socklen_t *valsize);
+int	kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data);
 int	kern_kevent(struct thread *td, int fd, int nchanges, int nevents,
 	    struct kevent_copyops *k_ops, const struct timespec *timeout);
+int	kern_kldload(struct thread *td, const char *file, int *fileid);
+int	kern_kldunload(struct thread *td, int fileid, int flags);
 int	kern_lchown(struct thread *td, char *path, enum uio_seg pathseg,
 	    int uid, int gid);
 int	kern_link(struct thread *td, char *path, char *link,
@@ -98,6 +115,8 @@
 int	kern_mknod(struct thread *td, char *path, enum uio_seg pathseg,
 	    int mode, int dev);
 int	kern_msgctl(struct thread *, int, int, struct msqid_ds *);
+int	kern_msgsnd(struct thread *, int, const void *, size_t, int, long);
+int	kern_msgrcv(struct thread *, int, void *, size_t, long, int, long *);
 int     kern_nanosleep(struct thread *td, struct timespec *rqt,
 	    struct timespec *rmt);
 int	kern_open(struct thread *td, char *path, enum uio_seg pathseg,
@@ -111,17 +130,22 @@
 int	kern_readlink(struct thread *td, char *path, enum uio_seg pathseg,
 	    char *buf, enum uio_seg bufseg, int count);
 int	kern_readv(struct thread *td, int fd, struct uio *auio);
-int	kern_recvit(struct thread *td, int s, struct msghdr *mp, void *namelenp,
-	    enum uio_seg segflg, struct mbuf **controlp);
+int	kern_recvit(struct thread *td, int s, struct msghdr *mp,
+	    enum uio_seg fromseg, struct mbuf **controlp);
 int	kern_rename(struct thread *td, char *from, char *to,
 	    enum uio_seg pathseg);
 int	kern_rmdir(struct thread *td, char *path, enum uio_seg pathseg);
 int	kern_sched_rr_get_interval(struct thread *td, pid_t pid,
 	    struct timespec *ts);
+int	kern_semctl(struct thread *td, int semid, int semnum, int cmd,
+	    union semun *arg, register_t *rval);
 int	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou,
 	    fd_set *fd_ex, struct timeval *tvp);
+int	kern_sendfile(struct thread *td, struct sendfile_args *uap,
+	    struct uio *hdr_uio, struct uio *trl_uio, int compat);
 int	kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags,
 	    struct mbuf *control, enum uio_seg segflg);
+int	kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups);
 int	kern_setitimer(struct thread *, u_int, struct itimerval *,
 	    struct itimerval *);
 int	kern_setrlimit(struct thread *, u_int, struct rlimit *);
@@ -145,6 +169,8 @@
 	    struct statfs *buf);
 int	kern_symlink(struct thread *td, char *path, char *link,
 	    enum uio_seg segflg);
+int	kern_thr_new(struct thread *td, struct thr_param *param);
+int	kern_thr_suspend(struct thread *td, struct timespec *tsp);
 int	kern_truncate(struct thread *td, char *path, enum uio_seg pathseg,
 	    off_t length);
 int	kern_unlink(struct thread *td, char *path, enum uio_seg pathseg);
Index: msgbuf.h
===================================================================
RCS file: /home/cvs/src/sys/sys/msgbuf.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/msgbuf.h -L sys/sys/msgbuf.h -u -r1.1.1.1 -r1.2
--- sys/sys/msgbuf.h
+++ sys/sys/msgbuf.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)msgbuf.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/msgbuf.h,v 1.27 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/msgbuf.h,v 1.28 2006/09/03 00:33:19 jmg Exp $
  */
 
 #ifndef _SYS_MSGBUF_H_
@@ -68,11 +68,7 @@
 void	msgbuf_reinit(struct msgbuf *mbp, void *ptr, int size);
 
 #ifndef MSGBUF_SIZE
-#ifdef __amd64__
 #define	MSGBUF_SIZE	(32768 * 2)
-#else
-#define	MSGBUF_SIZE	32768
-#endif
 #endif
 #endif /* KERNEL */
 
Index: unistd.h
===================================================================
RCS file: /home/cvs/src/sys/sys/unistd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/unistd.h -L sys/sys/unistd.h -u -r1.1.1.1 -r1.2
--- sys/sys/unistd.h
+++ sys/sys/unistd.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)unistd.h	8.2 (Berkeley) 1/7/94
- * $FreeBSD: src/sys/sys/unistd.h,v 1.41 2005/01/07 02:29:24 imp Exp $
+ * $FreeBSD: src/sys/sys/unistd.h,v 1.49 2007/04/07 18:31:40 pjd Exp $
  */
 
 #ifndef _SYS_UNISTD_H_
@@ -61,18 +61,19 @@
 #define	_POSIX_MEMLOCK			-1
 #define	_POSIX_MEMLOCK_RANGE		200112L
 #define	_POSIX_MEMORY_PROTECTION	200112L
-#define	_POSIX_MESSAGE_PASSING		-1
-#define	_POSIX_MONOTONIC_CLOCK		-1
+#define	_POSIX_MESSAGE_PASSING		200112L
+#define	_POSIX_MONOTONIC_CLOCK		200112L
 #define	_POSIX_NO_TRUNC			1
 #define	_POSIX_PRIORITIZED_IO		-1
 #define	_POSIX_PRIORITY_SCHEDULING	200112L
 #define	_POSIX_RAW_SOCKETS		200112L
-#define	_POSIX_REALTIME_SIGNALS		-1
+#define	_POSIX_REALTIME_SIGNALS		200112L
 #define	_POSIX_SEMAPHORES		-1
 #define	_POSIX_SHARED_MEMORY_OBJECTS	200112L
 #define	_POSIX_SPORADIC_SERVER		-1
 #define	_POSIX_SYNCHRONIZED_IO		-1
-#define	_POSIX_TIMEOUTS			-1
+#define	_POSIX_TIMEOUTS			200112L
+#define	_POSIX_TIMERS			200112L
 #define	_POSIX_TYPED_MEMORY_OBJECTS	-1
 #define	_POSIX_VDISABLE			0xff
 
@@ -107,6 +108,10 @@
 #define	SEEK_CUR	1	/* set file offset to current plus offset */
 #define	SEEK_END	2	/* set file offset to EOF plus offset */
 #endif
+#if __BSD_VISIBLE
+#define	SEEK_DATA	3	/* set file offset to next data past offset */
+#define	SEEK_HOLE	4	/* set file offset to next hole past offset */
+#endif
 
 #ifndef _POSIX_SOURCE
 /* whence values for lseek(2); renamed by POSIX 1003.1 */
@@ -150,6 +155,9 @@
 #define	_PC_MAC_PRESENT		63
 #endif
 
+/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */
+#define	_PC_MIN_HOLE_SIZE	21
+
 #if __BSD_VISIBLE
 /*
  * rfork() options.
Index: linker.h
===================================================================
RCS file: /home/cvs/src/sys/sys/linker.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/linker.h -L sys/sys/linker.h -u -r1.1.1.2 -r1.2
--- sys/sys/linker.h
+++ sys/sys/linker.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/linker.h,v 1.39.2.1 2005/12/30 22:13:58 marcel Exp $
+ * $FreeBSD: src/sys/sys/linker.h,v 1.46 2006/06/20 20:59:55 jhb Exp $
  */
 
 #ifndef _SYS_LINKER_H_
@@ -95,21 +95,14 @@
 };
 
 /*
- * The "file" for the kernel.
- */
-extern linker_file_t	linker_kernel_file;
-
-/*
- * Add a new file class to the linker.
+ * Function type used when iterating over the list of linker files.
  */
-int linker_add_class(linker_class_t _cls);
+typedef int linker_predicate_t(linker_file_t, void *);
 
 /*
- * Load a kernel module.
+ * The "file" for the kernel.
  */
-int linker_load_module(const char *_kldname, const char *_modname,
-    struct linker_file *_parent, struct mod_depend *_verinfo,
-    struct linker_file **_lfpp);
+extern linker_file_t	linker_kernel_file;
 
 /*
  * Obtain a reference to a module, loading it if required.
@@ -118,29 +111,19 @@
 			    linker_file_t* _result);
 
 /*
- * Find a currently loaded file given its filename.
- */
-linker_file_t linker_find_file_by_name(const char* _filename);
-
-/*
- * Find a currently loaded file given its file id.
+ * Release a reference to a module, unloading it if there are no more
+ * references.  Note that one should either provide a module name and
+ * optional version info or a linker file, but not both.
  */
-linker_file_t linker_find_file_by_id(int _fileid);
+int linker_release_module(const char *_modname, struct mod_depend *_verinfo,
+			  linker_file_t _file);
 
 /*
- * Called from a class handler when a file is laoded.
+ * Iterate over all of the currently loaded linker files calling the
+ * predicate function while the function returns 0.  Returns the value
+ * returned by the last predicate function.
  */
-linker_file_t linker_make_file(const char* _filename, linker_class_t _cls);
-
-/*
- * Unload a file, freeing up memory.
- */
-int linker_file_unload(linker_file_t _file, int flags);
-
-/*
- * Add a dependency to a file.
- */
-int linker_file_add_dependency(linker_file_t _file, linker_file_t _dep);
+int linker_file_foreach(linker_predicate_t *_predicate, void *_context);
 
 /*
  * Lookup a symbol in a file.  If deps is TRUE, look in dependencies
@@ -158,10 +141,12 @@
 			   void *_start, void *_stop, int *_count);
 
 /*
- * This routine is responsible for finding dependencies of userland
- * initiated kldload(2)'s of files.
+ * Functions soley for use by the linker class handlers.
  */
+int linker_add_class(linker_class_t _cls);
+int linker_file_unload(linker_file_t _file, int flags);
 int linker_load_dependencies(linker_file_t _lf);
+linker_file_t linker_make_file(const char* _filename, linker_class_t _cls);
 
 /*
  * DDB Helpers, tuned specifically for ddb/db_kld.c
@@ -172,6 +157,9 @@
 int linker_ddb_symbol_values(c_linker_sym_t _sym, linker_symval_t *_symval);
 
 
+/* HWPMC helper */
+void *linker_hwpmc_list_objects(void);
+
 #endif	/* _KERNEL */
 
 /*
Index: mdioctl.h
===================================================================
RCS file: /home/cvs/src/sys/sys/mdioctl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/mdioctl.h -L sys/sys/mdioctl.h -u -r1.1.1.1 -r1.2
--- sys/sys/mdioctl.h
+++ sys/sys/mdioctl.h
@@ -37,7 +37,7 @@
  *
  * From: src/sys/sys/vnioctl.h,v 1.4
  *
- * $FreeBSD: src/sys/sys/mdioctl.h,v 1.20 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/mdioctl.h,v 1.21 2005/11/11 11:31:22 pjd Exp $
  */
 
 #ifndef _SYS_MDIOCTL_H_
@@ -65,7 +65,6 @@
 };
 
 #define MD_NAME		"md"
-#define MD_MODNAME	"g_md"
 #define MDCTL_NAME	"mdctl"
 #define MDIOVERSION	0
 
Index: md5.h
===================================================================
RCS file: /home/cvs/src/sys/sys/md5.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/md5.h -L sys/sys/md5.h -u -r1.2 -r1.3
--- sys/sys/md5.h
+++ sys/sys/md5.h
@@ -1,5 +1,5 @@
 /* MD5.H - header file for MD5C.C
- * $FreeBSD: src/sys/sys/md5.h,v 1.18.2.1 2006/04/04 19:59:52 andre Exp $
+ * $FreeBSD: src/sys/sys/md5.h,v 1.20 2006/03/15 19:47:12 andre Exp $
  */
 
 /*-
@@ -43,11 +43,11 @@
 
 __BEGIN_DECLS
 void   MD5Init (MD5_CTX *);
-void   MD5Update (MD5_CTX *, const unsigned char *, unsigned int);
+void   MD5Update (MD5_CTX *, const void *, unsigned int);
 void   MD5Final (unsigned char [16], MD5_CTX *);
 char * MD5End(MD5_CTX *, char *);
 char * MD5File(const char *, char *);
 char * MD5FileChunk(const char *, char *, off_t, off_t);
-char * MD5Data(const unsigned char *, unsigned int, char *);
+char * MD5Data(const void *, unsigned int, char *);
 __END_DECLS
 #endif /* _SYS_MD5_H_ */
Index: watchdog.h
===================================================================
RCS file: /home/cvs/src/sys/sys/watchdog.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/watchdog.h -L sys/sys/watchdog.h -u -r1.1.1.1 -r1.2
--- sys/sys/watchdog.h
+++ sys/sys/watchdog.h
@@ -23,18 +23,14 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/watchdog.h,v 1.3 2004/02/28 20:06:58 phk Exp $
+ * $FreeBSD: src/sys/sys/watchdog.h,v 1.4 2006/12/15 21:44:49 n_hibma Exp $
  */
 #ifndef _SYS_WATCHDOG_H
 #define	_SYS_WATCHDOG_H
 
 #include <sys/ioccom.h>
 
-#ifdef I_HAVE_TOTALLY_LOST_MY_SENSE_OF_HUMOUR
-#define	_PATH_WATCHDOG	"watchdog"
-#else
 #define	_PATH_WATCHDOG	"fido"
-#endif
 
 #define WDIOCPATPAT	_IOW('W', 42, u_int)
 
Index: elf_generic.h
===================================================================
RCS file: /home/cvs/src/sys/sys/elf_generic.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/elf_generic.h -L sys/sys/elf_generic.h -u -r1.1.1.2 -r1.2
--- sys/sys/elf_generic.h
+++ sys/sys/elf_generic.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/elf_generic.h,v 1.6.14.1 2005/12/30 22:13:58 marcel Exp $
+ * $FreeBSD: src/sys/sys/elf_generic.h,v 1.8 2005/12/18 19:43:33 kan Exp $
  */
 
 #ifndef _SYS_ELF_GENERIC_H_
@@ -67,6 +67,11 @@
 __ElfType(Rel);
 __ElfType(Rela);
 __ElfType(Sym);
+__ElfType(Verdef);
+__ElfType(Verdaux);
+__ElfType(Verneed);
+__ElfType(Vernaux);
+__ElfType(Versym);
 
 /* Non-standard ELF types. */
 __ElfType(Hashelt);
Index: limits.h
===================================================================
RCS file: /home/cvs/src/sys/sys/limits.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/limits.h -L sys/sys/limits.h -u -r1.1.1.1 -r1.2
--- sys/sys/limits.h
+++ sys/sys/limits.h
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/limits.h,v 1.9 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/limits.h,v 1.10 2005/12/02 07:45:28 davidxu Exp $
  */
 
 #ifndef _SYS_LIMITS_H_
@@ -93,4 +93,8 @@
 #define	WORD_BIT	__WORD_BIT
 #endif
 
+#if __POSIX_VISIBLE
+#define	MQ_PRIO_MAX	64
+#endif
+
 #endif /* !_SYS_LIMITS_H_ */
Index: ioccom.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ioccom.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ioccom.h -L sys/sys/ioccom.h -u -r1.1.1.1 -r1.2
--- sys/sys/ioccom.h
+++ sys/sys/ioccom.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ioccom.h	8.2 (Berkeley) 3/28/94
- * $FreeBSD: src/sys/sys/ioccom.h,v 1.15 2004/04/07 04:19:49 imp Exp $
+ * $FreeBSD: src/sys/sys/ioccom.h,v 1.16 2006/09/27 19:57:02 ru Exp $
  */
 
 #ifndef	_SYS_IOCCOM_H_
@@ -48,17 +48,25 @@
 #define	IOC_OUT		0x40000000	/* copy out parameters */
 #define	IOC_IN		0x80000000	/* copy in parameters */
 #define	IOC_INOUT	(IOC_IN|IOC_OUT)
-#define	IOC_DIRMASK	0xe0000000	/* mask for IN/OUT/VOID */
+#define	IOC_DIRMASK	(IOC_VOID|IOC_OUT|IOC_IN)
 
 #define	_IOC(inout,group,num,len) \
 	((unsigned long)(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
 #define	_IO(g,n)	_IOC(IOC_VOID,	(g), (n), 0)
+#define	_IOWINT(g,n)	_IOC(IOC_VOID,	(g), (n), sizeof(int))
 #define	_IOR(g,n,t)	_IOC(IOC_OUT,	(g), (n), sizeof(t))
 #define	_IOW(g,n,t)	_IOC(IOC_IN,	(g), (n), sizeof(t))
 /* this should be _IORW, but stdio got there first */
 #define	_IOWR(g,n,t)	_IOC(IOC_INOUT,	(g), (n), sizeof(t))
 
-#ifndef _KERNEL
+#ifdef _KERNEL
+
+#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \
+    defined(COMPAT_FREEBSD4) || defined(COMPAT_43)
+#define	IOCPARM_IVAL(x)	((int)(intptr_t)(void *)*(caddr_t *)(void *)(x))
+#endif
+
+#else
 
 #include <sys/cdefs.h>
 
Index: ucontext.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ucontext.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ucontext.h -L sys/sys/ucontext.h -u -r1.1.1.1 -r1.2
--- sys/sys/ucontext.h
+++ sys/sys/ucontext.h
@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/ucontext.h,v 1.11 2003/11/09 20:31:04 marcel Exp $
+ * $FreeBSD: src/sys/sys/ucontext.h,v 1.12 2006/05/12 05:04:46 jhb Exp $
  */
 
 #ifndef _SYS_UCONTEXT_H_
@@ -54,7 +54,7 @@
 } ucontext_t;
 
 #if defined(_KERNEL) && defined(COMPAT_FREEBSD4)
-#if defined(__i386__) || defined(__alpha__)
+#if defined(__i386__)
 struct ucontext4 {
 	sigset_t	uc_sigmask;
 	struct mcontext4 uc_mcontext;
@@ -62,9 +62,9 @@
 	stack_t		uc_stack;
 	int		__spare__[8];
 };
-#else	/* __i386__ || __alpha__ */
+#else	/* __i386__ */
 #define ucontext4 ucontext
-#endif	/* __i386__ || __alpha__ */
+#endif	/* __i386__ */
 #endif	/* _KERNEL */
 
 #ifndef _KERNEL
Index: ktrace.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ktrace.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/ktrace.h -L sys/sys/ktrace.h -u -r1.1.1.2 -r1.2
--- sys/sys/ktrace.h
+++ sys/sys/ktrace.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ktrace.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/ktrace.h,v 1.29.2.2 2006/02/14 00:02:01 rwatson Exp $
+ * $FreeBSD: src/sys/sys/ktrace.h,v 1.33 2005/12/26 22:09:09 cognet Exp $
  */
 
 #ifndef _SYS_KTRACE_H_
@@ -68,6 +68,15 @@
 #define	KTRCHECK(td, type)	((td)->td_proc->p_traceflag & (1 << type))
 #define KTRPOINT(td, type)						\
 	(KTRCHECK((td), (type)) && !((td)->td_pflags & TDP_INKTRACE))
+#define	KTRCHECKDRAIN(td)	(!(STAILQ_EMPTY(&(td)->td_proc->p_ktr)))
+#define	KTRUSERRET(td) do {						\
+	if (KTRCHECKDRAIN(td))						\
+		ktruserret(td);						\
+} while (0)
+#define	KTRPROCEXIT(td) do {						\
+	if (KTRCHECKDRAIN(td))						\
+		ktrprocexit(td);					\
+} while (0)
 
 /*
  * ktrace record types
@@ -136,7 +145,7 @@
 };
 
 /*
- * KTR_USER - data comming from userland
+ * KTR_USER - data coming from userland
  */
 #define KTR_USER_MAXLEN	2048	/* maximum length of passed data */
 #define KTR_USER	7
@@ -174,6 +183,8 @@
 void	ktrgenio(int, enum uio_rw, struct uio *, int);
 void	ktrsyscall(int, int narg, register_t args[]);
 void	ktrsysret(int, int, register_t);
+void	ktrprocexit(struct thread *);
+void	ktruserret(struct thread *);
 
 #else
 
Index: firmware.h
===================================================================
RCS file: /home/cvs/src/sys/sys/firmware.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/firmware.h -L sys/sys/firmware.h -u -r1.1.1.1 -r1.2
--- sys/sys/firmware.h
+++ sys/sys/firmware.h
@@ -23,39 +23,42 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/firmware.h,v 1.1.2.1 2006/02/23 02:13:31 mlaier Exp $
+ * $FreeBSD: src/sys/sys/firmware.h,v 1.4 2007/02/15 17:21:31 luigi Exp $
  */
 #ifndef _SYS_FIRMWARE_H_
 #define _SYS_FIRMWARE_H_
 /*
  * Loadable firmware support.
  *
- * Firmware images are embedded in kernel loadable modules that can
+ * The firmware abstraction provides an interface for loading firmware
+ * images into the kernel and making them available to clients.
+ *
+ * Firmware images are usually embedded in kernel loadable modules that can
  * be loaded on-demand or pre-loaded as desired.  Modules may contain
  * one or more firmware images that are stored as opaque data arrays
- * and registered with a unique string name.  Consumers request
- * firmware by name with held references counted to use in disallowing
+ * and registered with a unique string name. Clients request
+ * firmware by name, and are returned a struct firmware * below on success.
+ * The kernel keeps track of references to firmware images to allow/prevent
  * module/data unload.
  *
- * When multiple images are stored in one module the one image is
+ * When multiple images are stored in one module, the first image is
  * treated as the master with the other images holding references
  * to it.  This means that to unload the module each dependent/subimage
  * must first have its references removed.
+ * In order for automatic loading to work, the master image must have
+ * the same name as the module it is embedded into.
  */
 struct firmware {
 	const char	*name;		/* system-wide name */
 	const void	*data;		/* location of image */
 	size_t		 datasize;	/* size of image in bytes */
 	unsigned int	 version;	/* version of the image */
-	int		 refcnt;	/* held references */
-	struct firmware *parent;	/* not null if a subimage */
-	linker_file_t	 file;		/* loadable module */
 };
 
-struct firmware	*firmware_register(const char *, const void *, size_t,
-    unsigned int, struct firmware *);
-int		 firmware_unregister(const char *);
-struct firmware *firmware_get(const char *);
+const struct firmware	*firmware_register(const char *,
+	const void *, size_t, unsigned int, const struct firmware *);
+int	 firmware_unregister(const char *);
+const struct firmware *firmware_get(const char *);
 #define	FIRMWARE_UNLOAD		0x0001	/* unload if unreferenced */
-void		 firmware_put(struct firmware *, int);
+void		 firmware_put(const struct firmware *, int);
 #endif /* _SYS_FIRMWARE_H_ */
Index: elf64.h
===================================================================
RCS file: /home/cvs/src/sys/sys/elf64.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/elf64.h -L sys/sys/elf64.h -u -r1.1.1.2 -r1.2
--- sys/sys/elf64.h
+++ sys/sys/elf64.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.1 2005/12/30 22:13:58 marcel Exp $
+ * $FreeBSD: src/sys/sys/elf64.h,v 1.17 2006/10/17 05:43:30 jkoshy Exp $
  */
 
 #ifndef _SYS_ELF64_H_
@@ -41,6 +41,7 @@
 typedef int32_t		Elf64_Sword;
 typedef int64_t		Elf64_Sxword;
 typedef uint32_t	Elf64_Word;
+typedef uint64_t	Elf64_Lword;
 typedef uint64_t	Elf64_Xword;
 
 /*
@@ -50,11 +51,7 @@
  * typedef is required.
  */
 
-#ifdef __alpha__
-typedef Elf64_Off	Elf64_Hashelt;
-#else
 typedef Elf64_Word	Elf64_Hashelt;
-#endif
 
 /* Non-standard class-dependent datatype used for abstraction. */
 typedef Elf64_Xword	Elf64_Size;
@@ -150,6 +147,42 @@
 /* Macro for constructing r_info from field values. */
 #define ELF64_R_INFO(sym, type)	(((sym) << 32) + ((type) & 0xffffffffL))
 
+#define	ELF64_R_TYPE_DATA(info)	(((Elf64_Xword)(info)<<32)>>40)
+#define	ELF64_R_TYPE_ID(info)	(((Elf64_Xword)(info)<<56)>>56)
+#define	ELF64_R_TYPE_INFO(data, type)	\
+		(((Elf64_Xword)(data)<<8)+(Elf64_Xword)(type))
+
+/*
+ *	Note entry header
+ */
+typedef Elf_Note Elf64_Nhdr;
+
+/*
+ *	Move entry
+ */
+typedef struct {
+	Elf64_Lword	m_value;	/* symbol value */
+	Elf64_Xword 	m_info;		/* size + index */
+	Elf64_Xword	m_poffset;	/* symbol offset */
+	Elf64_Half	m_repeat;	/* repeat count */
+	Elf64_Half	m_stride;	/* stride info */
+} Elf64_Move;
+
+#define	ELF64_M_SYM(info)	((info)>>8)
+#define	ELF64_M_SIZE(info)	((unsigned char)(info))
+#define	ELF64_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
+
+/*
+ *	Hardware/Software capabilities entry
+ */
+typedef struct {
+	Elf64_Xword	c_tag;		/* how to interpret value */
+	union {
+		Elf64_Xword	c_val;
+		Elf64_Addr	c_ptr;
+	} c_un;
+} Elf64_Cap;
+
 /*
  * Symbol table entries.
  */
@@ -173,4 +206,43 @@
 /* Macro for accessing the fields of st_other. */
 #define ELF64_ST_VISIBILITY(oth)	((oth) & 0x3)
 
+/* Structures used by Sun & GNU-style symbol versioning. */
+typedef struct {
+	Elf64_Half	vd_version;
+	Elf64_Half	vd_flags;
+	Elf64_Half	vd_ndx;
+	Elf64_Half	vd_cnt;
+	Elf64_Word	vd_hash;
+	Elf64_Word	vd_aux;
+	Elf64_Word	vd_next;
+} Elf64_Verdef;
+
+typedef struct {
+	Elf64_Word	vda_name;
+	Elf64_Word	vda_next;
+} Elf64_Verdaux;
+
+typedef struct {
+	Elf64_Half	vn_version;
+	Elf64_Half	vn_cnt;
+	Elf64_Word	vn_file;
+	Elf64_Word	vn_aux;
+	Elf64_Word	vn_next;
+} Elf64_Verneed;
+
+typedef struct {
+	Elf64_Word	vna_hash;
+	Elf64_Half	vna_flags;
+	Elf64_Half	vna_other;
+	Elf64_Word	vna_name;
+	Elf64_Word	vna_next;
+} Elf64_Vernaux;
+
+typedef Elf64_Half Elf64_Versym;
+
+typedef struct {
+	Elf64_Half	si_boundto;	/* direct bindings - symbol bound to */
+	Elf64_Half	si_flags;	/* per symbol flags */
+} Elf64_Syminfo;
+
 #endif /* !_SYS_ELF64_H_ */
Index: sleepqueue.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sleepqueue.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/sleepqueue.h -L sys/sys/sleepqueue.h -u -r1.2 -r1.3
--- sys/sys/sleepqueue.h
+++ sys/sys/sleepqueue.h
@@ -26,15 +26,16 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/sleepqueue.h,v 1.6 2005/01/07 02:29:24 imp Exp $
+ * $FreeBSD: src/sys/sys/sleepqueue.h,v 1.12 2007/03/31 23:23:42 jhb Exp $
  */
 
 #ifndef _SYS_SLEEPQUEUE_H_
 #define _SYS_SLEEPQUEUE_H_
 
 /*
- * Sleep queue interface.  Sleep/wakeup and condition variables use a sleep
- * queue for the queue of threads blocked on a sleep channel.
+ * Sleep queue interface.  Sleep/wakeup, condition variables, and sx
+ * locks use a sleep queue for the queue of threads blocked on a sleep
+ * channel.
  *
  * A thread calls sleepq_lock() to lock the sleep queue chain associated
  * with a given wait channel.  A thread can then call call sleepq_add() to
@@ -75,32 +76,35 @@
  * using this interface as well (death to TDI_IWAIT!)
  */
 
-struct mtx;
+struct lock_object;
 struct sleepqueue;
 struct thread;
 
 #ifdef _KERNEL
 
 #define	SLEEPQ_TYPE		0x0ff		/* Mask of sleep queue types. */
-#define	SLEEPQ_MSLEEP		0x00		/* Used by msleep/wakeup. */
+#define	SLEEPQ_SLEEP		0x00		/* Used by sleep/wakeup. */
 #define	SLEEPQ_CONDVAR		0x01		/* Used for a cv. */
+#define	SLEEPQ_PAUSE		0x02		/* Used by pause. */
+#define	SLEEPQ_SX		0x03		/* Used by an sx lock. */
 #define	SLEEPQ_INTERRUPTIBLE	0x100		/* Sleep is interruptible. */
 
 void	init_sleepqueues(void);
-void	sleepq_abort(struct thread *td, int intval);
-void	sleepq_add(void *, struct mtx *, const char *, int);
+void	sleepq_abort(struct thread *td, int intrval);
+void	sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg,
+	    int flags, int queue);
 struct sleepqueue *sleepq_alloc(void);
-void	sleepq_broadcast(void *, int, int);
-void	sleepq_free(struct sleepqueue *);
-void	sleepq_lock(void *);
-struct sleepqueue *sleepq_lookup(void *);
-void	sleepq_release(void *);
-void	sleepq_remove(struct thread *, void *);
-void	sleepq_signal(void *, int, int);
+void	sleepq_broadcast(void *wchan, int flags, int pri, int queue);
+void	sleepq_free(struct sleepqueue *sq);
+void	sleepq_lock(void *wchan);
+struct sleepqueue *sleepq_lookup(void *wchan);
+void	sleepq_release(void *wchan);
+void	sleepq_remove(struct thread *td, void *wchan);
+void	sleepq_signal(void *wchan, int flags, int pri, int queue);
 void	sleepq_set_timeout(void *wchan, int timo);
 int	sleepq_timedwait(void *wchan);
 int	sleepq_timedwait_sig(void *wchan);
-void	sleepq_wait(void *);
+void	sleepq_wait(void *wchan);
 int	sleepq_wait_sig(void *wchan);
 
 #endif	/* _KERNEL */
Index: ptrace.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ptrace.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ptrace.h -L sys/sys/ptrace.h -u -r1.1.1.1 -r1.2
--- sys/sys/ptrace.h
+++ sys/sys/ptrace.h
@@ -27,12 +27,14 @@
  * SUCH DAMAGE.
  *
  *	@(#)ptrace.h	8.2 (Berkeley) 1/4/94
- * $FreeBSD: src/sys/sys/ptrace.h,v 1.27 2005/06/30 07:49:22 peter Exp $
+ * $FreeBSD: src/sys/sys/ptrace.h,v 1.28 2006/02/06 09:41:56 davidxu Exp $
  */
 
 #ifndef	_SYS_PTRACE_H_
 #define	_SYS_PTRACE_H_
 
+#include <sys/_sigset.h>
+
 #define	PT_TRACE_ME	0	/* child declares it's being traced */
 #define	PT_READ_I	1	/* read word in child's I space */
 #define	PT_READ_D	2	/* read word in child's D space */
@@ -92,6 +94,8 @@
 	int	pl_flags;	/* LWP flags. */
 #define	PL_FLAG_SA	0x01	/* M:N thread */
 #define	PL_FLAG_BOUND	0x02	/* M:N bound thread */
+	sigset_t	pl_sigmask;	/* LWP signal mask */
+	sigset_t	pl_siglist;	/* LWP pending signal */
 };
 
 #ifdef _KERNEL
Index: signal.h
===================================================================
RCS file: /home/cvs/src/sys/sys/signal.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/signal.h -L sys/sys/signal.h -u -r1.1.1.1 -r1.2
--- sys/sys/signal.h
+++ sys/sys/signal.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)signal.h	8.4 (Berkeley) 5/4/95
- * $FreeBSD: src/sys/sys/signal.h,v 1.45.8.1 2005/11/16 12:44:10 davidxu Exp $
+ * $FreeBSD: src/sys/sys/signal.h,v 1.56.2.1 2007/12/17 03:05:56 davidxu Exp $
  */
 
 #ifndef _SYS_SIGNAL_H_
@@ -42,6 +42,7 @@
 #include <sys/_types.h>
 #include <sys/_sigset.h>
 
+#include <machine/_limits.h>	/* __MINSIGSTKSZ */
 #include <machine/signal.h>	/* sig_atomic_t; trap codes; sigcontext */
 
 /*
@@ -111,9 +112,9 @@
 #define	SIGTHR		32	/* reserved by thread library. */
 #define	SIGLWP		SIGTHR
 #endif
-/*
- * XXX missing SIGRTMIN, SIGRTMAX.
- */
+
+#define	SIGRTMIN	65
+#define	SIGRTMAX	126
 
 #define	SIG_DFL		((__sighandler_t *)0)
 #define	SIG_IGN		((__sighandler_t *)1)
@@ -150,36 +151,43 @@
 #if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE >= 500
 union sigval {
 	/* Members as suggested by Annex C of POSIX 1003.1b. */
-	int	sigval_int;
-	void	*sigval_ptr;
+	int	sival_int;
+	void	*sival_ptr;
+	/* 6.0 compatibility */
+	int     sigval_int;
+	void    *sigval_ptr;
 };
 #endif
 
 #if __POSIX_VISIBLE >= 199309
 struct sigevent {
 	int	sigev_notify;		/* Notification type */
-	union {
-		int	__sigev_signo;	/* Signal number */
-		int	__sigev_notify_kqueue;
-	} __sigev_u;
+	int	sigev_signo;		/* Signal number */
 	union sigval sigev_value;	/* Signal value */
-/*
- * XXX missing sigev_notify_function, sigev_notify_attributes.
- */
+	union {
+		__lwpid_t	_threadid;
+		struct {
+			void (*_function)(union sigval);
+			void *_attribute; /* pthread_attr_t * */
+		} _sigev_thread;
+		long __spare__[8];
+	} _sigev_un;
 };
-#define	sigev_signo		__sigev_u.__sigev_signo
+
 #if __BSD_VISIBLE
-#define	sigev_notify_kqueue	__sigev_u.__sigev_notify_kqueue
+#define	sigev_notify_kqueue		sigev_signo
+#define	sigev_notify_thread_id		_sigev_un._threadid
 #endif
+#define	sigev_notify_function		_sigev_un._sigev_thread._function
+#define	sigev_notify_attributes		_sigev_un._sigev_thread._attribute
 
-#define	SIGEV_NONE	0		/* No async notification */
-#define	SIGEV_SIGNAL	1		/* Generate a queued signal */
+#define	SIGEV_NONE	0		/* No async notification. */
+#define	SIGEV_SIGNAL	1		/* Generate a queued signal. */
+#define	SIGEV_THREAD	2		/* Call back from another pthread. */
 #if __BSD_VISIBLE
-#define	SIGEV_KEVENT	3		/* Generate a kevent */
+#define	SIGEV_KEVENT	3		/* Generate a kevent. */
+#define	SIGEV_THREAD_ID	4		/* Send signal to a kernel thread. */
 #endif
-/*
- * XXX missing SIGEV_THREAD.
- */
 #endif /* __POSIX_VISIBLE >= 199309 */
 
 #if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE
@@ -198,9 +206,86 @@
 	int	si_status;		/* exit value */
 	void	*si_addr;		/* faulting instruction */
 	union sigval si_value;		/* signal value */
-	long	si_band;		/* band event for SIGPOLL */
-	int	__spare__[7];		/* gimme some slack */
+	union	{
+		struct {
+			int	_trapno;/* machine specific trap code */
+		} _fault;
+		struct {
+			int	_timerid;
+			int	_overrun;
+		} _timer;
+		struct {
+			int	_mqd;
+		} _mesgq;
+		struct {
+			long	_band;		/* band event for SIGPOLL */
+		} _poll;			/* was this ever used ? */
+		struct {
+			long	__spare1__;
+			int	__spare2__[7];
+		} __spare__;
+	} _reason;
 } siginfo_t;
+
+#define si_trapno	_reason._fault._trapno
+#define si_timerid	_reason._timer._timerid
+#define si_overrun	_reason._timer._overrun
+#define si_mqd		_reason._mesgq._mqd
+#define si_band		_reason._poll._band
+
+/** si_code **/
+/* codes for SIGILL */
+#define ILL_ILLOPC 	1	/* Illegal opcode.			*/
+#define ILL_ILLOPN 	2	/* Illegal operand.			*/
+#define ILL_ILLADR 	3	/* Illegal addressing mode.		*/
+#define ILL_ILLTRP 	4	/* Illegal trap.			*/
+#define ILL_PRVOPC 	5	/* Privileged opcode.			*/
+#define ILL_PRVREG 	6	/* Privileged register.			*/
+#define ILL_COPROC 	7	/* Coprocessor error.			*/
+#define ILL_BADSTK 	8	/* Internal stack error.		*/
+
+/* codes for SIGBUS */
+#define BUS_ADRALN	1	/* Invalid address alignment.		*/
+#define BUS_ADRERR	2	/* Nonexistent physical address.	*/
+#define BUS_OBJERR	3	/* Object-specific hardware error.	*/
+
+/* codes for SIGSEGV */
+#define SEGV_MAPERR	1	/* Address not mapped to object.	*/
+#define SEGV_ACCERR	2	/* Invalid permissions for mapped	*/
+				/* object.				*/
+
+/* codes for SIGFPE */
+#define FPE_INTOVF	1	/* Integer overflow.			*/
+#define FPE_INTDIV	2	/* Integer divide by zero.		*/
+#define FPE_FLTDIV	3	/* Floating point divide by zero.	*/
+#define FPE_FLTOVF	4	/* Floating point overflow.		*/
+#define FPE_FLTUND	5	/* Floating point underflow.		*/
+#define FPE_FLTRES	6	/* Floating point inexact result.	*/
+#define FPE_FLTINV	7	/* Invalid floating point operation.	*/
+#define FPE_FLTSUB	8	/* Subscript out of range.		*/
+
+/* codes for SIGTRAP */
+#define TRAP_BRKPT	1	/* Process breakpoint.			*/
+#define TRAP_TRACE	2	/* Process trace trap.			*/
+
+/* codes for SIGCHLD */
+#define CLD_EXITED	1	/* Child has exited			*/
+#define CLD_KILLED	2	/* Child has terminated abnormally but	*/
+				/* did not create a core file		*/
+#define CLD_DUMPED	3	/* Child has terminated abnormally and	*/
+				/* created a core file			*/
+#define CLD_TRAPPED	4	/* Traced child has trapped		*/
+#define CLD_STOPPED	5	/* Child has stopped			*/
+#define CLD_CONTINUED	6	/* Stopped child has continued		*/
+
+/* codes for SIGPOLL */
+#define POLL_IN		1	/* Data input available			*/
+#define POLL_OUT	2	/* Output buffers available		*/
+#define POLL_MSG	3	/* Input message available		*/
+#define POLL_ERR	4	/* I/O Error				*/
+#define POLL_PRI	5	/* High priority input available	*/
+#define POLL_HUP	4	/* Device disconnected			*/
+
 #endif
 
 #if __POSIX_VISIBLE || __XSI_VISIBLE
@@ -244,11 +329,15 @@
 #endif
 
 #if __POSIX_VISIBLE || __XSI_VISIBLE
-#define	SI_USER		0x10001
-#define	SI_QUEUE	0x10002
-#define	SI_TIMER	0x10003
-#define	SI_ASYNCIO	0x10004
-#define	SI_MESGQ	0x10005
+#define	SI_NOINFO	0		/* No signal info besides si_signo. */
+#define	SI_USER		0x10001		/* Signal sent by kill(). */
+#define	SI_QUEUE	0x10002		/* Signal sent by the sigqueue(). */
+#define	SI_TIMER	0x10003		/* Signal generated by expiration of */
+					/* a timer set by timer_settime(). */
+#define	SI_ASYNCIO	0x10004		/* Signal generated by completion of */
+					/* an asynchronous I/O request.*/
+#define	SI_MESGQ	0x10005		/* Signal generated by arrival of a */
+					/* message on an empty message queue. */
 #endif
 #if __BSD_VISIBLE
 #define	SI_UNDEFINED	0
@@ -275,6 +364,7 @@
 
 #define	SS_ONSTACK	0x0001	/* take signal on alternate stack */
 #define	SS_DISABLE	0x0004	/* disable taking signals on alternate stack */
+#define	MINSIGSTKSZ	__MINSIGSTKSZ		/* minimum stack size */
 #define	SIGSTKSZ	(MINSIGSTKSZ + 32768)	/* recommended stack size */
 #endif
 
@@ -300,7 +390,7 @@
 
 /* Keep this in one place only */
 #if defined(_KERNEL) && defined(COMPAT_43) && \
-    !defined(__i386__) && !defined(__alpha__)
+    !defined(__i386__)
 struct osigcontext {
 	int _not_used;
 };
Index: sched.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sched.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/sched.h -L sys/sys/sched.h -u -r1.1.1.1 -r1.2
--- sys/sys/sched.h
+++ sys/sys/sched.h
@@ -1,4 +1,37 @@
 /*-
+ * Copyright (c) 1996, 1997
+ *      HD Associates, Inc.  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 HD Associates, Inc
+ *      and Jukka Antero Ukkonen.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES 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 HD ASSOCIATES 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.
+ */
+
+/*-
  * Copyright (c) 2002, Jeffrey Roberson <jeff at freebsd.org>
  * All rights reserved.
  *
@@ -23,12 +56,13 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/sched.h,v 1.24 2005/04/19 04:01:25 jkoshy Exp $
+ * $FreeBSD: src/sys/sys/sched.h,v 1.33 2007/06/12 19:49:39 jeff Exp $
  */
 
-#ifndef _SYS_SCHED_H_
-#define	_SYS_SCHED_H_
+#ifndef _SCHED_H_
+#define	_SCHED_H_
 
+#ifdef _KERNEL
 /*
  * General scheduling info.
  *
@@ -47,28 +81,31 @@
  */
 void	sched_exit(struct proc *p, struct thread *childtd);
 void	sched_fork(struct thread *td, struct thread *childtd);
+void	sched_fork_exit(struct thread *td);
 
 /*
  * KSE Groups contain scheduling priority information.  They record the
  * behavior of groups of KSEs and threads.
  */
-void	sched_class(struct ksegrp *kg, int class);
-void	sched_exit_ksegrp(struct ksegrp *kg, struct thread *childtd);
-void	sched_fork_ksegrp(struct thread *td, struct ksegrp *child);
+void	sched_class(struct thread *td, int class);
 void	sched_nice(struct proc *p, int nice);
 
 /*
  * Threads are switched in and out, block on resources, have temporary
- * priorities inherited from their ksegs, and use up cpu time.
+ * priorities inherited from their procs, and use up cpu time.
  */
 void	sched_exit_thread(struct thread *td, struct thread *child);
 void	sched_fork_thread(struct thread *td, struct thread *child);
+void	sched_lend_prio(struct thread *td, u_char prio);
+void	sched_lend_user_prio(struct thread *td, u_char pri);
 fixpt_t	sched_pctcpu(struct thread *td);
 void	sched_prio(struct thread *td, u_char prio);
-void	sched_lend_prio(struct thread *td, u_char prio);
 void	sched_sleep(struct thread *td);
 void	sched_switch(struct thread *td, struct thread *newtd, int flags);
+void	sched_throw(struct thread *td);
 void	sched_unlend_prio(struct thread *td, u_char prio);
+void	sched_unlend_user_prio(struct thread *td, u_char pri);
+void	sched_user_prio(struct thread *td, u_char prio);
 void	sched_userret(struct thread *td);
 void	sched_wakeup(struct thread *td);
 
@@ -78,6 +115,10 @@
 void	sched_add(struct thread *td, int flags);
 void	sched_clock(struct thread *td);
 void	sched_rem(struct thread *td);
+void	sched_tick(void);
+void	sched_relinquish(struct thread *td);
+struct thread *sched_choose(void);
+void	sched_idletd(void *);
 
 /*
  * Binding makes cpu affinity permanent while pinning is used to temporarily
@@ -93,7 +134,6 @@
  * These procedures tell the process data structure allocation code how
  * many bytes to actually allocate.
  */
-int	sched_sizeof_ksegrp(void);
 int	sched_sizeof_proc(void);
 int	sched_sizeof_thread(void);
 
@@ -109,13 +149,71 @@
 	curthread->td_pinned--;
 }
 
+/* sched_add arguments (formerly setrunqueue) */
+#define	SRQ_BORING	0x0000		/* No special circumstances. */
+#define	SRQ_YIELDING	0x0001		/* We are yielding (from mi_switch). */
+#define	SRQ_OURSELF	0x0002		/* It is ourself (from mi_switch). */
+#define	SRQ_INTR	0x0004		/* It is probably urgent. */
+#define	SRQ_PREEMPTED	0x0008		/* has been preempted.. be kind */
+#define	SRQ_BORROWING	0x0010		/* Priority updated due to prio_lend */
+
+/* Switch stats. */
+#ifdef SCHED_STATS
+extern long switch_preempt;
+extern long switch_owepreempt;
+extern long switch_turnstile;
+extern long switch_sleepq;
+extern long switch_sleepqtimo;
+extern long switch_relinquish;
+extern long switch_needresched;
+#define SCHED_STAT_INC(var)     atomic_add_long(&(var), 1)
+#else
+#define SCHED_STAT_INC(var)
+#endif
+
 /* temporarily here */
 void schedinit(void);
-void sched_init_concurrency(struct ksegrp *kg);
-void sched_set_concurrency(struct ksegrp *kg, int cuncurrency);
-void sched_schedinit(void);
-void sched_newproc(struct proc *p, struct ksegrp *kg, struct thread *td);
-void sched_thread_exit(struct thread *td);
+void sched_newproc(struct proc *p, struct thread *td);
 void sched_newthread(struct thread *td);
+#endif /* _KERNEL */
+
+/* POSIX 1003.1b Process Scheduling */
+
+/*
+ * POSIX scheduling policies
+ */
+#define SCHED_FIFO      1
+#define SCHED_OTHER     2
+#define SCHED_RR        3
+
+struct sched_param {
+        int     sched_priority;
+};
+
+/*
+ * POSIX scheduling declarations for userland.
+ */
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+#include <sys/_types.h>
+
+#ifndef _PID_T_DECLARED
+typedef __pid_t         pid_t;
+#define _PID_T_DECLARED
+#endif
+
+struct timespec;
+
+__BEGIN_DECLS
+int     sched_get_priority_max(int);
+int     sched_get_priority_min(int);
+int     sched_getparam(pid_t, struct sched_param *);
+int     sched_getscheduler(pid_t);
+int     sched_rr_get_interval(pid_t, struct timespec *);
+int     sched_setparam(pid_t, const struct sched_param *);
+int     sched_setscheduler(pid_t, int, const struct sched_param *);
+int     sched_yield(void);
+__END_DECLS
 
-#endif /* !_SYS_SCHED_H_ */
+#endif
+#endif /* !_SCHED_H_ */
Index: gpt.h
===================================================================
RCS file: /home/cvs/src/sys/sys/gpt.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/gpt.h -L sys/sys/gpt.h -u -r1.1.1.1 -r1.2
--- sys/sys/gpt.h
+++ sys/sys/gpt.h
@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/gpt.h,v 1.8 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/gpt.h,v 1.10.2.1 2007/10/29 00:11:40 marcel Exp $
  */
 
 #ifndef _SYS_GPT_H_
@@ -65,7 +65,7 @@
 	uint64_t	ent_lba_end;
 	uint64_t	ent_attr;
 #define	GPT_ENT_ATTR_PLATFORM		(1ULL << 0)
-	short		ent_name[36];		/* UNICODE-16. */
+	uint16_t	ent_name[36];		/* UTF-16. */
 };
 
 #define	GPT_ENT_TYPE_UNUSED		\
@@ -82,6 +82,8 @@
 	{0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
 #define	GPT_ENT_TYPE_FREEBSD_VINUM	\
 	{0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define	GPT_ENT_TYPE_FREEBSD_ZFS	\
+	{0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
 
 /*
  * The following are unused but documented here to avoid reuse.
@@ -113,4 +115,7 @@
 #define	GPT_ENT_TYPE_LINUX_LVM		\
 	{0xe6d6d379,0xf507,0x44c2,0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}}
 
+#define	GPT_ENT_TYPE_APPLE_HFS		\
+	{0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+
 #endif /* _SYS_GPT_H_ */
Index: pioctl.h
===================================================================
RCS file: /home/cvs/src/sys/sys/pioctl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/pioctl.h -L sys/sys/pioctl.h -u -r1.1.1.1 -r1.2
--- sys/sys/pioctl.h
+++ sys/sys/pioctl.h
@@ -33,7 +33,7 @@
 /*
  * procfs ioctl definitions.
  *
- * $FreeBSD: src/sys/sys/pioctl.h,v 1.14 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/pioctl.h,v 1.15 2006/09/27 19:57:02 ru Exp $
  */
 
 #ifndef _SYS_PIOCTL_H
@@ -49,12 +49,12 @@
 	unsigned long	val;	/* Any extra data */
 };
 
-# define	PIOCBIS	_IO('p', 1)	/* Set event flag */
-# define	PIOCBIC	_IO('p', 2)	/* Clear event flag */
-# define	PIOCSFL	_IO('p', 3)	/* Set flags */
+# define	PIOCBIS	_IOWINT('p', 1)	/* Set event flag */
+# define	PIOCBIC	_IOWINT('p', 2)	/* Clear event flag */
+# define	PIOCSFL	_IOWINT('p', 3)	/* Set flags */
 			/* wait for proc to stop */
 # define	PIOCWAIT	_IOR('p', 4, struct procfs_status)
-# define	PIOCCONT	_IO('p', 5)	/* Continue a process */
+# define	PIOCCONT	_IOWINT('p', 5)	/* Continue a process */
 			/* Get proc status */
 # define	PIOCSTATUS	_IOR('p', 6, struct procfs_status)
 # define	PIOCGFL	_IOR('p', 7, unsigned int)	/* Get flags */
Index: jail.h
===================================================================
RCS file: /home/cvs/src/sys/sys/jail.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/jail.h -L sys/sys/jail.h -u -r1.1.1.1 -r1.2
--- sys/sys/jail.h
+++ sys/sys/jail.h
@@ -6,7 +6,7 @@
  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
  * ----------------------------------------------------------------------------
  *
- * $FreeBSD: src/sys/sys/jail.h,v 1.26 2005/06/09 18:49:19 pjd Exp $
+ * $FreeBSD: src/sys/sys/jail.h,v 1.29 2007/04/05 23:19:13 pjd Exp $
  *
  */
 
@@ -54,7 +54,7 @@
  * delete the struture when the last inmate is dead.
  *
  * Lock key:
- *   (a) allprison_mtx
+ *   (a) allprison_lock
  *   (p) locked by pr_mtx
  *   (c) set only during creation before the structure is shared, no mutex
  *       required to read
@@ -73,6 +73,7 @@
 	int		 pr_securelevel;		/* (p) securelevel */
 	struct task	 pr_task;			/* (d) destroy task */
 	struct mtx	 pr_mtx;
+	void		**pr_slots;			/* (p) additional data */
 };
 #endif /* _KERNEL || _WANT_PRISON */
 
@@ -91,6 +92,7 @@
 
 LIST_HEAD(prisonlist, prison);
 extern struct	prisonlist allprison;
+extern struct	sx allprison_lock;
 
 /*
  * Kernel support functions for jail().
@@ -105,12 +107,30 @@
 int prison_canseemount(struct ucred *cred, struct mount *mp);
 void prison_enforce_statfs(struct ucred *cred, struct mount *mp,
     struct statfs *sp);
+struct prison *prison_find(int prid);
 void prison_free(struct prison *pr);
 u_int32_t prison_getip(struct ucred *cred);
 void prison_hold(struct prison *pr);
 int prison_if(struct ucred *cred, struct sockaddr *sa);
 int prison_ip(struct ucred *cred, int flag, u_int32_t *ip);
+int prison_priv_check(struct ucred *cred, int priv);
 void prison_remote_ip(struct ucred *cred, int flags, u_int32_t *ip);
 
+/*
+ * Kernel jail services.
+ */
+struct prison_service;
+typedef int (*prison_create_t)(struct prison_service *psrv, struct prison *pr);
+typedef int (*prison_destroy_t)(struct prison_service *psrv, struct prison *pr);
+
+struct prison_service *prison_service_register(const char *name,
+    prison_create_t create, prison_destroy_t destroy);
+void prison_service_deregister(struct prison_service *psrv);
+
+void prison_service_data_set(struct prison_service *psrv, struct prison *pr,
+    void *data);
+void *prison_service_data_get(struct prison_service *psrv, struct prison *pr);
+void *prison_service_data_del(struct prison_service *psrv, struct prison *pr);
+
 #endif /* _KERNEL */
 #endif /* !_SYS_JAIL_H_ */
Index: protosw.h
===================================================================
RCS file: /home/cvs/src/sys/sys/protosw.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/protosw.h -L sys/sys/protosw.h -u -r1.1.1.1 -r1.2
--- sys/sys/protosw.h
+++ sys/sys/protosw.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)protosw.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/protosw.h,v 1.45 2004/11/08 14:44:54 phk Exp $
+ * $FreeBSD: src/sys/sys/protosw.h,v 1.57 2006/07/24 15:20:08 rwatson Exp $
  */
 
 #ifndef _SYS_PROTOSW_H_
@@ -128,7 +128,13 @@
 #define	PR_LASTHDR	0x40		/* enforce ipsec policy; last header */
 
 /*
- * The arguments to usrreq are:
+ * In earlier BSD network stacks, a single pr_usrreq() function pointer was
+ * invoked with an operation number indicating what operation was desired.
+ * We now provide individual function pointers which protocols can implement,
+ * which offers a number of benefits (such as type checking for arguments).
+ * These older constants are still present in order to support TCP debugging.
+ *
+ * The arguments to usrreq were:
  *	(*protosw[].pr_usrreq)(up, req, m, nam, opt);
  * where up is a (struct socket *), req is one of these requests,
  * m is an optional mbuf chain containing a message,
@@ -164,7 +170,9 @@
 #define	PRU_PROTOSEND		21	/* send to below */
 /* end for protocol's internal use */
 #define PRU_SEND_EOF		22	/* send and close */
-#define PRU_NREQ		22
+#define	PRU_SOSETLABEL		23	/* MAC label change */
+#define	PRU_CLOSE		24	/* socket close */
+#define PRU_NREQ		24
 
 #ifdef PRUREQUESTS
 const char *prurequests[] = {
@@ -173,8 +181,8 @@
 	"RCVD",		"SEND",		"ABORT",	"CONTROL",
 	"SENSE",	"RCVOOB",	"SENDOOB",	"SOCKADDR",
 	"PEERADDR",	"CONNECT2",	"FASTTIMO",	"SLOWTIMO",
-	"PROTORCV",	"PROTOSEND",
-	"SEND_EOF",
+	"PROTORCV",	"PROTOSEND",	"SEND_EOF",	"SOSETLABEL",
+	"CLOSE",
 };
 #endif
 
@@ -186,17 +194,15 @@
 struct uio;
 
 /*
- * If the ordering here looks odd, that's because it's alphabetical.
- * Having this structure separated out from the main protoswitch is allegedly
- * a big (12 cycles per call) lose on high-end CPUs.  We will eventually
- * migrate this stuff back into the main structure.
+ * If the ordering here looks odd, that's because it's alphabetical.  These
+ * should eventually be merged back into struct protosw.
  *
  * Some fields initialized to defaults if they are NULL.
  * See uipc_domain.c:net_init_domain()
  */
 struct pr_usrreqs {
 	double	__Break_the_struct_layout_for_now;
-	int	(*pru_abort)(struct socket *so);
+	void	(*pru_abort)(struct socket *so);
 	int	(*pru_accept)(struct socket *so, struct sockaddr **nam);
 	int	(*pru_attach)(struct socket *so, int proto, struct thread *td);
 	int	(*pru_bind)(struct socket *so, struct sockaddr *nam,
@@ -206,9 +212,10 @@
 	int	(*pru_connect2)(struct socket *so1, struct socket *so2);
 	int	(*pru_control)(struct socket *so, u_long cmd, caddr_t data,
 		    struct ifnet *ifp, struct thread *td);
-	int	(*pru_detach)(struct socket *so);
+	void	(*pru_detach)(struct socket *so);
 	int	(*pru_disconnect)(struct socket *so);
-	int	(*pru_listen)(struct socket *so, struct thread *td);
+	int	(*pru_listen)(struct socket *so, int backlog,
+		    struct thread *td);
 	int	(*pru_peeraddr)(struct socket *so, struct sockaddr **nam);
 	int	(*pru_rcvd)(struct socket *so, int flags);
 	int	(*pru_rcvoob)(struct socket *so, struct mbuf *m, int flags);
@@ -221,15 +228,6 @@
 	int	(*pru_sense)(struct socket *so, struct stat *sb);
 	int	(*pru_shutdown)(struct socket *so);
 	int	(*pru_sockaddr)(struct socket *so, struct sockaddr **nam);
-	 
-	/*
-	 * These three added later, so they are out of order.  They are used
-	 * for shortcutting (fast path input/output) in some protocols.
-	 * XXX - that's a lie, they are not implemented yet
-	 * Rather than calling sosend() etc. directly, calls are made
-	 * through these entry points.  For protocols which still use
-	 * the generic code, these just point to those routines.
-	 */
 	int	(*pru_sosend)(struct socket *so, struct sockaddr *addr,
 		    struct uio *uio, struct mbuf *top, struct mbuf *control,
 		    int flags, struct thread *td);
@@ -239,15 +237,12 @@
 	int	(*pru_sopoll)(struct socket *so, int events,
 		    struct ucred *cred, struct thread *td);
 	void	(*pru_sosetlabel)(struct socket *so);
+	void	(*pru_close)(struct socket *so);
 };
 
 /*
- * The dummy protocol specific user requests function pointer array is
- * initialized to the functions below.  All functions return EOPNOTSUPP.
+ * All nonvoid pru_*() functions below return EOPNOTSUPP.
  */
-extern	struct pr_usrreqs nousrreqs;
-
-int	pru_abort_notsupp(struct socket *so);
 int	pru_accept_notsupp(struct socket *so, struct sockaddr **nam);
 int	pru_attach_notsupp(struct socket *so, int proto, struct thread *td);
 int	pru_bind_notsupp(struct socket *so, struct sockaddr *nam,
@@ -257,9 +252,8 @@
 int	pru_connect2_notsupp(struct socket *so1, struct socket *so2);
 int	pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,
 	    struct ifnet *ifp, struct thread *td);
-int	pru_detach_notsupp(struct socket *so);
 int	pru_disconnect_notsupp(struct socket *so);
-int	pru_listen_notsupp(struct socket *so, struct thread *td);
+int	pru_listen_notsupp(struct socket *so, int backlog, struct thread *td);
 int	pru_peeraddr_notsupp(struct socket *so, struct sockaddr **nam);
 int	pru_rcvd_notsupp(struct socket *so, int flags);
 int	pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags);
@@ -276,7 +270,6 @@
 	    int *flagsp);
 int	pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred,
 	    struct thread *td);
-void	pru_sosetlabel_null(struct socket *so);
 
 #endif /* _KERNEL */
 
Index: elf_common.h
===================================================================
RCS file: /home/cvs/src/sys/sys/elf_common.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/elf_common.h -L sys/sys/elf_common.h -u -r1.1.1.2 -r1.2
--- sys/sys/elf_common.h
+++ sys/sys/elf_common.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.1 2005/12/30 22:13:58 marcel Exp $
+ * $FreeBSD: src/sys/sys/elf_common.h,v 1.22 2007/04/03 01:47:07 kan Exp $
  */
 
 #ifndef _SYS_ELF_COMMON_H_
@@ -48,8 +48,8 @@
 	u_int32_t	n_type;		/* Type of this note. */
 } Elf_Note;
 
-/* Indexes into the e_ident array.  Keep synced with 
-   http://www.sco.com/developer/gabi/ch4.eheader.html */
+/* Indexes into the e_ident array.  Keep synced with
+   http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
 #define EI_MAG0		0	/* Magic number, byte 0. */
 #define EI_MAG1		1	/* Magic number, byte 1. */
 #define EI_MAG2		2	/* Magic number, byte 2. */
@@ -168,6 +168,7 @@
 #define EM_ST100	60	/* STMicroelectronics ST100 processor. */
 #define EM_TINYJ	61	/* Advanced Logic Corp. TinyJ processor. */
 #define EM_X86_64	62	/* Advanced Micro Devices x86-64 */
+#define	EM_AMD64	EM_X86_64	/* Advanced Micro Devices x86-64 (compat) */
 
 /* Non-standard or deprecated. */
 #define EM_486		6	/* Intel i486. */
@@ -205,12 +206,30 @@
 #define SHT_PREINIT_ARRAY	16	/* Pre-initialization function ptrs. */
 #define SHT_GROUP		17	/* Section group. */
 #define SHT_SYMTAB_SHNDX	18	/* Section indexes (see SHN_XINDEX). */
-#define SHT_LOOS	0x60000000	/* First of OS specific semantics */
-#define SHT_HIOS	0x6fffffff	/* Last of OS specific semantics */
-#define SHT_LOPROC	0x70000000	/* reserved range for processor */
-#define SHT_HIPROC	0x7fffffff	/* specific section header types */
-#define SHT_LOUSER	0x80000000	/* reserved range for application */
-#define SHT_HIUSER	0xffffffff	/* specific indexes */
+#define SHT_LOOS		0x60000000	/* First of OS specific semantics */
+#define SHT_LOSUNW		0x6ffffff4
+#define SHT_SUNW_dof		0x6ffffff4
+#define SHT_SUNW_cap		0x6ffffff5
+#define SHT_SUNW_SIGNATURE	0x6ffffff6
+#define SHT_SUNW_ANNOTATE	0x6ffffff7
+#define SHT_SUNW_DEBUGSTR	0x6ffffff8
+#define SHT_SUNW_DEBUG		0x6ffffff9
+#define SHT_SUNW_move		0x6ffffffa
+#define SHT_SUNW_COMDAT		0x6ffffffb
+#define SHT_SUNW_syminfo	0x6ffffffc
+#define SHT_SUNW_verdef		0x6ffffffd
+#define SHT_GNU_verdef		0x6ffffffd	/* Symbol versions provided */
+#define SHT_SUNW_verneed	0x6ffffffe
+#define SHT_GNU_verneed		0x6ffffffe	/* Symbol versions required */
+#define SHT_SUNW_versym		0x6fffffff
+#define SHT_GNU_versym		0x6fffffff	/* Symbol version table */
+#define SHT_HISUNW		0x6fffffff
+#define SHT_HIOS		0x6fffffff	/* Last of OS specific semantics */
+#define SHT_LOPROC		0x70000000	/* reserved range for processor */
+#define SHT_AMD64_UNWIND	0x70000001	/* unwind information */
+#define SHT_HIPROC		0x7fffffff	/* specific section header types */
+#define SHT_LOUSER		0x80000000	/* reserved range for application */
+#define SHT_HIUSER		0xffffffff	/* specific indexes */
 
 /* Flags for sh_flags. */
 #define SHF_WRITE		0x1	/* Section contains writable data. */
@@ -236,6 +255,14 @@
 #define PT_PHDR		6	/* Location of program header itself. */
 #define	PT_TLS		7	/* Thread local storage segment */
 #define PT_LOOS		0x60000000	/* First OS-specific. */
+#define	PT_SUNW_UNWIND	0x6464e550	/* amd64 UNWIND program header */
+#define	PT_GNU_EH_FRAME	0x6474e550
+#define	PT_LOSUNW	0x6ffffffa
+#define	PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */
+#define	PT_SUNWSTACK	0x6ffffffb	/* describes the stack segment */
+#define	PT_SUNWDTRACE	0x6ffffffc	/* private */
+#define	PT_SUNWCAP	0x6ffffffd	/* hard/soft capabilities segment */
+#define	PT_HISUNW	0x6fffffff
 #define PT_HIOS		0x6fffffff	/* Last OS-specific. */
 #define PT_LOPROC	0x70000000	/* First processor-specific type. */
 #define PT_HIPROC	0x7fffffff	/* Last processor-specific type. */
@@ -247,6 +274,9 @@
 #define PF_MASKOS	0x0ff00000	/* Operating system-specific. */
 #define PF_MASKPROC	0xf0000000	/* Processor-specific. */
 
+/* Extended program header index. */
+#define	PN_XNUM		0xffff
+
 /* Values for d_tag. */
 #define DT_NULL		0	/* Terminating entry. */
 #define DT_NEEDED	1	/* String table offset of a needed shared
@@ -296,9 +326,61 @@
 				   pre-initialization functions. */
 #define	DT_PREINIT_ARRAYSZ 33	/* Size in bytes of the array of
 				   pre-initialization functions. */
+#define	DT_MAXPOSTAGS	34	/* number of positive tags */
 #define	DT_LOOS		0x6000000d	/* First OS-specific */
+#define	DT_SUNW_AUXILIARY	0x6000000d	/* symbol auxiliary name */
+#define	DT_SUNW_RTLDINF		0x6000000e	/* ld.so.1 info (private) */
+#define	DT_SUNW_FILTER		0x6000000f	/* symbol filter name */
+#define	DT_SUNW_CAP		0x60000010	/* hardware/software */
 #define	DT_HIOS		0x6ffff000	/* Last OS-specific */
+
+/*
+ * DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
+ * Dyn.d_un.d_val field of the Elf*_Dyn structure.
+ */
+#define	DT_VALRNGLO	0x6ffffd00
+#define	DT_CHECKSUM	0x6ffffdf8	/* elf checksum */
+#define	DT_PLTPADSZ	0x6ffffdf9	/* pltpadding size */
+#define	DT_MOVEENT	0x6ffffdfa	/* move table entry size */
+#define	DT_MOVESZ	0x6ffffdfb	/* move table size */
+#define	DT_FEATURE_1	0x6ffffdfc	/* feature holder */
+#define	DT_POSFLAG_1	0x6ffffdfd	/* flags for DT_* entries, effecting */
+					/*	the following DT_* entry. */
+					/*	See DF_P1_* definitions */
+#define	DT_SYMINSZ	0x6ffffdfe	/* syminfo table size (in bytes) */
+#define	DT_SYMINENT	0x6ffffdff	/* syminfo entry size (in bytes) */
+#define	DT_VALRNGHI	0x6ffffdff
+
+/*
+ * DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
+ * Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
+ *
+ * If any adjustment is made to the ELF object after it has been
+ * built, these entries will need to be adjusted.
+ */
+#define	DT_ADDRRNGLO	0x6ffffe00
+#define	DT_CONFIG	0x6ffffefa	/* configuration information */
+#define	DT_DEPAUDIT	0x6ffffefb	/* dependency auditing */
+#define	DT_AUDIT	0x6ffffefc	/* object auditing */
+#define	DT_PLTPAD	0x6ffffefd	/* pltpadding (sparcv9) */
+#define	DT_MOVETAB	0x6ffffefe	/* move table */
+#define	DT_SYMINFO	0x6ffffeff	/* syminfo table */
+#define	DT_ADDRRNGHI	0x6ffffeff
+
+#define	DT_VERSYM	0x6ffffff0	/* Address of versym section. */
+#define	DT_RELACOUNT	0x6ffffff9	/* number of RELATIVE relocations */
+#define	DT_RELCOUNT	0x6ffffffa	/* number of RELATIVE relocations */
+#define	DT_FLAGS_1	0x6ffffffb	/* state flags - see DF_1_* defs */
+#define	DT_VERDEF	0x6ffffffc	/* Address of verdef section. */
+#define	DT_VERDEFNUM	0x6ffffffd	/* Number of elems in verdef section */
+#define	DT_VERNEED	0x6ffffffe	/* Address of verneed section. */
+#define	DT_VERNEEDNUM	0x6fffffff	/* Number of elems in verneed section */
+
 #define	DT_LOPROC	0x70000000	/* First processor-specific type. */
+#define	DT_DEPRECATED_SPARC_REGISTER	0x7000001
+#define	DT_AUXILIARY	0x7ffffffd	/* shared library auxiliary name */
+#define	DT_USED		0x7ffffffe	/* ignored - same as needed */
+#define	DT_FILTER	0x7fffffff	/* shared library filter name */
 #define	DT_HIPROC	0x7fffffff	/* Last processor-specific type. */
 
 /* Values for DT_FLAGS */
@@ -338,6 +420,7 @@
 #define STT_FILE	4	/* Source file. */
 #define STT_COMMON	5	/* Uninitialized common block. */
 #define STT_TLS		6	/* TLS object. */
+#define STT_NUM		7
 #define STT_LOOS	10	/* Reserved range for operating system */
 #define STT_HIOS	12	/*   specific semantics. */
 #define STT_LOPROC	13	/* reserved range for processor */
@@ -352,4 +435,409 @@
 /* Special symbol table indexes. */
 #define STN_UNDEF	0	/* Undefined symbol index. */
 
+/* Symbol versioning flags. */
+#define	VER_DEF_CURRENT	1
+#define VER_DEF_IDX(x)	VER_NDX(x)
+
+#define	VER_FLG_BASE	0x01
+#define	VER_FLG_WEAK	0x02
+
+#define	VER_NEED_CURRENT	1
+#define VER_NEED_WEAK	(1u << 15)
+#define VER_NEED_HIDDEN	VER_NDX_HIDDEN
+#define VER_NEED_IDX(x)	VER_NDX(x)
+
+#define	VER_NDX_LOCAL	0
+#define	VER_NDX_GLOBAL	1
+#define VER_NDX_GIVEN	2
+
+#define VER_NDX_HIDDEN	(1u << 15)
+#define VER_NDX(x)	((x) & ~(1u << 15))
+
+#define	CA_SUNW_NULL	0
+#define	CA_SUNW_HW_1	1		/* first hardware capabilities entry */
+#define	CA_SUNW_SF_1	2		/* first software capabilities entry */
+
+/*
+ * Syminfo flag values
+ */
+#define	SYMINFO_FLG_DIRECT	0x0001	/* symbol ref has direct association */
+					/*	to object containing defn. */
+#define	SYMINFO_FLG_PASSTHRU	0x0002	/* ignored - see SYMINFO_FLG_FILTER */
+#define	SYMINFO_FLG_COPY	0x0004	/* symbol is a copy-reloc */
+#define	SYMINFO_FLG_LAZYLOAD	0x0008	/* object containing defn should be */
+					/*	lazily-loaded */
+#define	SYMINFO_FLG_DIRECTBIND	0x0010	/* ref should be bound directly to */
+					/*	object containing defn. */
+#define	SYMINFO_FLG_NOEXTDIRECT	0x0020	/* don't let an external reference */
+					/*	directly bind to this symbol */
+#define	SYMINFO_FLG_FILTER	0x0002	/* symbol ref is associated to a */
+#define	SYMINFO_FLG_AUXILIARY	0x0040	/* 	standard or auxiliary filter */
+
+/*
+ * Syminfo.si_boundto values.
+ */
+#define	SYMINFO_BT_SELF		0xffff	/* symbol bound to self */
+#define	SYMINFO_BT_PARENT	0xfffe	/* symbol bound to parent */
+#define	SYMINFO_BT_NONE		0xfffd	/* no special symbol binding */
+#define	SYMINFO_BT_EXTERN	0xfffc	/* symbol defined as external */
+#define	SYMINFO_BT_LOWRESERVE	0xff00	/* beginning of reserved entries */
+
+/*
+ * Syminfo version values.
+ */
+#define	SYMINFO_NONE		0	/* Syminfo version */
+#define	SYMINFO_CURRENT		1
+#define	SYMINFO_NUM		2
+
+/*
+ * Relocation types.
+ *
+ * All machine architectures are defined here to allow tools on one to
+ * handle others.
+ */
+
+#define	R_386_NONE		0	/* No relocation. */
+#define	R_386_32		1	/* Add symbol value. */
+#define	R_386_PC32		2	/* Add PC-relative symbol value. */
+#define	R_386_GOT32		3	/* Add PC-relative GOT offset. */
+#define	R_386_PLT32		4	/* Add PC-relative PLT offset. */
+#define	R_386_COPY		5	/* Copy data from shared object. */
+#define	R_386_GLOB_DAT		6	/* Set GOT entry to data address. */
+#define	R_386_JMP_SLOT		7	/* Set GOT entry to code address. */
+#define	R_386_RELATIVE		8	/* Add load address of shared object. */
+#define	R_386_GOTOFF		9	/* Add GOT-relative symbol address. */
+#define	R_386_GOTPC		10	/* Add PC-relative GOT table address. */
+#define	R_386_TLS_TPOFF		14	/* Negative offset in static TLS block */
+#define	R_386_TLS_IE		15	/* Absolute address of GOT for -ve static TLS */
+#define	R_386_TLS_GOTIE		16	/* GOT entry for negative static TLS block */
+#define	R_386_TLS_LE		17	/* Negative offset relative to static TLS */
+#define	R_386_TLS_GD		18	/* 32 bit offset to GOT (index,off) pair */
+#define	R_386_TLS_LDM		19	/* 32 bit offset to GOT (index,zero) pair */
+#define	R_386_TLS_GD_32		24	/* 32 bit offset to GOT (index,off) pair */
+#define	R_386_TLS_GD_PUSH	25	/* pushl instruction for Sun ABI GD sequence */
+#define	R_386_TLS_GD_CALL	26	/* call instruction for Sun ABI GD sequence */
+#define	R_386_TLS_GD_POP	27	/* popl instruction for Sun ABI GD sequence */
+#define	R_386_TLS_LDM_32	28	/* 32 bit offset to GOT (index,zero) pair */
+#define	R_386_TLS_LDM_PUSH	29	/* pushl instruction for Sun ABI LD sequence */
+#define	R_386_TLS_LDM_CALL	30	/* call instruction for Sun ABI LD sequence */
+#define	R_386_TLS_LDM_POP	31	/* popl instruction for Sun ABI LD sequence */
+#define	R_386_TLS_LDO_32	32	/* 32 bit offset from start of TLS block */
+#define	R_386_TLS_IE_32		33	/* 32 bit offset to GOT static TLS offset entry */
+#define	R_386_TLS_LE_32		34	/* 32 bit offset within static TLS block */
+#define	R_386_TLS_DTPMOD32	35	/* GOT entry containing TLS index */
+#define	R_386_TLS_DTPOFF32	36	/* GOT entry containing TLS offset */
+#define	R_386_TLS_TPOFF32	37	/* GOT entry of -ve static TLS offset */
+
+#define	R_ARM_NONE		0	/* No relocation. */
+#define	R_ARM_PC24		1
+#define	R_ARM_ABS32		2
+#define	R_ARM_REL32		3
+#define	R_ARM_PC13		4
+#define	R_ARM_ABS16		5
+#define	R_ARM_ABS12		6
+#define	R_ARM_THM_ABS5		7
+#define	R_ARM_ABS8		8
+#define	R_ARM_SBREL32		9
+#define	R_ARM_THM_PC22		10
+#define	R_ARM_THM_PC8		11
+#define	R_ARM_AMP_VCALL9	12
+#define	R_ARM_SWI24		13
+#define	R_ARM_THM_SWI8		14
+#define	R_ARM_XPC25		15
+#define	R_ARM_THM_XPC22		16
+#define	R_ARM_COPY		20	/* Copy data from shared object. */
+#define	R_ARM_GLOB_DAT		21	/* Set GOT entry to data address. */
+#define	R_ARM_JUMP_SLOT		22	/* Set GOT entry to code address. */
+#define	R_ARM_RELATIVE		23	/* Add load address of shared object. */
+#define	R_ARM_GOTOFF		24	/* Add GOT-relative symbol address. */
+#define	R_ARM_GOTPC		25	/* Add PC-relative GOT table address. */
+#define	R_ARM_GOT32		26	/* Add PC-relative GOT offset. */
+#define	R_ARM_PLT32		27	/* Add PC-relative PLT offset. */
+#define	R_ARM_GNU_VTENTRY	100
+#define	R_ARM_GNU_VTINHERIT	101
+#define	R_ARM_RSBREL32		250
+#define	R_ARM_THM_RPC22		251
+#define	R_ARM_RREL32		252
+#define	R_ARM_RABS32		253
+#define	R_ARM_RPC24		254
+#define	R_ARM_RBASE		255
+
+/*	Name			Value	   Field	Calculation */
+#define	R_IA_64_NONE		0	/* None */
+#define	R_IA_64_IMM14		0x21	/* immediate14	S + A */
+#define	R_IA_64_IMM22		0x22	/* immediate22	S + A */
+#define	R_IA_64_IMM64		0x23	/* immediate64	S + A */
+#define	R_IA_64_DIR32MSB	0x24	/* word32 MSB	S + A */
+#define	R_IA_64_DIR32LSB	0x25	/* word32 LSB	S + A */
+#define	R_IA_64_DIR64MSB	0x26	/* word64 MSB	S + A */
+#define	R_IA_64_DIR64LSB	0x27	/* word64 LSB	S + A */
+#define	R_IA_64_GPREL22		0x2a	/* immediate22	@gprel(S + A) */
+#define	R_IA_64_GPREL64I	0x2b	/* immediate64	@gprel(S + A) */
+#define	R_IA_64_GPREL32MSB	0x2c	/* word32 MSB	@gprel(S + A) */
+#define	R_IA_64_GPREL32LSB	0x2d	/* word32 LSB	@gprel(S + A) */
+#define	R_IA_64_GPREL64MSB	0x2e	/* word64 MSB	@gprel(S + A) */
+#define	R_IA_64_GPREL64LSB	0x2f	/* word64 LSB	@gprel(S + A) */
+#define	R_IA_64_LTOFF22		0x32	/* immediate22	@ltoff(S + A) */
+#define	R_IA_64_LTOFF64I	0x33	/* immediate64	@ltoff(S + A) */
+#define	R_IA_64_PLTOFF22	0x3a	/* immediate22	@pltoff(S + A) */
+#define	R_IA_64_PLTOFF64I	0x3b	/* immediate64	@pltoff(S + A) */
+#define	R_IA_64_PLTOFF64MSB	0x3e	/* word64 MSB	@pltoff(S + A) */
+#define	R_IA_64_PLTOFF64LSB	0x3f	/* word64 LSB	@pltoff(S + A) */
+#define	R_IA_64_FPTR64I		0x43	/* immediate64	@fptr(S + A) */
+#define	R_IA_64_FPTR32MSB	0x44	/* word32 MSB	@fptr(S + A) */
+#define	R_IA_64_FPTR32LSB	0x45	/* word32 LSB	@fptr(S + A) */
+#define	R_IA_64_FPTR64MSB	0x46	/* word64 MSB	@fptr(S + A) */
+#define	R_IA_64_FPTR64LSB	0x47	/* word64 LSB	@fptr(S + A) */
+#define	R_IA_64_PCREL60B	0x48	/* immediate60 form1 S + A - P */
+#define	R_IA_64_PCREL21B	0x49	/* immediate21 form1 S + A - P */
+#define	R_IA_64_PCREL21M	0x4a	/* immediate21 form2 S + A - P */
+#define	R_IA_64_PCREL21F	0x4b	/* immediate21 form3 S + A - P */
+#define	R_IA_64_PCREL32MSB	0x4c	/* word32 MSB	S + A - P */
+#define	R_IA_64_PCREL32LSB	0x4d	/* word32 LSB	S + A - P */
+#define	R_IA_64_PCREL64MSB	0x4e	/* word64 MSB	S + A - P */
+#define	R_IA_64_PCREL64LSB	0x4f	/* word64 LSB	S + A - P */
+#define	R_IA_64_LTOFF_FPTR22	0x52	/* immediate22	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR64I	0x53	/* immediate64	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR32MSB	0x54	/* word32 MSB	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR32LSB	0x55	/* word32 LSB	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR64MSB	0x56	/* word64 MSB	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_LTOFF_FPTR64LSB	0x57	/* word64 LSB	@ltoff(@fptr(S + A)) */
+#define	R_IA_64_SEGREL32MSB	0x5c	/* word32 MSB	@segrel(S + A) */
+#define	R_IA_64_SEGREL32LSB	0x5d	/* word32 LSB	@segrel(S + A) */
+#define	R_IA_64_SEGREL64MSB	0x5e	/* word64 MSB	@segrel(S + A) */
+#define	R_IA_64_SEGREL64LSB	0x5f	/* word64 LSB	@segrel(S + A) */
+#define	R_IA_64_SECREL32MSB	0x64	/* word32 MSB	@secrel(S + A) */
+#define	R_IA_64_SECREL32LSB	0x65	/* word32 LSB	@secrel(S + A) */
+#define	R_IA_64_SECREL64MSB	0x66	/* word64 MSB	@secrel(S + A) */
+#define	R_IA_64_SECREL64LSB	0x67	/* word64 LSB	@secrel(S + A) */
+#define	R_IA_64_REL32MSB	0x6c	/* word32 MSB	BD + A */
+#define	R_IA_64_REL32LSB	0x6d	/* word32 LSB	BD + A */
+#define	R_IA_64_REL64MSB	0x6e	/* word64 MSB	BD + A */
+#define	R_IA_64_REL64LSB	0x6f	/* word64 LSB	BD + A */
+#define	R_IA_64_LTV32MSB	0x74	/* word32 MSB	S + A */
+#define	R_IA_64_LTV32LSB	0x75	/* word32 LSB	S + A */
+#define	R_IA_64_LTV64MSB	0x76	/* word64 MSB	S + A */
+#define	R_IA_64_LTV64LSB	0x77	/* word64 LSB	S + A */
+#define	R_IA_64_PCREL21BI	0x79	/* immediate21 form1 S + A - P */
+#define	R_IA_64_PCREL22		0x7a	/* immediate22	S + A - P */
+#define	R_IA_64_PCREL64I	0x7b	/* immediate64	S + A - P */
+#define	R_IA_64_IPLTMSB		0x80	/* function descriptor MSB special */
+#define	R_IA_64_IPLTLSB		0x81	/* function descriptor LSB speciaal */
+#define	R_IA_64_SUB		0x85	/* immediate64	A - S */
+#define	R_IA_64_LTOFF22X	0x86	/* immediate22	special */
+#define	R_IA_64_LDXMOV		0x87	/* immediate22	special */
+#define	R_IA_64_TPREL14		0x91	/* imm14	@tprel(S + A) */
+#define	R_IA_64_TPREL22		0x92	/* imm22	@tprel(S + A) */
+#define	R_IA_64_TPREL64I	0x93	/* imm64	@tprel(S + A) */
+#define	R_IA_64_TPREL64MSB	0x96	/* word64 MSB	@tprel(S + A) */
+#define	R_IA_64_TPREL64LSB	0x97	/* word64 LSB	@tprel(S + A) */
+#define	R_IA_64_LTOFF_TPREL22	0x9a	/* imm22	@ltoff(@tprel(S+A)) */
+#define	R_IA_64_DTPMOD64MSB	0xa6	/* word64 MSB	@dtpmod(S + A) */
+#define	R_IA_64_DTPMOD64LSB	0xa7	/* word64 LSB	@dtpmod(S + A) */
+#define	R_IA_64_LTOFF_DTPMOD22	0xaa	/* imm22	@ltoff(@dtpmod(S+A)) */
+#define	R_IA_64_DTPREL14	0xb1	/* imm14	@dtprel(S + A) */
+#define	R_IA_64_DTPREL22	0xb2	/* imm22	@dtprel(S + A) */
+#define	R_IA_64_DTPREL64I	0xb3	/* imm64	@dtprel(S + A) */
+#define	R_IA_64_DTPREL32MSB	0xb4	/* word32 MSB	@dtprel(S + A) */
+#define	R_IA_64_DTPREL32LSB	0xb5	/* word32 LSB	@dtprel(S + A) */
+#define	R_IA_64_DTPREL64MSB	0xb6	/* word64 MSB	@dtprel(S + A) */
+#define	R_IA_64_DTPREL64LSB	0xb7	/* word64 LSB	@dtprel(S + A) */
+#define	R_IA_64_LTOFF_DTPREL22	0xba	/* imm22	@ltoff(@dtprel(S+A)) */
+
+#define	R_PPC_NONE		0	/* No relocation. */
+#define	R_PPC_ADDR32		1
+#define	R_PPC_ADDR24		2
+#define	R_PPC_ADDR16		3
+#define	R_PPC_ADDR16_LO		4
+#define	R_PPC_ADDR16_HI		5
+#define	R_PPC_ADDR16_HA		6
+#define	R_PPC_ADDR14		7
+#define	R_PPC_ADDR14_BRTAKEN	8
+#define	R_PPC_ADDR14_BRNTAKEN	9
+#define	R_PPC_REL24		10
+#define	R_PPC_REL14		11
+#define	R_PPC_REL14_BRTAKEN	12
+#define	R_PPC_REL14_BRNTAKEN	13
+#define	R_PPC_GOT16		14
+#define	R_PPC_GOT16_LO		15
+#define	R_PPC_GOT16_HI		16
+#define	R_PPC_GOT16_HA		17
+#define	R_PPC_PLTREL24		18
+#define	R_PPC_COPY		19
+#define	R_PPC_GLOB_DAT		20
+#define	R_PPC_JMP_SLOT		21
+#define	R_PPC_RELATIVE		22
+#define	R_PPC_LOCAL24PC		23
+#define	R_PPC_UADDR32		24
+#define	R_PPC_UADDR16		25
+#define	R_PPC_REL32		26
+#define	R_PPC_PLT32		27
+#define	R_PPC_PLTREL32		28
+#define	R_PPC_PLT16_LO		29
+#define	R_PPC_PLT16_HI		30
+#define	R_PPC_PLT16_HA		31
+#define	R_PPC_SDAREL16		32
+#define	R_PPC_SECTOFF		33
+#define	R_PPC_SECTOFF_LO	34
+#define	R_PPC_SECTOFF_HI	35
+#define	R_PPC_SECTOFF_HA	36
+
+/*
+ * TLS relocations
+ */
+#define R_PPC_TLS		67
+#define R_PPC_DTPMOD32		68
+#define R_PPC_TPREL16		69
+#define R_PPC_TPREL16_LO	70
+#define R_PPC_TPREL16_HI	71
+#define R_PPC_TPREL16_HA	72
+#define R_PPC_TPREL32		73
+#define R_PPC_DTPREL16		74
+#define R_PPC_DTPREL16_LO	75
+#define R_PPC_DTPREL16_HI	76
+#define R_PPC_DTPREL16_HA	77
+#define R_PPC_DTPREL32		78
+#define R_PPC_GOT_TLSGD16	79
+#define R_PPC_GOT_TLSGD16_LO	80
+#define R_PPC_GOT_TLSGD16_HI	81
+#define R_PPC_GOT_TLSGD16_HA	82
+#define R_PPC_GOT_TLSLD16	83
+#define R_PPC_GOT_TLSLD16_LO	84
+#define R_PPC_GOT_TLSLD16_HI	85
+#define R_PPC_GOT_TLSLD16_HA	86
+#define R_PPC_GOT_TPREL16	87
+#define R_PPC_GOT_TPREL16_LO	88
+#define R_PPC_GOT_TPREL16_HI	89
+#define R_PPC_GOT_TPREL16_HA	90
+
+/*
+ * The remaining relocs are from the Embedded ELF ABI, and are not in the
+ *  SVR4 ELF ABI.
+ */
+
+#define	R_PPC_EMB_NADDR32	101
+#define	R_PPC_EMB_NADDR16	102
+#define	R_PPC_EMB_NADDR16_LO	103
+#define	R_PPC_EMB_NADDR16_HI	104
+#define	R_PPC_EMB_NADDR16_HA	105
+#define	R_PPC_EMB_SDAI16	106
+#define	R_PPC_EMB_SDA2I16	107
+#define	R_PPC_EMB_SDA2REL	108
+#define	R_PPC_EMB_SDA21		109
+#define	R_PPC_EMB_MRKREF	110
+#define	R_PPC_EMB_RELSEC16	111
+#define	R_PPC_EMB_RELST_LO	112
+#define	R_PPC_EMB_RELST_HI	113
+#define	R_PPC_EMB_RELST_HA	114
+#define	R_PPC_EMB_BIT_FLD	115
+#define	R_PPC_EMB_RELSDA	116
+
+#define	R_SPARC_NONE		0
+#define	R_SPARC_8		1
+#define	R_SPARC_16		2
+#define	R_SPARC_32		3
+#define	R_SPARC_DISP8		4
+#define	R_SPARC_DISP16		5
+#define	R_SPARC_DISP32		6
+#define	R_SPARC_WDISP30		7
+#define	R_SPARC_WDISP22		8
+#define	R_SPARC_HI22		9
+#define	R_SPARC_22		10
+#define	R_SPARC_13		11
+#define	R_SPARC_LO10		12
+#define	R_SPARC_GOT10		13
+#define	R_SPARC_GOT13		14
+#define	R_SPARC_GOT22		15
+#define	R_SPARC_PC10		16
+#define	R_SPARC_PC22		17
+#define	R_SPARC_WPLT30		18
+#define	R_SPARC_COPY		19
+#define	R_SPARC_GLOB_DAT	20
+#define	R_SPARC_JMP_SLOT	21
+#define	R_SPARC_RELATIVE	22
+#define	R_SPARC_UA32		23
+#define	R_SPARC_PLT32		24
+#define	R_SPARC_HIPLT22		25
+#define	R_SPARC_LOPLT10		26
+#define	R_SPARC_PCPLT32		27
+#define	R_SPARC_PCPLT22		28
+#define	R_SPARC_PCPLT10		29
+#define	R_SPARC_10		30
+#define	R_SPARC_11		31
+#define	R_SPARC_64		32
+#define	R_SPARC_OLO10		33
+#define	R_SPARC_HH22		34
+#define	R_SPARC_HM10		35
+#define	R_SPARC_LM22		36
+#define	R_SPARC_PC_HH22		37
+#define	R_SPARC_PC_HM10		38
+#define	R_SPARC_PC_LM22		39
+#define	R_SPARC_WDISP16		40
+#define	R_SPARC_WDISP19		41
+#define	R_SPARC_GLOB_JMP	42
+#define	R_SPARC_7		43
+#define	R_SPARC_5		44
+#define	R_SPARC_6		45
+#define	R_SPARC_DISP64		46
+#define	R_SPARC_PLT64		47
+#define	R_SPARC_HIX22		48
+#define	R_SPARC_LOX10		49
+#define	R_SPARC_H44		50
+#define	R_SPARC_M44		51
+#define	R_SPARC_L44		52
+#define	R_SPARC_REGISTER	53
+#define	R_SPARC_UA64		54
+#define	R_SPARC_UA16		55
+#define	R_SPARC_TLS_GD_HI22	56
+#define	R_SPARC_TLS_GD_LO10	57
+#define	R_SPARC_TLS_GD_ADD	58
+#define	R_SPARC_TLS_GD_CALL	59
+#define	R_SPARC_TLS_LDM_HI22	60
+#define	R_SPARC_TLS_LDM_LO10	61
+#define	R_SPARC_TLS_LDM_ADD	62
+#define	R_SPARC_TLS_LDM_CALL	63
+#define	R_SPARC_TLS_LDO_HIX22	64
+#define	R_SPARC_TLS_LDO_LOX10	65
+#define	R_SPARC_TLS_LDO_ADD	66
+#define	R_SPARC_TLS_IE_HI22	67
+#define	R_SPARC_TLS_IE_LO10	68
+#define	R_SPARC_TLS_IE_LD	69
+#define	R_SPARC_TLS_IE_LDX	70
+#define	R_SPARC_TLS_IE_ADD	71
+#define	R_SPARC_TLS_LE_HIX22	72
+#define	R_SPARC_TLS_LE_LOX10	73
+#define	R_SPARC_TLS_DTPMOD32	74
+#define	R_SPARC_TLS_DTPMOD64	75
+#define	R_SPARC_TLS_DTPOFF32	76
+#define	R_SPARC_TLS_DTPOFF64	77
+#define	R_SPARC_TLS_TPOFF32	78
+#define	R_SPARC_TLS_TPOFF64	79
+
+#define	R_X86_64_NONE		0	/* No relocation. */
+#define	R_X86_64_64		1	/* Add 64 bit symbol value. */
+#define	R_X86_64_PC32		2	/* PC-relative 32 bit signed sym value. */
+#define	R_X86_64_GOT32		3	/* PC-relative 32 bit GOT offset. */
+#define	R_X86_64_PLT32		4	/* PC-relative 32 bit PLT offset. */
+#define	R_X86_64_COPY		5	/* Copy data from shared object. */
+#define	R_X86_64_GLOB_DAT	6	/* Set GOT entry to data address. */
+#define	R_X86_64_JMP_SLOT	7	/* Set GOT entry to code address. */
+#define	R_X86_64_RELATIVE	8	/* Add load address of shared object. */
+#define	R_X86_64_GOTPCREL	9	/* Add 32 bit signed pcrel offset to GOT. */
+#define	R_X86_64_32		10	/* Add 32 bit zero extended symbol value */
+#define	R_X86_64_32S		11	/* Add 32 bit sign extended symbol value */
+#define	R_X86_64_16		12	/* Add 16 bit zero extended symbol value */
+#define	R_X86_64_PC16		13	/* Add 16 bit signed extended pc relative symbol value */
+#define	R_X86_64_8		14	/* Add 8 bit zero extended symbol value */
+#define	R_X86_64_PC8		15	/* Add 8 bit signed extended pc relative symbol value */
+#define	R_X86_64_DTPMOD64	16	/* ID of module containing symbol */
+#define	R_X86_64_DTPOFF64	17	/* Offset in TLS block */
+#define	R_X86_64_TPOFF64	18	/* Offset in static TLS block */
+#define	R_X86_64_TLSGD		19	/* PC relative offset to GD GOT entry */
+#define	R_X86_64_TLSLD		20	/* PC relative offset to LD GOT entry */
+#define	R_X86_64_DTPOFF32	21	/* Offset in TLS block */
+#define	R_X86_64_GOTTPOFF	22	/* PC relative offset to IE GOT entry */
+#define	R_X86_64_TPOFF32	23	/* Offset in static TLS block */
+
+
 #endif /* !_SYS_ELF_COMMON_H_ */
Index: cons.h
===================================================================
RCS file: /home/cvs/src/sys/sys/cons.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/cons.h -L sys/sys/cons.h -u -r1.1.1.1 -r1.2
--- sys/sys/cons.h
+++ sys/sys/cons.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)cons.h	7.2 (Berkeley) 5/9/91
- * $FreeBSD: src/sys/sys/cons.h,v 1.37 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/cons.h,v 1.40 2006/11/01 04:54:51 jb Exp $
  */
 
 #ifndef _MACHINE_CONS_H_
@@ -45,7 +45,6 @@
 typedef	int	cn_getc_t(struct consdev *);
 typedef	int	cn_checkc_t(struct consdev *);
 typedef	void	cn_putc_t(struct consdev *, int);
-typedef	void	cn_dbctl_t(struct consdev *, int);
 
 struct consdev {
 	cn_probe_t	*cn_probe;
@@ -60,8 +59,6 @@
 				/* kernel "return char if available" interface */
 	cn_putc_t	*cn_putc;
 				/* kernel putchar interface */
-	cn_dbctl_t	*cn_dbctl;
-				/* debugger control interface */
 	struct	tty *cn_tp;	/* tty structure for console device */
 	short	cn_pri;		/* pecking order; the higher the better */
 	void	*cn_arg;	/* drivers method argument */
@@ -85,7 +82,17 @@
 
 #define CONS_DRIVER(name, probe, init, term, getc, checkc, putc, dbctl)	\
 	static struct consdev name##_consdev = {			\
-		probe, init, term, getc, checkc, putc, dbctl		\
+		probe, init, term, getc, checkc, putc			\
+	};								\
+	DATA_SET(cons_set, name##_consdev)
+
+#define CONSOLE_DRIVER(name)						\
+	static struct consdev name##_consdev = {			\
+		.cn_probe = name##_cnprobe,				\
+		.cn_init = name##_cninit,				\
+		.cn_term = name##_cnterm,				\
+		.cn_getc = name##_cngetc,				\
+		.cn_putc = name##_cnputc,				\
 	};								\
 	DATA_SET(cons_set, name##_consdev)
 
@@ -98,8 +105,8 @@
 void	cnselect(struct consdev *);
 int	cncheckc(void);
 int	cngetc(void);
-void	cndbctl(int);
 void	cnputc(int);
+void	cnputs(char *);
 int	cnunavailable(void);
 
 #endif /* _KERNEL */
Index: link_elf.h
===================================================================
RCS file: /home/cvs/src/sys/sys/link_elf.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/link_elf.h -L sys/sys/link_elf.h -u -r1.1.1.1 -r1.2
--- sys/sys/link_elf.h
+++ sys/sys/link_elf.h
@@ -27,7 +27,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/link_elf.h,v 1.26 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/link_elf.h,v 1.27 2007/04/03 18:33:41 kan Exp $
  */
 
 /*
@@ -41,7 +41,7 @@
 #ifndef _SYS_LINK_ELF_H_
 #define _SYS_LINK_ELF_H_
 
-#include <sys/types.h>
+#include <sys/elf.h>
 
 /*
  * Flags that describe the origin of the entries in Dl_serinfo.
@@ -76,4 +76,24 @@
 	}		r_state;
 };
 
+struct dl_phdr_info
+{
+	Elf_Addr dlpi_addr;			/* module relocation base */
+	const char *dlpi_name;			/* module name */
+	const Elf_Phdr *dlpi_phdr;		/* pointer to module's phdr */
+	Elf_Half dlpi_phnum;			/* number of entries in phdr */
+	unsigned long long int dlpi_adds;	/* total # of loads */
+	unsigned long long int dlpi_subs;	/* total # of unloads */
+	size_t dlpi_tls_modid;
+	void *dlpi_tls_data;
+};
+
+__BEGIN_DECLS
+
+typedef int (*__dl_iterate_hdr_callback)(struct dl_phdr_info *, size_t,
+    void *);
+extern int dl_iterate_phdr(__dl_iterate_hdr_callback, void *);
+
+__END_DECLS
+
 #endif /* _SYS_LINK_ELF_H_ */
Index: lockf.h
===================================================================
RCS file: /home/cvs/src/sys/sys/lockf.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/lockf.h -L sys/sys/lockf.h -u -r1.1.1.1 -r1.2
--- sys/sys/lockf.h
+++ sys/sys/lockf.h
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)lockf.h	8.1 (Berkeley) 6/11/93
- * $FreeBSD: src/sys/sys/lockf.h,v 1.18.2.1 2005/10/27 18:32:39 glebius Exp $
+ * $FreeBSD: src/sys/sys/lockf.h,v 1.20 2007/05/17 16:03:14 csjp Exp $
  */
 
 #ifndef _SYS_LOCKF_H_
@@ -54,7 +54,7 @@
 	off_t	lf_start;	    /* Byte # of the start of the lock */
 	off_t	lf_end;		    /* Byte # of the end of the lock (-1=EOF) */
 	caddr_t	lf_id;		    /* Id of the resource holding the lock */
-	struct	lockf **lf_head;    /* Back pointer to the head of the locf list */
+	struct	lockf **lf_head;    /* Back pointer to the head of the lockf list */
 	struct	inode *lf_inode;    /* Back pointer to the inode */
 	struct	lockf *lf_next;	    /* Pointer to the next lock on this inode */
 	struct	locklist lf_blkhd;  /* List of requests blocked on this lock */
Index: stat.h
===================================================================
RCS file: /home/cvs/src/sys/sys/stat.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/stat.h -L sys/sys/stat.h -u -r1.1.1.1 -r1.2
--- sys/sys/stat.h
+++ sys/sys/stat.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)stat.h	8.12 (Berkeley) 6/16/95
- * $FreeBSD: src/sys/sys/stat.h,v 1.41 2005/03/22 01:19:18 das Exp $
+ * $FreeBSD: src/sys/sys/stat.h,v 1.42 2006/08/04 23:47:30 jb Exp $
  */
 
 #ifndef _SYS_STAT_H_
@@ -304,6 +304,14 @@
 
 #endif /* __BSD_VISIBLE */
 
+/*
+ * Solaris compatibility definitions.
+ */
+#ifdef _SOLARIS_C_SOURCE
+#define	stat64	stat
+#define	fstat64	fstat
+#endif
+
 #ifndef _KERNEL
 __BEGIN_DECLS
 #if __BSD_VISIBLE
Index: vmmeter.h
===================================================================
RCS file: /home/cvs/src/sys/sys/vmmeter.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/vmmeter.h -L sys/sys/vmmeter.h -u -r1.1.1.1 -r1.2
--- sys/sys/vmmeter.h
+++ sys/sys/vmmeter.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)vmmeter.h	8.2 (Berkeley) 7/10/94
- * $FreeBSD: src/sys/sys/vmmeter.h,v 1.26 2004/06/08 10:37:30 tjr Exp $
+ * $FreeBSD: src/sys/sys/vmmeter.h,v 1.34 2007/09/25 06:25:06 alc Exp $
  */
 
 #ifndef _SYS_VMMETER_H_
@@ -35,70 +35,77 @@
 
 /*
  * System wide statistics counters.
+ * Locking:
+ *      a - locked by atomic operations
+ *      c - constant after initialization
+ *      f - locked by vm_page_queue_free_mtx
+ *      p - locked by being in the PCPU and atomicity respect to interrupts
+ *      q - locked by vm_page_queue_mtx
  */
 struct vmmeter {
 	/*
 	 * General system activity.
 	 */
-	u_int v_swtch;		/* context switches */
-	u_int v_trap;		/* calls to trap */
-	u_int v_syscall;	/* calls to syscall() */
-	u_int v_intr;		/* device interrupts */
-	u_int v_soft;		/* software interrupts */
+	u_int v_swtch;		/* (p) context switches */
+	u_int v_trap;		/* (p) calls to trap */
+	u_int v_syscall;	/* (p) calls to syscall() */
+	u_int v_intr;		/* (p) device interrupts */
+	u_int v_soft;		/* (p) software interrupts */
 	/*
 	 * Virtual memory activity.
 	 */
-	u_int v_vm_faults;	/* number of address memory faults */
-	u_int v_cow_faults;	/* number of copy-on-writes */
-	u_int v_cow_optim;	/* number of optimized copy-on-writes */
-	u_int v_zfod;		/* pages zero filled on demand */
-	u_int v_ozfod;		/* optimized zero fill pages */
-	u_int v_swapin;		/* swap pager pageins */
-	u_int v_swapout;	/* swap pager pageouts */
-	u_int v_swappgsin;	/* swap pager pages paged in */
-	u_int v_swappgsout;	/* swap pager pages paged out */
-	u_int v_vnodein;	/* vnode pager pageins */
-	u_int v_vnodeout;	/* vnode pager pageouts */
-	u_int v_vnodepgsin;	/* vnode_pager pages paged in */
-	u_int v_vnodepgsout;	/* vnode pager pages paged out */
-	u_int v_intrans;	/* intransit blocking page faults */
-	u_int v_reactivated;	/* number of pages reactivated from free list */
-	u_int v_pdwakeups;	/* number of times daemon has awaken from sleep */
-	u_int v_pdpages;	/* number of pages analyzed by daemon */
-
-	u_int v_dfree;		/* pages freed by daemon */
-	u_int v_pfree;		/* pages freed by exiting processes */
-	u_int v_tfree;		/* total pages freed */
+	u_int v_vm_faults;	/* (p) address memory faults */
+	u_int v_cow_faults;	/* (p) copy-on-writes faults */
+	u_int v_cow_optim;	/* (p) optimized copy-on-writes faults */
+	u_int v_zfod;		/* (p) pages zero filled on demand */
+	u_int v_ozfod;		/* (p) optimized zero fill pages */
+	u_int v_swapin;		/* (p) swap pager pageins */
+	u_int v_swapout;	/* (p) swap pager pageouts */
+	u_int v_swappgsin;	/* (p) swap pager pages paged in */
+	u_int v_swappgsout;	/* (p) swap pager pages paged out */
+	u_int v_vnodein;	/* (p) vnode pager pageins */
+	u_int v_vnodeout;	/* (p) vnode pager pageouts */
+	u_int v_vnodepgsin;	/* (p) vnode_pager pages paged in */
+	u_int v_vnodepgsout;	/* (p) vnode pager pages paged out */
+	u_int v_intrans;	/* (p) intransit blocking page faults */
+	u_int v_reactivated;	/* (f) pages reactivated from free list */
+	u_int v_pdwakeups;	/* (f) times daemon has awaken from sleep */
+	u_int v_pdpages;	/* (q) pages analyzed by daemon */
+
+	u_int v_tcached;	/* (q) total pages cached */
+	u_int v_dfree;		/* (q) pages freed by daemon */
+	u_int v_pfree;		/* (q) pages freed by exiting processes */
+	u_int v_tfree;		/* (p) total pages freed */
 	/*
 	 * Distribution of page usages.
 	 */
-	u_int v_page_size;	/* page size in bytes */
-	u_int v_page_count;	/* total number of pages in system */
-	u_int v_free_reserved;	/* number of pages reserved for deadlock */
-	u_int v_free_target;	/* number of pages desired free */
-	u_int v_free_min;	/* minimum number of pages desired free */
-	u_int v_free_count;	/* number of pages free */
-	u_int v_wire_count;	/* number of pages wired down */
-	u_int v_active_count;	/* number of pages active */
-	u_int v_inactive_target; /* number of pages desired inactive */
-	u_int v_inactive_count;	/* number of pages inactive */
-	u_int v_cache_count;	/* number of pages on buffer cache queue */
-	u_int v_cache_min;	/* min number of pages desired on cache queue */
-	u_int v_cache_max;	/* max number of pages in cached obj */
-	u_int v_pageout_free_min;   /* min number pages reserved for kernel */
-	u_int v_interrupt_free_min; /* reserved number of pages for int code */
-	u_int v_free_severe;	/* severe depletion of pages below this pt */
+	u_int v_page_size;	/* (c) page size in bytes */
+	u_int v_page_count;	/* (c) total number of pages in system */
+	u_int v_free_reserved;	/* (c) pages reserved for deadlock */
+	u_int v_free_target;	/* (c) pages desired free */
+	u_int v_free_min;	/* (c) pages desired free */
+	u_int v_free_count;	/* (f) pages free */
+	u_int v_wire_count;	/* (a) pages wired down */
+	u_int v_active_count;	/* (q) pages active */
+	u_int v_inactive_target; /* (c) pages desired inactive */
+	u_int v_inactive_count;	/* (q) pages inactive */
+	u_int v_cache_count;	/* (f) pages on buffer cache queue */
+	u_int v_cache_min;	/* (c) min pages desired on cache queue */
+	u_int v_cache_max;	/* (c) max pages in cached obj */
+	u_int v_pageout_free_min;   /* (c) min pages reserved for kernel */
+	u_int v_interrupt_free_min; /* (c) reserved pages for int code */
+	u_int v_free_severe;	/* (c) severe page depletion point */
 	/*
 	 * Fork/vfork/rfork activity.
 	 */
-	u_int v_forks;		/* number of fork() calls */
-	u_int v_vforks;		/* number of vfork() calls */
-	u_int v_rforks;		/* number of rfork() calls */
-	u_int v_kthreads;	/* number of fork() calls by kernel */
-	u_int v_forkpages;	/* number of VM pages affected by fork() */
-	u_int v_vforkpages;	/* number of VM pages affected by vfork() */
-	u_int v_rforkpages;	/* number of VM pages affected by rfork() */
-	u_int v_kthreadpages;	/* number of VM pages affected by fork() by kernel */
+	u_int v_forks;		/* (p) fork() calls */
+	u_int v_vforks;		/* (p) vfork() calls */
+	u_int v_rforks;		/* (p) rfork() calls */
+	u_int v_kthreads;	/* (p) fork() calls by kernel */
+	u_int v_forkpages;	/* (p) VM pages affected by fork() */
+	u_int v_vforkpages;	/* (p) VM pages affected by vfork() */
+	u_int v_rforkpages;	/* (p) VM pages affected by rfork() */
+	u_int v_kthreadpages;	/* (p) VM pages affected by fork() by kernel */
 };
 #ifdef _KERNEL
 
@@ -168,7 +175,7 @@
 vm_paging_target(void)
 {
     return (
-	(cnt.v_free_target + cnt.v_cache_min) - 
+	(cnt.v_free_target + cnt.v_cache_min) -
 	(cnt.v_free_count + cnt.v_cache_count)
     );
 }
Index: select.h
===================================================================
RCS file: /home/cvs/src/sys/sys/select.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/select.h -L sys/sys/select.h -u -r1.1.1.2 -r1.2
--- sys/sys/select.h
+++ sys/sys/select.h
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/select.h,v 1.19.8.1 2006/01/13 03:11:16 marcel Exp $
+ * $FreeBSD: src/sys/sys/select.h,v 1.20 2006/01/06 22:12:46 marcel Exp $
  */
 
 #ifndef _SYS_SELECT_H_
Index: callout.h
===================================================================
RCS file: /home/cvs/src/sys/sys/callout.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/callout.h -L sys/sys/callout.h -u -r1.1.1.1 -r1.2
--- sys/sys/callout.h
+++ sys/sys/callout.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)callout.h	8.2 (Berkeley) 1/21/94
- * $FreeBSD: src/sys/sys/callout.h,v 1.28.2.1 2005/09/12 13:43:34 glebius Exp $
+ * $FreeBSD: src/sys/sys/callout.h,v 1.31 2007/09/15 12:33:24 rwatson Exp $
  */
 
 #ifndef _SYS_CALLOUT_H_
Index: pmclog.h
===================================================================
RCS file: /home/cvs/src/sys/sys/pmclog.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/pmclog.h -L sys/sys/pmclog.h -u -r1.1.1.1 -r1.2
--- sys/sys/pmclog.h
+++ sys/sys/pmclog.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2005 Joseph Koshy
+ * Copyright (c) 2005-2006, Joseph Koshy
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/pmclog.h,v 1.2 2005/06/30 19:01:26 jkoshy Exp $
+ * $FreeBSD: src/sys/sys/pmclog.h,v 1.4 2006/03/28 16:20:29 jkoshy Exp $
  */
 
 #ifndef	_SYS_PMCLOG_H_
@@ -32,10 +32,11 @@
 #include <sys/pmc.h>
 
 enum pmclog_type {
+	/* V1 ABI */
 	PMCLOG_TYPE_CLOSELOG,
 	PMCLOG_TYPE_DROPNOTIFY,
 	PMCLOG_TYPE_INITIALIZE,
-	PMCLOG_TYPE_MAPPINGCHANGE,
+	PMCLOG_TYPE_MAPPINGCHANGE, /* unused in v1 */
 	PMCLOG_TYPE_PCSAMPLE,
 	PMCLOG_TYPE_PMCALLOCATE,
 	PMCLOG_TYPE_PMCATTACH,
@@ -45,12 +46,17 @@
 	PMCLOG_TYPE_PROCEXIT,
 	PMCLOG_TYPE_PROCFORK,
 	PMCLOG_TYPE_SYSEXIT,
-	PMCLOG_TYPE_USERDATA
+	PMCLOG_TYPE_USERDATA,
+	/*
+	 * V2 ABI
+	 *
+	 * The MAP_{IN,OUT} event types obsolete the MAPPING_CHANGE
+	 * event type of the older (V1) ABI.
+	 */
+	PMCLOG_TYPE_MAP_IN,
+	PMCLOG_TYPE_MAP_OUT
 };
 
-#define	PMCLOG_MAPPING_INSERT			0x01
-#define	PMCLOG_MAPPING_DELETE			0x02
-
 /*
  * A log entry descriptor comprises of a 32 bit header and a 64 bit
  * time stamp followed by as many 32 bit words are required to record
@@ -98,15 +104,19 @@
 	uint32_t		pl_cpu;		/* enum pmc_cputype */
 } __packed;
 
-struct pmclog_mappingchange {
+struct pmclog_map_in {
 	PMCLOG_ENTRY_HEADER
-	uint32_t		pl_type;
-	uintfptr_t		pl_start;	/* 8 byte aligned */
-	uintfptr_t		pl_end;
 	uint32_t		pl_pid;
+	uintfptr_t		pl_start;	/* 8 byte aligned */
 	char			pl_pathname[PATH_MAX];
 } __packed;
 
+struct pmclog_map_out {
+	PMCLOG_ENTRY_HEADER
+	uint32_t		pl_pid;
+	uintfptr_t		pl_start;	/* 8 byte aligned */
+	uintfptr_t		pl_end;
+} __packed;
 
 struct pmclog_pcsample {
 	PMCLOG_ENTRY_HEADER
@@ -178,6 +188,8 @@
 	struct pmclog_closelog		pl_cl;
 	struct pmclog_dropnotify	pl_dn;
 	struct pmclog_initialize	pl_i;
+	struct pmclog_map_in		pl_mi;
+	struct pmclog_map_out		pl_mo;
 	struct pmclog_pcsample		pl_s;
 	struct pmclog_pmcallocate	pl_a;
 	struct pmclog_pmcattach		pl_t;
@@ -212,8 +224,10 @@
 void	pmclog_initialize(void);
 void	pmclog_process_closelog(struct pmc_owner *po);
 void	pmclog_process_dropnotify(struct pmc_owner *po);
-void	pmclog_process_mappingchange(struct pmc_owner *po, pid_t pid, int type,
-    uintfptr_t start, uintfptr_t end, char *path);
+void	pmclog_process_map_in(struct pmc_owner *po, pid_t pid,
+    uintfptr_t start, const char *path);
+void	pmclog_process_map_out(struct pmc_owner *po, pid_t pid,
+    uintfptr_t start, uintfptr_t end);
 void	pmclog_process_pcsample(struct pmc *_pm, struct pmc_sample *_ps);
 void	pmclog_process_pmcallocate(struct pmc *_pm);
 void	pmclog_process_pmcattach(struct pmc *_pm, pid_t _pid, char *_path);
Index: sysent.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sysent.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/sysent.h -L sys/sys/sysent.h -u -r1.1.1.1 -r1.2
--- sys/sys/sysent.h
+++ sys/sys/sysent.h
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/sysent.h,v 1.45 2005/05/29 20:08:39 rwatson Exp $
+ * $FreeBSD: src/sys/sys/sysent.h,v 1.55 2007/07/12 18:01:31 jhb Exp $
  */
 
 #ifndef _SYS_SYSENT_H_
@@ -34,19 +34,34 @@
 
 #include <bsm/audit.h>
 
+struct rlimit;
+struct sysent;
 struct thread;
+struct ksiginfo;
 
 typedef	int	sy_call_t(struct thread *, void *);
 
+/* Used by the machine dependent syscall() code. */
+typedef	void (*systrace_probe_func_t)(u_int32_t, int, struct sysent *, void *);
+
+/*
+ * Used by loaded syscalls to convert arguments to a DTrace array
+ * of 64-bit arguments.
+ */
+typedef	void (*systrace_args_func_t)(void *, u_int64_t *, int *);
+
+extern systrace_probe_func_t	systrace_probe_func;
+
 struct sysent {		/* system call table */
 	int	sy_narg;	/* number of arguments */
 	sy_call_t *sy_call;	/* implementing function */
 	au_event_t sy_auevent;	/* audit event associated with syscall */
+	systrace_args_func_t sy_systrace_args_func;
+				/* optional argument conversion function. */
+	u_int32_t sy_entry;	/* DTrace entry ID for systrace. */ 
+	u_int32_t sy_return;	/* DTrace return ID for systrace. */ 
 };
 
-#define SYF_ARGMASK	0x0000FFFF
-#define SYF_MPSAFE	0x00010000
-
 struct image_params;
 struct __sigset;
 struct trapframe;
@@ -64,8 +79,8 @@
 					/* translate trap-to-signal mapping */
 	int		(*sv_fixup)(register_t **, struct image_params *);
 					/* stack fixup function */
-	void		(*sv_sendsig)(void (*)(int), int, struct __sigset *,
-			    u_long);	/* send signal */
+	void		(*sv_sendsig)(void (*)(int), struct ksiginfo *, struct __sigset *);
+			    		/* send signal */
 	char 		*sv_sigcode;	/* start of sigtramp code */
 	int 		*sv_szsigcode;	/* size of sigtramp code */
 	void		(*sv_prepsyscall)(struct trapframe *, int *, u_int *,
@@ -83,7 +98,8 @@
 	int		sv_stackprot;	/* vm protection for stack */
 	register_t	*(*sv_copyout_strings)(struct image_params *);
 	void		(*sv_setregs)(struct thread *, u_long, u_long, u_long);
-	void		(*sv_fixlimits)(struct image_params *);
+	void		(*sv_fixlimit)(struct rlimit *, int);
+	u_long		*sv_maxssiz;
 };
 
 #ifdef _KERNEL
@@ -104,9 +120,17 @@
        struct  sysent old_sysent; /* old sysent */
 };
 
+#define MAKE_SYSENT(syscallname)                        \
+static struct sysent syscallname##_sysent = {           \
+    (sizeof(struct syscallname ## _args )               \
+     / sizeof(register_t)),                             \
+    (sy_call_t *)& syscallname,                         \
+    SYS_AUE_##syscallname                               \
+}
+	
 #define SYSCALL_MODULE(name, offset, new_sysent, evh, arg)     \
 static struct syscall_module_data name##_syscall_mod = {       \
-       evh, arg, offset, new_sysent, { 0, NULL }               \
+       evh, arg, offset, new_sysent, { 0, NULL, AUE_NULL }     \
 };                                                             \
                                                                \
 static moduledata_t name##_mod = {                             \
@@ -114,19 +138,21 @@
        syscall_module_handler,                                 \
        &name##_syscall_mod                                     \
 };                                                             \
-DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
+DECLARE_MODULE(name, name##_mod, SI_SUB_SYSCALLS, SI_ORDER_MIDDLE)
 
 #define SYSCALL_MODULE_HELPER(syscallname)              \
 static int syscallname##_syscall = SYS_##syscallname;   \
-static struct sysent syscallname##_sysent = {           \
-    (sizeof(struct syscallname ## _args )               \
-     / sizeof(register_t)),                             \
-    (sy_call_t *)& syscallname                          \
-};                                                      \
+MAKE_SYSENT(syscallname);                               \
 SYSCALL_MODULE(syscallname,                             \
     & syscallname##_syscall, & syscallname##_sysent,    \
     NULL, NULL);
 
+#define SYSCALL_MODULE_PRESENT(syscallname)		\
+	(sysent[SYS_##syscallname].sy_call !=		\
+			(sy_call_t *)lkmnosys &&	\
+	sysent[SYS_##syscallname].sy_call !=		\
+			(sy_call_t *)lkmressys)
+
 int    syscall_register(int *offset, struct sysent *new_sysent,
 	    struct sysent *old_sysent);
 int    syscall_deregister(int *offset, struct sysent *old_sysent);
Index: kerneldump.h
===================================================================
RCS file: /home/cvs/src/sys/sys/kerneldump.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/kerneldump.h -L sys/sys/kerneldump.h -u -r1.1.1.1 -r1.2
--- sys/sys/kerneldump.h
+++ sys/sys/kerneldump.h
@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/kerneldump.h,v 1.7 2005/06/29 22:28:46 peter Exp $
+ * $FreeBSD: src/sys/sys/kerneldump.h,v 1.8 2005/10/03 14:06:00 cognet Exp $
  */
 
 #ifndef _SYS_KERNELDUMP_H
@@ -70,6 +70,7 @@
 #define	KERNELDUMP_IA64_VERSION	1
 #define	KERNELDUMP_SPARC64_VERSION	1
 #define	KERNELDUMP_AMD64_VERSION	2
+#define KERNELDUMP_ARM_VERSION	1
 	uint64_t	dumplength;		/* excl headers */
 	uint64_t	dumptime;
 	uint32_t	blocksize;
Index: socket.h
===================================================================
RCS file: /home/cvs/src/sys/sys/socket.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/socket.h -L sys/sys/socket.h -u -r1.1.1.1 -r1.2
--- sys/sys/socket.h
+++ sys/sys/socket.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)socket.h	8.4 (Berkeley) 2/21/94
- * $FreeBSD: src/sys/sys/socket.h,v 1.88.2.1 2005/09/27 21:14:10 rwatson Exp $
+ * $FreeBSD: src/sys/sys/socket.h,v 1.95 2007/09/18 09:22:16 alfred Exp $
  */
 
 #ifndef _SYS_SOCKET_H_
@@ -208,7 +208,61 @@
 #define	AF_SCLUSTER	34		/* Sitara cluster protocol */
 #define	AF_ARP		35
 #define	AF_BLUETOOTH	36		/* Bluetooth sockets */
-#define	AF_MAX		37
+#define	AF_IEEE80211	37		/* IEEE 802.11 protocol */
+#define	AF_MAX		38
+/*
+ * When allocating a new AF_ constant, please only allocate
+ * even numbered constants for FreeBSD until 134 as odd numbered AF_
+ * constants 39-133 are now reserved for vendors.
+ */
+#define AF_VENDOR00 39
+#define AF_VENDOR01 41
+#define AF_VENDOR02 43
+#define AF_VENDOR03 45
+#define AF_VENDOR04 47
+#define AF_VENDOR05 49
+#define AF_VENDOR06 51
+#define AF_VENDOR07 53
+#define AF_VENDOR08 55
+#define AF_VENDOR09 57
+#define AF_VENDOR10 59
+#define AF_VENDOR11 61
+#define AF_VENDOR12 63
+#define AF_VENDOR13 65
+#define AF_VENDOR14 67
+#define AF_VENDOR15 69
+#define AF_VENDOR16 71
+#define AF_VENDOR17 73
+#define AF_VENDOR18 75
+#define AF_VENDOR19 77
+#define AF_VENDOR20 79
+#define AF_VENDOR21 81
+#define AF_VENDOR22 83
+#define AF_VENDOR23 85
+#define AF_VENDOR24 87
+#define AF_VENDOR25 89
+#define AF_VENDOR26 91
+#define AF_VENDOR27 93
+#define AF_VENDOR28 95
+#define AF_VENDOR29 97
+#define AF_VENDOR30 99
+#define AF_VENDOR31 101
+#define AF_VENDOR32 103
+#define AF_VENDOR33 105
+#define AF_VENDOR34 107
+#define AF_VENDOR35 109
+#define AF_VENDOR36 111
+#define AF_VENDOR37 113
+#define AF_VENDOR38 115
+#define AF_VENDOR39 117
+#define AF_VENDOR40 119
+#define AF_VENDOR41 121
+#define AF_VENDOR42 123
+#define AF_VENDOR43 125
+#define AF_VENDOR44 127
+#define AF_VENDOR45 129
+#define AF_VENDOR46 131
+#define AF_VENDOR47 133
 #endif
 
 /*
@@ -233,6 +287,7 @@
 };
 #endif
 
+#ifndef	_STRUCT_SOCKADDR_STORAGE_DECLARED
 /*
  * RFC 2553: protocol-independent placeholder for socket addresses
  */
@@ -250,6 +305,8 @@
 	__int64_t	__ss_align;	/* force desired struct alignment */
 	char		__ss_pad2[_SS_PAD2SIZE];
 };
+#define	_STRUCT_SOCKADDR_STORAGE_DECLARED
+#endif
 
 #if __BSD_VISIBLE
 /*
@@ -393,6 +450,7 @@
 #define	MSG_TRUNC	0x10		/* data discarded before delivery */
 #define	MSG_CTRUNC	0x20		/* control data lost before delivery */
 #define	MSG_WAITALL	0x40		/* wait for full request or error */
+#define MSG_NOTIFICATION 0x2000         /* SCTP notification */
 #if __BSD_VISIBLE
 #define	MSG_DONTWAIT	0x80		/* this message should be nonblocking */
 #define	MSG_EOF		0x100		/* data completes connection */
@@ -469,11 +527,13 @@
 
 /* given pointer to struct cmsghdr, return pointer to next cmsghdr */
 #define	CMSG_NXTHDR(mhdr, cmsg)	\
-	(((char *)(cmsg) + _ALIGN((cmsg)->cmsg_len) + \
+	((char *)(cmsg) == NULL ? CMSG_FIRSTHDR(mhdr) : \
+	    ((char *)(cmsg) + _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len) + \
 	  _ALIGN(sizeof(struct cmsghdr)) > \
 	    (char *)(mhdr)->msg_control + (mhdr)->msg_controllen) ? \
 	    (struct cmsghdr *)0 : \
-	    (struct cmsghdr *)((char *)(cmsg) + _ALIGN((cmsg)->cmsg_len)))
+	    (struct cmsghdr *)((char *)(cmsg) + \
+	    _ALIGN(((struct cmsghdr *)(cmsg))->cmsg_len)))
 
 /*
  * RFC 2292 requires to check msg_controllen, in case that the kernel returns
@@ -545,7 +605,8 @@
 /*
  * Sendfile-specific flag(s)
  */
-#define        SF_NODISKIO     0x00000001
+#define	SF_NODISKIO     0x00000001
+#define	SF_MNOWAIT	0x00000002
 #endif
 
 #ifndef	_KERNEL
Index: _types.h
===================================================================
RCS file: /home/cvs/src/sys/sys/_types.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/_types.h -L sys/sys/_types.h -u -r1.1.1.1 -r1.2
--- sys/sys/_types.h
+++ sys/sys/_types.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/_types.h,v 1.21 2005/03/22 01:19:17 das Exp $
+ * $FreeBSD: src/sys/sys/_types.h,v 1.23 2006/03/01 06:29:34 davidxu Exp $
  */
 
 #ifndef _SYS__TYPES_H_
@@ -57,7 +57,8 @@
 typedef	__uint8_t	__sa_family_t;
 typedef	__uint32_t	__socklen_t;
 typedef	long		__suseconds_t;	/* microseconds (signed) */
-typedef	__int32_t	__timer_t;	/* timer_gettime()... */
+typedef	struct __timer	*__timer_t;	/* timer_gettime()... */
+typedef	struct __mq	*__mqd_t;	/* mq_open()... */
 typedef	__uint32_t	__uid_t;
 typedef	unsigned int	__useconds_t;	/* microseconds (unsigned) */
 
Index: runq.h
===================================================================
RCS file: /home/cvs/src/sys/sys/runq.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/runq.h -L sys/sys/runq.h -u -r1.1.1.1 -r1.2
--- sys/sys/runq.h
+++ sys/sys/runq.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/runq.h,v 1.6 2005/01/07 02:29:24 imp Exp $
+ * $FreeBSD: src/sys/sys/runq.h,v 1.10 2007/02/08 01:52:24 jeff Exp $
  */
 
 #ifndef	_RUNQ_H_
@@ -31,7 +31,7 @@
 
 #include <machine/runq.h>
 
-struct kse;
+struct td_sched;
 
 /*
  * Run queue parameters.
@@ -43,7 +43,7 @@
 /*
  * Head of run queues.
  */
-TAILQ_HEAD(rqhead, kse);
+TAILQ_HEAD(rqhead, td_sched);
 
 /*
  * Bit array which maintains the status of a run queue.  When a queue is
@@ -62,10 +62,13 @@
 	struct	rqhead rq_queues[RQ_NQS];
 };
 
-void	runq_add(struct runq *, struct kse *, int flags);
+void	runq_add(struct runq *, struct td_sched *, int);
+void	runq_add_pri(struct runq *, struct td_sched *, u_char, int);
 int	runq_check(struct runq *);
-struct	kse *runq_choose(struct runq *);
+struct	td_sched *runq_choose(struct runq *);
+struct	td_sched *runq_choose_from(struct runq *, u_char);
 void	runq_init(struct runq *);
-void	runq_remove(struct runq *, struct kse *);
+void	runq_remove(struct runq *, struct td_sched *);
+void	runq_remove_idx(struct runq *, struct td_sched *, u_char *);
 
 #endif
Index: taskqueue.h
===================================================================
RCS file: /home/cvs/src/sys/sys/taskqueue.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/taskqueue.h -L sys/sys/taskqueue.h -u -r1.2 -r1.3
--- sys/sys/taskqueue.h
+++ sys/sys/taskqueue.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: /repoman/r/ncvs/src/sys/sys/taskqueue.h,v 1.14.2.3 2006/07/06 08:32:50 glebius Exp $
+ * $FreeBSD: src/sys/sys/taskqueue.h,v 1.16 2006/01/14 01:55:24 scottl Exp $
  */
 
 #ifndef _SYS_TASKQUEUE_H_
@@ -50,7 +50,7 @@
 struct proc;
 struct taskqueue *taskqueue_create(const char *name, int mflags,
 				    taskqueue_enqueue_fn enqueue,
-				    void *context, struct proc **);
+				    void *context);
 int	taskqueue_start_threads(struct taskqueue **tqp, int count, int pri,
 				const char *name, ...) __printflike(4, 5);
 int	taskqueue_enqueue(struct taskqueue *queue, struct task *task);
@@ -92,7 +92,7 @@
 taskqueue_define_##name(void *arg)					\
 {									\
 	taskqueue_##name =						\
-	    taskqueue_create(#name, M_NOWAIT, (enqueue), (context), NULL);\
+	    taskqueue_create(#name, M_NOWAIT, (enqueue), (context));	\
 	init;								\
 }									\
 									\
Index: filio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/filio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/filio.h -L sys/sys/filio.h -u -r1.1.1.1 -r1.2
--- sys/sys/filio.h
+++ sys/sys/filio.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)filio.h	8.1 (Berkeley) 3/28/94
- * $FreeBSD: src/sys/sys/filio.h,v 1.9 2005/03/08 21:32:19 phk Exp $
+ * $FreeBSD: src/sys/sys/filio.h,v 1.10 2007/04/05 21:10:53 pjd Exp $
  */
 
 #ifndef	_SYS_FILIO_H_
@@ -55,5 +55,8 @@
 	void	*buf;
 };
 #define	FIODGNAME	_IOW('f', 120, struct fiodgname_arg) /* get dev. name */
+/* Handle lseek SEEK_DATA and SEEK_HOLE for holey file knowledge. */
+#define	FIOSEEKDATA	_IOWR('f', 97, off_t)	/* SEEK_DATA */
+#define	FIOSEEKHOLE	_IOWR('f', 98, off_t)	/* SEEK_HOLE */
 
 #endif /* !_SYS_FILIO_H_ */
Index: unpcb.h
===================================================================
RCS file: /home/cvs/src/sys/sys/unpcb.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/unpcb.h -L sys/sys/unpcb.h -u -r1.1.1.1 -r1.2
--- sys/sys/unpcb.h
+++ sys/sys/unpcb.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)unpcb.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/unpcb.h,v 1.19 2005/04/13 00:01:46 mdodd Exp $
+ * $FreeBSD: src/sys/sys/unpcb.h,v 1.22 2007/02/26 20:47:51 rwatson Exp $
  */
 
 #ifndef _SYS_UNPCB_H_
@@ -78,6 +78,8 @@
 	unp_gen_t unp_gencnt;		/* generation count of this instance */
 	int	unp_flags;		/* flags */
 	struct	xucred unp_peercred;	/* peer credentials, if applicable */
+	u_int	unp_refcount;
+	struct	mtx unp_mtx;		/* mutex */
 };
 
 /*
@@ -98,6 +100,14 @@
 #define	UNP_WANTCRED			0x004	/* credentials wanted */
 #define	UNP_CONNWAIT			0x008	/* connect blocks until accepted */
 
+/*
+ * These flags are used to handle non-atomicity in connect() and bind()
+ * operations on a socket: in particular, to avoid races between multiple
+ * threads or processes operating simultaneously on the same socket.
+ */
+#define	UNP_CONNECTING			0x010	/* Currently connecting. */
+#define	UNP_BINDING			0x020	/* Currently binding. */
+
 #define	sotounpcb(so)	((struct unpcb *)((so)->so_pcb))
 
 /* Hack alert -- this structure depends on <sys/socketvar.h>. */
Index: bio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/bio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/bio.h -L sys/sys/bio.h -u -r1.1.1.1 -r1.2
--- sys/sys/bio.h
+++ sys/sys/bio.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)buf.h	8.9 (Berkeley) 3/30/95
- * $FreeBSD: src/sys/sys/bio.h,v 1.144 2005/06/12 22:33:06 jeff Exp $
+ * $FreeBSD: src/sys/sys/bio.h,v 1.147 2006/10/31 21:11:21 pjd Exp $
  */
 
 #ifndef _SYS_BIO_H_
@@ -59,7 +59,7 @@
 	long	bio_bcount;		/* Valid bytes in buffer. */
 	caddr_t	bio_data;		/* Memory, superblocks, indirect etc. */
 	int	bio_error;		/* Errno for BIO_ERROR. */
-	long	bio_resid;		/* Remaining I/0 in bytes. */
+	long	bio_resid;		/* Remaining I/O in bytes. */
 	void	(*bio_done)(struct bio *);
 	void	*bio_driver1;		/* Private use by the provider. */
 	void	*bio_driver2;		/* Private use by the provider. */
@@ -78,6 +78,11 @@
 
 	bio_task_t *bio_task;		/* Task_queue handler */
 	void	*bio_task_arg;		/* Argument to above */
+#ifdef DIAGNOSTIC
+	void	*_bio_caller1;
+	void	*_bio_caller2;
+	uint8_t	_bio_cflags;
+#endif
 
 	/* XXX: these go away when bio chaining is introduced */
 	daddr_t bio_pblkno;               /* physical block number */
@@ -88,6 +93,7 @@
 #define BIO_WRITE	0x02
 #define BIO_DELETE	0x04
 #define BIO_GETATTR	0x08
+#define BIO_FLUSH	0x10
 #define BIO_CMD0	0x20	/* Available for local hacks */
 #define BIO_CMD1	0x40	/* Available for local hacks */
 #define BIO_CMD2	0x80	/* Available for local hacks */
Index: priority.h
===================================================================
RCS file: /home/cvs/src/sys/sys/priority.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/priority.h -L sys/sys/priority.h -u -r1.1.1.1 -r1.2
--- sys/sys/priority.h
+++ sys/sys/priority.h
@@ -12,7 +12,7 @@
  *    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 (name).
+ *	This product includes software developed by Henrik Vestergaard Draboel.
  * 4. The name of the author may not be used to endorse or promote products
  *    derived from this software without specific prior written permission.
  *
@@ -28,7 +28,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/priority.h,v 1.3 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/priority.h,v 1.4 2007/01/08 21:21:45 imp Exp $
  */
 
 #ifndef _SYS_PRIORITY_H_
Index: digiio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/digiio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/digiio.h -L sys/sys/digiio.h -u -r1.1.1.1 -r1.2
--- sys/sys/digiio.h
+++ sys/sys/digiio.h
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/digiio.h,v 1.4 2001/06/20 14:51:58 brian Exp $
+ * $FreeBSD: src/sys/sys/digiio.h,v 1.5 2006/09/27 19:57:02 ru Exp $
  */
 
 /*
@@ -59,7 +59,7 @@
 
 #define	DIGIIO_REINIT		_IO('e', 'A')
 #define	DIGIIO_DEBUG		_IOW('e', 'B', int)
-#define	DIGIIO_RING		_IO('e', 'C')
+#define	DIGIIO_RING		_IOWINT('e', 'C')
 #define	DIGIIO_MODEL		_IOR('e', 'D', enum digi_model)
 #define	DIGIIO_IDENT		_IOW('e', 'E', char *)
 #define	DIGIIO_SETALTPIN	_IOW('e', 'F', int)
Index: resourcevar.h
===================================================================
RCS file: /home/cvs/src/sys/sys/resourcevar.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/resourcevar.h -L sys/sys/resourcevar.h -u -r1.1.1.1 -r1.2
--- sys/sys/resourcevar.h
+++ sys/sys/resourcevar.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)resourcevar.h	8.4 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/sys/resourcevar.h,v 1.47 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/resourcevar.h,v 1.52 2007/06/09 21:48:44 attilio Exp $
  */
 
 #ifndef	_SYS_RESOURCEVAR_H_
@@ -47,12 +47,11 @@
  * Locking key:
  *      b - created at fork, never changes
  *      c - locked by proc mtx
- *      j - locked by sched_lock mtx
+ *      j - locked by proc slock
  *      k - only accessed by curthread
  */
 struct pstats {
-#define	pstat_startzero	p_ru
-	struct	rusage p_ru;		/* Stats for this process. */
+#define	pstat_startzero	p_cru
 	struct	rusage p_cru;		/* Stats for reaped children. */
 	struct	itimerval p_timer[3];	/* (j) Virtual-time timers. */
 #define	pstat_endzero	pstat_startcopy
@@ -78,13 +77,8 @@
 struct plimit {
 	struct	rlimit pl_rlimit[RLIM_NLIMITS];
 	int	pl_refcnt;		/* number of references */
-	struct	mtx *pl_mtx;
 };
 
-#define	LIM_LOCK(lim)		mtx_lock((lim)->pl_mtx)
-#define	LIM_UNLOCK(lim)		mtx_unlock((lim)->pl_mtx)
-#define	LIM_LOCK_ASSERT(lim, f)	mtx_assert((lim)->pl_mtx, (f))
-
 /*-
  * Per uid resource consumption
  *
@@ -109,8 +103,8 @@
 struct rusage_ext;
 struct thread;
 
-void	 addupc_intr(struct thread *td, uintptr_t pc, u_int ticks);
-void	 addupc_task(struct thread *td, uintptr_t pc, u_int ticks);
+void	 addupc_intr(struct thread *td, uintfptr_t pc, u_int ticks);
+void	 addupc_task(struct thread *td, uintfptr_t pc, u_int ticks);
 void	 calccru(struct proc *p, struct timeval *up, struct timeval *sp);
 void	 calcru(struct proc *p, struct timeval *up, struct timeval *sp);
 int	 chgproccnt(struct uidinfo *uip, int diff, int maxval);
@@ -121,6 +115,7 @@
 	*lim_alloc(void);
 void	 lim_copy(struct plimit *dst, struct plimit *src);
 rlim_t	 lim_cur(struct proc *p, int which);
+void	 lim_fork(struct proc *p1, struct proc *p2);
 void	 lim_free(struct plimit *limp);
 struct plimit
 	*lim_hold(struct plimit *limp);
@@ -128,6 +123,11 @@
 void	 lim_rlimit(struct proc *p, int which, struct rlimit *rlp);
 void	 ruadd(struct rusage *ru, struct rusage_ext *rux, struct rusage *ru2,
 	    struct rusage_ext *rux2);
+void	 rucollect(struct rusage *ru, struct rusage *ru2);
+void	 rufetch(struct proc *p, struct rusage *ru);
+void	 rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up,
+	    struct timeval *sp);
+void	 ruxagg(struct rusage_ext *rux, struct thread *td);
 int	 suswintr(void *base, int word);
 struct uidinfo
 	*uifind(uid_t uid);
Index: snoop.h
===================================================================
RCS file: /home/cvs/src/sys/sys/snoop.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/snoop.h -L sys/sys/snoop.h -u -r1.1.1.1 -r1.2
--- sys/sys/snoop.h
+++ sys/sys/snoop.h
@@ -12,7 +12,7 @@
  *
  * Snoop stuff.
  *
- * $FreeBSD: src/sys/sys/snoop.h,v 1.24.2.1 2005/09/24 13:19:20 cognet Exp $
+ * $FreeBSD: src/sys/sys/snoop.h,v 1.25 2005/09/18 19:23:35 cognet Exp $
  */
 
 #ifndef _SYS_SNOOP_H_
Index: acct.h
===================================================================
RCS file: /home/cvs/src/sys/sys/acct.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/acct.h -L sys/sys/acct.h -u -r1.1.1.1 -r1.2
--- sys/sys/acct.h
+++ sys/sys/acct.h
@@ -32,51 +32,94 @@
  * SUCH DAMAGE.
  *
  *	@(#)acct.h	8.4 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/sys/acct.h,v 1.18 2004/06/17 17:16:52 phk Exp $
+ * $FreeBSD: src/sys/sys/acct.h,v 1.19 2007/05/22 06:51:37 dds Exp $
  */
 
 #ifndef _SYS_ACCT_H_
 #define _SYS_ACCT_H_
 
+#ifdef _KERNEL
+#define float uint32_t
+#endif
+
+#define AC_COMM_LEN 16
+
 /*
- * Accounting structures; these use a comp_t type which is a 3 bits base 8
- * exponent, 13 bit fraction ``floating point'' number.  Units are 1/AHZ
- * seconds.
+ * Accounting structure version 2 (current).
+ * The first byte is always zero.
+ * Time units are microseconds.
  */
-typedef u_int16_t comp_t;
 
-#define AC_COMM_LEN 16
-struct acct {
+struct acctv2 {
+	uint8_t   ac_zero;		/* zero identifies new version */
+	uint8_t   ac_version;		/* record version number */
+	uint16_t  ac_len;		/* record length */
+
 	char	  ac_comm[AC_COMM_LEN];	/* command name */
-	comp_t	  ac_utime;		/* user time */
-	comp_t	  ac_stime;		/* system time */
-	comp_t	  ac_etime;		/* elapsed time */
+	float	  ac_utime;		/* user time */
+	float	  ac_stime;		/* system time */
+	float	  ac_etime;		/* elapsed time */
 	time_t	  ac_btime;		/* starting time */
 	uid_t	  ac_uid;		/* user id */
 	gid_t	  ac_gid;		/* group id */
-	u_int16_t ac_mem;		/* average memory usage */
-	comp_t	  ac_io;		/* count of IO blocks */
+	float	  ac_mem;		/* average memory usage */
+	float	  ac_io;		/* count of IO blocks */
 	__dev_t   ac_tty;		/* controlling tty */
 
+	uint16_t  ac_len2;		/* record length */
+	union {
+		__dev_t	  ac_align;	/* force v1 compatible alignment */
+
 #define	AFORK	0x01			/* forked but not exec'ed */
 /* ASU is no longer supported */
 #define	ASU	0x02			/* used super-user permissions */
 #define	ACOMPAT	0x04			/* used compatibility mode */
 #define	ACORE	0x08			/* dumped core */
 #define	AXSIG	0x10			/* killed by a signal */
-	u_int8_t  ac_flag;		/* accounting flags */
+#define ANVER	0x20			/* new record version */
+
+		uint8_t   ac_flag;	/* accounting flags */
+	} ac_trailer;
+
+#define ac_flagx ac_trailer.ac_flag
+};
+
+
+/*
+ * Legacy accounting structure (rev. 1.5-1.18).
+ * The first byte is always non-zero.
+ * Some fields use a comp_t type which is a 3 bits base 8
+ * exponent, 13 bit fraction ``floating point'' number.
+ * Units are 1/AHZV1 seconds.
+ */
+
+typedef uint16_t comp_t;
+
+struct acctv1 {
+	char	  ac_comm[AC_COMM_LEN];	/* command name */
+	comp_t	  ac_utime;		/* user time */
+	comp_t	  ac_stime;		/* system time */
+	comp_t	  ac_etime;		/* elapsed time */
+	time_t	  ac_btime;		/* starting time */
+	uid_t	  ac_uid;		/* user id */
+	gid_t	  ac_gid;		/* group id */
+	uint16_t  ac_mem;		/* average memory usage */
+	comp_t	  ac_io;		/* count of IO blocks */
+	__dev_t   ac_tty;		/* controlling tty */
+	uint8_t   ac_flag;		/* accounting flags */
 };
 
 /*
- * 1/AHZ is the granularity of the data encoded in the comp_t fields.
+ * 1/AHZV1 is the granularity of the data encoded in the comp_t fields.
  * This is not necessarily equal to hz.
  */
-#define	AHZ	64
+#define	AHZV1	64
 
 #ifdef _KERNEL
 struct thread;
 
 int	acct_process(struct thread *td);
+#undef float
 #endif
 
 #endif /* !_SYS_ACCT_H_ */
Index: interrupt.h
===================================================================
RCS file: /home/cvs/src/sys/sys/interrupt.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/interrupt.h -L sys/sys/interrupt.h -u -r1.2 -r1.3
--- sys/sys/interrupt.h
+++ sys/sys/interrupt.h
@@ -23,7 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/interrupt.h,v 1.30.2.2.2.1 2006/04/13 18:45:49 jhb Exp $
+ * $FreeBSD: src/sys/sys/interrupt.h,v 1.37 2007/05/06 17:02:50 piso Exp $
  */
 
 #ifndef _SYS_INTERRUPT_H_
@@ -32,15 +32,9 @@
 #include <sys/_lock.h>
 #include <sys/_mutex.h>
 
-/* Compatibility shims */
-#define	tty_intr_event	tty_ithd
-#define	clk_intr_event	clk_ithd
-#define	ithd		intr_event
-#define	ithread_destroy		intr_event_destroy
-#define	ithread_remove_handler	intr_event_remove_handler
-
 struct intr_event;
 struct intr_thread;
+struct trapframe;
 
 /*
  * Describe a hardware interrupt handler.
@@ -49,6 +43,7 @@
  * together.
  */
 struct intr_handler {
+	driver_filter_t	*ih_filter;	/* Filter function. */
 	driver_intr_t	*ih_handler;	/* Handler function. */
 	void		*ih_argument;	/* Argument to pass to handler. */
 	int		 ih_flags;
@@ -57,10 +52,10 @@
 	int		 ih_need;	/* Needs service. */
 	TAILQ_ENTRY(intr_handler) ih_next; /* Next handler for this event. */
 	u_char		 ih_pri;	/* Priority of this handler. */
+	struct intr_thread *ih_thread;	/* Ithread for filtered handler. */
 };
 
 /* Interrupt handle flags kept in ih_flags */
-#define	IH_FAST		0x00000001	/* Fast interrupt. */
 #define	IH_EXCLUSIVE	0x00000002	/* Exclusive interrupt. */
 #define	IH_ENTROPY	0x00000004	/* Device is a good entropy source. */
 #define	IH_DEAD		0x00000008	/* Handler should be removed. */
@@ -78,9 +73,14 @@
 	void		*ie_source;	/* Cookie used by MD code. */
 	struct intr_thread *ie_thread;	/* Thread we are connected to. */
 	void		(*ie_enable)(void *);
+#ifdef INTR_FILTER
+	void		(*ie_eoi)(void *);
+	void		(*ie_disab)(void *);
+#endif
 	int		ie_flags;
 	int		ie_count;	/* Loop counter. */
-	int		ie_warned;	/* Warned about interrupt storm. */
+	int		ie_warncnt;	/* Rate-check interrupt storm warns. */
+	struct timeval	ie_warntm;
 };
 
 /* Interrupt event flags kept in ie_flags. */
@@ -118,16 +118,34 @@
 #ifdef DDB
 void	db_dump_intr_event(struct intr_event *ie, int handlers);
 #endif
+#ifdef INTR_FILTER
+int     intr_filter_loop(struct intr_event *ie, struct trapframe *frame, 
+			 struct intr_thread **ithd);
+int     intr_event_handle(struct intr_event *ie, struct trapframe *frame);
+#endif
 u_char	intr_priority(enum intr_type flags);
 int	intr_event_add_handler(struct intr_event *ie, const char *name,
-	    driver_intr_t handler, void *arg, u_char pri, enum intr_type flags,
-	    void **cookiep);
+	    driver_filter_t filter, driver_intr_t handler, void *arg, 
+	    u_char pri, enum intr_type flags, void **cookiep);	    
+#ifndef INTR_FILTER
 int	intr_event_create(struct intr_event **event, void *source,
 	    int flags, void (*enable)(void *), const char *fmt, ...)
 	    __printflike(5, 6);
+#else
+int	intr_event_create(struct intr_event **event, void *source,
+	    int flags, void (*enable)(void *), void (*eoi)(void *), 
+	    void (*disab)(void *), const char *fmt, ...)
+	    __printflike(7, 8);
+#endif
 int	intr_event_destroy(struct intr_event *ie);
 int	intr_event_remove_handler(void *cookie);
+#ifndef INTR_FILTER
 int	intr_event_schedule_thread(struct intr_event *ie);
+#else
+int	intr_event_schedule_thread(struct intr_event *ie,
+	    struct intr_thread *ithd);
+#endif
+void	*intr_handler_source(void *cookie);
 int	swi_add(struct intr_event **eventp, const char *name,
 	    driver_intr_t handler, void *arg, int pri, enum intr_type flags,
 	    void **cookiep);
Index: domain.h
===================================================================
RCS file: /home/cvs/src/sys/sys/domain.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/domain.h -L sys/sys/domain.h -u -r1.1.1.1 -r1.2
--- sys/sys/domain.h
+++ sys/sys/domain.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)domain.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/sys/sys/domain.h,v 1.21 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/domain.h,v 1.22 2006/08/07 12:02:43 rwatson Exp $
  */
 
 #ifndef _SYS_DOMAIN_H_
@@ -66,7 +66,6 @@
 #ifdef _KERNEL
 extern int	domain_init_status;
 extern struct	domain *domains;
-extern struct	domain localdomain;
 extern void	net_add_domain(void *);
 
 #define DOMAIN_SET(name) \
Index: buf.h
===================================================================
RCS file: /home/cvs/src/sys/sys/buf.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/buf.h -L sys/sys/buf.h -u -r1.1.1.1 -r1.2
--- sys/sys/buf.h
+++ sys/sys/buf.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)buf.h	8.9 (Berkeley) 3/30/95
- * $FreeBSD: src/sys/sys/buf.h,v 1.187.2.3 2005/10/04 04:41:26 truckman Exp $
+ * $FreeBSD: src/sys/sys/buf.h,v 1.196 2007/03/08 06:44:34 julian Exp $
  */
 
 #ifndef _SYS_BUF_H_
@@ -135,6 +135,10 @@
 	struct	vm_page *b_pages[btoc(MAXPHYS)];
 	int		b_npages;
 	struct	workhead b_dep;		/* (D) List of filesystem dependencies. */
+	void	*b_fsprivate1;
+	void	*b_fsprivate2;
+	void	*b_fsprivate3;
+	int	b_pin_count;
 };
 
 #define b_object	b_bufobj->bo_object
@@ -212,9 +216,9 @@
 #define	B_RELBUF	0x00400000	/* Release VMIO buffer. */
 #define	B_00800000	0x00800000	/* Available flag. */
 #define	B_01000000	0x01000000	/* Available flag. */
-#define	B_02000000	0x02000000	/* Available flag. */
+#define	B_NEEDSGIANT	0x02000000	/* Buffer's vnode needs giant. */
 #define	B_PAGING	0x04000000	/* volatile paging I/O -- bypass VMIO */
-#define	B_08000000	0x08000000	/* Available flag. */
+#define B_MANAGED	0x08000000	/* Managed by FS. */
 #define B_RAM		0x10000000	/* Read ahead mark (flag) */
 #define B_VMIO		0x20000000	/* VMIO flag */
 #define B_CLUSTER	0x40000000	/* pagein op, so swap() can count it */
@@ -338,8 +342,7 @@
 {
 	struct thread *td = curthread;
 
-	if ((td != PCPU_GET(idlethread))
-	&& bp->b_lock.lk_lockholder == td)
+	if (!TD_IS_IDLETHREAD(td) && bp->b_lock.lk_lockholder == td)
 		td->td_locks--;
 	bp->b_lock.lk_lockholder = LK_KERNPROC;
 }
@@ -367,6 +370,17 @@
 	return ret;
 }
 
+
+/*
+ * Find out the number of waiters on a lock.
+ */
+static __inline int BUF_LOCKWAITERS(struct buf *);
+static __inline int
+BUF_LOCKWAITERS(struct buf *bp)
+{
+	return (lockwaiters(&bp->b_lock));
+}
+
 #endif /* _KERNEL */
 
 struct buf_queue_head {
@@ -468,6 +482,10 @@
 extern int	maxbcache;		/* Max KVA for buffer cache */
 extern int	runningbufspace;
 extern int	hibufspace;
+extern int	dirtybufthresh;
+extern int	bdwriteskip;
+extern int	dirtybufferflushes;
+extern int	altbufferflushes;
 extern int      buf_maxio;              /* nominal maximum I/O for buffer */
 extern struct	buf *buf;		/* The buffer headers. */
 extern char	*buffers;		/* The buffer contents. */
@@ -486,6 +504,7 @@
 void	bremfree(struct buf *);
 void	bremfreef(struct buf *);	/* XXX Force bremfree, only for nfs. */
 int	bread(struct vnode *, daddr_t, int, struct ucred *, struct buf **);
+void	breada(struct vnode *, daddr_t *, int *, int, struct ucred *);
 int	breadn(struct vnode *, daddr_t, int, daddr_t *, int *, int,
 	    struct ucred *, struct buf **);
 void	bdwrite(struct buf *);
@@ -504,6 +523,7 @@
 int	bufwait(struct buf *);
 int	bufwrite(struct buf *);
 void	bufdone(struct buf *);
+void	bufdone_finish(struct buf *);
 
 int	cluster_read(struct vnode *, u_quad_t, daddr_t, long,
 	    struct ucred *, long, int, struct buf **);
@@ -527,6 +547,9 @@
 struct	buf *trypbuf(int *);
 void	bwait(struct buf *, u_char, const char *);
 void	bdone(struct buf *);
+void	bpin(struct buf *);
+void	bunpin(struct buf *);
+void 	bunpin_wait(struct buf *);
 
 #endif /* _KERNEL */
 
Index: clock.h
===================================================================
RCS file: /home/cvs/src/sys/sys/clock.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/clock.h -L sys/sys/clock.h -u -r1.1.1.1 -r1.2
--- sys/sys/clock.h
+++ sys/sys/clock.h
@@ -35,19 +35,38 @@
  *
  *	$NetBSD: clock_subr.h,v 1.7 2000/10/03 13:41:07 tsutsui Exp $
  *
- * $FreeBSD: src/sys/sys/clock.h,v 1.1 2002/04/04 23:39:08 tmm Exp $
+ * $FreeBSD: src/sys/sys/clock.h,v 1.7 2006/10/24 10:27:23 phk Exp $
  */
 
 #ifndef _SYS_CLOCK_H_
 #define _SYS_CLOCK_H_
 
+#ifdef _KERNEL		/* No user serviceable parts */
+
+/*
+ * Kernel to clock driver interface.
+ */
+void	inittodr(time_t base);
+void	resettodr(void);
+void	startrtclock(void);
+
+extern int	disable_rtc_set;
+
+/*
+ * Timezone info from settimeofday(2), usually not used
+ */
+extern int tz_minuteswest;
+extern int tz_dsttime;
+
+int utc_offset(void);
+
 /*
  * Structure to hold the values typically reported by time-of-day clocks.
  * This can be passed to the generic conversion functions to be converted
  * to a struct timespec.
  */
 struct clocktime {
-	int	year;			/* year - 1900 */
+	int	year;			/* year (4 digit year) */
 	int	mon;			/* month (1 - 12) */
 	int	day;			/* day (1 - 31) */
 	int	hour;			/* hour (0 - 23) */
@@ -64,8 +83,8 @@
 /*
  * BCD to decimal and decimal to BCD.
  */
-#define	FROMBCD(x)	(((x) >> 4) * 10 + ((x) & 0xf))
-#define	TOBCD(x)	(((x) / 10 * 16) + ((x) % 10))
+#define	FROMBCD(x)	bcd2bin(x)
+#define	TOBCD(x)	bin2bcd(x)
 
 /* Some handy constants. */
 #define SECDAY		(24 * 60 * 60)
@@ -74,4 +93,9 @@
 /* Traditional POSIX base year */
 #define	POSIX_BASE_YEAR	1970
 
+void timespec2fattime(struct timespec *tsp, int utc, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp);
+void fattime2timespec(unsigned dd, unsigned dt, unsigned dh, int utc, struct timespec *tsp);
+
+#endif /* _KERNEL */
+
 #endif /* !_SYS_CLOCK_H_ */
Index: event.h
===================================================================
RCS file: /home/cvs/src/sys/sys/event.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/event.h -L sys/sys/event.h -u -r1.1.1.1 -r1.2
--- sys/sys/event.h
+++ sys/sys/event.h
@@ -23,12 +23,14 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/event.h,v 1.32 2005/07/01 16:28:32 ssouhlal Exp $
+ * $FreeBSD: src/sys/sys/event.h,v 1.37.4.1 2008/01/28 10:43:11 dumbbell Exp $
  */
 
 #ifndef _SYS_EVENT_H_
 #define _SYS_EVENT_H_
 
+#include <sys/queue.h> 
+
 #define EVFILT_READ		(-1)
 #define EVFILT_WRITE		(-2)
 #define EVFILT_AIO		(-3)	/* attached to aio requests */
@@ -38,8 +40,8 @@
 #define EVFILT_TIMER		(-7)	/* timers */
 #define EVFILT_NETDEV		(-8)	/* network devices */
 #define EVFILT_FS		(-9)	/* filesystem events */
-
-#define EVFILT_SYSCOUNT		9
+#define EVFILT_LIO		(-10)	/* attached to lio requests */
+#define EVFILT_SYSCOUNT		10
 
 #define EV_SET(kevp_, a, b, c, d, e, f) do {	\
 	struct kevent *kevp = (kevp_);		\
@@ -114,13 +116,6 @@
 #define NOTE_LINKDOWN	0x0002			/* link is down */
 #define NOTE_LINKINV	0x0004			/* link state is invalid */
 
-/*
- * This is currently visible to userland to work around broken
- * programs which pull in <sys/proc.h>.
- */
-#include <sys/queue.h> 
-#include <sys/_lock.h>
-#include <sys/_mutex.h>
 struct knote;
 SLIST_HEAD(klist, knote);
 struct kqueue;
@@ -186,6 +181,8 @@
 	union {
 		struct		file *p_fp;	/* file data pointer */
 		struct		proc *p_proc;	/* proc pointer */
+		struct		aiocblist *p_aio;	/* AIO job pointer */
+		struct		aioliojob *p_lio;	/* LIO job pointer */ 
 	} kn_ptr;
 	struct			filterops *kn_fop;
 	void			*kn_hook;
@@ -223,8 +220,8 @@
 #define knlist_delete(knl, td, islocked)			\
 		knlist_cleardel((knl), (td), (islocked), 1)
 extern void	knote_fdclose(struct thread *p, int fd);
-extern int 	kqueue_register(struct kqueue *kq,
-		    struct kevent *kev, struct thread *p, int waitok);
+extern int 	kqfd_register(int fd, struct kevent *kev, struct thread *p,
+		    int waitok);
 extern int	kqueue_add_filteropts(int filt, struct filterops *filtops);
 extern int	kqueue_del_filteropts(int filt);
 
@@ -235,7 +232,7 @@
 
 __BEGIN_DECLS
 int     kqueue(void);
-int     kevent(int kq, struct kevent *changelist, int nchanges,
+int     kevent(int kq, const struct kevent *changelist, int nchanges,
 	    struct kevent *eventlist, int nevents,
 	    const struct timespec *timeout);
 __END_DECLS
Index: iconv.h
===================================================================
RCS file: /home/cvs/src/sys/sys/iconv.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/iconv.h -L sys/sys/iconv.h -u -r1.1.1.1 -r1.2
--- sys/sys/iconv.h
+++ sys/sys/iconv.h
@@ -29,7 +29,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/iconv.h,v 1.11.2.1 2005/09/08 15:48:35 imura Exp $
+ * $FreeBSD: src/sys/sys/iconv.h,v 1.12 2005/09/05 17:03:40 imura Exp $
  */
 #ifndef _SYS_ICONV_H_
 #define _SYS_ICONV_H_
Index: mbuf.h
===================================================================
RCS file: /home/cvs/src/sys/sys/mbuf.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -L sys/sys/mbuf.h -L sys/sys/mbuf.h -u -r1.3 -r1.4
--- sys/sys/mbuf.h
+++ sys/sys/mbuf.h
@@ -1,6 +1,7 @@
 /*-
  * Copyright (c) 1982, 1986, 1988, 1993
- *	The Regents of the University of California.  All rights reserved.
+ *	The 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
@@ -27,7 +28,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)mbuf.h	8.5 (Berkeley) 2/19/95
- * $FreeBSD: src/sys/sys/mbuf.h,v 1.170.2.6 2006/03/23 23:24:32 sam Exp $
+ * $FreeBSD: src/sys/sys/mbuf.h,v 1.217 2007/10/06 21:42:39 kmacy Exp $
  */
 
 #ifndef _SYS_MBUF_H_
@@ -44,13 +45,13 @@
 #endif
 
 /*
- * Mbufs are of a single size, MSIZE (sys/param.h), which
- * includes overhead.  An mbuf may add a single "mbuf cluster" of size
- * MCLBYTES (also in sys/param.h), which has no additional overhead
- * and is used instead of the internal data area; this is done when
- * at least MINCLSIZE of data must be stored.  Additionally, it is possible
- * to allocate a separate buffer externally and attach it to the mbuf in
- * a way similar to that of mbuf clusters.
+ * Mbufs are of a single size, MSIZE (sys/param.h), which includes overhead.
+ * An mbuf may add a single "mbuf cluster" of size MCLBYTES (also in
+ * sys/param.h), which has no additional overhead and is used instead of the
+ * internal data area; this is done when at least MINCLSIZE of data must be
+ * stored.  Additionally, it is possible to allocate a separate buffer
+ * externally and attach it to the mbuf in a way similar to that of mbuf
+ * clusters.
  */
 #define	MLEN		(MSIZE - sizeof(struct m_hdr))	/* normal data len */
 #define	MHLEN		(MLEN - sizeof(struct pkthdr))	/* data len w/pkthdr */
@@ -76,16 +77,23 @@
 };
 #endif /* _KERNEL */
 
+#if defined(__LP64__)
+#define M_HDR_PAD    6
+#else
+#define M_HDR_PAD    2
+#endif
+
 /*
  * Header present at the beginning of every mbuf.
  */
 struct m_hdr {
-	struct	mbuf *mh_next;		/* next buffer in chain */
-	struct	mbuf *mh_nextpkt;	/* next chain in queue/record */
-	caddr_t	mh_data;		/* location of data */
-	int	mh_len;			/* amount of data in this mbuf */
-	int	mh_flags;		/* flags; see below */
-	short	mh_type;		/* type of data in this mbuf */
+	struct mbuf	*mh_next;	/* next buffer in chain */
+	struct mbuf	*mh_nextpkt;	/* next chain in queue/record */
+	caddr_t		 mh_data;	/* location of data */
+	int		 mh_len;	/* amount of data in this mbuf */
+	int		 mh_flags;	/* flags; see below */
+	short		 mh_type;	/* type of data in this mbuf */
+	uint8_t          pad[M_HDR_PAD];/* word align                  */
 };
 
 /*
@@ -103,41 +111,44 @@
  * Record/packet header in first mbuf of chain; valid only if M_PKTHDR is set.
  */
 struct pkthdr {
-	struct	ifnet *rcvif;		/* rcv interface */
-	int	len;			/* total packet length */
+	struct ifnet	*rcvif;		/* rcv interface */
 	/* variables for ip and tcp reassembly */
-	void	*header;		/* pointer to packet header */
+	void		*header;	/* pointer to packet header */
+	int		 len;		/* total packet length */
 	/* variables for hardware checksum */
-	int	csum_flags;		/* flags regarding checksum */
-	int	csum_data;		/* data field used by csum routines */
+	int		 csum_flags;	/* flags regarding checksum */
+	int		 csum_data;	/* data field used by csum routines */
+	u_int16_t	 tso_segsz;	/* TSO segment size */
+	u_int16_t	 ether_vtag;	/* Ethernet 802.1p+q vlan tag */
 	SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */
 };
 
 /*
- * Description of external storage mapped into mbuf; valid only if M_EXT is set.
+ * Description of external storage mapped into mbuf; valid only if M_EXT is
+ * set.
  */
 struct m_ext {
-	caddr_t	ext_buf;		/* start of buffer */
-	void	(*ext_free)		/* free routine if not the usual */
-		    (void *, void *);
-	void	*ext_args;		/* optional argument pointer */
-	u_int	ext_size;		/* size of buffer, for ext_free */
-	volatile u_int *ref_cnt;	/* pointer to ref count info */
-	int	ext_type;		/* type of external storage */
+	caddr_t		 ext_buf;	/* start of buffer */
+	void		(*ext_free)	/* free routine if not the usual */
+			    (void *, void *);
+	void		*ext_args;	/* optional argument pointer */
+	u_int		 ext_size;	/* size of buffer, for ext_free */
+	volatile u_int	*ref_cnt;	/* pointer to ref count info */
+	int		 ext_type;	/* type of external storage */
 };
 
 /*
- * The core of the mbuf object along with some shortcut defines for
- * practical purposes.
+ * The core of the mbuf object along with some shortcut defines for practical
+ * purposes.
  */
 struct mbuf {
-	struct	m_hdr m_hdr;
+	struct m_hdr	m_hdr;
 	union {
 		struct {
-			struct	pkthdr MH_pkthdr;	/* M_PKTHDR set */
+			struct pkthdr	MH_pkthdr;	/* M_PKTHDR set */
 			union {
-				struct	m_ext MH_ext;	/* M_EXT set */
-				char	MH_databuf[MHLEN];
+				struct m_ext	MH_ext;	/* M_EXT set */
+				char		MH_databuf[MHLEN];
 			} MH_dat;
 		} MH;
 		char	M_databuf[MLEN];		/* !M_PKTHDR, !M_EXT */
@@ -167,6 +178,7 @@
 #define	M_PROTO3	0x0040	/* protocol-specific */
 #define	M_PROTO4	0x0080	/* protocol-specific */
 #define	M_PROTO5	0x0100	/* protocol-specific */
+#define	M_NOTIFICATION	M_PROTO5/* SCTP notification */
 #define	M_SKIP_FIREWALL	0x4000	/* skip firewall processing */
 #define	M_FREELIST	0x8000	/* mbuf is on the free list */
 
@@ -178,17 +190,20 @@
 #define	M_FRAG		0x0800	/* packet is a fragment of a larger packet */
 #define	M_FIRSTFRAG	0x1000	/* packet is first fragment */
 #define	M_LASTFRAG	0x2000	/* packet is last fragment */
-#define	M_VLANTAG	0x10000	/* packet has VLAN tag attached */
+#define	M_VLANTAG	0x10000	/* ether_vtag is valid */
+#define	M_PROMISC	0x20000	/* packet was not for us */
+#define	M_NOFREE	0x40000	/* do not free mbuf - it is embedded in the cluster */
 
 /*
  * External buffer types: identify ext_buf type.
  */
 #define	EXT_CLUSTER	1	/* mbuf cluster */
 #define	EXT_SFBUF	2	/* sendfile(2)'s sf_bufs */
-#define	EXT_PACKET	3	/* came out of Packet zone */
-#define	EXT_JUMBOP	4	/* jumbo cluster 4096 bytes */
-#define	EXT_JUMBO9	5	/* jumbo cluster 9216 bytes */
-#define	EXT_JUMBO16	6	/* jumbo cluster 16184 bytes */
+#define	EXT_JUMBOP	3	/* jumbo cluster 4096 bytes */
+#define	EXT_JUMBO9	4	/* jumbo cluster 9216 bytes */
+#define	EXT_JUMBO16	5	/* jumbo cluster 16184 bytes */
+#define	EXT_PACKET	6	/* mbuf+cluster from packet zone */
+#define	EXT_MBUF	7	/* external mbuf reference (M_IOVEC) */
 #define	EXT_NET_DRV	100	/* custom ext_buf provided by net driver(s) */
 #define	EXT_MOD_TYPE	200	/* custom module's ext_buf type */
 #define	EXT_DISPOSABLE	300	/* can throw this buffer away w/page flipping */
@@ -200,16 +215,23 @@
 #define	M_COPYFLAGS	(M_PKTHDR|M_EOR|M_RDONLY|M_PROTO1|M_PROTO1|M_PROTO2|\
 			    M_PROTO3|M_PROTO4|M_PROTO5|M_SKIP_FIREWALL|\
 			    M_BCAST|M_MCAST|M_FRAG|M_FIRSTFRAG|M_LASTFRAG|\
-			    M_VLANTAG)
+			    M_VLANTAG|M_PROMISC)
 
 /*
- * Flags indicating hw checksum support and sw checksum requirements.
+ * Flags to purge when crossing layers.
+ */
+#define	M_PROTOFLAGS	(M_PROTO1|M_PROTO2|M_PROTO3|M_PROTO4|M_PROTO5)
+
+/*
+ * Flags indicating hw checksum support and sw checksum requirements.  This
+ * field can be directly tested against if_data.ifi_hwassist.
  */
 #define	CSUM_IP			0x0001		/* will csum IP */
 #define	CSUM_TCP		0x0002		/* will csum TCP */
 #define	CSUM_UDP		0x0004		/* will csum UDP */
 #define	CSUM_IP_FRAGS		0x0008		/* will csum IP fragments */
 #define	CSUM_FRAGMENT		0x0010		/* will do IP fragmentation */
+#define	CSUM_TSO		0x0020		/* will do TSO */
 
 #define	CSUM_IP_CHECKED		0x0100		/* did csum IP */
 #define	CSUM_IP_VALID		0x0200		/*   ... the csum is valid */
@@ -224,23 +246,8 @@
  */
 #define	MT_NOTMBUF	0	/* USED INTERNALLY ONLY! Object is not mbuf */
 #define	MT_DATA		1	/* dynamic (data) allocation */
-#define	MT_HEADER	2	/* packet header */
-#if 0
-#define	MT_SOCKET	3	/* socket structure */
-#define	MT_PCB		4	/* protocol control block */
-#define	MT_RTABLE	5	/* routing tables */
-#define	MT_HTABLE	6	/* IMP host tables */
-#define	MT_ATABLE	7	/* address resolution tables */
-#endif
+#define	MT_HEADER	MT_DATA	/* packet header, use M_PKTHDR instead */
 #define	MT_SONAME	8	/* socket name */
-#if 0
-#define	MT_SOOPTS	10	/* socket options */
-#endif
-#define	MT_FTABLE	11	/* fragment reassembly header */
-#if 0
-#define	MT_RIGHTS	12	/* access rights */
-#define	MT_IFADDR	13	/* interface address */
-#endif
 #define	MT_CONTROL	14	/* extra-data protocol message */
 #define	MT_OOBDATA	15	/* expedited data  */
 #define	MT_NTYPES	16	/* number of mbuf types for mbtypes[] */
@@ -248,8 +255,13 @@
 #define	MT_NOINIT	255	/* Not a type but a flag to allocate
 				   a non-initialized mbuf */
 
+#define MB_NOTAGS	0x1UL	/* no tags attached to mbuf */
+
 /*
  * General mbuf allocator statistics structure.
+ *
+ * Many of these statistics are no longer used; we instead track many
+ * allocator statistics through UMA's built in statistics mechanism.
  */
 struct mbstat {
 	u_long	m_mbufs;	/* XXX */
@@ -280,11 +292,10 @@
  * - M_DONTWAIT or M_NOWAIT from an interrupt handler to not block allocation.
  * - M_WAIT or M_WAITOK or M_TRYWAIT from wherever it is safe to block.
  *
- * M_DONTWAIT/M_NOWAIT means that we will not block the thread explicitly
- * and if we cannot allocate immediately we may return NULL,
- * whereas M_WAIT/M_WAITOK/M_TRYWAIT means that if we cannot allocate
- * resources we will block until they are available, and thus never
- * return NULL.
+ * M_DONTWAIT/M_NOWAIT means that we will not block the thread explicitly and
+ * if we cannot allocate immediately we may return NULL, whereas
+ * M_WAIT/M_WAITOK/M_TRYWAIT means that if we cannot allocate resources we
+ * will block until they are available, and thus never return NULL.
  *
  * XXX Eventually just phase this out to use M_WAITOK/M_NOWAIT.
  */
@@ -300,59 +311,23 @@
  */
 #define	MBUF_MEM_NAME		"mbuf"
 #define	MBUF_CLUSTER_MEM_NAME	"mbuf_cluster"
+#define	MBUF_PACKET_MEM_NAME	"mbuf_packet"
 #define	MBUF_JUMBOP_MEM_NAME	"mbuf_jumbo_pagesize"
 #define	MBUF_JUMBO9_MEM_NAME	"mbuf_jumbo_9k"
 #define	MBUF_JUMBO16_MEM_NAME	"mbuf_jumbo_16k"
-#define	MBUF_PACKET_MEM_NAME	"mbuf_packet"
 #define	MBUF_TAG_MEM_NAME	"mbuf_tag"
+#define	MBUF_EXTREFCNT_MEM_NAME	"mbuf_ext_refcnt"
 
 #ifdef _KERNEL
-/*-
- * mbuf external reference count management macros.
- *
- * MEXT_IS_REF(m): true if (m) is not the only mbuf referencing
- *     the external buffer ext_buf.
- *
- * MEXT_REM_REF(m): remove reference to m_ext object.
- *
- * MEXT_ADD_REF(m): add reference to m_ext object already
- *     referred to by (m).  XXX Note that it is VERY important that you
- *     always set the second mbuf's m_ext.ref_cnt to point to the first
- *     one's (i.e., n->m_ext.ref_cnt = m->m_ext.ref_cnt) AFTER you run
- *     MEXT_ADD_REF(m).  This is because m might have a lazy initialized
- *     ref_cnt (NULL) before this is run and it will only be looked up
- *     from here.  We should make MEXT_ADD_REF() always take two mbufs
- *     as arguments so that it can take care of this itself.
- */
-#define	MEXT_IS_REF(m)	(((m)->m_ext.ref_cnt != NULL)			\
-    && (*((m)->m_ext.ref_cnt) > 1))
-
-#define	MEXT_REM_REF(m) do {						\
-	KASSERT((m)->m_ext.ref_cnt != NULL, ("m_ext refcnt lazy NULL")); \
-	KASSERT(*((m)->m_ext.ref_cnt) > 0, ("m_ext refcnt < 0"));	\
-	atomic_subtract_int((m)->m_ext.ref_cnt, 1);			\
-} while(0)
-
-#define	MEXT_ADD_REF(m)	do {						\
-	if ((m)->m_ext.ref_cnt == NULL) {				\
-		KASSERT((m)->m_ext.ext_type == EXT_CLUSTER ||		\
-		    (m)->m_ext.ext_type == EXT_PACKET,			\
-		    ("Unexpected mbuf type has lazy refcnt"));		\
-		(m)->m_ext.ref_cnt = (u_int *)uma_find_refcnt(		\
-		    zone_clust, (m)->m_ext.ext_buf);			\
-		*((m)->m_ext.ref_cnt) = 2;				\
-	} else								\
-		atomic_add_int((m)->m_ext.ref_cnt, 1);			\
-} while (0)
 
 #ifdef WITNESS
-#define MBUF_CHECKSLEEP(how) do {					\
+#define	MBUF_CHECKSLEEP(how) do {					\
 	if (how == M_WAITOK)						\
 		WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,		\
 		    "Sleeping in \"%s\"", __func__);			\
-} while(0)
+} while (0)
 #else
-#define MBUF_CHECKSLEEP(how)
+#define	MBUF_CHECKSLEEP(how)
 #endif
 
 /*
@@ -367,32 +342,95 @@
 extern uma_zone_t	zone_jumbop;
 extern uma_zone_t	zone_jumbo9;
 extern uma_zone_t	zone_jumbo16;
+extern uma_zone_t	zone_ext_refcnt;
 
+static __inline struct mbuf	*m_getcl(int how, short type, int flags);
 static __inline struct mbuf	*m_get(int how, short type);
 static __inline struct mbuf	*m_gethdr(int how, short type);
-static __inline struct mbuf	*m_getcl(int how, short type, int flags);
-static __inline struct mbuf	*m_getjcl(int how, short type, int flags, int size);
+static __inline struct mbuf	*m_getjcl(int how, short type, int flags,
+				    int size);
 static __inline struct mbuf	*m_getclr(int how, short type);	/* XXX */
 static __inline struct mbuf	*m_free(struct mbuf *m);
 static __inline void		 m_clget(struct mbuf *m, int how);
 static __inline void		*m_cljget(struct mbuf *m, int how, int size);
 static __inline void		 m_chtype(struct mbuf *m, short new_type);
 void				 mb_free_ext(struct mbuf *);
+static __inline struct mbuf	*m_last(struct mbuf *m);
+
+static __inline int
+m_gettype(int size)
+{
+	int type;
+	
+	switch (size) {
+	case MSIZE:
+		type = EXT_MBUF;
+		break;
+	case MCLBYTES:
+		type = EXT_CLUSTER;
+		break;
+#if MJUMPAGESIZE != MCLBYTES
+	case MJUMPAGESIZE:
+		type = EXT_JUMBOP;
+		break;
+#endif
+	case MJUM9BYTES:
+		type = EXT_JUMBO9;
+		break;
+	case MJUM16BYTES:
+		type = EXT_JUMBO16;
+		break;
+	default:
+		panic("%s: m_getjcl: invalid cluster size", __func__);
+	}
+
+	return (type);
+}
+
+static __inline uma_zone_t
+m_getzone(int size)
+{
+	uma_zone_t zone;
+	
+	switch (size) {
+	case MSIZE:
+		zone = zone_mbuf;
+		break;
+	case MCLBYTES:
+		zone = zone_clust;
+		break;
+#if MJUMPAGESIZE != MCLBYTES
+	case MJUMPAGESIZE:
+		zone = zone_jumbop;
+		break;
+#endif
+	case MJUM9BYTES:
+		zone = zone_jumbo9;
+		break;
+	case MJUM16BYTES:
+		zone = zone_jumbo16;
+		break;
+	default:
+		panic("%s: m_getjcl: invalid cluster type", __func__);
+	}
+
+	return (zone);
+}
 
-static __inline
-struct mbuf *
+static __inline struct mbuf *
 m_get(int how, short type)
 {
 	struct mb_args args;
 
 	args.flags = 0;
 	args.type = type;
-	return (uma_zalloc_arg(zone_mbuf, &args, how));
+	return ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, &args, how)));
 }
 
-/* XXX This should be depracated, very little use */
-static __inline
-struct mbuf *
+/*
+ * XXX This should be deprecated, very little use.
+ */
+static __inline struct mbuf *
 m_getclr(int how, short type)
 {
 	struct mbuf *m;
@@ -403,37 +441,36 @@
 	m = uma_zalloc_arg(zone_mbuf, &args, how);
 	if (m != NULL)
 		bzero(m->m_data, MLEN);
-	return m;
+	return (m);
 }
 
-static __inline
-struct mbuf *
+static __inline struct mbuf *
 m_gethdr(int how, short type)
 {
 	struct mb_args args;
 
 	args.flags = M_PKTHDR;
 	args.type = type;
-	return (uma_zalloc_arg(zone_mbuf, &args, how));
+	return ((struct mbuf *)(uma_zalloc_arg(zone_mbuf, &args, how)));
 }
 
-static __inline
-struct mbuf *
+static __inline struct mbuf *
 m_getcl(int how, short type, int flags)
 {
 	struct mb_args args;
 
 	args.flags = flags;
 	args.type = type;
-	return (uma_zalloc_arg(zone_pack, &args, how));
+	return ((struct mbuf *)(uma_zalloc_arg(zone_pack, &args, how)));
 }
 
 /*
  * m_getjcl() returns an mbuf with a cluster of the specified size attached.
  * For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES.
+ *
+ * XXX: This is rather large, should be real function maybe.
  */
-static __inline	/* XXX: This is rather large, should be real function maybe. */
-struct mbuf *
+static __inline struct mbuf *
 m_getjcl(int how, short type, int flags, int size)
 {
 	struct mb_args args;
@@ -445,69 +482,63 @@
 
 	m = uma_zalloc_arg(zone_mbuf, &args, how);
 	if (m == NULL)
-		return NULL;
+		return (NULL);
 
-	switch (size) {
-	case MCLBYTES:
-		zone = zone_clust;
-		break;
-#if MJUMPAGESIZE != MCLBYTES
-	case MJUMPAGESIZE:
-		zone = zone_jumbop;
-		break;
-#endif
-	case MJUM9BYTES:
-		zone = zone_jumbo9;
-		break;
-	case MJUM16BYTES:
-		zone = zone_jumbo16;
-		break;
-	default:
-		panic("%s: m_getjcl: invalid cluster type", __func__);
-	}
+	zone = m_getzone(size);
 	n = uma_zalloc_arg(zone, m, how);
 	if (n == NULL) {
 		uma_zfree(zone_mbuf, m);
-		return NULL;
+		return (NULL);
 	}
-	return m;
+	return (m);
+}
+
+static __inline void
+m_free_fast(struct mbuf *m)
+{
+	KASSERT(SLIST_EMPTY(&m->m_pkthdr.tags), ("doing fast free of mbuf with tags"));
+
+	uma_zfree_arg(zone_mbuf, m, (void *)MB_NOTAGS);
 }
 
-static __inline
-struct mbuf *
+static __inline struct mbuf *
 m_free(struct mbuf *m)
 {
 	struct mbuf *n = m->m_next;
 
-#ifdef INVARIANTS
-	m->m_flags |= M_FREELIST;
-#endif
 	if (m->m_flags & M_EXT)
 		mb_free_ext(m);
-	else
+	else if ((m->m_flags & M_NOFREE) == 0)
 		uma_zfree(zone_mbuf, m);
-	return n;
+	return (n);
 }
 
-static __inline
-void
+static __inline void
 m_clget(struct mbuf *m, int how)
 {
 
-	m->m_ext.ext_buf = NULL;
+	if (m->m_flags & M_EXT)
+		printf("%s: %p mbuf already has cluster\n", __func__, m);
+	m->m_ext.ext_buf = (char *)NULL;
 	uma_zalloc_arg(zone_clust, m, how);
+	/*
+	 * On a cluster allocation failure, drain the packet zone and retry,
+	 * we might be able to loosen a few clusters up on the drain.
+	 */
+	if ((how & M_NOWAIT) && (m->m_ext.ext_buf == NULL)) {
+		zone_drain(zone_pack);
+		uma_zalloc_arg(zone_clust, m, how);
+	}
 }
 
 /*
- * m_cljget() is different from m_clget() as it can allocate clusters
- * without attaching them to an mbuf.  In that case the return value
- * is the pointer to the cluster of the requested size.  If an mbuf was
- * specified, it gets the cluster attached to it and the return value
- * can be safely ignored.
+ * m_cljget() is different from m_clget() as it can allocate clusters without
+ * attaching them to an mbuf.  In that case the return value is the pointer
+ * to the cluster of the requested size.  If an mbuf was specified, it gets
+ * the cluster attached to it and the return value can be safely ignored.
  * For size it takes MCLBYTES, MJUMPAGESIZE, MJUM9BYTES, MJUM16BYTES.
  */
-static __inline
-void *
+static __inline void *
 m_cljget(struct mbuf *m, int how, int size)
 {
 	uma_zone_t zone;
@@ -517,84 +548,128 @@
 	if (m != NULL)
 		m->m_ext.ext_buf = NULL;
 
-	switch (size) {
-	case MCLBYTES:
+	zone = m_getzone(size);
+	return (uma_zalloc_arg(zone, m, how));
+}
+
+static __inline void
+m_cljset(struct mbuf *m, void *cl, int type)
+{
+	uma_zone_t zone;
+	int size;
+	
+	switch (type) {
+	case EXT_CLUSTER:
+		size = MCLBYTES;
 		zone = zone_clust;
 		break;
 #if MJUMPAGESIZE != MCLBYTES
-	case MJUMPAGESIZE:
+	case EXT_JUMBOP:
+		size = MJUMPAGESIZE;
 		zone = zone_jumbop;
 		break;
 #endif
-	case MJUM9BYTES:
+	case EXT_JUMBO9:
+		size = MJUM9BYTES;
 		zone = zone_jumbo9;
 		break;
-	case MJUM16BYTES:
+	case EXT_JUMBO16:
+		size = MJUM16BYTES;
 		zone = zone_jumbo16;
 		break;
 	default:
-		panic("%s: m_getjcl: invalid cluster type", __func__);
+		panic("unknown cluster type");
+		break;
 	}
-	
-	return (uma_zalloc_arg(zone, m, how));
+
+	m->m_data = m->m_ext.ext_buf = cl;
+	m->m_ext.ext_free = m->m_ext.ext_args = NULL;
+	m->m_ext.ext_size = size;
+	m->m_ext.ext_type = type;
+	m->m_ext.ref_cnt = uma_find_refcnt(zone, cl);
+	m->m_flags |= M_EXT;
+
 }
 
-static __inline
-void
+static __inline void
 m_chtype(struct mbuf *m, short new_type)
 {
+
 	m->m_type = new_type;
 }
 
+static __inline struct mbuf *
+m_last(struct mbuf *m)
+{
+
+	while (m->m_next)
+		m = m->m_next;
+	return (m);
+}
+
 /*
- * mbuf, cluster, and external object allocation macros
- * (for compatibility purposes).
+ * mbuf, cluster, and external object allocation macros (for compatibility
+ * purposes).
  */
-/* NB: M_COPY_PKTHDR is deprecated.  Use M_MOVE_PKTHDR or m_dup_pktdr. */
 #define	M_MOVE_PKTHDR(to, from)	m_move_pkthdr((to), (from))
 #define	MGET(m, how, type)	((m) = m_get((how), (type)))
 #define	MGETHDR(m, how, type)	((m) = m_gethdr((how), (type)))
 #define	MCLGET(m, how)		m_clget((m), (how))
 #define	MEXTADD(m, buf, size, free, args, flags, type) 			\
     m_extadd((m), (caddr_t)(buf), (size), (free), (args), (flags), (type))
+#define	m_getm(m, len, how, type)					\
+    m_getm2((m), (len), (how), (type), M_PKTHDR)
 
 /*
- * Evaluate TRUE if it's safe to write to the mbuf m's data region (this
- * can be both the local data payload, or an external buffer area,
- * depending on whether M_EXT is set).
+ * Evaluate TRUE if it's safe to write to the mbuf m's data region (this can
+ * be both the local data payload, or an external buffer area, depending on
+ * whether M_EXT is set).
  */
-#define	M_WRITABLE(m)	(!((m)->m_flags & M_RDONLY) && (!((m)->m_flags  \
-			    & M_EXT) || !MEXT_IS_REF(m)))
+#define	M_WRITABLE(m)	(!((m)->m_flags & M_RDONLY) &&			\
+			 (!(((m)->m_flags & M_EXT)) ||			\
+			 (*((m)->m_ext.ref_cnt) == 1)) )		\
 
 /* Check if the supplied mbuf has a packet header, or else panic. */
 #define	M_ASSERTPKTHDR(m)						\
 	KASSERT(m != NULL && m->m_flags & M_PKTHDR,			\
 	    ("%s: no mbuf packet header!", __func__))
 
-/* Ensure that the supplied mbuf is a valid, non-free mbuf. */
+/*
+ * Ensure that the supplied mbuf is a valid, non-free mbuf.
+ *
+ * XXX: Broken at the moment.  Need some UMA magic to make it work again.
+ */
 #define	M_ASSERTVALID(m)						\
-	KASSERT((((struct mbuf *)m)->m_flags & M_FREELIST) == 0,	\
+	KASSERT((((struct mbuf *)m)->m_flags & 0) == 0,			\
 	    ("%s: attempted use of a free mbuf!", __func__))
 
 /*
- * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place
- * an object of the specified size at the end of the mbuf, longword aligned.
+ * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place an
+ * object of the specified size at the end of the mbuf, longword aligned.
  */
 #define	M_ALIGN(m, len) do {						\
+	KASSERT(!((m)->m_flags & (M_PKTHDR|M_EXT)),			\
+		("%s: M_ALIGN not normal mbuf", __func__));		\
+	KASSERT((m)->m_data == (m)->m_dat,				\
+		("%s: M_ALIGN not a virgin mbuf", __func__));		\
 	(m)->m_data += (MLEN - (len)) & ~(sizeof(long) - 1);		\
 } while (0)
 
 /*
- * As above, for mbufs allocated with m_gethdr/MGETHDR
- * or initialized by M_COPY_PKTHDR.
+ * As above, for mbufs allocated with m_gethdr/MGETHDR or initialized by
+ * M_DUP/MOVE_PKTHDR.
  */
 #define	MH_ALIGN(m, len) do {						\
+	KASSERT((m)->m_flags & M_PKTHDR && !((m)->m_flags & M_EXT),	\
+		("%s: MH_ALIGN not PKTHDR mbuf", __func__));		\
+	KASSERT((m)->m_data == (m)->m_pktdat,				\
+		("%s: MH_ALIGN not a virgin mbuf", __func__));		\
 	(m)->m_data += (MHLEN - (len)) & ~(sizeof(long) - 1);		\
 } while (0)
 
 /*
- * Compute the amount of space available
- * before the current start of data in an mbuf.
+ * Compute the amount of space available before the current start of data in
+ * an mbuf.
  *
  * The M_WRITABLE() is a temporary, conservative safety measure: the burden
  * of checking writability of the mbuf data area rests solely with the caller.
@@ -606,8 +681,7 @@
 	    (m)->m_data - (m)->m_dat)
 
 /*
- * Compute the amount of space available
- * after the end of data in an mbuf.
+ * Compute the amount of space available after the end of data in an mbuf.
  *
  * The M_WRITABLE() is a temporary, conservative safety measure: the burden
  * of checking writability of the mbuf data area rests solely with the caller.
@@ -619,10 +693,9 @@
 	    &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
 
 /*
- * Arrange to prepend space of size plen to mbuf m.
- * If a new mbuf must be allocated, how specifies whether to wait.
- * If the allocation fails, the original mbuf chain is freed and m is
- * set to NULL.
+ * Arrange to prepend space of size plen to mbuf m.  If a new mbuf must be
+ * allocated, how specifies whether to wait.  If the allocation fails, the
+ * original mbuf chain is freed and m is set to NULL.
  */
 #define	M_PREPEND(m, plen, how) do {					\
 	struct mbuf **_mmp = &(m);					\
@@ -642,8 +715,8 @@
 } while (0)
 
 /*
- * Change mbuf to new type.
- * This is a relatively expensive operation and should be avoided.
+ * Change mbuf to new type.  This is a relatively expensive operation and
+ * should be avoided.
  */
 #define	MCHTYPE(m, t)	m_chtype((m), (t))
 
@@ -653,12 +726,12 @@
 /* Compatibility with 4.3. */
 #define	m_copy(m, o, l)	m_copym((m), (o), (l), M_DONTWAIT)
 
-extern	int max_datalen;		/* MHLEN - max_hdr */
-extern	int max_hdr;			/* Largest link + protocol header */
-extern	int max_linkhdr;		/* Largest link-level header */
-extern	int max_protohdr;		/* Largest protocol header */
-extern	struct mbstat mbstat;		/* General mbuf stats/infos */
-extern	int nmbclusters;		/* Maximum number of clusters */
+extern int		max_datalen;	/* MHLEN - max_hdr */
+extern int		max_hdr;	/* Largest link + protocol header */
+extern int		max_linkhdr;	/* Largest link-level header */
+extern int		max_protohdr;	/* Largest protocol header */
+extern struct mbstat	mbstat;		/* General mbuf stats/infos */
+extern int		nmbclusters;	/* Maximum number of clusters */
 
 struct uio;
 
@@ -672,59 +745,61 @@
 		    void (*)(void *, void *), void *, int, int);
 void		 m_copyback(struct mbuf *, int, int, c_caddr_t);
 void		 m_copydata(const struct mbuf *, int, int, caddr_t);
-struct	mbuf	*m_copym(struct mbuf *, int, int, int);
-struct	mbuf	*m_copypacket(struct mbuf *, int);
+struct mbuf	*m_copym(struct mbuf *, int, int, int);
+struct mbuf	*m_copymdata(struct mbuf *, struct mbuf *,
+		    int, int, int, int);
+struct mbuf	*m_copypacket(struct mbuf *, int);
 void		 m_copy_pkthdr(struct mbuf *, struct mbuf *);
-struct	mbuf	*m_copyup(struct mbuf *n, int len, int dstoff);
-struct	mbuf	*m_defrag(struct mbuf *, int);
-struct	mbuf	*m_devget(char *, int, int, struct ifnet *,
+struct mbuf	*m_copyup(struct mbuf *n, int len, int dstoff);
+struct mbuf	*m_defrag(struct mbuf *, int);
+void		 m_demote(struct mbuf *, int);
+struct mbuf	*m_devget(char *, int, int, struct ifnet *,
 		    void (*)(char *, caddr_t, u_int));
-struct	mbuf	*m_dup(struct mbuf *, int);
+struct mbuf	*m_dup(struct mbuf *, int);
 int		 m_dup_pkthdr(struct mbuf *, struct mbuf *, int);
 u_int		 m_fixhdr(struct mbuf *);
-struct	mbuf	*m_fragment(struct mbuf *, int, int);
+struct mbuf	*m_fragment(struct mbuf *, int, int);
 void		 m_freem(struct mbuf *);
-struct	mbuf	*m_getm(struct mbuf *, int, int, short);
-struct	mbuf	*m_getptr(struct mbuf *, int, int *);
+struct mbuf	*m_getm2(struct mbuf *, int, int, short, int);
+struct mbuf	*m_getptr(struct mbuf *, int, int *);
 u_int		 m_length(struct mbuf *, struct mbuf **);
 void		 m_move_pkthdr(struct mbuf *, struct mbuf *);
-struct	mbuf	*m_prepend(struct mbuf *, int, int);
+struct mbuf	*m_prepend(struct mbuf *, int, int);
 void		 m_print(const struct mbuf *, int);
-struct	mbuf	*m_pulldown(struct mbuf *, int, int, int *);
-struct	mbuf	*m_pullup(struct mbuf *, int);
-struct	mbuf	*m_split(struct mbuf *, int, int);
-struct	mbuf	*m_uiotombuf(struct uio *, int, int, int);
-struct	mbuf	*m_unshare(struct mbuf *, int how);
+struct mbuf	*m_pulldown(struct mbuf *, int, int, int *);
+struct mbuf	*m_pullup(struct mbuf *, int);
+int		m_sanity(struct mbuf *, int);
+struct mbuf	*m_split(struct mbuf *, int, int);
+struct mbuf	*m_uiotombuf(struct uio *, int, int, int, int);
+struct mbuf	*m_unshare(struct mbuf *, int how);
 
 /*-
- * Network packets may have annotations attached by affixing a list
- * of "packet tags" to the pkthdr structure.  Packet tags are
- * dynamically allocated semi-opaque data structures that have
- * a fixed header (struct m_tag) that specifies the size of the
- * memory block and a <cookie,type> pair that identifies it.
- * The cookie is a 32-bit unique unsigned value used to identify
- * a module or ABI.  By convention this value is chose as the
- * date+time that the module is created, expressed as the number of
- * seconds since the epoch (e.g., using date -u +'%s').  The type value
- * is an ABI/module-specific value that identifies a particular annotation
- * and is private to the module.  For compatibility with systems
- * like OpenBSD that define packet tags w/o an ABI/module cookie,
- * the value PACKET_ABI_COMPAT is used to implement m_tag_get and
- * m_tag_find compatibility shim functions and several tag types are
- * defined below.  Users that do not require compatibility should use
- * a private cookie value so that packet tag-related definitions
- * can be maintained privately.
- *
- * Note that the packet tag returned by m_tag_alloc has the default
- * memory alignment implemented by malloc.  To reference private data
- * one can use a construct like:
+ * Network packets may have annotations attached by affixing a list of
+ * "packet tags" to the pkthdr structure.  Packet tags are dynamically
+ * allocated semi-opaque data structures that have a fixed header
+ * (struct m_tag) that specifies the size of the memory block and a
+ * <cookie,type> pair that identifies it.  The cookie is a 32-bit unique
+ * unsigned value used to identify a module or ABI.  By convention this value
+ * is chosen as the date+time that the module is created, expressed as the
+ * number of seconds since the epoch (e.g., using date -u +'%s').  The type
+ * value is an ABI/module-specific value that identifies a particular
+ * annotation and is private to the module.  For compatibility with systems
+ * like OpenBSD that define packet tags w/o an ABI/module cookie, the value
+ * PACKET_ABI_COMPAT is used to implement m_tag_get and m_tag_find
+ * compatibility shim functions and several tag types are defined below.
+ * Users that do not require compatibility should use a private cookie value
+ * so that packet tag-related definitions can be maintained privately.
+ *
+ * Note that the packet tag returned by m_tag_alloc has the default memory
+ * alignment implemented by malloc.  To reference private data one can use a
+ * construct like:
  *
  *	struct m_tag *mtag = m_tag_alloc(...);
  *	struct foo *p = (struct foo *)(mtag+1);
  *
- * if the alignment of struct m_tag is sufficient for referencing members
- * of struct foo.  Otherwise it is necessary to embed struct m_tag within
- * the private data structure to insure proper alignment; e.g.,
+ * if the alignment of struct m_tag is sufficient for referencing members of
+ * struct foo.  Otherwise it is necessary to embed struct m_tag within the
+ * private data structure to insure proper alignment; e.g.,
  *
  *	struct foo {
  *		struct m_tag	tag;
@@ -735,17 +810,16 @@
  */
 
 /*
- * Persistent tags stay with an mbuf until the mbuf is reclaimed.
- * Otherwise tags are expected to ``vanish'' when they pass through
- * a network interface.  For most interfaces this happens normally
- * as the tags are reclaimed when the mbuf is free'd.  However in
- * some special cases reclaiming must be done manually.  An example
- * is packets that pass through the loopback interface.  Also, one
- * must be careful to do this when ``turning around'' packets (e.g.,
- * icmp_reflect).
+ * Persistent tags stay with an mbuf until the mbuf is reclaimed.  Otherwise
+ * tags are expected to ``vanish'' when they pass through a network
+ * interface.  For most interfaces this happens normally as the tags are
+ * reclaimed when the mbuf is free'd.  However in some special cases
+ * reclaiming must be done manually.  An example is packets that pass through
+ * the loopback interface.  Also, one must be careful to do this when
+ * ``turning around'' packets (e.g., icmp_reflect).
  *
- * To mark a tag persistent bit-or this flag in when defining the
- * tag id.  The tag will then be treated as described above.
+ * To mark a tag persistent bit-or this flag in when defining the tag id.
+ * The tag will then be treated as described above.
  */
 #define	MTAG_PERSISTENT				0x800
 
@@ -770,22 +844,20 @@
 #define	PACKET_TAG_DIVERT			17 /* divert info */
 #define	PACKET_TAG_IPFORWARD			18 /* ipforward info */
 #define	PACKET_TAG_MACLABEL	(19 | MTAG_PERSISTENT) /* MAC label */
-#define	PACKET_TAG_PF_ROUTED			21 /* PF routed, avoid loops */
-#define	PACKET_TAG_PF_FRAGCACHE			22 /* PF fragment cached */
-#define	PACKET_TAG_PF_QID			23 /* PF ALTQ queue id */
-#define	PACKET_TAG_PF_TAG			24 /* PF tagged */
+#define	PACKET_TAG_PF				21 /* PF + ALTQ information */
 #define	PACKET_TAG_RTSOCKFAM			25 /* rtsock sa family */
-#define	PACKET_TAG_PF_TRANSLATE_LOCALHOST	26 /* PF translate localhost */
 #define	PACKET_TAG_IPOPTIONS			27 /* Saved IP options */
 #define	PACKET_TAG_CARP                         28 /* CARP info */
 
+/* Specific cookies and tags. */
+
 /* Packet tag routines. */
-struct	m_tag	*m_tag_alloc(u_int32_t, int, int, int);
+struct m_tag	*m_tag_alloc(u_int32_t, int, int, int);
 void		 m_tag_delete(struct mbuf *, struct m_tag *);
 void		 m_tag_delete_chain(struct mbuf *, struct m_tag *);
 void		 m_tag_free_default(struct m_tag *);
-struct	m_tag	*m_tag_locate(struct mbuf *, u_int32_t, int, struct m_tag *);
-struct	m_tag	*m_tag_copy(struct m_tag *, int);
+struct m_tag	*m_tag_locate(struct mbuf *, u_int32_t, int, struct m_tag *);
+struct m_tag	*m_tag_copy(struct m_tag *, int);
 int		 m_tag_copy_chain(struct mbuf *, struct mbuf *, int);
 void		 m_tag_delete_nonpersistent(struct mbuf *);
 
@@ -795,19 +867,20 @@
 static __inline void
 m_tag_init(struct mbuf *m)
 {
+
 	SLIST_INIT(&m->m_pkthdr.tags);
 }
 
 /*
- * Set up the contents of a tag.  Note that this does not
- * fill in the free method; the caller is expected to do that.
+ * Set up the contents of a tag.  Note that this does not fill in the free
+ * method; the caller is expected to do that.
  *
- * XXX probably should be called m_tag_init, but that was
- * already taken.
+ * XXX probably should be called m_tag_init, but that was already taken.
  */
 static __inline void
 m_tag_setup(struct m_tag *t, u_int32_t cookie, int type, int len)
 {
+
 	t->m_tag_id = type;
 	t->m_tag_len = len;
 	t->m_tag_cookie = cookie;
@@ -819,6 +892,7 @@
 static __inline void
 m_tag_free(struct m_tag *t)
 {
+
 	(*t->m_tag_free)(t);
 }
 
@@ -828,6 +902,7 @@
 static __inline struct m_tag *
 m_tag_first(struct mbuf *m)
 {
+
 	return (SLIST_FIRST(&m->m_pkthdr.tags));
 }
 
@@ -837,6 +912,7 @@
 static __inline struct m_tag *
 m_tag_next(struct mbuf *m, struct m_tag *t)
 {
+
 	return (SLIST_NEXT(t, m_tag_link));
 }
 
@@ -846,6 +922,7 @@
 static __inline void
 m_tag_prepend(struct mbuf *m, struct m_tag *t)
 {
+
 	SLIST_INSERT_HEAD(&m->m_pkthdr.tags, t, m_tag_link);
 }
 
@@ -855,6 +932,7 @@
 static __inline void
 m_tag_unlink(struct mbuf *m, struct m_tag *t)
 {
+
 	SLIST_REMOVE(&m->m_pkthdr.tags, t, m_tag, m_tag_link);
 }
 
@@ -870,8 +948,8 @@
 static __inline struct m_tag *
 m_tag_find(struct mbuf *m, int type, struct m_tag *start)
 {
-	return (SLIST_EMPTY(&m->m_pkthdr.tags) ?
-	    NULL : m_tag_locate(m, MTAG_ABI_COMPAT, type, start));
+	return (SLIST_EMPTY(&m->m_pkthdr.tags) ? (struct m_tag *)NULL :
+	    m_tag_locate(m, MTAG_ABI_COMPAT, type, start));
 }
 
 #endif /* _KERNEL */
Index: disk.h
===================================================================
RCS file: /home/cvs/src/sys/sys/disk.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/disk.h -L sys/sys/disk.h -u -r1.1.1.1 -r1.2
--- sys/sys/disk.h
+++ sys/sys/disk.h
@@ -6,7 +6,7 @@
  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
  * ----------------------------------------------------------------------------
  *
- * $FreeBSD: src/sys/sys/disk.h,v 1.40 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/disk.h,v 1.42 2007/05/05 17:02:19 pjd Exp $
  *
  */
 
@@ -21,8 +21,6 @@
 #include <sys/conf.h>	/* XXX: temporary to avoid breakage */
 #endif
 
-struct disk;
-struct disk *disk_enumerate(struct disk *disk);
 void disk_err(struct bio *bp, const char *what, int blkdone, int nl);
 
 #endif
@@ -68,4 +66,36 @@
 	 * which may apply to the device.
 	 */
 
+#define	DIOCGFLUSH _IO('d', 135)		/* Flush write cache */
+	/*-
+	 * Flush write cache of the device.
+	 */
+
+#define	DIOCGDELETE _IOW('d', 136, off_t[2])	/* Delete data */
+	/*-
+	 * Mark data on the device as unused.
+	 */
+
+#define	DISK_IDENT_SIZE	256
+#define	DIOCGIDENT _IOR('d', 137, char[DISK_IDENT_SIZE])
+	/*-
+	 * Get the ident of the given provider. Ident is (most of the time)
+	 * a uniqe and fixed provider's identifier. Ident's properties are as
+	 * follow:
+	 * - ident value is preserved between reboots,
+	 * - provider can be detached/attached and ident is preserved,
+	 * - provider's name can change - ident can't,
+	 * - ident value should not be based on on-disk metadata; in other
+	 *   words copying whole data from one disk to another should not
+	 *   yield the same ident for the other disk,
+	 * - there could be more than one provider with the same ident, but
+	 *   only if they point at exactly the same physical storage, this is
+	 *   the case for multipathing for example,
+	 * - GEOM classes that consumes single providers and provide single
+	 *   providers, like geli, gbde, should just attach class name to the
+	 *   ident of the underlying provider,
+	 * - ident is an ASCII string (is printable),
+	 * - ident is optional and applications can't relay on its presence.
+	 */
+
 #endif /* _SYS_DISK_H_ */
Index: namei.h
===================================================================
RCS file: /home/cvs/src/sys/sys/namei.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/namei.h -L sys/sys/namei.h -u -r1.1.1.1 -r1.2
--- sys/sys/namei.h
+++ sys/sys/namei.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)namei.h	8.5 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/sys/namei.h,v 1.47 2005/04/27 09:00:47 jeff Exp $
+ * $FreeBSD: src/sys/sys/namei.h,v 1.48 2006/02/05 15:42:01 rwatson Exp $
  */
 
 #ifndef _SYS_NAMEI_H_
@@ -139,7 +139,9 @@
 #define	NOMACCHECK	0x0800000 /* do not perform MAC checks */
 #define	MPSAFE		0x1000000 /* namei() must acquire Giant if needed. */
 #define	GIANTHELD	0x2000000 /* namei() is holding giant. */
-#define	PARAMASK	0x3fffe00 /* mask of parameter descriptors */
+#define	AUDITVNODE1	0x4000000 /* audit the looked up vnode information */
+#define	AUDITVNODE2 	0x8000000 /* audit the looked up vnode information */
+#define	PARAMASK	0xffffe00 /* mask of parameter descriptors */
 
 #define	NDHASGIANT(NDP)	(((NDP)->ni_cnd.cn_flags & GIANTHELD) != 0)
 
Index: shm.h
===================================================================
RCS file: /home/cvs/src/sys/sys/shm.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/shm.h -L sys/sys/shm.h -u -r1.1.1.1 -r1.2
--- sys/sys/shm.h
+++ sys/sys/shm.h
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/sys/shm.h,v 1.23 2005/04/02 12:33:36 das Exp $ */
+/* $FreeBSD: src/sys/sys/shm.h,v 1.24 2005/08/06 07:20:17 csjp Exp $ */
 /*	$NetBSD: shm.h,v 1.15 1994/06/29 06:45:17 cgd Exp $	*/
 
 /*-
@@ -94,11 +94,11 @@
  * might be of interest to user programs.  Do we really want/need this?
  */
 struct shminfo {
-	int	shmmax,		/* max shared memory segment size (bytes) */
-		shmmin,		/* min shared memory segment size (bytes) */
-		shmmni,		/* max number of shared memory identifiers */
-		shmseg,		/* max shared memory segments per process */
-		shmall;		/* max amount of shared memory (pages) */
+	u_long	shmmax;		/* max shared memory segment size (bytes) */
+	u_long	shmmin;		/* max shared memory segment size (bytes) */
+	u_long	shmmni;		/* max number of shared memory identifiers */
+	u_long	shmseg;		/* max shared memory segments per process */
+	u_long	shmall;		/* max amount of shared memory (pages) */
 };
 
 /* 
Index: types.h
===================================================================
RCS file: /home/cvs/src/sys/sys/types.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/types.h -L sys/sys/types.h -u -r1.1.1.1 -r1.2
--- sys/sys/types.h
+++ sys/sys/types.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)types.h	8.6 (Berkeley) 2/19/95
- * $FreeBSD: src/sys/sys/types.h,v 1.92 2005/05/31 15:18:17 rodrigc Exp $
+ * $FreeBSD: src/sys/sys/types.h,v 1.96 2006/08/04 22:54:10 jb Exp $
  */
 
 #ifndef _SYS_TYPES_H_
@@ -249,6 +249,11 @@
 #define	_TIMER_T_DECLARED
 #endif
 
+#ifndef _MQD_T_DECLARED
+typedef	__mqd_t	mqd_t;
+#define	_MQD_T_DECLARED
+#endif
+
 typedef	__u_register_t	u_register_t;
 
 #ifndef _UID_T_DECLARED
@@ -270,6 +275,7 @@
 #ifdef _KERNEL
 typedef	int		boolean_t;
 typedef	__cpumask_t	cpumask_t;
+typedef	struct device	*device_t;
 typedef	__intfptr_t	intfptr_t;
 
 /*-
@@ -291,6 +297,36 @@
 #endif /* !_KERNEL */
 
 /*
+ * Solaris compatibility definitions.
+ */
+#ifdef _SOLARIS_C_SOURCE
+typedef u_int		uint_t;
+typedef u_char		uchar_t;
+typedef u_short		ushort_t;
+typedef u_long		ulong_t;
+
+typedef	long long	longlong_t;  
+typedef unsigned long long	u_longlong_t;
+
+typedef off_t		off64_t;
+
+typedef id_t		taskid_t;
+typedef id_t		projid_t;
+typedef id_t		poolid_t;
+typedef id_t		zoneid_t;
+typedef id_t		ctid_t;
+
+#ifndef _KERNEL
+#if defined(__XOPEN_OR_POSIX)
+typedef enum { _B_FALSE, _B_TRUE } boolean_t;
+#else
+typedef enum { B_FALSE, B_TRUE } boolean_t;
+#endif /* defined(__XOPEN_OR_POSIX) */
+#endif
+
+#endif /* _SOLARIS_C_SOURCE */
+
+/*
  * The following are all things that really shouldn't exist in this header,
  * since its purpose is to provide typedefs, not miscellaneous doodads.
  */
Index: pmckern.h
===================================================================
RCS file: /home/cvs/src/sys/sys/pmckern.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/pmckern.h -L sys/sys/pmckern.h -u -r1.1.1.1 -r1.2
--- sys/sys/pmckern.h
+++ sys/sys/pmckern.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2003-2005, Joseph Koshy
+ * Copyright (c) 2003-2006, Joseph Koshy
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/pmckern.h,v 1.4.2.1 2005/08/15 18:46:13 jkoshy Exp $
+ * $FreeBSD: src/sys/sys/pmckern.h,v 1.6 2006/03/26 12:20:54 jkoshy Exp $
  */
 
 /*
@@ -43,10 +43,24 @@
 #define	PMC_FN_CSW_IN			2
 #define	PMC_FN_CSW_OUT			3
 #define	PMC_FN_DO_SAMPLES		4
+#define	PMC_FN_KLD_LOAD			5
+#define	PMC_FN_KLD_UNLOAD		6
+#define	PMC_FN_MMAP			7
+#define	PMC_FN_MUNMAP			8
 
 struct pmckern_procexec {
 	int		pm_credentialschanged;
-	uintptr_t	pm_entryaddr;
+	uintfptr_t	pm_entryaddr;
+};
+
+struct pmckern_map_in {
+	void		*pm_file;	/* filename or vnode pointer */
+	uintfptr_t	pm_address;	/* address object is loaded at */
+};
+
+struct pmckern_map_out {
+	uintfptr_t	pm_address;	/* start address of region */
+	size_t		pm_size;	/* size of unmapped region */
 };
 
 /* hook */
Index: cpu.h
===================================================================
RCS file: /home/cvs/src/sys/sys/cpu.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/cpu.h -L sys/sys/cpu.h -u -r1.1.1.1 -r1.2
--- sys/sys/cpu.h
+++ sys/sys/cpu.h
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2005 Nate Lawson (SDG)
+ * Copyright (c) 2005-2007 Nate Lawson (SDG)
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -23,12 +23,14 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/cpu.h,v 1.3 2005/02/19 06:13:25 njl Exp $
+ * $FreeBSD: src/sys/sys/cpu.h,v 1.4 2007/03/26 18:03:28 njl Exp $
  */
 
 #ifndef _SYS_CPU_H_
 #define _SYS_CPU_H_
 
+#include <sys/eventhandler.h>
+
 /*
  * CPU device support.
  */
@@ -118,6 +120,36 @@
 int	cpufreq_register(device_t dev);
 int	cpufreq_unregister(device_t dev);
 
+/*
+ * Notify the cpufreq core that the number of or values for settings have
+ * changed.
+ */
+int	cpufreq_settings_changed(device_t dev);
+
+/*
+ * Eventhandlers that are called before and after a change in frequency.
+ * The new level and the result of the change (0 is success) is passed in.
+ * If the driver wishes to revoke the change from cpufreq_pre_change, it
+ * stores a non-zero error code in the result parameter and the change will
+ * not be made.  If the post-change eventhandler gets a non-zero result, 
+ * no change was made and the previous level remains in effect.  If a change
+ * is revoked, the post-change eventhandler is still called with the error
+ * value supplied by the revoking driver.  This gives listeners who cached
+ * some data in preparation for a level change a chance to clean up.
+ */
+typedef void (*cpufreq_pre_notify_fn)(void *, const struct cf_level *, int *);
+typedef void (*cpufreq_post_notify_fn)(void *, const struct cf_level *, int);
+EVENTHANDLER_DECLARE(cpufreq_pre_change, cpufreq_pre_notify_fn);
+EVENTHANDLER_DECLARE(cpufreq_post_change, cpufreq_post_notify_fn);
+
+/*
+ * Eventhandler called when the available list of levels changed.
+ * The unit number of the device (i.e. "cpufreq0") whose levels changed
+ * is provided so the listener can retrieve the new list of levels.
+ */
+typedef void (*cpufreq_levels_notify_fn)(void *, int);
+EVENTHANDLER_DECLARE(cpufreq_levels_changed, cpufreq_levels_notify_fn);
+
 /* Allow values to be +/- a bit since sometimes we have to estimate. */
 #define CPUFREQ_CMP(x, y)	(abs((x) - (y)) < 25)
 
Index: sem.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sem.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/sem.h -L sys/sys/sem.h -u -r1.1.1.1 -r1.2
--- sys/sys/sem.h
+++ sys/sys/sem.h
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/sys/sem.h,v 1.29 2004/11/17 13:12:06 rwatson Exp $ */
+/* $FreeBSD: src/sys/sys/sem.h,v 1.31 2006/11/07 18:56:48 jhb Exp $ */
 /*	$NetBSD: sem.h,v 1.5 1994/06/29 06:45:15 cgd Exp $	*/
 
 /*
@@ -12,7 +12,20 @@
 
 #include <sys/ipc.h>
 
-struct sem;
+#ifndef _PID_T_DECLARED
+typedef	__pid_t		pid_t;
+#define	_PID_T_DECLARED
+#endif
+
+#ifndef _SIZE_T_DECLARED
+typedef	__size_t	size_t;
+#define	_SIZE_T_DECLARED
+#endif
+
+#ifndef _TIME_T_DECLARED
+typedef	__time_t	time_t;
+#define	_TIME_T_DECLARED
+#endif
 
 struct semid_ds {
 	struct ipc_perm	sem_perm;	/* operation permission struct */
@@ -100,21 +113,8 @@
  * Process sem_undo vectors at proc exit.
  */
 void	semexit(struct proc *p);
-#endif /* _KERNEL */
 
-#ifndef _KERNEL
-#include <sys/cdefs.h>
-#include <sys/_types.h>
-
-#ifndef _SIZE_T_DECLARED
-typedef __size_t        size_t;
-#define _SIZE_T_DECLARED
-#endif
-
-#ifndef _PID_T_DECLARED
-typedef __pid_t         pid_t;
-#define _PID_T_DECLARED
-#endif
+#else /* ! _KERNEL */
 
 __BEGIN_DECLS
 int semsys(int, ...);
@@ -122,6 +122,7 @@
 int semget(key_t, int, int);
 int semop(int, struct sembuf *, size_t);
 __END_DECLS
+
 #endif /* !_KERNEL */
 
 #endif /* !_SYS_SEM_H_ */
Index: signalvar.h
===================================================================
RCS file: /home/cvs/src/sys/sys/signalvar.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/signalvar.h -L sys/sys/signalvar.h -u -r1.1.1.1 -r1.2
--- sys/sys/signalvar.h
+++ sys/sys/signalvar.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)signalvar.h	8.6 (Berkeley) 2/19/95
- * $FreeBSD: src/sys/sys/signalvar.h,v 1.68 2005/01/07 02:29:24 imp Exp $
+ * $FreeBSD: src/sys/sys/signalvar.h,v 1.77.4.1 2008/01/19 18:15:06 kib Exp $
  */
 
 #ifndef _SYS_SIGNALVAR_H_
@@ -199,14 +199,56 @@
 	return (1);
 }
 
-#ifdef _KERNEL
+struct osigevent {
+	int	sigev_notify;		/* Notification type */
+	union {
+		int	__sigev_signo;	/* Signal number */
+		int	__sigev_notify_kqueue;
+	} __sigev_u;
+	union sigval sigev_value;	/* Signal value */
+};
 
-/*
- * Specifies the target of a signal.
- *	P - Doesn't matter which thread it gets delivered to.
- *	TD - Must be delivered to a specific thread.
- */
-typedef enum sigtarget_enum { SIGTARGET_P, SIGTARGET_TD } sigtarget_t;
+typedef struct ksiginfo {
+	TAILQ_ENTRY(ksiginfo)	ksi_link;
+	siginfo_t		ksi_info;
+	int			ksi_flags;
+	struct sigqueue		*ksi_sigq;
+} ksiginfo_t;
+
+#define ksi_signo	ksi_info.si_signo
+#define ksi_errno	ksi_info.si_errno
+#define ksi_code	ksi_info.si_code
+#define ksi_pid		ksi_info.si_pid
+#define ksi_uid		ksi_info.si_uid
+#define ksi_status      ksi_info.si_status
+#define ksi_addr        ksi_info.si_addr
+#define ksi_value	ksi_info.si_value
+#define ksi_band	ksi_info.si_band
+#define ksi_trapno	ksi_info.si_trapno
+#define ksi_overrun	ksi_info.si_overrun
+#define ksi_timerid	ksi_info.si_timerid
+#define ksi_mqd		ksi_info.si_mqd
+
+/* bits for ksi_flags */
+#define KSI_TRAP	0x01	/* Generated by trap. */
+#define	KSI_EXT		0x02	/* Externally managed ksi. */
+#define KSI_INS		0x04	/* Directly insert ksi, not the copy */
+#define	KSI_COPYMASK	KSI_TRAP
+
+#define	KSI_ONQ(ksi)	((ksi)->ksi_sigq != NULL)
+
+typedef struct sigqueue {
+	sigset_t	sq_signals;	/* All pending signals. */
+	sigset_t	sq_kill;	/* Legacy depth 1 queue. */
+	TAILQ_HEAD(, ksiginfo)	sq_list;/* Queued signal info. */
+	struct proc	*sq_proc;
+	int		sq_flags;
+} sigqueue_t;
+
+/* Flags for ksi_flags */
+#define	SQ_INIT	0x01
+
+#ifdef _KERNEL
 
 /* Return nonzero if process p has an unmasked pending signal. */
 #define	SIGPENDING(td)							\
@@ -230,6 +272,25 @@
 	return (1);
 }
 
+#define ksiginfo_init(ksi)			\
+do {						\
+	bzero(ksi, sizeof(ksiginfo_t));		\
+} while(0)
+
+#define ksiginfo_init_trap(ksi)			\
+do {						\
+	ksiginfo_t *kp = ksi;			\
+	bzero(kp, sizeof(ksiginfo_t));		\
+	kp->ksi_flags |= KSI_TRAP;		\
+} while(0)
+
+static __inline void
+ksiginfo_copy(ksiginfo_t *src, ksiginfo_t *dst)
+{
+	(dst)->ksi_info = src->ksi_info;
+	(dst)->ksi_flags = (src->ksi_flags & KSI_COPYMASK);
+}
+
 struct pgrp;
 struct thread;
 struct proc;
@@ -238,6 +299,7 @@
 
 extern int sugid_coredump;	/* Sysctl variable kern.sugid_coredump */
 extern struct mtx	sigio_lock;
+extern int kern_logsigexit;	/* Sysctl variable kern.logsigexit */
 
 /*
  * Lock the pointers for a sigio object in the underlying objects of
@@ -260,6 +322,7 @@
 void	pgsignal(struct pgrp *pgrp, int sig, int checkctty);
 void	postsig(int sig);
 void	psignal(struct proc *p, int sig);
+int	psignal_event(struct proc *p, struct sigevent *, ksiginfo_t *);
 struct sigacts *sigacts_alloc(void);
 void	sigacts_copy(struct sigacts *dest, struct sigacts *src);
 void	sigacts_free(struct sigacts *ps);
@@ -269,14 +332,32 @@
 int	sig_ffs(sigset_t *set);
 void	siginit(struct proc *p);
 void	signotify(struct thread *td);
-void	tdsignal(struct thread *td, int sig, sigtarget_t target);
-void	trapsignal(struct thread *td, int sig, u_long code);
+int	tdsignal(struct proc *p, struct thread *td, int sig,
+	    ksiginfo_t *ksi);
+void	trapsignal(struct thread *td, ksiginfo_t *);
 int	ptracestop(struct thread *td, int sig);
+ksiginfo_t * ksiginfo_alloc(int);
+void	ksiginfo_free(ksiginfo_t *);
+void	sigqueue_init(struct sigqueue *queue, struct proc *p);
+void	sigqueue_flush(struct sigqueue *queue);
+void	sigqueue_delete_proc(struct proc *p, int sig);
+void	sigqueue_delete_set(struct sigqueue *queue, sigset_t *set);
+void	sigqueue_delete(struct sigqueue *queue, int sig);
+void	sigqueue_move_set(struct sigqueue *src, sigqueue_t *dst, sigset_t *);
+int	sigqueue_get(struct sigqueue *queue, int sig, ksiginfo_t *info);
+int	sigqueue_add(struct sigqueue *queue, int sig, ksiginfo_t *info);
+void	sigqueue_collect_set(struct sigqueue *queue, sigset_t *set);
+void	sigqueue_move(struct sigqueue *, struct sigqueue *, int sig);
+void	sigqueue_delete_set_proc(struct proc *, sigset_t *);
+void	sigqueue_delete_stopmask_proc(struct proc *);
+void	sigqueue_take(ksiginfo_t *ksi);
+int	kern_sigtimedwait(struct thread *, sigset_t,
+		ksiginfo_t *, struct timespec *);
 
 /*
  * Machine-dependent functions:
  */
-void	sendsig(sig_t action, int sig, sigset_t *retmask, u_long code);
+void	sendsig(sig_t, ksiginfo_t *, sigset_t *retmask);
 
 #endif /* _KERNEL */
 
Index: sx.h
===================================================================
RCS file: /home/cvs/src/sys/sys/sx.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/sx.h -L sys/sys/sx.h -u -r1.2 -r1.3
--- sys/sys/sx.h
+++ sys/sys/sx.h
@@ -1,5 +1,7 @@
 /*-
- * Copyright (C) 2001 Jason Evans <jasone at freebsd.org>.  All rights reserved.
+ * Copyright (c) 2007 Attilio Rao <attilio at freebsd.org>
+ * Copyright (c) 2001 Jason Evans <jasone at freebsd.org>
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -24,42 +26,99 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  * DAMAGE.
  *
- * $FreeBSD: src/sys/sys/sx.h,v 1.21.2.1 2005/09/21 21:05:19 jhb Exp $
+ * $FreeBSD: src/sys/sys/sx.h,v 1.37 2007/07/06 13:20:44 attilio Exp $
  */
 
 #ifndef	_SYS_SX_H_
 #define	_SYS_SX_H_
 
-#include <sys/queue.h>
 #include <sys/_lock.h>
-#include <sys/condvar.h>	/* XXX */
+#include <sys/_sx.h>
+#include <sys/lock_profile.h>
 
-struct sx {
-	struct lock_object sx_object;	/* Common lock properties. */
-	struct mtx	*sx_lock;	/* General protection lock. */
-	int		sx_cnt;		/* -1: xlock, > 0: slock count. */
-	struct cv	sx_shrd_cv;	/* slock waiters. */
-	int		sx_shrd_wcnt;	/* Number of slock waiters. */
-	struct cv	sx_excl_cv;	/* xlock waiters. */
-	int		sx_excl_wcnt;	/* Number of xlock waiters. */
-	struct thread	*sx_xholder;	/* Thread presently holding xlock. */
-};
+#ifdef	_KERNEL
+#include <machine/atomic.h>
+#endif
+
+/*
+ * In general, the sx locks and rwlocks use very similar algorithms.
+ * The main difference in the implementations is how threads are
+ * blocked when a lock is unavailable.  For this, sx locks use sleep
+ * queues which do not support priority propagation, and rwlocks use
+ * turnstiles which do.
+ *
+ * The sx_lock field consists of several fields.  The low bit
+ * indicates if the lock is locked with a shared or exclusive lock.  A
+ * value of 0 indicates an exclusive lock, and a value of 1 indicates
+ * a shared lock.  Bit 1 is a boolean indicating if there are any
+ * threads waiting for a shared lock.  Bit 2 is a boolean indicating
+ * if there are any threads waiting for an exclusive lock.  Bit 3 is a
+ * boolean indicating if an exclusive lock is recursively held.  The
+ * rest of the variable's definition is dependent on the value of the
+ * first bit.  For an exclusive lock, it is a pointer to the thread
+ * holding the lock, similar to the mtx_lock field of mutexes.  For
+ * shared locks, it is a count of read locks that are held.
+ *
+ * When the lock is not locked by any thread, it is encoded as a
+ * shared lock with zero waiters.
+ *
+ * A note about memory barriers.  Exclusive locks need to use the same
+ * memory barriers as mutexes: _acq when acquiring an exclusive lock
+ * and _rel when releasing an exclusive lock.  On the other side,
+ * shared lock needs to use an _acq barrier when acquiring the lock
+ * but, since they don't update any locked data, no memory barrier is
+ * needed when releasing a shared lock.
+ */
+
+#define	SX_LOCK_SHARED			0x01
+#define	SX_LOCK_SHARED_WAITERS		0x02
+#define	SX_LOCK_EXCLUSIVE_WAITERS	0x04
+#define	SX_LOCK_RECURSED		0x08
+#define	SX_LOCK_FLAGMASK						\
+	(SX_LOCK_SHARED | SX_LOCK_SHARED_WAITERS |			\
+	SX_LOCK_EXCLUSIVE_WAITERS | SX_LOCK_RECURSED)
+
+#define	SX_OWNER(x)			((x) & ~SX_LOCK_FLAGMASK)
+#define	SX_SHARERS_SHIFT		4
+#define	SX_SHARERS(x)			(SX_OWNER(x) >> SX_SHARERS_SHIFT)
+#define	SX_SHARERS_LOCK(x)						\
+	((x) << SX_SHARERS_SHIFT | SX_LOCK_SHARED)
+#define	SX_ONE_SHARER			(1 << SX_SHARERS_SHIFT)
+
+#define	SX_LOCK_UNLOCKED		SX_SHARERS_LOCK(0)
+#define	SX_LOCK_DESTROYED						\
+	(SX_LOCK_SHARED_WAITERS | SX_LOCK_EXCLUSIVE_WAITERS)
 
 #ifdef _KERNEL
+
+/*
+ * Function prototipes.  Routines that start with an underscore are not part
+ * of the public interface and are wrappered with a macro.
+ */
 void	sx_sysinit(void *arg);
-void	sx_init(struct sx *sx, const char *description);
+#define	sx_init(sx, desc)	sx_init_flags((sx), (desc), 0)
+void	sx_init_flags(struct sx *sx, const char *description, int opts);
 void	sx_destroy(struct sx *sx);
-void	_sx_slock(struct sx *sx, const char *file, int line);
-void	_sx_xlock(struct sx *sx, const char *file, int line);
+int	_sx_slock(struct sx *sx, int opts, const char *file, int line);
+int	_sx_xlock(struct sx *sx, int opts, const char *file, int line);
 int	_sx_try_slock(struct sx *sx, const char *file, int line);
 int	_sx_try_xlock(struct sx *sx, const char *file, int line);
 void	_sx_sunlock(struct sx *sx, const char *file, int line);
 void	_sx_xunlock(struct sx *sx, const char *file, int line);
 int	_sx_try_upgrade(struct sx *sx, const char *file, int line);
 void	_sx_downgrade(struct sx *sx, const char *file, int line);
-#ifdef INVARIANT_SUPPORT
+int	_sx_xlock_hard(struct sx *sx, uintptr_t tid, int opts,
+	    const char *file, int line);
+int	_sx_slock_hard(struct sx *sx, int opts, const char *file, int line);
+void	_sx_xunlock_hard(struct sx *sx, uintptr_t tid, const char *file, int
+	    line);
+void	_sx_sunlock_hard(struct sx *sx, const char *file, int line);
+#if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
 void	_sx_assert(struct sx *sx, int what, const char *file, int line);
 #endif
+#ifdef DDB
+int	sx_chain(struct thread *td, struct thread **ownerp);
+#endif
 
 struct sx_args {
 	struct sx 	*sa_sx;
@@ -76,15 +135,119 @@
 	SYSUNINIT(name##_sx_sysuninit, SI_SUB_LOCK, SI_ORDER_MIDDLE,	\
 	    sx_destroy, (sxa))
 
-#define	sx_xlocked(sx)		((sx)->sx_cnt < 0 && (sx)->sx_xholder == curthread)
-#define	sx_slock(sx)		_sx_slock((sx), LOCK_FILE, LOCK_LINE)
-#define	sx_xlock(sx)		_sx_xlock((sx), LOCK_FILE, LOCK_LINE)
+/*
+ * Full lock operations that are suitable to be inlined in non-debug kernels.
+ * If the lock can't be acquired or released trivially then the work is
+ * deferred to 'tougher' functions.
+ */
+
+/* Acquire an exclusive lock. */
+static __inline int
+__sx_xlock(struct sx *sx, struct thread *td, int opts, const char *file,
+    int line)
+{
+	uintptr_t tid = (uintptr_t)td;
+	int error = 0;
+
+	if (!atomic_cmpset_acq_ptr(&sx->sx_lock, SX_LOCK_UNLOCKED, tid))
+		error = _sx_xlock_hard(sx, tid, opts, file, line);
+	else
+		lock_profile_obtain_lock_success(&sx->lock_object, 0, 0, file,
+		    line);
+
+	return (error);
+}
+
+/* Release an exclusive lock. */
+static __inline void
+__sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line)
+{
+	uintptr_t tid = (uintptr_t)td;
+
+	if (!atomic_cmpset_rel_ptr(&sx->sx_lock, tid, SX_LOCK_UNLOCKED))
+		_sx_xunlock_hard(sx, tid, file, line);
+}
+
+/* Acquire a shared lock. */
+static __inline int
+__sx_slock(struct sx *sx, int opts, const char *file, int line)
+{
+	uintptr_t x = sx->sx_lock;
+	int error = 0;
+
+	if (!(x & SX_LOCK_SHARED) ||
+	    !atomic_cmpset_acq_ptr(&sx->sx_lock, x, x + SX_ONE_SHARER))
+		error = _sx_slock_hard(sx, opts, file, line);
+#ifdef LOCK_PROFILING_SHARED
+	else if (SX_SHARERS(x) == 0)
+		lock_profile_obtain_lock_success(&sx->lock_object, 0, 0, file,
+		    line);
+#endif
+
+	return (error);
+}
+
+/*
+ * Release a shared lock.  We can just drop a single shared lock so
+ * long as we aren't trying to drop the last shared lock when other
+ * threads are waiting for an exclusive lock.  This takes advantage of
+ * the fact that an unlocked lock is encoded as a shared lock with a
+ * count of 0.
+ */
+static __inline void
+__sx_sunlock(struct sx *sx, const char *file, int line)
+{
+	uintptr_t x = sx->sx_lock;
+
+	if (x == (SX_SHARERS_LOCK(1) | SX_LOCK_EXCLUSIVE_WAITERS) ||
+	    !atomic_cmpset_ptr(&sx->sx_lock, x, x - SX_ONE_SHARER))
+		_sx_sunlock_hard(sx, file, line);
+}
+
+/*
+ * Public interface for lock operations.
+ */
+#ifndef LOCK_DEBUG
+#error	"LOCK_DEBUG not defined, include <sys/lock.h> before <sys/sx.h>"
+#endif
+#if	(LOCK_DEBUG > 0) || defined(SX_NOINLINE)
+#define	sx_xlock(sx)		(void)_sx_xlock((sx), 0, LOCK_FILE, LOCK_LINE)
+#define	sx_xlock_sig(sx)						\
+	_sx_xlock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE)
+#define	sx_xunlock(sx)		_sx_xunlock((sx), LOCK_FILE, LOCK_LINE)
+#define	sx_slock(sx)		(void)_sx_slock((sx), 0, LOCK_FILE, LOCK_LINE)
+#define	sx_slock_sig(sx)						\
+	_sx_slock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE)
+#define	sx_sunlock(sx)		_sx_sunlock((sx), LOCK_FILE, LOCK_LINE)
+#else
+#define	sx_xlock(sx)							\
+	(void)__sx_xlock((sx), curthread, 0, LOCK_FILE, LOCK_LINE)
+#define	sx_xlock_sig(sx)						\
+	__sx_xlock((sx), curthread, SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE)
+#define	sx_xunlock(sx)							\
+	__sx_xunlock((sx), curthread, LOCK_FILE, LOCK_LINE)
+#define	sx_slock(sx)		(void)__sx_slock((sx), 0, LOCK_FILE, LOCK_LINE)
+#define	sx_slock_sig(sx)						\
+	__sx_slock((sx), SX_INTERRUPTIBLE, LOCK_FILE, LOCK_LINE)
+#define	sx_sunlock(sx)		__sx_sunlock((sx), LOCK_FILE, LOCK_LINE)
+#endif	/* LOCK_DEBUG > 0 || SX_NOINLINE */
 #define	sx_try_slock(sx)	_sx_try_slock((sx), LOCK_FILE, LOCK_LINE)
 #define	sx_try_xlock(sx)	_sx_try_xlock((sx), LOCK_FILE, LOCK_LINE)
-#define	sx_sunlock(sx)		_sx_sunlock((sx), LOCK_FILE, LOCK_LINE)
-#define	sx_xunlock(sx)		_sx_xunlock((sx), LOCK_FILE, LOCK_LINE)
 #define	sx_try_upgrade(sx)	_sx_try_upgrade((sx), LOCK_FILE, LOCK_LINE)
 #define	sx_downgrade(sx)	_sx_downgrade((sx), LOCK_FILE, LOCK_LINE)
+
+/*
+ * Return a pointer to the owning thread if the lock is exclusively
+ * locked.
+ */
+#define	sx_xholder(sx)							\
+	((sx)->sx_lock & SX_LOCK_SHARED ? NULL :			\
+	(struct thread *)SX_OWNER((sx)->sx_lock))
+
+#define	sx_xlocked(sx)							\
+	(((sx)->sx_lock & ~(SX_LOCK_FLAGMASK & ~SX_LOCK_SHARED)) ==	\
+	    (uintptr_t)curthread)
+
 #define	sx_unlock(sx) do {						\
 	if (sx_xlocked(sx))						\
 		sx_xunlock(sx);						\
@@ -92,11 +255,39 @@
 		sx_sunlock(sx);						\
 } while (0)
 
+#define	sx_sleep(chan, sx, pri, wmesg, timo)				\
+	_sleep((chan), &(sx)->lock_object, (pri), (wmesg), (timo))
+
+/*
+ * Options passed to sx_init_flags().
+ */
+#define	SX_DUPOK		0x01
+#define	SX_NOPROFILE		0x02
+#define	SX_NOWITNESS		0x04
+#define	SX_QUIET		0x08
+#define	SX_ADAPTIVESPIN		0x10
+#define	SX_RECURSE		0x20
+
+/*
+ * Options passed to sx_*lock_hard().
+ */
+#define	SX_INTERRUPTIBLE	0x40
+
 #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT)
+#define	SA_LOCKED		LA_LOCKED
+#define	SA_SLOCKED		LA_SLOCKED
+#define	SA_XLOCKED		LA_XLOCKED
+#define	SA_UNLOCKED		LA_UNLOCKED
+#define	SA_RECURSED		LA_RECURSED
+#define	SA_NOTRECURSED		LA_NOTRECURSED
+
+/* Backwards compatability. */
 #define	SX_LOCKED		LA_LOCKED
 #define	SX_SLOCKED		LA_SLOCKED
 #define	SX_XLOCKED		LA_XLOCKED
 #define	SX_UNLOCKED		LA_UNLOCKED
+#define	SX_RECURSED		LA_RECURSED
+#define	SX_NOTRECURSED		LA_NOTRECURSED
 #endif
 
 #ifdef INVARIANTS
Index: bus.h
===================================================================
RCS file: /home/cvs/src/sys/sys/bus.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -L sys/sys/bus.h -L sys/sys/bus.h -u -r1.3 -r1.4
--- sys/sys/bus.h
+++ sys/sys/bus.h
@@ -23,12 +23,14 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/bus.h,v 1.70.2.1 2006/07/07 23:30:14 imp Exp $
+ * $FreeBSD: src/sys/sys/bus.h,v 1.78.4.1 2008/02/06 03:35:40 iwasaki Exp $
  */
 
 #ifndef _SYS_BUS_H_
 #define _SYS_BUS_H_
 
+#include <sys/_bus_dma.h>
+
 /**
  * @defgroup NEWBUS newbus - a generic framework for managing devices
  * @{
@@ -81,15 +83,11 @@
  * hook to send the message.  However, devctl_queue_data is also
  * included in case devctl_notify isn't sufficiently general.
  */
+boolean_t devctl_process_running(void);
 void devctl_notify(const char *__system, const char *__subsystem,
     const char *__type, const char *__data);
 void devctl_queue_data(char *__data);
 
-/*
- * Forward declarations
- */
-typedef struct device		*device_t;
-
 /**
  * @brief A device driver (included mainly for compatibility with
  * FreeBSD 4.x).
@@ -125,8 +123,43 @@
 #define device_method_t		kobj_method_t
 
 /**
- * @brief A driver interrupt service routine
+ * @brief Driver interrupt filter return values
+ *
+ * If a driver provides an interrupt filter routine it must return an
+ * integer consisting of oring together zero or more of the following
+ * flags:
+ *
+ *	FILTER_STRAY	- this device did not trigger the interrupt
+ *	FILTER_HANDLED	- the interrupt has been fully handled and can be EOId
+ *	FILTER_SCHEDULE_THREAD - the threaded interrupt handler should be
+ *			  scheduled to execute
+ *
+ * If the driver does not provide a filter, then the interrupt code will
+ * act is if the filter had returned FILTER_SCHEDULE_THREAD.  Note that it
+ * is illegal to specify any other flag with FILTER_STRAY and that it is
+ * illegal to not specify either of FILTER_HANDLED or FILTER_SCHEDULE_THREAD
+ * if FILTER_STRAY is not specified.
+ */
+#define	FILTER_STRAY		0x01
+#define	FILTER_HANDLED		0x02
+#define	FILTER_SCHEDULE_THREAD	0x04
+
+/**
+ * @brief Driver interrupt service routines
+ *
+ * The filter routine is run in primary interrupt context and may not
+ * block or use regular mutexes.  It may only use spin mutexes for
+ * synchronization.  The filter may either completely handle the
+ * interrupt or it may perform some of the work and defer more
+ * expensive work to the regular interrupt handler.  If a filter
+ * routine is not registered by the driver, then the regular interrupt
+ * handler is always used to handle interrupts from this device.
+ *
+ * The regular interrupt handler executes in its own thread context
+ * and may use regular mutexes.  However, it is prohibited from
+ * sleeping on a sleep queue.
  */
+typedef int driver_filter_t(void*);
 typedef void driver_intr_t(void*);
 
 /**
@@ -245,6 +278,9 @@
 
 int	bus_generic_activate_resource(device_t dev, device_t child, int type,
 				      int rid, struct resource *r);
+device_t
+	bus_generic_add_child(device_t dev, int order, const char *name,
+			      int unit);
 struct resource *
 	bus_generic_alloc_resource(device_t bus, device_t child, int type,
 				   int *rid, u_long start, u_long end,
@@ -257,6 +293,8 @@
 					int rid, struct resource *r);
 int	bus_generic_detach(device_t dev);
 void	bus_generic_driver_added(device_t dev, driver_t *driver);
+bus_dma_tag_t
+	bus_generic_get_dma_tag(device_t dev, device_t child);
 struct resource_list *
 	bus_generic_get_resource_list (device_t, device_t);
 int	bus_print_child_header(device_t dev, device_t child);
@@ -270,7 +308,8 @@
 int	bus_generic_resume(device_t dev);
 int	bus_generic_setup_intr(device_t dev, device_t child,
 			       struct resource *irq, int flags,
-			       driver_intr_t *intr, void *arg, void **cookiep);
+			       driver_filter_t *filter, driver_intr_t *intr, 
+			       void *arg, void **cookiep);
 
 struct resource *
 	bus_generic_rl_alloc_resource (device_t, device_t, int, int *,
@@ -294,6 +333,16 @@
  * Wrapper functions for the BUS_*_RESOURCE methods to make client code
  * a little simpler.
  */
+
+struct resource_spec {
+	int	type;
+	int	rid;
+	int	flags;
+};
+
+int bus_alloc_resources(device_t dev, struct resource_spec *rs, struct resource **res);
+void bus_release_resources(device_t dev, const struct resource_spec *rs, struct resource **res);
+
 struct	resource *bus_alloc_resource(device_t dev, int type, int *rid,
 				     u_long start, u_long end, u_long count,
 				     u_int flags);
@@ -301,11 +350,13 @@
 			      struct resource *r);
 int	bus_deactivate_resource(device_t dev, int type, int rid,
 				struct resource *r);
+bus_dma_tag_t bus_get_dma_tag(device_t dev);
 int	bus_release_resource(device_t dev, int type, int rid,
 			     struct resource *r);
 int	bus_free_resource(device_t dev, int type, struct resource *r);
 int	bus_setup_intr(device_t dev, struct resource *r, int flags,
-		       driver_intr_t handler, void *arg, void **cookiep);
+		       driver_filter_t filter, driver_intr_t handler, 
+		       void *arg, void **cookiep);
 int	bus_teardown_intr(device_t dev, struct resource *r, void *cookie);
 int	bus_set_resource(device_t dev, int type, int rid,
 			 u_long start, u_long count);
@@ -317,6 +368,7 @@
 int	bus_child_present(device_t child);
 int	bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen);
 int	bus_child_location_str(device_t child, char *buf, size_t buflen);
+void	bus_enumerate_hinted_children(device_t bus);
 
 static __inline struct resource *
 bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
@@ -325,22 +377,6 @@
 }
 
 /*
- * Forward compatibility define.   bus_get_dma_tag is defined in current
- * to get the parent's dma tag.  In RELENG_6 this is currently spelled NULL,
- * so provide a stop-gap compatibilty hook until this functionality is
- * merged from head (if ever) (FreeBSD)
- */
-#define bus_get_dma_tag(a) NULL
-
-/*
- * Forward compatibility define.   bus_get_dma_tag is defined in current
- * to get the parent's dma tag.  In RELENG_6 this is currently spelled NULL,
- * so provide a stop-gap compatibilty hook until this functionality is
- * merged from head (if ever) (FreeBSD)
- */
-#define bus_get_dma_tag(a) NULL
-
-/*
  * Access functions for device.
  */
 device_t	device_add_child(device_t dev, const char *name, int unit);
@@ -376,6 +412,7 @@
 int	device_print_prettyname(device_t dev);
 int	device_printf(device_t dev, const char *, ...) __printflike(2, 3);
 int	device_probe_and_attach(device_t dev);
+int	device_probe_child(device_t bus, device_t dev);
 int	device_quiesce(device_t dev);
 void	device_quiet(device_t dev);
 void	device_set_desc(device_t dev, const char* desc);
@@ -531,139 +568,139 @@
 
 /**
  * Shorthand macros, taking resource argument
+ * Generated with sys/tools/bus_macro.sh
  */
 
 #define bus_barrier(r, o, l, f) \
-	bus_space_barrier(rman_get_bustag(r), rman_get_bushandle(r), (o), (l), (f))
+	bus_space_barrier((r)->r_bustag, (r)->r_bushandle, (o), (l), (f))
 #define bus_read_1(r, o) \
-	bus_space_read_1(rman_get_bustag(r), rman_get_bushandle(r), (o))
+	bus_space_read_1((r)->r_bustag, (r)->r_bushandle, (o))
 #define bus_read_multi_1(r, o, d, c) \
-	bus_space_read_multi_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_region_1(r, o, d, c) \
-	bus_space_read_region_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_set_multi_1(r, o, v, c) \
-	bus_space_set_multi_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_set_region_1(r, o, v, c) \
-	bus_space_set_region_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_region_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_write_1(r, o, v) \
-	bus_space_write_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (v))
+	bus_space_write_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
 #define bus_write_multi_1(r, o, d, c) \
-	bus_space_write_multi_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_multi_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_write_region_1(r, o, d, c) \
-	bus_space_write_region_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_region_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_stream_1(r, o) \
-	bus_space_read_stream_1(rman_get_bustag(r), rman_get_bushandle(r), (o))
+	bus_space_read_stream_1((r)->r_bustag, (r)->r_bushandle, (o))
 #define bus_read_multi_stream_1(r, o, d, c) \
-	bus_space_read_multi_stream_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_region_stream_1(r, o, d, c) \
-	bus_space_read_region_stream_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_set_multi_stream_1(r, o, v, c) \
-	bus_space_set_multi_stream_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_set_region_stream_1(r, o, v, c) \
-	bus_space_set_region_stream_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_write_stream_1(r, o, v) \
-	bus_space_write_stream_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (v))
+	bus_space_write_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (v))
 #define bus_write_multi_stream_1(r, o, d, c) \
-	bus_space_write_multi_stream_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_multi_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_write_region_stream_1(r, o, d, c) \
-	bus_space_write_region_stream_1(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_region_stream_1((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_2(r, o) \
-	bus_space_read_2(rman_get_bustag(r), rman_get_bushandle(r), (o))
+	bus_space_read_2((r)->r_bustag, (r)->r_bushandle, (o))
 #define bus_read_multi_2(r, o, d, c) \
-	bus_space_read_multi_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_region_2(r, o, d, c) \
-	bus_space_read_region_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_set_multi_2(r, o, v, c) \
-	bus_space_set_multi_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_set_region_2(r, o, v, c) \
-	bus_space_set_region_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_region_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_write_2(r, o, v) \
-	bus_space_write_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (v))
+	bus_space_write_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
 #define bus_write_multi_2(r, o, d, c) \
-	bus_space_write_multi_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_multi_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_write_region_2(r, o, d, c) \
-	bus_space_write_region_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_region_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_stream_2(r, o) \
-	bus_space_read_stream_2(rman_get_bustag(r), rman_get_bushandle(r), (o))
+	bus_space_read_stream_2((r)->r_bustag, (r)->r_bushandle, (o))
 #define bus_read_multi_stream_2(r, o, d, c) \
-	bus_space_read_multi_stream_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_region_stream_2(r, o, d, c) \
-	bus_space_read_region_stream_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_set_multi_stream_2(r, o, v, c) \
-	bus_space_set_multi_stream_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_set_region_stream_2(r, o, v, c) \
-	bus_space_set_region_stream_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_write_stream_2(r, o, v) \
-	bus_space_write_stream_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (v))
+	bus_space_write_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (v))
 #define bus_write_multi_stream_2(r, o, d, c) \
-	bus_space_write_multi_stream_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_multi_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_write_region_stream_2(r, o, d, c) \
-	bus_space_write_region_stream_2(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_region_stream_2((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_4(r, o) \
-	bus_space_read_4(rman_get_bustag(r), rman_get_bushandle(r), (o))
+	bus_space_read_4((r)->r_bustag, (r)->r_bushandle, (o))
 #define bus_read_multi_4(r, o, d, c) \
-	bus_space_read_multi_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_region_4(r, o, d, c) \
-	bus_space_read_region_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_set_multi_4(r, o, v, c) \
-	bus_space_set_multi_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_set_region_4(r, o, v, c) \
-	bus_space_set_region_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_region_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_write_4(r, o, v) \
-	bus_space_write_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (v))
+	bus_space_write_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
 #define bus_write_multi_4(r, o, d, c) \
-	bus_space_write_multi_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_multi_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_write_region_4(r, o, d, c) \
-	bus_space_write_region_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_region_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_stream_4(r, o) \
-	bus_space_read_stream_4(rman_get_bustag(r), rman_get_bushandle(r), (o))
+	bus_space_read_stream_4((r)->r_bustag, (r)->r_bushandle, (o))
 #define bus_read_multi_stream_4(r, o, d, c) \
-	bus_space_read_multi_stream_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_region_stream_4(r, o, d, c) \
-	bus_space_read_region_stream_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_set_multi_stream_4(r, o, v, c) \
-	bus_space_set_multi_stream_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_set_region_stream_4(r, o, v, c) \
-	bus_space_set_region_stream_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_write_stream_4(r, o, v) \
-	bus_space_write_stream_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (v))
+	bus_space_write_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (v))
 #define bus_write_multi_stream_4(r, o, d, c) \
-	bus_space_write_multi_stream_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_multi_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_write_region_stream_4(r, o, d, c) \
-	bus_space_write_region_stream_4(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_region_stream_4((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_8(r, o) \
-	bus_space_read_8(rman_get_bustag(r), rman_get_bushandle(r), (o))
+	bus_space_read_8((r)->r_bustag, (r)->r_bushandle, (o))
 #define bus_read_multi_8(r, o, d, c) \
-	bus_space_read_multi_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_region_8(r, o, d, c) \
-	bus_space_read_region_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_set_multi_8(r, o, v, c) \
-	bus_space_set_multi_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_set_region_8(r, o, v, c) \
-	bus_space_set_region_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_region_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_write_8(r, o, v) \
-	bus_space_write_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (v))
+	bus_space_write_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
 #define bus_write_multi_8(r, o, d, c) \
-	bus_space_write_multi_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_multi_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_write_region_8(r, o, d, c) \
-	bus_space_write_region_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_region_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_stream_8(r, o) \
-	bus_space_read_stream_8(rman_get_bustag(r), rman_get_bushandle(r), (o))
+	bus_space_read_stream_8((r)->r_bustag, (r)->r_bushandle, (o))
 #define bus_read_multi_stream_8(r, o, d, c) \
-	bus_space_read_multi_stream_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_read_region_stream_8(r, o, d, c) \
-	bus_space_read_region_stream_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_read_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_set_multi_stream_8(r, o, v, c) \
-	bus_space_set_multi_stream_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_set_region_stream_8(r, o, v, c) \
-	bus_space_set_region_stream_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (v), (c))
+	bus_space_set_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v), (c))
 #define bus_write_stream_8(r, o, v) \
-	bus_space_write_stream_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (v))
+	bus_space_write_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (v))
 #define bus_write_multi_stream_8(r, o, d, c) \
-	bus_space_write_multi_stream_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
+	bus_space_write_multi_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #define bus_write_region_stream_8(r, o, d, c) \
-	bus_space_write_region_stream_8(rman_get_bustag(r), rman_get_bushandle(r), (o), (d), (c))
-
+	bus_space_write_region_stream_8((r)->r_bustag, (r)->r_bushandle, (o), (d), (c))
 #endif /* _KERNEL */
 
 #endif /* !_SYS_BUS_H_ */
Index: bufobj.h
===================================================================
RCS file: /home/cvs/src/sys/sys/bufobj.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/bufobj.h -L sys/sys/bufobj.h -u -r1.1.1.1 -r1.2
--- sys/sys/bufobj.h
+++ sys/sys/bufobj.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/bufobj.h,v 1.15 2005/06/10 23:50:41 green Exp $
+ * $FreeBSD: src/sys/sys/bufobj.h,v 1.18 2007/01/23 10:01:18 kib Exp $
  */
 
 /*
@@ -42,7 +42,7 @@
  * their lifetime.
  *
  * The exact relationship to the vmobject is not determined at this point,
- * it may in fact bee that we find them to be two sides of the same object 
+ * it may in fact be that we find them to be two sides of the same object 
  * once things starts to crystalize.
  */
 
@@ -70,17 +70,20 @@
 typedef void b_strategy_t(struct bufobj *, struct buf *);
 typedef int b_write_t(struct buf *);
 typedef int b_sync_t(struct bufobj *, int waitfor, struct thread *td);
+typedef void b_bdflush_t(struct bufobj *, struct buf *);
 
 struct buf_ops {
 	char		*bop_name;
 	b_write_t	*bop_write;
 	b_strategy_t	*bop_strategy;
 	b_sync_t	*bop_sync;
+	b_bdflush_t	*bop_bdflush;
 };
 
 #define BO_STRATEGY(bo, bp)	((bo)->bo_ops->bop_strategy((bo), (bp)))
 #define BO_SYNC(bo, w, td)	((bo)->bo_ops->bop_sync((bo), (w), (td)))
 #define BO_WRITE(bo, bp)	((bo)->bo_ops->bop_write((bp)))
+#define BO_BDFLUSH(bo, bp)	((bo)->bo_ops->bop_bdflush((bo), (bp)))
 
 struct bufobj {
 	struct mtx	*bo_mtx;	/* Mutex which protects "i" things */
@@ -106,6 +109,7 @@
  */
 #define	BO_ONWORKLST	(1 << 0)	/* On syncer work-list */
 #define	BO_WWAIT	(1 << 1)	/* Wait for output to complete */
+#define	BO_NEEDSGIANT	(1 << 2)	/* Require giant for child buffers. */
 
 #define	BO_LOCK(bo) \
 	do { \
@@ -129,6 +133,7 @@
 int bufobj_invalbuf(struct bufobj *bo, int flags, struct thread *td, int slpflag, int slptimeo);
 int bufobj_wwait(struct bufobj *bo, int slpflag, int timeo);
 int bufsync(struct bufobj *bo, int waitfor, struct thread *td);
+void bufbdflush(struct bufobj *bo, struct buf *bp);
 
 #endif /* defined(_KERNEL) || defined(_KVM_VNODE) */
 #endif /* _SYS_BUFOBJ_H_ */
Index: tty.h
===================================================================
RCS file: /home/cvs/src/sys/sys/tty.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/tty.h -L sys/sys/tty.h -u -r1.1.1.1 -r1.2
--- sys/sys/tty.h
+++ sys/sys/tty.h
@@ -40,7 +40,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)tty.h	8.6 (Berkeley) 1/21/94
- * $FreeBSD: src/sys/sys/tty.h,v 1.97 2004/10/18 21:51:27 phk Exp $
+ * $FreeBSD: src/sys/sys/tty.h,v 1.101 2006/01/04 09:59:06 phk Exp $
  */
 
 #ifndef _SYS_TTY_H_
@@ -253,6 +253,7 @@
 
 #define TS_DTR_WAIT	0x1000000	/* DTR hold-down between sessions */
 #define TS_GONE		0x2000000	/* Hardware detached */
+#define TS_CALLOUT	0x4000000	/* Callout devices */
 
 /* Character type information. */
 #define	ORDINARY	0
@@ -336,8 +337,6 @@
 int	 ttioctl(struct tty *tp, u_long com, void *data, int flag);
 int	 ttread(struct tty *tp, struct uio *uio, int flag);
 void	 ttrstrt(void *tp);
-int	 ttsetcompat(struct tty *tp, u_long *com, caddr_t data,
-	    struct termios *term);
 void	 ttsetwater(struct tty *tp);
 int	 ttspeedtab(int speed, struct speedtab *table);
 int	 ttstart(struct tty *tp);
@@ -350,7 +349,7 @@
 int	 ttycheckoutq(struct tty *tp, int wait);
 void	 ttyconsolemode(struct tty *tp, int speed);
 int	 tty_close(struct tty *tp);
-int	 ttycreate(struct tty *tp, struct cdevsw *, int unit, int flags, const char *fmt, ...) __printflike(5, 6);
+int	 ttycreate(struct tty *tp, int flags, const char *fmt, ...) __printflike(3, 4);
 int	 ttydtrwaitsleep(struct tty *tp);
 void	 ttydtrwaitstart(struct tty *tp);
 void	 ttyflush(struct tty *tp, int rw);
@@ -361,7 +360,6 @@
 int	 ttyinput(int c, struct tty *tp);
 int	 ttylclose(struct tty *tp, int flag);
 void	 ttyldoptim(struct tty *tp);
-struct tty *ttymalloc(struct tty *tp);
 int	 ttymodem(struct tty *tp, int flag);
 int	 tty_open(struct cdev *device, struct tty *tp);
 int	 ttyref(struct tty *tp);
@@ -370,6 +368,82 @@
 int	 ttywait(struct tty *tp);
 int	 unputc(struct clist *q);
 
+static __inline int
+tt_open(struct tty *t, struct cdev *c)
+{
+
+	if (t->t_open == NULL)
+		return (0);
+	return (t->t_open(t, c));
+}
+
+static __inline void
+tt_close(struct tty *t)
+{
+
+	if (t->t_close != NULL)
+		return (t->t_close(t));
+}
+
+static __inline void
+tt_oproc(struct tty *t)
+{
+
+	if (t->t_oproc != NULL)			/* XXX: Kludge for pty. */
+		t->t_oproc(t);
+}
+
+static __inline void
+tt_purge(struct tty *t)
+{
+
+	if (t->t_purge != NULL)
+		t->t_purge(t);
+}
+
+static __inline void
+tt_stop(struct tty *t, int i)
+{
+
+	t->t_stop(t, i);
+}
+
+static __inline int
+tt_param(struct tty *t, struct termios *s)
+{
+
+	if (t->t_param == NULL)
+		return (0);
+	return (t->t_param(t, s));
+}
+
+static __inline int
+tt_modem(struct tty *t, int i, int j)
+{
+
+	if (t->t_modem == NULL)
+		return (0);
+	return (t->t_modem(t, i, j));
+}
+
+static __inline int
+tt_break(struct tty *t, int i)
+{
+
+	if (t->t_break == NULL)
+		return (ENOIOCTL);
+	t->t_break(t, i);
+	return (0);
+}
+
+static __inline int
+tt_ioctl(struct tty *t, u_long cmd, void *data,
+		      int fflag, struct thread *td)
+{
+
+	return (t->t_ioctl(t, cmd, data, fflag, td));
+}
+
 /*
  * XXX: temporary
  */
Index: ttycom.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ttycom.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ttycom.h -L sys/sys/ttycom.h -u -r1.1.1.1 -r1.2
--- sys/sys/ttycom.h
+++ sys/sys/ttycom.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ttycom.h	8.1 (Berkeley) 3/28/94
- * $FreeBSD: src/sys/sys/ttycom.h,v 1.23 2004/06/25 21:54:49 phk Exp $
+ * $FreeBSD: src/sys/sys/ttycom.h,v 1.25 2006/09/27 19:57:02 ru Exp $
  */
 
 #ifndef	_SYS_TTYCOM_H_
@@ -63,7 +63,7 @@
 						/* 11-12 obsolete or unused */
 #define	TIOCEXCL	 _IO('t', 13)		/* set exclusive use of tty */
 #define	TIOCNXCL	 _IO('t', 14)		/* reset exclusive use of tty */
-						/* 15 unused */
+#define	TIOCGPTN	_IOR('t', 15, int)	/* Get pts number. */
 #define	TIOCFLUSH	_IOW('t', 16, int)	/* flush buffers */
 						/* 17-18 compat */
 #define	TIOCGETA	_IOR('t', 19, struct termios) /* get termios struct */
@@ -123,7 +123,7 @@
 #define	TIOCSCTTY	 _IO('t', 97)		/* become controlling tty */
 						/* 97-90 tun; some conflicts */
 #define	TIOCEXT		_IOW('t', 96, int)	/* pty: external processing */
-#define	TIOCSIG		 _IO('t', 95)		/* pty: generate signal */
+#define	TIOCSIG		_IOWINT('t', 95)	/* pty: generate signal */
 #define	TIOCDRAIN	 _IO('t', 94)		/* wait till output drained */
 						/* 92-90 tap; some conflicts */
 #define	TIOCMSDTRWAIT	_IOW('t', 91, int)	/* modem: set wait on close */
Index: kobj.h
===================================================================
RCS file: /home/cvs/src/sys/sys/kobj.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/kobj.h -L sys/sys/kobj.h -u -r1.1.1.1 -r1.2
--- sys/sys/kobj.h
+++ sys/sys/kobj.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/sys/kobj.h,v 1.9 2003/10/16 09:16:28 dfr Exp $
+ *	$FreeBSD: src/sys/sys/kobj.h,v 1.11 2006/08/24 21:09:39 rik Exp $
  */
 
 #ifndef _SYS_KOBJ_H_
@@ -120,7 +120,7 @@
 /*
  * Define a class inheriting a single base class. Use like this:
  *
- * DEFINE_CLASS1(foo, foo_class, foo_methods, sizeof(foo_softc),
+ * DEFINE_CLASS_1(foo, foo_class, foo_methods, sizeof(foo_softc),
  *			  bar);
  */
 #define DEFINE_CLASS_1(name, classvar, methods, size,	\
@@ -135,7 +135,7 @@
 /*
  * Define a class inheriting two base classes. Use like this:
  *
- * DEFINE_CLASS2(foo, foo_class, foo_methods, sizeof(foo_softc),
+ * DEFINE_CLASS_2(foo, foo_class, foo_methods, sizeof(foo_softc),
  *			  bar, baz);
  */
 #define DEFINE_CLASS_2(name, methods, size,		\
@@ -151,7 +151,7 @@
 /*
  * Define a class inheriting three base classes. Use like this:
  *
- * DEFINE_CLASS3(foo, foo_class, foo_methods, sizeof(foo_softc),
+ * DEFINE_CLASS_3(foo, foo_class, foo_methods, sizeof(foo_softc),
  *			  bar, baz, foobar);
  */
 #define DEFINE_CLASS_3(name, methods, size,		\
@@ -246,4 +246,9 @@
  */
 int kobj_error_method(void);
 
+/*
+ * Machine-dependent initialisation call for boot-time kobj clients
+ */
+void kobj_machdep_init(void);
+
 #endif /* !_SYS_KOBJ_H_ */
Index: stack.h
===================================================================
RCS file: /home/cvs/src/sys/sys/stack.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -L sys/sys/stack.h -L sys/sys/stack.h -u -r1.1 -r1.2
--- sys/sys/stack.h
+++ sys/sys/stack.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/stack.h,v 1.2.2.1 2006/03/13 03:07:17 jeff Exp $
+ * $FreeBSD: src/sys/sys/stack.h,v 1.2 2005/08/29 11:34:08 pjd Exp $
  */
 
 #ifndef _SYS_STACK_H_
Index: vnode.h
===================================================================
RCS file: /home/cvs/src/sys/sys/vnode.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -L sys/sys/vnode.h -L sys/sys/vnode.h -u -r1.2 -r1.3
--- sys/sys/vnode.h
+++ sys/sys/vnode.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)vnode.h	8.7 (Berkeley) 2/4/94
- * $FreeBSD: src/sys/sys/vnode.h,v 1.304.2.7 2006/03/13 03:07:27 jeff Exp $
+ * $FreeBSD: src/sys/sys/vnode.h,v 1.326 2007/05/31 11:51:52 kib Exp $
  */
 
 #ifndef _SYS_VNODE_H_
@@ -253,6 +253,8 @@
 #define	VV_SYSTEM	0x0080	/* vnode being used by kernel */
 #define	VV_PROCDEP	0x0100	/* vnode is process dependent */
 #define	VV_NOKNOTE	0x0200	/* don't activate knotes on this vnode */
+#define	VV_DELETED	0x0400	/* should be removed */
+#define	VV_MD		0x0800	/* vnode backs the md device */
 
 /*
  * Vnode attributes.  A field value of VNOVAL represents a field whose value
@@ -452,12 +454,6 @@
 	int	vdesc_cred_offset;	/* cred location, if any */
 	int	vdesc_thread_offset;	/* thread location, if any */
 	int	vdesc_componentname_offset; /* if any */
-	/*
-	 * Finally, we've got a list of private data (about each operation)
-	 * for each transport layer.  (Support to manage this list is not
-	 * yet part of BSD.)
-	 */
-	caddr_t	*vdesc_transports;
 };
 
 #ifdef _KERNEL
@@ -569,13 +565,15 @@
 	    struct componentname *cnp);
 void	cache_purge(struct vnode *vp);
 void	cache_purgevfs(struct mount *mp);
-int	cache_leaf_test(struct vnode *vp);
 int	change_dir(struct vnode *vp, struct thread *td);
 int	change_root(struct vnode *vp, struct thread *td);
 void	cvtstat(struct stat *st, struct ostat *ost);
 void	cvtnstat(struct stat *sb, struct nstat *nsb);
 int	getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops,
 	    struct vnode **vpp);
+int	insmntque1(struct vnode *vp, struct mount *mp,
+	    void (*dtr)(struct vnode *, void *), void *dtr_arg);
+int	insmntque(struct vnode *vp, struct mount *mp);
 u_quad_t init_va_filerev(void);
 int	lease_check(struct vop_lease_args *ap);
 int	speedup_syncer(void);
@@ -592,6 +590,7 @@
 void	vattr_null(struct vattr *vap);
 int	vcount(struct vnode *vp);
 void	vdrop(struct vnode *);
+void	vdropl(struct vnode *);
 void	vfs_add_vnodeops(const void *);
 void	vfs_rm_vnodeops(const void *);
 int	vflush(struct mount *mp, int rootrefs, int flags, struct thread *td);
@@ -611,16 +610,17 @@
 void	vn_finished_write(struct mount *mp);
 void	vn_finished_secondary_write(struct mount *mp);
 int	vn_isdisk(struct vnode *vp, int *errp);
-int	vn_lock(struct vnode *vp, int flags, struct thread *td);
-int	vn_open(struct nameidata *ndp, int *flagp, int cmode, int fdidx);
+int	_vn_lock(struct vnode *vp, int flags, struct thread *td, char *file, int line);
+#define vn_lock(vp, flags, td) _vn_lock(vp, flags, td, __FILE__, __LINE__)
+int	vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp);
 int	vn_open_cred(struct nameidata *ndp, int *flagp, int cmode,
-	    struct ucred *cred, int fdidx);
+	    struct ucred *cred, struct file *fp);
 int	vn_pollrecord(struct vnode *vp, struct thread *p, int events);
-int	vn_rdwr(enum uio_rw rw, struct vnode *vp, caddr_t base,
+int	vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base,
 	    int len, off_t offset, enum uio_seg segflg, int ioflg,
 	    struct ucred *active_cred, struct ucred *file_cred, int *aresid,
 	    struct thread *td);
-int	vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, caddr_t base,
+int	vn_rdwr_inchunks(enum uio_rw rw, struct vnode *vp, void *base,
 	    size_t len, off_t offset, enum uio_seg segflg, int ioflg,
 	    struct ucred *active_cred, struct ucred *file_cred, size_t *aresid,
 	    struct thread *td);
@@ -649,12 +649,13 @@
 int	vop_stdinactive(struct vop_inactive_args *);
 int	vop_stdislocked(struct vop_islocked_args *);
 int	vop_stdkqfilter(struct vop_kqfilter_args *);
-int	vop_stdlock(struct vop_lock_args *);
+int	vop_stdlock(struct vop_lock1_args *);
 int	vop_stdputpages(struct vop_putpages_args *);
 int	vop_stdunlock(struct vop_unlock_args *);
 int	vop_nopoll(struct vop_poll_args *);
 int	vop_stdpathconf(struct vop_pathconf_args *);
 int	vop_stdpoll(struct vop_poll_args *);
+int	vop_stdvptofh(struct vop_vptofh_args *ap);
 int	vop_eopnotsupp(struct vop_generic_args *ap);
 int	vop_ebadf(struct vop_generic_args *ap);
 int	vop_einval(struct vop_generic_args *ap);
@@ -702,14 +703,16 @@
 		    | (noffset > osize ? NOTE_EXTEND : 0));		\
 	}
 
+#define VOP_LOCK(vp, flags, td) VOP_LOCK1(vp, flags, td, __FILE__, __LINE__)
+
+
 void	vput(struct vnode *vp);
 void	vrele(struct vnode *vp);
 void	vref(struct vnode *vp);
 int	vrefcnt(struct vnode *vp);
 void 	v_addpollinfo(struct vnode *vp);
 
-int vnode_create_vobject(struct vnode *vp, size_t size, struct thread *td);
-int vnode_create_vobject_off(struct vnode *vp, off_t size, struct thread *td);
+int vnode_create_vobject(struct vnode *vp, off_t size, struct thread *td);
 void vnode_destroy_vobject(struct vnode *vp);
 
 extern struct vop_vector fifo_specops;
@@ -726,7 +729,7 @@
 /* vfs_hash.c */
 typedef int vfs_hash_cmp_t(struct vnode *vp, void *arg);
 
-int vfs_hash_get(struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
+int vfs_hash_get(const struct mount *mp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
 int vfs_hash_insert(struct vnode *vp, u_int hash, int flags, struct thread *td, struct vnode **vpp, vfs_hash_cmp_t *fn, void *arg);
 void vfs_hash_rehash(struct vnode *vp, u_int hash);
 void vfs_hash_remove(struct vnode *vp);
Index: _timeval.h
===================================================================
RCS file: /home/cvs/src/sys/sys/_timeval.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/_timeval.h -L sys/sys/_timeval.h -u -r1.1.1.1 -r1.2
--- sys/sys/_timeval.h
+++ sys/sys/_timeval.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/_timeval.h,v 1.1 2002/12/31 04:08:41 mike Exp $
+ * $FreeBSD: src/sys/sys/_timeval.h,v 1.3 2006/05/12 05:04:46 jhb Exp $
  */
 
 #ifndef _SYS__TIMEVAL_H_
@@ -45,7 +45,7 @@
  * Structure returned by gettimeofday(2) system call, and used in other calls.
  */
 struct timeval {
-	long		tv_sec;		/* seconds (XXX should be time_t) */
+	time_t		tv_sec;		/* seconds */
 	suseconds_t	tv_usec;	/* and microseconds */
 };
 
Index: _mutex.h
===================================================================
RCS file: /home/cvs/src/sys/sys/_mutex.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/_mutex.h -L sys/sys/_mutex.h -u -r1.1.1.1 -r1.2
--- sys/sys/_mutex.h
+++ sys/sys/_mutex.h
@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/_mutex.h,v 1.11 2004/01/25 01:59:26 rwatson Exp $
+ * $FreeBSD: src/sys/sys/_mutex.h,v 1.13 2007/03/21 21:20:51 jhb Exp $
  */
 
 #ifndef _SYS__MUTEX_H_
@@ -35,28 +35,9 @@
  * Sleep/spin mutex.
  */
 struct mtx {
-	struct lock_object	mtx_object;	/* Common lock properties. */
+	struct lock_object	lock_object;	/* Common lock properties. */
 	volatile uintptr_t	mtx_lock;	/* Owner and flags. */
 	volatile u_int		mtx_recurse;	/* Number of recursive holds. */
-
-#ifdef MUTEX_PROFILING
-	/*
-	 * This does not result in variant structure sizes because
-	 * MUTEX_PROFILING is in opt_global.h
-	 */
-	u_int64_t		mtx_acqtime;
-	const char		*mtx_filename;
-	int			mtx_lineno;
-	/*
-	 * Fields relating to measuring contention on mutexes.
-	 * holding must be accessed atomically since it's
-	 * modified by threads that don't yet hold the mutex.
-	 * locking is only modified and referenced while
-	 * the mutex is held.
-	 */
-	u_int			mtx_contest_holding;
-	u_int			mtx_contest_locking;
-#endif
 };
 
 #endif /* !_SYS__MUTEX_H_ */
Index: ucred.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ucred.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ucred.h -L sys/sys/ucred.h -u -r1.1.1.1 -r1.2
--- sys/sys/ucred.h
+++ sys/sys/ucred.h
@@ -27,17 +27,19 @@
  * SUCH DAMAGE.
  *
  *	@(#)ucred.h	8.4 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/sys/ucred.h,v 1.52 2005/06/28 02:23:56 delphij Exp $
+ * $FreeBSD: src/sys/sys/ucred.h,v 1.55.2.1 2007/12/07 05:46:09 kmacy Exp $
  */
 
 #ifndef _SYS_UCRED_H_
 #define	_SYS_UCRED_H_
 
+#include <bsm/audit.h>
+
 /*
  * Credentials.
  *
- * Please do not inspect cr_uid directly to determine superuserness.
- * Only the suser() or suser_cred() function should be used for this.
+ * Please do not inspect cr_uid directly to determine superuserness.  The
+ * priv(9) interface should be used to check for privilege.
  */
 #if defined(_KERNEL) || defined(_WANT_UCRED)
 struct ucred {
@@ -53,9 +55,10 @@
 	struct uidinfo	*cr_uidinfo;	/* per euid resource consumption */
 	struct uidinfo	*cr_ruidinfo;	/* per ruid resource consumption */
 	struct prison	*cr_prison;	/* jail(2) */
+	void 		*cr_pspare[3];	/* vimage 2; general use 1 */
 #define	cr_endcopy	cr_label
 	struct label	*cr_label;	/* MAC label */
-	struct mtx	*cr_mtxp;      	/* protect refcount */
+	struct auditinfo_addr	cr_audit;	/* Audit properties. */
 };
 #define	NOCRED	((struct ucred *)0)	/* no credential available */
 #define	FSCRED	((struct ucred *)-1)	/* filesystem credential */
Index: pciio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/pciio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/pciio.h -L sys/sys/pciio.h -u -r1.1.1.1 -r1.2
--- sys/sys/pciio.h
+++ sys/sys/pciio.h
@@ -24,7 +24,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- *	$FreeBSD: src/sys/sys/pciio.h,v 1.6 2001/09/05 01:22:14 obrien Exp $
+ *	$FreeBSD: src/sys/sys/pciio.h,v 1.7.2.1 2007/10/28 17:31:52 marius Exp $
  *
  */
 
@@ -43,25 +43,27 @@
 } pci_getconf_status;
 
 typedef enum {
-	PCI_GETCONF_NO_MATCH		= 0x00,
-	PCI_GETCONF_MATCH_BUS		= 0x01,
-	PCI_GETCONF_MATCH_DEV		= 0x02,
-	PCI_GETCONF_MATCH_FUNC		= 0x04,
-	PCI_GETCONF_MATCH_NAME		= 0x08,
-	PCI_GETCONF_MATCH_UNIT		= 0x10,
-	PCI_GETCONF_MATCH_VENDOR	= 0x20,
-	PCI_GETCONF_MATCH_DEVICE	= 0x40,
-	PCI_GETCONF_MATCH_CLASS		= 0x80
+	PCI_GETCONF_NO_MATCH		= 0x0000,
+	PCI_GETCONF_MATCH_DOMAIN	= 0x0001,
+	PCI_GETCONF_MATCH_BUS		= 0x0002,
+	PCI_GETCONF_MATCH_DEV		= 0x0004,
+	PCI_GETCONF_MATCH_FUNC		= 0x0008,
+	PCI_GETCONF_MATCH_NAME		= 0x0010,
+	PCI_GETCONF_MATCH_UNIT		= 0x0020,
+	PCI_GETCONF_MATCH_VENDOR	= 0x0040,
+	PCI_GETCONF_MATCH_DEVICE	= 0x0080,
+	PCI_GETCONF_MATCH_CLASS		= 0x0100
 } pci_getconf_flags;
 
 struct pcisel {
+	u_int32_t	pc_domain;	/* domain number */
 	u_int8_t	pc_bus;		/* bus number */
 	u_int8_t	pc_dev;		/* device on this bus */
 	u_int8_t	pc_func;	/* function on this device */
 };
 
 struct pci_conf {
-	struct pcisel	pc_sel;		/* bus+slot+function */
+	struct pcisel	pc_sel;		/* domain+bus+slot+function */
 	u_int8_t	pc_hdr;		/* PCI header type */
 	u_int16_t	pc_subvendor;	/* card vendor ID */
 	u_int16_t	pc_subdevice;	/* card device ID, assigned by 
@@ -78,7 +80,7 @@
 };
 
 struct pci_match_conf {
-	struct pcisel		pc_sel;		/* bus+slot+function */
+	struct pcisel		pc_sel;		/* domain+bus+slot+function */
 	char			pd_name[PCI_MAXNAMELEN + 1];  /* device name */
 	u_long			pd_unit;	/* Unit number */
 	u_int16_t		pc_vendor;	/* PCI Vendor ID */
@@ -105,9 +107,8 @@
 	int		pi_width;	/* width (in bytes) of read or write */
 	u_int32_t	pi_data;	/* data to write or result of read */
 };
-	
 
-#define	PCIOCGETCONF	_IOWR('p', 1, struct pci_conf_io)
+#define	PCIOCGETCONF	_IOWR('p', 5, struct pci_conf_io)
 #define	PCIOCREAD	_IOWR('p', 2, struct pci_io)
 #define	PCIOCWRITE	_IOWR('p', 3, struct pci_io)
 #define	PCIOCATTACHED	_IOWR('p', 4, struct pci_io)
Index: imgact_elf.h
===================================================================
RCS file: /home/cvs/src/sys/sys/imgact_elf.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/imgact_elf.h -L sys/sys/imgact_elf.h -u -r1.1.1.2 -r1.2
--- sys/sys/imgact_elf.h
+++ sys/sys/imgact_elf.h
@@ -25,7 +25,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/imgact_elf.h,v 1.27.8.1 2005/12/30 22:13:58 marcel Exp $
+ * $FreeBSD: src/sys/sys/imgact_elf.h,v 1.29 2005/12/26 21:23:56 sobomax Exp $
  */
 
 #ifndef _SYS_IMGACT_ELF_H_
@@ -63,6 +63,8 @@
 	const char *interp_path;
 	struct sysentvec *sysvec;
 	const char *interp_newpath;
+        int flags;
+#define		BI_CAN_EXEC_DYN	0x0001
 } __ElfN(Brandinfo);
 
 __ElfType(Auxargs);
Index: wait.h
===================================================================
RCS file: /home/cvs/src/sys/sys/wait.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/wait.h -L sys/sys/wait.h -u -r1.1.1.1 -r1.2
--- sys/sys/wait.h
+++ sys/sys/wait.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)wait.h	8.2 (Berkeley) 7/10/94
- * $FreeBSD: src/sys/sys/wait.h,v 1.21 2005/01/05 22:19:44 jhb Exp $
+ * $FreeBSD: src/sys/sys/wait.h,v 1.22 2005/11/10 05:00:20 davidxu Exp $
  */
 
 #ifndef _SYS_WAIT_H_
@@ -45,11 +45,9 @@
  * values.
  */
 #if __BSD_VISIBLE
-#define	_W_INT(w)	(*(int *)&(w))	/* Convert union wait to int. */
 #define	WCOREFLAG	0200
-#else
-#define	_W_INT(i)	(i)
 #endif
+#define	_W_INT(i)	(i)
 
 #define	_WSTATUS(x)	(_W_INT(x) & 0177)
 #define	_WSTOPPED	0177		/* _WSTATUS if process is stopped */
Index: imgact.h
===================================================================
RCS file: /home/cvs/src/sys/sys/imgact.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/imgact.h -L sys/sys/imgact.h -u -r1.1.1.1 -r1.2
--- sys/sys/imgact.h
+++ sys/sys/imgact.h
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/imgact.h,v 1.38 2005/02/25 11:49:42 sobomax Exp $
+ * $FreeBSD: src/sys/sys/imgact.h,v 1.40 2006/08/15 12:10:57 netchild Exp $
  */
 
 #ifndef _SYS_IMGACT_H_
@@ -63,6 +63,7 @@
 	unsigned long ps_strings; /* PS_STRINGS for BSD/OS binaries */
 	size_t auxarg_size;
 	struct image_args *args;	/* system call arguments */
+	struct sysentvec *sysent;	/* system entry vector */
 };
 
 #ifdef _KERNEL
@@ -76,7 +77,6 @@
 int	exec_shell_imgact(struct image_params *);
 int	exec_copyin_args(struct image_args *, char *, enum uio_seg,
 	char **, char **);
-void	exec_free_args(struct image_args *);
 #endif
 
 #endif /* !_SYS_IMGACT_H_ */
Index: _lock.h
===================================================================
RCS file: /home/cvs/src/sys/sys/_lock.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/_lock.h -L sys/sys/_lock.h -u -r1.1.1.1 -r1.2
--- sys/sys/_lock.h
+++ sys/sys/_lock.h
@@ -25,19 +25,45 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/_lock.h,v 1.10 2004/06/19 14:58:35 bde Exp $
+ * $FreeBSD: src/sys/sys/_lock.h,v 1.14 2006/11/13 05:41:26 kmacy Exp $
  */
 
 #ifndef _SYS__LOCK_H_
 #define	_SYS__LOCK_H_
 
+struct lock_profile_object {
+        /*
+         * This does not result in variant structure sizes because
+         * MUTEX_PROFILING is in opt_global.h
+         */
+	u_int64_t               lpo_acqtime;
+	u_int64_t               lpo_waittime;
+	const char              *lpo_filename;
+	u_int                   lpo_namehash;
+	int                     lpo_lineno;
+	const char              *lpo_type;
+        /*
+         * Fields relating to measuring contention on mutexes.
+         * holding must be accessed atomically since it's
+         * modified by threads that don't yet hold the mutex.
+         * locking is only modified and referenced while
+         * the mutex is held.
+         */
+        u_int                   lpo_contest_holding;
+        u_int                   lpo_contest_locking;
+};
+
 struct lock_object {
-	struct	lock_class *lo_class;
 	const	char *lo_name;		/* Individual lock name. */
 	const	char *lo_type;		/* General lock type. */
 	u_int	lo_flags;
-	TAILQ_ENTRY(lock_object) lo_list; /* List of all locks in system. */
-	struct	witness *lo_witness;
+#ifdef LOCK_PROFILING
+        struct  lock_profile_object lo_profile_obj;
+#endif
+	union {				/* Data for witness. */
+		STAILQ_ENTRY(lock_object) lod_list;
+		struct	witness *lod_witness;
+	} lo_witness_data;
 };
 
 #endif /* !_SYS__LOCK_H_ */
Index: ttychars.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ttychars.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ttychars.h -L sys/sys/ttychars.h -u -r1.1.1.1 -r1.2
--- sys/sys/ttychars.h
+++ sys/sys/ttychars.h
@@ -27,14 +27,12 @@
  * SUCH DAMAGE.
  *
  *	@(#)ttychars.h	8.2 (Berkeley) 1/4/94
- * $FreeBSD: src/sys/sys/ttychars.h,v 1.9 2004/06/21 22:57:16 phk Exp $
+ * $FreeBSD: src/sys/sys/ttychars.h,v 1.10 2006/01/10 09:19:10 phk Exp $
  */
 
 #ifndef _SYS_TTYCHARS_H_
 #define _SYS_TTYCHARS_H_
 
-#ifndef BURN_BRIDGES
-
 /*
  * 4.3 COMPATIBILITY FILE
  *
@@ -61,6 +59,4 @@
 #include <sys/ttydefaults.h>	/* to pick up character defaults */
 #endif
 
-#endif /* BURN_BRIDGES */
-
 #endif /* !_SYS_TTYCHARS_H_ */
Index: ttydev.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ttydev.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ttydev.h -L sys/sys/ttydev.h -u -r1.1.1.1 -r1.2
--- sys/sys/ttydev.h
+++ sys/sys/ttydev.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ttydev.h	8.2 (Berkeley) 1/4/94
- * $FreeBSD: src/sys/sys/ttydev.h,v 1.11 2004/06/21 22:57:16 phk Exp $
+ * $FreeBSD: src/sys/sys/ttydev.h,v 1.12 2006/01/10 09:19:10 phk Exp $
  */
 
 /* COMPATIBILITY HEADER FILE */
@@ -35,8 +35,6 @@
 #ifndef _SYS_TTYDEV_H_
 #define	_SYS_TTYDEV_H_
 
-#ifndef BURN_BRIDGES
-
 #ifdef USE_OLD_TTY
 #define B0	0
 #define B50	1
@@ -61,6 +59,4 @@
 #define B921600	20
 #endif /* USE_OLD_TTY */
 
-#endif /* BURN_BRIDGES */
-
 #endif /* !_SYS_TTYDEV_H_ */
Index: elf32.h
===================================================================
RCS file: /home/cvs/src/sys/sys/elf32.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/elf32.h -L sys/sys/elf32.h -u -r1.1.1.2 -r1.2
--- sys/sys/elf32.h
+++ sys/sys/elf32.h
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/elf32.h,v 1.8.14.1 2005/12/30 22:13:58 marcel Exp $
+ * $FreeBSD: src/sys/sys/elf32.h,v 1.13 2006/10/17 05:43:30 jkoshy Exp $
  */
 
 #ifndef _SYS_ELF32_H_
@@ -40,6 +40,7 @@
 typedef uint32_t	Elf32_Off;
 typedef int32_t		Elf32_Sword;
 typedef uint32_t	Elf32_Word;
+typedef uint64_t	Elf32_Lword;
 
 typedef Elf32_Word	Elf32_Hashelt;
 
@@ -138,6 +139,44 @@
 #define ELF32_R_INFO(sym, type)	(((sym) << 8) + (unsigned char)(type))
 
 /*
+ *	Note entry header
+ */
+typedef Elf_Note Elf32_Nhdr;
+
+/*
+ *	Move entry
+ */
+typedef struct {
+	Elf32_Lword	m_value;	/* symbol value */
+	Elf32_Word 	m_info;		/* size + index */
+	Elf32_Word	m_poffset;	/* symbol offset */
+	Elf32_Half	m_repeat;	/* repeat count */
+	Elf32_Half	m_stride;	/* stride info */
+} Elf32_Move;
+
+/*
+ *	The macros compose and decompose values for Move.r_info
+ *
+ *	sym = ELF32_M_SYM(M.m_info)
+ *	size = ELF32_M_SIZE(M.m_info)
+ *	M.m_info = ELF32_M_INFO(sym, size)
+ */
+#define	ELF32_M_SYM(info)	((info)>>8)
+#define	ELF32_M_SIZE(info)	((unsigned char)(info))
+#define	ELF32_M_INFO(sym, size)	(((sym)<<8)+(unsigned char)(size))
+
+/*
+ *	Hardware/Software capabilities entry
+ */
+typedef struct {
+	Elf32_Word	c_tag;		/* how to interpret value */
+	union {
+		Elf32_Word	c_val;
+		Elf32_Addr	c_ptr;
+	} c_un;
+} Elf32_Cap;
+
+/*
  * Symbol table entries.
  */
 
@@ -160,4 +199,47 @@
 /* Macro for accessing the fields of st_other. */
 #define ELF32_ST_VISIBILITY(oth)	((oth) & 0x3)
 
+/* Structures used by Sun & GNU symbol versioning. */
+typedef struct
+{
+	Elf32_Half	vd_version;
+	Elf32_Half	vd_flags;
+	Elf32_Half	vd_ndx;
+	Elf32_Half	vd_cnt;
+	Elf32_Word	vd_hash;
+	Elf32_Word	vd_aux;
+	Elf32_Word	vd_next;
+} Elf32_Verdef;
+
+typedef struct
+{
+	Elf32_Word	vda_name;
+	Elf32_Word	vda_next;
+} Elf32_Verdaux;
+
+typedef struct
+{
+	Elf32_Half	vn_version;
+	Elf32_Half	vn_cnt;
+	Elf32_Word	vn_file;
+	Elf32_Word	vn_aux;
+	Elf32_Word	vn_next;
+} Elf32_Verneed;
+
+typedef struct
+{
+	Elf32_Word	vna_hash;
+	Elf32_Half	vna_flags;
+	Elf32_Half	vna_other;
+	Elf32_Word	vna_name;
+	Elf32_Word	vna_next;
+} Elf32_Vernaux;
+
+typedef Elf32_Half Elf32_Versym;
+
+typedef struct {
+	Elf32_Half	si_boundto;	/* direct bindings - symbol bound to */
+	Elf32_Half	si_flags;	/* per symbol flags */
+} Elf32_Syminfo;
+
 #endif /* !_SYS_ELF32_H_ */
Index: queue.h
===================================================================
RCS file: /home/cvs/src/sys/sys/queue.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/queue.h -L sys/sys/queue.h -u -r1.1.1.1 -r1.2
--- sys/sys/queue.h
+++ sys/sys/queue.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)queue.h	8.5 (Berkeley) 8/20/94
- * $FreeBSD: src/sys/sys/queue.h,v 1.60.2.1 2005/08/16 22:41:39 phk Exp $
+ * $FreeBSD: src/sys/sys/queue.h,v 1.68 2006/10/24 11:20:29 ru Exp $
  */
 
 #ifndef _SYS_QUEUE_H_
@@ -100,8 +100,7 @@
  * _REMOVE			+	+	+	+
  *
  */
-#define	QUEUE_MACRO_DEBUG 0
-#if QUEUE_MACRO_DEBUG
+#ifdef QUEUE_MACRO_DEBUG
 /* Store the last 2 places the queue element or head was altered */
 struct qm_trace {
 	char * lastfile;
@@ -199,6 +198,7 @@
 		SLIST_NEXT(curelm, field) =				\
 		    SLIST_NEXT(SLIST_NEXT(curelm, field), field);	\
 	}								\
+	TRASHIT((elm)->field.sle_next);					\
 } while (0)
 
 #define	SLIST_REMOVE_HEAD(head, field) do {				\
@@ -274,7 +274,7 @@
 #define	STAILQ_LAST(head, type, field)					\
 	(STAILQ_EMPTY((head)) ?						\
 		NULL :							\
-	        ((struct type *)					\
+	        ((struct type *)(void *)				\
 		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
 
 #define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
@@ -291,6 +291,7 @@
 		     STAILQ_NEXT(STAILQ_NEXT(curelm, field), field)) == NULL)\
 			(head)->stqh_last = &STAILQ_NEXT((curelm), field);\
 	}								\
+	TRASHIT((elm)->field.stqe_next);				\
 } while (0)
 
 #define	STAILQ_REMOVE_HEAD(head, field) do {				\
@@ -299,11 +300,6 @@
 		(head)->stqh_last = &STAILQ_FIRST((head));		\
 } while (0)
 
-#define	STAILQ_REMOVE_HEAD_UNTIL(head, elm, field) do {			\
-	if ((STAILQ_FIRST((head)) = STAILQ_NEXT((elm), field)) == NULL)	\
-		(head)->stqh_last = &STAILQ_FIRST((head));		\
-} while (0)
-
 /*
  * List declarations.
  */
@@ -325,6 +321,31 @@
  * List functions.
  */
 
+#if (defined(_KERNEL) && defined(INVARIANTS))
+#define	QMD_LIST_CHECK_HEAD(head, field) do {				\
+	if (LIST_FIRST((head)) != NULL &&				\
+	    LIST_FIRST((head))->field.le_prev !=			\
+	     &LIST_FIRST((head)))					\
+		panic("Bad list head %p first->prev != head", (head));	\
+} while (0)
+
+#define	QMD_LIST_CHECK_NEXT(elm, field) do {				\
+	if (LIST_NEXT((elm), field) != NULL &&				\
+	    LIST_NEXT((elm), field)->field.le_prev !=			\
+	     &((elm)->field.le_next))					\
+	     	panic("Bad link elm %p next->prev != elm", (elm));	\
+} while (0)
+
+#define	QMD_LIST_CHECK_PREV(elm, field) do {				\
+	if (*(elm)->field.le_prev != (elm))				\
+		panic("Bad link elm %p prev->next != elm", (elm));	\
+} while (0)
+#else
+#define	QMD_LIST_CHECK_HEAD(head, field)
+#define	QMD_LIST_CHECK_NEXT(elm, field)
+#define	QMD_LIST_CHECK_PREV(elm, field)
+#endif /* (_KERNEL && INVARIANTS) */
+
 #define	LIST_EMPTY(head)	((head)->lh_first == NULL)
 
 #define	LIST_FIRST(head)	((head)->lh_first)
@@ -344,6 +365,7 @@
 } while (0)
 
 #define	LIST_INSERT_AFTER(listelm, elm, field) do {			\
+	QMD_LIST_CHECK_NEXT(listelm, field);				\
 	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
 		LIST_NEXT((listelm), field)->field.le_prev =		\
 		    &LIST_NEXT((elm), field);				\
@@ -352,6 +374,7 @@
 } while (0)
 
 #define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_LIST_CHECK_PREV(listelm, field);				\
 	(elm)->field.le_prev = (listelm)->field.le_prev;		\
 	LIST_NEXT((elm), field) = (listelm);				\
 	*(listelm)->field.le_prev = (elm);				\
@@ -359,6 +382,7 @@
 } while (0)
 
 #define	LIST_INSERT_HEAD(head, elm, field) do {				\
+	QMD_LIST_CHECK_HEAD((head), field);				\
 	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\
 		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
 	LIST_FIRST((head)) = (elm);					\
@@ -368,10 +392,14 @@
 #define	LIST_NEXT(elm, field)	((elm)->field.le_next)
 
 #define	LIST_REMOVE(elm, field) do {					\
+	QMD_LIST_CHECK_NEXT(elm, field);				\
+	QMD_LIST_CHECK_PREV(elm, field);				\
 	if (LIST_NEXT((elm), field) != NULL)				\
 		LIST_NEXT((elm), field)->field.le_prev = 		\
 		    (elm)->field.le_prev;				\
 	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\
+	TRASHIT((elm)->field.le_next);					\
+	TRASHIT((elm)->field.le_prev);					\
 } while (0)
 
 /*
@@ -397,6 +425,37 @@
 /*
  * Tail queue functions.
  */
+#if (defined(_KERNEL) && defined(INVARIANTS))
+#define	QMD_TAILQ_CHECK_HEAD(head, field) do {				\
+	if (!TAILQ_EMPTY(head) &&					\
+	    TAILQ_FIRST((head))->field.tqe_prev !=			\
+	     &TAILQ_FIRST((head)))					\
+		panic("Bad tailq head %p first->prev != head", (head));	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_TAIL(head, field) do {				\
+	if (*(head)->tqh_last != NULL)					\
+	    	panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); 	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_NEXT(elm, field) do {				\
+	if (TAILQ_NEXT((elm), field) != NULL &&				\
+	    TAILQ_NEXT((elm), field)->field.tqe_prev !=			\
+	     &((elm)->field.tqe_next))					\
+		panic("Bad link elm %p next->prev != elm", (elm));	\
+} while (0)
+
+#define	QMD_TAILQ_CHECK_PREV(elm, field) do {				\
+	if (*(elm)->field.tqe_prev != (elm))				\
+		panic("Bad link elm %p prev->next != elm", (elm));	\
+} while (0)
+#else
+#define	QMD_TAILQ_CHECK_HEAD(head, field)
+#define	QMD_TAILQ_CHECK_TAIL(head, headname)
+#define	QMD_TAILQ_CHECK_NEXT(elm, field)
+#define	QMD_TAILQ_CHECK_PREV(elm, field)
+#endif /* (_KERNEL && INVARIANTS) */
+
 #define	TAILQ_CONCAT(head1, head2, field) do {				\
 	if (!TAILQ_EMPTY(head2)) {					\
 		*(head1)->tqh_last = (head2)->tqh_first;		\
@@ -439,6 +498,7 @@
 } while (0)
 
 #define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\
+	QMD_TAILQ_CHECK_NEXT(listelm, field);				\
 	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
 		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
 		    &TAILQ_NEXT((elm), field);				\
@@ -453,6 +513,7 @@
 } while (0)
 
 #define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\
+	QMD_TAILQ_CHECK_PREV(listelm, field);				\
 	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\
 	TAILQ_NEXT((elm), field) = (listelm);				\
 	*(listelm)->field.tqe_prev = (elm);				\
@@ -462,6 +523,7 @@
 } while (0)
 
 #define	TAILQ_INSERT_HEAD(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_HEAD(head, field);				\
 	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\
 		TAILQ_FIRST((head))->field.tqe_prev =			\
 		    &TAILQ_NEXT((elm), field);				\
@@ -474,6 +536,7 @@
 } while (0)
 
 #define	TAILQ_INSERT_TAIL(head, elm, field) do {			\
+	QMD_TAILQ_CHECK_TAIL(head, field);				\
 	TAILQ_NEXT((elm), field) = NULL;				\
 	(elm)->field.tqe_prev = (head)->tqh_last;			\
 	*(head)->tqh_last = (elm);					\
@@ -491,6 +554,8 @@
 	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
 
 #define	TAILQ_REMOVE(head, elm, field) do {				\
+	QMD_TAILQ_CHECK_NEXT(elm, field);				\
+	QMD_TAILQ_CHECK_PREV(elm, field);				\
 	if ((TAILQ_NEXT((elm), field)) != NULL)				\
 		TAILQ_NEXT((elm), field)->field.tqe_prev = 		\
 		    (elm)->field.tqe_prev;				\
Index: ktr.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ktr.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/sys/ktr.h -L sys/sys/ktr.h -u -r1.1.1.2 -r1.2
--- sys/sys/ktr.h
+++ sys/sys/ktr.h
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  *
  *	from BSDI $Id: ktr.h,v 1.10.2.7 2000/03/16 21:44:42 cp Exp $
- * $FreeBSD: src/sys/sys/ktr.h,v 1.32.2.2 2006/01/23 14:56:33 marius Exp $
+ * $FreeBSD: src/sys/sys/ktr.h,v 1.37 2006/01/25 14:57:23 jhb Exp $
  */
 
 /*
@@ -38,36 +38,41 @@
 
 /*
  * Trace classes
+ *
+ * Two of the trace classes (KTR_DEV and KTR_SUBSYS) are special in that
+ * they are really placeholders so that indvidual drivers and subsystems
+ * can map their internal tracing to the general class when they wish to
+ * have tracing enabled and map it to 0 when they don't.
  */
 #define	KTR_GEN		0x00000001		/* General (TR) */
 #define	KTR_NET		0x00000002		/* Network */
 #define	KTR_DEV		0x00000004		/* Device driver */
 #define	KTR_LOCK	0x00000008		/* MP locking */
 #define	KTR_SMP		0x00000010		/* MP general */
-#define	KTR_FS		0x00000020		/* Filesystem */
-#define KTR_PMAP	0x00000040		/* Pmap tracing */
-#define KTR_MALLOC	0x00000080		/* Malloc tracing */
+#define	KTR_SUBSYS	0x00000020		/* Subsystem. */
+#define	KTR_PMAP	0x00000040		/* Pmap tracing */
+#define	KTR_MALLOC	0x00000080		/* Malloc tracing */
 #define	KTR_TRAP	0x00000100		/* Trap processing */
 #define	KTR_INTR	0x00000200		/* Interrupt tracing */
-#define KTR_SIG		0x00000400		/* Signal processing */
-#define	KTR_CLK		0x00000800		/* hardclock verbose */
+#define	KTR_SIG		0x00000400		/* Signal processing */
+#define	KTR_SPARE2	0x00000800		/* Unused */
 #define	KTR_PROC	0x00001000		/* Process scheduling */
 #define	KTR_SYSC	0x00002000		/* System call */
 #define	KTR_INIT	0x00004000		/* System initialization */
-#define KTR_KGDB	0x00008000		/* Trace kgdb internals */
-#define	KTR_IO		0x00010000		/* Upper I/O  */
+#define	KTR_SPARE3	0x00008000		/* Unused */
+#define	KTR_SPARE4	0x00010000		/* Unused */
 #define	KTR_EVH		0x00020000		/* Eventhandler */
-#define KTR_VFS		0x00040000		/* VFS events */
-#define KTR_VOP		0x00080000		/* Auto-generated vop events */
-#define KTR_VM		0x00100000		/* The virtual memory system */
-#define KTR_WITNESS	0x00200000
+#define	KTR_VFS		0x00040000		/* VFS events */
+#define	KTR_VOP		0x00080000		/* Auto-generated vop events */
+#define	KTR_VM		0x00100000		/* The virtual memory system */
+#define	KTR_SPARE1	0x00200000		/* Unused */
 #define	KTR_RUNQ	0x00400000		/* Run queue */
 #define	KTR_CONTENTION	0x00800000		/* Lock contention */
 #define	KTR_UMA		0x01000000		/* UMA slab allocator */
 #define	KTR_CALLOUT	0x02000000		/* Callouts and timeouts */
 #define	KTR_GEOM	0x04000000		/* GEOM I/O events */
 #define	KTR_BUSDMA	0x08000000		/* busdma(9) events */
-#define	KTR_CRITICAL	0x10000000		/* Critical sections */
+#define	KTR_SPARE5	0x10000000		/* Unused */
 #define	KTR_SCHED	0x20000000		/* Machine parsed sched info. */
 #define	KTR_BUF		0x40000000		/* Buffer cache */
 #define	KTR_ALL		0x7fffffff
@@ -95,9 +100,6 @@
 #define KTR_COMPILE 0
 #endif	/* KTR */
 
-/* Trace classes that can not be used with KTR_ALQ */
-#define	KTR_ALQ_MASK	(KTR_WITNESS)
-
 /*
  * Version number for ktr_entry struct.  Increment this when you break binary
  * compatibility.
Index: turnstile.h
===================================================================
RCS file: /home/cvs/src/sys/sys/turnstile.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/turnstile.h -L sys/sys/turnstile.h -u -r1.1.1.1 -r1.2
--- sys/sys/turnstile.h
+++ sys/sys/turnstile.h
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/turnstile.h,v 1.7 2005/01/07 02:29:24 imp Exp $
+ * $FreeBSD: src/sys/sys/turnstile.h,v 1.12 2007/06/04 23:51:44 jeff Exp $
  */
 
 #ifndef _SYS_TURNSTILE_H_
@@ -34,7 +34,10 @@
 
 /*
  * Turnstile interface.  Non-sleepable locks use a turnstile for the
- * queue of threads blocked on them when they are contested.
+ * queue of threads blocked on them when they are contested.  Each
+ * turnstile contains two sub-queues: one for threads waiting for a
+ * shared, or eread, lock, and one for threads waiting for an
+ * exclusive, or write, lock.
  *
  * A thread calls turnstile_lock() to lock the turnstile chain associated
  * with a given lock.  A thread calls turnstile_wait() when the lock is
@@ -50,7 +53,10 @@
  * blocked threads.  The turnstile_signal() function returns true if the
  * turnstile became empty as a result.  After the higher level code finishes
  * releasing the lock, turnstile_unpend() must be called to wake up the
- * pending thread(s).
+ * pending thread(s) and give up ownership of the turnstile.
+ *
+ * Alternatively, if a thread wishes to relinquish ownership of a thread
+ * without waking up any waiters, it may call turnstile_disown().
  *
  * When a lock is acquired that already has at least one thread contested
  * on it, the new owner of the lock must claim ownership of the turnstile
@@ -62,9 +68,9 @@
  * released at thread destruction may not be the same turnstile that the
  * thread allocated when it was created.
  *
- * A function can query a turnstile to see if it is empty via
- * turnstile_empty().  The highest priority thread blocked on a turnstile
- * can be obtained via turnstile_head().
+ * The highest priority thread blocked on a specified queue of a
+ * turnstile can be obtained via turnstile_head().  A given queue can
+ * also be queried to see if it is empty via turnstile_empty().
  */
 
 struct lock_object;
@@ -73,20 +79,31 @@
 
 #ifdef _KERNEL
 
+/* Which queue to block on or which queue to wakeup one or more threads from. */
+#define	TS_EXCLUSIVE_QUEUE	0
+#define	TS_SHARED_QUEUE		1
+
+/* The type of lock currently held. */
+#define	TS_EXCLUSIVE_LOCK	TS_EXCLUSIVE_QUEUE
+#define	TS_SHARED_LOCK		TS_SHARED_QUEUE
+
 void	init_turnstiles(void);
 void	turnstile_adjust(struct thread *, u_char);
 struct turnstile *turnstile_alloc(void);
-void	turnstile_broadcast(struct turnstile *);
-void	turnstile_claim(struct lock_object *);
-int	turnstile_empty(struct turnstile *);
+void	turnstile_broadcast(struct turnstile *, int);
+void	turnstile_cancel(struct turnstile *);
+void	turnstile_chain_lock(struct lock_object *);
+void	turnstile_chain_unlock(struct lock_object *);
+void	turnstile_claim(struct turnstile *);
+void	turnstile_disown(struct turnstile *);
+int	turnstile_empty(struct turnstile *ts, int queue);
 void	turnstile_free(struct turnstile *);
-struct thread *turnstile_head(struct turnstile *);
-void	turnstile_lock(struct lock_object *);
+struct thread *turnstile_head(struct turnstile *, int);
 struct turnstile *turnstile_lookup(struct lock_object *);
-void	turnstile_release(struct lock_object *);
-int	turnstile_signal(struct turnstile *);
-void	turnstile_unpend(struct turnstile *);
-void	turnstile_wait(struct lock_object *, struct thread *);
+int	turnstile_signal(struct turnstile *, int);
+struct turnstile *turnstile_trywait(struct lock_object *);
+void	turnstile_unpend(struct turnstile *, int);
+void	turnstile_wait(struct turnstile *, struct thread *, int);
 
 #endif	/* _KERNEL */
 #endif	/* _SYS_TURNSTILE_H_ */
Index: mchain.h
===================================================================
RCS file: /home/cvs/src/sys/sys/mchain.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/mchain.h -L sys/sys/mchain.h -u -r1.1.1.1 -r1.2
--- sys/sys/mchain.h
+++ sys/sys/mchain.h
@@ -29,59 +29,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/mchain.h,v 1.8 2005/01/07 02:29:23 imp Exp $
+ * $FreeBSD: src/sys/sys/mchain.h,v 1.10 2005/09/19 08:07:18 imura Exp $
  */
 #ifndef _SYS_MCHAIN_H_
 #define _SYS_MCHAIN_H_
 
-#include <machine/endian.h>
-
-#ifndef _KERNEL
-/*
- * This macros probably belongs to the endian.h
- */
-#if (BYTE_ORDER == LITTLE_ENDIAN)
-
-#define	htoles(x)	((u_int16_t)(x))
-#define	letohs(x)	((u_int16_t)(x))
-#define	htolel(x)	((u_int32_t)(x))
-#define	letohl(x)	((u_int32_t)(x))
-#define	htoleq(x)	((int64_t)(x))
-#define	letohq(x)	((int64_t)(x))
-
-#define	htobes(x)	(__htons(x))
-#define	betohs(x)	(__ntohs(x))
-#define	htobel(x)	(__htonl(x))
-#define	betohl(x)	(__ntohl(x))
-
-static __inline int64_t
-htobeq(int64_t x)
-{
-	return (int64_t)__htonl((u_int32_t)(x >> 32)) |
-	    (int64_t)__htonl((u_int32_t)(x & 0xffffffff)) << 32;
-}
-
-static __inline int64_t
-betohq(int64_t x)
-{
-	return (int64_t)__ntohl((u_int32_t)(x >> 32)) |
-	    (int64_t)__ntohl((u_int32_t)(x & 0xffffffff)) << 32;
-}
-
-#else	/* (BYTE_ORDER == LITTLE_ENDIAN) */
-
-#error "Macros for Big-Endians are incomplete"
-
-/*
-#define	htoles(x)	((u_int16_t)(x))
-#define	letohs(x)	((u_int16_t)(x))
-#define	htolel(x)	((u_int32_t)(x))
-#define	letohl(x)	((u_int32_t)(x))
-*/
-#endif	/* (BYTE_ORDER == LITTLE_ENDIAN) */
-#endif	/* _KERNEL */
-
-
 #ifdef _KERNEL
 
 /*
@@ -96,7 +48,8 @@
 struct mbuf;
 struct mbchain;
 
-typedef int mb_copy_t(struct mbchain *mbp, c_caddr_t src, caddr_t dst, size_t len);
+typedef int mb_copy_t(struct mbchain *mbp, c_caddr_t src, caddr_t dst,
+    size_t *srclen, size_t *dstlen);
 
 struct mbchain {
 	struct mbuf *	mb_top;		/* head of mbufs chain */
Index: hash.h
===================================================================
RCS file: /home/cvs/src/sys/sys/hash.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -L sys/sys/hash.h -L sys/sys/hash.h -u -r1.1 -r1.2
--- sys/sys/hash.h
+++ sys/sys/hash.h
@@ -23,8 +23,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $OpenBSD: hash.h,v 1.4 2004/05/25 18:37:23 jmc Exp $
- * $FreeBSD: src/sys/sys/hash.h,v 1.2.2.1 2006/04/04 19:50:02 andre Exp $
- * $MidnightBSD$
+ * $FreeBSD: src/sys/sys/hash.h,v 1.3 2007/04/09 22:55:14 thompsa Exp $
  */
 
 #ifndef _SYS_HASH_H_
@@ -87,7 +86,7 @@
  * namei() hashing of path name parts.
  */
 static __inline uint32_t
-hash32_stre(const void *buf, int end, char **ep, uint32_t hash)
+hash32_stre(const void *buf, int end, const char **ep, uint32_t hash)
 {
 	const unsigned char *p = buf;
 
@@ -95,7 +94,7 @@
 		hash = HASHSTEP(hash, *p++);
 
 	if (ep)
-		*ep = (char *)p;
+		*ep = p;
 
 	return hash;
 }
@@ -106,7 +105,8 @@
  * as a helper for the namei() hashing of path name parts.
  */
 static __inline uint32_t
-hash32_strne(const void *buf, size_t len, int end, char **ep, uint32_t hash)
+hash32_strne(const void *buf, size_t len, int end, const char **ep,
+    uint32_t hash)
 {
 	const unsigned char *p = buf;
 
@@ -114,7 +114,7 @@
 		hash = HASHSTEP(hash, *p++);
 
 	if (ep)
-		*ep = (char *)p;
+		*ep = p;
 
 	return hash;
 }
Index: rman.h
===================================================================
RCS file: /home/cvs/src/sys/sys/rman.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/rman.h -L sys/sys/rman.h -u -r1.1.1.1 -r1.2
--- sys/sys/rman.h
+++ sys/sys/rman.h
@@ -26,7 +26,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/rman.h,v 1.27 2005/04/12 06:21:58 imp Exp $
+ * $FreeBSD: src/sys/sys/rman.h,v 1.34 2006/06/12 04:06:20 imp Exp $
  */
 
 #ifndef _SYS_RMAN_H_
@@ -35,7 +35,7 @@
 #ifndef	_KERNEL
 #include <sys/queue.h>
 #else
-#include <machine/bus.h>
+#include <machine/_bus.h>
 #include <machine/resource.h>
 #endif
 
@@ -46,6 +46,7 @@
 #define	RF_WANTED	0x0010	/* somebody is waiting for this resource */
 #define	RF_FIRSTSHARE	0x0020	/* first in sharing list */
 #define	RF_PREFETCHABLE	0x0040	/* resource is prefetchable */
+#define	RF_OPTIONAL	0x0080	/* for bus_alloc_resources() */
 
 #define	RF_ALIGNMENT_SHIFT	10 /* alignment size bit starts bit 10 */
 #define	RF_ALIGNMENT_MASK	(0x003F << RF_ALIGNMENT_SHIFT)
@@ -84,37 +85,24 @@
 };
 
 #ifdef _KERNEL
+
 /*
- * We use a linked list rather than a bitmap because we need to be able to
- * represent potentially huge objects (like all of a processor's physical
- * address space).  That is also why the indices are defined to have type
- * `unsigned long' -- that being the largest integral type in ISO C (1990).
- * The 1999 version of C allows `long long'; we may need to switch to that
- * at some point in the future, particularly if we want to support 36-bit
- * addresses on IA32 hardware.
+ * The public (kernel) view of struct resource
+ *
+ * NB: Changing the offset/size/type of existing fields in struct resource
+ * NB: breaks the device driver ABI and is strongly FORBIDDEN.
+ * NB: Appending new fields is probably just misguided.
  */
-TAILQ_HEAD(resource_head, resource);
-#ifdef __RMAN_RESOURCE_VISIBLE
+
 struct resource {
-	TAILQ_ENTRY(resource)	r_link;
-	LIST_ENTRY(resource)	r_sharelink;
-	LIST_HEAD(, resource) 	*r_sharehead;
-	u_long	r_start;	/* index of the first entry in this resource */
-	u_long	r_end;		/* index of the last entry (inclusive) */
-	u_int	r_flags;
-	void	*r_virtual;	/* virtual address of this resource */
-	bus_space_tag_t r_bustag; /* bus_space tag */
-	bus_space_handle_t r_bushandle;	/* bus_space handle */
-	struct	device *r_dev;	/* device which has allocated this resource */
-	struct	rman *r_rm;	/* resource manager from whence this came */
-	void    *r_spare1;	/* Spare pointer 1 */
-	void    *r_spare2;	/* Spare pointer 2 */
-	int	r_rid;		/* optional rid for this resource. */
+	struct resource_i	*__r_i;
+	bus_space_tag_t		r_bustag; /* bus_space tag */
+	bus_space_handle_t	r_bushandle;	/* bus_space handle */
 };
-#else
-struct resource;
-struct device;
-#endif
+
+struct resource_i;
+
+TAILQ_HEAD(resource_head, resource_i);
 
 struct rman {
 	struct	resource_head 	rm_list;
@@ -141,8 +129,10 @@
 int	rman_deactivate_resource(struct resource *r);
 int	rman_fini(struct rman *rm);
 int	rman_init(struct rman *rm);
+int	rman_init_from_resource(struct rman *rm, struct resource *r);
 uint32_t rman_make_alignment_flags(uint32_t size);
 int	rman_manage_region(struct rman *rm, u_long start, u_long end);
+int	rman_is_region_manager(struct resource *r, struct rman *rm);
 int	rman_release_resource(struct resource *r);
 struct resource *rman_reserve_resource(struct rman *rm, u_long start,
 					u_long end, u_long count,
@@ -159,6 +149,7 @@
 void	rman_set_virtual(struct resource *_r, void *_v);
 
 extern	struct rman_head rman_head;
+
 #endif /* _KERNEL */
 
 #endif /* !_SYS_RMAN_H_ */
Index: tree.h
===================================================================
RCS file: /home/cvs/src/sys/sys/tree.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/tree.h -L sys/sys/tree.h -u -r1.1.1.1 -r1.2
--- sys/sys/tree.h
+++ sys/sys/tree.h
@@ -1,6 +1,6 @@
 /*	$NetBSD: tree.h,v 1.8 2004/03/28 19:38:30 provos Exp $	*/
 /*	$OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $	*/
-/* $FreeBSD: src/sys/sys/tree.h,v 1.3 2005/06/10 11:44:57 harti Exp $ */
+/* $FreeBSD: src/sys/sys/tree.h,v 1.6 2007/06/15 16:09:47 jasone Exp $ */
 
 /*-
  * Copyright 2002 Niels Provos <provos at citi.umich.edu>
@@ -30,6 +30,8 @@
 #ifndef	_SYS_TREE_H_
 #define	_SYS_TREE_H_
 
+#include <sys/cdefs.h>
+
 /*
  * This file defines data structures for different types of trees:
  * splay trees and red-black trees.
@@ -376,21 +378,30 @@
 } while (/*CONSTCOND*/ 0)
 
 /* Generates prototypes and inline functions */
-#define RB_PROTOTYPE(name, type, field, cmp)				\
-void name##_RB_INSERT_COLOR(struct name *, struct type *);	\
-void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
-struct type *name##_RB_REMOVE(struct name *, struct type *);		\
-struct type *name##_RB_INSERT(struct name *, struct type *);		\
-struct type *name##_RB_FIND(struct name *, struct type *);		\
-struct type *name##_RB_NEXT(struct type *);				\
-struct type *name##_RB_MINMAX(struct name *, int);			\
+#define	RB_PROTOTYPE(name, type, field, cmp)				\
+	RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
+#define	RB_PROTOTYPE_STATIC(name, type, field, cmp)			\
+	RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr)		\
+attr void name##_RB_INSERT_COLOR(struct name *, struct type *);		\
+attr void name##_RB_REMOVE_COLOR(struct name *, struct type *, struct type *);\
+attr struct type *name##_RB_REMOVE(struct name *, struct type *);	\
+attr struct type *name##_RB_INSERT(struct name *, struct type *);	\
+attr struct type *name##_RB_FIND(struct name *, struct type *);		\
+attr struct type *name##_RB_NFIND(struct name *, struct type *);	\
+attr struct type *name##_RB_NEXT(struct type *);			\
+attr struct type *name##_RB_MINMAX(struct name *, int);			\
 									\
 
 /* Main rb operation.
  * Moves node close to the key of elm to top
  */
-#define RB_GENERATE(name, type, field, cmp)				\
-void									\
+#define	RB_GENERATE(name, type, field, cmp)				\
+	RB_GENERATE_INTERNAL(name, type, field, cmp,)
+#define	RB_GENERATE_STATIC(name, type, field, cmp)			\
+	RB_GENERATE_INTERNAL(name, type, field, cmp, __unused static)
+#define RB_GENERATE_INTERNAL(name, type, field, cmp, attr)		\
+attr void								\
 name##_RB_INSERT_COLOR(struct name *head, struct type *elm)		\
 {									\
 	struct type *parent, *gparent, *tmp;				\
@@ -434,7 +445,7 @@
 	RB_COLOR(head->rbh_root, field) = RB_BLACK;			\
 }									\
 									\
-void									\
+attr void								\
 name##_RB_REMOVE_COLOR(struct name *head, struct type *parent, struct type *elm) \
 {									\
 	struct type *tmp;						\
@@ -512,7 +523,7 @@
 		RB_COLOR(elm, field) = RB_BLACK;			\
 }									\
 									\
-struct type *								\
+attr struct type *							\
 name##_RB_REMOVE(struct name *head, struct type *elm)			\
 {									\
 	struct type *child, *parent, *old = elm;			\
@@ -580,7 +591,7 @@
 }									\
 									\
 /* Inserts a node into the RB tree */					\
-struct type *								\
+attr struct type *							\
 name##_RB_INSERT(struct name *head, struct type *elm)			\
 {									\
 	struct type *tmp;						\
@@ -611,7 +622,7 @@
 }									\
 									\
 /* Finds the node with the same key as elm */				\
-struct type *								\
+attr struct type *							\
 name##_RB_FIND(struct name *head, struct type *elm)			\
 {									\
 	struct type *tmp = RB_ROOT(head);				\
@@ -628,8 +639,29 @@
 	return (NULL);							\
 }									\
 									\
+/* Finds the first node greater than or equal to the search key */	\
+attr struct type *							\
+name##_RB_NFIND(struct name *head, struct type *elm)			\
+{									\
+	struct type *tmp = RB_ROOT(head);				\
+	struct type *res = NULL;					\
+	int comp;							\
+	while (tmp) {							\
+		comp = cmp(elm, tmp);					\
+		if (comp < 0) {						\
+			res = tmp;					\
+			tmp = RB_LEFT(tmp, field);			\
+		}							\
+		else if (comp > 0)					\
+			tmp = RB_RIGHT(tmp, field);			\
+		else							\
+			return (tmp);					\
+	}								\
+	return (res);							\
+}									\
+									\
 /* ARGSUSED */								\
-struct type *								\
+attr struct type *							\
 name##_RB_NEXT(struct type *elm)					\
 {									\
 	if (RB_RIGHT(elm, field)) {					\
@@ -650,7 +682,7 @@
 	return (elm);							\
 }									\
 									\
-struct type *								\
+attr struct type *							\
 name##_RB_MINMAX(struct name *head, int val)				\
 {									\
 	struct type *tmp = RB_ROOT(head);				\
@@ -671,6 +703,7 @@
 #define RB_INSERT(name, x, y)	name##_RB_INSERT(x, y)
 #define RB_REMOVE(name, x, y)	name##_RB_REMOVE(x, y)
 #define RB_FIND(name, x, y)	name##_RB_FIND(x, y)
+#define RB_NFIND(name, x, y)	name##_RB_NFIND(x, y)
 #define RB_NEXT(name, x, y)	name##_RB_NEXT(y)
 #define RB_MIN(name, x)		name##_RB_MINMAX(x, RB_NEGINF)
 #define RB_MAX(name, x)		name##_RB_MINMAX(x, RB_INF)
Index: timers.h
===================================================================
RCS file: /home/cvs/src/sys/sys/timers.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/timers.h -L sys/sys/timers.h -u -r1.1.1.1 -r1.2
--- sys/sys/timers.h
+++ sys/sys/timers.h
@@ -1,4 +1,5 @@
 /*-
+ * Copyright (c) 2005 David Xu <davidxu at freebsd.org>
  * Copyright (c) 1994 by Chris Provenzano, proven at mit.edu
  * All rights reserved.
  *
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/timers.h,v 1.5 2005/01/07 02:29:24 imp Exp $
+ * $FreeBSD: src/sys/sys/timers.h,v 1.11 2006/03/01 06:48:31 davidxu Exp $
  *
  * Description : Basic timers header.
  */
@@ -39,4 +40,78 @@
 
 #include <sys/time.h>
 
+#ifdef _KERNEL
+/*
+ * Structures used to manage POSIX timers in a process.
+ */
+struct itimer {
+	struct mtx  		it_mtx;
+	struct sigevent		it_sigev;
+	struct itimerspec	it_time;
+	struct proc 		*it_proc;
+	int	it_flags;
+	int	it_usecount;
+	int	it_overrun;		/* Overruns currently accumulating */
+	int	it_overrun_last;	/* Overruns associated w/ a delivery */
+	int	it_clockid;
+	int	it_timerid;
+	ksiginfo_t	it_ksi;
+	union {
+		/* realtime */
+		struct {
+			struct callout it_callout;
+		} _rt;
+
+		/* cpu timer */
+		struct {
+			LIST_ENTRY(itimer)	it_link;
+			TAILQ_ENTRY(itimer)	it_worklink;
+			int			it_active;
+			int			it_cflags;
+		} _cpu;
+	} _data;
+};
+
+#define it_callout	_data._rt.it_callout
+#define it_link		_data._cpu.it_link
+#define it_active	_data._cpu.it_active
+#define	it_worklink	_data._cpu.it_worklink
+#define	it_cflags	_data._cpu.it_cflags
+
+#define	ITF_DELETING	0x01
+#define	ITF_WANTED	0x02
+
+#define	ITCF_ONWORKLIST	0x01
+
+#define	TIMER_MAX	32
+
+#define	ITIMER_LOCK(it)		mtx_lock(&(it)->it_mtx)
+#define	ITIMER_UNLOCK(it)	mtx_unlock(&(it)->it_mtx)
+
+LIST_HEAD(itimerlist, itimer);
+
+struct	itimers {
+	struct itimerlist	its_virtual;
+	struct itimerlist	its_prof;
+	TAILQ_HEAD(, itimer)	its_worklist;
+	struct itimer		*its_timers[TIMER_MAX];
+};
+
+struct	kclock {
+	int (*timer_create)(struct itimer *timer);
+	int (*timer_settime)(struct itimer * timer, int flags,
+		struct itimerspec * new_value,
+		struct itimerspec * old_value);
+	int (*timer_delete)(struct itimer * timer);
+	int (*timer_gettime)(struct itimer * timer,
+		struct itimerspec * cur_value);
+	void (*event_hook)(struct proc *p, clockid_t clock_id, int event);
+};
+
+/* Event values for event_hook() */
+#define	ITIMER_EV_EXEC	0
+#define	ITIMER_EV_EXIT	1
+
+int	itimer_accept(struct proc *p, int tid, ksiginfo_t *ksi);
 #endif
+#endif /* !_SYS_TIMERS_H_ */
Index: timespec.h
===================================================================
RCS file: /home/cvs/src/sys/sys/timespec.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/timespec.h -L sys/sys/timespec.h -u -r1.1.1.1 -r1.2
--- sys/sys/timespec.h
+++ sys/sys/timespec.h
@@ -28,7 +28,7 @@
  *
  *	@(#)time.h	8.5 (Berkeley) 5/4/95
  * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
- *	$FreeBSD: src/sys/sys/timespec.h,v 1.4 2005/01/07 02:29:24 imp Exp $
+ *	$FreeBSD: src/sys/sys/timespec.h,v 1.5 2005/10/23 04:22:56 davidxu Exp $
  */
 
 /*
@@ -62,4 +62,13 @@
 
 #endif /* __BSD_VISIBLE */
 
+/*
+ * Structure defined by POSIX.1b to be like a itimerval, but with
+ * timespecs. Used in the timer_*() system calls.
+ */
+struct itimerspec {
+	struct timespec  it_interval;
+	struct timespec  it_value;
+};
+
 #endif /* _SYS_TIMESPEC_H_ */
Index: ioctl.h
===================================================================
RCS file: /home/cvs/src/sys/sys/ioctl.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/ioctl.h -L sys/sys/ioctl.h -u -r1.1.1.1 -r1.2
--- sys/sys/ioctl.h
+++ sys/sys/ioctl.h
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ioctl.h	8.6 (Berkeley) 3/28/94
- * $FreeBSD: src/sys/sys/ioctl.h,v 1.14 2005/03/02 21:33:29 joerg Exp $
+ * $FreeBSD: src/sys/sys/ioctl.h,v 1.15 2006/01/10 09:19:10 phk Exp $
  */
 
 #ifndef	_SYS_IOCTL_H_
@@ -75,8 +75,8 @@
  * Compatibility with old terminal driver
  *
  * Source level -> #define USE_OLD_TTY
- * Kernel level -> options COMPAT_43
+ * Kernel level -> options COMPAT_43TTY
  */
-#if defined(USE_OLD_TTY) || defined(COMPAT_43)
+#if defined(USE_OLD_TTY) || defined(COMPAT_43TTY)
 #include <sys/ioctl_compat.h>
 #endif
Index: gmon.h
===================================================================
RCS file: /home/cvs/src/sys/sys/gmon.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/gmon.h -L sys/sys/gmon.h -u -r1.1.1.1 -r1.2
--- sys/sys/gmon.h
+++ sys/sys/gmon.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)gmon.h	8.2 (Berkeley) 1/4/94
- * $FreeBSD: src/sys/sys/gmon.h,v 1.19 2004/06/14 18:39:28 bms Exp $
+ * $FreeBSD: src/sys/sys/gmon.h,v 1.20 2006/03/29 18:17:03 jhb Exp $
  */
 
 #ifndef _SYS_GMON_H_
@@ -200,13 +200,14 @@
 
 #ifdef _KERNEL
 
-#ifdef GUPROF
-
-#define	CALIB_SCALE	1000
 #define	KCOUNT(p,index) \
 	((p)->kcount[(index) / (HISTFRACTION * sizeof(HISTCOUNTER))])
 #define	PC_TO_I(p, pc)	((uintfptr_t)(pc) - (uintfptr_t)(p)->lowpc)
 
+#ifdef GUPROF
+
+#define	CALIB_SCALE	1000
+
 extern int	cputime_bias;
 
 int	cputime(void);
Index: rtprio.h
===================================================================
RCS file: /home/cvs/src/sys/sys/rtprio.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/rtprio.h -L sys/sys/rtprio.h -u -r1.1.1.1 -r1.2
--- sys/sys/rtprio.h
+++ sys/sys/rtprio.h
@@ -12,7 +12,7 @@
  *    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 (name).
+ *	This product includes software developed by Henrik Vestergaard Draboel.
  * 4. The name of the author may not be used to endorse or promote products
  *    derived from this software without specific prior written permission.
  *
@@ -28,7 +28,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/sys/rtprio.h,v 1.14 2005/01/07 02:29:24 imp Exp $
+ * $FreeBSD: src/sys/sys/rtprio.h,v 1.18 2007/01/08 21:21:45 imp Exp $
  */
 
 #ifndef _SYS_RTPRIO_H_
@@ -75,9 +75,9 @@
 };
 
 #ifdef _KERNEL
-struct ksegrp;
-int	rtp_to_pri(struct rtprio *, struct ksegrp *);
-void	pri_to_rtp(struct ksegrp *, struct rtprio *);
+struct thread;
+int	rtp_to_pri(struct rtprio *, struct thread *);
+void	pri_to_rtp(struct thread *, struct rtprio *);
 #endif
 #endif
 
@@ -86,6 +86,7 @@
 
 __BEGIN_DECLS
 int	rtprio(int, pid_t, struct rtprio *);
+int	rtprio_thread(int, lwpid_t, struct rtprio *);
 __END_DECLS
 #endif	/* !_KERNEL */
 #endif	/* !_SYS_RTPRIO_H_ */
Index: disklabel.h
===================================================================
RCS file: /home/cvs/src/sys/sys/disklabel.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/sys/disklabel.h -L sys/sys/disklabel.h -u -r1.1.1.1 -r1.2
--- sys/sys/disklabel.h
+++ sys/sys/disklabel.h
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)disklabel.h	8.2 (Berkeley) 7/10/94
- * $FreeBSD: src/sys/sys/disklabel.h,v 1.107 2005/04/07 22:09:02 cognet Exp $
+ * $FreeBSD: src/sys/sys/disklabel.h,v 1.108 2006/05/12 05:04:46 jhb Exp $
  */
 
 #ifndef _SYS_DISKLABEL_H_
@@ -57,11 +57,6 @@
 #define LABELOFFSET	0			/* offset of label in sector */
 #endif
 
-#ifdef __alpha__
-#define LABELSECTOR	0
-#define LABELOFFSET	64
-#endif
-
 #define DISKMAGIC	((u_int32_t)0x82564557)	/* The disk magic number */
 #ifndef MAXPARTITIONS
 #define	MAXPARTITIONS	8


More information about the Midnightbsd-cvs mailing list