sync with head yamt-pagecache
authoryamt <yamt@NetBSD.org>
Thu, 10 Nov 2011 14:31:09 +0000
branchyamt-pagecache
changeset 280305 b9662434d582
parent 280304 643452be414c
child 280306 97a273c1f1fc
sync with head
bin/csh/csh.h
bin/csh/dol.c
bin/csh/extern.h
bin/csh/proc.c
bin/csh/proc.h
bin/csh/time.c
bin/dd/Makefile
bin/dd/args.c
bin/dd/dd.1
bin/dd/dd.c
bin/dd/extern.h
bin/dd/misc.c
bin/pax/tar.c
common/lib/libc/string/memcmp.c
common/lib/libc/string/memset.c
common/lib/libc/string/memset2.c
common/lib/libc/string/strcpy.c
crypto/external/bsd/heimdal/include/config.h
crypto/external/bsd/openssh/dist/log.c
dist/openpam/lib/openpam_configure.c
distrib/sets/lists/base/ad.mips64eb
distrib/sets/lists/base/ad.mips64el
distrib/sets/lists/base/md.amd64
distrib/sets/lists/base/md.sparc64
distrib/sets/lists/base/mi
distrib/sets/lists/base/shl.mi
distrib/sets/lists/comp/ad.mips64eb
distrib/sets/lists/comp/ad.mips64el
distrib/sets/lists/comp/md.amd64
distrib/sets/lists/comp/md.sparc64
distrib/sets/lists/comp/mi
distrib/sets/lists/comp/shl.mi
distrib/sets/lists/man/mi
distrib/sets/lists/modules/md.evbppc
distrib/sets/lists/modules/mi
distrib/sets/lists/tests/mi
distrib/utils/sysinst/arch/acorn32/md.c
distrib/utils/sysinst/arch/alpha/md.c
distrib/utils/sysinst/arch/amiga/md.c
distrib/utils/sysinst/arch/arc/md.c
distrib/utils/sysinst/arch/atari/md.c
distrib/utils/sysinst/arch/bebox/md.c
distrib/utils/sysinst/arch/cats/md.c
distrib/utils/sysinst/arch/cobalt/md.c
distrib/utils/sysinst/arch/emips/md.c
distrib/utils/sysinst/arch/evbarm/md.c
distrib/utils/sysinst/arch/evbmips/md.c
distrib/utils/sysinst/arch/evbppc/md.c
distrib/utils/sysinst/arch/evbsh3/md.c
distrib/utils/sysinst/arch/ews4800mips/md.c
distrib/utils/sysinst/arch/hp300/md.c
distrib/utils/sysinst/arch/hp700/md.c
distrib/utils/sysinst/arch/hpcarm/md.c
distrib/utils/sysinst/arch/hpcmips/md.c
distrib/utils/sysinst/arch/hpcsh/md.c
distrib/utils/sysinst/arch/i386/md.c
distrib/utils/sysinst/arch/landisk/md.c
distrib/utils/sysinst/arch/luna68k/md.c
distrib/utils/sysinst/arch/mac68k/md.c
distrib/utils/sysinst/arch/macppc/md.c
distrib/utils/sysinst/arch/mipsco/md.c
distrib/utils/sysinst/arch/mvme68k/md.c
distrib/utils/sysinst/arch/news68k/md.c
distrib/utils/sysinst/arch/newsmips/md.c
distrib/utils/sysinst/arch/ofppc/md.c
distrib/utils/sysinst/arch/pmax/md.c
distrib/utils/sysinst/arch/prep/md.c
distrib/utils/sysinst/arch/sandpoint/md.c
distrib/utils/sysinst/arch/sgimips/md.c
distrib/utils/sysinst/arch/shark/md.c
distrib/utils/sysinst/arch/sparc/md.c
distrib/utils/sysinst/arch/sparc64/md.c
distrib/utils/sysinst/arch/sparc64/msg.md.de
distrib/utils/sysinst/arch/sparc64/msg.md.en
distrib/utils/sysinst/arch/sparc64/msg.md.es
distrib/utils/sysinst/arch/sparc64/msg.md.fr
distrib/utils/sysinst/arch/sparc64/msg.md.pl
distrib/utils/sysinst/arch/vax/md.c
distrib/utils/sysinst/arch/x68k/md.c
distrib/utils/sysinst/arch/zaurus/md.c
distrib/utils/sysinst/defs.h
distrib/utils/sysinst/disks.c
doc/3RDPARTY
doc/BRANCHES
doc/CHANGES
doc/HACKS
etc/MAKEDEV.tmpl
etc/Makefile
etc/mtree/NetBSD.dist.tests
external/bsd/Makefile
external/bsd/atf/dist/atf-c/tc.c
external/bsd/iscsi/dist/src/lib/libiscsi.3
external/bsd/iscsi/dist/src/lib/md5hl.c
external/bsd/llvm/Makefile.inc
external/bsd/llvm/bin/clang/Makefile
external/bsd/llvm/config/llvm/Config/config.h
external/bsd/llvm/config/llvm/Config/llvm-config.h
external/bsd/llvm/lib/Makefile
external/bsd/llvm/lib/libLLVMARMCodeGen/Makefile
external/bsd/llvm/lib/libLLVMCodeGen/Makefile
external/bsd/llvm/lib/libLLVMLinker/Makefile
external/bsd/llvm/lib/libLLVMMipsCodeGen/Makefile
external/bsd/llvm/lib/libLLVMScalarOpts/Makefile
external/bsd/llvm/lib/libLLVMSelectionDAG/Makefile
external/bsd/llvm/lib/libLLVMTransformsUtils/Makefile
external/bsd/llvm/lib/libclangAnalysis/Makefile
external/bsd/llvm/lib/libclangFrontend/Makefile
external/bsd/llvm/lib/libclangSema/Makefile
external/bsd/llvm/lib/libclangStaticAnalyzerCore/Makefile
external/bsd/tre/Makefile
external/bsd/tre/Makefile.inc
external/bsd/tre/agrep/Makefile
external/bsd/tre/agrep/agrep.1
external/bsd/tre/bin/Makefile
external/bsd/tre/bin/agrep.1
external/bsd/tre/dist/config.h
external/bsd/tre/dist/lib/regcomp.c
external/bsd/tre/dist/lib/regerror.c
external/bsd/tre/dist/lib/regexec.c
external/bsd/tre/dist/lib/tre-alloca.h
external/bsd/tre/dist/lib/tre-ast.h
external/bsd/tre/dist/lib/tre-compile.c
external/bsd/tre/dist/lib/tre-config.h
external/bsd/tre/dist/lib/tre-internal.h
external/bsd/tre/dist/lib/tre-match-approx.c
external/bsd/tre/dist/lib/tre-match-backtrack.c
external/bsd/tre/dist/lib/tre-match-parallel.c
external/bsd/tre/dist/lib/tre-match-utils.h
external/bsd/tre/dist/lib/tre-mem.c
external/bsd/tre/dist/lib/tre-parse.c
external/bsd/tre/dist/lib/tre-parse.h
external/bsd/tre/dist/lib/tre-stack.c
external/bsd/tre/dist/lib/tre-stack.h
external/bsd/tre/dist/lib/tre.h
external/bsd/tre/dist/lib/xmalloc.c
external/bsd/tre/include/config.h
external/bsd/tre/include/tre-config.h
external/bsd/tre/lib/Makefile
external/bsd/tre/lib/shlib_version
external/bsd/tre/libtre/Makefile
external/bsd/tre/libtre/config.h
external/bsd/tre/libtre/shlib_version
external/bsd/tre/libtre/tre-config.h
external/gpl3/gcc/dist/gcc/unwind-dw2-fde.c
external/gpl3/gcc/usr.bin/backend/Makefile
external/gpl3/gdb/bin/gdb/Makefile
external/ibm-public/postfix/dist/HISTORY
external/ibm-public/postfix/dist/makedefs
external/ibm-public/postfix/dist/src/global/mail_version.h
external/ibm-public/postfix/dist/src/postscreen/postscreen_send.c
external/ibm-public/postfix/dist/src/util/sys_defs.h
external/public-domain/sqlite/dist/sqlite3.c
games/factor/factor.c
gnu/dist/gcc4/gcc/config/arm/arm.md
gnu/dist/gcc4/gcc/version.c
include/setjmp.h
include/ucontext.h
include/unistd.h
lib/Makefile
lib/libc/Makefile.inc
lib/libc/compat/include/setjmp.h
lib/libc/gen/cpuset.3
lib/libc/gen/time.3
lib/libc/gen/unvis.c
lib/libc/regex/regcomp.c
lib/libc/shlib_version
lib/libc/time/ctime.3
lib/libc/time/localtime.c
lib/libnpf/npf.c
lib/libnpf/npf.h
lib/libterminfo/Makefile
lib/libterminfo/Makefile.hash
lib/lua/Makefile
share/man/man4/Makefile
share/man/man4/filemon.4
share/man/man4/ld.4
share/man/man4/virtio.4
share/man/man5/mk.conf.5
share/man/man7/sysctl.7
share/man/man9/kauth.9
share/mk/bsd.README
share/mk/bsd.prog.mk
sys/arch/amd64/amd64/machdep.c
sys/arch/amd64/amd64/trap.c
sys/arch/amd64/conf/files.amd64
sys/arch/amd64/include/pmap.h
sys/arch/amiga/dev/efa.c
sys/arch/arm/at91/at91aic.c
sys/arch/arm/at91/at91bus.c
sys/arch/arm/at91/at91dbgu.c
sys/arch/arm/at91/at91dbgureg.h
sys/arch/arm/at91/at91ohci.c
sys/arch/arm/at91/at91pmc.c
sys/arch/arm/at91/at91pmcreg.h
sys/arch/arm/at91/at91sam9260bus.c
sys/arch/arm/at91/at91sam9260busvar.h
sys/arch/arm/at91/at91sam9260reg.h
sys/arch/arm/at91/at91tctmr.c
sys/arch/arm/at91/files.at91
sys/arch/atari/stand/installboot/installboot.c
sys/arch/evbarm/conf/MMNET_GENERIC
sys/arch/evbarm/conf/files.mmnet
sys/arch/evbarm/conf/mk.mmnet
sys/arch/evbarm/conf/std.mmnet
sys/arch/evbarm/mmnet/mmnet_machdep.c
sys/arch/evbarm/mmnet/mmnet_start.S
sys/arch/evbmips/conf/LOONGSON
sys/arch/hp300/hp300/locore.s
sys/arch/i386/i386/dumpsys.c
sys/arch/i386/i386/gdt.c
sys/arch/i386/i386/machdep.c
sys/arch/i386/include/pmap.h
sys/arch/luna68k/include/param.h
sys/arch/luna68k/luna68k/genassym.cf
sys/arch/luna68k/luna68k/locore.s
sys/arch/m68k/m68k/pmap_motorola.c
sys/arch/mips/include/asm.h
sys/arch/mips/mips/mipsX_subr.S
sys/arch/mips/mips/mips_fixup.c
sys/arch/news68k/news68k/locore.s
sys/arch/sandpoint/README.NAS
sys/arch/sandpoint/pci/pci_machdep.c
sys/arch/sandpoint/stand/altboot/brdsetup.c
sys/arch/sandpoint/stand/altboot/globals.h
sys/arch/sandpoint/stand/altboot/main.c
sys/arch/x68k/x68k/locore.s
sys/arch/x86/include/cpu.h
sys/arch/x86/include/intrdefs.h
sys/arch/x86/include/pmap.h
sys/arch/x86/x86/pmap.c
sys/arch/xen/include/hypervisor.h
sys/arch/xen/include/intrdefs.h
sys/arch/xen/include/xenpmap.h
sys/arch/xen/x86/cpu.c
sys/arch/xen/x86/x86_xpmap.c
sys/arch/xen/x86/xen_ipi.c
sys/arch/xen/x86/xen_pmap.c
sys/arch/xen/x86/xenfunc.c
sys/compat/netbsd32/netbsd32_netbsd.c
sys/compat/netbsd32/netbsd32_syscall.h
sys/compat/netbsd32/netbsd32_syscallargs.h
sys/compat/netbsd32/netbsd32_syscalls.c
sys/compat/netbsd32/netbsd32_sysent.c
sys/compat/netbsd32/syscalls.master
sys/dev/ata/satafisreg.h
sys/dev/i2c/lm75.c
sys/dev/ic/sm502reg.h
sys/dev/iscsi/files.iscsi
sys/dev/mii/miidevs
sys/dev/mii/miidevs.h
sys/dev/mii/miidevs_data.h
sys/dev/pci/hdaudio/hdaudio.c
sys/dev/pci/virtio.c
sys/dev/pci/voyager/voyagerfb.c
sys/dev/raidframe/rf_netbsdkintf.c
sys/dev/usb/files.usb
sys/dev/usb/u3g.c
sys/dev/usb/ukbd.c
sys/dev/usb/usbdevs
sys/dev/usb/usbdevs.h
sys/dev/usb/usbdevs_data.h
sys/kern/bufq_priocscan.c
sys/kern/kern_module.c
sys/kern/kern_synch.c
sys/kern/uipc_syscalls.c
sys/kern/vfs_xattr.c
sys/modules/Makefile
sys/modules/npf/Makefile
sys/modules/npf_alg_icmp/Makefile
sys/net/if_gre.c
sys/net/npf/npf.c
sys/net/npf/npf.h
sys/net/npf/npf_alg_icmp.c
sys/net/npf/npf_ctl.c
sys/net/npf/npf_handler.c
sys/net/npf/npf_impl.h
sys/net/npf/npf_inet.c
sys/net/npf/npf_instr.c
sys/net/npf/npf_nat.c
sys/net/npf/npf_ncode.h
sys/net/npf/npf_processor.c
sys/net/npf/npf_sendpkt.c
sys/net/npf/npf_session.c
sys/net/npf/npf_state.c
sys/net/npf/npf_tableset.c
sys/netinet6/frag6.c
sys/netinet6/ip6_var.h
sys/sys/Makefile
sys/sys/cdefs.h
sys/sys/systm.h
tests/include/t_paths.c
tests/lib/Makefile
tests/lib/libc/gen/Makefile
tests/lib/libc/gen/t_cpuset.c
tests/lib/libc/gen/t_ftok.c
tests/lib/libc/gen/t_time.c
tests/lib/libc/gen/t_vis.c
tests/lib/libc/regex/Makefile
tests/lib/libc/regex/att.c
tests/lib/libc/regex/data/att/README
tests/lib/libc/regex/data/att/basic.dat
tests/lib/libc/regex/data/att/categorization.dat
tests/lib/libc/regex/data/att/forcedassoc.dat
tests/lib/libc/regex/data/att/leftassoc.dat
tests/lib/libc/regex/data/att/nullsubexpr.dat
tests/lib/libc/regex/data/att/repetition.dat
tests/lib/libc/regex/data/att/rightassoc.dat
tests/lib/libc/regex/t_exhaust.c
tests/lib/libc/regex/t_regex.awk
tests/lib/libc/regex/t_regex_att.in
tests/lib/libc/sys/Makefile
tests/lib/libc/sys/t_connect.c
tests/lib/libc/sys/t_listen.c
tests/lib/libc/sys/t_msgctl.c
tests/lib/libc/sys/t_msgget.c
tests/lib/libc/sys/t_msgrcv.c
tests/lib/libc/sys/t_msgsnd.c
tests/lib/libc/sys/t_socketpair.c
tests/lib/libtre/Makefile
tests/net/sys/Makefile
tests/net/sys/t_connect.c
tests/net/sys/t_listen.c
tests/net/sys/t_rfc6056.c
tools/Makefile
tools/compat/Makefile
tools/compat/compat_defs.h
tools/compat/configure
tools/compat/configure.ac
tools/compat/nbtool_config.h.in
tools/gdb/mknative-gdb
tools/llvm-lib/libLLVMLinker/Makefile
tools/tic/Makefile
usr.bin/make/make.1
usr.bin/make/parse.c
usr.bin/tic/tic.1
usr.bin/tic/tic.c
usr.bin/time/ext.h
usr.bin/time/time.1
usr.bin/time/time.c
usr.sbin/installboot/installboot.8
usr.sbin/installboot/installboot.c
usr.sbin/lpr/lpd/lpd.8
usr.sbin/lpr/lpd/lpd.c
usr.sbin/mountd/mountd.8
usr.sbin/mountd/mountd.c
usr.sbin/npf/npfctl/npf_data.c
usr.sbin/npf/npfctl/npf_ncgen.c
usr.sbin/npf/npfctl/npf_parser.c
usr.sbin/npf/npfctl/npfctl.c
usr.sbin/npf/npfctl/npfctl.h
--- a/bin/csh/csh.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/csh/csh.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.21 2007/07/16 18:26:09 christos Exp $ */
+/* $NetBSD: csh.h,v 1.21.34.1 2011/11/10 14:31:09 yamt Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -141,7 +141,7 @@
 #include <sys/time.h>
 #include <sys/types.h>
 
-struct timeval time0;		/* Time at which the shell started */
+struct timespec time0;		/* Time at which the shell started */
 struct rusage ru0;
 
 /*
--- a/bin/csh/dol.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/csh/dol.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dol.c,v 1.27 2011/08/29 14:51:17 joerg Exp $ */
+/* $NetBSD: dol.c,v 1.27.2.1 2011/11/10 14:31:09 yamt Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)dol.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dol.c,v 1.27 2011/08/29 14:51:17 joerg Exp $");
+__RCSID("$NetBSD: dol.c,v 1.27.2.1 2011/11/10 14:31:09 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -815,7 +815,7 @@
 heredoc(Char *term)
 {
     Char obuf[BUFSIZE], lbuf[BUFSIZE], mbuf[BUFSIZE];
-    struct timeval tv;
+    struct timespec tv;
     Char *Dv[2], *lbp, *obp, *mbp, **vp;
     char *tmp;
     int c, ocnt, lcnt, mcnt;
@@ -826,9 +826,9 @@
     if (open(tmp, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600) < 0) {
 	if (errno == EEXIST) {
 	    if (unlink(tmp) == -1) {
-		(void)gettimeofday(&tv, NULL);
+		(void)clock_gettime(CLOCK_MONOTONIC, &tv);
 		mbp = putn((((int)tv.tv_sec) ^ 
-		    ((int)tv.tv_usec) ^ ((int)getpid())) & 0x00ffffff);
+		    ((int)tv.tv_nsec) ^ ((int)getpid())) & 0x00ffffff);
 		shtemp = Strspl(STRtmpsh, mbp);
 		xfree((ptr_t)mbp);
 	    }
--- a/bin/csh/extern.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/csh/extern.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.23 2011/08/29 14:51:17 joerg Exp $ */
+/* $NetBSD: extern.h,v 1.23.2.1 2011/11/10 14:31:09 yamt Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -288,8 +288,8 @@
  */
 void donice(Char **, struct command *);
 void dotime(Char **, struct command *);
-void prusage(FILE *, struct rusage *, struct rusage *, struct timeval *,
-             struct timeval *);
+void prusage(FILE *, struct rusage *, struct rusage *, struct timespec *,
+             struct timespec *);
 void ruadd(struct rusage *, struct rusage *);
 void settimes(void);
 void psecs(long);
--- a/bin/csh/proc.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/csh/proc.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.c,v 1.34 2007/07/16 18:26:10 christos Exp $ */
+/* $NetBSD: proc.c,v 1.34.34.1 2011/11/10 14:31:10 yamt Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)proc.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: proc.c,v 1.34 2007/07/16 18:26:10 christos Exp $");
+__RCSID("$NetBSD: proc.c,v 1.34.34.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -109,7 +109,7 @@
     }
     else {
 	if (pp->p_flags & (PTIME | PPTIME) || adrof(STRtime))
-	    (void)gettimeofday(&pp->p_etime, NULL);
+	    (void)clock_gettime(CLOCK_MONOTONIC, &pp->p_etime);
 
 	pp->p_rusage = ru;
 	if (WIFSIGNALED(w)) {
@@ -500,7 +500,7 @@
     }
     pp->p_next = proclist.p_next;
     proclist.p_next = pp;
-    (void)gettimeofday(&pp->p_btime, NULL);
+    (void)clock_gettime(CLOCK_MONOTONIC, &pp->p_btime);
 }
 
 static void
@@ -800,9 +800,9 @@
 ptprint(struct process *tp)
 {
     static struct rusage zru;
-    static struct timeval ztime;
+    static struct timespec ztime;
     struct rusage ru;
-    struct timeval tetime, diff;
+    struct timespec tetime, diff;
     struct process *pp;
 
     pp = tp;
@@ -810,8 +810,8 @@
     tetime = ztime;
     do {
 	ruadd(&ru, &pp->p_rusage);
-	timersub(&pp->p_etime, &pp->p_btime, &diff);
-	if (timercmp(&diff, &tetime, >))
+	timespecsub(&pp->p_etime, &pp->p_btime, &diff);
+	if (timespeccmp(&diff, &tetime, >))
 	    tetime = diff;
     } while ((pp = pp->p_friends) != tp);
     prusage(cshout, &zru, &ru, &tetime, &ztime);
--- a/bin/csh/proc.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/csh/proc.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: proc.h,v 1.12 2007/07/16 18:26:10 christos Exp $ */
+/* $NetBSD: proc.h,v 1.12.34.1 2011/11/10 14:31:10 yamt Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -52,8 +52,8 @@
     pid_t p_pid;
     pid_t p_jobid;		/* pid of job leader */
     /* if a job is stopped/background p_jobid gives its pgrp */
-    struct timeval p_btime;	/* begin time */
-    struct timeval p_etime;	/* end time */
+    struct timespec p_btime;	/* begin time */
+    struct timespec p_etime;	/* end time */
     struct rusage p_rusage;
     Char *p_command;		/* first PMAXLEN chars of command */
 };
--- a/bin/csh/time.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/csh/time.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: time.c,v 1.18 2011/08/28 07:49:16 christos Exp $ */
+/* $NetBSD: time.c,v 1.18.2.1 2011/11/10 14:31:10 yamt Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)time.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: time.c,v 1.18 2011/08/28 07:49:16 christos Exp $");
+__RCSID("$NetBSD: time.c,v 1.18.2.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -58,7 +58,7 @@
 {
     struct rusage ruch;
 
-    (void)gettimeofday(&time0, NULL);
+    (void)clock_gettime(CLOCK_MONOTONIC, &time0);
     (void)getrusage(RUSAGE_SELF, &ru0);
     (void)getrusage(RUSAGE_CHILDREN, &ruch);
     ruadd(&ru0, &ruch);
@@ -73,12 +73,12 @@
 dotime(Char **v, struct command *t)
 {
     struct rusage ru1, ruch;
-    struct timeval timedol;
+    struct timespec timedol;
 
     (void)getrusage(RUSAGE_SELF, &ru1);
     (void)getrusage(RUSAGE_CHILDREN, &ruch);
     ruadd(&ru1, &ruch);
-    (void)gettimeofday(&timedol, NULL);
+    (void)clock_gettime(CLOCK_MONOTONIC, &timedol);
     prusage(cshout, &ru0, &ru1, &timedol, &time0);
 }
 
@@ -127,8 +127,8 @@
 #endif /* NOT_CSH */
 
 void
-prusage(FILE *fp, struct rusage *r0, struct rusage *r1, struct timeval *e,
-        struct timeval *b)
+prusage(FILE *fp, struct rusage *r0, struct rusage *r1, struct timespec *e,
+        struct timespec *b)
 {
 #ifndef NOT_CSH
     struct varent *vp;
@@ -139,7 +139,7 @@
     int ms;
 
     cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
-    ms = (e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000;
+    ms = (e->tv_sec - b->tv_sec) * 100 + (e->tv_nsec - b->tv_nsec) / 10000000;
     t = (r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
         (r1->ru_utime.tv_usec - r0->ru_utime.tv_usec) / 10000 +
         (r1->ru_stime.tv_sec - r0->ru_stime.tv_sec) * 100 +
--- a/bin/dd/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/dd/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2011/02/04 19:42:12 pooka Exp $
+#	$NetBSD: Makefile,v 1.15.4.1 2011/11/10 14:31:10 yamt Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
 RUMPPRG=dd
@@ -8,7 +8,7 @@
 LDADD+=	-lutil
 
 .ifdef SMALLPROG
-CPPFLAGS+=	-DNO_CONV -DSMALL
+CPPFLAGS+=	-DNO_CONV -DNO_MSGFMT -DSMALL
 .else
 SRCS+=		conv_tab.c
 .ifndef CRUNCHEDPROG
--- a/bin/dd/args.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/dd/args.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.35 2011/09/16 16:06:23 joerg Exp $	*/
+/*	$NetBSD: args.c,v 1.35.2.1 2011/11/10 14:31:10 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)args.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: args.c,v 1.35 2011/09/16 16:06:23 joerg Exp $");
+__RCSID("$NetBSD: args.c,v 1.35.2.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -56,15 +56,22 @@
 #include "extern.h"
 
 static int	c_arg(const void *, const void *);
-#ifndef	NO_CONV
+
+#ifdef NO_MSGFMT
+static void	f_msgfmt(char *) __dead;
+#else
+static void	f_msgfmt(char *);
+#endif /* NO_MSGFMT */
+
+#ifdef NO_CONV
+static void	f_conv(char *) __dead;
+#else
+static void	f_conv(char *);
 static int	c_conv(const void *, const void *);
-#endif
+#endif /* NO_CONV */
+
 static void	f_bs(char *);
 static void	f_cbs(char *);
-#ifdef	NO_CONV
-__dead
-#endif
-static void	f_conv(char *);
 static void	f_count(char *);
 static void	f_files(char *);
 static void	f_ibs(char *);
@@ -90,6 +97,7 @@
 	{ "ibs",	f_ibs,		C_IBS,	 C_BS|C_IBS },
 	{ "if",		f_if,		C_IF,	 C_IF },
 	{ "iseek",	f_skip,		C_SKIP,	 C_SKIP },
+	{ "msgfmt",	f_msgfmt,	C_SKIP,	 C_SKIP },
 	{ "obs",	f_obs,		C_OBS,	 C_BS|C_OBS },
 	{ "of",		f_of,		C_OF,	 C_OF },
 	{ "oseek",	f_seek,		C_SEEK,	 C_SEEK },
@@ -252,6 +260,30 @@
 	in.name = arg;
 }
 
+#ifdef NO_MSGFMT
+/* Build a small version (i.e. for a ramdisk root) */
+static void
+f_msgfmt(char *arg)
+{
+
+	errx(EXIT_FAILURE, "msgfmt option disabled");
+	/* NOTREACHED */
+}
+#else	/* NO_MSGFMT */
+static void
+f_msgfmt(char *arg)
+{
+
+	/*
+	 * If the format string is not valid, dd_write_msg() will print
+	 * an error and exit.
+	 */
+	dd_write_msg(arg, 0);
+
+	msgfmt = arg;
+}
+#endif	/* NO_MSGFMT */
+
 static void
 f_obs(char *arg)
 {
--- a/bin/dd/dd.1	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/dd/dd.1	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dd.1,v 1.23 2010/12/22 09:42:53 enami Exp $
+.\"	$NetBSD: dd.1,v 1.23.6.1 2011/11/10 14:31:10 yamt Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	@(#)dd.1	8.2 (Berkeley) 1/13/94
 .\"
-.Dd December 22, 2010
+.Dd November 6, 2011
 .Dt DD 1
 .Os
 .Sh NAME
@@ -97,6 +97,74 @@
 blocks.
 This is synonymous with
 .Cm skip= Ns Ar n .
+.It Cm msgfmt= Ns Ar fmt
+Specify the message format
+.Ar fmt
+to be used when writing information to standard output.
+Possible values are:
+.Bl -tag -width xxxxx -offset indent -compact
+.It quiet
+turns off information summary report except for errors and
+.Cm progress .
+.It posix
+default information summary report as specified by POSIX.
+.It human
+default information summary report extended with human-readable
+values.
+.El
+.Pp
+When
+.Ar fmt
+does not correspond to any value given above,
+it contains a string that will be used as format specifier
+for the information summary output.
+Each conversion specification is introduced by the character
+.Cm % .
+The following ones are available:
+.Bl -tag -width xx -offset indent -compact
+.It b
+total number of bytes transferred
+.It B
+total number of bytes transferred in
+.Xr humanize_number 3
+format
+.It e
+speed transfer
+.It E
+speed transfer in
+.Xr humanize_number 3
+format
+.It i
+number of partial input block(s)
+.It I
+number of full input block(s)
+.It o
+number of partial output block(s)
+.It O
+number of full output block(s)
+.It s
+time elapsed since the beginning in
+.Do seconds.ms Dc
+format
+.It p
+number of sparse output blocks
+.It t
+number of truncated blocks
+.It w
+number of odd-length swab blocks
+.It P
+singular/plural of
+.Do block Dc
+depending on number of sparse blocks
+.It T
+singular/plural of
+.Do block Dc
+depending on number of truncated blocks
+.It W
+singular/plural of
+.Do block Dc
+depending on number of swab blocks
+.El
 .It Cm obs= Ns Ar n
 Set the output block size to
 .Va n
@@ -370,6 +438,18 @@
 The
 .Nm
 utility exits 0 on success and \*[Gt]0 if an error occurred.
+.Sh EXAMPLES
+To print summary information in human-readable form:
+.Pp
+.Dl dd if=/dev/zero of=/dev/null count=1 msgfmt=human
+.Pp
+To customize the information summary output and print it through
+.Xr unvis 3 :
+.Pp
+.Bd -literal -offset indent
+dd if=/dev/zero of=/dev/null count=1 \e
+     msgfmt='speed:%E, in %s seconds\en' 2\*[Gt]\*[Am]1 | unvis
+.Ed
 .Sh SEE ALSO
 .Xr cp 1 ,
 .Xr mt 1 ,
@@ -382,7 +462,9 @@
 standard.
 The
 .Cm files
-operand and the
+and
+.Cm msgfmt
+operands and the
 .Cm ascii ,
 .Cm ebcdic ,
 .Cm ibm ,
--- a/bin/dd/dd.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/dd/dd.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: dd.c,v 1.47 2011/02/04 19:42:12 pooka Exp $	*/
+/*	$NetBSD: dd.c,v 1.47.4.1 2011/11/10 14:31:10 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)dd.c	8.5 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: dd.c,v 1.47 2011/02/04 19:42:12 pooka Exp $");
+__RCSID("$NetBSD: dd.c,v 1.47.4.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -86,6 +86,7 @@
 uint64_t	progress = 0;		/* display sign of life */
 const u_char	*ctab;			/* conversion table */
 sigset_t	infoset;		/* a set blocking SIGINFO */
+const char	*msgfmt = "posix";	/* default summary() message format */
 
 /*
  * Ops for stdin/stdout and crunch'd dd.  These are always host ops.
--- a/bin/dd/extern.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/dd/extern.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.20 2011/09/16 16:06:23 joerg Exp $	*/
+/*	$NetBSD: extern.h,v 1.20.2.1 2011/11/10 14:31:10 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -48,6 +48,11 @@
 void unblock(void);
 void unblock_close(void);
 #endif
+
+#ifndef NO_MSGFMT
+int dd_write_msg(const char *, int);
+#endif
+
 void dd_out(int);
 void def(void);
 void def_close(void);
@@ -74,3 +79,4 @@
 extern const u_char	e2a_32V[], e2a_POSIX[];
 extern const u_char	a2ibm_32V[], a2ibm_POSIX[];
 extern u_char		casetab[];
+extern const char	*msgfmt;
--- a/bin/dd/misc.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/dd/misc.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.21 2007/10/05 07:23:09 lukem Exp $	*/
+/*	$NetBSD: misc.c,v 1.21.28.1 2011/11/10 14:31:10 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)misc.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: misc.c,v 1.21 2007/10/05 07:23:09 lukem Exp $");
+__RCSID("$NetBSD: misc.c,v 1.21.28.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -59,9 +59,41 @@
 
 #define	tv2mS(tv) ((tv).tv_sec * 1000LL + ((tv).tv_usec + 500) / 1000)
 
+static void posix_summary(void);
+#ifndef NO_MSGFMT
+static void custom_summary(void);
+static void human_summary(void);
+static void quiet_summary(void);
+
+static void buffer_write(const char *, size_t, int);
+#endif /* NO_MSGFMT */
+
 void
 summary(void)
 {
+
+	if (progress)
+		(void)write(STDERR_FILENO, "\n", 1);
+
+#ifdef NO_MSGFMT
+	return posix_summary();
+#else /* NO_MSGFMT */
+	if (strncmp(msgfmt, "human", sizeof("human")) == 0)
+		return human_summary();
+
+	if (strncmp(msgfmt, "posix", sizeof("posix")) == 0)
+		return posix_summary();
+
+	if (strncmp(msgfmt, "quiet", sizeof("quiet")) == 0)
+		return quiet_summary();
+
+	return custom_summary();
+#endif /* NO_MSGFMT */
+}
+
+static void
+posix_summary(void)
+{
 	char buf[100];
 	int64_t mS;
 	struct timeval tv;
@@ -73,6 +105,7 @@
 	mS = tv2mS(tv) - tv2mS(st.start);
 	if (mS == 0)
 		mS = 1;
+
 	/* Use snprintf(3) so that we don't reenter stdio(3). */
 	(void)snprintf(buf, sizeof(buf),
 	    "%llu+%llu records in\n%llu+%llu records out\n",
@@ -123,3 +156,187 @@
 	(void)raise_default_signal(signo);
 	_exit(127);
 }
+
+#ifndef NO_MSGFMT
+/*
+ * Buffer write(2) calls
+ */
+static void
+buffer_write(const char *str, size_t size, int flush)
+{
+	static char wbuf[128];
+	static size_t cnt = 0; /* Internal counter to allow wbuf to wrap */
+	
+	unsigned int i;
+
+	for (i = 0; i < size; i++) {
+		if (str != NULL) {
+			wbuf[cnt++] = str[i];
+		}
+		if (cnt >= sizeof(wbuf)) {
+			(void)write(STDERR_FILENO, wbuf, cnt);
+			cnt = 0;
+		}
+	}
+
+	if (flush != 0) {
+		(void)write(STDERR_FILENO, wbuf, cnt);
+		cnt = 0;
+	}
+}
+
+/*
+ * Write summary to stderr according to format 'fmt'. If 'enable' is 0, it
+ * will not attempt to write anything. Can be used to validate the
+ * correctness of the 'fmt' string.
+ */
+int
+dd_write_msg(const char *fmt, int enable)
+{
+	char hbuf[7], nbuf[32];
+	const char *ptr;
+	int64_t mS;
+	struct timeval tv;
+
+	(void)gettimeofday(&tv, NULL);
+	mS = tv2mS(tv) - tv2mS(st.start);
+	if (mS == 0)
+		mS = 1;
+
+#define ADDC(c) do { if (enable != 0) buffer_write(&c, 1, 0); } \
+	while (/*CONSTCOND*/0)
+#define ADDS(p) do { if (enable != 0) buffer_write(p, strlen(p), 0); } \
+	while (/*CONSTCOND*/0)
+
+	for (ptr = fmt; *ptr; ptr++) {
+		if (*ptr != '%') {
+			ADDC(*ptr);
+			continue;
+		}
+
+ 		switch (*++ptr) {
+		case 'b':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long)st.bytes);
+			ADDS(nbuf);
+			break;
+		case 'B':
+			if (humanize_number(hbuf, sizeof(hbuf),
+			    st.bytes, "B",
+			    HN_AUTOSCALE, HN_DECIMAL) == -1)
+				warnx("humanize_number (bytes transferred)");
+			ADDS(hbuf);
+			break;
+		case 'e':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long) (st.bytes * 1000LL / mS));
+			ADDS(nbuf);
+			break;
+		case 'E':
+			if (humanize_number(hbuf, sizeof(hbuf),
+			    st.bytes * 1000LL / mS, "B",
+			    HN_AUTOSCALE, HN_DECIMAL) == -1)
+				warnx("humanize_number (bytes per second)");
+			ADDS(hbuf); ADDS("/sec");
+			break;
+		case 'i':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long)st.in_part);
+			ADDS(nbuf);
+			break;
+		case 'I':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long)st.in_full);
+			ADDS(nbuf);
+			break;
+		case 'o':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long)st.out_part);
+			ADDS(nbuf);
+			break;
+		case 'O':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long)st.out_full);
+			ADDS(nbuf);
+			break;
+		case 's':
+			(void)snprintf(nbuf, sizeof(nbuf), "%li.%03d",
+			    (long) (mS / 1000), (int) (mS % 1000));
+			ADDS(nbuf);
+			break;
+		case 'p':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long)st.sparse);
+			ADDS(nbuf);
+			break;
+		case 't':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long)st.trunc);
+			ADDS(nbuf);
+			break;
+		case 'w':
+			(void)snprintf(nbuf, sizeof(nbuf), "%llu",
+			    (unsigned long long)st.swab);
+			ADDS(nbuf);
+			break;
+		case 'P':
+			ADDS("block");
+			if (st.sparse != 1) ADDS("s");
+			break;
+		case 'T':
+			ADDS("block");
+			if (st.trunc != 1) ADDS("s");
+			break;
+		case 'W':
+			ADDS("block");
+			if (st.swab != 1) ADDS("s");
+			break;
+		case '%':
+			ADDC(*ptr);
+			break;
+		default:
+			if (*ptr == '\0')
+				goto done;
+			errx(EXIT_FAILURE, "unknown specifier '%c' in "
+			    "msgfmt string", *ptr);
+			/* NOTREACHED */
+		}
+	}
+
+done:
+	/* flush buffer */
+	buffer_write(NULL, 0, 1);
+	return 0;
+}
+
+static void
+custom_summary(void)
+{
+
+	dd_write_msg(msgfmt, 1);
+}
+
+static void
+human_summary(void)
+{
+	(void)dd_write_msg("%I+%i records in\n%O+%o records out\n", 1);
+	if (st.swab) {
+		(void)dd_write_msg("%w odd length swab %W\n", 1);
+	}
+	if (st.trunc) {
+		(void)dd_write_msg("%t truncated %T\n", 1);
+	}
+	if (st.sparse) {
+		(void)dd_write_msg("%p sparse output %P\n", 1);
+	}
+	(void)dd_write_msg("%b bytes (%B) transferred in %s secs "
+	    "(%e bytes/sec - %E)\n", 1);
+}
+
+static void
+quiet_summary(void)
+{
+
+	/* stay quiet */
+}
+#endif /* NO_MSGFMT */
--- a/bin/pax/tar.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/bin/pax/tar.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: tar.c,v 1.67 2009/02/14 08:10:06 lukem Exp $	*/
+/*	$NetBSD: tar.c,v 1.67.6.1 2011/11/10 14:31:10 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1992 Keith Muller.
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)tar.c	8.2 (Berkeley) 4/18/94";
 #else
-__RCSID("$NetBSD: tar.c,v 1.67 2009/02/14 08:10:06 lukem Exp $");
+__RCSID("$NetBSD: tar.c,v 1.67.6.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -1386,11 +1386,15 @@
 	int lineno = 0;
 	size_t len;
 
-	fp = fopen(path, "r");
-	if (fp == NULL) {
-		tty_warn(1, "cannot open %s: %s", path,
-		    strerror(errno));
-		return -1;
+	if (path[0] == '-' && path[1] == '\0')
+		fp = stdin;
+	else {
+		fp = fopen(path, "r");
+		if (fp == NULL) {
+			tty_warn(1, "cannot open %s: %s", path,
+			    strerror(errno));
+			return -1;
+		}
 	}
 
 	while ((line = fgetln(fp, &len))) {
@@ -1400,7 +1404,9 @@
 			    lineno, path);
 		}
 		if (tar_gnutar_exclude_one(line, len))
-			return (-1);
+			return -1;
 	}
-	return (0);
+	if (fp != stdin)
+		fclose(fp);
+	return 0;
 }
--- a/common/lib/libc/string/memcmp.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/common/lib/libc/string/memcmp.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: memcmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $	*/
+/*	$NetBSD: memcmp.c,v 1.2.34.1 2011/11/10 14:31:10 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)memcmp.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: memcmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
+__RCSID("$NetBSD: memcmp.c,v 1.2.34.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -48,6 +48,7 @@
 #include <lib/libkern/libkern.h>
 #endif 
 
+#undef memcmp
 /*
  * Compare memory regions.
  */
--- a/common/lib/libc/string/memset.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/common/lib/libc/string/memset.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: memset.c,v 1.8 2009/03/18 12:25:06 tsutsui Exp $	*/
+/*	$NetBSD: memset.c,v 1.8.6.1 2011/11/10 14:31:10 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)memset.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: memset.c,v 1.8 2009/03/18 12:25:06 tsutsui Exp $");
+__RCSID("$NetBSD: memset.c,v 1.8.6.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -60,8 +60,8 @@
 
 #ifdef _FORTIFY_SOURCE
 #undef bzero
+#endif
 #undef memset
-#endif
 
 #ifndef __OPTIMIZE_SIZE__
 #ifdef BZERO
--- a/common/lib/libc/string/memset2.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/common/lib/libc/string/memset2.c	Thu Nov 10 14:31:09 2011 +0000
@@ -49,11 +49,11 @@
 
 #ifdef _FORTIFY_SOURCE
 #undef bzero
+#endif
 #undef memset
-#endif
 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: memset2.c,v 1.2 2009/12/14 00:39:01 matt Exp $");    
+__RCSID("$NetBSD: memset2.c,v 1.2.6.1 2011/11/10 14:31:10 yamt Exp $");    
 #endif /* LIBC_SCCS and not lint */
 
 /*
--- a/common/lib/libc/string/strcpy.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/common/lib/libc/string/strcpy.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: strcpy.c,v 1.2 2007/06/04 18:19:27 christos Exp $	*/
+/*	$NetBSD: strcpy.c,v 1.2.34.1 2011/11/10 14:31:10 yamt Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strcpy.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strcpy.c,v 1.2 2007/06/04 18:19:27 christos Exp $");
+__RCSID("$NetBSD: strcpy.c,v 1.2.34.1 2011/11/10 14:31:10 yamt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -45,9 +45,7 @@
 #include <lib/libkern/libkern.h>
 #endif
 
-#ifdef _FORTIFY_SOURCE
 #undef strcpy
-#endif
 
 char *
 strcpy(char *to, const char *from)
--- a/crypto/external/bsd/heimdal/include/config.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/crypto/external/bsd/heimdal/include/config.h	Thu Nov 10 14:31:09 2011 +0000
@@ -528,8 +528,10 @@
 /* Define to 1 if you have the <io.h> header file. */
 /* #undef HAVE_IO_H */
 
+#if 0
 /* Define if you have IPv6. */
 #define HAVE_IPV6 1
+#endif
 
 /* Define if you have the function `iruserok'. */
 #define HAVE_IRUSEROK 1
--- a/crypto/external/bsd/openssh/dist/log.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/crypto/external/bsd/openssh/dist/log.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: log.c,v 1.6 2011/09/16 15:36:00 joerg Exp $	*/
+/*	$NetBSD: log.c,v 1.6.2.1 2011/11/10 14:31:11 yamt Exp $	*/
 /* $OpenBSD: log.c,v 1.42 2011/06/17 21:44:30 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -36,7 +36,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: log.c,v 1.6 2011/09/16 15:36:00 joerg Exp $");
+__RCSID("$NetBSD: log.c,v 1.6.2.1 2011/11/10 14:31:11 yamt Exp $");
 #include <sys/types.h>
 #include <sys/uio.h>
 
@@ -375,12 +375,13 @@
 	msgbufp = msgbuf;
 	if (txt != NULL && log_handler == NULL) {
 		len2 = strlen(txt);
-		if (len2 >= len)
-			len2 = len - 1;
+		if (len2 > len - 2)
+			len2 = len - 2;
 		memcpy(msgbufp, txt, len2);
 		msgbufp += len2;
-		*msgbufp++ = '\0';
-		len -= len2 + 1;
+		*msgbufp++ = ':';
+		*msgbufp++ = ' ';
+		len -= len2 + 2;
 	}
 	vsnprintf(msgbufp, len, fmt, args);
 	len3 = strnvis(visbuf, sizeof(visbuf), msgbuf, VIS_SAFE|VIS_OCTAL);
--- a/dist/openpam/lib/openpam_configure.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/dist/openpam/lib/openpam_configure.c	Thu Nov 10 14:31:09 2011 +0000
@@ -32,7 +32,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: openpam_configure.c,v 1.5 2008/01/27 01:22:59 christos Exp $
+ * $Id: openpam_configure.c,v 1.5.26.1 2011/11/10 14:31:11 yamt Exp $
  */
 
 #include <ctype.h>
@@ -289,6 +289,12 @@
 	size_t len;
 	int r;
 
+	/* don't allow to escape from policy_path */
+	if (strchr(service, '/')) {
+		openpam_log(PAM_LOG_ERROR, "illegal service \"%s\"", service);
+		return (-PAM_SYSTEM_ERR);
+	}
+
 	for (path = openpam_policy_path; *path != NULL; ++path) {
 		len = strlen(*path);
 		if ((*path)[len - 1] == '/') {
--- a/distrib/sets/lists/base/ad.mips64eb	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/base/ad.mips64eb	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64eb,v 1.73 2011/10/15 10:46:24 mbalmer Exp $
+# $NetBSD: ad.mips64eb,v 1.73.2.1 2011/11/10 14:31:11 yamt Exp $
 ./libexec/ld.elf_so-64				base-compat-shlib	compat,pic
 ./libexec/ld.elf_so-o32				base-sysutil-bin	compat,pic
 ./usr/lib/64					base-compat-lib
@@ -256,6 +256,8 @@
 ./usr/lib/64/libterminfo.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libtermlib.so.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libtermlib.so.0.6			base-compat-shlib	compat,pic
+./usr/lib/64/libtre.so.0			base-compat-shlib	compat,pic
+./usr/lib/64/libtre.so.0.8			base-compat-shlib	compat,pic
 ./usr/lib/64/libukfs.so.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libukfs.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libusbhid.so.1			base-compat-shlib	compat,pic
@@ -550,6 +552,8 @@
 ./usr/lib/o32/libterminfo.so.1.0		base-compat-shlib	compat,pic
 ./usr/lib/o32/libtermlib.so.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libtermlib.so.0.6			base-compat-shlib	compat,pic
+./usr/lib/o32/libtre.so.0			base-compat-shlib	compat,pic
+./usr/lib/o32/libtre.so.0.8			base-compat-shlib	compat,pic
 ./usr/lib/o32/libukfs.so.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libukfs.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libusbhid.so.1			base-compat-shlib	compat,pic
--- a/distrib/sets/lists/base/ad.mips64el	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/base/ad.mips64el	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64el,v 1.72 2011/10/15 10:46:24 mbalmer Exp $
+# $NetBSD: ad.mips64el,v 1.72.2.1 2011/11/10 14:31:11 yamt Exp $
 ./libexec/ld.elf_so-64				base-compat-shlib	compat,pic
 ./libexec/ld.elf_so-o32				base-sysutil-bin	compat,pic
 ./usr/lib/64					base-compat-lib
@@ -256,6 +256,8 @@
 ./usr/lib/64/libterminfo.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libtermlib.so.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libtermlib.so.0.6			base-compat-shlib	compat,pic
+./usr/lib/64/libtre.so.0			base-compat-shlib	compat,pic
+./usr/lib/64/libtre.so.0.8			base-compat-shlib	compat,pic
 ./usr/lib/64/libukfs.so.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libukfs.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libusbhid.so.1			base-compat-shlib	compat,pic
@@ -550,6 +552,8 @@
 ./usr/lib/o32/libterminfo.so.1.0		base-compat-shlib	compat,pic
 ./usr/lib/o32/libtermlib.so.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libtermlib.so.0.6			base-compat-shlib	compat,pic
+./usr/lib/o32/libtre.so.0			base-compat-shlib	compat,pic
+./usr/lib/o32/libtre.so.0.8			base-compat-shlib	compat,pic
 ./usr/lib/o32/libukfs.so.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libukfs.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libusbhid.so.1			base-compat-shlib	compat,pic
--- a/distrib/sets/lists/base/md.amd64	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/base/md.amd64	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.145 2011/10/15 10:46:24 mbalmer Exp $
+# $NetBSD: md.amd64,v 1.145.2.1 2011/11/10 14:31:11 yamt Exp $
 ./dev/lms0					base-obsolete		obsolete
 ./dev/mms0					base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib		compat,pic
@@ -259,6 +259,8 @@
 ./usr/lib/i386/libterminfo.so.1.0		base-compat-shlib	compat,pic
 ./usr/lib/i386/libtermlib.so.0			base-compat-shlib	compat,pic
 ./usr/lib/i386/libtermlib.so.0.6		base-compat-shlib	compat,pic
+./usr/lib/i386/libtre.so.0			base-compat-shlib	compat,pic
+./usr/lib/i386/libtre.so.0.8			base-compat-shlib	compat,pic
 ./usr/lib/i386/libukfs.so.1			base-compat-shlib	compat,pic
 ./usr/lib/i386/libukfs.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/i386/libusbhid.so.1			base-compat-shlib	compat,pic
--- a/distrib/sets/lists/base/md.sparc64	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/base/md.sparc64	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.138 2011/10/15 10:46:25 mbalmer Exp $
+# $NetBSD: md.sparc64,v 1.138.2.1 2011/11/10 14:31:11 yamt Exp $
 ./libexec/ld.elf_so-sparc			base-sysutil-bin	compat,pic
 ./sbin/edlabel					base-sysutil-root	obsolete
 ./usr/bin/fdformat				base-util-bin
@@ -257,6 +257,8 @@
 ./usr/lib/sparc/libterminfo.so.1.0		base-compat-shlib	compat,pic
 ./usr/lib/sparc/libtermlib.so.0			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libtermlib.so.0.6		base-compat-shlib	compat,pic
+./usr/lib/sparc/libtre.so.0			base-compat-shlib	compat,pic
+./usr/lib/sparc/libtre.so.0.8			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libukfs.so.1			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libukfs.so.1.0			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libusbhid.so.1			base-compat-shlib	compat,pic
--- a/distrib/sets/lists/base/mi	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/base/mi	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.969 2011/10/15 13:00:59 mbalmer Exp $
+# $NetBSD: mi,v 1.969.2.1 2011/11/10 14:31:11 yamt Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -365,6 +365,7 @@
 ./usr						base-sys-root
 ./usr/bin					base-sys-usr
 ./usr/bin/Mail					base-mail-bin
+./usr/bin/agrep					base-util-bin
 ./usr/bin/apply					base-util-bin
 ./usr/bin/apropos				base-man-bin
 ./usr/bin/arpaname				base-bind-bin
--- a/distrib/sets/lists/base/shl.mi	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/base/shl.mi	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.607 2011/10/15 10:46:25 mbalmer Exp $
+# $NetBSD: shl.mi,v 1.607.2.1 2011/11/10 14:31:12 yamt Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -670,6 +670,9 @@
 ./usr/lib/libtermlib.so				base-sys-shlib
 ./usr/lib/libtermlib.so.0			base-sys-shlib
 ./usr/lib/libtermlib.so.0.6			base-sys-shlib
+./usr/lib/libtre.so				base-sys-shlib
+./usr/lib/libtre.so.0				base-sys-shlib
+./usr/lib/libtre.so.0.8				base-sys-shlib
 ./usr/lib/libukfs.so				base-sys-shlib
 ./usr/lib/libukfs.so.1				base-sys-shlib
 ./usr/lib/libukfs.so.1.0			base-sys-shlib
--- a/distrib/sets/lists/comp/ad.mips64eb	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/comp/ad.mips64eb	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64eb,v 1.59 2011/10/17 14:20:54 chs Exp $
+# $NetBSD: ad.mips64eb,v 1.59.2.1 2011/11/10 14:31:12 yamt Exp $
 ./usr/bin/elf2aout				comp-obsolete		obsolete
 ./usr/bin/elf2ecoff				comp-sysutil-bin
 ./usr/include/gcc-4.5/loongson.h		comp-c-include		gcccmds,gcc=45
@@ -611,6 +611,10 @@
 ./usr/lib/64/libtermlib.so			base-sys-shlib		compat,pic
 ./usr/lib/64/libtermlib_p.a			comp-c-proflib		compat,profile
 ./usr/lib/64/libtermlib_pic.a			comp-c-piclib		compat,pic
+./usr/lib/64/libtre.a				comp-c-lib		compat
+./usr/lib/64/libtre.so				base-sys-shlib		compat,pic
+./usr/lib/64/libtre_p.a				comp-c-proflib		compat,profile
+./usr/lib/64/libtre_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/64/libukfs.a				comp-c-lib		compat
 ./usr/lib/64/libukfs.so				base-sys-shlib		compat,pic
 ./usr/lib/64/libukfs_p.a			comp-c-proflib		compat,profile
@@ -1192,6 +1196,10 @@
 ./usr/lib/o32/libtermlib.so			base-sys-shlib		compat,pic
 ./usr/lib/o32/libtermlib_p.a			comp-c-proflib		compat,profile
 ./usr/lib/o32/libtermlib_pic.a			comp-c-piclib		compat,pic
+./usr/lib/o32/libtre.a				comp-c-lib		compat
+./usr/lib/o32/libtre.so				base-sys-shlib		compat,pic
+./usr/lib/o32/libtre_p.a			comp-c-proflib		compat,profile
+./usr/lib/o32/libtre_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/o32/libukfs.a				comp-c-lib		compat
 ./usr/lib/o32/libukfs.so			base-sys-shlib		compat,pic
 ./usr/lib/o32/libukfs_p.a			comp-c-proflib		compat,profile
@@ -1366,6 +1374,7 @@
 ./usr/libdata/debug/usr/lib/64/libstdc++.so.7.0.debug	comp-sys-debug	gcc=4,cxx,debug,compat
 ./usr/libdata/debug/usr/lib/64/libstdc++.so.7.1.debug	comp-sys-debug	gcc=45,cxx,debug,compat
 ./usr/libdata/debug/usr/lib/64/libterminfo.so.1.0.debug	comp-sys-debug	debug,compat
+./usr/libdata/debug/usr/lib/64/libtre.so.0.8.debug	comp-sys-debug	debug,compat
 ./usr/libdata/debug/usr/lib/64/libukfs.so.1.0.debug	comp-sys-debug	debug,compat
 ./usr/libdata/debug/usr/lib/64/libumem.so.0.0.debug	comp-zfs-debug	zfs,dynamicroot,debug,compat
 ./usr/libdata/debug/usr/lib/64/libusbhid.so.1.0.debug	comp-sys-debug	debug,compat
@@ -1517,6 +1526,7 @@
 ./usr/libdata/debug/usr/lib/o32/libstdc++.so.7.0.debug	comp-sys-debug	gcc=4,cxx,debug,compat
 ./usr/libdata/debug/usr/lib/o32/libstdc++.so.7.1.debug	comp-sys-debug	gcc=45,cxx,debug,compat
 ./usr/libdata/debug/usr/lib/o32/libterminfo.so.1.0.debug	comp-sys-debug	debug,compat
+./usr/libdata/debug/usr/lib/o32/libtre.so.0.8.debug	comp-sys-debug	debug,compat
 ./usr/libdata/debug/usr/lib/o32/libukfs.so.1.0.debug	comp-sys-debug	debug,compat
 ./usr/libdata/debug/usr/lib/o32/libumem.so.0.0.debug	comp-zfs-debug	zfs,dynamicroot,debug,compat
 ./usr/libdata/debug/usr/lib/o32/libusbhid.so.1.0.debug	comp-sys-debug	debug,compat
--- a/distrib/sets/lists/comp/ad.mips64el	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/comp/ad.mips64el	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64el,v 1.59 2011/10/17 14:20:54 chs Exp $
+# $NetBSD: ad.mips64el,v 1.59.2.1 2011/11/10 14:31:12 yamt Exp $
 ./usr/bin/elf2aout				comp-obsolete		obsolete
 ./usr/bin/elf2ecoff				comp-sysutil-bin
 ./usr/include/gcc-4.5/loongson.h		comp-c-include		gcccmds,gcc=45
@@ -611,6 +611,10 @@
 ./usr/lib/64/libtermlib.so			base-sys-shlib		compat,pic
 ./usr/lib/64/libtermlib_p.a			comp-c-proflib		compat,profile
 ./usr/lib/64/libtermlib_pic.a			comp-c-piclib		compat,pic
+./usr/lib/64/libtre.a				comp-c-lib		compat
+./usr/lib/64/libtre.so				base-sys-shlib		compat,pic
+./usr/lib/64/libtre_p.a				comp-c-proflib		compat,profile
+./usr/lib/64/libtre_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/64/libukfs.a				comp-c-lib		compat
 ./usr/lib/64/libukfs.so				base-sys-shlib		compat,pic
 ./usr/lib/64/libukfs_p.a			comp-c-proflib		compat,profile
@@ -1192,6 +1196,10 @@
 ./usr/lib/o32/libtermlib.so			base-sys-shlib		compat,pic
 ./usr/lib/o32/libtermlib_p.a			comp-c-proflib		compat,profile
 ./usr/lib/o32/libtermlib_pic.a			comp-c-piclib		compat,pic
+./usr/lib/o32/libtre.a				comp-c-lib		compat
+./usr/lib/o32/libtre.so				base-sys-shlib		compat,pic
+./usr/lib/o32/libtre_p.a			comp-c-proflib		compat,profile
+./usr/lib/o32/libtre_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/o32/libukfs.a				comp-c-lib		compat
 ./usr/lib/o32/libukfs.so			base-sys-shlib		compat,pic
 ./usr/lib/o32/libukfs_p.a			comp-c-proflib		compat,profile
@@ -1366,6 +1374,7 @@
 ./usr/libdata/debug/usr/lib/64/libstdc++.so.7.0.debug	comp-sys-debug	gcc=4,cxx,debug,compat
 ./usr/libdata/debug/usr/lib/64/libstdc++.so.7.1.debug	comp-sys-debug	gcc=45,cxx,debug,compat
 ./usr/libdata/debug/usr/lib/64/libterminfo.so.1.0.debug	comp-sys-debug	debug,compat
+./usr/libdata/debug/usr/lib/64/libtre.so.0.8.debug	comp-sys-debug	debug,compat
 ./usr/libdata/debug/usr/lib/64/libukfs.so.1.0.debug	comp-sys-debug	debug,compat
 ./usr/libdata/debug/usr/lib/64/libumem.so.0.0.debug	comp-zfs-debug	zfs,dynamicroot,debug,compat
 ./usr/libdata/debug/usr/lib/64/libusbhid.so.1.0.debug	comp-sys-debug	debug,compat
@@ -1517,6 +1526,7 @@
 ./usr/libdata/debug/usr/lib/o32/libstdc++.so.7.0.debug	comp-sys-debug	gcc=4,cxx,debug,compat
 ./usr/libdata/debug/usr/lib/o32/libstdc++.so.7.1.debug	comp-sys-debug	gcc=45,cxx,debug,compat
 ./usr/libdata/debug/usr/lib/o32/libterminfo.so.1.0.debug	comp-sys-debug	debug,compat
+./usr/libdata/debug/usr/lib/o32/libtre.so.0.8.debug	comp-sys-debug	debug,compat
 ./usr/libdata/debug/usr/lib/o32/libukfs.so.1.0.debug	comp-sys-debug	debug,compat
 ./usr/libdata/debug/usr/lib/o32/libumem.so.0.0.debug	comp-zfs-debug	zfs,dynamicroot,debug,compat
 ./usr/libdata/debug/usr/lib/o32/libusbhid.so.1.0.debug	comp-sys-debug	debug,compat
--- a/distrib/sets/lists/comp/md.amd64	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/comp/md.amd64	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.143 2011/10/17 14:20:54 chs Exp $
+# $NetBSD: md.amd64,v 1.143.2.1 2011/11/10 14:31:12 yamt Exp $
 ./usr/include/amd64				comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
 ./usr/include/amd64/aout_machdep.h		comp-c-include
@@ -958,6 +958,10 @@
 ./usr/lib/i386/libtermlib.so			comp-sys-shlib		compat,pic
 ./usr/lib/i386/libtermlib_p.a			comp-c-proflib		compat,profile
 ./usr/lib/i386/libtermlib_pic.a			comp-c-piclib		compat,pic
+./usr/lib/i386/libtre.a				comp-c-lib		compat
+./usr/lib/i386/libtre.so			comp-sys-shlib		compat,pic
+./usr/lib/i386/libtre_p.a			comp-c-proflib		compat,profile
+./usr/lib/i386/libtre_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/i386/libukfs.a			comp-c-lib		compat
 ./usr/lib/i386/libukfs.so			comp-sys-shlib		compat,pic
 ./usr/lib/i386/libukfs_g.a			comp-c-proflib		compat,debuglib
@@ -1137,6 +1141,7 @@
 ./usr/libdata/debug/usr/lib/i386/libstdc++.so.7.0.debug	comp-compat-shlib	gcc=4,compat,pic,debug
 ./usr/libdata/debug/usr/lib/i386/libstdc++.so.7.1.debug	comp-compat-shlib	gcc=45,compat,pic,debug
 ./usr/libdata/debug/usr/lib/i386/libterminfo.so.1.0.debug	comp-compat-shlib	compat,pic,debug
+./usr/libdata/debug/usr/lib/i386/libtre.so.0.8.debug	comp-compat-shlib	compat,pic,debug
 ./usr/libdata/debug/usr/lib/i386/libukfs.so.1.0.debug	comp-compat-shlib	compat,pic,debug
 ./usr/libdata/debug/usr/lib/i386/libusbhid.so.1.0.debug	comp-compat-shlib	compat,pic,debug
 ./usr/libdata/debug/usr/lib/i386/libutil.so.7.19.debug	comp-compat-shlib	compat,pic,debug
--- a/distrib/sets/lists/comp/md.sparc64	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/comp/md.sparc64	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.128 2011/10/17 14:20:54 chs Exp $
+# $NetBSD: md.sparc64,v 1.128.2.1 2011/11/10 14:31:12 yamt Exp $
 ./usr/include/gcc-4.5/tgmath.h			comp-c-include		gcccmds,gcc=45
 ./usr/include/ieeefp.h				comp-c-include
 ./usr/include/sparc				comp-c-include
@@ -814,6 +814,11 @@
 ./usr/lib/sparc/libtermlib_g.a			obsolete		compat,obsolete
 ./usr/lib/sparc/libtermlib_p.a			comp-c-proflib		compat,profile
 ./usr/lib/sparc/libtermlib_pic.a		comp-c-piclib		compat,pic
+./usr/lib/sparc/libtre.a			comp-c-lib		compat
+./usr/lib/sparc/libtre.so			base-sys-shlib		compat,pic
+./usr/lib/sparc/libtre_g.a			obsolete		compat,obsolete
+./usr/lib/sparc/libtre_p.a			comp-c-proflib		compat,profile
+./usr/lib/sparc/libtre_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/sparc/libukfs.a			comp-c-lib		compat
 ./usr/lib/sparc/libukfs.so			base-sys-shlib		compat,pic
 ./usr/lib/sparc/libukfs_g.a			-unknown-		compat,debuglib
@@ -984,6 +989,7 @@
 ./usr/libdata/debug/usr/lib/sparc/libstdc++.so.7.0.debug		comp-compat-shlib	gcc=4,compat,pic,debug
 ./usr/libdata/debug/usr/lib/sparc/libstdc++.so.7.1.debug		comp-compat-shlib	gcc=45,compat,pic,debug
 ./usr/libdata/debug/usr/lib/sparc/libterminfo.so.1.0.debug		comp-compat-shlib	compat,pic,debug
+./usr/libdata/debug/usr/lib/sparc/libtre.so.0.8.debug			comp-compat-shlib	compat,pic,debug
 ./usr/libdata/debug/usr/lib/sparc/libukfs.so.1.0.debug			comp-compat-shlib	compat,pic,debug
 ./usr/libdata/debug/usr/lib/sparc/libusbhid.so.1.0.debug		comp-compat-shlib	compat,pic,debug
 ./usr/libdata/debug/usr/lib/sparc/libutil.so.7.19.debug			comp-compat-shlib	compat,pic,debug
--- a/distrib/sets/lists/comp/mi	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/comp/mi	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1702.2.1 2011/11/02 21:53:56 yamt Exp $
+#	$NetBSD: mi,v 1.1702.2.2 2011/11/10 14:31:12 yamt Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3292,6 +3292,8 @@
 ./usr/lib/libterminfo_p.a			comp-c-proflib		profile
 ./usr/lib/libtermlib.a				comp-c-lib
 ./usr/lib/libtermlib_p.a			comp-c-proflib		profile
+./usr/lib/libtre.a				comp-c-lib
+./usr/lib/libtre_p.a				comp-c-proflib		profile
 ./usr/lib/libukfs.a				comp-c-lib
 ./usr/lib/libukfs_g.a				-unknown-		debuglib
 ./usr/lib/libukfs_p.a				comp-c-proflib		profile
@@ -3491,6 +3493,7 @@
 ./usr/libdata/debug/sbin/zpool.debug		comp-zfs-debug		zfs,debug
 ./usr/libdata/debug/usr/bin/addftinfo.debug	comp-groff-debug	groff,debug
 ./usr/libdata/debug/usr/bin/addr2line.debug	comp-debug-debug	binutils,debug
+./usr/libdata/debug/usr/bin/agrep.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/apply.debug		comp-util-debug		debug
 ./usr/libdata/debug/usr/bin/apropos.debug	comp-man-debug		debug
 ./usr/libdata/debug/usr/bin/ar.debug		comp-util-debug		binutils,debug
@@ -4403,6 +4406,7 @@
 ./usr/libdata/lint/llib-ltelnet.ln		comp-obsolete		obsolete
 ./usr/libdata/lint/llib-ltermcap.ln		comp-obsolete		obsolete
 ./usr/libdata/lint/llib-lterminfo.ln		comp-c-lintlib		lint
+./usr/libdata/lint/llib-ltre.ln			comp-c-lintlib		lint
 ./usr/libdata/lint/llib-lukfs.ln		comp-c-lintlib		lint
 ./usr/libdata/lint/llib-lusb.ln			comp-obsolete		obsolete
 ./usr/libdata/lint/llib-lusbhid.ln		comp-c-lintlib		lint
--- a/distrib/sets/lists/comp/shl.mi	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/comp/shl.mi	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.198 2011/10/17 14:20:56 chs Exp $
+# $NetBSD: shl.mi,v 1.198.2.1 2011/11/10 14:31:14 yamt Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -205,6 +205,7 @@
 ./usr/lib/libtermcap_pic.a			comp-c-piclib
 ./usr/lib/libterminfo_pic.a			comp-c-piclib
 ./usr/lib/libtermlib_pic.a			comp-c-piclib
+./usr/lib/libtre_pic.a				comp-c-piclib
 ./usr/lib/libukfs_pic.a				comp-c-piclib
 ./usr/lib/libumem_pic.a				comp-zfs-piclib		zfs
 ./usr/lib/libusbhid_pic.a			comp-c-piclib
@@ -409,6 +410,7 @@
 ./usr/libdata/debug/usr/lib/libstdc++.so.7.0.debug	comp-sys-debug	gcc=4,cxx,debug
 ./usr/libdata/debug/usr/lib/libstdc++.so.7.1.debug	comp-sys-debug	gcc=45,cxx,debug
 ./usr/libdata/debug/usr/lib/libterminfo.so.1.0.debug	comp-sys-debug	debug
+./usr/libdata/debug/usr/lib/libtre.so.0.8.debug		comp-sys-debug	debug
 ./usr/libdata/debug/usr/lib/libukfs.so.1.0.debug	comp-sys-debug	debug
 ./usr/libdata/debug/usr/lib/libumem.so.0.0.debug	comp-zfs-debug	zfs,dynamicroot,debug
 ./usr/libdata/debug/usr/lib/libusbhid.so.1.0.debug	comp-sys-debug	debug
--- a/distrib/sets/lists/man/mi	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/man/mi	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1351 2011/10/27 22:12:24 rkujawa Exp $
+# $NetBSD: mi,v 1.1351.2.1 2011/11/10 14:31:14 yamt Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -41,6 +41,7 @@
 ./usr/share/info/vi.info			man-sys-info		doc,info
 ./usr/share/man/cat1/Mail.0			man-mail-catman		.cat
 ./usr/share/man/cat1/[.0			man-util-catman		.cat
+./usr/share/man/cat1/agrep.0			man-util-catman		.cat
 ./usr/share/man/cat1/alias.0			man-util-catman		.cat
 ./usr/share/man/cat1/altqstat.0			man-router-catman	.cat
 ./usr/share/man/cat1/amq.0			man-obsolete		obsolete
@@ -1786,6 +1787,7 @@
 ./usr/share/man/cat4/video.0			man-sys-catman		.cat
 ./usr/share/man/cat4/vinum.0			man-obsolete		obsolete
 ./usr/share/man/cat4/virt.0			man-sys-catman		.cat
+./usr/share/man/cat4/virtio.0			man-sys-catman		.cat
 ./usr/share/man/cat4/vlan.0			man-sys-catman		.cat
 ./usr/share/man/cat4/vmmon.0			man-sys-catman		.cat
 ./usr/share/man/cat4/vmnet.0			man-sys-catman		.cat
@@ -2961,6 +2963,7 @@
 ./usr/share/man/cat9/boot.0			man-obsolete		obsolete
 ./usr/share/man/html1/Mail.html			man-mail-htmlman	html
 ./usr/share/man/html1/[.html			man-util-htmlman	html
+./usr/share/man/html1/agrep.html		man-util-htmlman	html
 ./usr/share/man/html1/alias.html		man-util-htmlman	html
 ./usr/share/man/html1/altqstat.html		man-router-htmlman	html
 ./usr/share/man/html1/apply.html		man-util-htmlman	html
@@ -4544,6 +4547,7 @@
 ./usr/share/man/html4/viaide.html		man-sys-htmlman		html
 ./usr/share/man/html4/video.html		man-sys-htmlman		html
 ./usr/share/man/html4/virt.html			man-sys-htmlman		html
+./usr/share/man/html4/virtio.html		man-sys-htmlman		html
 ./usr/share/man/html4/vlan.html			man-sys-htmlman		html
 ./usr/share/man/html4/vmmon.html		man-sys-htmlman		html
 ./usr/share/man/html4/vmnet.html		man-sys-htmlman		html
@@ -5492,6 +5496,7 @@
 ./usr/share/man/html8/zzz.html			man-sysutil-htmlman	html
 ./usr/share/man/man1/Mail.1			man-mail-man		.man
 ./usr/share/man/man1/[.1			man-util-man		.man
+./usr/share/man/man1/agrep.1			man-util-man		.man
 ./usr/share/man/man1/alias.1			man-util-man		.man
 ./usr/share/man/man1/altqstat.1			man-router-man		.man
 ./usr/share/man/man1/amq.1			man-obsolete		obsolete
@@ -7237,6 +7242,7 @@
 ./usr/share/man/man4/video.4			man-sys-man		.man
 ./usr/share/man/man4/vinum.4			man-obsolete		obsolete
 ./usr/share/man/man4/virt.4			man-sys-man		.man
+./usr/share/man/man4/virtio.4			man-sys-man		.man
 ./usr/share/man/man4/vlan.4			man-sys-man		.man
 ./usr/share/man/man4/vmmon.4			man-sys-man		.man
 ./usr/share/man/man4/vmnet.4			man-sys-man		.man
--- a/distrib/sets/lists/modules/md.evbppc	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/modules/md.evbppc	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbppc,v 1.13 2011/10/29 11:52:15 mrg Exp $
+# $NetBSD: md.evbppc,v 1.13.2.1 2011/11/10 14:31:15 yamt Exp $
 ./stand/powerpc-4xx							base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@						base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules					base-kernel-modules	kmod,compatmodules
@@ -96,6 +96,10 @@
 ./stand/powerpc-4xx/@OSRELEASE@/modules/nfsserver/nfsserver.kmod	base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/nilfs				base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/nilfs/nilfs.kmod		base-kernel-modules	kmod,compatmodules
+./stand/powerpc-4xx/@OSRELEASE@/modules/npf				base-kernel-modules	kmod,compatmodules
+./stand/powerpc-4xx/@OSRELEASE@/modules/npf/npf.kmod			base-kernel-modules	kmod,compatmodules
+./stand/powerpc-4xx/@OSRELEASE@/modules/npf_alg_icmp			base-kernel-modules	kmod,compatmodules
+./stand/powerpc-4xx/@OSRELEASE@/modules/npf_alg_icmp/npf_alg_icmp.kmod	base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/ntfs				base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/ntfs/ntfs.kmod			base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-4xx/@OSRELEASE@/modules/null				base-kernel-modules	kmod,compatmodules
@@ -259,6 +263,10 @@
 ./stand/powerpc-booke/@OSRELEASE@/modules/nfsserver/nfsserver.kmod	base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/nilfs				base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/nilfs/nilfs.kmod		base-kernel-modules	kmod,compatmodules
+./stand/powerpc-booke/@OSRELEASE@/modules/npf				base-kernel-modules	kmod,compatmodules
+./stand/powerpc-booke/@OSRELEASE@/modules/npf/npf.kmod			base-kernel-modules	kmod,compatmodules
+./stand/powerpc-booke/@OSRELEASE@/modules/npf_alg_icmp			base-kernel-modules	kmod,compatmodules
+./stand/powerpc-booke/@OSRELEASE@/modules/npf_alg_icmp/npf_alg_icmp.kmod	base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/ntfs				base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/ntfs/ntfs.kmod		base-kernel-modules	kmod,compatmodules
 ./stand/powerpc-booke/@OSRELEASE@/modules/null				base-kernel-modules	kmod,compatmodules
--- a/distrib/sets/lists/modules/mi	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/modules/mi	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.34 2011/10/02 12:13:09 mbalmer Exp $
+# $NetBSD: mi,v 1.34.2.1 2011/11/10 14:31:15 yamt Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -103,6 +103,10 @@
 ./@MODULEDIR@/nfsserver/nfsserver.kmod		base-kernel-modules	kmod
 ./@MODULEDIR@/nilfs				base-kernel-modules	kmod
 ./@MODULEDIR@/nilfs/nilfs.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/npf				base-kernel-modules	kmod
+./@MODULEDIR@/npf/npf.kmod			base-kernel-modules	kmod
+./@MODULEDIR@/npf_alg_icmp			base-kernel-modules	kmod
+./@MODULEDIR@/npf_alg_icmp/npf_alg_icmp.kmod	base-kernel-modules	kmod
 ./@MODULEDIR@/ntfs				base-kernel-modules	kmod
 ./@MODULEDIR@/ntfs/ntfs.kmod			base-kernel-modules	kmod
 ./@MODULEDIR@/null				base-kernel-modules	kmod
--- a/distrib/sets/lists/tests/mi	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/sets/lists/tests/mi	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.413 2011/11/01 22:37:42 pgoyette Exp $
+# $NetBSD: mi,v 1.413.2.1 2011/11/10 14:31:15 yamt Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -358,11 +358,13 @@
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_assert.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_basedirname.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_closefrom.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/gen/t_cpuset.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_dir.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fmtcheck.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fpclassify.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fpsetmask.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fpsetround.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/gen/t_ftok.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_fmtcheck.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_getcwd.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_getgrent.debug		tests-lib-debug		debug,atf
@@ -381,6 +383,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_siginfo.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_syslog.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_syslog_pthread.debug	tests-obsolete		obsolete
+./usr/libdata/debug/usr/tests/lib/libc/gen/t_time.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_ttyname.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/gen/t_vis.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/getaddrinfo			tests-obsolete		obsolete
@@ -419,6 +422,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/regex				tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/regex/t_exhaust.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/regex/h_regex.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/regex/h_regex_att.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/rpc				tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/rpc/t_xdr.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/setjmp				tests-lib-debug
@@ -491,6 +495,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_chroot.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_clock_gettime.debug	tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_clone.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_connect.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_context.debug		tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_dup.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_fsync.debug		tests-lib-debug		debug,atf
@@ -505,12 +510,17 @@
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_issetugid.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_kill.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_link.debug			tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_listen.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mincore.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mkdir.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mkfifo.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mknod.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mmap.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_mprotect.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_msgctl.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_msgget.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_msgrcv.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_msgsnd.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_msync.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_nanosleep.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_pipe.debug			tests-lib-debug		debug,atf
@@ -523,6 +533,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_setuid.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_sigaction.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_sigqueue.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_socketpair.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_stat.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_timer_create.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_truncate.debug		tests-lib-debug		debug,atf
@@ -635,6 +646,9 @@
 ./usr/libdata/debug/usr/tests/lib/librumphijack/h_netget.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libskey				tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libskey/t_algorithms.debug		tests-lib-debug		debug,atf,skey
+./usr/libdata/debug/usr/tests/lib/libtre				tests-lib-debug
+./usr/libdata/debug/usr/tests/lib/libtre/h_regex_att.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libtre/t_exhaust.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libutil				tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libutil/t_efun.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libutil/t_parsedate.debug		tests-lib-debug		debug,atf
@@ -676,9 +690,10 @@
 ./usr/libdata/debug/usr/tests/net/net/t_raw.debug		tests-net-debug		debug,atf
 ./usr/libdata/debug/usr/tests/net/net/t_unix.debug		tests-net-debug		debug,atf
 ./usr/libdata/debug/usr/tests/net/sys					tests-net-debug
-./usr/libdata/debug/usr/tests/net/sys/t_connect.debug			tests-net-debug		debug,atf
-./usr/libdata/debug/usr/tests/net/sys/t_listen.debug			tests-net-debug		debug,atf
+./usr/libdata/debug/usr/tests/net/sys/t_connect.debug			tests-obsolete		obsolete
+./usr/libdata/debug/usr/tests/net/sys/t_listen.debug			tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/net/sys/t_rfc6056.debug			tests-net-debug		debug,atf
+./usr/libdata/debug/usr/tests/net/sys/t_socketpair.debug		tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/rump					tests-syscall-debug
 ./usr/libdata/debug/usr/tests/rump/modautoload				tests-syscall-debug
 ./usr/libdata/debug/usr/tests/rump/modautoload/t_modautoload.debug	tests-syscall-debug	debug,atf
@@ -1906,11 +1921,13 @@
 ./usr/tests/lib/libc/gen/t_assert		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_basedirname		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_closefrom		tests-lib-tests		atf
+./usr/tests/lib/libc/gen/t_cpuset		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_dir			tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_fmtcheck		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_fpclassify		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_fpsetmask		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_fpsetround		tests-lib-tests		atf
+./usr/tests/lib/libc/gen/t_ftok			tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_getcwd		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_getgrent		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_glob			tests-lib-tests		atf
@@ -1928,6 +1945,7 @@
 ./usr/tests/lib/libc/gen/t_siginfo		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_syslog		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_syslog_pthread	tests-obsolete		obsolete
+./usr/tests/lib/libc/gen/t_time			tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_ttyname		tests-lib-tests		atf
 ./usr/tests/lib/libc/gen/t_vis			tests-lib-tests		atf
 ./usr/tests/lib/libc/getaddrinfo		tests-obsolete		obsolete
@@ -2013,27 +2031,36 @@
 ./usr/tests/lib/libc/regex/data/README		tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/anchor.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/backref.in	tests-lib-tests		atf
+./usr/tests/lib/libc/regex/data/basic.dat	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/basic.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/bracket.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/c_comments.in	tests-lib-tests		atf
+./usr/tests/lib/libc/regex/data/categorization.dat	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/complex.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/error.in	tests-lib-tests		atf
+./usr/tests/lib/libc/regex/data/forcedassoc.dat	tests-lib-tests		atf
+./usr/tests/lib/libc/regex/data/leftassoc.dat	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/meta.in		tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/nospec.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/nul.in		tests-obsolete		obsolete
+./usr/tests/lib/libc/regex/data/nullsubexpr.dat	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/paren.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/regress.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/repet_bounded.in tests-lib-tests	atf
 ./usr/tests/lib/libc/regex/data/repet_multi.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/repet_ordinary.in tests-lib-tests	atf
+./usr/tests/lib/libc/regex/data/repetition.dat	tests-lib-tests		atf
+./usr/tests/lib/libc/regex/data/rightassoc.dat	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/startend.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/subexp.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/subtle.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/word_bound.in	tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/data/zero.in		tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/h_regex		tests-lib-tests		atf
+./usr/tests/lib/libc/regex/h_regex_att		tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/t_exhaust		tests-lib-tests		atf
 ./usr/tests/lib/libc/regex/t_regex		tests-lib-tests		atf
+./usr/tests/lib/libc/regex/t_regex_att		tests-lib-tests		atf
 ./usr/tests/lib/libc/rpc			tests-lib-tests
 ./usr/tests/lib/libc/rpc/Atffile		tests-lib-tests		atf
 ./usr/tests/lib/libc/rpc/t_xdr			tests-lib-tests		atf
@@ -2116,6 +2143,7 @@
 ./usr/tests/lib/libc/sys/t_chroot		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_clock_gettime	tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_clone		tests-lib-tests		atf
+./usr/tests/lib/libc/sys/t_connect		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_context		tests-obsolete		obsolete
 ./usr/tests/lib/libc/sys/t_dup			tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_fsync		tests-lib-tests		atf
@@ -2130,12 +2158,17 @@
 ./usr/tests/lib/libc/sys/t_issetugid		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_kill			tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_link			tests-lib-tests		atf
+./usr/tests/lib/libc/sys/t_listen		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_mincore		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_mkdir		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_mkfifo		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_mknod		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_mmap			tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_mprotect		tests-lib-tests		atf
+./usr/tests/lib/libc/sys/t_msgctl		tests-lib-tests		atf
+./usr/tests/lib/libc/sys/t_msgget		tests-lib-tests		atf
+./usr/tests/lib/libc/sys/t_msgrcv		tests-lib-tests		atf
+./usr/tests/lib/libc/sys/t_msgsnd		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_msync		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_nanosleep		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_pipe			tests-lib-tests		atf
@@ -2148,6 +2181,7 @@
 ./usr/tests/lib/libc/sys/t_setuid		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_sigaction		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_sigqueue		tests-lib-tests		atf
+./usr/tests/lib/libc/sys/t_socketpair		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_stat			tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_timer_create		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_truncate		tests-lib-tests		atf
@@ -2401,6 +2435,39 @@
 ./usr/tests/lib/libskey				tests-lib-tests		atf
 ./usr/tests/lib/libskey/Atffile			tests-lib-tests		atf,skey
 ./usr/tests/lib/libskey/t_algorithms		tests-lib-tests		atf,skey
+./usr/tests/lib/libtre				tests-lib-tests		atf
+./usr/tests/lib/libtre/Atffile			tests-lib-tests		atf
+./usr/tests/lib/libtre/h_regex_att		tests-lib-tests		atf
+./usr/tests/lib/libtre/t_exhaust		tests-lib-tests		atf
+./usr/tests/lib/libtre/t_regex_att		tests-lib-tests		atf
+./usr/tests/lib/libtre/data			tests-lib-tests		atf
+./usr/tests/lib/libtre/data/README		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/anchor.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/backref.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/basic.dat		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/basic.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/bracket.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/c_comments.in	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/categorization.dat	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/complex.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/error.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/forcedassoc.dat	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/leftassoc.dat	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/meta.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/nospec.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/nullsubexpr.dat	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/paren.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/regress.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/repet_bounded.in	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/repet_multi.in	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/repet_ordinary.in	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/repetition.dat	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/rightassoc.dat	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/startend.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/subexp.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/subtle.in		tests-lib-tests		atf
+./usr/tests/lib/libtre/data/word_bound.in	tests-lib-tests		atf
+./usr/tests/lib/libtre/data/zero.in		tests-lib-tests		atf
 ./usr/tests/lib/libutil				tests-lib-tests		atf
 ./usr/tests/lib/libutil/Atffile			tests-lib-tests		atf
 ./usr/tests/lib/libutil/t_efun			tests-lib-tests		atf
@@ -2476,9 +2543,10 @@
 ./usr/tests/net/route/t_change		tests-net-tests		atf
 ./usr/tests/net/sys				tests-net-tests
 ./usr/tests/net/sys/Atffile			tests-net-tests		atf
-./usr/tests/net/sys/t_connect			tests-net-tests		atf
-./usr/tests/net/sys/t_listen			tests-net-tests		atf
+./usr/tests/net/sys/t_connect			tests-obsolete		obsolete
+./usr/tests/net/sys/t_listen			tests-obsolete		obsolete
 ./usr/tests/net/sys/t_rfc6056			tests-net-tests		atf
+./usr/tests/net/sys/t_socketpair		tests-obsolete		obsolete
 ./usr/tests/rump				tests-rump-tests
 ./usr/tests/rump/Atffile			tests-rump-tests	atf
 ./usr/tests/rump/modautoload			tests-rump-tests
--- a/distrib/utils/sysinst/arch/acorn32/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/acorn32/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.28 2011/09/14 12:35:19 christos Exp $ */
+/*	$NetBSD: md.c,v 1.28.2.1 2011/11/10 14:31:15 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -348,3 +348,9 @@
 
 	return (sum - ((sum - 1) / 255) * 255);
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/alpha/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/alpha/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.50 2011/04/04 08:30:16 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.50.4.1 2011/11/10 14:31:16 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -195,3 +195,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/amiga/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/amiga/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.24 2011/04/04 08:30:18 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.24.4.1 2011/11/10 14:31:16 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -139,3 +139,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/arc/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/arc/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.35 2011/04/04 08:30:19 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.35.4.1 2011/11/10 14:31:16 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -393,3 +393,9 @@
 	bootsize = part[0].mbrp_size;
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/atari/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/atari/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.26 2011/04/04 08:30:19 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.26.4.1 2011/11/10 14:31:16 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -180,3 +180,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/bebox/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/bebox/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.56 2011/08/25 15:42:33 kiyohara Exp $ */
+/*	$NetBSD: md.c,v 1.56.2.1 2011/11/10 14:31:16 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -155,3 +155,9 @@
 {
 	return mbr_use_wholedisk(mbri);
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/cats/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/cats/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.23 2011/04/04 08:30:20 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.23.4.1 2011/11/10 14:31:16 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -200,3 +200,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/cobalt/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/cobalt/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.8 2011/04/04 08:30:21 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.8.4.1 2011/11/10 14:31:16 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -412,3 +412,9 @@
 	bootsize = part[0].mbrp_size;
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/emips/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/emips/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.3 2011/04/04 08:30:22 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.3.4.1 2011/11/10 14:31:17 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -200,3 +200,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/evbarm/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/evbarm/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.24 2011/04/04 08:30:22 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.24.4.1 2011/11/10 14:31:17 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -181,3 +181,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/evbmips/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/evbmips/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: md.c,v 1.8 2011/04/04 08:30:25 mbalmer Exp $ */
+/* $NetBSD: md.c,v 1.8.4.1 2011/11/10 14:31:17 yamt Exp $ */
 
 /*
  * Copyright 1997,2002 Piermont Information Systems Inc.
@@ -158,3 +158,9 @@
 {
 	return mbr_use_wholedisk(mbri);
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/evbppc/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/evbppc/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.31 2011/04/04 08:30:26 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.31.4.1 2011/11/10 14:31:17 yamt Exp $ */
 
 /*
  * Copyright 1997,2002 Piermont Information Systems Inc.
@@ -162,3 +162,9 @@
 {
 	return mbr_use_wholedisk(mbri);
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/evbsh3/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/evbsh3/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.3 2011/04/04 08:30:27 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.3.4.1 2011/11/10 14:31:17 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -186,3 +186,9 @@
 {
 	return 0;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/ews4800mips/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/ews4800mips/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.9 2011/04/04 08:30:27 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.9.4.1 2011/11/10 14:31:17 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -225,3 +225,9 @@
 {
 	return (8 * 1024 * 1024) / 512;	/* 8MB */
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/hp300/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/hp300/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.30 2011/04/04 08:30:28 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.30.4.1 2011/11/10 14:31:17 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -245,3 +245,9 @@
 
 	return i;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/hp700/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/hp700/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.11 2011/04/04 08:30:28 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.11.4.1 2011/11/10 14:31:17 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -200,3 +200,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/hpcarm/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/hpcarm/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.11 2011/06/11 11:43:23 nonaka Exp $ */
+/*	$NetBSD: md.c,v 1.11.2.1 2011/11/10 14:31:18 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -222,3 +222,9 @@
 {
 	return mbr_use_wholedisk(mbri);
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/hpcmips/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/hpcmips/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.47 2011/04/04 08:30:30 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.47.4.1 2011/11/10 14:31:18 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -164,3 +164,9 @@
 {
 	return mbr_use_wholedisk(mbri);
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/hpcsh/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/hpcsh/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.3 2011/04/04 08:30:31 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.3.4.1 2011/11/10 14:31:18 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -171,3 +171,9 @@
 
 	return mbr_use_wholedisk(mbri);
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/i386/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/i386/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.128 2011/04/04 08:30:32 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.128.4.1 2011/11/10 14:31:18 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -631,3 +631,9 @@
 	return SET_KERNEL_GENERIC;
 }
 
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/landisk/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/landisk/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.9 2011/04/04 08:30:33 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.9.4.1 2011/11/10 14:31:18 yamt Exp $	*/
 
 /*
  * Copyright 1997,2002 Piermont Information Systems Inc.
@@ -181,3 +181,9 @@
 	return mbr_use_wholedisk(mbri);
 }
 
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/luna68k/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/luna68k/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.1 2011/07/16 15:52:21 tsutsui Exp $	*/
+/*	$NetBSD: md.c,v 1.1.2.1 2011/11/10 14:31:18 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -196,3 +196,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/mac68k/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/mac68k/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.59 2011/04/04 08:30:34 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.59.4.1 2011/11/10 14:31:18 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1193,3 +1193,9 @@
 	return(yesno);
 }
 #endif /* MD_DEBUG_SORT_MERGE */
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/macppc/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/macppc/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.44 2011/04/04 08:30:34 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.44.4.1 2011/11/10 14:31:19 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -210,3 +210,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/mipsco/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/mipsco/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.18 2011/04/04 08:30:35 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.18.4.1 2011/11/10 14:31:19 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -196,3 +196,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/mvme68k/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/mvme68k/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.25 2011/04/04 08:30:36 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.25.4.1 2011/11/10 14:31:19 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -231,3 +231,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/news68k/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/news68k/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.33 2011/07/16 23:49:10 tsutsui Exp $	*/
+/*	$NetBSD: md.c,v 1.33.2.1 2011/11/10 14:31:19 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -194,3 +194,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/newsmips/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/newsmips/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.20 2011/04/04 08:30:38 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.20.4.1 2011/11/10 14:31:19 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -185,3 +185,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/ofppc/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/ofppc/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.9 2011/08/21 13:40:08 phx Exp $	*/
+/*	$NetBSD: md.c,v 1.9.2.1 2011/11/10 14:31:19 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -542,3 +542,9 @@
 
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/pmax/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/pmax/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.65 2011/04/04 08:30:40 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.65.4.1 2011/11/10 14:31:19 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -205,3 +205,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/prep/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/prep/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.33 2011/04/04 08:30:40 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.33.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -283,3 +283,9 @@
 	return 1;
 }
 
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/sandpoint/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sandpoint/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.36 2011/04/04 08:30:41 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.36.4.1 2011/11/10 14:31:20 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -219,3 +219,9 @@
 {
 	return mbr_use_wholedisk(mbri);
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/sgimips/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sgimips/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.27 2011/04/04 08:30:42 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.27.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -217,3 +217,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/shark/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/shark/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.26 2011/04/04 08:30:42 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.26.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -226,3 +226,9 @@
 	return 0;
 }
 
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/sparc/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sparc/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.50 2011/04/04 08:30:43 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.50.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -193,3 +193,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/sparc64/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sparc64/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.27 2011/04/04 08:30:44 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.27.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -53,6 +53,7 @@
 #include "menu_defs.h"
 
 static void install_bootblocks(void);
+static void install_ofwboot(void);
 
 void
 md_init(void)
@@ -145,6 +146,7 @@
 int
 md_post_disklabel(void)
 {
+	install_bootblocks();
 	return 0;
 }
 
@@ -156,7 +158,7 @@
 int
 md_post_newfs(void)
 {
-	install_bootblocks();
+	install_ofwboot();
 	return 0;
 }
 
@@ -192,8 +194,26 @@
 static void
 install_bootblocks(void)
 {
-	/* Install boot blocks now that we have a full system ... */
+	/* Install boot blocks before mounting the target disk */
 	msg_display(MSG_dobootblks, diskdev);
 	run_program(RUN_DISPLAY, "/sbin/disklabel -W %s", diskdev);
-	run_program(RUN_DISPLAY, "/usr/mdec/binstall ffs %s", targetroot_mnt);
+	run_program(RUN_DISPLAY, "/usr/sbin/installboot /dev/r%sc"
+	    " /usr/mdec/bootblk", diskdev);
 }
+
+/* install/update secondary bootstrap */
+static void
+install_ofwboot(void)
+{
+	/* copy secondary bootstrap now that the target is mounted */
+	msg_display(MSG_doofwboot, targetroot_mnt);
+	run_program(RUN_DISPLAY, "/bin/cp -p /usr/mdec/ofwboot %s",
+	    targetroot_mnt);
+}
+
+int
+md_pre_mount()
+{
+	install_bootblocks();
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/sparc64/msg.md.de	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sparc64/msg.md.de	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.de,v 1.8 2011/04/04 08:30:44 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.de,v 1.8.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -49,6 +49,10 @@
 {Installiere die Bootblöcke auf %s ...
 }
 
+message doofwboot
+{Installiere /ofwboot auf %s ...
+}
+
 message set_kernel_1
 {Kernel (GENERIC)}
 message set_kernel_2
--- a/distrib/utils/sysinst/arch/sparc64/msg.md.en	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sparc64/msg.md.en	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.en,v 1.10 2011/04/04 08:30:44 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.en,v 1.10.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -48,6 +48,10 @@
 {Installing boot blocks on %s....
 }
 
+message doofwboot
+{Installing /ofwboot on %s....
+}
+
 message set_kernel_1
 {Kernel (GENERIC)}
 message set_kernel_2
--- a/distrib/utils/sysinst/arch/sparc64/msg.md.es	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sparc64/msg.md.es	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.es,v 1.8 2011/04/04 08:30:44 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.es,v 1.8.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -48,6 +48,10 @@
 {Instalando bloques de arranque en %s....
 }
 
+message doofwboot
+{Instalando /ofwboot en %s....
+}
+
 message set_kernel_1
 {Núcleo (GENERIC)}
 message set_kernel_2
--- a/distrib/utils/sysinst/arch/sparc64/msg.md.fr	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sparc64/msg.md.fr	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.fr,v 1.11 2011/04/04 08:30:44 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.fr,v 1.11.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -48,6 +48,10 @@
 {Installation des blocs de démarrage sur %s ...
 }
 
+message doofwboot
+{Installation des /ofwboot sur %s ...
+}
+
 message set_kernel_1
 {Kernel (GENERIC)}
 message set_kernel_2
--- a/distrib/utils/sysinst/arch/sparc64/msg.md.pl	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/sparc64/msg.md.pl	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.md.pl,v 1.9 2011/04/04 08:30:44 mbalmer Exp $	*/
+/*	$NetBSD: msg.md.pl,v 1.9.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 /* Based on english version: */
 /*	NetBSD: msg.md.en,v 1.2 2002/12/03 01:54:49 minoura Exp */
 
@@ -50,6 +50,10 @@
 {Instalowanie bootblokow na %s....
 }
 
+message doofwboot
+{Instalowanie /ofwboot na %s....
+}
+
 message set_kernel_1
 {Kernel (GENERIC)}
 message set_kernel_2
--- a/distrib/utils/sysinst/arch/vax/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/vax/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.36 2011/04/04 08:30:44 mbalmer Exp $	*/
+/*	$NetBSD: md.c,v 1.36.4.1 2011/11/10 14:31:20 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -189,3 +189,9 @@
 	md_post_newfs();
 	return 1;
 }
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/x68k/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/x68k/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.40 2011/04/04 08:30:45 mbalmer Exp $ */
+/*	$NetBSD: md.c,v 1.40.4.1 2011/11/10 14:31:21 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -327,3 +327,9 @@
 	    "/usr/mdec/newdisk -v %s", diskdev);
 }
 
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/arch/zaurus/md.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/arch/zaurus/md.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.8 2011/06/11 11:43:23 nonaka Exp $	*/
+/*	$NetBSD: md.c,v 1.8.2.1 2011/11/10 14:31:21 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -189,3 +189,9 @@
 	return mbr_use_wholedisk(mbri);
 }
 
+
+int
+md_pre_mount()
+{
+	return 0;
+}
--- a/distrib/utils/sysinst/defs.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/defs.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.154 2011/06/30 20:09:15 wiz Exp $	*/
+/*	$NetBSD: defs.h,v 1.154.2.1 2011/11/10 14:31:15 yamt Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -326,6 +326,7 @@
 int	md_check_partitions(void);
 int	md_pre_disklabel(void);
 int	md_post_disklabel(void);
+int	md_pre_mount(void);
 int	md_post_newfs(void);
 int	md_post_extract(void);
 void	md_cleanup_install(void);
--- a/distrib/utils/sysinst/disks.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/distrib/utils/sysinst/disks.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.116 2011/08/21 15:06:41 phx Exp $ */
+/*	$NetBSD: disks.c,v 1.116.2.1 2011/11/10 14:31:15 yamt Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -628,6 +628,8 @@
 		if (error != 0)
 			return error;
 
+		md_pre_mount();
+
 		if (lbl->pi_flags & PIF_MOUNT && mnt_opts != NULL) {
 			make_target_dir(lbl->pi_mount);
 			error = target_mount(mnt_opts, diskdev, ptn,
@@ -919,6 +921,8 @@
 	if (error != 0)
 		return error;
 
+	md_pre_mount();
+
 	/* Mount /dev/<diskdev>a on target's "".
 	 * If we pass "" as mount-on, Prefixing will DTRT.
 	 * for now, use no options.
--- a/doc/3RDPARTY	Sun Nov 06 22:05:00 2011 +0000
+++ b/doc/3RDPARTY	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.884 2011/11/02 05:24:12 apb Exp $
+#	$NetBSD: 3RDPARTY,v 1.884.2.1 2011/11/10 14:31:21 yamt Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -357,14 +357,14 @@
 		gcc/testsuite/gnat.dg
 
 Package:	gdb
-Version:	6.5
-Current Vers:	7.2
+Version:	6.5/7.3.1
+Current Vers:	7.3.1
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/gdb/
 Home Page:	http://www.gnu.org/software/gdb/
 Mailing List:	bug-gdb@gnu.org
-Responsible:	thorpej
-License:	GPLv2, LGPLv2
+Responsible:	christos
+License:	GPLv3, LGPLv3.1
 Notes:
 When updating GDB, it is imperative to test that:
 	- Debugging of kernel cores ("target kvm") works correctly
@@ -410,7 +410,8 @@
 for the import.
 A non-gnu grep was imported into src/usr.bin/grep on 2 Jan 2004. It
 needs some tuning before it can replace gnu grep.
-	(cf.	http://www.vocito.com/downloads/software/grep/)
+	(cf.	https://github.com/howardjp/freegrep
+		http://www.monkey.org/openbsd/archive/tech/0306/msg00129.html)
 
 Package:	groff
 Version:	1.19.2
@@ -903,8 +904,8 @@
 and more.
 
 Package:	postfix
-Version:	2.8.6
-Current Vers:	2.8.6
+Version:	2.8.7
+Current Vers:	2.8.7
 Maintainer:	Wietse Venema <wietse@porcupine.org>
 Archive Site:	ftp://postfix.cloud9.net/official/
 Home Page:	http://www.postfix.org/
@@ -1234,3 +1235,15 @@
 Responsible:	mrg
 License:	LGPL3
 Notes:
+
+Package:	tre
+Version:	0.8.0
+Current Vers:	0.8.0
+Maintainer:	http://laurikari.net/tre
+Archive Site:	http://laurikari.net/tre
+Home Page:	http://laurikari.net/tre
+Mailing List:	http://laurikari.net/mailman/listinfo/tre-general
+Responsible:	agc, christos
+License:	BSD
+Notes:
+		Need to feed back local changes
--- a/doc/BRANCHES	Sun Nov 06 22:05:00 2011 +0000
+++ b/doc/BRANCHES	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: BRANCHES,v 1.310 2011/09/20 00:29:57 jym Exp $
+#	$NetBSD: BRANCHES,v 1.310.2.1 2011/11/10 14:31:21 yamt Exp $
 #
 # This file contains a list of branches that exist in the NetBSD CVS
 # tree and their current state.
@@ -588,6 +588,23 @@
 Scope:		src/sys  (src/common is tagged but not branched)
 Notes:		
 
+Branch:		yamt-pagecache
+Description:	page cache related changes
+Status:		Active
+Start Date:	Wed Nov 2 2011
+End Date:	
+Base Tag:	yamt-pagecache-base
+Maintainer:	YAMAMOTO Takashi <yamt@NetBSD.org>
+Scope:		src
+Notes:		- maintain object pages in radix tree rather than rb tree.
+		- reduce unnecessary page scan in putpages.  esp. when an
+		  object has a ton of pages cached but only a few of them
+		  are dirty.
+		- reduce the number of pmap operations by tracking page
+		  dirtiness more  precisely in uvm layer.
+		- fix nfs commit range tracking.
+		- fix nfs write clustering.  XXX hack
+
 Branch:		reinoud-bufcleanup
 Description:	implement and evaluate struct buf usage cleanup strategies.
 		Ideas currently in mind (preference for b):
--- a/doc/CHANGES	Sun Nov 06 22:05:00 2011 +0000
+++ b/doc/CHANGES	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1621 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1621.2.1 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -1152,3 +1152,13 @@
 	efa(4): Add driver for ELBOX FastATA 1200. [rkujawa 20111028]
 	postfix(1): Import version 2.8.6 [tron 20111028]
 	zoneinfo: Import tzdata2011n. [apb 20111102]
+	tre: Incorporate library. Adds agrep. This library provides
+		regcomp/regexec/regerror/regfree as a binary compatible
+		regex library with libc. Using -ltre will use the tre
+		regex functions. The library also has support for
+		approximate regex as well as wide char versions of
+		the regex functions. To access these we are going to
+		need to either add tre.h in /usr/include, or enhance
+		regex.h and provide more tre_ -> libc names aliases.
+		[christos 20111105]
+	postfix(1): Import version 2.8.7 [tron 20111109]
--- a/doc/HACKS	Sun Nov 06 22:05:00 2011 +0000
+++ b/doc/HACKS	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.120 2011/10/29 20:59:30 christos Exp $
+# $NetBSD: HACKS,v 1.120.2.1 2011/11/10 14:31:21 yamt Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -280,6 +280,17 @@
 	-fno-strict-aliasing.
 kcah
 
+hack	emacs aborting on exit (libgcc issue)
+mdate	7 November 2011
+who	christos
+file	external/gpl3/gcc/dist/gcc/unwind-dw2-fde.c : 1.2
+descr
+	GCC 4.5.3 now calls __unregister_frame_info_bases() on unloading/exit
+	to do just that. If the symbol requested is not found, then it aborts.
+	emacs 23.3 triggers this assertion. For now disable aborting, and
+	silently ignore.
+kcah
+
 hack	cross-building hack on Darwin
 mdate	20 July 2008
 who	agc
--- a/etc/MAKEDEV.tmpl	Sun Nov 06 22:05:00 2011 +0000
+++ b/etc/MAKEDEV.tmpl	Thu Nov 10 14:31:09 2011 +0000
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.145 2011/10/26 09:02:20 apb Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.145.2.1 2011/11/10 14:31:21 yamt Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -382,7 +382,7 @@
 	local junk
 	case "$flags" in
 	"-1")	junk="$( "$@" )" ;;
-	"-2")	exec 4>&1 ; junk="$( { "$@" ; } 2>&1 1>&4 )" ; exec 4>&- ;;
+	"-2")	( exec 4>&1 ; junk="$( { "$@" ; } 2>&1 1>&4 )" ) ;;
 	"-12")	junk="$( { "$@" ; } 2>&1 )" ;;
 	*)	warn "Incorrect use of nooutput" ;;
 	esac
--- a/etc/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/etc/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.392 2011/08/22 18:54:05 jym Exp $
+#	$NetBSD: Makefile,v 1.392.2.1 2011/11/10 14:31:21 yamt Exp $
 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -189,11 +189,11 @@
 		MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
 		MKBFD MKBINUTILS MKCATPAGES \
 		MKCRYPTO MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKCVS \
-		MKDEBUG MKDEBUGLIB MKDOC MKDYNAMICROOT \
+		MKDEBUG MKDEBUGLIB MKDOC MKDTRACE MKDYNAMICROOT \
 		MKGCC MKGCCCMDS MKGDB \
-		MKHESIOD MKHOSTOBJ MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
+		MKHESIOD MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
 		MKKERBEROS MKLDAP MKLINKLIB MKLINT \
-		MKMAN MKMANZ MKMDNS MKNLS MKNPF MKNVI MKOBJ MKOBJDIRS \
+		MKMAN MKMANZ MKMDNS MKNLS MKNPF MKOBJ MKOBJDIRS \
 		MKPAM MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
 		MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
 		MKUNPRIVED MKUPDATE MKX11 MKYP \
--- a/etc/mtree/NetBSD.dist.tests	Sun Nov 06 22:05:00 2011 +0000
+++ b/etc/mtree/NetBSD.dist.tests	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.53 2011/09/19 05:25:50 jruoho Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.53.2.1 2011/11/10 14:31:22 yamt Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -85,6 +85,7 @@
 ./usr/libdata/debug/usr/tests/lib/librumpclient
 ./usr/libdata/debug/usr/tests/lib/librumphijack
 ./usr/libdata/debug/usr/tests/lib/libskey
+./usr/libdata/debug/usr/tests/lib/libtre
 ./usr/libdata/debug/usr/tests/lib/libutil
 ./usr/libdata/debug/usr/tests/libexec
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so
@@ -210,6 +211,8 @@
 ./usr/tests/lib/librumpclient
 ./usr/tests/lib/librumphijack
 ./usr/tests/lib/libskey
+./usr/tests/lib/libtre
+./usr/tests/lib/libtre/data
 ./usr/tests/lib/libutil
 ./usr/tests/libexec
 ./usr/tests/libexec/ld.elf_so
--- a/external/bsd/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.30 2011/07/03 21:58:33 tron Exp $
+#	$NetBSD: Makefile,v 1.30.2.1 2011/11/10 14:31:22 yamt Exp $
 
 .include <bsd.own.mk>
 
 SUBDIR=	acpica am-utils bind cron dhcpcd fetch file flex less libarchive \
 	libevent liblzf libpcap mdocml openresolv top byacc wpa ntp tcpdump \
-	tmux
+	tmux tre
 
 .if (${MKATF} != "no")
 SUBDIR+= atf
--- a/external/bsd/atf/dist/atf-c/tc.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/atf/dist/atf-c/tc.c	Thu Nov 10 14:31:09 2011 +0000
@@ -29,6 +29,7 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/uio.h>
 
 #include <errno.h>
 #include <fcntl.h>
@@ -156,30 +157,40 @@
 write_resfile(const int fd, const char *result, const int arg,
               const atf_dynstr_t *reason)
 {
-    char buffer[1024];
-    int ret;
+    static char NL[] = "\n", CS[] = ": ";
+    char buf[64];
+    const char *r;
+    struct iovec iov[5];
+    ssize_t ret;
+    int count = 0;
+
+    INV(arg == -1 || reason != NULL);
+
+    iov[count].iov_base = __UNCONST(result);
+    iov[count++].iov_len = strlen(result);
 
-    if (arg == -1 && reason == NULL) {
-        if (snprintf(buffer, sizeof(buffer), "%s\n", result) <= 0)
-            goto err;
-    } else if (arg == -1 && reason != NULL) {
-        if (snprintf(buffer, sizeof(buffer), "%s: %s\n", result,
-                     atf_dynstr_cstring(reason)) <= 0)
-            goto err;
-    } else if (arg != -1 && reason != NULL) {
-        if (snprintf(buffer, sizeof(buffer), "%s(%d): %s\n", result,
-                     arg, atf_dynstr_cstring(reason)) <= 0)
-            goto err;
-    } else {
-        UNREACHABLE;
+    if (reason != NULL) {
+	if (arg != -1) {
+	    iov[count].iov_base = buf;
+	    iov[count++].iov_len = snprintf(buf, sizeof(buf), "(%d)", arg);
+	}
+
+	iov[count].iov_base = CS;
+	iov[count++].iov_len = sizeof(CS) - 1;
+
+	r = atf_dynstr_cstring(reason);
+	iov[count].iov_base = __UNCONST(r);
+	iov[count++].iov_len = strlen(r);
     }
 
-    while ((ret = write(fd, buffer, strlen(buffer))) == -1 && errno == EINTR)
-        ; /* Retry. */
+    iov[count].iov_base = NL;
+    iov[count++].iov_len = sizeof(NL) - 1;
+
+    while ((ret = writev(fd, iov, count)) == -1 && errno == EINTR)
+        continue; /* Retry. */
     if (ret != -1)
         return atf_no_error();
 
-err:
     return atf_libc_error(
         errno, "Failed to write results file; result %s, reason %s", result,
         reason == NULL ? "null" : atf_dynstr_cstring(reason));
--- a/external/bsd/iscsi/dist/src/lib/libiscsi.3	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/iscsi/dist/src/lib/libiscsi.3	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: libiscsi.3,v 1.4 2011/02/20 03:56:36 agc Exp $
+.\" $NetBSD: libiscsi.3,v 1.4.4.1 2011/11/10 14:31:22 yamt Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -64,7 +64,6 @@
 .Ft char *
 .Fo iscsi_target_getvar
 .Fa "iscsi_target_t *target" "const char *name"
-.Fa "iscsi_target_t *target"
 .Fc
 .Ft int
 .Fo iscsi_initiator_set_defaults
@@ -159,5 +158,5 @@
 iSCSI subsystem
 first appeared in
 .Nx 6.0 .
-.Sh AUTHOR
+.Sh AUTHORS
 .An Alistair Crooks Aq agc@NetBSD.org .
--- a/external/bsd/iscsi/dist/src/lib/md5hl.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/iscsi/dist/src/lib/md5hl.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: md5hl.c,v 1.2 2009/06/30 02:44:52 agc Exp $	*/
+/*	$NetBSD: md5hl.c,v 1.2.6.1 2011/11/10 14:31:22 yamt Exp $	*/
 
 /*
  * Written by Jason R. Thorpe <thorpej@netbsd.org>, April 29, 1997.
@@ -18,7 +18,7 @@
 #define _DIAGASSERT(cond)	assert(cond)
 #endif
 
-/*	$NetBSD: md5hl.c,v 1.2 2009/06/30 02:44:52 agc Exp $	*/
+/*	$NetBSD: md5hl.c,v 1.2.6.1 2011/11/10 14:31:22 yamt Exp $	*/
 
 /*
  * ----------------------------------------------------------------------------
@@ -84,7 +84,7 @@
 	unsigned char buffer[BUFSIZ];
 	MDNAME(_CTX) ctx;
 	int f, j;
-	size_t i;
+	ssize_t i;
 
 	_DIAGASSERT(filename != 0);
 	/* buf may be NULL */
--- a/external/bsd/llvm/Makefile.inc	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/Makefile.inc	Thu Nov 10 14:31:09 2011 +0000
@@ -1,19 +1,20 @@
-#	$NetBSD: Makefile.inc,v 1.23 2011/10/11 13:53:57 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.23.2.1 2011/11/10 14:31:22 yamt Exp $
 
 .if !defined(LLVM_TOPLEVEL_MK)
 LLVM_TOPLEVEL_MK=
 
 .include <bsd.own.mk>
 
-LLVM_REVISION=	141658
-CLANG_REVISION=	141658 
+LLVM_REVISION=	143571
+CLANG_REVISION=	143571
 
 LLVM_SRCDIR:=	${.PARSEDIR}/dist/llvm
 CLANG_SRCDIR:=	${.PARSEDIR}/dist/clang
 LLVM_TOPLEVEL:=	${.PARSEDIR}
 
 CPPFLAGS+=	-I. -I${LLVM_SRCDIR}/include -I${CLANG_SRCDIR}/include \
-		-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
+		-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS \
+		-D__STDC_FORMAT_MACROS
 
 .if defined(HOSTLIB) || defined(HOSTPROG)
 LLVM_INCLUDE_CONFIG=	${LLVM_TOOLCONF_OBJDIR}/config/include
--- a/external/bsd/llvm/bin/clang/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/bin/clang/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2011/08/09 12:30:47 joerg Exp $
+#	$NetBSD: Makefile,v 1.15.2.1 2011/11/10 14:31:22 yamt Exp $
 
 PROG_CXX=	clang
 NOMAN=		yes
@@ -73,6 +73,7 @@
 	MCDisassembler \
 	MCParser \
 	MC \
+	Linker \
 	TransformsUtils \
 	ipa \
 	Core \
--- a/external/bsd/llvm/config/llvm/Config/config.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/config/llvm/Config/config.h	Thu Nov 10 14:31:09 2011 +0000
@@ -539,19 +539,22 @@
 #define LLVM_BINDIR "/usr/bin"
 
 /* Time at which LLVM was configured */
-#define LLVM_CONFIGTIME "Mon Jul 25 15:20:40 CEST 2011"
+#define LLVM_CONFIGTIME "Thu Nov  3 00:22:51 CET 2011"
 
 /* Installation directory for data files */
 #define LLVM_DATADIR "/usr/share/llvm"
 
+/* Target triple LLVM will generate code for by default */
+#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64--netbsd"
+
 /* Installation directory for documentation */
 #define LLVM_DOCSDIR "/usr/share/doc/llvm"
 
 /* Installation directory for config files */
 #define LLVM_ETCDIR "/usr/etc/llvm"
 
-/* Host triple we were built on */
-#define LLVM_HOSTTRIPLE "x86_64--netbsd"
+/* Has gcc/MSVC atomic intrinsics */
+#define LLVM_HAS_ATOMICS 1
 
 /* Installation directory for include files */
 #define LLVM_INCLUDEDIR "/usr/include"
@@ -565,9 +568,6 @@
 /* Installation directory for man pages */
 #define LLVM_MANDIR "/usr/man"
 
-/* Build multithreading support into LLVM */
-#define LLVM_MULTITHREADED 1
-
 /* LLVM architecture name for the native architecture, if available */
 #define LLVM_NATIVE_ARCH X86
 
@@ -577,15 +577,15 @@
 /* LLVM name for the native AsmPrinter init function, if available */
 #define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter
 
-/* LLVM name for the native TargetMC init function, if available */
-#define LLVM_NATIVE_TARGETMC LLVMInitializeX86TargetMC
-
 /* LLVM name for the native Target init function, if available */
 #define LLVM_NATIVE_TARGET LLVMInitializeX86Target
 
 /* LLVM name for the native TargetInfo init function, if available */
 #define LLVM_NATIVE_TARGETINFO LLVMInitializeX86TargetInfo
 
+/* LLVM name for the native target MC init function, if available */
+#define LLVM_NATIVE_TARGETMC LLVMInitializeX86TargetMC
+
 /* Define if this is Unixish platform */
 #define LLVM_ON_UNIX 1
 
@@ -653,13 +653,13 @@
 #define PACKAGE_NAME "llvm"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "llvm 3.0svn"
+#define PACKAGE_STRING "llvm 3.1svn"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "-llvm-"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "3.0svn"
+#define PACKAGE_VERSION "3.1svn"
 
 /* Define as the return type of signal handlers (`int' or `void'). */
 #define RETSIGTYPE void
--- a/external/bsd/llvm/config/llvm/Config/llvm-config.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/config/llvm/Config/llvm-config.h	Thu Nov 10 14:31:09 2011 +0000
@@ -21,7 +21,7 @@
 #define LLVM_BINDIR "/usr/bin"
 
 /* Time at which LLVM was configured */
-#define LLVM_CONFIGTIME "Mon Jul 25 15:20:40 CEST 2011"
+#define LLVM_CONFIGTIME "Thu Nov  3 00:22:51 CET 2011"
 
 /* Installation directory for data files */
 #define LLVM_DATADIR "/usr/share/llvm"
@@ -32,8 +32,11 @@
 /* Installation directory for config files */
 #define LLVM_ETCDIR "/usr/etc/llvm"
 
+/* Has gcc/MSVC atomic intrinsics */
+#define LLVM_HAS_ATOMICS 1
+
 /* Host triple we were built on */
-#define LLVM_HOSTTRIPLE "x86_64--netbsd"
+#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64--netbsd"
 
 /* Installation directory for include files */
 #define LLVM_INCLUDEDIR "/usr/include"
@@ -47,27 +50,24 @@
 /* Installation directory for man pages */
 #define LLVM_MANDIR "/usr/man"
 
-/* Build multithreading support into LLVM */
-#define LLVM_MULTITHREADED 1
-
 /* LLVM architecture name for the native architecture, if available */
 #define LLVM_NATIVE_ARCH X86
 
+/* LLVM name for the native AsmParser init function, if available */
+#define LLVM_NATIVE_ASMPARSER LLVMInitializeX86AsmParser
+
+/* LLVM name for the native AsmPrinter init function, if available */
+#define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter
+
 /* LLVM name for the native Target init function, if available */
 #define LLVM_NATIVE_TARGET LLVMInitializeX86Target
 
 /* LLVM name for the native TargetInfo init function, if available */
 #define LLVM_NATIVE_TARGETINFO LLVMInitializeX86TargetInfo
 
-/* LLVM name for the native TargetMC init function, if available */
+/* LLVM name for the native target MC init function, if available */
 #define LLVM_NATIVE_TARGETMC LLVMInitializeX86TargetMC
 
-/* LLVM name for the native AsmPrinter init function, if available */
-#define LLVM_NATIVE_ASMPRINTER LLVMInitializeX86AsmPrinter
-
-/* LLVM name for the native AsmPrinter init function, if available */
-#define LLVM_NATIVE_ASMPARSER LLVMInitializeX86AsmParser
-
 /* Define if this is Unixish platform */
 #define LLVM_ON_UNIX 1
 
@@ -98,6 +98,9 @@
 /* Define to path to twopi program if found or 'echo twopi' otherwise */
 /* #undef LLVM_PATH_TWOPI */
 
+/* Define to path to xdot.py program if found or 'echo xdot.py' otherwise */
+/* #undef LLVM_PATH_XDOT_PY */
+
 /* Installation prefix directory */
 #define LLVM_PREFIX "/usr"
 
--- a/external/bsd/llvm/lib/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.16 2011/10/11 13:53:58 joerg Exp $
+# $NetBSD: Makefile,v 1.16.2.1 2011/11/10 14:31:22 yamt Exp $
 
 .include <bsd.own.mk>
 
@@ -16,6 +16,7 @@
 	libLLVMInstrumentation \
 	libLLVMipa \
 	libLLVMipo \
+	libLLVMLinker \
 	libLLVMMC \
 	libLLVMMCDisassembler \
 	libLLVMMCParser \
@@ -74,7 +75,6 @@
 	libLLVMHello \
 	libLLVMInterpreter \
 	libLLVMJIT \
-	libLLVMLinker \
 	libLLVMMCJIT \
 	libLLVMObject \
 	libLLVMRuntimeDyld
--- a/external/bsd/llvm/lib/libLLVMARMCodeGen/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libLLVMARMCodeGen/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2011/10/11 13:53:58 joerg Exp $
+#	$NetBSD: Makefile,v 1.6.2.1 2011/11/10 14:31:23 yamt Exp $
 
 LIB=	LLVMARMCodeGen
 
@@ -16,7 +16,6 @@
 	ARMExpandPseudoInsts.cpp \
 	ARMFastISel.cpp \
 	ARMFrameLowering.cpp \
-	ARMGlobalMerge.cpp \
 	ARMHazardRecognizer.cpp \
 	ARMISelDAGToDAG.cpp \
 	ARMISelLowering.cpp \
--- a/external/bsd/llvm/lib/libLLVMCodeGen/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libLLVMCodeGen/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2011/10/11 13:53:58 joerg Exp $
+#	$NetBSD: Makefile,v 1.8.2.1 2011/11/10 14:31:23 yamt Exp $
 
 LIB=	LLVMCodeGen
 
@@ -45,6 +45,7 @@
 	MachineBasicBlock.cpp \
 	MachineBranchProbabilityInfo.cpp \
 	MachineBlockFrequencyInfo.cpp \
+	MachineBlockPlacement.cpp \
 	MachineCSE.cpp \
 	MachineDominators.cpp \
 	MachineFunction.cpp \
--- a/external/bsd/llvm/lib/libLLVMLinker/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libLLVMLinker/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2011/02/06 01:13:58 joerg Exp $
+#	$NetBSD: Makefile,v 1.1.6.1 2011/11/10 14:31:23 yamt Exp $
 
 LIB=	LLVMLinker
 
@@ -11,4 +11,8 @@
 	LinkModules.cpp \
 	Linker.cpp
 
+.if defined(HOSTLIB)
+.include <bsd.hostlib.mk>
+.else
 .include <bsd.lib.mk>
+.endif
--- a/external/bsd/llvm/lib/libLLVMMipsCodeGen/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libLLVMMipsCodeGen/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2011/07/25 16:32:44 joerg Exp $
+#	$NetBSD: Makefile,v 1.4.2.1 2011/11/10 14:31:23 yamt Exp $
 
 LIB=	LLVMMipsCodeGen
 
@@ -30,6 +30,7 @@
 	MipsGenRegisterInfo.inc|-gen-register-info \
 	MipsGenInstrInfo.inc|-gen-instr-info \
 	MipsGenAsmWriter.inc|-gen-asm-writer \
+	MipsGenCodeEmitter.inc|-gen-emitter \
 	MipsGenDAGISel.inc|-gen-dag-isel \
 	MipsGenCallingConv.inc|-gen-callingconv \
 	MipsGenSubtargetInfo.inc|-gen-subtarget
--- a/external/bsd/llvm/lib/libLLVMScalarOpts/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libLLVMScalarOpts/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2011/09/01 12:24:36 joerg Exp $
+#	$NetBSD: Makefile,v 1.4.2.1 2011/11/10 14:31:23 yamt Exp $
 
 LIB=	LLVMScalarOpts
 
@@ -14,6 +14,7 @@
 	DCE.cpp \
 	DeadStoreElimination.cpp \
 	EarlyCSE.cpp \
+	GlobalMerge.cpp \
 	GVN.cpp \
 	IndVarSimplify.cpp \
 	JumpThreading.cpp \
--- a/external/bsd/llvm/lib/libLLVMSelectionDAG/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libLLVMSelectionDAG/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2011/02/06 01:14:01 joerg Exp $
+#	$NetBSD: Makefile,v 1.1.6.1 2011/11/10 14:31:23 yamt Exp $
 
 LIB=	LLVMSelectionDAG
 
@@ -18,7 +18,6 @@
 	LegalizeVectorOps.cpp \
 	LegalizeVectorTypes.cpp \
 	ScheduleDAGFast.cpp \
-	ScheduleDAGList.cpp \
 	ScheduleDAGRRList.cpp \
 	ScheduleDAGSDNodes.cpp \
 	SelectionDAG.cpp \
--- a/external/bsd/llvm/lib/libLLVMTransformsUtils/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libLLVMTransformsUtils/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2011/09/01 12:24:36 joerg Exp $
+#	$NetBSD: Makefile,v 1.4.2.1 2011/11/10 14:31:23 yamt Exp $
 
 LIB=	LLVMTransformsUtils
 
@@ -25,6 +25,7 @@
 	LowerInvoke.cpp \
 	LowerSwitch.cpp \
 	Mem2Reg.cpp \
+	ModuleUtils.cpp \
 	PromoteMemoryToRegister.cpp \
 	SSAUpdater.cpp \
 	SimplifyCFG.cpp \
--- a/external/bsd/llvm/lib/libclangAnalysis/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libclangAnalysis/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2011/10/11 13:54:00 joerg Exp $
+#	$NetBSD: Makefile,v 1.4.2.1 2011/11/10 14:31:23 yamt Exp $
 
 LIB=	clangAnalysis
 
@@ -6,13 +6,15 @@
 
 .PATH: ${CLANG_SRCDIR}/lib/Analysis
 
-SRCS+=	AnalysisContext.cpp \
+SRCS+=	AnalysisDeclContext.cpp \
 	CFG.cpp \
 	CFGReachabilityAnalysis.cpp \
 	CFGStmtMap.cpp \
 	CocoaConventions.cpp \
+	Dominators.cpp \
 	FormatString.cpp \
 	LiveVariables.cpp \
+	PostOrderCFGView.cpp \
 	ProgramPoint.cpp \
 	PrintfFormatString.cpp \
 	PseudoConstantAnalysis.cpp \
--- a/external/bsd/llvm/lib/libclangFrontend/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libclangFrontend/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2011/10/11 13:54:00 joerg Exp $
+#	$NetBSD: Makefile,v 1.6.2.1 2011/11/10 14:31:24 yamt Exp $
 
 LIB=	clangFrontend
 
@@ -24,6 +24,8 @@
 	LogDiagnosticPrinter.cpp \
 	MultiplexConsumer.cpp \
 	PrintPreprocessedOutput.cpp \
+	SerializedDiagnosticPrinter.cpp \
+	TextDiagnostic.cpp \
 	TextDiagnosticBuffer.cpp \
 	TextDiagnosticPrinter.cpp \
 	VerifyDiagnosticConsumer.cpp \
--- a/external/bsd/llvm/lib/libclangSema/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libclangSema/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2011/10/11 13:54:00 joerg Exp $
+#	$NetBSD: Makefile,v 1.5.2.1 2011/11/10 14:31:24 yamt Exp $
 
 LIB=	clangSema
 
@@ -18,8 +18,8 @@
 	Sema.cpp \
 	SemaAccess.cpp \
 	SemaAttr.cpp \
-	SemaCXXCast.cpp \
 	SemaCXXScopeSpec.cpp \
+	SemaCast.cpp \
 	SemaChecking.cpp \
 	SemaCodeComplete.cpp \
 	SemaDecl.cpp \
@@ -36,6 +36,7 @@
 	SemaLookup.cpp \
 	SemaObjCProperty.cpp \
 	SemaOverload.cpp \
+	SemaPseudoObject.cpp \
 	SemaStmt.cpp \
 	SemaTemplate.cpp \
 	SemaTemplateDeduction.cpp \
--- a/external/bsd/llvm/lib/libclangStaticAnalyzerCore/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/llvm/lib/libclangStaticAnalyzerCore/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2011/09/12 13:32:59 joerg Exp $
+#	$NetBSD: Makefile,v 1.5.2.1 2011/11/10 14:31:24 yamt Exp $
 
 LIB=	clangStaticAnalyzerCore
 
@@ -14,7 +14,6 @@
 	BugReporter.cpp \
 	BugReporterVisitors.cpp \
 	Checker.cpp \
-	CheckerContext.cpp \
 	CheckerHelpers.cpp \
 	CheckerManager.cpp \
 	CheckerRegistry.cpp \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tre/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,3 @@
+# $NetBSD: Makefile,v 1.1.2.2 2011/11/10 14:31:24 yamt Exp $
+SUBDIR=	lib .WAIT bin
+.include "bsd.subdir.mk"
--- a/external/bsd/tre/Makefile.inc	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/Makefile.inc	Thu Nov 10 14:31:09 2011 +0000
@@ -1,23 +1,13 @@
-#	$NetBSD: Makefile.inc,v 1.1 2010/09/04 12:17:58 ahoka Exp $
+#	$NetBSD: Makefile.inc,v 1.1.6.1 2011/11/10 14:31:24 yamt Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
 
 # regex sources
 TREDIST= ${NETBSDSRCDIR}/external/bsd/tre/dist
 
-# Add libc/regex for manpages
-.PATH: ${TREDIST}/lib ${NETBSDSRCDIR}/lib/libc/regex
-
-CPPFLAGS+=	-I${TREDIST} -I${TREDIST}/lib
+CPPFLAGS+=	-I${TREDIST}/lib -I${.CURDIR}/../include
 CPPFLAGS+=	-DHAVE_CONFIG_H=1
+CPPFLAGS+=	-DTRE_SYSTEM_REGEX_H_PATH=\"${NETBSDSRCDIR}/include/regex.h\"
+CPPFLAGS+=	-DTRE_USE_SYSTEM_REGEX_H=1
 
-SRCS+=	regcomp.c regerror.c regexec.c
-SRCS+=	tre-ast.c tre-compile.c
-SRCS+=	tre-match-backtrack.c tre-match-parallel.c tre-mem.c
-SRCS+=	tre-parse.c tre-stack.c
 
 WARNS=	4
-
-MAN+=	regex.3 re_format.7
-
-MLINKS+=regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 \
-	regex.3 regfree.3
--- a/external/bsd/tre/agrep/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-#	$NetBSD: Makefile,v 1.1 2010/02/25 08:06:43 agc Exp $
-
-TREDIST=	${.CURDIR}/../dist
-
-.PATH: ${TREDIST}/src
-
-CPPFLAGS+=	-I${TREDIST}/lib -I${.CURDIR}/../libtre
-CPPFLAGS+=	-DHAVE_CONFIG_H=1
-
-PROG=		agrep
-SRCS=		agrep.c
-LDADD+=		-ltre
-
-WARNS=	4
-
-.include <bsd.prog.mk>
--- a/external/bsd/tre/agrep/agrep.1	Sun Nov 06 22:05:00 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-.\" $NetBSD: agrep.1,v 1.3 2010/02/25 13:51:44 wiz Exp $
-.Dd November 21, 2004
-.Dt AGREP 1
-.Os
-.Sh NAME
-.Nm agrep
-.Nd print lines approximately matching a pattern
-.Sh SYNOPSIS
-.Nm
-.Op options
-.Ar pattern
-.Op files
-.Sh DESCRIPTION
-Searches for approximate matches of
-.Ar pattern
-in each
-.Ar FILE
-or standard input.
-.Sh OPTIONS
-.Ss Regexp selection and interpretation
-.Bl -tag -width 10n
-.It Fl e Ar pattern , Fl Fl regexp= Ns Ar pattern
-Use
-.Ar PATTERN
-as a regular expression; useful to protect patterns beginning with
-.Sq - .
-.It Fl i , Fl Fl ignore-case
-Ignore case distinctions (as defined by the current locale) in
-.Ar pattern
-and input files.
-.It Fl k , Fl Fl literal
-Treat
-.Ar pattern
-as a literal string, that is, a fixed string with no special
-characters.
-.It Fl w , Fl Fl word-regexp
-Force
-.Ar pattern
-to match only whole words.
-A
-.Dq whole word
-is a substring which either starts at the beginning
-or the record or is preceded by a non-word constituent character.
-Similarly, the substring must either end at the end of the record
-or be followed by a non-word constituent character.
-Word-constituent characters are alphanumerics (as
-defined by the current locale) and the underscore character.
-Note that the non-word constituent characters
-.Em must
-surround the match; they cannot be counted as errors.
-.El
-.Ss Approximate matching settings
-.Bl -tag -width 10n
-.It Fl D Ar num , Fl Fl delete-cost= Ns Ar num
-Set cost of missing characters to
-.Ar num .
-.It Fl I Ar num , Fl Fl insert-cost= Ns Ar num
-Set cost of extra characters to
-.Ar num .
-.It Fl S Ar num , Fl Fl substitue-cost= Ns Ar num
-Set cost of incorrect characters to
-.Ar num .
-Note that a deletion (a missing character) and an insertion (an extra
-character) together constitute a substituted character, but the cost
-will be the that of a deletion and an insertion added together.
-Thus, if the const of a substitution is set to be larger than the
-sum of the costs of deletion and insertion, direct substitutions
-will never be done.
-.It Fl E num , Fl Fl max-errors= Ns Ar num
-Select records that have at most
-.Ar num
-errors.
-.It Fl Ns Ar #
-Select records that have at most
-.Ar #
-errors
-.Ar ( #
-is a digit between 0 and 9).
-.El
-.Ss Miscellaneous
-.Bl -tag -width 10n
-.It Fl d pattern , Fl Fl delimiter= Ns Ar pattern
-Set the record delimiter regular expression to
-.Ar pattern .
-The text between two delimiters, before the first delimiter, and after
-the last delimiter is considered to be a record.
-The default record
-delimiter is the regexp
-.Dq \en ,
-so by default a record is a line.
-.Ar pattern
-can be any regular expression that does not match the empty string.
-For example, using
-.Fl d Ar \"^From \"
-defines mail messages as records in a Mailbox format file.
-.It Fl v , Fl Fl invert-match
-Select non-matching records instead of matching records.
-.It Fl V , Fl Fl version
-Print version information and exit.
-.It Fl y , Fl Fl nothing
-Does nothing.
-This options exists only for compatibility with the
-non-free agrep program.
-.It Fl Fl help
-Display a brief help message and exit.
-.El
-.Ss Output control
-.Bl -tag -width 10n
-.It Fl B , Fl Fl best-match
-Only output the best matching records, that is, the records with the
-lowest cost.
-This is currently implemented by making two passes over
-the input files and cannot be used when reading from standard input.
-.It Fl Fl color , Fl Fl colour
-Highlight the matching strings in the output with a color marker.
-The color string is taken from the
-.Ev GREP_COLOR
-environment variable.
-The default color is red.
-.It Fl c , Fl Fl count
-Only print a count of matching records per each input file,
-suppressing normal output.
-.It Fl h , Fl Fl no-filename
-Suppress the prefixing filename on output when multiple files are
-searched.
-.It Fl H , Fl Fl with-filename
-Prefix each output record with the name of the input file where the
-record was read from.
-.It Fl l , Fl Fl files-with-matches
-Only print the name of each input file which contains at least one
-match, suppressing normal output.
-The scanning for each file will stop on the first match.
-.It Fl n , Fl Fl record-number
-Prefix each output record with its sequence number in the input file.
-The number of the first record is 1.
-.It Fl q , Fl Fl quiet , Fl Fl silent
-Do not write anything to standard output.
-Exit immediately with zero exit status if a match is found.
-.It Fl s , Fl Fl show-cost
-Print match cost with output.
-.It Fl Fl show-position
-Prefix each output record with the start and end offset of the first
-match within the record.
-The offset of the first character of the record is 0.
-The end position is given as the offset of the first
-character after the match.
-.It Fl M , Fl Fl delimiter-after
-By default, the record delimiter is the newline character and is
-output after the matching record.
-If
-.Fl d
-is used, the record delimiter will be output before the matching
-record.
-This option causes the delimiter to be output after the
-matching record.
-.El
-.Pp
-With no
-.Ar file ,
-or when
-.Ar file
-is
-.Dq - ,
-.Nm
-reads standard input.
-If less than two
-.Ar files
-are given
-.Fl h
-is assumed, otherwise
-.Fl H
-is the default.
-.Sh EXAMPLES
-.Dl agrep \-2 optimize foo.txt
-outputs all lines in file
-.Pa foo.txt
-that match
-.Dq optimize
-within two errors.
-E.g. lines which contain
-.Dq optimise ,
-.Dq optmise ,
-and
-.Dq opitmize
-all match.
-.Sh DIAGNOSTICS
-Exit status is 0 if a match is found, 1 for no match, and 2 if there
-were errors.
-If
-.Fl E
-or
-.Fl Ns Ar #
-is not specified, only exact matches are selected.
-.Pp
-.Ar pattern
-is a POSIX extended regular expression (ERE) with the TRE extensions.
-.Sh REPORTING BUGS
-Report bugs to the TRE mailing list
-.Aq tre-general@lists.laurikari.net .
-.Sh COPYRIGHT
-Copyright \(co 2002-2004 Ville Laurikari.
-.Pp
-This is free software, and comes with ABSOLUTELY NO WARRANTY.
-You are welcome to redistribute this software under certain
-conditions; see the source for the full license text.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tre/bin/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,18 @@
+#	$NetBSD: Makefile,v 1.1.2.2 2011/11/10 14:31:24 yamt Exp $
+
+TREDIST=	${.CURDIR}/../dist
+
+.PATH: ${TREDIST}/src
+
+CPPFLAGS+=	-I${TREDIST}/lib -I${.CURDIR}/../libtre
+CPPFLAGS+=	-DHAVE_CONFIG_H=1
+
+BINDIR=		/usr/bin
+PROG=		agrep
+SRCS=		agrep.c
+LDADD+=		-ltre
+DPADD+=		${LIBTRE}
+
+WARNS=	4
+
+.include <bsd.prog.mk>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tre/bin/agrep.1	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,205 @@
+.\" $NetBSD: agrep.1,v 1.1.2.2 2011/11/10 14:31:24 yamt Exp $
+.Dd November 21, 2004
+.Dt AGREP 1
+.Os
+.Sh NAME
+.Nm agrep
+.Nd print lines approximately matching a pattern
+.Sh SYNOPSIS
+.Nm
+.Op options
+.Ar pattern
+.Op files
+.Sh DESCRIPTION
+Searches for approximate matches of
+.Ar pattern
+in each
+.Ar FILE
+or standard input.
+.Sh OPTIONS
+.Ss Regexp selection and interpretation
+.Bl -tag -width 10n
+.It Fl e Ar pattern , Fl Fl regexp= Ns Ar pattern
+Use
+.Ar PATTERN
+as a regular expression; useful to protect patterns beginning with
+.Sq - .
+.It Fl i , Fl Fl ignore-case
+Ignore case distinctions (as defined by the current locale) in
+.Ar pattern
+and input files.
+.It Fl k , Fl Fl literal
+Treat
+.Ar pattern
+as a literal string, that is, a fixed string with no special
+characters.
+.It Fl w , Fl Fl word-regexp
+Force
+.Ar pattern
+to match only whole words.
+A
+.Dq whole word
+is a substring which either starts at the beginning
+or the record or is preceded by a non-word constituent character.
+Similarly, the substring must either end at the end of the record
+or be followed by a non-word constituent character.
+Word-constituent characters are alphanumerics (as
+defined by the current locale) and the underscore character.
+Note that the non-word constituent characters
+.Em must
+surround the match; they cannot be counted as errors.
+.El
+.Ss Approximate matching settings
+.Bl -tag -width 10n
+.It Fl D Ar num , Fl Fl delete-cost= Ns Ar num
+Set cost of missing characters to
+.Ar num .
+.It Fl I Ar num , Fl Fl insert-cost= Ns Ar num
+Set cost of extra characters to
+.Ar num .
+.It Fl S Ar num , Fl Fl substitue-cost= Ns Ar num
+Set cost of incorrect characters to
+.Ar num .
+Note that a deletion (a missing character) and an insertion (an extra
+character) together constitute a substituted character, but the cost
+will be the that of a deletion and an insertion added together.
+Thus, if the const of a substitution is set to be larger than the
+sum of the costs of deletion and insertion, direct substitutions
+will never be done.
+.It Fl E num , Fl Fl max-errors= Ns Ar num
+Select records that have at most
+.Ar num
+errors.
+.It Fl Ns Ar #
+Select records that have at most
+.Ar #
+errors
+.Ar ( #
+is a digit between 0 and 9).
+.El
+.Ss Miscellaneous
+.Bl -tag -width 10n
+.It Fl d pattern , Fl Fl delimiter= Ns Ar pattern
+Set the record delimiter regular expression to
+.Ar pattern .
+The text between two delimiters, before the first delimiter, and after
+the last delimiter is considered to be a record.
+The default record
+delimiter is the regexp
+.Dq \en ,
+so by default a record is a line.
+.Ar pattern
+can be any regular expression that does not match the empty string.
+For example, using
+.Fl d Ar \"^From \"
+defines mail messages as records in a Mailbox format file.
+.It Fl v , Fl Fl invert-match
+Select non-matching records instead of matching records.
+.It Fl V , Fl Fl version
+Print version information and exit.
+.It Fl y , Fl Fl nothing
+Does nothing.
+This options exists only for compatibility with the
+non-free agrep program.
+.It Fl Fl help
+Display a brief help message and exit.
+.El
+.Ss Output control
+.Bl -tag -width 10n
+.It Fl B , Fl Fl best-match
+Only output the best matching records, that is, the records with the
+lowest cost.
+This is currently implemented by making two passes over
+the input files and cannot be used when reading from standard input.
+.It Fl Fl color , Fl Fl colour
+Highlight the matching strings in the output with a color marker.
+The color string is taken from the
+.Ev GREP_COLOR
+environment variable.
+The default color is red.
+.It Fl c , Fl Fl count
+Only print a count of matching records per each input file,
+suppressing normal output.
+.It Fl h , Fl Fl no-filename
+Suppress the prefixing filename on output when multiple files are
+searched.
+.It Fl H , Fl Fl with-filename
+Prefix each output record with the name of the input file where the
+record was read from.
+.It Fl l , Fl Fl files-with-matches
+Only print the name of each input file which contains at least one
+match, suppressing normal output.
+The scanning for each file will stop on the first match.
+.It Fl n , Fl Fl record-number
+Prefix each output record with its sequence number in the input file.
+The number of the first record is 1.
+.It Fl q , Fl Fl quiet , Fl Fl silent
+Do not write anything to standard output.
+Exit immediately with zero exit status if a match is found.
+.It Fl s , Fl Fl show-cost
+Print match cost with output.
+.It Fl Fl show-position
+Prefix each output record with the start and end offset of the first
+match within the record.
+The offset of the first character of the record is 0.
+The end position is given as the offset of the first
+character after the match.
+.It Fl M , Fl Fl delimiter-after
+By default, the record delimiter is the newline character and is
+output after the matching record.
+If
+.Fl d
+is used, the record delimiter will be output before the matching
+record.
+This option causes the delimiter to be output after the
+matching record.
+.El
+.Pp
+With no
+.Ar file ,
+or when
+.Ar file
+is
+.Dq - ,
+.Nm
+reads standard input.
+If less than two
+.Ar files
+are given
+.Fl h
+is assumed, otherwise
+.Fl H
+is the default.
+.Sh EXAMPLES
+.Dl agrep \-2 optimize foo.txt
+outputs all lines in file
+.Pa foo.txt
+that match
+.Dq optimize
+within two errors.
+E.g. lines which contain
+.Dq optimise ,
+.Dq optmise ,
+and
+.Dq opitmize
+all match.
+.Sh DIAGNOSTICS
+Exit status is 0 if a match is found, 1 for no match, and 2 if there
+were errors.
+If
+.Fl E
+or
+.Fl Ns Ar #
+is not specified, only exact matches are selected.
+.Pp
+.Ar pattern
+is a POSIX extended regular expression (ERE) with the TRE extensions.
+.Sh REPORTING BUGS
+Report bugs to the TRE mailing list
+.Aq tre-general@lists.laurikari.net .
+.Sh COPYRIGHT
+Copyright \(co 2002-2004 Ville Laurikari.
+.Pp
+This is free software, and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute this software under certain
+conditions; see the source for the full license text.
--- a/external/bsd/tre/dist/config.h	Sun Nov 06 22:05:00 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/* config.h.  Generated from config.h.in by configure.  */
-/* config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
-   systems. This function is required for `alloca.c' support on those systems.
-   */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to 1 if using `alloca.c'. */
-/* #undef C_ALLOCA */
-
-/* Define to 1 if translation of program messages to the user's native
-   language is requested. */
-/* #undef ENABLE_NLS */
-
-/* Define to 1 if you have `alloca', as a function or macro. */
-/* #undef HAVE_ALLOCA */
-
-/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
-   */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
-   CoreFoundation framework. */
-/* #undef HAVE_CFLOCALECOPYCURRENT */
-
-/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
-   the CoreFoundation framework. */
-/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
-
-/* Define if the GNU dcgettext() function is already present or preinstalled.
-   */
-/* #undef HAVE_DCGETTEXT */
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the <getopt.h> header file. */
-#define HAVE_GETOPT_H 1
-
-/* Define to 1 if you have the `getopt_long' function. */
-#define HAVE_GETOPT_LONG 1
-
-/* Define if the GNU gettext() function is already present or preinstalled. */
-/* #undef HAVE_GETTEXT */
-
-/* Define if you have the iconv() function and it works. */
-#define HAVE_ICONV 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-/* #undef HAVE_INTTYPES_H */
-
-/* Define to 1 if you have the `isascii' function. */
-#define HAVE_ISASCII 1
-
-/* Define to 1 if you have the `isblank' function. */
-#define HAVE_ISBLANK 1
-
-/* Define to 1 if you have the `iswascii' function or macro. */
-/* #undef HAVE_ISWASCII */
-
-/* Define to 1 if you have the `iswblank' function or macro. */
-/* #undef HAVE_ISWBLANK */
-
-/* Define to 1 if you have the `iswctype' function or macro. */
-/* #undef HAVE_ISWCTYPE */
-
-/* Define to 1 if you have the `iswlower' function or macro. */
-/* #undef HAVE_ISWLOWER */
-
-/* Define to 1 if you have the `iswupper' function or macro. */
-/* #undef HAVE_ISWUPPER */
-
-/* Define to 1 if you have the <libutf8.h> header file. */
-/* #undef HAVE_LIBUTF8_H */
-
-/* Define to 1 if you have the `mbrtowc' function or macro. */
-/* #undef HAVE_MBRTOWC */
-
-/* Define to 1 if the system has the type `mbstate_t'. */
-/* #undef HAVE_MBSTATE_T */
-
-/* Define to 1 if you have the `mbtowc' function or macro. */
-/* #undef HAVE_MBTOWC */
-
-/* Define to 1 if you have the <memory.h> header file. */
-/* #undef HAVE_MEMORY_H */
-
-/* Define to 1 if you have the <regex.h> header file. */
-#define HAVE_REGEX_H 1
-
-/* Define to 1 if the system has the type `reg_errcode_t'. */
-/* #undef HAVE_REG_ERRCODE_T */
-
-/* Define to 1 if you have the <stdint.h> header file. */
-/* #undef HAVE_STDINT_H */
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-/* #undef HAVE_STDLIB_H */
-
-/* Define to 1 if you have the <strings.h> header file. */
-/* #undef HAVE_STRINGS_H */
-
-/* Define to 1 if you have the <string.h> header file. */
-/* #undef HAVE_STRING_H */
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-/* #undef HAVE_SYS_STAT_H */
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the `towlower' function or macro. */
-/* #undef HAVE_TOWLOWER */
-
-/* Define to 1 if you have the `towupper' function or macro. */
-/* #undef HAVE_TOWUPPER */
-
-/* Define to 1 if you have the <unistd.h> header file. */
-/* #undef HAVE_UNISTD_H */
-
-/* Define to 1 if you have the <wchar.h> header file. */
-/* #undef HAVE_WCHAR_H */
-
-/* Define to 1 if the system has the type `wchar_t'. */
-/* #undef HAVE_WCHAR_T */
-
-/* Define to 1 if you have the `wcschr' function or macro. */
-/* #undef HAVE_WCSCHR */
-
-/* Define to 1 if you have the `wcscpy' function or macro. */
-/* #undef HAVE_WCSCPY */
-
-/* Define to 1 if you have the `wcslen' function or macro. */
-/* #undef HAVE_WCSLEN */
-
-/* Define to 1 if you have the `wcsncpy' function or macro. */
-/* #undef HAVE_WCSNCPY */
-
-/* Define to 1 if you have the `wcsrtombs' function or macro. */
-/* #undef HAVE_WCSRTOMBS */
-
-/* Define to 1 if you have the `wcstombs' function or macro. */
-/* #undef HAVE_WCSTOMBS */
-
-/* Define to 1 if you have the `wctype' function or macro. */
-/* #undef HAVE_WCTYPE */
-
-/* Define to 1 if you have the <wctype.h> header file. */
-/* #undef HAVE_WCTYPE_H */
-
-/* Define to 1 if the system has the type `wint_t'. */
-/* #undef HAVE_WINT_T */
-
-/* Define if you want to disable debug assertions. */
-#define NDEBUG 1
-
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-/* #undef NO_MINUS_C_MINUS_O */
-
-/* Name of package */
-#define PACKAGE "tre"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "tre-general@lists.laurikari.net"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "TRE"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "TRE 0.8.0"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "tre"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.8.0"
-
-/* If using the C implementation of alloca, define if you know the
-   direction of stack growth for your system; otherwise it will be
-   automatically deduced at runtime.
-	STACK_DIRECTION > 0 => grows toward higher addresses
-	STACK_DIRECTION < 0 => grows toward lower addresses
-	STACK_DIRECTION = 0 => direction of growth unknown */
-/* #undef STACK_DIRECTION */
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if you want to enable approximate matching functionality. */
-/* #undef TRE_APPROX */
-
-/* Define if you want TRE to print debug messages to stdout. */
-/* #undef TRE_DEBUG */
-
-/* Define to enable multibyte character set support. */
-/* #undef TRE_MULTIBYTE */
-
-/* Define to a field in the regex_t struct where TRE should store a pointer to
-   the internal tre_tnfa_t structure */
-#define TRE_REGEX_T_FIELD re_g
-
-/* Define to the absolute path to the system regex.h */
-#define TRE_SYSTEM_REGEX_H_PATH "../../../include/regex.h"
-
-/* Define if you want TRE to use alloca() instead of malloc() when allocating
-   memory needed for regexec operations. */
-/* #undef TRE_USE_ALLOCA */
-
-/* Define to include the system regex.h from TRE regex.h */
-#define TRE_USE_SYSTEM_REGEX_H 1
-
-/* TRE version string. */
-#define TRE_VERSION "0.8.0"
-
-/* TRE version level 1. */
-#define TRE_VERSION_1 0
-
-/* TRE version level 2. */
-#define TRE_VERSION_2 8
-
-/* TRE version level 3. */
-#define TRE_VERSION_3 0
-
-/* Define to enable wide character (wchar_t) support. */
-/* #undef TRE_WCHAR */
-
-/* Version number of package */
-#define VERSION "0.8.0"
-
-/* Define to the maximum value of wchar_t if not already defined elsewhere */
-/* #undef WCHAR_MAX */
-
-/* Define if wchar_t is signed */
-/* #undef WCHAR_T_SIGNED */
-
-/* Define if wchar_t is unsigned */
-/* #undef WCHAR_T_UNSIGNED */
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-/* #undef _FILE_OFFSET_BITS */
-
-/* Define to enable GNU extensions in glibc */
-#define _GNU_SOURCE 1
-
-/* Define for large files, on AIX-style hosts. */
-/* #undef _LARGE_FILES */
-
-/* Define on IRIX */
-#define _REGCOMP_INTERNAL 1
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
--- a/external/bsd/tre/dist/lib/regcomp.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/regcomp.c	Thu Nov 10 14:31:09 2011 +0000
@@ -18,11 +18,6 @@
 #include "tre-internal.h"
 #include "xmalloc.h"
 
-#ifdef __weak_alias
-__weak_alias(regcomp,_regcomp)
-__weak_alias(regfree,_regfree)
-#endif
-
 int
 tre_regncomp(regex_t *preg, const char *regex, size_t n, int cflags)
 {
@@ -55,7 +50,7 @@
 #if TRE_MULTIBYTE
   else
     {
-      int consumed;
+      size_t consumed;
       tre_char_t *wcptr = wregex;
 #ifdef HAVE_MBSTATE_T
       mbstate_t state;
@@ -76,11 +71,11 @@
 		  return REG_BADPAT;
 		}
 	      break;
-	    case -1:
+	    case (size_t)-1:
 	      DPRINT(("mbrtowc: error %d: %s.\n", errno, strerror(errno)));
 	      xfree(wregex);
 	      return REG_BADPAT;
-	    case -2:
+	    case (size_t)-2:
 	      /* The last character wasn't complete.  Let's not call it a
 		 fatal error. */
 	      consumed = n;
--- a/external/bsd/tre/dist/lib/regerror.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/regerror.c	Thu Nov 10 14:31:09 2011 +0000
@@ -21,10 +21,6 @@
 #include "tre-internal.h"
 #include "tre.h"
 
-#ifdef __weak_alias
-__weak_alias(regerror,_regerror)
-#endif
-
 #ifdef HAVE_GETTEXT
 #include <libintl.h>
 #else
--- a/external/bsd/tre/dist/lib/regexec.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/regexec.c	Thu Nov 10 14:31:09 2011 +0000
@@ -10,22 +10,7 @@
 #include <config.h>
 #endif /* HAVE_CONFIG_H */
 
-#ifdef TRE_USE_ALLOCA
-/* AIX requires this to be the first thing in the file.	 */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-#  include <alloca.h>
-# else
-#  ifdef _AIX
- #pragma alloca
-#  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
-#endif /* TRE_USE_ALLOCA */
+#include "tre-alloca.h"
 
 #include <assert.h>
 #include <stdlib.h>
@@ -48,10 +33,6 @@
 #include "tre.h"
 #include "xmalloc.h"
 
-#ifdef __weak_alias
-__weak_alias(regexec,_regexec)
-#endif
-
 /* Fills the POSIX.2 regmatch_t array according to the TNFA tag and match
    endpoint values. */
 void
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tre/dist/lib/tre-alloca.h	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,17 @@
+
+#ifdef TRE_USE_ALLOCA
+/* AIX requires this to be the first thing in the file.	 */
+#if !defined(__GNUC__) && !defined(__lint__)
+# if HAVE_ALLOCA_H
+#  include <alloca.h>
+# else
+#  ifdef _AIX
+ #pragma alloca
+#  else
+#   ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#   endif
+#  endif
+# endif
+#endif
+#endif /* TRE_USE_ALLOCA */
--- a/external/bsd/tre/dist/lib/tre-ast.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-ast.h	Thu Nov 10 14:31:09 2011 +0000
@@ -44,8 +44,8 @@
   void *obj;             /* Pointer to actual node. */
   int nullable;
   int submatch_id;
-  int num_submatches;
-  int num_tags;
+  size_t num_submatches;
+  size_t num_tags;
   tre_pos_and_tags_t *firstpos;
   tre_pos_and_tags_t *lastpos;
 } tre_ast_node_t;
@@ -55,8 +55,8 @@
    tags, matching parameter settings, and all expressions that match one
    character. */
 typedef struct {
-  long code_min;
-  long code_max;
+  int code_min;
+  int code_max;
   int position;
   union {
     tre_ctype_t class;
--- a/external/bsd/tre/dist/lib/tre-compile.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-compile.c	Thu Nov 10 14:31:09 2011 +0000
@@ -196,20 +196,20 @@
     }
 
   STACK_PUSH(stack, voidptr, node);
-  STACK_PUSH(stack, int, ADDTAGS_RECURSE);
+  STACK_PUSH(stack, long, ADDTAGS_RECURSE);
 
   while (tre_stack_num_objects(stack) > bottom)
     {
       if (status != REG_OK)
 	break;
 
-      symbol = (tre_addtags_symbol_t)tre_stack_pop_int(stack);
+      symbol = (tre_addtags_symbol_t)tre_stack_pop_long(stack);
       switch (symbol)
 	{
 
 	case ADDTAGS_SET_SUBMATCH_END:
 	  {
-	    int id = tre_stack_pop_int(stack);
+	    int id = (int)tre_stack_pop_long(stack);
 	    int i;
 
 	    /* Add end of this submatch to regset. */
@@ -259,8 +259,8 @@
 
 	      /* Add end of this submatch to regset after processing this
 		 node. */
-	      STACK_PUSHX(stack, int, node->submatch_id);
-	      STACK_PUSHX(stack, int, ADDTAGS_SET_SUBMATCH_END);
+	      STACK_PUSHX(stack, long, node->submatch_id);
+	      STACK_PUSHX(stack, long, ADDTAGS_SET_SUBMATCH_END);
 	    }
 
 	  switch (node->type)
@@ -324,14 +324,14 @@
 
 		/* After processing right child. */
 		STACK_PUSHX(stack, voidptr, node);
-		STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_RIGHT);
+		STACK_PUSHX(stack, long, ADDTAGS_AFTER_CAT_RIGHT);
 
 		/* Process right child. */
 		STACK_PUSHX(stack, voidptr, right);
-		STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
+		STACK_PUSHX(stack, long, ADDTAGS_RECURSE);
 
 		/* After processing left child. */
-		STACK_PUSHX(stack, int, next_tag + left->num_tags);
+		STACK_PUSHX(stack, long, (long)(next_tag + left->num_tags));
 		DPRINT(("  Pushing %d for after left\n",
 			next_tag + left->num_tags));
 		if (left->num_tags > 0 && right->num_tags > 0)
@@ -342,12 +342,12 @@
 		    reserved_tag = next_tag;
 		    next_tag++;
 		  }
-		STACK_PUSHX(stack, int, reserved_tag);
-		STACK_PUSHX(stack, int, ADDTAGS_AFTER_CAT_LEFT);
+		STACK_PUSHX(stack, long, reserved_tag);
+		STACK_PUSHX(stack, long, ADDTAGS_AFTER_CAT_LEFT);
 
 		/* Process left child. */
 		STACK_PUSHX(stack, voidptr, left);
-		STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
+		STACK_PUSHX(stack, long, ADDTAGS_RECURSE);
 
 		}
 	      break;
@@ -358,18 +358,18 @@
 
 		if (first_pass)
 		  {
-		    STACK_PUSHX(stack, int, regset[0] >= 0 || iter->minimal);
+		    STACK_PUSHX(stack, long, regset[0] >= 0 || iter->minimal);
 		  }
 		else
 		  {
-		    STACK_PUSHX(stack, int, tag);
-		    STACK_PUSHX(stack, int, iter->minimal);
+		    STACK_PUSHX(stack, long, tag);
+		    STACK_PUSHX(stack, long, iter->minimal);
 		  }
 		STACK_PUSHX(stack, voidptr, node);
-		STACK_PUSHX(stack, int, ADDTAGS_AFTER_ITERATION);
+		STACK_PUSHX(stack, long, ADDTAGS_AFTER_ITERATION);
 
 		STACK_PUSHX(stack, voidptr, iter->arg);
-		STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
+		STACK_PUSHX(stack, long, ADDTAGS_RECURSE);
 
 		/* Regset is not empty, so add a tag here. */
 		if (regset[0] >= 0 || iter->minimal)
@@ -426,25 +426,25 @@
 		DPRINT(("Union\n"));
 
 		/* After processing right child. */
-		STACK_PUSHX(stack, int, right_tag);
-		STACK_PUSHX(stack, int, left_tag);
+		STACK_PUSHX(stack, long, right_tag);
+		STACK_PUSHX(stack, long, left_tag);
 		STACK_PUSHX(stack, voidptr, regset);
-		STACK_PUSHX(stack, int, regset[0] >= 0);
+		STACK_PUSHX(stack, long, regset[0] >= 0);
 		STACK_PUSHX(stack, voidptr, node);
 		STACK_PUSHX(stack, voidptr, right);
 		STACK_PUSHX(stack, voidptr, left);
-		STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_RIGHT);
+		STACK_PUSHX(stack, long, ADDTAGS_AFTER_UNION_RIGHT);
 
 		/* Process right child. */
 		STACK_PUSHX(stack, voidptr, right);
-		STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
+		STACK_PUSHX(stack, long, ADDTAGS_RECURSE);
 
 		/* After processing left child. */
-		STACK_PUSHX(stack, int, ADDTAGS_AFTER_UNION_LEFT);
+		STACK_PUSHX(stack, long, ADDTAGS_AFTER_UNION_LEFT);
 
 		/* Process left child. */
 		STACK_PUSHX(stack, voidptr, left);
-		STACK_PUSHX(stack, int, ADDTAGS_RECURSE);
+		STACK_PUSHX(stack, long, ADDTAGS_RECURSE);
 
 		/* Regset is not empty, so add a tag here. */
 		if (regset[0] >= 0)
@@ -505,7 +505,7 @@
 	    if (first_pass)
 	      {
 		node->num_tags = ((tre_iteration_t *)node->obj)->arg->num_tags
-		  + tre_stack_pop_int(stack);
+		  + tre_stack_pop_long(stack);
 		minimal_tag = -1;
 	      }
 	    else
@@ -667,7 +667,7 @@
   tre_copyast_symbol_t symbol;
 
   STACK_PUSH(stack, voidptr, ast);
-  STACK_PUSH(stack, int, COPY_RECURSE);
+  STACK_PUSH(stack, long, COPY_RECURSE);
 
   while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
     {
@@ -675,7 +675,7 @@
       if (status != REG_OK)
 	break;
 
-      symbol = (tre_copyast_symbol_t)tre_stack_pop_int(stack);
+      symbol = (tre_copyast_symbol_t)tre_stack_pop_long(stack);
       switch (symbol)
 	{
 	case COPY_SET_RESULT_PTR:
@@ -733,11 +733,11 @@
 		tmp = (*result)->obj;
 		result = &tmp->left;
 		STACK_PUSHX(stack, voidptr, uni->right);
-		STACK_PUSHX(stack, int, COPY_RECURSE);
+		STACK_PUSHX(stack, long, COPY_RECURSE);
 		STACK_PUSHX(stack, voidptr, &tmp->right);
-		STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR);
+		STACK_PUSHX(stack, long, COPY_SET_RESULT_PTR);
 		STACK_PUSHX(stack, voidptr, uni->left);
-		STACK_PUSHX(stack, int, COPY_RECURSE);
+		STACK_PUSHX(stack, long, COPY_RECURSE);
 		break;
 	      }
 	    case CATENATION:
@@ -756,18 +756,18 @@
 		result = &tmp->left;
 
 		STACK_PUSHX(stack, voidptr, cat->right);
-		STACK_PUSHX(stack, int, COPY_RECURSE);
+		STACK_PUSHX(stack, long, COPY_RECURSE);
 		STACK_PUSHX(stack, voidptr, &tmp->right);
-		STACK_PUSHX(stack, int, COPY_SET_RESULT_PTR);
+		STACK_PUSHX(stack, long, COPY_SET_RESULT_PTR);
 		STACK_PUSHX(stack, voidptr, cat->left);
-		STACK_PUSHX(stack, int, COPY_RECURSE);
+		STACK_PUSHX(stack, long, COPY_RECURSE);
 		break;
 	      }
 	    case ITERATION:
 	      {
 		tre_iteration_t *iter = node->obj;
 		STACK_PUSHX(stack, voidptr, iter->arg);
-		STACK_PUSHX(stack, int, COPY_RECURSE);
+		STACK_PUSHX(stack, long, COPY_RECURSE);
 		*result = tre_ast_new_iter(mem, iter->arg, iter->min,
 					   iter->max, iter->minimal);
 		if (*result == NULL)
@@ -818,7 +818,7 @@
     params[i] = TRE_PARAM_DEFAULT;
 
   STACK_PUSHR(stack, voidptr, ast);
-  STACK_PUSHR(stack, int, EXPAND_RECURSE);
+  STACK_PUSHR(stack, long, EXPAND_RECURSE);
   while (status == REG_OK && tre_stack_num_objects(stack) > bottom)
     {
       tre_ast_node_t *node;
@@ -829,7 +829,7 @@
 
       DPRINT(("pos_add %d\n", pos_add));
 
-      symbol = (tre_expand_ast_symbol_t)tre_stack_pop_int(stack);
+      symbol = (tre_expand_ast_symbol_t)tre_stack_pop_long(stack);
       node = tre_stack_pop_voidptr(stack);
       switch (symbol)
 	{
@@ -851,28 +851,28 @@
 	      {
 		tre_union_t *uni = node->obj;
 		STACK_PUSHX(stack, voidptr, uni->right);
-		STACK_PUSHX(stack, int, EXPAND_RECURSE);
+		STACK_PUSHX(stack, long, EXPAND_RECURSE);
 		STACK_PUSHX(stack, voidptr, uni->left);
-		STACK_PUSHX(stack, int, EXPAND_RECURSE);
+		STACK_PUSHX(stack, long, EXPAND_RECURSE);
 		break;
 	      }
 	    case CATENATION:
 	      {
 		tre_catenation_t *cat = node->obj;
 		STACK_PUSHX(stack, voidptr, cat->right);
-		STACK_PUSHX(stack, int, EXPAND_RECURSE);
+		STACK_PUSHX(stack, long, EXPAND_RECURSE);
 		STACK_PUSHX(stack, voidptr, cat->left);
-		STACK_PUSHX(stack, int, EXPAND_RECURSE);
+		STACK_PUSHX(stack, long, EXPAND_RECURSE);
 		break;
 	      }
 	    case ITERATION:
 	      {
 		tre_iteration_t *iter = node->obj;
-		STACK_PUSHX(stack, int, pos_add);
+		STACK_PUSHX(stack, long, pos_add);
 		STACK_PUSHX(stack, voidptr, node);
-		STACK_PUSHX(stack, int, EXPAND_AFTER_ITER);
+		STACK_PUSHX(stack, long, EXPAND_AFTER_ITER);
 		STACK_PUSHX(stack, voidptr, iter->arg);
-		STACK_PUSHX(stack, int, EXPAND_RECURSE);
+		STACK_PUSHX(stack, long, EXPAND_RECURSE);
 		/* If we are going to expand this node at EXPAND_AFTER_ITER
 		   then don't increase the `pos' fields of the nodes now, it
 		   will get done when expanding. */
@@ -1321,14 +1321,14 @@
   int bottom = tre_stack_num_objects(stack);
 
   STACK_PUSHR(stack, voidptr, tree);
-  STACK_PUSHR(stack, int, NFL_RECURSE);
+  STACK_PUSHR(stack, long, NFL_RECURSE);
 
   while (tre_stack_num_objects(stack) > bottom)
     {
       tre_nfl_stack_symbol_t symbol;
       tre_ast_node_t *node;
 
-      symbol = (tre_nfl_stack_symbol_t)tre_stack_pop_int(stack);
+      symbol = (tre_nfl_stack_symbol_t)tre_stack_pop_long(stack);
       node = tre_stack_pop_voidptr(stack);
       switch (symbol)
 	{
@@ -1390,31 +1390,31 @@
 	      /* Compute the attributes for the two subtrees, and after that
 		 for this node. */
 	      STACK_PUSHR(stack, voidptr, node);
-	      STACK_PUSHR(stack, int, NFL_POST_UNION);
+	      STACK_PUSHR(stack, long, NFL_POST_UNION);
 	      STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->right);
-	      STACK_PUSHR(stack, int, NFL_RECURSE);
+	      STACK_PUSHR(stack, long, NFL_RECURSE);
 	      STACK_PUSHR(stack, voidptr, ((tre_union_t *)node->obj)->left);
-	      STACK_PUSHR(stack, int, NFL_RECURSE);
+	      STACK_PUSHR(stack, long, NFL_RECURSE);
 	      break;
 
 	    case CATENATION:
 	      /* Compute the attributes for the two subtrees, and after that
 		 for this node. */
 	      STACK_PUSHR(stack, voidptr, node);
-	      STACK_PUSHR(stack, int, NFL_POST_CATENATION);
+	      STACK_PUSHR(stack, long, NFL_POST_CATENATION);
 	      STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->right);
-	      STACK_PUSHR(stack, int, NFL_RECURSE);
+	      STACK_PUSHR(stack, long, NFL_RECURSE);
 	      STACK_PUSHR(stack, voidptr, ((tre_catenation_t *)node->obj)->left);
-	      STACK_PUSHR(stack, int, NFL_RECURSE);
+	      STACK_PUSHR(stack, long, NFL_RECURSE);
 	      break;
 
 	    case ITERATION:
 	      /* Compute the attributes for the subtree, and after that for
 		 this node. */
 	      STACK_PUSHR(stack, voidptr, node);
-	      STACK_PUSHR(stack, int, NFL_POST_ITERATION);
+	      STACK_PUSHR(stack, long, NFL_POST_ITERATION);
 	      STACK_PUSHR(stack, voidptr, ((tre_iteration_t *)node->obj)->arg);
-	      STACK_PUSHR(stack, int, NFL_RECURSE);
+	      STACK_PUSHR(stack, long, NFL_RECURSE);
 	      break;
 	    }
 	  break; /* end case: NFL_RECURSE */
--- a/external/bsd/tre/dist/lib/tre-config.h	Sun Nov 06 22:05:00 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* lib/tre-config.h.  Generated from tre-config.h.in by configure.  */
-/* tre-config.h.in.  This file has all definitions that are needed in
-   `tre.h'.  Note that this file must contain only the bare minimum
-   of definitions without the TRE_ prefix to avoid conflicts between
-   definitions here and definitions included from somewhere else. */
-
-/* Define to 1 if you have the <libutf8.h> header file. */
-/* #undef HAVE_LIBUTF8_H */
-
-/* Define to 1 if the system has the type `reg_errcode_t'. */
-/* #undef HAVE_REG_ERRCODE_T */
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <wchar.h> header file. */
-/* #undef HAVE_WCHAR_H */
-
-/* Define if you want to enable approximate matching functionality. */
-/* #undef TRE_APPROX */
-
-/* Define to enable multibyte character set support. */
-/* #undef TRE_MULTIBYTE */
-
-/* Define to the absolute path to the system tre.h */
-#define TRE_SYSTEM_REGEX_H_PATH "../../../include/regex.h"
-
-/* Define to include the system regex.h from tre.h */
-#define TRE_USE_SYSTEM_REGEX_H 1
-
-/* Define to enable wide character (wchar_t) support. */
-/* #undef TRE_WCHAR */
-
-/* TRE version string. */
-#define TRE_VERSION "0.8.0"
-
-/* TRE version level 1. */
-#define TRE_VERSION_1 0
-
-/* TRE version level 2. */
-#define TRE_VERSION_2 8
-
-/* TRE version level 3. */
-#define TRE_VERSION_3 0
--- a/external/bsd/tre/dist/lib/tre-internal.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-internal.h	Thu Nov 10 14:31:09 2011 +0000
@@ -230,19 +230,19 @@
 
 struct tnfa {
   tre_tnfa_transition_t *transitions;
-  unsigned int num_transitions;
+  size_t num_transitions;
   tre_tnfa_transition_t *initial;
   tre_tnfa_transition_t *final;
   tre_submatch_data_t *submatch_data;
   char *firstpos_chars;
   int first_char;
-  unsigned int num_submatches;
+  size_t num_submatches;
   tre_tag_direction_t *tag_directions;
   int *minimal_tags;
-  int num_tags;
-  int num_minimals;
+  size_t num_tags;
+  size_t num_minimals;
   int end_tag;
-  int num_states;
+  size_t num_states;
   int cflags;
   int have_backrefs;
   int have_approx;
--- a/external/bsd/tre/dist/lib/tre-match-approx.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-match-approx.c	Thu Nov 10 14:31:09 2011 +0000
@@ -5,27 +5,11 @@
   See the file LICENSE for details and copyright.
 
 */
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif /* HAVE_CONFIG_H */
 
-/* AIX requires this to be the first thing in the file.	 */
-#ifdef TRE_USE_ALLOCA
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-#  include <alloca.h>
-# else
-#  ifdef _AIX
- #pragma alloca
-#  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
-#endif /* TRE_USE_ALLOCA */
+#include "tre-alloca.h"
 
 #define __USE_STRING_INLINES
 #undef __NO_INLINE__
@@ -82,7 +66,7 @@
 /* Prints the `reach' array in a readable fashion with DPRINT. */
 static void
 tre_print_reach(const tre_tnfa_t *tnfa, tre_tnfa_approx_reach_t *reach,
-		int pos, int num_tags)
+		int pos, size_t num_tags)
 {
   int id;
 
@@ -220,12 +204,12 @@
   int reg_notbol = eflags & REG_NOTBOL;
   int reg_noteol = eflags & REG_NOTEOL;
   int reg_newline = tnfa->cflags & REG_NEWLINE;
-  int str_user_end = 0;
+  size_t str_user_end = 0;
 
   int prev_pos;
 
   /* Number of tags. */
-  int num_tags;
+  size_t num_tags;
   /* The reach tables. */
   tre_tnfa_approx_reach_t *reach, *reach_next;
   /* Tag array for temporary use. */
@@ -239,7 +223,7 @@
   /* Space for temporary data required for matching. */
   unsigned char *buf;
 
-  int i, id;
+  size_t i, id;
 
   if (!match_tags)
     num_tags = 0;
@@ -267,11 +251,11 @@
   {
     unsigned char *buf_cursor;
     /* Space needed for one array of tags. */
-    int tag_bytes = sizeof(*tmp_tags) * num_tags;
+    size_t tag_bytes = sizeof(*tmp_tags) * num_tags;
     /* Space needed for one reach table. */
-    int reach_bytes = sizeof(*reach_next) * tnfa->num_states;
+    size_t reach_bytes = sizeof(*reach_next) * tnfa->num_states;
     /* Total space needed. */
-    int total_bytes = reach_bytes * 2 + (tnfa->num_states * 2 + 1 ) * tag_bytes;
+    size_t total_bytes = reach_bytes * 2 + (tnfa->num_states * 2 + 1 ) * tag_bytes;
     /* Add some extra to make sure we can align the pointers.  The multiplier
        used here must be equal to the number of ALIGN calls below. */
     total_bytes += (sizeof(long) - 1) * 3;
@@ -357,7 +341,7 @@
 
 		  if (trans->tags)
 		    for (i = 0; trans->tags[i] >= 0; i++)
-		      if (trans->tags[i] < num_tags)
+		      if ((size_t)trans->tags[i] < num_tags)
 			reach_next[stateid].tags[trans->tags[i]] = pos;
 
 		  /* Set the parameters, depth, and costs. */
@@ -546,7 +530,7 @@
 		  tmp_tags[i] = reach_p->tags[i];
 		if (trans->tags)
 		  for (i = 0; trans->tags[i] >= 0; i++)
-		    if (trans->tags[i] < num_tags)
+		    if ((size_t)trans->tags[i] < num_tags)
 		      tmp_tags[trans->tags[i]] = pos;
 
 		/* If another path has also reached this state, choose the one
@@ -729,7 +713,7 @@
 		tmp_tags[i] = reach[id].tags[i];
 	      if (trans->tags)
 		for (i = 0; trans->tags[i] >= 0; i++)
-		  if (trans->tags[i] < num_tags)
+		  if ((size_t)trans->tags[i] < num_tags)
 		    tmp_tags[trans->tags[i]] = pos;
 
 	      /* If another path has also reached this state, choose the
--- a/external/bsd/tre/dist/lib/tre-match-backtrack.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-match-backtrack.c	Thu Nov 10 14:31:09 2011 +0000
@@ -34,22 +34,7 @@
 #include <config.h>
 #endif /* HAVE_CONFIG_H */
 
-#ifdef TRE_USE_ALLOCA
-/* AIX requires this to be the first thing in the file.	 */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-#  include <alloca.h>
-# else
-#  ifdef _AIX
- #pragma alloca
-#  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
-#endif /* TRE_USE_ALLOCA */
+#include "tre-alloca.h"
 
 #include <assert.h>
 #include <stdlib.h>
@@ -114,7 +99,7 @@
 #ifdef TRE_USE_ALLOCA
 #define tre_bt_mem_new		  tre_mem_newa
 #define tre_bt_mem_alloc	  tre_mem_alloca
-#define tre_bt_mem_destroy(obj)	  do { } while (0)
+#define tre_bt_mem_destroy(obj)	  do { } while (/*CONSTCOND*/0)
 #else /* !TRE_USE_ALLOCA */
 #define tre_bt_mem_new		  tre_mem_new
 #define tre_bt_mem_alloc	  tre_mem_alloc
@@ -125,7 +110,7 @@
 #define BT_STACK_PUSH(_pos, _str_byte, _str_wide, _state, _state_id, _next_c, _tags, _mbstate) \
   do									      \
     {									      \
-      int i;								      \
+      size_t i;								      \
       if (!stack->next)							      \
 	{								      \
 	  tre_backtrack_t s;						      \
@@ -176,7 +161,7 @@
 #define BT_STACK_POP()							      \
   do									      \
     {									      \
-      int i;								      \
+      size_t i;								      \
       assert(stack->prev);						      \
       pos = stack->item.pos;						      \
       if (type == STR_USER)                                                   \
@@ -214,7 +199,7 @@
   int reg_notbol = eflags & REG_NOTBOL;
   int reg_noteol = eflags & REG_NOTEOL;
   int reg_newline = tnfa->cflags & REG_NEWLINE;
-  int str_user_end = 0;
+  size_t str_user_end = 0;
 
   /* These are used to remember the necessary values of the above
      variables to return to the position where the current search
@@ -301,7 +286,7 @@
 
  retry:
   {
-    int i;
+    size_t i;
     for (i = 0; i < tnfa->num_tags; i++)
       {
 	tags[i] = -1;
@@ -385,7 +370,7 @@
 		  && tre_tag_order(tnfa->num_tags, tnfa->tag_directions,
 				   tags, match_tags)))
 	    {
-	      int i;
+	      size_t i;
 	      /* This match wins the previous match. */
 	      DPRINT(("	 win previous\n"));
 	      match_eo = pos;
@@ -600,12 +585,14 @@
 	  if (stack->prev)
 	    {
 	      DPRINT(("	 backtracking\n"));
-	      if (stack->item.state->assertions && ASSERT_BACKREF)
+#if ASSERT_BACKREF
+	      if (stack->item.state->assertions)
 		{
 		  DPRINT(("  states_seen[%d] = 0\n",
 			  stack->item.state_id));
 		  states_seen[stack->item.state_id] = 0;
 		}
+#endif
 
 	      BT_STACK_POP();
 	    }
--- a/external/bsd/tre/dist/lib/tre-match-parallel.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-match-parallel.c	Thu Nov 10 14:31:09 2011 +0000
@@ -27,22 +27,7 @@
 #include <config.h>
 #endif /* HAVE_CONFIG_H */
 
-#ifdef TRE_USE_ALLOCA
-/* AIX requires this to be the first thing in the file.	 */
-#ifndef __GNUC__
-# if HAVE_ALLOCA_H
-#  include <alloca.h>
-# else
-#  ifdef _AIX
- #pragma alloca
-#  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
-char *alloca ();
-#   endif
-#  endif
-# endif
-#endif
-#endif /* TRE_USE_ALLOCA */
+#include "tre-alloca.h"
 
 #include <assert.h>
 #include <stdlib.h>
@@ -123,14 +108,14 @@
   int reg_notbol = eflags & REG_NOTBOL;
   int reg_noteol = eflags & REG_NOTEOL;
   int reg_newline = tnfa->cflags & REG_NEWLINE;
-  int str_user_end = 0;
+  size_t str_user_end = 0;
 
   char *buf;
   tre_tnfa_transition_t *trans_i;
   tre_tnfa_reach_t *reach, *reach_next, *reach_i, *reach_next_i;
   tre_reach_pos_t *reach_pos;
   int *tag_i;
-  int num_tags, i;
+  size_t num_tags, i;
 
   int match_eo = -1;	   /* end offset of match (-1 if no match found yet) */
   int new_match = 0;
@@ -153,7 +138,7 @@
      everything in a single large block from the stack frame using alloca()
      or with malloc() if alloca is unavailable. */
   {
-    int tbytes, rbytes, pbytes, xbytes, total_bytes;
+    size_t tbytes, rbytes, pbytes, xbytes, total_bytes;
     char *tmp_buf;
     /* Compute the length of the block we need. */
     tbytes = sizeof(*tmp_tags) * num_tags;
@@ -221,7 +206,7 @@
       if (str_byte >= orig_str + 1)
 	prev_c = (unsigned char)*(str_byte - 1);
       next_c = (unsigned char)*str_byte;
-      pos = str_byte - orig_str;
+      pos = (int)(str_byte - orig_str);
       if (len < 0 || pos < len)
 	str_byte++;
     }
@@ -296,7 +281,7 @@
 		  if (tag_i)
 		    while (*tag_i >= 0)
 		      {
-			if (*tag_i < num_tags)
+			if ((size_t)*tag_i < num_tags)
 			  reach_next_i->tags[*tag_i] = pos;
 			tag_i++;
 		      }
@@ -369,7 +354,7 @@
 		  int end = tnfa->minimal_tags[i];
 		  int start = tnfa->minimal_tags[i + 1];
 		  DPRINT(("  Minimal start %d, end %d\n", start, end));
-		  if (end >= num_tags)
+		  if ((size_t)end >= num_tags)
 		    {
 		      DPRINT(("	 Throwing %p out.\n", reach_i->state));
 		      skip = 1;
@@ -428,7 +413,7 @@
 		  if (tag_i != NULL)
 		    while (*tag_i >= 0)
 		      {
-			if (*tag_i < num_tags)
+			if ((size_t)*tag_i < num_tags)
 			  tmp_tags[*tag_i] = pos;
 			tag_i++;
 		      }
--- a/external/bsd/tre/dist/lib/tre-match-utils.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-match-utils.h	Thu Nov 10 14:31:09 2011 +0000
@@ -17,31 +17,29 @@
 #define GET_NEXT_WCHAR()						      \
   do {									      \
     prev_c = next_c;							      \
-    if (type == STR_BYTE)						      \
-      {									      \
+    switch (type) {							      \
+      case STR_BYTE:						      	      \
 	pos++;								      \
 	if (len >= 0 && pos >= len)					      \
 	  next_c = '\0';						      \
 	else								      \
 	  next_c = (unsigned char)(*str_byte++);			      \
-      }									      \
-    else if (type == STR_WIDE)						      \
-      {									      \
+	break;							              \
+      case STR_WIDE:						      	      \
 	pos++;								      \
 	if (len >= 0 && pos >= len)					      \
 	  next_c = L'\0';						      \
 	else								      \
 	  next_c = *str_wide++;						      \
-      }									      \
-    else if (type == STR_MBS)						      \
-      {									      \
+        break;								      \
+      case STR_MBS:						      	      \
         pos += pos_add_next;					      	      \
 	if (str_byte == NULL)						      \
 	  next_c = L'\0';						      \
 	else								      \
 	  {								      \
 	    size_t w;							      \
-	    int max;							      \
+	    long max;							      \
 	    if (len >= 0)						      \
 	      max = len - pos;						      \
 	    else							      \
@@ -64,18 +62,18 @@
 		  }							      \
 		else							      \
 		  {							      \
-		    pos_add_next = w;					      \
+		    pos_add_next = (unsigned int)w;			      \
 		    str_byte += w;					      \
 		  }							      \
 	      }								      \
-	  }								      \
-      }									      \
-    else if (type == STR_USER)						      \
-      {									      \
+	  } 								      \
+        break;								      \
+      case STR_USER:						      	      \
         pos += pos_add_next;					      	      \
 	str_user_end = str_source->get_next_char(&next_c, &pos_add_next,      \
-                                                 str_source->context);	      \
-      }									      \
+                                                 str_source->context);        \
+        break;								      \
+    }									      \
   } while(/*CONSTCOND*/0)
 
 #else /* !TRE_MULTIBYTE */
@@ -85,28 +83,27 @@
 #define GET_NEXT_WCHAR()						      \
   do {									      \
     prev_c = next_c;							      \
-    if (type == STR_BYTE)						      \
-      {									      \
+    switch (type) {							      \
+      case STR_BYTE:							      \
 	pos++;								      \
 	if (len >= 0 && pos >= len)					      \
 	  next_c = '\0';						      \
 	else								      \
 	  next_c = (unsigned char)(*str_byte++);			      \
-      }									      \
-    else if (type == STR_WIDE)						      \
-      {									      \
+        break;								      \
+      case STR_WIDE:							      \
 	pos++;								      \
 	if (len >= 0 && pos >= len)					      \
 	  next_c = L'\0';						      \
 	else								      \
 	  next_c = *str_wide++;						      \
-      }									      \
-    else if (type == STR_USER)						      \
-      {									      \
+        break;								      \
+      case STR_USER:							      \
         pos += pos_add_next;					      	      \
 	str_user_end = str_source->get_next_char(&next_c, &pos_add_next,      \
                                                  str_source->context);	      \
-      }									      \
+        break;								      \
+    }									      \
   } while(/*CONSTCOND*/0)
 
 #endif /* !TRE_MULTIBYTE */
@@ -118,20 +115,20 @@
 #define GET_NEXT_WCHAR()						      \
   do {									      \
     prev_c = next_c;							      \
-    if (type == STR_BYTE)						      \
-      {									      \
+    switch (type) {							      \
+      case STR_BYTE:							      \
 	pos++;								      \
 	if (len >= 0 && pos >= len)					      \
 	  next_c = '\0';						      \
 	else								      \
 	  next_c = (unsigned char)(*str_byte++);			      \
-      }									      \
-    else if (type == STR_USER)						      \
-      {									      \
+        break;								      \
+      case STR_USER:						      	      \
 	pos += pos_add_next;						      \
 	str_user_end = str_source->get_next_char(&next_c, &pos_add_next,      \
 						 str_source->context);	      \
-      }									      \
+        break;								      \
+    }									      \
   } while(/*CONSTCOND*/0)
 
 #endif /* !TRE_WCHAR */
@@ -175,10 +172,10 @@
 
 /* Returns 1 if `t1' wins `t2', 0 otherwise. */
 inline static int
-tre_tag_order(int num_tags, tre_tag_direction_t *tag_directions,
+tre_tag_order(size_t num_tags, tre_tag_direction_t *tag_directions,
 	      int *t1, int *t2)
 {
-  int i;
+  size_t i;
   for (i = 0; i < num_tags; i++)
     {
       if (tag_directions[i] == TRE_TAG_MINIMIZE)
--- a/external/bsd/tre/dist/lib/tre-mem.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-mem.c	Thu Nov 10 14:31:09 2011 +0000
@@ -106,7 +106,7 @@
 	}
       else
 	{
-	  unsigned block_size;
+	  size_t block_size;
 	  if (size * 8 > TRE_MEM_BLOCK_SIZE)
 	    block_size = size * 8;
 	  else
--- a/external/bsd/tre/dist/lib/tre-parse.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-parse.c	Thu Nov 10 14:31:09 2011 +0000
@@ -314,7 +314,7 @@
 	    {
 	      char tmp_str[64];
 	      const tre_char_t *endptr = re + 2;
-	      int len;
+	      size_t len;
 	      DPRINT(("tre_parse_bracket:  class: '%.*" STRF "'\n", REST(re)));
 	      while (endptr < ctx->re_end && *endptr != CHAR_COLON)
 		endptr++;
@@ -955,11 +955,11 @@
 
   if (!ctx->nofirstsub)
     {
-      STACK_PUSH(stack, int, ctx->submatch_id);
-      STACK_PUSH(stack, int, PARSE_MARK_FOR_SUBMATCH);
+      STACK_PUSH(stack, long, ctx->submatch_id);
+      STACK_PUSH(stack, long, PARSE_MARK_FOR_SUBMATCH);
       ctx->submatch_id++;
     }
-  STACK_PUSH(stack, int, PARSE_RE);
+  STACK_PUSH(stack, long, PARSE_RE);
   ctx->re_start = ctx->re;
   ctx->re_end = ctx->re + ctx->len;
 
@@ -982,15 +982,15 @@
 	  if (!(ctx->cflags & REG_LITERAL)
 	      && ctx->cflags & REG_EXTENDED)
 #endif /* REG_LITERAL */
-	    STACK_PUSHX(stack, int, PARSE_UNION);
-	  STACK_PUSHX(stack, int, PARSE_BRANCH);
+	    STACK_PUSHX(stack, long, PARSE_UNION);
+	  STACK_PUSHX(stack, long, PARSE_BRANCH);
 	  break;
 
 	case PARSE_BRANCH:
 	  /* Parse a branch.  A branch is one or more pieces, concatenated.
 	     A piece is an atom possibly followed by a postfix operator. */
-	  STACK_PUSHX(stack, int, PARSE_CATENATION);
-	  STACK_PUSHX(stack, int, PARSE_PIECE);
+	  STACK_PUSHX(stack, long, PARSE_CATENATION);
+	  STACK_PUSHX(stack, long, PARSE_PIECE);
 	  break;
 
 	case PARSE_PIECE:
@@ -999,8 +999,8 @@
 #ifdef REG_LITERAL
 	  if (!(ctx->cflags & REG_LITERAL))
 #endif /* REG_LITERAL */
-	    STACK_PUSHX(stack, int, PARSE_POSTFIX);
-	  STACK_PUSHX(stack, int, PARSE_ATOM);
+	    STACK_PUSHX(stack, long, PARSE_POSTFIX);
+	  STACK_PUSHX(stack, long, PARSE_ATOM);
 	  break;
 
 	case PARSE_CATENATION:
@@ -1040,18 +1040,18 @@
 	      {
 		/* Right associative concatenation. */
 		STACK_PUSHX(stack, voidptr, result);
-		STACK_PUSHX(stack, int, PARSE_POST_CATENATION);
-		STACK_PUSHX(stack, int, PARSE_CATENATION);
-		STACK_PUSHX(stack, int, PARSE_PIECE);
+		STACK_PUSHX(stack, long, PARSE_POST_CATENATION);
+		STACK_PUSHX(stack, long, PARSE_CATENATION);
+		STACK_PUSHX(stack, long, PARSE_PIECE);
 	      }
 	    else
 #endif /* REG_RIGHT_ASSOC */
 	      {
 		/* Default case, left associative concatenation. */
-		STACK_PUSHX(stack, int, PARSE_CATENATION);
+		STACK_PUSHX(stack, long, PARSE_CATENATION);
 		STACK_PUSHX(stack, voidptr, result);
-		STACK_PUSHX(stack, int, PARSE_POST_CATENATION);
-		STACK_PUSHX(stack, int, PARSE_PIECE);
+		STACK_PUSHX(stack, long, PARSE_POST_CATENATION);
+		STACK_PUSHX(stack, long, PARSE_PIECE);
 	      }
 	    break;
 	  }
@@ -1079,10 +1079,10 @@
 	    case CHAR_PIPE:
 	      DPRINT(("tre_parse:	union: '%.*" STRF "'\n",
 		      REST(ctx->re)));
-	      STACK_PUSHX(stack, int, PARSE_UNION);
+	      STACK_PUSHX(stack, long, PARSE_UNION);
 	      STACK_PUSHX(stack, voidptr, result);
-	      STACK_PUSHX(stack, int, PARSE_POST_UNION);
-	      STACK_PUSHX(stack, int, PARSE_BRANCH);
+	      STACK_PUSHX(stack, long, PARSE_POST_UNION);
+	      STACK_PUSHX(stack, long, PARSE_BRANCH);
 	      ctx->re++;
 	      break;
 
@@ -1162,7 +1162,7 @@
 		if (tmp_node == NULL)
 		  return REG_ESPACE;
 		result = tmp_node;
-		STACK_PUSHX(stack, int, PARSE_POSTFIX);
+		STACK_PUSHX(stack, long, PARSE_POSTFIX);
 	      }
 	      break;
 
@@ -1191,7 +1191,7 @@
 	      status = tre_parse_bound(ctx, &result);
 	      if (status != REG_OK)
 		return status;
-	      STACK_PUSHX(stack, int, PARSE_POSTFIX);
+	      STACK_PUSHX(stack, long, PARSE_POSTFIX);
 	      break;
 	    }
 	  break;
@@ -1313,9 +1313,9 @@
 
 		  /* Turn on the cflags changes for the rest of the
 		     enclosing group. */
-		  STACK_PUSHX(stack, int, ctx->cflags);
-		  STACK_PUSHX(stack, int, PARSE_RESTORE_CFLAGS);
-		  STACK_PUSHX(stack, int, PARSE_RE);
+		  STACK_PUSHX(stack, long, ctx->cflags);
+		  STACK_PUSHX(stack, long, PARSE_RESTORE_CFLAGS);
+		  STACK_PUSHX(stack, long, PARSE_RE);
 		  ctx->cflags = new_cflags;
 		  break;
 		}
@@ -1333,7 +1333,7 @@
 			      "', no submatch\n", REST(ctx->re)));
 		      /* Don't mark for submatching. */
 		      ctx->re += 3;
-		      STACK_PUSHX(stack, int, PARSE_RE);
+		      STACK_PUSHX(stack, long, PARSE_RE);
 		    }
 		  else
 		    {
@@ -1343,9 +1343,9 @@
 		      ctx->re++;
 		      /* First parse a whole RE, then mark the resulting tree
 			 for submatching. */
-		      STACK_PUSHX(stack, int, ctx->submatch_id);
-		      STACK_PUSHX(stack, int, PARSE_MARK_FOR_SUBMATCH);
-		      STACK_PUSHX(stack, int, PARSE_RE);
+		      STACK_PUSHX(stack, long, ctx->submatch_id);
+		      STACK_PUSHX(stack, long, PARSE_MARK_FOR_SUBMATCH);
+		      STACK_PUSHX(stack, long, PARSE_RE);
 		      ctx->submatch_id++;
 		    }
 		}
@@ -1392,7 +1392,7 @@
 		      || *(ctx->re + 1) == CHAR_RPAREN))
 		{
 		  ctx->re++;
-		  STACK_PUSHX(stack, int, PARSE_ATOM);
+		  STACK_PUSHX(stack, long, PARSE_ATOM);
 		  break;
 		}
 
@@ -1430,7 +1430,7 @@
 		  ctx->cflags |= REG_LITERAL;
 		  temporary_cflags |= REG_LITERAL;
 		  ctx->re += 2;
-		  STACK_PUSHX(stack, int, PARSE_ATOM);
+		  STACK_PUSHX(stack, long, PARSE_ATOM);
 		  break;
 		}
 #endif /* REG_LITERAL */
@@ -1630,7 +1630,7 @@
 		  ctx->cflags &= ~temporary_cflags;
 		  temporary_cflags = 0;
 		  ctx->re += 2;
-		  STACK_PUSHX(stack, int, PARSE_PIECE);
+		  STACK_PUSHX(stack, long, PARSE_PIECE);
 		  break;
 		}
 
--- a/external/bsd/tre/dist/lib/tre-parse.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-parse.h	Thu Nov 10 14:31:09 2011 +0000
@@ -23,7 +23,7 @@
   const tre_char_t *re_start;
   /* The first character after the end of the regexp. */
   const tre_char_t *re_end;
-  int len;
+  size_t len;
   /* Current submatch ID. */
   int submatch_id;
   /* Current position (number of literal). */
--- a/external/bsd/tre/dist/lib/tre-stack.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-stack.c	Thu Nov 10 14:31:09 2011 +0000
@@ -18,7 +18,7 @@
 
 union tre_stack_item {
   void *voidptr_value;
-  int int_value;
+  long long_value;
 };
 
 struct tre_stack_rec {
@@ -111,7 +111,7 @@
     return tre_stack_push(s, item);  \
 }
 
-define_pushf(int, int)
+define_pushf(long, long)
 define_pushf(voidptr, void *)
 
 #define define_popf(typetag, type)		    \
@@ -119,7 +119,7 @@
     return s->stack[--s->ptr].typetag ## _value;    \
   }
 
-define_popf(int, int)
+define_popf(long, long)
 define_popf(voidptr, void *)
 
 /* EOF */
--- a/external/bsd/tre/dist/lib/tre-stack.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre-stack.h	Thu Nov 10 14:31:09 2011 +0000
@@ -37,7 +37,7 @@
   reg_errcode_t tre_stack_push_ ## typetag(tre_stack_t *s, type value)
 
 declare_pushf(voidptr, void *);
-declare_pushf(int, int);
+declare_pushf(long, long);
 
 /* Each tre_stack_pop_*(tre_stack_t *s) function pops the topmost
    element off of stack `s' and returns it.  The stack must not be
@@ -46,7 +46,9 @@
   type tre_stack_pop_ ## typetag(tre_stack_t *s)
 
 declare_popf(voidptr, void *);
-declare_popf(int, int);
+declare_popf(long, long);
+
+#define tre_stack_pop_int(stack)	(int)tre_stack_pop_long(stack)
 
 /* Just to save some typing. */
 #define STACK_PUSH(s, typetag, value)					      \
--- a/external/bsd/tre/dist/lib/tre.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/tre.h	Thu Nov 10 14:31:09 2011 +0000
@@ -24,10 +24,10 @@
    system regex. */
 #include TRE_SYSTEM_REGEX_H_PATH
 #ifdef __weak_alias
-#define tre_regcomp  _regcomp
-#define tre_regexec  _regexec
-#define tre_regerror _regerror
-#define tre_regfree  _regfree
+__weak_alias(regcomp, tre_regcomp)
+__weak_alias(regexec, tre_regexec)
+__weak_alias(regerror, tre_regerror)
+__weak_alias(regfree, tre_regfree)
 #else
 #define tre_regcomp  regcomp
 #define tre_regexec  regexec
--- a/external/bsd/tre/dist/lib/xmalloc.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/bsd/tre/dist/lib/xmalloc.c	Thu Nov 10 14:31:09 2011 +0000
@@ -82,7 +82,7 @@
   hash = 0;
   for (i = 0; i < (int)sizeof(ptr)*8 / TABLE_BITS; i++)
     {
-      hash ^= (unsigned long)ptr >> i*8;
+      hash ^= (int)((unsigned long)ptr >> i*8);
       hash += i * 17;
       hash &= TABLE_MASK;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tre/include/config.h	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,259 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to 1 if using `alloca.c'. */
+/* #undef C_ALLOCA */
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#define HAVE_GETOPT_H 1
+
+/* Define to 1 if you have the `getopt_long' function. */
+#define HAVE_GETOPT_LONG 1
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* #undef HAVE_GETTEXT */
+
+/* Define if you have the iconv() function and it works. */
+#define HAVE_ICONV 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `isascii' function. */
+#define HAVE_ISASCII 1
+
+/* Define to 1 if you have the `isblank' function. */
+#define HAVE_ISBLANK 1
+
+/* Define to 1 if you have the `iswascii' function or macro. */
+/* #undef HAVE_ISWASCII */
+
+/* Define to 1 if you have the `iswblank' function or macro. */
+#define HAVE_ISWBLANK 1
+
+/* Define to 1 if you have the `iswctype' function or macro. */
+#define HAVE_ISWCTYPE 1
+
+/* Define to 1 if you have the `iswlower' function or macro. */
+#define HAVE_ISWLOWER 1
+
+/* Define to 1 if you have the `iswupper' function or macro. */
+#define HAVE_ISWUPPER 1
+
+/* Define to 1 if you have the <libutf8.h> header file. */
+/* #undef HAVE_LIBUTF8_H */
+
+/* Define to 1 if you have the `mbrtowc' function or macro. */
+#define HAVE_MBRTOWC 1
+
+/* Define to 1 if the system has the type `mbstate_t'. */
+#define HAVE_MBSTATE_T 1
+
+/* Define to 1 if you have the `mbtowc' function or macro. */
+#define HAVE_MBTOWC 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <regex.h> header file. */
+#define HAVE_REGEX_H 1
+
+/* Define to 1 if the system has the type `reg_errcode_t'. */
+/* #undef HAVE_REG_ERRCODE_T */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `towlower' function or macro. */
+#define HAVE_TOWLOWER 1
+
+/* Define to 1 if you have the `towupper' function or macro. */
+#define HAVE_TOWUPPER 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define to 1 if the system has the type `wchar_t'. */
+#define HAVE_WCHAR_T 1
+
+/* Define to 1 if you have the `wcschr' function or macro. */
+#define HAVE_WCSCHR 1
+
+/* Define to 1 if you have the `wcscpy' function or macro. */
+#define HAVE_WCSCPY 1
+
+/* Define to 1 if you have the `wcslen' function or macro. */
+#define HAVE_WCSLEN 1
+
+/* Define to 1 if you have the `wcsncpy' function or macro. */
+#define HAVE_WCSNCPY 1
+
+/* Define to 1 if you have the `wcsrtombs' function or macro. */
+#define HAVE_WCSRTOMBS 1
+
+/* Define to 1 if you have the `wcstombs' function or macro. */
+#define HAVE_WCSTOMBS 1
+
+/* Define to 1 if you have the `wctype' function or macro. */
+#define HAVE_WCTYPE 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+/* Define to 1 if the system has the type `wint_t'. */
+#define HAVE_WINT_T 1
+
+/* Define if you want to disable debug assertions. */
+#define NDEBUG 1
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "tre"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "tre-general@lists.laurikari.net"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "TRE"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "TRE 0.8.0"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "tre"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.8.0"
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at runtime.
+	STACK_DIRECTION > 0 => grows toward higher addresses
+	STACK_DIRECTION < 0 => grows toward lower addresses
+	STACK_DIRECTION = 0 => direction of growth unknown */
+/* #undef STACK_DIRECTION */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you want to enable approximate matching functionality. */
+#define TRE_APPROX 1
+
+/* Define if you want TRE to print debug messages to stdout. */
+/* #undef TRE_DEBUG */
+
+/* Define to enable multibyte character set support. */
+#define TRE_MULTIBYTE 1
+
+/* Define to a field in the regex_t struct where TRE should store a pointer to
+   the internal tre_tnfa_t structure */
+#define TRE_REGEX_T_FIELD re_g
+
+/* Define to the absolute path to the system regex.h */
+/* #undef TRE_SYSTEM_REGEX_H_PATH */
+
+/* Define if you want TRE to use alloca() instead of malloc() when allocating
+   memory needed for regexec operations. */
+#define TRE_USE_ALLOCA 1
+
+/* Define to include the system regex.h from TRE regex.h */
+/* #undef TRE_USE_SYSTEM_REGEX_H */
+
+/* TRE version string. */
+#define TRE_VERSION "0.8.0"
+
+/* TRE version level 1. */
+#define TRE_VERSION_1 0
+
+/* TRE version level 2. */
+#define TRE_VERSION_2 8
+
+/* TRE version level 3. */
+#define TRE_VERSION_3 0
+
+/* Define to enable wide character (wchar_t) support. */
+#define TRE_WCHAR 1
+
+/* Version number of package */
+#define VERSION "0.8.0"
+
+/* Define to the maximum value of wchar_t if not already defined elsewhere */
+/* #undef WCHAR_MAX */
+
+/* Define if wchar_t is signed */
+#define WCHAR_T_SIGNED 1
+
+/* Define if wchar_t is unsigned */
+/* #undef WCHAR_T_UNSIGNED */
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to enable GNU extensions in glibc */
+#define _GNU_SOURCE 1
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define on IRIX */
+/* #undef _REGCOMP_INTERNAL */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tre/include/tre-config.h	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,44 @@
+/* lib/tre-config.h.  Generated from tre-config.h.in by configure.  */
+/* tre-config.h.in.  This file has all definitions that are needed in
+   `tre.h'.  Note that this file must contain only the bare minimum
+   of definitions without the TRE_ prefix to avoid conflicts between
+   definitions here and definitions included from somewhere else. */
+
+/* Define to 1 if you have the <libutf8.h> header file. */
+/* #undef HAVE_LIBUTF8_H */
+
+/* Define to 1 if the system has the type `reg_errcode_t'. */
+/* #undef HAVE_REG_ERRCODE_T */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define if you want to enable approximate matching functionality. */
+#define TRE_APPROX 1
+
+/* Define to enable multibyte character set support. */
+#define TRE_MULTIBYTE 1
+
+/* Define to the absolute path to the system tre.h */
+/* #undef TRE_SYSTEM_REGEX_H_PATH */
+
+/* Define to include the system regex.h from tre.h */
+/* #undef TRE_USE_SYSTEM_REGEX_H */
+
+/* Define to enable wide character (wchar_t) support. */
+#define TRE_WCHAR 1
+
+/* TRE version string. */
+#define TRE_VERSION "0.8.0"
+
+/* TRE version level 1. */
+#define TRE_VERSION_1 0
+
+/* TRE version level 2. */
+#define TRE_VERSION_2 8
+
+/* TRE version level 3. */
+#define TRE_VERSION_3 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tre/lib/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,26 @@
+#	$NetBSD: Makefile,v 1.2.2.2 2011/11/10 14:31:25 yamt Exp $
+
+# for information:
+# the configure script is run as:
+#	./configure --prefix=/usr --without-alloca
+
+.include <bsd.own.mk>
+TREDIST=	${.CURDIR}/../dist
+
+# external tre sources
+.PATH: ${TREDIST}/lib
+
+CPPFLAGS+=	-I${.CURDIR}
+
+LIB=	tre
+
+SRCS+=	regcomp.c regerror.c regexec.c
+SRCS+=	tre-ast.c tre-compile.c tre-match-approx.c
+SRCS+=	tre-match-backtrack.c tre-match-parallel.c tre-mem.c
+SRCS+=	tre-parse.c tre-stack.c xmalloc.c
+
+WARNS=	4
+
+.include <bsd.lib.mk>
+
+CFLAGS+=	-Wno-stack-protector
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tre/lib/shlib_version	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,2 @@
+major=0
+minor=8
--- a/external/bsd/tre/libtre/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#	$NetBSD: Makefile,v 1.1 2010/02/25 07:46:14 agc Exp $
-
-# for information:
-# the configure script is run as:
-#	./configure --prefix=/usr --without-alloca
-
-TREDIST=	${.CURDIR}/../dist
-
-# external tre sources
-.PATH: ${TREDIST}/lib
-
-CPPFLAGS+=	-I${TREDIST} -I${TREDIST}/lib -I${.CURDIR}
-CPPFLAGS+=	-DHAVE_CONFIG_H=1
-
-LIB=	tre
-
-SRCS+=	regcomp.c regerror.c regexec.c
-SRCS+=	tre-ast.c tre-compile.c tre-match-approx.c
-SRCS+=	tre-match-backtrack.c tre-match-parallel.c tre-mem.c
-SRCS+=	tre-parse.c tre-stack.c xmalloc.c
-
-WARNS=	4
-
-.include <bsd.lib.mk>
--- a/external/bsd/tre/libtre/config.h	Sun Nov 06 22:05:00 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/* config.h.  Generated from config.h.in by configure.  */
-/* config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
-   systems. This function is required for `alloca.c' support on those systems.
-   */
-/* #undef CRAY_STACKSEG_END */
-
-/* Define to 1 if using `alloca.c'. */
-/* #undef C_ALLOCA */
-
-/* Define to 1 if translation of program messages to the user's native
-   language is requested. */
-/* #undef ENABLE_NLS */
-
-/* Define to 1 if you have `alloca', as a function or macro. */
-/* #undef HAVE_ALLOCA */
-
-/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
-   */
-/* #undef HAVE_ALLOCA_H */
-
-/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
-   CoreFoundation framework. */
-/* #undef HAVE_CFLOCALECOPYCURRENT */
-
-/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
-   the CoreFoundation framework. */
-/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
-
-/* Define if the GNU dcgettext() function is already present or preinstalled.
-   */
-/* #undef HAVE_DCGETTEXT */
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if you have the <getopt.h> header file. */
-#define HAVE_GETOPT_H 1
-
-/* Define to 1 if you have the `getopt_long' function. */
-#define HAVE_GETOPT_LONG 1
-
-/* Define if the GNU gettext() function is already present or preinstalled. */
-/* #undef HAVE_GETTEXT */
-
-/* Define if you have the iconv() function and it works. */
-#define HAVE_ICONV 1
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-/* #undef HAVE_INTTYPES_H */
-
-/* Define to 1 if you have the `isascii' function. */
-#define HAVE_ISASCII 1
-
-/* Define to 1 if you have the `isblank' function. */
-#define HAVE_ISBLANK 1
-
-/* Define to 1 if you have the `iswascii' function or macro. */
-/* #undef HAVE_ISWASCII */
-
-/* Define to 1 if you have the `iswblank' function or macro. */
-#define HAVE_ISWBLANK 1
-
-/* Define to 1 if you have the `iswctype' function or macro. */
-#define HAVE_ISWCTYPE 1
-
-/* Define to 1 if you have the `iswlower' function or macro. */
-#define HAVE_ISWLOWER 1
-
-/* Define to 1 if you have the `iswupper' function or macro. */
-#define HAVE_ISWUPPER 1
-
-/* Define to 1 if you have the <libutf8.h> header file. */
-/* #undef HAVE_LIBUTF8_H */
-
-/* Define to 1 if you have the `mbrtowc' function or macro. */
-#define HAVE_MBRTOWC 1
-
-/* Define to 1 if the system has the type `mbstate_t'. */
-#define HAVE_MBSTATE_T 1
-
-/* Define to 1 if you have the `mbtowc' function or macro. */
-/* #undef HAVE_MBTOWC */
-
-/* Define to 1 if you have the <memory.h> header file. */
-/* #undef HAVE_MEMORY_H */
-
-/* Define to 1 if you have the <regex.h> header file. */
-/* #undef HAVE_REGEX_H */
-
-/* Define to 1 if the system has the type `reg_errcode_t'. */
-/* #undef HAVE_REG_ERRCODE_T */
-
-/* Define to 1 if you have the <stdint.h> header file. */
-/* #undef HAVE_STDINT_H */
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-/* #undef HAVE_STDLIB_H */
-
-/* Define to 1 if you have the <strings.h> header file. */
-/* #undef HAVE_STRINGS_H */
-
-/* Define to 1 if you have the <string.h> header file. */
-/* #undef HAVE_STRING_H */
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-/* #undef HAVE_SYS_STAT_H */
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-/* #undef HAVE_SYS_TYPES_H */
-
-/* Define to 1 if you have the `towlower' function or macro. */
-#define HAVE_TOWLOWER 1
-
-/* Define to 1 if you have the `towupper' function or macro. */
-#define HAVE_TOWUPPER 1
-
-/* Define to 1 if you have the <unistd.h> header file. */
-/* #undef HAVE_UNISTD_H */
-
-/* Define to 1 if you have the <wchar.h> header file. */
-#define HAVE_WCHAR_H 1
-
-/* Define to 1 if the system has the type `wchar_t'. */
-#define HAVE_WCHAR_T 1
-
-/* Define to 1 if you have the `wcschr' function or macro. */
-#define HAVE_WCSCHR 1
-
-/* Define to 1 if you have the `wcscpy' function or macro. */
-#define HAVE_WCSCPY 1
-
-/* Define to 1 if you have the `wcslen' function or macro. */
-#define HAVE_WCSLEN 1
-
-/* Define to 1 if you have the `wcsncpy' function or macro. */
-#define HAVE_WCSNCPY 1
-
-/* Define to 1 if you have the `wcsrtombs' function or macro. */
-#define HAVE_WCSRTOMBS 1
-
-/* Define to 1 if you have the `wcstombs' function or macro. */
-/* #undef HAVE_WCSTOMBS */
-
-/* Define to 1 if you have the `wctype' function or macro. */
-#define HAVE_WCTYPE 1
-
-/* Define to 1 if you have the <wctype.h> header file. */
-#define HAVE_WCTYPE_H 1
-
-/* Define to 1 if the system has the type `wint_t'. */
-#define HAVE_WINT_T 1
-
-/* Define if you want to disable debug assertions. */
-#define NDEBUG 1
-
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-/* #undef NO_MINUS_C_MINUS_O */
-
-/* Name of package */
-#define PACKAGE "tre"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "tre-general@lists.laurikari.net"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "TRE"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "TRE 0.8.0"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "tre"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "0.8.0"
-
-/* If using the C implementation of alloca, define if you know the
-   direction of stack growth for your system; otherwise it will be
-   automatically deduced at runtime.
-	STACK_DIRECTION > 0 => grows toward higher addresses
-	STACK_DIRECTION < 0 => grows toward lower addresses
-	STACK_DIRECTION = 0 => direction of growth unknown */
-/* #undef STACK_DIRECTION */
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* Define if you want to enable approximate matching functionality. */
-#define TRE_APPROX 1
-
-/* Define if you want TRE to print debug messages to stdout. */
-/* #undef TRE_DEBUG */
-
-/* Define to enable multibyte character set support. */
-#define TRE_MULTIBYTE 1
-
-/* Define to a field in the regex_t struct where TRE should store a pointer to
-   the internal tre_tnfa_t structure */
-#define TRE_REGEX_T_FIELD value
-
-/* Define to the absolute path to the system regex.h */
-/* #undef TRE_SYSTEM_REGEX_H_PATH */
-
-/* Define if you want TRE to use alloca() instead of malloc() when allocating
-   memory needed for regexec operations. */
-/* #undef TRE_USE_ALLOCA */
-
-/* Define to include the system regex.h from TRE regex.h */
-/* #undef TRE_USE_SYSTEM_REGEX_H */
-
-/* TRE version string. */
-#define TRE_VERSION "0.8.0"
-
-/* TRE version level 1. */
-#define TRE_VERSION_1 0
-
-/* TRE version level 2. */
-#define TRE_VERSION_2 8
-
-/* TRE version level 3. */
-#define TRE_VERSION_3 0
-
-/* Define to enable wide character (wchar_t) support. */
-#define TRE_WCHAR 1
-
-/* Version number of package */
-#define VERSION "0.8.0"
-
-/* Define to the maximum value of wchar_t if not already defined elsewhere */
-/* #undef WCHAR_MAX */
-
-/* Define if wchar_t is signed */
-/* #undef WCHAR_T_SIGNED */
-
-/* Define if wchar_t is unsigned */
-/* #undef WCHAR_T_UNSIGNED */
-
-/* Number of bits in a file offset, on hosts where this is settable. */
-/* #undef _FILE_OFFSET_BITS */
-
-/* Define to enable GNU extensions in glibc */
-#define _GNU_SOURCE 1
-
-/* Define for large files, on AIX-style hosts. */
-/* #undef _LARGE_FILES */
-
-/* Define on IRIX */
-/* #undef _REGCOMP_INTERNAL */
-
-/* Define to empty if `const' does not conform to ANSI C. */
-/* #undef const */
-
-/* Define to `__inline__' or `__inline' if that's what the C compiler
-   calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
--- a/external/bsd/tre/libtre/shlib_version	Sun Nov 06 22:05:00 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-major=0
-minor=8
--- a/external/bsd/tre/libtre/tre-config.h	Sun Nov 06 22:05:00 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* lib/tre-config.h.  Generated from tre-config.h.in by configure.  */
-/* tre-config.h.in.  This file has all definitions that are needed in
-   `tre.h'.  Note that this file must contain only the bare minimum
-   of definitions without the TRE_ prefix to avoid conflicts between
-   definitions here and definitions included from somewhere else. */
-
-/* Define to 1 if you have the <libutf8.h> header file. */
-/* #undef HAVE_LIBUTF8_H */
-
-/* Define to 1 if the system has the type `reg_errcode_t'. */
-/* #undef HAVE_REG_ERRCODE_T */
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-/* #undef HAVE_SYS_TYPES_H */
-
-/* Define to 1 if you have the <wchar.h> header file. */
-#define HAVE_WCHAR_H 1
-
-/* Define if you want to enable approximate matching functionality. */
-#define TRE_APPROX 1
-
-/* Define to enable multibyte character set support. */
-#define TRE_MULTIBYTE 1
-
-/* Define to the absolute path to the system tre.h */
-/* #undef TRE_SYSTEM_REGEX_H_PATH */
-
-/* Define to include the system regex.h from tre.h */
-/* #undef TRE_USE_SYSTEM_REGEX_H */
-
-/* Define to enable wide character (wchar_t) support. */
-#define TRE_WCHAR 1
-
-/* TRE version string. */
-#define TRE_VERSION "0.8.0"
-
-/* TRE version level 1. */
-#define TRE_VERSION_1 0
-
-/* TRE version level 2. */
-#define TRE_VERSION_2 8
-
-/* TRE version level 3. */
-#define TRE_VERSION_3 0
--- a/external/gpl3/gcc/dist/gcc/unwind-dw2-fde.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/gpl3/gcc/dist/gcc/unwind-dw2-fde.c	Thu Nov 10 14:31:09 2011 +0000
@@ -209,7 +209,9 @@
 
  out:
   __gthread_mutex_unlock (&object_mutex);
+#if 0
   gcc_assert (ob);
+#endif
   return (void *) ob;
 }
 
--- a/external/gpl3/gcc/usr.bin/backend/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/gpl3/gcc/usr.bin/backend/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.12 2011/07/21 03:01:26 mrg Exp $
+#	$NetBSD: Makefile,v 1.12.2.1 2011/11/10 14:31:25 yamt Exp $
 
 LIBISPRIVATE=	yes
 
@@ -163,6 +163,8 @@
 	HEADERS="$(G_tm_p_include_list)" DEFINES="" \
 	${HOST_SH} ${GNUHOSTDIST}/gcc/mkconfig.sh ${.TARGET}
 
+${G_OBJS} ${G_OBJS:.o=.d}:	tm_p.h		# XXX crude
+
 CLEANFILES+=	options.h options.c optionlist
 optionlist: ${G_ALL_OPT_FILES} ${GCCARCH}/defs.mk Makefile ${DIST}/gcc/opt-gather.awk
 	${TOOL_AWK} -f ${DIST}/gcc/opt-gather.awk ${G_ALL_OPT_FILES} > ${.TARGET}
@@ -305,6 +307,10 @@
 gtype-desc.d gtype-desc.o: insn-constants.h
 insn-emit.d insn-emit.o: tm-constrs.h
 
+.if ${MACHINE_ARCH} == "alpha"
+alpha.d alpha.o: tm-constrs.h tm_p.h
+.endif
+
 .if ${MACHINE_CPU} == "arm"
 arm.d arm.o: insn-constants.h tm_p.h
 .endif
--- a/external/gpl3/gdb/bin/gdb/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/gpl3/gdb/bin/gdb/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.4 2011/10/12 03:57:45 mrg Exp $
+#	$NetBSD: Makefile,v 1.4.2.1 2011/11/10 14:31:25 yamt Exp $
 
 .include <bsd.own.mk>
 .include "../Makefile.inc"
@@ -31,7 +31,7 @@
 	${TOOL_CAT} ${.ALLSRC} > ${.TARGET}
 
 CLEANFILES+= GDBvn.texi gdb-cfg.texi
-gdb.info: gdb-cfg.texi GDBvn.texi
+gdbint.info stabs.info gdb.info: gdb-cfg.texi GDBvn.texi
 
 .include "../../Makefile.inc"
 .include <bsd.info.mk>
--- a/external/ibm-public/postfix/dist/HISTORY	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/ibm-public/postfix/dist/HISTORY	Thu Nov 10 14:31:09 2011 +0000
@@ -16681,3 +16681,17 @@
 	checks to unknown message subtypes such as message/global*.
 	File: global/mime_state.c.
 
+20111025
+
+	Workaround: postscreen sent non-compliant SMTP responses
+	(220- followed by 421) when it could not give a connection
+	to a real smtpd process, causing some remote SMTP clients
+	to bounce mail. The workaround is to hang up without sending
+	the 421 reply (which is harmless); the complete fix involves
+	too much change for a stable release.  Problem reported by
+	Ralf Hildebrandt.  File: postscreen/postscreen_send.c.
+
+20111102
+
+	Portability: OpenBSD 5.x is supported. Files: makedefs,
+	util/sys_defs.h.
--- a/external/ibm-public/postfix/dist/makedefs	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/ibm-public/postfix/dist/makedefs	Thu Nov 10 14:31:09 2011 +0000
@@ -152,6 +152,8 @@
 		;;
   OpenBSD.4*)	SYSTYPE=OPENBSD4
 		;;
+  OpenBSD.5*)	SYSTYPE=OPENBSD5
+		;;
   ekkoBSD.1*)	SYSTYPE=EKKOBSD1
 		;;
    NetBSD.1*)	SYSTYPE=NETBSD1
--- a/external/ibm-public/postfix/dist/src/global/mail_version.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/ibm-public/postfix/dist/src/global/mail_version.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: mail_version.h,v 1.1.1.11 2011/10/28 07:09:49 tron Exp $	*/
+/*	$NetBSD: mail_version.h,v 1.1.1.11.2.1 2011/11/10 14:31:26 yamt Exp $	*/
 
 #ifndef _MAIL_VERSION_H_INCLUDED_
 #define _MAIL_VERSION_H_INCLUDED_
@@ -22,8 +22,8 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE	"20111024"
-#define MAIL_VERSION_NUMBER	"2.8.6"
+#define MAIL_RELEASE_DATE	"20111105"
+#define MAIL_VERSION_NUMBER	"2.8.7"
 
 #ifdef SNAPSHOT
 # define MAIL_VERSION_DATE	"-" MAIL_RELEASE_DATE
--- a/external/ibm-public/postfix/dist/src/postscreen/postscreen_send.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/ibm-public/postfix/dist/src/postscreen/postscreen_send.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: postscreen_send.c,v 1.1.1.1 2011/03/02 19:32:26 tron Exp $	*/
+/*	$NetBSD: postscreen_send.c,v 1.1.1.1.6.1 2011/11/10 14:31:26 yamt Exp $	*/
 
 /*++
 /* NAME
@@ -189,7 +189,9 @@
 	 PASS_CONNECT(psc_smtpd_service_name, NON_BLOCKING,
 		      PSC_SEND_SOCK_CONNECT_TIMEOUT)) < 0) {
 	msg_warn("cannot connect to service %s: %m", psc_smtpd_service_name);
-	PSC_SEND_REPLY(state, "421 4.3.2 All server ports are busy\r\n");
+	/* Best effort: after sending 220-, hang up without sending 421. */
+	if ((state->flags & PSC_STATE_FLAG_PREGR_TODO) == 0)
+	    PSC_SEND_REPLY(state, "421 4.3.2 All server ports are busy\r\n");
 	psc_free_session_state(state);
 	return;
     }
@@ -198,7 +200,9 @@
 		      vstream_fileno(state->smtp_client_stream)) < 0) {
 	msg_warn("cannot pass connection to service %s: %m",
 		 psc_smtpd_service_name);
-	PSC_SEND_REPLY(state, "421 4.3.2 No system resources\r\n");
+	/* Best effort: after sending 220-, hang up without sending 421. */
+	if ((state->flags & PSC_STATE_FLAG_PREGR_TODO) == 0)
+	    PSC_SEND_REPLY(state, "421 4.3.2 No system resources\r\n");
 	psc_free_session_state(state);
 	return;
     } else {
--- a/external/ibm-public/postfix/dist/src/util/sys_defs.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/ibm-public/postfix/dist/src/util/sys_defs.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_defs.h,v 1.1.1.6 2011/07/31 10:03:06 tron Exp $	*/
+/*	$NetBSD: sys_defs.h,v 1.1.1.6.2.1 2011/11/10 14:31:26 yamt Exp $	*/
 
 #ifndef _SYS_DEFS_H_INCLUDED_
 #define _SYS_DEFS_H_INCLUDED_
@@ -30,6 +30,7 @@
     || defined(FREEBSD8) \
     || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
     || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \
+    || defined(OPENBSD5) \
     || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \
     || defined(NETBSD4) \
     || defined(EKKOBSD1)
@@ -1275,6 +1276,7 @@
  /*
   * Defaults for systems that pre-date IPv6 support.
   */
+#ifndef __NetBSD__
 #ifndef HAS_IPV6
 #define EMULATE_IPV4_ADDRINFO
 #define MISSING_INET_PTON
@@ -1283,6 +1285,7 @@
 extern int inet_pton(int, const char *, void *);
 
 #endif
+#endif
 
  /*
   * Workaround: after a watchdog alarm signal, wake up from select/poll/etc.
--- a/external/public-domain/sqlite/dist/sqlite3.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/external/public-domain/sqlite/dist/sqlite3.c	Thu Nov 10 14:31:09 2011 +0000
@@ -7615,10 +7615,19 @@
 # define SQLITE_OMIT_TRACE 1
 # undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
 # undef SQLITE_HAVE_ISNAN
+#else
+# ifdef __vax__
+#  include <float.h>
+#  define SQLITE_BIG_DBL DBL_MAX
+#  define SQLITE_HUGE_DBL DBL_MAX
+# endif
 #endif
 #ifndef SQLITE_BIG_DBL
 # define SQLITE_BIG_DBL (1e99)
 #endif
+#ifndef SQLITE_HUGE_DBL
+# define SQLITE_HUGE_DBL (1.0e+308)
+#endif
 
 /*
 ** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
@@ -21000,10 +21009,10 @@
         while( e%308 ) { scale *= 1.0e+1; e -= 1; }
         if( esign<0 ){
           result = s / scale;
-          result /= 1.0e+308;
+          result /= SQLITE_HUGE_DBL;
         }else{
           result = s * scale;
-          result *= 1.0e+308;
+          result *= SQLITE_HUGE_DBL;
         }
       }else{
         /* 1.0e+22 is the largest power of 10 than can be 
@@ -130632,7 +130641,7 @@
 **    May you share freely, never taking more than you give.
 **
 *************************************************************************
-** $Id: sqlite3.c,v 1.1.1.1 2011/10/13 21:38:52 joerg Exp $
+** $Id: sqlite3.c,v 1.1.1.1.2.1 2011/11/10 14:31:27 yamt Exp $
 **
 ** This file implements an integration between the ICU library 
 ** ("International Components for Unicode", an open-source library 
--- a/games/factor/factor.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/games/factor/factor.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: factor.c,v 1.25 2011/05/23 22:49:59 joerg Exp $	*/
+/*	$NetBSD: factor.c,v 1.25.4.1 2011/11/10 14:31:35 yamt Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)factor.c	8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: factor.c,v 1.25 2011/05/23 22:49:59 joerg Exp $");
+__RCSID("$NetBSD: factor.c,v 1.25.4.1 2011/11/10 14:31:35 yamt Exp $");
 #endif
 #endif /* not lint */
 
@@ -82,9 +82,6 @@
 #define BN_new()		((BIGNUM *)calloc(sizeof(BIGNUM), 1))
 #define BN_is_zero(v)		(*(v) == 0)
 #define BN_is_one(v)		(*(v) == 1)
-#define BN_new()		((BIGNUM *)calloc(sizeof(BIGNUM), 1))
-#define BN_is_zero(v)		(*(v) == 0)
-#define BN_is_one(v)		(*(v) == 1)
 #define BN_mod_word(a, b)	(*(a) % (b))
 #endif
 
--- a/gnu/dist/gcc4/gcc/config/arm/arm.md	Sun Nov 06 22:05:00 2011 +0000
+++ b/gnu/dist/gcc4/gcc/config/arm/arm.md	Thu Nov 10 14:31:09 2011 +0000
@@ -9338,109 +9338,13 @@
    (set_attr "length" "4,8,8")]
 )
 
-(define_insn "*arith_adjacentmem"
-  [(set (match_operand:SI 0 "s_register_operand" "=r")
-	(match_operator:SI 1 "shiftable_operator"
-	 [(match_operand:SI 2 "memory_operand" "m")
-	  (match_operand:SI 3 "memory_operand" "m")]))
-   (clobber (match_scratch:SI 4 "=r"))]
-  "TARGET_ARM && adjacent_mem_locations (operands[2], operands[3])"
-  "*
-  {
-    rtx ldm[3];
-    rtx arith[4];
-    rtx base_reg;
-    HOST_WIDE_INT val1 = 0, val2 = 0;
-
-    if (REGNO (operands[0]) > REGNO (operands[4]))
-      {
-	ldm[1] = operands[4];
-	ldm[2] = operands[0];
-      }
-    else
-      {
-	ldm[1] = operands[0];
-	ldm[2] = operands[4];
-      }
-
-    base_reg = XEXP (operands[2], 0);
-
-    if (!REG_P (base_reg))
-      {
-	val1 = INTVAL (XEXP (base_reg, 1));
-	base_reg = XEXP (base_reg, 0);
-      }
-
-    if (!REG_P (XEXP (operands[3], 0)))
-      val2 = INTVAL (XEXP (XEXP (operands[3], 0), 1));
-
-    arith[0] = operands[0];
-    arith[3] = operands[1];
-
-    if (val1 < val2)
-      {
-	arith[1] = ldm[1];
-	arith[2] = ldm[2];
-      }
-    else
-      {
-	arith[1] = ldm[2];
-	arith[2] = ldm[1];
-      }
-
-    ldm[0] = base_reg;
-    if (val1 !=0 && val2 != 0)
-      {
-	rtx ops[3];
-
-	if (val1 == 4 || val2 == 4)
-	  /* Other val must be 8, since we know they are adjacent and neither
-	     is zero.  */
-	  output_asm_insn (\"ldm%?ib\\t%0, {%1, %2}\", ldm);
-	else if (const_ok_for_arm (val1) || const_ok_for_arm (-val1))
-	  {
-	    ldm[0] = ops[0] = operands[4];
-	    ops[1] = base_reg;
-	    ops[2] = GEN_INT (val1);
-	    output_add_immediate (ops);
-	    if (val1 < val2)
-	      output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
-	    else
-	      output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
-	  }
-	else
-	  {
-	    /* Offset is out of range for a single add, so use two ldr.  */
-	    ops[0] = ldm[1];
-	    ops[1] = base_reg;
-	    ops[2] = GEN_INT (val1);
-	    output_asm_insn (\"ldr%?\\t%0, [%1, %2]\", ops);
-	    ops[0] = ldm[2];
-	    ops[2] = GEN_INT (val2);
-	    output_asm_insn (\"ldr%?\\t%0, [%1, %2]\", ops);
-	  }
-      }
-    else if (val1 != 0)
-      {
-	if (val1 < val2)
-	  output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
-	else
-	  output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
-      }
-    else
-      {
-	if (val1 < val2)
-	  output_asm_insn (\"ldm%?ia\\t%0, {%1, %2}\", ldm);
-	else
-	  output_asm_insn (\"ldm%?da\\t%0, {%1, %2}\", ldm);
-      }
-    output_asm_insn (\"%I3%?\\t%0, %1, %2\", arith);
-    return \"\";
-  }"
-  [(set_attr "length" "12")
-   (set_attr "predicable" "yes")
-   (set_attr "type" "load1")]
-)
+
+;-----
+;arith_adjacentmem removed as a quick fix, suggested by rearnsha@
+;broken at least in gcc 4.1.3 - 4.4
+;known fixed in 4.5.3 (is@)
+;known fixed in post-4.6 trunk (rearnsha@)
+;-----
 
 ; This pattern is never tried by combine, so do it as a peephole
 
--- a/gnu/dist/gcc4/gcc/version.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/gnu/dist/gcc4/gcc/version.c	Thu Nov 10 14:31:09 2011 +0000
@@ -8,7 +8,7 @@
    in parentheses.  You may also wish to include a number indicating
    the revision of your modified compiler.  */
 
-#define VERSUFFIX " (NetBSD nb2 20081120)"
+#define VERSUFFIX " (NetBSD nb3 20111107)"
 
 /* This is the location of the online document giving instructions for
    reporting bugs.  If you distribute a modified version of GCC,
--- a/include/setjmp.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/include/setjmp.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.h,v 1.25 2009/08/12 04:57:36 matt Exp $	*/
+/*	$NetBSD: setjmp.h,v 1.25.8.1 2011/11/10 14:31:36 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -62,18 +62,18 @@
 
 __BEGIN_DECLS
 #ifndef __LIBC12_SOURCE__
-int	setjmp(jmp_buf)			 __RENAME(__setjmp14);
+int	setjmp(jmp_buf)			 __RENAME(__setjmp14) __returns_twice;
 void	longjmp(jmp_buf, int)		 __RENAME(__longjmp14) __dead;
 
 #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
     defined(_NETBSD_SOURCE)
-int	sigsetjmp(sigjmp_buf, int)	__RENAME(__sigsetjmp14);
+int	sigsetjmp(sigjmp_buf, int)	__RENAME(__sigsetjmp14) __returns_twice;
 void	siglongjmp(sigjmp_buf, int)	 __RENAME(__siglongjmp14) __dead;
 #endif /* not ANSI */
 #endif /* __LIBC12_SOURCE__ */
 
 #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-int	_setjmp(jmp_buf);
+int	_setjmp(jmp_buf) __returns_twice;
 void	_longjmp(jmp_buf, int) __dead;
 #endif
 
--- a/include/ucontext.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/include/ucontext.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucontext.h,v 1.6 2009/03/19 08:04:38 uebayasi Exp $	*/
+/*	$NetBSD: ucontext.h,v 1.6.8.1 2011/11/10 14:31:36 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include <sys/ucontext.h>
 
 __BEGIN_DECLS
-int	getcontext(ucontext_t *);
+int	getcontext(ucontext_t *) __returns_twice;
 int	setcontext(const ucontext_t *);
 void	makecontext(ucontext_t *, void (*)(), int, ...);
 int	swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict);
--- a/include/unistd.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/include/unistd.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: unistd.h,v 1.127 2011/08/08 12:08:53 manu Exp $	*/
+/*	$NetBSD: unistd.h,v 1.127.2.1 2011/11/10 14:31:36 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -274,7 +274,7 @@
 useconds_t ualarm(useconds_t, useconds_t);
 int	 usleep(useconds_t);
 #ifndef __LIBC12_SOURCE__
-pid_t	 vfork(void) __RENAME(__vfork14);
+pid_t	 vfork(void) __RENAME(__vfork14) __returns_twice;
 #endif
 
 #ifndef __AUDIT__
--- a/lib/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.179 2011/10/13 22:08:20 joerg Exp $
+#	$NetBSD: Makefile,v 1.179.2.1 2011/11/10 14:31:36 yamt Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include <bsd.own.mk>
@@ -58,6 +58,7 @@
 .endif
 
 SUBDIR+=	../external/bsd/flex/lib
+SUBDIR+=	../external/bsd/tre/lib
 SUBDIR+=	../external/bsd/libdwarf/lib
 SUBDIR+=	../external/bsd/libelf/lib
 SUBDIR+=	../external/bsd/libevent/lib
--- a/lib/libc/Makefile.inc	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/Makefile.inc	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.6 2010/05/30 08:28:53 tnozaki Exp $
+#	$NetBSD: Makefile.inc,v 1.6.6.1 2011/11/10 14:31:36 yamt Exp $
 #	@(#)Makefile	8.2 (Berkeley) 2/3/94
 #
 # All library objects contain sccsid strings by default; they may be
@@ -53,9 +53,6 @@
 
 ARCHDIR=	${.CURDIR}/arch/${ARCHSUBDIR}
 AFLAGS+=	-I${ARCHDIR}
-.if defined(DESTDIR)
-AFLAGS+=	-nostdinc -isystem ${DESTDIR}/usr/include
-.endif
 CLEANFILES+=	tags
 
 # Don't try to lint the C library against itself when creating llib-lc.ln
--- a/lib/libc/compat/include/setjmp.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/compat/include/setjmp.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: setjmp.h,v 1.1 2005/09/13 01:44:09 christos Exp $	*/
+/*	$NetBSD: setjmp.h,v 1.1.44.1 2011/11/10 14:31:36 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -40,11 +40,11 @@
 #define _COMPAT_SETJMP_H_
 
 __BEGIN_DECLS
-int	__setjmp14(jmp_buf);
-void	__longjmp14(jmp_buf, int) __attribute__((__noreturn__));
+int	__setjmp14(jmp_buf) __returns_twice;
+void	__longjmp14(jmp_buf, int) __dead;
 
-int	__sigsetjmp14(sigjmp_buf, int);
-void	__siglongjmp14(sigjmp_buf, int) __attribute__((__noreturn__));
+int	__sigsetjmp14(sigjmp_buf, int) __returns_twice;
+void	__siglongjmp14(sigjmp_buf, int) __dead;
 __END_DECLS
 
 #endif /* !_COMPAT_SETJMP_H_ */
--- a/lib/libc/gen/cpuset.3	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/gen/cpuset.3	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\"	$NetBSD: cpuset.3,v 1.5 2011/11/02 13:05:43 yamt Exp $
+.\"	$NetBSD: cpuset.3,v 1.5.2.1 2011/11/10 14:31:36 yamt Exp $
 .\"
 .\" Copyright (c) 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd Nomember 2, 2011
+.Dd November 2, 2011
 .Dt CPUSET 3
 .Os
 .Sh NAME
--- a/lib/libc/gen/time.3	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/gen/time.3	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\"	$NetBSD: time.3,v 1.15 2010/04/24 01:35:50 dholland Exp $
+.\"	$NetBSD: time.3,v 1.15.6.1 2011/11/10 14:31:36 yamt Exp $
 .\"
 .\" Copyright (c) 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -33,7 +33,7 @@
 .\"
 .\"     @(#)time.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd April 23, 2010
+.Dd November 5, 2011
 .Dt TIME 3
 .Os
 .Sh NAME
@@ -72,12 +72,7 @@
 .Va errno
 is set to indicate the error.
 .Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.It Bq Er EFAULT
-An argument address referenced invalid memory.
-.El
+No errors are defined.
 .Sh SEE ALSO
 .Xr gettimeofday 2 ,
 .Xr ctime 3
--- a/lib/libc/gen/unvis.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/gen/unvis.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: unvis.c,v 1.36 2011/03/18 09:07:20 martin Exp $	*/
+/*	$NetBSD: unvis.c,v 1.36.4.1 2011/11/10 14:31:36 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)unvis.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: unvis.c,v 1.36 2011/03/18 09:07:20 martin Exp $");
+__RCSID("$NetBSD: unvis.c,v 1.36.4.1 2011/11/10 14:31:36 yamt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -63,18 +63,19 @@
 #define	S_CTRL		4	/* control char started (^) */
 #define	S_OCTAL2	5	/* octal digit 2 */
 #define	S_OCTAL3	6	/* octal digit 3 */
-#define	S_HEX1		7	/* http hex digit */
-#define	S_HEX2		8	/* http hex digit 2 */
-#define S_MIME1		9	/* mime hex digit 1 */
-#define S_MIME2		10	/* mime hex digit 2 */
-#define S_EATCRNL	11	/* mime eating CRNL */
-#define S_AMP		12	/* seen & */
-#define S_NUMBER	13	/* collecting number */
-#define S_STRING	14	/* collecting string */
+#define	S_HEX		7	/* mandatory hex digit */
+#define	S_HEX1		8	/* http hex digit */
+#define	S_HEX2		9	/* http hex digit 2 */
+#define	S_MIME1		10	/* mime hex digit 1 */
+#define	S_MIME2		11	/* mime hex digit 2 */
+#define	S_EATCRNL	12	/* mime eating CRNL */
+#define	S_AMP		13	/* seen & */
+#define	S_NUMBER	14	/* collecting number */
+#define	S_STRING	15	/* collecting string */
 
 #define	isoctal(c)	(((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
-#define xtod(c)		(isdigit(c) ? (c - '0') : ((tolower(c) - 'a') + 10))
-#define XTOD(c)		(isdigit(c) ? (c - '0') : ((c - 'A') + 10))
+#define	xtod(c)		(isdigit(c) ? (c - '0') : ((tolower(c) - 'a') + 10))
+#define	XTOD(c)		(isdigit(c) ? (c - '0') : ((c - 'A') + 10))
 
 /*
  * RFC 1866
@@ -297,6 +298,9 @@
 			*cp = '\033';
 			*astate = SS(0, S_GROUND);
 			return UNVIS_VALID;
+		case 'x':
+			*astate = SS(0, S_HEX);
+			return UNVIS_NOCHAR;
 		case '\n':
 			/*
 			 * hidden newline
@@ -360,6 +364,10 @@
 		 */
 		return UNVIS_VALIDPUSH;
 
+	case S_HEX:
+		if (!isxdigit(uc))
+			goto bad;
+		/*FALLTHROUGH*/
 	case S_HEX1:
 		if (isxdigit(uc)) {
 			*cp = xtod(uc);
--- a/lib/libc/regex/regcomp.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/regex/regcomp.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: regcomp.c,v 1.31 2011/10/09 22:14:17 christos Exp $	*/
+/*	$NetBSD: regcomp.c,v 1.31.2.1 2011/11/10 14:31:36 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -76,7 +76,7 @@
 #if 0
 static char sccsid[] = "@(#)regcomp.c	8.5 (Berkeley) 3/20/94";
 #else
-__RCSID("$NetBSD: regcomp.c,v 1.31 2011/10/09 22:14:17 christos Exp $");
+__RCSID("$NetBSD: regcomp.c,v 1.31.2.1 2011/11/10 14:31:36 yamt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -761,7 +761,6 @@
 {
 	cset *cs;
 	int invert = 0;
-
 	_DIAGASSERT(p != NULL);
 
 	cs = allocset(p);
@@ -1562,6 +1561,9 @@
 
 	_DIAGASSERT(g != NULL);
 
+	if (g->setbits == NULL)
+		return 0;
+
 	ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
 
 	for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
--- a/lib/libc/shlib_version	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/shlib_version	Thu Nov 10 14:31:09 2011 +0000
@@ -1,10 +1,11 @@
-#	$NetBSD: shlib_version,v 1.224 2011/09/18 23:57:06 christos Exp $
+#	$NetBSD: shlib_version,v 1.224.2.1 2011/11/10 14:31:36 yamt Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
 # - libc/net/rcmd.c: make __ivaliduser() and __ivaliduser_sa() static
 # - libc/net: resolver update to BIND8/9?
 # - md2, md4, md5, rmd160 & sha1 functions should take the same arguments AFAP
+# - Crypto hashes have name overlap with libcrypto, rename them
 # - libc/gen/assert.c: __{diag,}assert13() -> __{diag,}assert()
 # - libc/gen/times.c: remove; __times13() -> times()
 # - libc/gen/timezone.c: remove; __timezone13 -> timezone
--- a/lib/libc/time/ctime.3	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/time/ctime.3	Thu Nov 10 14:31:09 2011 +0000
@@ -1,8 +1,8 @@
-.\" $NetBSD: ctime.3,v 1.44 2011/10/27 14:47:59 christos Exp $
+.\" $NetBSD: ctime.3,v 1.44.2.1 2011/11/10 14:31:36 yamt Exp $
 .\"
 .\" XXX: License missing?
 .\"
-.Dd October 27, 2011
+.Dd November 2, 2011
 .Dt CTIME 3
 .Os
 .Sh NAME
@@ -101,7 +101,7 @@
 Years requiring fewer than four characters are padded with leading zeroes.
 For years longer than four characters, the string is of the form
 .Bd -literal -offset indent
-.D1 Thu Nov 24 18:22:48     81986\en\e0
+.D1 "Thu Nov 24 18:22:48     81986\en\e0"
 .Ed
 .Pp
 with five spaces before the year.
@@ -436,9 +436,11 @@
 Rest of the functions conform to
 .St -p1003.1-2008 .
 .Sh CAVEATS
-The return values point to static data; the data is overwritten by
+The functions that do not take an explicit
+.Ft timezone_t
+argument return values point to static data; the data is overwritten by
 each call.
-The
+For the above functions the
 .Fa tm_zone
 field of a returned
 .Va "struct tm"
@@ -446,6 +448,18 @@
 will also be overwritten at the next call
 (and by calls to
 .Xr tzset 3 ) .
+The functions that do take an explicit
+.Ft timezone_t
+argument and set the fields of a supplied
+.Va "struct tm"
+should not call
+.Fn tzfree
+since the
+.Fa tm_zone
+field of the
+.Va "struct tm"
+points to data allocated by
+.Fn tzalloc .
 .Pp
 The
 .Fn asctime
--- a/lib/libc/time/localtime.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libc/time/localtime.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: localtime.c,v 1.62 2011/10/28 21:51:06 christos Exp $	*/
+/*	$NetBSD: localtime.c,v 1.62.2.1 2011/11/10 14:31:37 yamt Exp $	*/
 
 /*
 ** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
 #if 0
 static char	elsieid[] = "@(#)localtime.c	8.17";
 #else
-__RCSID("$NetBSD: localtime.c,v 1.62 2011/10/28 21:51:06 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.62.2.1 2011/11/10 14:31:37 yamt Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -1802,6 +1802,9 @@
 
 	*okayp = FALSE;
 	yourtm = *tmp;
+#ifdef NO_ERROR_IN_DST_GAP
+again:
+#endif
 	if (do_norm_secs) {
 		if (normalize_overflow(&yourtm.tm_min, &yourtm.tm_sec,
 		    SECSPERMIN))
@@ -1919,25 +1922,20 @@
 				--hi;
 			}
 #ifdef NO_ERROR_IN_DST_GAP
-			if (ilo != lo && lo - 1 == hi && yourtm.tm_isdst < 0) {
-				time_t off = 0;
+			if (ilo != lo && lo - 1 == hi && yourtm.tm_isdst < 0 &&
+			    do_norm_secs) {
 				for (i = sp->typecnt - 1; i >= 0; --i) {
 					for (j = sp->typecnt - 1; j >= 0; --j) {
+						time_t off;
 						if (sp->ttis[j].tt_isdst ==
 						    sp->ttis[i].tt_isdst)
 							continue;
 						off = sp->ttis[j].tt_gmtoff -
 						    sp->ttis[i].tt_gmtoff;
-						break;
+						yourtm.tm_sec += off < 0 ?
+						    -off : off;
+						goto again;
 					}
-					if (j >= 0)
-						break;
-				}
-				if (off) {
-					t = hi;
-					if (off > 0)
-						t += off;
-					break;
 				}
 			}
 #endif
--- a/lib/libnpf/npf.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libnpf/npf.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.c,v 1.2 2011/02/02 15:17:37 rmind Exp $	*/
+/*	$NetBSD: npf.c,v 1.2.6.1 2011/11/10 14:31:37 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2010-2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.2 2011/02/02 15:17:37 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.2.6.1 2011/11/10 14:31:37 yamt Exp $");
 
 #include <sys/types.h>
 #include <netinet/in_systm.h>
@@ -429,18 +429,21 @@
 }
 
 int
-npf_table_add_entry(nl_table_t *tl, in_addr_t addr, in_addr_t mask)
+npf_table_add_entry(nl_table_t *tl, npf_addr_t *addr, npf_netmask_t mask)
 {
 	prop_dictionary_t tldict = tl->ntl_dict, entdict;
 	prop_array_t tblents;
+	prop_data_t addrdata;
 
 	/* Create the table entry. */
 	entdict = prop_dictionary_create();
 	if (entdict) {
 		return ENOMEM;
 	}
-	prop_dictionary_set_uint32(entdict, "addr", addr);
-	prop_dictionary_set_uint32(entdict, "mask", mask);
+	addrdata = prop_data_create_data(addr, sizeof(npf_addr_t));
+	prop_dictionary_set(entdict, "addr", addrdata);
+	prop_dictionary_set_uint8(entdict, "mask", mask);
+	prop_object_release(addrdata);
 
 	/* Insert the entry. */
 	tblents = prop_dictionary_get(tldict, "entries");
--- a/lib/libnpf/npf.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libnpf/npf.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf.h,v 1.1 2011/02/02 02:20:25 rmind Exp $	*/
+/*	$NetBSD: npf.h,v 1.1.6.1 2011/11/10 14:31:37 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
 int		npf_nat_insert(nl_config_t *, nl_nat_t *, pri_t);
 
 nl_table_t *	npf_table_create(int, int);
-int		npf_table_add_entry(nl_table_t *, in_addr_t, in_addr_t);
+int		npf_table_add_entry(nl_table_t *, npf_addr_t *, npf_netmask_t);
 bool		npf_table_exists_p(nl_config_t *, u_int);
 int		npf_table_insert(nl_config_t *, nl_table_t *);
 void		npf_table_destroy(nl_table_t *);
--- a/lib/libterminfo/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/libterminfo/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2011/11/02 12:09:25 roy Exp $
+#	$NetBSD: Makefile,v 1.18.2.1 2011/11/10 14:31:37 yamt Exp $
 
 .include <bsd.own.mk>
 
@@ -37,31 +37,12 @@
 
 CPPFLAGS+=	-I${.OBJDIR}
 
-# Generate our string and hash tables
-hash.c: genhash term.h
-		@echo "Generating terminfo hash"
-		cd ${.CURDIR} && ${HOST_SH} ./genhash >${.OBJDIR}/$@
-
-termcap_hash.c: genthash term.h
-		@echo "Generating termcap hash"
-		cd ${.CURDIR} && ${HOST_SH} ./genthash >${.OBJDIR}/$@
-
-
-# Allow terminfo descriptions to be compiled into libterminfo
-compiled_terms.c: genterms term.h ${NETBSDSRCDIR}/share/terminfo/terminfo
-		@echo "Generating compiled terminfo descriptions"
-		cd ${.CURDIR} && ${HOST_SH} ./genterms >${.OBJDIR}/$@
-
-CLEANFILES+=	hash.c termcap_hash.c compiled_terms.c
-
-term.c: compiled_terms.c
-
-termcap.c: termcap_hash.c
+.include <Makefile.hash>
 
 # Generate our man pages
-terminfo.5: terminfo.5.in term.h termcap_map.c
+terminfo.5: genman terminfo.5.in term.h termcap_map.c
 		@echo "Generating terminfo man pages"
-		cd ${.CURDIR} && ${HOST_SH} ./genman >${.OBJDIR}/$@
+		${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET}
 
 CLEANFILES+=	terminfo.5
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libterminfo/Makefile.hash	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,27 @@
+#	$NetBSD: Makefile.hash,v 1.4.2.2 2011/11/10 14:31:37 yamt Exp $
+
+SCRIPT_ENV=	\
+	TOOL_AWK=${TOOL_AWK:Q} \
+	TOOL_NBPERF=${TOOL_NBPERF:Q} \
+	TOOL_SED=${TOOL_SED:Q} \
+	TOOL_SORT=${TOOL_SORT:Q} \
+	TOOL_TIC=${TOOL_TIC:Q}
+
+PARSEDIR:=${.PARSEDIR}
+# Generate our string and hash tables
+hash.c: genhash term.h
+		@echo "Generating terminfo hash"
+		${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET}
+
+termcap_hash.c: genthash termcap_map.c
+		@echo "Generating termcap hash"
+		${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET}
+
+# Allow terminfo descriptions to be compiled into libterminfo
+compiled_terms.c: genterms term.h ${NETBSDSRCDIR}/share/terminfo/terminfo
+		@echo "Generating compiled terminfo descriptions"
+		${SCRIPT_ENV} ${HOST_SH} ${.ALLSRC} > ${.TARGET}
+
+DPSRCS+=	hash.c termcap_hash.c compiled_terms.c
+
+CLEANFILES+=	hash.c termcap_hash.c compiled_terms.c
--- a/lib/lua/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/lib/lua/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.4 2011/10/15 10:46:24 mbalmer Exp $
+#	$NetBSD: Makefile,v 1.4.2.1 2011/11/10 14:31:37 yamt Exp $
 
 .include <bsd.own.mk>
 
-.if ${MACHINE_ARCH} != "m68000"
+.if ${MKPIC} != "no"
 # No support for shared libraries and pic code.
 SUBDIR+=	gpio sqlite
 .endif
--- a/share/man/man4/Makefile	Sun Nov 06 22:05:00 2011 +0000
+++ b/share/man/man4/Makefile	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.572 2011/10/18 10:19:12 wiz Exp $
+#	$NetBSD: Makefile,v 1.572.2.1 2011/11/10 14:31:37 yamt Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -60,8 +60,8 @@
 	ti.4 tl.4 tlp.4 tlphy.4 \
 	tp.4 tr.4 tra.4 trm.4 tty.4 tun.4 tqphy.4 twa.4 twe.4 txp.4 \
 	uark.4 ubsec.4 udp.4 uep.4 ug.4 uha.4 uk.4 ukphy.4 unix.4 userconf.4 \
-	vald.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 virt.4 vlan.4 vmmon.4 \
-	vmnet.4 vnd.4 vr.4 vte.4 \
+	vald.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 virt.4 virtio.4 vlan.4 \
+	vmmon.4 vmnet.4 vnd.4 vr.4 vte.4 \
 	wapbl.4 wb.4 wbsio.4 wd.4 wdc.4 wi.4 wm.4 wpi.4 \
 	wscons.4 wsdisplay.4 wsfont.4 wskbd.4 wsmouse.4 wsmux.4 \
 	xbox.4 xge.4 \
--- a/share/man/man4/filemon.4	Sun Nov 06 22:05:00 2011 +0000
+++ b/share/man/man4/filemon.4	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\"	$NetBSD: filemon.4,v 1.6 2011/09/30 05:07:39 sjg Exp $
+.\"	$NetBSD: filemon.4,v 1.6.2.1 2011/11/10 14:31:37 yamt Exp $
 .\"
 .\" Copyright (c) 2011, Juniper Networks, Inc.
 .\"
@@ -175,7 +175,7 @@
 }
 .Ed
 .Pp
-The outut of
+The output of
 .Nm
 is intended to be simple to parse.
 It is possible to achieve almost equivalent results with
--- a/share/man/man4/ld.4	Sun Nov 06 22:05:00 2011 +0000
+++ b/share/man/man4/ld.4	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ld.4,v 1.18 2009/04/22 07:19:50 wiz Exp $
+.\"	$NetBSD: ld.4,v 1.18.8.1 2011/11/10 14:31:37 yamt Exp $
 .\"
 .\" Copyright (c) 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 22, 2009
+.Dd November 5, 2011
 .Dt LD 4
 .Os
 .Sh NAME
@@ -36,6 +36,7 @@
 .Sh SYNOPSIS
 .Cd "ld* at aac? unit ?"
 .Cd "ld* at amr? unit ?"
+.Cd "ld* at ataraid? vendtype ? unit ?"
 .Cd "ld* at cac? unit ?"
 .Cd "ld* at icp? unit ?"
 .Cd "ld* at iop? tid ?"
@@ -43,7 +44,7 @@
 .Cd "ld* at sdmmc?"
 .Cd "ld* at twa? unit ?"
 .Cd "ld* at twe? unit ?"
-.Cd "ld* at ataraid? vendtype ? unit ?"
+.Cd "ld* at virtio?"
 .Sh DESCRIPTION
 The
 .Nm
@@ -72,7 +73,8 @@
 .Xr mlx 4 ,
 .Xr sdmmc 4 ,
 .Xr twa 4 ,
-.Xr twe 4
+.Xr twe 4 ,
+.Xr virtio 4
 .Sh HISTORY
 The
 .Nm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/share/man/man4/virtio.4	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,63 @@
+.\"	$NetBSD: virtio.4,v 1.2.2.2 2011/11/10 14:31:37 yamt Exp $
+.\"
+.\" Copyright (c) 2011 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\"
+.\" 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.
+.\"
+.Dd November 5, 2011
+.Dt VIRTIO 4
+.Os
+.Sh NAME
+.Nm virtio
+.Nd Para-virtualized I/O in a virtual machine
+.Sh SYNOPSIS
+.Cd "virtio* at pci? dev ? function ?"
+.Cd "ld* at virtio?"
+.Cd "vioif* at virtio?"
+.Cd "viomb* at virtio?"
+.Sh DESCRIPTION
+.Nm
+defines an interface for efficient, standard and extensible I/O between the
+hypervisor and the virtual machine.
+The
+.Nm
+device driver represents an emulated PCI device that the hypervisor makes
+available to the virtual machine.
+.Pp
+.Nm
+supports the following devices:
+.Bl -tag -width xxxxx
+.It Nm ld
+A Disk device.
+.It Nm vioif
+An Ethernet device.
+.It Nm viomb
+A pseudo-device to release memory back to the hypervisor.
+.El
+.Sh SEE ALSO
+.Xr ld 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Nx 6.0 .
--- a/share/man/man5/mk.conf.5	Sun Nov 06 22:05:00 2011 +0000
+++ b/share/man/man5/mk.conf.5	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mk.conf.5,v 1.57 2011/08/22 02:37:15 dholland Exp $
+.\"	$NetBSD: mk.conf.5,v 1.57.2.1 2011/11/10 14:31:37 yamt Exp $
 .\"
 .\"  Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
 .\"  All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 22, 2011
+.Dd November 6, 2011
 .Dt MK.CONF 5
 .Os
 .\" turn off hyphenation
@@ -840,9 +840,8 @@
 which detects stack overflows and aborts the program,
 is enabled.
 This imposes some performance penalty.
-.DFLTy
-on i386 and amd64, otherwise
-.Dq no .
+.DFLTn
+.
 .It Sy USE_YP
 .YorN
 Indicates whether YP (NIS) support is
--- a/share/man/man7/sysctl.7	Sun Nov 06 22:05:00 2011 +0000
+++ b/share/man/man7/sysctl.7	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.67 2011/09/24 17:08:16 christos Exp $
+.\"	$NetBSD: sysctl.7,v 1.67.2.1 2011/11/10 14:31:37 yamt Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -142,7 +142,7 @@
 Returns configuration information about the file system type given as a fourth
 level identifier.
 .It Li vfs.generic.usermount ( VFS_USERMOUNT )
-Determines if non superuser mounts are allowed, default to no
+Determines if non superuser mounts are allowed, defaults to
 .Dv 0 .
 .It Li vfs.generic.magiclinks ( VFS_MAGICLINKS )
 Controls if expansion of variables is going to be performed on pathnames
--- a/share/man/man9/kauth.9	Sun Nov 06 22:05:00 2011 +0000
+++ b/share/man/man9/kauth.9	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: kauth.9,v 1.91 2011/04/28 12:22:35 wiz Exp $
+.\" $NetBSD: kauth.9,v 1.91.4.1 2011/11/10 14:31:38 yamt Exp $
 .\"
 .\" Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 10, 2009
+.Dd November 8, 2011
 .Dt KAUTH 9
 .Os
 .Sh NAME
@@ -77,11 +77,21 @@
 .Pp
 Every listener examines the passed information and returns its decision
 regarding the requested operation.
-It can either allow, deny, or defer the operation -- in which case, the
-decision is left to the other listeners.
+It can either return:
 .Pp
-For an operation to be allowed, all listeners must not return any deny
-or defer decisions.
+.Bl -tag -width KAUTH_RESULT_ALLOW -compact
+.It Dv KAUTH_RESULT_ALLOW
+The listener allows the operation.
+.It Dv KAUTH_RESULT_DENY
+The listener denies the operation.
+.It Dv KAUTH_RESULT_DEFER
+The listener defers the decision to other listeners.
+.El
+.Pp
+For an operation to be allowed, at least one listener has to return
+.Dv KAUTH_RESULT_ALLOW
+while no other listener returned
+.Dv KAUTH_RESULT_DENY .
 .Pp
 Scopes manage listeners that operate in the same aspect of the system.
 .Ss Kernel Programming Interface
@@ -104,12 +114,15 @@
 .Ft int Fn kauth_authorize_action "kauth_scope_t scope" "kauth_cred_t cred" \
 "kauth_action_t op" "void *arg0" "void *arg1" "void *arg2" "void *arg3"
 .Pp
-An authorization request can return one of two possible values.
-Zero indicates success -- the operation is allowed;
-.Er EPERM
-(see
-.Xr errno 2 )
-indicates failure -- the operation is denied.
+An authorization request can return one of two possible values:
+.Bl -tag -width ".It Dv 0 Po zero Pc" -compact
+.It Dv 0 Po zero Pc
+indicates success; operation is allowed.
+.It Dv EPERM
+indicates failure; operation is denied.
+See
+.Xr errno 2 .
+.El
 .Pp
 Each scope has its own authorization wrapper, to make it easy to call from various
 places by eliminating the need to specify the scope and/or cast values.
--- a/share/mk/bsd.README	Sun Nov 06 22:05:00 2011 +0000
+++ b/share/mk/bsd.README	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.289 2011/10/16 01:28:35 christos Exp $
+#	$NetBSD: bsd.README,v 1.289.2.1 2011/11/10 14:31:38 yamt Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -1485,6 +1485,7 @@
 		LIBSTDCXX?=	${DESTDIR}/usr/lib/libstdc++.a
 		LIBSUPCXX?=	${DESTDIR}/usr/lib/libsupc++.a
 		LIBTERMINFO?=	${DESTDIR}/usr/lib/libterminfo.a
+		LIBTRE?=	${DESTDIR}/usr/lib/libtre.a
 		LIBUSBHID?=	${DESTDIR}/usr/lib/libusbhid.a
 		LIBUTIL?=	${DESTDIR}/usr/lib/libutil.a
 		LIBWIND?=	${DESTDIR}/usr/lib/libwind.a
--- a/share/mk/bsd.prog.mk	Sun Nov 06 22:05:00 2011 +0000
+++ b/share/mk/bsd.prog.mk	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.prog.mk,v 1.269 2011/10/16 01:24:05 christos Exp $
+#	$NetBSD: bsd.prog.mk,v 1.269.2.1 2011/11/10 14:31:38 yamt Exp $
 #	@(#)bsd.prog.mk	8.2 (Berkeley) 4/2/94
 
 .ifndef HOSTPROG
@@ -180,6 +180,7 @@
 	stdcxx \
 	supcxx \
 	terminfo \
+	tre \
 	usbhid \
 	util \
 	wind \
--- a/sys/arch/amd64/amd64/machdep.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/amd64/amd64/machdep.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.168 2011/10/31 12:42:36 yamt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.168.2.1 2011/11/10 14:31:38 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.168 2011/10/31 12:42:36 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.168.2.1 2011/11/10 14:31:38 yamt Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -242,7 +242,7 @@
 uint64_t	dumpmem_low;
 uint64_t	dumpmem_high;
 int	cpu_class;
-
+int	use_pae;
 
 #ifndef NO_SPARSE_DUMP
 int sparse_dump = 0;
@@ -568,10 +568,10 @@
 		       NULL, 0, &tsc_freq, 0,
 		       CTL_MACHDEP, CTL_CREATE, CTL_EOL);
 	sysctl_createv(clog, 0, NULL, NULL,
-		       CTLFLAG_PERMANENT | CTLFLAG_IMMEDIATE,
+		       CTLFLAG_PERMANENT,
 		       CTLTYPE_INT, "pae",
 		       SYSCTL_DESCR("Whether the kernel uses PAE"),
-		       NULL, 1, NULL, 0,
+		       NULL, 0, &use_pae, 0,
 		       CTL_MACHDEP, CTL_CREATE, CTL_EOL);
 #ifndef NO_SPARSE_DUMP
 	/* XXXjld Does this really belong under machdep, and not e.g. kern? */
@@ -1646,6 +1646,8 @@
 
 	pcb = lwp_getpcb(&lwp0);
 
+	use_pae = 1; /* PAE always enabled in long mode */
+
 #ifdef XEN
 	pcb->pcb_cr3 = xen_start_info.pt_base - KERNBASE;
 	__PRINTK(("pcb_cr3 0x%lx\n", xen_start_info.pt_base - KERNBASE));
@@ -1684,8 +1686,8 @@
 	/* Determine physical address space */
 	avail_start = first_avail;
 	avail_end = ctob(xen_start_info.nr_pages);
-	pmap_pa_start = (KERNTEXTOFF - KERNBASE);
-	pmap_pa_end = avail_end;
+	pmap_pa_start = XPMAP_OFFSET;
+	pmap_pa_end = pmap_pa_start + ctob(xen_start_info.nr_pages);
 	__PRINTK(("pmap_pa_start 0x%lx avail_start 0x%lx avail_end 0x%lx\n",
 	    pmap_pa_start, avail_start, avail_end));
 #endif	/* !XEN */
--- a/sys/arch/amd64/amd64/trap.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/amd64/amd64/trap.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.67 2011/10/05 20:39:24 njoly Exp $	*/
+/*	$NetBSD: trap.c,v 1.67.2.1 2011/11/10 14:31:38 yamt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.67 2011/10/05 20:39:24 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.67.2.1 2011/11/10 14:31:38 yamt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -275,7 +275,7 @@
 		else
 			printf("unknown trap %ld", (u_long)frame->tf_trapno);
 		printf(" in %s mode\n", (type & T_USER) ? "user" : "supervisor");
-		printf("trap type %d code %lx rip %lx cs %lx rflags %lx cr2"
+		printf("trap type %d code %lx rip %lx cs %lx rflags %lx cr2 "
 		       " %lx cpl %x rsp %lx\n",
 		    type, frame->tf_err, (u_long)frame->tf_rip, frame->tf_cs,
 		    frame->tf_rflags, rcr2(), curcpu()->ci_ilevel, frame->tf_rsp);
@@ -733,7 +733,7 @@
 	    (void *)tf->tf_r13, (void *)tf->tf_r14, (void *)tf->tf_r15);
 	printf("rbp %p  rbx %p  rax %p\n",
 	    (void *)tf->tf_rbp, (void *)tf->tf_rbx, (void *)tf->tf_rax);
-	printf("cs %p  ds %p  es %p  fs %p  gs %p  ss %p\n",
+	printf("cs %lx  ds %lx  es %lx  fs %lx  gs %lx  ss %lx\n",
 		tf->tf_cs & 0xffff, tf->tf_ds & 0xffff, tf->tf_es & 0xffff,
 		tf->tf_fs & 0xffff, tf->tf_gs & 0xffff, tf->tf_ss & 0xffff);
 	
--- a/sys/arch/amd64/conf/files.amd64	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/amd64/conf/files.amd64	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.73 2011/06/12 03:35:38 rmind Exp $
+#	$NetBSD: files.amd64,v 1.73.2.1 2011/11/10 14:31:38 yamt Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -152,6 +152,12 @@
 file	arch/amd64/amd64/linux32_sigcode.S		compat_linux32
 file	arch/amd64/amd64/linux32_syscall.c		compat_linux32
 
+# SVR4 compatibility (COMPAT_SVR4)
+include "compat/svr4/files.svr4"
+
+# SVR4 compatibility (COMPAT_SVR4_32)
+include "compat/svr4_32/files.svr4_32"
+
 # OSS audio driver compatibility
 include	"compat/ossaudio/files.ossaudio"
 
--- a/sys/arch/amd64/include/pmap.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/amd64/include/pmap.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.26 2011/08/27 16:23:44 christos Exp $	*/
+/*	$NetBSD: pmap.h,v 1.26.2.1 2011/11/10 14:31:38 yamt Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -192,7 +192,8 @@
 #define AL4_BASE ((pd_entry_t *)((char *)AL3_BASE + L4_SLOT_PTE * NBPD_L1))
 
 #define PDP_PDE		(L4_BASE + PDIR_SLOT_PTE)
-#define APDP_PDE	(L4_BASE + PDIR_SLOT_APTE)
+#define APDP_PDE	(&curcpu()->ci_kpm_pdir[PDIR_SLOT_APTE])
+#define APDP_PDE_SHADOW	(L4_BASE + PDIR_SLOT_APTE)
 
 #define PDP_BASE	L4_BASE
 #define APDP_BASE	AL4_BASE
@@ -277,9 +278,7 @@
 pmap_pte_set(pt_entry_t *pte, pt_entry_t npte)
 {
 	int s = splvm();
-	xpq_queue_lock();
 	xpq_queue_pte_update(xpmap_ptetomach(pte), npte);
-	xpq_queue_unlock();
 	splx(s);
 }
 
@@ -288,14 +287,12 @@
 {
 	int s = splvm();
 
-	xpq_queue_lock();
 	pt_entry_t opte = *ptep;
 
 	if (opte == o) {
 		xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n);
 		xpq_flush_queue();
 	}
-	xpq_queue_unlock();
 	splx(s);
 	return opte;
 }
@@ -304,11 +301,9 @@
 pmap_pte_testset(volatile pt_entry_t *pte, pt_entry_t npte)
 {
 	int s = splvm();
-	xpq_queue_lock();
 	pt_entry_t opte = *pte;
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), npte);
 	xpq_flush_queue();
-	xpq_queue_unlock();
 	splx(s);
 	return opte;
 }
@@ -317,10 +312,8 @@
 pmap_pte_setbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {
 	int s = splvm();
-	xpq_queue_lock();
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)), (*pte) | bits);
 	xpq_flush_queue();
-	xpq_queue_unlock();
 	splx(s);
 }
 
@@ -328,11 +321,9 @@
 pmap_pte_clearbits(volatile pt_entry_t *pte, pt_entry_t bits)
 {	
 	int s = splvm();
-	xpq_queue_lock();
 	xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(pte)),
 	    (*pte) & ~bits);
 	xpq_flush_queue();
-	xpq_queue_unlock();
 	splx(s);
 }
 
@@ -340,9 +331,7 @@
 pmap_pte_flush(void)
 {
 	int s = splvm();
-	xpq_queue_lock();
 	xpq_flush_queue();
-	xpq_queue_unlock();
 	splx(s);
 }
 #endif
--- a/sys/arch/amiga/dev/efa.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/amiga/dev/efa.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: efa.c,v 1.4 2011/10/30 11:10:42 rkujawa Exp $ */
+/*	$NetBSD: efa.c,v 1.4.2.1 2011/11/10 14:31:39 yamt Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -104,10 +104,6 @@
     { FATA1_PION_OFF_DATA, FATA1_PION_OFF_ERROR, FATA1_PION_OFF_SECCNT,
       FATA1_PION_OFF_SECTOR, FATA1_PION_OFF_CYL_LO, FATA1_PION_OFF_CYL_HI,
       FATA1_PION_OFF_SDH, FATA1_PION_OFF_COMMAND };
-static const unsigned int	wdr_offsets_pion32[] =
-    { FATA1_PION_OFF_DATA32, FATA1_PION_OFF_ERROR, FATA1_PION_OFF_SECCNT,
-      FATA1_PION_OFF_SECTOR, FATA1_PION_OFF_CYL_LO, FATA1_PION_OFF_CYL_HI,
-      FATA1_PION_OFF_SDH, FATA1_PION_OFF_COMMAND };
 
 int
 efa_probe(device_t parent, cfdata_t cfp, void *aux)
@@ -439,48 +435,27 @@
 static void
 efa_fata_subregion_pio0(struct wdc_regs *wdr_fata) 
 {
+	int i;
 
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PIO0_OFF_DATA, 4, &wdr_fata->cmd_iohs[wd_data]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PIO0_OFF_ERROR, 1, &wdr_fata->cmd_iohs[wd_error]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PIO0_OFF_SECCNT, 1, &wdr_fata->cmd_iohs[wd_seccnt]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PIO0_OFF_SECTOR, 1, &wdr_fata->cmd_iohs[wd_sector]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PIO0_OFF_CYL_LO, 1, &wdr_fata->cmd_iohs[wd_cyl_lo]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PIO0_OFF_CYL_HI, 1, &wdr_fata->cmd_iohs[wd_cyl_hi]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PIO0_OFF_SDH, 1, &wdr_fata->cmd_iohs[wd_sdh]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PIO0_OFF_COMMAND, 1, &wdr_fata->cmd_iohs[wd_command]);
+	for (i = 0; i < WDC_NREG; i++) 
+		bus_space_subregion(wdr_fata->cmd_iot,
+		    wdr_fata->cmd_baseioh, wdr_offsets_pio0[i], 
+		    i == 0 ? 4 : 1, &wdr_fata->cmd_iohs[i]);
 }
 
 static void
 efa_fata_subregion_pion(struct wdc_regs *wdr_fata, bool data32) 
 {
+	int i;
+
 	if (data32)
 		bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
 		    FATA1_PION_OFF_DATA32, 8, &wdr_fata->data32ioh);
 
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-    	    FATA1_PION_OFF_DATA, 4, &wdr_fata->cmd_iohs[wd_data]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PION_OFF_ERROR, 1, &wdr_fata->cmd_iohs[wd_error]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PION_OFF_SECCNT, 1, &wdr_fata->cmd_iohs[wd_seccnt]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PION_OFF_SECTOR, 1, &wdr_fata->cmd_iohs[wd_sector]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PION_OFF_CYL_LO, 1, &wdr_fata->cmd_iohs[wd_cyl_lo]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PION_OFF_CYL_HI, 1, &wdr_fata->cmd_iohs[wd_cyl_hi]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PION_OFF_SDH, 1, &wdr_fata->cmd_iohs[wd_sdh]);
-	bus_space_subregion(wdr_fata->cmd_iot, wdr_fata->cmd_baseioh, 
-	    FATA1_PION_OFF_COMMAND, 1, &wdr_fata->cmd_iohs[wd_command]);
+	for (i = 0; i < WDC_NREG; i++) 
+		bus_space_subregion(wdr_fata->cmd_iot,
+		    wdr_fata->cmd_baseioh, wdr_offsets_pion[i], 
+		    i == 0 ? 4 : 1, &wdr_fata->cmd_iohs[i]);
 }
 
 static void
--- a/sys/arch/arm/at91/at91aic.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/at91aic.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,5 +1,5 @@
-/*	$Id: at91aic.c,v 1.7 2011/07/01 19:31:16 dyoung Exp $	*/
-/*	$NetBSD: at91aic.c,v 1.7 2011/07/01 19:31:16 dyoung Exp $	*/
+/*	$Id: at91aic.c,v 1.7.2.1 2011/11/10 14:31:39 yamt Exp $	*/
+/*	$NetBSD: at91aic.c,v 1.7.2.1 2011/11/10 14:31:39 yamt Exp $	*/
 
 /*
  * Copyright (c) 2007 Embedtronics Oy.
@@ -89,7 +89,13 @@
 static void
 at91aic_attach(device_t parent, device_t self, void *aux)
 {
+	int i;
+
 	(void)parent; (void)self; (void)aux;
+	for (i = 0; i < NIRQ; i++) {
+		evcnt_attach_dynamic(&intrq[i].iq_ev, EVCNT_TYPE_INTR,
+				     NULL, "aic", intrq[i].iq_name);
+	}
 	printf("\n");
 }
 
@@ -246,8 +252,6 @@
 		TAILQ_INIT(&iq->iq_list);
 
 		sprintf(iq->iq_name, "irq %d", i);
-		evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
-				     NULL, "aic", iq->iq_name);
 	}
 
 	/* All interrupts should use IRQ not FIQ */
--- a/sys/arch/arm/at91/at91bus.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/at91bus.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: at91bus.c,v 1.11 2011/07/01 19:31:16 dyoung Exp $	*/
+/*	$NetBSD: at91bus.c,v 1.11.2.1 2011/11/10 14:31:39 yamt Exp $	*/
 
 /*
  * Copyright (c) 2007 Embedtronics Oy
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91bus.c,v 1.11 2011/07/01 19:31:16 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91bus.c,v 1.11.2.1 2011/11/10 14:31:39 yamt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -149,7 +149,8 @@
 				 const int *, void *);
 
 
-CFATTACH_DECL(at91bus, sizeof(struct at91bus_softc), at91bus_match, at91bus_attach, NULL, NULL);
+CFATTACH_DECL_NEW(at91bus, sizeof(struct at91bus_softc),
+	at91bus_match, at91bus_attach, NULL, NULL);
 
 struct at91bus_clocks at91bus_clocks = {0};
 struct at91bus_softc *at91bus_sc = NULL;
@@ -160,6 +161,10 @@
 #include <arm/at91/at91rm9200busvar.h>
 #endif
 
+#ifdef	AT91SAM9260
+#include <arm/at91/at91sam9260busvar.h>
+#endif
+
 #ifdef	AT91SAM9261
 #include <arm/at91/at91sam9261busvar.h>
 #endif
@@ -179,6 +184,9 @@
 	{
 		DBGU_CIDR_AT91SAM9260,
 		"AT91SAM9260"
+#ifdef	AT91SAM9260
+		, &at91sam9260bus
+#endif
 	},
 	{
 		DBGU_CIDR_AT91SAM9260,
@@ -188,7 +196,7 @@
 #endif
 	},
 	{
-		DBGU_CIDR_AT91SAM9260,
+		DBGU_CIDR_AT91SAM9263,
 		"AT91SAM9263"
 	},
 	{
@@ -592,7 +600,7 @@
 	locs[AT91BUSCF_ADDR] = addr;
 	locs[AT91BUSCF_PID]  = pid;
 
-	sc = (struct at91bus_softc*) self;
+	sc = device_private(self);
 	sa.sa_iot = sc->sc_iot;
 	sa.sa_dmat = sc->sc_dmat;
 	sa.sa_addr = addr;
@@ -611,7 +619,7 @@
 	if (at91_chip_ndx < 0)
 		panic("%s: at91bus_init() has not been called!", __FUNCTION__);
 
-	sc = (struct at91bus_softc*) self;
+	sc = device_private(self);
 
         /* initialize bus space and bus dma things... */
 	sc->sc_iot = &at91_bs_tag;
--- a/sys/arch/arm/at91/at91dbgu.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/at91dbgu.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,5 +1,5 @@
-/*	$Id: at91dbgu.c,v 1.6 2011/07/01 19:31:17 dyoung Exp $	*/
-/*	$NetBSD: at91dbgu.c,v 1.6 2011/07/01 19:31:17 dyoung Exp $ */
+/*	$Id: at91dbgu.c,v 1.6.2.1 2011/11/10 14:31:39 yamt Exp $	*/
+/*	$NetBSD: at91dbgu.c,v 1.6.2.1 2011/11/10 14:31:39 yamt Exp $ */
 
 /*
  *
@@ -83,7 +83,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.6 2011/07/01 19:31:17 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.6.2.1 2011/11/10 14:31:39 yamt Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -167,7 +167,7 @@
 
 static struct cnm_state at91dbgu_cnm_state;
 
-CFATTACH_DECL(at91dbgu, sizeof(struct at91dbgu_softc),
+CFATTACH_DECL_NEW(at91dbgu, sizeof(struct at91dbgu_softc),
 	      at91dbgu_match, at91dbgu_attach, NULL, NULL);
 
 extern struct cfdriver at91dbgu_cd;
--- a/sys/arch/arm/at91/at91dbgureg.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/at91dbgureg.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: at91dbgureg.h,v 1.3 2009/10/23 06:53:13 snj Exp $	*/
+/*	$NetBSD: at91dbgureg.h,v 1.3.12.1 2011/11/10 14:31:39 yamt Exp $	*/
 
 /*
  * Copyright (c) 2007 Embedtronics Oy
@@ -172,7 +172,7 @@
 #define	DBGU_CIDR_VERSION	0x0000001F	/* version of the device */
 
 #define	DBGU_CIDR_AT91RM9200	0x09290781
-#define	DBGU_CIDR_AT91SAM9260	0x019803A0
+#define	DBGU_CIDR_AT91SAM9260	0x019803A2
 #define	DBGU_CIDR_AT91SAM9261	0x019703A0
 #define	DBGU_CIDR_AT91SAM9263	0x019607A0
 
--- a/sys/arch/arm/at91/at91ohci.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/at91ohci.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,5 +1,5 @@
-/*	$Id: at91ohci.c,v 1.4 2011/07/01 19:31:17 dyoung Exp $	*/
-/*	$NetBSD: at91ohci.c,v 1.4 2011/07/01 19:31:17 dyoung Exp $	*/
+/*	$Id: at91ohci.c,v 1.4.2.1 2011/11/10 14:31:39 yamt Exp $	*/
+/*	$NetBSD: at91ohci.c,v 1.4.2.1 2011/11/10 14:31:39 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2007 Embedtronics Oy.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91ohci.c,v 1.4 2011/07/01 19:31:17 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91ohci.c,v 1.4.2.1 2011/11/10 14:31:39 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -75,7 +75,7 @@
 	int	sc_pid;
 };
 
-CFATTACH_DECL(at91ohci, sizeof(struct at91ohci_softc),
+CFATTACH_DECL_NEW(at91ohci, sizeof(struct at91ohci_softc),
     at91ohci_match, at91ohci_attach, NULL, NULL);
 
 int
@@ -90,11 +90,13 @@
 void
 at91ohci_attach(device_t parent, device_t self, void *aux)
 {
-	struct at91ohci_softc *sc = (struct at91ohci_softc *)self;
+	struct at91ohci_softc *sc = device_private(self);
 	struct at91bus_attach_args *sa = aux;
 
+	sc->sc.sc_dev = self;
+	sc->sc.sc_bus.hci_private = sc;
+	sc->sc.sc_bus.dmatag = sa->sa_dmat;
 	sc->sc.iot = sa->sa_iot;
-	sc->sc.sc_bus.dmatag = sa->sa_dmat;
 	sc->sc_pid = sa->sa_pid;
 
 	/* Map I/O space */
@@ -104,6 +106,8 @@
 		return;
 	}
 
+	sc->sc.sc_size = sa->sa_size;
+
 	/* enable peripheral clock */
 	at91_peripheral_clock(sc->sc_pid, 1);
 
@@ -116,7 +120,7 @@
 void
 at91ohci_callback(device_t self)
 {
-	struct at91ohci_softc *sc = (struct at91ohci_softc *)self;
+	struct at91ohci_softc *sc = device_private(self);
 	usbd_status r;
 
 	/* Disable interrupts, so we don't get any spurious ones. */
@@ -136,5 +140,5 @@
 	}
 
 	/* Attach usb device. */
-	sc->sc.sc_child = config_found((void *) sc, &sc->sc.sc_bus, usbctlprint);
+	sc->sc.sc_child = config_found(self, &sc->sc.sc_bus, usbctlprint);
 }
--- a/sys/arch/arm/at91/at91pmc.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/at91pmc.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,5 +1,5 @@
-/*	$Id: at91pmc.c,v 1.4 2011/07/01 19:31:17 dyoung Exp $	*/
-/*	$NetBSD: at91pmc.c,v 1.4 2011/07/01 19:31:17 dyoung Exp $	*/
+/*	$Id: at91pmc.c,v 1.4.2.1 2011/11/10 14:31:39 yamt Exp $	*/
+/*	$NetBSD: at91pmc.c,v 1.4.2.1 2011/11/10 14:31:39 yamt Exp $	*/
 
 /*
  * Copyright (c) 2007 Embedtronics Oy
@@ -70,6 +70,8 @@
 	  mclk -= (mclk % 1000000U);
 	}
 
+	PMCREG(PMC_PLLICPR) = PMC_PLLICPR_ICPPLLA | PMC_PLLICPR_ICPPLLB;
+
 	reg = PMCREG(PMC_PLLAR); pllaclk = 0;
 	if (reg & PMC_PLL_DIV) {
 		pllaclk = mclk * (((reg & PMC_PLL_MUL) >> PMC_PLL_MUL_SHIFT) + 1);
--- a/sys/arch/arm/at91/at91pmcreg.h	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/at91pmcreg.h	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$Id: at91pmcreg.h,v 1.2 2008/07/03 01:15:38 matt Exp $	*/
+/*	$Id: at91pmcreg.h,v 1.2.32.1 2011/11/10 14:31:39 yamt Exp $	*/
 
 #ifndef	_AT91PMCREG_H_
 #define	_AT91PMCREG_H_	1
@@ -24,12 +24,15 @@
 #define	PMC_IDR		0x64U		/* 64: Interrupt Disable Reg	*/
 #define	PMC_SR		0x68U		/* 68: Status Register		*/
 #define	PMC_IMR		0x6CU		/* 6C: Interrupt Mask Reg	*/
+#define	PMC_PLLICPR	0x80U		/* 80: PLL Charge Pump Current Reg */
 
 /* System Clock Enable Register bits: */
 #define	PMC_SCSR_PCK3	0x0800U
 #define	PMC_SCSR_PCK2	0x0400U
 #define	PMC_SCSR_PCK1	0x0200U
 #define	PMC_SCSR_PCK0	0x0100U
+#define PMC_SCSR_SAM_UDP 0x0080U
+#define PMC_SCSR_SAM_UHP 0x0040U
 #define	PMC_SCSR_UHP	0x0010U		/* 1 = Enable USB Host Port clks */
 #define	PMC_SCSR_MCKUDP	0x0004U		/* 1 = enable Master Clock dis	*/
 #define	PMC_SCSR_UDP	0x0002U		/* 1 = enable USB Device Port clk */
@@ -113,6 +116,10 @@
 #define	PMC_SR_LOCKA		0x0002U
 #define	PMC_SR_MOSCS		0x0001U
 
+/* PLL Charge Pump Current Reg bits: */
+#define	PMC_PLLICPR_ICPPLLA	0x00000001U
+#define	PMC_PLLICPR_ICPPLLB	0x00010000U
+
 #define	PMCREG(offset)		*((volatile uint32_t*)(0xfffffc00UL + (offset)))
 
 #endif /* !_AT91PMCREG_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/at91/at91sam9260bus.c	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,161 @@
+/*	$NetBSD: at91sam9260bus.c,v 1.1.2.2 2011/11/10 14:31:39 yamt Exp $	*/
+/*
+ * Copied from at91sam9261bus.c
+ * Adaptation to AT91SAM9260 by Aymeric Vincent is in the public domain.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: at91sam9260bus.c,v 1.1.2.2 2011/11/10 14:31:39 yamt Exp $");
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/time.h>
+#include <sys/device.h>
+#include <uvm/uvm_extern.h>
+
+#include <arm/at91/at91sam9260busvar.h>
+
+const struct at91bus_machdep at91sam9260bus = {
+	at91sam9260bus_init,
+	at91sam9260bus_attach_cn,
+	at91sam9260bus_devmap,
+
+	/* clocking support: */
+	at91sam9260bus_peripheral_clock,
+
+	/* PIO support: */
+	at91sam9260bus_pio_port,
+	at91sam9260bus_gpio_mask,
+
+	/* interrupt handling support: */
+	at91sam9260bus_intr_init,
+	at91sam9260bus_intr_establish,
+	at91sam9260bus_intr_disestablish,
+	at91sam9260bus_intr_poll,
+	at91sam9260bus_intr_dispatch,
+
+	/* configuration */
+	at91sam9260bus_peripheral_name,
+	at91sam9260bus_search_peripherals
+};
+
+void at91sam9260bus_init(struct at91bus_clocks *clocks) {
+	pmap_devmap_register(at91_devmap());
+	at91pmc_get_clocks(clocks);
+}
+
+const struct pmap_devmap *at91sam9260bus_devmap(void) {
+	static const struct pmap_devmap devmap[] = {
+	    {
+		AT91SAM9260_APB_VBASE,
+		AT91SAM9260_APB_HWBASE,
+		AT91SAM9260_APB_SIZE,
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	    },
+
+	    {
+		0, 0, 0, 0, 0
+	    }
+	};
+
+	return devmap;
+}
+
+void at91sam9260bus_peripheral_clock(int pid, int enable) {
+	switch (pid) {
+	case PID_UHP:
+		if (enable)
+			PMCREG(PMC_SCER) = PMC_SCSR_SAM_UHP;
+		else
+			PMCREG(PMC_SCDR) = PMC_SCSR_SAM_UHP;
+		break;
+	}
+	at91pmc_peripheral_clock(pid, enable);
+}
+
+at91pio_port at91sam9260bus_pio_port(int pid) {
+	switch (pid) {
+	case PID_PIOA:	return AT91_PIOA;
+	case PID_PIOB:	return AT91_PIOB;
+	case PID_PIOC:	return AT91_PIOC;
+	default:	panic("%s: pid %d not valid", __FUNCTION__, pid);
+	}
+	
+}
+
+uint32_t at91sam9260bus_gpio_mask(int pid) {
+	return 0xFFFFFFFFUL;
+}
+
+const char *at91sam9260bus_peripheral_name(int pid) {
+	switch (pid) {
+	case PID_FIQ:	return "FIQ";
+	case PID_SYSIRQ:return "SYS";
+	case PID_PIOA:	return "PIOA";
+	case PID_PIOB:	return "PIOB";
+	case PID_PIOC:	return "PIOC";
+	case PID_US0:	return "USART0";
+	case PID_US1:	return "USART1";
+	case PID_US2:	return "USART2";
+	case PID_MCI:	return "MCI";
+	case PID_UDP:	return "UDP";
+	case PID_TWI:	return "TWI";
+	case PID_SPI0:	return "SPI0";
+	case PID_SPI1:	return "SPI1";
+	case PID_SSC:	return "SSC";
+	case PID_TC0:	return "TC0";
+	case PID_TC1:	return "TC1";
+	case PID_TC2:	return "TC2";
+	case PID_UHP:	return "UHP";
+	case PID_EMAC:	return "EMAC";
+	case PID_US3:	return "USART3";
+	case PID_US4:	return "USART4";
+	case PID_US5:	return "USART5";
+	case PID_TC3:	return "TC3";
+	case PID_TC4:	return "TC4";
+	case PID_TC5:	return "TC5";
+	case PID_IRQ0:	return "IRQ0";
+	case PID_IRQ1:	return "IRQ1";
+	case PID_IRQ2:	return "IRQ2";
+	default:	panic("%s: invalid pid %d", __FUNCTION__, pid);
+	}
+}
+
+void at91sam9260bus_search_peripherals(device_t self, 
+			   device_t found_func(device_t, bus_addr_t, int)) {
+	static const struct {
+		bus_addr_t	addr;
+		int		pid;
+	} table[] = {
+		{AT91SAM9260_PMC_BASE,		-1},
+		{AT91SAM9260_AIC_BASE,		-1},
+		{AT91SAM9260_PIT_BASE,		PID_SYSIRQ},
+		{AT91SAM9260_TC0_BASE,		PID_TC0},
+		{AT91SAM9260_TC1_BASE,		PID_TC1},
+		{AT91SAM9260_TC2_BASE,		PID_TC2},
+		{AT91SAM9260_DBGU_BASE,		PID_SYSIRQ},
+		{AT91SAM9260_PIOA_BASE,		PID_PIOA},
+		{AT91SAM9260_PIOB_BASE,		PID_PIOB},
+		{AT91SAM9260_PIOC_BASE,		PID_PIOC},
+		{AT91SAM9260_USART0_BASE,	PID_US0},
+		{AT91SAM9260_USART1_BASE,	PID_US1},
+		{AT91SAM9260_USART2_BASE,	PID_US2},
+		{AT91SAM9260_SSC_BASE,		PID_SSC},
+//		{AT91SAM9260_EMAC_BASE,		PID_EMAC},
+		{AT91SAM9260_TWI_BASE,		PID_TWI},
+		{AT91SAM9260_SPI0_BASE,		PID_SPI0},
+		{AT91SAM9260_SPI1_BASE,		PID_SPI1},
+		{AT91SAM9260_UHP_BASE,		PID_UHP},
+		{AT91SAM9260_UDP_BASE,		PID_UDP},
+		{AT91SAM9260_MCI_BASE,		PID_MCI},
+		{0, 0}
+	};
+	int i;
+
+	for (i = 0; table[i].addr; i++)
+		found_func(self, table[i].addr, table[i].pid);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/at91/at91sam9260busvar.h	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,62 @@
+/*	$NetBSD: at91sam9260busvar.h,v 1.1.2.2 2011/11/10 14:31:39 yamt Exp $ */
+
+/*
+ * Copyright (c) 2007 Embedtronics Oy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``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 ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD 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.
+ */
+/* Adaptation to AT91SAM9260 by Aymeric Vincent is in the public domain */
+
+#ifndef _AT91SAM9260BUSVAR_H_
+#define _AT91SAM9260BUSVAR_H_
+
+#include <arm/at91/at91busvar.h>
+#include <arm/at91/at91pmcvar.h>
+#include <arm/at91/at91aicvar.h>
+#include <arm/at91/at91dbguvar.h>
+#include <arm/at91/at91sam9260reg.h>
+
+#include "at91dbgu.h"
+
+void at91sam9260bus_init(struct at91bus_clocks *);
+#if NAT91DBGU > 0
+#define	at91sam9260bus_attach_cn		at91dbgu_attach_cn
+#else
+void at91sam9260bus_attach_cn(bus_space_tag_t iot, int ospeed, int cflag);
+#endif
+const struct pmap_devmap *at91sam9260bus_devmap(void);
+void at91sam9260bus_peripheral_clock(int pid, int enable);
+at91pio_port at91sam9260bus_pio_port(int pid);
+uint32_t at91sam9260bus_gpio_mask(int pid);
+#define	at91sam9260bus_intr_init		at91aic_init
+#define	at91sam9260bus_intr_establish	at91aic_intr_establish
+#define	at91sam9260bus_intr_disestablish	at91aic_intr_disestablish
+#define	at91sam9260bus_intr_poll		at91aic_intr_poll
+#define	at91sam9260bus_intr_dispatch	at91aic_intr_dispatch
+const char *at91sam9260bus_peripheral_name(int pid);
+void at91sam9260bus_search_peripherals(device_t self,
+				   device_t (*found_func)(device_t, bus_addr_t, int));
+
+extern const struct at91bus_machdep at91sam9260bus;
+
+#endif	// _AT91SAM9260BUSVAR_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/at91/at91sam9260reg.h	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,280 @@
+/*	$NetBSD: at91sam9260reg.h,v 1.1.2.2 2011/11/10 14:31:39 yamt Exp $	*/
+
+/*
+ * Copyright (c) 2007 Embedtronics Oy
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``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 ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD 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.
+ */
+/* Adaptation to AT91SAM9260 by Aymeric Vincent is in the public domain */
+
+#ifndef _AT91SAM9260REG_H_
+#define _AT91SAM9260REG_H_
+
+#include <arm/at91/at91reg.h>
+
+/*
+ * Physical memory map for the AT91SAM9260
+ */
+
+/*
+ * ffff ffff ---------------------------
+ *	      System Controller
+ * ffff c000 ---------------------------
+ *	      Peripherals
+ * fffa 0000 ---------------------------
+ *	      (not used)
+ * 9000 0000 ---------------------------
+ *	      EBI Chip Select 7
+ * 8000 0000 ---------------------------
+ *	      EBI Chip Select 6 / CF logic
+ * 7000 0000 ---------------------------
+ *	      EBI Chip Select 5 / CF logic
+ * 6000 0000 ---------------------------
+ *	      EBI Chip Select 4 / CF logic
+ * 5000 0000 ---------------------------
+ *	      EBI Chip Select 3 / NANDFlash
+ * 4000 0000 ---------------------------
+ *	      EBI Chip Select 2
+ * 3000 0000 ---------------------------
+ *	      EBI Chip Select 1 / SDRAM
+ * 2000 0000 ---------------------------
+ *	      EBI Chip Select 0 / BFC
+ * 1000 0000 ---------------------------
+ *	      Reserved
+ * 0070 0000 ---------------------------
+ *	      LCD User Interface
+ * 0060 0000 ---------------------------
+ *	      UHP User Interface
+ * 0050 0000 ---------------------------
+ *	      Reserved
+ * 0040 0000 ---------------------------
+ *	      SRAM
+ * 0030 0000 ---------------------------
+ *	      DTCM
+ * 0020 0000 ---------------------------
+ *	      ITCM
+ * 0010 0000 ---------------------------
+ *	      Boot memory
+ * 0000 0000 ---------------------------
+ */
+
+
+/*
+ * Virtual memory map for the AT91SAM9260 integrated devices
+ *
+ * Some device registers are statically mapped on upper address region.
+ * because we have to access them before bus_space is initialized.
+ * Most devices are dynamicaly mapped by bus_space_map(). In this case,
+ * the actual mapped (virtual) address are not cared by device drivers.
+ */
+
+/*
+ * FFFF FFFF ---------------------------
+ *            APB bus (1 MB)
+ * FFF0 0000 ---------------------------
+ *	      (not used)
+ * E000 0000 ---------------------------
+ *            Kernel text and data
+ * C000 0000 ---------------------------
+ *	      (not used)
+ * 0000 0000 ---------------------------
+ *
+ */
+
+#define	AT91SAM9260_BOOTMEM_BASE	0x00000000U
+#define	AT91SAM9260_BOOTMEM_SIZE	0x00100000U
+
+#define	AT91SAM9260_ROM_BASE	0x00100000U
+#define	AT91SAM9260_ROM_SIZE	0x00008000U
+
+#define	AT91SAM9260_SRAM0_BASE	0x00200000U
+#define	AT91SAM9260_SRAM0_SIZE	0x00001000U
+
+#define	AT91SAM9260_SRAM1_BASE	0x00300000U
+#define	AT91SAM9260_SRAM1_SIZE	0x00001000U
+
+#define	AT91SAM9260_UHP_BASE	0x00500000U
+#define	AT91SAM9260_UHP_SIZE	0x00004000U
+
+#define	AT91SAM9260_CS0_BASE	0x10000000U
+#define	AT91SAM9260_CS0_SIZE	0x10000000U
+
+#define	AT91SAM9260_CS1_BASE	0x20000000U
+#define	AT91SAM9260_CS1_SIZE	0x10000000U
+
+#define	AT91SAM9260_SDRAM_BASE	AT91SAM9260_CS1_BASE
+
+#define	AT91SAM9260_CS2_BASE	0x30000000U
+#define	AT91SAM9260_CS2_SIZE	0x10000000U
+
+#define	AT91SAM9260_CS3_BASE	0x40000000U
+#define	AT91SAM9260_CS3_SIZE	0x10000000U
+
+#define	AT91SAM9260_CS4_BASE	0x50000000U
+#define	AT91SAM9260_CS4_SIZE	0x10000000U
+
+#define	AT91SAM9260_CS5_BASE	0x60000000U
+#define	AT91SAM9260_CS5_SIZE	0x10000000U
+
+#define	AT91SAM9260_CS6_BASE	0x70000000U
+#define	AT91SAM9260_CS6_SIZE	0x10000000U
+
+#define	AT91SAM9260_CS7_BASE	0x80000000U
+#define	AT91SAM9260_CS7_SIZE	0x10000000U
+
+/* Virtual address for I/O space */
+#define	AT91SAM9260_APB_VBASE	0xfff00000U
+#define	AT91SAM9260_APB_HWBASE	0xfff00000U
+#define	AT91SAM9260_APB_SIZE	0x00100000U
+
+/* Peripherals: */
+#include <arm/at91/at91pdcreg.h>
+
+#define	AT91SAM9260_TC0_BASE	0xFFFA0000U
+#define	AT91SAM9260_TC1_BASE	0xFFFA0040U
+#define	AT91SAM9260_TC2_BASE	0xFFFA0080U
+#define	AT91SAM9260_TCB012_BASE	0xFFFA00C0U
+#define	AT91SAM9260_TC_SIZE	0x4000U
+//#include <arm/at91/at91tcreg.h>
+
+#define	AT91SAM9260_UDP_BASE	0xFFFA4000U
+#define	AT91SAM9260_UDP_SIZE	0x4000U
+//#include <arm/at91/at91udpreg.h>
+
+#define	AT91SAM9260_MCI_BASE	0xFFFA8000U
+
+#define	AT91SAM9260_TWI_BASE	0xFFFAC000U
+#include <arm/at91/at91twireg.h>
+
+#define	AT91SAM9260_USART0_BASE	0xFFFB0000U
+#define	AT91SAM9260_USART1_BASE	0xFFFB4000U
+#define	AT91SAM9260_USART2_BASE	0xFFFB8000U
+#define	AT91SAM9260_USART_SIZE	0x4000U
+#include <arm/at91/at91usartreg.h>
+
+#define	AT91SAM9260_SSC_BASE	0xFFFBC000U
+#define	AT91SAM9260_SSC_SIZE	0x4000U
+//#include <arm/at91/at91sscreg.h>
+
+#define AT91SAM9260_EMAC_BASE	0xFFFC4000U
+#define	AT91SAM9260_EMAC_SIZE	0x4000U
+#include <arm/at91/at91emacreg.h>
+
+#define	AT91SAM9260_SPI0_BASE	0xFFFC8000U
+#define	AT91SAM9260_SPI1_BASE	0xFFFCC000U
+#define	AT91SAM9260_SPI_SIZE	0x4000U
+#include <arm/at91/at91spireg.h>
+
+/* system controller: */
+#define	AT91SAM9260_SDRAMC_BASE	0xFFFFEA00U
+#define	AT91SAM9260_SDRAMC_SIZE	0x200U
+
+#define	AT91SAM9260_SMC_BASE	0xFFFFEC00U
+#define	AT91SAM9260_SMC_SIZE	0x200U
+
+#define	AT91SAM9260_MATRIX_BASE	0xFFFFEE00U
+#define	AT91SAM9216_MATRIX_SIZE	0x200U
+
+#define	AT91SAM9260_AIC_BASE	0xFFFFF000U
+#define	AT91SAM9260_AIC_SIZE	0x200U
+#include <arm/at91/at91aicreg.h>
+
+#define	AT91SAM9260_DBGU_BASE	0xFFFFF200U
+#define	AT91SAM9260_DBGU_SIZE	0x200U
+#include <arm/at91/at91dbgureg.h>
+
+#define	AT91SAM9260_PIOA_BASE	0xFFFFF400U
+#define	AT91SAM9260_PIOB_BASE	0xFFFFF600U
+#define	AT91SAM9260_PIOC_BASE	0xFFFFF800U
+#define	AT91SAM9260_PIO_SIZE	0x200U
+#define	AT91_PIO_SIZE		AT91SAM9260_PIO_SIZE	// for generic AT91 code
+#include <arm/at91/at91pioreg.h>
+
+#define	PIOA_READ(_reg)		*((volatile uint32_t *)(AT91SAM9260_PIOA_BASE + (_reg)))
+#define	PIOA_WRITE(_reg, _val)	do {*((volatile uint32_t *)(AT91SAM9260_PIOA_BASE + (_reg))) = (_val);} while (0)
+#define	PIOB_READ(_reg)		*((volatile uint32_t *)(AT91SAM9260_PIOB_BASE + (_reg)))
+#define	PIOB_WRITE(_reg, _val)	do {*((volatile uint32_t *)(AT91SAM9260_PIOB_BASE + (_reg))) = (_val);} while (0)
+#define	PIOC_READ(_reg)		*((volatile uint32_t *)(AT91SAM9260_PIOC_BASE + (_reg)))
+#define	PIOC_WRITE(_reg, _val)	do {*((volatile uint32_t *)(AT91SAM9260_PIOC_BASE + (_reg))) = (_val);} while (0)
+
+#define	AT91SAM9260_PMC_BASE	0xFFFFFC00U
+#define	AT91SAM9260_PMC_SIZE	0x100U
+#include <arm/at91/at91pmcreg.h>
+
+#define	AT91SAM9260_RSTC_BASE	0xFFFFFD00U
+#define	AT91SAM9260_RSTC_SIZE	0x10U
+
+#define	AT91SAM9260_SHDWC_BASE	0xFFFFFD10U
+#define	AT91SAM9260_SHDWC_SIZE	0x10U
+
+#define	AT91SAM9260_RTT_BASE	0xFFFFFD20U
+#define	AT91SAM9260_RTT_SIZE	0x10U
+
+#define	AT91SAM9260_PIT_BASE	0xFFFFFD30U
+#define	AT91SAM9260_PIT_SIZE	0x10U
+
+#define	AT91SAM9260_WDT_BASE	0xFFFFFD40U
+#define	AT91SAM9260_WDT_SIZE	0x10U
+
+#define	AT91SAM9260_GPBR_BASE	0xFFFFFD50U
+#define	AT91SAM9260_GPBR_SIZE	0x10U
+
+
+// peripheral identifiers:
+/* peripheral identifiers: */
+enum {
+  PID_FIQ = 0,			/* 0 */
+  PID_SYSIRQ,			/* 1 */
+  PID_PIOA,			/* 2 */
+  PID_PIOB,			/* 3 */
+  PID_PIOC,			/* 4 */
+  PID_ADC,			/* 5 */
+  PID_US0,			/* 6 */
+  PID_US1,			/* 7 */
+  PID_US2,			/* 8 */
+  PID_MCI,			/* 9 */
+  PID_UDP,			/* 10 */
+  PID_TWI,			/* 11 */
+  PID_SPI0,			/* 12 */
+  PID_SPI1,			/* 13 */
+  PID_SSC,			/* 14 */
+
+
+  PID_TC0 = 17,			/* 17 */
+  PID_TC1,			/* 18 */
+  PID_TC2,			/* 19 */
+  PID_UHP,			/* 20 */
+  PID_EMAC,			/* 21 */
+  PID_ISI,			/* 22 */
+  PID_US3,			/* 23 */
+  PID_US4,			/* 24 */
+  PID_US5,			/* 25 */
+  PID_TC3,			/* 26 */
+  PID_TC4,			/* 27 */
+  PID_TC5,			/* 28 */
+  PID_IRQ0,			/* 29 */
+  PID_IRQ1,			/* 30 */
+  PID_IRQ2,			/* 31 */
+};
+
+#endif /* _AT91SAM9260REG_H_ */
--- a/sys/arch/arm/at91/at91tctmr.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/at91tctmr.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*$NetBSD: at91tctmr.c,v 1.5 2011/07/01 19:31:17 dyoung Exp $*/
+/*$NetBSD: at91tctmr.c,v 1.5.2.1 2011/11/10 14:31:39 yamt Exp $*/
 
 /*
  * AT91 Timer Counter (TC) based clock functions
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at91tctmr.c,v 1.5 2011/07/01 19:31:17 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at91tctmr.c,v 1.5.2.1 2011/11/10 14:31:39 yamt Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -90,7 +90,9 @@
 };
 
 static struct at91tctmr_softc *at91tctmr_sc = NULL;
+#if 0
 static struct timeval lasttv;
+#endif
 
     
     
@@ -151,6 +153,7 @@
 CFATTACH_DECL_NEW(at91tctmr, sizeof(struct at91tctmr_softc),
     at91tctmr_match, at91tctmr_attach, NULL, NULL);
 
+#if 0
 static u_int at91tctmr_get_timecount(struct timecounter *);
 
 static struct timecounter at91tctmr_timecounter = {
@@ -163,6 +166,7 @@
 	NULL,			/* prev */
 	NULL,			/* next */
 };
+#endif
 
 static int
 at91tctmr_match(device_t parent, cfdata_t match, void *aux)
--- a/sys/arch/arm/at91/files.at91	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/arm/at91/files.at91	Thu Nov 10 14:31:09 2011 +0000
@@ -1,9 +1,10 @@
-#	$Id: files.at91,v 1.2 2008/07/03 01:15:39 matt Exp $
+#	$Id: files.at91,v 1.2.32.1 2011/11/10 14:31:39 yamt Exp $
 
 #
 # Configuration info for AT91 based CPUs
 #
 defflag opt_at91types.h			AT91RM9200
+defflag opt_at91types.h			AT91SAM9260
 defflag opt_at91types.h			AT91SAM9261
 
 file	arch/arm/arm32/irq_dispatch.S
@@ -22,6 +23,7 @@
 
 # chips:
 file	arch/arm/at91/at91rm9200bus.c	at91rm9200
+file	arch/arm/at91/at91sam9260bus.c	at91sam9260
 file	arch/arm/at91/at91sam9261bus.c	at91sam9261
 
 # AT91 Advanced Interrupt controller:
@@ -45,7 +47,7 @@
 file	arch/arm/at91/at91tctmr.c	at91tctmr needs-flag
 
 # AT91 Power Management Controller
-file	arch/arm/at91/at91pmc.c		at91rm9200 | at91sam9261
+file	arch/arm/at91/at91pmc.c		at91rm9200 | at91sam9260 | at91sam9261
 
 # AT91 serial port
 device	at91usart: tty
--- a/sys/arch/atari/stand/installboot/installboot.c	Sun Nov 06 22:05:00 2011 +0000
+++ b/sys/arch/atari/stand/installboot/installboot.c	Thu Nov 10 14:31:09 2011 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.24 2009/03/14 21:04:07 dsl Exp $	*/
+/*	$NetBSD: installboot.c,v 1.24.12.1 2011/11/10 14:31:39 yamt Exp $	*/
 
 /*
  * Copyright (c) 1995 Waldi Ravens
@@ -78,7 +78,7 @@
 static int		milan = 0;
 
 static void
-usage ()
+usage(void)
 {
 	fprintf(stderr,
 		"usage: installboot [options] device\n"
@@ -92,7 +92,7 @@
 }
 
 int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
 {
 	struct disklabel dl;
 	char		 *dn;
@@ -176,10 +176,12 @@
 }
 
 static void
-oscheck ()
+oscheck(void)
 {
-	struct nlist	kbv[] = { { "_bootversion" },
-				  { NULL } };
+	struct nlist kbv[] = {
+		{ .n_name = "_bootversion" },
+		{ .n_name = NULL }
+	};
 	kvm_t		*kd_kern;
 	char		errbuf[_POSIX2_LINE_MAX];
 	u_short		kvers;
@@ -197,17 +199,16 @@
 		errx(EXIT_FAILURE, "kvm_nlist: %s", kvm_geterr(kd_kern));
 	if (kbv[0].n_value == 0)
 		errx(EXIT_FAILURE, "%s not in namelist", kbv[0].n_name);
-	if (kvm_read(kd_kern, kbv[0].n_value, (char *)&kvers,
-						sizeof(kvers)) == -1)
+	if (kvm_read(kd_kern, kbv[0].n_value, &kvers, sizeof(kvers)) == -1)
 		errx(EXIT_FAILURE, "kvm_read: %s", kvm_geterr(kd_kern));
 	kvm_close(kd_kern);
 	if (kvers != BOOTVERSION)
 		errx(EXIT_FAILURE, "Kern bootversion: %d, expected: %d",
-					kvers, BOOTVERSION);
+		    kvers, BOOTVERSION);
 }
 
 static void
-install_fd (char *devnm, struct disklabel *label)
+install_fd(char *devnm, struct disklabel *label)
 {
 	const char	 *machpath;
 	char		 *xxboot, *bootxx;
@@ -261,7 +262,7 @@
 }
 
 static void
-install_sd (char *devnm, struct disklabel *label)
+install_sd(char *devnm, struct disklabel *label)
 {
 	const char	 *machpath;
 	char		 *xxb00t, *xxboot, *bootxx;
@@ -316,16 +317,17 @@
 		if (write(fd, &bootarea, sizeof(bootarea)) != sizeof(bootarea))
 			err(EXIT_FAILURE, "%s", devnm);
 		if (verbose)
-			printf("Boot block installed on %s (sector %d)\n", devnm,
-								    bbsec);
+			printf("Boot block installed on %s (sector %d)\n",
+			    devnm, bbsec);
 		if (xxb00t) {
 			if (lseek(fd, (off_t)0, SEEK_SET) != 0)
 				err(EXIT_FAILURE, "%s", devnm);
-			if (write(fd, &ahdiboot, sizeof(ahdiboot)) != sizeof(ahdiboot))
+			if (write(fd, &ahdiboot, sizeof(ahdiboot)) !=
+			    sizeof(ahdiboot))
 				err(EXIT_FAILURE, "%s", devnm);
 			if (verbose)
 				printf("AHDI root  installed on %s (0)\n",
-								devnm);
+				    devnm);
 		}
 		if (close(fd))
 			err(EXIT_FAILURE, "%s", devnm);
@@ -333,7 +335,7 @@
 }
 
 static void
-install_wd (char *devnm, struct disklabel *label)
+install_wd(char *devnm, struct disklabel *label)
 {
 	const char	 *machpath;
 	char		 *xxb00t, *xxboot, *bootxx;
@@ -388,8 +390,8 @@
 		if (write(fd, &bootarea, sizeof(bootarea)) != sizeof(bootarea))
 			err(EXIT_FAILURE, "%s", devnm);
 		if (verbose)
-			printf("Boot block installed on %s (sector %d)\n", devnm,
-								    bbsec);
+			printf("Boot block installed on %s (sector %d)\n",
+			    devnm, bbsec);
 		if (xxb00t) {
 			if (lseek(fd, (off_t)0, SEEK_SET) != 0)
 				err(EXIT_FAILURE, "%s", devnm);
@@ -397,8 +399,8 @@
 							!= sizeof(ahdiboot))
 				err(EXIT_FAILURE, "%s", devnm);
 			if (verbose)
-				printf("AHDI root  installed on %s (sector 0)\n",
-									devnm);
+				printf("AHDI root installed on %s (sector 0)\n",
+				    devnm);
 		}
 		if (close(fd))
 			err(EXIT_FAILURE, "%s", devnm);
@@ -406,11 +408,8 @@
 }
 
 static void
-mkahdiboot (newroot, xxb00t, devnm, bbsec)
-	struct ahdi_root *newroot;
-	char		 *xxb00t,
-			 *devnm;
-	u_int32_t	 bbsec;
+mkahdiboot(struct ahdi_root *newroot, char *xxb00t, char *devnm,
+    u_int32_t bbsec)
 {
 	struct ahdi_root tmproot;
 	struct ahdi_part *pd;
@@ -455,12 +454,8 @@
 }
 
 static void
-mkbootblock (bb, xxb, bxx, label, magic)
-	struct bootblock *bb;
-	char		 *xxb,
-			 *bxx;
-	u_int		 magic;
-	struct disklabel *label;
+mkbootblock(struct bootblock *bb, char *xxb, char *bxx,
+    struct disklabel *label, u_int magic)
 {
 	int		 fd;
 
@@ -546,7 +541,7 @@
 }
 
 static void
-setNVpref ()
+setNVpref(void)
 {
 	static const u_char	bootpref = BOOTPREF_NETBSD;
 	static const char	nvrdev[] = PATH_NVRAM;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/evbarm/conf/MMNET_GENERIC	Thu Nov 10 14:31:09 2011 +0000
@@ -0,0 +1,649 @@
+# $NetBSD: MMNET_GENERIC,v 1.1.2.2 2011/11/10 14:31:39 yamt Exp $
+#
+# GENERIC machine description file
+#
+# This machine description file is used to generate the default NetBSD
+# kernel.  The generic kernel does not include all options, subsystems
+# and device drivers, but should be useful for most applications.
+#
+# The machine description file can be customised for your specific
+# machine to reduce the kernel size and improve its performance.
+#
+# For further information on compiling NetBSD kernels, see the config(8)
+# man page.
+#
+# For further information on hardware support for this architecture, see
+# the intro(4) man page.  For further information about kernel options
+# for this architecture, see the options(4) man page.  For an explanation
+# of each device driver in this file see the section 4 man page for the
+# device.
+
+include		"arch/evbarm/conf/std.mmnet"
+
+options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
+
+#ident 		"GENERIC-$Revision: 1.1.2.2 $"
+
+maxusers	32		# estimated number of users
+
+# CPU support.
+options		CPU_ARM9E
+makeoptions	CPUFLAGS="-mtune=arm926ej-s -mcpu=arm926ej-s"
+
+# CPU-related options.
+#options 	MATH_EMULATE	# floating point emulation
+
+# doesn't work with MP just yet..
+#options 	PERFCTRS	# performance-monitoring counters support
+
+#options 	MULTIBOOT	# Multiboot support (see multiboot(8))
+
+# delay between "rebooting ..." message and hardware reset, in milliseconds
+#options 	CPURESET_DELAY=2000
+
+# This option allows you to force a serial console at the specified
+# I/O address.   see console(4) for details.
+#options 	CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=57600
+#	you don't want the option below ON iff you are using the
+#	serial console option of the new boot strap code.
+#options 	CONS_OVERRIDE	# Always use above! independent of boot info
+
+# Standard system options
+
+#options 	INSECURE	# disable kernel security levels - X needs this
+
+options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
+options 	NTP		# NTP phase/frequency locked loop
+
+options 	KTRACE		# system call tracing via ktrace(1)
+
+options 	SYSVMSG		# System V-like message queues
+options 	SYSVSEM		# System V-like semaphores
+#options 	SEMMNI=10	# number of semaphore identifiers
+#options 	SEMMNS=60	# number of semaphores in system
+#options 	SEMUME=10	# max number of undo entries per process
+#options 	SEMMNU=30	# number of undo structures in system
+options 	SYSVSHM		# System V-like memory sharing
+options 	P1003_1B_SEMAPHORE	# p1003.1b semaphore support
+
+
+#options 	USERCONF	# userconf(4) support
+#options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
+options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
+
+# Beep when it is safe to power down the system (requires sysbeep)
+#options 	BEEP_ONHALT
+# Some tunable details of the above feature (default values used below)
+#options 	BEEP_ONHALT_COUNT=3	# Times to beep
+#options 	BEEP_ONHALT_PITCH=1500	# Default frequency (in Hz)
+#options 	BEEP_ONHALT_PERIOD=250	# Default duration (in msecs)
+
+# Enable experimental buffer queue strategy for better responsiveness under
+# high disk I/O load. Likely stable but not yet the default.
+#options 	BUFQ_READPRIO
+#options 	BUFQ_PRIOCSCAN
+
+# Diagnostic/debugging support options
+options 	DIAGNOSTIC	# expensive kernel consistency checks
+options 	DEBUG		# expensive debugging checks/support
+options 	KMEMSTATS	# kernel memory statistics (vmstat -m)
+options 	DDB		# in-kernel debugger
+options 	DDB_ONPANIC=1	# see also sysctl(8): `ddb.onpanic'
+options 	DDB_HISTORY_SIZE=512	# enable history editing in DDB
+#options 	KGDB		# remote debugger
+#options 	KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x3f8,KGDB_DEVRATE=9600
+makeoptions	DEBUG="-Os -g"	# compile full symbol table
+options     SYMTAB_SPACE=600000
+#options 	SYSCALL_STATS	# per syscall counts
+#options 	SYSCALL_TIMES	# per syscall times
+#options 	SYSCALL_TIMES_HASCOUNTER	# use 'broken' rdtsc (soekris)
+
+# Compatibility options
+#options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI
+#options 	COMPAT_09	# NetBSD 0.9
+#options 	COMPAT_10	# NetBSD 1.0
+#options 	COMPAT_11	# NetBSD 1.1
+#options 	COMPAT_12	# NetBSD 1.2, 386BSD, and BSDI
+#options 	COMPAT_13	# NetBSD 1.3, 386BSD, and BSDI
+#options 	COMPAT_14	# NetBSD 1.4
+#options 	COMPAT_15	# NetBSD 1.5
+options 	COMPAT_16	# NetBSD 1.6
+options 	COMPAT_20	# NetBSD 2.0
+options 	COMPAT_30	# NetBSD 3.0
+options 	COMPAT_43	# 4.3BSD, 386BSD, and BSDI
+#options 	COMPAT_386BSD_MBRPART # recognize old partition ID
+#options 	TCP_COMPAT_42	# 4.2BSD TCP/IP bug compat. Not recommended.
+
+#options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility
+#options 	COMPAT_SVR4	# binary compatibility with SVR4
+#options 	COMPAT_IBCS2	# binary compatibility with SCO and ISC
+#options 	COMPAT_LINUX	# binary compatibility with Linux
+#options 	COMPAT_FREEBSD	# binary compatibility with FreeBSD
+#options 	COMPAT_MACH	# binary compatibility with Mach binaries
+#options 	COMPAT_DARWIN	# binary compatibility with Darwin binaries
+#options 	EXEC_MACHO	# exec MACH-O binaries
+#options 	COMPAT_NDIS	# NDIS network driver
+#options 	COMPAT_PECOFF	# kernel support to run Win32 apps
+options 	COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
+
+# File systems
+file-system 	FFS		# UFS
+#file-system 	EXT2FS		# second extended file system (linux)
+#file-system 	LFS		# log-structured file system
+file-system 	MFS		# memory file system
+file-system 	NFS		# Network File System client
+#file-system 	NTFS		# Windows/NT file system (experimental)
+#file-system 	CD9660		# ISO 9660 + Rock Ridge file system
+file-system 	MSDOSFS		# MS-DOS file system
+#file-system 	FDESC		# /dev/fd
+file-system 	KERNFS		# /kern
+file-system 	NULLFS		# loopback file system
+#file-system 	OVERLAY		# overlay file system
+#file-system 	PROCFS		# /proc
+#file-system 	UMAPFS		# NULLFS + uid and gid remapping
+file-system 	UNION		# union file system
+#file-system	CODA		# Coda File System; also needs vcoda (below)
+#file-system	SMBFS		# experimental - CIFS; also needs nsmb (below)
+file-system	PTYFS		# /dev/ptm support
+file-system	TMPFS		# Efficient memory file-system
+#file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
+
+# File system options
+#options 	QUOTA		# UFS quotas
+#options 	FFS_EI		# FFS Endian Independent support
+options 	WAPBL		# File system journaling support - Experimental
+# Note that UFS_DIRHASH is suspected of causing kernel memory corruption.
+# It is not recommended for general use.
+#options 	UFS_DIRHASH	# UFS Large Directory Hashing - Experimental
+#options 	NFSSERVER	# Network File System server
+options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
+#options 	EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
+				# immutable) behave as system flags.
+
+# Networking options
+options 	GATEWAY		# packet forwarding
+options 	INET		# IP + ICMP + TCP + UDP
+#options 	INET6		# IPV6
+#options 	IPSEC		# IP security
+#options 	IPSEC_ESP	# IP security (encryption part; define w/IPSEC)
+#options 	IPSEC_NAT_T	# IPsec NAT traversal (NAT-T)
+#options 	IPSEC_DEBUG	# debug for IP security
+#options 	MROUTING	# IP multicast routing
+#options 	PIM		# Protocol Independent Multicast
+#options 	ISO,TPIP	# OSI
+#options 	EON		# OSI tunneling over IP
+#options 	NETATALK	# AppleTalk networking protocols
+options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
+options 	PPP_DEFLATE	# Deflate compression support for PPP
+options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
+options 	PFIL_HOOKS	# pfil(9) packet filter hooks
+options 	IPFILTER_LOG	# ipmon(8) log support
+options 	IPFILTER_LOOKUP	# ippool(8) support
+#options 	IPFILTER_DEFAULT_BLOCK	# block all packets by default
+#options 	TCP_DEBUG	# Record last TCP_NDEBUG packets with SO_DEBUG
+
+#options 	ALTQ		# Manipulate network interfaces' output queues
+#options 	ALTQ_BLUE	# Stochastic Fair Blue
+#options 	ALTQ_CBQ	# Class-Based Queueing
+#options 	ALTQ_CDNR	# Diffserv Traffic Conditioner
+#options 	ALTQ_FIFOQ	# First-In First-Out Queue
+#options 	ALTQ_FLOWVALVE	# RED/flow-valve (red-penalty-box)
+#options 	ALTQ_HFSC	# Hierarchical Fair Service Curve
+#options 	ALTQ_LOCALQ	# Local queueing discipline
+#options 	ALTQ_PRIQ	# Priority Queueing
+#options 	ALTQ_RED	# Random Early Detection
+#options 	ALTQ_RIO	# RED with IN/OUT
+#options 	ALTQ_WFQ	# Weighted Fair Queueing
+
+# These options enable verbose messages for several subsystems.
+# Warning, these may compile large string tables into the kernel!
+options 	MIIVERBOSE	# verbose PHY autoconfig messages
+options 	PCMCIAVERBOSE	# verbose PCMCIA configuration messages
+options 	SCSIVERBOSE	# human readable SCSI error messages
+options 	USBVERBOSE	# verbose USB device autoconfig messages
+
+options 	NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM
+
+#
+# wscons options
+#
+# builtin terminal emulations
+#options 	WSEMUL_SUN		# sun terminal emulation
+#options 	WSEMUL_VT100		# VT100 / VT220 emulation
+# customization of console and kernel output - see dev/wscons/wsdisplayvar.h
+#options 	WSDISPLAY_CUSTOM_OUTPUT	# color customization from wsconsctl(8)
+#options 	WS_DEFAULT_FG=WSCOL_WHITE
+#options 	WS_DEFAULT_BG=WSCOL_BLACK
+#options 	WS_DEFAULT_COLATTR="(0)"
+#options 	WS_DEFAULT_MONOATTR="(0)"
+#options 	WS_KERNEL_FG=WSCOL_GREEN
+#options 	WS_KERNEL_BG=WSCOL_BLACK
+#options 	WS_KERNEL_COLATTR=""
+#options 	WS_KERNEL_MONOATTR=""
+# customization of console border color
+#options 	WSDISPLAY_CUSTOM_BORDER	# custom border colors via wsconsctl(8)
+#options 	WSDISPLAY_BORDER_COLOR=WSCOL_BLUE	# default color
+# compatibility to other console drivers
+#options 	WSDISPLAY_COMPAT_PCVT		# emulate some ioctls
+#options 	WSDISPLAY_COMPAT_SYSCONS	# emulate some ioctls
+#options 	WSDISPLAY_COMPAT_USL		# VT handling
+#options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
+#options 	WSKBD_EVENT_AUTOREPEAT		# auto repeat in event mode
+#options 	WSKBD_USONLY			# strip off non-US keymaps
+# don't attach pckbd as the console if no PS/2 keyboard is found
+#options 	PCKBD_CNATTACH_MAY_FAIL
+# see dev/pckbport/wskbdmap_mfii.c for implemented layouts
+#options 	PCKBD_LAYOUT="(KB_DE | KB_NODEAD)" # for pckbd driver
+#options 	UKBD_LAYOUT="(KB_DE | KB_NODEAD)"  # for ukbd driver
+# allocate a number of virtual screens at autoconfiguration time
+#options 	WSDISPLAY_DEFAULTSCREENS=4
+# use a large software cursor that doesn't blink
+#options 	PCDISPLAY_SOFTCURSOR
+# modify the screen type of the console; defaults to "80x25"
+#options 	VGA_CONSOLE_SCREENTYPE="\"80x24\""
+# work around a hardware bug that loaded fonts don't work; found on ATI cards
+#options 	VGA_CONSOLE_ATI_BROKEN_FONTSEL
+# console scrolling support.
+#options 	WSDISPLAY_SCROLLSUPPORT
+# enable VGA raster mode capable of displaying multilingual text on console
+#options 	VGA_RASTERCONSOLE
+# enable splash screen support; requires hw driver support
+#options 	SPLASHSCREEN
+#options 	SPLASHSCREEN_PROGRESS
+