Module Name:    src
Committed By:   tls
Date:           Sun Aug 10 06:56:55 UTC 2014

Modified Files:
        src/sys/sys [tls-earlyentropy]: Makefile cdefs.h cdefs_elf.h conf.h
            cpu.h cpu_data.h dkio.h envsys.h exec_elf.h intr.h kcpuset.h lua.h
            lwp.h malloc.h mbuf.h mman.h module.h mount.h namei.h namei.src
            param.h pcq.h pcu.h pool.h protosw.h queue.h quotactl.h select.h
            signalvar.h sleepq.h socket.h socketvar.h syscall.h syscallargs.h
            sysctl.h syslog.h systm.h time.h tty.h ttydev.h un.h vnode.h
            vnode_if.h
Added Files:
        src/sys/sys [tls-earlyentropy]: common_int_const.h common_int_fmtio.h
            common_int_limits.h common_int_mwgwtypes.h common_int_types.h ipi.h

Log Message:
Rebase.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.148.2.1 src/sys/sys/Makefile
cvs rdiff -u -r1.119 -r1.119.2.1 src/sys/sys/cdefs.h
cvs rdiff -u -r1.43 -r1.43.10.1 src/sys/sys/cdefs_elf.h
cvs rdiff -u -r0 -r1.1.2.2 src/sys/sys/common_int_const.h \
    src/sys/sys/common_int_fmtio.h src/sys/sys/common_int_limits.h \
    src/sys/sys/common_int_mwgwtypes.h src/sys/sys/common_int_types.h
cvs rdiff -u -r1.144 -r1.144.10.1 src/sys/sys/conf.h
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/sys/cpu.h
cvs rdiff -u -r1.36 -r1.36.2.1 src/sys/sys/cpu_data.h
cvs rdiff -u -r1.18 -r1.18.10.1 src/sys/sys/dkio.h
cvs rdiff -u -r1.33 -r1.33.10.1 src/sys/sys/envsys.h
cvs rdiff -u -r1.140 -r1.140.2.1 src/sys/sys/exec_elf.h
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/sys/intr.h
cvs rdiff -u -r0 -r1.2.2.2 src/sys/sys/ipi.h
cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/sys/kcpuset.h
cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/sys/lua.h
cvs rdiff -u -r1.168 -r1.168.8.1 src/sys/sys/lwp.h
cvs rdiff -u -r1.114 -r1.114.12.1 src/sys/sys/malloc.h
cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/sys/mbuf.h
cvs rdiff -u -r1.45 -r1.45.2.1 src/sys/sys/mman.h
cvs rdiff -u -r1.34 -r1.34.2.1 src/sys/sys/module.h
cvs rdiff -u -r1.212 -r1.212.2.1 src/sys/sys/mount.h
cvs rdiff -u -r1.87 -r1.87.10.1 src/sys/sys/namei.h
cvs rdiff -u -r1.31 -r1.31.10.1 src/sys/sys/namei.src
cvs rdiff -u -r1.450 -r1.450.2.1 src/sys/sys/param.h
cvs rdiff -u -r1.1 -r1.1.48.1 src/sys/sys/pcq.h
cvs rdiff -u -r1.11 -r1.11.2.1 src/sys/sys/pcu.h
cvs rdiff -u -r1.75 -r1.75.12.1 src/sys/sys/pool.h
cvs rdiff -u -r1.44 -r1.44.54.1 src/sys/sys/protosw.h
cvs rdiff -u -r1.65 -r1.65.2.1 src/sys/sys/queue.h
cvs rdiff -u -r1.36 -r1.36.10.1 src/sys/sys/quotactl.h
cvs rdiff -u -r1.36 -r1.36.36.1 src/sys/sys/select.h
cvs rdiff -u -r1.85 -r1.85.2.1 src/sys/sys/signalvar.h
cvs rdiff -u -r1.22 -r1.22.12.1 src/sys/sys/sleepq.h
cvs rdiff -u -r1.108 -r1.108.10.1 src/sys/sys/socket.h
cvs rdiff -u -r1.131 -r1.131.2.1 src/sys/sys/socketvar.h
cvs rdiff -u -r1.268 -r1.268.2.1 src/sys/sys/syscall.h
cvs rdiff -u -r1.251 -r1.251.2.1 src/sys/sys/syscallargs.h
cvs rdiff -u -r1.211 -r1.211.2.1 src/sys/sys/sysctl.h
cvs rdiff -u -r1.35 -r1.35.10.1 src/sys/sys/syslog.h
cvs rdiff -u -r1.263 -r1.263.2.1 src/sys/sys/systm.h
cvs rdiff -u -r1.65 -r1.65.26.1 src/sys/sys/time.h
cvs rdiff -u -r1.91 -r1.91.10.1 src/sys/sys/tty.h
cvs rdiff -u -r1.9 -r1.9.136.1 src/sys/sys/ttydev.h
cvs rdiff -u -r1.46 -r1.46.26.1 src/sys/sys/un.h
cvs rdiff -u -r1.246 -r1.246.2.1 src/sys/sys/vnode.h
cvs rdiff -u -r1.87 -r1.87.2.1 src/sys/sys/vnode_if.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/Makefile
diff -u src/sys/sys/Makefile:1.148 src/sys/sys/Makefile:1.148.2.1
--- src/sys/sys/Makefile:1.148	Thu Mar 20 06:50:54 2014
+++ src/sys/sys/Makefile	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.148 2014/03/20 06:50:54 skrll Exp $
+#	$NetBSD: Makefile,v 1.148.2.1 2014/08/10 06:56:54 tls Exp $
 
 .include <bsd.own.mk>
 
@@ -7,7 +7,10 @@ INCSDIR= /usr/include/sys
 INCS=	acct.h agpio.h aio.h ansi.h aout_mids.h ataio.h atomic.h audioio.h \
 	bitops.h bootblock.h bswap.h buf.h \
 	callback.h callout.h cdbr.h cdefs.h cdefs_aout.h \
-	cdefs_elf.h cdio.h chio.h clockctl.h condvar.h conf.h core.h \
+	cdefs_elf.h cdio.h chio.h clockctl.h \
+	common_int_const.h common_int_fmtio.h common_int_limits.h \
+	common_int_mwgwtypes.h common_int_types.h \
+	condvar.h conf.h core.h \
 	cpufreq.h cpuio.h ctype_bits.h ctype_inline.h \
 	device.h device_if.h \
 	dir.h dirent.h \

Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.119 src/sys/sys/cdefs.h:1.119.2.1
--- src/sys/sys/cdefs.h:1.119	Thu Mar 13 20:36:01 2014
+++ src/sys/sys/cdefs.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.119 2014/03/13 20:36:01 pooka Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.119.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /* * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -296,6 +296,12 @@
 #define	__noprofile	/* nothing */
 #endif
 
+#if __GNUC_PREREQ__(4, 6) || defined(__clang__)
+#define	__unreachable()	__builtin_unreachable()
+#else
+#define	__unreachable()	do {} while (0)
+#endif
+
 #if defined(__cplusplus)
 #define	__BEGIN_EXTERN_C	extern "C" {
 #define	__END_EXTERN_C		}
@@ -353,14 +359,10 @@
 #define	__packed	__packed
 #define	__aligned(x)	/* delete */
 #define	__section(x)	/* delete */
-#elif __GNUC_PREREQ__(2, 7)
+#elif __GNUC_PREREQ__(2, 7) || defined(__PCC__)
 #define	__packed	__attribute__((__packed__))
 #define	__aligned(x)	__attribute__((__aligned__(x)))
 #define	__section(x)	__attribute__((__section__(x)))
-#elif defined(__PCC__)
-#define	__packed	_Pragma("packed 1")
-#define	__aligned(x)   	_Pragma("aligned " __STRING(x))
-#define	__section(x)   	_Pragma("section " ## x)
 #elif defined(_MSC_VER)
 #define	__packed	/* ignore */
 #else

Index: src/sys/sys/cdefs_elf.h
diff -u src/sys/sys/cdefs_elf.h:1.43 src/sys/sys/cdefs_elf.h:1.43.10.1
--- src/sys/sys/cdefs_elf.h:1.43	Thu Feb  7 18:53:34 2013
+++ src/sys/sys/cdefs_elf.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs_elf.h,v 1.43 2013/02/07 18:53:34 gdt Exp $	*/
+/*	$NetBSD: cdefs_elf.h,v 1.43.10.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -152,13 +152,13 @@
 #define	__link_set_add_data2(set, sym, n)   __link_set_make_entry2(set, sym, n)
 #define	__link_set_add_bss2(set, sym, n)    __link_set_make_entry2(set, sym, n)
 
-#define	__link_set_decl(set, ptype)					\
-	extern ptype * const __start_link_set_##set[] __dso_hidden;	\
-	extern ptype * const __stop_link_set_##set[] __dso_hidden
-
 #define	__link_set_start(set)	(__start_link_set_##set)
 #define	__link_set_end(set)	(__stop_link_set_##set)
 
+#define	__link_set_decl(set, ptype)					\
+	extern ptype * const __link_set_start(set)[] __dso_hidden;	\
+	extern ptype * const __link_set_end(set)[] __dso_hidden
+
 #define	__link_set_count(set)						\
 	(__link_set_end(set) - __link_set_start(set))
 

Index: src/sys/sys/conf.h
diff -u src/sys/sys/conf.h:1.144 src/sys/sys/conf.h:1.144.10.1
--- src/sys/sys/conf.h:1.144	Sat Oct 27 17:18:40 2012
+++ src/sys/sys/conf.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.144 2012/10/27 17:18:40 chs Exp $	*/
+/*	$NetBSD: conf.h,v 1.144.10.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -74,6 +74,7 @@ struct bdevsw {
 	int		(*d_ioctl)(dev_t, u_long, void *, int, struct lwp *);
 	int		(*d_dump)(dev_t, daddr_t, void *, size_t);
 	int		(*d_psize)(dev_t);
+	int		(*d_discard)(dev_t, off_t, off_t);
 	int		d_flag;
 };
 
@@ -91,6 +92,7 @@ struct cdevsw {
 	int		(*d_poll)(dev_t, int, struct lwp *);
 	paddr_t		(*d_mmap)(dev_t, off_t, int);
 	int		(*d_kqfilter)(dev_t, struct knote *);
+	int		(*d_discard)(dev_t, off_t, off_t);
 	int		d_flag;
 };
 
@@ -121,6 +123,7 @@ devmajor_t cdevsw_lookup_major(const str
 #define	dev_type_dump(n)	int n (dev_t, daddr_t, void *, size_t)
 #define	dev_type_size(n)	int n (dev_t)
 #define	dev_type_kqfilter(n)	int n (dev_t, struct knote *)
+#define dev_type_discard(n)	int n (dev_t, off_t, off_t)
 
 #define	noopen		((dev_type_open((*)))enodev)
 #define	noclose		((dev_type_close((*)))enodev)
@@ -134,6 +137,7 @@ devmajor_t cdevsw_lookup_major(const str
 #define	nodump		((dev_type_dump((*)))enodev)
 #define	nosize		NULL
 #define	nokqfilter	seltrue_kqfilter
+#define nodiscard	((dev_type_discard((*)))enodev)
 
 #define	nullopen	((dev_type_open((*)))nullop)
 #define	nullclose	((dev_type_close((*)))nullop)
@@ -145,6 +149,7 @@ devmajor_t cdevsw_lookup_major(const str
 #define	nullmmap	((dev_type_mmap((*)))nullop)
 #define	nulldump	((dev_type_dump((*)))nullop)
 #define	nullkqfilter	((dev_type_kqfilter((*)))eopnotsupp)
+#define nulldiscard	((dev_type_discard((*)))nullop)
 
 /* device access wrappers. */
 
@@ -154,6 +159,7 @@ dev_type_strategy(bdev_strategy);
 dev_type_ioctl(bdev_ioctl);
 dev_type_dump(bdev_dump);
 dev_type_size(bdev_size);
+dev_type_discard(bdev_discard);
 
 dev_type_open(cdev_open);
 dev_type_close(cdev_close);
@@ -165,6 +171,7 @@ dev_type_tty(cdev_tty);
 dev_type_poll(cdev_poll);
 dev_type_mmap(cdev_mmap);
 dev_type_kqfilter(cdev_kqfilter);
+dev_type_discard(cdev_discard);
 
 int	cdev_type(dev_t);
 int	bdev_type(dev_t);

Index: src/sys/sys/cpu.h
diff -u src/sys/sys/cpu.h:1.40 src/sys/sys/cpu.h:1.40.2.1
--- src/sys/sys/cpu.h:1.40	Mon Mar 24 20:07:40 2014
+++ src/sys/sys/cpu.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.40 2014/03/24 20:07:40 christos Exp $	*/
+/*	$NetBSD: cpu.h,v 1.40.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2007 YAMAMOTO Takashi,
@@ -101,7 +101,7 @@ extern kcpuset_t *kcpuset_attached;
 extern kcpuset_t *kcpuset_running;
 
 static inline u_int
-cpu_index(struct cpu_info *ci)
+cpu_index(const struct cpu_info *ci)
 {
 	return ci->ci_index;
 }

Index: src/sys/sys/cpu_data.h
diff -u src/sys/sys/cpu_data.h:1.36 src/sys/sys/cpu_data.h:1.36.2.1
--- src/sys/sys/cpu_data.h:1.36	Mon Nov 25 03:02:30 2013
+++ src/sys/sys/cpu_data.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_data.h,v 1.36 2013/11/25 03:02:30 christos Exp $	*/
+/*	$NetBSD: cpu_data.h,v 1.36.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -43,6 +43,7 @@ struct lwp;
 #include <sys/percpu_types.h>
 #include <sys/queue.h>
 #include <sys/kcpuset.h>
+#include <sys/ipi.h>
 
 /*
  * MI per-cpu data
@@ -71,6 +72,7 @@ struct cpu_data {
 	kcondvar_t	cpu_xcall;		/* cross-call support */
 	int		cpu_xcall_pending;	/* cross-call support */
 	lwp_t		*cpu_onproc;		/* bottom level LWP */
+	uint32_t	cpu_ipipend[IPI_BITWORDS];	/* pending IPIs */
 
 	cpuid_t		cpu_package_id;
 	cpuid_t		cpu_core_id;
@@ -123,6 +125,7 @@ struct cpu_data {
 #define	ci_lkdebug_recurse	ci_data.cpu_lkdebug_recurse
 #define	ci_pcu_curlwp		ci_data.cpu_pcu_curlwp
 #define	ci_kcpuset		ci_data.cpu_kcpuset
+#define	ci_ipipend		ci_data.cpu_ipipend
 
 #define	ci_package_id		ci_data.cpu_package_id
 #define	ci_core_id		ci_data.cpu_core_id

Index: src/sys/sys/dkio.h
diff -u src/sys/sys/dkio.h:1.18 src/sys/sys/dkio.h:1.18.10.1
--- src/sys/sys/dkio.h:1.18	Fri Oct 19 17:09:07 2012
+++ src/sys/sys/dkio.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: dkio.h,v 1.18 2012/10/19 17:09:07 drochner Exp $	*/
+/*	$NetBSD: dkio.h,v 1.18.10.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*
  * Copyright (c) 1987, 1988, 1993
@@ -109,15 +109,7 @@
 
 #define	DIOCTUR		_IOR('d', 128, int)	/* test unit ready */
 
-struct disk_discard_params {
-	long maxsize; /* in DEV_BSIZE units */
-};
-#define DIOCGDISCARDPARAMS _IOR('d', 129, struct disk_discard_params)
-
-struct disk_discard_range {
-	daddr_t bno;
-	long size;
-};
-#define DIOCDISCARD	_IOW('d', 130, struct disk_discard_range)
+/* 129 was DIOCGDISCARDPARAMS during 6.99 */
+/* 130 was DIOCDISCARD during 6.99 */
 
 #endif /* _SYS_DKIO_H_ */

Index: src/sys/sys/envsys.h
diff -u src/sys/sys/envsys.h:1.33 src/sys/sys/envsys.h:1.33.10.1
--- src/sys/sys/envsys.h:1.33	Wed Dec  5 04:21:30 2012
+++ src/sys/sys/envsys.h	Sun Aug 10 06:56:54 2014
@@ -1,7 +1,7 @@
-/* $NetBSD: envsys.h,v 1.33 2012/12/05 04:21:30 riastradh Exp $ */
+/* $NetBSD: envsys.h,v 1.33.10.1 2014/08/10 06:56:54 tls Exp $ */
 
 /*-
- * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999, 2007, 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -63,6 +63,7 @@ enum envsys_units {
 	ENVSYS_DRIVE,			/* Drive */
 	ENVSYS_BATTERY_CAPACITY,	/* Battery capacity */
 	ENVSYS_BATTERY_CHARGE,		/* Battery charging/discharging */
+	ENVSYS_SRELHUMIDITY,		/* relative humidity */
 	ENVSYS_NSENSORS
 };
 
@@ -161,7 +162,7 @@ typedef struct envsys_tre_data envsys_tr
 #ifdef ENVSYSUNITNAMES
 static const char * const envsysunitnames[] = {
     "degC", "RPM", "VAC", "V", "Ohms", "W",
-    "A", "Wh", "Ah", "bool", "integer", "drive", "Unk"
+    "A", "Wh", "Ah", "bool", "integer", "drive", "%rH", "Unk"
 };
 static const char * const envsysdrivestatus[] = {
     "unknown", "empty", "ready", "powering up", "online", "idle", "active",

Index: src/sys/sys/exec_elf.h
diff -u src/sys/sys/exec_elf.h:1.140 src/sys/sys/exec_elf.h:1.140.2.1
--- src/sys/sys/exec_elf.h:1.140	Sun Mar  9 17:59:19 2014
+++ src/sys/sys/exec_elf.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.h,v 1.140 2014/03/09 17:59:19 christos Exp $	*/
+/*	$NetBSD: exec_elf.h,v 1.140.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -1225,6 +1225,13 @@ typedef Elf32_Versym	Elf64_Versym;
 
 #ifdef _KERNEL
 
+/*
+ * Arbitrary limits to avoid DoS for excessive memory allocation.
+ */
+#define ELF_MAXPHNUM	128
+#define ELF_MAXSHNUM	32768
+#define ELF_MAXNOTESIZE	1024
+
 #define ELF_AUX_ENTRIES 15	/* Max size of aux array passed to loader */
 #define ELF32_NO_ADDR	(~(Elf32_Addr)0) /* Indicates addr. not yet filled in */
 #define ELF32_LINK_ADDR ((Elf32_Addr)-2) /* advises to use link address */

Index: src/sys/sys/intr.h
diff -u src/sys/sys/intr.h:1.16 src/sys/sys/intr.h:1.16.2.1
--- src/sys/sys/intr.h:1.16	Sun Aug 25 03:08:56 2013
+++ src/sys/sys/intr.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.16 2013/08/25 03:08:56 matt Exp $	*/
+/*	$NetBSD: intr.h,v 1.16.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -42,6 +42,7 @@ struct cpu_info;
 void	*softint_establish(u_int, void (*)(void *), void *);
 void	softint_disestablish(void *);
 void	softint_schedule(void *);
+void	softint_schedule_cpu(void *, struct cpu_info *);
 
 /* MI hooks. */
 void	softint_init(struct cpu_info *);
@@ -62,6 +63,7 @@ void	softint_dispatch(lwp_t *, int);
 #define	SOFTINT_SERIAL	0x0002
 #define	SOFTINT_NET	0x0003
 #define	SOFTINT_MPSAFE	0x0100
+#define	SOFTINT_RCPU	0x0200
 
 /* Implementation private flags. */
 #define	SOFTINT_PENDING	0x1000

Index: src/sys/sys/kcpuset.h
diff -u src/sys/sys/kcpuset.h:1.10 src/sys/sys/kcpuset.h:1.10.2.1
--- src/sys/sys/kcpuset.h:1.10	Tue Mar 18 18:20:44 2014
+++ src/sys/sys/kcpuset.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kcpuset.h,v 1.10 2014/03/18 18:20:44 riastradh Exp $	*/
+/*	$NetBSD: kcpuset.h,v 1.10.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2011 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@ bool		kcpuset_match(const kcpuset_t *, c
 void		kcpuset_intersect(kcpuset_t *, const kcpuset_t *);
 void		kcpuset_merge(kcpuset_t *, const kcpuset_t *);
 void		kcpuset_remove(kcpuset_t *, const kcpuset_t *);
-int		kcpuset_countset(kcpuset_t *);
+int		kcpuset_countset(const kcpuset_t *);
 
 cpuid_t		kcpuset_ffs(const kcpuset_t *);
 cpuid_t		kcpuset_ffs_intersecting(const kcpuset_t *, const kcpuset_t *);

Index: src/sys/sys/lua.h
diff -u src/sys/sys/lua.h:1.3 src/sys/sys/lua.h:1.3.2.1
--- src/sys/sys/lua.h:1.3	Tue Oct 29 17:35:40 2013
+++ src/sys/sys/lua.h	Sun Aug 10 06:56:54 2014
@@ -1,6 +1,7 @@
-/*	$NetBSD: lua.h,v 1.3 2013/10/29 17:35:40 mbalmer Exp $ */
+/*	$NetBSD: lua.h,v 1.3.2.1 2014/08/10 06:56:54 tls Exp $ */
 
 /*
+ * Copyright (c) 2014 by Lourival Vieira Neto <ln...@netbsd.org>.
  * Copyright (c) 2011, 2013 Marc Balmer <mbal...@netbsd.org>.
  * All rights reserved.
  *
@@ -79,25 +80,22 @@ struct lua_load {
 #define LUALOAD		_IOWR('l', 4, struct lua_load)
 
 #ifdef _KERNEL
-extern int lua_mod_register(const char *, int (*)(void *));
-extern int lua_mod_unregister(const char *);
+extern int klua_mod_register(const char *, lua_CFunction);
+extern int klua_mod_unregister(const char *);
 
 typedef struct _klua_State {
 	lua_State	*L;
 	kmutex_t	 ks_lock;
-	kcondvar_t	 ks_inuse_cv;
-	int		 ks_inuse;
 	bool		 ks_user;	/* state created by user (ioctl) */
 } klua_State;
 
-extern int klua_lock(klua_State *);
+extern void klua_lock(klua_State *);
 extern void klua_unlock(klua_State *);
 
 extern void klua_close(klua_State *);
-extern klua_State *klua_newstate(lua_Alloc, void *, const char *, const char *);
-
-extern void *lua_alloc(void *, void *, size_t, size_t);
-
+extern klua_State *klua_newstate(lua_Alloc, void *, const char *, const char *,
+		int);
+extern klua_State *kluaL_newstate(const char *, const char *, int);
 #endif
 
 #endif /* _SYS_LUA_H_ */

Index: src/sys/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.168 src/sys/sys/lwp.h:1.168.8.1
--- src/sys/sys/lwp.h:1.168	Fri Mar 29 01:09:45 2013
+++ src/sys/sys/lwp.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.168 2013/03/29 01:09:45 christos Exp $	*/
+/*	$NetBSD: lwp.h,v 1.168.8.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -129,7 +129,7 @@ struct lwp {
 
 #if PCU_UNIT_COUNT > 0
 	struct cpu_info	* volatile l_pcu_cpu[PCU_UNIT_COUNT];
-	uint16_t	l_pcu_used[2];
+	uint32_t	l_pcu_valid;
 #endif
 
 	/* Process level and global state, misc. */

Index: src/sys/sys/malloc.h
diff -u src/sys/sys/malloc.h:1.114 src/sys/sys/malloc.h:1.114.12.1
--- src/sys/sys/malloc.h:1.114	Mon Apr 30 22:51:27 2012
+++ src/sys/sys/malloc.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: malloc.h,v 1.114 2012/04/30 22:51:27 rmind Exp $	*/
+/*	$NetBSD: malloc.h,v 1.114.12.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993
@@ -56,7 +56,6 @@
 MALLOC_DECLARE(M_DEVBUF);
 MALLOC_DECLARE(M_DMAMAP);
 MALLOC_DECLARE(M_FREE);
-MALLOC_DECLARE(M_PCB);
 MALLOC_DECLARE(M_TEMP);
 MALLOC_DECLARE(M_RTABLE);
 MALLOC_DECLARE(M_FTABLE);

Index: src/sys/sys/mbuf.h
diff -u src/sys/sys/mbuf.h:1.154 src/sys/sys/mbuf.h:1.154.2.1
--- src/sys/sys/mbuf.h:1.154	Thu Mar 20 00:29:57 2014
+++ src/sys/sys/mbuf.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.h,v 1.154 2014/03/20 00:29:57 pooka Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.154.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -818,7 +818,6 @@ extern struct mowner revoked_mowner;
 
 MALLOC_DECLARE(M_MBUF);
 MALLOC_DECLARE(M_SONAME);
-MALLOC_DECLARE(M_SOOPTS);
 
 struct	mbuf *m_copym(struct mbuf *, int, int, int);
 struct	mbuf *m_copypacket(struct mbuf *, int);

Index: src/sys/sys/mman.h
diff -u src/sys/sys/mman.h:1.45 src/sys/sys/mman.h:1.45.2.1
--- src/sys/sys/mman.h:1.45	Thu Dec 19 19:11:50 2013
+++ src/sys/sys/mman.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mman.h,v 1.45 2013/12/19 19:11:50 rmind Exp $	*/
+/*	$NetBSD: mman.h,v 1.45.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -94,7 +94,8 @@ typedef	__off_t		off_t;		/* file offset 
  * Mapping type
  */
 #define	MAP_FILE	0x0000	/* map from file (default) */
-#define	MAP_ANON	0x1000	/* allocated from memory, swap space */
+#define	MAP_ANONYMOUS	0x1000	/* allocated from memory, swap space */
+#define	MAP_ANON	MAP_ANONYMOUS
 #define	MAP_STACK	0x2000	/* allocated from memory, swap space (stack) */
 
 /*
@@ -131,7 +132,7 @@ typedef	__off_t		off_t;		/* file offset 
 
 /*
  * POSIX memory avissory values.
- * Note: keep consistent with the original defintions below.
+ * Note: keep consistent with the original definitions below.
  */
 #define	POSIX_MADV_NORMAL	0	/* No further special treatment */
 #define	POSIX_MADV_RANDOM	1	/* Expect random page references */
@@ -141,7 +142,7 @@ typedef	__off_t		off_t;		/* file offset 
 
 #if defined(_NETBSD_SOURCE)
 /*
- * Original advice values, equivalent to POSIX defintions,
+ * Original advice values, equivalent to POSIX definitions,
  * and few implementation-specific ones.
  */
 #define	MADV_NORMAL		POSIX_MADV_NORMAL
@@ -160,6 +161,7 @@ typedef	__off_t		off_t;		/* file offset 
 #define	MAP_INHERIT_NONE	2	/* absent from child */
 #define	MAP_INHERIT_DONATE_COPY	3	/* copy and delete -- not
 					   implemented in UVM */
+#define	MAP_INHERIT_ZERO	4	/* zero in child */
 #define	MAP_INHERIT_DEFAULT	MAP_INHERIT_COPY
 #endif
 

Index: src/sys/sys/module.h
diff -u src/sys/sys/module.h:1.34 src/sys/sys/module.h:1.34.2.1
--- src/sys/sys/module.h:1.34	Wed Oct 23 18:57:40 2013
+++ src/sys/sys/module.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: module.h,v 1.34 2013/10/23 18:57:40 mbalmer Exp $	*/
+/*	$NetBSD: module.h,v 1.34.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -101,7 +101,35 @@ typedef struct module {
  * containing only one entry, pointing to the module's modinfo_t record.
  * For the kernel, `link_set_modules' can contain multiple entries and
  * records all modules built into the kernel at link time.
+ *
+ * Alternatively, in some environments rump kernels use
+ * __attribute__((constructor)) due to link sets being
+ * difficult (impossible?) to implement (e.g. GNU gold, OS X, etc.)
  */
+
+#ifdef RUMP_USE_CTOR
+struct modinfo_chain {
+	const struct modinfo	*mc_info;
+	LIST_ENTRY(modinfo_chain) mc_entries;
+};
+LIST_HEAD(modinfo_boot_chain, modinfo_chain);
+#define _MODULE_REGISTER(name)						\
+static void modctor_##name(void) __attribute__((constructor));		\
+static void modctor_##name(void)					\
+{									\
+	static struct modinfo_chain mc = {				\
+		.mc_info = &name##_modinfo,				\
+	};								\
+	extern struct modinfo_boot_chain modinfo_boot_chain;		\
+	LIST_INSERT_HEAD(&modinfo_boot_chain, &mc, mc_entries);		\
+}
+
+#else /* RUMP_USE_CTOR */
+
+#define _MODULE_REGISTER(name) __link_set_add_rodata(modules, name##_modinfo);
+
+#endif /* RUMP_USE_CTOR */
+
 #define	MODULE(class, name, required)				\
 static int name##_modcmd(modcmd_t, void *);			\
 static const modinfo_t name##_modinfo = {			\
@@ -111,7 +139,7 @@ static const modinfo_t name##_modinfo = 
 	.mi_name = #name,					\
 	.mi_required = (required)				\
 }; 								\
-__link_set_add_rodata(modules, name##_modinfo);
+_MODULE_REGISTER(name)
 
 TAILQ_HEAD(modlist, module);
 

Index: src/sys/sys/mount.h
diff -u src/sys/sys/mount.h:1.212 src/sys/sys/mount.h:1.212.2.1
--- src/sys/sys/mount.h:1.212	Wed Mar  5 09:37:29 2014
+++ src/sys/sys/mount.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mount.h,v 1.212 2014/03/05 09:37:29 hannken Exp $	*/
+/*	$NetBSD: mount.h,v 1.212.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -220,6 +220,8 @@ struct vfsops {
 	int	(*vfs_statvfs)	(struct mount *, struct statvfs *);
 	int	(*vfs_sync)	(struct mount *, int, struct kauth_cred *);
 	int	(*vfs_vget)	(struct mount *, ino_t, struct vnode **);
+	int	(*vfs_loadvnode) (struct mount *, struct vnode *,
+				    const void *, size_t, const void **);
 	int	(*vfs_fhtovp)	(struct mount *, struct fid *,
 				    struct vnode **);
 	int	(*vfs_vptofh)	(struct vnode *, struct fid *, size_t *);
@@ -242,6 +244,8 @@ struct vfsops {
 
 /* XXX vget is actually file system internal. */
 #define VFS_VGET(MP, INO, VPP)    (*(MP)->mnt_op->vfs_vget)(MP, INO, VPP)
+#define VFS_LOADVNODE(MP, VP, KEY, KEY_LEN, NEW_KEY) \
+	(*(MP)->mnt_op->vfs_loadvnode)(MP, VP, KEY, KEY_LEN, NEW_KEY)
 
 #define VFS_RENAMELOCK_ENTER(MP)  (*(MP)->mnt_op->vfs_renamelock_enter)(MP)
 #define VFS_RENAMELOCK_EXIT(MP)   (*(MP)->mnt_op->vfs_renamelock_exit)(MP)
@@ -281,6 +285,8 @@ int	fsname##_quotactl(struct mount *, st
 int	fsname##_statvfs(struct mount *, struct statvfs *);		\
 int	fsname##_sync(struct mount *, int, struct kauth_cred *);	\
 int	fsname##_vget(struct mount *, ino_t, struct vnode **);		\
+int	fsname##_loadvnode(struct mount *, struct vnode *,		\
+		const void *, size_t, const void **);			\
 int	fsname##_fhtovp(struct mount *, struct fid *, struct vnode **);	\
 int	fsname##_vptofh(struct vnode *, struct fid *, size_t *);	\
 void	fsname##_init(void);						\
@@ -421,7 +427,7 @@ int	vfs_quotactl_get(struct mount *, con
 	    struct quotaval *);
 int	vfs_quotactl_put(struct mount *, const struct quotakey *,
 	    const struct quotaval *);
-int	vfs_quotactl_delete(struct mount *, const struct quotakey *);
+int	vfs_quotactl_del(struct mount *, const struct quotakey *);
 int	vfs_quotactl_cursoropen(struct mount *, struct quotakcursor *);
 int	vfs_quotactl_cursorclose(struct mount *, struct quotakcursor *);
 int	vfs_quotactl_cursorskipidtype(struct mount *, struct quotakcursor *,
@@ -436,7 +442,8 @@ int	vfs_quotactl_quotaoff(struct mount *
 struct vnode_iterator; /* Opaque. */
 void	vfs_vnode_iterator_init(struct mount *, struct vnode_iterator **);
 void	vfs_vnode_iterator_destroy(struct vnode_iterator *);
-bool	vfs_vnode_iterator_next(struct vnode_iterator *, struct vnode **);
+struct vnode *vfs_vnode_iterator_next(struct vnode_iterator *,
+    bool (*)(void *, struct vnode *), void *);
 
 extern	TAILQ_HEAD(mntlist, mount) mountlist;	/* mounted filesystem list */
 extern	struct vfsops *vfssw[];			/* filesystem type table */

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.87 src/sys/sys/namei.h:1.87.10.1
--- src/sys/sys/namei.h:1.87	Sun Nov 18 18:25:50 2012
+++ src/sys/sys/namei.h	Sun Aug 10 06:56:54 2014
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.87 2012/11/18 18:25:50 dholland Exp $	*/
+/*	$NetBSD: namei.h,v 1.87.10.1 2014/08/10 06:56:54 tls Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.31 2012/11/18 18:25:08 dholland Exp 
+ *   from: NetBSD: namei.src,v 1.33 2014/06/03 21:16:15 joerg Exp 
  */
 
 /*
@@ -286,6 +286,8 @@ void	cache_enter(struct vnode *, struct 
 			const char *, size_t, uint32_t);
 void	nchinit(void);
 void	nchreinit(void);
+void	namecache_count_pass2(void);
+void	namecache_count_2passes(void);
 void	cache_cpu_init(struct cpu_info *);
 void	cache_purgevfs(struct mount *);
 void	namecache_print(struct vnode *, void (*)(const char *, ...)
@@ -310,6 +312,19 @@ struct	nchstats {
 	long	ncs_revmiss;		/* reverse-cache misses */
 };
 
+struct	nchstats_sysctl {
+	uint64_t ncs_goodhits;		/* hits that we can really use */
+	uint64_t ncs_neghits;		/* negative hits that we can use */
+	uint64_t ncs_badhits;		/* hits we must drop */
+	uint64_t ncs_falsehits;		/* hits with id mismatch */
+	uint64_t ncs_miss;		/* misses */
+	uint64_t ncs_long;		/* long names that ignore cache */
+	uint64_t ncs_pass2;		/* names found with passes == 2 */
+	uint64_t ncs_2passes;		/* number of times we attempt it */
+	uint64_t ncs_revhits;		/* reverse-cache hits */
+	uint64_t ncs_revmiss;		/* reverse-cache misses */
+};
+
 #ifdef _KERNEL
 extern struct nchstats nchstats;
 #endif

Index: src/sys/sys/namei.src
diff -u src/sys/sys/namei.src:1.31 src/sys/sys/namei.src:1.31.10.1
--- src/sys/sys/namei.src:1.31	Sun Nov 18 18:25:08 2012
+++ src/sys/sys/namei.src	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: namei.src,v 1.31 2012/11/18 18:25:08 dholland Exp $	*/
+/*	$NetBSD: namei.src,v 1.31.10.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -278,6 +278,8 @@ void	cache_enter(struct vnode *, struct 
 			const char *, size_t, uint32_t);
 void	nchinit(void);
 void	nchreinit(void);
+void	namecache_count_pass2(void);
+void	namecache_count_2passes(void);
 void	cache_cpu_init(struct cpu_info *);
 void	cache_purgevfs(struct mount *);
 void	namecache_print(struct vnode *, void (*)(const char *, ...)
@@ -302,6 +304,19 @@ struct	nchstats {
 	long	ncs_revmiss;		/* reverse-cache misses */
 };
 
+struct	nchstats_sysctl {
+	uint64_t ncs_goodhits;		/* hits that we can really use */
+	uint64_t ncs_neghits;		/* negative hits that we can use */
+	uint64_t ncs_badhits;		/* hits we must drop */
+	uint64_t ncs_falsehits;		/* hits with id mismatch */
+	uint64_t ncs_miss;		/* misses */
+	uint64_t ncs_long;		/* long names that ignore cache */
+	uint64_t ncs_pass2;		/* names found with passes == 2 */
+	uint64_t ncs_2passes;		/* number of times we attempt it */
+	uint64_t ncs_revhits;		/* reverse-cache hits */
+	uint64_t ncs_revmiss;		/* reverse-cache misses */
+};
+
 #ifdef _KERNEL
 extern struct nchstats nchstats;
 #endif

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.450 src/sys/sys/param.h:1.450.2.1
--- src/sys/sys/param.h:1.450	Fri Apr  4 18:11:58 2014
+++ src/sys/sys/param.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.450 2014/04/04 18:11:58 christos Exp $	*/
+/*	$NetBSD: param.h,v 1.450.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	699004000	/* NetBSD 6.99.40 */
+#define	__NetBSD_Version__	699004900	/* NetBSD 6.99.49 */
 
 #define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
     (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)

Index: src/sys/sys/pcq.h
diff -u src/sys/sys/pcq.h:1.1 src/sys/sys/pcq.h:1.1.48.1
--- src/sys/sys/pcq.h:1.1	Tue Nov 11 20:17:27 2008
+++ src/sys/sys/pcq.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcq.h,v 1.1 2008/11/11 20:17:27 matt Exp $	*/
+/*	$NetBSD: pcq.h,v 1.1.48.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -37,12 +37,16 @@
 typedef struct pcq pcq_t;
 
 #ifdef _KERNEL
+
+#define	PCQ_MAXLEN	(0xffffU)
+
 bool	pcq_put(pcq_t *, void *);
 void *	pcq_peek(pcq_t *);
 void *	pcq_get(pcq_t *);
 size_t	pcq_maxitems(pcq_t *);
 pcq_t *	pcq_create(size_t, km_flag_t);
 void	pcq_destroy(pcq_t *);
+
 #endif /* _KERNEL */
 
 #endif /* _SYS_PCQ_H_ */

Index: src/sys/sys/pcu.h
diff -u src/sys/sys/pcu.h:1.11 src/sys/sys/pcu.h:1.11.2.1
--- src/sys/sys/pcu.h:1.11	Thu Aug 22 19:50:55 2013
+++ src/sys/sys/pcu.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcu.h,v 1.11 2013/08/22 19:50:55 drochner Exp $	*/
+/*	$NetBSD: pcu.h,v 1.11.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -50,31 +50,31 @@
 #if PCU_UNIT_COUNT > 0
 
 /*
- * pcu_state_save(lwp, flags)
- *	save the current CPU's state into the given LWP's MD storage.
+ * pcu_state_save(lwp)
+ *	Tells MD code to save the current CPU's state into the given
+ *	LWP's MD storage.
  *
  * pcu_state_load(lwp, flags)
- *	load PCU state from the given LWP's MD storage to the current CPU.
- *	the 'flags' argument contains PCU_LOADED if it isn't the first time
- *	the LWP has used the PCU.
+ *	Tells MD code to load PCU state from the given LWP's MD storage
+ *	to the current CPU.
  *
- * pcu_state_release(lwp, flags)
- *	tell MD code detect the next use of the PCU on the LWP, and call
- *	pcu_load().
+ * pcu_state_release(lwp)
+ *	Tells MD code detect the next use of the PCU on the LWP and
+ *	call pcu_load().
  */
 
 typedef struct {
 	u_int	pcu_id;
-	void	(*pcu_state_save)(lwp_t *, u_int);
-	void	(*pcu_state_load)(lwp_t *, u_int);
-	void	(*pcu_state_release)(lwp_t *, u_int);
+	void	(*pcu_state_save)(lwp_t *);
+	void	(*pcu_state_load)(lwp_t *, unsigned);
+	void	(*pcu_state_release)(lwp_t *);
 } pcu_ops_t;
 
-#define	PCU_USER	0x00		/* PCU state is for the user */
-#define	PCU_KERNEL	0x01		/* PCU state is for the kernel */
-#define	PCU_RELOAD	0x02		/* Load registers into the PCU, */
-#define	PCU_ENABLE	0x04		/* Enable the PCU, */
-#define	PCU_LOADED	0x08		/* LWP has used the PCU before, */
+/*
+ * Flags for the pcu_state_load() operation.
+ */
+#define	PCU_VALID	0x01	/* PCU state is considered valid */
+#define	PCU_REENABLE	0x02	/* the state is present, re-enable PCU */
 
 void	pcu_switchpoint(lwp_t *);
 void	pcu_discard_all(lwp_t *);
@@ -84,9 +84,7 @@ void	pcu_load(const pcu_ops_t *);
 void	pcu_save(const pcu_ops_t *);
 void	pcu_save_all_on_cpu(void);
 void	pcu_discard(const pcu_ops_t *, bool);
-void	pcu_kernel_acquire(const pcu_ops_t *);
-void	pcu_kernel_release(const pcu_ops_t *);
-bool	pcu_used_p(const pcu_ops_t *);
+bool	pcu_valid_p(const pcu_ops_t *);
 
 #else
 #define	pcu_switchpoint(l)

Index: src/sys/sys/pool.h
diff -u src/sys/sys/pool.h:1.75 src/sys/sys/pool.h:1.75.12.1
--- src/sys/sys/pool.h:1.75	Tue Jun  5 22:51:47 2012
+++ src/sys/sys/pool.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pool.h,v 1.75 2012/06/05 22:51:47 jym Exp $	*/
+/*	$NetBSD: pool.h,v 1.75.12.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2007 The NetBSD Foundation, Inc.
@@ -32,6 +32,39 @@
 
 #ifndef _SYS_POOL_H_
 #define _SYS_POOL_H_
+#include <sys/stdint.h>
+
+struct pool_sysctl {
+	char pr_wchan[16];
+	uint64_t pr_flags;
+	uint64_t pr_size;
+	uint64_t pr_pagesize;
+	uint64_t pr_itemsperpage;
+	uint64_t pr_nitems;
+	uint64_t pr_nout;
+	uint64_t pr_hardlimit;
+	uint64_t pr_npages;
+	uint64_t pr_minpages;
+	uint64_t pr_maxpages;
+
+	uint64_t pr_nget;
+	uint64_t pr_nfail;
+	uint64_t pr_nput;
+	uint64_t pr_npagealloc;
+	uint64_t pr_npagefree;
+	uint64_t pr_hiwat;
+	uint64_t pr_nidle;
+
+	uint64_t pr_cache_meta_size;
+	uint64_t pr_cache_nfull;
+	uint64_t pr_cache_npartial;
+	uint64_t pr_cache_nempty;
+	uint64_t pr_cache_ncontended;
+	uint64_t pr_cache_nmiss_global;
+	uint64_t pr_cache_nhit_global;
+	uint64_t pr_cache_nmiss_pcpu;
+	uint64_t pr_cache_nhit_pcpu;
+};
 
 #ifdef _KERNEL
 #define	__POOL_EXPOSE

Index: src/sys/sys/protosw.h
diff -u src/sys/sys/protosw.h:1.44 src/sys/sys/protosw.h:1.44.54.1
--- src/sys/sys/protosw.h:1.44	Wed Aug  6 15:01:24 2008
+++ src/sys/sys/protosw.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: protosw.h,v 1.44 2008/08/06 15:01:24 plunky Exp $	*/
+/*	$NetBSD: protosw.h,v 1.44.54.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -58,12 +58,15 @@
  */
 
 struct mbuf;
+struct ifnet;
 struct sockaddr;
 struct socket;
 struct sockopt;
+struct stat;
 struct domain;
 struct proc;
 struct lwp;
+struct pr_usrreqs;
 
 struct protosw {
 	int 	pr_type;		/* socket type used for */
@@ -81,10 +84,8 @@ struct protosw {
 	int	(*pr_ctloutput)		/* control output (from above) */
 			(int, struct socket *, struct sockopt *);
 
-/* user-protocol hook */
-	int	(*pr_usrreq)		/* user request: see list below */
-			(struct socket *, int, struct mbuf *,
-			     struct mbuf *, struct mbuf *, struct lwp *);
+/* user-protocol hooks */
+	const struct pr_usrreqs *pr_usrreqs;
 
 /* utility hooks */
 	void	(*pr_init)		/* initialization hook */
@@ -109,14 +110,14 @@ struct protosw {
 #define	PR_ATOMIC	0x01		/* exchange atomic messages only */
 #define	PR_ADDR		0x02		/* addresses given with messages */
 #define	PR_CONNREQUIRED	0x04		/* connection required by protocol */
-#define	PR_WANTRCVD	0x08		/* want PRU_RCVD calls */
+#define	PR_WANTRCVD	0x08		/* want pr_rcvd() calls */
 #define	PR_RIGHTS	0x10		/* passes capabilities */
 #define	PR_LISTEN	0x20		/* supports listen(2) and accept(2) */
 #define	PR_LASTHDR	0x40		/* enforce ipsec policy; last header */
 #define	PR_ABRTACPTDIS	0x80		/* abort on accept(2) to disconnected
 					   socket */
 #define PR_PURGEIF	0x100		/* might store struct ifnet pointer;
-					   PRU_PURGEIF must be called on ifnet
+					   pr_purgeif() must be called on ifnet
 					   deletion */
 
 /*
@@ -233,6 +234,32 @@ static const char * const prcorequests[]
 #endif
 
 #ifdef _KERNEL
+
+struct pr_usrreqs {
+	int	(*pr_attach)(struct socket *, int);
+	void	(*pr_detach)(struct socket *);
+	int	(*pr_accept)(struct socket *, struct mbuf *);
+	int	(*pr_connect)(struct socket *, struct mbuf *, struct lwp *);
+	int	(*pr_connect2)(struct socket *, struct socket *);
+	int	(*pr_bind)(struct socket *, struct mbuf *, struct lwp *);
+	int	(*pr_listen)(struct socket *, struct lwp *);
+	int	(*pr_disconnect)(struct socket *);
+	int	(*pr_shutdown)(struct socket *);
+	int	(*pr_abort)(struct socket *);
+	int	(*pr_ioctl)(struct socket *, u_long, void *, struct ifnet *);
+	int	(*pr_stat)(struct socket *, struct stat *);
+	int	(*pr_peeraddr)(struct socket *, struct mbuf *);
+	int	(*pr_sockaddr)(struct socket *, struct mbuf *);
+	int	(*pr_rcvd)(struct socket *, int, struct lwp *);
+	int	(*pr_recvoob)(struct socket *, struct mbuf *, int);
+	int	(*pr_send)(struct socket *, struct mbuf *, struct mbuf *,
+	    struct mbuf *, struct lwp *);
+	int	(*pr_sendoob)(struct socket *, struct mbuf *, struct mbuf *);
+	int	(*pr_purgeif)(struct socket *, struct ifnet *);
+	int	(*pr_generic)(struct socket *, int, struct mbuf *,
+	    struct mbuf *, struct mbuf *, struct lwp *);
+};
+
 /*
  * Monotonically increasing time values for slow and fast timers.
  */
@@ -263,14 +290,193 @@ void pfctlinput2(int, const struct socka
  */
 #include <sys/systm.h>	/* kernel_lock */
 
-#define	PR_WRAP_USRREQ(name)				\
+#define	PR_WRAP_USRREQS(name)				\
+static int						\
+name##_attach_wrapper(struct socket *a, int b)		\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_attach(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static void						\
+name##_detach_wrapper(struct socket *a)			\
+{							\
+	KERNEL_LOCK(1, NULL);				\
+	name##_detach(a);				\
+	KERNEL_UNLOCK_ONE(NULL);			\
+}							\
+static int						\
+name##_accept_wrapper(struct socket *a, struct mbuf *b)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_accept(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_bind_wrapper(struct socket *a, struct mbuf *b,	\
+    struct lwp *c)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_bind(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_connect_wrapper(struct socket *a,		\
+    struct mbuf *b, struct lwp *c)			\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_connect(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_connect2_wrapper(struct socket *a,		\
+    struct socket *b)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_connect2(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_listen_wrapper(struct socket *a, struct lwp *b)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_listen(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_disconnect_wrapper(struct socket *a)		\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_disconnect(a);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_shutdown_wrapper(struct socket *a)		\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_shutdown(a);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_abort_wrapper(struct socket *a)			\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_abort(a);				\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_ioctl_wrapper(struct socket *a, u_long b,	\
+    void *c, struct ifnet *d)				\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_ioctl(a, b, c, d);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_stat_wrapper(struct socket *a, struct stat *b)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_stat(a, b);				\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_peeraddr_wrapper(struct socket *a, struct mbuf *b)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_peeraddr(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_sockaddr_wrapper(struct socket *a, struct mbuf *b)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_sockaddr(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_rcvd_wrapper(struct socket *a, int b,		\
+    struct lwp *c)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_rcvd(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_recvoob_wrapper(struct socket *a,		\
+    struct mbuf *b, int c)				\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_recvoob(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_send_wrapper(struct socket *a, struct mbuf *b,	\
+    struct mbuf *c, struct mbuf *d, struct lwp *e)	\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_send(a, b, c, d, e);		\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_sendoob_wrapper(struct socket *a,		\
+    struct mbuf *b, struct mbuf *c)			\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_sendoob(a, b, c);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
+static int						\
+name##_purgeif_wrapper(struct socket *a,		\
+    struct ifnet *b)					\
+{							\
+	int rv;						\
+	KERNEL_LOCK(1, NULL);				\
+	rv = name##_purgeif(a, b);			\
+	KERNEL_UNLOCK_ONE(NULL);			\
+	return rv;					\
+}							\
 static int						\
-name##_wrapper(struct socket *a, int b, struct mbuf *c,	\
-     struct mbuf *d, struct mbuf *e, struct lwp *f)	\
+name##_usrreq_wrapper(struct socket *a, int b,		\
+    struct mbuf *c, struct mbuf *d, struct mbuf *e,	\
+    struct lwp *f)					\
 {							\
 	int rv;						\
 	KERNEL_LOCK(1, NULL);				\
-	rv = name(a, b, c, d, e, f);			\
+	rv = name##_usrreq(a, b, c, d, e, f);		\
 	KERNEL_UNLOCK_ONE(NULL);			\
 	return rv;					\
 }

Index: src/sys/sys/queue.h
diff -u src/sys/sys/queue.h:1.65 src/sys/sys/queue.h:1.65.2.1
--- src/sys/sys/queue.h:1.65	Wed Dec 25 17:19:34 2013
+++ src/sys/sys/queue.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: queue.h,v 1.65 2013/12/25 17:19:34 christos Exp $	*/
+/*	$NetBSD: queue.h,v 1.65.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -211,6 +211,14 @@ struct {								\
 	    ((tvar) = LIST_NEXT((var), field), 1);			\
 	    (var) = (tvar))
 
+#define	LIST_MOVE(head1, head2) do {					\
+	LIST_INIT((head2));						\
+	if (!LIST_EMPTY((head1))) {					\
+		(head2)->lh_first = (head1)->lh_first;			\
+		LIST_INIT((head1));					\
+	}								\
+} while (/*CONSTCOND*/0)
+
 /*
  * List functions.
  */

Index: src/sys/sys/quotactl.h
diff -u src/sys/sys/quotactl.h:1.36 src/sys/sys/quotactl.h:1.36.10.1
--- src/sys/sys/quotactl.h:1.36	Sat Dec  1 11:41:50 2012
+++ src/sys/sys/quotactl.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: quotactl.h,v 1.36 2012/12/01 11:41:50 mbalmer Exp $	*/
+/*	$NetBSD: quotactl.h,v 1.36.10.1 2014/08/10 06:56:54 tls Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -83,7 +83,7 @@ struct quotakcursor {
 #define QUOTACTL_OBJTYPESTAT	2
 #define QUOTACTL_GET		3
 #define QUOTACTL_PUT		4
-#define QUOTACTL_DELETE		5
+#define QUOTACTL_DEL		5
 #define QUOTACTL_CURSOROPEN	6
 #define QUOTACTL_CURSORCLOSE	7
 #define QUOTACTL_CURSORSKIPIDTYPE 8
@@ -118,7 +118,7 @@ struct quotactl_args {
 		} put;
 		struct {
 			const struct quotakey *qc_key;
-		} delete;
+		} del;
 		struct {
 			struct quotakcursor *qc_cursor;
 		} cursoropen;

Index: src/sys/sys/select.h
diff -u src/sys/sys/select.h:1.36 src/sys/sys/select.h:1.36.36.1
--- src/sys/sys/select.h:1.36	Wed Nov 11 09:48:51 2009
+++ src/sys/sys/select.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: select.h,v 1.36 2009/11/11 09:48:51 rmind Exp $	*/
+/*	$NetBSD: select.h,v 1.36.36.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -55,7 +55,6 @@ void	selnotify(struct selinfo *, int, lo
 void	selsysinit(struct cpu_info *);
 void	selinit(struct selinfo *);
 void	seldestroy(struct selinfo *);
-int	pollsock(struct socket *, const struct timespec *, int);
 
 #else /* _KERNEL */
 

Index: src/sys/sys/signalvar.h
diff -u src/sys/sys/signalvar.h:1.85 src/sys/sys/signalvar.h:1.85.2.1
--- src/sys/sys/signalvar.h:1.85	Wed Jan  1 18:57:16 2014
+++ src/sys/sys/signalvar.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: signalvar.h,v 1.85 2014/01/01 18:57:16 dsl Exp $	*/
+/*	$NetBSD: signalvar.h,v 1.85.2.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -130,7 +130,7 @@ void	kpsignal(struct proc *, struct ksig
 void	child_psignal(struct proc *, int);
 void	siginit(struct proc *);
 void	trapsignal(struct lwp *, struct ksiginfo *);
-void	sigexit(struct lwp *, int);
+void	sigexit(struct lwp *, int) __dead;
 void	killproc(struct proc *, const char *);
 void	setsigvec(struct proc *, int, struct sigaction *);
 int	killpg1(struct lwp *, struct ksiginfo *, int, int);

Index: src/sys/sys/sleepq.h
diff -u src/sys/sys/sleepq.h:1.22 src/sys/sys/sleepq.h:1.22.12.1
--- src/sys/sys/sleepq.h:1.22	Sun Feb 19 21:07:00 2012
+++ src/sys/sys/sleepq.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sleepq.h,v 1.22 2012/02/19 21:07:00 rmind Exp $	*/
+/*	$NetBSD: sleepq.h,v 1.22.12.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@ void	sleepq_remove(sleepq_t *, lwp_t *);
 void	sleepq_enqueue(sleepq_t *, wchan_t, const char *, syncobj_t *);
 void	sleepq_unsleep(lwp_t *, bool);
 void	sleepq_timeout(void *);
-lwp_t	*sleepq_wake(sleepq_t *, wchan_t, u_int, kmutex_t *);
+void	sleepq_wake(sleepq_t *, wchan_t, u_int, kmutex_t *);
 int	sleepq_abort(kmutex_t *, int);
 void	sleepq_changepri(lwp_t *, pri_t);
 void	sleepq_lendpri(lwp_t *, pri_t);

Index: src/sys/sys/socket.h
diff -u src/sys/sys/socket.h:1.108 src/sys/sys/socket.h:1.108.10.1
--- src/sys/sys/socket.h:1.108	Thu Jan 31 14:30:47 2013
+++ src/sys/sys/socket.h	Sun Aug 10 06:56:54 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: socket.h,v 1.108 2013/01/31 14:30:47 joerg Exp $	*/
+/*	$NetBSD: socket.h,v 1.108.10.1 2014/08/10 06:56:54 tls Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -341,7 +341,8 @@ struct sockcred {
  * Compute size of a sockcred structure with groups.
  */
 #define	SOCKCREDSIZE(ngrps) \
-	(sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))
+	(sizeof(struct sockcred) + (sizeof(gid_t) * \
+	    ((ngrps) ? ((ngrps) - 1) : 0)))
 #endif /* _NETBSD_SOURCE */
 
 
@@ -428,6 +429,8 @@ struct kinfo_pcb {
 
 #define ki_src ki_s._kis_src
 #define ki_dst ki_d._kid_dst
+#define ki_spad ki_s._kis_pad
+#define ki_dpad ki_d._kid_pad
 
 #define PCB_SLOP		20
 #define PCB_ALL			0

Index: src/sys/sys/socketvar.h
diff -u src/sys/sys/socketvar.h:1.131 src/sys/sys/socketvar.h:1.131.2.1
--- src/sys/sys/socketvar.h:1.131	Thu Aug 29 17:49:21 2013
+++ src/sys/sys/socketvar.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: socketvar.h,v 1.131 2013/08/29 17:49:21 rmind Exp $	*/
+/*	$NetBSD: socketvar.h,v 1.131.2.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -295,7 +295,7 @@ int	soconnect(struct socket *, struct mb
 int	soconnect2(struct socket *, struct socket *);
 int	socreate(int, struct socket **, int, int, struct lwp *,
 		 struct socket *);
-int	fsocreate(int, struct socket **, int, int, struct lwp *, int *);
+int	fsocreate(int, struct socket **, int, int, int *);
 int	sodisconnect(struct socket *);
 void	sofree(struct socket *);
 int	sogetopt(struct socket *, struct sockopt *);
@@ -308,7 +308,7 @@ int	solisten(struct socket *, int, struc
 struct socket *
 	sonewconn(struct socket *, bool);
 void	soqinsque(struct socket *, struct socket *, int);
-int	soqremque(struct socket *, int);
+bool	soqremque(struct socket *, int);
 int	soreceive(struct socket *, struct mbuf **, struct uio *,
 	    struct mbuf **, struct mbuf **, int *);
 int	soreserve(struct socket *, u_long, u_long);
@@ -346,7 +346,8 @@ int	copyout_sockname(struct sockaddr *, 
 int	copyout_msg_control(struct lwp *, struct msghdr *, struct mbuf *);
 void	free_control_mbuf(struct lwp *, struct mbuf *, struct mbuf *);
 
-int	do_sys_getsockname(struct lwp *, int, int, struct mbuf **);
+int	do_sys_getpeername(int, struct mbuf **);
+int	do_sys_getsockname(int, struct mbuf **);
 int	do_sys_sendmsg(struct lwp *, int, struct msghdr *, int, register_t *);
 int	do_sys_recvmsg(struct lwp *, int, struct msghdr *, struct mbuf **,
 	    struct mbuf **, register_t *);

Index: src/sys/sys/syscall.h
diff -u src/sys/sys/syscall.h:1.268 src/sys/sys/syscall.h:1.268.2.1
--- src/sys/sys/syscall.h:1.268	Fri Mar 14 00:56:37 2014
+++ src/sys/sys/syscall.h	Sun Aug 10 06:56:55 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: syscall.h,v 1.268 2014/03/14 00:56:37 pooka Exp $ */
+/* $NetBSD: syscall.h,v 1.268.2.1 2014/08/10 06:56:55 tls Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.267 2014/03/14 00:52:08 pooka Exp
+ * created from	NetBSD: syscalls.master,v 1.270 2014/07/25 08:25:47 dholland Exp
  */
 
 #ifndef _SYS_SYSCALL_H_
@@ -1364,6 +1364,12 @@
 /* syscall: "___lwp_park60" ret: "int" args: "clockid_t" "int" "const struct timespec *" "lwpid_t" "const void *" "const void *" */
 #define	SYS____lwp_park60	478
 
-#define	SYS_MAXSYSCALL	479
+/* syscall: "posix_fallocate" ret: "int" args: "int" "int" "off_t" "off_t" */
+#define	SYS_posix_fallocate	479
+
+/* syscall: "fdiscard" ret: "int" args: "int" "int" "off_t" "off_t" */
+#define	SYS_fdiscard	480
+
+#define	SYS_MAXSYSCALL	481
 #define	SYS_NSYSENT	512
 #endif /* _SYS_SYSCALL_H_ */

Index: src/sys/sys/syscallargs.h
diff -u src/sys/sys/syscallargs.h:1.251 src/sys/sys/syscallargs.h:1.251.2.1
--- src/sys/sys/syscallargs.h:1.251	Fri Mar 14 00:56:37 2014
+++ src/sys/sys/syscallargs.h	Sun Aug 10 06:56:55 2014
@@ -1,10 +1,10 @@
-/* $NetBSD: syscallargs.h,v 1.251 2014/03/14 00:56:37 pooka Exp $ */
+/* $NetBSD: syscallargs.h,v 1.251.2.1 2014/08/10 06:56:55 tls Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.267 2014/03/14 00:52:08 pooka Exp
+ * created from	NetBSD: syscalls.master,v 1.270 2014/07/25 08:25:47 dholland Exp
  */
 
 #ifndef _SYS_SYSCALLARGS_H_
@@ -1248,9 +1248,9 @@ check_syscall_args(sys_ftruncate)
 struct sys___sysctl_args {
 	syscallarg(const int *) name;
 	syscallarg(u_int) namelen;
-	syscallarg(void *) old;
+	syscallarg(void *) oldv;
 	syscallarg(size_t *) oldlenp;
-	syscallarg(const void *) new;
+	syscallarg(const void *) newv;
 	syscallarg(size_t) newlen;
 };
 check_syscall_args(sys___sysctl)
@@ -2094,8 +2094,8 @@ check_syscall_args(sys__lwp_ctl)
 
 #ifndef RUMP_CLIENT
 struct compat_60_sys_sa_register_args {
-	syscallarg(void *) new;
-	syscallarg(void **) old;
+	syscallarg(void *) newv;
+	syscallarg(void **) oldv;
 	syscallarg(int) flags;
 	syscallarg(ssize_t) stackinfo_offset;
 };
@@ -2550,42 +2550,32 @@ struct compat_50_sys___fhstat40_args {
 };
 check_syscall_args(compat_50_sys___fhstat40)
 
-#ifndef RUMP_CLIENT
 struct sys_aio_cancel_args {
 	syscallarg(int) fildes;
 	syscallarg(struct aiocb *) aiocbp;
 };
 check_syscall_args(sys_aio_cancel)
-#endif /* !RUMP_CLIENT */
 
-#ifndef RUMP_CLIENT
 struct sys_aio_error_args {
 	syscallarg(const struct aiocb *) aiocbp;
 };
 check_syscall_args(sys_aio_error)
-#endif /* !RUMP_CLIENT */
 
-#ifndef RUMP_CLIENT
 struct sys_aio_fsync_args {
 	syscallarg(int) op;
 	syscallarg(struct aiocb *) aiocbp;
 };
 check_syscall_args(sys_aio_fsync)
-#endif /* !RUMP_CLIENT */
 
-#ifndef RUMP_CLIENT
 struct sys_aio_read_args {
 	syscallarg(struct aiocb *) aiocbp;
 };
 check_syscall_args(sys_aio_read)
-#endif /* !RUMP_CLIENT */
 
-#ifndef RUMP_CLIENT
 struct sys_aio_return_args {
 	syscallarg(struct aiocb *) aiocbp;
 };
 check_syscall_args(sys_aio_return)
-#endif /* !RUMP_CLIENT */
 
 #ifndef RUMP_CLIENT
 struct compat_50_sys_aio_suspend_args {
@@ -2596,14 +2586,11 @@ struct compat_50_sys_aio_suspend_args {
 check_syscall_args(compat_50_sys_aio_suspend)
 #endif /* !RUMP_CLIENT */
 
-#ifndef RUMP_CLIENT
 struct sys_aio_write_args {
 	syscallarg(struct aiocb *) aiocbp;
 };
 check_syscall_args(sys_aio_write)
-#endif /* !RUMP_CLIENT */
 
-#ifndef RUMP_CLIENT
 struct sys_lio_listio_args {
 	syscallarg(int) mode;
 	syscallarg(struct aiocb *const *) list;
@@ -2611,7 +2598,6 @@ struct sys_lio_listio_args {
 	syscallarg(struct sigevent *) sig;
 };
 check_syscall_args(sys_lio_listio)
-#endif /* !RUMP_CLIENT */
 
 struct sys___mount50_args {
 	syscallarg(const char *) type;
@@ -2835,14 +2821,12 @@ struct sys___pollts50_args {
 };
 check_syscall_args(sys___pollts50)
 
-#ifndef RUMP_CLIENT
 struct sys___aio_suspend50_args {
 	syscallarg(const struct aiocb *const *) list;
 	syscallarg(int) nent;
 	syscallarg(const struct timespec *) timeout;
 };
 check_syscall_args(sys___aio_suspend50)
-#endif /* !RUMP_CLIENT */
 
 struct sys___stat50_args {
 	syscallarg(const char *) path;
@@ -3163,6 +3147,22 @@ struct sys____lwp_park60_args {
 check_syscall_args(sys____lwp_park60)
 #endif /* !RUMP_CLIENT */
 
+struct sys_posix_fallocate_args {
+	syscallarg(int) fd;
+	syscallarg(int) PAD;
+	syscallarg(off_t) pos;
+	syscallarg(off_t) len;
+};
+check_syscall_args(sys_posix_fallocate)
+
+struct sys_fdiscard_args {
+	syscallarg(int) fd;
+	syscallarg(int) PAD;
+	syscallarg(off_t) pos;
+	syscallarg(off_t) len;
+};
+check_syscall_args(sys_fdiscard)
+
 /*
  * System call prototypes.
  */
@@ -4060,5 +4060,9 @@ int	sys_clock_nanosleep(struct lwp *, co
 
 int	sys____lwp_park60(struct lwp *, const struct sys____lwp_park60_args *, register_t *);
 
+int	sys_posix_fallocate(struct lwp *, const struct sys_posix_fallocate_args *, register_t *);
+
+int	sys_fdiscard(struct lwp *, const struct sys_fdiscard_args *, register_t *);
+
 #endif /* !RUMP_CLIENT */
 #endif /* _SYS_SYSCALLARGS_H_ */

Index: src/sys/sys/sysctl.h
diff -u src/sys/sys/sysctl.h:1.211 src/sys/sys/sysctl.h:1.211.2.1
--- src/sys/sys/sysctl.h:1.211	Tue Feb 25 18:30:13 2014
+++ src/sys/sys/sysctl.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.h,v 1.211 2014/02/25 18:30:13 pooka Exp $	*/
+/*	$NetBSD: sysctl.h,v 1.211.2.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -1143,6 +1143,7 @@ typedef int (*sysctlfn)(SYSCTLFN_PROTO);
  * used in more than just sysctl
  */
 void	fill_eproc(struct proc *, struct eproc *, bool);
+void	fill_kproc2(struct proc *, struct kinfo_proc2 *, bool);
 
 /*
  * subsystem setup
@@ -1261,6 +1262,8 @@ int	sysctlgetmibinfo(const char *, int *
 int	sysctlnametomib(const char *, int *, size_t *);
 int	proc_compare(const struct kinfo_proc2 *, const struct kinfo_lwp *,
     const struct kinfo_proc2 *, const struct kinfo_lwp *);
+void	*asysctl(const int *, size_t, size_t *);
+void	*asysctlbyname(const char *, size_t *);
 __END_DECLS
 
 #endif	/* !_KERNEL */

Index: src/sys/sys/syslog.h
diff -u src/sys/sys/syslog.h:1.35 src/sys/sys/syslog.h:1.35.10.1
--- src/sys/sys/syslog.h:1.35	Wed Oct 10 22:51:55 2012
+++ src/sys/sys/syslog.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslog.h,v 1.35 2012/10/10 22:51:55 christos Exp $	*/
+/*	$NetBSD: syslog.h,v 1.35.10.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -83,7 +83,7 @@ CODE prioritynames[] = {
 	{ "warning",	LOG_WARNING },
 	{ NULL,		-1 }
 };
-#endif
+#endif /* SYSLOG_NAMES */
 
 /* facility codes */
 #define	LOG_KERN	(0<<3)	/* kernel messages */
@@ -140,7 +140,7 @@ CODE facilitynames[] = {
 	{ "local7",	LOG_LOCAL7 },
 	{ NULL,		-1 }
 };
-#endif
+#endif /* SYSLOG_NAMES */
 
 #ifdef _KERNEL
 #define	LOG_PRINTF	-1	/* pseudo-priority to indicate use of printf */

Index: src/sys/sys/systm.h
diff -u src/sys/sys/systm.h:1.263 src/sys/sys/systm.h:1.263.2.1
--- src/sys/sys/systm.h:1.263	Thu Apr  3 15:22:57 2014
+++ src/sys/sys/systm.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: systm.h,v 1.263 2014/04/03 15:22:57 christos Exp $	*/
+/*	$NetBSD: systm.h,v 1.263.2.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -73,6 +73,7 @@ extern const char osrelease[];	/* short 
 extern const char ostype[];	/* system type */
 extern const char kernel_ident[];/* kernel configuration ID */
 extern const char version[];	/* system version */
+extern const char buildinfo[];	/* information from build environment */
 
 extern int autonicetime;        /* time (in seconds) before autoniceval */
 extern int autoniceval;         /* proc priority after autonicetime */
@@ -527,7 +528,7 @@ void assert_sleepable(void);
 #if defined(DEBUG)
 #define	ASSERT_SLEEPABLE()	assert_sleepable()
 #else /* defined(DEBUG) */
-#define	ASSERT_SLEEPABLE()	/* nothing */
+#define	ASSERT_SLEEPABLE()	do {} while (0)
 #endif /* defined(DEBUG) */
 
 vaddr_t calc_cache_size(vsize_t , int, int);

Index: src/sys/sys/time.h
diff -u src/sys/sys/time.h:1.65 src/sys/sys/time.h:1.65.26.1
--- src/sys/sys/time.h:1.65	Thu Oct 27 16:12:52 2011
+++ src/sys/sys/time.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: time.h,v 1.65 2011/10/27 16:12:52 christos Exp $	*/
+/*	$NetBSD: time.h,v 1.65.26.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -174,7 +174,7 @@ timespec2bintime(const struct timespec *
 
 	bt->sec = ts->tv_sec;
 	/* 18446744073 = int(2^64 / 1000000000) */
-	bt->frac = ts->tv_nsec * (uint64_t)18446744073LL; 
+	bt->frac = (uint64_t)ts->tv_nsec * (uint64_t)18446744073ULL; 
 }
 
 static __inline void
@@ -192,7 +192,7 @@ timeval2bintime(const struct timeval *tv
 
 	bt->sec = tv->tv_sec;
 	/* 18446744073709 = int(2^64 / 1000000) */
-	bt->frac = tv->tv_usec * (uint64_t)18446744073709LL;
+	bt->frac = (uint64_t)tv->tv_usec * (uint64_t)18446744073709ULL;
 }
 #endif /* !defined(_STANDALONE) */
 

Index: src/sys/sys/tty.h
diff -u src/sys/sys/tty.h:1.91 src/sys/sys/tty.h:1.91.10.1
--- src/sys/sys/tty.h:1.91	Sun Feb 24 06:20:24 2013
+++ src/sys/sys/tty.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.h,v 1.91 2013/02/24 06:20:24 matt Exp $	*/
+/*	$NetBSD: tty.h,v 1.91.10.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -151,7 +151,9 @@ struct tty {
 	void	*t_softc;		/* pointer to driver's softc. */
 };
 
+#ifdef TTY_ALLOW_PRIVATE
 #define	t_cc		t_termios.c_cc
+#endif
 #define	t_cflag		t_termios.c_cflag
 #define	t_iflag		t_termios.c_iflag
 #define	t_ispeed	t_termios.c_ispeed
@@ -303,6 +305,10 @@ void	clfree(struct clist *);
 
 extern int (*ttcompatvec)(struct tty *, u_long, void *, int, struct lwp *);
 
+unsigned char tty_getctrlchar(struct tty *, unsigned /*which*/);
+void tty_setctrlchar(struct tty *, unsigned /*which*/, unsigned char /*val*/);
+int tty_try_xonxoff(struct tty *, unsigned char /*c*/);
+
 #endif /* _KERNEL */
 
 #endif /* !_SYS_TTY_H_ */

Index: src/sys/sys/ttydev.h
diff -u src/sys/sys/ttydev.h:1.9 src/sys/sys/ttydev.h:1.9.136.1
--- src/sys/sys/ttydev.h:1.9	Sun Dec 11 12:25:21 2005
+++ src/sys/sys/ttydev.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttydev.h,v 1.9 2005/12/11 12:25:21 christos Exp $	*/
+/*	$NetBSD: ttydev.h,v 1.9.136.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -31,7 +31,7 @@
  *	@(#)ttydev.h	8.2 (Berkeley) 1/4/94
  */
 
-/* COMPATABILITY HEADER FILE */
+/* COMPATIBILITY HEADER FILE */
 
 #ifndef _SYS_TTYDEV_H_
 #define	_SYS_TTYDEV_H_

Index: src/sys/sys/un.h
diff -u src/sys/sys/un.h:1.46 src/sys/sys/un.h:1.46.26.1
--- src/sys/sys/un.h:1.46	Sun Jun 26 16:43:12 2011
+++ src/sys/sys/un.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: un.h,v 1.46 2011/06/26 16:43:12 christos Exp $	*/
+/*	$NetBSD: un.h,v 1.46.26.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -71,33 +71,24 @@ struct unpcbid {
 };
 
 #ifdef _KERNEL
+
 struct unpcb;
 struct socket;
 struct sockopt;
 
-int	uipc_usrreq(struct socket *, int, struct mbuf *,
-	    struct mbuf *, struct mbuf *, struct lwp *);
+extern const struct pr_usrreqs unp_usrreqs;
+
 int	uipc_ctloutput(int, struct socket *, struct sockopt *);
-void	uipc_init (void);
-kmutex_t *uipc_dgramlock (void);
-kmutex_t *uipc_streamlock (void);
-kmutex_t *uipc_rawlock (void);
-
-int	unp_attach (struct socket *);
-int	unp_bind (struct socket *, struct mbuf *, struct lwp *);
-int	unp_connect (struct socket *, struct mbuf *, struct lwp *);
-int	unp_connect2 (struct socket *, struct socket *, int);
-void	unp_detach (struct unpcb *);
-void	unp_discard (struct file *);
-void	unp_disconnect (struct unpcb *);
-bool	unp_drop (struct unpcb *, int);
-void	unp_shutdown (struct unpcb *);
-int 	unp_externalize (struct mbuf *, struct lwp *, int);
-int	unp_internalize (struct mbuf **);
-void 	unp_dispose (struct mbuf *);
-int	unp_output (struct mbuf *, struct mbuf *, struct unpcb *,
-	    struct lwp *);
-void	unp_setaddr (struct socket *, struct mbuf *, bool);
+void	uipc_init(void);
+kmutex_t *uipc_dgramlock(void);
+kmutex_t *uipc_streamlock(void);
+kmutex_t *uipc_rawlock(void);
+
+int	unp_connect(struct socket *, struct mbuf *, struct lwp *);
+int	unp_connect2(struct socket *, struct socket *);
+void 	unp_dispose(struct mbuf *);
+int 	unp_externalize(struct mbuf *, struct lwp *, int);
+
 #else /* !_KERNEL */
 
 /* actual length of an initialized sockaddr_un */

Index: src/sys/sys/vnode.h
diff -u src/sys/sys/vnode.h:1.246 src/sys/sys/vnode.h:1.246.2.1
--- src/sys/sys/vnode.h:1.246	Mon Mar 24 13:42:40 2014
+++ src/sys/sys/vnode.h	Sun Aug 10 06:56:55 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.246 2014/03/24 13:42:40 hannken Exp $	*/
+/*	$NetBSD: vnode.h,v 1.246.2.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -207,8 +207,8 @@ typedef struct vnode vnode_t;
 #define	VI_MARKER	0x00008000	/* Dummy marker vnode */
 #endif	/* _VFS_VNODE_PRIVATE */
 #define	VI_LAYER	0x00020000	/* vnode is on a layer filesystem */
-#ifdef _VFS_VNODE_PRIVATE
 #define	VI_LOCKSHARE	0x00040000	/* v_interlock is shared */
+#ifdef _VFS_VNODE_PRIVATE
 #define	VI_CLEAN	0x00080000	/* has been reclaimed */
 #define	VI_CHANGING	0x00100000	/* vnode changes state */
 #endif	/* _VFS_VNODE_PRIVATE */
@@ -556,6 +556,12 @@ struct vnode *
 	vnalloc(struct mount *);
 void	vnfree(struct vnode *);
 void	vremfree(struct vnode *);
+int	vcache_get(struct mount *, const void *, size_t, struct vnode **);
+int	vcache_rekey_enter(struct mount *, struct vnode *,
+	    const void *, size_t, const void *, size_t);
+void	vcache_rekey_exit(struct mount *, struct vnode *,
+	    const void *, size_t, const void *, size_t);
+void	vcache_remove(struct mount *, const void *, size_t);
 
 /* see vnsubr(9) */
 int	vn_bwrite(void *);

Index: src/sys/sys/vnode_if.h
diff -u src/sys/sys/vnode_if.h:1.87 src/sys/sys/vnode_if.h:1.87.2.1
--- src/sys/sys/vnode_if.h:1.87	Fri Feb  7 15:29:23 2014
+++ src/sys/sys/vnode_if.h	Sun Aug 10 06:56:55 2014
@@ -1,11 +1,11 @@
-/*	$NetBSD: vnode_if.h,v 1.87 2014/02/07 15:29:23 hannken Exp $	*/
+/*	$NetBSD: vnode_if.h,v 1.87.2.1 2014/08/10 06:56:55 tls Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
  * (Modifications made here may easily be lost!)
  *
  * Created from the file:
- *	NetBSD: vnode_if.src,v 1.66 2014/02/07 15:26:42 hannken Exp
+ *	NetBSD: vnode_if.src,v 1.67 2014/07/25 08:16:47 dholland Exp
  * by the script:
  *	NetBSD: vnode_if.sh,v 1.60 2014/01/13 12:07:55 hannken Exp
  */
@@ -165,7 +165,27 @@ struct vop_write_args {
 extern const struct vnodeop_desc vop_write_desc;
 int VOP_WRITE(struct vnode *, struct uio *, int, kauth_cred_t);
 
-#define VOP_IOCTL_DESCOFFSET 12
+#define VOP_FALLOCATE_DESCOFFSET 12
+struct vop_fallocate_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	off_t a_pos;
+	off_t a_len;
+};
+extern const struct vnodeop_desc vop_fallocate_desc;
+int VOP_FALLOCATE(struct vnode *, off_t, off_t);
+
+#define VOP_FDISCARD_DESCOFFSET 13
+struct vop_fdiscard_args {
+	const struct vnodeop_desc *a_desc;
+	struct vnode *a_vp;
+	off_t a_pos;
+	off_t a_len;
+};
+extern const struct vnodeop_desc vop_fdiscard_desc;
+int VOP_FDISCARD(struct vnode *, off_t, off_t);
+
+#define VOP_IOCTL_DESCOFFSET 14
 struct vop_ioctl_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -177,7 +197,7 @@ struct vop_ioctl_args {
 extern const struct vnodeop_desc vop_ioctl_desc;
 int VOP_IOCTL(struct vnode *, u_long, void *, int, kauth_cred_t);
 
-#define VOP_FCNTL_DESCOFFSET 13
+#define VOP_FCNTL_DESCOFFSET 15
 struct vop_fcntl_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -189,7 +209,7 @@ struct vop_fcntl_args {
 extern const struct vnodeop_desc vop_fcntl_desc;
 int VOP_FCNTL(struct vnode *, u_int, void *, int, kauth_cred_t);
 
-#define VOP_POLL_DESCOFFSET 14
+#define VOP_POLL_DESCOFFSET 16
 struct vop_poll_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -198,7 +218,7 @@ struct vop_poll_args {
 extern const struct vnodeop_desc vop_poll_desc;
 int VOP_POLL(struct vnode *, int);
 
-#define VOP_KQFILTER_DESCOFFSET 15
+#define VOP_KQFILTER_DESCOFFSET 17
 struct vop_kqfilter_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -207,7 +227,7 @@ struct vop_kqfilter_args {
 extern const struct vnodeop_desc vop_kqfilter_desc;
 int VOP_KQFILTER(struct vnode *, struct knote *);
 
-#define VOP_REVOKE_DESCOFFSET 16
+#define VOP_REVOKE_DESCOFFSET 18
 struct vop_revoke_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -216,7 +236,7 @@ struct vop_revoke_args {
 extern const struct vnodeop_desc vop_revoke_desc;
 int VOP_REVOKE(struct vnode *, int);
 
-#define VOP_MMAP_DESCOFFSET 17
+#define VOP_MMAP_DESCOFFSET 19
 struct vop_mmap_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -226,7 +246,7 @@ struct vop_mmap_args {
 extern const struct vnodeop_desc vop_mmap_desc;
 int VOP_MMAP(struct vnode *, vm_prot_t, kauth_cred_t);
 
-#define VOP_FSYNC_DESCOFFSET 18
+#define VOP_FSYNC_DESCOFFSET 20
 struct vop_fsync_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -238,7 +258,7 @@ struct vop_fsync_args {
 extern const struct vnodeop_desc vop_fsync_desc;
 int VOP_FSYNC(struct vnode *, kauth_cred_t, int, off_t, off_t);
 
-#define VOP_SEEK_DESCOFFSET 19
+#define VOP_SEEK_DESCOFFSET 21
 struct vop_seek_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -249,7 +269,7 @@ struct vop_seek_args {
 extern const struct vnodeop_desc vop_seek_desc;
 int VOP_SEEK(struct vnode *, off_t, off_t, kauth_cred_t);
 
-#define VOP_REMOVE_DESCOFFSET 20
+#define VOP_REMOVE_DESCOFFSET 22
 struct vop_remove_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_dvp;
@@ -259,7 +279,7 @@ struct vop_remove_args {
 extern const struct vnodeop_desc vop_remove_desc;
 int VOP_REMOVE(struct vnode *, struct vnode *, struct componentname *);
 
-#define VOP_LINK_DESCOFFSET 21
+#define VOP_LINK_DESCOFFSET 23
 struct vop_link_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_dvp;
@@ -269,7 +289,7 @@ struct vop_link_args {
 extern const struct vnodeop_desc vop_link_desc;
 int VOP_LINK(struct vnode *, struct vnode *, struct componentname *);
 
-#define VOP_RENAME_DESCOFFSET 22
+#define VOP_RENAME_DESCOFFSET 24
 struct vop_rename_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_fdvp;
@@ -283,7 +303,7 @@ extern const struct vnodeop_desc vop_ren
 int VOP_RENAME(struct vnode *, struct vnode *, struct componentname *, 
     struct vnode *, struct vnode *, struct componentname *);
 
-#define VOP_MKDIR_DESCOFFSET 23
+#define VOP_MKDIR_DESCOFFSET 25
 struct vop_mkdir_v3_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_dvp;
@@ -295,7 +315,7 @@ extern const struct vnodeop_desc vop_mkd
 int VOP_MKDIR(struct vnode *, struct vnode **, struct componentname *, 
     struct vattr *);
 
-#define VOP_RMDIR_DESCOFFSET 24
+#define VOP_RMDIR_DESCOFFSET 26
 struct vop_rmdir_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_dvp;
@@ -305,7 +325,7 @@ struct vop_rmdir_args {
 extern const struct vnodeop_desc vop_rmdir_desc;
 int VOP_RMDIR(struct vnode *, struct vnode *, struct componentname *);
 
-#define VOP_SYMLINK_DESCOFFSET 25
+#define VOP_SYMLINK_DESCOFFSET 27
 struct vop_symlink_v3_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_dvp;
@@ -318,7 +338,7 @@ extern const struct vnodeop_desc vop_sym
 int VOP_SYMLINK(struct vnode *, struct vnode **, struct componentname *, 
     struct vattr *, char *);
 
-#define VOP_READDIR_DESCOFFSET 26
+#define VOP_READDIR_DESCOFFSET 28
 struct vop_readdir_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -332,7 +352,7 @@ extern const struct vnodeop_desc vop_rea
 int VOP_READDIR(struct vnode *, struct uio *, kauth_cred_t, int *, off_t **, 
     int *);
 
-#define VOP_READLINK_DESCOFFSET 27
+#define VOP_READLINK_DESCOFFSET 29
 struct vop_readlink_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -342,7 +362,7 @@ struct vop_readlink_args {
 extern const struct vnodeop_desc vop_readlink_desc;
 int VOP_READLINK(struct vnode *, struct uio *, kauth_cred_t);
 
-#define VOP_ABORTOP_DESCOFFSET 28
+#define VOP_ABORTOP_DESCOFFSET 30
 struct vop_abortop_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_dvp;
@@ -351,7 +371,7 @@ struct vop_abortop_args {
 extern const struct vnodeop_desc vop_abortop_desc;
 int VOP_ABORTOP(struct vnode *, struct componentname *);
 
-#define VOP_INACTIVE_DESCOFFSET 29
+#define VOP_INACTIVE_DESCOFFSET 31
 struct vop_inactive_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -360,7 +380,7 @@ struct vop_inactive_args {
 extern const struct vnodeop_desc vop_inactive_desc;
 int VOP_INACTIVE(struct vnode *, bool *);
 
-#define VOP_RECLAIM_DESCOFFSET 30
+#define VOP_RECLAIM_DESCOFFSET 32
 struct vop_reclaim_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -368,7 +388,7 @@ struct vop_reclaim_args {
 extern const struct vnodeop_desc vop_reclaim_desc;
 int VOP_RECLAIM(struct vnode *);
 
-#define VOP_LOCK_DESCOFFSET 31
+#define VOP_LOCK_DESCOFFSET 33
 struct vop_lock_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -377,7 +397,7 @@ struct vop_lock_args {
 extern const struct vnodeop_desc vop_lock_desc;
 int VOP_LOCK(struct vnode *, int);
 
-#define VOP_UNLOCK_DESCOFFSET 32
+#define VOP_UNLOCK_DESCOFFSET 34
 struct vop_unlock_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -385,7 +405,7 @@ struct vop_unlock_args {
 extern const struct vnodeop_desc vop_unlock_desc;
 int VOP_UNLOCK(struct vnode *);
 
-#define VOP_BMAP_DESCOFFSET 33
+#define VOP_BMAP_DESCOFFSET 35
 struct vop_bmap_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -397,7 +417,7 @@ struct vop_bmap_args {
 extern const struct vnodeop_desc vop_bmap_desc;
 int VOP_BMAP(struct vnode *, daddr_t, struct vnode **, daddr_t *, int *);
 
-#define VOP_STRATEGY_DESCOFFSET 34
+#define VOP_STRATEGY_DESCOFFSET 36
 struct vop_strategy_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -406,7 +426,7 @@ struct vop_strategy_args {
 extern const struct vnodeop_desc vop_strategy_desc;
 int VOP_STRATEGY(struct vnode *, struct buf *);
 
-#define VOP_PRINT_DESCOFFSET 35
+#define VOP_PRINT_DESCOFFSET 37
 struct vop_print_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -414,7 +434,7 @@ struct vop_print_args {
 extern const struct vnodeop_desc vop_print_desc;
 int VOP_PRINT(struct vnode *);
 
-#define VOP_ISLOCKED_DESCOFFSET 36
+#define VOP_ISLOCKED_DESCOFFSET 38
 struct vop_islocked_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -422,7 +442,7 @@ struct vop_islocked_args {
 extern const struct vnodeop_desc vop_islocked_desc;
 int VOP_ISLOCKED(struct vnode *);
 
-#define VOP_PATHCONF_DESCOFFSET 37
+#define VOP_PATHCONF_DESCOFFSET 39
 struct vop_pathconf_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -432,7 +452,7 @@ struct vop_pathconf_args {
 extern const struct vnodeop_desc vop_pathconf_desc;
 int VOP_PATHCONF(struct vnode *, int, register_t *);
 
-#define VOP_ADVLOCK_DESCOFFSET 38
+#define VOP_ADVLOCK_DESCOFFSET 40
 struct vop_advlock_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -444,7 +464,7 @@ struct vop_advlock_args {
 extern const struct vnodeop_desc vop_advlock_desc;
 int VOP_ADVLOCK(struct vnode *, void *, int, struct flock *, int);
 
-#define VOP_WHITEOUT_DESCOFFSET 39
+#define VOP_WHITEOUT_DESCOFFSET 41
 struct vop_whiteout_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_dvp;
@@ -454,7 +474,7 @@ struct vop_whiteout_args {
 extern const struct vnodeop_desc vop_whiteout_desc;
 int VOP_WHITEOUT(struct vnode *, struct componentname *, int);
 
-#define VOP_GETPAGES_DESCOFFSET 40
+#define VOP_GETPAGES_DESCOFFSET 42
 struct vop_getpages_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -470,7 +490,7 @@ extern const struct vnodeop_desc vop_get
 int VOP_GETPAGES(struct vnode *, voff_t, struct vm_page **, int *, int, 
     vm_prot_t, int, int);
 
-#define VOP_PUTPAGES_DESCOFFSET 41
+#define VOP_PUTPAGES_DESCOFFSET 43
 struct vop_putpages_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -481,7 +501,7 @@ struct vop_putpages_args {
 extern const struct vnodeop_desc vop_putpages_desc;
 int VOP_PUTPAGES(struct vnode *, voff_t, voff_t, int);
 
-#define VOP_CLOSEEXTATTR_DESCOFFSET 42
+#define VOP_CLOSEEXTATTR_DESCOFFSET 44
 struct vop_closeextattr_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -491,7 +511,7 @@ struct vop_closeextattr_args {
 extern const struct vnodeop_desc vop_closeextattr_desc;
 int VOP_CLOSEEXTATTR(struct vnode *, int, kauth_cred_t);
 
-#define VOP_GETEXTATTR_DESCOFFSET 43
+#define VOP_GETEXTATTR_DESCOFFSET 45
 struct vop_getextattr_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -505,7 +525,7 @@ extern const struct vnodeop_desc vop_get
 int VOP_GETEXTATTR(struct vnode *, int, const char *, struct uio *, 
     size_t *, kauth_cred_t);
 
-#define VOP_LISTEXTATTR_DESCOFFSET 44
+#define VOP_LISTEXTATTR_DESCOFFSET 46
 struct vop_listextattr_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -519,7 +539,7 @@ extern const struct vnodeop_desc vop_lis
 int VOP_LISTEXTATTR(struct vnode *, int, struct uio *, size_t *, int, 
     kauth_cred_t);
 
-#define VOP_OPENEXTATTR_DESCOFFSET 45
+#define VOP_OPENEXTATTR_DESCOFFSET 47
 struct vop_openextattr_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -528,7 +548,7 @@ struct vop_openextattr_args {
 extern const struct vnodeop_desc vop_openextattr_desc;
 int VOP_OPENEXTATTR(struct vnode *, kauth_cred_t);
 
-#define VOP_DELETEEXTATTR_DESCOFFSET 46
+#define VOP_DELETEEXTATTR_DESCOFFSET 48
 struct vop_deleteextattr_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -539,7 +559,7 @@ struct vop_deleteextattr_args {
 extern const struct vnodeop_desc vop_deleteextattr_desc;
 int VOP_DELETEEXTATTR(struct vnode *, int, const char *, kauth_cred_t);
 
-#define VOP_SETEXTATTR_DESCOFFSET 47
+#define VOP_SETEXTATTR_DESCOFFSET 49
 struct vop_setextattr_args {
 	const struct vnodeop_desc *a_desc;
 	struct vnode *a_vp;
@@ -552,6 +572,6 @@ extern const struct vnodeop_desc vop_set
 int VOP_SETEXTATTR(struct vnode *, int, const char *, struct uio *, 
     kauth_cred_t);
 
-#define VNODE_OPS_COUNT	48
+#define VNODE_OPS_COUNT	50
 
 #endif /* !_SYS_VNODE_IF_H_ */

Added files:

Index: src/sys/sys/common_int_const.h
diff -u /dev/null src/sys/sys/common_int_const.h:1.1.2.2
--- /dev/null	Sun Aug 10 06:56:55 2014
+++ src/sys/sys/common_int_const.h	Sun Aug 10 06:56:54 2014
@@ -0,0 +1,62 @@
+/*	$NetBSD: common_int_const.h,v 1.1.2.2 2014/08/10 06:56:54 tls Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION 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.
+ */
+
+#ifndef _SYS_COMMON_INT_CONST_H_
+#define _SYS_COMMON_INT_CONST_H_
+
+#ifndef __INTMAX_C_SUFFIX__
+#error Your compiler does not provide inter constant suffix macros.
+#endif
+
+#define __int_join_(c,suffix) c ## suffix
+#define __int_join(c,suffix) __int_join_(c,suffix)
+/*
+ * 7.18.4 Macros for integer constants
+ */
+
+/* 7.18.4.1 Macros for minimum-width integer constants */
+
+#define	INT8_C(c)	__int_join(c, __INT8_C_SUFFIX__)
+#define	INT16_C(c)	__int_join(c, __INT16_C_SUFFIX__)
+#define	INT32_C(c)	__int_join(c, __INT32_C_SUFFIX__)
+#define	INT64_C(c)	__int_join(c, __INT64_C_SUFFIX__)
+
+#define	UINT8_C(c)	__int_join(c, __UINT8_C_SUFFIX__)
+#define	UINT16_C(c)	__int_join(c, __UINT16_C_SUFFIX__)
+#define	UINT32_C(c)	__int_join(c, __UINT32_C_SUFFIX__)
+#define	UINT64_C(c)	__int_join(c, __UINT64_C_SUFFIX__)
+
+/* 7.18.4.2 Macros for greatest-width integer constants */
+
+#define	INTMAX_C(c)	__int_join(c, __INTMAX_C_SUFFIX__)
+#define	UINTMAX_C(c)	__int_join(c, __UINTMAX_C_SUFFIX__)
+
+#endif /* _SYS_COMMON_INT_CONST_H_ */
Index: src/sys/sys/common_int_fmtio.h
diff -u /dev/null src/sys/sys/common_int_fmtio.h:1.1.2.2
--- /dev/null	Sun Aug 10 06:56:55 2014
+++ src/sys/sys/common_int_fmtio.h	Sun Aug 10 06:56:54 2014
@@ -0,0 +1,230 @@
+/*	$NetBSD: common_int_fmtio.h,v 1.1.2.2 2014/08/10 06:56:54 tls Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION 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.
+ */
+
+#ifndef _SYS_COMMON_INT_FMTIO_H_
+#define _SYS_COMMON_INT_FMTIO_H_
+
+#ifndef __INTPTR_FMTd__
+#error Your compiler does not provide format string macros.
+#endif
+
+/*
+ * 7.8.1 Macros for format specifiers
+ */
+
+/* fprintf macros for signed integers */
+#define	PRId8		__INT8_FMTd__
+#define	PRId16		__INT16_FMTd__
+#define	PRId32		__INT32_FMTd__
+#define	PRId64		__INT64_FMTd__
+#define	PRIdLEAST8	__INT_LEAST8_FMTd__
+#define	PRIdLEAST16	__INT_LEAST16_FMTd__
+#define	PRIdLEAST32	__INT_LEAST32_FMTd__
+#define	PRIdLEAST64	__INT_LEAST64_FMTd__
+#define	PRIdFAST8	__INT_FAST8_FMTd__
+#define	PRIdFAST16	__INT_FAST16_FMTd__
+#define	PRIdFAST32	__INT_FAST32_FMTd__
+#define	PRIdFAST64	__INT_FAST64_FMTd__
+#define	PRIdMAX		__INTMAX_FMTd__
+#define	PRIdPTR		__INTPTR_FMTd__
+
+#define	PRIi8		__INT8_FMTi__
+#define	PRIi16		__INT16_FMTi__
+#define	PRIi32		__INT32_FMTi__
+#define	PRIi64		__INT64_FMTi__
+#define	PRIiLEAST8	__INT_LEAST8_FMTi__
+#define	PRIiLEAST16	__INT_LEAST16_FMTi__
+#define	PRIiLEAST32	__INT_LEAST32_FMTi__
+#define	PRIiLEAST64	__INT_LEAST64_FMTi__
+#define	PRIiFAST8	__INT_FAST8_FMTi__
+#define	PRIiFAST16	__INT_FAST16_FMTi__
+#define	PRIiFAST32	__INT_FAST32_FMTi__
+#define	PRIiFAST64	__INT_FAST64_FMTi__
+#define	PRIiMAX		__INTMAX_FMTi__
+#define	PRIiPTR		__INTPTR_FMTi__
+
+/* fprintf macros for unsigned integers */
+
+#define	PRIo8		__UINT8_FMTo__
+#define	PRIo16		__UINT16_FMTo__
+#define	PRIo32		__UINT32_FMTo__
+#define	PRIo64		__UINT64_FMTo__
+#define	PRIoLEAST8	__UINT_LEAST8_FMTo__
+#define	PRIoLEAST16	__UINT_LEAST16_FMTo__
+#define	PRIoLEAST32	__UINT_LEAST32_FMTo__
+#define	PRIoLEAST64	__UINT_LEAST64_FMTo__
+#define	PRIoFAST8	__UINT_FAST8_FMTo__
+#define	PRIoFAST16	__UINT_FAST16_FMTo__
+#define	PRIoFAST32	__UINT_FAST32_FMTo__
+#define	PRIoFAST64	__UINT_FAST64_FMTo__
+#define	PRIoMAX		__UINTMAX_FMTo__
+#define	PRIoPTR		__UINTPTR_FMTo__
+
+#define	PRIu8		__UINT8_FMTu__
+#define	PRIu16		__UINT16_FMTu__
+#define	PRIu32		__UINT32_FMTu__
+#define	PRIu64		__UINT64_FMTu__
+#define	PRIuLEAST8	__UINT_LEAST8_FMTu__
+#define	PRIuLEAST16	__UINT_LEAST16_FMTu__
+#define	PRIuLEAST32	__UINT_LEAST32_FMTu__
+#define	PRIuLEAST64	__UINT_LEAST64_FMTu__
+#define	PRIuFAST8	__UINT_FAST8_FMTu__
+#define	PRIuFAST16	__UINT_FAST16_FMTu__
+#define	PRIuFAST32	__UINT_FAST32_FMTu__
+#define	PRIuFAST64	__UINT_FAST64_FMTu__
+#define	PRIuMAX		__UINTMAX_FMTu__
+#define	PRIuPTR		__UINTPTR_FMTu__
+
+#define	PRIx8		__UINT8_FMTx__
+#define	PRIx16		__UINT16_FMTx__
+#define	PRIx32		__UINT32_FMTx__
+#define	PRIx64		__UINT64_FMTx__
+#define	PRIxLEAST8	__UINT_LEAST8_FMTx__
+#define	PRIxLEAST16	__UINT_LEAST16_FMTx__
+#define	PRIxLEAST32	__UINT_LEAST32_FMTx__
+#define	PRIxLEAST64	__UINT_LEAST64_FMTx__
+#define	PRIxFAST8	__UINT_FAST8_FMTx__
+#define	PRIxFAST16	__UINT_FAST16_FMTx__
+#define	PRIxFAST32	__UINT_FAST32_FMTx__
+#define	PRIxFAST64	__UINT_FAST64_FMTx__
+#define	PRIxMAX		__UINTMAX_FMTx__
+#define	PRIxPTR		__UINTPTR_FMTx__
+
+#define	PRIX8		__UINT8_FMTX__
+#define	PRIX16		__UINT16_FMTX__
+#define	PRIX32		__UINT32_FMTX__
+#define	PRIX64		__UINT64_FMTX__
+#define	PRIXLEAST8	__UINT_LEAST8_FMTX__
+#define	PRIXLEAST16	__UINT_LEAST16_FMTX__
+#define	PRIXLEAST32	__UINT_LEAST32_FMTX__
+#define	PRIXLEAST64	__UINT_LEAST64_FMTX__
+#define	PRIXFAST8	__UINT_FAST8_FMTX__
+#define	PRIXFAST16	__UINT_FAST16_FMTX__
+#define	PRIXFAST32	__UINT_FAST32_FMTX__
+#define	PRIXFAST64	__UINT_FAST64_FMTX__
+#define	PRIXMAX		__UINTMAX_FMTX__
+#define	PRIXPTR		__UINTPTR_FMTX__
+
+/* fscanf macros for signed integers */
+
+#define	SCNd8		__INT8_FMTd__
+#define	SCNd16		__INT16_FMTd__
+#define	SCNd32		__INT32_FMTd__
+#define	SCNd64		__INT64_FMTd__
+#define	SCNdLEAST8	__INT_LEAST8_FMTd__
+#define	SCNdLEAST16	__INT_LEAST16_FMTd__
+#define	SCNdLEAST32	__INT_LEAST32_FMTd__
+#define	SCNdLEAST64	__INT_LEAST64_FMTd__
+#define	SCNdFAST8	__INT_FAST8_FMTd__
+#define	SCNdFAST16	__INT_FAST16_FMTd__
+#define	SCNdFAST32	__INT_FAST32_FMTd__
+#define	SCNdFAST64	__INT_FAST64_FMTd__
+#define	SCNdMAX		__INTMAX_FMTd__
+#define	SCNdPTR		__INTPTR_FMTd__
+
+#define	SCNi8		__INT8_FMTi__
+#define	SCNi16		__INT16_FMTi__
+#define	SCNi32		__INT32_FMTi__
+#define	SCNi64		__INT64_FMTi__
+#define	SCNiLEAST8	__INT_LEAST8_FMTi__
+#define	SCNiLEAST16	__INT_LEAST16_FMTi__
+#define	SCNiLEAST32	__INT_LEAST32_FMTi__
+#define	SCNiLEAST64	__INT_LEAST64_FMTi__
+#define	SCNiFAST8	__INT_FAST8_FMTi__
+#define	SCNiFAST16	__INT_FAST16_FMTi__
+#define	SCNiFAST32	__INT_FAST32_FMTi__
+#define	SCNiFAST64	__INT_FAST64_FMTi__
+#define	SCNiMAX		__INTMAX_FMTi__
+#define	SCNiPTR		__INTPTR_FMTi__
+
+/* fscanf macros for unsigned integers */
+
+#define	SCNo8		__UINT8_FMTo__
+#define	SCNo16		__UINT16_FMTo__
+#define	SCNo32		__UINT32_FMTo__
+#define	SCNo64		__UINT64_FMTo__
+#define	SCNoLEAST8	__UINT_LEAST8_FMTo__
+#define	SCNoLEAST16	__UINT_LEAST16_FMTo__
+#define	SCNoLEAST32	__UINT_LEAST32_FMTo__
+#define	SCNoLEAST64	__UINT_LEAST64_FMTo__
+#define	SCNoFAST8	__UINT_FAST8_FMTo__
+#define	SCNoFAST16	__UINT_FAST16_FMTo__
+#define	SCNoFAST32	__UINT_FAST32_FMTo__
+#define	SCNoFAST64	__UINT_FAST64_FMTo__
+#define	SCNoMAX		__UINTMAX_FMTo__
+#define	SCNoPTR		__UINTPTR_FMTo__
+
+#define	SCNu8		__UINT8_FMTu__
+#define	SCNu16		__UINT16_FMTu__
+#define	SCNu32		__UINT32_FMTu__
+#define	SCNu64		__UINT64_FMTu__
+#define	SCNuLEAST8	__UINT_LEAST8_FMTu__
+#define	SCNuLEAST16	__UINT_LEAST16_FMTu__
+#define	SCNuLEAST32	__UINT_LEAST32_FMTu__
+#define	SCNuLEAST64	__UINT_LEAST64_FMTu__
+#define	SCNuFAST8	__UINT_FAST8_FMTu__
+#define	SCNuFAST16	__UINT_FAST16_FMTu__
+#define	SCNuFAST32	__UINT_FAST32_FMTu__
+#define	SCNuFAST64	__UINT_FAST64_FMTu__
+#define	SCNuMAX		__UINTMAX_FMTu__
+#define	SCNuPTR		__UINTPTR_FMTu__
+
+#define	SCNx8		__UINT8_FMTx__
+#define	SCNx16		__UINT16_FMTx__
+#define	SCNx32		__UINT32_FMTx__
+#define	SCNx64		__UINT64_FMTx__
+#define	SCNxLEAST8	__UINT_LEAST8_FMTx__
+#define	SCNxLEAST16	__UINT_LEAST16_FMTx__
+#define	SCNxLEAST32	__UINT_LEAST32_FMTx__
+#define	SCNxLEAST64	__UINT_LEAST64_FMTx__
+#define	SCNxFAST8	__UINT_FAST8_FMTx__
+#define	SCNxFAST16	__UINT_FAST16_FMTx__
+#define	SCNxFAST32	__UINT_FAST32_FMTx__
+#define	SCNxFAST64	__UINT_FAST64_FMTx__
+#define	SCNxMAX		__UINTMAX_FMTx__
+#define	SCNxPTR		__UINTPTR_FMTx__
+
+#define	SCNX8		__UINT8_FMTX__
+#define	SCNX16		__UINT16_FMTX__
+#define	SCNX32		__UINT32_FMTX__
+#define	SCNX64		__UINT64_FMTX__
+#define	SCNXLEAST8	__UINT_LEAST8_FMTX__
+#define	SCNXLEAST16	__UINT_LEAST16_FMTX__
+#define	SCNXLEAST32	__UINT_LEAST32_FMTX__
+#define	SCNXLEAST64	__UINT_LEAST64_FMTX__
+#define	SCNXFAST8	__UINT_FAST8_FMTX__
+#define	SCNXFAST16	__UINT_FAST16_FMTX__
+#define	SCNXFAST32	__UINT_FAST32_FMTX__
+#define	SCNXFAST64	__UINT_FAST64_FMTX__
+#define	SCNXMAX		__UINTMAX_FMTX__
+#define	SCNXPTR		__UINTPTR_FMTX__
+
+#endif /* _SYS_COMMON_INT_FMTIO_H_ */
Index: src/sys/sys/common_int_limits.h
diff -u /dev/null src/sys/sys/common_int_limits.h:1.1.2.2
--- /dev/null	Sun Aug 10 06:56:55 2014
+++ src/sys/sys/common_int_limits.h	Sun Aug 10 06:56:54 2014
@@ -0,0 +1,130 @@
+/*	$NetBSD: common_int_limits.h,v 1.1.2.2 2014/08/10 06:56:54 tls Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION 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.
+ */
+
+#ifndef _SYS_COMMON_INT_LIMITS_H_
+#define _SYS_COMMON_INT_LIMITS_H_
+
+#ifndef __SIG_ATOMIC_MAX__
+#error Your compiler does not provide limit macros.
+#endif
+
+/*
+ * 7.18.2 Limits of specified-width integer types
+ */
+
+/* 7.18.2.1 Limits of exact-width integer types */
+
+/* minimum values of exact-width signed integer types */
+#define	INT8_MIN		(-__INT8_MAX__-1)
+#define	INT16_MIN		(-__INT16_MAX__-1)
+#define	INT32_MIN		(-__INT32_MAX__-1)
+#define	INT64_MIN		(-__INT64_MAX__-1)
+
+/* maximum values of exact-width signed integer types */
+#define	INT8_MAX		__INT8_MAX__
+#define	INT16_MAX		__INT16_MAX__
+#define	INT32_MAX		__INT32_MAX__
+#define	INT64_MAX		__INT64_MAX__
+
+/* maximum values of exact-width unsigned integer types */
+#define	UINT8_MAX		__UINT8_MAX__
+#define	UINT16_MAX		__UINT16_MAX__
+#define	UINT32_MAX		__UINT32_MAX__
+#define	UINT64_MAX		__UINT64_MAX__
+
+/* 7.18.2.2 Limits of minimum-width integer types */
+
+/* minimum values of minimum-width signed integer types */
+#define	INT_LEAST8_MIN		(-__INT_LEAST8_MAX__-1)
+#define	INT_LEAST16_MIN		(-__INT_LEAST16_MAX__-1)
+#define	INT_LEAST32_MIN		(-__INT_LEAST32_MAX__-1)
+#define	INT_LEAST64_MIN		(-__INT_LEAST64_MAX__-1)
+
+/* maximum values of minimum-width signed integer types */
+#define	INT_LEAST8_MAX		__INT_LEAST8_MAX__
+#define	INT_LEAST16_MAX		__INT_LEAST16_MAX__
+#define	INT_LEAST32_MAX		__INT_LEAST32_MAX__
+#define	INT_LEAST64_MAX		__INT_LEAST64_MAX__
+
+/* maximum values of minimum-width unsigned integer types */
+#define	UINT_LEAST8_MAX 	__UINT_LEAST8_MAX__
+#define	UINT_LEAST16_MAX	__UINT_LEAST16_MAX__
+#define	UINT_LEAST32_MAX	__UINT_LEAST32_MAX__
+#define	UINT_LEAST64_MAX	__UINT_LEAST64_MAX__
+
+/* 7.18.2.3 Limits of fastest minimum-width integer types */
+ 
+/* minimum values of fastest minimum-width signed integer types */
+#define	INT_FAST8_MIN		(-__INT_FAST8_MAX__-1)
+#define	INT_FAST16_MIN		(-__INT_FAST16_MAX__-1)
+#define	INT_FAST32_MIN		(-__INT_FAST32_MAX__-1)
+#define	INT_FAST64_MIN		(-__INT_FAST64_MAX__-1)
+
+/* maximum values of fastest minimum-width signed integer types */
+#define	INT_FAST8_MAX		__INT_FAST8_MAX__
+#define	INT_FAST16_MAX		__INT_FAST16_MAX__
+#define	INT_FAST32_MAX		__INT_FAST32_MAX__
+#define	INT_FAST64_MAX		__INT_FAST64_MAX__
+
+/* maximum values of fastest minimum-width unsigned integer types */
+#define	UINT_FAST8_MAX 	__UINT_FAST8_MAX__
+#define	UINT_FAST16_MAX	__UINT_FAST16_MAX__
+#define	UINT_FAST32_MAX	__UINT_FAST32_MAX__
+#define	UINT_FAST64_MAX	__UINT_FAST64_MAX__
+
+/* 7.18.2.4 Limits of integer types capable of holding object pointers */
+#define	INTPTR_MIN	(-__INTPTR_MAX__-1)
+#define	INTPTR_MAX	__INTPTR_MAX__
+#define	UINTPTR_MAX	__UINTPTR_MAX__
+
+/* 7.18.2.5 Limits of greatest-width integer types */
+
+#define	INTMAX_MIN	(-__INTMAX_MAX__-1)
+#define	INTMAX_MAX	__INTMAX_MAX__
+#define	UINTMAX_MAX	__UINTMAX_MAX__
+
+
+/*
+ * 7.18.3 Limits of other integer types
+ */
+
+/* limits of ptrdiff_t */
+#define	PTRDIFF_MIN	(-__PTRDIFF_MAX__-1)
+#define	PTRDIFF_MAX	__PTRDIFF_MAX__
+
+/* limits of sig_atomic_t */
+#define	SIG_ATOMIC_MIN	(-__SIG_ATOMIC_MAX__-1)
+#define	SIG_ATOMIC_MAX	__SIG_ATOMIC_MAX__
+
+/* limit of size_t */
+#define	SIZE_MAX	__SIZE_MAX__
+
+#endif /* _SYS_COMMON_INT_LIMITS_H_ */
Index: src/sys/sys/common_int_mwgwtypes.h
diff -u /dev/null src/sys/sys/common_int_mwgwtypes.h:1.1.2.2
--- /dev/null	Sun Aug 10 06:56:55 2014
+++ src/sys/sys/common_int_mwgwtypes.h	Sun Aug 10 06:56:54 2014
@@ -0,0 +1,69 @@
+/*	$NetBSD: common_int_mwgwtypes.h,v 1.1.2.2 2014/08/10 06:56:54 tls Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION 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.
+ */
+
+#ifndef _SYS_COMMON_INT_MWGWTYPES_H_
+#define _SYS_COMMON_INT_MWGWTYPES_H_
+
+#ifndef __UINT_FAST64_TYPE__
+#error Your compiler does not provide min/fast width type macros.
+#endif
+
+/*
+ * 7.18.1 Integer types
+ */
+
+/* 7.18.1.2 Minimum-width integer types */
+
+typedef	__INT_LEAST8_TYPE__		  int_least8_t;
+typedef	__UINT_LEAST8_TYPE__		 uint_least8_t;
+typedef	__INT_LEAST16_TYPE__		 int_least16_t;
+typedef	__UINT_LEAST16_TYPE__		uint_least16_t;
+typedef	__INT_LEAST32_TYPE__		 int_least32_t;
+typedef	__UINT_LEAST32_TYPE__		uint_least32_t;
+typedef	__INT_LEAST64_TYPE__		 int_least64_t;
+typedef	__UINT_LEAST64_TYPE__		uint_least64_t;
+
+/* 7.18.1.3 Fastest minimum-width integer types */
+typedef	__INT_FAST8_TYPE__		   int_fast8_t;
+typedef	__UINT_FAST8_TYPE__		  uint_fast8_t;
+typedef	__INT_FAST16_TYPE__		  int_fast16_t;
+typedef	__UINT_FAST16_TYPE__		 uint_fast16_t;
+typedef	__INT_FAST32_TYPE__		  int_fast32_t;
+typedef	__UINT_FAST32_TYPE__		 uint_fast32_t;
+typedef	__INT_FAST64_TYPE__		  int_fast64_t;
+typedef	__UINT_FAST64_TYPE__		 uint_fast64_t;
+
+/* 7.18.1.5 Greatest-width integer types */
+
+typedef	__INTMAX_TYPE__			      intmax_t;
+typedef	__UINTMAX_TYPE__		     uintmax_t;
+
+#endif /* _SYS_COMMON_INT_MWGWTYPES_H_ */
Index: src/sys/sys/common_int_types.h
diff -u /dev/null src/sys/sys/common_int_types.h:1.1.2.2
--- /dev/null	Sun Aug 10 06:56:55 2014
+++ src/sys/sys/common_int_types.h	Sun Aug 10 06:56:54 2014
@@ -0,0 +1,61 @@
+/*	$NetBSD: common_int_types.h,v 1.1.2.2 2014/08/10 06:56:54 tls Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Joerg Sonnenberger.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION 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.
+ */
+
+#ifndef _SYS_COMMON_INT_TYPES_H_
+#define _SYS_COMMON_INT_TYPES_H_
+
+#ifndef __UINTPTR_TYPE__
+#error Your compiler does not provide exact width type macros.
+#endif
+
+/*
+ * 7.18.1 Integer types
+ */
+
+/* 7.18.1.1 Exact-width integer types */
+
+typedef	__INT8_TYPE__		   __int8_t;
+typedef	__UINT8_TYPE__		  __uint8_t;
+typedef	__INT16_TYPE__		  __int16_t;
+typedef	__UINT16_TYPE__		 __uint16_t;
+typedef	__INT32_TYPE__		  __int32_t;
+typedef	__UINT32_TYPE__		 __uint32_t;
+typedef	__INT64_TYPE__		  __int64_t;
+typedef	__UINT64_TYPE__		 __uint64_t;
+
+#define	__BIT_TYPES_DEFINED__
+
+/* 7.18.1.4 Integer types capable of holding object pointers */
+
+typedef	__INTPTR_TYPE__		 __intptr_t;
+typedef	__UINTPTR_TYPE__	__uintptr_t;
+
+#endif /* _SYS_COMMON_INT_TYPES_H_ */

Index: src/sys/sys/ipi.h
diff -u /dev/null src/sys/sys/ipi.h:1.2.2.2
--- /dev/null	Sun Aug 10 06:56:55 2014
+++ src/sys/sys/ipi.h	Sun Aug 10 06:56:54 2014
@@ -0,0 +1,77 @@
+/*	$NetBSD: ipi.h,v 1.2.2.2 2014/08/10 06:56:54 tls Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Mindaugas Rasiukevicius.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION 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.
+ */
+
+#ifndef _SYS_IPI_H_
+#define _SYS_IPI_H_
+
+#if !defined(_KERNEL) && !defined(_KMEMUSER)
+#error "not supposed to be exposed to userland"
+#endif
+
+typedef void (*ipi_func_t)(void *);
+
+typedef struct {
+	/* Public: function handler and an argument. */
+	ipi_func_t	func;
+	void *		arg;
+
+	/* Private (internal) elements. */
+	volatile u_int	_pending;
+} ipi_msg_t;
+
+/*
+ * Internal constants and implementation hooks.
+ *
+ * IPI_MAXREG: the maximum number of asynchronous handlers which can
+ * be registered on the system (normally, this should not be high).
+ */
+#define	IPI_MAXREG	32
+
+#define	IPI_BITW_SHIFT	5
+#define	IPI_BITW_MASK	(32 - 1)
+#define	IPI_BITWORDS	(IPI_MAXREG >> IPI_BITW_SHIFT)
+
+void	ipi_sysinit(void);
+void	ipi_cpu_handler(void);
+void	cpu_ipi(struct cpu_info *);
+
+/* Public interface: asynchronous IPIs. */
+u_int	ipi_register(ipi_func_t, void *);
+void	ipi_unregister(u_int);
+void	ipi_trigger(u_int, struct cpu_info *);
+
+/* Public interface: synchronous IPIs. */
+void	ipi_unicast(ipi_msg_t *, struct cpu_info *);
+void	ipi_multicast(ipi_msg_t *, const kcpuset_t *);
+void	ipi_broadcast(ipi_msg_t *);
+void	ipi_wait(ipi_msg_t *);
+
+#endif

Reply via email to