Index: projects/arm_intrng/ObsoleteFiles.inc =================================================================== --- projects/arm_intrng/ObsoleteFiles.inc (revision 276247) +++ projects/arm_intrng/ObsoleteFiles.inc (revision 276248) @@ -1,6655 +1,6680 @@ # # $FreeBSD$ # # This file lists old files (OLD_FILES), libraries (OLD_LIBS) and # directories (OLD_DIRS) which should get removed at an update. Recently # removed entries first (with the date as a comment). Dynamic libraries are # special cased (OLD_LIBS). Static libraries or the generic links to # the dynamic libraries (lib*.so) should (if you don't know why to make an # exception, make this a "must") be viewed as normal files (OLD_FILES). # # In case of a complete directory hierarchy the sorting is in depth first # order. # # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # # Before you commit changes to this file please check if any entries in # tools/build/mk/OptionalObsoleteFiles.inc can be removed. The following # command tells which files are listed more than once regardless of some # architecture specific conditionals, so you can not blindly trust the # output: # ( grep '+=' /usr/src/ObsoleteFiles.inc | sort -u ; \ # grep '+=' /usr/src/tools/build/mk/OptionalObsoleteFiles.inc | sort -u) | \ # sort | uniq -d # # To find regular duplicates not dependant on optional components, you can # also use something that will not give you false positives, e.g.: # for t in `make -V TARGETS universe`; do # __MAKE_CONF=/dev/null make -f Makefile.inc1 TARGET=$t \ # -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \ # xargs -n1 | sort | uniq -d; # done # # For optional components, you can use the following to see if some entries # in OptionalObsoleteFiles.inc have been obsoleted by ObsoleteFiles.inc # for o in tools/build/options/WITH*; do # __MAKE_CONF=/dev/null make -f Makefile.inc1 -D${o##*/} \ # -V OLD_FILES -V OLD_LIBS -V OLD_DIRS check-old | \ # xargs -n1 | sort | uniq -d; # done +# 20141226: Remove gpib/ieee488 +OLD_FILES+=usr/include/dev/ieee488/ibfoo_int.h +OLD_FILES+=usr/include/dev/ieee488/tnt4882.h +OLD_FILES+=usr/include/dev/ieee488/ugpib.h +OLD_FILES+=usr/include/dev/ieee488/upd7210.h +OLD_DIRS+=usr/include/dev/ieee488 +OLD_FILES+=usr/include/gpib/gpib.h +OLD_DIRS+=usr/include/gpib +OLD_FILES+=usr/lib/libgpib.a +OLD_FILES+=usr/lib/libgpib_p.a +OLD_FILES+=usr/lib/libgpib.so +OLD_LIBS+=usr/lib/libgpib.so.3 +OLD_FILES+=usr/lib/libgpib_p.a +OLD_FILES+=share/man/man4/pcii.4.gz +OLD_FILES+=share/man/man4/gpib.4.gz +OLD_FILES+=share/man/man4/tnt4882.4.gz +.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" +OLD_FILES+=usr/lib32/libgpib.a +OLD_FILES+=usr/lib32/libgpib_p.a +OLD_FILES+=usr/lib32/libgpib.so +OLD_LIBS+=usr/lib32/libgpib.so.3 +.endif + +# 20141224: libxo moved to /lib +OLD_LIBS+=usr/lib/libxo.so.0 # 20141223: remove in6_gif.h, in_gif.h and if_stf.h OLD_FILES+=usr/include/net/if_stf.h OLD_FILES+=usr/include/netinet/in_gif.h OLD_FILES+=usr/include/netinet6/in6_gif.h # 20141202: update to mandoc CVS 20141201 OLD_FILES+=usr.bin/preconv OLD_FILES+=share/man/man1/preconv.1.gz # 20141129: mrouted rc.d scripts removed from base OLD_FILES+=etc/rc.d/mrouted # 20141126: convert sbin/mdconfig/tests to ATF format tests OLD_FILES+=usr/tests/sbin/mdconfig/legacy_test OLD_FILES+=usr/tests/sbin/mdconfig/mdconfig.test OLD_FILES+=usr/tests/sbin/mdconfig/run.pl # 20141126: remove xform_ipip decapsulation fallback OLD_FILES+=usr/include/netipsec/ipip_var.h # 20141109: faith/faithd removal OLD_FILES+=etc/rc.d/faith OLD_FILES+=usr/share/man/man4/faith.4.gz OLD_FILES+=usr/share/man/man4/if_faith.4.gz OLD_FILES+=usr/sbin/faithd OLD_FILES+=usr/share/man/man8/faithd.8.gz # 20141107: overhaul if_gre(4) OLD_FILES+=usr/include/netinet/ip_gre.h # 20141102: postrandom obsoleted by new /dev/random code OLD_FILES+=etc/rc.d/postrandom # 20141031: initrandom obsoleted by new /dev/random code OLD_FILES+=etc/rc.d/initrandom # 20141028: debug files accidentally installed as directory name OLD_FILES+=usr/lib/debug/usr/lib/i18n OLD_FILES+=usr/lib/debug/usr/lib/private OLD_FILES+=usr/lib/debug/usr/lib32/i18n OLD_FILES+=usr/lib/debug/usr/lib32/private # 20141015: OpenSSL 1.0.1j import OLD_FILES+=usr/share/openssl/man/man3/CMS_sign_add1_signer.3.gz # 20140922: sleepq_calc_signal_retval.9 and sleepq_catch_signals.9 removed OLD_FILES+=usr/share/man/man9/sleepq_calc_signal_retval.9.gz OLD_FILES+=usr/share/man/man9/sleepq_catch_signals.9.gz # 20140917: hv_kvpd rc.d script removed in favor of devd configuration OLD_FILES+=etc/rc.d/hv_kvpd # 20140917: libnv was accidentally being installed to /usr/lib instead of /lib OLD_LIBS+=usr/lib/libnv.so.0 # 20140829: rc.d/kerberos removed OLD_FILES+=etc/rc.d/kerberos # 20140814: libopie version bump OLD_LIBS+=usr/lib/libopie.so.7 OLD_LIBS+=usr/lib32/libopie.so.7 # 20140811: otp-sha renamed to otp-sha1 OLD_FILES+=usr/bin/otp-sha OLD_FILES+=usr/share/man/man1/otp-sha.1.gz # 20140807: Remove private lib files that should not be installed. OLD_FILES+=usr/lib/private/libatf-c.a OLD_FILES+=usr/lib/private/libatf-c.so OLD_FILES+=usr/lib/private/libatf-c_p.a OLD_FILES+=usr/lib/private/libatf-c++.a OLD_FILES+=usr/lib/private/libatf-c++.so OLD_FILES+=usr/lib/private/libatf-c++_p.a OLD_FILES+=usr/lib/private/libbsdstat.a OLD_FILES+=usr/lib/private/libbsdstat.so OLD_FILES+=usr/lib/private/libbsdstat_p.a OLD_FILES+=usr/lib/private/libheimipcc.a OLD_FILES+=usr/lib/private/libheimipcc.so OLD_FILES+=usr/lib/private/libheimipcc_p.a OLD_FILES+=usr/lib/private/libheimipcs.a OLD_FILES+=usr/lib/private/libheimipcs.so OLD_FILES+=usr/lib/private/libheimipcs_p.a OLD_FILES+=usr/lib/private/libldns.a OLD_FILES+=usr/lib/private/libldns.so OLD_FILES+=usr/lib/private/libldns_p.a OLD_FILES+=usr/lib/private/libssh.a OLD_FILES+=usr/lib/private/libssh.so OLD_FILES+=usr/lib/private/libssh.p.a OLD_FILES+=usr/lib/private/libunbound.a OLD_FILES+=usr/lib/private/libunbound.so OLD_FILES+=usr/lib/private/libunbound_p.a OLD_FILES+=usr/lib/private/libucl.a OLD_FILES+=usr/lib/private/libucl.so OLD_FILES+=usr/lib/private/libucl_p.a # 20140803: Remove an obsolete man page OLD_FILES+=usr/share/man/man9/pmap_change_wiring.9.gz # 20140728: libsbuf restored to old version. OLD_LIBS+=lib/libsbuf.so.7 # 20140728: Remove an obsolete man page OLD_FILES+=usr/share/man/man9/VOP_GETVOBJECT.9.gz OLD_FILES+=usr/share/man/man9/VOP_CREATEVOBJECT.9.gz OLD_FILES+=usr/share/man/man9/VOP_DESTROYVOBJECT.9.gz # 20140723: renamed to PCBGROUP.9 OLD_FILES+=usr/share/man/man9/PCBGROUPS.9.gz # 20140718: Remove obsolete man pages OLD_FILES+=usr/share/man/man9/zero_copy.9.gz OLD_FILES+=usr/share/man/man9/zero_copy_sockets.9.gz # 20140718: Remove an obsolete man page OLD_FILES+=usr/share/man/man9/pmap_page_protect.9.gz # 20140717: Remove an obsolete man page OLD_FILES+=usr/share/man/man9/pmap_clear_reference.9.gz # 20140716: Remove an incorrectly named man page OLD_FILES+=usr/share/man/man9/pmap_ts_modified.9.gz # 20140712: Removal of bsd.dtrace.mk OLD_FILES+=usr/share/mk/bsd.dtrace.mk # 20140705: turn libreadline into an internal lib OLD_LIBS+=lib/libreadline.so.8 OLD_FILES+=usr/lib/libreadline.a OLD_FILES+=usr/lib/libreadline_p.a OLD_FILES+=usr/lib/libreadline.so OLD_FILES+=usr/lib/libhistory.a OLD_FILES+=usr/lib/libhistory_p.a OLD_FILES+=usr/lib/libhistory.so OLD_LIBS+=usr/lib/libhistory.so.8 OLD_FILES+=usr/include/readline/chardefs.h OLD_FILES+=usr/include/readline/history.h OLD_FILES+=usr/include/readline/keymaps.h OLD_FILES+=usr/include/readline/readline.h OLD_FILES+=usr/include/readline/tilde.h OLD_FILES+=usr/include/readline/rlconf.h OLD_FILES+=usr/include/readline/rlstdc.h OLD_FILES+=usr/include/readline/rltypedefs.h OLD_FILES+=usr/include/readline/rltypedefs.h OLD_DIRS+=usr/include/readline OLD_FILES+=usr/share/info/readline.info.gz OLD_FILES+=usr/share/man/man3/readline.3.gz # 20140625: csup removal OLD_FILES+=usr/bin/csup OLD_FILES+=usr/bin/cpasswd OLD_FILES+=usr/share/man/man1/csup.1.gz OLD_FILES+=usr/share/man/man1/cpasswd.1.gz OLD_FILES+=usr/share/examples/cvsup/README OLD_FILES+=usr/share/examples/cvsup/cvs-supfile OLD_FILES+=usr/share/examples/cvsup/stable-supfile OLD_FILES+=usr/share/examples/cvsup/standard-supfile OLD_DIRS+=usr/share/examples/cvsup # 20140614: send-pr removal OLD_FILES+=usr/bin/sendbug OLD_FILES+=usr/share/info/send-pr.info.gz OLD_FILES+=usr/share/man/man1/send-pr.1.gz OLD_FILES+=usr/share/man/man1/sendbug.1.gz OLD_FILES+=etc/gnats/freefall OLD_DIRS+=etc/gnats # 20140512: new clang import which bumps version from 3.4 to 3.4.1. OLD_FILES+=usr/include/clang/3.4/__wmmintrin_aes.h OLD_FILES+=usr/include/clang/3.4/__wmmintrin_pclmul.h OLD_FILES+=usr/include/clang/3.4/altivec.h OLD_FILES+=usr/include/clang/3.4/ammintrin.h OLD_FILES+=usr/include/clang/3.4/avx2intrin.h OLD_FILES+=usr/include/clang/3.4/avxintrin.h OLD_FILES+=usr/include/clang/3.4/bmi2intrin.h OLD_FILES+=usr/include/clang/3.4/bmiintrin.h OLD_FILES+=usr/include/clang/3.4/cpuid.h OLD_FILES+=usr/include/clang/3.4/emmintrin.h OLD_FILES+=usr/include/clang/3.4/f16cintrin.h OLD_FILES+=usr/include/clang/3.4/fma4intrin.h OLD_FILES+=usr/include/clang/3.4/fmaintrin.h OLD_FILES+=usr/include/clang/3.4/immintrin.h OLD_FILES+=usr/include/clang/3.4/lzcntintrin.h OLD_FILES+=usr/include/clang/3.4/mm3dnow.h OLD_FILES+=usr/include/clang/3.4/mm_malloc.h OLD_FILES+=usr/include/clang/3.4/mmintrin.h OLD_FILES+=usr/include/clang/3.4/module.map OLD_FILES+=usr/include/clang/3.4/nmmintrin.h OLD_FILES+=usr/include/clang/3.4/pmmintrin.h OLD_FILES+=usr/include/clang/3.4/popcntintrin.h OLD_FILES+=usr/include/clang/3.4/prfchwintrin.h OLD_FILES+=usr/include/clang/3.4/rdseedintrin.h OLD_FILES+=usr/include/clang/3.4/rtmintrin.h OLD_FILES+=usr/include/clang/3.4/shaintrin.h OLD_FILES+=usr/include/clang/3.4/smmintrin.h OLD_FILES+=usr/include/clang/3.4/tbmintrin.h OLD_FILES+=usr/include/clang/3.4/tmmintrin.h OLD_FILES+=usr/include/clang/3.4/wmmintrin.h OLD_FILES+=usr/include/clang/3.4/x86intrin.h OLD_FILES+=usr/include/clang/3.4/xmmintrin.h OLD_FILES+=usr/include/clang/3.4/xopintrin.h OLD_FILES+=usr/include/clang/3.4/arm_neon.h OLD_FILES+=usr/include/clang/3.4/module.map OLD_DIRS+=usr/include/clang/3.4 # 20140505: Bogusly installing src.opts.mk OLD_FILES+=usr/share/mk/src.opts.mk # 20140505: Reject PR kern/187551 OLD_DIRS+=usr/tests/sbin/ifconfig OLD_FILES+=usr/tests/sbin/ifconfig/Kyuafile OLD_FILES+=usr/tests/sbin/ifconfig/fibs_test # 20140502: Removal of lindev(4) OLD_FILES+=usr/share/man/man4/lindev.4.gz # 20140314: AppleTalk OLD_DIRS+=usr/include/netatalk OLD_FILES+=usr/include/netatalk/aarp.h OLD_FILES+=usr/include/netatalk/at.h OLD_FILES+=usr/include/netatalk/at_extern.h OLD_FILES+=usr/include/netatalk/at_var.h OLD_FILES+=usr/include/netatalk/ddp.h OLD_FILES+=usr/include/netatalk/ddp_pcb.h OLD_FILES+=usr/include/netatalk/ddp_var.h OLD_FILES+=usr/include/netatalk/endian.h OLD_FILES+=usr/include/netatalk/phase2.h # 20140314: Remove IPX/SPX OLD_LIBS+=lib/libipx.so.5 OLD_FILES+=usr/include/netipx/ipx.h OLD_FILES+=usr/include/netipx/ipx_if.h OLD_FILES+=usr/include/netipx/ipx_pcb.h OLD_FILES+=usr/include/netipx/ipx_var.h OLD_FILES+=usr/include/netipx/spx.h OLD_FILES+=usr/include/netipx/spx_debug.h OLD_FILES+=usr/include/netipx/spx_timer.h OLD_FILES+=usr/include/netipx/spx_var.h OLD_DIRS+=usr/include/netipx OLD_FILES+=usr/lib/libipx.a OLD_FILES+=usr/lib/libipx.so OLD_FILES+=usr/lib/libipx_p.a OLD_FILES+=usr/lib32/libipx.a OLD_FILES+=usr/lib32/libipx.so OLD_LIBS+=usr/lib32/libipx.so.5 OLD_FILES+=usr/lib32/libipx_p.a OLD_FILES+=usr/sbin/IPXrouted OLD_FILES+=usr/share/man/man3/ipx.3.gz OLD_FILES+=usr/share/man/man3/ipx_addr.3.gz OLD_FILES+=usr/share/man/man3/ipx_ntoa.3.gz OLD_FILES+=usr/share/man/man4/ef.4.gz OLD_FILES+=usr/share/man/man4/if_ef.4.gz OLD_FILES+=usr/share/man/man8/IPXrouted.8.gz # 20140314: bsdconfig usermgmt rewrite OLD_FILES+=usr/libexec/bsdconfig/070.usermgmt/userinput # 20140307: bsdconfig groupmgmt rewrite OLD_FILES+=usr/libexec/bsdconfig/070.usermgmt/groupinput # 20140223: Remove libyaml OLD_FILES+=usr/lib/private/libyaml.a OLD_FILES+=usr/lib/private/libyaml.so OLD_FILES+=usr/lib/private/libyaml.so.1 OLD_FILES+=usr/lib/private/libyaml_p.a # 20140216: new clang import which bumps version from 3.3 to 3.4. OLD_FILES+=usr/bin/llvm-prof OLD_FILES+=usr/bin/llvm-ranlib OLD_FILES+=usr/include/clang/3.3/__wmmintrin_aes.h OLD_FILES+=usr/include/clang/3.3/__wmmintrin_pclmul.h OLD_FILES+=usr/include/clang/3.3/altivec.h OLD_FILES+=usr/include/clang/3.3/ammintrin.h OLD_FILES+=usr/include/clang/3.3/avx2intrin.h OLD_FILES+=usr/include/clang/3.3/avxintrin.h OLD_FILES+=usr/include/clang/3.3/bmi2intrin.h OLD_FILES+=usr/include/clang/3.3/bmiintrin.h OLD_FILES+=usr/include/clang/3.3/cpuid.h OLD_FILES+=usr/include/clang/3.3/emmintrin.h OLD_FILES+=usr/include/clang/3.3/f16cintrin.h OLD_FILES+=usr/include/clang/3.3/fma4intrin.h OLD_FILES+=usr/include/clang/3.3/fmaintrin.h OLD_FILES+=usr/include/clang/3.3/immintrin.h OLD_FILES+=usr/include/clang/3.3/lzcntintrin.h OLD_FILES+=usr/include/clang/3.3/mm3dnow.h OLD_FILES+=usr/include/clang/3.3/mm_malloc.h OLD_FILES+=usr/include/clang/3.3/mmintrin.h OLD_FILES+=usr/include/clang/3.3/module.map OLD_FILES+=usr/include/clang/3.3/nmmintrin.h OLD_FILES+=usr/include/clang/3.3/pmmintrin.h OLD_FILES+=usr/include/clang/3.3/popcntintrin.h OLD_FILES+=usr/include/clang/3.3/prfchwintrin.h OLD_FILES+=usr/include/clang/3.3/rdseedintrin.h OLD_FILES+=usr/include/clang/3.3/rtmintrin.h OLD_FILES+=usr/include/clang/3.3/smmintrin.h OLD_FILES+=usr/include/clang/3.3/tmmintrin.h OLD_FILES+=usr/include/clang/3.3/wmmintrin.h OLD_FILES+=usr/include/clang/3.3/x86intrin.h OLD_FILES+=usr/include/clang/3.3/xmmintrin.h OLD_FILES+=usr/include/clang/3.3/xopintrin.h OLD_FILES+=usr/share/man/man1/llvm-prof.1.gz OLD_FILES+=usr/share/man/man1/llvm-ranlib.1.gz OLD_DIRS+=usr/include/clang/3.3 # 20140216: nve(4) removed OLD_FILES+=usr/share/man/man4/if_nve.4.gz OLD_FILES+=usr/share/man/man4/nve.4.gz # 20140205: Open Firmware device moved OLD_FILES+=usr/include/dev/ofw/ofw_nexus.h # 20140128: libelf and libdwarf import OLD_LIBS+=usr/lib/libelf.so.1 OLD_LIBS+=usr/lib32/libelf.so.1 OLD_LIBS+=usr/lib/libdwarf.so.3 OLD_LIBS+=usr/lib32/libdwarf.so.3 # 20140123: apicvar header moved to x86 OLD_FILES+=usr/include/machine/apicvar.h # 20131215: libcam version bumped OLD_LIBS+=lib/libcam.so.6 usr/lib32/libcam.so.6 # 20131202: libcapsicum and libcasper moved to /lib/ OLD_LIBS+=usr/lib/libcapsicum.so.0 OLD_LIBS+=usr/lib/libcasper.so.0 # 20131109: extattr(2) mlinks fixed OLD_FILES+=usr/share/man/man2/extattr_delete_list.2.gz OLD_FILES+=usr/share/man/man2/extattr_get_list.2.gz # 20131107: example files removed OLD_FILES+=usr/share/examples/libusb20/aux.c OLD_FILES+=usr/share/examples/libusb20/aux.h # 20131105: tzdata 2013h import OLD_FILES+=usr/share/zoneinfo/America/Shiprock OLD_FILES+=usr/share/zoneinfo/Antarctica/South_Pole # 20131103: WITH_LIBICONV_COMPAT removal OLD_FILES+=usr/include/_libiconv_compat.h OLD_FILES+=usr/lib/libiconv.a OLD_FILES+=usr/lib/libiconv.so OLD_FILES+=usr/lib/libiconv.so.3 OLD_FILES+=usr/lib/libiconv_p.a OLD_FILES+=usr/lib32/libiconv.a OLD_FILES+=usr/lib32/libiconv.so OLD_FILES+=usr/lib32/libiconv.so.3 OLD_FILES+=usr/lib32/libiconv_p.a # 20131103: removal of utxrm(8), use 'utx rm' instead. OLD_FILES+=usr/sbin/utxrm OLD_FILES+=usr/share/man/man8/utxrm.8.gz # 20131031: pkg_install has been removed OLD_FILES+=etc/periodic/daily/220.backup-pkgdb OLD_FILES+=etc/periodic/daily/490.status-pkg-changes OLD_FILES+=etc/periodic/security/460.chkportsum OLD_FILES+=etc/periodic/weekly/400.status-pkg OLD_FILES+=usr/sbin/pkg_add OLD_FILES+=usr/sbin/pkg_create OLD_FILES+=usr/sbin/pkg_delete OLD_FILES+=usr/sbin/pkg_info OLD_FILES+=usr/sbin/pkg_updating OLD_FILES+=usr/sbin/pkg_version OLD_FILES+=usr/share/man/man1/pkg_add.1.gz OLD_FILES+=usr/share/man/man1/pkg_create.1.gz OLD_FILES+=usr/share/man/man1/pkg_delete.1.gz OLD_FILES+=usr/share/man/man1/pkg_info.1.gz OLD_FILES+=usr/share/man/man1/pkg_updating.1.gz OLD_FILES+=usr/share/man/man1/pkg_version.1.gz # 20131030: /etc/keys moved to /usr/share/keys OLD_DIRS+=etc/keys OLD_DIRS+=etc/keys/pkg OLD_DIRS+=etc/keys/pkg/revoked OLD_DIRS+=etc/keys/pkg/trusted OLD_FILES+=etc/keys/pkg/trusted/pkg.freebsd.org.2013102301 # 20131028: ng_fec(4) removed OLD_FILES+=usr/include/netgraph/ng_fec.h OLD_FILES+=usr/share/man/man4/ng_fec.4.gz # 20131027: header moved OLD_FILES+=usr/include/net/pf_mtag.h # 20131023: remove never used iscsi directory OLD_DIRS+=usr/share/examples/iscsi # 20131021: isf(4) removed OLD_FILES+=usr/sbin/isfctl OLD_FILES+=usr/share/man/man4/isf.4.gz OLD_FILES+=usr/share/man/man8/isfctl.8.gz # 20131014: libbsdyml becomes private OLD_FILES+=usr/lib/libbsdyml.a OLD_FILES+=usr/lib/libbsdyml.so OLD_LIBS+=usr/lib/libbsdyml.so.0 OLD_FILES+=usr/lib/libbsdyml_p.a OLD_FILES+=usr/lib32/libbsdyml.a OLD_FILES+=usr/lib32/libbsdyml.so OLD_LIBS+=usr/lib32/libbsdyml.so.0 OLD_FILES+=usr/lib32/libbsdyml_p.a OLD_FILES+=usr/share/man/man3/libbsdyml.3.gz OLD_FILES+=usr/include/bsdyml.h # 20131013: Removal of the ATF tools OLD_FILES+=etc/atf/FreeBSD.conf OLD_FILES+=etc/atf/atf-run.hooks OLD_FILES+=etc/atf/common.conf OLD_FILES+=usr/bin/atf-config OLD_FILES+=usr/bin/atf-report OLD_FILES+=usr/bin/atf-run OLD_FILES+=usr/bin/atf-version OLD_FILES+=usr/share/atf/atf-run.hooks OLD_FILES+=usr/share/examples/atf/atf-run.hooks OLD_FILES+=usr/share/examples/atf/tests-results.css OLD_FILES+=usr/share/man/man1/atf-config.1.gz OLD_FILES+=usr/share/man/man1/atf-report.1.gz OLD_FILES+=usr/share/man/man1/atf-run.1.gz OLD_FILES+=usr/share/man/man1/atf-version.1.gz OLD_FILES+=usr/share/man/man5/atf-formats.5.gz OLD_FILES+=usr/share/xml/atf/tests-results.dtd OLD_FILES+=usr/share/xsl/atf/tests-results.xsl # 20131009: freebsd-version moved from /libexec to /bin OLD_FILES+=libexec/freebsd-version # 20131001: ar and ranlib from binutils not used OLD_FILES+=usr/bin/gnu-ar OLD_FILES+=usr/bin/gnu-ranlib OLD_FILES+=usr/share/man/man1/gnu-ar.1.gz OLD_FILES+=usr/share/man/man1/gnu-ranlib.1.gz # 20130930: BIND removed from base OLD_FILES+=etc/mtree/BIND.chroot.dist OLD_FILES+=etc/namedb OLD_FILES+=etc/periodic/daily/470.status-named OLD_FILES+=usr/bin/dig OLD_FILES+=usr/bin/nslookup OLD_FILES+=usr/bin/nsupdate OLD_DIRS+=usr/include/lwres OLD_FILES+=usr/include/lwres/context.h OLD_FILES+=usr/include/lwres/int.h OLD_FILES+=usr/include/lwres/ipv6.h OLD_FILES+=usr/include/lwres/lang.h OLD_FILES+=usr/include/lwres/list.h OLD_FILES+=usr/include/lwres/lwbuffer.h OLD_FILES+=usr/include/lwres/lwpacket.h OLD_FILES+=usr/include/lwres/lwres.h OLD_FILES+=usr/include/lwres/net.h OLD_FILES+=usr/include/lwres/netdb.h OLD_FILES+=usr/include/lwres/platform.h OLD_FILES+=usr/include/lwres/result.h OLD_FILES+=usr/include/lwres/version.h OLD_FILES+=usr/lib/liblwres.a OLD_FILES+=usr/lib/liblwres.so OLD_LIBS+=usr/lib/liblwres.so.90 OLD_FILES+=usr/lib/liblwres_p.a OLD_FILES+=usr/sbin/arpaname OLD_FILES+=usr/sbin/ddns-confgen OLD_FILES+=usr/sbin/dnssec-dsfromkey OLD_FILES+=usr/sbin/dnssec-keyfromlabel OLD_FILES+=usr/sbin/dnssec-keygen OLD_FILES+=usr/sbin/dnssec-revoke OLD_FILES+=usr/sbin/dnssec-settime OLD_FILES+=usr/sbin/dnssec-signzone OLD_FILES+=usr/sbin/dnssec-verify OLD_FILES+=usr/sbin/genrandom OLD_FILES+=usr/sbin/isc-hmac-fixup OLD_FILES+=usr/sbin/lwresd OLD_FILES+=usr/sbin/named OLD_FILES+=usr/sbin/named-checkconf OLD_FILES+=usr/sbin/named-checkzone OLD_FILES+=usr/sbin/named-compilezone OLD_FILES+=usr/sbin/named-journalprint OLD_FILES+=usr/sbin/named.reconfig OLD_FILES+=usr/sbin/named.reload OLD_FILES+=usr/sbin/nsec3hash OLD_FILES+=usr/sbin/rndc OLD_FILES+=usr/sbin/rndc-confgen OLD_DIRS+=usr/share/doc/bind9 OLD_FILES+=usr/share/doc/bind9/CHANGES OLD_FILES+=usr/share/doc/bind9/COPYRIGHT OLD_FILES+=usr/share/doc/bind9/FAQ OLD_FILES+=usr/share/doc/bind9/HISTORY OLD_FILES+=usr/share/doc/bind9/README OLD_DIRS+=usr/share/doc/bind9/arm OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch01.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch02.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch03.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch04.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch05.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch06.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch07.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch08.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch09.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.ch10.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.html OLD_FILES+=usr/share/doc/bind9/arm/Bv9ARM.pdf OLD_FILES+=usr/share/doc/bind9/arm/man.arpaname.html OLD_FILES+=usr/share/doc/bind9/arm/man.ddns-confgen.html OLD_FILES+=usr/share/doc/bind9/arm/man.dig.html OLD_FILES+=usr/share/doc/bind9/arm/man.dnssec-dsfromkey.html OLD_FILES+=usr/share/doc/bind9/arm/man.dnssec-keyfromlabel.html OLD_FILES+=usr/share/doc/bind9/arm/man.dnssec-keygen.html OLD_FILES+=usr/share/doc/bind9/arm/man.dnssec-revoke.html OLD_FILES+=usr/share/doc/bind9/arm/man.dnssec-settime.html OLD_FILES+=usr/share/doc/bind9/arm/man.dnssec-signzone.html OLD_FILES+=usr/share/doc/bind9/arm/man.dnssec-verify.html OLD_FILES+=usr/share/doc/bind9/arm/man.genrandom.html OLD_FILES+=usr/share/doc/bind9/arm/man.host.html OLD_FILES+=usr/share/doc/bind9/arm/man.isc-hmac-fixup.html OLD_FILES+=usr/share/doc/bind9/arm/man.named-checkconf.html OLD_FILES+=usr/share/doc/bind9/arm/man.named-checkzone.html OLD_FILES+=usr/share/doc/bind9/arm/man.named-journalprint.html OLD_FILES+=usr/share/doc/bind9/arm/man.named.html OLD_FILES+=usr/share/doc/bind9/arm/man.nsec3hash.html OLD_FILES+=usr/share/doc/bind9/arm/man.nsupdate.html OLD_FILES+=usr/share/doc/bind9/arm/man.rndc-confgen.html OLD_FILES+=usr/share/doc/bind9/arm/man.rndc.conf.html OLD_FILES+=usr/share/doc/bind9/arm/man.rndc.html OLD_DIRS+=usr/share/doc/bind9/misc OLD_FILES+=usr/share/doc/bind9/misc/dnssec OLD_FILES+=usr/share/doc/bind9/misc/format-options.pl OLD_FILES+=usr/share/doc/bind9/misc/ipv6 OLD_FILES+=usr/share/doc/bind9/misc/migration OLD_FILES+=usr/share/doc/bind9/misc/migration-4to9 OLD_FILES+=usr/share/doc/bind9/misc/options OLD_FILES+=usr/share/doc/bind9/misc/rfc-compliance OLD_FILES+=usr/share/doc/bind9/misc/roadmap OLD_FILES+=usr/share/doc/bind9/misc/sdb OLD_FILES+=usr/share/doc/bind9/misc/sort-options.pl OLD_FILES+=usr/share/man/man1/arpaname.1.gz OLD_FILES+=usr/share/man/man1/dig.1.gz OLD_FILES+=usr/share/man/man1/nslookup.1.gz OLD_FILES+=usr/share/man/man1/nsupdate.1.gz OLD_FILES+=usr/share/man/man3/lwres.3.gz OLD_FILES+=usr/share/man/man3/lwres_addr_parse.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_add.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_back.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_clear.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_first.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_forward.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_getmem.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_getuint16.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_getuint32.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_getuint8.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_init.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_invalidate.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_putmem.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_putuint16.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_putuint32.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_putuint8.3.gz OLD_FILES+=usr/share/man/man3/lwres_buffer_subtract.3.gz OLD_FILES+=usr/share/man/man3/lwres_conf_clear.3.gz OLD_FILES+=usr/share/man/man3/lwres_conf_get.3.gz OLD_FILES+=usr/share/man/man3/lwres_conf_init.3.gz OLD_FILES+=usr/share/man/man3/lwres_conf_parse.3.gz OLD_FILES+=usr/share/man/man3/lwres_conf_print.3.gz OLD_FILES+=usr/share/man/man3/lwres_config.3.gz OLD_FILES+=usr/share/man/man3/lwres_context.3.gz OLD_FILES+=usr/share/man/man3/lwres_context_allocmem.3.gz OLD_FILES+=usr/share/man/man3/lwres_context_create.3.gz OLD_FILES+=usr/share/man/man3/lwres_context_destroy.3.gz OLD_FILES+=usr/share/man/man3/lwres_context_freemem.3.gz OLD_FILES+=usr/share/man/man3/lwres_context_initserial.3.gz OLD_FILES+=usr/share/man/man3/lwres_context_nextserial.3.gz OLD_FILES+=usr/share/man/man3/lwres_context_sendrecv.3.gz OLD_FILES+=usr/share/man/man3/lwres_endhostent.3.gz OLD_FILES+=usr/share/man/man3/lwres_endhostent_r.3.gz OLD_FILES+=usr/share/man/man3/lwres_freeaddrinfo.3.gz OLD_FILES+=usr/share/man/man3/lwres_freehostent.3.gz OLD_FILES+=usr/share/man/man3/lwres_gabn.3.gz OLD_FILES+=usr/share/man/man3/lwres_gabnrequest_free.3.gz OLD_FILES+=usr/share/man/man3/lwres_gabnrequest_parse.3.gz OLD_FILES+=usr/share/man/man3/lwres_gabnrequest_render.3.gz OLD_FILES+=usr/share/man/man3/lwres_gabnresponse_free.3.gz OLD_FILES+=usr/share/man/man3/lwres_gabnresponse_parse.3.gz OLD_FILES+=usr/share/man/man3/lwres_gabnresponse_render.3.gz OLD_FILES+=usr/share/man/man3/lwres_gai_strerror.3.gz OLD_FILES+=usr/share/man/man3/lwres_getaddrinfo.3.gz OLD_FILES+=usr/share/man/man3/lwres_getaddrsbyname.3.gz OLD_FILES+=usr/share/man/man3/lwres_gethostbyaddr.3.gz OLD_FILES+=usr/share/man/man3/lwres_gethostbyaddr_r.3.gz OLD_FILES+=usr/share/man/man3/lwres_gethostbyname.3.gz OLD_FILES+=usr/share/man/man3/lwres_gethostbyname2.3.gz OLD_FILES+=usr/share/man/man3/lwres_gethostbyname_r.3.gz OLD_FILES+=usr/share/man/man3/lwres_gethostent.3.gz OLD_FILES+=usr/share/man/man3/lwres_gethostent_r.3.gz OLD_FILES+=usr/share/man/man3/lwres_getipnode.3.gz OLD_FILES+=usr/share/man/man3/lwres_getipnodebyaddr.3.gz OLD_FILES+=usr/share/man/man3/lwres_getipnodebyname.3.gz OLD_FILES+=usr/share/man/man3/lwres_getnamebyaddr.3.gz OLD_FILES+=usr/share/man/man3/lwres_getnameinfo.3.gz OLD_FILES+=usr/share/man/man3/lwres_getrrsetbyname.3.gz OLD_FILES+=usr/share/man/man3/lwres_gnba.3.gz OLD_FILES+=usr/share/man/man3/lwres_gnbarequest_free.3.gz OLD_FILES+=usr/share/man/man3/lwres_gnbarequest_parse.3.gz OLD_FILES+=usr/share/man/man3/lwres_gnbarequest_render.3.gz OLD_FILES+=usr/share/man/man3/lwres_gnbaresponse_free.3.gz OLD_FILES+=usr/share/man/man3/lwres_gnbaresponse_parse.3.gz OLD_FILES+=usr/share/man/man3/lwres_gnbaresponse_render.3.gz OLD_FILES+=usr/share/man/man3/lwres_herror.3.gz OLD_FILES+=usr/share/man/man3/lwres_hstrerror.3.gz OLD_FILES+=usr/share/man/man3/lwres_inetntop.3.gz OLD_FILES+=usr/share/man/man3/lwres_lwpacket_parseheader.3.gz OLD_FILES+=usr/share/man/man3/lwres_lwpacket_renderheader.3.gz OLD_FILES+=usr/share/man/man3/lwres_net_ntop.3.gz OLD_FILES+=usr/share/man/man3/lwres_noop.3.gz OLD_FILES+=usr/share/man/man3/lwres_nooprequest_free.3.gz OLD_FILES+=usr/share/man/man3/lwres_nooprequest_parse.3.gz OLD_FILES+=usr/share/man/man3/lwres_nooprequest_render.3.gz OLD_FILES+=usr/share/man/man3/lwres_noopresponse_free.3.gz OLD_FILES+=usr/share/man/man3/lwres_noopresponse_parse.3.gz OLD_FILES+=usr/share/man/man3/lwres_noopresponse_render.3.gz OLD_FILES+=usr/share/man/man3/lwres_packet.3.gz OLD_FILES+=usr/share/man/man3/lwres_resutil.3.gz OLD_FILES+=usr/share/man/man3/lwres_sethostent.3.gz OLD_FILES+=usr/share/man/man3/lwres_sethostent_r.3.gz OLD_FILES+=usr/share/man/man3/lwres_string_parse.3.gz OLD_FILES+=usr/share/man/man5/named.conf.5.gz OLD_FILES+=usr/share/man/man5/rndc.conf.5.gz OLD_FILES+=usr/share/man/man8/ddns-confgen.8.gz OLD_FILES+=usr/share/man/man8/dnssec-dsfromkey.8.gz OLD_FILES+=usr/share/man/man8/dnssec-keyfromlabel.8.gz OLD_FILES+=usr/share/man/man8/dnssec-keygen.8.gz OLD_FILES+=usr/share/man/man8/dnssec-revoke.8.gz OLD_FILES+=usr/share/man/man8/dnssec-settime.8.gz OLD_FILES+=usr/share/man/man8/dnssec-signzone.8.gz OLD_FILES+=usr/share/man/man8/dnssec-verify.8.gz OLD_FILES+=usr/share/man/man8/genrandom.8.gz OLD_FILES+=usr/share/man/man8/isc-hmac-fixup.8.gz OLD_FILES+=usr/share/man/man8/lwresd.8.gz OLD_FILES+=usr/share/man/man8/named-checkconf.8.gz OLD_FILES+=usr/share/man/man8/named-checkzone.8.gz OLD_FILES+=usr/share/man/man8/named-compilezone.8.gz OLD_FILES+=usr/share/man/man8/named-journalprint.8.gz OLD_FILES+=usr/share/man/man8/named.8.gz OLD_FILES+=usr/share/man/man8/named.reconfig.8.gz OLD_FILES+=usr/share/man/man8/named.reload.8.gz OLD_FILES+=usr/share/man/man8/nsec3hash.8.gz OLD_FILES+=usr/share/man/man8/rndc-confgen.8.gz OLD_FILES+=usr/share/man/man8/rndc.8.gz OLD_DIRS+=var/named/dev OLD_DIRS+=var/named/etc OLD_DIRS+=var/named/etc/namedb OLD_FILES+=var/named/etc/namedb/PROTO.localhost-v6.rev OLD_FILES+=var/named/etc/namedb/PROTO.localhost.rev OLD_DIRS+=var/named/etc/namedb/dynamic OLD_FILES+=var/named/etc/namedb/make-localhost OLD_DIRS+=var/named/etc/namedb/master OLD_FILES+=var/named/etc/namedb/master/empty.db OLD_FILES+=var/named/etc/namedb/master/localhost-forward.db OLD_FILES+=var/named/etc/namedb/master/localhost-reverse.db #OLD_FILES+=var/named/etc/namedb/named.conf # intentionally left out OLD_FILES+=var/named/etc/namedb/named.root OLD_DIRS+=var/named/etc/namedb/slave OLD_DIRS+=var/named/var OLD_DIRS+=var/named/var/dump OLD_DIRS+=var/named/var/log OLD_DIRS+=var/named/var/run OLD_DIRS+=var/named/var/run/named OLD_DIRS+=var/named/var/stats OLD_DIRS+=var/run/named # 20130923: example moved OLD_FILES+=usr/share/examples/bsdconfig/browse_packages.sh # 20130908: libssh becomes private OLD_FILES+=usr/lib/libssh.a OLD_FILES+=usr/lib/libssh.so OLD_LIBS+=usr/lib/libssh.so.5 OLD_FILES+=usr/lib/libssh_p.a OLD_FILES+=usr/lib32/libssh.a OLD_FILES+=usr/lib32/libssh.so OLD_LIBS+=usr/lib32/libssh.so.5 OLD_FILES+=usr/lib32/libssh_p.a # 20130903: gnupatch is no more OLD_FILES+=usr/bin/gnupatch OLD_FILES+=usr/share/man/man1/gnupatch.1.gz # 20130829: bsdpatch is patch unconditionally OLD_FILES+=usr/bin/bsdpatch OLD_FILES+=usr/share/man/man1/bsdpatch.1.gz # 20130822: bind 9.9.3-P2 import OLD_LIBS+=usr/lib/liblwres.so.80 # 20130814: vm_page_busy(9) OLD_FILES+=usr/share/man/man9/vm_page_flash.9.gz OLD_FILES+=usr/share/man/man9/vm_page_io.9.gz OLD_FILES+=usr/share/man/man9/vm_page_io_finish.9.gz OLD_FILES+=usr/share/man/man9/vm_page_io_start.9.gz OLD_FILES+=usr/share/man/man9/vm_page_wakeup.9.gz # 20130710: libkvm version bump OLD_LIBS+=lib/libkvm.so.5 OLD_LIBS+=usr/lib32/libkvm.so.5 # 20130623: dialog update from 1.1 to 1.2 OLD_LIBS+=usr/lib/libdialog.so.7 OLD_LIBS+=usr/lib32/libdialog.so.7 # 20130616: vfs_mount.9 removed OLD_FILES+=usr/share/man/man9/vfs_mount.9.gz # 20130614: remove CVS from base OLD_FILES+=usr/bin/cvs OLD_FILES+=usr/bin/cvsbug OLD_FILES+=usr/share/doc/psd/28.cvs/paper.ascii.gz OLD_FILES+=usr/share/doc/psd/28.cvs/paper.ps.gz OLD_DIRS+=usr/share/doc/psd/28.cvs OLD_FILES+=usr/share/examples/cvs/contrib/README OLD_FILES+=usr/share/examples/cvs/contrib/clmerge OLD_FILES+=usr/share/examples/cvs/contrib/cln_hist OLD_FILES+=usr/share/examples/cvs/contrib/commit_prep OLD_FILES+=usr/share/examples/cvs/contrib/cvs2vendor OLD_FILES+=usr/share/examples/cvs/contrib/cvs_acls OLD_FILES+=usr/share/examples/cvs/contrib/cvscheck OLD_FILES+=usr/share/examples/cvs/contrib/cvscheck.man OLD_FILES+=usr/share/examples/cvs/contrib/cvshelp.man OLD_FILES+=usr/share/examples/cvs/contrib/descend.man OLD_FILES+=usr/share/examples/cvs/contrib/easy-import OLD_FILES+=usr/share/examples/cvs/contrib/intro.doc OLD_FILES+=usr/share/examples/cvs/contrib/log OLD_FILES+=usr/share/examples/cvs/contrib/log_accum OLD_FILES+=usr/share/examples/cvs/contrib/mfpipe OLD_FILES+=usr/share/examples/cvs/contrib/rcs-to-cvs OLD_FILES+=usr/share/examples/cvs/contrib/rcs2log OLD_FILES+=usr/share/examples/cvs/contrib/rcslock OLD_FILES+=usr/share/examples/cvs/contrib/sccs2rcs OLD_DIRS+=usr/share/examples/cvs/contrib OLD_DIRS+=usr/share/examples/cvs OLD_FILES+=usr/share/info/cvs.info.gz OLD_FILES+=usr/share/info/cvsclient.info.gz OLD_FILES+=usr/share/man/man1/cvs.1.gz OLD_FILES+=usr/share/man/man5/cvs.5.gz OLD_FILES+=usr/share/man/man8/cvsbug.8.gz # 20130607: WITH_DEBUG_FILES added OLD_FILES+=lib/libufs.so.6.symbols OLD_FILES+=usr/lib32/libufs.so.6.symbols # 20130417: nfs fha moved from nfsserver to nfs OLD_FILES+=usr/include/nfsserver/nfs_fha.h # 20130411: new clang import which bumps version from 3.2 to 3.3. OLD_FILES+=usr/include/clang/3.2/__wmmintrin_aes.h OLD_FILES+=usr/include/clang/3.2/__wmmintrin_pclmul.h OLD_FILES+=usr/include/clang/3.2/altivec.h OLD_FILES+=usr/include/clang/3.2/ammintrin.h OLD_FILES+=usr/include/clang/3.2/avx2intrin.h OLD_FILES+=usr/include/clang/3.2/avxintrin.h OLD_FILES+=usr/include/clang/3.2/bmi2intrin.h OLD_FILES+=usr/include/clang/3.2/bmiintrin.h OLD_FILES+=usr/include/clang/3.2/cpuid.h OLD_FILES+=usr/include/clang/3.2/emmintrin.h OLD_FILES+=usr/include/clang/3.2/f16cintrin.h OLD_FILES+=usr/include/clang/3.2/fma4intrin.h OLD_FILES+=usr/include/clang/3.2/fmaintrin.h OLD_FILES+=usr/include/clang/3.2/immintrin.h OLD_FILES+=usr/include/clang/3.2/lzcntintrin.h OLD_FILES+=usr/include/clang/3.2/mm3dnow.h OLD_FILES+=usr/include/clang/3.2/mm_malloc.h OLD_FILES+=usr/include/clang/3.2/mmintrin.h OLD_FILES+=usr/include/clang/3.2/module.map OLD_FILES+=usr/include/clang/3.2/nmmintrin.h OLD_FILES+=usr/include/clang/3.2/pmmintrin.h OLD_FILES+=usr/include/clang/3.2/popcntintrin.h OLD_FILES+=usr/include/clang/3.2/rtmintrin.h OLD_FILES+=usr/include/clang/3.2/smmintrin.h OLD_FILES+=usr/include/clang/3.2/tmmintrin.h OLD_FILES+=usr/include/clang/3.2/wmmintrin.h OLD_FILES+=usr/include/clang/3.2/x86intrin.h OLD_FILES+=usr/include/clang/3.2/xmmintrin.h OLD_FILES+=usr/include/clang/3.2/xopintrin.h OLD_DIRS+=usr/include/clang/3.2 # 20130404: legacy ATA stack removed OLD_FILES+=etc/periodic/daily/405.status-ata-raid OLD_FILES+=rescue/atacontrol OLD_FILES+=sbin/atacontrol OLD_FILES+=usr/share/man/man8/atacontrol.8.gz OLD_FILES+=usr/share/man/man4/atapicam.4.gz OLD_FILES+=usr/share/man/man4/ataraid.4.gz OLD_FILES+=usr/sbin/burncd OLD_FILES+=usr/share/man/man8/burncd.8.gz # 20130316: vinum.4 removed OLD_FILES+=usr/share/man/man4/vinum.4.gz # 20130312: fortunes-o removed OLD_FILES+=usr/share/games/fortune/fortunes-o OLD_FILES+=usr/share/games/fortune/fortunes-o.dat # 20130311: Ports are no more available via cvsup OLD_FILES+=usr/share/examples/cvsup/ports-supfile OLD_FILES+=usr/share/examples/cvsup/refuse OLD_FILES+=usr/share/examples/cvsup/refuse.README # 20130309: NWFS and NCP supports removed OLD_FILES+=usr/bin/ncplist OLD_FILES+=usr/bin/ncplogin OLD_FILES+=usr/bin/ncplogout OLD_FILES+=usr/include/fs/nwfs/nwfs.h OLD_FILES+=usr/include/fs/nwfs/nwfs_mount.h OLD_FILES+=usr/include/fs/nwfs/nwfs_node.h OLD_FILES+=usr/include/fs/nwfs/nwfs_subr.h OLD_DIRS+=usr/include/fs/nwfs OLD_FILES+=usr/include/netncp/ncp.h OLD_FILES+=usr/include/netncp/ncp_cfg.h OLD_FILES+=usr/include/netncp/ncp_conn.h OLD_FILES+=usr/include/netncp/ncp_file.h OLD_FILES+=usr/include/netncp/ncp_lib.h OLD_FILES+=usr/include/netncp/ncp_ncp.h OLD_FILES+=usr/include/netncp/ncp_nls.h OLD_FILES+=usr/include/netncp/ncp_rcfile.h OLD_FILES+=usr/include/netncp/ncp_rq.h OLD_FILES+=usr/include/netncp/ncp_sock.h OLD_FILES+=usr/include/netncp/ncp_subr.h OLD_FILES+=usr/include/netncp/ncp_user.h OLD_FILES+=usr/include/netncp/ncpio.h OLD_FILES+=usr/include/netncp/nwerror.h OLD_DIRS+=usr/include/netncp OLD_FILES+=usr/lib/libncp.a OLD_FILES+=usr/lib/libncp.so OLD_LIBS+=usr/lib/libncp.so.4 OLD_FILES+=usr/lib/libncp_p.a OLD_FILES+=usr/lib32/libncp.a OLD_FILES+=usr/lib32/libncp.so OLD_LIBS+=usr/lib32/libncp.so.4 OLD_FILES+=usr/lib32/libncp_p.a OLD_FILES+=usr/sbin/mount_nwfs OLD_FILES+=usr/share/examples/nwclient/dot.nwfsrc OLD_FILES+=usr/share/examples/nwclient/nwfs.sh.sample OLD_DIRS+=usr/share/examples/nwclient OLD_FILES+=usr/share/man/man1/ncplist.1.gz OLD_FILES+=usr/share/man/man1/ncplogin.1.gz OLD_FILES+=usr/share/man/man1/ncplogout.1.gz OLD_FILES+=usr/share/man/man8/mount_nwfs.8.gz # 20130302: NTFS support removed OLD_FILES+=rescue/mount_ntfs OLD_FILES+=sbin/mount_ntfs OLD_FILES+=usr/include/fs/ntfs/ntfs.h OLD_FILES+=usr/include/fs/ntfs/ntfs_compr.h OLD_FILES+=usr/include/fs/ntfs/ntfs_ihash.h OLD_FILES+=usr/include/fs/ntfs/ntfs_inode.h OLD_FILES+=usr/include/fs/ntfs/ntfs_subr.h OLD_FILES+=usr/include/fs/ntfs/ntfs_vfsops.h OLD_FILES+=usr/include/fs/ntfs/ntfsmount.h OLD_DIRS+=usr/include/fs/ntfs OLD_FILES+=usr/share/man/man8/mount_ntfs.8.gz # 20130302: PORTALFS support removed OLD_FILES+=usr/include/fs/portalfs/portal.h OLD_DIRS+=usr/include/fs/portalfs OLD_FILES+=usr/sbin/mount_portalfs OLD_FILES+=usr/share/examples/portal/README OLD_FILES+=usr/share/examples/portal/portal.conf OLD_DIRS+=usr/share/examples/portal OLD_FILES+=usr/share/man/man8/mount_portalfs.8.gz # 20130302: CODAFS support removed OLD_FILES+=usr/share/man/man4/coda.4.gz # 20130302: XFS support removed OLD_FILES+=usr/share/man/man5/xfs.5.gz # 20130302: Capsicum overhaul OLD_FILES+=usr/share/man/man2/cap_getrights.2.gz OLD_FILES+=usr/share/man/man2/cap_new.2.gz # 20130213: OpenSSL 1.0.1e import OLD_FILES+=usr/share/openssl/man/man3/EVP_PKEY_verifyrecover.3.gz OLD_FILES+=usr/share/openssl/man/man3/EVP_PKEY_verifyrecover_init.3.gz # 20130116: removed long unused directories for .1aout section manpages OLD_FILES+=usr/share/man/en.ISO8859-1/man1aout OLD_FILES+=usr/share/man/en.UTF-8/man1aout OLD_DIRS+=usr/share/man/man1aout OLD_DIRS+=usr/share/man/cat1aout OLD_DIRS+=usr/share/man/en.ISO8859-1/cat1aout OLD_DIRS+=usr/share/man/en.UTF-8/cat1aout # 20130110: bsd.compat.mk removed OLD_FILES+=usr/share/mk/bsd.compat.mk # 20130103: gnats-supfile removed OLD_FILES+=usr/share/examples/cvsup/gnats-supfile # 20121230: libdisk removed OLD_FILES+=usr/share/man/man3/libdisk.3.gz usr/include/libdisk.h OLD_FILES+=usr/lib/libdisk.a usr/lib32/libdisk.a # 20121230: remove wrongly created directories for auditdistd OLD_DIRS+=var/dist OLD_DIRS+=var/remote # 20121114: zpool-features manual page moved from section 5 to 7 OLD_FILES+=usr/share/man/man5/zpool-features.5.gz # 20121022: remove harp, hfa and idt man page OLD_FILES+=usr/share/man/man4/harp.4.gz OLD_FILES+=usr/share/man/man4/hfa.4.gz OLD_FILES+=usr/share/man/man4/idt.4.gz OLD_FILES+=usr/share/man/man4/if_idt.4.gz # 20121022: VFS_LOCK_GIANT elimination OLD_FILES+=usr/share/man/man9/VFS_LOCK_GIANT.9.gz OLD_FILES+=usr/share/man/man9/VFS_UNLOCK_GIANT.9.gz # 20121004: remove incomplete unwind.h OLD_FILES+=usr/include/clang/3.2/unwind.h # 20120910: NetBSD compat shims removed OLD_FILES+=usr/include/cam/scsi/scsi_low_pisa.h OLD_FILES+=usr/include/sys/device_port.h # 20120909: doc and www supfiles removed OLD_FILES+=usr/share/examples/cvsup/doc-supfile OLD_FILES+=usr/share/examples/cvsup/www-supfile # 20120908: pf cleanup OLD_FILES+=usr/include/net/if_pflow.h # 20120816: new clang import which bumps version from 3.1 to 3.2 OLD_FILES+=usr/bin/llvm-ld OLD_FILES+=usr/bin/llvm-stub OLD_FILES+=usr/include/clang/3.1/altivec.h OLD_FILES+=usr/include/clang/3.1/avx2intrin.h OLD_FILES+=usr/include/clang/3.1/avxintrin.h OLD_FILES+=usr/include/clang/3.1/bmi2intrin.h OLD_FILES+=usr/include/clang/3.1/bmiintrin.h OLD_FILES+=usr/include/clang/3.1/cpuid.h OLD_FILES+=usr/include/clang/3.1/emmintrin.h OLD_FILES+=usr/include/clang/3.1/fma4intrin.h OLD_FILES+=usr/include/clang/3.1/immintrin.h OLD_FILES+=usr/include/clang/3.1/lzcntintrin.h OLD_FILES+=usr/include/clang/3.1/mm3dnow.h OLD_FILES+=usr/include/clang/3.1/mm_malloc.h OLD_FILES+=usr/include/clang/3.1/mmintrin.h OLD_FILES+=usr/include/clang/3.1/module.map OLD_FILES+=usr/include/clang/3.1/nmmintrin.h OLD_FILES+=usr/include/clang/3.1/pmmintrin.h OLD_FILES+=usr/include/clang/3.1/popcntintrin.h OLD_FILES+=usr/include/clang/3.1/smmintrin.h OLD_FILES+=usr/include/clang/3.1/tmmintrin.h OLD_FILES+=usr/include/clang/3.1/unwind.h OLD_FILES+=usr/include/clang/3.1/wmmintrin.h OLD_FILES+=usr/include/clang/3.1/x86intrin.h OLD_FILES+=usr/include/clang/3.1/xmmintrin.h OLD_DIRS+=usr/include/clang/3.1 OLD_FILES+=usr/share/man/man1/llvm-ld.1.gz # 20120712: OpenSSL 1.0.1c import OLD_LIBS+=lib/libcrypto.so.6 OLD_LIBS+=usr/lib/libssl.so.6 OLD_LIBS+=usr/lib32/libcrypto.so.6 OLD_LIBS+=usr/lib32/libssl.so.6 OLD_FILES+=usr/include/openssl/aes_locl.h OLD_FILES+=usr/include/openssl/bio_lcl.h OLD_FILES+=usr/include/openssl/e_os.h OLD_FILES+=usr/include/openssl/fips.h OLD_FILES+=usr/include/openssl/fips_rand.h OLD_FILES+=usr/include/openssl/md2.h OLD_FILES+=usr/include/openssl/pq_compat.h OLD_FILES+=usr/include/openssl/store.h OLD_FILES+=usr/include/openssl/tmdiff.h OLD_FILES+=usr/include/openssl/ui_locl.h OLD_FILES+=usr/share/openssl/man/man3/CRYPTO_set_id_callback.3.gz # 20120621: remove old man page OLD_FILES+=usr/share/man/man8/vnconfig.8.gz # 20120619: TOE support updated OLD_FILES+=usr/include/netinet/toedev.h # 20120613: auth.conf removed OLD_FILES+=etc/auth.conf OLD_FILES+=usr/share/examples/etc/auth.conf OLD_FILES+=usr/share/man/man3/auth.3.gz OLD_FILES+=usr/share/man/man3/auth_getval.3.gz OLD_FILES+=usr/share/man/man5/auth.conf.5.gz # 20120530: kde pam lives now in ports OLD_FILES+=etc/pam.d/kde # 20120521: byacc import OLD_FILES+=usr/bin/yyfix OLD_FILES+=usr/share/man/man1/yyfix.1.gz # 20120505: new clang import installed a redundant internal header OLD_FILES+=usr/include/clang/3.1/stdalign.h # 20120428: MD2 removed from libmd OLD_LIBS+=lib/libmd.so.5 OLD_FILES+=usr/include/md2.h OLD_LIBS+=usr/lib32/libmd.so.5 OLD_FILES+=usr/share/man/man3/MD2Data.3.gz OLD_FILES+=usr/share/man/man3/MD2End.3.gz OLD_FILES+=usr/share/man/man3/MD2File.3.gz OLD_FILES+=usr/share/man/man3/MD2FileChunk.3.gz OLD_FILES+=usr/share/man/man3/MD2Final.3.gz OLD_FILES+=usr/share/man/man3/MD2Init.3.gz OLD_FILES+=usr/share/man/man3/MD2Update.3.gz OLD_FILES+=usr/share/man/man3/md2.3.gz # 20120425: libusb version bump (r234684) OLD_LIBS+=usr/lib/libusb.so.2 OLD_LIBS+=usr/lib32/libusb.so.2 OLD_FILES+=usr/share/man/man3/libsub_get_active_config_descriptor.3.gz # 20120415: new clang import which bumps version from 3.0 to 3.1 OLD_FILES+=usr/include/clang/3.0/altivec.h OLD_FILES+=usr/include/clang/3.0/avxintrin.h OLD_FILES+=usr/include/clang/3.0/emmintrin.h OLD_FILES+=usr/include/clang/3.0/immintrin.h OLD_FILES+=usr/include/clang/3.0/mm3dnow.h OLD_FILES+=usr/include/clang/3.0/mm_malloc.h OLD_FILES+=usr/include/clang/3.0/mmintrin.h OLD_FILES+=usr/include/clang/3.0/nmmintrin.h OLD_FILES+=usr/include/clang/3.0/pmmintrin.h OLD_FILES+=usr/include/clang/3.0/smmintrin.h OLD_FILES+=usr/include/clang/3.0/tmmintrin.h OLD_FILES+=usr/include/clang/3.0/wmmintrin.h OLD_FILES+=usr/include/clang/3.0/x86intrin.h OLD_FILES+=usr/include/clang/3.0/xmmintrin.h OLD_DIRS+=usr/include/clang/3.0 # 20120412: BIND 9.8.1 release notes removed OLD_FILES+=usr/share/doc/bind9/RELEASE-NOTES-BIND-9.8.1.pdf OLD_FILES+=usr/share/doc/bind9/RELEASE-NOTES-BIND-9.8.1.txt OLD_FILES+=usr/share/doc/bind9/RELEASE-NOTES-BIND-9.8.1.html OLD_FILES+=usr/share/doc/bind9/release-notes.css # 20120330: legacy(4) moved to x86 OLD_FILES+=usr/include/machine/legacyvar.h # 20120324: MPI headers updated OLD_FILES+=usr/include/dev/mpt/mpilib/mpi_inb.h # 20120322: hwpmc_mips24k.h removed OLD_FILES+=usr/include/dev/hwpmc/hwpmc_mips24k.h # 20120322: Update heimdal to 1.5.1. OLD_FILES+=usr/include/krb5-v4compat.h \ usr/include/krb_err.h \ usr/include/hdb-private.h \ usr/share/man/man3/krb5_addresses.3.gz \ usr/share/man/man3/krb5_cc_cursor.3.gz \ usr/share/man/man3/krb5_cc_ops.3.gz \ usr/share/man/man3/krb5_config.3.gz \ usr/share/man/man3/krb5_config_get_int_default.3.gz \ usr/share/man/man3/krb5_context.3.gz \ usr/share/man/man3/krb5_data.3.gz \ usr/share/man/man3/krb5_err.3.gz \ usr/share/man/man3/krb5_errx.3.gz \ usr/share/man/man3/krb5_keyblock.3.gz \ usr/share/man/man3/krb5_keytab_entry.3.gz \ usr/share/man/man3/krb5_kt_cursor.3.gz \ usr/share/man/man3/krb5_kt_ops.3.gz \ usr/share/man/man3/krb5_set_warn_dest.3.gz \ usr/share/man/man3/krb5_verr.3.gz \ usr/share/man/man3/krb5_verrx.3.gz \ usr/share/man/man3/krb5_vwarnx.3.gz \ usr/share/man/man3/krb5_warn.3.gz \ usr/share/man/man3/krb5_warnx.3.gz OLD_LIBS+=usr/lib/libasn1.so.10 \ usr/lib/libhdb.so.10 \ usr/lib/libheimntlm.so.10 \ usr/lib/libhx509.so.10 \ usr/lib/libkadm5clnt.so.10 \ usr/lib/libkadm5srv.so.10 \ usr/lib/libkafs5.so.10 \ usr/lib/libkrb5.so.10 \ usr/lib/libroken.so.10 \ usr/lib32/libasn1.so.10 \ usr/lib32/libhdb.so.10 \ usr/lib32/libheimntlm.so.10 \ usr/lib32/libhx509.so.10 \ usr/lib32/libkadm5clnt.so.10 \ usr/lib32/libkadm5srv.so.10 \ usr/lib32/libkafs5.so.10 \ usr/lib32/libkrb5.so.10 \ usr/lib32/libroken.so.10 # 20120309: Remove fifofs header files. OLD_FILES+=usr/include/fs/fifofs/fifo.h OLD_DIRS+=usr/include/fs/fifofs # 20120304: xlocale cleanup OLD_FILES+=usr/include/_xlocale_ctype.h # 20120225: libarchive 3.0.3 OLD_FILES+=usr/share/man/man3/archive_read_data_into_buffer.3.gz \ usr/share/man/man3/archive_read_support_compression_all.3.gz \ usr/share/man/man3/archive_read_support_compression_bzip2.3.gz \ usr/share/man/man3/archive_read_support_compression_compress.3.gz \ usr/share/man/man3/archive_read_support_compression_gzip.3.gz \ usr/share/man/man3/archive_read_support_compression_lzma.3.gz \ usr/share/man/man3/archive_read_support_compression_none.3.gz \ usr/share/man/man3/archive_read_support_compression_program.3.gz \ usr/share/man/man3/archive_read_support_compression_program_signature.3.gz \ usr/share/man/man3/archive_read_support_compression_xz.3.gz \ usr/share/man/man3/archive_write_set_callbacks.3.gz \ usr/share/man/man3/archive_write_set_compression_bzip2.3.gz \ usr/share/man/man3/archive_write_set_compression_compress.3.gz \ usr/share/man/man3/archive_write_set_compression_gzip.3.gz \ usr/share/man/man3/archive_write_set_compression_none.3.gz \ usr/share/man/man3/archive_write_set_compression_program.3.gz OLD_LIBS+=usr/lib/libarchive.so.5 OLD_LIBS+=usr/lib32/libarchive.so.5 # 20120113: removal of wtmpcvt(1) OLD_FILES+=usr/bin/wtmpcvt OLD_FILES+=usr/share/man/man1/wtmpcvt.1.gz # 20111214: eventtimers(7) moved to eventtimers(4) OLD_FILES+=usr/share/man/man7/eventtimers.7.gz # 20111125: amd(4) removed OLD_FILES+=usr/share/man/man4/amd.4.gz # 20111125: libodialog removed OLD_FILES+=usr/lib/libodialog.a OLD_FILES+=usr/lib/libodialog.so OLD_LIBS+=usr/lib/libodialog.so.7 OLD_FILES+=usr/lib/libodialog_p.a OLD_FILES+=usr/lib32/libodialog.a OLD_FILES+=usr/lib32/libodialog.so OLD_LIBS+=usr/lib32/libodialog.so.7 OLD_FILES+=usr/lib32/libodialog_p.a # 20110930: sysinstall removed OLD_FILES+=usr/sbin/sysinstall OLD_FILES+=usr/share/man/man8/sysinstall.8.gz OLD_FILES+=usr/lib/libftpio.a OLD_FILES+=usr/lib/libftpio.so OLD_LIBS+=usr/lib/libftpio.so.8 OLD_FILES+=usr/lib/libftpio_p.a OLD_FILES+=usr/lib32/libftpio.a OLD_FILES+=usr/lib32/libftpio.so OLD_LIBS+=usr/lib32/libftpio.so.8 OLD_FILES+=usr/lib32/libftpio_p.a OLD_FILES+=usr/include/ftpio.h OLD_FILES+=usr/share/man/man3/ftpio.3.gz # 20110915: rename congestion control manpages OLD_FILES+=usr/share/man/man4/cc.4.gz OLD_FILES+=usr/share/man/man9/cc.9.gz # 20110831: atomic page flags operations OLD_FILES+=usr/share/man/man9/vm_page_flag.9.gz OLD_FILES+=usr/share/man/man9/vm_page_flag_clear.9.gz OLD_FILES+=usr/share/man/man9/vm_page_flag_set.9.gz # 20110828: library version bump for 9.0 OLD_LIBS+=lib/libcam.so.5 OLD_LIBS+=lib/libpcap.so.7 OLD_LIBS+=lib/libufs.so.5 OLD_LIBS+=usr/lib/libbsnmp.so.5 OLD_LIBS+=usr/lib/libdwarf.so.2 OLD_LIBS+=usr/lib/libopie.so.6 OLD_LIBS+=usr/lib/librtld_db.so.1 OLD_LIBS+=usr/lib/libtacplus.so.4 OLD_LIBS+=usr/lib32/libcam.so.5 OLD_LIBS+=usr/lib32/libpcap.so.7 OLD_LIBS+=usr/lib32/libufs.so.5 OLD_LIBS+=usr/lib32/libbsnmp.so.5 OLD_LIBS+=usr/lib32/libdwarf.so.2 OLD_LIBS+=usr/lib32/libopie.so.6 OLD_LIBS+=usr/lib32/librtld_db.so.1 OLD_LIBS+=usr/lib32/libtacplus.so.4 # 20110817: no more acd.4, ad.4, afd.4 and ast.4 OLD_FILES+=usr/share/man/man4/acd.4.gz OLD_FILES+=usr/share/man/man4/ad.4.gz OLD_FILES+=usr/share/man/man4/afd.4.gz OLD_FILES+=usr/share/man/man4/ast.4.gz # 20110718: no longer useful in the age of rc.d OLD_FILES+=usr/sbin/named.reconfig OLD_FILES+=usr/sbin/named.reload OLD_FILES+=usr/share/man/man8/named.reconfig.8.gz OLD_FILES+=usr/share/man/man8/named.reload.8.gz # 20110716: bind 9.8.0 import OLD_LIBS+=usr/lib/liblwres.so.50 OLD_FILES+=usr/share/doc/bind9/KNOWN-DEFECTS OLD_FILES+=usr/share/doc/bind9/NSEC3-NOTES OLD_FILES+=usr/share/doc/bind9/README.idnkit OLD_FILES+=usr/share/doc/bind9/README.pkcs11 # 20110709: vm_map_clean.9 -> vm_map_sync.9 OLD_FILES+=usr/share/man/man9/vm_map_clean.9.gz # 20110709: Catch up with removal of these functions. OLD_FILES+=usr/share/man/man9/vm_page_copy.9.gz OLD_FILES+=usr/share/man/man9/vm_page_protect.9.gz OLD_FILES+=usr/share/man/man9/vm_page_zero_fill.9.gz # 20110707: script no longer needed by /etc/rc.d/nfsd OLD_FILES+=etc/rc.d/nfsserver # 20110705: files moved so both NFS clients can share them OLD_FILES+=usr/include/nfsclient/krpc.h OLD_FILES+=usr/include/nfsclient/nfsdiskless.h # 20110705: the switch of default NFS client to the new one OLD_FILES+=sbin/mount_newnfs OLD_FILES+=usr/share/man/man8/mount_newnfs.8.gz OLD_FILES+=usr/include/nfsclient/nfs_kdtrace.h # 20110628: calendar.msk removed OLD_FILES+=usr/share/calendar/ru_RU.KOI8-R/calendar.msk # 20110517: libpkg removed OLD_FILES+=usr/include/pkg.h OLD_FILES+=usr/lib/libpkg.a OLD_FILES+=usr/lib/libpkg.so OLD_LIBS+=usr/lib/libpkg.so.0 OLD_FILES+=usr/lib/libpkg_p.a OLD_FILES+=usr/lib32/libpkg.a OLD_FILES+=usr/lib32/libpkg.so OLD_LIBS+=usr/lib32/libpkg.so.0 OLD_FILES+=usr/lib32/libpkg_p.a # 20110517: libsbuf version bump OLD_LIBS+=lib/libsbuf.so.5 OLD_LIBS+=usr/lib32/libsbuf.so.5 # 20110502: new clang import which bumps version from 2.9 to 3.0 OLD_FILES+=usr/include/clang/2.9/emmintrin.h OLD_FILES+=usr/include/clang/2.9/mm_malloc.h OLD_FILES+=usr/include/clang/2.9/mmintrin.h OLD_FILES+=usr/include/clang/2.9/pmmintrin.h OLD_FILES+=usr/include/clang/2.9/tmmintrin.h OLD_FILES+=usr/include/clang/2.9/xmmintrin.h OLD_DIRS+=usr/include/clang/2.9 # 20110417: removal of Objective-C support OLD_FILES+=usr/include/objc/encoding.h OLD_FILES+=usr/include/objc/hash.h OLD_FILES+=usr/include/objc/NXConstStr.h OLD_FILES+=usr/include/objc/objc-api.h OLD_FILES+=usr/include/objc/objc-decls.h OLD_FILES+=usr/include/objc/objc-list.h OLD_FILES+=usr/include/objc/objc.h OLD_FILES+=usr/include/objc/Object.h OLD_FILES+=usr/include/objc/Protocol.h OLD_FILES+=usr/include/objc/runtime.h OLD_FILES+=usr/include/objc/sarray.h OLD_FILES+=usr/include/objc/thr.h OLD_FILES+=usr/include/objc/typedstream.h OLD_FILES+=usr/lib/libobjc.a OLD_FILES+=usr/lib/libobjc.so OLD_FILES+=usr/lib/libobjc_p.a OLD_FILES+=usr/libexec/cc1obj OLD_LIBS+=usr/lib/libobjc.so.4 OLD_DIRS+=usr/include/objc OLD_FILES+=usr/lib32/libobjc.a OLD_FILES+=usr/lib32/libobjc.so OLD_FILES+=usr/lib32/libobjc_p.a OLD_LIBS+=usr/lib32/libobjc.so.4 # 20110331: firmware.img created at build time OLD_FILES+=usr/share/examples/kld/firmware/fwimage/firmware.img # 20110224: sticky.8 -> sticky.7 OLD_FILES+=usr/share/man/man8/sticky.8.gz # 20110220: new clang import which bumps version from 2.8 to 2.9 OLD_FILES+=usr/include/clang/2.8/emmintrin.h OLD_FILES+=usr/include/clang/2.8/mm_malloc.h OLD_FILES+=usr/include/clang/2.8/mmintrin.h OLD_FILES+=usr/include/clang/2.8/pmmintrin.h OLD_FILES+=usr/include/clang/2.8/tmmintrin.h OLD_FILES+=usr/include/clang/2.8/xmmintrin.h OLD_DIRS+=usr/include/clang/2.8 # 20110119: netinet/sctp_cc_functions.h removed OLD_FILES+=usr/include/netinet/sctp_cc_functions.h # 20110119: Remove SYSCTL_*X* sysctl additions. OLD_FILES+=usr/share/man/man9/SYSCTL_XINT.9.gz \ usr/share/man/man9/SYSCTL_XLONG.9.gz # 20110112: Update dialog to new version, rename old libdialog to libodialog, # removing associated man pages and header files. OLD_FILES+=usr/share/man/man3/draw_shadow.3.gz \ usr/share/man/man3/draw_box.3.gz usr/share/man/man3/line_edit.3.gz \ usr/share/man/man3/strheight.3.gz usr/share/man/man3/strwidth.3.gz \ usr/share/man/man3/dialog_create_rc.3.gz \ usr/share/man/man3/dialog_yesno.3.gz usr/share/man/man3/dialog_noyes.3.gz \ usr/share/man/man3/dialog_prgbox.3.gz \ usr/share/man/man3/dialog_textbox.3.gz usr/share/man/man3/dialog_menu.3.gz \ usr/share/man/man3/dialog_checklist.3.gz \ usr/share/man/man3/dialog_radiolist.3.gz \ usr/share/man/man3/dialog_inputbox.3.gz \ usr/share/man/man3/dialog_clear_norefresh.3.gz \ usr/share/man/man3/dialog_clear.3.gz usr/share/man/man3/dialog_update.3.gz \ usr/share/man/man3/dialog_fselect.3.gz \ usr/share/man/man3/dialog_notify.3.gz \ usr/share/man/man3/dialog_mesgbox.3.gz \ usr/share/man/man3/dialog_gauge.3.gz usr/share/man/man3/init_dialog.3.gz \ usr/share/man/man3/end_dialog.3.gz usr/share/man/man3/use_helpfile.3.gz \ usr/share/man/man3/use_helpline.3.gz usr/share/man/man3/get_helpline.3.gz \ usr/share/man/man3/restore_helpline.3.gz \ usr/share/man/man3/dialog_msgbox.3.gz \ usr/share/man/man3/dialog_ftree.3.gz usr/share/man/man3/dialog_tree.3.gz \ usr/share/examples/dialog/README usr/share/examples/dialog/checklist \ usr/share/examples/dialog/ftreebox usr/share/examples/dialog/infobox \ usr/share/examples/dialog/inputbox usr/share/examples/dialog/menubox \ usr/share/examples/dialog/msgbox usr/share/examples/dialog/prgbox \ usr/share/examples/dialog/radiolist usr/share/examples/dialog/textbox \ usr/share/examples/dialog/treebox usr/share/examples/dialog/yesno \ usr/share/examples/libdialog/Makefile usr/share/examples/libdialog/check1.c\ usr/share/examples/libdialog/check2.c usr/share/examples/libdialog/check3.c\ usr/share/examples/libdialog/dselect.c \ usr/share/examples/libdialog/fselect.c \ usr/share/examples/libdialog/ftree1.c \ usr/share/examples/libdialog/ftree1.test \ usr/share/examples/libdialog/ftree2.c \ usr/share/examples/libdialog/ftree2.test \ usr/share/examples/libdialog/gauge.c usr/share/examples/libdialog/input1.c \ usr/share/examples/libdialog/input2.c usr/share/examples/libdialog/menu1.c \ usr/share/examples/libdialog/menu2.c usr/share/examples/libdialog/menu3.c \ usr/share/examples/libdialog/msg.c usr/share/examples/libdialog/prgbox.c \ usr/share/examples/libdialog/radio1.c usr/share/examples/libdialog/radio2.c\ usr/share/examples/libdialog/radio3.c usr/share/examples/libdialog/text.c \ usr/share/examples/libdialog/tree.c usr/share/examples/libdialog/yesno.c OLD_DIRS+=usr/share/examples/libdialog usr/share/examples/dialog # 20101114: Remove long-obsolete MAKEDEV.8 OLD_FILES+=usr/share/man/man8/MAKEDEV.8.gz # 20101112: vgonel(9) has gone to private API a while ago OLD_FILES+=usr/share/man/man9/vgonel.9.gz # 20101112: removed gasp.info OLD_FILES+=usr/share/info/gasp.info.gz # 20101109: machine/mutex.h removed OLD_FILES+=usr/include/machine/mutex.h # 20101109: headers moved from machine/ to x86/ .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/mptable.h .endif # 20101101: headers moved from machine/ to x86/ .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/apicreg.h OLD_FILES+=usr/include/machine/mca.h .endif # 20101020: catch up with vm_page_sleep_if_busy rename OLD_FILES+=usr/share/man/man9/vm_page_sleep_busy.9.gz # 20101018: taskqueue(9) updates OLD_FILES+=usr/share/man/man9/taskqueue_find.9.gz # 20101011: removed subblock.h from liblzma OLD_FILES+=usr/include/lzma/subblock.h # 20101002: removed manpath.config OLD_FILES+=etc/manpath.config OLD_FILES+=usr/share/examples/etc/manpath.config # 20100910: renamed sbuf_overflowed to sbuf_error OLD_FILES+=usr/share/man/man9/sbuf_overflowed.9.gz # 20100815: retired last traces of chooseproc(9) OLD_FILES+=usr/share/man/man9/chooseproc.9.gz # 20100806: removal of unused libcompat routines OLD_FILES+=usr/share/man/man3/ascftime.3.gz OLD_FILES+=usr/share/man/man3/cfree.3.gz OLD_FILES+=usr/share/man/man3/cftime.3.gz OLD_FILES+=usr/share/man/man3/getpw.3.gz # 20100801: tzdata2010k import OLD_FILES+=usr/share/zoneinfo/Pacific/Ponape OLD_FILES+=usr/share/zoneinfo/Pacific/Truk # 20100725: acpi_aiboost(4) removal. OLD_FILES+=usr/share/man/man4/acpi_aiboost.4.gz # 20100724: nfsclient/nfs_lock.h moved to nfs/nfs_lock.h OLD_FILES+=usr/include/nfsclient/nfs_lock.h # 20100720: new clang import which bumps version from 2.0 to 2.8 OLD_FILES+=usr/include/clang/2.0/emmintrin.h OLD_FILES+=usr/include/clang/2.0/mm_malloc.h OLD_FILES+=usr/include/clang/2.0/mmintrin.h OLD_FILES+=usr/include/clang/2.0/pmmintrin.h OLD_FILES+=usr/include/clang/2.0/tmmintrin.h OLD_FILES+=usr/include/clang/2.0/xmmintrin.h OLD_DIRS+=usr/include/clang/2.0 # 20100706: removed pc-sysinstall's detect-vmware.sh OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-vmware.sh # 20100701: [powerpc] removed .if ${TARGET_ARCH} == "powerpc" OLD_FILES+=usr/include/machine/intr.h .endif # 20100514: library version bump for versioned symbols for liblzma OLD_LIBS+=usr/lib/liblzma.so.0 OLD_LIBS+=usr/lib32/liblzma.so.0 # 20100511: move GCC-specific headers to /usr/include/gcc .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/emmintrin.h OLD_FILES+=usr/include/mm_malloc.h OLD_FILES+=usr/include/pmmintrin.h OLD_FILES+=usr/include/xmmintrin.h .endif .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "arm" OLD_FILES+=usr/include/mmintrin.h .endif .if ${TARGET_ARCH} == "powerpc" OLD_FILES+=usr/include/altivec.h OLD_FILES+=usr/include/ppc-asm.h OLD_FILES+=usr/include/spe.h .endif # 20100416: [mips] removed .if ${TARGET_ARCH} == "mips" OLD_FILES+=usr/include/machine/psl.h .endif # 20100415: [mips] removed unused headers .if ${TARGET_ARCH} == "mips" OLD_FILES+=usr/include/machine/archtype.h OLD_FILES+=usr/include/machine/segments.h OLD_FILES+=usr/include/machine/rm7000.h OLD_FILES+=usr/include/machine/defs.h OLD_FILES+=usr/include/machine/queue.h .endif # 20100326: gcpio removal OLD_FILES+=usr/bin/gcpio OLD_FILES+=usr/share/info/cpio.info.gz OLD_FILES+=usr/share/man/man1/gcpio.1.gz # 20100322: libz update OLD_LIBS+=lib/libz.so.5 OLD_LIBS+=usr/lib32/libz.so.5 # 20100314: removal of regexp.h OLD_FILES+=usr/include/regexp.h OLD_FILES+=usr/share/man/man3/regexp.3.gz OLD_FILES+=usr/share/man/man3/regsub.3.gz # 20100303: actual removal of utmp.h OLD_FILES+=usr/include/utmp.h # 20100208: man pages moved .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/share/man/man4/i386/alpm.4.gz OLD_FILES+=usr/share/man/man4/i386/amdpm.4.gz OLD_FILES+=usr/share/man/man4/i386/mcd.4.gz OLD_FILES+=usr/share/man/man4/i386/padlock.4.gz OLD_FILES+=usr/share/man/man4/i386/pcf.4.gz OLD_FILES+=usr/share/man/man4/i386/scd.4.gz OLD_FILES+=usr/share/man/man4/i386/viapm.4.gz .endif # 20100122: move BSDL bc/dc USD documents to /usr/share/doc/usd OLD_FILES+=usr/share/doc/papers/bc.ascii.gz OLD_FILES+=usr/share/doc/papers/dc.ascii.gz # 20100120: replacing GNU bc/dc with BSDL versions OLD_FILES+=usr/share/examples/bc/ckbook.b OLD_FILES+=usr/share/examples/bc/pi.b OLD_FILES+=usr/share/examples/bc/primes.b OLD_FILES+=usr/share/examples/bc/twins.b OLD_FILES+=usr/share/info/dc.info.gz OLD_DIRS+=usr/share/examples/bc # 20100114: removal of ttyslot(3) OLD_FILES+=usr/share/man/man3/ttyslot.3.gz # 20100113: remove utmp.h, replace it by utmpx.h OLD_FILES+=usr/share/man/man3/login.3.gz OLD_FILES+=usr/share/man/man3/logout.3.gz OLD_FILES+=usr/share/man/man3/logwtmp.3.gz OLD_FILES+=usr/share/man/man3/ulog_endutxent.3.gz OLD_FILES+=usr/share/man/man3/ulog_getutxent.3.gz OLD_FILES+=usr/share/man/man3/ulog_getutxline.3.gz OLD_FILES+=usr/share/man/man3/ulog_getutxuser.3.gz OLD_FILES+=usr/share/man/man3/ulog_pututxline.3.gz OLD_FILES+=usr/share/man/man3/ulog_setutxent.3.gz OLD_FILES+=usr/share/man/man3/ulog_setutxfile.3.gz OLD_FILES+=usr/share/man/man5/lastlog.5.gz OLD_FILES+=usr/share/man/man5/utmp.5.gz OLD_FILES+=usr/share/man/man5/wtmp.5.gz OLD_LIBS+=lib/libutil.so.8 OLD_LIBS+=usr/lib32/libutil.so.8 # 20100105: new userland semaphore implementation OLD_FILES+=usr/include/sys/semaphore.h # 20100103: ntptrace(8) removed OLD_FILES+=usr/sbin/ntptrace OLD_FILES+=usr/share/man/man8/ntptrace.8.gz # 20091229: remove no longer relevant examples OLD_FILES+=usr/share/examples/pppd/auth-down.sample OLD_FILES+=usr/share/examples/pppd/auth-up.sample OLD_FILES+=usr/share/examples/pppd/chap-secrets.sample OLD_FILES+=usr/share/examples/pppd/chat.sh.sample OLD_FILES+=usr/share/examples/pppd/ip-down.sample OLD_FILES+=usr/share/examples/pppd/ip-up.sample OLD_FILES+=usr/share/examples/pppd/options.sample OLD_FILES+=usr/share/examples/pppd/pap-secrets.sample OLD_FILES+=usr/share/examples/pppd/ppp.deny.sample OLD_FILES+=usr/share/examples/pppd/ppp.shells.sample OLD_DIRS+=usr/share/examples/pppd OLD_FILES+=usr/share/examples/slattach/unit-command.sh OLD_DIRS+=usr/share/examples/slattach OLD_FILES+=usr/share/examples/sliplogin/slip.hosts OLD_FILES+=usr/share/examples/sliplogin/slip.login OLD_FILES+=usr/share/examples/sliplogin/slip.logout OLD_FILES+=usr/share/examples/sliplogin/slip.slparms OLD_DIRS+=usr/share/examples/sliplogin OLD_FILES+=usr/share/examples/startslip/sldown.sh OLD_FILES+=usr/share/examples/startslip/slip.sh OLD_FILES+=usr/share/examples/startslip/slup.sh OLD_DIRS+=usr/share/examples/startslip # 20091202: unify rc.firewall and rc.firewall6. OLD_FILES+=etc/rc.d/ip6fw OLD_FILES+=etc/rc.firewall6 OLD_FILES+=usr/share/examples/etc/rc.firewall6 # 20091117: removal of rc.early(8) link OLD_FILES+=usr/share/man/man8/rc.early.8.gz # 20091117: usr/share/zoneinfo/GMT link removed OLD_FILES+=usr/share/zoneinfo/GMT # 20091027: pselect.3 implemented as syscall OLD_FILES+=usr/share/man/man3/pselect.3.gz # 20091005: fusword.9 and susword.9 removed OLD_FILES+=usr/share/man/man9/fusword.9.gz OLD_FILES+=usr/share/man/man9/susword.9.gz # 20090909: vesa and dpms promoted to be i386/amd64 common OLD_FILES+=usr/include/machine/pc/vesa.h OLD_FILES+=usr/share/man/man4/i386/dpms.4.gz # 20090904: remove lukemftpd OLD_FILES+=usr/libexec/lukemftpd OLD_FILES+=usr/share/man/man5/ftpd.conf.5.gz OLD_FILES+=usr/share/man/man5/ftpusers.5.gz OLD_FILES+=usr/share/man/man8/lukemftpd.8.gz # 20090902: BSD.{x11,x11-4}.dist are dead and BSD.local.dist lives in ports/ OLD_FILES+=etc/mtree/BSD.local.dist OLD_FILES+=etc/mtree/BSD.x11.dist OLD_FILES+=etc/mtree/BSD.x11-4.dist # 20090812: net80211 documentation overhaul OLD_FILES+=usr/share/man/man9/ieee80211_add_rates.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_add_xrates.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_alloc_node.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_attach.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_begin_scan.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_cfgget.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_cfgset.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_chan2ieee.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_chan2mode.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_create_ibss.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_crypto_attach.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_crypto_detach.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_decap.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_dump_pkt.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_dup_bss.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_encap.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_end_scan.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_find_node.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_fix_rate.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_free_allnodes.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_ieee2mhz.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_ioctl.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_lookup_node.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_media2rate.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_media_change.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_media_init.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_media_status.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_mhz2ieee.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_next_scan.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_node_attach.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_node_detach.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_node_lateattach.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_print_essid.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_proto_attach.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_proto_detach.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_rate2media.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_recv_mgmt.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_send_mgmt.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_setmode.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_timeout_nodes.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_watchdog.9.gz OLD_FILES+=usr/share/man/man9/ieee80211_wep_crypt.9.gz # 20090801: vimage.h removed in favour of vnet.h OLD_FILES+=usr/include/sys/vimage.h # 20101208: libbsnmp was moved to usr/lib OLD_LIBS+=lib/libbsnmp.so.5 # 20090719: library version bump for 8.0 OLD_LIBS+=lib/libalias.so.6 OLD_LIBS+=lib/libavl.so.1 OLD_LIBS+=lib/libbegemot.so.3 OLD_LIBS+=lib/libbsdxml.so.3 OLD_LIBS+=lib/libbsnmp.so.4 OLD_LIBS+=lib/libcam.so.4 OLD_LIBS+=lib/libcrypt.so.4 OLD_LIBS+=lib/libcrypto.so.5 OLD_LIBS+=lib/libctf.so.1 OLD_LIBS+=lib/libdevstat.so.6 OLD_LIBS+=lib/libdtrace.so.1 OLD_LIBS+=lib/libedit.so.6 OLD_LIBS+=lib/libgeom.so.4 OLD_LIBS+=lib/libipsec.so.3 OLD_LIBS+=lib/libipx.so.4 OLD_LIBS+=lib/libkiconv.so.3 OLD_LIBS+=lib/libkvm.so.4 OLD_LIBS+=lib/libmd.so.4 OLD_LIBS+=lib/libncurses.so.7 OLD_LIBS+=lib/libncursesw.so.7 OLD_LIBS+=lib/libnvpair.so.1 OLD_LIBS+=lib/libpcap.so.6 OLD_LIBS+=lib/libreadline.so.7 OLD_LIBS+=lib/libsbuf.so.4 OLD_LIBS+=lib/libufs.so.4 OLD_LIBS+=lib/libumem.so.1 OLD_LIBS+=lib/libutil.so.7 OLD_LIBS+=lib/libuutil.so.1 OLD_LIBS+=lib/libz.so.4 OLD_LIBS+=lib/libzfs.so.1 OLD_LIBS+=lib/libzpool.so.1 OLD_LIBS+=usr/lib/libarchive.so.4 OLD_LIBS+=usr/lib/libauditd.so.4 OLD_LIBS+=usr/lib/libbluetooth.so.3 OLD_LIBS+=usr/lib/libbsm.so.2 OLD_LIBS+=usr/lib/libbz2.so.3 OLD_LIBS+=usr/lib/libcalendar.so.4 OLD_LIBS+=usr/lib/libcom_err.so.4 OLD_LIBS+=usr/lib/libdevinfo.so.4 OLD_LIBS+=usr/lib/libdialog.so.6 OLD_LIBS+=usr/lib/libdwarf.so.1 OLD_LIBS+=usr/lib/libfetch.so.5 OLD_LIBS+=usr/lib/libform.so.4 OLD_LIBS+=usr/lib/libformw.so.4 OLD_LIBS+=usr/lib/libftpio.so.7 OLD_LIBS+=usr/lib/libgnuregex.so.4 OLD_LIBS+=usr/lib/libgpib.so.2 OLD_LIBS+=usr/lib/libhistory.so.7 OLD_LIBS+=usr/lib/libmagic.so.3 OLD_LIBS+=usr/lib/libmemstat.so.2 OLD_LIBS+=usr/lib/libmenu.so.4 OLD_LIBS+=usr/lib/libmenuw.so.4 OLD_LIBS+=usr/lib/libmilter.so.4 OLD_LIBS+=usr/lib/libncp.so.3 OLD_LIBS+=usr/lib/libnetgraph.so.3 OLD_LIBS+=usr/lib/libngatm.so.3 OLD_LIBS+=usr/lib/libobjc.so.3 OLD_LIBS+=usr/lib/libopie.so.5 OLD_LIBS+=usr/lib/libpam.so.4 OLD_LIBS+=usr/lib/libpanel.so.4 OLD_LIBS+=usr/lib/libpanelw.so.4 OLD_LIBS+=usr/lib/libpmc.so.4 OLD_LIBS+=usr/lib/libproc.so.1 OLD_LIBS+=usr/lib/libproc.so.2 OLD_LIBS+=usr/lib/libradius.so.3 OLD_LIBS+=usr/lib/librpcsvc.so.4 OLD_LIBS+=usr/lib/libsdp.so.3 OLD_LIBS+=usr/lib/libsmb.so.3 OLD_LIBS+=usr/lib/libssh.so.4 OLD_LIBS+=usr/lib/libssl.so.5 OLD_LIBS+=usr/lib/libtacplus.so.3 OLD_LIBS+=usr/lib/libugidfw.so.3 OLD_LIBS+=usr/lib/libusb.so.1 OLD_LIBS+=usr/lib/libusbhid.so.3 OLD_LIBS+=usr/lib/libvgl.so.5 OLD_LIBS+=usr/lib/libwrap.so.5 OLD_LIBS+=usr/lib/libypclnt.so.3 OLD_LIBS+=usr/lib/pam_chroot.so.4 OLD_LIBS+=usr/lib/pam_deny.so.4 OLD_LIBS+=usr/lib/pam_echo.so.4 OLD_LIBS+=usr/lib/pam_exec.so.4 OLD_LIBS+=usr/lib/pam_ftpusers.so.4 OLD_LIBS+=usr/lib/pam_group.so.4 OLD_LIBS+=usr/lib/pam_guest.so.4 OLD_LIBS+=usr/lib/pam_krb5.so.4 OLD_LIBS+=usr/lib/pam_ksu.so.4 OLD_LIBS+=usr/lib/pam_lastlog.so.4 OLD_LIBS+=usr/lib/pam_login_access.so.4 OLD_LIBS+=usr/lib/pam_nologin.so.4 OLD_LIBS+=usr/lib/pam_opie.so.4 OLD_LIBS+=usr/lib/pam_opieaccess.so.4 OLD_LIBS+=usr/lib/pam_passwdqc.so.4 OLD_LIBS+=usr/lib/pam_permit.so.4 OLD_LIBS+=usr/lib/pam_radius.so.4 OLD_LIBS+=usr/lib/pam_rhosts.so.4 OLD_LIBS+=usr/lib/pam_rootok.so.4 OLD_LIBS+=usr/lib/pam_securetty.so.4 OLD_LIBS+=usr/lib/pam_self.so.4 OLD_LIBS+=usr/lib/pam_ssh.so.4 OLD_LIBS+=usr/lib/pam_tacplus.so.4 OLD_LIBS+=usr/lib/pam_unix.so.4 OLD_LIBS+=usr/lib/snmp_atm.so.5 OLD_LIBS+=usr/lib/snmp_bridge.so.5 OLD_LIBS+=usr/lib/snmp_hostres.so.5 OLD_LIBS+=usr/lib/snmp_mibII.so.5 OLD_LIBS+=usr/lib/snmp_netgraph.so.5 OLD_LIBS+=usr/lib/snmp_pf.so.5 OLD_LIBS+=usr/lib32/libalias.so.6 OLD_LIBS+=usr/lib32/libarchive.so.4 OLD_LIBS+=usr/lib32/libauditd.so.4 OLD_LIBS+=usr/lib32/libavl.so.1 OLD_LIBS+=usr/lib32/libbegemot.so.3 OLD_LIBS+=usr/lib32/libbluetooth.so.3 OLD_LIBS+=usr/lib32/libbsdxml.so.3 OLD_LIBS+=usr/lib32/libbsm.so.2 OLD_LIBS+=usr/lib32/libbsnmp.so.4 OLD_LIBS+=usr/lib32/libbz2.so.3 OLD_LIBS+=usr/lib32/libcalendar.so.4 OLD_LIBS+=usr/lib32/libcam.so.4 OLD_LIBS+=usr/lib32/libcom_err.so.4 OLD_LIBS+=usr/lib32/libcrypt.so.4 OLD_LIBS+=usr/lib32/libcrypto.so.5 OLD_LIBS+=usr/lib32/libctf.so.1 OLD_LIBS+=usr/lib32/libdevinfo.so.4 OLD_LIBS+=usr/lib32/libdevstat.so.6 OLD_LIBS+=usr/lib32/libdialog.so.6 OLD_LIBS+=usr/lib32/libdtrace.so.1 OLD_LIBS+=usr/lib32/libdwarf.so.1 OLD_LIBS+=usr/lib32/libedit.so.6 OLD_LIBS+=usr/lib32/libfetch.so.5 OLD_LIBS+=usr/lib32/libform.so.4 OLD_LIBS+=usr/lib32/libformw.so.4 OLD_LIBS+=usr/lib32/libftpio.so.7 OLD_LIBS+=usr/lib32/libgeom.so.4 OLD_LIBS+=usr/lib32/libgnuregex.so.4 OLD_LIBS+=usr/lib32/libgpib.so.2 OLD_LIBS+=usr/lib32/libhistory.so.7 OLD_LIBS+=usr/lib32/libipsec.so.3 OLD_LIBS+=usr/lib32/libipx.so.4 OLD_LIBS+=usr/lib32/libkiconv.so.3 OLD_LIBS+=usr/lib32/libkvm.so.4 OLD_LIBS+=usr/lib32/libmagic.so.3 OLD_LIBS+=usr/lib32/libmd.so.4 OLD_LIBS+=usr/lib32/libmemstat.so.2 OLD_LIBS+=usr/lib32/libmenu.so.4 OLD_LIBS+=usr/lib32/libmenuw.so.4 OLD_LIBS+=usr/lib32/libmilter.so.4 OLD_LIBS+=usr/lib32/libncp.so.3 OLD_LIBS+=usr/lib32/libncurses.so.7 OLD_LIBS+=usr/lib32/libncursesw.so.7 OLD_LIBS+=usr/lib32/libnetgraph.so.3 OLD_LIBS+=usr/lib32/libngatm.so.3 OLD_LIBS+=usr/lib32/libnvpair.so.1 OLD_LIBS+=usr/lib32/libobjc.so.3 OLD_LIBS+=usr/lib32/libopie.so.5 OLD_LIBS+=usr/lib32/libpam.so.4 OLD_LIBS+=usr/lib32/libpanel.so.4 OLD_LIBS+=usr/lib32/libpanelw.so.4 OLD_LIBS+=usr/lib32/libpcap.so.6 OLD_LIBS+=usr/lib32/libpmc.so.4 OLD_LIBS+=usr/lib32/libproc.so.1 OLD_LIBS+=usr/lib32/libradius.so.3 OLD_LIBS+=usr/lib32/libreadline.so.7 OLD_LIBS+=usr/lib32/librpcsvc.so.4 OLD_LIBS+=usr/lib32/libsbuf.so.4 OLD_LIBS+=usr/lib32/libsdp.so.3 OLD_LIBS+=usr/lib32/libsmb.so.3 OLD_LIBS+=usr/lib32/libssh.so.4 OLD_LIBS+=usr/lib32/libssl.so.5 OLD_LIBS+=usr/lib32/libtacplus.so.3 OLD_LIBS+=usr/lib32/libufs.so.4 OLD_LIBS+=usr/lib32/libugidfw.so.3 OLD_LIBS+=usr/lib32/libumem.so.1 OLD_LIBS+=usr/lib32/libusb.so.1 OLD_LIBS+=usr/lib32/libusbhid.so.3 OLD_LIBS+=usr/lib32/libutil.so.7 OLD_LIBS+=usr/lib32/libuutil.so.1 OLD_LIBS+=usr/lib32/libvgl.so.5 OLD_LIBS+=usr/lib32/libwrap.so.5 OLD_LIBS+=usr/lib32/libypclnt.so.3 OLD_LIBS+=usr/lib32/libz.so.4 OLD_LIBS+=usr/lib32/libzfs.so.1 OLD_LIBS+=usr/lib32/libzpool.so.1 OLD_LIBS+=usr/lib32/pam_chroot.so.4 OLD_LIBS+=usr/lib32/pam_deny.so.4 OLD_LIBS+=usr/lib32/pam_echo.so.4 OLD_LIBS+=usr/lib32/pam_exec.so.4 OLD_LIBS+=usr/lib32/pam_ftpusers.so.4 OLD_LIBS+=usr/lib32/pam_group.so.4 OLD_LIBS+=usr/lib32/pam_guest.so.4 OLD_LIBS+=usr/lib32/pam_krb5.so.4 OLD_LIBS+=usr/lib32/pam_ksu.so.4 OLD_LIBS+=usr/lib32/pam_lastlog.so.4 OLD_LIBS+=usr/lib32/pam_login_access.so.4 OLD_LIBS+=usr/lib32/pam_nologin.so.4 OLD_LIBS+=usr/lib32/pam_opie.so.4 OLD_LIBS+=usr/lib32/pam_opieaccess.so.4 OLD_LIBS+=usr/lib32/pam_passwdqc.so.4 OLD_LIBS+=usr/lib32/pam_permit.so.4 OLD_LIBS+=usr/lib32/pam_radius.so.4 OLD_LIBS+=usr/lib32/pam_rhosts.so.4 OLD_LIBS+=usr/lib32/pam_rootok.so.4 OLD_LIBS+=usr/lib32/pam_securetty.so.4 OLD_LIBS+=usr/lib32/pam_self.so.4 OLD_LIBS+=usr/lib32/pam_ssh.so.4 OLD_LIBS+=usr/lib32/pam_tacplus.so.4 OLD_LIBS+=usr/lib32/pam_unix.so.4 # 20090718: the gdm pam.d file is no longer required. OLD_FILES+=etc/pam.d/gdm # 20090714: net_add_domain(9) renamed to domain_add(9) OLD_FILES+=usr/share/man/man9/net_add_domain.9.gz # 20090713: vimage container structs removed. OLD_FILES+=usr/include/netinet/vinet.h OLD_FILES+=usr/include/netinet6/vinet6.h OLD_FILES+=usr/include/netipsec/vipsec.h # 20090712: ieee80211.4 -> net80211.4 OLD_FILES+=usr/share/man/man4/ieee80211.4.gz # 20090711: typo fixed, kproc_resume,.9 -> kproc_resume.9 OLD_FILES+=usr/share/man/man9/kproc_resume,.9.gz # 20090709: msgctl.3 msgget.3 msgrcv.3 msgsnd.3 manual pages moved OLD_FILES+=usr/share/man/man3/msgctl.3.gz OLD_FILES+=usr/share/man/man3/msgget.3.gz OLD_FILES+=usr/share/man/man3/msgrcv.3.gz OLD_FILES+=usr/share/man/man3/msgsnd.3.gz # 20090630: old kernel RPC implementation removal OLD_FILES+=usr/include/nfs/rpcv2.h # 20090624: update usbdi(9) OLD_FILES+=usr/share/man/man9/usbd_abort_default_pipe.9.gz OLD_FILES+=usr/share/man/man9/usbd_abort_pipe.9.gz OLD_FILES+=usr/share/man/man9/usbd_alloc_buffer.9.gz OLD_FILES+=usr/share/man/man9/usbd_alloc_xfer.9.gz OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_stall.9.gz OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_stall_async.9.gz OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_toggle.9.gz OLD_FILES+=usr/share/man/man9/usbd_close_pipe.9.gz OLD_FILES+=usr/share/man/man9/usbd_device2interface_handle.9.gz OLD_FILES+=usr/share/man/man9/usbd_do_request_async.9.gz OLD_FILES+=usr/share/man/man9/usbd_do_request_flags_pipe.9.gz OLD_FILES+=usr/share/man/man9/usbd_endpoint_count.9.gz OLD_FILES+=usr/share/man/man9/usbd_find_edesc.9.gz OLD_FILES+=usr/share/man/man9/usbd_find_idesc.9.gz OLD_FILES+=usr/share/man/man9/usbd_free_buffer.9.gz OLD_FILES+=usr/share/man/man9/usbd_free_xfer.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_buffer.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_config.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_config_desc.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_config_desc_full.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_config_descriptor.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_device_descriptor.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_endpoint_descriptor.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_interface_altindex.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_interface_descriptor.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_no_alts.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_quirks.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_speed.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_string.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_string_desc.9.gz OLD_FILES+=usr/share/man/man9/usbd_get_xfer_status.9.gz OLD_FILES+=usr/share/man/man9/usbd_interface2device_handle.9.gz OLD_FILES+=usr/share/man/man9/usbd_interface2endpoint_descriptor.9.gz OLD_FILES+=usr/share/man/man9/usbd_interface_count.9.gz OLD_FILES+=usr/share/man/man9/usbd_open_pipe.9.gz OLD_FILES+=usr/share/man/man9/usbd_open_pipe_intr.9.gz OLD_FILES+=usr/share/man/man9/usbd_pipe2device_handle.9.gz OLD_FILES+=usr/share/man/man9/usbd_set_config_index.9.gz OLD_FILES+=usr/share/man/man9/usbd_set_config_no.9.gz OLD_FILES+=usr/share/man/man9/usbd_set_interface.9.gz OLD_FILES+=usr/share/man/man9/usbd_setup_default_xfer.9.gz OLD_FILES+=usr/share/man/man9/usbd_setup_isoc_xfer.9.gz OLD_FILES+=usr/share/man/man9/usbd_setup_xfer.9.gz OLD_FILES+=usr/share/man/man9/usbd_sync_transfer.9.gz OLD_FILES+=usr/share/man/man9/usbd_transfer.9.gz OLD_FILES+=usr/share/man/man9/usb_find_desc.9.gz # 20090623: number of headers needed for a usb driver reduced OLD_FILES+=usr/include/dev/usb/usb_defs.h OLD_FILES+=usr/include/dev/usb/usb_error.h OLD_FILES+=usr/include/dev/usb/usb_handle_request.h OLD_FILES+=usr/include/dev/usb/usb_hid.h OLD_FILES+=usr/include/dev/usb/usb_lookup.h OLD_FILES+=usr/include/dev/usb/usb_mfunc.h OLD_FILES+=usr/include/dev/usb/usb_parse.h OLD_FILES+=usr/include/dev/usb/usb_revision.h # 20090609: devclass_add_driver is no longer public OLD_FILES+=usr/share/man/man9/devclass_add_driver.9.gz OLD_FILES+=usr/share/man/man9/devclass_delete_driver.9.gz OLD_FILES+=usr/share/man/man9/devclass_find_driver.9.gz # 20090605: removal of clists OLD_FILES+=usr/include/sys/clist.h # 20090602: removal of window(1) OLD_FILES+=usr/bin/window OLD_FILES+=usr/share/man/man1/window.1.gz # 20090531: bind 9.6.1rc1 import OLD_LIBS+=usr/lib/liblwres.so.30 # 20090530: removal of early.sh OLD_FILES+=etc/rc.d/early.sh # 20090527: renaming of S{LIST,TAILQ}_REMOVE_NEXT() to _REMOVE_AFTER() OLD_FILES+=usr/share/man/man3/SLIST_REMOVE_NEXT.3.gz OLD_FILES+=usr/share/man/man3/STAILQ_REMOVE_NEXT.3.gz # 20090527: removal of legacy USB stack OLD_FILES+=usr/include/legacy/dev/usb/dsbr100io.h OLD_FILES+=usr/include/legacy/dev/usb/ehcireg.h OLD_FILES+=usr/include/legacy/dev/usb/ehcivar.h OLD_FILES+=usr/include/legacy/dev/usb/hid.h OLD_FILES+=usr/include/legacy/dev/usb/if_urtwreg.h OLD_FILES+=usr/include/legacy/dev/usb/if_urtwvar.h OLD_FILES+=usr/include/legacy/dev/usb/ohcireg.h OLD_FILES+=usr/include/legacy/dev/usb/ohcivar.h OLD_FILES+=usr/include/legacy/dev/usb/rio500_usb.h OLD_FILES+=usr/include/legacy/dev/usb/rt2573_ucode.h OLD_FILES+=usr/include/legacy/dev/usb/sl811hsreg.h OLD_FILES+=usr/include/legacy/dev/usb/sl811hsvar.h OLD_FILES+=usr/include/legacy/dev/usb/ubser.h OLD_FILES+=usr/include/legacy/dev/usb/ucomvar.h OLD_FILES+=usr/include/legacy/dev/usb/udbp.h OLD_FILES+=usr/include/legacy/dev/usb/uftdireg.h OLD_FILES+=usr/include/legacy/dev/usb/ugraphire_rdesc.h OLD_FILES+=usr/include/legacy/dev/usb/uhcireg.h OLD_FILES+=usr/include/legacy/dev/usb/uhcivar.h OLD_FILES+=usr/include/legacy/dev/usb/usb.h OLD_FILES+=usr/include/legacy/dev/usb/usb_mem.h OLD_FILES+=usr/include/legacy/dev/usb/usb_port.h OLD_FILES+=usr/include/legacy/dev/usb/usb_quirks.h OLD_FILES+=usr/include/legacy/dev/usb/usbcdc.h OLD_FILES+=usr/include/legacy/dev/usb/usbdi.h OLD_FILES+=usr/include/legacy/dev/usb/usbdi_util.h OLD_FILES+=usr/include/legacy/dev/usb/usbdivar.h OLD_FILES+=usr/include/legacy/dev/usb/usbhid.h OLD_FILES+=usr/include/legacy/dev/usb/uxb360gp_rdesc.h OLD_DIRS+=usr/include/legacy/dev/usb OLD_DIRS+=usr/include/legacy/dev OLD_DIRS+=usr/include/legacy # 20090526: removal of makekey(8) OLD_FILES+=usr/libexec/makekey OLD_FILES+=usr/share/man/man8/makekey.8.gz # 20090522: removal of University of Michigan NFSv4 client OLD_FILES+=etc/rc.d/idmapd OLD_FILES+=sbin/idmapd OLD_FILES+=sbin/mount_nfs4 OLD_FILES+=usr/share/man/man8/idmapd.8.gz OLD_FILES+=usr/share/man/man8/mount_nfs4.8.gz # 20090513: removal of legacy versions of USB network interface drivers OLD_FILES+=usr/include/legacy/dev/usb/if_upgtvar.h OLD_FILES+=usr/include/legacy/dev/usb/usb_ethersubr.h # 20090417: removal of legacy versions of USB network interface drivers OLD_FILES+=usr/include/legacy/dev/usb/if_auereg.h OLD_FILES+=usr/include/legacy/dev/usb/if_axereg.h OLD_FILES+=usr/include/legacy/dev/usb/if_cdcereg.h OLD_FILES+=usr/include/legacy/dev/usb/if_cuereg.h OLD_FILES+=usr/include/legacy/dev/usb/if_kuereg.h OLD_FILES+=usr/include/legacy/dev/usb/if_ruereg.h OLD_FILES+=usr/include/legacy/dev/usb/if_rumreg.h OLD_FILES+=usr/include/legacy/dev/usb/if_rumvar.h OLD_FILES+=usr/include/legacy/dev/usb/if_udavreg.h OLD_FILES+=usr/include/legacy/dev/usb/if_uralreg.h OLD_FILES+=usr/include/legacy/dev/usb/if_uralvar.h OLD_FILES+=usr/include/legacy/dev/usb/if_zydfw.h OLD_FILES+=usr/include/legacy/dev/usb/if_zydreg.h OLD_FILES+=usr/include/legacy/dev/usb/kue_fw.h # 20090416: removal of ar(4), ray(4), sr(4), raycontrol(8) OLD_FILES+=usr/sbin/raycontrol OLD_FILES+=usr/share/man/man4/i386/ar.4.gz OLD_FILES+=usr/share/man/man4/i386/ray.4.gz OLD_FILES+=usr/share/man/man4/i386/sr.4.gz OLD_FILES+=usr/share/man/man8/raycontrol.8.gz # 20090410: VOP_LEASE.9 removed OLD_FILES+=usr/share/man/man9/VOP_LEASE.9.gz # 20090406: usb_sw_transfer.h removed OLD_FILES+=usr/include/dev/usb/usb_sw_transfer.h # 20090405: removal of if_ppp(4) and if_sl(4) OLD_FILES+=sbin/slattach rescue/slattach OLD_FILES+=sbin/startslip rescue/startslip OLD_FILES+=usr/include/net/if_ppp.h OLD_FILES+=usr/include/net/if_pppvar.h OLD_FILES+=usr/include/net/if_slvar.h OLD_FILES+=usr/include/net/ppp_comp.h OLD_FILES+=usr/include/net/slip.h OLD_FILES+=usr/sbin/sliplogin OLD_FILES+=usr/sbin/slstat OLD_FILES+=usr/sbin/pppd OLD_FILES+=usr/sbin/pppstats OLD_FILES+=usr/share/man/man1/startslip.1.gz OLD_FILES+=usr/share/man/man4/if_ppp.4.gz OLD_FILES+=usr/share/man/man4/if_sl.4.gz OLD_FILES+=usr/share/man/man4/ppp.4.gz OLD_FILES+=usr/share/man/man4/sl.4.gz OLD_FILES+=usr/share/man/man8/pppd.8.gz OLD_FILES+=usr/share/man/man8/pppstats.8.gz OLD_FILES+=usr/share/man/man8/slattach.8.gz OLD_FILES+=usr/share/man/man8/slip.8.gz OLD_FILES+=usr/share/man/man8/sliplogin.8.gz OLD_FILES+=usr/share/man/man8/slstat.8.gz # 20090321: libpcap upgraded to 1.0.0 OLD_LIBS+=lib/libpcap.so.5 OLD_LIBS+=usr/lib32/libpcap.so.5 # 20090319: uscanner(4) has been removed OLD_FILES+=usr/share/man/man4/uscanner.4.gz # 20090313: k8temp(4) renamed to amdtemp(4) OLD_FILES+=usr/share/man/man4/k8temp.4.gz # 20090308: libusb.so.1 renamed OLD_LIBS+=usr/lib/libusb20.so.1 OLD_FILES+=usr/lib/libusb20.a OLD_FILES+=usr/lib/libusb20.so OLD_FILES+=usr/lib/libusb20_p.a OLD_FILES+=usr/include/libusb20_compat01.h OLD_FILES+=usr/include/libusb20_compat10.h OLD_LIBS+=usr/lib32/libusb20.so.1 OLD_FILES+=usr/lib32/libusb20.a OLD_FILES+=usr/lib32/libusb20.so OLD_FILES+=usr/lib32/libusb20_p.a # 20090226: libmp(3) functions renamed OLD_LIBS+=usr/lib/libmp.so.6 OLD_LIBS+=usr/lib32/libmp.so.6 # 20090223: changeover of USB stacks OLD_FILES+=usr/include/dev/usb2/include/ufm2_ioctl.h OLD_FILES+=usr/include/dev/usb2/include/urio2_ioctl.h OLD_FILES+=usr/include/dev/usb2/include/usb2_cdc.h OLD_FILES+=usr/include/dev/usb2/include/usb2_defs.h OLD_FILES+=usr/include/dev/usb2/include/usb2_devid.h OLD_FILES+=usr/include/dev/usb2/include/usb2_devtable.h OLD_FILES+=usr/include/dev/usb2/include/usb2_endian.h OLD_FILES+=usr/include/dev/usb2/include/usb2_error.h OLD_FILES+=usr/include/dev/usb2/include/usb2_hid.h OLD_FILES+=usr/include/dev/usb2/include/usb2_ioctl.h OLD_FILES+=usr/include/dev/usb2/include/usb2_mfunc.h OLD_FILES+=usr/include/dev/usb2/include/usb2_revision.h OLD_FILES+=usr/include/dev/usb2/include/usb2_standard.h OLD_DIRS+=usr/include/dev/usb2/include OLD_DIRS+=usr/include/dev/usb2 OLD_FILES+=usr/include/dev/usb/dsbr100io.h OLD_FILES+=usr/include/dev/usb/ehcireg.h OLD_FILES+=usr/include/dev/usb/ehcivar.h OLD_FILES+=usr/include/dev/usb/hid.h OLD_FILES+=usr/include/dev/usb/if_auereg.h OLD_FILES+=usr/include/dev/usb/if_axereg.h OLD_FILES+=usr/include/dev/usb/if_cdcereg.h OLD_FILES+=usr/include/dev/usb/if_cuereg.h OLD_FILES+=usr/include/dev/usb/if_kuereg.h OLD_FILES+=usr/include/dev/usb/if_ruereg.h OLD_FILES+=usr/include/dev/usb/if_rumreg.h OLD_FILES+=usr/include/dev/usb/if_rumvar.h OLD_FILES+=usr/include/dev/usb/if_udavreg.h OLD_FILES+=usr/include/dev/usb/if_upgtvar.h OLD_FILES+=usr/include/dev/usb/if_uralreg.h OLD_FILES+=usr/include/dev/usb/if_uralvar.h OLD_FILES+=usr/include/dev/usb/if_urtwreg.h OLD_FILES+=usr/include/dev/usb/if_urtwvar.h OLD_FILES+=usr/include/dev/usb/if_zydfw.h OLD_FILES+=usr/include/dev/usb/if_zydreg.h OLD_FILES+=usr/include/dev/usb/kue_fw.h OLD_FILES+=usr/include/dev/usb/ohcireg.h OLD_FILES+=usr/include/dev/usb/ohcivar.h OLD_FILES+=usr/include/dev/usb/rio500_usb.h OLD_FILES+=usr/include/dev/usb/rt2573_ucode.h OLD_FILES+=usr/include/dev/usb/sl811hsreg.h OLD_FILES+=usr/include/dev/usb/sl811hsvar.h OLD_FILES+=usr/include/dev/usb/ubser.h OLD_FILES+=usr/include/dev/usb/ucomvar.h OLD_FILES+=usr/include/dev/usb/udbp.h OLD_FILES+=usr/include/dev/usb/uftdireg.h OLD_FILES+=usr/include/dev/usb/ugraphire_rdesc.h OLD_FILES+=usr/include/dev/usb/uhcireg.h OLD_FILES+=usr/include/dev/usb/uhcivar.h OLD_FILES+=usr/include/dev/usb/usb_ethersubr.h OLD_FILES+=usr/include/dev/usb/usb_mem.h OLD_FILES+=usr/include/dev/usb/usb_port.h OLD_FILES+=usr/include/dev/usb/usb_quirks.h OLD_FILES+=usr/include/dev/usb/usbcdc.h OLD_FILES+=usr/include/dev/usb/usbdivar.h OLD_FILES+=usr/include/dev/usb/uxb360gp_rdesc.h OLD_FILES+=usr/sbin/usbdevs OLD_FILES+=usr/share/man/man8/usbdevs.8.gz # 20090203: removal of pccard header files OLD_FILES+=usr/include/pccard/cardinfo.h OLD_FILES+=usr/include/pccard/cis.h OLD_DIRS+=usr/include/pccard # 20090203: adding_user.8 moved to adding_user.7 OLD_FILES+=usr/share/man/man8/adding_user.8.gz # 20090122: tzdata2009a import OLD_FILES+=usr/share/zoneinfo/Asia/Katmandu # 20090102: file 4.26 import OLD_FILES+=usr/share/misc/magic.mime OLD_FILES+=usr/share/misc/magic.mime.mgc # 20081223: bind 9.4.3 import, nsupdate.8 moved to nsupdate.1 OLD_FILES+=usr/share/man/man8/nsupdate.8.gz # 20081223: ipprotosw.h removed OLD_FILES+=usr/include/netinet/ipprotosw.h # 20081123: vfs_mountedon.9 removed OLD_FILES+=usr/share/man/man9/vfs_mountedon.9.gz # 20081023: FREE.9 and MALLOC.9 removed OLD_FILES+=usr/share/man/man9/FREE.9.gz OLD_FILES+=usr/share/man/man9/MALLOC.9.gz # 20080928: removal of inaccurate device_ids(9) manual page OLD_FILES+=usr/share/man/man9/device_ids.9.gz OLD_FILES+=usr/share/man/man9/major.9.gz OLD_FILES+=usr/share/man/man9/minor.9.gz OLD_FILES+=usr/share/man/man9/umajor.9.gz OLD_FILES+=usr/share/man/man9/uminor.9.gz # 20080917: removal of manpage for axed kernel primitive suser(9) OLD_FILES+=usr/share/man/man9/suser.9.gz OLD_FILES+=usr/share/man/man9/suser_cred.9.gz # 20080913: pax removed from rescue OLD_FILES+=rescue/pax # 20080823: removal of unneeded pt_chown, to implement grantpt(3) OLD_FILES+=usr/libexec/pt_chown # 20080822: ntp 4.2.4p5 import OLD_FILES+=usr/share/doc/ntp/driver23.html OLD_FILES+=usr/share/doc/ntp/driver24.html # 20080821: several man pages moved from man4.i386 to man4 .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/share/man/man4/i386/acpi_aiboost.4.gz OLD_FILES+=usr/share/man/man4/i386/acpi_asus.4.gz OLD_FILES+=usr/share/man/man4/i386/acpi_fujitsu.4.gz OLD_FILES+=usr/share/man/man4/i386/acpi_ibm.4.gz OLD_FILES+=usr/share/man/man4/i386/acpi_panasonic.4.gz OLD_FILES+=usr/share/man/man4/i386/acpi_sony.4.gz OLD_FILES+=usr/share/man/man4/i386/acpi_toshiba.4.gz OLD_FILES+=usr/share/man/man4/i386/ichwd.4.gz OLD_FILES+=usr/share/man/man4/i386/if_ndis.4.gz OLD_FILES+=usr/share/man/man4/i386/io.4.gz OLD_FILES+=usr/share/man/man4/i386/linux.4.gz OLD_FILES+=usr/share/man/man4/i386/ndis.4.gz .endif # 20080820: MPSAFE TTY layer integrated OLD_FILES+=usr/include/sys/linedisc.h OLD_FILES+=usr/share/man/man3/posix_openpt.3.gz # 20080725: sgtty.h removed OLD_FILES+=usr/include/sgtty.h # 20080706: bsdlabel(8) removed on powerpc .if ${TARGET_ARCH} == "powerpc" OLD_FILES+=sbin/bsdlabel OLD_FILES+=usr/share/man/man8/bsdlabel.8.gz .endif # 20080704: sbsh(4) removed OLD_FILES+=usr/share/man/man4/if_sbsh.4.gz OLD_FILES+=usr/share/man/man4/sbsh.4.gz # 20080704: cnw(4) removed OLD_FILES+=usr/share/man/man4/if_cnw.4.gz OLD_FILES+=usr/share/man/man4/cnw.4.gz # 20080704: oltr(4) removed .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/share/man/man4/i386/if_oltr.4.gz OLD_FILES+=usr/share/man/man4/i386/oltr.4.gz .endif # 20080704: arl(4) removed .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/sbin/arlcontrol OLD_FILES+=usr/share/man/man4/i386/arl.4.gz OLD_FILES+=usr/share/man/man8/arlcontrol.8.gz .endif # 20080703: sunlabel only for sparc64 .if ${TARGET_ARCH} != "sparc64" OLD_FILES+=sbin/sunlabel OLD_FILES+=usr/share/man/man8/sunlabel.8.gz .endif # 20080701: wpa_supplicant.conf moved to share/examples/etc/ OLD_FILES+=usr/share/examples/wpa_supplicant/wpa_supplicant.conf OLD_DIRS+=usr/share/examples/wpa_supplicant # 20080614: pecoff image activator removed .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/pecoff_machdep.h .endif # 20080614: sgtty removed OLD_FILES+=usr/include/sys/ttychars.h OLD_FILES+=usr/include/sys/ttydev.h OLD_FILES+=usr/share/man/man3/gtty.3.gz OLD_FILES+=usr/share/man/man3/stty.3.gz # 20080609: gpt(8) removed OLD_FILES+=sbin/gpt OLD_FILES+=usr/share/man/man8/gpt.8.gz # 20080525: I4B removed OLD_FILES+=etc/isdn/answer OLD_FILES+=etc/isdn/isdntel OLD_FILES+=etc/isdn/record OLD_FILES+=etc/isdn/tell OLD_FILES+=etc/isdn/tell-record OLD_FILES+=etc/isdn/unknown_incoming OLD_FILES+=etc/isdn/holidays.D OLD_FILES+=etc/isdn/isdnd.rates.A OLD_FILES+=etc/isdn/isdnd.rates.D OLD_FILES+=etc/isdn/isdnd.rates.F OLD_FILES+=etc/isdn/isdnd.rates.L OLD_FILES+=etc/isdn/isdnd.rates.UK.BT OLD_FILES+=etc/isdn/isdnd.rc.sample OLD_FILES+=etc/isdn/isdntel.alias.sample OLD_DIRS+=etc/isdn OLD_FILES+=etc/rc.d/isdnd OLD_FILES+=usr/include/i4b/i4b_cause.h OLD_FILES+=usr/include/i4b/i4b_debug.h OLD_FILES+=usr/include/i4b/i4b_ioctl.h OLD_FILES+=usr/include/i4b/i4b_rbch_ioctl.h OLD_FILES+=usr/include/i4b/i4b_tel_ioctl.h OLD_FILES+=usr/include/i4b/i4b_trace.h OLD_DIRS+=usr/include/i4b OLD_FILES+=usr/sbin/dtmfdecode OLD_FILES+=usr/sbin/g711conv OLD_FILES+=usr/sbin/isdnd OLD_FILES+=usr/sbin/isdndebug OLD_FILES+=usr/sbin/isdndecode OLD_FILES+=usr/sbin/isdnmonitor OLD_FILES+=usr/sbin/isdnphone OLD_FILES+=usr/sbin/isdntel OLD_FILES+=usr/sbin/isdntelctl OLD_FILES+=usr/sbin/isdntrace OLD_FILES+=usr/share/isdn/0.al OLD_FILES+=usr/share/isdn/1.al OLD_FILES+=usr/share/isdn/2.al OLD_FILES+=usr/share/isdn/3.al OLD_FILES+=usr/share/isdn/4.al OLD_FILES+=usr/share/isdn/5.al OLD_FILES+=usr/share/isdn/6.al OLD_FILES+=usr/share/isdn/7.al OLD_FILES+=usr/share/isdn/8.al OLD_FILES+=usr/share/isdn/9.al OLD_FILES+=usr/share/isdn/beep.al OLD_FILES+=usr/share/isdn/msg.al OLD_DIRS+=usr/share/isdn OLD_FILES+=usr/share/man/man1/dtmfdecode.1.gz OLD_FILES+=usr/share/man/man1/g711conv.1.gz OLD_FILES+=usr/share/man/man4/i4b.4.gz OLD_FILES+=usr/share/man/man4/i4bcapi.4.gz OLD_FILES+=usr/share/man/man4/i4bctl.4.gz OLD_FILES+=usr/share/man/man4/i4bing.4.gz OLD_FILES+=usr/share/man/man4/i4bipr.4.gz OLD_FILES+=usr/share/man/man4/i4bisppp.4.gz OLD_FILES+=usr/share/man/man4/i4bq921.4.gz OLD_FILES+=usr/share/man/man4/i4bq931.4.gz OLD_FILES+=usr/share/man/man4/i4brbch.4.gz OLD_FILES+=usr/share/man/man4/i4btel.4.gz OLD_FILES+=usr/share/man/man4/i4btrc.4.gz OLD_FILES+=usr/share/man/man4/iavc.4.gz OLD_FILES+=usr/share/man/man4/isic.4.gz OLD_FILES+=usr/share/man/man4/ifpi.4.gz OLD_FILES+=usr/share/man/man4/ifpi2.4.gz OLD_FILES+=usr/share/man/man4/ifpnp.4.gz OLD_FILES+=usr/share/man/man4/ihfc.4.gz OLD_FILES+=usr/share/man/man4/itjc.4.gz OLD_FILES+=usr/share/man/man4/iwic.4.gz OLD_FILES+=usr/share/man/man5/isdnd.rc.5.gz OLD_FILES+=usr/share/man/man5/isdnd.rates.5.gz OLD_FILES+=usr/share/man/man5/isdnd.acct.5.gz OLD_FILES+=usr/share/man/man8/isdnd.8.gz OLD_FILES+=usr/share/man/man8/isdndebug.8.gz OLD_FILES+=usr/share/man/man8/isdndecode.8.gz OLD_FILES+=usr/share/man/man8/isdnmonitor.8.gz OLD_FILES+=usr/share/man/man8/isdnphone.8.gz OLD_FILES+=usr/share/man/man8/isdntel.8.gz OLD_FILES+=usr/share/man/man8/isdntelctl.8.gz OLD_FILES+=usr/share/man/man8/isdntrace.8.gz OLD_FILES+=usr/share/examples/isdn/contrib/README OLD_FILES+=usr/share/examples/isdn/contrib/anleitung.ppp OLD_FILES+=usr/share/examples/isdn/contrib/answer.c OLD_FILES+=usr/share/examples/isdn/contrib/answer.sh OLD_FILES+=usr/share/examples/isdn/contrib/convert.sh OLD_FILES+=usr/share/examples/isdn/contrib/hplay.c OLD_FILES+=usr/share/examples/isdn/contrib/i4b-ppp-newbie.txt OLD_FILES+=usr/share/examples/isdn/contrib/isdnctl OLD_FILES+=usr/share/examples/isdn/contrib/isdnd_acct OLD_FILES+=usr/share/examples/isdn/contrib/isdnd_acct.pl OLD_FILES+=usr/share/examples/isdn/contrib/isdntelmux.c OLD_FILES+=usr/share/examples/isdn/contrib/mrtg-isp0.sh OLD_FILES+=usr/share/examples/isdn/i4brunppp/Makefile OLD_FILES+=usr/share/examples/isdn/i4brunppp/README OLD_FILES+=usr/share/examples/isdn/i4brunppp/i4brunppp-isdnd.rc OLD_FILES+=usr/share/examples/isdn/i4brunppp/i4brunppp.8 OLD_FILES+=usr/share/examples/isdn/i4brunppp/i4brunppp.c OLD_FILES+=usr/share/examples/isdn/v21/Makefile OLD_FILES+=usr/share/examples/isdn/v21/README OLD_FILES+=usr/share/examples/isdn/v21/v21modem.c OLD_FILES+=usr/share/examples/isdn/FAQ OLD_FILES+=usr/share/examples/isdn/KERNEL OLD_FILES+=usr/share/examples/isdn/Overview OLD_FILES+=usr/share/examples/isdn/README OLD_FILES+=usr/share/examples/isdn/ROADMAP OLD_FILES+=usr/share/examples/isdn/ReleaseNotes OLD_FILES+=usr/share/examples/isdn/Resources OLD_FILES+=usr/share/examples/isdn/SupportedCards OLD_FILES+=usr/share/examples/isdn/ThankYou OLD_DIRS+=usr/share/examples/isdn/contrib OLD_DIRS+=usr/share/examples/isdn/i4brunppp OLD_DIRS+=usr/share/examples/isdn/v21 OLD_DIRS+=usr/share/examples/isdn OLD_FILES+=usr/share/examples/ppp/isdnd.rc OLD_FILES+=usr/share/examples/ppp/ppp.conf.isdn # 20080525: ng_atmpif removed OLD_FILES+=usr/include/netgraph/atm/ng_atmpif.h OLD_FILES+=usr/share/man/man4/ng_atmpif.4.gz # 20080522: pmap_addr_hint removed OLD_FILES+=usr/share/man/man9/pmap_addr_hint.9.gz # 20080517: ipsec_osdep.h removed OLD_FILES+=usr/include/netipsec/ipsec_osdep.h # 20080507: heimdal 1.1 import OLD_LIBS+=usr/lib/libasn1.so.9 OLD_LIBS+=usr/lib/libgssapi.so.9 OLD_LIBS+=usr/lib/libgssapi_krb5.so.9 OLD_LIBS+=usr/lib/libhdb.so.9 OLD_LIBS+=usr/lib/libkadm5clnt.so.9 OLD_LIBS+=usr/lib/libkadm5srv.so.9 OLD_LIBS+=usr/lib/libkafs5.so.9 OLD_LIBS+=usr/lib/libkrb5.so.9 OLD_LIBS+=usr/lib/libroken.so.9 OLD_LIBS+=usr/lib32/libgssapi.so.9 # 20080420: Symbol card support dropped OLD_FILES+=usr/include/dev/wi/spectrum24t_cf.h # 20080420: awi removal OLD_FILES+=usr/share/man/man4/awi.4.gz OLD_FILES+=usr/share/man/man4/if_awi.4.gz # 20080331: pkg_sign has been removed OLD_FILES+=usr/sbin/pkg_check OLD_FILES+=usr/sbin/pkg_sign OLD_FILES+=usr/share/man/man1/pkg_check.1.gz OLD_FILES+=usr/share/man/man1/pkg_sign.1.gz # 20080325: tzdata2008b import OLD_FILES+=usr/share/zoneinfo/Asia/Calcutta OLD_FILES+=usr/share/zoneinfo/Asia/Saigon # 20080314: stack_print(9) mlink fixed OLD_FILES+=usr/share/man/man9/stack_printf.9.gz # 20080312: libkse removal OLD_FILES+=usr/include/sys/kse.h OLD_FILES+=usr/lib/libkse.so OLD_LIBS+=usr/lib/libkse.so.3 OLD_FILES+=usr/share/man/man2/kse.2.gz OLD_FILES+=usr/share/man/man2/kse_create.2.gz OLD_FILES+=usr/share/man/man2/kse_exit.2.gz OLD_FILES+=usr/share/man/man2/kse_release.2.gz OLD_FILES+=usr/share/man/man2/kse_switchin.2.gz OLD_FILES+=usr/share/man/man2/kse_thr_interrupt.2.gz OLD_FILES+=usr/share/man/man2/kse_wakeup.2.gz OLD_FILES+=usr/lib32/libkse.so OLD_LIBS+=usr/lib32/libkse.so.3 # 20080225: bsdar/bsdranlib rename to ar/ranlib OLD_FILES+=usr/bin/bsdar OLD_FILES+=usr/bin/bsdranlib OLD_FILES+=usr/share/man/man1/bsdar.1.gz OLD_FILES+=usr/share/man/man1/bsdranlib.1.gz # 20080220: geom_lvm rename to geom_linux_lvm OLD_FILES+=usr/share/man/man4/geom_lvm.4.gz # 20080126: oldcard.4 removal OLD_FILES+=usr/share/man/man4/card.4.gz OLD_FILES+=usr/share/man/man4/oldcard.4.gz # 20080122: Removed from the tree OLD_FILES+=usr/share/man/man9/BUF_REFCNT.9.gz # 20080108: Moved to section 2 OLD_FILES+=usr/share/man/man3/shm_open.3.gz OLD_FILES+=usr/share/man/man3/shm_unlink.3.gz # 20071207: Merged with fortunes-o.real OLD_FILES+=usr/share/games/fortune/fortunes2-o OLD_FILES+=usr/share/games/fortune/fortunes2-o.dat # 20071201: Removal of XRPU driver OLD_FILES+=usr/include/sys/xrpuio.h # 20071129: Disabled static versions of libkse by default OLD_FILES+=usr/lib/libkse.a OLD_FILES+=usr/lib/libkse_p.a OLD_FILES+=usr/lib/libkse_pic.a OLD_FILES+=usr/lib32/libkse.a OLD_FILES+=usr/lib32/libkse_p.a OLD_FILES+=usr/lib32/libkse_pic.a # 20071129: Removed a Solaris compatibility header OLD_FILES+=usr/include/sys/_elf_solaris.h # 20071125: Renamed to pmc_get_msr() OLD_FILES+=usr/share/man/man3/pmc_x86_get_msr.3.gz # 20071108: Removed very crunch OLDCARD support file OLD_FILES+=etc/defaults/pccard.conf # 20071025: rc.d/nfslocking superceeded by rc.d/lockd and rc.d/statd OLD_FILES+=etc/rc.d/nfslocking # 20070930: rename of cached to nscd OLD_FILES+=etc/cached.conf OLD_FILES+=etc/rc.d/cached OLD_FILES+=usr/sbin/cached OLD_FILES+=usr/share/man/man5/cached.conf.5.gz OLD_FILES+=usr/share/man/man8/cached.8.gz # 20070807: removal of PowerPC specific header file. .if ${TARGET_ARCH} == "powerpc" OLD_FILES+=usr/include/machine/interruptvar.h .endif # 20070801: fast_ipsec.4 gone OLD_FILES+=usr/share/man/man4/fast_ipsec.4.gz # 20070715: netatm temporarily disconnected (removed 20080525) OLD_FILES+=rescue/atm OLD_FILES+=rescue/fore_dnld OLD_FILES+=rescue/ilmid OLD_FILES+=sbin/atm OLD_FILES+=sbin/fore_dnld OLD_FILES+=sbin/ilmid OLD_FILES+=usr/include/libatm.h OLD_FILES+=usr/include/netatm/atm.h OLD_FILES+=usr/include/netatm/atm_cm.h OLD_FILES+=usr/include/netatm/atm_if.h OLD_FILES+=usr/include/netatm/atm_ioctl.h OLD_FILES+=usr/include/netatm/atm_pcb.h OLD_FILES+=usr/include/netatm/atm_sap.h OLD_FILES+=usr/include/netatm/atm_sigmgr.h OLD_FILES+=usr/include/netatm/atm_stack.h OLD_FILES+=usr/include/netatm/atm_sys.h OLD_FILES+=usr/include/netatm/atm_var.h OLD_FILES+=usr/include/netatm/atm_vc.h OLD_FILES+=usr/include/netatm/ipatm/ipatm.h OLD_FILES+=usr/include/netatm/ipatm/ipatm_serv.h OLD_FILES+=usr/include/netatm/ipatm/ipatm_var.h OLD_FILES+=usr/include/netatm/port.h OLD_FILES+=usr/include/netatm/queue.h OLD_FILES+=usr/include/netatm/sigpvc/sigpvc_var.h OLD_FILES+=usr/include/netatm/spans/spans_cls.h OLD_FILES+=usr/include/netatm/spans/spans_kxdr.h OLD_FILES+=usr/include/netatm/spans/spans_var.h OLD_FILES+=usr/include/netatm/uni/sscf_uni.h OLD_FILES+=usr/include/netatm/uni/sscf_uni_var.h OLD_FILES+=usr/include/netatm/uni/sscop.h OLD_FILES+=usr/include/netatm/uni/sscop_misc.h OLD_FILES+=usr/include/netatm/uni/sscop_pdu.h OLD_FILES+=usr/include/netatm/uni/sscop_var.h OLD_FILES+=usr/include/netatm/uni/uni.h OLD_FILES+=usr/include/netatm/uni/uniip_var.h OLD_FILES+=usr/include/netatm/uni/unisig.h OLD_FILES+=usr/include/netatm/uni/unisig_decode.h OLD_FILES+=usr/include/netatm/uni/unisig_mbuf.h OLD_FILES+=usr/include/netatm/uni/unisig_msg.h OLD_FILES+=usr/include/netatm/uni/unisig_print.h OLD_FILES+=usr/include/netatm/uni/unisig_var.h OLD_FILES+=usr/lib/libatm.a OLD_FILES+=usr/lib/libatm_p.a OLD_FILES+=usr/sbin/atmarpd OLD_FILES+=usr/sbin/scspd OLD_FILES+=usr/share/man/en.ISO8859-1/man8/atm.8.gz OLD_FILES+=usr/share/man/en.ISO8859-1/man8/atmarpd.8.gz OLD_FILES+=usr/share/man/en.ISO8859-1/man8/fore_dnld.8.gz OLD_FILES+=usr/share/man/en.ISO8859-1/man8/ilmid.8.gz OLD_FILES+=usr/share/man/en.ISO8859-1/man8/scspd.8.gz OLD_FILES+=usr/share/man/man8/atm.8.gz OLD_FILES+=usr/share/man/man8/atmarpd.8.gz OLD_FILES+=usr/share/man/man8/fore_dnld.8.gz OLD_FILES+=usr/share/man/man8/ilmid.8.gz OLD_FILES+=usr/share/man/man8/scspd.8.gz OLD_FILES+=usr/share/examples/atm/NOTES OLD_FILES+=usr/share/examples/atm/README OLD_FILES+=usr/share/examples/atm/Startup OLD_FILES+=usr/share/examples/atm/atm-config.sh OLD_FILES+=usr/share/examples/atm/atm-sockets.txt OLD_FILES+=usr/share/examples/atm/cpcs-design.txt OLD_FILES+=usr/share/examples/atm/fore-microcode.txt OLD_FILES+=usr/share/examples/atm/sscf-design.txt OLD_FILES+=usr/share/examples/atm/sscop-design.txt OLD_LIBS+=lib/libatm.so.5 OLD_LIBS+=usr/lib/libatm.so OLD_DIRS+=usr/include/netatm/sigpvc OLD_DIRS+=usr/include/netatm/spans OLD_DIRS+=usr/include/netatm/ipatm OLD_DIRS+=usr/include/netatm/uni OLD_DIRS+=usr/include/netatm OLD_DIRS+=usr/share/examples/atm OLD_FILES+=usr/lib32/libatm.a OLD_FILES+=usr/lib32/libatm.so OLD_LIBS+=usr/lib32/libatm.so.5 OLD_FILES+=usr/lib32/libatm_p.a # 20070705: I4B headers repo-copied to include/i4b/ .if ${TARGET_ARCH} == "i386" OLD_FILES+=usr/include/machine/i4b_cause.h OLD_FILES+=usr/include/machine/i4b_debug.h OLD_FILES+=usr/include/machine/i4b_ioctl.h OLD_FILES+=usr/include/machine/i4b_rbch_ioctl.h OLD_FILES+=usr/include/machine/i4b_tel_ioctl.h OLD_FILES+=usr/include/machine/i4b_trace.h .endif # 20070703: pf 4.1 import OLD_FILES+=usr/libexec/ftp-proxy # 20070701: KAME IPSec removal OLD_FILES+=usr/include/netinet6/ah.h OLD_FILES+=usr/include/netinet6/ah6.h OLD_FILES+=usr/include/netinet6/ah_aesxcbcmac.h OLD_FILES+=usr/include/netinet6/esp.h OLD_FILES+=usr/include/netinet6/esp6.h OLD_FILES+=usr/include/netinet6/esp_aesctr.h OLD_FILES+=usr/include/netinet6/esp_camellia.h OLD_FILES+=usr/include/netinet6/esp_rijndael.h OLD_FILES+=usr/include/netinet6/ipsec.h OLD_FILES+=usr/include/netinet6/ipsec6.h OLD_FILES+=usr/include/netinet6/ipcomp.h OLD_FILES+=usr/include/netinet6/ipcomp6.h OLD_FILES+=usr/include/netkey/key.h OLD_FILES+=usr/include/netkey/key_debug.h OLD_FILES+=usr/include/netkey/key_var.h OLD_FILES+=usr/include/netkey/keydb.h OLD_FILES+=usr/include/netkey/keysock.h OLD_DIRS+=usr/include/netkey # 20070701: remove wicontrol OLD_FILES+=usr/sbin/wicontrol OLD_FILES+=usr/share/man/man8/wicontrol.8.gz # 20070625: umapfs removal OLD_FILES+=rescue/mount_umapfs OLD_FILES+=sbin/mount_umapfs OLD_FILES+=usr/include/fs/umapfs/umap.h OLD_FILES+=usr/share/man/man8/mount_umapfs.8.gz OLD_DIRS+=usr/include/fs/umapfs # 20070618: Removal of the PROTO.localhost* files OLD_FILES+=etc/namedb/PROTO.localhost-v6.rev OLD_FILES+=etc/namedb/PROTO.localhost.rev OLD_FILES+=etc/namedb/make-localhost # 20070618: shared library version bump OLD_LIBS+=lib/libalias.so.5 OLD_LIBS+=lib/libbsnmp.so.3 OLD_LIBS+=lib/libncurses.so.6 OLD_LIBS+=lib/libncursesw.so.6 OLD_LIBS+=lib/libreadline.so.6 OLD_LIBS+=usr/lib/libdialog.so.5 OLD_LIBS+=usr/lib/libgnuregex.so.3 OLD_LIBS+=usr/lib/libhistory.so.6 OLD_LIBS+=usr/lib/libpam.so.3 OLD_LIBS+=usr/lib/libssh.so.3 OLD_LIBS+=usr/lib/pam_chroot.so.3 OLD_LIBS+=usr/lib/pam_deny.so.3 OLD_LIBS+=usr/lib/pam_echo.so.3 OLD_LIBS+=usr/lib/pam_exec.so.3 OLD_LIBS+=usr/lib/pam_ftpusers.so.3 OLD_LIBS+=usr/lib/pam_group.so.3 OLD_LIBS+=usr/lib/pam_guest.so.3 OLD_LIBS+=usr/lib/pam_krb5.so.3 OLD_LIBS+=usr/lib/pam_ksu.so.3 OLD_LIBS+=usr/lib/pam_lastlog.so.3 OLD_LIBS+=usr/lib/pam_login_access.so.3 OLD_LIBS+=usr/lib/pam_nologin.so.3 OLD_LIBS+=usr/lib/pam_opie.so.3 OLD_LIBS+=usr/lib/pam_opieaccess.so.3 OLD_LIBS+=usr/lib/pam_passwdqc.so.3 OLD_LIBS+=usr/lib/pam_permit.so.3 OLD_LIBS+=usr/lib/pam_radius.so.3 OLD_LIBS+=usr/lib/pam_rhosts.so.3 OLD_LIBS+=usr/lib/pam_rootok.so.3 OLD_LIBS+=usr/lib/pam_securetty.so.3 OLD_LIBS+=usr/lib/pam_self.so.3 OLD_LIBS+=usr/lib/pam_ssh.so.3 OLD_LIBS+=usr/lib/pam_tacplus.so.3 OLD_LIBS+=usr/lib/pam_unix.so.3 OLD_LIBS+=usr/lib/snmp_atm.so.4 OLD_LIBS+=usr/lib/snmp_bridge.so.4 OLD_LIBS+=usr/lib/snmp_hostres.so.4 OLD_LIBS+=usr/lib/snmp_mibII.so.4 OLD_LIBS+=usr/lib/snmp_netgraph.so.4 OLD_LIBS+=usr/lib/snmp_pf.so.4 OLD_LIBS+=usr/lib32/libalias.so.5 OLD_LIBS+=usr/lib32/libbsnmp.so.3 OLD_LIBS+=usr/lib32/libdialog.so.5 OLD_LIBS+=usr/lib32/libgnuregex.so.3 OLD_LIBS+=usr/lib32/libhistory.so.6 OLD_LIBS+=usr/lib32/libncurses.so.6 OLD_LIBS+=usr/lib32/libncursesw.so.6 OLD_LIBS+=usr/lib32/libpam.so.3 OLD_LIBS+=usr/lib32/libreadline.so.6 OLD_LIBS+=usr/lib32/libssh.so.3 OLD_LIBS+=usr/lib32/pam_chroot.so.3 OLD_LIBS+=usr/lib32/pam_deny.so.3 OLD_LIBS+=usr/lib32/pam_echo.so.3 OLD_LIBS+=usr/lib32/pam_exec.so.3 OLD_LIBS+=usr/lib32/pam_ftpusers.so.3 OLD_LIBS+=usr/lib32/pam_group.so.3 OLD_LIBS+=usr/lib32/pam_guest.so.3 OLD_LIBS+=usr/lib32/pam_krb5.so.3 OLD_LIBS+=usr/lib32/pam_ksu.so.3 OLD_LIBS+=usr/lib32/pam_lastlog.so.3 OLD_LIBS+=usr/lib32/pam_login_access.so.3 OLD_LIBS+=usr/lib32/pam_nologin.so.3 OLD_LIBS+=usr/lib32/pam_opie.so.3 OLD_LIBS+=usr/lib32/pam_opieaccess.so.3 OLD_LIBS+=usr/lib32/pam_passwdqc.so.3 OLD_LIBS+=usr/lib32/pam_permit.so.3 OLD_LIBS+=usr/lib32/pam_radius.so.3 OLD_LIBS+=usr/lib32/pam_rhosts.so.3 OLD_LIBS+=usr/lib32/pam_rootok.so.3 OLD_LIBS+=usr/lib32/pam_securetty.so.3 OLD_LIBS+=usr/lib32/pam_self.so.3 OLD_LIBS+=usr/lib32/pam_ssh.so.3 OLD_LIBS+=usr/lib32/pam_tacplus.so.3 OLD_LIBS+=usr/lib32/pam_unix.so.3 # 20070613: IPX over IP tunnel removal OLD_FILES+=usr/include/netipx/ipx_ip.h # 20070605: sched_core removal OLD_FILES+=usr/share/man/man4/sched_core.4.gz # 20070603: BIND 9.4.1 import OLD_LIBS+=usr/lib/liblwres.so.10 # 20070521: shared library version bump OLD_LIBS+=lib/libatm.so.4 OLD_LIBS+=lib/libbegemot.so.2 OLD_LIBS+=lib/libbsdxml.so.2 OLD_LIBS+=lib/libcam.so.3 OLD_LIBS+=lib/libcrypt.so.3 OLD_LIBS+=lib/libdevstat.so.5 OLD_LIBS+=lib/libedit.so.5 OLD_LIBS+=lib/libgeom.so.3 OLD_LIBS+=lib/libipsec.so.2 OLD_LIBS+=lib/libipx.so.3 OLD_LIBS+=lib/libkiconv.so.2 OLD_LIBS+=lib/libkse.so.2 OLD_LIBS+=lib/libkvm.so.3 OLD_LIBS+=lib/libm.so.4 OLD_LIBS+=lib/libmd.so.3 OLD_LIBS+=lib/libpcap.so.4 OLD_LIBS+=lib/libpthread.so.2 OLD_LIBS+=lib/libsbuf.so.3 OLD_LIBS+=lib/libthr.so.2 OLD_LIBS+=lib/libufs.so.3 OLD_LIBS+=lib/libutil.so.6 OLD_LIBS+=lib/libz.so.3 OLD_LIBS+=usr/lib/libbluetooth.so.2 OLD_LIBS+=usr/lib/libbsm.so.1 OLD_LIBS+=usr/lib/libbz2.so.2 OLD_LIBS+=usr/lib/libcalendar.so.3 OLD_LIBS+=usr/lib/libcom_err.so.3 OLD_LIBS+=usr/lib/libdevinfo.so.3 OLD_LIBS+=usr/lib/libfetch.so.4 OLD_LIBS+=usr/lib/libform.so.3 OLD_LIBS+=usr/lib/libformw.so.3 OLD_LIBS+=usr/lib/libftpio.so.6 OLD_LIBS+=usr/lib/libgpib.so.1 OLD_LIBS+=usr/lib/libkse.so.2 OLD_LIBS+=usr/lib/libmagic.so.2 OLD_LIBS+=usr/lib/libmemstat.so.1 OLD_LIBS+=usr/lib/libmenu.so.3 OLD_LIBS+=usr/lib/libmenuw.so.3 OLD_LIBS+=usr/lib/libmilter.so.3 OLD_LIBS+=usr/lib/libmp.so.5 OLD_LIBS+=usr/lib/libncp.so.2 OLD_LIBS+=usr/lib/libnetgraph.so.2 OLD_LIBS+=usr/lib/libngatm.so.2 OLD_LIBS+=usr/lib/libopie.so.4 OLD_LIBS+=usr/lib/libpanel.so.3 OLD_LIBS+=usr/lib/libpanelw.so.3 OLD_LIBS+=usr/lib/libpmc.so.3 OLD_LIBS+=usr/lib/libradius.so.2 OLD_LIBS+=usr/lib/librpcsvc.so.3 OLD_LIBS+=usr/lib/libsdp.so.2 OLD_LIBS+=usr/lib/libsmb.so.2 OLD_LIBS+=usr/lib/libstdc++.so.5 OLD_LIBS+=usr/lib/libtacplus.so.2 OLD_LIBS+=usr/lib/libthr.so.2 OLD_LIBS+=usr/lib/libthread_db.so.2 OLD_LIBS+=usr/lib/libugidfw.so.2 OLD_LIBS+=usr/lib/libusbhid.so.2 OLD_LIBS+=usr/lib/libvgl.so.4 OLD_LIBS+=usr/lib/libwrap.so.4 OLD_LIBS+=usr/lib/libypclnt.so.2 OLD_LIBS+=usr/lib/snmp_bridge.so.3 OLD_LIBS+=usr/lib/snmp_hostres.so.3 OLD_LIBS+=usr/lib32/libatm.so.4 OLD_LIBS+=usr/lib32/libbegemot.so.2 OLD_LIBS+=usr/lib32/libbluetooth.so.2 OLD_LIBS+=usr/lib32/libbsdxml.so.2 OLD_LIBS+=usr/lib32/libbsm.so.1 OLD_LIBS+=usr/lib32/libbz2.so.2 OLD_LIBS+=usr/lib32/libcalendar.so.3 OLD_LIBS+=usr/lib32/libcam.so.3 OLD_LIBS+=usr/lib32/libcom_err.so.3 OLD_LIBS+=usr/lib32/libcrypt.so.3 OLD_LIBS+=usr/lib32/libdevinfo.so.3 OLD_LIBS+=usr/lib32/libdevstat.so.5 OLD_LIBS+=usr/lib32/libedit.so.5 OLD_LIBS+=usr/lib32/libfetch.so.4 OLD_LIBS+=usr/lib32/libform.so.3 OLD_LIBS+=usr/lib32/libformw.so.3 OLD_LIBS+=usr/lib32/libftpio.so.6 OLD_LIBS+=usr/lib32/libgeom.so.3 OLD_LIBS+=usr/lib32/libgpib.so.1 OLD_LIBS+=usr/lib32/libipsec.so.2 OLD_LIBS+=usr/lib32/libipx.so.3 OLD_LIBS+=usr/lib32/libkiconv.so.2 OLD_LIBS+=usr/lib32/libkse.so.2 OLD_LIBS+=usr/lib32/libkvm.so.3 OLD_LIBS+=usr/lib32/libm.so.4 OLD_LIBS+=usr/lib32/libmagic.so.2 OLD_LIBS+=usr/lib32/libmd.so.3 OLD_LIBS+=usr/lib32/libmemstat.so.1 OLD_LIBS+=usr/lib32/libmenu.so.3 OLD_LIBS+=usr/lib32/libmenuw.so.3 OLD_LIBS+=usr/lib32/libmilter.so.3 OLD_LIBS+=usr/lib32/libmp.so.5 OLD_LIBS+=usr/lib32/libncp.so.2 OLD_LIBS+=usr/lib32/libnetgraph.so.2 OLD_LIBS+=usr/lib32/libngatm.so.2 OLD_LIBS+=usr/lib32/libopie.so.4 OLD_LIBS+=usr/lib32/libpanel.so.3 OLD_LIBS+=usr/lib32/libpanelw.so.3 OLD_LIBS+=usr/lib32/libpcap.so.4 OLD_LIBS+=usr/lib32/libpmc.so.3 OLD_LIBS+=usr/lib32/libpthread.so.2 OLD_LIBS+=usr/lib32/libradius.so.2 OLD_LIBS+=usr/lib32/librpcsvc.so.3 OLD_LIBS+=usr/lib32/libsbuf.so.3 OLD_LIBS+=usr/lib32/libsdp.so.2 OLD_LIBS+=usr/lib32/libsmb.so.2 OLD_LIBS+=usr/lib32/libstdc++.so.5 OLD_LIBS+=usr/lib32/libtacplus.so.2 OLD_LIBS+=usr/lib32/libthr.so.2 OLD_LIBS+=usr/lib32/libthread_db.so.2 OLD_LIBS+=usr/lib32/libufs.so.3 OLD_LIBS+=usr/lib32/libugidfw.so.2 OLD_LIBS+=usr/lib32/libusbhid.so.2 OLD_LIBS+=usr/lib32/libutil.so.6 OLD_LIBS+=usr/lib32/libvgl.so.4 OLD_LIBS+=usr/lib32/libwrap.so.4 OLD_LIBS+=usr/lib32/libypclnt.so.2 OLD_LIBS+=usr/lib32/libz.so.3 # 20070519: GCC 4.2 OLD_FILES+=usr/bin/f77 OLD_FILES+=usr/bin/protoize OLD_FILES+=usr/include/g2c.h OLD_FILES+=usr/libexec/f771 OLD_FILES+=usr/share/info/g77.info.gz OLD_FILES+=usr/share/man/man1/f77.1.gz OLD_FILES+=usr/include/c++/3.4/algorithm OLD_FILES+=usr/include/c++/3.4/backward/algo.h OLD_FILES+=usr/include/c++/3.4/backward/algobase.h OLD_FILES+=usr/include/c++/3.4/backward/alloc.h OLD_FILES+=usr/include/c++/3.4/backward/backward_warning.h OLD_FILES+=usr/include/c++/3.4/backward/bvector.h OLD_FILES+=usr/include/c++/3.4/backward/complex.h OLD_FILES+=usr/include/c++/3.4/backward/defalloc.h OLD_FILES+=usr/include/c++/3.4/backward/deque.h OLD_FILES+=usr/include/c++/3.4/backward/fstream.h OLD_FILES+=usr/include/c++/3.4/backward/function.h OLD_FILES+=usr/include/c++/3.4/backward/hash_map.h OLD_FILES+=usr/include/c++/3.4/backward/hash_set.h OLD_FILES+=usr/include/c++/3.4/backward/hashtable.h OLD_FILES+=usr/include/c++/3.4/backward/heap.h OLD_FILES+=usr/include/c++/3.4/backward/iomanip.h OLD_FILES+=usr/include/c++/3.4/backward/iostream.h OLD_FILES+=usr/include/c++/3.4/backward/istream.h OLD_FILES+=usr/include/c++/3.4/backward/iterator.h OLD_FILES+=usr/include/c++/3.4/backward/list.h OLD_FILES+=usr/include/c++/3.4/backward/map.h OLD_FILES+=usr/include/c++/3.4/backward/multimap.h OLD_FILES+=usr/include/c++/3.4/backward/multiset.h OLD_FILES+=usr/include/c++/3.4/backward/new.h OLD_FILES+=usr/include/c++/3.4/backward/ostream.h OLD_FILES+=usr/include/c++/3.4/backward/pair.h OLD_FILES+=usr/include/c++/3.4/backward/queue.h OLD_FILES+=usr/include/c++/3.4/backward/rope.h OLD_FILES+=usr/include/c++/3.4/backward/set.h OLD_FILES+=usr/include/c++/3.4/backward/slist.h OLD_FILES+=usr/include/c++/3.4/backward/stack.h OLD_FILES+=usr/include/c++/3.4/backward/stream.h OLD_FILES+=usr/include/c++/3.4/backward/streambuf.h OLD_FILES+=usr/include/c++/3.4/backward/strstream OLD_FILES+=usr/include/c++/3.4/backward/tempbuf.h OLD_FILES+=usr/include/c++/3.4/backward/tree.h OLD_FILES+=usr/include/c++/3.4/backward/vector.h OLD_FILES+=usr/include/c++/3.4/bits/allocator.h OLD_FILES+=usr/include/c++/3.4/bits/atomic_word.h OLD_FILES+=usr/include/c++/3.4/bits/atomicity.h OLD_FILES+=usr/include/c++/3.4/bits/basic_file.h OLD_FILES+=usr/include/c++/3.4/bits/basic_ios.h OLD_FILES+=usr/include/c++/3.4/bits/basic_ios.tcc OLD_FILES+=usr/include/c++/3.4/bits/basic_string.h OLD_FILES+=usr/include/c++/3.4/bits/basic_string.tcc OLD_FILES+=usr/include/c++/3.4/bits/boost_concept_check.h OLD_FILES+=usr/include/c++/3.4/bits/c++allocator.h OLD_FILES+=usr/include/c++/3.4/bits/c++config.h OLD_FILES+=usr/include/c++/3.4/bits/c++io.h OLD_FILES+=usr/include/c++/3.4/bits/c++locale.h OLD_FILES+=usr/include/c++/3.4/bits/c++locale_internal.h OLD_FILES+=usr/include/c++/3.4/bits/char_traits.h OLD_FILES+=usr/include/c++/3.4/bits/cmath.tcc OLD_FILES+=usr/include/c++/3.4/bits/codecvt.h OLD_FILES+=usr/include/c++/3.4/bits/codecvt_specializations.h OLD_FILES+=usr/include/c++/3.4/bits/concept_check.h OLD_FILES+=usr/include/c++/3.4/bits/concurrence.h OLD_FILES+=usr/include/c++/3.4/bits/cpp_type_traits.h OLD_FILES+=usr/include/c++/3.4/bits/ctype_base.h OLD_FILES+=usr/include/c++/3.4/bits/ctype_inline.h OLD_FILES+=usr/include/c++/3.4/bits/ctype_noninline.h OLD_FILES+=usr/include/c++/3.4/bits/deque.tcc OLD_FILES+=usr/include/c++/3.4/bits/fstream.tcc OLD_FILES+=usr/include/c++/3.4/bits/functexcept.h OLD_FILES+=usr/include/c++/3.4/bits/gslice.h OLD_FILES+=usr/include/c++/3.4/bits/gslice_array.h OLD_FILES+=usr/include/c++/3.4/bits/gthr-default.h OLD_FILES+=usr/include/c++/3.4/bits/gthr-posix.h OLD_FILES+=usr/include/c++/3.4/bits/gthr-single.h OLD_FILES+=usr/include/c++/3.4/bits/gthr.h OLD_FILES+=usr/include/c++/3.4/bits/indirect_array.h OLD_FILES+=usr/include/c++/3.4/bits/ios_base.h OLD_FILES+=usr/include/c++/3.4/bits/istream.tcc OLD_FILES+=usr/include/c++/3.4/bits/list.tcc OLD_FILES+=usr/include/c++/3.4/bits/locale_classes.h OLD_FILES+=usr/include/c++/3.4/bits/locale_facets.h OLD_FILES+=usr/include/c++/3.4/bits/locale_facets.tcc OLD_FILES+=usr/include/c++/3.4/bits/localefwd.h OLD_FILES+=usr/include/c++/3.4/bits/mask_array.h OLD_FILES+=usr/include/c++/3.4/bits/messages_members.h OLD_FILES+=usr/include/c++/3.4/bits/os_defines.h OLD_FILES+=usr/include/c++/3.4/bits/ostream.tcc OLD_FILES+=usr/include/c++/3.4/bits/postypes.h OLD_FILES+=usr/include/c++/3.4/bits/slice_array.h OLD_FILES+=usr/include/c++/3.4/bits/sstream.tcc OLD_FILES+=usr/include/c++/3.4/bits/stl_algo.h OLD_FILES+=usr/include/c++/3.4/bits/stl_algobase.h OLD_FILES+=usr/include/c++/3.4/bits/stl_bvector.h OLD_FILES+=usr/include/c++/3.4/bits/stl_construct.h OLD_FILES+=usr/include/c++/3.4/bits/stl_deque.h OLD_FILES+=usr/include/c++/3.4/bits/stl_function.h OLD_FILES+=usr/include/c++/3.4/bits/stl_heap.h OLD_FILES+=usr/include/c++/3.4/bits/stl_iterator.h OLD_FILES+=usr/include/c++/3.4/bits/stl_iterator_base_funcs.h OLD_FILES+=usr/include/c++/3.4/bits/stl_iterator_base_types.h OLD_FILES+=usr/include/c++/3.4/bits/stl_list.h OLD_FILES+=usr/include/c++/3.4/bits/stl_map.h OLD_FILES+=usr/include/c++/3.4/bits/stl_multimap.h OLD_FILES+=usr/include/c++/3.4/bits/stl_multiset.h OLD_FILES+=usr/include/c++/3.4/bits/stl_numeric.h OLD_FILES+=usr/include/c++/3.4/bits/stl_pair.h OLD_FILES+=usr/include/c++/3.4/bits/stl_queue.h OLD_FILES+=usr/include/c++/3.4/bits/stl_raw_storage_iter.h OLD_FILES+=usr/include/c++/3.4/bits/stl_relops.h OLD_FILES+=usr/include/c++/3.4/bits/stl_set.h OLD_FILES+=usr/include/c++/3.4/bits/stl_stack.h OLD_FILES+=usr/include/c++/3.4/bits/stl_tempbuf.h OLD_FILES+=usr/include/c++/3.4/bits/stl_threads.h OLD_FILES+=usr/include/c++/3.4/bits/stl_tree.h OLD_FILES+=usr/include/c++/3.4/bits/stl_uninitialized.h OLD_FILES+=usr/include/c++/3.4/bits/stl_vector.h OLD_FILES+=usr/include/c++/3.4/bits/stream_iterator.h OLD_FILES+=usr/include/c++/3.4/bits/streambuf.tcc OLD_FILES+=usr/include/c++/3.4/bits/streambuf_iterator.h OLD_FILES+=usr/include/c++/3.4/bits/stringfwd.h OLD_FILES+=usr/include/c++/3.4/bits/time_members.h OLD_FILES+=usr/include/c++/3.4/bits/type_traits.h OLD_FILES+=usr/include/c++/3.4/bits/valarray_after.h OLD_FILES+=usr/include/c++/3.4/bits/valarray_array.h OLD_FILES+=usr/include/c++/3.4/bits/valarray_array.tcc OLD_FILES+=usr/include/c++/3.4/bits/valarray_before.h OLD_FILES+=usr/include/c++/3.4/bits/vector.tcc OLD_FILES+=usr/include/c++/3.4/bitset OLD_FILES+=usr/include/c++/3.4/cassert OLD_FILES+=usr/include/c++/3.4/cctype OLD_FILES+=usr/include/c++/3.4/cerrno OLD_FILES+=usr/include/c++/3.4/cfloat OLD_FILES+=usr/include/c++/3.4/ciso646 OLD_FILES+=usr/include/c++/3.4/climits OLD_FILES+=usr/include/c++/3.4/clocale OLD_FILES+=usr/include/c++/3.4/cmath OLD_FILES+=usr/include/c++/3.4/complex OLD_FILES+=usr/include/c++/3.4/csetjmp OLD_FILES+=usr/include/c++/3.4/csignal OLD_FILES+=usr/include/c++/3.4/cstdarg OLD_FILES+=usr/include/c++/3.4/cstddef OLD_FILES+=usr/include/c++/3.4/cstdio OLD_FILES+=usr/include/c++/3.4/cstdlib OLD_FILES+=usr/include/c++/3.4/cstring OLD_FILES+=usr/include/c++/3.4/ctime OLD_FILES+=usr/include/c++/3.4/cwchar OLD_FILES+=usr/include/c++/3.4/cwctype OLD_FILES+=usr/include/c++/3.4/cxxabi.h OLD_FILES+=usr/include/c++/3.4/debug/bitset OLD_FILES+=usr/include/c++/3.4/debug/debug.h OLD_FILES+=usr/include/c++/3.4/debug/deque OLD_FILES+=usr/include/c++/3.4/debug/formatter.h OLD_FILES+=usr/include/c++/3.4/debug/hash_map OLD_FILES+=usr/include/c++/3.4/debug/hash_map.h OLD_FILES+=usr/include/c++/3.4/debug/hash_multimap.h OLD_FILES+=usr/include/c++/3.4/debug/hash_multiset.h OLD_FILES+=usr/include/c++/3.4/debug/hash_set OLD_FILES+=usr/include/c++/3.4/debug/hash_set.h OLD_FILES+=usr/include/c++/3.4/debug/list OLD_FILES+=usr/include/c++/3.4/debug/map OLD_FILES+=usr/include/c++/3.4/debug/map.h OLD_FILES+=usr/include/c++/3.4/debug/multimap.h OLD_FILES+=usr/include/c++/3.4/debug/multiset.h OLD_FILES+=usr/include/c++/3.4/debug/safe_base.h OLD_FILES+=usr/include/c++/3.4/debug/safe_iterator.h OLD_FILES+=usr/include/c++/3.4/debug/safe_iterator.tcc OLD_FILES+=usr/include/c++/3.4/debug/safe_sequence.h OLD_FILES+=usr/include/c++/3.4/debug/set OLD_FILES+=usr/include/c++/3.4/debug/set.h OLD_FILES+=usr/include/c++/3.4/debug/string OLD_FILES+=usr/include/c++/3.4/debug/vector OLD_FILES+=usr/include/c++/3.4/deque OLD_FILES+=usr/include/c++/3.4/exception OLD_FILES+=usr/include/c++/3.4/exception_defines.h OLD_FILES+=usr/include/c++/3.4/ext/algorithm OLD_FILES+=usr/include/c++/3.4/ext/bitmap_allocator.h OLD_FILES+=usr/include/c++/3.4/ext/debug_allocator.h OLD_FILES+=usr/include/c++/3.4/ext/enc_filebuf.h OLD_FILES+=usr/include/c++/3.4/ext/functional OLD_FILES+=usr/include/c++/3.4/ext/hash_fun.h OLD_FILES+=usr/include/c++/3.4/ext/hash_map OLD_FILES+=usr/include/c++/3.4/ext/hash_set OLD_FILES+=usr/include/c++/3.4/ext/hashtable.h OLD_FILES+=usr/include/c++/3.4/ext/iterator OLD_FILES+=usr/include/c++/3.4/ext/malloc_allocator.h OLD_FILES+=usr/include/c++/3.4/ext/memory OLD_FILES+=usr/include/c++/3.4/ext/mt_allocator.h OLD_FILES+=usr/include/c++/3.4/ext/new_allocator.h OLD_FILES+=usr/include/c++/3.4/ext/numeric OLD_FILES+=usr/include/c++/3.4/ext/pod_char_traits.h OLD_FILES+=usr/include/c++/3.4/ext/pool_allocator.h OLD_FILES+=usr/include/c++/3.4/ext/rb_tree OLD_FILES+=usr/include/c++/3.4/ext/rope OLD_FILES+=usr/include/c++/3.4/ext/ropeimpl.h OLD_FILES+=usr/include/c++/3.4/ext/slist OLD_FILES+=usr/include/c++/3.4/ext/stdio_filebuf.h OLD_FILES+=usr/include/c++/3.4/ext/stdio_sync_filebuf.h OLD_FILES+=usr/include/c++/3.4/fstream OLD_FILES+=usr/include/c++/3.4/functional OLD_FILES+=usr/include/c++/3.4/iomanip OLD_FILES+=usr/include/c++/3.4/ios OLD_FILES+=usr/include/c++/3.4/iosfwd OLD_FILES+=usr/include/c++/3.4/iostream OLD_FILES+=usr/include/c++/3.4/istream OLD_FILES+=usr/include/c++/3.4/iterator OLD_FILES+=usr/include/c++/3.4/limits OLD_FILES+=usr/include/c++/3.4/list OLD_FILES+=usr/include/c++/3.4/locale OLD_FILES+=usr/include/c++/3.4/map OLD_FILES+=usr/include/c++/3.4/memory OLD_FILES+=usr/include/c++/3.4/new OLD_FILES+=usr/include/c++/3.4/numeric OLD_FILES+=usr/include/c++/3.4/ostream OLD_FILES+=usr/include/c++/3.4/queue OLD_FILES+=usr/include/c++/3.4/set OLD_FILES+=usr/include/c++/3.4/sstream OLD_FILES+=usr/include/c++/3.4/stack OLD_FILES+=usr/include/c++/3.4/stdexcept OLD_FILES+=usr/include/c++/3.4/streambuf OLD_FILES+=usr/include/c++/3.4/string OLD_FILES+=usr/include/c++/3.4/typeinfo OLD_FILES+=usr/include/c++/3.4/utility OLD_FILES+=usr/include/c++/3.4/valarray OLD_FILES+=usr/include/c++/3.4/vector OLD_DIRS+=usr/include/c++/3.4/backward OLD_DIRS+=usr/include/c++/3.4/bits OLD_DIRS+=usr/include/c++/3.4/debug OLD_DIRS+=usr/include/c++/3.4/ext OLD_DIRS+=usr/include/c++/3.4 # 20070510: zpool/zfs moved to /sbin OLD_FILES+=usr/sbin/zfs OLD_FILES+=usr/sbin/zpool # 20070423: rc.bluetooth (examples) removed OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth OLD_DIRS+=usr/share/examples/netgraph/bluetooth # 20070421: worm.4 removed OLD_FILES+=usr/share/man/man4/worm.4.gz # 20070417: trunk(4) renamed to lagg(4) OLD_FILES+=usr/include/net/if_trunk.h # 20070409: uuidgen moved to /bin/ OLD_FILES+=usr/bin/uuidgen # 20070328: bzip2 1.0.4 OLD_FILES+=usr/share/info/bzip2.info.gz # 20070303: libarchive 2.0 OLD_LIBS+=usr/lib/libarchive.so.3 OLD_LIBS+=usr/lib32/libarchive.so.3 # 20070301: remove addr2ascii and ascii2addr OLD_FILES+=usr/share/man/man3/addr2ascii.3.gz OLD_FILES+=usr/share/man/man3/ascii2addr.3.gz # 20070225: vm_page_unmanage() removed OLD_FILES+=usr/share/man/man9/vm_page_unmanage.9.gz # 20070216: VFS_VPTOFH(9) -> VOP_VPTOFH(9) OLD_FILES+=usr/share/man/man9/VFS_VPTOFH.9.gz # 20070212: kame.4 removed OLD_FILES+=usr/share/man/man4/kame.4.gz # 20070201: remove libmytinfo link OLD_FILES+=usr/lib/libmytinfo.a OLD_FILES+=usr/lib/libmytinfo.so OLD_FILES+=usr/lib/libmytinfo_p.a OLD_FILES+=usr/lib/libmytinfow.a OLD_FILES+=usr/lib/libmytinfow.so OLD_FILES+=usr/lib/libmytinfow_p.a OLD_FILES+=usr/lib32/libmytinfo.a OLD_FILES+=usr/lib32/libmytinfo.so OLD_FILES+=usr/lib32/libmytinfo_p.a OLD_FILES+=usr/lib32/libmytinfow.a OLD_FILES+=usr/lib32/libmytinfow.so OLD_FILES+=usr/lib32/libmytinfow_p.a # 20070128: remove vnconfig OLD_FILES+=usr/sbin/vnconfig # 20070127: remove bpf_compat.h OLD_FILES+=usr/include/net/bpf_compat.h # 20070125: objformat bites the dust OLD_FILES+=usr/bin/objformat OLD_FILES+=usr/share/man/man1/objformat.1.gz OLD_FILES+=usr/include/objformat.h OLD_FILES+=usr/share/man/man3/getobjformat.3.gz # 20061201: remove symlink to *.so.4 libalias modules OLD_FILES+=usr/lib/libalias_cuseeme.so OLD_FILES+=usr/lib/libalias_dummy.so OLD_FILES+=usr/lib/libalias_ftp.so OLD_FILES+=usr/lib/libalias_irc.so OLD_FILES+=usr/lib/libalias_nbt.so OLD_FILES+=usr/lib/libalias_pptp.so OLD_FILES+=usr/lib/libalias_skinny.so OLD_FILES+=usr/lib/libalias_smedia.so # 20061201: remove old *.so.4 libalias modules OLD_FILES+=lib/libalias_cuseeme.so.4 OLD_FILES+=lib/libalias_dummy.so.4 OLD_FILES+=lib/libalias_ftp.so.4 OLD_FILES+=lib/libalias_irc.so.4 OLD_FILES+=lib/libalias_nbt.so.4 OLD_FILES+=lib/libalias_pptp.so.4 OLD_FILES+=lib/libalias_skinny.so.4 OLD_FILES+=lib/libalias_smedia.so.4 # 20061126: remove old man page OLD_FILES+=usr/share/man/man3/archive_read_set_bytes_per_block.3.gz # 20061125: remove old man page OLD_FILES+=usr/share/man/man9/devsw.9.gz # 20061122: remove obsolete mount programs OLD_FILES+=sbin/mount_devfs OLD_FILES+=sbin/mount_ext2fs OLD_FILES+=sbin/mount_fdescfs OLD_FILES+=sbin/mount_linprocfs OLD_FILES+=sbin/mount_procfs OLD_FILES+=sbin/mount_std OLD_FILES+=rescue/mount_devfs OLD_FILES+=rescue/mount_ext2fs OLD_FILES+=rescue/mount_fdescfs OLD_FILES+=rescue/mount_linprocfs OLD_FILES+=rescue/mount_procfs OLD_FILES+=rescue/mount_std OLD_FILES+=usr/share/man/man8/mount_devfs.8.gz OLD_FILES+=usr/share/man/man8/mount_ext2fs.8.gz OLD_FILES+=usr/share/man/man8/mount_fdescfs.8.gz OLD_FILES+=usr/share/man/man8/mount_linprocfs.8.gz OLD_FILES+=usr/share/man/man8/mount_procfs.8.gz OLD_FILES+=usr/share/man/man8/mount_std.8.gz # 20061116: uhidev.4 removed OLD_FILES+=usr/share/man/man4/uhidev.4.gz # 20061106: archive_write_prepare.3 removed OLD_FILES+=usr/share/man/man3/archive_write_prepare.3.gz # 20061018: pccardc removed OLD_FILES+=usr/sbin/pccardc usr/share/man/man8/pccardc.8.gz # 20060930: demangle.h from contrib/libstdc++/include/ext/ OLD_FILES+=usr/include/c++/3.4/ext/demangle.h # 20060929: mrouted removed OLD_FILES+=usr/sbin/map-mbone OLD_FILES+=usr/sbin/mrinfo OLD_FILES+=usr/sbin/mrouted OLD_FILES+=usr/sbin/mtrace OLD_FILES+=usr/share/man/man8/map-mbone.8.gz OLD_FILES+=usr/share/man/man8/mrinfo.8.gz OLD_FILES+=usr/share/man/man8/mrouted.8.gz OLD_FILES+=usr/share/man/man8/mtrace.8.gz # 20060924: tcpslice removed OLD_FILES+=usr/sbin/tcpslice OLD_FILES+=usr/share/man/man1/tcpslice.1.gz # 20060829: kvmdb cleanup script removed OLD_FILES+=etc/periodic/weekly/120.clean-kvmdb # 20060822: ramdisk{,-own} have been replaced by mdconfig{,2} OLD_FILES+=etc/rc.d/ramdisk OLD_FILES+=etc/rc.d/ramdisk-own # 20060729: OpenSSL 0.9.7e -> 0.9.8b upgrade OLD_FILES+=usr/include/openssl/eng_int.h OLD_FILES+=usr/include/openssl/hw_4758_cca_err.h OLD_FILES+=usr/include/openssl/hw_aep_err.h OLD_FILES+=usr/include/openssl/hw_atalla_err.h OLD_FILES+=usr/include/openssl/hw_cswift_err.h OLD_FILES+=usr/include/openssl/hw_ncipher_err.h OLD_FILES+=usr/include/openssl/hw_nuron_err.h OLD_FILES+=usr/include/openssl/hw_sureware_err.h OLD_FILES+=usr/include/openssl/hw_ubsec_err.h # 20060713: mount_linsysfs(8) never existed in 7.x OLD_FILES+=sbin/mount_linsysfs OLD_FILES+=usr/share/man/man8/mount_linsysfs.8.gz # 20060704: KAME compat file net_osdep.h removed OLD_FILES+=usr/include/net/net_osdep.h # 20060605: man page links removed by OpenBSM 1.0 alpha 6 import OLD_FILES+=usr/share/man/man3/au_to_socket.3.gz OLD_FILES+=usr/share/man/man3/au_to_socket_ex_128.3.gz OLD_FILES+=usr/share/man/man3/au_to_socket_ex_32.3.gz # 20060517: pcvt removed OLD_FILES+=usr/share/pcvt/README.FIRST OLD_FILES+=usr/share/pcvt/Etc/xmodmap-german OLD_FILES+=usr/share/pcvt/Etc/pcvt.sh OLD_FILES+=usr/share/pcvt/Etc/pcvt.el OLD_FILES+=usr/share/pcvt/Etc/Terminfo OLD_FILES+=usr/share/pcvt/Etc/Termcap OLD_DIRS+=usr/share/pcvt/Etc OLD_FILES+=usr/share/pcvt/Doc/NotesAndHints OLD_FILES+=usr/share/pcvt/Doc/Keyboard.VT OLD_FILES+=usr/share/pcvt/Doc/Keyboard.HP OLD_FILES+=usr/share/pcvt/Doc/EscapeSequences OLD_FILES+=usr/share/pcvt/Doc/Charsets OLD_FILES+=usr/share/pcvt/Doc/CharGen OLD_FILES+=usr/share/pcvt/Doc/Bibliography OLD_FILES+=usr/share/pcvt/Doc/Acknowledgements OLD_DIRS+=usr/share/pcvt/Doc OLD_DIRS+=usr/share/pcvt OLD_FILES+=usr/share/misc/pcvtfonts/vt220l.816 OLD_FILES+=usr/share/misc/pcvtfonts/vt220l.814 OLD_FILES+=usr/share/misc/pcvtfonts/vt220l.810 OLD_FILES+=usr/share/misc/pcvtfonts/vt220l.808 OLD_FILES+=usr/share/misc/pcvtfonts/vt220h.816 OLD_FILES+=usr/share/misc/pcvtfonts/vt220h.814 OLD_FILES+=usr/share/misc/pcvtfonts/vt220h.810 OLD_FILES+=usr/share/misc/pcvtfonts/vt220h.808 OLD_DIRS+=usr/share/misc/pcvtfonts OLD_FILES+=usr/share/misc/keycap.pcvt OLD_FILES+=usr/share/man/man8/ispcvt.8.gz OLD_FILES+=usr/share/man/man5/keycap.5.gz OLD_FILES+=usr/share/man/man4/pcvt.4.gz OLD_FILES+=usr/share/man/man3/kgetstr.3.gz OLD_FILES+=usr/share/man/man3/kgetnum.3.gz OLD_FILES+=usr/share/man/man3/kgetflag.3.gz OLD_FILES+=usr/share/man/man3/kgetent.3.gz OLD_FILES+=usr/share/man/man3/keycap.3.gz OLD_FILES+=usr/share/man/man1/vt220keys.1.gz OLD_FILES+=usr/share/man/man1/scon.1.gz OLD_FILES+=usr/share/man/man1/loadfont.1.gz OLD_FILES+=usr/share/man/man1/kcon.1.gz OLD_FILES+=usr/share/man/man1/fontedit.1.gz OLD_FILES+=usr/share/man/man1/cursor.1.gz OLD_FILES+=usr/sbin/vt220keys OLD_FILES+=usr/sbin/scon OLD_FILES+=usr/sbin/loadfont OLD_FILES+=usr/sbin/kcon OLD_FILES+=usr/sbin/ispcvt OLD_FILES+=usr/sbin/fontedit OLD_FILES+=usr/sbin/cursor OLD_FILES+=usr/lib/libkeycap_p.a OLD_FILES+=usr/lib/libkeycap.a OLD_FILES+=usr/include/machine/pcvt_ioctl.h # 20060514: lnc(4) replaced by le(4) OLD_FILES+=usr/share/man/man4/i386/lnc.4.gz # 20060512: remove ip6fw OLD_FILES+=etc/periodic/security/600.ip6fwdenied OLD_FILES+=etc/periodic/security/650.ip6fwlimit OLD_FILES+=sbin/ip6fw OLD_FILES+=usr/include/netinet6/ip6_fw.h OLD_FILES+=usr/share/man/man8/ip6fw.8.gz # 20060424: sab(4) removed OLD_FILES+=usr/share/man/man4/sab.4.gz # 20060328: remove redundant rc.d script OLD_FILES+=etc/rc.d/ike # 20060127: revert libdisk to static-only OLD_FILES+=usr/lib/libdisk.so # 20060115: sys/pccard includes cleanup OLD_FILES+=usr/include/pccard/driver.h OLD_FILES+=usr/include/pccard/i82365.h OLD_FILES+=usr/include/pccard/meciareg.h OLD_FILES+=usr/include/pccard/pccard_nbk.h OLD_FILES+=usr/include/pccard/pcic_pci.h OLD_FILES+=usr/include/pccard/pcicvar.h OLD_FILES+=usr/include/pccard/slot.h # 20051215: rescue/nextboot.sh renamed to rescue/nextboot OLD_FILES+=rescue/nextboot.sh # 20051214: usbd(8) removed OLD_FILES+=etc/rc.d/usbd OLD_FILES+=etc/usbd.conf OLD_FILES+=usr/sbin/usbd OLD_FILES+=usr/share/man/man8/usbd.8.gz # 20051029: rc.d/ppp-user renamed to rc.d/ppp for convenience OLD_FILES+=etc/rc.d/ppp-user # 20051012: setkey(8) moved to /sbin/ OLD_FILES+=usr/sbin/setkey # 20050930: pccardd(8) removed OLD_FILES+=usr/sbin/pccardd OLD_FILES+=usr/share/man/man5/pccard.conf.5.gz OLD_FILES+=usr/share/man/man8/pccardd.8.gz # 20050927: bridge(4) replaced by if_bridge(4) OLD_FILES+=usr/include/net/bridge.h # 20050831: not implemented OLD_FILES+=usr/share/man/man3/getino.3.gz OLD_FILES+=usr/share/man/man3/putino.3.gz # 20050825: T/TCP retired several months ago OLD_FILES+=usr/share/man/man4/ttcp.4.gz # 20050805 tn3270 retired long ago OLD_FILES+=usr/share/misc/map3270 # 20050801: too old to be interesting here OLD_FILES+=usr/share/doc/papers/px.ps.gz # 20050721: moved to ports OLD_FILES+=usr/sbin/vttest OLD_FILES+=usr/share/man/man1/vttest.1.gz # 20050617: wpa man pages moved to section 8 OLD_FILES+=usr/share/man/man1/hostapd.1.gz OLD_FILES+=usr/share/man/man1/hostapd_cli.1.gz OLD_FILES+=usr/share/man/man1/wpa_cli.1.gz OLD_FILES+=usr/share/man/man1/wpa_supplicant.1.gz # 20050610: rexecd (insecure by design) OLD_FILES+=etc/pam.d/rexecd OLD_FILES+=usr/share/man/man8/rexecd.8.gz OLD_FILES+=usr/libexec/rexecd # 20050606: OpenBSD dhclient replaces ISC one OLD_FILES+=bin/omshell OLD_FILES+=sbin/omshell OLD_FILES+=usr/share/man/man1/omshell.1.gz OLD_FILES+=usr/share/man/man5/dhcp-eval.5.gz # 200504XX: ipf tools moved from /usr to / OLD_FILES+=rescue/ipfs OLD_FILES+=rescue/ipfstat OLD_FILES+=rescue/ipmon OLD_FILES+=rescue/ipnat OLD_FILES+=usr/sbin/ipftest OLD_FILES+=usr/sbin/ipresend OLD_FILES+=usr/sbin/ipsend OLD_FILES+=usr/sbin/iptest OLD_FILES+=usr/share/man/man1/ipnat.1.gz OLD_FILES+=usr/share/man/man1/ipsend.1.gz OLD_FILES+=usr/share/man/man1/iptest.1.gz OLD_FILES+=usr/share/man/man5/ipsend.5.gz # 200503XX: bsdtar takes over gtar OLD_FILES+=usr/bin/gtar OLD_FILES+=usr/share/man/man1/gtar.1.gz # 200503XX OLD_FILES+=usr/share/man/man3/exp10.3.gz OLD_FILES+=usr/share/man/man3/exp10f.3.gz OLD_FILES+=usr/share/man/man3/fpsetsticky.3.gz # 20050324: updated release infrastructure OLD_FILES+=usr/share/man/man5/drivers.conf.5.gz # 20050317: removed from BIND 9 distribution OLD_FILES+=usr/share/doc/bind9/KNOWN_DEFECTS # 2005XXXX: OLD_FILES+=sbin/mount_autofs OLD_FILES+=usr/lib/libautofs.a OLD_FILES+=usr/lib/libautofs.so OLD_FILES+=usr/share/man/man8/mount_autofs.8.gz # 20050203: Merged with fortunes OLD_FILES+=usr/share/games/fortune/fortunes2 OLD_FILES+=usr/share/games/fortune/fortunes2.dat # 200501XX: OLD_FILES+=usr/libexec/getNAME # 200411XX: gvinum replaces vinum OLD_FILES+=bin/vinum OLD_FILES+=rescue/vinum OLD_FILES+=sbin/vinum OLD_FILES+=usr/share/man/man8/vinum.8.gz # 200411XX: libxpg4 removal OLD_FILES+=usr/lib/libxpg4.a OLD_FILES+=usr/lib/libxpg4.so OLD_FILES+=usr/lib/libxpg4_p.a # 20041109: replaced by em(4) OLD_FILES+=usr/share/man/man4/gx.4.gz OLD_FILES+=usr/share/man/man4/if_gx.4.gz # 20041017: rune interface removed OLD_FILES+=usr/include/rune.h OLD_FILES+=usr/share/man/man3/fgetrune.3.gz OLD_FILES+=usr/share/man/man3/fputrune.3.gz OLD_FILES+=usr/share/man/man3/fungetrune.3.gz OLD_FILES+=usr/share/man/man3/mbrrune.3.gz OLD_FILES+=usr/share/man/man3/mbrune.3.gz OLD_FILES+=usr/share/man/man3/rune.3.gz OLD_FILES+=usr/share/man/man3/setinvalidrune.3.gz OLD_FILES+=usr/share/man/man3/sgetrune.3.gz OLD_FILES+=usr/share/man/man3/sputrune.3.gz # 20040925: bind9 import OLD_FILES+=usr/bin/dnskeygen OLD_FILES+=usr/bin/dnsquery OLD_FILES+=usr/lib/libisc.a OLD_FILES+=usr/lib/libisc.so OLD_FILES+=usr/lib/libisc_p.a OLD_FILES+=usr/libexec/named-xfer OLD_FILES+=usr/sbin/named.restart OLD_FILES+=usr/sbin/ndc OLD_FILES+=usr/sbin/nslookup OLD_FILES+=usr/sbin/nsupdate OLD_FILES+=usr/share/doc/bind/html/acl.html OLD_FILES+=usr/share/doc/bind/html/address_list.html OLD_FILES+=usr/share/doc/bind/html/comments.html OLD_FILES+=usr/share/doc/bind/html/config.html OLD_FILES+=usr/share/doc/bind/html/controls.html OLD_FILES+=usr/share/doc/bind/html/docdef.html OLD_FILES+=usr/share/doc/bind/html/example.html OLD_FILES+=usr/share/doc/bind/html/include.html OLD_FILES+=usr/share/doc/bind/html/index.html OLD_FILES+=usr/share/doc/bind/html/key.html OLD_FILES+=usr/share/doc/bind/html/logging.html OLD_FILES+=usr/share/doc/bind/html/master.html OLD_FILES+=usr/share/doc/bind/html/options.html OLD_FILES+=usr/share/doc/bind/html/server.html OLD_FILES+=usr/share/doc/bind/html/trusted-keys.html OLD_FILES+=usr/share/doc/bind/html/zone.html OLD_FILES+=usr/share/doc/bind/misc/DynamicUpdate OLD_FILES+=usr/share/doc/bind/misc/FAQ.1of2 OLD_FILES+=usr/share/doc/bind/misc/FAQ.2of2 OLD_FILES+=usr/share/doc/bind/misc/rfc2317-notes.txt OLD_FILES+=usr/share/doc/bind/misc/style.txt OLD_FILES+=usr/share/man/man1/dnskeygen.1.gz OLD_FILES+=usr/share/man/man1/dnsquery.1.gz OLD_FILES+=usr/share/man/man8/named-bootconf.8.gz OLD_FILES+=usr/share/man/man8/named-xfer.8.gz OLD_FILES+=usr/share/man/man8/named.restart.8.gz OLD_FILES+=usr/share/man/man8/ndc.8.gz OLD_FILES+=usr/share/man/man8/nslookup.8.gz # 200409XX OLD_FILES+=usr/share/man/man3/ENSURE.3.gz OLD_FILES+=usr/share/man/man3/ENSURE_ERR.3.gz OLD_FILES+=usr/share/man/man3/INSIST.3.gz OLD_FILES+=usr/share/man/man3/INSIST_ERR.3.gz OLD_FILES+=usr/share/man/man3/INVARIANT.3.gz OLD_FILES+=usr/share/man/man3/INVARIANT_ERR.3.gz OLD_FILES+=usr/share/man/man3/REQUIRE.3.gz OLD_FILES+=usr/share/man/man3/REQUIRE_ERR.3.gz OLD_FILES+=usr/share/man/man3/assertion_type_to_text.3.gz OLD_FILES+=usr/share/man/man3/assertions.3.gz OLD_FILES+=usr/share/man/man3/bitncmp.3.gz OLD_FILES+=usr/share/man/man3/evAddTime.3.gz OLD_FILES+=usr/share/man/man3/evCancelConn.3.gz OLD_FILES+=usr/share/man/man3/evCancelRW.3.gz OLD_FILES+=usr/share/man/man3/evClearIdleTimer.3.gz OLD_FILES+=usr/share/man/man3/evClearTimer.3.gz OLD_FILES+=usr/share/man/man3/evCmpTime.3.gz OLD_FILES+=usr/share/man/man3/evConnFunc.3.gz OLD_FILES+=usr/share/man/man3/evConnect.3.gz OLD_FILES+=usr/share/man/man3/evConsIovec.3.gz OLD_FILES+=usr/share/man/man3/evConsTime.3.gz OLD_FILES+=usr/share/man/man3/evCreate.3.gz OLD_FILES+=usr/share/man/man3/evDefer.3.gz OLD_FILES+=usr/share/man/man3/evDeselectFD.3.gz OLD_FILES+=usr/share/man/man3/evDestroy.3.gz OLD_FILES+=usr/share/man/man3/evDispatch.3.gz OLD_FILES+=usr/share/man/man3/evDo.3.gz OLD_FILES+=usr/share/man/man3/evDrop.3.gz OLD_FILES+=usr/share/man/man3/evFileFunc.3.gz OLD_FILES+=usr/share/man/man3/evGetNext.3.gz OLD_FILES+=usr/share/man/man3/evHold.3.gz OLD_FILES+=usr/share/man/man3/evInitID.3.gz OLD_FILES+=usr/share/man/man3/evLastEventTime.3.gz OLD_FILES+=usr/share/man/man3/evListen.3.gz OLD_FILES+=usr/share/man/man3/evMainLoop.3.gz OLD_FILES+=usr/share/man/man3/evNowTime.3.gz OLD_FILES+=usr/share/man/man3/evPrintf.3.gz OLD_FILES+=usr/share/man/man3/evRead.3.gz OLD_FILES+=usr/share/man/man3/evResetTimer.3.gz OLD_FILES+=usr/share/man/man3/evSelectFD.3.gz OLD_FILES+=usr/share/man/man3/evSetDebug.3.gz OLD_FILES+=usr/share/man/man3/evSetIdleTimer.3.gz OLD_FILES+=usr/share/man/man3/evSetTimer.3.gz OLD_FILES+=usr/share/man/man3/evStreamFunc.3.gz OLD_FILES+=usr/share/man/man3/evSubTime.3.gz OLD_FILES+=usr/share/man/man3/evTestID.3.gz OLD_FILES+=usr/share/man/man3/evTimeRW.3.gz OLD_FILES+=usr/share/man/man3/evTimeSpec.3.gz OLD_FILES+=usr/share/man/man3/evTimeVal.3.gz OLD_FILES+=usr/share/man/man3/evTimerFunc.3.gz OLD_FILES+=usr/share/man/man3/evTouchIdleTimer.3.gz OLD_FILES+=usr/share/man/man3/evTryAccept.3.gz OLD_FILES+=usr/share/man/man3/evUnhold.3.gz OLD_FILES+=usr/share/man/man3/evUntimeRW.3.gz OLD_FILES+=usr/share/man/man3/evUnwait.3.gz OLD_FILES+=usr/share/man/man3/evWaitFor.3.gz OLD_FILES+=usr/share/man/man3/evWaitFunc.3.gz OLD_FILES+=usr/share/man/man3/evWrite.3.gz OLD_FILES+=usr/share/man/man3/eventlib.3.gz OLD_FILES+=usr/share/man/man3/heap.3.gz OLD_FILES+=usr/share/man/man3/heap_decreased.3.gz OLD_FILES+=usr/share/man/man3/heap_delete.3.gz OLD_FILES+=usr/share/man/man3/heap_element.3.gz OLD_FILES+=usr/share/man/man3/heap_for_each.3.gz OLD_FILES+=usr/share/man/man3/heap_free.3.gz OLD_FILES+=usr/share/man/man3/heap_increased.3.gz OLD_FILES+=usr/share/man/man3/heap_insert.3.gz OLD_FILES+=usr/share/man/man3/heap_new.3.gz OLD_FILES+=usr/share/man/man3/log_add_channel.3.gz OLD_FILES+=usr/share/man/man3/log_category_is_active.3.gz OLD_FILES+=usr/share/man/man3/log_close_stream.3.gz OLD_FILES+=usr/share/man/man3/log_dec_references.3.gz OLD_FILES+=usr/share/man/man3/log_free_channel.3.gz OLD_FILES+=usr/share/man/man3/log_free_context.3.gz OLD_FILES+=usr/share/man/man3/log_get_filename.3.gz OLD_FILES+=usr/share/man/man3/log_get_stream.3.gz OLD_FILES+=usr/share/man/man3/log_inc_references.3.gz OLD_FILES+=usr/share/man/man3/log_new_context.3.gz OLD_FILES+=usr/share/man/man3/log_new_file_channel.3.gz OLD_FILES+=usr/share/man/man3/log_new_null_channel.3.gz OLD_FILES+=usr/share/man/man3/log_new_syslog_channel.3.gz OLD_FILES+=usr/share/man/man3/log_open_stream.3.gz OLD_FILES+=usr/share/man/man3/log_option.3.gz OLD_FILES+=usr/share/man/man3/log_remove_channel.3.gz OLD_FILES+=usr/share/man/man3/log_set_file_owner.3.gz OLD_FILES+=usr/share/man/man3/log_vwrite.3.gz OLD_FILES+=usr/share/man/man3/log_write.3.gz OLD_FILES+=usr/share/man/man3/logging.3.gz OLD_FILES+=usr/share/man/man3/memcluster.3.gz OLD_FILES+=usr/share/man/man3/memget.3.gz OLD_FILES+=usr/share/man/man3/memput.3.gz OLD_FILES+=usr/share/man/man3/memstats.3.gz OLD_FILES+=usr/share/man/man3/set_assertion_failure_callback.3. OLD_FILES+=usr/share/man/man3/sigwait.3.gz OLD_FILES+=usr/share/man/man3/tree_add.3.gz OLD_FILES+=usr/share/man/man3/tree_delete.3.gz OLD_FILES+=usr/share/man/man3/tree_init.3.gz OLD_FILES+=usr/share/man/man3/tree_mung.3.gz OLD_FILES+=usr/share/man/man3/tree_srch.3.gz OLD_FILES+=usr/share/man/man3/tree_trav.3.gz # 2004XXYY: OS internal libs, no ports use them, no need to use OLD_LIBS OLD_FILES+=lib/geom/geom_concat.so.1 OLD_FILES+=lib/geom/geom_label.so.1 OLD_FILES+=lib/geom/geom_nop.so.1 OLD_FILES+=lib/geom/geom_stripe.so.1 # 20040728: GCC 3.4.2 OLD_DIRS+=usr/include/c++/3.3 OLD_FILES+=usr/include/c++/3.3/FlexLexer.h OLD_FILES+=usr/include/c++/3.3/algorithm OLD_FILES+=usr/include/c++/3.3/backward/algo.h OLD_FILES+=usr/include/c++/3.3/backward/algobase.h OLD_FILES+=usr/include/c++/3.3/backward/alloc.h OLD_FILES+=usr/include/c++/3.3/backward/backward_warning.h OLD_FILES+=usr/include/c++/3.3/backward/bvector.h OLD_FILES+=usr/include/c++/3.3/backward/complex.h OLD_FILES+=usr/include/c++/3.3/backward/defalloc.h OLD_FILES+=usr/include/c++/3.3/backward/deque.h OLD_FILES+=usr/include/c++/3.3/backward/fstream.h OLD_FILES+=usr/include/c++/3.3/backward/function.h OLD_FILES+=usr/include/c++/3.3/backward/hash_map.h OLD_FILES+=usr/include/c++/3.3/backward/hash_set.h OLD_FILES+=usr/include/c++/3.3/backward/hashtable.h OLD_FILES+=usr/include/c++/3.3/backward/heap.h OLD_FILES+=usr/include/c++/3.3/backward/iomanip.h OLD_FILES+=usr/include/c++/3.3/backward/iostream.h OLD_FILES+=usr/include/c++/3.3/backward/istream.h OLD_FILES+=usr/include/c++/3.3/backward/iterator.h OLD_FILES+=usr/include/c++/3.3/backward/list.h OLD_FILES+=usr/include/c++/3.3/backward/map.h OLD_FILES+=usr/include/c++/3.3/backward/multimap.h OLD_FILES+=usr/include/c++/3.3/backward/multiset.h OLD_FILES+=usr/include/c++/3.3/backward/new.h OLD_FILES+=usr/include/c++/3.3/backward/ostream.h OLD_FILES+=usr/include/c++/3.3/backward/pair.h OLD_FILES+=usr/include/c++/3.3/backward/queue.h OLD_FILES+=usr/include/c++/3.3/backward/rope.h OLD_FILES+=usr/include/c++/3.3/backward/set.h OLD_FILES+=usr/include/c++/3.3/backward/slist.h OLD_FILES+=usr/include/c++/3.3/backward/stack.h OLD_FILES+=usr/include/c++/3.3/backward/stream.h OLD_FILES+=usr/include/c++/3.3/backward/streambuf.h OLD_FILES+=usr/include/c++/3.3/backward/strstream OLD_FILES+=usr/include/c++/3.3/backward/strstream.h OLD_FILES+=usr/include/c++/3.3/backward/tempbuf.h OLD_FILES+=usr/include/c++/3.3/backward/tree.h OLD_FILES+=usr/include/c++/3.3/backward/vector.h OLD_DIRS+=usr/include/c++/3.3/backward OLD_FILES+=usr/include/c++/3.3/bits/atomicity.h OLD_FILES+=usr/include/c++/3.3/bits/basic_file.h OLD_FILES+=usr/include/c++/3.3/bits/basic_ios.h OLD_FILES+=usr/include/c++/3.3/bits/basic_ios.tcc OLD_FILES+=usr/include/c++/3.3/bits/basic_string.h OLD_FILES+=usr/include/c++/3.3/bits/basic_string.tcc OLD_FILES+=usr/include/c++/3.3/bits/boost_concept_check.h OLD_FILES+=usr/include/c++/3.3/bits/c++config.h OLD_FILES+=usr/include/c++/3.3/bits/c++io.h OLD_FILES+=usr/include/c++/3.3/bits/c++locale.h OLD_FILES+=usr/include/c++/3.3/bits/c++locale_internal.h OLD_FILES+=usr/include/c++/3.3/bits/char_traits.h OLD_FILES+=usr/include/c++/3.3/bits/cmath.tcc OLD_FILES+=usr/include/c++/3.3/bits/codecvt.h OLD_FILES+=usr/include/c++/3.3/bits/codecvt_specializations.h OLD_FILES+=usr/include/c++/3.3/bits/concept_check.h OLD_FILES+=usr/include/c++/3.3/bits/cpp_type_traits.h OLD_FILES+=usr/include/c++/3.3/bits/ctype_base.h OLD_FILES+=usr/include/c++/3.3/bits/ctype_inline.h OLD_FILES+=usr/include/c++/3.3/bits/ctype_noninline.h OLD_FILES+=usr/include/c++/3.3/bits/deque.tcc OLD_FILES+=usr/include/c++/3.3/bits/fpos.h OLD_FILES+=usr/include/c++/3.3/bits/fstream.tcc OLD_FILES+=usr/include/c++/3.3/bits/functexcept.h OLD_FILES+=usr/include/c++/3.3/bits/generic_shadow.h OLD_FILES+=usr/include/c++/3.3/bits/gslice.h OLD_FILES+=usr/include/c++/3.3/bits/gslice_array.h OLD_FILES+=usr/include/c++/3.3/bits/gthr-default.h OLD_FILES+=usr/include/c++/3.3/bits/gthr-posix.h OLD_FILES+=usr/include/c++/3.3/bits/gthr-single.h OLD_FILES+=usr/include/c++/3.3/bits/gthr.h OLD_FILES+=usr/include/c++/3.3/bits/indirect_array.h OLD_FILES+=usr/include/c++/3.3/bits/ios_base.h OLD_FILES+=usr/include/c++/3.3/bits/istream.tcc OLD_FILES+=usr/include/c++/3.3/bits/list.tcc OLD_FILES+=usr/include/c++/3.3/bits/locale_classes.h OLD_FILES+=usr/include/c++/3.3/bits/locale_facets.h OLD_FILES+=usr/include/c++/3.3/bits/locale_facets.tcc OLD_FILES+=usr/include/c++/3.3/bits/localefwd.h OLD_FILES+=usr/include/c++/3.3/bits/mask_array.h OLD_FILES+=usr/include/c++/3.3/bits/messages_members.h OLD_FILES+=usr/include/c++/3.3/bits/os_defines.h OLD_FILES+=usr/include/c++/3.3/bits/ostream.tcc OLD_FILES+=usr/include/c++/3.3/bits/pthread_allocimpl.h OLD_FILES+=usr/include/c++/3.3/bits/slice.h OLD_FILES+=usr/include/c++/3.3/bits/slice_array.h OLD_FILES+=usr/include/c++/3.3/bits/sstream.tcc OLD_FILES+=usr/include/c++/3.3/bits/stl_algo.h OLD_FILES+=usr/include/c++/3.3/bits/stl_algobase.h OLD_FILES+=usr/include/c++/3.3/bits/stl_alloc.h OLD_FILES+=usr/include/c++/3.3/bits/stl_bvector.h OLD_FILES+=usr/include/c++/3.3/bits/stl_construct.h OLD_FILES+=usr/include/c++/3.3/bits/stl_deque.h OLD_FILES+=usr/include/c++/3.3/bits/stl_function.h OLD_FILES+=usr/include/c++/3.3/bits/stl_heap.h OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator.h OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator_base_funcs.h OLD_FILES+=usr/include/c++/3.3/bits/stl_iterator_base_types.h OLD_FILES+=usr/include/c++/3.3/bits/stl_list.h OLD_FILES+=usr/include/c++/3.3/bits/stl_map.h OLD_FILES+=usr/include/c++/3.3/bits/stl_multimap.h OLD_FILES+=usr/include/c++/3.3/bits/stl_multiset.h OLD_FILES+=usr/include/c++/3.3/bits/stl_numeric.h OLD_FILES+=usr/include/c++/3.3/bits/stl_pair.h OLD_FILES+=usr/include/c++/3.3/bits/stl_pthread_alloc.h OLD_FILES+=usr/include/c++/3.3/bits/stl_queue.h OLD_FILES+=usr/include/c++/3.3/bits/stl_raw_storage_iter.h OLD_FILES+=usr/include/c++/3.3/bits/stl_relops.h OLD_FILES+=usr/include/c++/3.3/bits/stl_set.h OLD_FILES+=usr/include/c++/3.3/bits/stl_stack.h OLD_FILES+=usr/include/c++/3.3/bits/stl_tempbuf.h OLD_FILES+=usr/include/c++/3.3/bits/stl_threads.h OLD_FILES+=usr/include/c++/3.3/bits/stl_tree.h OLD_FILES+=usr/include/c++/3.3/bits/stl_uninitialized.h OLD_FILES+=usr/include/c++/3.3/bits/stl_vector.h OLD_FILES+=usr/include/c++/3.3/bits/stream_iterator.h OLD_FILES+=usr/include/c++/3.3/bits/streambuf.tcc OLD_FILES+=usr/include/c++/3.3/bits/streambuf_iterator.h OLD_FILES+=usr/include/c++/3.3/bits/stringfwd.h OLD_FILES+=usr/include/c++/3.3/bits/time_members.h OLD_FILES+=usr/include/c++/3.3/bits/type_traits.h OLD_FILES+=usr/include/c++/3.3/bits/valarray_array.h OLD_FILES+=usr/include/c++/3.3/bits/valarray_array.tcc OLD_FILES+=usr/include/c++/3.3/bits/valarray_meta.h OLD_FILES+=usr/include/c++/3.3/bits/vector.tcc OLD_DIRS+=usr/include/c++/3.3/bits OLD_FILES+=usr/include/c++/3.3/bitset OLD_FILES+=usr/include/c++/3.3/cassert OLD_FILES+=usr/include/c++/3.3/cctype OLD_FILES+=usr/include/c++/3.3/cerrno OLD_FILES+=usr/include/c++/3.3/cfloat OLD_FILES+=usr/include/c++/3.3/ciso646 OLD_FILES+=usr/include/c++/3.3/climits OLD_FILES+=usr/include/c++/3.3/clocale OLD_FILES+=usr/include/c++/3.3/cmath OLD_FILES+=usr/include/c++/3.3/complex OLD_FILES+=usr/include/c++/3.3/csetjmp OLD_FILES+=usr/include/c++/3.3/csignal OLD_FILES+=usr/include/c++/3.3/cstdarg OLD_FILES+=usr/include/c++/3.3/cstddef OLD_FILES+=usr/include/c++/3.3/cstdio OLD_FILES+=usr/include/c++/3.3/cstdlib OLD_FILES+=usr/include/c++/3.3/cstring OLD_FILES+=usr/include/c++/3.3/ctime OLD_FILES+=usr/include/c++/3.3/cwchar OLD_FILES+=usr/include/c++/3.3/cwctype OLD_FILES+=usr/include/c++/3.3/cxxabi.h OLD_FILES+=usr/include/c++/3.3/deque OLD_FILES+=usr/include/c++/3.3/exception OLD_FILES+=usr/include/c++/3.3/exception_defines.h OLD_FILES+=usr/include/c++/3.3/ext/algorithm OLD_FILES+=usr/include/c++/3.3/ext/enc_filebuf.h OLD_FILES+=usr/include/c++/3.3/ext/functional OLD_FILES+=usr/include/c++/3.3/ext/hash_map OLD_FILES+=usr/include/c++/3.3/ext/hash_set OLD_FILES+=usr/include/c++/3.3/ext/iterator OLD_FILES+=usr/include/c++/3.3/ext/memory OLD_FILES+=usr/include/c++/3.3/ext/numeric OLD_FILES+=usr/include/c++/3.3/ext/rb_tree OLD_FILES+=usr/include/c++/3.3/ext/rope OLD_FILES+=usr/include/c++/3.3/ext/ropeimpl.h OLD_FILES+=usr/include/c++/3.3/ext/slist OLD_FILES+=usr/include/c++/3.3/ext/stdio_filebuf.h OLD_FILES+=usr/include/c++/3.3/ext/stl_hash_fun.h OLD_FILES+=usr/include/c++/3.3/ext/stl_hashtable.h OLD_FILES+=usr/include/c++/3.3/ext/stl_rope.h OLD_DIRS+=usr/include/c++/3.3/ext OLD_FILES+=usr/include/c++/3.3/fstream OLD_FILES+=usr/include/c++/3.3/functional OLD_FILES+=usr/include/c++/3.3/iomanip OLD_FILES+=usr/include/c++/3.3/ios OLD_FILES+=usr/include/c++/3.3/iosfwd OLD_FILES+=usr/include/c++/3.3/iostream OLD_FILES+=usr/include/c++/3.3/istream OLD_FILES+=usr/include/c++/3.3/iterator OLD_FILES+=usr/include/c++/3.3/limits OLD_FILES+=usr/include/c++/3.3/list OLD_FILES+=usr/include/c++/3.3/locale OLD_FILES+=usr/include/c++/3.3/map OLD_FILES+=usr/include/c++/3.3/memory OLD_FILES+=usr/include/c++/3.3/new OLD_FILES+=usr/include/c++/3.3/numeric OLD_FILES+=usr/include/c++/3.3/ostream OLD_FILES+=usr/include/c++/3.3/queue OLD_FILES+=usr/include/c++/3.3/set OLD_FILES+=usr/include/c++/3.3/sstream OLD_FILES+=usr/include/c++/3.3/stack OLD_FILES+=usr/include/c++/3.3/stdexcept OLD_FILES+=usr/include/c++/3.3/streambuf OLD_FILES+=usr/include/c++/3.3/string OLD_FILES+=usr/include/c++/3.3/typeinfo OLD_FILES+=usr/include/c++/3.3/utility OLD_FILES+=usr/include/c++/3.3/valarray OLD_FILES+=usr/include/c++/3.3/vector # 20040713: fla(4) removed. OLD_FILES+=usr/share/man/man4/fla.4.gz # 200407XX OLD_FILES+=usr/sbin/kernbb OLD_FILES+=usr/sbin/ntp-genkeys OLD_FILES+=usr/sbin/ntptimeset OLD_FILES+=usr/share/man/man8/kernbb.8.gz OLD_FILES+=usr/share/man/man8/ntp-genkeys.8.gz # 20040627: usbdevs.h and usbdevs_data.h removal OLD_FILES+=usr/include/dev/usb/usbdevs.h OLD_FILES+=usr/include/dev/usb/usbdevs_data.h # 200406XX OLD_FILES+=usr/bin/gasp OLD_FILES+=usr/bin/gdbreplay OLD_FILES+=usr/share/man/man1/gasp.1.gz OLD_FILES+=sbin/mountd OLD_FILES+=sbin/mount_fdesc OLD_FILES+=sbin/mount_umap OLD_FILES+=sbin/mount_union OLD_FILES+=sbin/mount_msdos OLD_FILES+=sbin/mount_null OLD_FILES+=sbin/mount_kernfs # 200405XX: arl OLD_FILES+=usr/sbin/arlconfig OLD_FILES+=usr/share/man/man8/arlconfig.8.gz # 200403XX OLD_FILES+=bin/raidctl OLD_FILES+=sbin/raidctl OLD_FILES+=usr/bin/sasc OLD_FILES+=usr/sbin/sgsc OLD_FILES+=usr/sbin/stlload OLD_FILES+=usr/sbin/stlstats OLD_FILES+=usr/share/man/man1/sasc.1.gz OLD_FILES+=usr/share/man/man1/sgsc.1.gz OLD_FILES+=usr/share/man/man4/i386/stl.4.gz OLD_FILES+=usr/share/man/man8/raidctl.8.gz # 20040229: clean_environment() was removed after 3 days OLD_FILES+=usr/share/man/man3/clean_environment.3.gz # 20040119: installed as `isdntel' in newer systems OLD_FILES+=etc/isdn/isdntel.sh # 200XYYZZ: /lib transition clitches OLD_FILES+=lib/libalias.so OLD_FILES+=lib/libatm.so OLD_FILES+=lib/libbsdxml.so OLD_FILES+=lib/libc.so OLD_FILES+=lib/libcam.so OLD_FILES+=lib/libcrypt.so OLD_FILES+=lib/libcrypto.so OLD_FILES+=lib/libdevstat.so OLD_FILES+=lib/libedit.so OLD_FILES+=lib/libgeom.so OLD_FILES+=lib/libipsec.so OLD_FILES+=lib/libipx.so OLD_FILES+=lib/libkvm.so OLD_FILES+=lib/libm.so OLD_FILES+=lib/libmd.so OLD_FILES+=lib/libncurses.so OLD_FILES+=lib/libreadline.so OLD_FILES+=lib/libsbuf.so OLD_FILES+=lib/libufs.so OLD_FILES+=lib/libz.so # 200312XX OLD_FILES+=bin/cxconfig OLD_FILES+=sbin/cxconfig OLD_FILES+=usr/share/man/man8/cxconfig.8.gz # 20031016: MULTI_DRIVER_MODULE macro removed OLD_FILES+=usr/share/man/man9/MULTI_DRIVER_MODULE.9.gz # 200309XX OLD_FILES+=usr/bin/symorder OLD_FILES+=usr/share/man/man1/symorder.1.gz # 200308XX OLD_FILES+=usr/sbin/amldb OLD_FILES+=usr/share/man/man8/amldb.8.gz # 200307XX OLD_FILES+=sbin/mount_nwfs OLD_FILES+=sbin/mount_portalfs OLD_FILES+=sbin/mount_smbfs # 200306XX OLD_FILES+=usr/sbin/dev_mkdb OLD_FILES+=usr/share/man/man8/dev_mkdb.8.gz # 200304XX OLD_FILES+=usr/lib/libcipher.a OLD_FILES+=usr/lib/libcipher.so OLD_FILES+=usr/lib/libcipher_p.a OLD_FILES+=usr/lib/libgmp.a OLD_FILES+=usr/lib/libgmp.so OLD_FILES+=usr/lib/libgmp_p.a OLD_FILES+=usr/lib/libperl.a OLD_FILES+=usr/lib/libperl.so OLD_FILES+=usr/lib/libperl_p.a OLD_FILES+=usr/lib/libposix1e.a OLD_FILES+=usr/lib/libposix1e.so OLD_FILES+=usr/lib/libposix1e_p.a OLD_FILES+=usr/lib/libskey.a OLD_FILES+=usr/lib/libskey.so OLD_FILES+=usr/lib/libskey_p.a OLD_FILES+=usr/libexec/tradcpp0 OLD_FILES+=usr/libexec/cpp0 # 200304XX: removal of xten OLD_FILES+=usr/libexec/xtend OLD_FILES+=usr/sbin/xten OLD_FILES+=usr/share/man/man1/xten.1.gz OLD_FILES+=usr/share/man/man8/xtend.8.gz # 200303XX OLD_FILES+=usr/lib/libacl.so OLD_FILES+=usr/lib/libdescrypt.so OLD_FILES+=usr/lib/libf2c.so OLD_FILES+=usr/lib/libg++.so OLD_FILES+=usr/lib/libkdb.so OLD_FILES+=usr/lib/librsaINTL.so OLD_FILES+=usr/lib/libscrypt.so OLD_FILES+=usr/lib/libss.so # 200302XX OLD_FILES+=usr/lib/libacl.a OLD_FILES+=usr/lib/libacl_p.a OLD_FILES+=usr/lib/libkadm.a OLD_FILES+=usr/lib/libkadm.so OLD_FILES+=usr/lib/libkadm_p.a OLD_FILES+=usr/lib/libkafs.a OLD_FILES+=usr/lib/libkafs.so OLD_FILES+=usr/lib/libkafs_p.a OLD_FILES+=usr/lib/libkdb.a OLD_FILES+=usr/lib/libkdb_p.a OLD_FILES+=usr/lib/libkrb.a OLD_FILES+=usr/lib/libkrb.so OLD_FILES+=usr/lib/libkrb_p.a OLD_FILES+=usr/share/man/man3/SSL_CIPHER_get_name.3.gz OLD_FILES+=usr/share/man/man3/SSL_COMP_add_compression_method.3 OLD_FILES+=usr/share/man/man3/SSL_CTX_add_extra_chain_cert.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_add_session.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_ctrl.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_flush_sessions.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_free.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_get_verify_mode.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_load_verify_locations.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_new.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_sess_number.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_sess_set_cache_size.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_sess_set_get_cb.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_sessions.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_cert_store.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_cert_verify_callback.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_cipher_list.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_client_CA_list.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_client_cert_cb.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_default_passwd_cb.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_generate_session_id.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_info_callback.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_max_cert_list.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_mode.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_msg_callback.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_options.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_quiet_shutdown.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_session_cache_mode.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_session_id_context.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_ssl_version.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_timeout.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_tmp_dh_callback.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_tmp_rsa_callback.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_set_verify.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_use_certificate.3.gz OLD_FILES+=usr/share/man/man3/SSL_SESSION_free.3.gz OLD_FILES+=usr/share/man/man3/SSL_SESSION_get_ex_new_index.3.gz OLD_FILES+=usr/share/man/man3/SSL_SESSION_get_time.3.gz OLD_FILES+=usr/share/man/man3/SSL_accept.3.gz OLD_FILES+=usr/share/man/man3/SSL_alert_type_string.3.gz OLD_FILES+=usr/share/man/man3/SSL_clear.3.gz OLD_FILES+=usr/share/man/man3/SSL_connect.3.gz OLD_FILES+=usr/share/man/man3/SSL_do_handshake.3.gz OLD_FILES+=usr/share/man/man3/SSL_free.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_SSL_CTX.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_ciphers.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_client_CA_list.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_current_cipher.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_default_timeout.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_error.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_ex_data_X509_STORE_CTX_idx.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_ex_new_index.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_fd.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_peer_cert_chain.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_peer_certificate.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_rbio.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_session.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_verify_result.3.gz OLD_FILES+=usr/share/man/man3/SSL_get_version.3.gz OLD_FILES+=usr/share/man/man3/SSL_library_init.3.gz OLD_FILES+=usr/share/man/man3/SSL_load_client_CA_file.3.gz OLD_FILES+=usr/share/man/man3/SSL_new.3.gz OLD_FILES+=usr/share/man/man3/SSL_pending.3.gz OLD_FILES+=usr/share/man/man3/SSL_read.3.gz OLD_FILES+=usr/share/man/man3/SSL_rstate_string.3.gz OLD_FILES+=usr/share/man/man3/SSL_session_reused.3.gz OLD_FILES+=usr/share/man/man3/SSL_set_bio.3.gz OLD_FILES+=usr/share/man/man3/SSL_set_connect_state.3.gz OLD_FILES+=usr/share/man/man3/SSL_set_fd.3.gz OLD_FILES+=usr/share/man/man3/SSL_set_session.3.gz OLD_FILES+=usr/share/man/man3/SSL_set_shutdown.3.gz OLD_FILES+=usr/share/man/man3/SSL_set_verify_result.3.gz OLD_FILES+=usr/share/man/man3/SSL_shutdown.3.gz OLD_FILES+=usr/share/man/man3/SSL_state_string.3.gz OLD_FILES+=usr/share/man/man3/SSL_want.3.gz OLD_FILES+=usr/share/man/man3/SSL_write.3.gz OLD_FILES+=usr/share/man/man3/d2i_SSL_SESSION.3.gz # 200301XX OLD_FILES+=usr/share/man/man3/des_3cbc_encrypt.3.gz OLD_FILES+=usr/share/man/man3/des_3ecb_encrypt.3.gz OLD_FILES+=usr/share/man/man3/des_cbc_cksum.3.gz OLD_FILES+=usr/share/man/man3/des_cbc_encrypt.3.gz OLD_FILES+=usr/share/man/man3/des_cfb_encrypt.3.gz OLD_FILES+=usr/share/man/man3/des_ecb_encrypt.3.gz OLD_FILES+=usr/share/man/man3/des_enc_read.3.gz OLD_FILES+=usr/share/man/man3/des_enc_write.3.gz OLD_FILES+=usr/share/man/man3/des_is_weak_key.3.gz OLD_FILES+=usr/share/man/man3/des_key_sched.3.gz OLD_FILES+=usr/share/man/man3/des_ofb_encrypt.3.gz OLD_FILES+=usr/share/man/man3/des_pcbc_encrypt.3.gz OLD_FILES+=usr/share/man/man3/des_quad_cksum.3.gz OLD_FILES+=usr/share/man/man3/des_random_key.3.gz OLD_FILES+=usr/share/man/man3/des_read_2password.3.gz OLD_FILES+=usr/share/man/man3/des_read_password.3.gz OLD_FILES+=usr/share/man/man3/des_read_pw_string.3.gz OLD_FILES+=usr/share/man/man3/des_set_key.3.gz OLD_FILES+=usr/share/man/man3/des_set_odd_parity.3.gz OLD_FILES+=usr/share/man/man3/des_string_to_2key.3.gz OLD_FILES+=usr/share/man/man3/des_string_to_key.3.gz # 200212XX OLD_FILES+=usr/sbin/kenv OLD_FILES+=usr/bin/kenv OLD_FILES+=usr/sbin/elf2aout # 200210XX OLD_FILES+=usr/include/libusbhid.h OLD_FILES+=usr/share/man/man3/All_FreeBSD.3.gz OLD_FILES+=usr/share/man/man3/CheckRules.3.gz OLD_FILES+=usr/share/man/man3/ChunkCanBeRoot.3.gz OLD_FILES+=usr/share/man/man3/Clone_Disk.3.gz OLD_FILES+=usr/share/man/man3/Collapse_Chunk.3.gz OLD_FILES+=usr/share/man/man3/Collapse_Disk.3.gz OLD_FILES+=usr/share/man/man3/Create_Chunk.3.gz OLD_FILES+=usr/share/man/man3/Create_Chunk_DWIM.3.gz OLD_FILES+=usr/share/man/man3/Cyl_Aligned.3.gz OLD_FILES+=usr/share/man/man3/Debug_Disk.3.gz OLD_FILES+=usr/share/man/man3/Delete_Chunk.3.gz OLD_FILES+=usr/share/man/man3/Disk_Names.3.gz OLD_FILES+=usr/share/man/man3/Free_Disk.3.gz OLD_FILES+=usr/share/man/man3/MakeDev.3.gz OLD_FILES+=usr/share/man/man3/MakeDevDisk.3.gz OLD_FILES+=usr/share/man/man3/Next_Cyl_Aligned.3.gz OLD_FILES+=usr/share/man/man3/Next_Track_Aligned.3.gz OLD_FILES+=usr/share/man/man3/Open_Disk.3.gz OLD_FILES+=usr/share/man/man3/Prev_Cyl_Aligned.3.gz OLD_FILES+=usr/share/man/man3/Prev_Track_Aligned.3.gz OLD_FILES+=usr/share/man/man3/Set_Bios_Geom.3.gz OLD_FILES+=usr/share/man/man3/Set_Boot_Blocks.3.gz OLD_FILES+=usr/share/man/man3/Set_Boot_Mgr.3.gz OLD_FILES+=usr/share/man/man3/ShowChunkFlags.3.gz OLD_FILES+=usr/share/man/man3/Track_Aligned.3.gz OLD_FILES+=usr/share/man/man3/Write_Disk.3.gz OLD_FILES+=usr/share/man/man3/slice_type_name.3.gz # 200210XX: most games moved to ports OLD_FILES+=usr/share/man/man6/adventure.6.gz OLD_FILES+=usr/share/man/man6/arithmetic.6.gz OLD_FILES+=usr/share/man/man6/atc.6.gz OLD_FILES+=usr/share/man/man6/backgammon.6.gz OLD_FILES+=usr/share/man/man6/battlestar.6.gz OLD_FILES+=usr/share/man/man6/bs.6.gz OLD_FILES+=usr/share/man/man6/canfield.6.gz OLD_FILES+=usr/share/man/man6/cfscores.6.gz OLD_FILES+=usr/share/man/man6/cribbage.6.gz OLD_FILES+=usr/share/man/man6/fish.6.gz OLD_FILES+=usr/share/man/man6/hack.6.gz OLD_FILES+=usr/share/man/man6/hangman.6.gz OLD_FILES+=usr/share/man/man6/larn.6.gz OLD_FILES+=usr/share/man/man6/mille.6.gz OLD_FILES+=usr/share/man/man6/phantasia.6.gz OLD_FILES+=usr/share/man/man6/piano.6.gz OLD_FILES+=usr/share/man/man6/pig.6.gz OLD_FILES+=usr/share/man/man6/quiz.6.gz OLD_FILES+=usr/share/man/man6/rain.6.gz OLD_FILES+=usr/share/man/man6/robots.6.gz OLD_FILES+=usr/share/man/man6/rogue.6.gz OLD_FILES+=usr/share/man/man6/sail.6.gz OLD_FILES+=usr/share/man/man6/snake.6.gz OLD_FILES+=usr/share/man/man6/snscore.6.gz OLD_FILES+=usr/share/man/man6/trek.6.gz OLD_FILES+=usr/share/man/man6/wargames.6.gz OLD_FILES+=usr/share/man/man6/worm.6.gz OLD_FILES+=usr/share/man/man6/worms.6.gz OLD_FILES+=usr/share/man/man6/wump.6.gz # 200207XX OLD_FILES+=usr/share/man/man1aout/ar.1aout.gz OLD_FILES+=usr/share/man/man1aout/as.1aout.gz OLD_FILES+=usr/share/man/man1aout/ld.1aout.gz OLD_FILES+=usr/share/man/man1aout/nm.1aout.gz OLD_FILES+=usr/share/man/man1aout/ranlib.1aout.gz OLD_FILES+=usr/share/man/man1aout/size.1aout.gz OLD_FILES+=usr/share/man/man1aout/strings.1aout.gz OLD_FILES+=usr/share/man/man1aout/strip.1aout.gz OLD_FILES+=bin/mountd OLD_FILES+=bin/nfsd # 20020707 sbin/nfsd -> usr.sbin/nfsd OLD_FILES+=sbin/nfsd # 200206XX OLD_FILES+=usr/lib/libpam_ssh.a OLD_FILES+=usr/lib/libpam_ssh_p.a OLD_FILES+=usr/bin/help OLD_FILES+=usr/bin/sccs .if ${TARGET_ARCH} != "amd64" && ${TARGET} != "arm" && ${TARGET_ARCH} != "i386" && ${TARGET} != "powerpc" OLD_FILES+=usr/bin/gdbserver .endif OLD_FILES+=usr/bin/ssh-keysign OLD_FILES+=usr/sbin/gifconfig OLD_FILES+=usr/sbin/prefix # 200205XX OLD_FILES+=usr/bin/doscmd # 200204XX OLD_FILES+=usr/bin/a2p OLD_FILES+=usr/bin/ptx OLD_FILES+=usr/bin/pod2text OLD_FILES+=usr/bin/pod2man OLD_FILES+=usr/bin/pod2latex OLD_FILES+=usr/bin/pod2html OLD_FILES+=usr/bin/h2ph OLD_FILES+=usr/bin/dprofpp OLD_FILES+=usr/bin/c2ph OLD_FILES+=usr/bin/h2xs OLD_FILES+=usr/bin/pl2pm OLD_FILES+=usr/bin/splain OLD_FILES+=usr/bin/s2p OLD_FILES+=usr/bin/find2perl OLD_FILES+=usr/sbin/pkg_update OLD_FILES+=usr/sbin/scriptdump # 20020409 GC kget(1), userconfig is long dead. OLD_FILES+=sbin/kget OLD_FILES+=usr/share/man/man8/kget.8.gz # 200203XX OLD_FILES+=usr/lib/libss.a OLD_FILES+=usr/lib/libss_p.a OLD_FILES+=usr/lib/libtelnet.a OLD_FILES+=usr/lib/libtelnet_p.a OLD_FILES+=usr/sbin/diskpart # 200202XX OLD_FILES+=usr/bin/gprof4 # 200201XX OLD_FILES+=usr/sbin/linux # 2001XXXX OLD_FILES+=usr/bin/joy OLD_FILES+=usr/sbin/ibcs2 OLD_FILES+=usr/sbin/svr4 OLD_FILES+=usr/bin/chflags OLD_FILES+=usr/sbin/uuconv OLD_FILES+=usr/sbin/uuchk OLD_FILES+=usr/sbin/portmap OLD_FILES+=usr/sbin/pmap_set OLD_FILES+=usr/sbin/pmap_dump OLD_FILES+=usr/sbin/mcon OLD_FILES+=usr/sbin/stlstty OLD_FILES+=usr/sbin/ispppcontrol OLD_FILES+=usr/sbin/rndcontrol # 20011001: UUCP migration to ports OLD_FILES+=usr/bin/uucp OLD_FILES+=usr/bin/uulog OLD_FILES+=usr/bin/uuname OLD_FILES+=usr/bin/uupick OLD_FILES+=usr/bin/uusched OLD_FILES+=usr/bin/uustat OLD_FILES+=usr/bin/uuto OLD_FILES+=usr/bin/uux OLD_FILES+=usr/libexec/uucp/uucico OLD_FILES+=usr/libexec/uucp/uuxqt OLD_FILES+=usr/libexec/uucpd OLD_FILES+=usr/share/man/man1/uuconv.1.gz OLD_FILES+=usr/share/man/man1/uucp.1.gz OLD_FILES+=usr/share/man/man1/uulog.1.gz OLD_FILES+=usr/share/man/man1/uuname.1.gz OLD_FILES+=usr/share/man/man1/uupick.1.gz OLD_FILES+=usr/share/man/man1/uustat.1.gz OLD_FILES+=usr/share/man/man1/uuto.1.gz OLD_FILES+=usr/share/man/man1/uux.1.gz OLD_FILES+=usr/share/man/man8/uuchk.8.gz OLD_FILES+=usr/share/man/man8/uucico.8.gz OLD_FILES+=usr/share/man/man8/uucpd.8.gz OLD_FILES+=usr/share/man/man8/uusched.8.gz OLD_FILES+=usr/share/man/man8/uuxqt.8.gz # 20010523 mount_portal -> mount_portalfs OLD_FILES+=sbin/mount_portal OLD_FILES+=usr/share/man/man8/mount_portal.8.gz # 200104XX OLD_FILES+=usr/lib/libdescrypt.a OLD_FILES+=usr/lib/libscrypt.a OLD_FILES+=usr/lib/libscrypt_p.a OLD_FILES+=usr/sbin/pim6stat OLD_FILES+=usr/sbin/pim6sd OLD_FILES+=usr/sbin/pim6dd # 20010217 OLD_FILES+=usr/share/doc/bind/misc/dns-setup # 20001200 OLD_FILES+=usr/lib/libgcc_r_pic.a # 200009XX OLD_FILES+=usr/lib/libRSAglue.a OLD_FILES+=usr/lib/libRSAglue.so OLD_FILES+=usr/lib/librsaINTL.a OLD_FILES+=usr/lib/librsaUSA.a OLD_FILES+=usr/lib/librsaUSA.so # 200002XX ? OLD_FILES+=usr/lib/libf2c.a OLD_FILES+=usr/lib/libf2c_p.a OLD_FILES+=usr/lib/libg++.a OLD_FILES+=usr/lib/libg++_p.a # 20001006 OLD_FILES+=usr/bin/miniperl # 20000810 OLD_FILES+=usr/bin/sperl # 200001XX OLD_FILES+=usr/sbin/apmconf # 199911XX OLD_FILES+=usr/sbin/ipfstat OLD_FILES+=usr/sbin/ipmon OLD_FILES+=usr/sbin/ipnat OLD_FILES+=usr/sbin/bad144 OLD_FILES+=usr/sbin/wormcontrol OLD_FILES+=usr/sbin/named-bootconf OLD_FILES+=usr/sbin/kvm_mkdb OLD_FILES+=usr/sbin/keyadmin # 199909XX OLD_FILES+=usr/lib/libdesrypt_p.a OLD_FILES+=sbin/ft # 199903XX OLD_FILES+=sbin/modload OLD_FILES+=sbin/modunload OLD_FILES+=usr/sbin/natd # 199812XX OLD_FILES+=sbin/dset # 199809XX OLD_FILES+=sbin/scsi OLD_FILES+=sbin/scsiformat OLD_FILES+=usr/sbin/ncrcontrol OLD_FILES+=usr/sbin/tickadj # 199806XX OLD_FILES+=usr/sbin/mkdosfs # 199801XX OLD_FILES+=sbin/mount_lfs OLD_FILES+=sbin/newlfs OLD_FILES+=sbin/dumplfs OLD_FILES+=usr/sbin/qcamcontrol OLD_FILES+=usr/sbin/supscan # 1997XXXX OLD_FILES+=usr/sbin/sysctl OLD_FILES+=usr/sbin/ctm_scan OLD_FILES+=usr/sbin/addgroup OLD_FILES+=usr/sbin/rmgroup # 1996XXXX OLD_FILES+=sbin/rdisc OLD_FILES+=usr/sbin/cdplay OLD_FILES+=usr/sbin/supfilesrv OLD_FILES+=usr/sbin/routed OLD_FILES+=usr/sbin/lsdev OLD_FILES+=usr/sbin/yppasswdd ## unsorted # do we still support aout builds? #OLD_FILES+=usr/lib/aout/c++rt0.o #OLD_FILES+=usr/lib/aout/crt0.o #OLD_FILES+=usr/lib/aout/gcrt0.o #OLD_FILES+=usr/lib/aout/scrt0.o #OLD_FILES+=usr/lib/aout/sgcrt0.o OLD_FILES+=usr/bin/sperl5 OLD_FILES+=usr/bin/perl5.6.0 OLD_FILES+=usr/bin/sperl5.6.0 OLD_FILES+=usr/bin/perlbc OLD_FILES+=usr/bin/perl5.00503 OLD_FILES+=usr/bin/sperl5.00503 OLD_FILES+=usr/bin/perlbug OLD_FILES+=usr/bin/perlcc OLD_FILES+=usr/bin/perldoc OLD_FILES+=usr/bin/suidperl OLD_FILES+=usr/lib/pam_ftp.so OLD_FILES+=usr/libdata/perl/5.00503/CGI/Apache.pm OLD_FILES+=usr/libdata/perl/5.00503/CGI/Carp.pm OLD_FILES+=usr/libdata/perl/5.00503/CGI/Cookie.pm OLD_FILES+=usr/libdata/perl/5.00503/CGI/Fast.pm OLD_FILES+=usr/libdata/perl/5.00503/CGI/Push.pm OLD_FILES+=usr/libdata/perl/5.00503/CGI/Switch.pm OLD_FILES+=usr/libdata/perl/5.00503/CPAN/FirstTime.pm OLD_FILES+=usr/libdata/perl/5.00503/CPAN/Nox.pm OLD_FILES+=usr/libdata/perl/5.00503/Class/Struct.pm OLD_FILES+=usr/libdata/perl/5.00503/Devel/SelfStubber.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Command.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Embed.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Install.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Installed.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Liblist.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/MM_OS2.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/MM_Unix.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/MM_VMS.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/MM_Win32.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/MakeMaker.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Manifest.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Mkbootstrap.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Mksymlists.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/Packlist.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/inst OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/testlib.pm OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/typemap OLD_FILES+=usr/libdata/perl/5.00503/ExtUtils/xsubpp OLD_FILES+=usr/libdata/perl/5.00503/File/Spec/Mac.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Spec/OS2.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Spec/Unix.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Spec/VMS.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Spec/Win32.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Basename.pm OLD_FILES+=usr/libdata/perl/5.00503/File/CheckTree.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Compare.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Copy.pm OLD_FILES+=usr/libdata/perl/5.00503/File/DosGlob.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Find.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Path.pm OLD_FILES+=usr/libdata/perl/5.00503/File/Spec.pm OLD_FILES+=usr/libdata/perl/5.00503/File/stat.pm OLD_FILES+=usr/libdata/perl/5.00503/Getopt/Long.pm OLD_FILES+=usr/libdata/perl/5.00503/Getopt/Std.pm OLD_FILES+=usr/libdata/perl/5.00503/I18N/Collate.pm OLD_FILES+=usr/libdata/perl/5.00503/IPC/Open2.pm OLD_FILES+=usr/libdata/perl/5.00503/IPC/Open3.pm OLD_FILES+=usr/libdata/perl/5.00503/Math/BigFloat.pm OLD_FILES+=usr/libdata/perl/5.00503/Math/BigInt.pm OLD_FILES+=usr/libdata/perl/5.00503/Math/Complex.pm OLD_FILES+=usr/libdata/perl/5.00503/Math/Trig.pm OLD_FILES+=usr/libdata/perl/5.00503/Net/Ping.pm OLD_FILES+=usr/libdata/perl/5.00503/Net/hostent.pm OLD_FILES+=usr/libdata/perl/5.00503/Net/netent.pm OLD_FILES+=usr/libdata/perl/5.00503/Net/protoent.pm OLD_FILES+=usr/libdata/perl/5.00503/Net/servent.pm OLD_FILES+=usr/libdata/perl/5.00503/Pod/Functions.pm OLD_FILES+=usr/libdata/perl/5.00503/Pod/Html.pm OLD_FILES+=usr/libdata/perl/5.00503/Pod/Text.pm OLD_FILES+=usr/libdata/perl/5.00503/Search/Dict.pm OLD_FILES+=usr/libdata/perl/5.00503/Sys/Hostname.pm OLD_FILES+=usr/libdata/perl/5.00503/Sys/Syslog.pm OLD_FILES+=usr/libdata/perl/5.00503/Term/Cap.pm OLD_FILES+=usr/libdata/perl/5.00503/Term/Complete.pm OLD_FILES+=usr/libdata/perl/5.00503/Term/ReadLine.pm OLD_FILES+=usr/libdata/perl/5.00503/Test/Harness.pm OLD_FILES+=usr/libdata/perl/5.00503/Text/Abbrev.pm OLD_FILES+=usr/libdata/perl/5.00503/Text/ParseWords.pm OLD_FILES+=usr/libdata/perl/5.00503/Text/Soundex.pm OLD_FILES+=usr/libdata/perl/5.00503/Text/Tabs.pm OLD_FILES+=usr/libdata/perl/5.00503/Text/Wrap.pm OLD_FILES+=usr/libdata/perl/5.00503/Tie/Array.pm OLD_FILES+=usr/libdata/perl/5.00503/Tie/Handle.pm OLD_FILES+=usr/libdata/perl/5.00503/Tie/Hash.pm OLD_FILES+=usr/libdata/perl/5.00503/Tie/RefHash.pm OLD_FILES+=usr/libdata/perl/5.00503/Tie/Scalar.pm OLD_FILES+=usr/libdata/perl/5.00503/Tie/SubstrHash.pm OLD_FILES+=usr/libdata/perl/5.00503/Time/Local.pm OLD_FILES+=usr/libdata/perl/5.00503/Time/gmtime.pm OLD_FILES+=usr/libdata/perl/5.00503/Time/localtime.pm OLD_FILES+=usr/libdata/perl/5.00503/Time/tm.pm OLD_FILES+=usr/libdata/perl/5.00503/User/grent.pm OLD_FILES+=usr/libdata/perl/5.00503/User/pwent.pm OLD_FILES+=usr/libdata/perl/5.00503/auto/Getopt/Long/GetOptions.al OLD_FILES+=usr/libdata/perl/5.00503/auto/Getopt/Long/FindOption.al OLD_FILES+=usr/libdata/perl/5.00503/auto/Getopt/Long/Configure.al OLD_FILES+=usr/libdata/perl/5.00503/auto/Getopt/Long/config.al OLD_FILES+=usr/libdata/perl/5.00503/auto/Getopt/Long/Croak.al OLD_FILES+=usr/libdata/perl/5.00503/auto/Getopt/Long/autosplit.ix OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Deparse.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/CC.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Debug.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Showlex.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/makeliblinks OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Bblock.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/cc_harness OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Bytecode.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Stackobj.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Xref.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Lint.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Asmdata.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Assembler.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Disassembler.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/disassemble OLD_FILES+=usr/libdata/perl/5.00503/mach/B/assemble OLD_FILES+=usr/libdata/perl/5.00503/mach/B/Terse.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B/C.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/EXTERN.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/INTERN.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/XSUB.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/XSlock.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/av.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/bytecode.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/byterun.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/cc_runtime.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/config.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/cop.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/cv.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/dosish.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/embed.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/embedvar.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/fakethr.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/form.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/gv.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/handy.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/hv.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/intrpvar.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/iperlsys.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/keywords.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/mg.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/nostdio.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/objXSUB.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/objpp.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/op.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/opcode.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/patchlevel.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/perl.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/perlio.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/perlsdio.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/perlsfio.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/perlvars.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/perly.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/pp.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/pp_proto.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/proto.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/regcomp.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/regexp.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/regnodes.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/scope.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/sv.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/thrdvar.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/thread.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/unixish.h OLD_FILES+=usr/libdata/perl/5.00503/mach/CORE/util.h OLD_FILES+=usr/libdata/perl/5.00503/mach/Data/Dumper.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IO/File.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IO/Select.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IO/Socket.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IO/Handle.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IO/Seekable.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IO/Pipe.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IPC/SysV.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IPC/Msg.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IPC/Semaphore.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/B/B.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/B/B.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/B/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DB_File/autosplit.ix OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DB_File/DB_File.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DB_File/DB_File.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DB_File/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Data/Dumper/Dumper.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Data/Dumper/Dumper.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Data/Dumper/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DynaLoader/.exists OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DynaLoader/dl_findfile.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DynaLoader/dl_expandspec.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DynaLoader/dl_find_symbol_anywhere.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DynaLoader/autosplit.ix OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DynaLoader/DynaLoader.a OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/DynaLoader/extralibs.ld OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Fcntl/Fcntl.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Fcntl/Fcntl.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Fcntl/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/IO/IO.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/IO/IO.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/IO/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/IPC/SysV/SysV.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/IPC/SysV/SysV.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/IPC/SysV/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/NDBM_File/NDBM_File.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/NDBM_File/NDBM_File.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/NDBM_File/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Opcode/Opcode.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Opcode/Opcode.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Opcode/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/assert.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/tolower.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/toupper.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/closedir.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/opendir.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/readdir.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/rewinddir.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/errno.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/creat.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fcntl.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getgrgid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getgrnam.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/atan2.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/cos.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/exp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fabs.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/log.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/pow.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/sin.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/sqrt.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getpwnam.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getpwuid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/longjmp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/setjmp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/kill.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/feof.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/siglongjmp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/sigsetjmp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/raise.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/offsetof.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/clearerr.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fclose.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fdopen.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fgetc.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fgets.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fileno.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fopen.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fprintf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fputc.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fputs.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fread.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/freopen.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fscanf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fseek.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/ferror.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fflush.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fgetpos.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fsetpos.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/ftell.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fwrite.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getc.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getchar.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/gets.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/perror.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/printf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/putc.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/putchar.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/puts.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/remove.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/rename.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/rewind.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/scanf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/sprintf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/sscanf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/tmpfile.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/ungetc.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/vfprintf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/vprintf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/vsprintf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/abs.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/atexit.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/atof.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/atoi.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/atol.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/bsearch.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/calloc.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/div.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/exit.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/free.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getenv.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/labs.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/ldiv.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/malloc.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/qsort.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/rand.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/realloc.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/srand.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/system.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/memchr.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/memcmp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/memcpy.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/memmove.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/memset.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strcat.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strchr.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strcmp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strcpy.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strcspn.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strerror.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strlen.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strncat.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strncmp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strncpy.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strpbrk.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strrchr.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strspn.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strstr.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/strtok.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/chmod.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fstat.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/mkdir.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/stat.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/umask.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/wait.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/waitpid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/gmtime.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/localtime.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/time.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/alarm.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/chdir.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/chown.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/execl.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/execle.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/execlp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/execv.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/execve.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/execvp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/fork.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getcwd.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getegid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/geteuid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getgid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getgroups.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getlogin.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getpgrp.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getpid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getppid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/getuid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/isatty.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/link.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/rmdir.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/setbuf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/setgid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/setuid.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/setvbuf.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/sleep.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/unlink.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/utime.al OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/autosplit.ix OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/POSIX.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/POSIX.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/POSIX/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/SDBM_File/SDBM_File.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/SDBM_File/SDBM_File.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/SDBM_File/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Socket/Socket.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Socket/Socket.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Socket/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/attrs/attrs.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/attrs/attrs.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/attrs/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/re/re.so OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/re/re.bs OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/re/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/sdbm/extralibs.ld OLD_FILES+=usr/libdata/perl/5.00503/mach/auto/Errno/.packlist OLD_FILES+=usr/libdata/perl/5.00503/mach/Config.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/B.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/O.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/perllocal.pod OLD_FILES+=usr/libdata/perl/5.00503/mach/DB_File.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/Errno.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/Fcntl.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/IO.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/NDBM_File.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/Safe.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/Opcode.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/ops.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/POSIX.pod OLD_FILES+=usr/libdata/perl/5.00503/mach/POSIX.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/SDBM_File.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/Socket.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/attrs.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/re.pm OLD_FILES+=usr/libdata/perl/5.00503/mach/_h2ph_pre.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/a.out.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_ccb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_debug.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_extend.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_periph.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_queue.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_sim.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_xpt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_xpt_periph.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/cam/cam_xpt_sim.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/aio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/alias.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/assert.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/bitstring.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/calendar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/camlib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/com_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/com_right.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ctype.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/curses.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/db.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/des.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/devstat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/dialog.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/dirent.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/disktab.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/dlfcn.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/elf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/errno.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/eti.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/fcntl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/fetch.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/float.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/floatingpoint.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/fnmatch.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/form.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/fstab.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ftpio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/fts.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/glob.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/gmp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/gnuregex.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/grp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/histedit.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ieeefp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ifaddrs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/inttypes.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/iso646.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/kvm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/libatm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/libdisk.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/libgen.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/libusb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/libutil.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/limits.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/link.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/linker_set.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/locale.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/login_cap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/malloc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/FlexLexer.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/PlotFile.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/SFile.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/_G_config.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/algo.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/algobase.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/alloc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/builtinbuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/bvector.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/complex.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/defalloc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/deque.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/editbuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/floatio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/fstream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/function.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/hash_map.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/hash_set.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/hashtable.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/heap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/indstream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/iolibio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/iomanip.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/list.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/iostdio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/iostream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/iostreamP.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/istream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/iterator.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/libio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/libioP.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/map.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/multimap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/multiset.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/new.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/ostream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/pair.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/parsestream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/pfstream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/procbuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/pthread_alloc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/rope.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/ropeimpl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/set.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/slist.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stack.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stdiostream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_algo.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/tree.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_algobase.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_alloc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_bvector.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_config.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_construct.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_deque.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_function.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_hash_fun.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_hash_map.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_hash_set.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_hashtable.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_heap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_iterator.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_list.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_map.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_multimap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_multiset.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_numeric.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_pair.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_queue.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_raw_storage_iter.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_relops.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_rope.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_set.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_slist.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_stack.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_tempbuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_tree.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_uninitialized.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stl_vector.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/stream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/streambuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/strfile.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/strstream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/tempbuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/type_traits.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g++/vector.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/math.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/md2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/md4.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/md5.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/memory.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/menu.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/mp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/mpool.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/mqueue.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ncurses.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ndbm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netdb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nl_types.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nlist.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objformat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/opie.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/osreldate.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/panel.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/paths.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pcap-int.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pcap-namedb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pcap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/poll.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pthread.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pthread_np.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pwd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/radlib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ranlib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/regex.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/regexp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/resolv.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ripemd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rune.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/runetype.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sched.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/search.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/semaphore.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/setjmp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sgtty.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sha.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/signal.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/skey.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/stab.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/stand.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/stdarg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/stddef.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/stdio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/stdlib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/strhash.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/string.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/stringlist.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/strings.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/struct.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sysexits.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/syslog.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/taclib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/tar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/tcpd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/term.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/termcap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/termios.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/time.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/timers.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ttyent.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ucontext.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/unctrl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/unistd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/utime.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/utmp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/values.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/varargs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vgl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vis.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/zconf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/zlib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/arpa/ftp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/arpa/inet.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/arpa/nameser.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/arpa/nameser_compat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/arpa/telnet.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/arpa/tftp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/assertions.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/ctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/dst.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/eventlib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/heap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/irpmarshall.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/logging.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/memcluster.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/misc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/tree.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/isc/list.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ansi.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/apic.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/apm_bios.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/apm_segments.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/asc_ioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/asm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/asmacros.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/asnames.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/atomic.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/bootinfo.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/bus.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/bus_at386.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/bus_memio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/bus_pc98.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/bus_pio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/bus_pio_ind.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/cdk.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/clock.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/comstats.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/console.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/cpu.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/cpufunc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/cputypes.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/cronyx.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/db_machdep.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/dvcfg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/elf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/endian.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/exec.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/float.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/floatingpoint.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/frame.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/globaldata.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/globals.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/gsc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/i4b_cause.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/i4b_debug.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/i4b_ioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/i4b_rbch_ioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/i4b_tel_ioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/i4b_trace.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ieeefp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/if_wavelan_ieee.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/if_wl_wavelan.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/iic.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/in_cksum.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ioctl_bt848.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ioctl_ctx.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ioctl_fd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ioctl_meteor.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ipl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/joystick.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/limits.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/lock.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/md_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/mouse.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/mpapic.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/mtpr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/bus_dma.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/npx.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/param.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/pcaudioio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/pcb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/pcb_ext.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/pcvt_ioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/perfmon.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/physio_proc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/pmap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/proc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/profile.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/psl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ptrace.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/reg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/reloc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/resource.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/segments.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/setjmp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/sigframe.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/signal.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/smb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/smp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/smptests.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/soundcard.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/speaker.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/specialreg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/spigot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/stdarg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/sysarch.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/trap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/tss.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/types.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/uc_device.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ucontext.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/ultrasound.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/varargs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/vm86.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/vmparam.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/wtio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/i4b_isppp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/machine/pci_cfgreg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/msdosfs/bootsect.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/msdosfs/bpb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/msdosfs/denode.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/msdosfs/direntry.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/msdosfs/fat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/msdosfs/msdosfsmount.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/bpf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/bpf_compat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/bpfdesc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/bridge.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/ethernet.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/hostcache.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_arp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_atm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_dl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_gif.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_ieee80211.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_llc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_media.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_mib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_ppp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_pppvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_slvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_sppp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_stf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_tap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_tapvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_tun.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/slip.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_tunvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_types.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_vlan_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/intrq.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/iso88025.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/net_osdep.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/netisr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/pfkeyv2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/ppp_comp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/ppp_defs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/radix.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/raw_cb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/route.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/slcompress.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/zlib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_faith.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_arc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/net/if_gre.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/krpc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfsdiskless.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfsm_subs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfsmount.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfsnode.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfsproto.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfsrtt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfsrvcache.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nfsv2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/nqnfs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/rpcv2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nfs/xdr_subs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatalk/aarp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatalk/at.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatalk/at_extern.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatalk/at_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatalk/ddp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatalk/ddp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatalk/endian.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatalk/phase2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_cm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_if.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_ioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_pcb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_sap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_sigmgr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_stack.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_sys.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/atm_vc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/kern_include.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/port.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netatm/queue.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/netgraph.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_UI.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_async.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_bpf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_bridge.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_cisco.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_echo.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_ether.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_frame_relay.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_hole.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_iface.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_ksocket.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_lmi.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_message.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_mppc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_one2many.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_parse.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_ppp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_pppoe.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_pptpgre.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_rfc1490.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_sample.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_socket.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_socketvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_tee.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_tty.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_vjc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_eiface.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_etf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_device.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_l2tp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netgraph/ng_fec.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/icmp6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/icmp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/if_atm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/if_ether.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/if_fddi.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/igmp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/igmp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/in.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/in_gif.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/in_hostcache.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/in_pcb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/in_systm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/in_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_auth.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_compat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_dummynet.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_ecn.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_encap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_fil.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_flow.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_frag.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_fw.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_icmp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_mroute.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_nat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_proxy.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_state.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ipl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ipprotosw.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/tcp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/tcp_debug.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/tcp_fsm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/tcp_seq.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/tcp_timer.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/tcp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/tcpip.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/udp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/udp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_fw2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet/ip_gre.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ah.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ah6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/esp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/esp6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/icmp6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/in6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/in6_gif.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/in6_ifattach.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/in6_pcb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/in6_prefix.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/in6_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ip6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ip6_ecn.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ip6_fw.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ip6_mroute.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ip6_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ip6protosw.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ipcomp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ipcomp6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ipsec.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/ipsec6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/mld6_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/nd6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/pim6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/pim6_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/scope6_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/tcp6_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/udp6_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/esp_rijndael.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netinet6/raw_ip6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/ipx.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/ipx_if.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/ipx_ip.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/ipx_pcb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/ipx_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/spx.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/spx_debug.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/spx_timer.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipx/spx_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netkey/key.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netkey/key_debug.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netkey/key_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netkey/keydb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netkey/keysock.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netnatm/natm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_cfg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_conn.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_file.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_lib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_ncp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_nls.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_rcfile.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_rq.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_sock.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_subr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/ncp_user.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netncp/nwerror.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/idp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/idp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/ns.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/ns_error.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/ns_if.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/ns_pcb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/sp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/spidp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/spp_debug.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/spp_timer.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netns/spp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ntfs/ntfs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ntfs/ntfs_compr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ntfs/ntfs_ihash.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ntfs/ntfs_inode.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ntfs/ntfs_subr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ntfs/ntfs_vfsops.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ntfs/ntfsmount.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nwfs/nwfs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nwfs/nwfs_mount.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nwfs/nwfs_node.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/nwfs/nwfs_subr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/NXConstStr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/Object.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/Protocol.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/encoding.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/hash.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/objc-api.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/objc-list.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/objc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/runtime.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/sarray.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/thr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/objc/typedstream.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/asn1.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/asn1_mac.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/bio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/blowfish.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/bn.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/buffer.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/cast.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/comp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/conf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/conf_api.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/crypto.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/des.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/dh.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/dsa.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/dso.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/e_os.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/e_os2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ebcdic.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/evp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hmac.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/lhash.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/md2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/md4.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/md5.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/mdc2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/obj_mac.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/objects.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/opensslconf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/opensslv.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/pem.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/pem2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/pkcs12.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/pkcs7.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/rand.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/rc2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/rc4.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/rc5.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ripemd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/rsa.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/safestack.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/sha.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ssl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ssl2.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ssl23.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ssl3.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ssl_locl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/stack.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/symhacks.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/tls1.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/tmdiff.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/txt_db.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/x509.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/x509_vfy.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/x509v3.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/idea.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/aes.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/asn1t.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/cryptlib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/des_old.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ec.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/engine.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/krb5_asn.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/kssl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ocsp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ossl_typ.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ui.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ui_compat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/aes_locl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/eng_int.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hw_4758_cca_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hw_aep_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hw_atalla_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hw_cswift_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hw_ncipher_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hw_nuron_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hw_sureware_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/hw_ubsec_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/openssl/ui_locl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/cardinfo.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/cis.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/driver.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/i82365.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/pccard_nbk.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/slot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/meciareg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/pcic_pci.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/pccard/pcicvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/posix4/aio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/posix4/mqueue.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/posix4/posix4.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/posix4/sched.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/posix4/semaphore.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/protocols/dumprestore.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/protocols/routed.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/protocols/rwhod.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/protocols/talkd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/protocols/timed.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/readline/chardefs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/readline/history.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/readline/keymaps.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/readline/readline.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/readline/rlconf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/readline/rlstdc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/readline/tilde.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/auth.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/auth_des.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/auth_unix.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/clnt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/des.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/des_crypt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/key_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/pmap_clnt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/pmap_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/pmap_rmt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/rpc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/rpc_com.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/rpc_msg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/svc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/svc_auth.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/types.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpc/xdr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/bootparam_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/crypt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/key_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/klm_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/mount.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/nfs_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/nis.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/nis_cache.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/nis_callback.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/nis_db.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/nis_tags.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/nislib.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/nlm_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/rex.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/rnusers.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/rquota.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/rstat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/rwall.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/sm_inter.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/spray.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/yp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/yp_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/ypclnt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/yppasswd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/ypupdate_prot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/rpcsvc/ypxfrd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/security/_pam_compat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/security/_pam_macros.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/security/_pam_types.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/security/pam_appl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/security/pam_malloc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/security/pam_misc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/security/pam_mod_misc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/security/pam_modules.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ss/mit-sipb-copyright.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ss/ss.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/ss/ss_err.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/_posix.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ata.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/acct.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/acl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/agpio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/aio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/assym.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/blist.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/buf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/bus.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/bus_private.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/callout.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ccdvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/cdefs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/cdio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/cdrio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/chio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/clist.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/endian.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/conf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/cons.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/consio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/copyright.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ctype.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/dir.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/dataacq.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/link_elf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/device_port.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/devicestat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/dirent.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/disk.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/disklabel.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/diskslice.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/dkstat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/dmap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/domain.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/dvdio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/elf32.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/elf64.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/elf_common.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/elf_generic.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/errno.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/event.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/eventhandler.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/eventvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/exec.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/extattr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/fbio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/fcntl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/file.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/filedesc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/filio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/gmon.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/imgact.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/imgact_aout.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/imgact_elf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/inflate.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/interrupt.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/inttypes.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ioccom.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ioctl_compat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ipc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/jail.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/joystick.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/kbio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/kernel.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/kthread.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ktrace.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/libkern.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/linker.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/linker_set.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/lock.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/lockf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/malloc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/mbuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/md5.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/memrange.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/mman.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/module.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/mount.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/msg.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/msgbuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/mtio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/namei.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/param.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/pciio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/pioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/pipe.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/poll.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/proc.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/procfs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/protosw.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ptio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ptrace.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/queue.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/random.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/reboot.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/resource.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/resourcevar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/rman.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/rtprio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/sbuf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/select.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/sem.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/shm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/signal.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/signalvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/snoop.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/socket.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/socketvar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/sockio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/soundcard.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/stat.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/syscall-hide.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/syscall.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/sysctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/sysent.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/syslimits.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/syslog.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/sysproto.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/systm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/taskqueue.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/termios.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/time.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/timeb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/timepps.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/timers.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/times.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/timex.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/tprintf.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/tty.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ttychars.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ttycom.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ttydefaults.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ttydev.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/types.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ucontext.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/ucred.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/uio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/un.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/unistd.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/unpcb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/user.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/utsname.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/vmmeter.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/vnioctl.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/vnode.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/wait.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/wormio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/xrpuio.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/kobj.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/link_aout.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/nlist_aout.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/mchain.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/fnv_hash.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/iconv.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/sys/md4.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/pmap.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/swap_pager.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_extern.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_kern.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_map.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_object.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_page.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_pageout.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_pager.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_param.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vm_zone.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/vm/vnode_pager.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/complex.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/stdbool.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/langinfo.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netsmb/netbios.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netsmb/smb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netsmb/smb_conn.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netsmb/smb_dev.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netsmb/smb_rq.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netsmb/smb_subr.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netsmb/smb_tran.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netsmb/smb_trantcp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/g2c.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/telnet.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/elf-hints.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/libusbhid.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/radlib_vs.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/readpassphrase.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/wchar.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/wctype.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/cast.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/castsb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/cryptodev.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/cryptosoft.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/deflate.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/rijndael.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/rmd160.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/skipjack.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/crypto/xform.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/ah.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/ah_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/esp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/esp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/ipcomp.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/ipcomp_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/ipip_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/ipsec.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/ipsec6.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/key.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/key_debug.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/key_var.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/keydb.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/keysock.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/netipsec/xform.ph OLD_FILES+=usr/libdata/perl/5.00503/mach/bzlib.ph OLD_FILES+=usr/libdata/perl/5.00503/pod/perl.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perl5004delta.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlapio.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlbook.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlbot.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlcall.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perldata.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perldebug.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perldelta.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perldiag.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perldsc.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlembed.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq1.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq2.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq3.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq4.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq5.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq6.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq7.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlipc.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq8.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfaq9.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlform.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlfunc.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlguts.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlhist.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perllocale.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perllol.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlmod.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlmodinstall.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlmodlib.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlobj.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlop.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlopentut.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlpod.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlport.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlre.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlref.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlreftut.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlrun.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlsec.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlstyle.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlsub.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlsyn.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlthrtut.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perltie.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perltoc.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perltoot.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perltrap.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlvar.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlxs.pod OLD_FILES+=usr/libdata/perl/5.00503/pod/perlxstut.pod OLD_FILES+=usr/libdata/perl/5.00503/AnyDBM_File.pm OLD_FILES+=usr/libdata/perl/5.00503/AutoLoader.pm OLD_FILES+=usr/libdata/perl/5.00503/AutoSplit.pm OLD_FILES+=usr/libdata/perl/5.00503/Benchmark.pm OLD_FILES+=usr/libdata/perl/5.00503/CGI.pm OLD_FILES+=usr/libdata/perl/5.00503/CPAN.pm OLD_FILES+=usr/libdata/perl/5.00503/Carp.pm OLD_FILES+=usr/libdata/perl/5.00503/Cwd.pm OLD_FILES+=usr/libdata/perl/5.00503/DirHandle.pm OLD_FILES+=usr/libdata/perl/5.00503/Dumpvalue.pm OLD_FILES+=usr/libdata/perl/5.00503/English.pm OLD_FILES+=usr/libdata/perl/5.00503/Env.pm OLD_FILES+=usr/libdata/perl/5.00503/Exporter.pm OLD_FILES+=usr/libdata/perl/5.00503/Fatal.pm OLD_FILES+=usr/libdata/perl/5.00503/FileCache.pm OLD_FILES+=usr/libdata/perl/5.00503/FileHandle.pm OLD_FILES+=usr/libdata/perl/5.00503/FindBin.pm OLD_FILES+=usr/libdata/perl/5.00503/SelectSaver.pm OLD_FILES+=usr/libdata/perl/5.00503/SelfLoader.pm OLD_FILES+=usr/libdata/perl/5.00503/Shell.pm OLD_FILES+=usr/libdata/perl/5.00503/Symbol.pm OLD_FILES+=usr/libdata/perl/5.00503/Test.pm OLD_FILES+=usr/libdata/perl/5.00503/abbrev.pl OLD_FILES+=usr/libdata/perl/5.00503/UNIVERSAL.pm OLD_FILES+=usr/libdata/perl/5.00503/assert.pl OLD_FILES+=usr/libdata/perl/5.00503/autouse.pm OLD_FILES+=usr/libdata/perl/5.00503/base.pm OLD_FILES+=usr/libdata/perl/5.00503/bigfloat.pl OLD_FILES+=usr/libdata/perl/5.00503/bigint.pl OLD_FILES+=usr/libdata/perl/5.00503/bigrat.pl OLD_FILES+=usr/libdata/perl/5.00503/blib.pm OLD_FILES+=usr/libdata/perl/5.00503/cacheout.pl OLD_FILES+=usr/libdata/perl/5.00503/chat2.pl OLD_FILES+=usr/libdata/perl/5.00503/complete.pl OLD_FILES+=usr/libdata/perl/5.00503/constant.pm OLD_FILES+=usr/libdata/perl/5.00503/ctime.pl OLD_FILES+=usr/libdata/perl/5.00503/diagnostics.pm OLD_FILES+=usr/libdata/perl/5.00503/dotsh.pl OLD_FILES+=usr/libdata/perl/5.00503/dumpvar.pl OLD_FILES+=usr/libdata/perl/5.00503/exceptions.pl OLD_FILES+=usr/libdata/perl/5.00503/fastcwd.pl OLD_FILES+=usr/libdata/perl/5.00503/fields.pm OLD_FILES+=usr/libdata/perl/5.00503/find.pl OLD_FILES+=usr/libdata/perl/5.00503/finddepth.pl OLD_FILES+=usr/libdata/perl/5.00503/flush.pl OLD_FILES+=usr/libdata/perl/5.00503/ftp.pl OLD_FILES+=usr/libdata/perl/5.00503/getcwd.pl OLD_FILES+=usr/libdata/perl/5.00503/getopt.pl OLD_FILES+=usr/libdata/perl/5.00503/getopts.pl OLD_FILES+=usr/libdata/perl/5.00503/hostname.pl OLD_FILES+=usr/libdata/perl/5.00503/importenv.pl OLD_FILES+=usr/libdata/perl/5.00503/integer.pm OLD_FILES+=usr/libdata/perl/5.00503/less.pm OLD_FILES+=usr/libdata/perl/5.00503/lib.pm OLD_FILES+=usr/libdata/perl/5.00503/locale.pm OLD_FILES+=usr/libdata/perl/5.00503/look.pl OLD_FILES+=usr/libdata/perl/5.00503/newgetopt.pl OLD_FILES+=usr/libdata/perl/5.00503/open2.pl OLD_FILES+=usr/libdata/perl/5.00503/open3.pl OLD_FILES+=usr/libdata/perl/5.00503/overload.pm OLD_FILES+=usr/libdata/perl/5.00503/perl5db.pl OLD_FILES+=usr/libdata/perl/5.00503/pwd.pl OLD_FILES+=usr/libdata/perl/5.00503/shellwords.pl OLD_FILES+=usr/libdata/perl/5.00503/sigtrap.pm OLD_FILES+=usr/libdata/perl/5.00503/stat.pl OLD_FILES+=usr/libdata/perl/5.00503/strict.pm OLD_FILES+=usr/libdata/perl/5.00503/subs.pm OLD_FILES+=usr/libdata/perl/5.00503/syslog.pl OLD_FILES+=usr/libdata/perl/5.00503/tainted.pl OLD_FILES+=usr/libdata/perl/5.00503/termcap.pl OLD_FILES+=usr/libdata/perl/5.00503/timelocal.pl OLD_FILES+=usr/libdata/perl/5.00503/validate.pl OLD_FILES+=usr/libdata/perl/5.00503/vars.pm OLD_FILES+=usr/libdata/perl/5.00503/re.pm OLD_FILES+=usr/libdata/perl/5.00503/Config.pm OLD_FILES+=usr/libdata/perl/5.00503/.exists OLD_FILES+=usr/libdata/perl/5.00503/DynaLoader.pm OLD_FILES+=usr/share/perl/man/man3/AnyDBM_File.3.gz OLD_FILES+=usr/share/perl/man/man3/AutoLoader.3.gz OLD_FILES+=usr/share/perl/man/man3/AutoSplit.3.gz OLD_FILES+=usr/share/perl/man/man3/B.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Asmdata.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Assembler.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Bblock.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Bytecode.3.gz OLD_FILES+=usr/share/perl/man/man3/B::C.3.gz OLD_FILES+=usr/share/perl/man/man3/B::CC.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Debug.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Deparse.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Disassembler.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Lint.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Showlex.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Stackobj.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Terse.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Xref.3.gz OLD_FILES+=usr/share/perl/man/man3/Benchmark.3.gz OLD_FILES+=usr/share/perl/man/man3/CGI.3.gz OLD_FILES+=usr/share/perl/man/man3/CGI::Apache.3.gz OLD_FILES+=usr/share/perl/man/man3/CGI::Carp.3.gz OLD_FILES+=usr/share/perl/man/man3/CGI::Cookie.3.gz OLD_FILES+=usr/share/perl/man/man3/CGI::Fast.3.gz OLD_FILES+=usr/share/perl/man/man3/CGI::Push.3.gz OLD_FILES+=usr/share/perl/man/man3/CGI::Switch.3.gz OLD_FILES+=usr/share/perl/man/man3/CPAN.3.gz OLD_FILES+=usr/share/perl/man/man3/CPAN::FirstTime.3.gz OLD_FILES+=usr/share/perl/man/man3/CPAN::Nox.3.gz OLD_FILES+=usr/share/perl/man/man3/Carp.3.gz OLD_FILES+=usr/share/perl/man/man3/Class::Struct.3.gz OLD_FILES+=usr/share/perl/man/man3/Config.3.gz OLD_FILES+=usr/share/perl/man/man3/Cwd.3.gz OLD_FILES+=usr/share/perl/man/man3/DB_File.3.gz OLD_FILES+=usr/share/perl/man/man3/Data::Dumper.3.gz OLD_FILES+=usr/share/perl/man/man3/Devel::SelfStubber.3.gz OLD_FILES+=usr/share/perl/man/man3/DirHandle.3.gz OLD_FILES+=usr/share/perl/man/man3/Dumpvalue.3.gz OLD_FILES+=usr/share/perl/man/man3/DynaLoader.3.gz OLD_FILES+=usr/share/perl/man/man3/English.3.gz OLD_FILES+=usr/share/perl/man/man3/Env.3.gz OLD_FILES+=usr/share/perl/man/man3/Exporter.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Command.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Embed.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Install.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Installed.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Liblist.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::MM_OS2.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::MM_Unix.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::MM_VMS.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::MM_Win32.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::MakeMaker.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Manifest.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Mkbootstrap.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Mksymlists.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::Packlist.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::testlib.3.gz OLD_FILES+=usr/share/perl/man/man3/Fatal.3.gz OLD_FILES+=usr/share/perl/man/man3/Fcntl.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Basename.3.gz OLD_FILES+=usr/share/perl/man/man3/File::CheckTree.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Compare.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Copy.3.gz OLD_FILES+=usr/share/perl/man/man3/File::DosGlob.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Find.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Path.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Spec.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Spec::Mac.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Spec::OS2.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Spec::Unix.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Spec::VMS.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Spec::Win32.3.gz OLD_FILES+=usr/share/perl/man/man3/File::stat.3.gz OLD_FILES+=usr/share/perl/man/man3/FileCache.3.gz OLD_FILES+=usr/share/perl/man/man3/IO.3.gz OLD_FILES+=usr/share/perl/man/man3/FileHandle.3.gz OLD_FILES+=usr/share/perl/man/man3/FindBin.3.gz OLD_FILES+=usr/share/perl/man/man3/GDBM_File.3.gz OLD_FILES+=usr/share/perl/man/man3/Getopt::Long.3.gz OLD_FILES+=usr/share/perl/man/man3/Getopt::Std.3.gz OLD_FILES+=usr/share/perl/man/man3/I18N::Collate.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::File.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Handle.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Pipe.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Seekable.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Select.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Socket.3.gz OLD_FILES+=usr/share/perl/man/man3/IPC::Msg.3.gz OLD_FILES+=usr/share/perl/man/man3/IPC::Open2.3.gz OLD_FILES+=usr/share/perl/man/man3/IPC::Open3.3.gz OLD_FILES+=usr/share/perl/man/man3/IPC::Semaphore.3.gz OLD_FILES+=usr/share/perl/man/man3/IPC::SysV.3.gz OLD_FILES+=usr/share/perl/man/man3/Math::BigFloat.3.gz OLD_FILES+=usr/share/perl/man/man3/Math::BigInt.3.gz OLD_FILES+=usr/share/perl/man/man3/Math::Complex.3.gz OLD_FILES+=usr/share/perl/man/man3/Math::Trig.3.gz OLD_FILES+=usr/share/perl/man/man3/NDBM_File.3.gz OLD_FILES+=usr/share/perl/man/man3/Net::Ping.3.gz OLD_FILES+=usr/share/perl/man/man3/Net::hostent.3.gz OLD_FILES+=usr/share/perl/man/man3/Net::netent.3.gz OLD_FILES+=usr/share/perl/man/man3/Net::protoent.3.gz OLD_FILES+=usr/share/perl/man/man3/Net::servent.3.gz OLD_FILES+=usr/share/perl/man/man3/O.3.gz OLD_FILES+=usr/share/perl/man/man3/ODBM_File.3.gz OLD_FILES+=usr/share/perl/man/man3/Opcode.3.gz OLD_FILES+=usr/share/perl/man/man3/POSIX.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Html.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Text.3.gz OLD_FILES+=usr/share/perl/man/man3/SDBM_File.3.gz OLD_FILES+=usr/share/perl/man/man3/Safe.3.gz OLD_FILES+=usr/share/perl/man/man3/Search::Dict.3.gz OLD_FILES+=usr/share/perl/man/man3/SelectSaver.3.gz OLD_FILES+=usr/share/perl/man/man3/SelfLoader.3.gz OLD_FILES+=usr/share/perl/man/man3/Shell.3.gz OLD_FILES+=usr/share/perl/man/man3/Socket.3.gz OLD_FILES+=usr/share/perl/man/man3/Symbol.3.gz OLD_FILES+=usr/share/perl/man/man3/re.3.gz OLD_FILES+=usr/share/perl/man/man3/Sys::Hostname.3.gz OLD_FILES+=usr/share/perl/man/man3/Sys::Syslog.3.gz OLD_FILES+=usr/share/perl/man/man3/Term::Cap.3.gz OLD_FILES+=usr/share/perl/man/man3/Term::Complete.3.gz OLD_FILES+=usr/share/perl/man/man3/Term::ReadLine.3.gz OLD_FILES+=usr/share/perl/man/man3/Test.3.gz OLD_FILES+=usr/share/perl/man/man3/Test::Harness.3.gz OLD_FILES+=usr/share/perl/man/man3/Text::Abbrev.3.gz OLD_FILES+=usr/share/perl/man/man3/Text::ParseWords.3.gz OLD_FILES+=usr/share/perl/man/man3/Text::Soundex.3.gz OLD_FILES+=usr/share/perl/man/man3/Text::Tabs.3.gz OLD_FILES+=usr/share/perl/man/man3/Text::Wrap.3.gz OLD_FILES+=usr/share/perl/man/man3/Thread.3.gz OLD_FILES+=usr/share/perl/man/man3/Thread::Queue.3.gz OLD_FILES+=usr/share/perl/man/man3/Thread::Semaphore.3.gz OLD_FILES+=usr/share/perl/man/man3/Thread::Signal.3.gz OLD_FILES+=usr/share/perl/man/man3/Thread::Specific.3.gz OLD_FILES+=usr/share/perl/man/man3/Tie::Array.3.gz OLD_FILES+=usr/share/perl/man/man3/Tie::Handle.3.gz OLD_FILES+=usr/share/perl/man/man3/Tie::Hash.3.gz OLD_FILES+=usr/share/perl/man/man3/Tie::RefHash.3.gz OLD_FILES+=usr/share/perl/man/man3/Tie::Scalar.3.gz OLD_FILES+=usr/share/perl/man/man3/Tie::SubstrHash.3.gz OLD_FILES+=usr/share/perl/man/man3/Time::Local.3.gz OLD_FILES+=usr/share/perl/man/man3/Time::gmtime.3.gz OLD_FILES+=usr/share/perl/man/man3/Time::localtime.3.gz OLD_FILES+=usr/share/perl/man/man3/Time::tm.3.gz OLD_FILES+=usr/share/perl/man/man3/UNIVERSAL.3.gz OLD_FILES+=usr/share/perl/man/man3/User::grent.3.gz OLD_FILES+=usr/share/perl/man/man3/User::pwent.3.gz OLD_FILES+=usr/share/perl/man/man3/attrs.3.gz OLD_FILES+=usr/share/perl/man/man3/autouse.3.gz OLD_FILES+=usr/share/perl/man/man3/base.3.gz OLD_FILES+=usr/share/perl/man/man3/blib.3.gz OLD_FILES+=usr/share/perl/man/man3/constant.3.gz OLD_FILES+=usr/share/perl/man/man3/diagnostics.3.gz OLD_FILES+=usr/share/perl/man/man3/fields.3.gz OLD_FILES+=usr/share/perl/man/man3/integer.3.gz OLD_FILES+=usr/share/perl/man/man3/less.3.gz OLD_FILES+=usr/share/perl/man/man3/lib.3.gz OLD_FILES+=usr/share/perl/man/man3/locale.3.gz OLD_FILES+=usr/share/perl/man/man3/ops.3.gz OLD_FILES+=usr/share/perl/man/man3/overload.3.gz OLD_FILES+=usr/share/perl/man/man3/sigtrap.3.gz OLD_FILES+=usr/share/perl/man/man3/strict.3.gz OLD_FILES+=usr/share/perl/man/man3/subs.3.gz OLD_FILES+=usr/share/perl/man/man3/vars.3.gz OLD_FILES+=usr/share/perl/man/man3/B::Stash.3.gz OLD_FILES+=usr/share/perl/man/man3/ByteLoader.3.gz OLD_FILES+=usr/share/perl/man/man3/CGI::Pretty.3.gz OLD_FILES+=usr/share/perl/man/man3/Carp::Heavy.3.gz OLD_FILES+=usr/share/perl/man/man3/DB.3.gz OLD_FILES+=usr/share/perl/man/man3/DProf::DProf.3.gz OLD_FILES+=usr/share/perl/man/man3/Exporter::Heavy.3.gz OLD_FILES+=usr/share/perl/man/man3/ExtUtils::MM_Cygwin.3.gz OLD_FILES+=usr/share/perl/man/man3/File::Glob.3.gz OLD_FILES+=usr/share/perl/man/man3/Glob::Glob.3.gz OLD_FILES+=usr/share/perl/man/man3/Hostname::Hostname.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Dir.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Poll.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Socket::INET.3.gz OLD_FILES+=usr/share/perl/man/man3/IO::Socket::UNIX.3.gz OLD_FILES+=usr/share/perl/man/man3/Peek::Peek.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Checker.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Find.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::InputObjects.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Man.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::ParseUtils.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Parser.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Plainer.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Select.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Text::Color.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Text::Termcap.3.gz OLD_FILES+=usr/share/perl/man/man3/Pod::Usage.3.gz OLD_FILES+=usr/share/perl/man/man3/Syslog::Syslog.3.gz OLD_FILES+=usr/share/perl/man/man3/Term::ANSIColor.3.gz OLD_FILES+=usr/share/perl/man/man3/XSLoader.3.gz OLD_FILES+=usr/share/perl/man/man3/attributes.3.gz OLD_FILES+=usr/share/perl/man/man3/bytes.3.gz OLD_FILES+=usr/share/perl/man/man3/charnames.3.gz OLD_FILES+=usr/share/perl/man/man3/filetest.3.gz OLD_FILES+=usr/share/perl/man/man3/open.3.gz OLD_FILES+=usr/share/perl/man/man3/utf8.3.gz OLD_FILES+=usr/share/perl/man/man3/warnings.3.gz OLD_FILES+=usr/share/perl/man/man3/warnings::register.3.gz OLD_FILES+=usr/share/perl/man/whatis OLD_FILES+=usr/share/man/man1/CA.pl.1.gz OLD_FILES+=usr/share/man/man1/asn1parse.1.gz OLD_FILES+=usr/share/man/man1/ca.1.gz OLD_FILES+=usr/share/man/man1/ciphers.1.gz OLD_FILES+=usr/share/man/man1/config.1.gz OLD_FILES+=usr/share/man/man1/crl.1.gz OLD_FILES+=usr/share/man/man1/crl2pkcs7.1.gz OLD_FILES+=usr/share/man/man1/dgst.1.gz OLD_FILES+=usr/share/man/man1/dhparam.1.gz OLD_FILES+=usr/share/man/man1/doscmd.1.gz OLD_FILES+=usr/share/man/man1/dsa.1.gz OLD_FILES+=usr/share/man/man1/dsaparam.1.gz OLD_FILES+=usr/share/man/man1/enc.1.gz OLD_FILES+=usr/share/man/man1/gendsa.1.gz OLD_FILES+=usr/share/man/man1/genrsa.1.gz OLD_FILES+=usr/share/man/man1/getNAME.1.gz OLD_FILES+=usr/share/man/man1/nseq.1.gz OLD_FILES+=usr/share/man/man1/ocsp.1.gz OLD_FILES+=usr/share/man/man1/openssl.1.gz OLD_FILES+=usr/share/man/man1/perl.1.gz OLD_FILES+=usr/share/man/man1/perl5004delta.1.gz OLD_FILES+=usr/share/man/man1/perlapio.1.gz OLD_FILES+=usr/share/man/man1/perlbook.1.gz OLD_FILES+=usr/share/man/man1/perlbot.1.gz OLD_FILES+=usr/share/man/man1/perlcall.1.gz OLD_FILES+=usr/share/man/man1/perldata.1.gz OLD_FILES+=usr/share/man/man1/perldebug.1.gz OLD_FILES+=usr/share/man/man1/perldelta.1.gz OLD_FILES+=usr/share/man/man1/perldiag.1.gz OLD_FILES+=usr/share/man/man1/perldsc.1.gz OLD_FILES+=usr/share/man/man1/perlembed.1.gz OLD_FILES+=usr/share/man/man1/perlfaq.1.gz OLD_FILES+=usr/share/man/man1/perlfaq1.1.gz OLD_FILES+=usr/share/man/man1/perlfaq2.1.gz OLD_FILES+=usr/share/man/man1/perlfaq3.1.gz OLD_FILES+=usr/share/man/man1/perlfaq4.1.gz OLD_FILES+=usr/share/man/man1/perlfaq5.1.gz OLD_FILES+=usr/share/man/man1/perlfaq6.1.gz OLD_FILES+=usr/share/man/man1/perlfaq7.1.gz OLD_FILES+=usr/share/man/man1/perlfaq8.1.gz OLD_FILES+=usr/share/man/man1/perlfaq9.1.gz OLD_FILES+=usr/share/man/man1/perlform.1.gz OLD_FILES+=usr/share/man/man1/perlfunc.1.gz OLD_FILES+=usr/share/man/man1/perlguts.1.gz OLD_FILES+=usr/share/man/man1/perlhist.1.gz OLD_FILES+=usr/share/man/man1/perlipc.1.gz OLD_FILES+=usr/share/man/man1/perllocale.1.gz OLD_FILES+=usr/share/man/man1/perllol.1.gz OLD_FILES+=usr/share/man/man1/perlmod.1.gz OLD_FILES+=usr/share/man/man1/perlmodinstall.1.gz OLD_FILES+=usr/share/man/man1/perlmodlib.1.gz OLD_FILES+=usr/share/man/man1/perlobj.1.gz OLD_FILES+=usr/share/man/man1/perlop.1.gz OLD_FILES+=usr/share/man/man1/perlopentut.1.gz OLD_FILES+=usr/share/man/man1/perlpod.1.gz OLD_FILES+=usr/share/man/man1/perlport.1.gz OLD_FILES+=usr/share/man/man1/perlre.1.gz OLD_FILES+=usr/share/man/man1/perlref.1.gz OLD_FILES+=usr/share/man/man1/perlreftut.1.gz OLD_FILES+=usr/share/man/man1/perlrun.1.gz OLD_FILES+=usr/share/man/man1/perlsec.1.gz OLD_FILES+=usr/share/man/man1/perlstyle.1.gz OLD_FILES+=usr/share/man/man1/perlsub.1.gz OLD_FILES+=usr/share/man/man1/perlsyn.1.gz OLD_FILES+=usr/share/man/man1/perlthrtut.1.gz OLD_FILES+=usr/share/man/man1/perltie.1.gz OLD_FILES+=usr/share/man/man1/perltoc.1.gz OLD_FILES+=usr/share/man/man1/perltoot.1.gz OLD_FILES+=usr/share/man/man1/perltrap.1.gz OLD_FILES+=usr/share/man/man1/perlvar.1.gz OLD_FILES+=usr/share/man/man1/perlxs.1.gz OLD_FILES+=usr/share/man/man1/perlxstut.1.gz OLD_FILES+=usr/share/man/man1/perlbug.1.gz OLD_FILES+=usr/share/man/man1/perlcc.1.gz OLD_FILES+=usr/share/man/man1/perldoc.1.gz OLD_FILES+=usr/share/man/man1/perl5005delta.1.gz OLD_FILES+=usr/share/man/man1/perlfork.1.gz OLD_FILES+=usr/share/man/man1/perlboot.1.gz OLD_FILES+=usr/share/man/man1/perltootc.1.gz OLD_FILES+=usr/share/man/man1/perldbmfilter.1.gz OLD_FILES+=usr/share/man/man1/perldebguts.1.gz OLD_FILES+=usr/share/man/man1/perlnumber.1.gz OLD_FILES+=usr/share/man/man1/perlcompile.1.gz OLD_FILES+=usr/share/man/man1/perltodo.1.gz OLD_FILES+=usr/share/man/man1/perlapi.1.gz OLD_FILES+=usr/share/man/man1/perlintern.1.gz OLD_FILES+=usr/share/man/man1/perlhack.1.gz OLD_FILES+=usr/share/man/man1/perlbc.1.gz OLD_FILES+=usr/share/man/man1/pkcs12.1.gz OLD_FILES+=usr/share/man/man1/pkcs7.1.gz OLD_FILES+=usr/share/man/man1/pkcs8.1.gz OLD_FILES+=usr/share/man/man1/rand.1.gz OLD_FILES+=usr/share/man/man1/req.1.gz OLD_FILES+=usr/share/man/man1/rsa.1.gz OLD_FILES+=usr/share/man/man1/rsautl.1.gz OLD_FILES+=usr/share/man/man1/s_client.1.gz OLD_FILES+=usr/share/man/man1/s_server.1.gz OLD_FILES+=usr/share/man/man1/sess_id.1.gz OLD_FILES+=usr/share/man/man1/smime.1.gz OLD_FILES+=usr/share/man/man1/speed.1.gz OLD_FILES+=usr/share/man/man1/spkac.1.gz OLD_FILES+=usr/share/man/man1/verify.1.gz OLD_FILES+=usr/share/man/man1/version.1.gz OLD_FILES+=usr/share/man/man1/x509.1.gz OLD_FILES+=usr/share/man/man3/SSL_COMP_add_compression_method.3.gz OLD_FILES+=usr/share/man/man3/SSL_CTX_get_ex_new_index.3.gz OLD_FILES+=usr/share/man/man3/archive_entry_dup.3.gz OLD_FILES+=usr/share/man/man3/archive_entry_set_tartype.3.gz OLD_FILES+=usr/share/man/man3/archive_entry_tartype.3.gz OLD_FILES+=usr/share/man/man3/archive_read_data_into_file.3.gz OLD_FILES+=usr/share/man/man3/archive_read_open_tar.3.gz OLD_FILES+=usr/share/man/man3/archive_read_support_format_gnutar.3.gz OLD_FILES+=usr/share/man/man3/cipher.3.gz OLD_FILES+=usr/share/man/man3/des_cipher.3.gz OLD_FILES+=usr/share/man/man3/des_setkey.3.gz OLD_FILES+=usr/share/man/man3/encrypt.3.gz OLD_FILES+=usr/share/man/man3/endvfsent.3.gz OLD_FILES+=usr/share/man/man3/getvfsbytype.3.gz OLD_FILES+=usr/share/man/man3/getvfsent.3.gz OLD_FILES+=usr/share/man/man3/isnanf.3.gz OLD_FILES+=usr/share/man/man3/libautofs.3.gz OLD_FILES+=usr/share/man/man3/pthread_attr_setsstack.3.gz OLD_FILES+=usr/share/man/man3/pthread_getcancelstate.3.gz OLD_FILES+=usr/share/man/man3/pthread_mutexattr_getpshared.3.gz OLD_FILES+=usr/share/man/man3/pthread_mutexattr_setpshared.3.gz OLD_FILES+=usr/share/man/man3/set_assertion_failure_callback.3.gz OLD_FILES+=usr/share/man/man3/setkey.3.gz OLD_FILES+=usr/share/man/man3/setvfsent.3.gz OLD_FILES+=usr/share/man/man3/ssl.3.gz OLD_FILES+=usr/share/man/man3/vfsisloadable.3.gz OLD_FILES+=usr/share/man/man3/vfsload.3.gz OLD_FILES+=usr/share/man/man4/als4000.4.gz OLD_FILES+=usr/share/man/man4/csa.4.gz OLD_FILES+=usr/share/man/man4/emu10k1.4.gz OLD_FILES+=usr/share/man/man4/euc.4.gz OLD_FILES+=usr/share/man/man4/gusc.4.gz OLD_FILES+=usr/share/man/man4/if_fwp.4.gz OLD_FILES+=usr/share/man/man4/lomac.4.gz OLD_FILES+=usr/share/man/man4/maestro3.4.gz OLD_FILES+=usr/share/man/man4/raid.4.gz OLD_FILES+=usr/share/man/man4/sbc.4.gz OLD_FILES+=usr/share/man/man4/sd.4.gz OLD_FILES+=usr/share/man/man4/snc.4.gz OLD_FILES+=usr/share/man/man4/st.4.gz OLD_FILES+=usr/share/man/man4/uaudio.4.gz OLD_FILES+=usr/share/man/man4/utf2.4.gz OLD_FILES+=usr/share/man/man4/vinumdebug.4.gz OLD_FILES+=usr/share/man/man5/disklabel.5.gz OLD_FILES+=usr/share/man/man5/dm.conf.5.gz OLD_FILES+=usr/share/man/man5/ranlib.5.gz OLD_FILES+=usr/share/man/man5/utf2.5.gz OLD_FILES+=usr/share/man/man7/groff_mwww.7.gz OLD_FILES+=usr/share/man/man7/mmroff.7.gz OLD_FILES+=usr/share/man/man7/mwww.7.gz OLD_FILES+=usr/share/man/man7/style.perl.7.gz OLD_FILES+=usr/share/man/man8/apm.8.gz OLD_FILES+=usr/share/man/man8/apmconf.8.gz OLD_FILES+=usr/share/man/man8/apmd.8.gz OLD_FILES+=usr/share/man/man8/dm.8.gz OLD_FILES+=usr/share/man/man8/pam_ftp.8.gz OLD_FILES+=usr/share/man/man8/pam_wheel.8.gz OLD_FILES+=usr/share/man/man8/sconfig.8.gz OLD_FILES+=usr/share/man/man8/ssl.8.gz OLD_FILES+=usr/share/man/man8/wlconfig.8.gz OLD_FILES+=usr/share/man/man9/CURSIG.9.gz OLD_FILES+=usr/share/man/man9/VFS_INIT.9.gz OLD_FILES+=usr/share/man/man9/at_exit.9.gz OLD_FILES+=usr/share/man/man9/at_fork.9.gz OLD_FILES+=usr/share/man/man9/cdevsw_add.9.gz OLD_FILES+=usr/share/man/man9/cdevsw_remove.9.gz OLD_FILES+=usr/share/man/man9/cv_waitq_empty.9.gz OLD_FILES+=usr/share/man/man9/cv_waitq_remove.9.gz OLD_FILES+=usr/share/man/man9/endtsleep.9.gz OLD_FILES+=usr/share/man/man9/jumbo.9.gz OLD_FILES+=usr/share/man/man9/jumbo_freem.9.gz OLD_FILES+=usr/share/man/man9/jumbo_pg_alloc.9.gz OLD_FILES+=usr/share/man/man9/jumbo_pg_free.9.gz OLD_FILES+=usr/share/man/man9/jumbo_pg_steal.9.gz OLD_FILES+=usr/share/man/man9/jumbo_phys_to_kva.9.gz OLD_FILES+=usr/share/man/man9/jumbo_vm_init.9.gz OLD_FILES+=usr/share/man/man9/mac_biba.9.gz OLD_FILES+=usr/share/man/man9/mac_bsdextended.9.gz OLD_FILES+=usr/share/man/man9/mono_time.9.gz OLD_FILES+=usr/share/man/man9/p1003_1b.9.gz OLD_FILES+=usr/share/man/man9/pmap_prefault.9.gz OLD_FILES+=usr/share/man/man9/posix4.9.gz OLD_FILES+=usr/share/man/man9/resource_query_name.9.gz OLD_FILES+=usr/share/man/man9/resource_query_string.9.gz OLD_FILES+=usr/share/man/man9/resource_query_unit.9.gz OLD_FILES+=usr/share/man/man9/rm_at_exit.9.gz OLD_FILES+=usr/share/man/man9/rm_at_fork.9.gz OLD_FILES+=usr/share/man/man9/runtime.9.gz OLD_FILES+=usr/share/man/man9/sleepinit.9.gz OLD_FILES+=usr/share/man/man9/unsleep.9.gz OLD_FILES+=usr/share/man/ja/man1/perl.1.gz OLD_FILES+=usr/share/games/atc/Game_List OLD_FILES+=usr/share/games/atc/Killer OLD_FILES+=usr/share/games/atc/crossover OLD_FILES+=usr/share/games/atc/default OLD_FILES+=usr/share/games/atc/easy OLD_FILES+=usr/share/games/atc/game_2 OLD_FILES+=usr/share/games/larn/larnmaze OLD_FILES+=usr/share/games/larn/larnopts OLD_FILES+=usr/share/games/larn/larn.help OLD_FILES+=usr/share/games/quiz.db/africa OLD_FILES+=usr/share/games/quiz.db/america OLD_FILES+=usr/share/games/quiz.db/areas OLD_FILES+=usr/share/games/quiz.db/arith OLD_FILES+=usr/share/games/quiz.db/asia OLD_FILES+=usr/share/games/quiz.db/babies OLD_FILES+=usr/share/games/quiz.db/bard OLD_FILES+=usr/share/games/quiz.db/chinese OLD_FILES+=usr/share/games/quiz.db/collectives OLD_FILES+=usr/share/games/quiz.db/ed OLD_FILES+=usr/share/games/quiz.db/elements OLD_FILES+=usr/share/games/quiz.db/europe OLD_FILES+=usr/share/games/quiz.db/flowers OLD_FILES+=usr/share/games/quiz.db/greek OLD_FILES+=usr/share/games/quiz.db/inca OLD_FILES+=usr/share/games/quiz.db/index OLD_FILES+=usr/share/games/quiz.db/latin OLD_FILES+=usr/share/games/quiz.db/locomotive OLD_FILES+=usr/share/games/quiz.db/midearth OLD_FILES+=usr/share/games/quiz.db/morse OLD_FILES+=usr/share/games/quiz.db/murders OLD_FILES+=usr/share/games/quiz.db/poetry OLD_FILES+=usr/share/games/quiz.db/posneg OLD_FILES+=usr/share/games/quiz.db/pres OLD_FILES+=usr/share/games/quiz.db/province OLD_FILES+=usr/share/games/quiz.db/seq-easy OLD_FILES+=usr/share/games/quiz.db/seq-hard OLD_FILES+=usr/share/games/quiz.db/sexes OLD_FILES+=usr/share/games/quiz.db/sov OLD_FILES+=usr/share/games/quiz.db/spell OLD_FILES+=usr/share/games/quiz.db/state OLD_FILES+=usr/share/games/quiz.db/trek OLD_FILES+=usr/share/games/quiz.db/ucc OLD_FILES+=usr/share/games/cribbage.instr OLD_FILES+=usr/share/games/fish.instr OLD_FILES+=usr/share/games/wump.info OLD_FILES+=usr/games/hide/adventure OLD_FILES+=usr/games/hide/arithmetic OLD_FILES+=usr/games/hide/atc OLD_FILES+=usr/games/hide/backgammon OLD_FILES+=usr/games/hide/teachgammon OLD_FILES+=usr/games/hide/battlestar OLD_FILES+=usr/games/hide/bs OLD_FILES+=usr/games/hide/canfield OLD_FILES+=usr/games/hide/cribbage OLD_FILES+=usr/games/hide/fish OLD_FILES+=usr/games/hide/hack OLD_FILES+=usr/games/hide/hangman OLD_FILES+=usr/games/hide/larn OLD_FILES+=usr/games/hide/mille OLD_FILES+=usr/games/hide/phantasia OLD_FILES+=usr/games/hide/quiz OLD_FILES+=usr/games/hide/robots OLD_FILES+=usr/games/hide/rogue OLD_FILES+=usr/games/hide/sail OLD_FILES+=usr/games/hide/snake OLD_FILES+=usr/games/hide/trek OLD_FILES+=usr/games/hide/worm OLD_FILES+=usr/games/hide/wump OLD_FILES+=usr/games/adventure OLD_FILES+=usr/games/arithmetic OLD_FILES+=usr/games/atc OLD_FILES+=usr/games/backgammon OLD_FILES+=usr/games/teachgammon OLD_FILES+=usr/games/battlestar OLD_FILES+=usr/games/bs OLD_FILES+=usr/games/canfield OLD_FILES+=usr/games/cfscores OLD_FILES+=usr/games/cribbage OLD_FILES+=usr/games/dm OLD_FILES+=usr/games/fish OLD_FILES+=usr/games/hack OLD_FILES+=usr/games/hangman OLD_FILES+=usr/games/larn OLD_FILES+=usr/games/mille OLD_FILES+=usr/games/phantasia OLD_FILES+=usr/games/piano OLD_FILES+=usr/games/pig OLD_FILES+=usr/games/quiz OLD_FILES+=usr/games/rain OLD_FILES+=usr/games/robots OLD_FILES+=usr/games/rogue OLD_FILES+=usr/games/sail OLD_FILES+=usr/games/snake OLD_FILES+=usr/games/snscore OLD_FILES+=usr/games/trek OLD_FILES+=usr/games/wargames OLD_FILES+=usr/games/worm OLD_FILES+=usr/games/worms OLD_FILES+=usr/games/wump OLD_FILES+=sbin/mount_reiserfs OLD_FILES+=usr/include/cam/cam_extend.h OLD_FILES+=usr/include/dev/wi/wi_hostap.h OLD_FILES+=usr/include/disktab.h OLD_FILES+=usr/include/g++/FlexLexer.h OLD_FILES+=usr/include/g++/PlotFile.h OLD_FILES+=usr/include/g++/SFile.h OLD_FILES+=usr/include/g++/_G_config.h OLD_FILES+=usr/include/g++/algo.h OLD_FILES+=usr/include/g++/algobase.h OLD_FILES+=usr/include/g++/algorithm OLD_FILES+=usr/include/g++/alloc.h OLD_FILES+=usr/include/g++/bitset OLD_FILES+=usr/include/g++/builtinbuf.h OLD_FILES+=usr/include/g++/bvector.h OLD_FILES+=usr/include/g++/cassert OLD_FILES+=usr/include/g++/cctype OLD_FILES+=usr/include/g++/cerrno OLD_FILES+=usr/include/g++/cfloat OLD_FILES+=usr/include/g++/ciso646 OLD_FILES+=usr/include/g++/climits OLD_FILES+=usr/include/g++/clocale OLD_FILES+=usr/include/g++/cmath OLD_FILES+=usr/include/g++/complex OLD_FILES+=usr/include/g++/complex.h OLD_FILES+=usr/include/g++/csetjmp OLD_FILES+=usr/include/g++/csignal OLD_FILES+=usr/include/g++/cstdarg OLD_FILES+=usr/include/g++/cstddef OLD_FILES+=usr/include/g++/cstdio OLD_FILES+=usr/include/g++/cstdlib OLD_FILES+=usr/include/g++/cstring OLD_FILES+=usr/include/g++/ctime OLD_FILES+=usr/include/g++/cwchar OLD_FILES+=usr/include/g++/cwctype OLD_FILES+=usr/include/g++/defalloc.h OLD_FILES+=usr/include/g++/deque OLD_FILES+=usr/include/g++/deque.h OLD_FILES+=usr/include/g++/editbuf.h OLD_FILES+=usr/include/g++/exception OLD_FILES+=usr/include/g++/floatio.h OLD_FILES+=usr/include/g++/fstream OLD_FILES+=usr/include/g++/fstream.h OLD_FILES+=usr/include/g++/function.h OLD_FILES+=usr/include/g++/functional OLD_FILES+=usr/include/g++/hash_map OLD_FILES+=usr/include/g++/hash_map.h OLD_FILES+=usr/include/g++/hash_set OLD_FILES+=usr/include/g++/hash_set.h OLD_FILES+=usr/include/g++/hashtable.h OLD_FILES+=usr/include/g++/heap.h OLD_FILES+=usr/include/g++/indstream.h OLD_FILES+=usr/include/g++/iolibio.h OLD_FILES+=usr/include/g++/iomanip OLD_FILES+=usr/include/g++/iomanip.h OLD_FILES+=usr/include/g++/iosfwd OLD_FILES+=usr/include/g++/iostdio.h OLD_FILES+=usr/include/g++/iostream OLD_FILES+=usr/include/g++/iostream.h OLD_FILES+=usr/include/g++/iostreamP.h OLD_FILES+=usr/include/g++/istream.h OLD_FILES+=usr/include/g++/iterator OLD_FILES+=usr/include/g++/iterator.h OLD_FILES+=usr/include/g++/libio.h OLD_FILES+=usr/include/g++/libioP.h OLD_FILES+=usr/include/g++/list OLD_FILES+=usr/include/g++/list.h OLD_FILES+=usr/include/g++/map OLD_FILES+=usr/include/g++/map.h OLD_FILES+=usr/include/g++/memory OLD_FILES+=usr/include/g++/multimap.h OLD_FILES+=usr/include/g++/multiset.h OLD_FILES+=usr/include/g++/new OLD_FILES+=usr/include/g++/new.h OLD_FILES+=usr/include/g++/numeric OLD_FILES+=usr/include/g++/ostream.h OLD_FILES+=usr/include/g++/pair.h OLD_FILES+=usr/include/g++/parsestream.h OLD_FILES+=usr/include/g++/pfstream.h OLD_FILES+=usr/include/g++/procbuf.h OLD_FILES+=usr/include/g++/pthread_alloc OLD_FILES+=usr/include/g++/pthread_alloc.h OLD_FILES+=usr/include/g++/queue OLD_FILES+=usr/include/g++/rope OLD_FILES+=usr/include/g++/rope.h OLD_FILES+=usr/include/g++/ropeimpl.h OLD_FILES+=usr/include/g++/set OLD_FILES+=usr/include/g++/set.h OLD_FILES+=usr/include/g++/slist OLD_FILES+=usr/include/g++/slist.h OLD_FILES+=usr/include/g++/sstream OLD_FILES+=usr/include/g++/stack OLD_FILES+=usr/include/g++/stack.h OLD_FILES+=usr/include/g++/std/bastring.cc OLD_FILES+=usr/include/g++/std/bastring.h OLD_FILES+=usr/include/g++/std/complext.cc OLD_FILES+=usr/include/g++/std/complext.h OLD_FILES+=usr/include/g++/std/dcomplex.h OLD_FILES+=usr/include/g++/std/fcomplex.h OLD_FILES+=usr/include/g++/std/gslice.h OLD_FILES+=usr/include/g++/std/gslice_array.h OLD_FILES+=usr/include/g++/std/indirect_array.h OLD_FILES+=usr/include/g++/std/ldcomplex.h OLD_FILES+=usr/include/g++/std/mask_array.h OLD_FILES+=usr/include/g++/std/slice.h OLD_FILES+=usr/include/g++/std/slice_array.h OLD_FILES+=usr/include/g++/std/std_valarray.h OLD_FILES+=usr/include/g++/std/straits.h OLD_FILES+=usr/include/g++/std/valarray_array.h OLD_FILES+=usr/include/g++/std/valarray_array.tcc OLD_FILES+=usr/include/g++/std/valarray_meta.h OLD_FILES+=usr/include/g++/stdexcept OLD_FILES+=usr/include/g++/stdiostream.h OLD_FILES+=usr/include/g++/stl.h OLD_FILES+=usr/include/g++/stl_algo.h OLD_FILES+=usr/include/g++/stl_algobase.h OLD_FILES+=usr/include/g++/stl_alloc.h OLD_FILES+=usr/include/g++/stl_bvector.h OLD_FILES+=usr/include/g++/stl_config.h OLD_FILES+=usr/include/g++/stl_construct.h OLD_FILES+=usr/include/g++/stl_deque.h OLD_FILES+=usr/include/g++/stl_function.h OLD_FILES+=usr/include/g++/stl_hash_fun.h OLD_FILES+=usr/include/g++/stl_hash_map.h OLD_FILES+=usr/include/g++/stl_hash_set.h OLD_FILES+=usr/include/g++/stl_hashtable.h OLD_FILES+=usr/include/g++/stl_heap.h OLD_FILES+=usr/include/g++/stl_iterator.h OLD_FILES+=usr/include/g++/stl_list.h OLD_FILES+=usr/include/g++/stl_map.h OLD_FILES+=usr/include/g++/stl_multimap.h OLD_FILES+=usr/include/g++/stl_multiset.h OLD_FILES+=usr/include/g++/stl_numeric.h OLD_FILES+=usr/include/g++/stl_pair.h OLD_FILES+=usr/include/g++/stl_queue.h OLD_FILES+=usr/include/g++/stl_raw_storage_iter.h OLD_FILES+=usr/include/g++/stl_relops.h OLD_FILES+=usr/include/g++/stl_rope.h OLD_FILES+=usr/include/g++/stl_set.h OLD_FILES+=usr/include/g++/stl_slist.h OLD_FILES+=usr/include/g++/stl_stack.h OLD_FILES+=usr/include/g++/stl_tempbuf.h OLD_FILES+=usr/include/g++/stl_tree.h OLD_FILES+=usr/include/g++/stl_uninitialized.h OLD_FILES+=usr/include/g++/stl_vector.h OLD_FILES+=usr/include/g++/stream.h OLD_FILES+=usr/include/g++/streambuf.h OLD_FILES+=usr/include/g++/strfile.h OLD_FILES+=usr/include/g++/string OLD_FILES+=usr/include/g++/strstream OLD_FILES+=usr/include/g++/strstream.h OLD_FILES+=usr/include/g++/tempbuf.h OLD_FILES+=usr/include/g++/tree.h OLD_FILES+=usr/include/g++/type_traits.h OLD_FILES+=usr/include/g++/typeinfo OLD_FILES+=usr/include/g++/utility OLD_FILES+=usr/include/g++/valarray OLD_FILES+=usr/include/g++/vector OLD_FILES+=usr/include/g++/vector.h OLD_FILES+=usr/include/gmp.h OLD_FILES+=usr/include/isc/assertions.h OLD_FILES+=usr/include/isc/ctl.h OLD_FILES+=usr/include/isc/dst.h OLD_FILES+=usr/include/isc/eventlib.h OLD_FILES+=usr/include/isc/heap.h OLD_FILES+=usr/include/isc/irpmarshall.h OLD_FILES+=usr/include/isc/list.h OLD_FILES+=usr/include/isc/logging.h OLD_FILES+=usr/include/isc/memcluster.h OLD_FILES+=usr/include/isc/misc.h OLD_FILES+=usr/include/isc/tree.h OLD_FILES+=usr/include/machine/ansi.h OLD_FILES+=usr/include/machine/apic.h OLD_FILES+=usr/include/machine/asc_ioctl.h OLD_FILES+=usr/include/machine/asnames.h OLD_FILES+=usr/include/machine/bus_at386.h OLD_FILES+=usr/include/machine/bus_memio.h OLD_FILES+=usr/include/machine/bus_pc98.h OLD_FILES+=usr/include/machine/bus_pio.h OLD_FILES+=usr/include/machine/cdk.h OLD_FILES+=usr/include/machine/comstats.h OLD_FILES+=usr/include/machine/console.h OLD_FILES+=usr/include/machine/critical.h OLD_FILES+=usr/include/machine/cronyx.h OLD_FILES+=usr/include/machine/dvcfg.h OLD_FILES+=usr/include/machine/globaldata.h OLD_FILES+=usr/include/machine/globals.h OLD_FILES+=usr/include/machine/gsc.h OLD_FILES+=usr/include/machine/i4b_isppp.h OLD_FILES+=usr/include/machine/if_wavelan_ieee.h OLD_FILES+=usr/include/machine/iic.h OLD_FILES+=usr/include/machine/ioctl_ctx.h OLD_FILES+=usr/include/machine/ioctl_fd.h OLD_FILES+=usr/include/machine/ipl.h OLD_FILES+=usr/include/machine/lock.h OLD_FILES+=usr/include/machine/mouse.h OLD_FILES+=usr/include/machine/mpapic.h OLD_FILES+=usr/include/machine/mtpr.h OLD_FILES+=usr/include/machine/pc/msdos.h OLD_FILES+=usr/include/machine/physio_proc.h OLD_FILES+=usr/include/machine/smb.h OLD_FILES+=usr/include/machine/spigot.h OLD_FILES+=usr/include/machine/types.h OLD_FILES+=usr/include/machine/uc_device.h OLD_FILES+=usr/include/machine/ultrasound.h OLD_FILES+=usr/include/machine/wtio.h OLD_FILES+=usr/include/msdosfs/bootsect.h OLD_FILES+=usr/include/msdosfs/bpb.h OLD_FILES+=usr/include/msdosfs/denode.h OLD_FILES+=usr/include/msdosfs/direntry.h OLD_FILES+=usr/include/msdosfs/fat.h OLD_FILES+=usr/include/msdosfs/msdosfsmount.h OLD_FILES+=usr/include/net/hostcache.h OLD_FILES+=usr/include/net/if_faith.h OLD_FILES+=usr/include/net/if_ieee80211.h OLD_FILES+=usr/include/net/if_tunvar.h OLD_FILES+=usr/include/net/intrq.h OLD_FILES+=usr/include/netatm/kern_include.h OLD_FILES+=usr/include/netinet/if_fddi.h OLD_FILES+=usr/include/netinet/in_hostcache.h OLD_FILES+=usr/include/netinet/ip_flow.h OLD_FILES+=usr/include/netinet/ip_fw2.h OLD_FILES+=usr/include/netinet6/in6_prefix.h OLD_FILES+=usr/include/netns/idp.h OLD_FILES+=usr/include/netns/idp_var.h OLD_FILES+=usr/include/netns/ns.h OLD_FILES+=usr/include/netns/ns_error.h OLD_FILES+=usr/include/netns/ns_if.h OLD_FILES+=usr/include/netns/ns_pcb.h OLD_FILES+=usr/include/netns/sp.h OLD_FILES+=usr/include/netns/spidp.h OLD_FILES+=usr/include/netns/spp_debug.h OLD_FILES+=usr/include/netns/spp_timer.h OLD_FILES+=usr/include/netns/spp_var.h OLD_FILES+=usr/include/nfs/nfs.h OLD_FILES+=usr/include/nfs/nfsm_subs.h OLD_FILES+=usr/include/nfs/nfsmount.h OLD_FILES+=usr/include/nfs/nfsnode.h OLD_FILES+=usr/include/nfs/nfsrtt.h OLD_FILES+=usr/include/nfs/nfsrvcache.h OLD_FILES+=usr/include/nfs/nfsv2.h OLD_FILES+=usr/include/nfs/nqnfs.h OLD_FILES+=usr/include/ntfs/ntfs.h OLD_FILES+=usr/include/ntfs/ntfs_compr.h OLD_FILES+=usr/include/ntfs/ntfs_ihash.h OLD_FILES+=usr/include/ntfs/ntfs_inode.h OLD_FILES+=usr/include/ntfs/ntfs_subr.h OLD_FILES+=usr/include/ntfs/ntfs_vfsops.h OLD_FILES+=usr/include/ntfs/ntfsmount.h OLD_FILES+=usr/include/nwfs/nwfs.h OLD_FILES+=usr/include/nwfs/nwfs_mount.h OLD_FILES+=usr/include/nwfs/nwfs_node.h OLD_FILES+=usr/include/nwfs/nwfs_subr.h OLD_FILES+=usr/include/posix4/_semaphore.h OLD_FILES+=usr/include/posix4/aio.h OLD_FILES+=usr/include/posix4/ksem.h OLD_FILES+=usr/include/posix4/mqueue.h OLD_FILES+=usr/include/posix4/posix4.h OLD_FILES+=usr/include/posix4/sched.h OLD_FILES+=usr/include/posix4/semaphore.h OLD_DIRS+=usr/include/posix4 OLD_FILES+=usr/include/security/_pam_compat.h OLD_FILES+=usr/include/security/_pam_macros.h OLD_FILES+=usr/include/security/_pam_types.h OLD_FILES+=usr/include/security/pam_malloc.h OLD_FILES+=usr/include/security/pam_misc.h OLD_FILES+=usr/include/skey.h OLD_FILES+=usr/include/strhash.h OLD_FILES+=usr/include/struct.h OLD_FILES+=usr/include/sys/_label.h OLD_FILES+=usr/include/sys/_posix.h OLD_FILES+=usr/include/sys/bus_private.h OLD_FILES+=usr/include/sys/ccdvar.h OLD_FILES+=usr/include/sys/diskslice.h OLD_FILES+=usr/include/sys/dmap.h OLD_FILES+=usr/include/sys/inttypes.h OLD_FILES+=usr/include/sys/jumbo.h OLD_FILES+=usr/include/sys/mac_policy.h OLD_FILES+=usr/include/sys/pbioio.h OLD_FILES+=usr/include/sys/syscall-hide.h OLD_FILES+=usr/include/sys/tprintf.h OLD_FILES+=usr/include/sys/vnioctl.h OLD_FILES+=usr/include/sys/wormio.h OLD_FILES+=usr/include/telnet.h OLD_FILES+=usr/include/ufs/mfs/mfs_extern.h OLD_FILES+=usr/include/ufs/mfs/mfsnode.h OLD_FILES+=usr/include/values.h OLD_FILES+=usr/include/vm/vm_zone.h OLD_FILES+=usr/share/examples/etc/usbd.conf OLD_FILES+=usr/share/examples/meteor/README OLD_FILES+=usr/share/examples/meteor/rgb16.c OLD_FILES+=usr/share/examples/meteor/rgb24.c OLD_FILES+=usr/share/examples/meteor/test-n.c OLD_FILES+=usr/share/examples/meteor/yuvpk.c OLD_FILES+=usr/share/examples/meteor/yuvpl.c OLD_FILES+=usr/share/examples/worm/README OLD_FILES+=usr/share/examples/worm/makecdfs.sh OLD_FILES+=usr/share/groff_font/devlj4/Makefile OLD_FILES+=usr/share/groff_font/devlj4/text.map OLD_FILES+=usr/share/groff_font/devlj4/special.map OLD_FILES+=usr/share/misc/nslookup.help OLD_FILES+=usr/share/sendmail/cf/feature/nodns.m4 OLD_FILES+=usr/share/syscons/keymaps/lat-amer.kbd OLD_FILES+=usr/share/vi/catalog/ru_SU.KOI8-R OLD_FILES+=usr/share/zoneinfo/Africa/Timbuktu OLD_FILES+=usr/share/zoneinfo/Africa/Asmera OLD_FILES+=usr/share/zoneinfo/America/Buenos_Aires OLD_FILES+=usr/share/zoneinfo/America/Cordoba OLD_FILES+=usr/share/zoneinfo/America/Jujuy OLD_FILES+=usr/share/zoneinfo/America/Catamarca OLD_FILES+=usr/share/zoneinfo/America/Mendoza OLD_FILES+=usr/share/zoneinfo/America/Indianapolis OLD_FILES+=usr/share/zoneinfo/America/Louisville OLD_FILES+=usr/share/zoneinfo/America/Argentina/ComodRivadavia OLD_FILES+=usr/share/zoneinfo/Atlantic/Faeroe OLD_FILES+=usr/share/zoneinfo/Europe/Belfast OLD_FILES+=usr/share/zoneinfo/Pacific/Yap OLD_FILES+=usr/share/zoneinfo/SystemV/YST9 OLD_FILES+=usr/share/zoneinfo/SystemV/PST8 OLD_FILES+=usr/share/zoneinfo/SystemV/EST5EDT OLD_FILES+=usr/share/zoneinfo/SystemV/CST6CDT OLD_FILES+=usr/share/zoneinfo/SystemV/MST7MDT OLD_FILES+=usr/share/zoneinfo/SystemV/PST8PDT OLD_FILES+=usr/share/zoneinfo/SystemV/YST9YDT OLD_FILES+=usr/share/zoneinfo/SystemV/HST10 OLD_FILES+=usr/share/zoneinfo/SystemV/MST7 OLD_FILES+=usr/share/zoneinfo/SystemV/EST5 OLD_FILES+=usr/share/zoneinfo/SystemV/AST4ADT OLD_FILES+=usr/share/zoneinfo/SystemV/CST6 OLD_FILES+=usr/share/zoneinfo/SystemV/AST4 OLD_FILES+=usr/share/doc/ntp/accopt.htm OLD_FILES+=usr/share/doc/ntp/assoc.htm OLD_FILES+=usr/share/doc/ntp/audio.htm OLD_FILES+=usr/share/doc/ntp/authopt.htm OLD_FILES+=usr/share/doc/ntp/biblio.htm OLD_FILES+=usr/share/doc/ntp/build.htm OLD_FILES+=usr/share/doc/ntp/clockopt.htm OLD_FILES+=usr/share/doc/ntp/config.htm OLD_FILES+=usr/share/doc/ntp/confopt.htm OLD_FILES+=usr/share/doc/ntp/copyright.htm OLD_FILES+=usr/share/doc/ntp/debug.htm OLD_FILES+=usr/share/doc/ntp/driver1.htm OLD_FILES+=usr/share/doc/ntp/driver10.htm OLD_FILES+=usr/share/doc/ntp/driver11.htm OLD_FILES+=usr/share/doc/ntp/driver12.htm OLD_FILES+=usr/share/doc/ntp/driver16.htm OLD_FILES+=usr/share/doc/ntp/driver18.htm OLD_FILES+=usr/share/doc/ntp/driver19.htm OLD_FILES+=usr/share/doc/ntp/driver2.htm OLD_FILES+=usr/share/doc/ntp/driver20.htm OLD_FILES+=usr/share/doc/ntp/driver22.htm OLD_FILES+=usr/share/doc/ntp/driver23.htm OLD_FILES+=usr/share/doc/ntp/driver24.htm OLD_FILES+=usr/share/doc/ntp/driver26.htm OLD_FILES+=usr/share/doc/ntp/driver27.htm OLD_FILES+=usr/share/doc/ntp/driver28.htm OLD_FILES+=usr/share/doc/ntp/driver29.htm OLD_FILES+=usr/share/doc/ntp/driver3.htm OLD_FILES+=usr/share/doc/ntp/driver30.htm OLD_FILES+=usr/share/doc/ntp/driver32.htm OLD_FILES+=usr/share/doc/ntp/driver33.htm OLD_FILES+=usr/share/doc/ntp/driver34.htm OLD_FILES+=usr/share/doc/ntp/driver35.htm OLD_FILES+=usr/share/doc/ntp/driver36.htm OLD_FILES+=usr/share/doc/ntp/driver37.htm OLD_FILES+=usr/share/doc/ntp/driver4.htm OLD_FILES+=usr/share/doc/ntp/driver5.htm OLD_FILES+=usr/share/doc/ntp/driver6.htm OLD_FILES+=usr/share/doc/ntp/driver7.htm OLD_FILES+=usr/share/doc/ntp/driver8.htm OLD_FILES+=usr/share/doc/ntp/driver9.htm OLD_FILES+=usr/share/doc/ntp/exec.htm OLD_FILES+=usr/share/doc/ntp/extern.htm OLD_FILES+=usr/share/doc/ntp/gadget.htm OLD_FILES+=usr/share/doc/ntp/hints.htm OLD_FILES+=usr/share/doc/ntp/howto.htm OLD_FILES+=usr/share/doc/ntp/htmlprimer.htm OLD_FILES+=usr/share/doc/ntp/index.htm OLD_FILES+=usr/share/doc/ntp/kern.htm OLD_FILES+=usr/share/doc/ntp/kernpps.htm OLD_FILES+=usr/share/doc/ntp/ldisc.htm OLD_FILES+=usr/share/doc/ntp/measure.htm OLD_FILES+=usr/share/doc/ntp/miscopt.htm OLD_FILES+=usr/share/doc/ntp/monopt.htm OLD_FILES+=usr/share/doc/ntp/mx4200data.htm OLD_FILES+=usr/share/doc/ntp/notes.htm OLD_FILES+=usr/share/doc/ntp/ntpd.htm OLD_FILES+=usr/share/doc/ntp/ntpdate.htm OLD_FILES+=usr/share/doc/ntp/ntpdc.htm OLD_FILES+=usr/share/doc/ntp/ntpq.htm OLD_FILES+=usr/share/doc/ntp/ntptime.htm OLD_FILES+=usr/share/doc/ntp/ntptrace.htm OLD_FILES+=usr/share/doc/ntp/parsedata.htm OLD_FILES+=usr/share/doc/ntp/parsenew.htm OLD_FILES+=usr/share/doc/ntp/patches.htm OLD_FILES+=usr/share/doc/ntp/porting.htm OLD_FILES+=usr/share/doc/ntp/pps.htm OLD_FILES+=usr/share/doc/ntp/prefer.htm OLD_FILES+=usr/share/doc/ntp/qth.htm OLD_FILES+=usr/share/doc/ntp/quick.htm OLD_FILES+=usr/share/doc/ntp/rdebug.htm OLD_FILES+=usr/share/doc/ntp/refclock.htm OLD_FILES+=usr/share/doc/ntp/release.htm OLD_FILES+=usr/share/doc/ntp/tickadj.htm OLD_FILES+=usr/share/doc/papers/nqnfs.ascii.gz OLD_FILES+=usr/share/doc/papers/px.ascii.gz OLD_FILES+=usr/share/man/man3/exp10.3.gz OLD_FILES+=usr/share/man/man3/exp10f.3.gz OLD_FILES+=usr/share/man/man3/fpsetsticky.3.gz OLD_FILES+=usr/share/man/man3/gss_krb5_compat_des3_mic.3.gz OLD_FILES+=usr/share/man/man3/gss_krb5_copy_ccache.3.gz OLD_FILES+=usr/share/man/man3/mac_is_present_np.3.gz OLD_FILES+=usr/share/man/man3/mbmb.3.gz OLD_FILES+=usr/share/man/man3/setrunelocale.3.gz OLD_FILES+=usr/share/man/man5/usbd.conf.5.gz .if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64" OLD_FILES+=usr/share/man/man8/boot_i386.8.gz .endif .if ${TARGET_ARCH} != "powerpc" && ${TARGET_ARCH} != "powerpc64" && ${TARGET_ARCH} != "sparc64" OLD_FILES+=usr/share/man/man8/ofwdump.8.gz .endif OLD_FILES+=usr/share/man/man8/mount_reiserfs.8.gz OLD_FILES+=usr/share/man/man9/VFS_START.9.gz OLD_FILES+=usr/share/man/man9/cpu_critical_exit.9.gz OLD_FILES+=usr/share/man/man9/cpu_critical_enter.9.gz OLD_FILES+=usr/share/info/annotate.info.gz OLD_FILES+=usr/share/info/tar.info.gz OLD_FILES+=usr/share/bsnmp/defs/tree.def OLD_FILES+=usr/share/bsnmp/defs/mibII_tree.def OLD_FILES+=usr/share/bsnmp/defs/netgraph_tree.def OLD_FILES+=usr/share/bsnmp/mibs/FOKUS-MIB.txt OLD_FILES+=usr/share/bsnmp/mibs/BEGEMOT-MIB.txt OLD_FILES+=usr/share/bsnmp/mibs/BEGEMOT-SNMPD.txt OLD_FILES+=usr/share/bsnmp/mibs/BEGEMOT-NETGRAPH.txt OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.x OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xbn OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xn OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xr OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xs OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xu OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xc OLD_FILES+=usr/libdata/ldscripts/elf64_sparc.xsc OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.x OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xbn OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xn OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xr OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xs OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xu OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xc OLD_FILES+=usr/libdata/ldscripts/elf32_sparc.xsc OLD_FILES+=usr/libdata/msdosfs/iso22dos OLD_FILES+=usr/libdata/msdosfs/iso72dos OLD_FILES+=usr/libdata/msdosfs/koi2dos OLD_FILES+=usr/libdata/msdosfs/koi8u2dos # The following files are *not* obsolete, they just don't get touched at # install, so don't add them: # - boot/loader.rc # - usr/share/tmac/man.local # - usr/share/tmac/mm/locale # - usr/share/tmac/mm/se_locale # - var/yp/Makefile # 20071120: shared library version bump OLD_LIBS+=usr/lib/libasn1.so.8 OLD_LIBS+=usr/lib/libgssapi.so.8 OLD_LIBS+=usr/lib/libgssapi_krb5.so.8 OLD_LIBS+=usr/lib/libhdb.so.8 OLD_LIBS+=usr/lib/libkadm5clnt.so.8 OLD_LIBS+=usr/lib/libkadm5srv.so.8 OLD_LIBS+=usr/lib/libkafs5.so.8 OLD_LIBS+=usr/lib/libkrb5.so.8 OLD_LIBS+=usr/lib/libobjc.so.2 OLD_LIBS+=usr/lib32/libgssapi.so.8 OLD_LIBS+=usr/lib32/libobjc.so.2 # 20070519: GCC 4.2 OLD_LIBS+=usr/lib/libg2c.a OLD_LIBS+=usr/lib/libg2c.so OLD_LIBS+=usr/lib/libg2c.so.2 OLD_LIBS+=usr/lib/libg2c_p.a OLD_LIBS+=usr/lib/libgcc_pic.a OLD_LIBS+=usr/lib32/libg2c.a OLD_LIBS+=usr/lib32/libg2c.so OLD_LIBS+=usr/lib32/libg2c.so.2 OLD_LIBS+=usr/lib32/libg2c_p.a OLD_LIBS+=usr/lib32/libgcc_pic.a # 20060729: OpenSSL 0.9.7e -> 0.9.8b upgrade OLD_LIBS+=lib/libcrypto.so.4 OLD_LIBS+=usr/lib/libssl.so.4 OLD_LIBS+=usr/lib32/libcrypto.so.4 OLD_LIBS+=usr/lib32/libssl.so.4 # 20060521: gethostbyaddr(3) ABI change OLD_LIBS+=usr/lib/libroken.so.8 OLD_LIBS+=lib/libatm.so.3 OLD_LIBS+=lib/libc.so.6 OLD_LIBS+=lib/libutil.so.5 OLD_LIBS+=usr/lib32/libatm.so.3 OLD_LIBS+=usr/lib32/libc.so.6 OLD_LIBS+=usr/lib32/libutil.so.5 # 20060413: shared library moved to /usr/lib OLD_LIBS+=lib/libgpib.so.1 # 20060413: libpcap.so.4 moved to /lib/ OLD_LIBS+=usr/lib/libpcap.so.4 # 20060412: libpthread.so.2 moved to /lib/ OLD_LIBS+=usr/lib/libpthread.so.2 # 20060127: revert libdisk to static-only OLD_LIBS+=usr/lib/libdisk.so.3 # 20051027: libc_r discontinued (removed 20101113) OLD_LIBS+=usr/lib/libc_r.a OLD_LIBS+=usr/lib/libc_r.so OLD_LIBS+=usr/lib/libc_r.so.7 OLD_LIBS+=usr/lib/libc_r_p.a OLD_LIBS+=usr/lib32/libc_r.a OLD_LIBS+=usr/lib32/libc_r.so OLD_LIBS+=usr/lib32/libc_r.so.7 OLD_LIBS+=usr/lib32/libc_r_p.a # 20050722: bump for 6.0-RELEASE OLD_LIBS+=lib/libalias.so.4 OLD_LIBS+=lib/libatm.so.2 OLD_LIBS+=lib/libbegemot.so.1 OLD_LIBS+=lib/libbsdxml.so.1 OLD_LIBS+=lib/libbsnmp.so.2 OLD_LIBS+=lib/libc.so.5 OLD_LIBS+=lib/libcam.so.2 OLD_LIBS+=lib/libcrypt.so.2 OLD_LIBS+=lib/libcrypto.so.3 OLD_LIBS+=lib/libdevstat.so.4 OLD_LIBS+=lib/libedit.so.4 OLD_LIBS+=lib/libgeom.so.2 OLD_LIBS+=lib/libgpib.so.0 OLD_LIBS+=lib/libipsec.so.1 OLD_LIBS+=lib/libipx.so.2 OLD_LIBS+=lib/libkiconv.so.1 OLD_LIBS+=lib/libkvm.so.2 OLD_LIBS+=lib/libm.so.3 OLD_LIBS+=lib/libmd.so.2 OLD_LIBS+=lib/libncurses.so.5 OLD_LIBS+=lib/libreadline.so.5 OLD_LIBS+=lib/libsbuf.so.2 OLD_LIBS+=lib/libufs.so.2 OLD_LIBS+=lib/libutil.so.4 OLD_LIBS+=lib/libz.so.2 OLD_LIBS+=usr/lib/libarchive.so.1 OLD_LIBS+=usr/lib/libasn1.so.7 OLD_LIBS+=usr/lib/libbluetooth.so.1 OLD_LIBS+=usr/lib/libbz2.so.1 OLD_LIBS+=usr/lib/libc_r.so.5 OLD_LIBS+=usr/lib/libcalendar.so.2 OLD_LIBS+=usr/lib/libcom_err.so.2 OLD_LIBS+=usr/lib/libdevinfo.so.2 OLD_LIBS+=usr/lib/libdialog.so.4 OLD_LIBS+=usr/lib/libfetch.so.3 OLD_LIBS+=usr/lib/libform.so.2 OLD_LIBS+=usr/lib/libftpio.so.5 OLD_LIBS+=usr/lib/libg2c.so.1 OLD_LIBS+=usr/lib/libgnuregex.so.2 OLD_LIBS+=usr/lib/libgssapi.so.7 OLD_LIBS+=usr/lib/libhdb.so.7 OLD_LIBS+=usr/lib/libhistory.so.5 OLD_LIBS+=usr/lib/libkadm5clnt.so.7 OLD_LIBS+=usr/lib/libkadm5srv.so.7 OLD_LIBS+=usr/lib/libkafs5.so.7 OLD_LIBS+=usr/lib/libkrb5.so.7 OLD_LIBS+=usr/lib/libmagic.so.1 OLD_LIBS+=usr/lib/libmenu.so.2 OLD_LIBS+=usr/lib/libmilter.so.2 OLD_LIBS+=usr/lib/libmp.so.4 OLD_LIBS+=usr/lib/libncp.so.1 OLD_LIBS+=usr/lib/libnetgraph.so.1 OLD_LIBS+=usr/lib/libngatm.so.1 OLD_LIBS+=usr/lib/libobjc.so.1 OLD_LIBS+=usr/lib/libopie.so.3 OLD_LIBS+=usr/lib/libpam.so.2 OLD_LIBS+=usr/lib/libpanel.so.2 OLD_LIBS+=usr/lib/libpcap.so.3 OLD_LIBS+=usr/lib/libpmc.so.2 OLD_LIBS+=usr/lib/libpthread.so.1 OLD_LIBS+=usr/lib/libradius.so.1 OLD_LIBS+=usr/lib/libroken.so.7 OLD_LIBS+=usr/lib/librpcsvc.so.2 OLD_LIBS+=usr/lib/libsdp.so.1 OLD_LIBS+=usr/lib/libsmb.so.1 OLD_LIBS+=usr/lib/libssh.so.2 OLD_LIBS+=usr/lib/libssl.so.3 OLD_LIBS+=usr/lib/libstdc++.so.4 OLD_LIBS+=usr/lib/libtacplus.so.1 OLD_LIBS+=usr/lib/libthr.so.1 OLD_LIBS+=usr/lib/libthread_db.so.1 OLD_LIBS+=usr/lib/libugidfw.so.1 OLD_LIBS+=usr/lib/libusbhid.so.1 OLD_LIBS+=usr/lib/libvgl.so.3 OLD_LIBS+=usr/lib/libwrap.so.3 OLD_LIBS+=usr/lib/libypclnt.so.1 OLD_LIBS+=usr/lib/pam_chroot.so.2 OLD_LIBS+=usr/lib/pam_deny.so.2 OLD_LIBS+=usr/lib/pam_echo.so.2 OLD_LIBS+=usr/lib/pam_exec.so.2 OLD_LIBS+=usr/lib/pam_ftpusers.so.2 OLD_LIBS+=usr/lib/pam_group.so.2 OLD_LIBS+=usr/lib/pam_guest.so.2 OLD_LIBS+=usr/lib/pam_krb5.so.2 OLD_LIBS+=usr/lib/pam_ksu.so.2 OLD_LIBS+=usr/lib/pam_lastlog.so.2 OLD_LIBS+=usr/lib/pam_login_access.so.2 OLD_LIBS+=usr/lib/pam_nologin.so.2 OLD_LIBS+=usr/lib/pam_opie.so.2 OLD_LIBS+=usr/lib/pam_opieaccess.so.2 OLD_LIBS+=usr/lib/pam_passwdqc.so.2 OLD_LIBS+=usr/lib/pam_permit.so.2 OLD_LIBS+=usr/lib/pam_radius.so.2 OLD_LIBS+=usr/lib/pam_rhosts.so.2 OLD_LIBS+=usr/lib/pam_rootok.so.2 OLD_LIBS+=usr/lib/pam_securetty.so.2 OLD_LIBS+=usr/lib/pam_self.so.2 OLD_LIBS+=usr/lib/pam_ssh.so.2 OLD_LIBS+=usr/lib/pam_tacplus.so.2 OLD_LIBS+=usr/lib/pam_unix.so.2 OLD_LIBS+=usr/lib/snmp_atm.so.3 OLD_LIBS+=usr/lib/snmp_mibII.so.3 OLD_LIBS+=usr/lib/snmp_netgraph.so.3 OLD_LIBS+=usr/lib/snmp_pf.so.3 # 200505XX: ? OLD_LIBS+=usr/lib/snmp_atm.so.2 OLD_LIBS+=usr/lib/snmp_mibII.so.2 OLD_LIBS+=usr/lib/snmp_netgraph.so.2 OLD_LIBS+=usr/lib/snmp_pf.so.2 # 2005XXXX: not ready for primetime yet OLD_LIBS+=usr/lib/libautofs.so.1 # 200411XX: libxpg4 removal OLD_LIBS+=usr/lib/libxpg4.so.3 # 200410XX: libm compatibility fix OLD_LIBS+=lib/libm.so.2 # 20041001: version bump OLD_LIBS+=lib/libreadline.so.4 OLD_LIBS+=usr/lib/libhistory.so.4 OLD_LIBS+=usr/lib/libopie.so.2 OLD_LIBS+=usr/lib/libpcap.so.2 # 20040925: bind9 import OLD_LIBS+=usr/lib/libisc.so.1 # 200408XX OLD_LIBS+=usr/lib/snmp_netgraph.so.1 # 200404XX OLD_LIBS+=usr/lib/libsnmp.so.1 OLD_LIBS+=usr/lib/snmp_mibII.so.1 # 200309XX OLD_LIBS+=usr/lib/libasn1.so.6 OLD_LIBS+=usr/lib/libhdb.so.6 OLD_LIBS+=usr/lib/libkadm5clnt.so.6 OLD_LIBS+=usr/lib/libkadm5srv.so.6 OLD_LIBS+=usr/lib/libkrb5.so.6 OLD_LIBS+=usr/lib/libroken.so.6 # 200304XX OLD_LIBS+=usr/lib/libc.so.4 OLD_LIBS+=usr/lib/libc_r.so.4 OLD_LIBS+=usr/lib/libdevstat.so.2 OLD_LIBS+=usr/lib/libedit.so.3 OLD_LIBS+=usr/lib/libgmp.so.3 OLD_LIBS+=usr/lib/libmp.so.3 OLD_LIBS+=usr/lib/libpam.so.1 OLD_LIBS+=usr/lib/libposix1e.so.2 OLD_LIBS+=usr/lib/libskey.so.2 OLD_LIBS+=usr/lib/libusbhid.so.0 OLD_LIBS+=usr/lib/libvgl.so.2 # 200302XX OLD_LIBS+=usr/lib/libacl.so.3 OLD_LIBS+=usr/lib/libasn1.so.5 OLD_LIBS+=usr/lib/libcrypto.so.2 OLD_LIBS+=usr/lib/libgssapi.so.5 OLD_LIBS+=usr/lib/libhdb.so.5 OLD_LIBS+=usr/lib/libkadm.so.3 OLD_LIBS+=usr/lib/libkadm5clnt.so.5 OLD_LIBS+=usr/lib/libkadm5srv.so.5 OLD_LIBS+=usr/lib/libkafs.so.3 OLD_LIBS+=usr/lib/libkafs5.so.5 OLD_LIBS+=usr/lib/libkdb.so.3 OLD_LIBS+=usr/lib/libkrb.so.3 OLD_LIBS+=usr/lib/libroken.so. OLD_LIBS+=usr/lib/libssl.so.2 OLD_LIBS+=usr/lib/pam_kerberosIV.so # 200208XX OLD_LIBS+=usr/lib/libgssapi.so.4 # 200203XX OLD_LIBS+=usr/lib/libss.so.3 OLD_LIBS+=usr/lib/libusb.so.0 # 200112XX OLD_LIBS+=usr/lib/libfetch.so.2 # 200110XX OLD_LIBS+=usr/lib/libgssapi.so.3 # 200104XX OLD_LIBS+=usr/lib/libdescrypt.so.2 OLD_LIBS+=usr/lib/libscrypt.so.2 # 200102XX OLD_LIBS+=usr/lib/libcrypto.so.1 OLD_LIBS+=usr/lib/libssl.so.1 # 200009XX OLD_LIBS+=usr/lib/libRSAglue.so.1 OLD_LIBS+=usr/lib/librsaINTL.so.1 OLD_LIBS+=usr/lib/librsaUSA.so.1 # 200006XX OLD_LIBS+=usr/lib/libalias.so.3 OLD_LIBS+=usr/lib/libfetch.so.1 OLD_LIBS+=usr/lib/libipsec.so.0 # 200005XX OLD_LIBS+=usr/lib/libxpg4.so.2 # 200002XX OLD_LIBS+=usr/lib/libc.so.3 OLD_LIBS+=usr/lib/libcurses.so.2 OLD_LIBS+=usr/lib/libdialog.so.3 OLD_LIBS+=usr/lib/libedit.so.2 OLD_LIBS+=usr/lib/libf2c.so.2 OLD_LIBS+=usr/lib/libftpio.so.4 OLD_LIBS+=usr/lib/libg++.so.4 OLD_LIBS+=usr/lib/libhistory.so.3 OLD_LIBS+=usr/lib/libmytinfo.so.2 OLD_LIBS+=usr/lib/libncurses.so.3 OLD_LIBS+=usr/lib/libreadline.so.3 OLD_LIBS+=usr/lib/libss.so.2 OLD_LIBS+=usr/lib/libtermcap.so.2 OLD_LIBS+=usr/lib/libutil.so.2 OLD_LIBS+=usr/lib/libvgl.so.1 OLD_LIBS+=usr/lib/libwrap.so.2 # 199909XX OLD_LIBS+=usr/lib/libc_r.so.3 # ??? OLD_LIBS+=usr/lib/libarchive.so.2 OLD_LIBS+=usr/lib/libbsnmp.so.1 OLD_LIBS+=usr/lib/libc_r.so.6 OLD_LIBS+=usr/lib32/libarchive.so.2 OLD_LIBS+=usr/lib32/libc_r.so.6 OLD_LIBS+=usr/lib/libcipher.so.2 OLD_LIBS+=usr/lib/libgssapi.so.6 OLD_LIBS+=usr/lib/libkse.so.1 OLD_LIBS+=usr/lib/liblwres.so.3 OLD_LIBS+=usr/lib/pam_ftp.so.2 # 20131013: Removal of the ATF tools OLD_DIRS+=etc/atf OLD_DIRS+=usr/share/examples/atf OLD_DIRS+=usr/share/xml/atf OLD_DIRS+=usr/share/xml OLD_DIRS+=usr/share/xsl/atf OLD_DIRS+=usr/share/xsl # 20040925: bind9 import OLD_DIRS+=usr/share/doc/bind/html OLD_DIRS+=usr/share/doc/bind/misc OLD_DIRS+=usr/share/doc/bind/ # ??? OLD_DIRS+=usr/include/g++/std OLD_DIRS+=usr/include/msdosfs OLD_DIRS+=usr/include/ntfs OLD_DIRS+=usr/include/nwfs OLD_DIRS+=usr/include/ufs/mfs # 20011001: UUCP migration to ports OLD_DIRS+=usr/libexec/uucp .include "tools/build/mk/OptionalObsoleteFiles.inc" Index: projects/arm_intrng/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c =================================================================== --- projects/arm_intrng/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c (revision 276247) +++ projects/arm_intrng/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c (revision 276248) @@ -1,5543 +1,5609 @@ /* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2011 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011, 2014 by Delphix. All rights reserved. * Copyright (c) 2012 by Frederik Wessels. All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. * Copyright (c) 2013 by Prasad Joshi (sTec). All rights reserved. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "zpool_util.h" #include "zfs_comutil.h" #include "zfeature_common.h" #include "statcommon.h" static int zpool_do_create(int, char **); static int zpool_do_destroy(int, char **); static int zpool_do_add(int, char **); static int zpool_do_remove(int, char **); static int zpool_do_labelclear(int, char **); static int zpool_do_list(int, char **); static int zpool_do_iostat(int, char **); static int zpool_do_status(int, char **); static int zpool_do_online(int, char **); static int zpool_do_offline(int, char **); static int zpool_do_clear(int, char **); static int zpool_do_reopen(int, char **); static int zpool_do_reguid(int, char **); static int zpool_do_attach(int, char **); static int zpool_do_detach(int, char **); static int zpool_do_replace(int, char **); static int zpool_do_split(int, char **); static int zpool_do_scrub(int, char **); static int zpool_do_import(int, char **); static int zpool_do_export(int, char **); static int zpool_do_upgrade(int, char **); static int zpool_do_history(int, char **); static int zpool_do_get(int, char **); static int zpool_do_set(int, char **); /* * These libumem hooks provide a reasonable set of defaults for the allocator's * debugging facilities. */ #ifdef DEBUG const char * _umem_debug_init(void) { return ("default,verbose"); /* $UMEM_DEBUG setting */ } const char * _umem_logging_init(void) { return ("fail,contents"); /* $UMEM_LOGGING setting */ } #endif typedef enum { HELP_ADD, HELP_ATTACH, HELP_CLEAR, HELP_CREATE, HELP_DESTROY, HELP_DETACH, HELP_EXPORT, HELP_HISTORY, HELP_IMPORT, HELP_IOSTAT, HELP_LABELCLEAR, HELP_LIST, HELP_OFFLINE, HELP_ONLINE, HELP_REPLACE, HELP_REMOVE, HELP_SCRUB, HELP_STATUS, HELP_UPGRADE, HELP_GET, HELP_SET, HELP_SPLIT, HELP_REGUID, HELP_REOPEN } zpool_help_t; typedef struct zpool_command { const char *name; int (*func)(int, char **); zpool_help_t usage; } zpool_command_t; /* * Master command table. Each ZFS command has a name, associated function, and * usage message. The usage messages need to be internationalized, so we have * to have a function to return the usage message based on a command index. * * These commands are organized according to how they are displayed in the usage * message. An empty command (one with a NULL name) indicates an empty line in * the generic usage message. */ static zpool_command_t command_table[] = { { "create", zpool_do_create, HELP_CREATE }, { "destroy", zpool_do_destroy, HELP_DESTROY }, { NULL }, { "add", zpool_do_add, HELP_ADD }, { "remove", zpool_do_remove, HELP_REMOVE }, { NULL }, { "labelclear", zpool_do_labelclear, HELP_LABELCLEAR }, { NULL }, { "list", zpool_do_list, HELP_LIST }, { "iostat", zpool_do_iostat, HELP_IOSTAT }, { "status", zpool_do_status, HELP_STATUS }, { NULL }, { "online", zpool_do_online, HELP_ONLINE }, { "offline", zpool_do_offline, HELP_OFFLINE }, { "clear", zpool_do_clear, HELP_CLEAR }, { "reopen", zpool_do_reopen, HELP_REOPEN }, { NULL }, { "attach", zpool_do_attach, HELP_ATTACH }, { "detach", zpool_do_detach, HELP_DETACH }, { "replace", zpool_do_replace, HELP_REPLACE }, { "split", zpool_do_split, HELP_SPLIT }, { NULL }, { "scrub", zpool_do_scrub, HELP_SCRUB }, { NULL }, { "import", zpool_do_import, HELP_IMPORT }, { "export", zpool_do_export, HELP_EXPORT }, { "upgrade", zpool_do_upgrade, HELP_UPGRADE }, { "reguid", zpool_do_reguid, HELP_REGUID }, { NULL }, { "history", zpool_do_history, HELP_HISTORY }, { "get", zpool_do_get, HELP_GET }, { "set", zpool_do_set, HELP_SET }, }; #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) static zpool_command_t *current_command; static char history_str[HIS_MAX_RECORD_LEN]; static boolean_t log_history = B_TRUE; static uint_t timestamp_fmt = NODATE; static const char * get_usage(zpool_help_t idx) { switch (idx) { case HELP_ADD: return (gettext("\tadd [-fn] ...\n")); case HELP_ATTACH: return (gettext("\tattach [-f] " "\n")); case HELP_CLEAR: return (gettext("\tclear [-nF] [device]\n")); case HELP_CREATE: return (gettext("\tcreate [-fnd] [-o property=value] ... \n" "\t [-O file-system-property=value] ... \n" "\t [-m mountpoint] [-R root] ...\n")); case HELP_DESTROY: return (gettext("\tdestroy [-f] \n")); case HELP_DETACH: return (gettext("\tdetach \n")); case HELP_EXPORT: return (gettext("\texport [-f] ...\n")); case HELP_HISTORY: return (gettext("\thistory [-il] [] ...\n")); case HELP_IMPORT: return (gettext("\timport [-d dir] [-D]\n" "\timport [-d dir | -c cachefile] [-F [-n]] \n" "\timport [-o mntopts] [-o property=value] ... \n" "\t [-d dir | -c cachefile] [-D] [-f] [-m] [-N] " "[-R root] [-F [-n]] -a\n" "\timport [-o mntopts] [-o property=value] ... \n" "\t [-d dir | -c cachefile] [-D] [-f] [-m] [-N] " "[-R root] [-F [-n]]\n" "\t [newpool]\n")); case HELP_IOSTAT: return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval " "[count]]\n")); case HELP_LABELCLEAR: return (gettext("\tlabelclear [-f] \n")); case HELP_LIST: return (gettext("\tlist [-Hpv] [-o property[,...]] " "[-T d|u] [pool] ... [interval [count]]\n")); case HELP_OFFLINE: return (gettext("\toffline [-t] ...\n")); case HELP_ONLINE: return (gettext("\tonline [-e] ...\n")); case HELP_REPLACE: return (gettext("\treplace [-f] " "[new-device]\n")); case HELP_REMOVE: return (gettext("\tremove ...\n")); case HELP_REOPEN: return (gettext("\treopen \n")); case HELP_SCRUB: return (gettext("\tscrub [-s] ...\n")); case HELP_STATUS: return (gettext("\tstatus [-vx] [-T d|u] [pool] ... [interval " "[count]]\n")); case HELP_UPGRADE: return (gettext("\tupgrade [-v]\n" "\tupgrade [-V version] <-a | pool ...>\n")); case HELP_GET: return (gettext("\tget [-Hp] [-o \"all\" | field[,...]] " "<\"all\" | property[,...]> ...\n")); case HELP_SET: return (gettext("\tset \n")); case HELP_SPLIT: return (gettext("\tsplit [-n] [-R altroot] [-o mntopts]\n" "\t [-o property=value] " "[ ...]\n")); case HELP_REGUID: return (gettext("\treguid \n")); } abort(); /* NOTREACHED */ } /* * Callback routine that will print out a pool property value. */ static int print_prop_cb(int prop, void *cb) { FILE *fp = cb; (void) fprintf(fp, "\t%-15s ", zpool_prop_to_name(prop)); if (zpool_prop_readonly(prop)) (void) fprintf(fp, " NO "); else (void) fprintf(fp, " YES "); if (zpool_prop_values(prop) == NULL) (void) fprintf(fp, "-\n"); else (void) fprintf(fp, "%s\n", zpool_prop_values(prop)); return (ZPROP_CONT); } /* * Display usage message. If we're inside a command, display only the usage for * that command. Otherwise, iterate over the entire command table and display * a complete usage message. */ void usage(boolean_t requested) { FILE *fp = requested ? stdout : stderr; if (current_command == NULL) { int i; (void) fprintf(fp, gettext("usage: zpool command args ...\n")); (void) fprintf(fp, gettext("where 'command' is one of the following:\n\n")); for (i = 0; i < NCOMMAND; i++) { if (command_table[i].name == NULL) (void) fprintf(fp, "\n"); else (void) fprintf(fp, "%s", get_usage(command_table[i].usage)); } } else { (void) fprintf(fp, gettext("usage:\n")); (void) fprintf(fp, "%s", get_usage(current_command->usage)); } if (current_command != NULL && ((strcmp(current_command->name, "set") == 0) || (strcmp(current_command->name, "get") == 0) || (strcmp(current_command->name, "list") == 0))) { (void) fprintf(fp, gettext("\nthe following properties are supported:\n")); (void) fprintf(fp, "\n\t%-15s %s %s\n\n", "PROPERTY", "EDIT", "VALUES"); /* Iterate over all properties */ (void) zprop_iter(print_prop_cb, fp, B_FALSE, B_TRUE, ZFS_TYPE_POOL); (void) fprintf(fp, "\t%-15s ", "feature@..."); (void) fprintf(fp, "YES disabled | enabled | active\n"); (void) fprintf(fp, gettext("\nThe feature@ properties must be " "appended with a feature name.\nSee zpool-features(7).\n")); } /* * See comments at end of main(). */ if (getenv("ZFS_ABORT") != NULL) { (void) printf("dumping core by request\n"); abort(); } exit(requested ? 0 : 2); } void print_vdev_tree(zpool_handle_t *zhp, const char *name, nvlist_t *nv, int indent, boolean_t print_logs) { nvlist_t **child; uint_t c, children; char *vname; if (name != NULL) (void) printf("\t%*s%s\n", indent, "", name); if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) return; for (c = 0; c < children; c++) { uint64_t is_log = B_FALSE; (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, &is_log); if ((is_log && !print_logs) || (!is_log && print_logs)) continue; vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE); print_vdev_tree(zhp, vname, child[c], indent + 2, B_FALSE); free(vname); } } static boolean_t prop_list_contains_feature(nvlist_t *proplist) { nvpair_t *nvp; for (nvp = nvlist_next_nvpair(proplist, NULL); NULL != nvp; nvp = nvlist_next_nvpair(proplist, nvp)) { if (zpool_prop_feature(nvpair_name(nvp))) return (B_TRUE); } return (B_FALSE); } /* * Add a property pair (name, string-value) into a property nvlist. */ static int add_prop_list(const char *propname, char *propval, nvlist_t **props, boolean_t poolprop) { zpool_prop_t prop = ZPROP_INVAL; zfs_prop_t fprop; nvlist_t *proplist; const char *normnm; char *strval; if (*props == NULL && nvlist_alloc(props, NV_UNIQUE_NAME, 0) != 0) { (void) fprintf(stderr, gettext("internal error: out of memory\n")); return (1); } proplist = *props; if (poolprop) { const char *vname = zpool_prop_to_name(ZPOOL_PROP_VERSION); if ((prop = zpool_name_to_prop(propname)) == ZPROP_INVAL && !zpool_prop_feature(propname)) { (void) fprintf(stderr, gettext("property '%s' is " "not a valid pool property\n"), propname); return (2); } /* * feature@ properties and version should not be specified * at the same time. */ if ((prop == ZPROP_INVAL && zpool_prop_feature(propname) && nvlist_exists(proplist, vname)) || (prop == ZPOOL_PROP_VERSION && prop_list_contains_feature(proplist))) { (void) fprintf(stderr, gettext("'feature@' and " "'version' properties cannot be specified " "together\n")); return (2); } if (zpool_prop_feature(propname)) normnm = propname; else normnm = zpool_prop_to_name(prop); } else { if ((fprop = zfs_name_to_prop(propname)) != ZPROP_INVAL) { normnm = zfs_prop_to_name(fprop); } else { normnm = propname; } } if (nvlist_lookup_string(proplist, normnm, &strval) == 0 && prop != ZPOOL_PROP_CACHEFILE) { (void) fprintf(stderr, gettext("property '%s' " "specified multiple times\n"), propname); return (2); } if (nvlist_add_string(proplist, normnm, propval) != 0) { (void) fprintf(stderr, gettext("internal " "error: out of memory\n")); return (1); } return (0); } /* * zpool add [-fn] ... * * -f Force addition of devices, even if they appear in use * -n Do not add the devices, but display the resulting layout if * they were to be added. * * Adds the given vdevs to 'pool'. As with create, the bulk of this work is * handled by get_vdev_spec(), which constructs the nvlist needed to pass to * libzfs. */ int zpool_do_add(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t dryrun = B_FALSE; int c; nvlist_t *nvroot; char *poolname; int ret; zpool_handle_t *zhp; nvlist_t *config; /* check options */ while ((c = getopt(argc, argv, "fn")) != -1) { switch (c) { case 'f': force = B_TRUE; break; case 'n': dryrun = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* get pool name and check number of arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name argument\n")); usage(B_FALSE); } if (argc < 2) { (void) fprintf(stderr, gettext("missing vdev specification\n")); usage(B_FALSE); } poolname = argv[0]; argc--; argv++; if ((zhp = zpool_open(g_zfs, poolname)) == NULL) return (1); if ((config = zpool_get_config(zhp, NULL)) == NULL) { (void) fprintf(stderr, gettext("pool '%s' is unavailable\n"), poolname); zpool_close(zhp); return (1); } /* pass off to get_vdev_spec for processing */ nvroot = make_root_vdev(zhp, force, !force, B_FALSE, dryrun, argc, argv); if (nvroot == NULL) { zpool_close(zhp); return (1); } if (dryrun) { nvlist_t *poolnvroot; verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &poolnvroot) == 0); (void) printf(gettext("would update '%s' to the following " "configuration:\n"), zpool_get_name(zhp)); /* print original main pool and new tree */ print_vdev_tree(zhp, poolname, poolnvroot, 0, B_FALSE); print_vdev_tree(zhp, NULL, nvroot, 0, B_FALSE); /* Do the same for the logs */ if (num_logs(poolnvroot) > 0) { print_vdev_tree(zhp, "logs", poolnvroot, 0, B_TRUE); print_vdev_tree(zhp, NULL, nvroot, 0, B_TRUE); } else if (num_logs(nvroot) > 0) { print_vdev_tree(zhp, "logs", nvroot, 0, B_TRUE); } ret = 0; } else { ret = (zpool_add(zhp, nvroot) != 0); } nvlist_free(nvroot); zpool_close(zhp); return (ret); } /* * zpool remove ... * * Removes the given vdev from the pool. Currently, this supports removing * spares, cache, and log devices from the pool. */ int zpool_do_remove(int argc, char **argv) { char *poolname; int i, ret = 0; zpool_handle_t *zhp; argc--; argv++; /* get pool name and check number of arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name argument\n")); usage(B_FALSE); } if (argc < 2) { (void) fprintf(stderr, gettext("missing device\n")); usage(B_FALSE); } poolname = argv[0]; if ((zhp = zpool_open(g_zfs, poolname)) == NULL) return (1); for (i = 1; i < argc; i++) { if (zpool_vdev_remove(zhp, argv[i]) != 0) ret = 1; } return (ret); } /* * zpool labelclear * * Verifies that the vdev is not active and zeros out the label information * on the device. */ int zpool_do_labelclear(int argc, char **argv) { char *vdev, *name; int c, fd = -1, ret = 0; pool_state_t state; boolean_t inuse = B_FALSE; boolean_t force = B_FALSE; /* check options */ while ((c = getopt(argc, argv, "f")) != -1) { switch (c) { case 'f': force = B_TRUE; break; default: (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* get vdev name */ if (argc < 1) { (void) fprintf(stderr, gettext("missing vdev device name\n")); usage(B_FALSE); } vdev = argv[0]; if ((fd = open(vdev, O_RDWR)) < 0) { (void) fprintf(stderr, gettext("Unable to open %s\n"), vdev); return (B_FALSE); } name = NULL; if (zpool_in_use(g_zfs, fd, &state, &name, &inuse) != 0) { if (force) goto wipe_label; (void) fprintf(stderr, gettext("Unable to determine pool state for %s\n" "Use -f to force the clearing any label data\n"), vdev); return (1); } if (inuse) { switch (state) { default: case POOL_STATE_ACTIVE: case POOL_STATE_SPARE: case POOL_STATE_L2CACHE: (void) fprintf(stderr, gettext("labelclear operation failed.\n" "\tVdev %s is a member (%s), of pool \"%s\".\n" "\tTo remove label information from this device, export or destroy\n" "\tthe pool, or remove %s from the configuration of this pool\n" "\tand retry the labelclear operation\n"), vdev, zpool_pool_state_to_name(state), name, vdev); ret = 1; goto errout; case POOL_STATE_EXPORTED: if (force) break; (void) fprintf(stderr, gettext("labelclear operation failed.\n" "\tVdev %s is a member of the exported pool \"%s\".\n" "\tUse \"zpool labelclear -f %s\" to force the removal of label\n" "\tinformation.\n"), vdev, name, vdev); ret = 1; goto errout; case POOL_STATE_POTENTIALLY_ACTIVE: if (force) break; (void) fprintf(stderr, gettext("labelclear operation failed.\n" "\tVdev %s is a member of the pool \"%s\".\n" "\tThis pool is unknown to this system, but may be active on\n" "\tanother system. Use \'zpool labelclear -f %s\' to force the\n" "\tremoval of label information.\n"), vdev, name, vdev); ret = 1; goto errout; case POOL_STATE_DESTROYED: /* inuse should never be set for a destoryed pool... */ break; } } wipe_label: if (zpool_clear_label(fd) != 0) { (void) fprintf(stderr, gettext("Label clear failed on vdev %s\n"), vdev); ret = 1; } errout: close(fd); if (name != NULL) free(name); return (ret); } /* * zpool create [-fnd] [-o property=value] ... * [-O file-system-property=value] ... * [-R root] [-m mountpoint] ... * * -f Force creation, even if devices appear in use * -n Do not create the pool, but display the resulting layout if it * were to be created. * -R Create a pool under an alternate root * -m Set default mountpoint for the root dataset. By default it's * '/' * -o Set property=value. * -d Don't automatically enable all supported pool features * (individual features can be enabled with -o). * -O Set fsproperty=value in the pool's root file system * * Creates the named pool according to the given vdev specification. The * bulk of the vdev processing is done in get_vdev_spec() in zpool_vdev.c. Once * we get the nvlist back from get_vdev_spec(), we either print out the contents * (if '-n' was specified), or pass it to libzfs to do the creation. */ int zpool_do_create(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t dryrun = B_FALSE; boolean_t enable_all_pool_feat = B_TRUE; int c; nvlist_t *nvroot = NULL; char *poolname; int ret = 1; char *altroot = NULL; char *mountpoint = NULL; nvlist_t *fsprops = NULL; nvlist_t *props = NULL; char *propval; /* check options */ while ((c = getopt(argc, argv, ":fndR:m:o:O:")) != -1) { switch (c) { case 'f': force = B_TRUE; break; case 'n': dryrun = B_TRUE; break; case 'd': enable_all_pool_feat = B_FALSE; break; case 'R': altroot = optarg; if (add_prop_list(zpool_prop_to_name( ZPOOL_PROP_ALTROOT), optarg, &props, B_TRUE)) goto errout; if (nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_CACHEFILE), &propval) == 0) break; if (add_prop_list(zpool_prop_to_name( ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) goto errout; break; case 'm': /* Equivalent to -O mountpoint=optarg */ mountpoint = optarg; break; case 'o': if ((propval = strchr(optarg, '=')) == NULL) { (void) fprintf(stderr, gettext("missing " "'=' for -o option\n")); goto errout; } *propval = '\0'; propval++; if (add_prop_list(optarg, propval, &props, B_TRUE)) goto errout; /* * If the user is creating a pool that doesn't support * feature flags, don't enable any features. */ if (zpool_name_to_prop(optarg) == ZPOOL_PROP_VERSION) { char *end; u_longlong_t ver; ver = strtoull(propval, &end, 10); if (*end == '\0' && ver < SPA_VERSION_FEATURES) { enable_all_pool_feat = B_FALSE; } } break; case 'O': if ((propval = strchr(optarg, '=')) == NULL) { (void) fprintf(stderr, gettext("missing " "'=' for -O option\n")); goto errout; } *propval = '\0'; propval++; /* * Mountpoints are checked and then added later. * Uniquely among properties, they can be specified * more than once, to avoid conflict with -m. */ if (0 == strcmp(optarg, zfs_prop_to_name(ZFS_PROP_MOUNTPOINT))) { mountpoint = propval; } else if (add_prop_list(optarg, propval, &fsprops, B_FALSE)) { goto errout; } break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); goto badusage; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); goto badusage; } } argc -= optind; argv += optind; /* get pool name and check number of arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name argument\n")); goto badusage; } if (argc < 2) { (void) fprintf(stderr, gettext("missing vdev specification\n")); goto badusage; } poolname = argv[0]; /* * As a special case, check for use of '/' in the name, and direct the * user to use 'zfs create' instead. */ if (strchr(poolname, '/') != NULL) { (void) fprintf(stderr, gettext("cannot create '%s': invalid " "character '/' in pool name\n"), poolname); (void) fprintf(stderr, gettext("use 'zfs create' to " "create a dataset\n")); goto errout; } /* pass off to get_vdev_spec for bulk processing */ nvroot = make_root_vdev(NULL, force, !force, B_FALSE, dryrun, argc - 1, argv + 1); if (nvroot == NULL) goto errout; /* make_root_vdev() allows 0 toplevel children if there are spares */ if (!zfs_allocatable_devs(nvroot)) { (void) fprintf(stderr, gettext("invalid vdev " "specification: at least one toplevel vdev must be " "specified\n")); goto errout; } if (altroot != NULL && altroot[0] != '/') { (void) fprintf(stderr, gettext("invalid alternate root '%s': " "must be an absolute path\n"), altroot); goto errout; } /* * Check the validity of the mountpoint and direct the user to use the * '-m' mountpoint option if it looks like its in use. * Ignore the checks if the '-f' option is given. */ if (!force && (mountpoint == NULL || (strcmp(mountpoint, ZFS_MOUNTPOINT_LEGACY) != 0 && strcmp(mountpoint, ZFS_MOUNTPOINT_NONE) != 0))) { char buf[MAXPATHLEN]; DIR *dirp; if (mountpoint && mountpoint[0] != '/') { (void) fprintf(stderr, gettext("invalid mountpoint " "'%s': must be an absolute path, 'legacy', or " "'none'\n"), mountpoint); goto errout; } if (mountpoint == NULL) { if (altroot != NULL) (void) snprintf(buf, sizeof (buf), "%s/%s", altroot, poolname); else (void) snprintf(buf, sizeof (buf), "/%s", poolname); } else { if (altroot != NULL) (void) snprintf(buf, sizeof (buf), "%s%s", altroot, mountpoint); else (void) snprintf(buf, sizeof (buf), "%s", mountpoint); } if ((dirp = opendir(buf)) == NULL && errno != ENOENT) { (void) fprintf(stderr, gettext("mountpoint '%s' : " "%s\n"), buf, strerror(errno)); (void) fprintf(stderr, gettext("use '-m' " "option to provide a different default\n")); goto errout; } else if (dirp) { int count = 0; while (count < 3 && readdir(dirp) != NULL) count++; (void) closedir(dirp); if (count > 2) { (void) fprintf(stderr, gettext("mountpoint " "'%s' exists and is not empty\n"), buf); (void) fprintf(stderr, gettext("use '-m' " "option to provide a " "different default\n")); goto errout; } } } /* * Now that the mountpoint's validity has been checked, ensure that * the property is set appropriately prior to creating the pool. */ if (mountpoint != NULL) { ret = add_prop_list(zfs_prop_to_name(ZFS_PROP_MOUNTPOINT), mountpoint, &fsprops, B_FALSE); if (ret != 0) goto errout; } ret = 1; if (dryrun) { /* * For a dry run invocation, print out a basic message and run * through all the vdevs in the list and print out in an * appropriate hierarchy. */ (void) printf(gettext("would create '%s' with the " "following layout:\n\n"), poolname); print_vdev_tree(NULL, poolname, nvroot, 0, B_FALSE); if (num_logs(nvroot) > 0) print_vdev_tree(NULL, "logs", nvroot, 0, B_TRUE); ret = 0; } else { /* * Hand off to libzfs. */ if (enable_all_pool_feat) { spa_feature_t i; for (i = 0; i < SPA_FEATURES; i++) { char propname[MAXPATHLEN]; zfeature_info_t *feat = &spa_feature_table[i]; (void) snprintf(propname, sizeof (propname), "feature@%s", feat->fi_uname); /* * Skip feature if user specified it manually * on the command line. */ if (nvlist_exists(props, propname)) continue; ret = add_prop_list(propname, ZFS_FEATURE_ENABLED, &props, B_TRUE); if (ret != 0) goto errout; } } ret = 1; if (zpool_create(g_zfs, poolname, nvroot, props, fsprops) == 0) { zfs_handle_t *pool = zfs_open(g_zfs, poolname, ZFS_TYPE_FILESYSTEM); if (pool != NULL) { if (zfs_mount(pool, NULL, 0) == 0) ret = zfs_shareall(pool); zfs_close(pool); } } else if (libzfs_errno(g_zfs) == EZFS_INVALIDNAME) { (void) fprintf(stderr, gettext("pool name may have " "been omitted\n")); } } errout: nvlist_free(nvroot); nvlist_free(fsprops); nvlist_free(props); return (ret); badusage: nvlist_free(fsprops); nvlist_free(props); usage(B_FALSE); return (2); } /* * zpool destroy * * -f Forcefully unmount any datasets * * Destroy the given pool. Automatically unmounts any datasets in the pool. */ int zpool_do_destroy(int argc, char **argv) { boolean_t force = B_FALSE; int c; char *pool; zpool_handle_t *zhp; int ret; /* check options */ while ((c = getopt(argc, argv, "f")) != -1) { switch (c) { case 'f': force = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* check arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool argument\n")); usage(B_FALSE); } if (argc > 1) { (void) fprintf(stderr, gettext("too many arguments\n")); usage(B_FALSE); } pool = argv[0]; if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) { /* * As a special case, check for use of '/' in the name, and * direct the user to use 'zfs destroy' instead. */ if (strchr(pool, '/') != NULL) (void) fprintf(stderr, gettext("use 'zfs destroy' to " "destroy a dataset\n")); return (1); } if (zpool_disable_datasets(zhp, force) != 0) { (void) fprintf(stderr, gettext("could not destroy '%s': " "could not unmount datasets\n"), zpool_get_name(zhp)); return (1); } /* The history must be logged as part of the export */ log_history = B_FALSE; ret = (zpool_destroy(zhp, history_str) != 0); zpool_close(zhp); return (ret); } /* * zpool export [-f] ... * * -f Forcefully unmount datasets * * Export the given pools. By default, the command will attempt to cleanly * unmount any active datasets within the pool. If the '-f' flag is specified, * then the datasets will be forcefully unmounted. */ int zpool_do_export(int argc, char **argv) { boolean_t force = B_FALSE; boolean_t hardforce = B_FALSE; int c; zpool_handle_t *zhp; int ret; int i; /* check options */ while ((c = getopt(argc, argv, "fF")) != -1) { switch (c) { case 'f': force = B_TRUE; break; case 'F': hardforce = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* check arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool argument\n")); usage(B_FALSE); } ret = 0; for (i = 0; i < argc; i++) { if ((zhp = zpool_open_canfail(g_zfs, argv[i])) == NULL) { ret = 1; continue; } if (zpool_disable_datasets(zhp, force) != 0) { ret = 1; zpool_close(zhp); continue; } /* The history must be logged as part of the export */ log_history = B_FALSE; if (hardforce) { if (zpool_export_force(zhp, history_str) != 0) ret = 1; } else if (zpool_export(zhp, force, history_str) != 0) { ret = 1; } zpool_close(zhp); } return (ret); } /* * Given a vdev configuration, determine the maximum width needed for the device * name column. */ static int max_width(zpool_handle_t *zhp, nvlist_t *nv, int depth, int max) { char *name = zpool_vdev_name(g_zfs, zhp, nv, B_TRUE); nvlist_t **child; uint_t c, children; int ret; if (strlen(name) + depth > max) max = strlen(name) + depth; free(name); if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, max)) > max) max = ret; } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, max)) > max) max = ret; } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0) { for (c = 0; c < children; c++) if ((ret = max_width(zhp, child[c], depth + 2, max)) > max) max = ret; } return (max); } typedef struct spare_cbdata { uint64_t cb_guid; zpool_handle_t *cb_zhp; } spare_cbdata_t; static boolean_t find_vdev(nvlist_t *nv, uint64_t search) { uint64_t guid; nvlist_t **child; uint_t c, children; if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &guid) == 0 && search == guid) return (B_TRUE); if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) == 0) { for (c = 0; c < children; c++) if (find_vdev(child[c], search)) return (B_TRUE); } return (B_FALSE); } static int find_spare(zpool_handle_t *zhp, void *data) { spare_cbdata_t *cbp = data; nvlist_t *config, *nvroot; config = zpool_get_config(zhp, NULL); verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); if (find_vdev(nvroot, cbp->cb_guid)) { cbp->cb_zhp = zhp; return (1); } zpool_close(zhp); return (0); } /* * Print out configuration state as requested by status_callback. */ void print_status_config(zpool_handle_t *zhp, const char *name, nvlist_t *nv, int namewidth, int depth, boolean_t isspare) { nvlist_t **child; uint_t c, vsc, children; pool_scan_stat_t *ps = NULL; vdev_stat_t *vs; char rbuf[6], wbuf[6], cbuf[6]; char *vname; uint64_t notpresent; uint64_t ashift; spare_cbdata_t cb; const char *state; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) children = 0; verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &vsc) == 0); state = zpool_state_to_name(vs->vs_state, vs->vs_aux); if (isspare) { /* * For hot spares, we use the terms 'INUSE' and 'AVAILABLE' for * online drives. */ if (vs->vs_aux == VDEV_AUX_SPARED) state = "INUSE"; else if (vs->vs_state == VDEV_STATE_HEALTHY) state = "AVAIL"; } (void) printf("\t%*s%-*s %-8s", depth, "", namewidth - depth, name, state); if (!isspare) { zfs_nicenum(vs->vs_read_errors, rbuf, sizeof (rbuf)); zfs_nicenum(vs->vs_write_errors, wbuf, sizeof (wbuf)); zfs_nicenum(vs->vs_checksum_errors, cbuf, sizeof (cbuf)); (void) printf(" %5s %5s %5s", rbuf, wbuf, cbuf); } if (nvlist_lookup_uint64(nv, ZPOOL_CONFIG_NOT_PRESENT, ¬present) == 0 || vs->vs_state <= VDEV_STATE_CANT_OPEN) { char *path; if (nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0) (void) printf(" was %s", path); } else if (vs->vs_aux != 0) { (void) printf(" "); switch (vs->vs_aux) { case VDEV_AUX_OPEN_FAILED: (void) printf(gettext("cannot open")); break; case VDEV_AUX_BAD_GUID_SUM: (void) printf(gettext("missing device")); break; case VDEV_AUX_NO_REPLICAS: (void) printf(gettext("insufficient replicas")); break; case VDEV_AUX_VERSION_NEWER: (void) printf(gettext("newer version")); break; case VDEV_AUX_UNSUP_FEAT: (void) printf(gettext("unsupported feature(s)")); break; case VDEV_AUX_ASHIFT_TOO_BIG: (void) printf(gettext("unsupported minimum blocksize")); break; case VDEV_AUX_SPARED: verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_GUID, &cb.cb_guid) == 0); if (zpool_iter(g_zfs, find_spare, &cb) == 1) { if (strcmp(zpool_get_name(cb.cb_zhp), zpool_get_name(zhp)) == 0) (void) printf(gettext("currently in " "use")); else (void) printf(gettext("in use by " "pool '%s'"), zpool_get_name(cb.cb_zhp)); zpool_close(cb.cb_zhp); } else { (void) printf(gettext("currently in use")); } break; case VDEV_AUX_ERR_EXCEEDED: (void) printf(gettext("too many errors")); break; case VDEV_AUX_IO_FAILURE: (void) printf(gettext("experienced I/O failures")); break; case VDEV_AUX_BAD_LOG: (void) printf(gettext("bad intent log")); break; case VDEV_AUX_EXTERNAL: (void) printf(gettext("external device fault")); break; case VDEV_AUX_SPLIT_POOL: (void) printf(gettext("split into new pool")); break; default: (void) printf(gettext("corrupted data")); break; } } else if (children == 0 && !isspare && VDEV_STAT_VALID(vs_physical_ashift, vsc) && vs->vs_configured_ashift < vs->vs_physical_ashift) { (void) printf( gettext(" block size: %dB configured, %dB native"), 1 << vs->vs_configured_ashift, 1 << vs->vs_physical_ashift); } (void) nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &c); if (ps && ps->pss_state == DSS_SCANNING && vs->vs_scan_processed != 0 && children == 0) { (void) printf(gettext(" (%s)"), (ps->pss_func == POOL_SCAN_RESILVER) ? "resilvering" : "repairing"); } (void) printf("\n"); for (c = 0; c < children; c++) { uint64_t islog = B_FALSE, ishole = B_FALSE; /* Don't print logs or holes here */ (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, &islog); (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_HOLE, &ishole); if (islog || ishole) continue; vname = zpool_vdev_name(g_zfs, zhp, child[c], B_TRUE); print_status_config(zhp, vname, child[c], namewidth, depth + 2, isspare); free(vname); } } /* * Print the configuration of an exported pool. Iterate over all vdevs in the * pool, printing out the name and status for each one. */ void print_import_config(const char *name, nvlist_t *nv, int namewidth, int depth) { nvlist_t **child; uint_t c, children; vdev_stat_t *vs; char *type, *vname; verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0); if (strcmp(type, VDEV_TYPE_MISSING) == 0 || strcmp(type, VDEV_TYPE_HOLE) == 0) return; verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &c) == 0); (void) printf("\t%*s%-*s", depth, "", namewidth - depth, name); (void) printf(" %s", zpool_state_to_name(vs->vs_state, vs->vs_aux)); if (vs->vs_aux != 0) { (void) printf(" "); switch (vs->vs_aux) { case VDEV_AUX_OPEN_FAILED: (void) printf(gettext("cannot open")); break; case VDEV_AUX_BAD_GUID_SUM: (void) printf(gettext("missing device")); break; case VDEV_AUX_NO_REPLICAS: (void) printf(gettext("insufficient replicas")); break; case VDEV_AUX_VERSION_NEWER: (void) printf(gettext("newer version")); break; case VDEV_AUX_UNSUP_FEAT: (void) printf(gettext("unsupported feature(s)")); break; case VDEV_AUX_ERR_EXCEEDED: (void) printf(gettext("too many errors")); break; default: (void) printf(gettext("corrupted data")); break; } } (void) printf("\n"); if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) return; for (c = 0; c < children; c++) { uint64_t is_log = B_FALSE; (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, &is_log); if (is_log) continue; vname = zpool_vdev_name(g_zfs, NULL, child[c], B_TRUE); print_import_config(vname, child[c], namewidth, depth + 2); free(vname); } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, &child, &children) == 0) { (void) printf(gettext("\tcache\n")); for (c = 0; c < children; c++) { vname = zpool_vdev_name(g_zfs, NULL, child[c], B_FALSE); (void) printf("\t %s\n", vname); free(vname); } } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_SPARES, &child, &children) == 0) { (void) printf(gettext("\tspares\n")); for (c = 0; c < children; c++) { vname = zpool_vdev_name(g_zfs, NULL, child[c], B_FALSE); (void) printf("\t %s\n", vname); free(vname); } } } /* * Print log vdevs. * Logs are recorded as top level vdevs in the main pool child array * but with "is_log" set to 1. We use either print_status_config() or * print_import_config() to print the top level logs then any log * children (eg mirrored slogs) are printed recursively - which * works because only the top level vdev is marked "is_log" */ static void print_logs(zpool_handle_t *zhp, nvlist_t *nv, int namewidth, boolean_t verbose) { uint_t c, children; nvlist_t **child; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) return; (void) printf(gettext("\tlogs\n")); for (c = 0; c < children; c++) { uint64_t is_log = B_FALSE; char *name; (void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, &is_log); if (!is_log) continue; name = zpool_vdev_name(g_zfs, zhp, child[c], B_TRUE); if (verbose) print_status_config(zhp, name, child[c], namewidth, 2, B_FALSE); else print_import_config(name, child[c], namewidth, 2); free(name); } } /* * Display the status for the given pool. */ static void show_import(nvlist_t *config) { uint64_t pool_state; vdev_stat_t *vs; char *name; uint64_t guid; char *msgid; nvlist_t *nvroot; int reason; const char *health; uint_t vsc; int namewidth; char *comment; verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &name) == 0); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &guid) == 0); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, &pool_state) == 0); verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &vsc) == 0); health = zpool_state_to_name(vs->vs_state, vs->vs_aux); reason = zpool_import_status(config, &msgid); (void) printf(gettext(" pool: %s\n"), name); (void) printf(gettext(" id: %llu\n"), (u_longlong_t)guid); (void) printf(gettext(" state: %s"), health); if (pool_state == POOL_STATE_DESTROYED) (void) printf(gettext(" (DESTROYED)")); (void) printf("\n"); switch (reason) { case ZPOOL_STATUS_MISSING_DEV_R: case ZPOOL_STATUS_MISSING_DEV_NR: case ZPOOL_STATUS_BAD_GUID_SUM: (void) printf(gettext(" status: One or more devices are " "missing from the system.\n")); break; case ZPOOL_STATUS_CORRUPT_LABEL_R: case ZPOOL_STATUS_CORRUPT_LABEL_NR: (void) printf(gettext(" status: One or more devices contains " "corrupted data.\n")); break; case ZPOOL_STATUS_CORRUPT_DATA: (void) printf( gettext(" status: The pool data is corrupted.\n")); break; case ZPOOL_STATUS_OFFLINE_DEV: (void) printf(gettext(" status: One or more devices " "are offlined.\n")); break; case ZPOOL_STATUS_CORRUPT_POOL: (void) printf(gettext(" status: The pool metadata is " "corrupted.\n")); break; case ZPOOL_STATUS_VERSION_OLDER: (void) printf(gettext(" status: The pool is formatted using a " "legacy on-disk version.\n")); break; case ZPOOL_STATUS_VERSION_NEWER: (void) printf(gettext(" status: The pool is formatted using an " "incompatible version.\n")); break; case ZPOOL_STATUS_FEAT_DISABLED: (void) printf(gettext(" status: Some supported features are " "not enabled on the pool.\n")); break; case ZPOOL_STATUS_UNSUP_FEAT_READ: (void) printf(gettext("status: The pool uses the following " "feature(s) not supported on this sytem:\n")); zpool_print_unsup_feat(config); break; case ZPOOL_STATUS_UNSUP_FEAT_WRITE: (void) printf(gettext("status: The pool can only be accessed " "in read-only mode on this system. It\n\tcannot be " "accessed in read-write mode because it uses the " "following\n\tfeature(s) not supported on this system:\n")); zpool_print_unsup_feat(config); break; case ZPOOL_STATUS_HOSTID_MISMATCH: (void) printf(gettext(" status: The pool was last accessed by " "another system.\n")); break; case ZPOOL_STATUS_FAULTED_DEV_R: case ZPOOL_STATUS_FAULTED_DEV_NR: (void) printf(gettext(" status: One or more devices are " "faulted.\n")); break; case ZPOOL_STATUS_BAD_LOG: (void) printf(gettext(" status: An intent log record cannot be " "read.\n")); break; case ZPOOL_STATUS_RESILVERING: (void) printf(gettext(" status: One or more devices were being " "resilvered.\n")); break; case ZPOOL_STATUS_NON_NATIVE_ASHIFT: (void) printf(gettext("status: One or more devices were " "configured to use a non-native block size.\n" "\tExpect reduced performance.\n")); break; default: /* * No other status can be seen when importing pools. */ assert(reason == ZPOOL_STATUS_OK); } /* * Print out an action according to the overall state of the pool. */ if (vs->vs_state == VDEV_STATE_HEALTHY) { if (reason == ZPOOL_STATUS_VERSION_OLDER || reason == ZPOOL_STATUS_FEAT_DISABLED) { (void) printf(gettext(" action: The pool can be " "imported using its name or numeric identifier, " "though\n\tsome features will not be available " "without an explicit 'zpool upgrade'.\n")); } else if (reason == ZPOOL_STATUS_HOSTID_MISMATCH) { (void) printf(gettext(" action: The pool can be " "imported using its name or numeric " "identifier and\n\tthe '-f' flag.\n")); } else { (void) printf(gettext(" action: The pool can be " "imported using its name or numeric " "identifier.\n")); } } else if (vs->vs_state == VDEV_STATE_DEGRADED) { (void) printf(gettext(" action: The pool can be imported " "despite missing or damaged devices. The\n\tfault " "tolerance of the pool may be compromised if imported.\n")); } else { switch (reason) { case ZPOOL_STATUS_VERSION_NEWER: (void) printf(gettext(" action: The pool cannot be " "imported. Access the pool on a system running " "newer\n\tsoftware, or recreate the pool from " "backup.\n")); break; case ZPOOL_STATUS_UNSUP_FEAT_READ: (void) printf(gettext("action: The pool cannot be " "imported. Access the pool on a system that " "supports\n\tthe required feature(s), or recreate " "the pool from backup.\n")); break; case ZPOOL_STATUS_UNSUP_FEAT_WRITE: (void) printf(gettext("action: The pool cannot be " "imported in read-write mode. Import the pool " "with\n" "\t\"-o readonly=on\", access the pool on a system " "that supports the\n\trequired feature(s), or " "recreate the pool from backup.\n")); break; case ZPOOL_STATUS_MISSING_DEV_R: case ZPOOL_STATUS_MISSING_DEV_NR: case ZPOOL_STATUS_BAD_GUID_SUM: (void) printf(gettext(" action: The pool cannot be " "imported. Attach the missing\n\tdevices and try " "again.\n")); break; default: (void) printf(gettext(" action: The pool cannot be " "imported due to damaged devices or data.\n")); } } /* Print the comment attached to the pool. */ if (nvlist_lookup_string(config, ZPOOL_CONFIG_COMMENT, &comment) == 0) (void) printf(gettext("comment: %s\n"), comment); /* * If the state is "closed" or "can't open", and the aux state * is "corrupt data": */ if (((vs->vs_state == VDEV_STATE_CLOSED) || (vs->vs_state == VDEV_STATE_CANT_OPEN)) && (vs->vs_aux == VDEV_AUX_CORRUPT_DATA)) { if (pool_state == POOL_STATE_DESTROYED) (void) printf(gettext("\tThe pool was destroyed, " "but can be imported using the '-Df' flags.\n")); else if (pool_state != POOL_STATE_EXPORTED) (void) printf(gettext("\tThe pool may be active on " "another system, but can be imported using\n\t" "the '-f' flag.\n")); } if (msgid != NULL) (void) printf(gettext(" see: http://illumos.org/msg/%s\n"), msgid); (void) printf(gettext(" config:\n\n")); namewidth = max_width(NULL, nvroot, 0, 0); if (namewidth < 10) namewidth = 10; print_import_config(name, nvroot, namewidth, 0); if (num_logs(nvroot) > 0) print_logs(NULL, nvroot, namewidth, B_FALSE); if (reason == ZPOOL_STATUS_BAD_GUID_SUM) { (void) printf(gettext("\n\tAdditional devices are known to " "be part of this pool, though their\n\texact " "configuration cannot be determined.\n")); } } /* * Perform the import for the given configuration. This passes the heavy * lifting off to zpool_import_props(), and then mounts the datasets contained * within the pool. */ static int do_import(nvlist_t *config, const char *newname, const char *mntopts, nvlist_t *props, int flags) { zpool_handle_t *zhp; char *name; uint64_t state; uint64_t version; verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &name) == 0); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, &state) == 0); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, &version) == 0); if (!SPA_VERSION_IS_SUPPORTED(version)) { (void) fprintf(stderr, gettext("cannot import '%s': pool " "is formatted using an unsupported ZFS version\n"), name); return (1); } else if (state != POOL_STATE_EXPORTED && !(flags & ZFS_IMPORT_ANY_HOST)) { uint64_t hostid; if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID, &hostid) == 0) { if ((unsigned long)hostid != gethostid()) { char *hostname; uint64_t timestamp; time_t t; verify(nvlist_lookup_string(config, ZPOOL_CONFIG_HOSTNAME, &hostname) == 0); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_TIMESTAMP, ×tamp) == 0); t = timestamp; (void) fprintf(stderr, gettext("cannot import " "'%s': pool may be in use from other " "system, it was last accessed by %s " "(hostid: 0x%lx) on %s"), name, hostname, (unsigned long)hostid, asctime(localtime(&t))); (void) fprintf(stderr, gettext("use '-f' to " "import anyway\n")); return (1); } } else { (void) fprintf(stderr, gettext("cannot import '%s': " "pool may be in use from other system\n"), name); (void) fprintf(stderr, gettext("use '-f' to import " "anyway\n")); return (1); } } if (zpool_import_props(g_zfs, config, newname, props, flags) != 0) return (1); if (newname != NULL) name = (char *)newname; if ((zhp = zpool_open_canfail(g_zfs, name)) == NULL) return (1); if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL && !(flags & ZFS_IMPORT_ONLY) && zpool_enable_datasets(zhp, mntopts, 0) != 0) { zpool_close(zhp); return (1); } zpool_close(zhp); return (0); } /* * zpool import [-d dir] [-D] * import [-o mntopts] [-o prop=value] ... [-R root] [-D] * [-d dir | -c cachefile] [-f] -a * import [-o mntopts] [-o prop=value] ... [-R root] [-D] * [-d dir | -c cachefile] [-f] [-n] [-F] [newpool] * * -c Read pool information from a cachefile instead of searching * devices. * * -d Scan in a specific directory, other than /dev/dsk. More than * one directory can be specified using multiple '-d' options. * * -D Scan for previously destroyed pools or import all or only * specified destroyed pools. * * -R Temporarily import the pool, with all mountpoints relative to * the given root. The pool will remain exported when the machine * is rebooted. * * -V Import even in the presence of faulted vdevs. This is an * intentionally undocumented option for testing purposes, and * treats the pool configuration as complete, leaving any bad * vdevs in the FAULTED state. In other words, it does verbatim * import. * * -f Force import, even if it appears that the pool is active. * * -F Attempt rewind if necessary. * * -n See if rewind would work, but don't actually rewind. * * -N Import the pool but don't mount datasets. * * -T Specify a starting txg to use for import. This option is * intentionally undocumented option for testing purposes. * * -a Import all pools found. * * -o Set property=value and/or temporary mount options (without '='). * * The import command scans for pools to import, and import pools based on pool * name and GUID. The pool can also be renamed as part of the import process. */ int zpool_do_import(int argc, char **argv) { char **searchdirs = NULL; int nsearch = 0; int c; int err = 0; nvlist_t *pools = NULL; boolean_t do_all = B_FALSE; boolean_t do_destroyed = B_FALSE; char *mntopts = NULL; nvpair_t *elem; nvlist_t *config; uint64_t searchguid = 0; char *searchname = NULL; char *propval; nvlist_t *found_config; nvlist_t *policy = NULL; nvlist_t *props = NULL; boolean_t first; int flags = ZFS_IMPORT_NORMAL; uint32_t rewind_policy = ZPOOL_NO_REWIND; boolean_t dryrun = B_FALSE; boolean_t do_rewind = B_FALSE; boolean_t xtreme_rewind = B_FALSE; uint64_t pool_state, txg = -1ULL; char *cachefile = NULL; importargs_t idata = { 0 }; char *endptr; /* check options */ while ((c = getopt(argc, argv, ":aCc:d:DEfFmnNo:R:T:VX")) != -1) { switch (c) { case 'a': do_all = B_TRUE; break; case 'c': cachefile = optarg; break; case 'd': if (searchdirs == NULL) { searchdirs = safe_malloc(sizeof (char *)); } else { char **tmp = safe_malloc((nsearch + 1) * sizeof (char *)); bcopy(searchdirs, tmp, nsearch * sizeof (char *)); free(searchdirs); searchdirs = tmp; } searchdirs[nsearch++] = optarg; break; case 'D': do_destroyed = B_TRUE; break; case 'f': flags |= ZFS_IMPORT_ANY_HOST; break; case 'F': do_rewind = B_TRUE; break; case 'm': flags |= ZFS_IMPORT_MISSING_LOG; break; case 'n': dryrun = B_TRUE; break; case 'N': flags |= ZFS_IMPORT_ONLY; break; case 'o': if ((propval = strchr(optarg, '=')) != NULL) { *propval = '\0'; propval++; if (add_prop_list(optarg, propval, &props, B_TRUE)) goto error; } else { mntopts = optarg; } break; case 'R': if (add_prop_list(zpool_prop_to_name( ZPOOL_PROP_ALTROOT), optarg, &props, B_TRUE)) goto error; if (nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_CACHEFILE), &propval) == 0) break; if (add_prop_list(zpool_prop_to_name( ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) goto error; break; case 'T': errno = 0; txg = strtoull(optarg, &endptr, 0); if (errno != 0 || *endptr != '\0') { (void) fprintf(stderr, gettext("invalid txg value\n")); usage(B_FALSE); } rewind_policy = ZPOOL_DO_REWIND | ZPOOL_EXTREME_REWIND; break; case 'V': flags |= ZFS_IMPORT_VERBATIM; break; case 'X': xtreme_rewind = B_TRUE; break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); usage(B_FALSE); break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; if (cachefile && nsearch != 0) { (void) fprintf(stderr, gettext("-c is incompatible with -d\n")); usage(B_FALSE); } if ((dryrun || xtreme_rewind) && !do_rewind) { (void) fprintf(stderr, gettext("-n or -X only meaningful with -F\n")); usage(B_FALSE); } if (dryrun) rewind_policy = ZPOOL_TRY_REWIND; else if (do_rewind) rewind_policy = ZPOOL_DO_REWIND; if (xtreme_rewind) rewind_policy |= ZPOOL_EXTREME_REWIND; /* In the future, we can capture further policy and include it here */ if (nvlist_alloc(&policy, NV_UNIQUE_NAME, 0) != 0 || nvlist_add_uint64(policy, ZPOOL_REWIND_REQUEST_TXG, txg) != 0 || nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0) goto error; if (searchdirs == NULL) { searchdirs = safe_malloc(sizeof (char *)); searchdirs[0] = "/dev"; nsearch = 1; } /* check argument count */ if (do_all) { if (argc != 0) { (void) fprintf(stderr, gettext("too many arguments\n")); usage(B_FALSE); } } else { if (argc > 2) { (void) fprintf(stderr, gettext("too many arguments\n")); usage(B_FALSE); } /* * Check for the SYS_CONFIG privilege. We do this explicitly * here because otherwise any attempt to discover pools will * silently fail. */ if (argc == 0 && !priv_ineffect(PRIV_SYS_CONFIG)) { (void) fprintf(stderr, gettext("cannot " "discover pools: permission denied\n")); free(searchdirs); nvlist_free(policy); return (1); } } /* * Depending on the arguments given, we do one of the following: * * Iterate through all pools and display information about * each one. * * -a Iterate through all pools and try to import each one. * * Find the pool that corresponds to the given GUID/pool * name and import that one. * * -D Above options applies only to destroyed pools. */ if (argc != 0) { char *endptr; errno = 0; searchguid = strtoull(argv[0], &endptr, 10); if (errno != 0 || *endptr != '\0') { searchname = argv[0]; searchguid = 0; } found_config = NULL; /* * User specified a name or guid. Ensure it's unique. */ idata.unique = B_TRUE; } idata.path = searchdirs; idata.paths = nsearch; idata.poolname = searchname; idata.guid = searchguid; idata.cachefile = cachefile; pools = zpool_search_import(g_zfs, &idata); if (pools != NULL && idata.exists && (argc == 1 || strcmp(argv[0], argv[1]) == 0)) { (void) fprintf(stderr, gettext("cannot import '%s': " "a pool with that name already exists\n"), argv[0]); (void) fprintf(stderr, gettext("use the form '%s " " ' to give it a new name\n"), "zpool import"); err = 1; } else if (pools == NULL && idata.exists) { (void) fprintf(stderr, gettext("cannot import '%s': " "a pool with that name is already created/imported,\n"), argv[0]); (void) fprintf(stderr, gettext("and no additional pools " "with that name were found\n")); err = 1; } else if (pools == NULL) { if (argc != 0) { (void) fprintf(stderr, gettext("cannot import '%s': " "no such pool available\n"), argv[0]); } err = 1; } if (err == 1) { free(searchdirs); nvlist_free(policy); return (1); } /* * At this point we have a list of import candidate configs. Even if * we were searching by pool name or guid, we still need to * post-process the list to deal with pool state and possible * duplicate names. */ err = 0; elem = NULL; first = B_TRUE; while ((elem = nvlist_next_nvpair(pools, elem)) != NULL) { verify(nvpair_value_nvlist(elem, &config) == 0); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, &pool_state) == 0); if (!do_destroyed && pool_state == POOL_STATE_DESTROYED) continue; if (do_destroyed && pool_state != POOL_STATE_DESTROYED) continue; verify(nvlist_add_nvlist(config, ZPOOL_REWIND_POLICY, policy) == 0); if (argc == 0) { if (first) first = B_FALSE; else if (!do_all) (void) printf("\n"); if (do_all) { err |= do_import(config, NULL, mntopts, props, flags); } else { show_import(config); } } else if (searchname != NULL) { char *name; /* * We are searching for a pool based on name. */ verify(nvlist_lookup_string(config, ZPOOL_CONFIG_POOL_NAME, &name) == 0); if (strcmp(name, searchname) == 0) { if (found_config != NULL) { (void) fprintf(stderr, gettext( "cannot import '%s': more than " "one matching pool\n"), searchname); (void) fprintf(stderr, gettext( "import by numeric ID instead\n")); err = B_TRUE; } found_config = config; } } else { uint64_t guid; /* * Search for a pool by guid. */ verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_GUID, &guid) == 0); if (guid == searchguid) found_config = config; } } /* * If we were searching for a specific pool, verify that we found a * pool, and then do the import. */ if (argc != 0 && err == 0) { if (found_config == NULL) { (void) fprintf(stderr, gettext("cannot import '%s': " "no such pool available\n"), argv[0]); err = B_TRUE; } else { err |= do_import(found_config, argc == 1 ? NULL : argv[1], mntopts, props, flags); } } /* * If we were just looking for pools, report an error if none were * found. */ if (argc == 0 && first) (void) fprintf(stderr, gettext("no pools available to import\n")); error: nvlist_free(props); nvlist_free(pools); nvlist_free(policy); free(searchdirs); return (err ? 1 : 0); } typedef struct iostat_cbdata { boolean_t cb_verbose; int cb_namewidth; int cb_iteration; zpool_list_t *cb_list; } iostat_cbdata_t; static void print_iostat_separator(iostat_cbdata_t *cb) { int i = 0; for (i = 0; i < cb->cb_namewidth; i++) (void) printf("-"); (void) printf(" ----- ----- ----- ----- ----- -----\n"); } static void print_iostat_header(iostat_cbdata_t *cb) { (void) printf("%*s capacity operations bandwidth\n", cb->cb_namewidth, ""); (void) printf("%-*s alloc free read write read write\n", cb->cb_namewidth, "pool"); print_iostat_separator(cb); } /* * Display a single statistic. */ static void print_one_stat(uint64_t value) { char buf[64]; zfs_nicenum(value, buf, sizeof (buf)); (void) printf(" %5s", buf); } /* * Print out all the statistics for the given vdev. This can either be the * toplevel configuration, or called recursively. If 'name' is NULL, then this * is a verbose output, and we don't want to display the toplevel pool stats. */ void print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv, nvlist_t *newnv, iostat_cbdata_t *cb, int depth) { nvlist_t **oldchild, **newchild; uint_t c, children; vdev_stat_t *oldvs, *newvs; vdev_stat_t zerovs = { 0 }; uint64_t tdelta; double scale; char *vname; if (oldnv != NULL) { verify(nvlist_lookup_uint64_array(oldnv, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&oldvs, &c) == 0); } else { oldvs = &zerovs; } verify(nvlist_lookup_uint64_array(newnv, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&newvs, &c) == 0); if (strlen(name) + depth > cb->cb_namewidth) (void) printf("%*s%s", depth, "", name); else (void) printf("%*s%s%*s", depth, "", name, (int)(cb->cb_namewidth - strlen(name) - depth), ""); tdelta = newvs->vs_timestamp - oldvs->vs_timestamp; if (tdelta == 0) scale = 1.0; else scale = (double)NANOSEC / tdelta; /* only toplevel vdevs have capacity stats */ if (newvs->vs_space == 0) { (void) printf(" - -"); } else { print_one_stat(newvs->vs_alloc); print_one_stat(newvs->vs_space - newvs->vs_alloc); } print_one_stat((uint64_t)(scale * (newvs->vs_ops[ZIO_TYPE_READ] - oldvs->vs_ops[ZIO_TYPE_READ]))); print_one_stat((uint64_t)(scale * (newvs->vs_ops[ZIO_TYPE_WRITE] - oldvs->vs_ops[ZIO_TYPE_WRITE]))); print_one_stat((uint64_t)(scale * (newvs->vs_bytes[ZIO_TYPE_READ] - oldvs->vs_bytes[ZIO_TYPE_READ]))); print_one_stat((uint64_t)(scale * (newvs->vs_bytes[ZIO_TYPE_WRITE] - oldvs->vs_bytes[ZIO_TYPE_WRITE]))); (void) printf("\n"); if (!cb->cb_verbose) return; if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_CHILDREN, &newchild, &children) != 0) return; if (oldnv && nvlist_lookup_nvlist_array(oldnv, ZPOOL_CONFIG_CHILDREN, &oldchild, &c) != 0) return; for (c = 0; c < children; c++) { uint64_t ishole = B_FALSE, islog = B_FALSE; (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_HOLE, &ishole); (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_LOG, &islog); if (ishole || islog) continue; vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE); print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL, newchild[c], cb, depth + 2); free(vname); } /* * Log device section */ if (num_logs(newnv) > 0) { (void) printf("%-*s - - - - - " "-\n", cb->cb_namewidth, "logs"); for (c = 0; c < children; c++) { uint64_t islog = B_FALSE; (void) nvlist_lookup_uint64(newchild[c], ZPOOL_CONFIG_IS_LOG, &islog); if (islog) { vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE); print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL, newchild[c], cb, depth + 2); free(vname); } } } /* * Include level 2 ARC devices in iostat output */ if (nvlist_lookup_nvlist_array(newnv, ZPOOL_CONFIG_L2CACHE, &newchild, &children) != 0) return; if (oldnv && nvlist_lookup_nvlist_array(oldnv, ZPOOL_CONFIG_L2CACHE, &oldchild, &c) != 0) return; if (children > 0) { (void) printf("%-*s - - - - - " "-\n", cb->cb_namewidth, "cache"); for (c = 0; c < children; c++) { vname = zpool_vdev_name(g_zfs, zhp, newchild[c], B_FALSE); print_vdev_stats(zhp, vname, oldnv ? oldchild[c] : NULL, newchild[c], cb, depth + 2); free(vname); } } } static int refresh_iostat(zpool_handle_t *zhp, void *data) { iostat_cbdata_t *cb = data; boolean_t missing; /* * If the pool has disappeared, remove it from the list and continue. */ if (zpool_refresh_stats(zhp, &missing) != 0) return (-1); if (missing) pool_list_remove(cb->cb_list, zhp); return (0); } /* * Callback to print out the iostats for the given pool. */ int print_iostat(zpool_handle_t *zhp, void *data) { iostat_cbdata_t *cb = data; nvlist_t *oldconfig, *newconfig; nvlist_t *oldnvroot, *newnvroot; newconfig = zpool_get_config(zhp, &oldconfig); if (cb->cb_iteration == 1) oldconfig = NULL; verify(nvlist_lookup_nvlist(newconfig, ZPOOL_CONFIG_VDEV_TREE, &newnvroot) == 0); if (oldconfig == NULL) oldnvroot = NULL; else verify(nvlist_lookup_nvlist(oldconfig, ZPOOL_CONFIG_VDEV_TREE, &oldnvroot) == 0); /* * Print out the statistics for the pool. */ print_vdev_stats(zhp, zpool_get_name(zhp), oldnvroot, newnvroot, cb, 0); if (cb->cb_verbose) print_iostat_separator(cb); return (0); } int get_namewidth(zpool_handle_t *zhp, void *data) { iostat_cbdata_t *cb = data; nvlist_t *config, *nvroot; if ((config = zpool_get_config(zhp, NULL)) != NULL) { verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); if (!cb->cb_verbose) cb->cb_namewidth = strlen(zpool_get_name(zhp)); else cb->cb_namewidth = max_width(zhp, nvroot, 0, cb->cb_namewidth); } /* * The width must fall into the range [10,38]. The upper limit is the * maximum we can have and still fit in 80 columns. */ if (cb->cb_namewidth < 10) cb->cb_namewidth = 10; if (cb->cb_namewidth > 38) cb->cb_namewidth = 38; return (0); } /* * Parse the input string, get the 'interval' and 'count' value if there is one. */ static void get_interval_count(int *argcp, char **argv, unsigned long *iv, unsigned long *cnt) { unsigned long interval = 0, count = 0; int argc = *argcp, errno; /* * Determine if the last argument is an integer or a pool name */ if (argc > 0 && isdigit(argv[argc - 1][0])) { char *end; errno = 0; interval = strtoul(argv[argc - 1], &end, 10); if (*end == '\0' && errno == 0) { if (interval == 0) { (void) fprintf(stderr, gettext("interval " "cannot be zero\n")); usage(B_FALSE); } /* * Ignore the last parameter */ argc--; } else { /* * If this is not a valid number, just plow on. The * user will get a more informative error message later * on. */ interval = 0; } } /* * If the last argument is also an integer, then we have both a count * and an interval. */ if (argc > 0 && isdigit(argv[argc - 1][0])) { char *end; errno = 0; count = interval; interval = strtoul(argv[argc - 1], &end, 10); if (*end == '\0' && errno == 0) { if (interval == 0) { (void) fprintf(stderr, gettext("interval " "cannot be zero\n")); usage(B_FALSE); } /* * Ignore the last parameter */ argc--; } else { interval = 0; } } *iv = interval; *cnt = count; *argcp = argc; } static void get_timestamp_arg(char c) { if (c == 'u') timestamp_fmt = UDATE; else if (c == 'd') timestamp_fmt = DDATE; else usage(B_FALSE); } /* * zpool iostat [-v] [-T d|u] [pool] ... [interval [count]] * * -v Display statistics for individual vdevs * -T Display a timestamp in date(1) or Unix format * * This command can be tricky because we want to be able to deal with pool * creation/destruction as well as vdev configuration changes. The bulk of this * processing is handled by the pool_list_* routines in zpool_iter.c. We rely * on pool_list_update() to detect the addition of new pools. Configuration * changes are all handled within libzfs. */ int zpool_do_iostat(int argc, char **argv) { int c; int ret; int npools; unsigned long interval = 0, count = 0; zpool_list_t *list; boolean_t verbose = B_FALSE; iostat_cbdata_t cb; /* check options */ while ((c = getopt(argc, argv, "T:v")) != -1) { switch (c) { case 'T': get_timestamp_arg(*optarg); break; case 'v': verbose = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; get_interval_count(&argc, argv, &interval, &count); /* * Construct the list of all interesting pools. */ ret = 0; if ((list = pool_list_get(argc, argv, NULL, &ret)) == NULL) return (1); if (pool_list_count(list) == 0 && argc != 0) { pool_list_free(list); return (1); } if (pool_list_count(list) == 0 && interval == 0) { pool_list_free(list); (void) fprintf(stderr, gettext("no pools available\n")); return (1); } /* * Enter the main iostat loop. */ cb.cb_list = list; cb.cb_verbose = verbose; cb.cb_iteration = 0; cb.cb_namewidth = 0; for (;;) { pool_list_update(list); if ((npools = pool_list_count(list)) == 0) break; /* * Refresh all statistics. This is done as an explicit step * before calculating the maximum name width, so that any * configuration changes are properly accounted for. */ (void) pool_list_iter(list, B_FALSE, refresh_iostat, &cb); /* * Iterate over all pools to determine the maximum width * for the pool / device name column across all pools. */ cb.cb_namewidth = 0; (void) pool_list_iter(list, B_FALSE, get_namewidth, &cb); if (timestamp_fmt != NODATE) print_timestamp(timestamp_fmt); /* * If it's the first time, or verbose mode, print the header. */ if (++cb.cb_iteration == 1 || verbose) print_iostat_header(&cb); (void) pool_list_iter(list, B_FALSE, print_iostat, &cb); /* * If there's more than one pool, and we're not in verbose mode * (which prints a separator for us), then print a separator. */ if (npools > 1 && !verbose) print_iostat_separator(&cb); if (verbose) (void) printf("\n"); /* * Flush the output so that redirection to a file isn't buffered * indefinitely. */ (void) fflush(stdout); if (interval == 0) break; if (count != 0 && --count == 0) break; (void) sleep(interval); } pool_list_free(list); return (ret); } typedef struct list_cbdata { boolean_t cb_verbose; int cb_namewidth; boolean_t cb_scripted; zprop_list_t *cb_proplist; boolean_t cb_literal; } list_cbdata_t; /* * Given a list of columns to display, output appropriate headers for each one. */ static void print_header(list_cbdata_t *cb) { zprop_list_t *pl = cb->cb_proplist; char headerbuf[ZPOOL_MAXPROPLEN]; const char *header; boolean_t first = B_TRUE; boolean_t right_justify; size_t width = 0; for (; pl != NULL; pl = pl->pl_next) { width = pl->pl_width; if (first && cb->cb_verbose) { /* * Reset the width to accommodate the verbose listing * of devices. */ width = cb->cb_namewidth; } if (!first) (void) printf(" "); else first = B_FALSE; right_justify = B_FALSE; if (pl->pl_prop != ZPROP_INVAL) { header = zpool_prop_column_name(pl->pl_prop); right_justify = zpool_prop_align_right(pl->pl_prop); } else { int i; for (i = 0; pl->pl_user_prop[i] != '\0'; i++) headerbuf[i] = toupper(pl->pl_user_prop[i]); headerbuf[i] = '\0'; header = headerbuf; } if (pl->pl_next == NULL && !right_justify) (void) printf("%s", header); else if (right_justify) (void) printf("%*s", width, header); else (void) printf("%-*s", width, header); } (void) printf("\n"); } /* * Given a pool and a list of properties, print out all the properties according * to the described layout. */ static void print_pool(zpool_handle_t *zhp, list_cbdata_t *cb) { zprop_list_t *pl = cb->cb_proplist; boolean_t first = B_TRUE; char property[ZPOOL_MAXPROPLEN]; char *propstr; boolean_t right_justify; size_t width; for (; pl != NULL; pl = pl->pl_next) { width = pl->pl_width; if (first && cb->cb_verbose) { /* * Reset the width to accommodate the verbose listing * of devices. */ width = cb->cb_namewidth; } if (!first) { if (cb->cb_scripted) (void) printf("\t"); else (void) printf(" "); } else { first = B_FALSE; } right_justify = B_FALSE; if (pl->pl_prop != ZPROP_INVAL) { if (zpool_get_prop(zhp, pl->pl_prop, property, sizeof (property), NULL, cb->cb_literal) != 0) propstr = "-"; else propstr = property; right_justify = zpool_prop_align_right(pl->pl_prop); } else if ((zpool_prop_feature(pl->pl_user_prop) || zpool_prop_unsupported(pl->pl_user_prop)) && zpool_prop_get_feature(zhp, pl->pl_user_prop, property, sizeof (property)) == 0) { propstr = property; } else { propstr = "-"; } /* * If this is being called in scripted mode, or if this is the * last column and it is left-justified, don't include a width * format specifier. */ if (cb->cb_scripted || (pl->pl_next == NULL && !right_justify)) (void) printf("%s", propstr); else if (right_justify) (void) printf("%*s", width, propstr); else (void) printf("%-*s", width, propstr); } (void) printf("\n"); } static void print_one_column(zpool_prop_t prop, uint64_t value, boolean_t scripted, boolean_t valid) { char propval[64]; boolean_t fixed; size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL); switch (prop) { case ZPOOL_PROP_EXPANDSZ: if (value == 0) (void) strlcpy(propval, "-", sizeof (propval)); else zfs_nicenum(value, propval, sizeof (propval)); break; case ZPOOL_PROP_FRAGMENTATION: if (value == ZFS_FRAG_INVALID) { (void) strlcpy(propval, "-", sizeof (propval)); } else { (void) snprintf(propval, sizeof (propval), "%llu%%", value); } break; case ZPOOL_PROP_CAPACITY: (void) snprintf(propval, sizeof (propval), "%llu%%", value); break; default: zfs_nicenum(value, propval, sizeof (propval)); } if (!valid) (void) strlcpy(propval, "-", sizeof (propval)); if (scripted) (void) printf("\t%s", propval); else (void) printf(" %*s", width, propval); } void print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv, list_cbdata_t *cb, int depth) { nvlist_t **child; vdev_stat_t *vs; uint_t c, children; char *vname; boolean_t scripted = cb->cb_scripted; verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &c) == 0); if (name != NULL) { boolean_t toplevel = (vs->vs_space != 0); uint64_t cap; if (scripted) (void) printf("\t%s", name); else if (strlen(name) + depth > cb->cb_namewidth) (void) printf("%*s%s", depth, "", name); else (void) printf("%*s%s%*s", depth, "", name, (int)(cb->cb_namewidth - strlen(name) - depth), ""); /* * Print the properties for the individual vdevs. Some * properties are only applicable to toplevel vdevs. The * 'toplevel' boolean value is passed to the print_one_column() * to indicate that the value is valid. */ print_one_column(ZPOOL_PROP_SIZE, vs->vs_space, scripted, toplevel); print_one_column(ZPOOL_PROP_ALLOCATED, vs->vs_alloc, scripted, toplevel); print_one_column(ZPOOL_PROP_FREE, vs->vs_space - vs->vs_alloc, scripted, toplevel); print_one_column(ZPOOL_PROP_EXPANDSZ, vs->vs_esize, scripted, B_TRUE); print_one_column(ZPOOL_PROP_FRAGMENTATION, vs->vs_fragmentation, scripted, (vs->vs_fragmentation != ZFS_FRAG_INVALID && toplevel)); cap = (vs->vs_space == 0) ? 0 : (vs->vs_alloc * 100 / vs->vs_space); print_one_column(ZPOOL_PROP_CAPACITY, cap, scripted, toplevel); (void) printf("\n"); } if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) return; for (c = 0; c < children; c++) { uint64_t ishole = B_FALSE; if (nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_HOLE, &ishole) == 0 && ishole) continue; vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE); print_list_stats(zhp, vname, child[c], cb, depth + 2); free(vname); } /* * Include level 2 ARC devices in iostat output */ if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_L2CACHE, &child, &children) != 0) return; if (children > 0) { (void) printf("%-*s - - - - - " "-\n", cb->cb_namewidth, "cache"); for (c = 0; c < children; c++) { vname = zpool_vdev_name(g_zfs, zhp, child[c], B_FALSE); print_list_stats(zhp, vname, child[c], cb, depth + 2); free(vname); } } } /* * Generic callback function to list a pool. */ int list_callback(zpool_handle_t *zhp, void *data) { list_cbdata_t *cbp = data; nvlist_t *config; nvlist_t *nvroot; config = zpool_get_config(zhp, NULL); print_pool(zhp, cbp); if (!cbp->cb_verbose) return (0); verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); print_list_stats(zhp, NULL, nvroot, cbp, 0); return (0); } /* * zpool list [-Hp] [-o prop[,prop]*] [-T d|u] [pool] ... [interval [count]] * * -H Scripted mode. Don't display headers, and separate properties * by a single tab. * -o List of properties to display. Defaults to * "name,size,allocated,free,expandsize,fragmentation,capacity," * "dedupratio,health,altroot" * -p Diplay values in parsable (exact) format. * -T Display a timestamp in date(1) or Unix format * * List all pools in the system, whether or not they're healthy. Output space * statistics for each one, as well as health status summary. */ int zpool_do_list(int argc, char **argv) { int c; int ret; list_cbdata_t cb = { 0 }; static char default_props[] = "name,size,allocated,free,expandsize,fragmentation,capacity," "dedupratio,health,altroot"; char *props = default_props; unsigned long interval = 0, count = 0; zpool_list_t *list; boolean_t first = B_TRUE; /* check options */ while ((c = getopt(argc, argv, ":Ho:pT:v")) != -1) { switch (c) { case 'H': cb.cb_scripted = B_TRUE; break; case 'o': props = optarg; break; case 'p': cb.cb_literal = B_TRUE; break; case 'T': get_timestamp_arg(*optarg); break; case 'v': cb.cb_verbose = B_TRUE; break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); usage(B_FALSE); break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; get_interval_count(&argc, argv, &interval, &count); if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) != 0) usage(B_FALSE); for (;;) { if ((list = pool_list_get(argc, argv, &cb.cb_proplist, &ret)) == NULL) return (1); if (pool_list_count(list) == 0) break; cb.cb_namewidth = 0; (void) pool_list_iter(list, B_FALSE, get_namewidth, &cb); if (timestamp_fmt != NODATE) print_timestamp(timestamp_fmt); if (!cb.cb_scripted && (first || cb.cb_verbose)) { print_header(&cb); first = B_FALSE; } ret = pool_list_iter(list, B_TRUE, list_callback, &cb); if (interval == 0) break; if (count != 0 && --count == 0) break; pool_list_free(list); (void) sleep(interval); } if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) { (void) printf(gettext("no pools available\n")); ret = 0; } pool_list_free(list); zprop_free_list(cb.cb_proplist); return (ret); } static nvlist_t * zpool_get_vdev_by_name(nvlist_t *nv, char *name) { nvlist_t **child; uint_t c, children; nvlist_t *match; char *path; if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) { verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_PATH, &path) == 0); if (strncmp(name, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) name += sizeof(_PATH_DEV) - 1; if (strncmp(path, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0) path += sizeof(_PATH_DEV) - 1; if (strcmp(name, path) == 0) return (nv); return (NULL); } for (c = 0; c < children; c++) if ((match = zpool_get_vdev_by_name(child[c], name)) != NULL) return (match); return (NULL); } static int zpool_do_attach_or_replace(int argc, char **argv, int replacing) { boolean_t force = B_FALSE; int c; nvlist_t *nvroot; char *poolname, *old_disk, *new_disk; zpool_handle_t *zhp; int ret; /* check options */ while ((c = getopt(argc, argv, "f")) != -1) { switch (c) { case 'f': force = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* get pool name and check number of arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name argument\n")); usage(B_FALSE); } poolname = argv[0]; if (argc < 2) { (void) fprintf(stderr, gettext("missing specification\n")); usage(B_FALSE); } old_disk = argv[1]; if (argc < 3) { if (!replacing) { (void) fprintf(stderr, gettext("missing specification\n")); usage(B_FALSE); } new_disk = old_disk; argc -= 1; argv += 1; } else { new_disk = argv[2]; argc -= 2; argv += 2; } if (argc > 1) { (void) fprintf(stderr, gettext("too many arguments\n")); usage(B_FALSE); } if ((zhp = zpool_open(g_zfs, poolname)) == NULL) return (1); if (zpool_get_config(zhp, NULL) == NULL) { (void) fprintf(stderr, gettext("pool '%s' is unavailable\n"), poolname); zpool_close(zhp); return (1); } nvroot = make_root_vdev(zhp, force, B_FALSE, replacing, B_FALSE, argc, argv); if (nvroot == NULL) { zpool_close(zhp); return (1); } ret = zpool_vdev_attach(zhp, old_disk, new_disk, nvroot, replacing); nvlist_free(nvroot); zpool_close(zhp); return (ret); } /* * zpool replace [-f] * * -f Force attach, even if appears to be in use. * * Replace with . */ /* ARGSUSED */ int zpool_do_replace(int argc, char **argv) { return (zpool_do_attach_or_replace(argc, argv, B_TRUE)); } /* * zpool attach [-f] * * -f Force attach, even if appears to be in use. * * Attach to the mirror containing . If is not * part of a mirror, then will be transformed into a mirror of * and . In either case, will begin life * with a DTL of [0, now], and will immediately begin to resilver itself. */ int zpool_do_attach(int argc, char **argv) { return (zpool_do_attach_or_replace(argc, argv, B_FALSE)); } /* * zpool detach [-f] * * -f Force detach of , even if DTLs argue against it * (not supported yet) * * Detach a device from a mirror. The operation will be refused if * is the last device in the mirror, or if the DTLs indicate that this device * has the only valid copy of some data. */ /* ARGSUSED */ int zpool_do_detach(int argc, char **argv) { int c; char *poolname, *path; zpool_handle_t *zhp; int ret; /* check options */ while ((c = getopt(argc, argv, "f")) != -1) { switch (c) { case 'f': case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* get pool name and check number of arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name argument\n")); usage(B_FALSE); } if (argc < 2) { (void) fprintf(stderr, gettext("missing specification\n")); usage(B_FALSE); } poolname = argv[0]; path = argv[1]; if ((zhp = zpool_open(g_zfs, poolname)) == NULL) return (1); ret = zpool_vdev_detach(zhp, path); zpool_close(zhp); return (ret); } /* * zpool split [-n] [-o prop=val] ... * [-o mntopt] ... * [-R altroot] [ ...] * * -n Do not split the pool, but display the resulting layout if * it were to be split. * -o Set property=value, or set mount options. * -R Mount the split-off pool under an alternate root. * * Splits the named pool and gives it the new pool name. Devices to be split * off may be listed, provided that no more than one device is specified * per top-level vdev mirror. The newly split pool is left in an exported * state unless -R is specified. * * Restrictions: the top-level of the pool pool must only be made up of * mirrors; all devices in the pool must be healthy; no device may be * undergoing a resilvering operation. */ int zpool_do_split(int argc, char **argv) { char *srcpool, *newpool, *propval; char *mntopts = NULL; splitflags_t flags; int c, ret = 0; zpool_handle_t *zhp; nvlist_t *config, *props = NULL; flags.dryrun = B_FALSE; flags.import = B_FALSE; /* check options */ while ((c = getopt(argc, argv, ":R:no:")) != -1) { switch (c) { case 'R': flags.import = B_TRUE; if (add_prop_list( zpool_prop_to_name(ZPOOL_PROP_ALTROOT), optarg, &props, B_TRUE) != 0) { if (props) nvlist_free(props); usage(B_FALSE); } break; case 'n': flags.dryrun = B_TRUE; break; case 'o': if ((propval = strchr(optarg, '=')) != NULL) { *propval = '\0'; propval++; if (add_prop_list(optarg, propval, &props, B_TRUE) != 0) { if (props) nvlist_free(props); usage(B_FALSE); } } else { mntopts = optarg; } break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); usage(B_FALSE); break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); break; } } if (!flags.import && mntopts != NULL) { (void) fprintf(stderr, gettext("setting mntopts is only " "valid when importing the pool\n")); usage(B_FALSE); } argc -= optind; argv += optind; if (argc < 1) { (void) fprintf(stderr, gettext("Missing pool name\n")); usage(B_FALSE); } if (argc < 2) { (void) fprintf(stderr, gettext("Missing new pool name\n")); usage(B_FALSE); } srcpool = argv[0]; newpool = argv[1]; argc -= 2; argv += 2; if ((zhp = zpool_open(g_zfs, srcpool)) == NULL) return (1); config = split_mirror_vdev(zhp, newpool, props, flags, argc, argv); if (config == NULL) { ret = 1; } else { if (flags.dryrun) { (void) printf(gettext("would create '%s' with the " "following layout:\n\n"), newpool); print_vdev_tree(NULL, newpool, config, 0, B_FALSE); } nvlist_free(config); } zpool_close(zhp); if (ret != 0 || flags.dryrun || !flags.import) return (ret); /* * The split was successful. Now we need to open the new * pool and import it. */ if ((zhp = zpool_open_canfail(g_zfs, newpool)) == NULL) return (1); if (zpool_get_state(zhp) != POOL_STATE_UNAVAIL && zpool_enable_datasets(zhp, mntopts, 0) != 0) { ret = 1; (void) fprintf(stderr, gettext("Split was successful, but " "the datasets could not all be mounted\n")); (void) fprintf(stderr, gettext("Try doing '%s' with a " "different altroot\n"), "zpool import"); } zpool_close(zhp); return (ret); } /* * zpool online ... */ int zpool_do_online(int argc, char **argv) { int c, i; char *poolname; zpool_handle_t *zhp; int ret = 0; vdev_state_t newstate; int flags = 0; /* check options */ while ((c = getopt(argc, argv, "et")) != -1) { switch (c) { case 'e': flags |= ZFS_ONLINE_EXPAND; break; case 't': case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* get pool name and check number of arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name\n")); usage(B_FALSE); } if (argc < 2) { (void) fprintf(stderr, gettext("missing device name\n")); usage(B_FALSE); } poolname = argv[0]; if ((zhp = zpool_open(g_zfs, poolname)) == NULL) return (1); for (i = 1; i < argc; i++) { if (zpool_vdev_online(zhp, argv[i], flags, &newstate) == 0) { if (newstate != VDEV_STATE_HEALTHY) { (void) printf(gettext("warning: device '%s' " "onlined, but remains in faulted state\n"), argv[i]); if (newstate == VDEV_STATE_FAULTED) (void) printf(gettext("use 'zpool " "clear' to restore a faulted " "device\n")); else (void) printf(gettext("use 'zpool " "replace' to replace devices " "that are no longer present\n")); } } else { ret = 1; } } zpool_close(zhp); return (ret); } /* * zpool offline [-ft] ... * * -f Force the device into the offline state, even if doing * so would appear to compromise pool availability. * (not supported yet) * * -t Only take the device off-line temporarily. The offline * state will not be persistent across reboots. */ /* ARGSUSED */ int zpool_do_offline(int argc, char **argv) { int c, i; char *poolname; zpool_handle_t *zhp; int ret = 0; boolean_t istmp = B_FALSE; /* check options */ while ((c = getopt(argc, argv, "ft")) != -1) { switch (c) { case 't': istmp = B_TRUE; break; case 'f': case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* get pool name and check number of arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name\n")); usage(B_FALSE); } if (argc < 2) { (void) fprintf(stderr, gettext("missing device name\n")); usage(B_FALSE); } poolname = argv[0]; if ((zhp = zpool_open(g_zfs, poolname)) == NULL) return (1); for (i = 1; i < argc; i++) { if (zpool_vdev_offline(zhp, argv[i], istmp) != 0) ret = 1; } zpool_close(zhp); return (ret); } /* * zpool clear [device] * * Clear all errors associated with a pool or a particular device. */ int zpool_do_clear(int argc, char **argv) { int c; int ret = 0; boolean_t dryrun = B_FALSE; boolean_t do_rewind = B_FALSE; boolean_t xtreme_rewind = B_FALSE; uint32_t rewind_policy = ZPOOL_NO_REWIND; nvlist_t *policy = NULL; zpool_handle_t *zhp; char *pool, *device; /* check options */ while ((c = getopt(argc, argv, "FnX")) != -1) { switch (c) { case 'F': do_rewind = B_TRUE; break; case 'n': dryrun = B_TRUE; break; case 'X': xtreme_rewind = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name\n")); usage(B_FALSE); } if (argc > 2) { (void) fprintf(stderr, gettext("too many arguments\n")); usage(B_FALSE); } if ((dryrun || xtreme_rewind) && !do_rewind) { (void) fprintf(stderr, gettext("-n or -X only meaningful with -F\n")); usage(B_FALSE); } if (dryrun) rewind_policy = ZPOOL_TRY_REWIND; else if (do_rewind) rewind_policy = ZPOOL_DO_REWIND; if (xtreme_rewind) rewind_policy |= ZPOOL_EXTREME_REWIND; /* In future, further rewind policy choices can be passed along here */ if (nvlist_alloc(&policy, NV_UNIQUE_NAME, 0) != 0 || nvlist_add_uint32(policy, ZPOOL_REWIND_REQUEST, rewind_policy) != 0) return (1); pool = argv[0]; device = argc == 2 ? argv[1] : NULL; if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) { nvlist_free(policy); return (1); } if (zpool_clear(zhp, device, policy) != 0) ret = 1; zpool_close(zhp); nvlist_free(policy); return (ret); } /* * zpool reguid */ int zpool_do_reguid(int argc, char **argv) { int c; char *poolname; zpool_handle_t *zhp; int ret = 0; /* check options */ while ((c = getopt(argc, argv, "")) != -1) { switch (c) { case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; /* get pool name and check number of arguments */ if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name\n")); usage(B_FALSE); } if (argc > 1) { (void) fprintf(stderr, gettext("too many arguments\n")); usage(B_FALSE); } poolname = argv[0]; if ((zhp = zpool_open(g_zfs, poolname)) == NULL) return (1); ret = zpool_reguid(zhp); zpool_close(zhp); return (ret); } /* * zpool reopen * * Reopen the pool so that the kernel can update the sizes of all vdevs. */ int zpool_do_reopen(int argc, char **argv) { int c; int ret = 0; zpool_handle_t *zhp; char *pool; /* check options */ while ((c = getopt(argc, argv, "")) != -1) { switch (c) { case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc--; argv++; if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name\n")); usage(B_FALSE); } if (argc > 1) { (void) fprintf(stderr, gettext("too many arguments\n")); usage(B_FALSE); } pool = argv[0]; if ((zhp = zpool_open_canfail(g_zfs, pool)) == NULL) return (1); ret = zpool_reopen(zhp); zpool_close(zhp); return (ret); } typedef struct scrub_cbdata { int cb_type; int cb_argc; char **cb_argv; } scrub_cbdata_t; int scrub_callback(zpool_handle_t *zhp, void *data) { scrub_cbdata_t *cb = data; int err; /* * Ignore faulted pools. */ if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) { (void) fprintf(stderr, gettext("cannot scrub '%s': pool is " "currently unavailable\n"), zpool_get_name(zhp)); return (1); } err = zpool_scan(zhp, cb->cb_type); return (err != 0); } /* * zpool scrub [-s] ... * * -s Stop. Stops any in-progress scrub. */ int zpool_do_scrub(int argc, char **argv) { int c; scrub_cbdata_t cb; cb.cb_type = POOL_SCAN_SCRUB; /* check options */ while ((c = getopt(argc, argv, "s")) != -1) { switch (c) { case 's': cb.cb_type = POOL_SCAN_NONE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } cb.cb_argc = argc; cb.cb_argv = argv; argc -= optind; argv += optind; if (argc < 1) { (void) fprintf(stderr, gettext("missing pool name argument\n")); usage(B_FALSE); } return (for_each_pool(argc, argv, B_TRUE, NULL, scrub_callback, &cb)); } typedef struct status_cbdata { int cb_count; boolean_t cb_allpools; boolean_t cb_verbose; boolean_t cb_explain; boolean_t cb_first; boolean_t cb_dedup_stats; } status_cbdata_t; /* * Print out detailed scrub status. */ void print_scan_status(pool_scan_stat_t *ps) { time_t start, end; uint64_t elapsed, mins_left, hours_left; uint64_t pass_exam, examined, total; uint_t rate; double fraction_done; char processed_buf[7], examined_buf[7], total_buf[7], rate_buf[7]; (void) printf(gettext(" scan: ")); /* If there's never been a scan, there's not much to say. */ if (ps == NULL || ps->pss_func == POOL_SCAN_NONE || ps->pss_func >= POOL_SCAN_FUNCS) { (void) printf(gettext("none requested\n")); return; } start = ps->pss_start_time; end = ps->pss_end_time; zfs_nicenum(ps->pss_processed, processed_buf, sizeof (processed_buf)); assert(ps->pss_func == POOL_SCAN_SCRUB || ps->pss_func == POOL_SCAN_RESILVER); /* * Scan is finished or canceled. */ if (ps->pss_state == DSS_FINISHED) { uint64_t minutes_taken = (end - start) / 60; char *fmt; if (ps->pss_func == POOL_SCAN_SCRUB) { fmt = gettext("scrub repaired %s in %lluh%um with " "%llu errors on %s"); } else if (ps->pss_func == POOL_SCAN_RESILVER) { fmt = gettext("resilvered %s in %lluh%um with " "%llu errors on %s"); } /* LINTED */ (void) printf(fmt, processed_buf, (u_longlong_t)(minutes_taken / 60), (uint_t)(minutes_taken % 60), (u_longlong_t)ps->pss_errors, ctime((time_t *)&end)); return; } else if (ps->pss_state == DSS_CANCELED) { if (ps->pss_func == POOL_SCAN_SCRUB) { (void) printf(gettext("scrub canceled on %s"), ctime(&end)); } else if (ps->pss_func == POOL_SCAN_RESILVER) { (void) printf(gettext("resilver canceled on %s"), ctime(&end)); } return; } assert(ps->pss_state == DSS_SCANNING); /* * Scan is in progress. */ if (ps->pss_func == POOL_SCAN_SCRUB) { (void) printf(gettext("scrub in progress since %s"), ctime(&start)); } else if (ps->pss_func == POOL_SCAN_RESILVER) { (void) printf(gettext("resilver in progress since %s"), ctime(&start)); } examined = ps->pss_examined ? ps->pss_examined : 1; total = ps->pss_to_examine; fraction_done = (double)examined / total; /* elapsed time for this pass */ elapsed = time(NULL) - ps->pss_pass_start; elapsed = elapsed ? elapsed : 1; pass_exam = ps->pss_pass_exam ? ps->pss_pass_exam : 1; rate = pass_exam / elapsed; rate = rate ? rate : 1; mins_left = ((total - examined) / rate) / 60; hours_left = mins_left / 60; zfs_nicenum(examined, examined_buf, sizeof (examined_buf)); zfs_nicenum(total, total_buf, sizeof (total_buf)); zfs_nicenum(rate, rate_buf, sizeof (rate_buf)); /* * do not print estimated time if hours_left is more than 30 days */ (void) printf(gettext(" %s scanned out of %s at %s/s"), examined_buf, total_buf, rate_buf); if (hours_left < (30 * 24)) { (void) printf(gettext(", %lluh%um to go\n"), (u_longlong_t)hours_left, (uint_t)(mins_left % 60)); } else { (void) printf(gettext( ", (scan is slow, no estimated time)\n")); } if (ps->pss_func == POOL_SCAN_RESILVER) { (void) printf(gettext(" %s resilvered, %.2f%% done\n"), processed_buf, 100 * fraction_done); } else if (ps->pss_func == POOL_SCAN_SCRUB) { (void) printf(gettext(" %s repaired, %.2f%% done\n"), processed_buf, 100 * fraction_done); } } static void print_error_log(zpool_handle_t *zhp) { nvlist_t *nverrlist = NULL; nvpair_t *elem; char *pathname; size_t len = MAXPATHLEN * 2; if (zpool_get_errlog(zhp, &nverrlist) != 0) { (void) printf("errors: List of errors unavailable " "(insufficient privileges)\n"); return; } (void) printf("errors: Permanent errors have been " "detected in the following files:\n\n"); pathname = safe_malloc(len); elem = NULL; while ((elem = nvlist_next_nvpair(nverrlist, elem)) != NULL) { nvlist_t *nv; uint64_t dsobj, obj; verify(nvpair_value_nvlist(elem, &nv) == 0); verify(nvlist_lookup_uint64(nv, ZPOOL_ERR_DATASET, &dsobj) == 0); verify(nvlist_lookup_uint64(nv, ZPOOL_ERR_OBJECT, &obj) == 0); zpool_obj_to_path(zhp, dsobj, obj, pathname, len); (void) printf("%7s %s\n", "", pathname); } free(pathname); nvlist_free(nverrlist); } static void print_spares(zpool_handle_t *zhp, nvlist_t **spares, uint_t nspares, int namewidth) { uint_t i; char *name; if (nspares == 0) return; (void) printf(gettext("\tspares\n")); for (i = 0; i < nspares; i++) { name = zpool_vdev_name(g_zfs, zhp, spares[i], B_FALSE); print_status_config(zhp, name, spares[i], namewidth, 2, B_TRUE); free(name); } } static void print_l2cache(zpool_handle_t *zhp, nvlist_t **l2cache, uint_t nl2cache, int namewidth) { uint_t i; char *name; if (nl2cache == 0) return; (void) printf(gettext("\tcache\n")); for (i = 0; i < nl2cache; i++) { name = zpool_vdev_name(g_zfs, zhp, l2cache[i], B_FALSE); print_status_config(zhp, name, l2cache[i], namewidth, 2, B_FALSE); free(name); } } static void print_dedup_stats(nvlist_t *config) { ddt_histogram_t *ddh; ddt_stat_t *dds; ddt_object_t *ddo; uint_t c; /* * If the pool was faulted then we may not have been able to * obtain the config. Otherwise, if we have anything in the dedup * table continue processing the stats. */ if (nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_OBJ_STATS, (uint64_t **)&ddo, &c) != 0) return; (void) printf("\n"); (void) printf(gettext(" dedup: ")); if (ddo->ddo_count == 0) { (void) printf(gettext("no DDT entries\n")); return; } (void) printf("DDT entries %llu, size %llu on disk, %llu in core\n", (u_longlong_t)ddo->ddo_count, (u_longlong_t)ddo->ddo_dspace, (u_longlong_t)ddo->ddo_mspace); verify(nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_STATS, (uint64_t **)&dds, &c) == 0); verify(nvlist_lookup_uint64_array(config, ZPOOL_CONFIG_DDT_HISTOGRAM, (uint64_t **)&ddh, &c) == 0); zpool_dump_ddt(dds, ddh); } /* * Display a summary of pool status. Displays a summary such as: * * pool: tank * status: DEGRADED * reason: One or more devices ... * see: http://illumos.org/msg/ZFS-xxxx-01 * config: * mirror DEGRADED * c1t0d0 OK * c2t0d0 UNAVAIL * * When given the '-v' option, we print out the complete config. If the '-e' * option is specified, then we print out error rate information as well. */ int status_callback(zpool_handle_t *zhp, void *data) { status_cbdata_t *cbp = data; nvlist_t *config, *nvroot; char *msgid; int reason; const char *health; uint_t c; vdev_stat_t *vs; config = zpool_get_config(zhp, NULL); reason = zpool_get_status(zhp, &msgid); cbp->cb_count++; /* * If we were given 'zpool status -x', only report those pools with * problems. */ if (cbp->cb_explain && (reason == ZPOOL_STATUS_OK || reason == ZPOOL_STATUS_VERSION_OLDER || reason == ZPOOL_STATUS_NON_NATIVE_ASHIFT || reason == ZPOOL_STATUS_FEAT_DISABLED)) { if (!cbp->cb_allpools) { (void) printf(gettext("pool '%s' is healthy\n"), zpool_get_name(zhp)); if (cbp->cb_first) cbp->cb_first = B_FALSE; } return (0); } if (cbp->cb_first) cbp->cb_first = B_FALSE; else (void) printf("\n"); verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&vs, &c) == 0); health = zpool_state_to_name(vs->vs_state, vs->vs_aux); (void) printf(gettext(" pool: %s\n"), zpool_get_name(zhp)); (void) printf(gettext(" state: %s\n"), health); switch (reason) { case ZPOOL_STATUS_MISSING_DEV_R: (void) printf(gettext("status: One or more devices could not " "be opened. Sufficient replicas exist for\n\tthe pool to " "continue functioning in a degraded state.\n")); (void) printf(gettext("action: Attach the missing device and " "online it using 'zpool online'.\n")); break; case ZPOOL_STATUS_MISSING_DEV_NR: (void) printf(gettext("status: One or more devices could not " "be opened. There are insufficient\n\treplicas for the " "pool to continue functioning.\n")); (void) printf(gettext("action: Attach the missing device and " "online it using 'zpool online'.\n")); break; case ZPOOL_STATUS_CORRUPT_LABEL_R: (void) printf(gettext("status: One or more devices could not " "be used because the label is missing or\n\tinvalid. " "Sufficient replicas exist for the pool to continue\n\t" "functioning in a degraded state.\n")); (void) printf(gettext("action: Replace the device using " "'zpool replace'.\n")); break; case ZPOOL_STATUS_CORRUPT_LABEL_NR: (void) printf(gettext("status: One or more devices could not " "be used because the label is missing \n\tor invalid. " "There are insufficient replicas for the pool to " "continue\n\tfunctioning.\n")); zpool_explain_recover(zpool_get_handle(zhp), zpool_get_name(zhp), reason, config); break; case ZPOOL_STATUS_FAILING_DEV: (void) printf(gettext("status: One or more devices has " "experienced an unrecoverable error. An\n\tattempt was " "made to correct the error. Applications are " "unaffected.\n")); (void) printf(gettext("action: Determine if the device needs " "to be replaced, and clear the errors\n\tusing " "'zpool clear' or replace the device with 'zpool " "replace'.\n")); break; case ZPOOL_STATUS_OFFLINE_DEV: (void) printf(gettext("status: One or more devices has " "been taken offline by the administrator.\n\tSufficient " "replicas exist for the pool to continue functioning in " "a\n\tdegraded state.\n")); (void) printf(gettext("action: Online the device using " "'zpool online' or replace the device with\n\t'zpool " "replace'.\n")); break; case ZPOOL_STATUS_REMOVED_DEV: (void) printf(gettext("status: One or more devices has " "been removed by the administrator.\n\tSufficient " "replicas exist for the pool to continue functioning in " "a\n\tdegraded state.\n")); (void) printf(gettext("action: Online the device using " "'zpool online' or replace the device with\n\t'zpool " "replace'.\n")); break; case ZPOOL_STATUS_RESILVERING: (void) printf(gettext("status: One or more devices is " "currently being resilvered. The pool will\n\tcontinue " "to function, possibly in a degraded state.\n")); (void) printf(gettext("action: Wait for the resilver to " "complete.\n")); break; case ZPOOL_STATUS_CORRUPT_DATA: (void) printf(gettext("status: One or more devices has " "experienced an error resulting in data\n\tcorruption. " "Applications may be affected.\n")); (void) printf(gettext("action: Restore the file in question " "if possible. Otherwise restore the\n\tentire pool from " "backup.\n")); break; case ZPOOL_STATUS_CORRUPT_POOL: (void) printf(gettext("status: The pool metadata is corrupted " "and the pool cannot be opened.\n")); zpool_explain_recover(zpool_get_handle(zhp), zpool_get_name(zhp), reason, config); break; case ZPOOL_STATUS_VERSION_OLDER: (void) printf(gettext("status: The pool is formatted using a " "legacy on-disk format. The pool can\n\tstill be used, " "but some features are unavailable.\n")); (void) printf(gettext("action: Upgrade the pool using 'zpool " "upgrade'. Once this is done, the\n\tpool will no longer " "be accessible on software that does not support feature\n" "\tflags.\n")); break; case ZPOOL_STATUS_VERSION_NEWER: (void) printf(gettext("status: The pool has been upgraded to a " "newer, incompatible on-disk version.\n\tThe pool cannot " "be accessed on this system.\n")); (void) printf(gettext("action: Access the pool from a system " "running more recent software, or\n\trestore the pool from " "backup.\n")); break; case ZPOOL_STATUS_FEAT_DISABLED: (void) printf(gettext("status: Some supported features are not " "enabled on the pool. The pool can\n\tstill be used, but " "some features are unavailable.\n")); (void) printf(gettext("action: Enable all features using " "'zpool upgrade'. Once this is done,\n\tthe pool may no " "longer be accessible by software that does not support\n\t" "the features. See zpool-features(7) for details.\n")); break; case ZPOOL_STATUS_UNSUP_FEAT_READ: (void) printf(gettext("status: The pool cannot be accessed on " "this system because it uses the\n\tfollowing feature(s) " "not supported on this system:\n")); zpool_print_unsup_feat(config); (void) printf("\n"); (void) printf(gettext("action: Access the pool from a system " "that supports the required feature(s),\n\tor restore the " "pool from backup.\n")); break; case ZPOOL_STATUS_UNSUP_FEAT_WRITE: (void) printf(gettext("status: The pool can only be accessed " "in read-only mode on this system. It\n\tcannot be " "accessed in read-write mode because it uses the " "following\n\tfeature(s) not supported on this system:\n")); zpool_print_unsup_feat(config); (void) printf("\n"); (void) printf(gettext("action: The pool cannot be accessed in " "read-write mode. Import the pool with\n" "\t\"-o readonly=on\", access the pool from a system that " "supports the\n\trequired feature(s), or restore the " "pool from backup.\n")); break; case ZPOOL_STATUS_FAULTED_DEV_R: (void) printf(gettext("status: One or more devices are " "faulted in response to persistent errors.\n\tSufficient " "replicas exist for the pool to continue functioning " "in a\n\tdegraded state.\n")); (void) printf(gettext("action: Replace the faulted device, " "or use 'zpool clear' to mark the device\n\trepaired.\n")); break; case ZPOOL_STATUS_FAULTED_DEV_NR: (void) printf(gettext("status: One or more devices are " "faulted in response to persistent errors. There are " "insufficient replicas for the pool to\n\tcontinue " "functioning.\n")); (void) printf(gettext("action: Destroy and re-create the pool " "from a backup source. Manually marking the device\n" "\trepaired using 'zpool clear' may allow some data " "to be recovered.\n")); break; case ZPOOL_STATUS_IO_FAILURE_WAIT: case ZPOOL_STATUS_IO_FAILURE_CONTINUE: (void) printf(gettext("status: One or more devices are " "faulted in response to IO failures.\n")); (void) printf(gettext("action: Make sure the affected devices " "are connected, then run 'zpool clear'.\n")); break; case ZPOOL_STATUS_BAD_LOG: (void) printf(gettext("status: An intent log record " "could not be read.\n" "\tWaiting for adminstrator intervention to fix the " "faulted pool.\n")); (void) printf(gettext("action: Either restore the affected " "device(s) and run 'zpool online',\n" "\tor ignore the intent log records by running " "'zpool clear'.\n")); break; case ZPOOL_STATUS_NON_NATIVE_ASHIFT: (void) printf(gettext("status: One or more devices are " "configured to use a non-native block size.\n" "\tExpect reduced performance.\n")); (void) printf(gettext("action: Replace affected devices with " "devices that support the\n\tconfigured block size, or " "migrate data to a properly configured\n\tpool.\n")); break; default: /* * The remaining errors can't actually be generated, yet. */ assert(reason == ZPOOL_STATUS_OK); } if (msgid != NULL) (void) printf(gettext(" see: http://illumos.org/msg/%s\n"), msgid); if (config != NULL) { int namewidth; uint64_t nerr; nvlist_t **spares, **l2cache; uint_t nspares, nl2cache; pool_scan_stat_t *ps = NULL; (void) nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &c); print_scan_status(ps); namewidth = max_width(zhp, nvroot, 0, 0); if (namewidth < 10) namewidth = 10; (void) printf(gettext("config:\n\n")); (void) printf(gettext("\t%-*s %-8s %5s %5s %5s\n"), namewidth, "NAME", "STATE", "READ", "WRITE", "CKSUM"); print_status_config(zhp, zpool_get_name(zhp), nvroot, namewidth, 0, B_FALSE); if (num_logs(nvroot) > 0) print_logs(zhp, nvroot, namewidth, B_TRUE); if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache) == 0) print_l2cache(zhp, l2cache, nl2cache, namewidth); if (nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_SPARES, &spares, &nspares) == 0) print_spares(zhp, spares, nspares, namewidth); if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_ERRCOUNT, &nerr) == 0) { nvlist_t *nverrlist = NULL; /* * If the approximate error count is small, get a * precise count by fetching the entire log and * uniquifying the results. */ if (nerr > 0 && nerr < 100 && !cbp->cb_verbose && zpool_get_errlog(zhp, &nverrlist) == 0) { nvpair_t *elem; elem = NULL; nerr = 0; while ((elem = nvlist_next_nvpair(nverrlist, elem)) != NULL) { nerr++; } } nvlist_free(nverrlist); (void) printf("\n"); if (nerr == 0) (void) printf(gettext("errors: No known data " "errors\n")); else if (!cbp->cb_verbose) (void) printf(gettext("errors: %llu data " "errors, use '-v' for a list\n"), (u_longlong_t)nerr); else print_error_log(zhp); } if (cbp->cb_dedup_stats) print_dedup_stats(config); } else { (void) printf(gettext("config: The configuration cannot be " "determined.\n")); } return (0); } /* * zpool status [-vx] [-T d|u] [pool] ... [interval [count]] * * -v Display complete error logs * -x Display only pools with potential problems * -D Display dedup status (undocumented) * -T Display a timestamp in date(1) or Unix format * * Describes the health status of all pools or some subset. */ int zpool_do_status(int argc, char **argv) { int c; int ret; unsigned long interval = 0, count = 0; status_cbdata_t cb = { 0 }; /* check options */ while ((c = getopt(argc, argv, "vxDT:")) != -1) { switch (c) { case 'v': cb.cb_verbose = B_TRUE; break; case 'x': cb.cb_explain = B_TRUE; break; case 'D': cb.cb_dedup_stats = B_TRUE; break; case 'T': get_timestamp_arg(*optarg); break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; get_interval_count(&argc, argv, &interval, &count); if (argc == 0) cb.cb_allpools = B_TRUE; cb.cb_first = B_TRUE; for (;;) { if (timestamp_fmt != NODATE) print_timestamp(timestamp_fmt); ret = for_each_pool(argc, argv, B_TRUE, NULL, status_callback, &cb); if (argc == 0 && cb.cb_count == 0) (void) printf(gettext("no pools available\n")); else if (cb.cb_explain && cb.cb_first && cb.cb_allpools) (void) printf(gettext("all pools are healthy\n")); if (ret != 0) return (ret); if (interval == 0) break; if (count != 0 && --count == 0) break; (void) sleep(interval); } return (0); } typedef struct upgrade_cbdata { - int cb_first; - char cb_poolname[ZPOOL_MAXNAMELEN]; - int cb_argc; - uint64_t cb_version; - char **cb_argv; + boolean_t cb_first; + boolean_t cb_unavail; + char cb_poolname[ZPOOL_MAXNAMELEN]; + int cb_argc; + uint64_t cb_version; + char **cb_argv; } upgrade_cbdata_t; #ifdef __FreeBSD__ static int is_root_pool(zpool_handle_t *zhp) { static struct statfs sfs; static char *poolname = NULL; static boolean_t stated = B_FALSE; char *slash; if (!stated) { stated = B_TRUE; if (statfs("/", &sfs) == -1) { (void) fprintf(stderr, "Unable to stat root file system: %s.\n", strerror(errno)); return (0); } if (strcmp(sfs.f_fstypename, "zfs") != 0) return (0); poolname = sfs.f_mntfromname; if ((slash = strchr(poolname, '/')) != NULL) *slash = '\0'; } return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0); } static void root_pool_upgrade_check(zpool_handle_t *zhp, char *poolname, int size) { if (poolname[0] == '\0' && is_root_pool(zhp)) (void) strlcpy(poolname, zpool_get_name(zhp), size); } #endif /* FreeBSD */ static int upgrade_version(zpool_handle_t *zhp, uint64_t version) { int ret; nvlist_t *config; uint64_t oldversion; config = zpool_get_config(zhp, NULL); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, &oldversion) == 0); assert(SPA_VERSION_IS_SUPPORTED(oldversion)); assert(oldversion < version); ret = zpool_upgrade(zhp, version); if (ret != 0) return (ret); if (version >= SPA_VERSION_FEATURES) { (void) printf(gettext("Successfully upgraded " "'%s' from version %llu to feature flags.\n"), zpool_get_name(zhp), oldversion); } else { (void) printf(gettext("Successfully upgraded " "'%s' from version %llu to version %llu.\n"), zpool_get_name(zhp), oldversion, version); } return (0); } static int upgrade_enable_all(zpool_handle_t *zhp, int *countp) { int i, ret, count; boolean_t firstff = B_TRUE; nvlist_t *enabled = zpool_get_features(zhp); count = 0; for (i = 0; i < SPA_FEATURES; i++) { const char *fname = spa_feature_table[i].fi_uname; const char *fguid = spa_feature_table[i].fi_guid; if (!nvlist_exists(enabled, fguid)) { char *propname; verify(-1 != asprintf(&propname, "feature@%s", fname)); ret = zpool_set_prop(zhp, propname, ZFS_FEATURE_ENABLED); if (ret != 0) { free(propname); return (ret); } count++; if (firstff) { (void) printf(gettext("Enabled the " "following features on '%s':\n"), zpool_get_name(zhp)); firstff = B_FALSE; } (void) printf(gettext(" %s\n"), fname); free(propname); } } if (countp != NULL) *countp = count; return (0); } static int upgrade_cb(zpool_handle_t *zhp, void *arg) { upgrade_cbdata_t *cbp = arg; nvlist_t *config; uint64_t version; boolean_t printnl = B_FALSE; int ret; + if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) { + (void) fprintf(stderr, gettext("cannot upgrade '%s': pool is " + "currently unavailable.\n\n"), zpool_get_name(zhp)); + cbp->cb_unavail = B_TRUE; + /* Allow iteration to continue. */ + return (0); + } + config = zpool_get_config(zhp, NULL); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, &version) == 0); assert(SPA_VERSION_IS_SUPPORTED(version)); if (version < cbp->cb_version) { cbp->cb_first = B_FALSE; ret = upgrade_version(zhp, cbp->cb_version); if (ret != 0) return (ret); #ifdef __FreeBSD__ root_pool_upgrade_check(zhp, cbp->cb_poolname, sizeof(cbp->cb_poolname)); #endif /* __FreeBSD__ */ printnl = B_TRUE; #ifdef illumos /* * If they did "zpool upgrade -a", then we could * be doing ioctls to different pools. We need * to log this history once to each pool, and bypass * the normal history logging that happens in main(). */ (void) zpool_log_history(g_zfs, history_str); log_history = B_FALSE; #endif } if (cbp->cb_version >= SPA_VERSION_FEATURES) { int count; ret = upgrade_enable_all(zhp, &count); if (ret != 0) return (ret); if (count > 0) { cbp->cb_first = B_FALSE; printnl = B_TRUE; #ifdef __FreeBSD__ root_pool_upgrade_check(zhp, cbp->cb_poolname, sizeof(cbp->cb_poolname)); #endif /* __FreeBSD__ */ /* * If they did "zpool upgrade -a", then we could * be doing ioctls to different pools. We need * to log this history once to each pool, and bypass * the normal history logging that happens in main(). */ (void) zpool_log_history(g_zfs, history_str); log_history = B_FALSE; } } if (printnl) { (void) printf(gettext("\n")); } return (0); } static int +upgrade_list_unavail(zpool_handle_t *zhp, void *arg) +{ + upgrade_cbdata_t *cbp = arg; + + if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) { + if (cbp->cb_first) { + (void) fprintf(stderr, gettext("The following pools " + "are unavailable and cannot be upgraded as this " + "time.\n\n")); + (void) fprintf(stderr, gettext("POOL\n")); + (void) fprintf(stderr, gettext("------------\n")); + cbp->cb_first = B_FALSE; + } + (void) printf(gettext("%s\n"), zpool_get_name(zhp)); + cbp->cb_unavail = B_TRUE; + } + return (0); +} + +static int upgrade_list_older_cb(zpool_handle_t *zhp, void *arg) { upgrade_cbdata_t *cbp = arg; nvlist_t *config; uint64_t version; + if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) { + /* + * This will have been reported by upgrade_list_unavail so + * just allow iteration to continue. + */ + cbp->cb_unavail = B_TRUE; + return (0); + } + config = zpool_get_config(zhp, NULL); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, &version) == 0); assert(SPA_VERSION_IS_SUPPORTED(version)); if (version < SPA_VERSION_FEATURES) { if (cbp->cb_first) { (void) printf(gettext("The following pools are " "formatted with legacy version numbers and can\n" "be upgraded to use feature flags. After " "being upgraded, these pools\nwill no " "longer be accessible by software that does not " "support feature\nflags.\n\n")); (void) printf(gettext("VER POOL\n")); (void) printf(gettext("--- ------------\n")); cbp->cb_first = B_FALSE; } (void) printf("%2llu %s\n", (u_longlong_t)version, zpool_get_name(zhp)); } return (0); } static int upgrade_list_disabled_cb(zpool_handle_t *zhp, void *arg) { upgrade_cbdata_t *cbp = arg; nvlist_t *config; uint64_t version; + if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) { + /* + * This will have been reported by upgrade_list_unavail so + * just allow iteration to continue. + */ + cbp->cb_unavail = B_TRUE; + return (0); + } + config = zpool_get_config(zhp, NULL); verify(nvlist_lookup_uint64(config, ZPOOL_CONFIG_VERSION, &version) == 0); if (version >= SPA_VERSION_FEATURES) { int i; boolean_t poolfirst = B_TRUE; nvlist_t *enabled = zpool_get_features(zhp); for (i = 0; i < SPA_FEATURES; i++) { const char *fguid = spa_feature_table[i].fi_guid; const char *fname = spa_feature_table[i].fi_uname; if (!nvlist_exists(enabled, fguid)) { if (cbp->cb_first) { (void) printf(gettext("\nSome " "supported features are not " "enabled on the following pools. " "Once a\nfeature is enabled the " "pool may become incompatible with " "software\nthat does not support " "the feature. See " "zpool-features(7) for " "details.\n\n")); (void) printf(gettext("POOL " "FEATURE\n")); (void) printf(gettext("------" "---------\n")); cbp->cb_first = B_FALSE; } if (poolfirst) { (void) printf(gettext("%s\n"), zpool_get_name(zhp)); poolfirst = B_FALSE; } (void) printf(gettext(" %s\n"), fname); } } } return (0); } /* ARGSUSED */ static int upgrade_one(zpool_handle_t *zhp, void *data) { boolean_t printnl = B_FALSE; upgrade_cbdata_t *cbp = data; uint64_t cur_version; int ret; + if (zpool_get_state(zhp) == POOL_STATE_UNAVAIL) { + (void) fprintf(stderr, gettext("cannot upgrade '%s': pool is " + "is currently unavailable.\n\n"), zpool_get_name(zhp)); + cbp->cb_unavail = B_TRUE; + return (1); + } + if (strcmp("log", zpool_get_name(zhp)) == 0) { (void) printf(gettext("'log' is now a reserved word\n" "Pool 'log' must be renamed using export and import" - " to upgrade.\n")); + " to upgrade.\n\n")); return (1); } cur_version = zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL); if (cur_version > cbp->cb_version) { (void) printf(gettext("Pool '%s' is already formatted " "using more current version '%llu'.\n\n"), zpool_get_name(zhp), cur_version); return (0); } if (cbp->cb_version != SPA_VERSION && cur_version == cbp->cb_version) { (void) printf(gettext("Pool '%s' is already formatted " "using version %llu.\n\n"), zpool_get_name(zhp), cbp->cb_version); return (0); } if (cur_version != cbp->cb_version) { printnl = B_TRUE; ret = upgrade_version(zhp, cbp->cb_version); if (ret != 0) return (ret); #ifdef __FreeBSD__ root_pool_upgrade_check(zhp, cbp->cb_poolname, sizeof(cbp->cb_poolname)); #endif /* __FreeBSD__ */ } if (cbp->cb_version >= SPA_VERSION_FEATURES) { int count = 0; ret = upgrade_enable_all(zhp, &count); if (ret != 0) return (ret); if (count != 0) { printnl = B_TRUE; #ifdef __FreeBSD__ root_pool_upgrade_check(zhp, cbp->cb_poolname, sizeof(cbp->cb_poolname)); #endif /* __FreeBSD __*/ } else if (cur_version == SPA_VERSION) { (void) printf(gettext("Pool '%s' already has all " - "supported features enabled.\n"), + "supported features enabled.\n\n"), zpool_get_name(zhp)); } } if (printnl) { (void) printf(gettext("\n")); } return (0); } /* * zpool upgrade * zpool upgrade -v * zpool upgrade [-V version] <-a | pool ...> * * With no arguments, display downrev'd ZFS pool available for upgrade. * Individual pools can be upgraded by specifying the pool, and '-a' will * upgrade all pools. */ int zpool_do_upgrade(int argc, char **argv) { int c; upgrade_cbdata_t cb = { 0 }; int ret = 0; boolean_t showversions = B_FALSE; boolean_t upgradeall = B_FALSE; char *end; /* check options */ while ((c = getopt(argc, argv, ":avV:")) != -1) { switch (c) { case 'a': upgradeall = B_TRUE; break; case 'v': showversions = B_TRUE; break; case 'V': cb.cb_version = strtoll(optarg, &end, 10); if (*end != '\0' || !SPA_VERSION_IS_SUPPORTED(cb.cb_version)) { (void) fprintf(stderr, gettext("invalid version '%s'\n"), optarg); usage(B_FALSE); } break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); usage(B_FALSE); break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } cb.cb_argc = argc; cb.cb_argv = argv; argc -= optind; argv += optind; if (cb.cb_version == 0) { cb.cb_version = SPA_VERSION; } else if (!upgradeall && argc == 0) { (void) fprintf(stderr, gettext("-V option is " "incompatible with other arguments\n")); usage(B_FALSE); } if (showversions) { if (upgradeall || argc != 0) { (void) fprintf(stderr, gettext("-v option is " "incompatible with other arguments\n")); usage(B_FALSE); } } else if (upgradeall) { if (argc != 0) { (void) fprintf(stderr, gettext("-a option should not " "be used along with a pool name\n")); usage(B_FALSE); } } (void) printf(gettext("This system supports ZFS pool feature " "flags.\n\n")); if (showversions) { int i; (void) printf(gettext("The following features are " "supported:\n\n")); (void) printf(gettext("FEAT DESCRIPTION\n")); (void) printf("----------------------------------------------" "---------------\n"); for (i = 0; i < SPA_FEATURES; i++) { zfeature_info_t *fi = &spa_feature_table[i]; const char *ro = fi->fi_can_readonly ? " (read-only compatible)" : ""; (void) printf("%-37s%s\n", fi->fi_uname, ro); (void) printf(" %s\n", fi->fi_desc); } (void) printf("\n"); (void) printf(gettext("The following legacy versions are also " "supported:\n\n")); (void) printf(gettext("VER DESCRIPTION\n")); (void) printf("--- -----------------------------------------" "---------------\n"); (void) printf(gettext(" 1 Initial ZFS version\n")); (void) printf(gettext(" 2 Ditto blocks " "(replicated metadata)\n")); (void) printf(gettext(" 3 Hot spares and double parity " "RAID-Z\n")); (void) printf(gettext(" 4 zpool history\n")); (void) printf(gettext(" 5 Compression using the gzip " "algorithm\n")); (void) printf(gettext(" 6 bootfs pool property\n")); (void) printf(gettext(" 7 Separate intent log devices\n")); (void) printf(gettext(" 8 Delegated administration\n")); (void) printf(gettext(" 9 refquota and refreservation " "properties\n")); (void) printf(gettext(" 10 Cache devices\n")); (void) printf(gettext(" 11 Improved scrub performance\n")); (void) printf(gettext(" 12 Snapshot properties\n")); (void) printf(gettext(" 13 snapused property\n")); (void) printf(gettext(" 14 passthrough-x aclinherit\n")); (void) printf(gettext(" 15 user/group space accounting\n")); (void) printf(gettext(" 16 stmf property support\n")); (void) printf(gettext(" 17 Triple-parity RAID-Z\n")); (void) printf(gettext(" 18 Snapshot user holds\n")); (void) printf(gettext(" 19 Log device removal\n")); (void) printf(gettext(" 20 Compression using zle " "(zero-length encoding)\n")); (void) printf(gettext(" 21 Deduplication\n")); (void) printf(gettext(" 22 Received properties\n")); (void) printf(gettext(" 23 Slim ZIL\n")); (void) printf(gettext(" 24 System attributes\n")); (void) printf(gettext(" 25 Improved scrub stats\n")); (void) printf(gettext(" 26 Improved snapshot deletion " "performance\n")); (void) printf(gettext(" 27 Improved snapshot creation " "performance\n")); (void) printf(gettext(" 28 Multiple vdev replacements\n")); (void) printf(gettext("\nFor more information on a particular " "version, including supported releases,\n")); (void) printf(gettext("see the ZFS Administration Guide.\n\n")); } else if (argc == 0 && upgradeall) { cb.cb_first = B_TRUE; ret = zpool_iter(g_zfs, upgrade_cb, &cb); if (ret == 0 && cb.cb_first) { if (cb.cb_version == SPA_VERSION) { - (void) printf(gettext("All pools are already " - "formatted using feature flags.\n\n")); - (void) printf(gettext("Every feature flags " + (void) printf(gettext("All %spools are already " + "formatted using feature flags.\n\n"), + cb.cb_unavail ? gettext("available ") : ""); + (void) printf(gettext("Every %sfeature flags " "pool already has all supported features " - "enabled.\n")); + "enabled.\n"), + cb.cb_unavail ? gettext("available ") : ""); } else { (void) printf(gettext("All pools are already " "formatted with version %llu or higher.\n"), cb.cb_version); } } } else if (argc == 0) { cb.cb_first = B_TRUE; + ret = zpool_iter(g_zfs, upgrade_list_unavail, &cb); + assert(ret == 0); + + if (!cb.cb_first) { + (void) fprintf(stderr, "\n"); + } + + cb.cb_first = B_TRUE; ret = zpool_iter(g_zfs, upgrade_list_older_cb, &cb); assert(ret == 0); if (cb.cb_first) { - (void) printf(gettext("All pools are formatted " - "using feature flags.\n\n")); + (void) printf(gettext("All %spools are formatted using " + "feature flags.\n\n"), cb.cb_unavail ? + gettext("available ") : ""); } else { (void) printf(gettext("\nUse 'zpool upgrade -v' " "for a list of available legacy versions.\n")); } cb.cb_first = B_TRUE; ret = zpool_iter(g_zfs, upgrade_list_disabled_cb, &cb); assert(ret == 0); if (cb.cb_first) { - (void) printf(gettext("Every feature flags pool has " - "all supported features enabled.\n")); + (void) printf(gettext("Every %sfeature flags pool has " + "all supported features enabled.\n"), + cb.cb_unavail ? gettext("available ") : ""); } else { (void) printf(gettext("\n")); } } else { - ret = for_each_pool(argc, argv, B_FALSE, NULL, + ret = for_each_pool(argc, argv, B_TRUE, NULL, upgrade_one, &cb); } if (cb.cb_poolname[0] != '\0') { (void) printf( "If you boot from pool '%s', don't forget to update boot code.\n" "Assuming you use GPT partitioning and da0 is your boot disk\n" "the following command will do it:\n" "\n" "\tgpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0\n\n", cb.cb_poolname); } return (ret); } typedef struct hist_cbdata { boolean_t first; boolean_t longfmt; boolean_t internal; } hist_cbdata_t; /* * Print out the command history for a specific pool. */ static int get_history_one(zpool_handle_t *zhp, void *data) { nvlist_t *nvhis; nvlist_t **records; uint_t numrecords; int ret, i; hist_cbdata_t *cb = (hist_cbdata_t *)data; cb->first = B_FALSE; (void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp)); if ((ret = zpool_get_history(zhp, &nvhis)) != 0) return (ret); verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD, &records, &numrecords) == 0); for (i = 0; i < numrecords; i++) { nvlist_t *rec = records[i]; char tbuf[30] = ""; if (nvlist_exists(rec, ZPOOL_HIST_TIME)) { time_t tsec; struct tm t; tsec = fnvlist_lookup_uint64(records[i], ZPOOL_HIST_TIME); (void) localtime_r(&tsec, &t); (void) strftime(tbuf, sizeof (tbuf), "%F.%T", &t); } if (nvlist_exists(rec, ZPOOL_HIST_CMD)) { (void) printf("%s %s", tbuf, fnvlist_lookup_string(rec, ZPOOL_HIST_CMD)); } else if (nvlist_exists(rec, ZPOOL_HIST_INT_EVENT)) { int ievent = fnvlist_lookup_uint64(rec, ZPOOL_HIST_INT_EVENT); if (!cb->internal) continue; if (ievent >= ZFS_NUM_LEGACY_HISTORY_EVENTS) { (void) printf("%s unrecognized record:\n", tbuf); dump_nvlist(rec, 4); continue; } (void) printf("%s [internal %s txg:%lld] %s", tbuf, zfs_history_event_names[ievent], fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG), fnvlist_lookup_string(rec, ZPOOL_HIST_INT_STR)); } else if (nvlist_exists(rec, ZPOOL_HIST_INT_NAME)) { if (!cb->internal) continue; (void) printf("%s [txg:%lld] %s", tbuf, fnvlist_lookup_uint64(rec, ZPOOL_HIST_TXG), fnvlist_lookup_string(rec, ZPOOL_HIST_INT_NAME)); if (nvlist_exists(rec, ZPOOL_HIST_DSNAME)) { (void) printf(" %s (%llu)", fnvlist_lookup_string(rec, ZPOOL_HIST_DSNAME), fnvlist_lookup_uint64(rec, ZPOOL_HIST_DSID)); } (void) printf(" %s", fnvlist_lookup_string(rec, ZPOOL_HIST_INT_STR)); } else if (nvlist_exists(rec, ZPOOL_HIST_IOCTL)) { if (!cb->internal) continue; (void) printf("%s ioctl %s\n", tbuf, fnvlist_lookup_string(rec, ZPOOL_HIST_IOCTL)); if (nvlist_exists(rec, ZPOOL_HIST_INPUT_NVL)) { (void) printf(" input:\n"); dump_nvlist(fnvlist_lookup_nvlist(rec, ZPOOL_HIST_INPUT_NVL), 8); } if (nvlist_exists(rec, ZPOOL_HIST_OUTPUT_NVL)) { (void) printf(" output:\n"); dump_nvlist(fnvlist_lookup_nvlist(rec, ZPOOL_HIST_OUTPUT_NVL), 8); } } else { if (!cb->internal) continue; (void) printf("%s unrecognized record:\n", tbuf); dump_nvlist(rec, 4); } if (!cb->longfmt) { (void) printf("\n"); continue; } (void) printf(" ["); if (nvlist_exists(rec, ZPOOL_HIST_WHO)) { uid_t who = fnvlist_lookup_uint64(rec, ZPOOL_HIST_WHO); struct passwd *pwd = getpwuid(who); (void) printf("user %d ", (int)who); if (pwd != NULL) (void) printf("(%s) ", pwd->pw_name); } if (nvlist_exists(rec, ZPOOL_HIST_HOST)) { (void) printf("on %s", fnvlist_lookup_string(rec, ZPOOL_HIST_HOST)); } if (nvlist_exists(rec, ZPOOL_HIST_ZONE)) { (void) printf(":%s", fnvlist_lookup_string(rec, ZPOOL_HIST_ZONE)); } (void) printf("]"); (void) printf("\n"); } (void) printf("\n"); nvlist_free(nvhis); return (ret); } /* * zpool history * * Displays the history of commands that modified pools. */ int zpool_do_history(int argc, char **argv) { hist_cbdata_t cbdata = { 0 }; int ret; int c; cbdata.first = B_TRUE; /* check options */ while ((c = getopt(argc, argv, "li")) != -1) { switch (c) { case 'l': cbdata.longfmt = B_TRUE; break; case 'i': cbdata.internal = B_TRUE; break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; ret = for_each_pool(argc, argv, B_FALSE, NULL, get_history_one, &cbdata); if (argc == 0 && cbdata.first == B_TRUE) { (void) printf(gettext("no pools available\n")); return (0); } return (ret); } static int get_callback(zpool_handle_t *zhp, void *data) { zprop_get_cbdata_t *cbp = (zprop_get_cbdata_t *)data; char value[MAXNAMELEN]; zprop_source_t srctype; zprop_list_t *pl; for (pl = cbp->cb_proplist; pl != NULL; pl = pl->pl_next) { /* * Skip the special fake placeholder. This will also skip * over the name property when 'all' is specified. */ if (pl->pl_prop == ZPOOL_PROP_NAME && pl == cbp->cb_proplist) continue; if (pl->pl_prop == ZPROP_INVAL && (zpool_prop_feature(pl->pl_user_prop) || zpool_prop_unsupported(pl->pl_user_prop))) { srctype = ZPROP_SRC_LOCAL; if (zpool_prop_get_feature(zhp, pl->pl_user_prop, value, sizeof (value)) == 0) { zprop_print_one_property(zpool_get_name(zhp), cbp, pl->pl_user_prop, value, srctype, NULL, NULL); } } else { if (zpool_get_prop(zhp, pl->pl_prop, value, sizeof (value), &srctype, cbp->cb_literal) != 0) continue; zprop_print_one_property(zpool_get_name(zhp), cbp, zpool_prop_to_name(pl->pl_prop), value, srctype, NULL, NULL); } } return (0); } /* * zpool get [-Hp] [-o "all" | field[,...]] <"all" | property[,...]> ... * * -H Scripted mode. Don't display headers, and separate properties * by a single tab. * -o List of columns to display. Defaults to * "name,property,value,source". * -p Diplay values in parsable (exact) format. * * Get properties of pools in the system. Output space statistics * for each one as well as other attributes. */ int zpool_do_get(int argc, char **argv) { zprop_get_cbdata_t cb = { 0 }; zprop_list_t fake_name = { 0 }; int ret; int c, i; char *value; cb.cb_first = B_TRUE; /* * Set up default columns and sources. */ cb.cb_sources = ZPROP_SRC_ALL; cb.cb_columns[0] = GET_COL_NAME; cb.cb_columns[1] = GET_COL_PROPERTY; cb.cb_columns[2] = GET_COL_VALUE; cb.cb_columns[3] = GET_COL_SOURCE; cb.cb_type = ZFS_TYPE_POOL; /* check options */ while ((c = getopt(argc, argv, ":Hpo:")) != -1) { switch (c) { case 'p': cb.cb_literal = B_TRUE; break; case 'H': cb.cb_scripted = B_TRUE; break; case 'o': bzero(&cb.cb_columns, sizeof (cb.cb_columns)); i = 0; while (*optarg != '\0') { static char *col_subopts[] = { "name", "property", "value", "source", "all", NULL }; if (i == ZFS_GET_NCOLS) { (void) fprintf(stderr, gettext("too " "many fields given to -o " "option\n")); usage(B_FALSE); } switch (getsubopt(&optarg, col_subopts, &value)) { case 0: cb.cb_columns[i++] = GET_COL_NAME; break; case 1: cb.cb_columns[i++] = GET_COL_PROPERTY; break; case 2: cb.cb_columns[i++] = GET_COL_VALUE; break; case 3: cb.cb_columns[i++] = GET_COL_SOURCE; break; case 4: if (i > 0) { (void) fprintf(stderr, gettext("\"all\" conflicts " "with specific fields " "given to -o option\n")); usage(B_FALSE); } cb.cb_columns[0] = GET_COL_NAME; cb.cb_columns[1] = GET_COL_PROPERTY; cb.cb_columns[2] = GET_COL_VALUE; cb.cb_columns[3] = GET_COL_SOURCE; i = ZFS_GET_NCOLS; break; default: (void) fprintf(stderr, gettext("invalid column name " "'%s'\n"), value); usage(B_FALSE); } } break; case '?': (void) fprintf(stderr, gettext("invalid option '%c'\n"), optopt); usage(B_FALSE); } } argc -= optind; argv += optind; if (argc < 1) { (void) fprintf(stderr, gettext("missing property " "argument\n")); usage(B_FALSE); } if (zprop_get_list(g_zfs, argv[0], &cb.cb_proplist, ZFS_TYPE_POOL) != 0) usage(B_FALSE); argc--; argv++; if (cb.cb_proplist != NULL) { fake_name.pl_prop = ZPOOL_PROP_NAME; fake_name.pl_width = strlen(gettext("NAME")); fake_name.pl_next = cb.cb_proplist; cb.cb_proplist = &fake_name; } ret = for_each_pool(argc, argv, B_TRUE, &cb.cb_proplist, get_callback, &cb); if (cb.cb_proplist == &fake_name) zprop_free_list(fake_name.pl_next); else zprop_free_list(cb.cb_proplist); return (ret); } typedef struct set_cbdata { char *cb_propname; char *cb_value; boolean_t cb_any_successful; } set_cbdata_t; int set_callback(zpool_handle_t *zhp, void *data) { int error; set_cbdata_t *cb = (set_cbdata_t *)data; error = zpool_set_prop(zhp, cb->cb_propname, cb->cb_value); if (!error) cb->cb_any_successful = B_TRUE; return (error); } int zpool_do_set(int argc, char **argv) { set_cbdata_t cb = { 0 }; int error; if (argc > 1 && argv[1][0] == '-') { (void) fprintf(stderr, gettext("invalid option '%c'\n"), argv[1][1]); usage(B_FALSE); } if (argc < 2) { (void) fprintf(stderr, gettext("missing property=value " "argument\n")); usage(B_FALSE); } if (argc < 3) { (void) fprintf(stderr, gettext("missing pool name\n")); usage(B_FALSE); } if (argc > 3) { (void) fprintf(stderr, gettext("too many pool names\n")); usage(B_FALSE); } cb.cb_propname = argv[1]; cb.cb_value = strchr(cb.cb_propname, '='); if (cb.cb_value == NULL) { (void) fprintf(stderr, gettext("missing value in " "property=value argument\n")); usage(B_FALSE); } *(cb.cb_value) = '\0'; cb.cb_value++; error = for_each_pool(argc - 2, argv + 2, B_TRUE, NULL, set_callback, &cb); return (error); } static int find_command_idx(char *command, int *idx) { int i; for (i = 0; i < NCOMMAND; i++) { if (command_table[i].name == NULL) continue; if (strcmp(command, command_table[i].name) == 0) { *idx = i; return (0); } } return (1); } int main(int argc, char **argv) { int ret; int i; char *cmdname; (void) setlocale(LC_ALL, ""); (void) textdomain(TEXT_DOMAIN); if ((g_zfs = libzfs_init()) == NULL) { (void) fprintf(stderr, gettext("internal error: failed to " "initialize ZFS library\n")); return (1); } libzfs_print_on_error(g_zfs, B_TRUE); opterr = 0; /* * Make sure the user has specified some command. */ if (argc < 2) { (void) fprintf(stderr, gettext("missing command\n")); usage(B_FALSE); } cmdname = argv[1]; /* * Special case '-?' */ if (strcmp(cmdname, "-?") == 0) usage(B_TRUE); zfs_save_arguments(argc, argv, history_str, sizeof (history_str)); /* * Run the appropriate command. */ if (find_command_idx(cmdname, &i) == 0) { current_command = &command_table[i]; ret = command_table[i].func(argc - 1, argv + 1); } else if (strchr(cmdname, '=')) { verify(find_command_idx("set", &i) == 0); current_command = &command_table[i]; ret = command_table[i].func(argc, argv); } else if (strcmp(cmdname, "freeze") == 0 && argc == 3) { /* * 'freeze' is a vile debugging abomination, so we treat * it as such. */ zfs_cmd_t zc = { 0 }; (void) strlcpy(zc.zc_name, argv[2], sizeof (zc.zc_name)); return (!!zfs_ioctl(g_zfs, ZFS_IOC_POOL_FREEZE, &zc)); } else { (void) fprintf(stderr, gettext("unrecognized " "command '%s'\n"), cmdname); usage(B_FALSE); } if (ret == 0 && log_history) (void) zpool_log_history(g_zfs, history_str); libzfs_fini(g_zfs); /* * The 'ZFS_ABORT' environment variable causes us to dump core on exit * for the purposes of running ::findleaks. */ if (getenv("ZFS_ABORT") != NULL) { (void) printf("dumping core by request\n"); abort(); } return (ret); } Index: projects/arm_intrng/cddl/contrib/opensolaris =================================================================== --- projects/arm_intrng/cddl/contrib/opensolaris (revision 276247) +++ projects/arm_intrng/cddl/contrib/opensolaris (revision 276248) Property changes on: projects/arm_intrng/cddl/contrib/opensolaris ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/cddl/contrib/opensolaris:r276183-276247 Index: projects/arm_intrng/cddl =================================================================== --- projects/arm_intrng/cddl (revision 276247) +++ projects/arm_intrng/cddl (revision 276248) Property changes on: projects/arm_intrng/cddl ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/cddl:r276183-276247 Index: projects/arm_intrng/contrib/binutils/gas/expr.c =================================================================== --- projects/arm_intrng/contrib/binutils/gas/expr.c (revision 276247) +++ projects/arm_intrng/contrib/binutils/gas/expr.c (revision 276248) @@ -1,2179 +1,2186 @@ /* expr.c -operands, expressions- Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GAS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GAS; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This is really a branch office of as-read.c. I split it out to clearly distinguish the world of expressions from the world of statements. (It also gives smaller files to re-compile.) Here, "operand"s are of expressions, not instructions. */ #define min(a, b) ((a) < (b) ? (a) : (b)) #include "as.h" #include "safe-ctype.h" #include "obstack.h" static void floating_constant (expressionS * expressionP); static valueT generic_bignum_to_int32 (void); #ifdef BFD64 static valueT generic_bignum_to_int64 (void); #endif static void integer_constant (int radix, expressionS * expressionP); static void mri_char_constant (expressionS *); static void current_location (expressionS *); static void clean_up_expression (expressionS * expressionP); static segT operand (expressionS *, enum expr_mode); static operatorT operator (int *); extern const char EXP_CHARS[], FLT_CHARS[]; /* We keep a mapping of expression symbols to file positions, so that we can provide better error messages. */ struct expr_symbol_line { struct expr_symbol_line *next; symbolS *sym; char *file; unsigned int line; }; static struct expr_symbol_line *expr_symbol_lines; /* Build a dummy symbol to hold a complex expression. This is how we build expressions up out of other expressions. The symbol is put into the fake section expr_section. */ symbolS * make_expr_symbol (expressionS *expressionP) { expressionS zero; symbolS *symbolP; struct expr_symbol_line *n; if (expressionP->X_op == O_symbol && expressionP->X_add_number == 0) return expressionP->X_add_symbol; if (expressionP->X_op == O_big) { /* This won't work, because the actual value is stored in generic_floating_point_number or generic_bignum, and we are going to lose it if we haven't already. */ if (expressionP->X_add_number > 0) as_bad (_("bignum invalid")); else as_bad (_("floating point number invalid")); zero.X_op = O_constant; zero.X_add_number = 0; zero.X_unsigned = 0; clean_up_expression (&zero); expressionP = &zero; } /* Putting constant symbols in absolute_section rather than expr_section is convenient for the old a.out code, for which S_GET_SEGMENT does not always retrieve the value put in by S_SET_SEGMENT. */ symbolP = symbol_create (FAKE_LABEL_NAME, (expressionP->X_op == O_constant ? absolute_section : expr_section), 0, &zero_address_frag); symbol_set_value_expression (symbolP, expressionP); if (expressionP->X_op == O_constant) resolve_symbol_value (symbolP); n = (struct expr_symbol_line *) xmalloc (sizeof *n); n->sym = symbolP; as_where (&n->file, &n->line); n->next = expr_symbol_lines; expr_symbol_lines = n; return symbolP; } /* Return the file and line number for an expr symbol. Return non-zero if something was found, 0 if no information is known for the symbol. */ int expr_symbol_where (symbolS *sym, char **pfile, unsigned int *pline) { register struct expr_symbol_line *l; for (l = expr_symbol_lines; l != NULL; l = l->next) { if (l->sym == sym) { *pfile = l->file; *pline = l->line; return 1; } } return 0; } /* Utilities for building expressions. Since complex expressions are recorded as symbols for use in other expressions these return a symbolS * and not an expressionS *. These explicitly do not take an "add_number" argument. */ /* ??? For completeness' sake one might want expr_build_symbol. It would just return its argument. */ /* Build an expression for an unsigned constant. The corresponding one for signed constants is missing because there's currently no need for it. One could add an unsigned_p flag but that seems more clumsy. */ symbolS * expr_build_uconstant (offsetT value) { expressionS e; e.X_op = O_constant; e.X_add_number = value; e.X_unsigned = 1; return make_expr_symbol (&e); } /* Build an expression for the current location ('.'). */ symbolS * expr_build_dot (void) { expressionS e; current_location (&e); return make_expr_symbol (&e); } /* Build any floating-point literal here. Also build any bignum literal here. */ /* Seems atof_machine can backscan through generic_bignum and hit whatever happens to be loaded before it in memory. And its way too complicated for me to fix right. Thus a hack. JF: Just make generic_bignum bigger, and never write into the early words, thus they'll always be zero. I hate Dean's floating-point code. Bleh. */ LITTLENUM_TYPE generic_bignum[SIZE_OF_LARGE_NUMBER + 6]; FLONUM_TYPE generic_floating_point_number = { &generic_bignum[6], /* low. (JF: Was 0) */ &generic_bignum[SIZE_OF_LARGE_NUMBER + 6 - 1], /* high. JF: (added +6) */ 0, /* leader. */ 0, /* exponent. */ 0 /* sign. */ }; static void floating_constant (expressionS *expressionP) { /* input_line_pointer -> floating-point constant. */ int error_code; error_code = atof_generic (&input_line_pointer, ".", EXP_CHARS, &generic_floating_point_number); if (error_code) { if (error_code == ERROR_EXPONENT_OVERFLOW) { as_bad (_("bad floating-point constant: exponent overflow")); } else { as_bad (_("bad floating-point constant: unknown error code=%d"), error_code); } } expressionP->X_op = O_big; /* input_line_pointer -> just after constant, which may point to whitespace. */ expressionP->X_add_number = -1; } static valueT generic_bignum_to_int32 (void) { valueT number = ((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS) | (generic_bignum[0] & LITTLENUM_MASK); number &= 0xffffffff; return number; } #ifdef BFD64 static valueT generic_bignum_to_int64 (void) { valueT number = ((((((((valueT) generic_bignum[3] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS) | ((valueT) generic_bignum[2] & LITTLENUM_MASK)) << LITTLENUM_NUMBER_OF_BITS) | ((valueT) generic_bignum[1] & LITTLENUM_MASK)) << LITTLENUM_NUMBER_OF_BITS) | ((valueT) generic_bignum[0] & LITTLENUM_MASK)); return number; } #endif static void integer_constant (int radix, expressionS *expressionP) { char *start; /* Start of number. */ char *suffix = NULL; char c; valueT number; /* Offset or (absolute) value. */ short int digit; /* Value of next digit in current radix. */ short int maxdig = 0; /* Highest permitted digit value. */ int too_many_digits = 0; /* If we see >= this number of. */ char *name; /* Points to name of symbol. */ symbolS *symbolP; /* Points to symbol. */ int small; /* True if fits in 32 bits. */ /* May be bignum, or may fit in 32 bits. */ /* Most numbers fit into 32 bits, and we want this case to be fast. so we pretend it will fit into 32 bits. If, after making up a 32 bit number, we realise that we have scanned more digits than comfortably fit into 32 bits, we re-scan the digits coding them into a bignum. For decimal and octal numbers we are conservative: Some numbers may be assumed bignums when in fact they do fit into 32 bits. Numbers of any radix can have excess leading zeros: We strive to recognise this and cast them back into 32 bits. We must check that the bignum really is more than 32 bits, and change it back to a 32-bit number if it fits. The number we are looking for is expected to be positive, but if it fits into 32 bits as an unsigned number, we let it be a 32-bit number. The cavalier approach is for speed in ordinary cases. */ /* This has been extended for 64 bits. We blindly assume that if you're compiling in 64-bit mode, the target is a 64-bit machine. This should be cleaned up. */ #ifdef BFD64 #define valuesize 64 #else /* includes non-bfd case, mostly */ #define valuesize 32 #endif if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && radix == 0) { int flt = 0; /* In MRI mode, the number may have a suffix indicating the radix. For that matter, it might actually be a floating point constant. */ for (suffix = input_line_pointer; ISALNUM (*suffix); suffix++) { if (*suffix == 'e' || *suffix == 'E') flt = 1; } if (suffix == input_line_pointer) { radix = 10; suffix = NULL; } else { c = *--suffix; c = TOUPPER (c); /* If we have both NUMBERS_WITH_SUFFIX and LOCAL_LABELS_FB, we distinguish between 'B' and 'b'. This is the case for Z80. */ if ((NUMBERS_WITH_SUFFIX && LOCAL_LABELS_FB ? *suffix : c) == 'B') radix = 2; else if (c == 'D') radix = 10; else if (c == 'O' || c == 'Q') radix = 8; else if (c == 'H') radix = 16; else if (suffix[1] == '.' || c == 'E' || flt) { floating_constant (expressionP); return; } else { radix = 10; suffix = NULL; } } } switch (radix) { case 2: maxdig = 2; too_many_digits = valuesize + 1; break; case 8: maxdig = radix = 8; too_many_digits = (valuesize + 2) / 3 + 1; break; case 16: maxdig = radix = 16; too_many_digits = (valuesize + 3) / 4 + 1; break; case 10: maxdig = radix = 10; too_many_digits = (valuesize + 11) / 4; /* Very rough. */ } #undef valuesize start = input_line_pointer; c = *input_line_pointer++; for (number = 0; (digit = hex_value (c)) < maxdig; c = *input_line_pointer++) { number = number * radix + digit; } /* c contains character after number. */ /* input_line_pointer->char after c. */ small = (input_line_pointer - start - 1) < too_many_digits; if (radix == 16 && c == '_') { /* This is literal of the form 0x333_0_12345678_1. This example is equivalent to 0x00000333000000001234567800000001. */ int num_little_digits = 0; int i; input_line_pointer = start; /* -> 1st digit. */ know (LITTLENUM_NUMBER_OF_BITS == 16); for (c = '_'; c == '_'; num_little_digits += 2) { /* Convert one 64-bit word. */ int ndigit = 0; number = 0; for (c = *input_line_pointer++; (digit = hex_value (c)) < maxdig; c = *(input_line_pointer++)) { number = number * radix + digit; ndigit++; } /* Check for 8 digit per word max. */ if (ndigit > 8) as_bad (_("a bignum with underscores may not have more than 8 hex digits in any word")); /* Add this chunk to the bignum. Shift things down 2 little digits. */ know (LITTLENUM_NUMBER_OF_BITS == 16); for (i = min (num_little_digits + 1, SIZE_OF_LARGE_NUMBER - 1); i >= 2; i--) generic_bignum[i] = generic_bignum[i - 2]; /* Add the new digits as the least significant new ones. */ generic_bignum[0] = number & 0xffffffff; generic_bignum[1] = number >> 16; } /* Again, c is char after number, input_line_pointer->after c. */ if (num_little_digits > SIZE_OF_LARGE_NUMBER - 1) num_little_digits = SIZE_OF_LARGE_NUMBER - 1; assert (num_little_digits >= 4); if (num_little_digits != 8) as_bad (_("a bignum with underscores must have exactly 4 words")); /* We might have some leading zeros. These can be trimmed to give us a change to fit this constant into a small number. */ while (generic_bignum[num_little_digits - 1] == 0 && num_little_digits > 1) num_little_digits--; if (num_little_digits <= 2) { /* will fit into 32 bits. */ number = generic_bignum_to_int32 (); small = 1; } #ifdef BFD64 else if (num_little_digits <= 4) { /* Will fit into 64 bits. */ number = generic_bignum_to_int64 (); small = 1; } #endif else { small = 0; /* Number of littlenums in the bignum. */ number = num_little_digits; } } else if (!small) { /* We saw a lot of digits. manufacture a bignum the hard way. */ LITTLENUM_TYPE *leader; /* -> high order littlenum of the bignum. */ LITTLENUM_TYPE *pointer; /* -> littlenum we are frobbing now. */ long carry; leader = generic_bignum; generic_bignum[0] = 0; generic_bignum[1] = 0; generic_bignum[2] = 0; generic_bignum[3] = 0; input_line_pointer = start; /* -> 1st digit. */ c = *input_line_pointer++; for (; (carry = hex_value (c)) < maxdig; c = *input_line_pointer++) { for (pointer = generic_bignum; pointer <= leader; pointer++) { long work; work = carry + radix * *pointer; *pointer = work & LITTLENUM_MASK; carry = work >> LITTLENUM_NUMBER_OF_BITS; } if (carry) { if (leader < generic_bignum + SIZE_OF_LARGE_NUMBER - 1) { /* Room to grow a longer bignum. */ *++leader = carry; } } } /* Again, c is char after number. */ /* input_line_pointer -> after c. */ know (LITTLENUM_NUMBER_OF_BITS == 16); if (leader < generic_bignum + 2) { /* Will fit into 32 bits. */ number = generic_bignum_to_int32 (); small = 1; } #ifdef BFD64 else if (leader < generic_bignum + 4) { /* Will fit into 64 bits. */ number = generic_bignum_to_int64 (); small = 1; } #endif else { /* Number of littlenums in the bignum. */ number = leader - generic_bignum + 1; } } if ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) && suffix != NULL && input_line_pointer - 1 == suffix) c = *input_line_pointer++; if (small) { /* Here with number, in correct radix. c is the next char. Note that unlike un*x, we allow "011f" "0x9f" to both mean the same as the (conventional) "9f". This is simply easier than checking for strict canonical form. Syntax sux! */ if (LOCAL_LABELS_FB && c == 'b') { /* Backward ref to local label. Because it is backward, expect it to be defined. */ /* Construct a local label. */ name = fb_label_name ((int) number, 0); /* Seen before, or symbol is defined: OK. */ symbolP = symbol_find (name); if ((symbolP != NULL) && (S_IS_DEFINED (symbolP))) { /* Local labels are never absolute. Don't waste time checking absoluteness. */ know (SEG_NORMAL (S_GET_SEGMENT (symbolP))); expressionP->X_op = O_symbol; expressionP->X_add_symbol = symbolP; } else { /* Either not seen or not defined. */ /* @@ Should print out the original string instead of the parsed number. */ as_bad (_("backward ref to unknown label \"%d:\""), (int) number); expressionP->X_op = O_constant; } expressionP->X_add_number = 0; } /* case 'b' */ else if (LOCAL_LABELS_FB && c == 'f') { /* Forward reference. Expect symbol to be undefined or unknown. undefined: seen it before. unknown: never seen it before. Construct a local label name, then an undefined symbol. Don't create a xseg frag for it: caller may do that. Just return it as never seen before. */ name = fb_label_name ((int) number, 1); symbolP = symbol_find_or_make (name); /* We have no need to check symbol properties. */ #ifndef many_segments /* Since "know" puts its arg into a "string", we can't have newlines in the argument. */ know (S_GET_SEGMENT (symbolP) == undefined_section || S_GET_SEGMENT (symbolP) == text_section || S_GET_SEGMENT (symbolP) == data_section); #endif expressionP->X_op = O_symbol; expressionP->X_add_symbol = symbolP; expressionP->X_add_number = 0; } /* case 'f' */ else if (LOCAL_LABELS_DOLLAR && c == '$') { /* If the dollar label is *currently* defined, then this is just another reference to it. If it is not *currently* defined, then this is a fresh instantiation of that number, so create it. */ if (dollar_label_defined ((long) number)) { name = dollar_label_name ((long) number, 0); symbolP = symbol_find (name); know (symbolP != NULL); } else { name = dollar_label_name ((long) number, 1); symbolP = symbol_find_or_make (name); } expressionP->X_op = O_symbol; expressionP->X_add_symbol = symbolP; expressionP->X_add_number = 0; } /* case '$' */ else { expressionP->X_op = O_constant; expressionP->X_add_number = number; input_line_pointer--; /* Restore following character. */ } /* Really just a number. */ } else { /* Not a small number. */ expressionP->X_op = O_big; expressionP->X_add_number = number; /* Number of littlenums. */ input_line_pointer--; /* -> char following number. */ } } /* Parse an MRI multi character constant. */ static void mri_char_constant (expressionS *expressionP) { int i; if (*input_line_pointer == '\'' && input_line_pointer[1] != '\'') { expressionP->X_op = O_constant; expressionP->X_add_number = 0; return; } /* In order to get the correct byte ordering, we must build the number in reverse. */ for (i = SIZE_OF_LARGE_NUMBER - 1; i >= 0; i--) { int j; generic_bignum[i] = 0; for (j = 0; j < CHARS_PER_LITTLENUM; j++) { if (*input_line_pointer == '\'') { if (input_line_pointer[1] != '\'') break; ++input_line_pointer; } generic_bignum[i] <<= 8; generic_bignum[i] += *input_line_pointer; ++input_line_pointer; } if (i < SIZE_OF_LARGE_NUMBER - 1) { /* If there is more than one littlenum, left justify the last one to make it match the earlier ones. If there is only one, we can just use the value directly. */ for (; j < CHARS_PER_LITTLENUM; j++) generic_bignum[i] <<= 8; } if (*input_line_pointer == '\'' && input_line_pointer[1] != '\'') break; } if (i < 0) { as_bad (_("character constant too large")); i = 0; } if (i > 0) { int c; int j; c = SIZE_OF_LARGE_NUMBER - i; for (j = 0; j < c; j++) generic_bignum[j] = generic_bignum[i + j]; i = c; } know (LITTLENUM_NUMBER_OF_BITS == 16); if (i > 2) { expressionP->X_op = O_big; expressionP->X_add_number = i; } else { expressionP->X_op = O_constant; if (i < 2) expressionP->X_add_number = generic_bignum[0] & LITTLENUM_MASK; else expressionP->X_add_number = (((generic_bignum[1] & LITTLENUM_MASK) << LITTLENUM_NUMBER_OF_BITS) | (generic_bignum[0] & LITTLENUM_MASK)); } /* Skip the final closing quote. */ ++input_line_pointer; } /* Return an expression representing the current location. This handles the magic symbol `.'. */ static void current_location (expressionS *expressionp) { if (now_seg == absolute_section) { expressionp->X_op = O_constant; expressionp->X_add_number = abs_section_offset; } else { expressionp->X_op = O_symbol; expressionp->X_add_symbol = symbol_temp_new_now (); expressionp->X_add_number = 0; } } /* In: Input_line_pointer points to 1st char of operand, which may be a space. Out: An expressionS. The operand may have been empty: in this case X_op == O_absent. Input_line_pointer->(next non-blank) char after operand. */ static segT operand (expressionS *expressionP, enum expr_mode mode) { char c; symbolS *symbolP; /* Points to symbol. */ char *name; /* Points to name of symbol. */ segT segment; /* All integers are regarded as unsigned unless they are negated. This is because the only thing which cares whether a number is unsigned is the code in emit_expr which extends constants into bignums. It should only sign extend negative numbers, so that something like ``.quad 0x80000000'' is not sign extended even though it appears negative if valueT is 32 bits. */ expressionP->X_unsigned = 1; /* Digits, assume it is a bignum. */ SKIP_WHITESPACE (); /* Leading whitespace is part of operand. */ c = *input_line_pointer++; /* input_line_pointer -> past char in c. */ if (is_end_of_line[(unsigned char) c]) goto eol; switch (c) { case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': input_line_pointer--; integer_constant ((NUMBERS_WITH_SUFFIX || flag_m68k_mri) ? 0 : 10, expressionP); break; #ifdef LITERAL_PREFIXDOLLAR_HEX case '$': /* $L is the start of a local label, not a hex constant. */ if (* input_line_pointer == 'L') goto isname; integer_constant (16, expressionP); break; #endif #ifdef LITERAL_PREFIXPERCENT_BIN case '%': integer_constant (2, expressionP); break; #endif case '0': /* Non-decimal radix. */ if (NUMBERS_WITH_SUFFIX || flag_m68k_mri) { char *s; /* Check for a hex or float constant. */ for (s = input_line_pointer; hex_p (*s); s++) ; if (*s == 'h' || *s == 'H' || *input_line_pointer == '.') { --input_line_pointer; integer_constant (0, expressionP); break; } } c = *input_line_pointer; switch (c) { case 'o': case 'O': case 'q': case 'Q': case '8': case '9': if (NUMBERS_WITH_SUFFIX || flag_m68k_mri) { integer_constant (0, expressionP); break; } /* Fall through. */ default: default_case: if (c && strchr (FLT_CHARS, c)) { input_line_pointer++; floating_constant (expressionP); expressionP->X_add_number = - TOLOWER (c); } else { /* The string was only zero. */ expressionP->X_op = O_constant; expressionP->X_add_number = 0; } break; case 'x': case 'X': if (flag_m68k_mri) goto default_case; input_line_pointer++; integer_constant (16, expressionP); break; case 'b': if (LOCAL_LABELS_FB && ! (flag_m68k_mri || NUMBERS_WITH_SUFFIX)) { /* This code used to check for '+' and '-' here, and, in some conditions, fall through to call integer_constant. However, that didn't make sense, as integer_constant only accepts digits. */ /* Some of our code elsewhere does permit digits greater than the expected base; for consistency, do the same here. */ if (input_line_pointer[1] < '0' || input_line_pointer[1] > '9') { /* Parse this as a back reference to label 0. */ input_line_pointer--; integer_constant (10, expressionP); break; } /* Otherwise, parse this as a binary number. */ } /* Fall through. */ case 'B': input_line_pointer++; if (flag_m68k_mri || NUMBERS_WITH_SUFFIX) goto default_case; integer_constant (2, expressionP); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': integer_constant ((flag_m68k_mri || NUMBERS_WITH_SUFFIX) ? 0 : 8, expressionP); break; case 'f': if (LOCAL_LABELS_FB) { /* If it says "0f" and it could possibly be a floating point number, make it one. Otherwise, make it a local label, and try to deal with parsing the rest later. */ if (!input_line_pointer[1] || (is_end_of_line[0xff & input_line_pointer[1]]) || strchr (FLT_CHARS, 'f') == NULL) goto is_0f_label; { char *cp = input_line_pointer + 1; int r = atof_generic (&cp, ".", EXP_CHARS, &generic_floating_point_number); switch (r) { case 0: case ERROR_EXPONENT_OVERFLOW: if (*cp == 'f' || *cp == 'b') /* Looks like a difference expression. */ goto is_0f_label; else if (cp == input_line_pointer + 1) /* No characters has been accepted -- looks like end of operand. */ goto is_0f_label; else goto is_0f_float; default: as_fatal (_("expr.c(operand): bad atof_generic return val %d"), r); } } /* Okay, now we've sorted it out. We resume at one of these two labels, depending on what we've decided we're probably looking at. */ is_0f_label: input_line_pointer--; integer_constant (10, expressionP); break; is_0f_float: /* Fall through. */ ; } case 'd': case 'D': if (flag_m68k_mri || NUMBERS_WITH_SUFFIX) { integer_constant (0, expressionP); break; } /* Fall through. */ case 'F': case 'r': case 'e': case 'E': case 'g': case 'G': input_line_pointer++; floating_constant (expressionP); expressionP->X_add_number = - TOLOWER (c); break; case '$': if (LOCAL_LABELS_DOLLAR) { integer_constant (10, expressionP); break; } else goto default_case; } break; case '(': #ifndef NEED_INDEX_OPERATOR case '[': #endif /* Didn't begin with digit & not a name. */ if (mode != expr_defer) segment = expression (expressionP); else segment = deferred_expression (expressionP); /* expression () will pass trailing whitespace. */ if ((c == '(' && *input_line_pointer != ')') || (c == '[' && *input_line_pointer != ']')) as_bad (_("missing '%c'"), c == '(' ? ')' : ']'); else input_line_pointer++; SKIP_WHITESPACE (); /* Here with input_line_pointer -> char after "(...)". */ return segment; #ifdef TC_M68K case 'E': if (! flag_m68k_mri || *input_line_pointer != '\'') goto de_fault; as_bad (_("EBCDIC constants are not supported")); /* Fall through. */ case 'A': if (! flag_m68k_mri || *input_line_pointer != '\'') goto de_fault; ++input_line_pointer; /* Fall through. */ #endif case '\'': if (! flag_m68k_mri) { /* Warning: to conform to other people's assemblers NO ESCAPEMENT is permitted for a single quote. The next character, parity errors and all, is taken as the value of the operand. VERY KINKY. */ expressionP->X_op = O_constant; expressionP->X_add_number = *input_line_pointer++; break; } mri_char_constant (expressionP); break; #ifdef TC_M68K case '"': /* Double quote is the bitwise not operator in MRI mode. */ if (! flag_m68k_mri) goto de_fault; /* Fall through. */ #endif case '~': /* '~' is permitted to start a label on the Delta. */ if (is_name_beginner (c)) goto isname; case '!': case '-': case '+': { operand (expressionP, mode); if (expressionP->X_op == O_constant) { /* input_line_pointer -> char after operand. */ if (c == '-') { expressionP->X_add_number = - expressionP->X_add_number; /* Notice: '-' may overflow: no warning is given. This is compatible with other people's assemblers. Sigh. */ expressionP->X_unsigned = 0; } else if (c == '~' || c == '"') expressionP->X_add_number = ~ expressionP->X_add_number; else if (c == '!') expressionP->X_add_number = ! expressionP->X_add_number; } else if (expressionP->X_op == O_big && expressionP->X_add_number <= 0 && c == '-' && (generic_floating_point_number.sign == '+' || generic_floating_point_number.sign == 'P')) { /* Negative flonum (eg, -1.000e0). */ if (generic_floating_point_number.sign == '+') generic_floating_point_number.sign = '-'; else generic_floating_point_number.sign = 'N'; } else if (expressionP->X_op == O_big && expressionP->X_add_number > 0) { int i; if (c == '~' || c == '-') { for (i = 0; i < expressionP->X_add_number; ++i) generic_bignum[i] = ~generic_bignum[i]; + + /* Extend the bignum to at least the size of .octa. */ + if (expressionP->X_add_number < SIZE_OF_LARGE_NUMBER) + { + expressionP->X_add_number = SIZE_OF_LARGE_NUMBER; + for (; i < expressionP->X_add_number; ++i) + generic_bignum[i] = ~(LITTLENUM_TYPE) 0; + } + if (c == '-') for (i = 0; i < expressionP->X_add_number; ++i) { generic_bignum[i] += 1; if (generic_bignum[i]) break; } } else if (c == '!') { - int nonzero = 0; for (i = 0; i < expressionP->X_add_number; ++i) - { - if (generic_bignum[i]) - nonzero = 1; - generic_bignum[i] = 0; - } - generic_bignum[0] = nonzero; + if (generic_bignum[i] != 0) + break; + expressionP->X_add_number = i >= expressionP->X_add_number; + expressionP->X_op = O_constant; + expressionP->X_unsigned = 1; } } else if (expressionP->X_op != O_illegal && expressionP->X_op != O_absent) { if (c != '+') { expressionP->X_add_symbol = make_expr_symbol (expressionP); if (c == '-') expressionP->X_op = O_uminus; else if (c == '~' || c == '"') expressionP->X_op = O_bit_not; else expressionP->X_op = O_logical_not; expressionP->X_add_number = 0; } } else as_warn (_("Unary operator %c ignored because bad operand follows"), c); } break; #if defined (DOLLAR_DOT) || defined (TC_M68K) case '$': /* '$' is the program counter when in MRI mode, or when DOLLAR_DOT is defined. */ #ifndef DOLLAR_DOT if (! flag_m68k_mri) goto de_fault; #endif if (DOLLAR_AMBIGU && hex_p (*input_line_pointer)) { /* In MRI mode and on Z80, '$' is also used as the prefix for a hexadecimal constant. */ integer_constant (16, expressionP); break; } if (is_part_of_name (*input_line_pointer)) goto isname; current_location (expressionP); break; #endif case '.': if (!is_part_of_name (*input_line_pointer)) { current_location (expressionP); break; } else if ((strncasecmp (input_line_pointer, "startof.", 8) == 0 && ! is_part_of_name (input_line_pointer[8])) || (strncasecmp (input_line_pointer, "sizeof.", 7) == 0 && ! is_part_of_name (input_line_pointer[7]))) { int start; start = (input_line_pointer[1] == 't' || input_line_pointer[1] == 'T'); input_line_pointer += start ? 8 : 7; SKIP_WHITESPACE (); if (*input_line_pointer != '(') as_bad (_("syntax error in .startof. or .sizeof.")); else { char *buf; ++input_line_pointer; SKIP_WHITESPACE (); name = input_line_pointer; c = get_symbol_end (); buf = (char *) xmalloc (strlen (name) + 10); if (start) sprintf (buf, ".startof.%s", name); else sprintf (buf, ".sizeof.%s", name); symbolP = symbol_make (buf); free (buf); expressionP->X_op = O_symbol; expressionP->X_add_symbol = symbolP; expressionP->X_add_number = 0; *input_line_pointer = c; SKIP_WHITESPACE (); if (*input_line_pointer != ')') as_bad (_("syntax error in .startof. or .sizeof.")); else ++input_line_pointer; } break; } else { goto isname; } case ',': eol: /* Can't imagine any other kind of operand. */ expressionP->X_op = O_absent; input_line_pointer--; break; #ifdef TC_M68K case '%': if (! flag_m68k_mri) goto de_fault; integer_constant (2, expressionP); break; case '@': if (! flag_m68k_mri) goto de_fault; integer_constant (8, expressionP); break; case ':': if (! flag_m68k_mri) goto de_fault; /* In MRI mode, this is a floating point constant represented using hexadecimal digits. */ ++input_line_pointer; integer_constant (16, expressionP); break; case '*': if (! flag_m68k_mri || is_part_of_name (*input_line_pointer)) goto de_fault; current_location (expressionP); break; #endif default: #ifdef TC_M68K de_fault: #endif if (is_name_beginner (c)) /* Here if did not begin with a digit. */ { /* Identifier begins here. This is kludged for speed, so code is repeated. */ isname: name = --input_line_pointer; c = get_symbol_end (); #ifdef md_parse_name /* This is a hook for the backend to parse certain names specially in certain contexts. If a name always has a specific value, it can often be handled by simply entering it in the symbol table. */ if (md_parse_name (name, expressionP, mode, &c)) { *input_line_pointer = c; break; } #endif #ifdef TC_I960 /* The MRI i960 assembler permits lda sizeof code,g13 FIXME: This should use md_parse_name. */ if (flag_mri && (strcasecmp (name, "sizeof") == 0 || strcasecmp (name, "startof") == 0)) { int start; char *buf; start = (name[1] == 't' || name[1] == 'T'); *input_line_pointer = c; SKIP_WHITESPACE (); name = input_line_pointer; c = get_symbol_end (); buf = (char *) xmalloc (strlen (name) + 10); if (start) sprintf (buf, ".startof.%s", name); else sprintf (buf, ".sizeof.%s", name); symbolP = symbol_make (buf); free (buf); expressionP->X_op = O_symbol; expressionP->X_add_symbol = symbolP; expressionP->X_add_number = 0; *input_line_pointer = c; SKIP_WHITESPACE (); break; } #endif symbolP = symbol_find_or_make (name); /* If we have an absolute symbol or a reg, then we know its value now. */ segment = S_GET_SEGMENT (symbolP); if (mode != expr_defer && segment == absolute_section) { expressionP->X_op = O_constant; expressionP->X_add_number = S_GET_VALUE (symbolP); } else if (mode != expr_defer && segment == reg_section) { expressionP->X_op = O_register; expressionP->X_add_number = S_GET_VALUE (symbolP); } else { expressionP->X_op = O_symbol; expressionP->X_add_symbol = symbolP; expressionP->X_add_number = 0; } *input_line_pointer = c; } else { /* Let the target try to parse it. Success is indicated by changing the X_op field to something other than O_absent and pointing input_line_pointer past the expression. If it can't parse the expression, X_op and input_line_pointer should be unchanged. */ expressionP->X_op = O_absent; --input_line_pointer; md_operand (expressionP); if (expressionP->X_op == O_absent) { ++input_line_pointer; as_bad (_("bad expression")); expressionP->X_op = O_constant; expressionP->X_add_number = 0; } } break; } /* It is more 'efficient' to clean up the expressionS when they are created. Doing it here saves lines of code. */ clean_up_expression (expressionP); SKIP_WHITESPACE (); /* -> 1st char after operand. */ know (*input_line_pointer != ' '); /* The PA port needs this information. */ if (expressionP->X_add_symbol) symbol_mark_used (expressionP->X_add_symbol); expressionP->X_add_symbol = symbol_clone_if_forward_ref (expressionP->X_add_symbol); expressionP->X_op_symbol = symbol_clone_if_forward_ref (expressionP->X_op_symbol); switch (expressionP->X_op) { default: return absolute_section; case O_symbol: return S_GET_SEGMENT (expressionP->X_add_symbol); case O_register: return reg_section; } } /* Internal. Simplify a struct expression for use by expr (). */ /* In: address of an expressionS. The X_op field of the expressionS may only take certain values. Elsewise we waste time special-case testing. Sigh. Ditto SEG_ABSENT. Out: expressionS may have been modified: Unused fields zeroed to help expr (). */ static void clean_up_expression (expressionS *expressionP) { switch (expressionP->X_op) { case O_illegal: case O_absent: expressionP->X_add_number = 0; /* Fall through. */ case O_big: case O_constant: case O_register: expressionP->X_add_symbol = NULL; /* Fall through. */ case O_symbol: case O_uminus: case O_bit_not: expressionP->X_op_symbol = NULL; break; default: break; } } /* Expression parser. */ /* We allow an empty expression, and just assume (absolute,0) silently. Unary operators and parenthetical expressions are treated as operands. As usual, Q==quantity==operand, O==operator, X==expression mnemonics. We used to do an aho/ullman shift-reduce parser, but the logic got so warped that I flushed it and wrote a recursive-descent parser instead. Now things are stable, would anybody like to write a fast parser? Most expressions are either register (which does not even reach here) or 1 symbol. Then "symbol+constant" and "symbol-symbol" are common. So I guess it doesn't really matter how inefficient more complex expressions are parsed. After expr(RANK,resultP) input_line_pointer->operator of rank <= RANK. Also, we have consumed any leading or trailing spaces (operand does that) and done all intervening operators. This returns the segment of the result, which will be absolute_section or the segment of a symbol. */ #undef __ #define __ O_illegal #ifndef O_SINGLE_EQ #define O_SINGLE_EQ O_illegal #endif /* Maps ASCII -> operators. */ static const operatorT op_encoding[256] = { __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, O_bit_or_not, __, __, __, O_modulus, O_bit_and, __, __, __, O_multiply, O_add, __, O_subtract, __, O_divide, __, __, __, __, __, __, __, __, __, __, __, __, O_lt, O_SINGLE_EQ, O_gt, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, #ifdef NEED_INDEX_OPERATOR O_index, #else __, #endif __, __, O_bit_exclusive_or, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, O_bit_inclusive_or, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __ }; /* Rank Examples 0 operand, (expression) 1 || 2 && 3 == <> < <= >= > 4 + - 5 used for * / % in MRI mode 6 & ^ ! | 7 * / % << >> 8 unary - unary ~ */ static operator_rankT op_rank[] = { 0, /* O_illegal */ 0, /* O_absent */ 0, /* O_constant */ 0, /* O_symbol */ 0, /* O_symbol_rva */ 0, /* O_register */ 0, /* O_big */ 9, /* O_uminus */ 9, /* O_bit_not */ 9, /* O_logical_not */ 8, /* O_multiply */ 8, /* O_divide */ 8, /* O_modulus */ 8, /* O_left_shift */ 8, /* O_right_shift */ 7, /* O_bit_inclusive_or */ 7, /* O_bit_or_not */ 7, /* O_bit_exclusive_or */ 7, /* O_bit_and */ 5, /* O_add */ 5, /* O_subtract */ 4, /* O_eq */ 4, /* O_ne */ 4, /* O_lt */ 4, /* O_le */ 4, /* O_ge */ 4, /* O_gt */ 3, /* O_logical_and */ 2, /* O_logical_or */ 1, /* O_index */ 0, /* O_md1 */ 0, /* O_md2 */ 0, /* O_md3 */ 0, /* O_md4 */ 0, /* O_md5 */ 0, /* O_md6 */ 0, /* O_md7 */ 0, /* O_md8 */ 0, /* O_md9 */ 0, /* O_md10 */ 0, /* O_md11 */ 0, /* O_md12 */ 0, /* O_md13 */ 0, /* O_md14 */ 0, /* O_md15 */ 0, /* O_md16 */ }; /* Unfortunately, in MRI mode for the m68k, multiplication and division have lower precedence than the bit wise operators. This function sets the operator precedences correctly for the current mode. Also, MRI uses a different bit_not operator, and this fixes that as well. */ #define STANDARD_MUL_PRECEDENCE 8 #define MRI_MUL_PRECEDENCE 6 void expr_set_precedence (void) { if (flag_m68k_mri) { op_rank[O_multiply] = MRI_MUL_PRECEDENCE; op_rank[O_divide] = MRI_MUL_PRECEDENCE; op_rank[O_modulus] = MRI_MUL_PRECEDENCE; } else { op_rank[O_multiply] = STANDARD_MUL_PRECEDENCE; op_rank[O_divide] = STANDARD_MUL_PRECEDENCE; op_rank[O_modulus] = STANDARD_MUL_PRECEDENCE; } } /* Initialize the expression parser. */ void expr_begin (void) { expr_set_precedence (); /* Verify that X_op field is wide enough. */ { expressionS e; e.X_op = O_max; assert (e.X_op == O_max); } } /* Return the encoding for the operator at INPUT_LINE_POINTER, and sets NUM_CHARS to the number of characters in the operator. Does not advance INPUT_LINE_POINTER. */ static inline operatorT operator (int *num_chars) { int c; operatorT ret; c = *input_line_pointer & 0xff; *num_chars = 1; if (is_end_of_line[c]) return O_illegal; switch (c) { default: return op_encoding[c]; case '+': case '-': return op_encoding[c]; case '<': switch (input_line_pointer[1]) { default: return op_encoding[c]; case '<': ret = O_left_shift; break; case '>': ret = O_ne; break; case '=': ret = O_le; break; } *num_chars = 2; return ret; case '=': if (input_line_pointer[1] != '=') return op_encoding[c]; *num_chars = 2; return O_eq; case '>': switch (input_line_pointer[1]) { default: return op_encoding[c]; case '>': ret = O_right_shift; break; case '=': ret = O_ge; break; } *num_chars = 2; return ret; case '!': switch (input_line_pointer[1]) { case '!': /* We accept !! as equivalent to ^ for MRI compatibility. */ *num_chars = 2; return O_bit_exclusive_or; case '=': /* We accept != as equivalent to <>. */ *num_chars = 2; return O_ne; default: if (flag_m68k_mri) return O_bit_inclusive_or; return op_encoding[c]; } case '|': if (input_line_pointer[1] != '|') return op_encoding[c]; *num_chars = 2; return O_logical_or; case '&': if (input_line_pointer[1] != '&') return op_encoding[c]; *num_chars = 2; return O_logical_and; } /* NOTREACHED */ } /* Parse an expression. */ segT expr (int rankarg, /* Larger # is higher rank. */ expressionS *resultP, /* Deliver result here. */ enum expr_mode mode /* Controls behavior. */) { operator_rankT rank = (operator_rankT) rankarg; segT retval; expressionS right; operatorT op_left; operatorT op_right; int op_chars; know (rankarg >= 0); /* Save the value of dot for the fixup code. */ if (rank == 0) dot_value = frag_now_fix (); retval = operand (resultP, mode); /* operand () gobbles spaces. */ know (*input_line_pointer != ' '); op_left = operator (&op_chars); while (op_left != O_illegal && op_rank[(int) op_left] > rank) { segT rightseg; bfd_vma frag_off; input_line_pointer += op_chars; /* -> after operator. */ rightseg = expr (op_rank[(int) op_left], &right, mode); if (right.X_op == O_absent) { as_warn (_("missing operand; zero assumed")); right.X_op = O_constant; right.X_add_number = 0; right.X_add_symbol = NULL; right.X_op_symbol = NULL; } know (*input_line_pointer != ' '); if (op_left == O_index) { if (*input_line_pointer != ']') as_bad ("missing right bracket"); else { ++input_line_pointer; SKIP_WHITESPACE (); } } op_right = operator (&op_chars); know (op_right == O_illegal || op_rank[(int) op_right] <= op_rank[(int) op_left]); know ((int) op_left >= (int) O_multiply && (int) op_left <= (int) O_index); /* input_line_pointer->after right-hand quantity. */ /* left-hand quantity in resultP. */ /* right-hand quantity in right. */ /* operator in op_left. */ if (resultP->X_op == O_big) { if (resultP->X_add_number > 0) as_warn (_("left operand is a bignum; integer 0 assumed")); else as_warn (_("left operand is a float; integer 0 assumed")); resultP->X_op = O_constant; resultP->X_add_number = 0; resultP->X_add_symbol = NULL; resultP->X_op_symbol = NULL; } if (right.X_op == O_big) { if (right.X_add_number > 0) as_warn (_("right operand is a bignum; integer 0 assumed")); else as_warn (_("right operand is a float; integer 0 assumed")); right.X_op = O_constant; right.X_add_number = 0; right.X_add_symbol = NULL; right.X_op_symbol = NULL; } /* Optimize common cases. */ #ifdef md_optimize_expr if (md_optimize_expr (resultP, op_left, &right)) { /* Skip. */ ; } else #endif if (op_left == O_add && right.X_op == O_constant) { /* X + constant. */ resultP->X_add_number += right.X_add_number; } /* This case comes up in PIC code. */ else if (op_left == O_subtract && right.X_op == O_symbol && resultP->X_op == O_symbol && retval == rightseg && (SEG_NORMAL (rightseg) || right.X_add_symbol == resultP->X_add_symbol) && frag_offset_fixed_p (symbol_get_frag (resultP->X_add_symbol), symbol_get_frag (right.X_add_symbol), &frag_off)) { resultP->X_add_number -= right.X_add_number; resultP->X_add_number -= frag_off / OCTETS_PER_BYTE; resultP->X_add_number += (S_GET_VALUE (resultP->X_add_symbol) - S_GET_VALUE (right.X_add_symbol)); resultP->X_op = O_constant; resultP->X_add_symbol = 0; } else if (op_left == O_subtract && right.X_op == O_constant) { /* X - constant. */ resultP->X_add_number -= right.X_add_number; } else if (op_left == O_add && resultP->X_op == O_constant) { /* Constant + X. */ resultP->X_op = right.X_op; resultP->X_add_symbol = right.X_add_symbol; resultP->X_op_symbol = right.X_op_symbol; resultP->X_add_number += right.X_add_number; retval = rightseg; } else if (resultP->X_op == O_constant && right.X_op == O_constant) { /* Constant OP constant. */ offsetT v = right.X_add_number; if (v == 0 && (op_left == O_divide || op_left == O_modulus)) { as_warn (_("division by zero")); v = 1; } switch (op_left) { default: abort (); case O_multiply: resultP->X_add_number *= v; break; case O_divide: resultP->X_add_number /= v; break; case O_modulus: resultP->X_add_number %= v; break; case O_left_shift: resultP->X_add_number <<= v; break; case O_right_shift: /* We always use unsigned shifts, to avoid relying on characteristics of the compiler used to compile gas. */ resultP->X_add_number = (offsetT) ((valueT) resultP->X_add_number >> (valueT) v); break; case O_bit_inclusive_or: resultP->X_add_number |= v; break; case O_bit_or_not: resultP->X_add_number |= ~v; break; case O_bit_exclusive_or: resultP->X_add_number ^= v; break; case O_bit_and: resultP->X_add_number &= v; break; /* Constant + constant (O_add) is handled by the previous if statement for constant + X, so is omitted here. */ case O_subtract: resultP->X_add_number -= v; break; case O_eq: resultP->X_add_number = resultP->X_add_number == v ? ~ (offsetT) 0 : 0; break; case O_ne: resultP->X_add_number = resultP->X_add_number != v ? ~ (offsetT) 0 : 0; break; case O_lt: resultP->X_add_number = resultP->X_add_number < v ? ~ (offsetT) 0 : 0; break; case O_le: resultP->X_add_number = resultP->X_add_number <= v ? ~ (offsetT) 0 : 0; break; case O_ge: resultP->X_add_number = resultP->X_add_number >= v ? ~ (offsetT) 0 : 0; break; case O_gt: resultP->X_add_number = resultP->X_add_number > v ? ~ (offsetT) 0 : 0; break; case O_logical_and: resultP->X_add_number = resultP->X_add_number && v; break; case O_logical_or: resultP->X_add_number = resultP->X_add_number || v; break; } } else if (resultP->X_op == O_symbol && right.X_op == O_symbol && (op_left == O_add || op_left == O_subtract || (resultP->X_add_number == 0 && right.X_add_number == 0))) { /* Symbol OP symbol. */ resultP->X_op = op_left; resultP->X_op_symbol = right.X_add_symbol; if (op_left == O_add) resultP->X_add_number += right.X_add_number; else if (op_left == O_subtract) { resultP->X_add_number -= right.X_add_number; if (retval == rightseg && SEG_NORMAL (retval)) { retval = absolute_section; rightseg = absolute_section; } } } else { /* The general case. */ resultP->X_add_symbol = make_expr_symbol (resultP); resultP->X_op_symbol = make_expr_symbol (&right); resultP->X_op = op_left; resultP->X_add_number = 0; resultP->X_unsigned = 1; } if (retval != rightseg) { if (! SEG_NORMAL (retval)) { if (retval != undefined_section || SEG_NORMAL (rightseg)) retval = rightseg; } else if (SEG_NORMAL (rightseg) #ifdef DIFF_EXPR_OK && op_left != O_subtract #endif ) as_bad (_("operation combines symbols in different segments")); } op_left = op_right; } /* While next operator is >= this rank. */ /* The PA port needs this information. */ if (resultP->X_add_symbol) symbol_mark_used (resultP->X_add_symbol); if (rank == 0 && mode == expr_evaluate) resolve_expression (resultP); return resultP->X_op == O_constant ? absolute_section : retval; } /* Resolve an expression without changing any symbols/sub-expressions used. */ int resolve_expression (expressionS *expressionP) { /* Help out with CSE. */ valueT final_val = expressionP->X_add_number; symbolS *add_symbol = expressionP->X_add_symbol; symbolS *op_symbol = expressionP->X_op_symbol; operatorT op = expressionP->X_op; valueT left, right; segT seg_left, seg_right; fragS *frag_left, *frag_right; bfd_vma frag_off; switch (op) { default: return 0; case O_constant: case O_register: left = 0; break; case O_symbol: case O_symbol_rva: if (!snapshot_symbol (&add_symbol, &left, &seg_left, &frag_left)) return 0; break; case O_uminus: case O_bit_not: case O_logical_not: if (!snapshot_symbol (&add_symbol, &left, &seg_left, &frag_left)) return 0; if (seg_left != absolute_section) return 0; if (op == O_logical_not) left = !left; else if (op == O_uminus) left = -left; else left = ~left; op = O_constant; break; case O_multiply: case O_divide: case O_modulus: case O_left_shift: case O_right_shift: case O_bit_inclusive_or: case O_bit_or_not: case O_bit_exclusive_or: case O_bit_and: case O_add: case O_subtract: case O_eq: case O_ne: case O_lt: case O_le: case O_ge: case O_gt: case O_logical_and: case O_logical_or: if (!snapshot_symbol (&add_symbol, &left, &seg_left, &frag_left) || !snapshot_symbol (&op_symbol, &right, &seg_right, &frag_right)) return 0; /* Simplify addition or subtraction of a constant by folding the constant into X_add_number. */ if (op == O_add) { if (seg_right == absolute_section) { final_val += right; op = O_symbol; break; } else if (seg_left == absolute_section) { final_val += left; left = right; seg_left = seg_right; add_symbol = op_symbol; op = O_symbol; break; } } else if (op == O_subtract) { if (seg_right == absolute_section) { final_val -= right; op = O_symbol; break; } } /* Equality and non-equality tests are permitted on anything. Subtraction, and other comparison operators are permitted if both operands are in the same section. Shifts by constant zero are permitted on anything. Multiplies, bit-ors, and bit-ands with constant zero are permitted on anything. Multiplies and divides by constant one are permitted on anything. Binary operations with both operands being the same register or undefined symbol are permitted if the result doesn't depend on the input value. Otherwise, both operands must be absolute. We already handled the case of addition or subtraction of a constant above. */ frag_off = 0; if (!(seg_left == absolute_section && seg_right == absolute_section) && !(op == O_eq || op == O_ne) && !((op == O_subtract || op == O_lt || op == O_le || op == O_ge || op == O_gt) && seg_left == seg_right && (finalize_syms || frag_offset_fixed_p (frag_left, frag_right, &frag_off)) && (seg_left != reg_section || left == right) && (seg_left != undefined_section || add_symbol == op_symbol))) { if ((seg_left == absolute_section && left == 0) || (seg_right == absolute_section && right == 0)) { if (op == O_bit_exclusive_or || op == O_bit_inclusive_or) { if (seg_right != absolute_section || right != 0) { seg_left = seg_right; left = right; add_symbol = op_symbol; } op = O_symbol; break; } else if (op == O_left_shift || op == O_right_shift) { if (seg_left != absolute_section || left != 0) { op = O_symbol; break; } } else if (op != O_multiply && op != O_bit_or_not && op != O_bit_and) return 0; } else if (op == O_multiply && seg_left == absolute_section && left == 1) { seg_left = seg_right; left = right; add_symbol = op_symbol; op = O_symbol; break; } else if ((op == O_multiply || op == O_divide) && seg_right == absolute_section && right == 1) { op = O_symbol; break; } else if (left != right || ((seg_left != reg_section || seg_right != reg_section) && (seg_left != undefined_section || seg_right != undefined_section || add_symbol != op_symbol))) return 0; else if (op == O_bit_and || op == O_bit_inclusive_or) { op = O_symbol; break; } else if (op != O_bit_exclusive_or && op != O_bit_or_not) return 0; } right += frag_off / OCTETS_PER_BYTE; switch (op) { case O_add: left += right; break; case O_subtract: left -= right; break; case O_multiply: left *= right; break; case O_divide: if (right == 0) return 0; left = (offsetT) left / (offsetT) right; break; case O_modulus: if (right == 0) return 0; left = (offsetT) left % (offsetT) right; break; case O_left_shift: left <<= right; break; case O_right_shift: left >>= right; break; case O_bit_inclusive_or: left |= right; break; case O_bit_or_not: left |= ~right; break; case O_bit_exclusive_or: left ^= right; break; case O_bit_and: left &= right; break; case O_eq: case O_ne: left = (left == right && seg_left == seg_right && (finalize_syms || frag_left == frag_right) && (seg_left != undefined_section || add_symbol == op_symbol) ? ~ (valueT) 0 : 0); if (op == O_ne) left = ~left; break; case O_lt: left = (offsetT) left < (offsetT) right ? ~ (valueT) 0 : 0; break; case O_le: left = (offsetT) left <= (offsetT) right ? ~ (valueT) 0 : 0; break; case O_ge: left = (offsetT) left >= (offsetT) right ? ~ (valueT) 0 : 0; break; case O_gt: left = (offsetT) left > (offsetT) right ? ~ (valueT) 0 : 0; break; case O_logical_and: left = left && right; break; case O_logical_or: left = left || right; break; default: abort (); } op = O_constant; break; } if (op == O_symbol) { if (seg_left == absolute_section) op = O_constant; else if (seg_left == reg_section && final_val == 0) op = O_register; else if (add_symbol != expressionP->X_add_symbol) final_val += left; expressionP->X_add_symbol = add_symbol; } expressionP->X_op = op; if (op == O_constant || op == O_register) final_val += left; expressionP->X_add_number = final_val; return 1; } /* This lives here because it belongs equally in expr.c & read.c. expr.c is just a branch office read.c anyway, and putting it here lessens the crowd at read.c. Assume input_line_pointer is at start of symbol name. Advance input_line_pointer past symbol name. Turn that character into a '\0', returning its former value. This allows a string compare (RMS wants symbol names to be strings) of the symbol name. There will always be a char following symbol name, because all good lines end in end-of-line. */ char get_symbol_end (void) { char c; /* We accept \001 in a name in case this is being called with a constructed string. */ if (is_name_beginner (c = *input_line_pointer++) || c == '\001') { while (is_part_of_name (c = *input_line_pointer++) || c == '\001') ; if (is_name_ender (c)) c = *input_line_pointer++; } *--input_line_pointer = 0; return (c); } unsigned int get_single_number (void) { expressionS exp; operand (&exp, expr_normal); return exp.X_add_number; } Index: projects/arm_intrng/contrib/binutils/gas/input-scrub.c =================================================================== --- projects/arm_intrng/contrib/binutils/gas/input-scrub.c (revision 276247) +++ projects/arm_intrng/contrib/binutils/gas/input-scrub.c (revision 276248) @@ -1,511 +1,511 @@ /* input_scrub.c - Break up input buffers into whole numbers of lines. Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2003, 2006, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GAS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GAS; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "as.h" #include "input-file.h" #include "sb.h" #include "listing.h" /* * O/S independent module to supply buffers of sanitised source code * to rest of assembler. We get sanitised input data of arbitrary length. * We break these buffers on line boundaries, recombine pieces that * were broken across buffers, and return a buffer of full lines to * the caller. * The last partial line begins the next buffer we build and return to caller. * The buffer returned to caller is preceded by BEFORE_STRING and followed * by AFTER_STRING, as sentinels. The last character before AFTER_STRING * is a newline. * Also looks after line numbers, for e.g. error messages. */ /* * We don't care how filthy our buffers are, but our callers assume * that the following sanitation has already been done. * * No comments, reduce a comment to a space. * Reduce a tab to a space unless it is 1st char of line. * All multiple tabs and spaces collapsed into 1 char. Tab only * legal if 1st char of line. * # line file statements converted to .line x;.file y; statements. * Escaped newlines at end of line: remove them but add as many newlines * to end of statement as you removed in the middle, to synch line numbers. */ #define BEFORE_STRING ("\n") #define AFTER_STRING ("\0") /* memcpy of 0 chars might choke. */ #define BEFORE_SIZE (1) #define AFTER_SIZE (1) #ifndef TC_EOL_IN_INSN #define TC_EOL_IN_INSN(P) 0 #endif static char *buffer_start; /*->1st char of full buffer area. */ static char *partial_where; /*->after last full line in buffer. */ static int partial_size; /* >=0. Number of chars in partial line in buffer. */ /* Because we need AFTER_STRING just after last full line, it clobbers 1st part of partial line. So we preserve 1st part of partial line here. */ static char save_source[AFTER_SIZE]; /* What is the largest size buffer that input_file_give_next_buffer() could return to us? */ static unsigned int buffer_length; /* The index into an sb structure we are reading from. -1 if none. */ static int sb_index = -1; /* If we are reading from an sb structure, this is it. */ static sb from_sb; /* Should we do a conditional check on from_sb? */ static int from_sb_is_expansion = 1; /* The number of nested sb structures we have included. */ int macro_nest; /* We can have more than one source file open at once, though the info for all but the latest one are saved off in a struct input_save. These files remain open, so we are limited by the number of open files allowed by the underlying OS. We may also sequentially read more than one source file in an assembly. */ /* We must track the physical file and line number for error messages. We also track a "logical" file and line number corresponding to (C?) compiler source line numbers. Whenever we open a file we must fill in physical_input_file. So if it is NULL we have not opened any files yet. */ static char *physical_input_file; static char *logical_input_file; typedef unsigned int line_numberT; /* 1-origin line number in a source file. */ /* A line ends in '\n' or eof. */ static line_numberT physical_input_line; static int logical_input_line; /* Struct used to save the state of the input handler during include files */ struct input_save { char * buffer_start; char * partial_where; int partial_size; char save_source[AFTER_SIZE]; unsigned int buffer_length; char * physical_input_file; char * logical_input_file; line_numberT physical_input_line; int logical_input_line; int sb_index; sb from_sb; int from_sb_is_expansion; /* Should we do a conditional check? */ struct input_save * next_saved_file; /* Chain of input_saves. */ char * input_file_save; /* Saved state of input routines. */ char * saved_position; /* Caller's saved position in buf. */ }; static struct input_save *input_scrub_push (char *saved_position); static char *input_scrub_pop (struct input_save *arg); /* Saved information about the file that .include'd this one. When we hit EOF, we automatically pop to that file. */ static struct input_save *next_saved_file; /* Push the state of input reading and scrubbing so that we can #include. The return value is a 'void *' (fudged for old compilers) to a save area, which can be restored by passing it to input_scrub_pop(). */ static struct input_save * input_scrub_push (char *saved_position) { register struct input_save *saved; saved = (struct input_save *) xmalloc (sizeof *saved); saved->saved_position = saved_position; saved->buffer_start = buffer_start; saved->partial_where = partial_where; saved->partial_size = partial_size; saved->buffer_length = buffer_length; saved->physical_input_file = physical_input_file; saved->logical_input_file = logical_input_file; saved->physical_input_line = physical_input_line; saved->logical_input_line = logical_input_line; saved->sb_index = sb_index; saved->from_sb = from_sb; saved->from_sb_is_expansion = from_sb_is_expansion; memcpy (saved->save_source, save_source, sizeof (save_source)); saved->next_saved_file = next_saved_file; saved->input_file_save = input_file_push (); input_file_begin (); /* Reinitialize! */ logical_input_line = -1; logical_input_file = (char *) NULL; buffer_length = input_file_buffer_size (); sb_index = -1; buffer_start = xmalloc ((BEFORE_SIZE + buffer_length + buffer_length + AFTER_SIZE)); memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE); return saved; } static char * input_scrub_pop (struct input_save *saved) { char *saved_position; input_scrub_end (); /* Finish off old buffer */ input_file_pop (saved->input_file_save); saved_position = saved->saved_position; buffer_start = saved->buffer_start; buffer_length = saved->buffer_length; physical_input_file = saved->physical_input_file; logical_input_file = saved->logical_input_file; physical_input_line = saved->physical_input_line; logical_input_line = saved->logical_input_line; sb_index = saved->sb_index; from_sb = saved->from_sb; from_sb_is_expansion = saved->from_sb_is_expansion; partial_where = saved->partial_where; partial_size = saved->partial_size; next_saved_file = saved->next_saved_file; memcpy (save_source, saved->save_source, sizeof (save_source)); free (saved); return saved_position; } void input_scrub_begin (void) { know (strlen (BEFORE_STRING) == BEFORE_SIZE); know (strlen (AFTER_STRING) == AFTER_SIZE || (AFTER_STRING[0] == '\0' && AFTER_SIZE == 1)); input_file_begin (); buffer_length = input_file_buffer_size (); buffer_start = xmalloc ((BEFORE_SIZE + buffer_length + buffer_length + AFTER_SIZE)); memcpy (buffer_start, BEFORE_STRING, (int) BEFORE_SIZE); /* Line number things. */ logical_input_line = -1; logical_input_file = (char *) NULL; physical_input_file = NULL; /* No file read yet. */ next_saved_file = NULL; /* At EOF, don't pop to any other file */ do_scrub_begin (flag_m68k_mri); } void input_scrub_end (void) { if (buffer_start) { free (buffer_start); buffer_start = 0; input_file_end (); } } /* Start reading input from a new file. Return start of caller's part of buffer. */ char * input_scrub_new_file (char *filename) { input_file_open (filename, !flag_no_comments); physical_input_file = filename[0] ? filename : _("{standard input}"); physical_input_line = 0; partial_size = 0; return (buffer_start + BEFORE_SIZE); } /* Include a file from the current file. Save our state, cause it to be restored on EOF, and begin handling a new file. Same result as input_scrub_new_file. */ char * input_scrub_include_file (char *filename, char *position) { next_saved_file = input_scrub_push (position); return input_scrub_new_file (filename); } /* Start getting input from an sb structure. This is used when expanding a macro. */ void input_scrub_include_sb (sb *from, char *position, int is_expansion) { if (macro_nest > max_macro_nest) as_fatal (_("macros nested too deeply")); ++macro_nest; #ifdef md_macro_start if (is_expansion) { md_macro_start (); } #endif next_saved_file = input_scrub_push (position); sb_new (&from_sb); from_sb_is_expansion = is_expansion; if (from->len >= 1 && from->ptr[0] != '\n') { /* Add the sentinel required by read.c. */ sb_add_char (&from_sb, '\n'); } sb_scrub_and_add_sb (&from_sb, from); sb_index = 1; /* These variables are reset by input_scrub_push. Restore them since we are, after all, still at the same point in the file. */ logical_input_line = next_saved_file->logical_input_line; logical_input_file = next_saved_file->logical_input_file; } void input_scrub_close (void) { input_file_close (); } char * input_scrub_next_buffer (char **bufp) { register char *limit; /*->just after last char of buffer. */ if (sb_index >= 0) { if (sb_index >= from_sb.len) { sb_kill (&from_sb); if (from_sb_is_expansion ) { cond_finish_check (macro_nest); #ifdef md_macro_end /* Allow the target to clean up per-macro expansion data. */ md_macro_end (); #endif } --macro_nest; partial_where = NULL; if (next_saved_file != NULL) *bufp = input_scrub_pop (next_saved_file); return partial_where; } partial_where = from_sb.ptr + from_sb.len; partial_size = 0; *bufp = from_sb.ptr + sb_index; sb_index = from_sb.len; return partial_where; } *bufp = buffer_start + BEFORE_SIZE; if (partial_size) { - memcpy (buffer_start + BEFORE_SIZE, partial_where, + memmove (buffer_start + BEFORE_SIZE, partial_where, (unsigned int) partial_size); memcpy (buffer_start + BEFORE_SIZE, save_source, AFTER_SIZE); } limit = input_file_give_next_buffer (buffer_start + BEFORE_SIZE + partial_size); if (limit) { register char *p; /* Find last newline. */ /* Terminate the buffer to avoid confusing TC_EOL_IN_INSN. */ *limit = '\0'; for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p) ; ++p; while (p <= buffer_start + BEFORE_SIZE) { int limoff; limoff = limit - buffer_start; buffer_length += input_file_buffer_size (); buffer_start = xrealloc (buffer_start, (BEFORE_SIZE + 2 * buffer_length + AFTER_SIZE)); *bufp = buffer_start + BEFORE_SIZE; limit = input_file_give_next_buffer (buffer_start + limoff); if (limit == NULL) { as_warn (_("partial line at end of file ignored")); partial_where = NULL; if (next_saved_file) *bufp = input_scrub_pop (next_saved_file); return NULL; } /* Terminate the buffer to avoid confusing TC_EOL_IN_INSN. */ *limit = '\0'; for (p = limit - 1; *p != '\n' || TC_EOL_IN_INSN (p); --p) ; ++p; } partial_where = p; partial_size = limit - p; memcpy (save_source, partial_where, (int) AFTER_SIZE); memcpy (partial_where, AFTER_STRING, (int) AFTER_SIZE); } else { partial_where = 0; if (partial_size > 0) { as_warn (_("partial line at end of file ignored")); } /* Tell the listing we've finished the file. */ LISTING_EOF (); /* If we should pop to another file at EOF, do it. */ if (next_saved_file) { *bufp = input_scrub_pop (next_saved_file); /* Pop state */ /* partial_where is now correct to return, since we popped it. */ } } return (partial_where); } /* The remaining part of this file deals with line numbers, error messages and so on. Return TRUE if we opened any file. */ int seen_at_least_1_file (void) { return (physical_input_file != NULL); } void bump_line_counters (void) { if (sb_index < 0) { ++physical_input_line; if (logical_input_line >= 0) ++logical_input_line; } } /* Tells us what the new logical line number and file are. If the line_number is -1, we don't change the current logical line number. If it is -2, we decrement the logical line number (this is to support the .appfile pseudo-op inserted into the stream by do_scrub_chars). If the fname is NULL, we don't change the current logical file name. Returns nonzero if the filename actually changes. */ int new_logical_line_flags (char *fname, /* DON'T destroy it! We point to it! */ int line_number, int flags) { switch (flags) { case 0: break; case 1: if (line_number != -1) abort (); break; case 1 << 1: case 1 << 2: /* FIXME: we could check that include nesting is correct. */ break; default: abort (); } if (line_number >= 0) logical_input_line = line_number; else if (line_number == -1 && fname && !*fname && (flags & (1 << 2))) { logical_input_file = physical_input_file; logical_input_line = physical_input_line; fname = NULL; } if (fname && (logical_input_file == NULL || strcmp (logical_input_file, fname))) { logical_input_file = fname; return 1; } else return 0; } int new_logical_line (char *fname, int line_number) { return new_logical_line_flags (fname, line_number, 0); } /* Return the current file name and line number. namep should be char * const *, but there are compilers which screw up declarations like that, and it's easier to avoid it. */ void as_where (char **namep, unsigned int *linep) { if (logical_input_file != NULL && (linep == NULL || logical_input_line >= 0)) { *namep = logical_input_file; if (linep != NULL) *linep = logical_input_line; } else if (physical_input_file != NULL) { *namep = physical_input_file; if (linep != NULL) *linep = physical_input_line; } else { *namep = 0; if (linep != NULL) *linep = 0; } } Index: projects/arm_intrng/contrib/binutils/gas/read.c =================================================================== --- projects/arm_intrng/contrib/binutils/gas/read.c (revision 276247) +++ projects/arm_intrng/contrib/binutils/gas/read.c (revision 276248) @@ -1,5751 +1,5768 @@ /* read.c - read a source file - Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GAS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GAS; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* If your chars aren't 8 bits, you will change this a bit (eg. to 0xFF). But then, GNU isn't spozed to run on your machine anyway. (RMS is so shortsighted sometimes.) */ #define MASK_CHAR ((int)(unsigned char) -1) /* This is the largest known floating point format (for now). It will grow when we do 4361 style flonums. */ #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16) /* Routines that read assembler source text to build spaghetti in memory. Another group of these functions is in the expr.c module. */ #include "as.h" #include "safe-ctype.h" #include "subsegs.h" #include "sb.h" #include "macro.h" #include "obstack.h" #include "ecoff.h" #include "dw2gencfi.h" #ifndef TC_START_LABEL #define TC_START_LABEL(x,y) (x == ':') #endif /* Set by the object-format or the target. */ #ifndef TC_IMPLICIT_LCOMM_ALIGNMENT #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \ do \ { \ if ((SIZE) >= 8) \ (P2VAR) = 3; \ else if ((SIZE) >= 4) \ (P2VAR) = 2; \ else if ((SIZE) >= 2) \ (P2VAR) = 1; \ else \ (P2VAR) = 0; \ } \ while (0) #endif char *input_line_pointer; /*->next char of source file to parse. */ #if BITS_PER_CHAR != 8 /* The following table is indexed by[(char)] and will break if a char does not have exactly 256 states (hopefully 0:255!)! */ die horribly; #endif #ifndef LEX_AT #define LEX_AT 0 #endif #ifndef LEX_BR /* The RS/6000 assembler uses {,},[,] as parts of symbol names. */ #define LEX_BR 0 #endif #ifndef LEX_PCT /* The Delta 68k assembler permits % inside label names. */ #define LEX_PCT 0 #endif #ifndef LEX_QM /* The PowerPC Windows NT assemblers permits ? inside label names. */ #define LEX_QM 0 #endif #ifndef LEX_HASH /* The IA-64 assembler uses # as a suffix designating a symbol. We include it in the symbol and strip it out in tc_canonicalize_symbol_name. */ #define LEX_HASH 0 #endif #ifndef LEX_DOLLAR #define LEX_DOLLAR 3 #endif #ifndef LEX_TILDE /* The Delta 68k assembler permits ~ at start of label names. */ #define LEX_TILDE 0 #endif /* Used by is_... macros. our ctype[]. */ char lex_type[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */ 0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */ LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, LEX_TILDE, 0, /* pqrstuvwxyz{|}~. */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; /* In: a character. Out: 1 if this character ends a line. */ char is_end_of_line[256] = { #ifdef CR_EOL 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */ #else 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* @abcdefghijklmno */ #endif 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* _!"#$%&'()*+,-./ */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0123456789:;<=>? */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */ }; #ifndef TC_CASE_SENSITIVE char original_case_string[128]; #endif /* Functions private to this file. */ static char *buffer; /* 1st char of each buffer of lines is here. */ static char *buffer_limit; /*->1 + last char in buffer. */ /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1 in the tc-.h file. See the "Porting GAS" section of the internals manual. */ int target_big_endian = TARGET_BYTES_BIG_ENDIAN; /* Variables for handling include file directory table. */ /* Table of pointers to directories to search for .include's. */ char **include_dirs; /* How many are in the table. */ int include_dir_count; /* Length of longest in table. */ int include_dir_maxlen = 1; #ifndef WORKING_DOT_WORD struct broken_word *broken_words; int new_broken_words; #endif /* The current offset into the absolute section. We don't try to build frags in the absolute section, since no data can be stored there. We just keep track of the current offset. */ addressT abs_section_offset; /* If this line had an MRI style label, it is stored in this variable. This is used by some of the MRI pseudo-ops. */ symbolS *line_label; /* This global variable is used to support MRI common sections. We translate such sections into a common symbol. This variable is non-NULL when we are in an MRI common section. */ symbolS *mri_common_symbol; /* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we need to align to an even byte boundary unless the next pseudo-op is dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment may be needed. */ static int mri_pending_align; #ifndef NO_LISTING #ifdef OBJ_ELF /* This variable is set to be non-zero if the next string we see might be the name of the source file in DWARF debugging information. See the comment in emit_expr for the format we look for. */ static int dwarf_file_string; #endif #endif static void do_s_func (int end_p, const char *default_prefix); static void do_align (int, char *, int, int); static void s_align (int, int); static void s_altmacro (int); static void s_bad_end (int); #ifdef OBJ_ELF static void s_gnu_attribute (int); #endif static void s_reloc (int); static int hex_float (int, char *); static segT get_known_segmented_expression (expressionS * expP); static void pobegin (void); static int get_line_sb (sb *); static void generate_file_debug (void); static char *_find_end_of_line (char *, int, int); void read_begin (void) { const char *p; pobegin (); obj_read_begin_hook (); /* Something close -- but not too close -- to a multiple of 1024. The debugging malloc I'm using has 24 bytes of overhead. */ obstack_begin (¬es, chunksize); obstack_begin (&cond_obstack, chunksize); /* Use machine dependent syntax. */ for (p = line_separator_chars; *p; p++) is_end_of_line[(unsigned char) *p] = 1; /* Use more. FIXME-SOMEDAY. */ if (flag_mri) lex_type['?'] = 3; } #ifndef TC_ADDRESS_BYTES #define TC_ADDRESS_BYTES address_bytes static inline int address_bytes (void) { /* Choose smallest of 1, 2, 4, 8 bytes that is large enough to contain an address. */ int n = (stdoutput->arch_info->bits_per_address - 1) / 8; n |= n >> 1; n |= n >> 2; n += 1; return n; } #endif /* Set up pseudo-op tables. */ static struct hash_control *po_hash; static const pseudo_typeS potable[] = { {"abort", s_abort, 0}, {"align", s_align_ptwo, 0}, {"altmacro", s_altmacro, 1}, {"ascii", stringer, 0}, {"asciz", stringer, 1}, {"balign", s_align_bytes, 0}, {"balignw", s_align_bytes, -2}, {"balignl", s_align_bytes, -4}, /* block */ {"byte", cons, 1}, {"comm", s_comm, 0}, {"common", s_mri_common, 0}, {"common.s", s_mri_common, 1}, {"data", s_data, 0}, {"dc", cons, 2}, #ifdef TC_ADDRESS_BYTES {"dc.a", cons, 0}, #endif {"dc.b", cons, 1}, {"dc.d", float_cons, 'd'}, {"dc.l", cons, 4}, {"dc.s", float_cons, 'f'}, {"dc.w", cons, 2}, {"dc.x", float_cons, 'x'}, {"dcb", s_space, 2}, {"dcb.b", s_space, 1}, {"dcb.d", s_float_space, 'd'}, {"dcb.l", s_space, 4}, {"dcb.s", s_float_space, 'f'}, {"dcb.w", s_space, 2}, {"dcb.x", s_float_space, 'x'}, {"ds", s_space, 2}, {"ds.b", s_space, 1}, {"ds.d", s_space, 8}, {"ds.l", s_space, 4}, {"ds.p", s_space, 12}, {"ds.s", s_space, 4}, {"ds.w", s_space, 2}, {"ds.x", s_space, 12}, {"debug", s_ignore, 0}, #ifdef S_SET_DESC {"desc", s_desc, 0}, #endif /* dim */ {"double", float_cons, 'd'}, /* dsect */ {"eject", listing_eject, 0}, /* Formfeed listing. */ {"else", s_else, 0}, {"elsec", s_else, 0}, {"elseif", s_elseif, (int) O_ne}, {"end", s_end, 0}, {"endc", s_endif, 0}, {"endfunc", s_func, 1}, {"endif", s_endif, 0}, {"endm", s_bad_end, 0}, {"endr", s_bad_end, 1}, /* endef */ {"equ", s_set, 0}, {"equiv", s_set, 1}, {"eqv", s_set, -1}, {"err", s_err, 0}, {"error", s_errwarn, 1}, {"exitm", s_mexit, 0}, /* extend */ {"extern", s_ignore, 0}, /* We treat all undef as ext. */ {"appfile", s_app_file, 1}, {"appline", s_app_line, 1}, {"fail", s_fail, 0}, {"file", s_app_file, 0}, {"fill", s_fill, 0}, {"float", float_cons, 'f'}, {"format", s_ignore, 0}, {"func", s_func, 0}, {"global", s_globl, 0}, {"globl", s_globl, 0}, #ifdef OBJ_ELF {"gnu_attribute", s_gnu_attribute, 0}, #endif {"hword", cons, 2}, {"if", s_if, (int) O_ne}, {"ifb", s_ifb, 1}, {"ifc", s_ifc, 0}, {"ifdef", s_ifdef, 0}, {"ifeq", s_if, (int) O_eq}, {"ifeqs", s_ifeqs, 0}, {"ifge", s_if, (int) O_ge}, {"ifgt", s_if, (int) O_gt}, {"ifle", s_if, (int) O_le}, {"iflt", s_if, (int) O_lt}, {"ifnb", s_ifb, 0}, {"ifnc", s_ifc, 1}, {"ifndef", s_ifdef, 1}, {"ifne", s_if, (int) O_ne}, {"ifnes", s_ifeqs, 1}, {"ifnotdef", s_ifdef, 1}, {"incbin", s_incbin, 0}, {"include", s_include, 0}, {"int", cons, 4}, {"irp", s_irp, 0}, {"irep", s_irp, 0}, {"irpc", s_irp, 1}, {"irepc", s_irp, 1}, {"lcomm", s_lcomm, 0}, {"lflags", listing_flags, 0}, /* Listing flags. */ {"linefile", s_app_line, 0}, {"linkonce", s_linkonce, 0}, {"list", listing_list, 1}, /* Turn listing on. */ {"llen", listing_psize, 1}, {"long", cons, 4}, {"lsym", s_lsym, 0}, {"macro", s_macro, 0}, {"mexit", s_mexit, 0}, {"mri", s_mri, 0}, {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */ {"name", s_ignore, 0}, {"noaltmacro", s_altmacro, 0}, {"noformat", s_ignore, 0}, {"nolist", listing_list, 0}, /* Turn listing off. */ {"nopage", listing_nopage, 0}, {"octa", cons, 16}, {"offset", s_struct, 0}, {"org", s_org, 0}, {"p2align", s_align_ptwo, 0}, {"p2alignw", s_align_ptwo, -2}, {"p2alignl", s_align_ptwo, -4}, {"page", listing_eject, 0}, {"plen", listing_psize, 0}, {"print", s_print, 0}, {"psize", listing_psize, 0}, /* Set paper size. */ {"purgem", s_purgem, 0}, {"quad", cons, 8}, {"reloc", s_reloc, 0}, {"rep", s_rept, 0}, {"rept", s_rept, 0}, {"rva", s_rva, 4}, {"sbttl", listing_title, 1}, /* Subtitle of listing. */ /* scl */ /* sect */ {"set", s_set, 0}, {"short", cons, 2}, {"single", float_cons, 'f'}, /* size */ {"space", s_space, 0}, {"skip", s_space, 0}, {"sleb128", s_leb128, 1}, {"spc", s_ignore, 0}, {"stabd", s_stab, 'd'}, {"stabn", s_stab, 'n'}, {"stabs", s_stab, 's'}, {"string", stringer, 1}, {"struct", s_struct, 0}, /* tag */ {"text", s_text, 0}, /* This is for gcc to use. It's only just been added (2/94), so gcc won't be able to use it for a while -- probably a year or more. But once this has been released, check with gcc maintainers before deleting it or even changing the spelling. */ {"this_GCC_requires_the_GNU_assembler", s_ignore, 0}, /* If we're folding case -- done for some targets, not necessarily all -- the above string in an input file will be converted to this one. Match it either way... */ {"this_gcc_requires_the_gnu_assembler", s_ignore, 0}, {"title", listing_title, 0}, /* Listing title. */ {"ttl", listing_title, 0}, /* type */ {"uleb128", s_leb128, 0}, /* use */ /* val */ {"xcom", s_comm, 0}, {"xdef", s_globl, 0}, {"xref", s_ignore, 0}, {"xstabs", s_xstab, 's'}, {"warning", s_errwarn, 0}, {"weakref", s_weakref, 0}, {"word", cons, 2}, {"zero", s_space, 0}, {NULL, NULL, 0} /* End sentinel. */ }; static offsetT get_absolute_expr (expressionS *exp) { expression_and_evaluate (exp); if (exp->X_op != O_constant) { if (exp->X_op != O_absent) as_bad (_("bad or irreducible absolute expression")); exp->X_add_number = 0; } return exp->X_add_number; } offsetT get_absolute_expression (void) { expressionS exp; return get_absolute_expr (&exp); } static int pop_override_ok = 0; static const char *pop_table_name; void pop_insert (const pseudo_typeS *table) { const char *errtxt; const pseudo_typeS *pop; for (pop = table; pop->poc_name; pop++) { errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop); if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists"))) as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name, errtxt); } } #ifndef md_pop_insert #define md_pop_insert() pop_insert(md_pseudo_table) #endif #ifndef obj_pop_insert #define obj_pop_insert() pop_insert(obj_pseudo_table) #endif #ifndef cfi_pop_insert #define cfi_pop_insert() pop_insert(cfi_pseudo_table) #endif static void pobegin (void) { po_hash = hash_new (); /* Do the target-specific pseudo ops. */ pop_table_name = "md"; md_pop_insert (); /* Now object specific. Skip any that were in the target table. */ pop_table_name = "obj"; pop_override_ok = 1; obj_pop_insert (); /* Now portable ones. Skip any that we've seen already. */ pop_table_name = "standard"; pop_insert (potable); #ifdef TARGET_USE_CFIPOP pop_table_name = "cfi"; pop_override_ok = 1; cfi_pop_insert (); #endif } #define HANDLE_CONDITIONAL_ASSEMBLY() \ if (ignore_input ()) \ { \ char *eol = find_end_of_line (input_line_pointer, flag_m68k_mri); \ input_line_pointer = (input_line_pointer <= buffer_limit \ && eol >= buffer_limit) \ ? buffer_limit \ : eol + 1; \ continue; \ } /* This function is used when scrubbing the characters between #APP and #NO_APP. */ static char *scrub_string; static char *scrub_string_end; static int scrub_from_string (char *buf, int buflen) { int copy; copy = scrub_string_end - scrub_string; if (copy > buflen) copy = buflen; memcpy (buf, scrub_string, copy); scrub_string += copy; return copy; } /* Helper function of read_a_source_file, which tries to expand a macro. */ static int try_macro (char term, const char *line) { sb out; const char *err; macro_entry *macro; if (check_macro (line, &out, &err, ¯o)) { if (err != NULL) as_bad ("%s", err); *input_line_pointer++ = term; input_scrub_include_sb (&out, input_line_pointer, 1); sb_kill (&out); buffer_limit = input_scrub_next_buffer (&input_line_pointer); #ifdef md_macro_info md_macro_info (macro); #endif return 1; } return 0; } /* We read the file, putting things into a web that represents what we have been reading. */ void read_a_source_file (char *name) { register char c; register char *s; /* String of symbol, '\0' appended. */ register int temp; pseudo_typeS *pop; #ifdef WARN_COMMENTS found_comment = 0; #endif buffer = input_scrub_new_file (name); listing_file (name); listing_newline (NULL); register_dependency (name); /* Generate debugging information before we've read anything in to denote this file as the "main" source file and not a subordinate one (e.g. N_SO vs N_SOL in stabs). */ generate_file_debug (); while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0) { /* We have another line to parse. */ #ifndef NO_LISTING /* In order to avoid listing macro expansion lines with labels multiple times, keep track of which line was last issued. */ static char *last_eol; last_eol = NULL; #endif while (input_line_pointer < buffer_limit) { /* We have more of this buffer to parse. */ /* We now have input_line_pointer->1st char of next line. If input_line_pointer [-1] == '\n' then we just scanned another line: so bump line counters. */ if (is_end_of_line[(unsigned char) input_line_pointer[-1]]) { #ifdef md_start_line_hook md_start_line_hook (); #endif if (input_line_pointer[-1] == '\n') bump_line_counters (); line_label = NULL; if (LABELS_WITHOUT_COLONS || flag_m68k_mri) { /* Text at the start of a line must be a label, we run down and stick a colon in. */ if (is_name_beginner (*input_line_pointer)) { char *line_start = input_line_pointer; char c; int mri_line_macro; LISTING_NEWLINE (); HANDLE_CONDITIONAL_ASSEMBLY (); c = get_symbol_end (); /* In MRI mode, the EQU and MACRO pseudoops must be handled specially. */ mri_line_macro = 0; if (flag_m68k_mri) { char *rest = input_line_pointer + 1; if (*rest == ':') ++rest; if (*rest == ' ' || *rest == '\t') ++rest; if ((strncasecmp (rest, "EQU", 3) == 0 || strncasecmp (rest, "SET", 3) == 0) && (rest[3] == ' ' || rest[3] == '\t')) { input_line_pointer = rest + 3; equals (line_start, strncasecmp (rest, "SET", 3) == 0); continue; } if (strncasecmp (rest, "MACRO", 5) == 0 && (rest[5] == ' ' || rest[5] == '\t' || is_end_of_line[(unsigned char) rest[5]])) mri_line_macro = 1; } /* In MRI mode, we need to handle the MACRO pseudo-op specially: we don't want to put the symbol in the symbol table. */ if (!mri_line_macro #ifdef TC_START_LABEL_WITHOUT_COLON && TC_START_LABEL_WITHOUT_COLON(c, input_line_pointer) #endif ) line_label = colon (line_start); else line_label = symbol_create (line_start, absolute_section, (valueT) 0, &zero_address_frag); *input_line_pointer = c; if (c == ':') input_line_pointer++; } } } /* We are at the beginning of a line, or similar place. We expect a well-formed assembler statement. A "symbol-name:" is a statement. Depending on what compiler is used, the order of these tests may vary to catch most common case 1st. Each test is independent of all other tests at the (top) level. */ do c = *input_line_pointer++; while (c == '\t' || c == ' ' || c == '\f'); #ifndef NO_LISTING /* If listing is on, and we are expanding a macro, then give the listing code the contents of the expanded line. */ if (listing) { if ((listing & LISTING_MACEXP) && macro_nest > 0) { char *copy; int len; /* Find the end of the current expanded macro line. */ s = find_end_of_line (input_line_pointer - 1, flag_m68k_mri); if (s != last_eol) { last_eol = s; /* Copy it for safe keeping. Also give an indication of how much macro nesting is involved at this point. */ len = s - (input_line_pointer - 1); copy = (char *) xmalloc (len + macro_nest + 2); memset (copy, '>', macro_nest); copy[macro_nest] = ' '; memcpy (copy + macro_nest + 1, input_line_pointer - 1, len); copy[macro_nest + 1 + len] = '\0'; /* Install the line with the listing facility. */ listing_newline (copy); } } else listing_newline (NULL); } #endif /* C is the 1st significant character. Input_line_pointer points after that character. */ if (is_name_beginner (c)) { /* Want user-defined label or pseudo/opcode. */ HANDLE_CONDITIONAL_ASSEMBLY (); s = --input_line_pointer; c = get_symbol_end (); /* name's delimiter. */ /* C is character after symbol. That character's place in the input line is now '\0'. S points to the beginning of the symbol. [In case of pseudo-op, s->'.'.] Input_line_pointer->'\0' where c was. */ if (TC_START_LABEL (c, input_line_pointer)) { if (flag_m68k_mri) { char *rest = input_line_pointer + 1; /* In MRI mode, \tsym: set 0 is permitted. */ if (*rest == ':') ++rest; if (*rest == ' ' || *rest == '\t') ++rest; if ((strncasecmp (rest, "EQU", 3) == 0 || strncasecmp (rest, "SET", 3) == 0) && (rest[3] == ' ' || rest[3] == '\t')) { input_line_pointer = rest + 3; equals (s, 1); continue; } } line_label = colon (s); /* User-defined label. */ /* Put ':' back for error messages' sake. */ *input_line_pointer++ = ':'; #ifdef tc_check_label tc_check_label (line_label); #endif /* Input_line_pointer->after ':'. */ SKIP_WHITESPACE (); } else if (input_line_pointer[1] == '=' && (c == '=' || ((c == ' ' || c == '\t') && input_line_pointer[2] == '='))) { equals (s, -1); demand_empty_rest_of_line (); } else if ((c == '=' || ((c == ' ' || c == '\t') && input_line_pointer[1] == '=')) #ifdef TC_EQUAL_IN_INSN && !TC_EQUAL_IN_INSN (c, s) #endif ) { equals (s, 1); demand_empty_rest_of_line (); } else { /* Expect pseudo-op or machine instruction. */ pop = NULL; #ifndef TC_CASE_SENSITIVE { char *s2 = s; strncpy (original_case_string, s2, sizeof (original_case_string)); original_case_string[sizeof (original_case_string) - 1] = 0; while (*s2) { *s2 = TOLOWER (*s2); s2++; } } #endif if (NO_PSEUDO_DOT || flag_m68k_mri) { /* The MRI assembler uses pseudo-ops without a period. */ pop = (pseudo_typeS *) hash_find (po_hash, s); if (pop != NULL && pop->poc_handler == NULL) pop = NULL; } if (pop != NULL || (!flag_m68k_mri && *s == '.')) { /* PSEUDO - OP. WARNING: c has next char, which may be end-of-line. We lookup the pseudo-op table with s+1 because we already know that the pseudo-op begins with a '.'. */ if (pop == NULL) pop = (pseudo_typeS *) hash_find (po_hash, s + 1); if (pop && !pop->poc_handler) pop = NULL; /* In MRI mode, we may need to insert an automatic alignment directive. What a hack this is. */ if (mri_pending_align && (pop == NULL || !((pop->poc_handler == cons && pop->poc_val == 1) || (pop->poc_handler == s_space && pop->poc_val == 1) #ifdef tc_conditional_pseudoop || tc_conditional_pseudoop (pop) #endif || pop->poc_handler == s_if || pop->poc_handler == s_ifdef || pop->poc_handler == s_ifc || pop->poc_handler == s_ifeqs || pop->poc_handler == s_else || pop->poc_handler == s_endif || pop->poc_handler == s_globl || pop->poc_handler == s_ignore))) { do_align (1, (char *) NULL, 0, 0); mri_pending_align = 0; if (line_label != NULL) { symbol_set_frag (line_label, frag_now); S_SET_VALUE (line_label, frag_now_fix ()); } } /* Print the error msg now, while we still can. */ if (pop == NULL) { char *end = input_line_pointer; *input_line_pointer = c; s_ignore (0); c = *--input_line_pointer; *input_line_pointer = '\0'; if (! macro_defined || ! try_macro (c, s)) { *end = '\0'; as_bad (_("unknown pseudo-op: `%s'"), s); *input_line_pointer++ = c; } continue; } /* Put it back for error messages etc. */ *input_line_pointer = c; /* The following skip of whitespace is compulsory. A well shaped space is sometimes all that separates keyword from operands. */ if (c == ' ' || c == '\t') input_line_pointer++; /* Input_line is restored. Input_line_pointer->1st non-blank char after pseudo-operation. */ (*pop->poc_handler) (pop->poc_val); /* If that was .end, just get out now. */ if (pop->poc_handler == s_end) goto quit; } else { /* WARNING: c has char, which may be end-of-line. */ /* Also: input_line_pointer->`\0` where c was. */ *input_line_pointer = c; input_line_pointer = _find_end_of_line (input_line_pointer, flag_m68k_mri, 1); c = *input_line_pointer; *input_line_pointer = '\0'; generate_lineno_debug (); if (macro_defined && try_macro (c, s)) continue; if (mri_pending_align) { do_align (1, (char *) NULL, 0, 0); mri_pending_align = 0; if (line_label != NULL) { symbol_set_frag (line_label, frag_now); S_SET_VALUE (line_label, frag_now_fix ()); } } md_assemble (s); /* Assemble 1 instruction. */ *input_line_pointer++ = c; /* We resume loop AFTER the end-of-line from this instruction. */ } } continue; } /* Empty statement? */ if (is_end_of_line[(unsigned char) c]) continue; if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c)) { /* local label ("4:") */ char *backup = input_line_pointer; HANDLE_CONDITIONAL_ASSEMBLY (); temp = c - '0'; /* Read the whole number. */ while (ISDIGIT (*input_line_pointer)) { temp = (temp * 10) + *input_line_pointer - '0'; ++input_line_pointer; } if (LOCAL_LABELS_DOLLAR && *input_line_pointer == '$' && *(input_line_pointer + 1) == ':') { input_line_pointer += 2; if (dollar_label_defined (temp)) { as_fatal (_("label \"%d$\" redefined"), temp); } define_dollar_label (temp); colon (dollar_label_name (temp, 0)); continue; } if (LOCAL_LABELS_FB && *input_line_pointer++ == ':') { fb_label_instance_inc (temp); colon (fb_label_name (temp, 0)); continue; } input_line_pointer = backup; } /* local label ("4:") */ if (c && strchr (line_comment_chars, c)) { /* Its a comment. Better say APP or NO_APP. */ sb sbuf; char *ends; char *new_buf; char *new_tmp; unsigned int new_length; char *tmp_buf = 0; s = input_line_pointer; if (strncmp (s, "APP\n", 4)) { /* We ignore it. */ ignore_rest_of_line (); continue; } bump_line_counters (); s += 4; sb_new (&sbuf); ends = strstr (s, "#NO_APP\n"); if (!ends) { unsigned int tmp_len; unsigned int num; /* The end of the #APP wasn't in this buffer. We keep reading in buffers until we find the #NO_APP that goes with this #APP There is one. The specs guarantee it... */ tmp_len = buffer_limit - s; tmp_buf = xmalloc (tmp_len + 1); memcpy (tmp_buf, s, tmp_len); do { new_tmp = input_scrub_next_buffer (&buffer); if (!new_tmp) break; else buffer_limit = new_tmp; input_line_pointer = buffer; ends = strstr (buffer, "#NO_APP\n"); if (ends) num = ends - buffer; else num = buffer_limit - buffer; tmp_buf = xrealloc (tmp_buf, tmp_len + num); memcpy (tmp_buf + tmp_len, buffer, num); tmp_len += num; } while (!ends); input_line_pointer = ends ? ends + 8 : NULL; s = tmp_buf; ends = s + tmp_len; } else { input_line_pointer = ends + 8; } scrub_string = s; scrub_string_end = ends; new_length = ends - s; new_buf = (char *) xmalloc (new_length); new_tmp = new_buf; for (;;) { int space; int size; space = (new_buf + new_length) - new_tmp; size = do_scrub_chars (scrub_from_string, new_tmp, space); if (size < space) { new_tmp[size] = 0; break; } new_buf = xrealloc (new_buf, new_length + 100); new_tmp = new_buf + new_length; new_length += 100; } if (tmp_buf) free (tmp_buf); /* We've "scrubbed" input to the preferred format. In the process we may have consumed the whole of the remaining file (and included files). We handle this formatted input similar to that of macro expansion, letting actual macro expansion (possibly nested) and other input expansion work. Beware that in messages, line numbers and possibly file names will be incorrect. */ sb_add_string (&sbuf, new_buf); input_scrub_include_sb (&sbuf, input_line_pointer, 0); sb_kill (&sbuf); buffer_limit = input_scrub_next_buffer (&input_line_pointer); free (new_buf); continue; } HANDLE_CONDITIONAL_ASSEMBLY (); #ifdef tc_unrecognized_line if (tc_unrecognized_line (c)) continue; #endif input_line_pointer--; /* Report unknown char as error. */ demand_empty_rest_of_line (); } #ifdef md_after_pass_hook md_after_pass_hook (); #endif } quit: #ifdef md_cleanup md_cleanup (); #endif /* Close the input file. */ input_scrub_close (); #ifdef WARN_COMMENTS { if (warn_comment && found_comment) as_warn_where (found_comment_file, found_comment, "first comment found here"); } #endif } /* Convert O_constant expression EXP into the equivalent O_big representation. Take the sign of the number from X_unsigned rather than X_add_number. */ static void convert_to_bignum (expressionS *exp) { valueT value; unsigned int i; value = exp->X_add_number; for (i = 0; i < sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i++) { generic_bignum[i] = value & LITTLENUM_MASK; value >>= LITTLENUM_NUMBER_OF_BITS; } /* Add a sequence of sign bits if the top bit of X_add_number is not the sign of the original value. */ if ((exp->X_add_number < 0) != !exp->X_unsigned) generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK; exp->X_op = O_big; exp->X_add_number = i; } /* For most MRI pseudo-ops, the line actually ends at the first nonquoted space. This function looks for that point, stuffs a null in, and sets *STOPCP to the character that used to be there, and returns the location. Until I hear otherwise, I am going to assume that this is only true for the m68k MRI assembler. */ char * mri_comment_field (char *stopcp) { char *s; #ifdef TC_M68K int inquote = 0; know (flag_m68k_mri); for (s = input_line_pointer; ((!is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t') || inquote); s++) { if (*s == '\'') inquote = !inquote; } #else for (s = input_line_pointer; !is_end_of_line[(unsigned char) *s]; s++) ; #endif *stopcp = *s; *s = '\0'; return s; } /* Skip to the end of an MRI comment field. */ void mri_comment_end (char *stop, int stopc) { know (flag_mri); input_line_pointer = stop; *stop = stopc; while (!is_end_of_line[(unsigned char) *input_line_pointer]) ++input_line_pointer; } void s_abort (int ignore ATTRIBUTE_UNUSED) { as_fatal (_(".abort detected. Abandoning ship.")); } /* Guts of .align directive. N is the power of two to which to align. FILL may be NULL, or it may point to the bytes of the fill pattern. LEN is the length of whatever FILL points to, if anything. MAX is the maximum number of characters to skip when doing the alignment, or 0 if there is no maximum. */ static void do_align (int n, char *fill, int len, int max) { if (now_seg == absolute_section) { if (fill != NULL) while (len-- > 0) if (*fill++ != '\0') { as_warn (_("ignoring fill value in absolute section")); break; } fill = NULL; len = 0; } #ifdef md_flush_pending_output md_flush_pending_output (); #endif #ifdef md_do_align md_do_align (n, fill, len, max, just_record_alignment); #endif /* Only make a frag if we HAVE to... */ if (n != 0 && !need_pass_2) { if (fill == NULL) { if (subseg_text_p (now_seg)) frag_align_code (n, max); else frag_align (n, 0, max); } else if (len <= 1) frag_align (n, *fill, max); else frag_align_pattern (n, fill, len, max); } #ifdef md_do_align just_record_alignment: ATTRIBUTE_UNUSED_LABEL #endif record_alignment (now_seg, n - OCTETS_PER_BYTE_POWER); } /* Handle the .align pseudo-op. A positive ARG is a default alignment (in bytes). A negative ARG is the negative of the length of the fill pattern. BYTES_P is non-zero if the alignment value should be interpreted as the byte boundary, rather than the power of 2. */ #define ALIGN_LIMIT (stdoutput->arch_info->bits_per_address - 1) static void s_align (int arg, int bytes_p) { unsigned int align_limit = ALIGN_LIMIT; unsigned int align; char *stop = NULL; char stopc = 0; offsetT fill = 0; int max; int fill_p; if (flag_mri) stop = mri_comment_field (&stopc); if (is_end_of_line[(unsigned char) *input_line_pointer]) { if (arg < 0) align = 0; else align = arg; /* Default value from pseudo-op table. */ } else { align = get_absolute_expression (); SKIP_WHITESPACE (); } if (bytes_p) { /* Convert to a power of 2. */ if (align != 0) { unsigned int i; for (i = 0; (align & 1) == 0; align >>= 1, ++i) ; if (align != 1) as_bad (_("alignment not a power of 2")); align = i; } } if (align > align_limit) { align = align_limit; as_warn (_("alignment too large: %u assumed"), align); } if (*input_line_pointer != ',') { fill_p = 0; max = 0; } else { ++input_line_pointer; if (*input_line_pointer == ',') fill_p = 0; else { fill = get_absolute_expression (); SKIP_WHITESPACE (); fill_p = 1; } if (*input_line_pointer != ',') max = 0; else { ++input_line_pointer; max = get_absolute_expression (); } } if (!fill_p) { if (arg < 0) as_warn (_("expected fill pattern missing")); do_align (align, (char *) NULL, 0, max); } else { int fill_len; if (arg >= 0) fill_len = 1; else fill_len = -arg; if (fill_len <= 1) { char fill_char; fill_char = fill; do_align (align, &fill_char, fill_len, max); } else { char ab[16]; if ((size_t) fill_len > sizeof ab) abort (); md_number_to_chars (ab, fill, fill_len); do_align (align, ab, fill_len, max); } } demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); } /* Handle the .align pseudo-op on machines where ".align 4" means align to a 4 byte boundary. */ void s_align_bytes (int arg) { s_align (arg, 1); } /* Handle the .align pseudo-op on machines where ".align 4" means align to a 2**4 boundary. */ void s_align_ptwo (int arg) { s_align (arg, 0); } /* Switch in and out of alternate macro mode. */ void s_altmacro (int on) { demand_empty_rest_of_line (); macro_set_alternate (on); } symbolS * s_comm_internal (int param, symbolS *(*comm_parse_extra) (int, symbolS *, addressT)) { char *name; char c; char *p; offsetT temp, size; symbolS *symbolP = NULL; char *stop = NULL; char stopc = 0; expressionS exp; if (flag_mri) stop = mri_comment_field (&stopc); name = input_line_pointer; c = get_symbol_end (); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; if (name == p) { as_bad (_("expected symbol name")); ignore_rest_of_line (); goto out; } SKIP_WHITESPACE (); /* Accept an optional comma after the name. The comma used to be required, but Irix 5 cc does not generate it for .lcomm. */ if (*input_line_pointer == ',') input_line_pointer++; temp = get_absolute_expr (&exp); size = temp; size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1; if (exp.X_op == O_absent) { as_bad (_("missing size expression")); ignore_rest_of_line (); goto out; } else if (temp != size || !exp.X_unsigned) { as_warn (_("size (%ld) out of range, ignored"), (long) temp); ignore_rest_of_line (); goto out; } *p = 0; symbolP = symbol_find_or_make (name); if ((S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP)) && !S_IS_COMMON (symbolP)) { if (!S_IS_VOLATILE (symbolP)) { symbolP = NULL; as_bad (_("symbol `%s' is already defined"), name); *p = c; ignore_rest_of_line (); goto out; } symbolP = symbol_clone (symbolP, 1); S_SET_SEGMENT (symbolP, undefined_section); S_SET_VALUE (symbolP, 0); symbol_set_frag (symbolP, &zero_address_frag); S_CLEAR_VOLATILE (symbolP); } size = S_GET_VALUE (symbolP); if (size == 0) size = temp; else if (size != temp) as_warn (_("size of \"%s\" is already %ld; not changing to %ld"), name, (long) size, (long) temp); *p = c; if (comm_parse_extra != NULL) symbolP = (*comm_parse_extra) (param, symbolP, size); else { S_SET_VALUE (symbolP, (valueT) size); S_SET_EXTERNAL (symbolP); S_SET_SEGMENT (symbolP, bfd_com_section_ptr); #ifdef OBJ_VMS { extern int flag_one; if (size == 0 || !flag_one) S_GET_OTHER (symbolP) = const_flag; } #endif } demand_empty_rest_of_line (); out: if (flag_mri) mri_comment_end (stop, stopc); return symbolP; } void s_comm (int ignore) { s_comm_internal (ignore, NULL); } /* The MRI COMMON pseudo-op. We handle this by creating a common symbol with the appropriate name. We make s_space do the right thing by increasing the size. */ void s_mri_common (int small ATTRIBUTE_UNUSED) { char *name; char c; char *alc = NULL; symbolS *sym; offsetT align; char *stop = NULL; char stopc = 0; if (!flag_mri) { s_comm (0); return; } stop = mri_comment_field (&stopc); SKIP_WHITESPACE (); name = input_line_pointer; if (!ISDIGIT (*name)) c = get_symbol_end (); else { do { ++input_line_pointer; } while (ISDIGIT (*input_line_pointer)); c = *input_line_pointer; *input_line_pointer = '\0'; if (line_label != NULL) { alc = (char *) xmalloc (strlen (S_GET_NAME (line_label)) + (input_line_pointer - name) + 1); sprintf (alc, "%s%s", name, S_GET_NAME (line_label)); name = alc; } } sym = symbol_find_or_make (name); *input_line_pointer = c; if (alc != NULL) free (alc); if (*input_line_pointer != ',') align = 0; else { ++input_line_pointer; align = get_absolute_expression (); } if (S_IS_DEFINED (sym) && !S_IS_COMMON (sym)) { as_bad (_("symbol `%s' is already defined"), S_GET_NAME (sym)); ignore_rest_of_line (); mri_comment_end (stop, stopc); return; } S_SET_EXTERNAL (sym); S_SET_SEGMENT (sym, bfd_com_section_ptr); mri_common_symbol = sym; #ifdef S_SET_ALIGN if (align != 0) S_SET_ALIGN (sym, align); #endif if (line_label != NULL) { expressionS exp; exp.X_op = O_symbol; exp.X_add_symbol = sym; exp.X_add_number = 0; symbol_set_value_expression (line_label, &exp); symbol_set_frag (line_label, &zero_address_frag); S_SET_SEGMENT (line_label, expr_section); } /* FIXME: We just ignore the small argument, which distinguishes COMMON and COMMON.S. I don't know what we can do about it. */ /* Ignore the type and hptype. */ if (*input_line_pointer == ',') input_line_pointer += 2; if (*input_line_pointer == ',') input_line_pointer += 2; demand_empty_rest_of_line (); mri_comment_end (stop, stopc); } void s_data (int ignore ATTRIBUTE_UNUSED) { segT section; register int temp; temp = get_absolute_expression (); if (flag_readonly_data_in_text) { section = text_section; temp += 1000; } else section = data_section; subseg_set (section, (subsegT) temp); #ifdef OBJ_VMS const_flag = 0; #endif demand_empty_rest_of_line (); } /* Handle the .appfile pseudo-op. This is automatically generated by do_scrub_chars when a preprocessor # line comment is seen with a file name. This default definition may be overridden by the object or CPU specific pseudo-ops. This function is also the default definition for .file; the APPFILE argument is 1 for .appfile, 0 for .file. */ void s_app_file_string (char *file, int appfile ATTRIBUTE_UNUSED) { #ifdef LISTING if (listing) listing_source_file (file); #endif register_dependency (file); #ifdef obj_app_file obj_app_file (file, appfile); #endif } void s_app_file (int appfile) { register char *s; int length; /* Some assemblers tolerate immediately following '"'. */ if ((s = demand_copy_string (&length)) != 0) { int may_omit = (!new_logical_line_flags (s, -1, 1) && appfile); /* In MRI mode, the preprocessor may have inserted an extraneous backquote. */ if (flag_m68k_mri && *input_line_pointer == '\'' && is_end_of_line[(unsigned char) input_line_pointer[1]]) ++input_line_pointer; demand_empty_rest_of_line (); if (!may_omit) s_app_file_string (s, appfile); } } static int get_linefile_number (int *flag) { SKIP_WHITESPACE (); if (*input_line_pointer < '0' || *input_line_pointer > '9') return 0; *flag = get_absolute_expression (); return 1; } /* Handle the .appline pseudo-op. This is automatically generated by do_scrub_chars when a preprocessor # line comment is seen. This default definition may be overridden by the object or CPU specific pseudo-ops. */ void s_app_line (int appline) { char *file = NULL; int l; /* The given number is that of the next line. */ if (appline) l = get_absolute_expression (); else if (!get_linefile_number (&l)) { ignore_rest_of_line (); return; } l--; if (l < -1) /* Some of the back ends can't deal with non-positive line numbers. Besides, it's silly. GCC however will generate a line number of zero when it is pre-processing builtins for assembler-with-cpp files: # 0 "" We do not want to barf on this, especially since such files are used in the GCC and GDB testsuites. So we check for negative line numbers rather than non-positive line numbers. */ as_warn (_("line numbers must be positive; line number %d rejected"), l + 1); else { int flags = 0; int length = 0; if (!appline) { SKIP_WHITESPACE (); if (*input_line_pointer == '"') file = demand_copy_string (&length); if (file) { int this_flag; while (get_linefile_number (&this_flag)) switch (this_flag) { /* From GCC's cpp documentation: 1: start of a new file. 2: returning to a file after having included another file. 3: following text comes from a system header file. 4: following text should be treated as extern "C". 4 is nonsensical for the assembler; 3, we don't care about, so we ignore it just in case a system header file is included while preprocessing assembly. So 1 and 2 are all we care about, and they are mutually incompatible. new_logical_line_flags() demands this. */ case 1: case 2: if (flags && flags != (1 << this_flag)) as_warn (_("incompatible flag %i in line directive"), this_flag); else flags |= 1 << this_flag; break; case 3: case 4: /* We ignore these. */ break; default: as_warn (_("unsupported flag %i in line directive"), this_flag); break; } if (!is_end_of_line[(unsigned char)*input_line_pointer]) file = 0; } } if (appline || file) { new_logical_line_flags (file, l, flags); #ifdef LISTING if (listing) listing_source_line (l); #endif } } if (appline || file) demand_empty_rest_of_line (); else ignore_rest_of_line (); } /* Handle the .end pseudo-op. Actually, the real work is done in read_a_source_file. */ void s_end (int ignore ATTRIBUTE_UNUSED) { if (flag_mri) { /* The MRI assembler permits the start symbol to follow .end, but we don't support that. */ SKIP_WHITESPACE (); if (!is_end_of_line[(unsigned char) *input_line_pointer] && *input_line_pointer != '*' && *input_line_pointer != '!') as_warn (_("start address not supported")); } } /* Handle the .err pseudo-op. */ void s_err (int ignore ATTRIBUTE_UNUSED) { as_bad (_(".err encountered")); demand_empty_rest_of_line (); } /* Handle the .error and .warning pseudo-ops. */ void s_errwarn (int err) { int len; /* The purpose for the conditional assignment is not to internationalize the directive itself, but that we need a self-contained message, one that can be passed like the demand_copy_C_string return value, and with no assumption on the location of the name of the directive within the message. */ char *msg = (err ? _(".error directive invoked in source file") : _(".warning directive invoked in source file")); if (!is_it_end_of_statement ()) { if (*input_line_pointer != '\"') { as_bad (_("%s argument must be a string"), err ? ".error" : ".warning"); ignore_rest_of_line (); return; } msg = demand_copy_C_string (&len); if (msg == NULL) return; } if (err) as_bad ("%s", msg); else as_warn ("%s", msg); demand_empty_rest_of_line (); } /* Handle the MRI fail pseudo-op. */ void s_fail (int ignore ATTRIBUTE_UNUSED) { offsetT temp; char *stop = NULL; char stopc = 0; if (flag_mri) stop = mri_comment_field (&stopc); temp = get_absolute_expression (); if (temp >= 500) as_warn (_(".fail %ld encountered"), (long) temp); else as_bad (_(".fail %ld encountered"), (long) temp); demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); } void s_fill (int ignore ATTRIBUTE_UNUSED) { expressionS rep_exp; long size = 1; register long fill = 0; char *p; #ifdef md_flush_pending_output md_flush_pending_output (); #endif get_known_segmented_expression (&rep_exp); if (*input_line_pointer == ',') { input_line_pointer++; size = get_absolute_expression (); if (*input_line_pointer == ',') { input_line_pointer++; fill = get_absolute_expression (); } } /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */ #define BSD_FILL_SIZE_CROCK_8 (8) if (size > BSD_FILL_SIZE_CROCK_8) { as_warn (_(".fill size clamped to %d"), BSD_FILL_SIZE_CROCK_8); size = BSD_FILL_SIZE_CROCK_8; } if (size < 0) { as_warn (_("size negative; .fill ignored")); size = 0; } else if (rep_exp.X_op == O_constant && rep_exp.X_add_number <= 0) { if (rep_exp.X_add_number < 0) as_warn (_("repeat < 0; .fill ignored")); size = 0; } if (size && !need_pass_2) { if (rep_exp.X_op == O_constant) { p = frag_var (rs_fill, (int) size, (int) size, (relax_substateT) 0, (symbolS *) 0, (offsetT) rep_exp.X_add_number, (char *) 0); } else { /* We don't have a constant repeat count, so we can't use rs_fill. We can get the same results out of rs_space, but its argument is in bytes, so we must multiply the repeat count by size. */ symbolS *rep_sym; rep_sym = make_expr_symbol (&rep_exp); if (size != 1) { expressionS size_exp; size_exp.X_op = O_constant; size_exp.X_add_number = size; rep_exp.X_op = O_multiply; rep_exp.X_add_symbol = rep_sym; rep_exp.X_op_symbol = make_expr_symbol (&size_exp); rep_exp.X_add_number = 0; rep_sym = make_expr_symbol (&rep_exp); } p = frag_var (rs_space, (int) size, (int) size, (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0); } memset (p, 0, (unsigned int) size); /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX flavoured AS. The following bizarre behaviour is to be compatible with above. I guess they tried to take up to 8 bytes from a 4-byte expression and they forgot to sign extend. */ #define BSD_FILL_SIZE_CROCK_4 (4) md_number_to_chars (p, (valueT) fill, (size > BSD_FILL_SIZE_CROCK_4 ? BSD_FILL_SIZE_CROCK_4 : (int) size)); /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes) but emits no error message because it seems a legal thing to do. It is a degenerate case of .fill but could be emitted by a compiler. */ } demand_empty_rest_of_line (); } void s_globl (int ignore ATTRIBUTE_UNUSED) { char *name; int c; symbolS *symbolP; char *stop = NULL; char stopc = 0; if (flag_mri) stop = mri_comment_field (&stopc); do { name = input_line_pointer; c = get_symbol_end (); symbolP = symbol_find_or_make (name); S_SET_EXTERNAL (symbolP); *input_line_pointer = c; SKIP_WHITESPACE (); c = *input_line_pointer; if (c == ',') { input_line_pointer++; SKIP_WHITESPACE (); if (is_end_of_line[(unsigned char) *input_line_pointer]) c = '\n'; } } while (c == ','); demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); } #ifdef OBJ_ELF #define skip_whitespace(str) do { if (*(str) == ' ') ++(str); } while (0) static inline int skip_past_char (char ** str, char c) { if (**str == c) { (*str)++; return 0; } else return -1; } #define skip_past_comma(str) skip_past_char (str, ',') /* Parse an attribute directive for VENDOR. */ void s_vendor_attribute (int vendor) { expressionS exp; int type; int tag; unsigned int i = 0; char *s = NULL; char saved_char; expression (& exp); if (exp.X_op != O_constant) goto bad; tag = exp.X_add_number; type = _bfd_elf_obj_attrs_arg_type (stdoutput, vendor, tag); if (skip_past_comma (&input_line_pointer) == -1) goto bad; if (type & 1) { expression (& exp); if (exp.X_op != O_constant) { as_bad (_("expected numeric constant")); ignore_rest_of_line (); return; } i = exp.X_add_number; } if (type == 3 && skip_past_comma (&input_line_pointer) == -1) { as_bad (_("expected comma")); ignore_rest_of_line (); return; } if (type & 2) { skip_whitespace(input_line_pointer); if (*input_line_pointer != '"') goto bad_string; input_line_pointer++; s = input_line_pointer; while (*input_line_pointer && *input_line_pointer != '"') input_line_pointer++; if (*input_line_pointer != '"') goto bad_string; saved_char = *input_line_pointer; *input_line_pointer = 0; } else { s = NULL; saved_char = 0; } switch (type) { case 3: bfd_elf_add_obj_attr_compat (stdoutput, vendor, i, s); break; case 2: bfd_elf_add_obj_attr_string (stdoutput, vendor, tag, s); break; case 1: bfd_elf_add_obj_attr_int (stdoutput, vendor, tag, i); break; default: abort (); } if (s) { *input_line_pointer = saved_char; input_line_pointer++; } demand_empty_rest_of_line (); return; bad_string: as_bad (_("bad string constant")); ignore_rest_of_line (); return; bad: as_bad (_("expected , ")); ignore_rest_of_line (); } /* Parse a .gnu_attribute directive. */ static void s_gnu_attribute (int ignored ATTRIBUTE_UNUSED) { s_vendor_attribute (OBJ_ATTR_GNU); } #endif /* OBJ_ELF */ /* Handle the MRI IRP and IRPC pseudo-ops. */ void s_irp (int irpc) { char *file, *eol; unsigned int line; sb s; const char *err; sb out; as_where (&file, &line); sb_new (&s); eol = find_end_of_line (input_line_pointer, 0); sb_add_buffer (&s, input_line_pointer, eol - input_line_pointer); input_line_pointer = eol; sb_new (&out); err = expand_irp (irpc, 0, &s, &out, get_line_sb); if (err != NULL) as_bad_where (file, line, "%s", err); sb_kill (&s); input_scrub_include_sb (&out, input_line_pointer, 1); sb_kill (&out); buffer_limit = input_scrub_next_buffer (&input_line_pointer); } /* Handle the .linkonce pseudo-op. This tells the assembler to mark the section to only be linked once. However, this is not supported by most object file formats. This takes an optional argument, which is what to do about duplicates. */ void s_linkonce (int ignore ATTRIBUTE_UNUSED) { enum linkonce_type type; SKIP_WHITESPACE (); type = LINKONCE_DISCARD; if (!is_end_of_line[(unsigned char) *input_line_pointer]) { char *s; char c; s = input_line_pointer; c = get_symbol_end (); if (strcasecmp (s, "discard") == 0) type = LINKONCE_DISCARD; else if (strcasecmp (s, "one_only") == 0) type = LINKONCE_ONE_ONLY; else if (strcasecmp (s, "same_size") == 0) type = LINKONCE_SAME_SIZE; else if (strcasecmp (s, "same_contents") == 0) type = LINKONCE_SAME_CONTENTS; else as_warn (_("unrecognized .linkonce type `%s'"), s); *input_line_pointer = c; } #ifdef obj_handle_link_once obj_handle_link_once (type); #else /* ! defined (obj_handle_link_once) */ { flagword flags; if ((bfd_applicable_section_flags (stdoutput) & SEC_LINK_ONCE) == 0) as_warn (_(".linkonce is not supported for this object file format")); flags = bfd_get_section_flags (stdoutput, now_seg); flags |= SEC_LINK_ONCE; switch (type) { default: abort (); case LINKONCE_DISCARD: flags |= SEC_LINK_DUPLICATES_DISCARD; break; case LINKONCE_ONE_ONLY: flags |= SEC_LINK_DUPLICATES_ONE_ONLY; break; case LINKONCE_SAME_SIZE: flags |= SEC_LINK_DUPLICATES_SAME_SIZE; break; case LINKONCE_SAME_CONTENTS: flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS; break; } if (!bfd_set_section_flags (stdoutput, now_seg, flags)) as_bad (_("bfd_set_section_flags: %s"), bfd_errmsg (bfd_get_error ())); } #endif /* ! defined (obj_handle_link_once) */ demand_empty_rest_of_line (); } void bss_alloc (symbolS *symbolP, addressT size, int align) { char *pfrag; segT current_seg = now_seg; subsegT current_subseg = now_subseg; segT bss_seg = bss_section; #if defined (TC_MIPS) || defined (TC_ALPHA) if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour || OUTPUT_FLAVOR == bfd_target_elf_flavour) { /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */ if (size <= bfd_get_gp_size (stdoutput)) { bss_seg = subseg_new (".sbss", 1); seg_info (bss_seg)->bss = 1; if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC)) as_warn (_("error setting flags for \".sbss\": %s"), bfd_errmsg (bfd_get_error ())); } } #endif subseg_set (bss_seg, 1); if (align) { record_alignment (bss_seg, align); frag_align (align, 0, 0); } /* Detach from old frag. */ if (S_GET_SEGMENT (symbolP) == bss_seg) symbol_get_frag (symbolP)->fr_symbol = NULL; symbol_set_frag (symbolP, frag_now); pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL); *pfrag = 0; #ifdef S_SET_SIZE S_SET_SIZE (symbolP, size); #endif S_SET_SEGMENT (symbolP, bss_seg); #ifdef OBJ_COFF /* The symbol may already have been created with a preceding ".globl" directive -- be careful not to step on storage class in that case. Otherwise, set it to static. */ if (S_GET_STORAGE_CLASS (symbolP) != C_EXT) S_SET_STORAGE_CLASS (symbolP, C_STAT); #endif /* OBJ_COFF */ subseg_set (current_seg, current_subseg); } offsetT parse_align (int align_bytes) { expressionS exp; addressT align; SKIP_WHITESPACE (); if (*input_line_pointer != ',') { no_align: as_bad (_("expected alignment after size")); ignore_rest_of_line (); return -1; } input_line_pointer++; SKIP_WHITESPACE (); align = get_absolute_expr (&exp); if (exp.X_op == O_absent) goto no_align; if (!exp.X_unsigned) { as_warn (_("alignment negative; 0 assumed")); align = 0; } if (align_bytes && align != 0) { /* convert to a power of 2 alignment */ unsigned int alignp2 = 0; while ((align & 1) == 0) align >>= 1, ++alignp2; if (align != 1) { as_bad (_("alignment not a power of 2")); ignore_rest_of_line (); return -1; } align = alignp2; } return align; } /* Called from s_comm_internal after symbol name and size have been parsed. NEEDS_ALIGN is 0 if it was an ".lcomm" (2 args only), 1 if this was a ".bss" directive which has a 3rd argument (alignment as a power of 2), or 2 if this was a ".bss" directive with alignment in bytes. */ symbolS * s_lcomm_internal (int needs_align, symbolS *symbolP, addressT size) { addressT align = 0; if (needs_align) { align = parse_align (needs_align - 1); if (align == (addressT) -1) return NULL; } else /* Assume some objects may require alignment on some systems. */ TC_IMPLICIT_LCOMM_ALIGNMENT (size, align); bss_alloc (symbolP, size, align); return symbolP; } void s_lcomm (int needs_align) { s_comm_internal (needs_align, s_lcomm_internal); } void s_lcomm_bytes (int needs_align) { s_comm_internal (needs_align * 2, s_lcomm_internal); } void s_lsym (int ignore ATTRIBUTE_UNUSED) { register char *name; register char c; register char *p; expressionS exp; register symbolS *symbolP; /* We permit ANY defined expression: BSD4.2 demands constants. */ name = input_line_pointer; c = get_symbol_end (); p = input_line_pointer; *p = c; if (name == p) { as_bad (_("expected symbol name")); ignore_rest_of_line (); return; } SKIP_WHITESPACE (); if (*input_line_pointer != ',') { *p = 0; as_bad (_("expected comma after \"%s\""), name); *p = c; ignore_rest_of_line (); return; } input_line_pointer++; expression_and_evaluate (&exp); if (exp.X_op != O_constant && exp.X_op != O_register) { as_bad (_("bad expression")); ignore_rest_of_line (); return; } *p = 0; symbolP = symbol_find_or_make (name); if (S_GET_SEGMENT (symbolP) == undefined_section) { /* The name might be an undefined .global symbol; be sure to keep the "external" bit. */ S_SET_SEGMENT (symbolP, (exp.X_op == O_constant ? absolute_section : reg_section)); S_SET_VALUE (symbolP, (valueT) exp.X_add_number); } else { as_bad (_("symbol `%s' is already defined"), name); } *p = c; demand_empty_rest_of_line (); } /* Read a line into an sb. Returns the character that ended the line or zero if there are no more lines. */ static int get_line_sb (sb *line) { char *eol; if (input_line_pointer[-1] == '\n') bump_line_counters (); if (input_line_pointer >= buffer_limit) { buffer_limit = input_scrub_next_buffer (&input_line_pointer); if (buffer_limit == 0) return 0; } eol = find_end_of_line (input_line_pointer, flag_m68k_mri); sb_add_buffer (line, input_line_pointer, eol - input_line_pointer); input_line_pointer = eol; /* Don't skip multiple end-of-line characters, because that breaks support for the IA-64 stop bit (;;) which looks like two consecutive end-of-line characters but isn't. Instead just skip one end of line character and return the character skipped so that the caller can re-insert it if necessary. */ return *input_line_pointer++; } /* Define a macro. This is an interface to macro.c. */ void s_macro (int ignore ATTRIBUTE_UNUSED) { char *file, *eol; unsigned int line; sb s; const char *err; const char *name; as_where (&file, &line); sb_new (&s); eol = find_end_of_line (input_line_pointer, 0); sb_add_buffer (&s, input_line_pointer, eol - input_line_pointer); input_line_pointer = eol; if (line_label != NULL) { sb label; sb_new (&label); sb_add_string (&label, S_GET_NAME (line_label)); err = define_macro (0, &s, &label, get_line_sb, file, line, &name); sb_kill (&label); } else err = define_macro (0, &s, NULL, get_line_sb, file, line, &name); if (err != NULL) as_bad_where (file, line, err, name); else { if (line_label != NULL) { S_SET_SEGMENT (line_label, absolute_section); S_SET_VALUE (line_label, 0); symbol_set_frag (line_label, &zero_address_frag); } if (((NO_PSEUDO_DOT || flag_m68k_mri) && hash_find (po_hash, name) != NULL) || (!flag_m68k_mri && *name == '.' && hash_find (po_hash, name + 1) != NULL)) as_warn_where (file, line, _("attempt to redefine pseudo-op `%s' ignored"), name); } sb_kill (&s); } /* Handle the .mexit pseudo-op, which immediately exits a macro expansion. */ void s_mexit (int ignore ATTRIBUTE_UNUSED) { cond_exit_macro (macro_nest); buffer_limit = input_scrub_next_buffer (&input_line_pointer); } /* Switch in and out of MRI mode. */ void s_mri (int ignore ATTRIBUTE_UNUSED) { int on, old_flag; on = get_absolute_expression (); old_flag = flag_mri; if (on != 0) { flag_mri = 1; #ifdef TC_M68K flag_m68k_mri = 1; #endif macro_mri_mode (1); } else { flag_mri = 0; #ifdef TC_M68K flag_m68k_mri = 0; #endif macro_mri_mode (0); } /* Operator precedence changes in m68k MRI mode, so we need to update the operator rankings. */ expr_set_precedence (); #ifdef MRI_MODE_CHANGE if (on != old_flag) MRI_MODE_CHANGE (on); #endif demand_empty_rest_of_line (); } /* Handle changing the location counter. */ static void do_org (segT segment, expressionS *exp, int fill) { if (segment != now_seg && segment != absolute_section) as_bad (_("invalid segment \"%s\""), segment_name (segment)); if (now_seg == absolute_section) { if (fill != 0) as_warn (_("ignoring fill value in absolute section")); if (exp->X_op != O_constant) { as_bad (_("only constant offsets supported in absolute section")); exp->X_add_number = 0; } abs_section_offset = exp->X_add_number; } else { char *p; symbolS *sym = exp->X_add_symbol; offsetT off = exp->X_add_number * OCTETS_PER_BYTE; if (exp->X_op != O_constant && exp->X_op != O_symbol) { /* Handle complex expressions. */ sym = make_expr_symbol (exp); off = 0; } p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0); *p = fill; } } void s_org (int ignore ATTRIBUTE_UNUSED) { register segT segment; expressionS exp; register long temp_fill; #ifdef md_flush_pending_output md_flush_pending_output (); #endif /* The m68k MRI assembler has a different meaning for .org. It means to create an absolute section at a given address. We can't support that--use a linker script instead. */ if (flag_m68k_mri) { as_bad (_("MRI style ORG pseudo-op not supported")); ignore_rest_of_line (); return; } /* Don't believe the documentation of BSD 4.2 AS. There is no such thing as a sub-segment-relative origin. Any absolute origin is given a warning, then assumed to be segment-relative. Any segmented origin expression ("foo+42") had better be in the right segment or the .org is ignored. BSD 4.2 AS warns if you try to .org backwards. We cannot because we never know sub-segment sizes when we are reading code. BSD will crash trying to emit negative numbers of filler bytes in certain .orgs. We don't crash, but see as-write for that code. Don't make frag if need_pass_2==1. */ segment = get_known_segmented_expression (&exp); if (*input_line_pointer == ',') { input_line_pointer++; temp_fill = get_absolute_expression (); } else temp_fill = 0; if (!need_pass_2) do_org (segment, &exp, temp_fill); demand_empty_rest_of_line (); } /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be called by the obj-format routine which handles section changing when in MRI mode. It will create a new section, and return it. It will set *TYPE to the section type: one of 'C' (code), 'D' (data), 'M' (mixed), or 'R' (romable). The flags will be set in the section. */ void s_mri_sect (char *type ATTRIBUTE_UNUSED) { #ifdef TC_M68K char *name; char c; segT seg; SKIP_WHITESPACE (); name = input_line_pointer; if (!ISDIGIT (*name)) c = get_symbol_end (); else { do { ++input_line_pointer; } while (ISDIGIT (*input_line_pointer)); c = *input_line_pointer; *input_line_pointer = '\0'; } name = xstrdup (name); *input_line_pointer = c; seg = subseg_new (name, 0); if (*input_line_pointer == ',') { int align; ++input_line_pointer; align = get_absolute_expression (); record_alignment (seg, align); } *type = 'C'; if (*input_line_pointer == ',') { c = *++input_line_pointer; c = TOUPPER (c); if (c == 'C' || c == 'D' || c == 'M' || c == 'R') *type = c; else as_bad (_("unrecognized section type")); ++input_line_pointer; { flagword flags; flags = SEC_NO_FLAGS; if (*type == 'C') flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE; else if (*type == 'D' || *type == 'M') flags = SEC_ALLOC | SEC_LOAD | SEC_DATA; else if (*type == 'R') flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM; if (flags != SEC_NO_FLAGS) { if (!bfd_set_section_flags (stdoutput, seg, flags)) as_warn (_("error setting flags for \"%s\": %s"), bfd_section_name (stdoutput, seg), bfd_errmsg (bfd_get_error ())); } } } /* Ignore the HP type. */ if (*input_line_pointer == ',') input_line_pointer += 2; demand_empty_rest_of_line (); #else /* ! TC_M68K */ #ifdef TC_I960 char *name; char c; segT seg; SKIP_WHITESPACE (); name = input_line_pointer; c = get_symbol_end (); name = xstrdup (name); *input_line_pointer = c; seg = subseg_new (name, 0); if (*input_line_pointer != ',') *type = 'C'; else { char *sectype; ++input_line_pointer; SKIP_WHITESPACE (); sectype = input_line_pointer; c = get_symbol_end (); if (*sectype == '\0') *type = 'C'; else if (strcasecmp (sectype, "text") == 0) *type = 'C'; else if (strcasecmp (sectype, "data") == 0) *type = 'D'; else if (strcasecmp (sectype, "romdata") == 0) *type = 'R'; else as_warn (_("unrecognized section type `%s'"), sectype); *input_line_pointer = c; } if (*input_line_pointer == ',') { char *seccmd; ++input_line_pointer; SKIP_WHITESPACE (); seccmd = input_line_pointer; c = get_symbol_end (); if (strcasecmp (seccmd, "absolute") == 0) { as_bad (_("absolute sections are not supported")); *input_line_pointer = c; ignore_rest_of_line (); return; } else if (strcasecmp (seccmd, "align") == 0) { int align; *input_line_pointer = c; align = get_absolute_expression (); record_alignment (seg, align); } else { as_warn (_("unrecognized section command `%s'"), seccmd); *input_line_pointer = c; } } demand_empty_rest_of_line (); #else /* ! TC_I960 */ /* The MRI assembler seems to use different forms of .sect for different targets. */ as_bad ("MRI mode not supported for this target"); ignore_rest_of_line (); #endif /* ! TC_I960 */ #endif /* ! TC_M68K */ } /* Handle the .print pseudo-op. */ void s_print (int ignore ATTRIBUTE_UNUSED) { char *s; int len; s = demand_copy_C_string (&len); if (s != NULL) printf ("%s\n", s); demand_empty_rest_of_line (); } /* Handle the .purgem pseudo-op. */ void s_purgem (int ignore ATTRIBUTE_UNUSED) { if (is_it_end_of_statement ()) { demand_empty_rest_of_line (); return; } do { char *name; char c; SKIP_WHITESPACE (); name = input_line_pointer; c = get_symbol_end (); delete_macro (name); *input_line_pointer = c; SKIP_WHITESPACE (); } while (*input_line_pointer++ == ','); --input_line_pointer; demand_empty_rest_of_line (); } /* Handle the .endm/.endr pseudo-ops. */ static void s_bad_end (int endr) { as_warn (_(".end%c encountered without preceeding %s"), endr ? 'r' : 'm', endr ? ".rept, .irp, or .irpc" : ".macro"); demand_empty_rest_of_line (); } /* Handle the .rept pseudo-op. */ void s_rept (int ignore ATTRIBUTE_UNUSED) { int count; count = get_absolute_expression (); do_repeat (count, "REPT", "ENDR"); } /* This function provides a generic repeat block implementation. It allows different directives to be used as the start/end keys. */ void do_repeat (int count, const char *start, const char *end) { sb one; sb many; sb_new (&one); if (!buffer_and_nest (start, end, &one, get_line_sb)) { as_bad (_("%s without %s"), start, end); return; } sb_new (&many); while (count-- > 0) sb_add_sb (&many, &one); sb_kill (&one); input_scrub_include_sb (&many, input_line_pointer, 1); sb_kill (&many); buffer_limit = input_scrub_next_buffer (&input_line_pointer); } /* Skip to end of current repeat loop; EXTRA indicates how many additional input buffers to skip. Assumes that conditionals preceding the loop end are properly nested. This function makes it easier to implement a premature "break" out of the loop. The EXTRA arg accounts for other buffers we might have inserted, such as line substitutions. */ void end_repeat (int extra) { cond_exit_macro (macro_nest); while (extra-- >= 0) buffer_limit = input_scrub_next_buffer (&input_line_pointer); } static void assign_symbol (char *name, int mode) { symbolS *symbolP; if (name[0] == '.' && name[1] == '\0') { /* Turn '. = mumble' into a .org mumble. */ segT segment; expressionS exp; segment = get_known_segmented_expression (&exp); if (!need_pass_2) do_org (segment, &exp, 0); return; } if ((symbolP = symbol_find (name)) == NULL && (symbolP = md_undefined_symbol (name)) == NULL) { symbolP = symbol_find_or_make (name); #ifndef NO_LISTING /* When doing symbol listings, play games with dummy fragments living outside the normal fragment chain to record the file and line info for this symbol. */ if (listing & LISTING_SYMBOLS) { extern struct list_info_struct *listing_tail; fragS *dummy_frag = (fragS *) xcalloc (1, sizeof (fragS)); dummy_frag->line = listing_tail; dummy_frag->fr_symbol = symbolP; symbol_set_frag (symbolP, dummy_frag); } #endif #ifdef OBJ_COFF /* "set" symbols are local unless otherwise specified. */ SF_SET_LOCAL (symbolP); #endif } if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP)) { /* Permit register names to be redefined. */ if ((mode != 0 || !S_IS_VOLATILE (symbolP)) && S_GET_SEGMENT (symbolP) != reg_section) { as_bad (_("symbol `%s' is already defined"), name); symbolP = symbol_clone (symbolP, 0); } /* If the symbol is volatile, copy the symbol and replace the original with the copy, so that previous uses of the symbol will retain the value of the symbol at the point of use. */ else if (S_IS_VOLATILE (symbolP)) symbolP = symbol_clone (symbolP, 1); } if (mode == 0) S_SET_VOLATILE (symbolP); else if (mode < 0) S_SET_FORWARD_REF (symbolP); pseudo_set (symbolP); } /* Handle the .equ, .equiv, .eqv, and .set directives. If EQUIV is 1, then this is .equiv, and it is an error if the symbol is already defined. If EQUIV is -1, the symbol additionally is a forward reference. */ void s_set (int equiv) { char *name; char delim; char *end_name; /* Especial apologies for the random logic: this just grew, and could be parsed much more simply! Dean in haste. */ name = input_line_pointer; delim = get_symbol_end (); end_name = input_line_pointer; *end_name = delim; if (name == end_name) { as_bad (_("expected symbol name")); ignore_rest_of_line (); return; } SKIP_WHITESPACE (); if (*input_line_pointer != ',') { *end_name = 0; as_bad (_("expected comma after \"%s\""), name); *end_name = delim; ignore_rest_of_line (); return; } input_line_pointer++; *end_name = 0; assign_symbol (name, equiv); *end_name = delim; demand_empty_rest_of_line (); } void s_space (int mult) { expressionS exp; expressionS val; char *p = 0; char *stop = NULL; char stopc = 0; int bytes; #ifdef md_flush_pending_output md_flush_pending_output (); #endif if (flag_mri) stop = mri_comment_field (&stopc); /* In m68k MRI mode, we need to align to a word boundary, unless this is ds.b. */ if (flag_m68k_mri && mult > 1) { if (now_seg == absolute_section) { abs_section_offset += abs_section_offset & 1; if (line_label != NULL) S_SET_VALUE (line_label, abs_section_offset); } else if (mri_common_symbol != NULL) { valueT val; val = S_GET_VALUE (mri_common_symbol); if ((val & 1) != 0) { S_SET_VALUE (mri_common_symbol, val + 1); if (line_label != NULL) { expressionS *symexp; symexp = symbol_get_value_expression (line_label); know (symexp->X_op == O_symbol); know (symexp->X_add_symbol == mri_common_symbol); symexp->X_add_number += 1; } } } else { do_align (1, (char *) NULL, 0, 0); if (line_label != NULL) { symbol_set_frag (line_label, frag_now); S_SET_VALUE (line_label, frag_now_fix ()); } } } bytes = mult; expression (&exp); SKIP_WHITESPACE (); if (*input_line_pointer == ',') { ++input_line_pointer; expression (&val); } else { val.X_op = O_constant; val.X_add_number = 0; } if (val.X_op != O_constant || val.X_add_number < - 0x80 || val.X_add_number > 0xff || (mult != 0 && mult != 1 && val.X_add_number != 0)) { resolve_expression (&exp); if (exp.X_op != O_constant) as_bad (_("unsupported variable size or fill value")); else { offsetT i; if (mult == 0) mult = 1; bytes = mult * exp.X_add_number; for (i = 0; i < exp.X_add_number; i++) emit_expr (&val, mult); } } else { if (now_seg == absolute_section || mri_common_symbol != NULL) resolve_expression (&exp); if (exp.X_op == O_constant) { long repeat; repeat = exp.X_add_number; if (mult) repeat *= mult; bytes = repeat; if (repeat <= 0) { if (!flag_mri) as_warn (_(".space repeat count is zero, ignored")); else if (repeat < 0) as_warn (_(".space repeat count is negative, ignored")); goto getout; } /* If we are in the absolute section, just bump the offset. */ if (now_seg == absolute_section) { abs_section_offset += repeat; goto getout; } /* If we are secretly in an MRI common section, then creating space just increases the size of the common symbol. */ if (mri_common_symbol != NULL) { S_SET_VALUE (mri_common_symbol, S_GET_VALUE (mri_common_symbol) + repeat); goto getout; } if (!need_pass_2) p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0, (offsetT) repeat, (char *) 0); } else { if (now_seg == absolute_section) { as_bad (_("space allocation too complex in absolute section")); subseg_set (text_section, 0); } if (mri_common_symbol != NULL) { as_bad (_("space allocation too complex in common section")); mri_common_symbol = NULL; } if (!need_pass_2) p = frag_var (rs_space, 1, 1, (relax_substateT) 0, make_expr_symbol (&exp), (offsetT) 0, (char *) 0); } if (p) *p = val.X_add_number; } getout: /* In MRI mode, after an odd number of bytes, we must align to an even word boundary, unless the next instruction is a dc.b, ds.b or dcb.b. */ if (flag_mri && (bytes & 1) != 0) mri_pending_align = 1; demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); } /* This is like s_space, but the value is a floating point number with the given precision. This is for the MRI dcb.s pseudo-op and friends. */ void s_float_space (int float_type) { offsetT count; int flen; char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT]; char *stop = NULL; char stopc = 0; if (flag_mri) stop = mri_comment_field (&stopc); count = get_absolute_expression (); SKIP_WHITESPACE (); if (*input_line_pointer != ',') { as_bad (_("missing value")); ignore_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); return; } ++input_line_pointer; SKIP_WHITESPACE (); /* Skip any 0{letter} that may be present. Don't even check if the * letter is legal. */ if (input_line_pointer[0] == '0' && ISALPHA (input_line_pointer[1])) input_line_pointer += 2; /* Accept :xxxx, where the x's are hex digits, for a floating point with the exact digits specified. */ if (input_line_pointer[0] == ':') { flen = hex_float (float_type, temp); if (flen < 0) { ignore_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); return; } } else { char *err; err = md_atof (float_type, temp, &flen); know (flen <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT); know (flen > 0); if (err) { as_bad (_("bad floating literal: %s"), err); ignore_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); return; } } while (--count >= 0) { char *p; p = frag_more (flen); memcpy (p, temp, (unsigned int) flen); } demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); } /* Handle the .struct pseudo-op, as found in MIPS assemblers. */ void s_struct (int ignore ATTRIBUTE_UNUSED) { char *stop = NULL; char stopc = 0; if (flag_mri) stop = mri_comment_field (&stopc); abs_section_offset = get_absolute_expression (); #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) /* The ELF backend needs to know that we are changing sections, so that .previous works correctly. */ if (IS_ELF) obj_elf_section_change_hook (); #endif subseg_set (absolute_section, 0); demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); } void s_text (int ignore ATTRIBUTE_UNUSED) { register int temp; temp = get_absolute_expression (); subseg_set (text_section, (subsegT) temp); demand_empty_rest_of_line (); #ifdef OBJ_VMS const_flag &= ~IN_DEFAULT_SECTION; #endif } /* .weakref x, y sets x as an alias to y that, as long as y is not referenced directly, will cause y to become a weak symbol. */ void s_weakref (int ignore ATTRIBUTE_UNUSED) { char *name; char delim; char *end_name; symbolS *symbolP; symbolS *symbolP2; expressionS exp; name = input_line_pointer; delim = get_symbol_end (); end_name = input_line_pointer; if (name == end_name) { as_bad (_("expected symbol name")); *end_name = delim; ignore_rest_of_line (); return; } symbolP = symbol_find_or_make (name); if (S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP)) { if (!S_IS_VOLATILE (symbolP)) { as_bad (_("symbol `%s' is already defined"), name); *end_name = delim; ignore_rest_of_line (); return; } symbolP = symbol_clone (symbolP, 1); S_CLEAR_VOLATILE (symbolP); } *end_name = delim; SKIP_WHITESPACE (); if (*input_line_pointer != ',') { *end_name = 0; as_bad (_("expected comma after \"%s\""), name); *end_name = delim; ignore_rest_of_line (); return; } input_line_pointer++; SKIP_WHITESPACE (); name = input_line_pointer; delim = get_symbol_end (); end_name = input_line_pointer; if (name == end_name) { as_bad (_("expected symbol name")); ignore_rest_of_line (); return; } if ((symbolP2 = symbol_find_noref (name, 1)) == NULL && (symbolP2 = md_undefined_symbol (name)) == NULL) { symbolP2 = symbol_find_or_make (name); S_SET_WEAKREFD (symbolP2); } else { symbolS *symp = symbolP2; while (S_IS_WEAKREFR (symp) && symp != symbolP) { expressionS *expP = symbol_get_value_expression (symp); assert (expP->X_op == O_symbol && expP->X_add_number == 0); symp = expP->X_add_symbol; } if (symp == symbolP) { char *loop; loop = concat (S_GET_NAME (symbolP), " => ", S_GET_NAME (symbolP2), NULL); symp = symbolP2; while (symp != symbolP) { char *old_loop = loop; symp = symbol_get_value_expression (symp)->X_add_symbol; loop = concat (loop, " => ", S_GET_NAME (symp), NULL); free (old_loop); } as_bad (_("%s: would close weakref loop: %s"), S_GET_NAME (symbolP), loop); free (loop); *end_name = delim; ignore_rest_of_line (); return; } /* Short-circuiting instead of just checking here might speed things up a tiny little bit, but loop error messages would miss intermediate links. */ /* symbolP2 = symp; */ } *end_name = delim; memset (&exp, 0, sizeof (exp)); exp.X_op = O_symbol; exp.X_add_symbol = symbolP2; S_SET_SEGMENT (symbolP, undefined_section); symbol_set_value_expression (symbolP, &exp); symbol_set_frag (symbolP, &zero_address_frag); S_SET_WEAKREFR (symbolP); demand_empty_rest_of_line (); } /* Verify that we are at the end of a line. If not, issue an error and skip to EOL. */ void demand_empty_rest_of_line (void) { SKIP_WHITESPACE (); if (is_end_of_line[(unsigned char) *input_line_pointer]) input_line_pointer++; else { if (ISPRINT (*input_line_pointer)) as_bad (_("junk at end of line, first unrecognized character is `%c'"), *input_line_pointer); else as_bad (_("junk at end of line, first unrecognized character valued 0x%x"), *input_line_pointer); ignore_rest_of_line (); } /* Return pointing just after end-of-line. */ know (is_end_of_line[(unsigned char) input_line_pointer[-1]]); } /* Silently advance to the end of line. Use this after already having issued an error about something bad. */ void ignore_rest_of_line (void) { while (input_line_pointer < buffer_limit && !is_end_of_line[(unsigned char) *input_line_pointer]) input_line_pointer++; input_line_pointer++; /* Return pointing just after end-of-line. */ know (is_end_of_line[(unsigned char) input_line_pointer[-1]]); } /* Sets frag for given symbol to zero_address_frag, except when the symbol frag is already set to a dummy listing frag. */ static void set_zero_frag (symbolS *symbolP) { if (symbol_get_frag (symbolP)->fr_type != rs_dummy) symbol_set_frag (symbolP, &zero_address_frag); } /* In: Pointer to a symbol. Input_line_pointer->expression. Out: Input_line_pointer->just after any whitespace after expression. Tried to set symbol to value of expression. Will change symbols type, value, and frag; */ void pseudo_set (symbolS *symbolP) { expressionS exp; segT seg; know (symbolP); /* NULL pointer is logic error. */ if (!S_IS_FORWARD_REF (symbolP)) (void) expression (&exp); else (void) deferred_expression (&exp); if (exp.X_op == O_illegal) as_bad (_("illegal expression")); else if (exp.X_op == O_absent) as_bad (_("missing expression")); else if (exp.X_op == O_big) { if (exp.X_add_number > 0) as_bad (_("bignum invalid")); else as_bad (_("floating point number invalid")); } else if (exp.X_op == O_subtract && !S_IS_FORWARD_REF (symbolP) && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol)) && (symbol_get_frag (exp.X_add_symbol) == symbol_get_frag (exp.X_op_symbol))) { exp.X_op = O_constant; exp.X_add_number = (S_GET_VALUE (exp.X_add_symbol) - S_GET_VALUE (exp.X_op_symbol)); } if (symbol_section_p (symbolP)) { as_bad ("attempt to set value of section symbol"); return; } switch (exp.X_op) { case O_illegal: case O_absent: case O_big: exp.X_add_number = 0; /* Fall through. */ case O_constant: S_SET_SEGMENT (symbolP, absolute_section); S_SET_VALUE (symbolP, (valueT) exp.X_add_number); set_zero_frag (symbolP); break; case O_register: S_SET_SEGMENT (symbolP, reg_section); S_SET_VALUE (symbolP, (valueT) exp.X_add_number); set_zero_frag (symbolP); symbol_get_value_expression (symbolP)->X_op = O_register; break; case O_symbol: seg = S_GET_SEGMENT (exp.X_add_symbol); /* For x=undef+const, create an expression symbol. For x=x+const, just update x except when x is an undefined symbol For x=defined+const, evaluate x. */ if (symbolP == exp.X_add_symbol && (seg != undefined_section || !symbol_constant_p (symbolP))) { *symbol_X_add_number (symbolP) += exp.X_add_number; break; } else if (!S_IS_FORWARD_REF (symbolP) && seg != undefined_section) { symbolS *s = exp.X_add_symbol; if (S_IS_COMMON (s)) as_bad (_("`%s' can't be equated to common symbol '%s'"), S_GET_NAME (symbolP), S_GET_NAME (s)); S_SET_SEGMENT (symbolP, seg); S_SET_VALUE (symbolP, exp.X_add_number + S_GET_VALUE (s)); symbol_set_frag (symbolP, symbol_get_frag (s)); copy_symbol_attributes (symbolP, s); break; } S_SET_SEGMENT (symbolP, undefined_section); symbol_set_value_expression (symbolP, &exp); set_zero_frag (symbolP); break; default: /* The value is some complex expression. */ S_SET_SEGMENT (symbolP, expr_section); symbol_set_value_expression (symbolP, &exp); set_zero_frag (symbolP); break; } } /* cons() CONStruct more frag of .bytes, or .words etc. Should need_pass_2 be 1 then emit no frag(s). This understands EXPRESSIONS. Bug (?) This has a split personality. We use expression() to read the value. We can detect if the value won't fit in a byte or word. But we can't detect if expression() discarded significant digits in the case of a long. Not worth the crocks required to fix it. */ /* Select a parser for cons expressions. */ /* Some targets need to parse the expression in various fancy ways. You can define TC_PARSE_CONS_EXPRESSION to do whatever you like (for example, the HPPA does this). Otherwise, you can define BITFIELD_CONS_EXPRESSIONS to permit bitfields to be specified, or REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these are defined, which is the normal case, then only simple expressions are permitted. */ #ifdef TC_M68K static void parse_mri_cons (expressionS *exp, unsigned int nbytes); #endif #ifndef TC_PARSE_CONS_EXPRESSION #ifdef BITFIELD_CONS_EXPRESSIONS #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES) static void parse_bitfield_cons (expressionS *exp, unsigned int nbytes); #endif #ifdef REPEAT_CONS_EXPRESSIONS #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES) static void parse_repeat_cons (expressionS *exp, unsigned int nbytes); #endif /* If we haven't gotten one yet, just call expression. */ #ifndef TC_PARSE_CONS_EXPRESSION #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP) #endif #endif void do_parse_cons_expression (expressionS *exp, int nbytes ATTRIBUTE_UNUSED) { TC_PARSE_CONS_EXPRESSION (exp, nbytes); } /* Worker to do .byte etc statements. Clobbers input_line_pointer and checks end-of-line. */ static void cons_worker (register int nbytes, /* 1=.byte, 2=.word, 4=.long. */ int rva) { int c; expressionS exp; char *stop = NULL; char stopc = 0; #ifdef md_flush_pending_output md_flush_pending_output (); #endif if (flag_mri) stop = mri_comment_field (&stopc); if (is_it_end_of_statement ()) { demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); return; } #ifdef TC_ADDRESS_BYTES if (nbytes == 0) nbytes = TC_ADDRESS_BYTES (); #endif #ifdef md_cons_align md_cons_align (nbytes); #endif c = 0; do { #ifdef TC_M68K if (flag_m68k_mri) parse_mri_cons (&exp, (unsigned int) nbytes); else #endif TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes); if (rva) { if (exp.X_op == O_symbol) exp.X_op = O_symbol_rva; else as_fatal (_("rva without symbol")); } emit_expr (&exp, (unsigned int) nbytes); ++c; } while (*input_line_pointer++ == ','); /* In MRI mode, after an odd number of bytes, we must align to an even word boundary, unless the next instruction is a dc.b, ds.b or dcb.b. */ if (flag_mri && nbytes == 1 && (c & 1) != 0) mri_pending_align = 1; input_line_pointer--; /* Put terminator back into stream. */ demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); } void cons (int size) { cons_worker (size, 0); } void s_rva (int size) { cons_worker (size, 1); } /* .reloc offset, reloc_name, symbol+addend. */ void s_reloc (int ignore ATTRIBUTE_UNUSED) { char *stop = NULL; char stopc = 0; expressionS exp; char *r_name; int c; struct reloc_list *reloc; reloc = xmalloc (sizeof (*reloc)); if (flag_mri) stop = mri_comment_field (&stopc); expression (&exp); switch (exp.X_op) { case O_illegal: case O_absent: case O_big: case O_register: as_bad (_("missing or bad offset expression")); goto err_out; case O_constant: exp.X_add_symbol = section_symbol (now_seg); exp.X_op = O_symbol; /* Fall thru */ case O_symbol: if (exp.X_add_number == 0) { reloc->u.a.offset_sym = exp.X_add_symbol; break; } /* Fall thru */ default: reloc->u.a.offset_sym = make_expr_symbol (&exp); break; } SKIP_WHITESPACE (); if (*input_line_pointer != ',') { as_bad (_("missing reloc type")); goto err_out; } ++input_line_pointer; SKIP_WHITESPACE (); r_name = input_line_pointer; c = get_symbol_end (); reloc->u.a.howto = bfd_reloc_name_lookup (stdoutput, r_name); *input_line_pointer = c; if (reloc->u.a.howto == NULL) { as_bad (_("unrecognized reloc type")); goto err_out; } exp.X_op = O_absent; SKIP_WHITESPACE (); if (*input_line_pointer == ',') { ++input_line_pointer; expression_and_evaluate (&exp); } switch (exp.X_op) { case O_illegal: case O_big: case O_register: as_bad (_("bad reloc expression")); err_out: ignore_rest_of_line (); free (reloc); if (flag_mri) mri_comment_end (stop, stopc); return; case O_absent: reloc->u.a.sym = NULL; reloc->u.a.addend = 0; break; case O_constant: reloc->u.a.sym = NULL; reloc->u.a.addend = exp.X_add_number; break; case O_symbol: reloc->u.a.sym = exp.X_add_symbol; reloc->u.a.addend = exp.X_add_number; break; default: reloc->u.a.sym = make_expr_symbol (&exp); reloc->u.a.addend = 0; break; } as_where (&reloc->file, &reloc->line); reloc->next = reloc_list; reloc_list = reloc; demand_empty_rest_of_line (); if (flag_mri) mri_comment_end (stop, stopc); } /* Put the contents of expression EXP into the object file using NBYTES bytes. If need_pass_2 is 1, this does nothing. */ void emit_expr (expressionS *exp, unsigned int nbytes) { operatorT op; register char *p; valueT extra_digit = 0; /* Don't do anything if we are going to make another pass. */ if (need_pass_2) return; dot_value = frag_now_fix (); #ifndef NO_LISTING #ifdef OBJ_ELF /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will appear as a four byte positive constant in the .line section, followed by a 2 byte 0xffff. Look for that case here. */ { static int dwarf_line = -1; if (strcmp (segment_name (now_seg), ".line") != 0) dwarf_line = -1; else if (dwarf_line >= 0 && nbytes == 2 && exp->X_op == O_constant && (exp->X_add_number == -1 || exp->X_add_number == 0xffff)) listing_source_line ((unsigned int) dwarf_line); else if (nbytes == 4 && exp->X_op == O_constant && exp->X_add_number >= 0) dwarf_line = exp->X_add_number; else dwarf_line = -1; } /* When gcc emits DWARF 1 debugging pseudo-ops, a file name will appear as a 2 byte TAG_compile_unit (0x11) followed by a 2 byte AT_sibling (0x12) followed by a four byte address of the sibling followed by a 2 byte AT_name (0x38) followed by the name of the file. We look for that case here. */ { static int dwarf_file = 0; if (strcmp (segment_name (now_seg), ".debug") != 0) dwarf_file = 0; else if (dwarf_file == 0 && nbytes == 2 && exp->X_op == O_constant && exp->X_add_number == 0x11) dwarf_file = 1; else if (dwarf_file == 1 && nbytes == 2 && exp->X_op == O_constant && exp->X_add_number == 0x12) dwarf_file = 2; else if (dwarf_file == 2 && nbytes == 4) dwarf_file = 3; else if (dwarf_file == 3 && nbytes == 2 && exp->X_op == O_constant && exp->X_add_number == 0x38) dwarf_file = 4; else dwarf_file = 0; /* The variable dwarf_file_string tells stringer that the string may be the name of the source file. */ if (dwarf_file == 4) dwarf_file_string = 1; else dwarf_file_string = 0; } #endif #endif if (check_eh_frame (exp, &nbytes)) return; op = exp->X_op; /* Allow `.word 0' in the absolute section. */ if (now_seg == absolute_section) { if (op != O_constant || exp->X_add_number != 0) as_bad (_("attempt to store value in absolute section")); abs_section_offset += nbytes; return; } /* Handle a negative bignum. */ if (op == O_uminus && exp->X_add_number == 0 && symbol_get_value_expression (exp->X_add_symbol)->X_op == O_big && symbol_get_value_expression (exp->X_add_symbol)->X_add_number > 0) { int i; unsigned long carry; exp = symbol_get_value_expression (exp->X_add_symbol); /* Negate the bignum: one's complement each digit and add 1. */ carry = 1; for (i = 0; i < exp->X_add_number; i++) { unsigned long next; next = (((~(generic_bignum[i] & LITTLENUM_MASK)) & LITTLENUM_MASK) + carry); generic_bignum[i] = next & LITTLENUM_MASK; carry = next >> LITTLENUM_NUMBER_OF_BITS; } /* We can ignore any carry out, because it will be handled by extra_digit if it is needed. */ extra_digit = (valueT) -1; op = O_big; } if (op == O_absent || op == O_illegal) { as_warn (_("zero assumed for missing expression")); exp->X_add_number = 0; op = O_constant; } else if (op == O_big && exp->X_add_number <= 0) { as_bad (_("floating point number invalid")); exp->X_add_number = 0; op = O_constant; } else if (op == O_register) { as_warn (_("register value used as expression")); op = O_constant; } p = frag_more ((int) nbytes); #ifndef WORKING_DOT_WORD /* If we have the difference of two symbols in a word, save it on the broken_words list. See the code in write.c. */ if (op == O_subtract && nbytes == 2) { struct broken_word *x; x = (struct broken_word *) xmalloc (sizeof (struct broken_word)); x->next_broken_word = broken_words; broken_words = x; x->seg = now_seg; x->subseg = now_subseg; x->frag = frag_now; x->word_goes_here = p; x->dispfrag = 0; x->add = exp->X_add_symbol; x->sub = exp->X_op_symbol; x->addnum = exp->X_add_number; x->added = 0; x->use_jump = 0; new_broken_words++; return; } #endif /* If we have an integer, but the number of bytes is too large to pass to md_number_to_chars, handle it as a bignum. */ if (op == O_constant && nbytes > sizeof (valueT)) { extra_digit = exp->X_unsigned ? 0 : -1; convert_to_bignum (exp); op = O_big; } if (op == O_constant) { register valueT get; register valueT use; register valueT mask; valueT hibit; register valueT unmask; /* JF << of >= number of bits in the object is undefined. In particular SPARC (Sun 4) has problems. */ if (nbytes >= sizeof (valueT)) { mask = 0; if (nbytes > sizeof (valueT)) hibit = 0; else hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1); } else { /* Don't store these bits. */ mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes); hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1); } unmask = ~mask; /* Do store these bits. */ #ifdef NEVER "Do this mod if you want every overflow check to assume SIGNED 2's complement data."; mask = ~(unmask >> 1); /* Includes sign bit now. */ #endif get = exp->X_add_number; use = get & unmask; if ((get & mask) != 0 && ((get & mask) != mask || (get & hibit) == 0)) { /* Leading bits contain both 0s & 1s. */ as_warn (_("value 0x%lx truncated to 0x%lx"), (unsigned long) get, (unsigned long) use); } /* Put bytes in right order. */ md_number_to_chars (p, use, (int) nbytes); } else if (op == O_big) { unsigned int size; LITTLENUM_TYPE *nums; - know (nbytes % CHARS_PER_LITTLENUM == 0); - size = exp->X_add_number * CHARS_PER_LITTLENUM; if (nbytes < size) { - as_warn (_("bignum truncated to %d bytes"), nbytes); + int i = nbytes / CHARS_PER_LITTLENUM; + if (i != 0) + { + LITTLENUM_TYPE sign = 0; + if ((generic_bignum[--i] + & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) != 0) + sign = ~(LITTLENUM_TYPE) 0; + while (++i < exp->X_add_number) + if (generic_bignum[i] != sign) + break; + } + if (i < exp->X_add_number) + as_warn (_("bignum truncated to %d bytes"), nbytes); size = nbytes; } + + if (nbytes == 1) + { + md_number_to_chars (p, (valueT) generic_bignum[0], 1); + return; + } + know (nbytes % CHARS_PER_LITTLENUM == 0); if (target_big_endian) { while (nbytes > size) { md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM); nbytes -= CHARS_PER_LITTLENUM; p += CHARS_PER_LITTLENUM; } nums = generic_bignum + size / CHARS_PER_LITTLENUM; while (size >= CHARS_PER_LITTLENUM) { --nums; md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM); size -= CHARS_PER_LITTLENUM; p += CHARS_PER_LITTLENUM; } } else { nums = generic_bignum; while (size >= CHARS_PER_LITTLENUM) { md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM); ++nums; size -= CHARS_PER_LITTLENUM; p += CHARS_PER_LITTLENUM; nbytes -= CHARS_PER_LITTLENUM; } while (nbytes >= CHARS_PER_LITTLENUM) { md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM); nbytes -= CHARS_PER_LITTLENUM; p += CHARS_PER_LITTLENUM; } } } else { memset (p, 0, nbytes); /* Now we need to generate a fixS to record the symbol value. */ #ifdef TC_CONS_FIX_NEW TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp); #else { bfd_reloc_code_real_type r; switch (nbytes) { case 1: r = BFD_RELOC_8; break; case 2: r = BFD_RELOC_16; break; case 4: r = BFD_RELOC_32; break; case 8: r = BFD_RELOC_64; break; default: as_bad (_("unsupported BFD relocation size %u"), nbytes); r = BFD_RELOC_32; break; } fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0, r); } #endif } } #ifdef BITFIELD_CONS_EXPRESSIONS /* i960 assemblers, (eg, asm960), allow bitfields after ".byte" as w:x,y:z, where w and y are bitwidths and x and y are values. They then pack them all together. We do a little better in that we allow them in words, longs, etc. and we'll pack them in target byte order for you. The rules are: pack least significant bit first, if a field doesn't entirely fit, put it in the next unit. Overflowing the bitfield is explicitly *not* even a warning. The bitwidth should be considered a "mask". To use this function the tc-XXX.h file should define BITFIELD_CONS_EXPRESSIONS. */ static void parse_bitfield_cons (exp, nbytes) expressionS *exp; unsigned int nbytes; { unsigned int bits_available = BITS_PER_CHAR * nbytes; char *hold = input_line_pointer; (void) expression (exp); if (*input_line_pointer == ':') { /* Bitfields. */ long value = 0; for (;;) { unsigned long width; if (*input_line_pointer != ':') { input_line_pointer = hold; break; } /* Next piece is not a bitfield. */ /* In the general case, we can't allow full expressions with symbol differences and such. The relocation entries for symbols not defined in this assembly would require arbitrary field widths, positions, and masks which most of our current object formats don't support. In the specific case where a symbol *is* defined in this assembly, we *could* build fixups and track it, but this could lead to confusion for the backends. I'm lazy. I'll take any SEG_ABSOLUTE. I think that means that you can use a previous .set or .equ type symbol. xoxorich. */ if (exp->X_op == O_absent) { as_warn (_("using a bit field width of zero")); exp->X_add_number = 0; exp->X_op = O_constant; } /* Implied zero width bitfield. */ if (exp->X_op != O_constant) { *input_line_pointer = '\0'; as_bad (_("field width \"%s\" too complex for a bitfield"), hold); *input_line_pointer = ':'; demand_empty_rest_of_line (); return; } /* Too complex. */ if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes)) { as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"), width, nbytes, (BITS_PER_CHAR * nbytes)); width = BITS_PER_CHAR * nbytes; } /* Too big. */ if (width > bits_available) { /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */ input_line_pointer = hold; exp->X_add_number = value; break; } /* Won't fit. */ /* Skip ':'. */ hold = ++input_line_pointer; (void) expression (exp); if (exp->X_op != O_constant) { char cache = *input_line_pointer; *input_line_pointer = '\0'; as_bad (_("field value \"%s\" too complex for a bitfield"), hold); *input_line_pointer = cache; demand_empty_rest_of_line (); return; } /* Too complex. */ value |= ((~(-1 << width) & exp->X_add_number) << ((BITS_PER_CHAR * nbytes) - bits_available)); if ((bits_available -= width) == 0 || is_it_end_of_statement () || *input_line_pointer != ',') { break; } /* All the bitfields we're gonna get. */ hold = ++input_line_pointer; (void) expression (exp); } exp->X_add_number = value; exp->X_op = O_constant; exp->X_unsigned = 1; } } #endif /* BITFIELD_CONS_EXPRESSIONS */ /* Handle an MRI style string expression. */ #ifdef TC_M68K static void parse_mri_cons (exp, nbytes) expressionS *exp; unsigned int nbytes; { if (*input_line_pointer != '\'' && (input_line_pointer[1] != '\'' || (*input_line_pointer != 'A' && *input_line_pointer != 'E'))) TC_PARSE_CONS_EXPRESSION (exp, nbytes); else { unsigned int scan; unsigned int result = 0; /* An MRI style string. Cut into as many bytes as will fit into a nbyte chunk, left justify if necessary, and separate with commas so we can try again later. */ if (*input_line_pointer == 'A') ++input_line_pointer; else if (*input_line_pointer == 'E') { as_bad (_("EBCDIC constants are not supported")); ++input_line_pointer; } input_line_pointer++; for (scan = 0; scan < nbytes; scan++) { if (*input_line_pointer == '\'') { if (input_line_pointer[1] == '\'') { input_line_pointer++; } else break; } result = (result << 8) | (*input_line_pointer++); } /* Left justify. */ while (scan < nbytes) { result <<= 8; scan++; } /* Create correct expression. */ exp->X_op = O_constant; exp->X_add_number = result; /* Fake it so that we can read the next char too. */ if (input_line_pointer[0] != '\'' || (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\'')) { input_line_pointer -= 2; input_line_pointer[0] = ','; input_line_pointer[1] = '\''; } else input_line_pointer++; } } #endif /* TC_M68K */ #ifdef REPEAT_CONS_EXPRESSIONS /* Parse a repeat expression for cons. This is used by the MIPS assembler. The format is NUMBER:COUNT; NUMBER appears in the object file COUNT times. To use this for a target, define REPEAT_CONS_EXPRESSIONS. */ static void parse_repeat_cons (exp, nbytes) expressionS *exp; unsigned int nbytes; { expressionS count; register int i; expression (exp); if (*input_line_pointer != ':') { /* No repeat count. */ return; } ++input_line_pointer; expression (&count); if (count.X_op != O_constant || count.X_add_number <= 0) { as_warn (_("unresolvable or nonpositive repeat count; using 1")); return; } /* The cons function is going to output this expression once. So we output it count - 1 times. */ for (i = count.X_add_number - 1; i > 0; i--) emit_expr (exp, nbytes); } #endif /* REPEAT_CONS_EXPRESSIONS */ /* Parse a floating point number represented as a hex constant. This permits users to specify the exact bits they want in the floating point number. */ static int hex_float (int float_type, char *bytes) { int length; int i; switch (float_type) { case 'f': case 'F': case 's': case 'S': length = 4; break; case 'd': case 'D': case 'r': case 'R': length = 8; break; case 'x': case 'X': length = 12; break; case 'p': case 'P': length = 12; break; default: as_bad (_("unknown floating type type '%c'"), float_type); return -1; } /* It would be nice if we could go through expression to parse the hex constant, but if we get a bignum it's a pain to sort it into the buffer correctly. */ i = 0; while (hex_p (*input_line_pointer) || *input_line_pointer == '_') { int d; /* The MRI assembler accepts arbitrary underscores strewn about through the hex constant, so we ignore them as well. */ if (*input_line_pointer == '_') { ++input_line_pointer; continue; } if (i >= length) { as_warn (_("floating point constant too large")); return -1; } d = hex_value (*input_line_pointer) << 4; ++input_line_pointer; while (*input_line_pointer == '_') ++input_line_pointer; if (hex_p (*input_line_pointer)) { d += hex_value (*input_line_pointer); ++input_line_pointer; } if (target_big_endian) bytes[i] = d; else bytes[length - i - 1] = d; ++i; } if (i < length) { if (target_big_endian) memset (bytes + i, 0, length - i); else memset (bytes, 0, length - i); } return length; } /* float_cons() CONStruct some more frag chars of .floats .ffloats etc. Makes 0 or more new frags. If need_pass_2 == 1, no frags are emitted. This understands only floating literals, not expressions. Sorry. A floating constant is defined by atof_generic(), except it is preceded by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its reading, I decided to be incompatible. This always tries to give you rounded bits to the precision of the pseudo-op. Former AS did premature truncation, restored noisy bits instead of trailing 0s AND gave you a choice of 2 flavours of noise according to which of 2 floating-point scanners you directed AS to use. In: input_line_pointer->whitespace before, or '0' of flonum. */ void float_cons (/* Clobbers input_line-pointer, checks end-of-line. */ register int float_type /* 'f':.ffloat ... 'F':.float ... */) { register char *p; int length; /* Number of chars in an object. */ register char *err; /* Error from scanning floating literal. */ char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT]; if (is_it_end_of_statement ()) { demand_empty_rest_of_line (); return; } #ifdef md_flush_pending_output md_flush_pending_output (); #endif do { /* input_line_pointer->1st char of a flonum (we hope!). */ SKIP_WHITESPACE (); /* Skip any 0{letter} that may be present. Don't even check if the letter is legal. Someone may invent a "z" format and this routine has no use for such information. Lusers beware: you get diagnostics if your input is ill-conditioned. */ if (input_line_pointer[0] == '0' && ISALPHA (input_line_pointer[1])) input_line_pointer += 2; /* Accept :xxxx, where the x's are hex digits, for a floating point with the exact digits specified. */ if (input_line_pointer[0] == ':') { ++input_line_pointer; length = hex_float (float_type, temp); if (length < 0) { ignore_rest_of_line (); return; } } else { err = md_atof (float_type, temp, &length); know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT); know (length > 0); if (err) { as_bad (_("bad floating literal: %s"), err); ignore_rest_of_line (); return; } } if (!need_pass_2) { int count; count = 1; #ifdef REPEAT_CONS_EXPRESSIONS if (*input_line_pointer == ':') { expressionS count_exp; ++input_line_pointer; expression (&count_exp); if (count_exp.X_op != O_constant || count_exp.X_add_number <= 0) as_warn (_("unresolvable or nonpositive repeat count; using 1")); else count = count_exp.X_add_number; } #endif while (--count >= 0) { p = frag_more (length); memcpy (p, temp, (unsigned int) length); } } SKIP_WHITESPACE (); } while (*input_line_pointer++ == ','); /* Put terminator back into stream. */ --input_line_pointer; demand_empty_rest_of_line (); } /* Return the size of a LEB128 value. */ static inline int sizeof_sleb128 (offsetT value) { register int size = 0; register unsigned byte; do { byte = (value & 0x7f); /* Sadly, we cannot rely on typical arithmetic right shift behaviour. Fortunately, we can structure things so that the extra work reduces to a noop on systems that do things "properly". */ value = (value >> 7) | ~(-(offsetT)1 >> 7); size += 1; } while (!(((value == 0) && ((byte & 0x40) == 0)) || ((value == -1) && ((byte & 0x40) != 0)))); return size; } static inline int sizeof_uleb128 (valueT value) { register int size = 0; register unsigned byte; do { byte = (value & 0x7f); value >>= 7; size += 1; } while (value != 0); return size; } int sizeof_leb128 (valueT value, int sign) { if (sign) return sizeof_sleb128 ((offsetT) value); else return sizeof_uleb128 (value); } /* Output a LEB128 value. */ static inline int output_sleb128 (char *p, offsetT value) { register char *orig = p; register int more; do { unsigned byte = (value & 0x7f); /* Sadly, we cannot rely on typical arithmetic right shift behaviour. Fortunately, we can structure things so that the extra work reduces to a noop on systems that do things "properly". */ value = (value >> 7) | ~(-(offsetT)1 >> 7); more = !((((value == 0) && ((byte & 0x40) == 0)) || ((value == -1) && ((byte & 0x40) != 0)))); if (more) byte |= 0x80; *p++ = byte; } while (more); return p - orig; } static inline int output_uleb128 (char *p, valueT value) { char *orig = p; do { unsigned byte = (value & 0x7f); value >>= 7; if (value != 0) /* More bytes to follow. */ byte |= 0x80; *p++ = byte; } while (value != 0); return p - orig; } int output_leb128 (char *p, valueT value, int sign) { if (sign) return output_sleb128 (p, (offsetT) value); else return output_uleb128 (p, value); } /* Do the same for bignums. We combine sizeof with output here in that we don't output for NULL values of P. It isn't really as critical as for "normal" values that this be streamlined. */ static inline int output_big_sleb128 (char *p, LITTLENUM_TYPE *bignum, int size) { char *orig = p; valueT val = 0; int loaded = 0; unsigned byte; /* Strip leading sign extensions off the bignum. */ while (size > 1 && bignum[size - 1] == LITTLENUM_MASK && bignum[size - 2] > LITTLENUM_MASK / 2) size--; do { /* OR in the next part of the littlenum. */ val |= (*bignum << loaded); loaded += LITTLENUM_NUMBER_OF_BITS; size--; bignum++; /* Add bytes until there are less than 7 bits left in VAL or until every non-sign bit has been written. */ do { byte = val & 0x7f; loaded -= 7; val >>= 7; if (size > 0 || val != ((byte & 0x40) == 0 ? 0 : ((valueT) 1 << loaded) - 1)) byte |= 0x80; if (orig) *p = byte; p++; } while ((byte & 0x80) != 0 && loaded >= 7); } while (size > 0); /* Mop up any left-over bits (of which there will be less than 7). */ if ((byte & 0x80) != 0) { /* Sign-extend VAL. */ if (val & (1 << (loaded - 1))) val |= ~0 << loaded; if (orig) *p = val & 0x7f; p++; } return p - orig; } static inline int output_big_uleb128 (char *p, LITTLENUM_TYPE *bignum, int size) { char *orig = p; valueT val = 0; int loaded = 0; unsigned byte; /* Strip leading zeros off the bignum. */ /* XXX: Is this needed? */ while (size > 0 && bignum[size - 1] == 0) size--; do { if (loaded < 7 && size > 0) { val |= (*bignum << loaded); loaded += 8 * CHARS_PER_LITTLENUM; size--; bignum++; } byte = val & 0x7f; loaded -= 7; val >>= 7; if (size > 0 || val) byte |= 0x80; if (orig) *p = byte; p++; } while (byte & 0x80); return p - orig; } static int output_big_leb128 (char *p, LITTLENUM_TYPE *bignum, int size, int sign) { if (sign) return output_big_sleb128 (p, bignum, size); else return output_big_uleb128 (p, bignum, size); } /* Generate the appropriate fragments for a given expression to emit a leb128 value. */ static void emit_leb128_expr (expressionS *exp, int sign) { operatorT op = exp->X_op; unsigned int nbytes; if (op == O_absent || op == O_illegal) { as_warn (_("zero assumed for missing expression")); exp->X_add_number = 0; op = O_constant; } else if (op == O_big && exp->X_add_number <= 0) { as_bad (_("floating point number invalid")); exp->X_add_number = 0; op = O_constant; } else if (op == O_register) { as_warn (_("register value used as expression")); op = O_constant; } else if (op == O_constant && sign && (exp->X_add_number < 0) != !exp->X_unsigned) { /* We're outputting a signed leb128 and the sign of X_add_number doesn't reflect the sign of the original value. Convert EXP to a correctly-extended bignum instead. */ convert_to_bignum (exp); op = O_big; } /* Let check_eh_frame know that data is being emitted. nbytes == -1 is a signal that this is leb128 data. It shouldn't optimize this away. */ nbytes = (unsigned int) -1; if (check_eh_frame (exp, &nbytes)) abort (); /* Let the backend know that subsequent data may be byte aligned. */ #ifdef md_cons_align md_cons_align (1); #endif if (op == O_constant) { /* If we've got a constant, emit the thing directly right now. */ valueT value = exp->X_add_number; int size; char *p; size = sizeof_leb128 (value, sign); p = frag_more (size); output_leb128 (p, value, sign); } else if (op == O_big) { /* O_big is a different sort of constant. */ int size; char *p; size = output_big_leb128 (NULL, generic_bignum, exp->X_add_number, sign); p = frag_more (size); output_big_leb128 (p, generic_bignum, exp->X_add_number, sign); } else { /* Otherwise, we have to create a variable sized fragment and resolve things later. */ frag_var (rs_leb128, sizeof_uleb128 (~(valueT) 0), 0, sign, make_expr_symbol (exp), 0, (char *) NULL); } } /* Parse the .sleb128 and .uleb128 pseudos. */ void s_leb128 (int sign) { expressionS exp; #ifdef md_flush_pending_output md_flush_pending_output (); #endif do { expression (&exp); emit_leb128_expr (&exp, sign); } while (*input_line_pointer++ == ','); input_line_pointer--; demand_empty_rest_of_line (); } /* We read 0 or more ',' separated, double-quoted strings. Caller should have checked need_pass_2 is FALSE because we don't check it. */ void stringer (/* Worker to do .ascii etc statements. */ /* Checks end-of-line. */ register int append_zero /* 0: don't append '\0', else 1. */) { register unsigned int c; char *start; #ifdef md_flush_pending_output md_flush_pending_output (); #endif /* The following awkward logic is to parse ZERO or more strings, comma separated. Recall a string expression includes spaces before the opening '\"' and spaces after the closing '\"'. We fake a leading ',' if there is (supposed to be) a 1st, expression. We keep demanding expressions for each ','. */ if (is_it_end_of_statement ()) { c = 0; /* Skip loop. */ ++input_line_pointer; /* Compensate for end of loop. */ } else { c = ','; /* Do loop. */ } /* If we have been switched into the abs_section then we will not have an obstack onto which we can hang strings. */ if (now_seg == absolute_section) { as_bad (_("strings must be placed into a section")); c = 0; ignore_rest_of_line (); } while (c == ',' || c == '<' || c == '"') { SKIP_WHITESPACE (); switch (*input_line_pointer) { case '\"': ++input_line_pointer; /*->1st char of string. */ start = input_line_pointer; while (is_a_char (c = next_char_of_string ())) { FRAG_APPEND_1_CHAR (c); } if (append_zero) { FRAG_APPEND_1_CHAR (0); } know (input_line_pointer[-1] == '\"'); #ifndef NO_LISTING #ifdef OBJ_ELF /* In ELF, when gcc is emitting DWARF 1 debugging output, it will emit .string with a filename in the .debug section after a sequence of constants. See the comment in emit_expr for the sequence. emit_expr will set dwarf_file_string to non-zero if this string might be a source file name. */ if (strcmp (segment_name (now_seg), ".debug") != 0) dwarf_file_string = 0; else if (dwarf_file_string) { c = input_line_pointer[-1]; input_line_pointer[-1] = '\0'; listing_source_file (start); input_line_pointer[-1] = c; } #endif #endif break; case '<': input_line_pointer++; c = get_single_number (); FRAG_APPEND_1_CHAR (c); if (*input_line_pointer != '>') { as_bad (_("expected ")); } input_line_pointer++; break; case ',': input_line_pointer++; break; } SKIP_WHITESPACE (); c = *input_line_pointer; } demand_empty_rest_of_line (); } /* stringer() */ /* FIXME-SOMEDAY: I had trouble here on characters with the high bits set. We'll probably also have trouble with multibyte chars, wide chars, etc. Also be careful about returning values bigger than 1 byte. xoxorich. */ unsigned int next_char_of_string (void) { register unsigned int c; c = *input_line_pointer++ & CHAR_MASK; switch (c) { case '\"': c = NOT_A_CHAR; break; case '\n': as_warn (_("unterminated string; newline inserted")); bump_line_counters (); break; #ifndef NO_STRING_ESCAPES case '\\': switch (c = *input_line_pointer++) { case 'b': c = '\b'; break; case 'f': c = '\f'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; case 'v': c = '\013'; break; case '\\': case '"': break; /* As itself. */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { long number; int i; for (i = 0, number = 0; ISDIGIT (c) && i < 3; c = *input_line_pointer++, i++) { number = number * 8 + c - '0'; } c = number & 0xff; } --input_line_pointer; break; case 'x': case 'X': { long number; number = 0; c = *input_line_pointer++; while (ISXDIGIT (c)) { if (ISDIGIT (c)) number = number * 16 + c - '0'; else if (ISUPPER (c)) number = number * 16 + c - 'A' + 10; else number = number * 16 + c - 'a' + 10; c = *input_line_pointer++; } c = number & 0xff; --input_line_pointer; } break; case '\n': /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */ as_warn (_("unterminated string; newline inserted")); c = '\n'; bump_line_counters (); break; default: #ifdef ONLY_STANDARD_ESCAPES as_bad (_("bad escaped character in string")); c = '?'; #endif /* ONLY_STANDARD_ESCAPES */ break; } break; #endif /* ! defined (NO_STRING_ESCAPES) */ default: break; } return (c); } static segT get_segmented_expression (register expressionS *expP) { register segT retval; retval = expression (expP); if (expP->X_op == O_illegal || expP->X_op == O_absent || expP->X_op == O_big) { as_bad (_("expected address expression")); expP->X_op = O_constant; expP->X_add_number = 0; retval = absolute_section; } return retval; } static segT get_known_segmented_expression (register expressionS *expP) { register segT retval; if ((retval = get_segmented_expression (expP)) == undefined_section) { /* There is no easy way to extract the undefined symbol from the expression. */ if (expP->X_add_symbol != NULL && S_GET_SEGMENT (expP->X_add_symbol) != expr_section) as_warn (_("symbol \"%s\" undefined; zero assumed"), S_GET_NAME (expP->X_add_symbol)); else as_warn (_("some symbol undefined; zero assumed")); retval = absolute_section; expP->X_op = O_constant; expP->X_add_number = 0; } know (retval == absolute_section || SEG_NORMAL (retval)); return (retval); } char /* Return terminator. */ get_absolute_expression_and_terminator (long *val_pointer /* Return value of expression. */) { /* FIXME: val_pointer should probably be offsetT *. */ *val_pointer = (long) get_absolute_expression (); return (*input_line_pointer++); } /* Like demand_copy_string, but return NULL if the string contains any '\0's. Give a warning if that happens. */ char * demand_copy_C_string (int *len_pointer) { register char *s; if ((s = demand_copy_string (len_pointer)) != 0) { register int len; for (len = *len_pointer; len > 0; len--) { if (*s == 0) { s = 0; len = 1; *len_pointer = 0; as_bad (_("this string may not contain \'\\0\'")); } } } return s; } /* Demand string, but return a safe (=private) copy of the string. Return NULL if we can't read a string here. */ char * demand_copy_string (int *lenP) { register unsigned int c; register int len; char *retval; len = 0; SKIP_WHITESPACE (); if (*input_line_pointer == '\"') { input_line_pointer++; /* Skip opening quote. */ while (is_a_char (c = next_char_of_string ())) { obstack_1grow (¬es, c); len++; } /* JF this next line is so demand_copy_C_string will return a null terminated string. */ obstack_1grow (¬es, '\0'); retval = obstack_finish (¬es); } else { as_bad (_("missing string")); retval = NULL; ignore_rest_of_line (); } *lenP = len; return (retval); } /* In: Input_line_pointer->next character. Do: Skip input_line_pointer over all whitespace. Out: 1 if input_line_pointer->end-of-line. */ int is_it_end_of_statement (void) { SKIP_WHITESPACE (); return (is_end_of_line[(unsigned char) *input_line_pointer]); } void equals (char *sym_name, int reassign) { char *stop = NULL; char stopc = 0; input_line_pointer++; if (*input_line_pointer == '=') input_line_pointer++; if (reassign < 0 && *input_line_pointer == '=') input_line_pointer++; while (*input_line_pointer == ' ' || *input_line_pointer == '\t') input_line_pointer++; if (flag_mri) stop = mri_comment_field (&stopc); assign_symbol (sym_name, reassign >= 0 ? !reassign : reassign); if (flag_mri) { demand_empty_rest_of_line (); mri_comment_end (stop, stopc); } } /* .incbin -- include a file verbatim at the current location. */ void s_incbin (int x ATTRIBUTE_UNUSED) { FILE * binfile; char * path; char * filename; char * binfrag; long skip = 0; long count = 0; long bytes; int len; #ifdef md_flush_pending_output md_flush_pending_output (); #endif SKIP_WHITESPACE (); filename = demand_copy_string (& len); if (filename == NULL) return; SKIP_WHITESPACE (); /* Look for optional skip and count. */ if (* input_line_pointer == ',') { ++ input_line_pointer; skip = get_absolute_expression (); SKIP_WHITESPACE (); if (* input_line_pointer == ',') { ++ input_line_pointer; count = get_absolute_expression (); if (count == 0) as_warn (_(".incbin count zero, ignoring `%s'"), filename); SKIP_WHITESPACE (); } } demand_empty_rest_of_line (); /* Try opening absolute path first, then try include dirs. */ binfile = fopen (filename, FOPEN_RB); if (binfile == NULL) { int i; path = xmalloc ((unsigned long) len + include_dir_maxlen + 5); for (i = 0; i < include_dir_count; i++) { sprintf (path, "%s/%s", include_dirs[i], filename); binfile = fopen (path, FOPEN_RB); if (binfile != NULL) break; } if (binfile == NULL) as_bad (_("file not found: %s"), filename); } else path = xstrdup (filename); if (binfile) { long file_len; register_dependency (path); /* Compute the length of the file. */ if (fseek (binfile, 0, SEEK_END) != 0) { as_bad (_("seek to end of .incbin file failed `%s'"), path); goto done; } file_len = ftell (binfile); /* If a count was not specified use the remainder of the file. */ if (count == 0) count = file_len - skip; if (skip < 0 || count < 0 || file_len < 0 || skip + count > file_len) { as_bad (_("skip (%ld) or count (%ld) invalid for file size (%ld)"), skip, count, file_len); goto done; } if (fseek (binfile, skip, SEEK_SET) != 0) { as_bad (_("could not skip to %ld in file `%s'"), skip, path); goto done; } /* Allocate frag space and store file contents in it. */ binfrag = frag_more (count); bytes = fread (binfrag, 1, count, binfile); if (bytes < count) as_warn (_("truncated file `%s', %ld of %ld bytes read"), path, bytes, count); } done: if (binfile != NULL) fclose (binfile); if (path) free (path); } /* .include -- include a file at this point. */ void s_include (int arg ATTRIBUTE_UNUSED) { char *filename; int i; FILE *try; char *path; if (!flag_m68k_mri) { filename = demand_copy_string (&i); if (filename == NULL) { /* demand_copy_string has already printed an error and called ignore_rest_of_line. */ return; } } else { SKIP_WHITESPACE (); i = 0; while (!is_end_of_line[(unsigned char) *input_line_pointer] && *input_line_pointer != ' ' && *input_line_pointer != '\t') { obstack_1grow (¬es, *input_line_pointer); ++input_line_pointer; ++i; } obstack_1grow (¬es, '\0'); filename = obstack_finish (¬es); while (!is_end_of_line[(unsigned char) *input_line_pointer]) ++input_line_pointer; } demand_empty_rest_of_line (); path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ ); for (i = 0; i < include_dir_count; i++) { strcpy (path, include_dirs[i]); strcat (path, "/"); strcat (path, filename); if (0 != (try = fopen (path, FOPEN_RT))) { fclose (try); goto gotit; } } free (path); path = filename; gotit: /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */ register_dependency (path); input_scrub_insert_file (path); } void add_include_dir (char *path) { int i; if (include_dir_count == 0) { include_dirs = (char **) xmalloc (2 * sizeof (*include_dirs)); include_dirs[0] = "."; /* Current dir. */ include_dir_count = 2; } else { include_dir_count++; include_dirs = (char **) realloc (include_dirs, include_dir_count * sizeof (*include_dirs)); } include_dirs[include_dir_count - 1] = path; /* New one. */ i = strlen (path); if (i > include_dir_maxlen) include_dir_maxlen = i; } /* Output debugging information to denote the source file. */ static void generate_file_debug (void) { if (debug_type == DEBUG_STABS) stabs_generate_asm_file (); } /* Output line number debugging information for the current source line. */ void generate_lineno_debug (void) { switch (debug_type) { case DEBUG_UNSPECIFIED: case DEBUG_NONE: case DEBUG_DWARF: break; case DEBUG_STABS: stabs_generate_asm_lineno (); break; case DEBUG_ECOFF: ecoff_generate_asm_lineno (); break; case DEBUG_DWARF2: /* ??? We could here indicate to dwarf2dbg.c that something has changed. However, since there is additional backend support that is required (calling dwarf2_emit_insn), we let dwarf2dbg.c call as_where on its own. */ break; } } /* Output debugging information to mark a function entry point or end point. END_P is zero for .func, and non-zero for .endfunc. */ void s_func (int end_p) { do_s_func (end_p, NULL); } /* Subroutine of s_func so targets can choose a different default prefix. If DEFAULT_PREFIX is NULL, use the target's "leading char". */ static void do_s_func (int end_p, const char *default_prefix) { /* Record the current function so that we can issue an error message for misplaced .func,.endfunc, and also so that .endfunc needs no arguments. */ static char *current_name; static char *current_label; if (end_p) { if (current_name == NULL) { as_bad (_("missing .func")); ignore_rest_of_line (); return; } if (debug_type == DEBUG_STABS) stabs_generate_asm_endfunc (current_name, current_label); current_name = current_label = NULL; } else /* ! end_p */ { char *name, *label; char delim1, delim2; if (current_name != NULL) { as_bad (_(".endfunc missing for previous .func")); ignore_rest_of_line (); return; } name = input_line_pointer; delim1 = get_symbol_end (); name = xstrdup (name); *input_line_pointer = delim1; SKIP_WHITESPACE (); if (*input_line_pointer != ',') { if (default_prefix) asprintf (&label, "%s%s", default_prefix, name); else { char leading_char = bfd_get_symbol_leading_char (stdoutput); /* Missing entry point, use function's name with the leading char prepended. */ if (leading_char) asprintf (&label, "%c%s", leading_char, name); else label = name; } } else { ++input_line_pointer; SKIP_WHITESPACE (); label = input_line_pointer; delim2 = get_symbol_end (); label = xstrdup (label); *input_line_pointer = delim2; } if (debug_type == DEBUG_STABS) stabs_generate_asm_func (name, label); current_name = name; current_label = label; } demand_empty_rest_of_line (); } void s_ignore (int arg ATTRIBUTE_UNUSED) { ignore_rest_of_line (); } void read_print_statistics (FILE *file) { hash_print_statistics (file, "pseudo-op table", po_hash); } /* Inserts the given line into the input stream. This call avoids macro/conditionals nesting checking, since the contents of the line are assumed to replace the contents of a line already scanned. An appropriate use of this function would be substitution of input lines when called by md_start_line_hook(). The given line is assumed to already be properly scrubbed. */ void input_scrub_insert_line (const char *line) { sb newline; sb_new (&newline); sb_add_string (&newline, line); input_scrub_include_sb (&newline, input_line_pointer, 0); sb_kill (&newline); buffer_limit = input_scrub_next_buffer (&input_line_pointer); } /* Insert a file into the input stream; the path must resolve to an actual file; no include path searching or dependency registering is performed. */ void input_scrub_insert_file (char *path) { input_scrub_include_file (path, input_line_pointer); buffer_limit = input_scrub_next_buffer (&input_line_pointer); } /* Find the end of a line, considering quotation and escaping of quotes. */ #if !defined(TC_SINGLE_QUOTE_STRINGS) && defined(SINGLE_QUOTE_STRINGS) # define TC_SINGLE_QUOTE_STRINGS 1 #endif static char * _find_end_of_line (char *s, int mri_string, int insn ATTRIBUTE_UNUSED) { char inquote = '\0'; int inescape = 0; while (!is_end_of_line[(unsigned char) *s] || (inquote && !ISCNTRL (*s)) || (inquote == '\'' && flag_mri) #ifdef TC_EOL_IN_INSN || (insn && TC_EOL_IN_INSN (s)) #endif ) { if (mri_string && *s == '\'') inquote ^= *s; else if (inescape) inescape = 0; else if (*s == '\\') inescape = 1; else if (!inquote ? *s == '"' #ifdef TC_SINGLE_QUOTE_STRINGS || (TC_SINGLE_QUOTE_STRINGS && *s == '\'') #endif : *s == inquote) inquote ^= *s; ++s; } if (inquote) as_warn (_("missing closing `%c'"), inquote); if (inescape) as_warn (_("stray `\\'")); return s; } char * find_end_of_line (char *s, int mri_string) { return _find_end_of_line (s, mri_string, 0); } Index: projects/arm_intrng/contrib/binutils =================================================================== --- projects/arm_intrng/contrib/binutils (revision 276247) +++ projects/arm_intrng/contrib/binutils (revision 276248) Property changes on: projects/arm_intrng/contrib/binutils ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/contrib/binutils:r276010-276247 Index: projects/arm_intrng/contrib/bzip2/bzip2.1 =================================================================== --- projects/arm_intrng/contrib/bzip2/bzip2.1 (revision 276247) +++ projects/arm_intrng/contrib/bzip2/bzip2.1 (revision 276248) @@ -1,454 +1,453 @@ -.PU .TH bzip2 1 .SH NAME bzip2, bunzip2 \- a block-sorting file compressor, v1.0.6 .br bzcat \- decompresses files to stdout .br bzip2recover \- recovers data from damaged bzip2 files .SH SYNOPSIS .ll +8 .B bzip2 .RB [ " \-cdfkqstvzVL123456789 " ] [ .I "filenames \&..." ] .ll -8 .br .B bunzip2 .RB [ " \-fkvsVL " ] [ .I "filenames \&..." ] .br .B bzcat .RB [ " \-s " ] [ .I "filenames \&..." ] .br .B bzip2recover .I "filename" .SH DESCRIPTION .I bzip2 compresses files using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. Compression is generally considerably better than that achieved by more conventional LZ77/LZ78-based compressors, and approaches the performance of the PPM family of statistical compressors. The command-line options are deliberately very similar to those of .I GNU gzip, but they are not identical. .I bzip2 expects a list of file names to accompany the command-line flags. Each file is replaced by a compressed version of itself, with the name "original_name.bz2". Each compressed file has the same modification date, permissions, and, when possible, ownership as the corresponding original, so that these properties can be correctly restored at decompression time. File name handling is naive in the sense that there is no mechanism for preserving original file names, permissions, ownerships or dates in filesystems which lack these concepts, or have serious file name length restrictions, such as MS-DOS. .I bzip2 and .I bunzip2 will by default not overwrite existing files. If you want this to happen, specify the \-f flag. If no file names are specified, .I bzip2 compresses from standard input to standard output. In this case, .I bzip2 will decline to write compressed output to a terminal, as this would be entirely incomprehensible and therefore pointless. .I bunzip2 (or .I bzip2 \-d) decompresses all specified files. Files which were not created by .I bzip2 will be detected and ignored, and a warning issued. .I bzip2 attempts to guess the filename for the decompressed file from that of the compressed file as follows: filename.bz2 becomes filename filename.bz becomes filename filename.tbz2 becomes filename.tar filename.tbz becomes filename.tar anyothername becomes anyothername.out If the file does not end in one of the recognised endings, .I .bz2, .I .bz, .I .tbz2 or .I .tbz, .I bzip2 complains that it cannot guess the name of the original file, and uses the original name with .I .out appended. As with compression, supplying no filenames causes decompression from standard input to standard output. .I bunzip2 will correctly decompress a file which is the concatenation of two or more compressed files. The result is the concatenation of the corresponding uncompressed files. Integrity testing (\-t) of concatenated compressed files is also supported. You can also compress or decompress files to the standard output by giving the \-c flag. Multiple files may be compressed and decompressed like this. The resulting outputs are fed sequentially to stdout. Compression of multiple files in this manner generates a stream containing multiple compressed file representations. Such a stream can be decompressed correctly only by .I bzip2 version 0.9.0 or later. Earlier versions of .I bzip2 will stop after decompressing the first file in the stream. .I bzcat (or .I bzip2 -dc) decompresses all specified files to the standard output. .I bzip2 will read arguments from the environment variables .I BZIP2 and .I BZIP, in that order, and will process them before any arguments read from the command line. This gives a convenient way to supply default arguments. Compression is always performed, even if the compressed file is slightly larger than the original. Files of less than about one hundred bytes tend to get larger, since the compression mechanism has a constant overhead in the region of 50 bytes. Random data (including the output of most file compressors) is coded at about 8.05 bits per byte, giving an expansion of around 0.5%. As a self-check for your protection, .I bzip2 uses 32-bit CRCs to make sure that the decompressed version of a file is identical to the original. This guards against corruption of the compressed data, and against undetected bugs in .I bzip2 (hopefully very unlikely). The chances of data corruption going undetected is microscopic, about one chance in four billion for each file processed. Be aware, though, that the check occurs upon decompression, so it can only tell you that something is wrong. It can't help you recover the original uncompressed data. You can use .I bzip2recover to try to recover data from damaged files. Return values: 0 for a normal exit, 1 for environmental problems (file not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt compressed file, 3 for an internal consistency error (eg, bug) which caused .I bzip2 to panic. .SH OPTIONS .TP .B \-c --stdout Compress or decompress to standard output. .TP .B \-d --decompress Force decompression. .I bzip2, .I bunzip2 and .I bzcat are really the same program, and the decision about what actions to take is done on the basis of which name is used. This flag overrides that mechanism, and forces .I bzip2 to decompress. .TP .B \-z --compress The complement to \-d: forces compression, regardless of the invocation name. .TP .B \-t --test Check integrity of the specified file(s), but don't decompress them. This really performs a trial decompression and throws away the result. .TP .B \-f --force Force overwrite of output files. Normally, .I bzip2 will not overwrite existing output files. Also forces .I bzip2 to break hard links to files, which it otherwise wouldn't do. bzip2 normally declines to decompress files which don't have the correct magic header bytes. If forced (-f), however, it will pass such files through unmodified. This is how GNU gzip behaves. .TP .B \-k --keep Keep (don't delete) input files during compression or decompression. .TP .B \-s --small Reduce memory usage, for compression, decompression and testing. Files are decompressed and tested using a modified algorithm which only requires 2.5 bytes per block byte. This means any file can be decompressed in 2300k of memory, albeit at about half the normal speed. During compression, \-s selects a block size of 200k, which limits memory use to around the same figure, at the expense of your compression ratio. In short, if your machine is low on memory (8 megabytes or less), use \-s for everything. See MEMORY MANAGEMENT below. .TP .B \-q --quiet Suppress non-essential warning messages. Messages pertaining to I/O errors and other critical events will not be suppressed. .TP .B \-v --verbose Verbose mode -- show the compression ratio for each file processed. Further \-v's increase the verbosity level, spewing out lots of information which is primarily of interest for diagnostic purposes. .TP .B \-L --license -V --version Display the software version, license terms and conditions. .TP .B \-1 (or \-\-fast) to \-9 (or \-\-best) Set the block size to 100 k, 200 k .. 900 k when compressing. Has no effect when decompressing. See MEMORY MANAGEMENT below. The \-\-fast and \-\-best aliases are primarily for GNU gzip compatibility. In particular, \-\-fast doesn't make things significantly faster. And \-\-best merely selects the default behaviour. .TP .B \-- Treats all subsequent arguments as file names, even if they start with a dash. This is so you can handle files with names beginning with a dash, for example: bzip2 \-- \-myfilename. .TP .B \--repetitive-fast --repetitive-best These flags are redundant in versions 0.9.5 and above. They provided some coarse control over the behaviour of the sorting algorithm in earlier versions, which was sometimes useful. 0.9.5 and above have an improved algorithm which renders these flags irrelevant. .SH MEMORY MANAGEMENT .I bzip2 compresses large files in blocks. The block size affects both the compression ratio achieved, and the amount of memory needed for compression and decompression. The flags \-1 through \-9 specify the block size to be 100,000 bytes through 900,000 bytes (the default) respectively. At decompression time, the block size used for compression is read from the header of the compressed file, and .I bunzip2 then allocates itself just enough memory to decompress the file. Since block sizes are stored in compressed files, it follows that the flags \-1 to \-9 are irrelevant to and so ignored during decompression. Compression and decompression requirements, in bytes, can be estimated as: Compression: 400k + ( 8 x block size ) Decompression: 100k + ( 4 x block size ), or 100k + ( 2.5 x block size ) Larger block sizes give rapidly diminishing marginal returns. Most of the compression comes from the first two or three hundred k of block size, a fact worth bearing in mind when using .I bzip2 on small machines. It is also important to appreciate that the decompression memory requirement is set at compression time by the choice of block size. For files compressed with the default 900k block size, .I bunzip2 will require about 3700 kbytes to decompress. To support decompression of any file on a 4 megabyte machine, .I bunzip2 has an option to decompress using approximately half this amount of memory, about 2300 kbytes. Decompression speed is also halved, so you should use this option only where necessary. The relevant flag is -s. In general, try and use the largest block size memory constraints allow, since that maximises the compression achieved. Compression and decompression speed are virtually unaffected by block size. Another significant point applies to files which fit in a single block -- that means most files you'd encounter using a large block size. The amount of real memory touched is proportional to the size of the file, since the file is smaller than a block. For example, compressing a file 20,000 bytes long with the flag -9 will cause the compressor to allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560 kbytes of it. Similarly, the decompressor will allocate 3700k but only touch 100k + 20000 * 4 = 180 kbytes. Here is a table which summarises the maximum memory usage for different block sizes. Also recorded is the total compressed size for 14 files of the Calgary Text Compression Corpus totalling 3,141,622 bytes. This column gives some feel for how compression varies with block size. These figures tend to understate the advantage of larger block sizes for larger files, since the Corpus is dominated by smaller files. Compress Decompress Decompress Corpus Flag usage usage -s usage Size -1 1200k 500k 350k 914704 -2 2000k 900k 600k 877703 -3 2800k 1300k 850k 860338 -4 3600k 1700k 1100k 846899 -5 4400k 2100k 1350k 845160 -6 5200k 2500k 1600k 838626 -7 6100k 2900k 1850k 834096 -8 6800k 3300k 2100k 828642 -9 7600k 3700k 2350k 828642 .SH RECOVERING DATA FROM DAMAGED FILES .I bzip2 compresses files in blocks, usually 900kbytes long. Each block is handled independently. If a media or transmission error causes a multi-block .bz2 file to become damaged, it may be possible to recover data from the undamaged blocks in the file. The compressed representation of each block is delimited by a 48-bit pattern, which makes it possible to find the block boundaries with reasonable certainty. Each block also carries its own 32-bit CRC, so damaged blocks can be distinguished from undamaged ones. .I bzip2recover is a simple program whose purpose is to search for blocks in .bz2 files, and write each block out into its own .bz2 file. You can then use .I bzip2 \-t to test the integrity of the resulting files, and decompress those which are undamaged. .I bzip2recover takes a single argument, the name of the damaged file, and writes a number of files "rec00001file.bz2", "rec00002file.bz2", etc, containing the extracted blocks. The output filenames are designed so that the use of wildcards in subsequent processing -- for example, "bzip2 -dc rec*file.bz2 > recovered_data" -- processes the files in the correct order. .I bzip2recover should be of most use dealing with large .bz2 files, as these will contain many blocks. It is clearly futile to use it on damaged single-block files, since a damaged block cannot be recovered. If you wish to minimise any potential data loss through media or transmission errors, you might consider compressing with a smaller block size. .SH PERFORMANCE NOTES The sorting phase of compression gathers together similar strings in the file. Because of this, files containing very long runs of repeated symbols, like "aabaabaabaab ..." (repeated several hundred times) may compress more slowly than normal. Versions 0.9.5 and above fare much better than previous versions in this respect. The ratio between worst-case and average-case compression time is in the region of 10:1. For previous versions, this figure was more like 100:1. You can use the \-vvvv option to monitor progress in great detail, if you want. Decompression speed is unaffected by these phenomena. .I bzip2 usually allocates several megabytes of memory to operate in, and then charges all over it in a fairly random fashion. This means that performance, both for compressing and decompressing, is largely determined by the speed at which your machine can service cache misses. Because of this, small changes to the code to reduce the miss rate have been observed to give disproportionately large performance improvements. I imagine .I bzip2 will perform best on machines with very large caches. .SH CAVEATS I/O error messages are not as helpful as they could be. .I bzip2 tries hard to detect I/O errors and exit cleanly, but the details of what the problem is sometimes seem rather misleading. This manual page pertains to version 1.0.6 of .I bzip2. Compressed data created by this version is entirely forwards and backwards compatible with the previous public releases, versions 0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and above, but with the following exception: 0.9.0 and above can correctly decompress multiple concatenated compressed files. 0.1pl2 cannot do this; it will stop after decompressing just the first file in the stream. .I bzip2recover versions prior to 1.0.2 used 32-bit integers to represent bit positions in compressed files, so they could not handle compressed files more than 512 megabytes long. Versions 1.0.2 and above use 64-bit ints on some platforms which support them (GNU supported targets, and Windows). To establish whether or not bzip2recover was built with such a limitation, run it without arguments. In any event you can build yourself an unlimited version if you can recompile it with MaybeUInt64 set to be an unsigned 64-bit integer. .SH AUTHOR Julian Seward, jsewardbzip.org. http://www.bzip.org The ideas embodied in .I bzip2 are due to (at least) the following people: Michael Burrows and David Wheeler (for the block sorting transformation), David Wheeler (again, for the Huffman coder), Peter Fenwick (for the structured coding model in the original .I bzip, and many refinements), and Alistair Moffat, Radford Neal and Ian Witten (for the arithmetic coder in the original .I bzip). I am much indebted for their help, support and advice. See the manual in the source distribution for pointers to sources of documentation. Christian von Roques encouraged me to look for faster sorting algorithms, so as to speed up compression. Bela Lubkin encouraged me to improve the worst-case compression performance. Donna Robinson XMLised the documentation. The bz* scripts are derived from those of GNU gzip. Many people sent patches, helped with portability problems, lent machines, gave advice and were generally helpful. Index: projects/arm_intrng/contrib/bzip2 =================================================================== --- projects/arm_intrng/contrib/bzip2 (revision 276247) +++ projects/arm_intrng/contrib/bzip2 (revision 276248) Property changes on: projects/arm_intrng/contrib/bzip2 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/contrib/bzip2:r269787-276247 Index: projects/arm_intrng/contrib/ee/ee.1 =================================================================== --- projects/arm_intrng/contrib/ee/ee.1 (revision 276247) +++ projects/arm_intrng/contrib/ee/ee.1 (revision 276248) @@ -1,543 +1,543 @@ .\" .\" .\" To format this reference page, use the command: .\" .\" nroff -man ee.1 .\" .\" $Header: /home/hugh/sources/old_ae/RCS/ee.1,v 1.22 2001/12/16 04:49:27 hugh Exp $ .\" .\" -.TH ee 1 "" "" "" "" +.TH ee 1 "" "" "" .SH NAME ee \- easy editor .SH SYNOPSIS .nf ee [-e] [-i] [-h] [+#] [\fIfile\fR ...] ree [-e] [-i] [-h] [+#] [\fIfile\fR ...] .ta .fi .ad b .SH DESCRIPTION The command .I ee is a simple screen oriented text editor. It is always in text insertion mode unless there is a prompt at the bottom of the terminal, or a menu present (in a box in the middle of the terminal). The command .I ree is the same as .I ee, but restricted to editing the named file (no file operations, or shell escapes are allowed). .PP An editor with similar user-friendly qualities but more features is available and is called .I aee. .PP For .I ee to work properly, the environment variable .SM TERM must be set to indicate the type of terminal being used. For example, for an .SM HP 700/92 terminal, the .SM TERM variable should be set to "70092". See your System Administrator if you need more information. .\" .\" options .\" .SS Options The following options are available from the command line: .PP .TP 4 .B -e Turns off expansion of tab character to spaces. .TP .B -i Turns off display of information window at top of terminal. .TP .B -h Turns off highlighting of borders of windows and menus (improves performance on some terminals). .TP .B +# Moves the cursor to line '#' at startup. .br .\" .\" control keys .\" .SS "Control keys" To do anything other than insert text, the user must use the control keys (the .B Control key, represented by a "^", pressed in conjunction with an alphabetic key, e.g., ^a) and function keys available on the keyboard (such as .BR "Next Page" ", " "Prev Page" , arrow keys, etc.). .PP Since not all terminals have function keys, .I ee has the basic cursor movement functions assigned to control keys as well as more intuitive keys on the keyboard when available. For instance, to move the cursor up, the user can use the up arrow key, or .BR ^u . .RS 4 .nf .ta 1.4i .sp ^a Prompt for the decimal value of a character to insert. ^b Move to the bottom of the text. ^c Get the prompt for a command. ^d Move the cursor down. ^e Prompt for the string to search for. ^f Undelete the last deleted character. ^g Move to the beginning of the line. ^h Backspace. ^i Tab. ^j Insert a newline. ^k Delete the character the cursor is sitting on. ^l Move the cursor left. ^m Insert a newline. ^n Move to the next page. ^o Move to the end of the line. ^p Move to the previous page. ^r Move the cursor to the right. ^t Move to the top of the text. ^u Move the cursor up. ^v Undelete the last deleted word. ^w Delete the word beginning at the cursor position. ^x Search. ^y Delete from the cursor position to the end of line. ^z Undelete the last deleted line. ^[ (ESC) Pop up menu. .ta .fi .RE .sp .SS "EMACS keys mode" .PP Since many shells provide an Emacs mode (for cursor movement and other editing operations), some bindings that may be more useful for people familiar with those bindings have been provided. These are accessible via the .B settings menu, or via the initialization file (see below). The mappings are as follows: .RS .nf .ta 1.4i ^a Move to the beginning of the line. ^b Back 1 character. ^c Command prompt. ^d Delete character the cursor is sitting on. ^e End of line. ^f Forward 1 character. ^g Go back 1 page. ^h Backspace. ^i Tab. ^j Undelete last deleted character. ^k Delete line. ^l Undelete last deleted line. ^m Insert a newline. ^n Move to the next line. ^o Prompt for the decimal value of a character to insert. ^p Previous line. ^r Restore last deleted word. ^t Move to the top of the text. ^u Move to the bottom of the text. ^v Move to the next page. ^w Delete the word beginning at the cursor position. ^y Prompt for the string to search for. ^z Next word. ^[ (ESC) Pop up menu. .ta .fi .RE .sp .\" .\" function keys .\" .SS "Function Keys" .RS 4 .IP "\fBNext Page\fR" Move to the next page. .IP "\fBPrev Page\fR" Move to the previous page. .IP "\fBDelete Char\fR" Delete the character the cursor is on. .IP "\fBDelete Line\fR" Delete from the cursor to the end of line. .IP "\fBInsert line\fR" Insert a newline at the cursor position. .IP "\fBArrow keys\fR" Move the cursor in the direction indicated. .RE .\" .\" commands .\" .SS Commands .PP Some operations require more information than a single keystroke can provide. For the most basic operations, there is a menu that can be obtained by pressing the .SM \fBESC\fR key. The same operations, and more can be performed by obtaining the command prompt (^c) and typing in one of the commands below. .RS 4 .IP "!\fBcmd\fR" Execute \fBcmd\fR in a shell. .IP "\fB0-9\fR" Move to the line indicated. .IP "\fBcase\fR" Make searches case sensitive. .IP "\fBcharacter\fR" Display the ascii value of the character at the cursor. .IP "\fBexit\fR" Save the edited text, and leave the editor. .IP "\fBexpand\fR" Expand tabs to spaces. .IP "\fBfile\fR" Print the name of the file. .IP "\fBhelp\fR" Display help screen. .IP "\fBline\fR" Display the current line number. .IP "\fBnocase\fR Make searches insensitive to case (the default). .IP "\fBnoexpand\fR" Don't expand tab to spaces when the TAB key is pressed. .IP "\fBquit\fR" Leave the editor without saving changes. .IP "\fBread\fR \fIfile\fR" Read the named \fIfile\fR. .IP "\fBwrite\fR \fIfile\fR" Write the text to the named \fIfile\fR. .RE .\" .\" menu operations .\" .SS "Menu Operations" .PP Pop-up menus can be obtained by pressing the .B escape key (or .B ^[ if no .B escape key is present). When in the menu, the escape key can be used to leave the menu without performing any operations. Use the up and down arrow keys, or .B ^u for moving up and .B ^d for moving down to move to the desired items in the menu, then press .B return to perform the indicated task. .PP To the left of each menu item is a letter, which if the corresponding letter is pressed on the keyboard selects that menu entry. .PP The main menu in \fIee\fR is as follows: .RS 4 .IP "\fBleave editor\fR" If changes have been made, the user will get a menu prompting whether or not the changes should be saved. .IP "\fBhelp\fR" Displays a help screen, with all of the keyboard operations and commands. .IP "\fBfile operations\fR" Pops up a menu for selecting whether to read a file, write to a file, or save the current contents of the editor, as well as send the contents of the editor to a print command (see the section \fBInitializing ee from a file\fR). .IP "\fBredraw screen\fR" Provides a means to repaint the screen if the screen has been corrupted. .IP "\fBsettings\fR" Shows the current values of the operating modes, and right margin. By pressing return when the cursor is on a particular item, the value can be changed. To leave this menu, press the \fBescape\fR key. (See \fBModes\fR below.) .IP "\fBsearch\fR" .br Pops up a menu in which the user may choose to enter a string to search for, or search for a string already entered. .IP "\fBmiscellaneous\fR" Pops up a menu that allows the user to format the current paragraph, execute a shell command, or check the spelling of the text in the editor. .RE .\" .\" paragraph formatting .\" .SS "Paragraph Formatting" .PP Paragraphs are defined for \fIee\fR by a block of text bounded by: .sp .RS 8 .IP \(bu Begin or end of file. .IP \(bu Line with no characters, or only spaces and/or tabs. .IP \(bu Line starting with a period ('.') or right angle bracket ('>'). .RE .PP A paragraph may be formatted two ways: explicitly by choosing the \fBformat paragraph\fR menu item, or by setting \fIee\fR to automatically format paragraphs. The automatic mode may be set via a menu, or via the initialization file. .PP There are three states for text operation in \fIee\fR: free-form, margins, and automatic formatting. .PP "Free-form" is best used for things like programming. There are no restrictions on the length of lines, and no formatting takes place. .PP "Margins" allows the user to type in text without having to worry about going beyond the right margin (the right margin may be set in the \fBsettings\fR menu, the default is for the margin to be the right edge of the terminal). This is the mode that allows the \fBformat paragraph\fR menu item to work. .PP "Automatic formatting" provides word-processor-like behavior. The user may type in text, while \fIee\fR will make sure the entire paragraph fits within the width of the terminal every time the user inserts a space after typing or deleting text. Margin observation must also be enabled in order for automatic formatting to occur. .\" .\" modes .\" .SS Modes .PP Although ee is a 'modeless' editor (it is in text insertion mode all the time), there are modes in some of the things it does. These include: .RS 4 .IP "\fBtab expansion\fR" Tabs may be inserted as a single tab character, or replaced with spaces. .IP "\fBcase sensitivity\fR" The search operation can be sensitive to whether characters are upper- or lower-case, or ignore case completely. .IP "\fBmargins observed\fR" Lines can either be truncated at the right margin, or extend on forever. .IP "\fBauto paragraph formatting\fR" While typing in text, the editor can try to keep it looking reasonably well within the width of the screen. .IP "\fBeightbit characters\fR" Toggles whether eight bit characters are displayed as their value in angle brackets (e.g. "<220>") or as a character. .IP "\fBinfo window\fR" A window showing the keyboard operations that can be performed can be displayed or not. .IP "\fBemacs keys\fR" Control keys may be given bindings similar to emacs, or not. .IP "\f16 bit characters\fR" Toggles whether sixteen bit characters are handled as one 16-bit quantities or two 8-bit quantities. This works primarily with the Chinese Big 5 code set. .RE .PP You may set these modes via the initialization file (see below), or with a menu (see above). .\" .\" spell checking .\" .SS "Spell Checking" .PP There are two ways to have the spelling in the text checked from \fIee\fR. One is by the traditional \fIspell\fR(1) command, the other is with the optional \fIispell\fR(1) command. .PP Using \fIspell\fR, the words that are not recognized will be placed at the top of the file. For the \fIispell\fR option, the file is written to disk, then \fIispell\fR run on the file, and the file read back in once \fIispell\fR has completed making changes to the file. .\" .\" printing .\" .SS "Printing the contents of the editor" .PP The user may select a menu item which prints the contents of the editor. .I ee pipes the text in the editor to the command specified by the initialization command .B printcommand (see the section .B Initializing ee from a file below). The default is to send the contents to "lp". .PP Whatever the user assigns to .B printcommand must take input from standard input. See your system administrator for more details. .\" .\" shell operations .\" .SS "Shell operations" .PP Shell commands can be executed from within .I ee by selecting the .B shell command item in the .B miscellaneous menu, or by placing an exclamation mark ("!") before the command to execute at the .B command: prompt. Additionally, the user may direct the contents of the edit buffer out to a shell operation (via a pipe) by using the left angle bracket (">"), followed by a "!" and the shell command to execute. The output of a shell operation can also be directed into the edit buffer by using a right angle bracket ("<") before the exclamation mark. These can even be used together to send output to a shell operation and read back the results into the editor. So, if the editor contained a list of words to be sorted, they could be sorted by typing the following at the command prompt: .RS 4 .sp >"). .IP \fB16bit\fR Turns on handling of 16-bit characters. .IP \fbno16bit\fR Turns off handling of 16-bit characters. .IP \fBemacs\fR Turns on emacs key bindings. .IP \fBnoemacs\fR Turns off emacs key bindings. .RE .\" .\" save editor configuration .\" .SS "Save Editor Configuration" .PP When using this entry from the .B settings menu, the user may choose to save the current configuration of the editor (see \fBInitializing ee from a file\fR above) to a file named .I .init.ee in the current directory or the user's home directory. If a file named .I .init.ee already exists, it will be renamed .IR .init.ee.old . .\" .\" Caveats .\" .SH CAVEATS .PP THIS MATERIAL IS PROVIDED "AS IS". THERE ARE NO WARRANTIES OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Neither Hewlett-Packard nor Hugh Mahon shall be liable for errors contained herein, nor for incidental or consequential damages in connection with the furnishing, performance or use of this material. Neither Hewlett-Packard nor Hugh Mahon assumes any responsibility for the use or reliability of this software or documentation. This software and documentation is totally UNSUPPORTED. There is no support contract available. Hewlett-Packard has done NO Quality Assurance on ANY of the program or documentation. You may find the quality of the materials inferior to supported materials. .PP Always make a copy of files that cannot be easily reproduced before editing. Save files early, and save often. .SS "International Code Set Support" .I ee supports single-byte character code sets (eight-bit clean), or the Chinese Big-5 code set. (Other multi-byte code sets may function, but the reason Big-5 works is that a two-byte character also takes up two columns on the screen.) .SH WARNINGS The automatic paragraph formatting operation may be too slow for slower systems. .SH FILES .PP .I /usr/share/misc/init.ee .br .I $HOME/.init.ee .br .I .init.ee .SH AUTHOR .PP The software .I ee was developed by Hugh Mahon. .PP This software and documentation contains proprietary information which is protected by copyright. All rights are reserved. .PP Copyright (c) 1990, 1991, 1992, 1993, 1995, 1996, 2001 Hugh Mahon. .SH "SEE ALSO" .PP termcap(4), terminfo(4), environ(5), spell(1), ispell(1), lp(1), aee(1) Index: projects/arm_intrng/contrib/ee =================================================================== --- projects/arm_intrng/contrib/ee (revision 276247) +++ projects/arm_intrng/contrib/ee (revision 276248) Property changes on: projects/arm_intrng/contrib/ee ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head/contrib/ee:r269787-276247 Index: projects/arm_intrng/contrib/mdocml/INSTALL =================================================================== --- projects/arm_intrng/contrib/mdocml/INSTALL (revision 276247) +++ projects/arm_intrng/contrib/mdocml/INSTALL (revision 276248) @@ -1,188 +1,217 @@ -$Id: INSTALL,v 1.5 2014/08/18 13:27:47 kristaps Exp $ +$Id: INSTALL,v 1.9 2014/12/11 07:44:46 schwarze Exp $ About mdocml, the portable mandoc distribution ---------------------------------------------- The mandoc manpage compiler toolset is a suite of tools compiling mdoc(7), the roff(7) macro language of choice for BSD manual pages, and man(7), the predominant historical language for UNIX manuals. -The toolset does not yet implement man(1); that is only scheduled -for the next release, 1.13.2. It can, however, already serve to -translate source manpages to the output displayed by man(1). +Since the present version 1.13.2, it includes a man(1) manual viewer +in addition to the apropos(1) manual page search tool. For general information, see . In this document, we describe the installation and deployment of mandoc(1), first as a simple, standalone formatter, and then as part of the man(1) system. In case you have questions or want to provide feedback, read . Consider subscribing to the discuss@ mailing list mentioned on that page. If you intend to help with the development of mandoc, consider subscribing to the tech@ mailing list, too. Enjoy using the mandoc toolset! -Ingo Schwarze, Karlsruhe, August 2014 +Ingo Schwarze, Karlsruhe, December 2014 Installation ------------ Before manually installing mandoc on your system, please check whether the newest version of mandoc is already installed by default or available via a binary package or a ports system. A list of the latest bundled and ported versions of mandoc for various operating systems is maintained at . If mandoc is installed, you can check the version by running "mandoc -V". You can find the version contained in this distribution tarball by running "./configure". Regarding how packages and ports are maintained for your operating system, please consult your operating system documentation. To install mandoc manually, the following steps are needed: 1. If you want to build the CGI program, man.cgi(8), too, run the command "echo BUILD_CGI=1 > configure.local". Then run "cp cgi.h.examples cgi.h" and edit cgi.h as desired. 2. Run "./configure". This script attempts autoconfiguration of mandoc for your system. Read both its standard output and the file "Makefile.local" it generates. If anything looks wrong or different from what you wish, read the file "configure.local.example", create and edit a file "configure.local", and re-run "./configure" until the result seems right to you. 3. Run "make". Any POSIX-compatible make, in particular both BSD make and GNU make, should work. If the build fails, look at "configure.local.example" and go back to step 2. 4. Run "make -n install" and check whether everything will be -installed to the intended places. Otherwise, put some *DIR variables -into "configure.local" and go back to step 2. +installed to the intended places. Otherwise, put some *DIR or *NM* +variables into "configure.local" and go back to step 2. 5. Run "sudo make install". If you intend to build a binary package using some kind of fake root mechanism, you may need a command like "make DESTDIR=... install". Read the *-install targets in the "Makefile" to understand how DESTDIR is used. 6. To set up a man.cgi(8) server, read its manual page. 7. To use mandoc(1) as your man(1) formatter, read the "Deployment" -section below. +sections below. Understanding mandoc dependencies --------------------------------- -The mandoc(1), preconv(1), and demandoc(1) utilities have no external -dependencies. However, makewhatis(8) and apropos(1) depend on the -following software: +The mandoc(1) and demandoc(1) utilities have no external dependencies. +However, makewhatis(8), apropos(1), and man(1) depend on the following +software: 1. The SQLite database system, see . The recommended version of SQLite is 3.8.4.3 or newer. The mandoc toolset is known to work with version 3.7.5 or newer. Versions older than 3.8.3 may not achieve full performance due to the missing SQLITE_DETERMINISTIC optimization flag. Versions older than 3.8.0 may not show full error information if opening a database fails due to the missing sqlite3_errstr() API. Both are very minor problems, apropos(1) is fully usable with SQLite 3.7.5. Versions older than 3.7.5 may or may not work, they have not been tested. -1.2. The fts(3) directory traversion functions. +2. The fts(3) directory traversion functions. If your system does not have them, the bundled compatibility version will be used, so you need not worry in that case. But be careful: the glibc version of fts(3) is known to be broken on 32bit platforms, see . If you run into that problem, set "HAVE_FTS=0" in configure.local. -1.3. Marc Espie's ohash(3) library. +3. Marc Espie's ohash(3) library. If your system does not have it, the bundled compatibility version will be used, so you probably need not worry about it. Checking autoconfiguration quality ---------------------------------- If you want to check whether automatic configuration works well on your platform, consider the following: The mandoc package intentionally does not use GNU autoconf because we consider that toolset a blatant example of overengineering that is obsolete nowadays, since all modern operating systems are now reasonably close to POSIX and do not need arcane shell magic any longer. If your system does need such magic, consider upgrading to reasonably modern POSIX-compliant tools rather than asking for autoconf-style workarounds. As far as mandoc is using any features not mandated by ANSI X3.159-1989 ("ANSI C") or IEEE Std 1003.1-2008 ("POSIX") that some modern systems do not have, we intend to provide autoconfiguration tests and compat_*.c implementations. Please report any that turn out to be missing. Note that while we do strive to produce portable code, we do not slavishly restrict ourselves to POSIX-only interfaces. For improved security and readability, we do use well-designed, modern interfaces like reallocarray(3) even if they are still rather uncommon, of course bundling compat_*.c implementations as needed. Where mandoc is using ANSI C or POSIX features that some systems still lack and that compat_*.c implementations can be provided for without too much hassle, we will consider adding them, too, so please report whatever is missing on your platform. The following steps can be used to manually check the automatic configuration on your platform: 1. Run "make distclean". 2. Run "./configure" 3. Read the file "config.log". It shows the compiler commands used to test the libraries installed on your system and the standard output and standard error output these commands produce. Watch out for unexpected failures. Those are most likely to happen if headers or libraries are installed in unusual places or interfaces defined in unusual headers. You can also look at the file "config.h" and check that no "#define HAVE_*" differ from your expectations. -Deployment ----------- -If you want to integrate the mandoc(1) tools with your existing -man(1) system as a formatter, then contact us first: on systems without -mandoc(1) as the default, you may have your work cut out for you! +Deployment using the integrated man(1) viewer +--------------------------------------------- +This mode of deployment requires database support. In case of +doubt, look at the section "user settings related to database +support" in the file configure.local.example. + +Deployment requires the following steps: + +1. Build and install mandoc as described above in steps 2 to 5 +below "Installation". + +2. If your system uses manpath(1), make sure it is configured +correctly, in particular, it returns all directory trees where +manual pages are installed. If your system uses man.conf(5), make +sure it contains a "_whatdb" line for each directory tree, and the +order of these lines meets your wishes. + +3. Run the command "sudo makewhatis" to build mandoc.db(5) databases +in all the directory trees configured in step 2. + +At this point, your new man(1), apropos(1), and whatis(1) should work. +Otherwise, please look at , both +for help and to have these instructions improved. + +Whenever installing new manual pages, re-run makewhatis(8) to update +the databases, or man(1) will not find the new pages. + + +Deployment using your system's native man(1) viewer +--------------------------------------------------- +This mode of deployment does not require database support, +so it works even if you don't have SQLite3. + Usually, you can have your default installation and mandoc(1) work right alongside each other by using user-specific versions of the files mentioned below. 0. Back up each file you want to change! 1. First see whether your system has "/etc/man.conf" or "/etc/manpath.conf" (if it has neither, but man(1) is functional, then let us know) or, if running as your own user, a per-user override file. In either case, find where man(1) is executing nroff(1) or groff(1) to format manuals. Replace these calls with mandoc(1). 2. Then make sure that man(1) isn't running preprocessors, so you may need to replace tbl(1), eqn(1), and similar references with cat(1). Some man(1) implementations, like that on Mac OSX, let you run "man -d" to see how the formatter is invoked. Use this to test your changes. On Mac OS X, for instance, man(1) will prepend all files with ".ll" and ".nr" to set the terminal size, so you need to pass "tail -n+2 | mandoc(1)" to disregard them. 3. Finally, make sure that mandoc(1) is actually being invoked instead of cached pages being pulled up. You can usually do this by commenting out NOCACHE or similar. + mandoc(1) still has a long way to go in understanding non-trivial low-level roff(7) markup embedded in some man(7) pages. On the BSD systems using mandoc(1), third-party software is generally vetted on whether it may be formatted with mandoc(1). If not, groff(1) is pulled in as a dependency and used to install a pre-formatted -"catpage" intead of directly as manual page source. +"catpage" instead of directly as manual page source. For more background on switching operating systems to use mandoc(1) -instead of groff(1) to format manuals, see the two BSDCan presentations -by Ingo Schwarze: +instead of groff(1) to format manuals, see the BSDCan and EuroBSDCon +presentations by Ingo Schwarze: + Index: projects/arm_intrng/contrib/mdocml/LICENSE =================================================================== --- projects/arm_intrng/contrib/mdocml/LICENSE (revision 276247) +++ projects/arm_intrng/contrib/mdocml/LICENSE (revision 276248) @@ -1,46 +1,46 @@ -$Id: LICENSE,v 1.4 2014/08/21 00:42:38 schwarze Exp $ +$Id: LICENSE,v 1.5 2014/12/11 07:56:24 schwarze Exp $ With the exceptions noted below, all code and documentation contained in the mdocml toolkit is protected by the Copyright of the following developers: -Copyright (c) 2008, 2009, 2010, 2011, 2012 Kristaps Dzonsons +Copyright (c) 2008-2012, 2014 Kristaps Dzonsons Copyright (c) 2010, 2011, 2012, 2013, 2014 Ingo Schwarze Copyright (c) 2009, 2010, 2011, 2012 Joerg Sonnenberger Copyright (c) 2013 Franco Fichtner Copyright (c) 1999, 2004 Marc Espie Copyright (c) 1998, 2010 Todd C. Miller Copyright (c) 2008 Otto Moerbeek -Copyright (c) 2003 Jason McIntyre +Copyright (c) 2003, 2007, 2008, 2014 Jason McIntyre See the individual source files for information about who contributed to which file during which years. The mdocml distribution as a whole is distributed by its developers under the following license: Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. The following files included from outside sources are protected by other people's Copyright and are distributed under a 3-clause BSD license; see these individual files for details. compat_fts.c, compat_fts.h, compat_getsubopt.c, compat_strcasestr.c, compat_strsep.c, man.1: Copyright (c) 1989,1990,1993,1994 The Regents of the University of California compat_fgetln.c: Copyright (c) 1998 The NetBSD Foundation, Inc. Index: projects/arm_intrng/contrib/mdocml/Makefile =================================================================== --- projects/arm_intrng/contrib/mdocml/Makefile (revision 276247) +++ projects/arm_intrng/contrib/mdocml/Makefile (revision 276248) @@ -1,407 +1,414 @@ -# $Id: Makefile,v 1.448 2014/11/28 18:57:31 schwarze Exp $ +# $Id: Makefile,v 1.453 2014/12/09 09:14:33 schwarze Exp $ # # Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons # Copyright (c) 2011, 2013, 2014 Ingo Schwarze # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -BASEBIN = mandoc demandoc -DBBIN = makewhatis -CGIBIN = man.cgi +# === LIST OF FILES ==================================================== TESTSRCS = test-dirent-namlen.c \ test-fgetln.c \ test-fts.c \ test-getsubopt.c \ test-mmap.c \ test-ohash.c \ test-reallocarray.c \ test-sqlite3.c \ test-sqlite3_errstr.c \ test-strcasestr.c \ test-strlcat.c \ test-strlcpy.c \ test-strptime.c \ test-strsep.c \ test-wchar.c SRCS = att.c \ cgi.c \ chars.c \ compat_fgetln.c \ compat_fts.c \ compat_getsubopt.c \ compat_ohash.c \ compat_reallocarray.c \ compat_sqlite3_errstr.c \ compat_strcasestr.c \ compat_strlcat.c \ compat_strlcpy.c \ compat_strsep.c \ demandoc.c \ eqn.c \ eqn_html.c \ eqn_term.c \ html.c \ lib.c \ main.c \ man.c \ man_hash.c \ man_html.c \ man_macro.c \ man_term.c \ man_validate.c \ mandoc.c \ mandoc_aux.c \ mandocdb.c \ manpage.c \ manpath.c \ mansearch.c \ mansearch_const.c \ mdoc.c \ mdoc_argv.c \ mdoc_hash.c \ mdoc_html.c \ mdoc_macro.c \ mdoc_man.c \ mdoc_term.c \ mdoc_validate.c \ msec.c \ out.c \ preconv.c \ read.c \ roff.c \ st.c \ tbl.c \ tbl_data.c \ tbl_html.c \ tbl_layout.c \ tbl_opts.c \ tbl_term.c \ term.c \ term_ascii.c \ term_ps.c \ tree.c \ $(TESTSRCS) DISTFILES = INSTALL \ LICENSE \ Makefile \ Makefile.depend \ NEWS \ TODO \ apropos.1 \ cgi.h.example \ chars.in \ compat_fts.h \ compat_ohash.h \ configure \ configure.local.example \ demandoc.1 \ eqn.7 \ example.style.css \ gmdiff \ html.h \ lib.in \ libman.h \ libmandoc.h \ libmdoc.h \ libroff.h \ main.h \ makewhatis.8 \ man-cgi.css \ man.1 \ man.7 \ man.cgi.8 \ man.h \ mandoc.1 \ mandoc.3 \ mandoc.db.5 \ mandoc.h \ mandoc_aux.h \ mandoc_char.7 \ mandoc_escape.3 \ + mandoc_headers.3 \ mandoc_html.3 \ mandoc_malloc.3 \ manpath.h \ mansearch.3 \ mansearch.h \ mchars_alloc.3 \ mdoc.7 \ mdoc.h \ msec.in \ out.h \ predefs.in \ roff.7 \ st.in \ style.css \ tbl.3 \ tbl.7 \ term.h \ $(SRCS) LIBMAN_OBJS = man.o \ man_hash.o \ man_macro.o \ man_validate.o LIBMDOC_OBJS = att.o \ lib.o \ mdoc.o \ mdoc_argv.o \ mdoc_hash.o \ mdoc_macro.o \ mdoc_validate.o \ st.o LIBROFF_OBJS = eqn.o \ roff.o \ tbl.o \ tbl_data.o \ tbl_layout.o \ tbl_opts.o LIBMANDOC_OBJS = $(LIBMAN_OBJS) \ $(LIBMDOC_OBJS) \ $(LIBROFF_OBJS) \ chars.o \ mandoc.o \ mandoc_aux.o \ msec.o \ preconv.o \ read.o COMPAT_OBJS = compat_fgetln.o \ compat_fts.o \ compat_getsubopt.o \ compat_ohash.o \ compat_reallocarray.o \ compat_sqlite3_errstr.o \ compat_strcasestr.o \ compat_strlcat.o \ compat_strlcpy.o \ compat_strsep.o MANDOC_HTML_OBJS = eqn_html.o \ html.o \ man_html.o \ mdoc_html.o \ tbl_html.o MANDOC_MAN_OBJS = mdoc_man.o MANDOC_TERM_OBJS = eqn_term.o \ man_term.o \ mdoc_term.o \ term.o \ term_ascii.o \ term_ps.o \ tbl_term.o -MANDOC_OBJS = $(MANDOC_HTML_OBJS) \ +BASE_OBJS = $(MANDOC_HTML_OBJS) \ $(MANDOC_MAN_OBJS) \ $(MANDOC_TERM_OBJS) \ main.o \ out.o \ tree.o -MAN_OBJS = $(MANDOC_OBJS) +MAIN_OBJS = $(BASE_OBJS) -MAKEWHATIS_OBJS = mandocdb.o mansearch_const.o manpath.o +DB_OBJS = mandocdb.o \ + mansearch.o \ + mansearch_const.o \ + manpath.o -APROPOS_OBJS = mansearch.o mansearch_const.o manpath.o - CGI_OBJS = $(MANDOC_HTML_OBJS) \ cgi.o \ mansearch.o \ mansearch_const.o \ out.o MANPAGE_OBJS = manpage.o mansearch.o mansearch_const.o manpath.o DEMANDOC_OBJS = demandoc.o WWW_MANS = apropos.1.html \ demandoc.1.html \ man.1.html \ mandoc.1.html \ mandoc.3.html \ mandoc_escape.3.html \ + mandoc_headers.3.html \ mandoc_html.3.html \ mandoc_malloc.3.html \ mansearch.3.html \ mchars_alloc.3.html \ tbl.3.html \ mandoc.db.5.html \ eqn.7.html \ man.7.html \ mandoc_char.7.html \ mdoc.7.html \ roff.7.html \ tbl.7.html \ makewhatis.8.html \ man.cgi.8.html \ man.h.html \ mandoc.h.html \ mandoc_aux.h.html \ manpath.h.html \ mansearch.h.html \ mdoc.h.html WWW_OBJS = mdocml.tar.gz \ mdocml.sha256 +# === USER CONFIGURATION =============================================== + include Makefile.local -INSTALL_TARGETS = $(BUILD_TARGETS:-build=-install) - # === DEPENDENCY HANDLING ============================================== all: base-build $(BUILD_TARGETS) Makefile.local -base-build: $(BASEBIN) +base-build: mandoc demandoc -db-build: $(DBBIN) +cgi-build: man.cgi -cgi-build: $(CGIBIN) - install: base-install $(INSTALL_TARGETS) www: $(WWW_OBJS) $(WWW_MANS) $(WWW_MANS): mandoc +.PHONY: base-install cgi-install db-install install www-install +.PHONY: clean distclean depend + include Makefile.depend # === TARGETS CONTAINING SHELL COMMANDS ================================ distclean: clean rm -f Makefile.local config.h config.h.old config.log config.log.old clean: rm -f libmandoc.a $(LIBMANDOC_OBJS) $(COMPAT_OBJS) - rm -f mandoc $(MANDOC_OBJS) $(APROPOS_OBJS) - rm -f makewhatis $(MAKEWHATIS_OBJS) + rm -f mandoc $(BASE_OBJS) $(DB_OBJS) rm -f man.cgi $(CGI_OBJS) rm -f manpage $(MANPAGE_OBJS) rm -f demandoc $(DEMANDOC_OBJS) rm -f $(WWW_MANS) $(WWW_OBJS) rm -rf *.dSYM base-install: base-build mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(EXAMPLEDIR) mkdir -p $(DESTDIR)$(LIBDIR) mkdir -p $(DESTDIR)$(INCLUDEDIR) mkdir -p $(DESTDIR)$(MANDIR)/man1 mkdir -p $(DESTDIR)$(MANDIR)/man3 mkdir -p $(DESTDIR)$(MANDIR)/man7 - $(INSTALL_PROGRAM) $(BASEBIN) $(DESTDIR)$(BINDIR) + $(INSTALL_PROGRAM) mandoc demandoc $(DESTDIR)$(BINDIR) $(INSTALL_LIB) libmandoc.a $(DESTDIR)$(LIBDIR) $(INSTALL_LIB) man.h mandoc.h mandoc_aux.h mdoc.h \ $(DESTDIR)$(INCLUDEDIR) - $(INSTALL_MAN) man.1 mandoc.1 demandoc.1 \ - $(DESTDIR)$(MANDIR)/man1 + $(INSTALL_MAN) mandoc.1 demandoc.1 $(DESTDIR)$(MANDIR)/man1 $(INSTALL_MAN) mandoc.3 mandoc_escape.3 mandoc_malloc.3 \ mchars_alloc.3 tbl.3 $(DESTDIR)$(MANDIR)/man3 - $(INSTALL_MAN) man.7 mdoc.7 roff.7 eqn.7 tbl.7 mandoc_char.7 \ - $(DESTDIR)$(MANDIR)/man7 + $(INSTALL_MAN) man.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MAN}.7 + $(INSTALL_MAN) mdoc.7 $(DESTDIR)$(MANDIR)/man7/${MANM_MDOC}.7 + $(INSTALL_MAN) roff.7 $(DESTDIR)$(MANDIR)/man7/${MANM_ROFF}.7 + $(INSTALL_MAN) eqn.7 $(DESTDIR)$(MANDIR)/man7/${MANM_EQN}.7 + $(INSTALL_MAN) tbl.7 $(DESTDIR)$(MANDIR)/man7/${MANM_TBL}.7 + $(INSTALL_MAN) mandoc_char.7 $(DESTDIR)$(MANDIR)/man7 $(INSTALL_DATA) example.style.css $(DESTDIR)$(EXAMPLEDIR) -db-install: db-build +db-install: base-build mkdir -p $(DESTDIR)$(BINDIR) mkdir -p $(DESTDIR)$(SBINDIR) mkdir -p $(DESTDIR)$(MANDIR)/man1 mkdir -p $(DESTDIR)$(MANDIR)/man3 mkdir -p $(DESTDIR)$(MANDIR)/man5 mkdir -p $(DESTDIR)$(MANDIR)/man8 - ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/apropos - ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/whatis - $(INSTALL_PROGRAM) makewhatis $(DESTDIR)$(SBINDIR) - $(INSTALL_MAN) apropos.1 $(DESTDIR)$(MANDIR)/man1 - ln -f $(DESTDIR)$(MANDIR)/man1/apropos.1 \ - $(DESTDIR)$(MANDIR)/man1/whatis.1 + ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_APROPOS) + ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_MAN) + ln -f $(DESTDIR)$(BINDIR)/mandoc $(DESTDIR)$(BINDIR)/$(BINM_WHATIS) + ln -f $(DESTDIR)$(BINDIR)/mandoc \ + $(DESTDIR)$(SBINDIR)/$(BINM_MAKEWHATIS) + $(INSTALL_MAN) apropos.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1 + $(INSTALL_MAN) man.1 $(DESTDIR)$(MANDIR)/man1/$(BINM_MAN).1 + ln -f $(DESTDIR)$(MANDIR)/man1/$(BINM_APROPOS).1 \ + $(DESTDIR)$(MANDIR)/man1/$(BINM_WHATIS).1 $(INSTALL_MAN) mansearch.3 $(DESTDIR)$(MANDIR)/man3 $(INSTALL_MAN) mandoc.db.5 $(DESTDIR)$(MANDIR)/man5 - $(INSTALL_MAN) makewhatis.8 $(DESTDIR)$(MANDIR)/man8 + $(INSTALL_MAN) makewhatis.8 \ + $(DESTDIR)$(MANDIR)/man8/$(BINM_MAKEWHATIS).8 cgi-install: cgi-build mkdir -p $(DESTDIR)$(CGIBINDIR) mkdir -p $(DESTDIR)$(HTDOCDIR) mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1 mkdir -p $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8 $(INSTALL_PROGRAM) man.cgi $(DESTDIR)$(CGIBINDIR) $(INSTALL_DATA) example.style.css $(DESTDIR)$(HTDOCDIR)/man.css $(INSTALL_DATA) man-cgi.css $(DESTDIR)$(HTDOCDIR) $(INSTALL_MAN) apropos.1 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man1/ $(INSTALL_MAN) man.cgi.8 $(DESTDIR)$(WWWPREFIX)/man/mandoc/man8/ -www-install: www - mkdir -p $(DESTDIR)$(HTDOCDIR)/snapshots - $(INSTALL_DATA) $(WWW_MANS) style.css $(DESTDIR)$(HTDOCDIR) - $(INSTALL_DATA) $(WWW_OBJS) $(DESTDIR)$(HTDOCDIR)/snapshots - $(INSTALL_DATA) mdocml.tar.gz \ - $(DESTDIR)$(HTDOCDIR)/snapshots/mdocml-$(VERSION).tar.gz - $(INSTALL_DATA) mdocml.sha256 \ - $(DESTDIR)$(HTDOCDIR)/snapshots/mdocml-$(VERSION).sha256 - Makefile.local config.h: configure ${TESTSRCS} @echo "$@ is out of date; please run ./configure" @exit 1 -depend: config.h - mkdep -f Makefile.depend $(CFLAGS) $(SRCS) - perl -e 'undef $$/; $$_ = <>; s|/usr/include/\S+||g; \ - s|\\\n||g; s| +| |g; s| $$||mg; print;' \ - Makefile.depend > Makefile.tmp - mv Makefile.tmp Makefile.depend - libmandoc.a: $(COMPAT_OBJS) $(LIBMANDOC_OBJS) $(AR) rs $@ $(COMPAT_OBJS) $(LIBMANDOC_OBJS) -mandoc: $(MAN_OBJS) libmandoc.a - $(CC) $(LDFLAGS) -o $@ $(MAN_OBJS) libmandoc.a $(DBLIB) +mandoc: $(MAIN_OBJS) libmandoc.a + $(CC) $(LDFLAGS) -o $@ $(MAIN_OBJS) libmandoc.a $(DBLIB) -makewhatis: $(MAKEWHATIS_OBJS) libmandoc.a - $(CC) $(LDFLAGS) -o $@ $(MAKEWHATIS_OBJS) libmandoc.a $(DBLIB) - manpage: $(MANPAGE_OBJS) libmandoc.a $(CC) $(LDFLAGS) -o $@ $(MANPAGE_OBJS) libmandoc.a $(DBLIB) man.cgi: $(CGI_OBJS) libmandoc.a $(CC) $(LDFLAGS) $(STATIC) -o $@ $(CGI_OBJS) libmandoc.a $(DBLIB) demandoc: $(DEMANDOC_OBJS) libmandoc.a $(CC) $(LDFLAGS) -o $@ $(DEMANDOC_OBJS) libmandoc.a +# --- maintainer targets --- + +www-install: www + mkdir -p $(HTDOCDIR)/snapshots + $(INSTALL_DATA) $(WWW_MANS) style.css $(HTDOCDIR)/man + $(INSTALL_DATA) $(WWW_OBJS) $(HTDOCDIR)/snapshots + $(INSTALL_DATA) mdocml.tar.gz \ + $(HTDOCDIR)/snapshots/mdocml-$(VERSION).tar.gz + $(INSTALL_DATA) mdocml.sha256 \ + $(HTDOCDIR)/snapshots/mdocml-$(VERSION).sha256 + +depend: config.h + mkdep -f Makefile.depend $(CFLAGS) $(SRCS) + perl -e 'undef $$/; $$_ = <>; s|/usr/include/\S+||g; \ + s|\\\n||g; s| +| |g; s| $$||mg; print;' \ + Makefile.depend > Makefile.tmp + mv Makefile.tmp Makefile.depend + mdocml.sha256: mdocml.tar.gz sha256 mdocml.tar.gz > $@ mdocml.tar.gz: $(DISTFILES) mkdir -p .dist/mdocml-$(VERSION)/ $(INSTALL) -m 0644 $(DISTFILES) .dist/mdocml-$(VERSION) chmod 755 .dist/mdocml-$(VERSION)/configure ( cd .dist/ && tar zcf ../$@ mdocml-$(VERSION) ) rm -rf .dist/ -.PHONY: base-install cgi-install db-install install www-install -.PHONY: clean distclean depend +# === SUFFIX RULES ===================================================== + .SUFFIXES: .1 .3 .5 .7 .8 .h .SUFFIXES: .1.html .3.html .5.html .7.html .8.html .h.html .h.h.html: highlight -I $< > $@ .1.1.html .3.3.html .5.5.html .7.7.html .8.8.html: mandoc ./mandoc -Thtml -Wall,stop \ -Ostyle=style.css,man=%N.%S.html,includes=%I.html $< > $@ Index: projects/arm_intrng/contrib/mdocml/Makefile.depend =================================================================== --- projects/arm_intrng/contrib/mdocml/Makefile.depend (revision 276247) +++ projects/arm_intrng/contrib/mdocml/Makefile.depend (revision 276248) @@ -1,72 +1,72 @@ att.o: att.c config.h mdoc.h libmdoc.h cgi.o: cgi.c config.h mandoc.h mandoc_aux.h main.h manpath.h mansearch.h cgi.h chars.o: chars.c config.h mandoc.h mandoc_aux.h libmandoc.h chars.in compat_fgetln.o: compat_fgetln.c config.h compat_fts.o: compat_fts.c config.h compat_fts.h compat_getsubopt.o: compat_getsubopt.c config.h compat_ohash.o: compat_ohash.c config.h compat_ohash.h compat_reallocarray.o: compat_reallocarray.c config.h compat_sqlite3_errstr.o: compat_sqlite3_errstr.c config.h compat_strcasestr.o: compat_strcasestr.c config.h compat_strlcat.o: compat_strlcat.c config.h compat_strlcpy.o: compat_strlcpy.c config.h compat_strsep.o: compat_strsep.c config.h demandoc.o: demandoc.c config.h man.h mdoc.h mandoc.h eqn.o: eqn.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h eqn_html.o: eqn_html.c config.h mandoc.h out.h html.h eqn_term.o: eqn_term.c config.h mandoc.h out.h term.h -html.o: html.c config.h mandoc.h mandoc_aux.h libmandoc.h out.h html.h main.h +html.o: html.c config.h mandoc.h mandoc_aux.h out.h html.h main.h lib.o: lib.c config.h mdoc.h libmdoc.h lib.in main.o: main.c config.h mandoc.h mandoc_aux.h main.h mdoc.h man.h manpath.h mansearch.h man.o: man.c config.h man.h mandoc.h mandoc_aux.h libman.h libmandoc.h -man_hash.o: man_hash.c config.h man.h mandoc.h libman.h -man_html.o: man_html.c config.h mandoc.h mandoc_aux.h out.h html.h man.h main.h +man_hash.o: man_hash.c config.h man.h libman.h +man_html.o: man_html.c config.h mandoc_aux.h man.h out.h html.h main.h man_macro.o: man_macro.c config.h man.h mandoc.h libmandoc.h libman.h man_term.o: man_term.c config.h mandoc.h mandoc_aux.h out.h man.h term.h main.h man_validate.o: man_validate.c config.h man.h mandoc.h mandoc_aux.h libman.h libmandoc.h mandoc.o: mandoc.c config.h mandoc.h mandoc_aux.h libmandoc.h mandoc_aux.o: mandoc_aux.c config.h mandoc.h mandoc_aux.h mandocdb.o: mandocdb.c config.h compat_fts.h compat_ohash.h mdoc.h man.h mandoc.h mandoc_aux.h manpath.h mansearch.h manpage.o: manpage.c config.h manpath.h mansearch.h manpath.o: manpath.c config.h mandoc_aux.h manpath.h mansearch.o: mansearch.c config.h compat_ohash.h mandoc.h mandoc_aux.h manpath.h mansearch.h -mansearch_const.o: mansearch_const.c config.h manpath.h mansearch.h +mansearch_const.o: mansearch_const.c config.h mansearch.h mdoc.o: mdoc.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h mdoc_argv.o: mdoc_argv.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h mdoc_hash.o: mdoc_hash.c config.h mdoc.h libmdoc.h -mdoc_html.o: mdoc_html.c config.h mandoc.h mandoc_aux.h out.h html.h mdoc.h main.h +mdoc_html.o: mdoc_html.c config.h mandoc_aux.h mdoc.h out.h html.h main.h mdoc_macro.o: mdoc_macro.c config.h mdoc.h mandoc.h libmdoc.h libmandoc.h mdoc_man.o: mdoc_man.c config.h mandoc.h mandoc_aux.h out.h man.h mdoc.h main.h mdoc_term.o: mdoc_term.c config.h mandoc.h mandoc_aux.h out.h term.h mdoc.h main.h mdoc_validate.o: mdoc_validate.c config.h mdoc.h mandoc.h mandoc_aux.h libmdoc.h libmandoc.h -msec.o: msec.c config.h mandoc.h libmandoc.h msec.in +msec.o: msec.c config.h libmandoc.h msec.in out.o: out.c config.h mandoc_aux.h mandoc.h out.h preconv.o: preconv.c config.h mandoc.h libmandoc.h -read.o: read.c config.h mandoc.h mandoc_aux.h libmandoc.h mdoc.h man.h main.h +read.o: read.c config.h mandoc.h mandoc_aux.h libmandoc.h mdoc.h man.h roff.o: roff.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h predefs.in st.o: st.c config.h mdoc.h libmdoc.h st.in tbl.o: tbl.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h tbl_data.o: tbl_data.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h tbl_html.o: tbl_html.c config.h mandoc.h out.h html.h tbl_layout.o: tbl_layout.c config.h mandoc.h mandoc_aux.h libmandoc.h libroff.h tbl_opts.o: tbl_opts.c config.h mandoc.h libmandoc.h libroff.h tbl_term.o: tbl_term.c config.h mandoc.h out.h term.h term.o: term.c config.h mandoc.h mandoc_aux.h out.h term.h main.h term_ascii.o: term_ascii.c config.h mandoc.h mandoc_aux.h out.h term.h main.h -term_ps.o: term_ps.c config.h mandoc.h mandoc_aux.h out.h main.h term.h +term_ps.o: term_ps.c config.h mandoc_aux.h out.h term.h main.h tree.o: tree.c config.h mandoc.h mdoc.h man.h main.h test-dirent-namlen.o: test-dirent-namlen.c test-fgetln.o: test-fgetln.c test-fts.o: test-fts.c test-getsubopt.o: test-getsubopt.c test-mmap.o: test-mmap.c test-ohash.o: test-ohash.c test-reallocarray.o: test-reallocarray.c test-sqlite3.o: test-sqlite3.c test-sqlite3_errstr.o: test-sqlite3_errstr.c test-strcasestr.o: test-strcasestr.c test-strlcat.o: test-strlcat.c test-strlcpy.o: test-strlcpy.c test-strptime.o: test-strptime.c test-strsep.o: test-strsep.c test-wchar.o: test-wchar.c Index: projects/arm_intrng/contrib/mdocml/NEWS =================================================================== --- projects/arm_intrng/contrib/mdocml/NEWS (revision 276247) +++ projects/arm_intrng/contrib/mdocml/NEWS (revision 276248) @@ -1,447 +1,516 @@ -$Id: NEWS,v 1.6 2014/08/11 01:39:00 schwarze Exp $ +$Id: NEWS,v 1.8 2014/12/13 13:43:47 schwarze Exp $ This file lists the most important changes in the mdocml.bsd.lv distribution. + +Changes in version 1.13.2, released on December 13, 2014 + + --- MAJOR NEW FEATURES --- + * Include an implementation of man(1), the manual page viewer. + * Unified set of command line option, each one supported by all + command names, including new options -a (format all), -c (no + pager), -h (synopsis only), and -w (list filenames). + * Support the MANPAGER and PAGER environment variables. + * Support gzip'ed manuals by the whole toolset, even as .so targets. + * Support UTF-8 and Latin-1 input by the whole toolset, delete preconv(1). + * Switch the default output mode from -Tascii to -Tlocale. + * Improve -Tascii output for Unicode escape sequences. + * Let the -Thtml output mode produce polyglot HTML5. + * Many improvements for eqn(7), in particular in-line equations, + MathML output in -Thtml mode, and much improved terminal formatting. + --- PORTABILITY IMPROVEMENTS --- + * Change the build sequence to the usual ./configure; make; make install. + * Support ./configure.local for build customizations. + * Autodetect wchar, sqlite3, and manpath support. + * Provide a fallback version of fts(3) for systems lacking it. + * Support choosing alternative binary and manual names. + --- MINOR NEW FEATURES --- + * Rudimentary implementation of the e, x, and z tbl(7) layout + modifiers to equalize, maximize, and ignore the width of columns. + * Implement font modifiers in tbl(7) layouts. + * Allow comma-separated options in the tbl(7) options line. + * Parse and ignore the .pl (page length) roff(7) request. + * Implement .An -[no]split for the mdoc(7) -Thtml output mode. + * Support bold italic font in PostScript and PDF output. + * Warn about commas in function arguments and parentheses in function names. + * Warn about botched .Xr ordering and punctuation below SEE ALSO. + * Warn about AUTHORS sections without .An macros. + * Warn about attempts to call non-callable macros. + * New developer documentation manual page mandoc_headers(3). + --- BUGFIXES --- + * Fix read buffer overrun sometimes triggered by trailing whitespace. + * Fix read buffer overrun triggered by certain invalid \H sequences. + * Fix NULL pointer access triggered by .Bl without any arguments. + * Fix NULL pointer access triggered by .It Nm Fo without .Fc. + * Fix NULL pointer access triggered by .Sh Xo .Sh without .Xc. + * Fix NULL pointer access triggered by missing .Nm. + * Fix an assertion triggered by .It right after .El. + * Fix an assertion triggered by .Ec without preceding .Eo. + * Fix an assertion triggered by .Sm or .Db with multiple arguments. + * Fix assertion failures triggered by very large width arguments. + * Fix a division by zero in the roff(7) parser. + * Prevent negative arguments to .ll from causing integer underflow. + * Correctly autodetect source format even when .Dd is preceded by .ll. + * Multiple fixes with respect to .Bd and .Bl -offset and -width. + * Many bugfixes with respect to scaling units. + * Multiple fixes with respect to delimiter handling by in-line macros. + * Multiple fixes with respect to .Pf. + * Make \c work properly in no-fill mode. + * Stricter syntax checking of Unicode character names. + --- THANKS TO --- + * Kristaps Dzonsons for rewriting the eqn(7) parser, implementing + HTML5 and MathML output, and various other code contributions. + * Jonathan Gray (OpenBSD) for extensive testing with afl (the + American Fuzzy Lop security fuzzer) resulting in many bug reports. + * Anthony Bentley (OpenBSD), Baptiste Daroussin (FreeBSD), Daniel + Dickman, Doug Hogan, Jason McIntyre, Theo de Raadt (OpenBSD), + and Martin Natano for source code patches. + * Carsten Kunze (Heirloom troff), Daniel Levai (Slackware), + Garrett D'Amore (illumos), Giovanni Becchis, Matthew Dempsky, + Stuart Henderson, Ted Unangst, Todd Miller (OpenBSD), Thomas + Klausner (NetBSD), Ulrich Spoerlein (FreeBSD), Justin Haynes, + Marcus Merighi, Sebastien Marie, Steffen Nurpmeso and Theo Buehler + for bug reports. Changes in version 1.13.1, released on August 10, 2014 --- MAJOR NEW FEATURES --- * A complete apropos(1)/makewhatis(8)/man.cgi(8) suite based on SQLite3 is now included. * The roff(7) parser now provides an almost complete implementation of numerical expressions. * Warning and error messages have been improved in many ways. Almost all fatal errors were downgraded to normal errors and some even to warnings. Almost all messages now mention the macro where the issue is detected and many indicate the workaround employed. The mandoc(1) manual now includes a list explaining all messages. --- MINOR NEW FEATURES --- * The roff(7) parser now supports the .ami (append to macro with indirectly specified name), .as (append to user-defined string), .dei (define macro with indirectly specified name), .ll (line length), and .rr (remove register) requests. * The roff(7) parser now supports string comparison and numerical conditionals in the .if and .ie requests. * The roff parser now fully supports the \B (validate numerical expression) and partially supports the \w (measure text width) escape sequences. * The terminal formatter now supports the \: (optional line break) escape sequence. * The roff parser now supports expansion of user-defined strings involving indirect references. * The roff(7) parser now handles some pre-defined read-only number registers that occur in the pod2man(1) preamble. * For backward compatibility, the mdoc(7) parser and formatters now support the obsolete macros .En, .Es, .Fr, and .Ot. * The mdoc(7) formatter non partially supports .Bd -centered. * tbl(7) now handles leading and trailing vertical lines. * The build system now provides fallback versions of strcasestr(3) and strsep(3) for systems lacking them. * The mdoc(7) manual now explains how various standards supported by the .St macro are related to each other. --- BUGFIXES --- * In the roff(7) parser, several bugs were fixed with respect to closing conditional blocks on macro lines. * Parsing of roff(7) identifiers and escape sequences was improved in multiple respects. * In the mdoc(7) parser, the handling of defective document prologues was improved in multiple ways. * The mdoc(7) parser no longer skips content before the first section header, and it no longer deletes non-.% content from .Rs blocks. * In the mdoc(7) parser, a crash was fixed related to weird .Sh headers. * In the mdoc(7) parser, handling of .Sm with missing or invalid arguments was corrected. * In the mdoc(7) parser, trailing punctuation at the end of partial implicit macros no longer triggers end-of-sentence spacing. * In the terminal formatter, two crashes were fixed: one triggered by excessive indentation and another by excessively long .Nm arguments. * In the terminal formatter, a floating point rounding bug was fixed that sometimes caused an off-by-one error in indentation. * In the UTF-8 formatter, rendering of accents, breakable hyphens, and non-breakable spaces was corrected. * In the HTML formatter, encoding of special characters was corrected in multiple respects. * In the mdoc(7) formatter, rendering of .Ex and .Rv was improved for various edge cases. * In the mdoc(7) formatter, handling of empty .Bl -inset item heads was improved. * In the man(7) formatter, some bugs were fixed with respect to same-line detection in the context of .TP and .nf macros, and the indentation of .IP and .TP blocks was improved. * The mandoc(3) library no longer prints to stderr. --- THANKS TO --- Abhinav Upadhyay (NetBSD), Andreas Voegele, Anthony Bentley (OpenBSD), Christian Weisgerber (OpenBSD), Havard Eidnes (NetBSD), Jan Stary, Jason McIntyre (OpenBSD), Jeremie Courreges-Anglas (OpenBSD), Joerg Sonnenberger (NetBSD), Juan Francisco Cantero Hurtado (OpenBSD), Marc Espie (OpenBSD), Matthias Scheler (NetBSD), Pascal Stumpf (OpenBSD), Paul Onyschuk (Alpine Linux), Sebastien Marie, Steffen Nurpmeso, Stuart Henderson (OpenBSD), Ted Unangst (OpenBSD), Theo de Raadt (OpenBSD), Thomas Klausner (NetBSD), and Ulrich Spoerlein (FreeBSD) for reporting bugs and missing features. Changes in version 1.12.3, released on December 31, 2013 * In the mdoc(7) SYNOPSIS, line breaks and hanging indentation now work correctly for .Fo/.Fa/.Fc and .Fn blocks. Thanks to Franco Fichtner for doing part of the work. * The mdoc(7) .Bk macro got some addititonal bugfixes. * In mdoc(7) macro arguments, double quotes can now be quoted by doubling them, just like in man(7). Thanks to Tsugutomo ENAMI for the patch. * At the end of man(7) macro lines, end-of-sentence spacing now works. Thanks to Franco Fichtner for the patch. * For backward compatibility, the man(7) parser now supports the man-ext .UR/.UE (uniform resource identifier) block macros. * The man(7) parser now handles closing blocks that are not open more gracefully. * The man(7) parser now ignores blank lines right after .SH and .SS. * In the man(7) formatter, reset indentation when leaving a block, not just when entering the next one. * The roff(7) .nr request now supports incrementing and decrementing number registers and stops parsing the number right before the first non-digit character. * The roff(7) parser now supports the alternative escape sequence syntax \C'uXXXX' for Unicode characters. * The roff(7) parser now parses and ignores the .fam (font family) and .hw (hyphenation points) requests and the \d and \u escape sequences. * The roff(7) manual got a new ESCAPE SEQUENCE REFERENCE. Changes in version 1.12.2, released on Oktober 5, 2013 * The mdoc(7) to man(7) converter, to be called as mandoc -Tman, is now fully functional. * The mandoc(1) utility now supports the -Ios (default operating system) input option, and the -Tutf8 output mode now actually works. * The mandocdb(8) utility no longer truncates existing databases when starting to build new ones, but only replaces them when the build actually succeeds. * The man(7) parser now supports the PD macro (paragraph distance), and (for GNU man-ext compatibility only) EX (example block) and EE (example end). Plus several bugfixes regarding indentation, line breaks, and vertical spacing, and regarding RS following TP. * The roff(7) parser now supports the \f(BI (bold+italic) font escape, the \z (zero cursor advance) escape and the cc (change control character) and it (input line trap) requests. Plus bugfixes regarding the \t (tab) escape, nested escape sequences, and conditional requests. * In mdoc(7), several bugs were fixed related to UTF-8 output of quoting enclosures, delimiter handling, list indentation and horizontal and vertical spacing, formatting of the Lk, %U, and %C macros, plus some bugfixes related to the handling of syntax errors like badly nested font blocks, stray Ta macros outside column lists, unterminated It Xo blocks, and non-text children of Nm blocks. * In tbl(7), the width of horizontal spans and the vertical spacing around tables was corrected, and in man(7) files, a crash was fixed that was triggered by some particular unclosed T{ macros. * For mandoc developers, we now provide a tbl(3) library manual and gmdiff, a very small, very simplistic groff-versus-mandoc output comparison tool. * Provide this NEWS file. Changes in version 1.12.1, released on March 23, 2012 * Significant work on apropos(1) and mandocdb(8). These tools are now much more robust. A whatis(1) implementation is now handled as an apropos(1) mode. These tools are also able to minimally handle pre-formatted pages, that is, those already formatted by another utility such as GNU troff. * The man.cgi(7) script is also now available for wider testing. It interfaces with mandocdb(8) manuals cached by catman(8). HTML output is generated on-the-fly by libmandoc or internal methods to convert pre-formatted pages. * The mailing list archive for the discuss and tech lists are being hosted by Gmane at gmane.comp.tools.mdocml.user and gmane.comp.tools.mdocml.devel, respectively. Changes in version 1.12.0, released on October 8, 2011 * This version features a new, work-in-progress mandoc(1) output mode: -Tman. This mode allows a system maintainer to distribute man(7) media for older systems that may not natively support mdoc(7), such as old Solaris systems. * The -Ofragment option was added to mandoc(1)'s -Thtml and -Txhtml modes. * While adding features, an apropos(1) utility has been merged from the mandoc-tools sandbox. This interfaces with mandocdb(8) for semantic search of manual content. apropos(1) is different from the traditional apropos primarily in allowing keyword search (such as for functions, utilities, etc.) and regular expressions. Note that the calling syntax for apropos is likely to change as it settles down. * In documentation news, the mdoc(7) and man(7) manuals have been made considerably more readable by adding MACRO OVERVIEW sections, by moving the gory details of the LANGUAGE SYNTAX to the roff(7) manual, and by moving the very technical MACRO SYNTAX sections down to the bottom of the page. * Furthermore, for tbl(7), the -Tascii mode horizontal spacing of tables was rewritten completely. It is now compatible with groff(1), both with and without frames and rulers. * Nesting of indented blocks is now supported in man(7), and several bugs were fixed regarding indentation and alignment. * The page headers in mdoc(7) are now nicer for very long titles. Changes in version 1.11.7, released on September 2, 2011 * Added demandoc(1) utility for stripping away macros and escapes. This replaces the historical deroff(1) utility. * Also improved the mdoc(7) and man(7) manuals. Changes in version 1.11.6, released on August 16, 2011 * Handling of tr macro in roff(7) implemented. This makes Perl documentation much more readable. Hyphenation is also now enabled in man(7) format documents. Many other general improvements have been implemented. Changes in version 1.11.5, released on July 24, 2011 * Significant eqn(7) improvements. mdocml can now parse arbitrary eqn input (although few GNU extensions are accepted, nor is mixing low-level roff with eqn). See the eqn(7) manual for details. For the time being, equations are rendered as simple in-line text. The equation parser satisfies the language specified in the Second Edition User's Guide: http://www.kohala.com/start/troff/v7man/eqn/eqn2e.ps Changes in version 1.11.4, released on July 12, 2011 * Bug-fixes and clean-ups across all systems, especially in mandocdb(8) and the man(7) parser. This release was significantly assisted by participants in OpenBSD's c2k11. Thanks! Changes in version 1.11.3, released on May 26, 2011 * Introduce locale-encoding of output with the -Tlocale output option and Unicode escaped-character input. See mandoc(1) and mandoc_char(7), respectively, for details. This allows for non-ASCII characters (e.g., \[u5000]) to be rendered in the locale's encoding, if said environment supports wide-character encoding (if it does not, -Tascii is used instead). Locale support can be turned off at compile time by removing -DUSE_WCHAR in the Makefile, in which case -Tlocale is always a synonym for -Tascii. * Furthermore, multibyte-encoded documents, such as those in UTF-8, may be on-the-fly recoded into mandoc(1) input by using the newly-added preconv(1) utility. Note: in the future, this feature may be integrated into mandoc(1). Changes in version 1.11.2, released on May 12, 2011 * Corrected some installation issues in version 1.11.1. * Further migration to libmandoc. * Initial public release (this utility is very much under development) of mandocdb(8). This utility produces keyword databases of manual content, which features semantic querying of manual content. Changes in version 1.11.1, released on April 4, 2011 * The earlier libroff, libmdoc, and libman soup have been merged into a single library, libmandoc, which manages all aspects of parsing real manuals, from line-handling to tbl(7) parsing. * As usual, many general fixes and improvements have also occurred. In particular, a great deal of redundancy and superfluous code has been removed with the merging of the backend libraries. * see also the changes in 1.10.10 Changes in version 1.10.10, March 20, 2011, NOT released * Initial eqn(7) functionality is in place. For the time being, this is limited to the recognition of equation blocks; future version of mdocml will expand upon this framework. Changes in version 1.10.9, released on January 7, 2011 * Many back-end fixes have been implemented: argument handling (quoting), man(7) improvements, error/warning classes, and many more. * Initial tbl(7) functionality (see the "TS", "TE", and "T&" macros in the roff(7) manual) has been merged from tbl.bsd.lv. Output is still minimal, especially for -Thtml and -Txhtml, but manages to at least display data. This means that mandoc(1) now has built-in support for two troff preprocessors via libroff: soelim(1) and tbl(1). Changes in version 1.10.8, released on December 24, 2010 * Overhauled the -Thtml and -Txhtml output modes. They now display readable output in arbitrary browsers, including text-based ones like lynx(1). See HTML and XHTML manuals in the DOCUMENTATION section for examples. Attention: available style-sheet classes have been considerably changed! See the example.style.css file for details. Lastly, libmdoc and libman have been cleaned up and reduced in size and complexity. * see also the changes in 1.10.7 Changes in version 1.10.7, December 6, 2010, NOT released Significant improvements merged from OpenBSD downstream, including: * many new roff(7) components, * in-line implementation of troff's soelim(1), * broken-block handling, * overhauled error classifications, and * cleaned up handling of error conditions. Changes in version 1.10.6, released on September 27, 2010 * Calling conventions for mandoc(1) have changed: -W improved and -f deprecated. * Non-ASCII characters are also now uniformly discarded. * Lots of documentation improvements. * Many incremental fixes accomodating for groff's more interesting productions. * Lastly, pod2man(1) preambles are now fully accepted after some considerable roff(7) and special character support. Changes in version 1.10.5, released on July 27, 2010 * Primarily a bug-fix and polish release, but including -Tpdf support in mandoc(1) by way of "Summer of Code". Highlights: * fix "Sm" and "Bd" handling * fix end-of-sentence handling for embedded sentences * polish man(7) documentation * document all mdoc(7) macros * polish mandoc(1) -Tps output * lots of internal clean-ups in character escapes * un-break literal contexts in man(7) documents * improve -Thtml output for -man * add mandoc(1) -Tpdf support Changes in version 1.10.4, released on July 12, 2010 * Lots of features developed during both "Summer of Code" and the OpenBSD c2k10 hackathon: * minimal "ds" roff(7) symbols are supported * beautified SYNOPSIS section output * acceptance of scope-block breakage in mdoc(7) * clarify error message status * many minor bug-fixes and formatting issues resolved * see also changes in 1.10.3 Changes in version 1.10.3, June 29, 2010, NOT released * variable font-width and paper-size support in mandoc(1) -Tps output * "Bk" mdoc(7) support Changes in version 1.10.2, released on June 19, 2010 * Small release featuring text-decoration in -Tps output, a few minor relaxations of errors, and some optimisations. Changes in version 1.10.1, released on June 7, 2010 * This primarily focusses on the "Bl" and "It" macros described in mdoc(7). Multi-line column support is now fully compatible with groff, as are implicit list entries for columns. * Removed manuals(7) in favour of http://manpages.bsd.lv. * The way we handle the SYNOPSIS section (see the SYNOPSIS documentation in MANUAL STRUCTURE) has also been considerably simplified compared to groff's method. * Furthermore, the -Owidth=width output option has been added to -Tascii, see mandoc(1). * Lastly, initial PostScript output has been added with the -Tps option to mandoc(1). It's brutally simple at the moment: fixed-font, with no font decorations. Changes in version 1.10.0, released on May 29, 2010 * Release consisting of the results from the m2k10 hackathon and up-merge from OpenBSD. This requires a significant note of thanks to Ingo Schwarze (OpenBSD) and Joerg Sonnenberger (NetBSD) for their hard work, and again to Joerg for hosting m2k10. Highlights (mostly cribbed from Ingo's m2k10 report) follow in no particular order: * a libroff preprocessor in front of libmdoc and libman stripping out roff(7) instructions; * end-of-sentence (EOS) detection in free-form and macro lines; * correct handling of tab-separated columnar lists in mdoc(7); * improved main calling routines to optionally use mmap(3) for better performance; * cleaned up exiting when invoked as -Tlint or over multiple files with -fign-errors; * error and warning message handling re-written to be unified for libroff, libmdoc, and libman; * handling of badly-nested explicit-scoped macros; * improved free-form text parsing in libman and libmdoc; * significant GNU troff compatibility improvements in -Tascii, largely in terms of spacing; * a regression framework for making sure the many fragilities of GNU troff aren't trampled in subsequent work; * support for -Tascii breaking at hyphens encountered in free-form text; * and many more minor fixes and improvements Changes in version 1.9.25, released on May 13, 2010 * Fixed handling of "\*(Ba" escape. * Backed out -fno-ign-chars (pointless complexity). * Fixed erroneous breaking of literal lines. * Fixed SYNOPSIS breaking lines before non-initial macros. * Changed default section ordering. * Most importantly, the framework for end-of-sentence double-spacing is in place, now implemented for the "end-of-sentence, end-of-line" rule. * This is a stable roll-back point before the mandoc hackathon in Rostock! Changes in version 1.9.24, released on May 9, 2010 * Rolled back break-at-hyphen. * -DUGLY is now the default (no feature splits!). * Free-form text is not de-chunked any more: lines are passed whole-sale into the front-end, including whitespace. * Added mailing lists. Changes in version 1.9.23, released on April 7, 2010 * mdocml has been linked to the OpenBSD build. * This version incorporates many small changes, mostly from patches by OpenBSD, allowing crufty manuals to slip by with warnings instead of erroring-out. * Some subtle semantic issues, such as punctuation scope, have also been fixed. * Lastly, some issues with -Thtml have been fixed, which prompted an update to the online manual pages style layout. Changes in version 1.9.22, released on March 31, 2010 * Adjusted merge of the significant work by Ingo Schwarze in getting "Xo" blocks (block full implicit, e.g., "It" for non-columnar lists) to work properly. This isn't enabled by default: you must specify -DUGLY as a compiler flag (see the Makefile for details). Changes in version 1.9.20, released on March 30, 2010 * More efforts to get roff instructions in man(7) documents under control. Note that roff instructions embedded in line-scoped, next-line macros (e.g. "B") are not supported. * Leading punctuation for mdoc(7) macros, such as "Fl ( ( a", are now correctly handled. Changes in version 1.9.18, released on March 27, 2010 * Many fixes (largely pertaining to scope) and improvements (e.g., handling of apostrophe-control macros, which fixes the strange "BR" seen in some macro output) to handling roff instructions in man(7) documents. Changes in version 1.9.17, released on March 25, 2010 * Accept perlpod(1) standard preamble. * Also accept (and discard) "de", "dei", "am", "ami", and "ig" roff macro blocks. Changes in version 1.9.16, released on March 22, 2010 * Inspired by patches and bug reports by Ingo Schwarze, allowed man(7) to accept non-printing elements to be nested within next-line scopes, such as "br" within "B" or "TH", which is valid roff. * Longsoon architecture also noted and Makefile cleaned up. Changes in version 1.9.15, released on February 18, 2010 * Moved to our new BSD.lv home. * XHTML is now an acceptable output mode for mandoc(1); * "Xr" made more compatible with groff; * "Vt" fixed when invoked in SYNOPSIS; * "\\" escape removed; * end-of-line white-space detected for all lines; * subtle bug fixed in list display for some modes; * compatibility layer checked in for compilation in diverse UNIX systems; * and column lengths handled correctly. For older releases, see the ChangeLog files in http://mdocml.bsd.lv/snapshots/ . Index: projects/arm_intrng/contrib/mdocml/TODO =================================================================== --- projects/arm_intrng/contrib/mdocml/TODO (revision 276247) +++ projects/arm_intrng/contrib/mdocml/TODO (revision 276248) @@ -1,603 +1,592 @@ ************************************************************************ * Official mandoc TODO. -* $Id: TODO,v 1.189 2014/11/26 21:40:17 schwarze Exp $ +* $Id: TODO,v 1.195 2014/12/13 13:14:39 schwarze Exp $ ************************************************************************ Many issues are annotated for difficulty as follows: - loc = locality of the issue * single file issue, affects file only, or very few ** single module issue, affects several files of one module *** cross-module issue, significantly impacts multiple modules and may require substantial changes to internal interfaces - exist = difficulty of the existing code in this area * affected code is straightforward and easy to read and change ** affected code is somewhat complex, but once you understand the design, not particularly difficult to understand *** affected code uses a special, exceptionally tricky design - algo = difficulty of the new algorithm to be written * the required logic and code is straightforward ** the required logic is somewhat complex and needs a careful design *** the required logic is exceptionally tricky, maybe an approach to solve that is not even known yet - size = the amount of code to be written or changed * a small number of lines (at most 100, usually much less) ** a considerable amount of code (several dozen to a few hundred) *** a large amount of code (many hundreds, maybe thousands) - imp = importance of the issue * mostly for completeness ** would be nice to have *** issue causes considerable inconvenience Obviously, as the issues have not been solved yet, these annotations are mere guesses, and some may be wrong. ************************************************************************ * crashes ************************************************************************ - The abort() in bufcat(), html.c, can be triggered via buffmt_includes() by running -Thtml -Oincludes on a file containing a long .In argument. Fixing this will probably require reworking the whole bufcat() concept. loc ** exist * algo * size ** imp ** ************************************************************************ * missing features ************************************************************************ --- missing roff features ---------------------------------------------- - .ad (adjust margins) .ad l -- adjust left margin only (flush left) .ad r -- adjust right margin only (flush right) .ad c -- center text on line .ad b -- adjust both margins (alias: .ad n) .na -- temporarily disable adjustment without changing the mode .ad -- re-enable adjustment without changing the mode Adjustment mode is ignored while in no-fill mode (.nf). loc *** exist *** algo ** size ** imp ** (parser reorg would help) - .fc (field control) found by naddy@ in xloadimage(1) loc ** exist *** algo * size * imp * - .nr third argument (auto-increment step size, requires \n+) found by bentley@ in sbcl(1) Mon, 9 Dec 2013 18:36:57 -0700 loc * exist * algo * size * imp ** - .ns (no-space mode) occurs in xine-config(1) reported by brad@ Sat, 15 Jan 2011 15:45:23 -0500 loc *** exist *** algo *** size ** imp * - .ta (tab settings) occurs in ircbug(1) and probably gnats(1) reported by brad@ Sat, 15 Jan 2011 15:50:51 -0500 also Tcl_NewStringObj(3) via wiz@ Wed, 5 Mar 2014 22:27:43 +0100 - loc ** exist *** algo ** size ** imp ** + also posix2time(3) Carsten Kunze Mon, 1 Dec 2014 13:03:10 +0100 + loc ** exist *** algo ** size ** imp *** - .ti (temporary indent) found by naddy@ in xloadimage(1) found by bentley@ in nmh(1) Mon, 23 Apr 2012 13:38:28 -0600 loc ** exist ** algo ** size * imp ** (parser reorg helps a lot) - .while and .shift found by jca@ in ratpoison(1) Sun, 30 Jun 2013 12:01:09 +0200 loc * exist ** algo ** size ** imp ** -- \c (interrupted text) should prevent the line break - even inside .Bd literal; that occurs in chat(8) - also found in cclive(1) - DocBook output - loc ** exist *** algo ** size * imp * - - \h horizontal move - found in cclive(1) DocBook output - Anthony J. Bentley on discuss@ Sat, 21 Sep 2013 22:29:34 -0600 + found in cclive(1) and nasm(1) asciidoc/DocBook output + bentley@ on discuss@ Sat, 21 Sep 2013 22:29:34 -0600 + naddy@ Thu, 4 Dec 2014 16:26:41 +0100 loc ** exist ** algo ** size * imp ** (parser reorg helps a lot) - \n+ and \n- numerical register increment and decrement found by bentley@ in sbcl(1) Mon, 9 Dec 2013 18:36:57 -0700 loc * exist * algo * size * imp ** - \w'' improve width measurements would not be very useful without an expression parser, see below needed for Tcl_NewStringObj(3) via wiz@ Wed, 5 Mar 2014 22:27:43 +0100 loc ** exist *** algo *** size * imp *** - using undefined strings or macros defines them to be empty wl@ Mon, 14 Nov 2011 14:37:01 +0000 loc * exist * algo * size * imp * --- missing mdoc features ---------------------------------------------- - fix bad block nesting involving multiple identical explicit blocks see the OpenBSD mdoc_macro.c 1.47 commit message loc * exist *** algo *** size * imp ** - .Bl -column .Xo support is missing ultimate goal: restore .Xr and .Dv to lib/libc/compat-43/sigvec.3 lib/libc/gen/signal.3 lib/libc/sys/sigaction.2 loc * exist *** algo *** size * imp ** - edge case: decide how to deal with blk_full bad nesting, e.g. .Sh .Nm .Bk .Nm .Ek .Sh found by jmc@ in ssh-keygen(1) from jmc@ Wed, 14 Jul 2010 18:10:32 +0100 loc * exist *** algo *** size ** imp ** -- \\ is now implemented correctly - * when defining strings and macros using .ds and .de - * when parsing roff(7) and man(7) macro arguments - It does not yet work in mdoc(7) macro arguments - because libmdoc does not yet use mandoc_getarg(). - Also check what happens in plain text, it must be identical to \e. - - .Bd -centered implies -filled, not -unfilled, which is not easy to implement; it requires code similar to .ce, which we don't have either. Besides, groff has bug causing text right *before* .Bd -centered to be centered as well. loc *** exist *** algo ** size ** imp ** (parser reorg would help) - .Bd -filled should not be the same as .Bd -ragged, but align both the left and right margin. In groff, it is implemented in terms of .ad b, which we don't have either. Found in cksum(1). loc *** exist *** algo ** size ** imp ** (parser reorg would help) - implement blank `Bl -column', such as .Bl -column .It foo Ta bar .El loc * exist *** algo *** size * imp * - explicitly disallow nested `Bl -column', which would clobber internal flags defined for struct mdoc_macro loc * exist * algo * size * imp ** - In .Bl -column .It, the end of the line probably has to be regarded as an implicit .Ta, if there could be one, see the following mildly ugly code from login.conf(5): .Bl -column minpasswordlen program xetcxmotd .It path Ta path Ta value of Dv _PATH_DEFPATH .br Default search path. reported by Michal Mazurek via jmc@ Thu, 7 Apr 2011 16:00:53 +0059 loc * exist *** algo ** size * imp ** - inside `.Bl -column' phrases, punctuation is handled like normal text, e.g. `.Bl -column .It Fl x . Ta ...' should give "-x -." - inside `.Bl -column' phrases, TERMP_IGNDELIM handling by `Pf' is not safe, e.g. `.Bl -column .It Pf a b .' gives "ab." but should give "ab ." -- set a meaningful default if no `Bl' list type is assigned - loc * exist * algo * size * imp ** (already done?) - -- have a blank `It' head for `Bl -tag' not puke - loc * exist * algo * size * imp ** (already done?) - - check whether it is correct that `D1' uses INDENT+1; does it need its own constant? loc * exist ** algo ** size * imp ** - prohibit `Nm' from having non-text HEAD children (e.g., NetBSD mDNSShared/dns-sd.1) (mdoc_html.c and mdoc_term.c `Nm' handlers can be slightly simplified) - support translated section names e.g. x11/scrotwm scrotwm_es.1:21:2: error: NAME section must be first that one uses NOMBRE because it is spanish... deraadt tends to think that section-dependent macro behaviour is a bad idea in the first place, so this may be irrelevant loc ** exist ** algo ** size * imp ** - When there is free text in the SYNOPSIS and that free text contains the .Nm macro, groff somehow understands to treat the .Nm as an in-line macro, while mandoc treats it as a block macro and breaks the line. No idea how the logic for distinguishing in-line and block instances should be, needs investigation. uqs@ Thu, 2 Jun 2011 11:03:51 +0200 uqs@ Thu, 2 Jun 2011 11:33:35 +0200 loc * exist ** algo *** size * imp ** --- missing man features ----------------------------------------------- - -T[x]html doesn't stipulate non-collapsing spaces in literal mode --- missing tbl features ----------------------------------------------- - look at the POSIX manuals in the books/man-pages-posix port, they use some unsupported tbl(7) features. loc * exist ** algo ** size ** imp *** - use Unicode U+2500 to U+256C for table borders in tbl(7) -Tutf-8 output suggested by bentley@ Tue, 14 Oct 2014 04:10:55 -0600 loc * exist ** algo * size * imp ** - allow standalone `.' to be interpreted as an end-of-layout delimiter instead of being thrown away as a no-op roff line reported by Yuri Pankov, Wed 18 May 2011 11:34:59 CEST loc ** exist ** algo ** size * imp ** --- missing eqn features ----------------------------------------------- - The "size" keyword is parsed, but ignored by the formatter. loc * exist * algo * size * imp * - The spacing characters `~', `^', and tab are currently ignored, see User's Guide (Second Edition) page 2 section 4. loc * exist * algo ** size * imp ** - Mark and lineup are parsed and ignored, see User's Guide (Second Edition) page 5 section 15. loc ** exist ** algo ** size ** imp ** --- missing misc features ---------------------------------------------- - italic correction (\/) in PostScript mode Werner LEMBERG on groff at gnu dot org Sun, 10 Nov 2013 12:47:46 loc ** exist ** algo * size * imp * - When makewhatis(8) encounters a FATAL parse error, it silently treats the file as formatted, which makes no sense at all for paths like man1/foo.1 - and which also contradicts what the manual says at the end of the description. The end result will be ENOENT for file names returned by mansearch() in manpage.file. loc * exist * algo * size * imp ** - makewhatis(8) for preformatted pages: parse the section number from the header line and compare to the section number from the directory name loc * exist * algo * size * imp ** - Does makewhatis(8) detect missing NAME sections, missing names, and missing descriptions in all the file formats? loc * exist * algo * size * imp *** - clean up escape sequence handling, creating three classes: (1) fully implemented, or parsed and ignored without loss of content (2) unimplemented, potentially causing loss of content or serious mangling of formatting (e.g. \n) -> ERROR see textproc/mgdiff(1) for nice examples (3) undefined, just output the character -> perhaps WARNING loc *** exist ** algo ** size ** imp *** (parser reorg helps) - kettenis wants base roff, ms, and me Fri, 1 Jan 2010 22:13:15 +0100 (CET) loc ** exist ** algo ** size *** imp * --- compatibility checks ----------------------------------------------- - is .Bk implemented correctly in modern groff? sobrado@ Tue, 19 Apr 2011 22:12:55 +0200 - compare output to Heirloom roff, Solaris roff, and http://repo.or.cz/w/neatroff.git http://litcave.rudi.ir/ - look at AT&T DWB http://www2.research.att.com/sw/download Carsten Kunze has patches Mon, 4 Aug 2014 17:01:28 +0200 - look at pages generated from reStructeredText, e.g. devel/mercurial hg(1) These are a weird mixture of man(7) and custom autogenerated low-level roff stuff. Figure out to what extent we can cope. For details, see http://docutils.sourceforge.net/rst.html noted by stsp@ Sat, 24 Apr 2010 09:17:55 +0200 reminded by nicm@ Mon, 3 May 2010 09:52:41 +0100 - look at pages generated from ronn(1) github.com/rtomayko/ronn (based on markdown) - look at pages generated from Texinfo source by yat2m, e.g. security/gnupg First impression is not that bad. - look at pages generated by pandoc; see https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Writers/Man.hs porting planned by kili@ Thu, 19 Jun 2014 19:46:28 +0200 - check compatibility with Plan9: http://swtch.com/usr/local/plan9/tmac/tmac.an http://swtch.com/plan9port/man/man7/man.html "Anthony J. Bentley" 28 Dec 2010 21:58:40 -0700 - check compatibility with the man(7) formatter https://raw.githubusercontent.com/rofl0r/hardcore-utils/master/man.c - check compatibility with http://ikiwiki.info/plugins/contrib/mandoc/ https://github.com/schmonz/ikiwiki/compare/mandoc Amitai Schlair Mon, 19 May 2014 14:05:53 -0400 ************************************************************************ * formatting issues: ugly output ************************************************************************ -- a column list with blank `Ta' cells triggers a spurrious +- revisit empty in-line macros + look at the difference between "Em x Em ." and "Sq x Em ." + Carsten Kunze Fri, 12 Dec 2014 00:15:41 +0100 + loc *** exist *** algo *** size * imp ** + +- a column list with blank `Ta' cells triggers a spurious start-with-whitespace printing of a newline +- In .Bl -column, .It a"bc" + shows the quotes in groff, but not in mandoc + loc * exist *** algo ** size * imp ** + - In .Bl -column, .It Em AuthenticationKey Length ought to render "Key Length" with emphasis, too, see OpenBSD iked.conf(5). reported again Nicolas Joly via wiz@ Wed, 12 Oct 2011 00:20:00 +0200 loc * exist *** algo *** size ** imp *** - empty phrases in .Bl column produce too few blanks try e.g. .Bl -column It Ta Ta reported by millert Fri, 02 Apr 2010 16:13:46 -0400 loc * exist *** algo *** size * imp ** - .%T can have trailing punctuation. Currently, it puts the trailing punctuation into a trailing MDOC_TEXT element inside its own scope. That element should rather be outside its scope, such that the punctuation does not get underlines. This is not trivial to implement because .%T then needs some features of in_line_eoln() - slurp all arguments into one single text element - and one feature of in_line() - put trailing punctuation out of scope. Found in mount_nfs(8) and exports(5), search for "Appendix". loc ** exist ** algo *** size * imp ** - Trailing punctuation after .%T triggers EOS spacing, at least outside .Rs (eek!). Simply setting ARGSFL_DELIM for .%T is not the right solution, it sends mandoc into an endless loop. reported by Nicolas Joly Sat, 17 Nov 2012 11:49:54 +0100 loc * exist ** algo ** size * imp ** - global variables in the SYNOPSIS of section 3 pages .Vt vs .Vt/.Va vs .Ft/.Va vs .Ft/.Fa ... from kristaps@ Tue, 08 Jun 2010 11:13:32 +0200 - in enclosures, mandoc sometimes fancies a bogus end of sentence reminded by jmc@ Thu, 23 Sep 2010 18:13:39 +0059 loc * exist ** algo *** size * imp *** - formatting /usr/local/man/man1/latex2man.1 with groff and mandoc reveals lots of bugs both in groff and mandoc... reported by bentley@ Wed, 22 May 2013 23:49:30 -0600 --- PDF issues --------------------------------------------------------- - PDF output doesn't use a monospaced font for .Bd -literal Example: "mandoc -Tpdf afterboot.8 > output.pdf && pdfviewer output.pdf". Search the text "Routing tables". Also check what PostScript mode does when fixing this. reported by juanfra@ Wed, 04 Jun 2014 21:44:58 +0200 instructions from juanfra@ Wed, 11 Jun 2014 02:21:01 +0200 add a new <> block to the PDF files with /BaseFont /Courier and change the /Name from /F0 to the new font (/F5 (?)). loc * exist ** algo ** size * imp ** --- HTML issues -------------------------------------------------------- -
formatting is ugly hints are easy to find on the web, e.g. http://stackoverflow.com/questions/1713048/ see also matthew@ Fri, 18 Jul 2014 19:25:12 -0700 loc * exist * algo ** size * imp *** - jsg on icb, Nov 3, 2014: try to guess Xr in man(7) for hyperlinking - The tables used to render the three-part page headers actually force the width of the to the max-width given for . Not yet sure how to fix that... Observed by an Anonymous Coward on undeadly.org: http://undeadly.org/cgi?action=article&sid=20140925064244&pid=1 loc * exist * algo ** size * imp *** - consider whether can be used for Ar Dv Er Ev Fa Va. from bentley@ Wed, 13 Aug 2014 09:17:55 -0600 - check https://github.com/trentm/mdocml ************************************************************************ * formatting issues: gratuitous differences ************************************************************************ - .Fn reopens a new scope after punctuation in mandoc, but closes its scope for good in groff. Do we want to change mandoc or groff? Steffen Nurpmeso Sat, 08 Nov 2014 13:34:59 +0100 loc * exist ** algo ** size * imp ** -- .Rv (and probably .Ex) print different text if an `Nm' has been named - or not (run a manual without `Nm blah' to see this). I'm not sure - that this exists in the wild, but it's still an error. - loc * exist * algo * size * imp * (already done?) - -- In .Bl -bullet, the groff bullet is "+\b+\bo\bo", the mandoc bullet - is just "o\bo". The problem is to not break ps/pdf when fixing. - see for example OpenBSD ksh(1) - loc ** exist ** algo ** size * imp ** - - In .Bl -enum -width 0n, groff continues one the same line after the number, mandoc breaks the line. mail to kristaps@ Mon, 20 Jul 2009 02:21:39 +0200 loc * exist ** algo ** size * imp ** - .Pp between two .It in .Bl -column should produce one, not two blank lines, see e.g. login.conf(5). reported by jmc@ Sun, 17 Apr 2011 14:04:58 +0059 reported again by sthen@ Wed, 18 Jan 2012 02:09:39 +0000 (UTC) loc * exist *** algo ** size * imp ** - If the *first* line after .It is .Pp, break the line right after the tag, do not pad with space characters before breaking. See the description of the a, c, and i commands in sed(1). loc * exist ** algo ** size * imp ** - If the first line after .It is .D1, do not assert a blank line in between, see for example tmux(1). reported by nicm@ 13 Jan 2011 00:18:57 +0000 loc * exist ** algo ** size * imp ** - Trailing punctuation after .It should trigger EOS spacing. reported by Nicolas Joly Sat, 17 Nov 2012 11:49:54 +0100 Probably, this should be fixed somewhere in termp_it_pre(), not sure. loc * exist ** algo ** size * imp ** - .Nx 1.0a should be "NetBSD 1.0A", not "NetBSD 1.0a", see OpenBSD ccdconfig(8). loc * exist * algo * size * imp ** - In .Bl -tag, if a tag exceeds the right margin and must be continued on the next line, it must be indented by -width, not width+1; see "rule block|pass" in OpenBSD ifconfig(8). loc * exist *** algo ** size * imp ** - When the -width string contains macros, the macros must be rendered before measuring the width, for example .Bl -tag -width ".Dv message" in magic(5), located in src/usr.bin/file, is the same as -width 7n, not -width 11n. The same applies to .Bl -column column widths; reported again by Nicolas Joly Thu, 1 Mar 2012 13:41:26 +0100 via wiz@ 5 Mar reported again by Franco Fichtner Fri, 27 Sep 2013 21:02:28 +0200 loc *** exist *** algo *** size ** imp *** An easy partial fix would be to just skip the first word if it starts with a dot, including any following white space, when measuring. loc * exist * algo * size * imp *** - The \& zero-width character counts as output. That is, when it is alone on a line between two .Pp, we want three blank lines, not two as in mandoc. loc ** exist ** algo ** size * imp ** - Header lines of excessive length: Port OpenBSD man_term.c rev. 1.25 to mdoc_term.c and document it in mdoc(7) and man(7) COMPATIBILITY found while talking to Chris Bennett loc * exist * algo * size * imp * - trailing whitespace must be ignored even when followed by a font escape, see for example makes \fBdig \fR operate in batch mode in dig(1). loc ** exist ** algo ** size * imp ** ************************************************************************ * warning issues ************************************************************************ - check that MANDOCERR_BADTAB is thrown in the right cases, i.e. when finding a literal tab character in fill mode, and possibly change the wording of the warning message to refer to fill mode, not literal mode See the mail from Werner LEMBERG on the groff list, Fri, 14 Feb 2014 18:54:42 +0100 (CET) loc * exist ** algo ** size * imp ** - warn about attempts to call non-callable macros Steffen Nurpmeso Tue, 11 Nov 2014 22:55:16 +0100 Note that formatting is inconsistent in groff. .Fn Po prints "Po()", .Ar Sh prints "file ..." and no "Sh". Relatively hard because the relevant code is scattered all over mdoc_macro.c and all subtly different. loc ** exist ** algo ** size ** imp ** - warn about "new sentence, new line" loc ** exist ** algo *** size * imp ** - mandoc_special does not really check the escape sequence, but just the overall format loc ** exist ** algo *** size ** imp ** - integrate mdoclint into mandoc ("end-of-line whitespace" thread) from jmc@ Mon, 13 Jul 2009 17:12:09 +0100 from kristaps@ Mon, 13 Jul 2009 18:34:53 +0200 from jmc@ Mon, 13 Jul 2009 17:45:37 +0059 from kristaps@ Mon, 13 Jul 2009 19:02:03 +0200 (mostly done, check what remains) - -Tlint parser errors and warnings to stdout to tech@mdocml, naddy@ Wed, 28 Sep 2011 11:21:46 +0200 wait! kristaps@ Sun, 02 Oct 2011 17:12:52 +0200 - for system errors, use errno/strerror/warn/err ************************************************************************ * documentation issues ************************************************************************ - mention hyphenation rules: breaking at letter-letter in text mode (not macro args) proper hyphenation is unimplemented - talk about spacing around delimiters to jmc@, kristaps@ Sat, 23 Apr 2011 17:41:27 +0200 - mark macros as: page structure domain, manual domain, general text domain is this useful? - mention /usr/share/misc/mdoc.template in mdoc(7)? - Is all the content from http://www.std.com/obi/BSD/doc/usd/28.tbl/tbl covered in tbl(7)? ************************************************************************ * performance issues ************************************************************************ - Why are we using MAP_SHARED, not MAP_PRIVATE for mmap(2)? How does SQLITE_CONFIG_PAGECACHE actually work? Document it! from kristaps@ Sat, 09 Aug 2014 13:51:36 +0200 Several areas can be cleaned up to make mandoc even faster. These are - improve hashing mechanism for macros (quite important: performance) - improve hashing mechanism for characters (not as important) - the PDF file is HUGE: this can be reduced by using relative offsets - instead of re-initialising the roff predefined-strings set before each parse, create a read-only version the first time and copy it loc * exist ** algo ** size * imp ** ************************************************************************ * structural issues ************************************************************************ - Use libz directly instead of forking gunzip(1). Suggested by bapt at FreeBSD among others. - We use the input line number at several places to distinguish same-line from different-line input. That plainly doesn't work with user-defined macros, leading to random breakage. - Find better ways to prevent endless loops in roff(7) macro and string expansion. - Finish cleanup of date handling. Decide which formats should be recognized where. Update both mdoc(7) and man(7) documentation. Triggered by Tim van der Molen Tue, 22 Feb 2011 20:30:45 +0100 - struct mparse refactoring Steffen Nurpmeso Thu, 04 Sep 2014 12:50:00 +0200 - Consider creating some views that will make the database more readable from the sqlite3 shell. Consider using them to abstract from the database structure, too. suggested by espie@ Sat, 19 Apr 2014 14:52:57 +0200 ************************************************************************ * CGI issues ************************************************************************ - Enable HTTP compression by detecting gzip encoding and filtering output through libz. - Sandbox (see OpenSSH). - Enable caching support via HTTP 304 and If-Modified-Since. - Allow for cgi.h to be overridden by CGI environment variables. Otherwise, binary distributions will inherit the compile-time behaviour, which is not optimal. - Have Mac OSX systems automatically disable -static compilation of the CGI: -static isn't supported. +************************************************************************ +* to improve in the groff_mdoc(7) macros +************************************************************************ + +- use uname(1) to set doc-default-operating-system at install time + tobimensch Mon, 1 Dec 2014 00:25:07 +0100 Index: projects/arm_intrng/contrib/mdocml/compat_fts.c =================================================================== --- projects/arm_intrng/contrib/mdocml/compat_fts.c (revision 276247) +++ projects/arm_intrng/contrib/mdocml/compat_fts.c (revision 276248) @@ -1,826 +1,805 @@ #include "config.h" #if HAVE_FTS int dummy; #else -/* $Id: compat_fts.c,v 1.4 2014/08/17 20:45:59 schwarze Exp $ */ -/* $OpenBSD: fts.c,v 1.46 2014/05/25 17:47:04 tedu Exp $ */ +/* $Id: compat_fts.c,v 1.6 2014/12/11 18:20:07 schwarze Exp $ */ +/* $OpenBSD: fts.c,v 1.49 2014/11/23 00:14:22 guenther Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #include #include #include #include #include #include #include #include "compat_fts.h" static FTSENT *fts_alloc(FTS *, const char *, size_t); static FTSENT *fts_build(FTS *); static void fts_lfree(FTSENT *); static void fts_load(FTS *, FTSENT *); static size_t fts_maxarglen(char * const *); static void fts_padjust(FTS *, FTSENT *); static int fts_palloc(FTS *, size_t); static unsigned short fts_stat(FTS *, FTSENT *); static int fts_safe_changedir(FTS *, FTSENT *, int, const char *); #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) +#define MAX(a,b) (((a)>(b))?(a):(b)) +#ifndef O_DIRECTORY +#define O_DIRECTORY 0 +#endif #define CLR(opt) (sp->fts_options &= ~(opt)) #define ISSET(opt) (sp->fts_options & (opt)) #define SET(opt) (sp->fts_options |= (opt)) #define FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && fchdir(fd)) FTS * fts_open(char * const *argv, int options, void *dummy) { FTS *sp; FTSENT *p, *root; int nitems; FTSENT *parent, *tmp; size_t len; /* Options check. */ if (options & ~FTS_OPTIONMASK) { errno = EINVAL; return (NULL); } /* Allocate/initialize the stream */ if ((sp = calloc(1, sizeof(FTS))) == NULL) return (NULL); sp->fts_options = options; /* * Start out with 1K of path space, and enough, in any case, * to hold the user's paths. */ if (fts_palloc(sp, MAX(fts_maxarglen(argv), PATH_MAX))) goto mem1; /* Allocate/initialize root's parent. */ if ((parent = fts_alloc(sp, "", 0)) == NULL) goto mem2; parent->fts_level = FTS_ROOTPARENTLEVEL; /* Allocate/initialize root(s). */ for (root = NULL, nitems = 0; *argv; ++argv, ++nitems) { /* Don't allow zero-length paths. */ if ((len = strlen(*argv)) == 0) { errno = ENOENT; goto mem3; } if ((p = fts_alloc(sp, *argv, len)) == NULL) goto mem3; p->fts_level = FTS_ROOTLEVEL; p->fts_parent = parent; p->fts_accpath = p->fts_name; p->fts_info = fts_stat(sp, p); /* Command-line "." and ".." are real directories. */ if (p->fts_info == FTS_DOT) p->fts_info = FTS_D; p->fts_link = NULL; if (root == NULL) tmp = root = p; else { tmp->fts_link = p; tmp = p; } } /* * Allocate a dummy pointer and make fts_read think that we've just * finished the node before the root(s); set p->fts_info to FTS_INIT * so that everything about the "current" node is ignored. */ if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL) goto mem3; sp->fts_cur->fts_link = root; sp->fts_cur->fts_info = FTS_INIT; /* * If using chdir(2), grab a file descriptor pointing to dot to ensure * that we can get back here; this could be avoided for some paths, * but almost certainly not worth the effort. Slashes, symbolic links, * and ".." are all fairly nasty problems. Note, if we can't get the * descriptor we run anyway, just more slowly. */ - if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0) + if (!ISSET(FTS_NOCHDIR) && + (sp->fts_rfd = open(".", O_RDONLY | O_CLOEXEC)) < 0) SET(FTS_NOCHDIR); if (nitems == 0) free(parent); return (sp); mem3: fts_lfree(root); free(parent); mem2: free(sp->fts_path); mem1: free(sp); return (NULL); } static void fts_load(FTS *sp, FTSENT *p) { size_t len; char *cp; /* * Load the stream structure for the next traversal. Since we don't * actually enter the directory until after the preorder visit, set * the fts_accpath field specially so the chdir gets done to the right * place and the user can access the first node. From fts_open it's * known that the path will fit. */ len = p->fts_pathlen = p->fts_namelen; memmove(sp->fts_path, p->fts_name, len + 1); if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) { len = strlen(++cp); memmove(p->fts_name, cp, len + 1); p->fts_namelen = len; } p->fts_accpath = p->fts_path = sp->fts_path; sp->fts_dev = p->fts_dev; } int fts_close(FTS *sp) { FTSENT *freep, *p; int rfd, error = 0; /* * This still works if we haven't read anything -- the dummy structure * points to the root list, so we step through to the end of the root * list which has a valid parent pointer. */ if (sp->fts_cur) { for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) { freep = p; p = p->fts_link ? p->fts_link : p->fts_parent; free(freep); } free(p); } /* Stash the original directory fd if needed. */ rfd = ISSET(FTS_NOCHDIR) ? -1 : sp->fts_rfd; /* Free up child linked list, sort array, path buffer, stream ptr.*/ if (sp->fts_child) fts_lfree(sp->fts_child); free(sp->fts_path); free(sp); /* Return to original directory, checking for error. */ if (rfd != -1) { int saved_errno; error = fchdir(rfd); saved_errno = errno; (void)close(rfd); errno = saved_errno; } return (error); } /* * Special case of "/" at the end of the path so that slashes aren't * appended which would cause paths to be written as "....//foo". */ #define NAPPEND(p) \ (p->fts_path[p->fts_pathlen - 1] == '/' \ ? p->fts_pathlen - 1 : p->fts_pathlen) FTSENT * fts_read(FTS *sp) { FTSENT *p, *tmp; int instr; char *t; /* If finished or unrecoverable error, return NULL. */ if (sp->fts_cur == NULL || ISSET(FTS_STOP)) return (NULL); /* Set current node pointer. */ p = sp->fts_cur; /* Save and zero out user instructions. */ instr = p->fts_instr; p->fts_instr = FTS_NOINSTR; /* Directory in pre-order. */ if (p->fts_info == FTS_D) { /* If skipped or crossed mount point, do post-order visit. */ if (instr == FTS_SKIP || (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) { if (sp->fts_child) { fts_lfree(sp->fts_child); sp->fts_child = NULL; } p->fts_info = FTS_DP; return (p); } /* * Cd to the subdirectory. * * If have already read and now fail to chdir, whack the list * to make the names come out right, and set the parent errno * so the application will eventually get an error condition. * Set the FTS_DONTCHDIR flag so that when we logically change * directories back to the parent we don't do a chdir. * * If haven't read do so. If the read fails, fts_build sets * FTS_STOP or the fts_info field of the node. */ if (sp->fts_child) { if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) { p->fts_errno = errno; p->fts_flags |= FTS_DONTCHDIR; for (p = sp->fts_child; p; p = p->fts_link) p->fts_accpath = p->fts_parent->fts_accpath; } } else if ((sp->fts_child = fts_build(sp)) == NULL) { if (ISSET(FTS_STOP)) return (NULL); return (p); } p = sp->fts_child; sp->fts_child = NULL; goto name; } /* Move to the next node on this level. */ next: tmp = p; if ((p = p->fts_link)) { free(tmp); /* * If reached the top, return to the original directory (or * the root of the tree), and load the paths for the next root. */ if (p->fts_level == FTS_ROOTLEVEL) { if (FCHDIR(sp, sp->fts_rfd)) { SET(FTS_STOP); return (NULL); } fts_load(sp, p); return (sp->fts_cur = p); } /* * User may have called fts_set on the node. If skipped, * ignore. If followed, get a file descriptor so we can * get back if necessary. */ if (p->fts_instr == FTS_SKIP) goto next; name: t = sp->fts_path + NAPPEND(p->fts_parent); *t++ = '/'; memmove(t, p->fts_name, p->fts_namelen + 1); return (sp->fts_cur = p); } /* Move up to the parent node. */ p = tmp->fts_parent; free(tmp); if (p->fts_level == FTS_ROOTPARENTLEVEL) { /* * Done; free everything up and set errno to 0 so the user * can distinguish between error and EOF. */ free(p); errno = 0; return (sp->fts_cur = NULL); } /* NUL terminate the pathname. */ sp->fts_path[p->fts_pathlen] = '\0'; /* * Return to the parent directory. If at a root node or came through * a symlink, go back through the file descriptor. Otherwise, cd up * one directory. */ if (p->fts_level == FTS_ROOTLEVEL) { if (FCHDIR(sp, sp->fts_rfd)) { SET(FTS_STOP); sp->fts_cur = p; return (NULL); } } else if (!(p->fts_flags & FTS_DONTCHDIR) && fts_safe_changedir(sp, p->fts_parent, -1, "..")) { SET(FTS_STOP); sp->fts_cur = p; return (NULL); } p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP; return (sp->fts_cur = p); } /* * Fts_set takes the stream as an argument although it's not used in this * implementation; it would be necessary if anyone wanted to add global * semantics to fts using fts_set. An error return is allowed for similar * reasons. */ /* ARGSUSED */ int fts_set(FTS *sp, FTSENT *p, int instr) { if (instr && instr != FTS_NOINSTR && instr != FTS_SKIP) { errno = EINVAL; return (1); } p->fts_instr = instr; return (0); } /* * This is the tricky part -- do not casually change *anything* in here. The * idea is to build the linked list of entries that are used by fts_children * and fts_read. There are lots of special cases. * * The real slowdown in walking the tree is the stat calls. If FTS_NOSTAT is * set and it's a physical walk (so that symbolic links can't be directories), * we can do things quickly. First, if it's a 4.4BSD file system, the type * of the file is in the directory entry. Otherwise, we assume that the number * of subdirectories in a node is equal to the number of links to the parent. * The former skips all stat calls. The latter skips stat calls in any leaf * directories and for any files after the subdirectories in the directory have * been found, cutting the stat calls by about 2/3. */ static FTSENT * fts_build(FTS *sp) { struct dirent *dp; FTSENT *p, *head; FTSENT *cur, *tail; DIR *dirp; void *oldaddr; size_t dlen, len, maxlen; - int nitems, cderrno, descend, level, nlinks, nostat, doadjust; + int nitems, cderrno, descend, level, doadjust; int saved_errno; char *cp; /* Set current node pointer. */ cur = sp->fts_cur; /* * Open the directory for reading. If this fails, we're done. * If being called from fts_read, set the fts_info field. */ if ((dirp = opendir(cur->fts_accpath)) == NULL) { cur->fts_info = FTS_DNR; cur->fts_errno = errno; return (NULL); } /* - * Nlinks is the number of possible entries of type directory in the - * directory if we're cheating on stat calls, 0 if we're not doing - * any stat calls at all, -1 if we're doing stats on everything. - */ - nlinks = -1; - nostat = 0; - - /* * If we're going to need to stat anything or we want to descend * and stay in the directory, chdir. If this fails we keep going, * but set a flag so we don't chdir after the post-order visit. * We won't be able to stat anything, but we can still return the * names themselves. Note, that since fts_read won't be able to * chdir into the directory, it will have to return different path * names than before, i.e. "a/b" instead of "b". Since the node * has already been visited in pre-order, have to wait until the * post-order visit to return the error. There is a special case * here, if there was nothing to stat then it's not an error to * not be able to stat. This is all fairly nasty. If a program * needed sorted entries or stat information, they had better be * checking FTS_NS on the returned nodes. */ cderrno = 0; if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) { - if (nlinks) - cur->fts_errno = errno; + cur->fts_errno = errno; cur->fts_flags |= FTS_DONTCHDIR; descend = 0; cderrno = errno; (void)closedir(dirp); dirp = NULL; } else descend = 1; /* * Figure out the max file name length that can be stored in the * current path -- the inner loop allocates more path as necessary. * We really wouldn't have to do the maxlen calculations here, we * could do them in fts_read before returning the path, but it's a * lot easier here since the length is part of the dirent structure. * * If not changing directories set a pointer so that can just append * each new name into the path. */ len = NAPPEND(cur); if (ISSET(FTS_NOCHDIR)) { cp = sp->fts_path + len; *cp++ = '/'; } len++; maxlen = sp->fts_pathlen - len; /* * fts_level is signed so we must prevent it from wrapping * around to FTS_ROOTLEVEL and FTS_ROOTPARENTLEVEL. */ level = cur->fts_level; if (level < FTS_MAXLEVEL) level++; /* Read the directory, attaching each entry to the `link' pointer. */ doadjust = 0; for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) { if (ISDOT(dp->d_name)) continue; #if HAVE_DIRENT_NAMLEN dlen = dp->d_namlen; #else dlen = strlen(dp->d_name); #endif if (!(p = fts_alloc(sp, dp->d_name, dlen))) goto mem1; if (dlen >= maxlen) { /* include space for NUL */ oldaddr = sp->fts_path; if (fts_palloc(sp, dlen + len + 1)) { /* * No more memory for path or structures. Save * errno, free up the current structure and the * structures already allocated. */ mem1: saved_errno = errno; if (p) free(p); fts_lfree(head); (void)closedir(dirp); cur->fts_info = FTS_ERR; SET(FTS_STOP); errno = saved_errno; return (NULL); } /* Did realloc() change the pointer? */ if (oldaddr != sp->fts_path) { doadjust = 1; if (ISSET(FTS_NOCHDIR)) cp = sp->fts_path + len; } maxlen = sp->fts_pathlen - len; } p->fts_level = level; p->fts_parent = sp->fts_cur; p->fts_pathlen = len + dlen; if (p->fts_pathlen < len) { /* * If we wrap, free up the current structure and * the structures already allocated, then error * out with ENAMETOOLONG. */ free(p); fts_lfree(head); (void)closedir(dirp); cur->fts_info = FTS_ERR; SET(FTS_STOP); errno = ENAMETOOLONG; return (NULL); } if (cderrno) { - if (nlinks) { - p->fts_info = FTS_NS; - p->fts_errno = cderrno; - } else - p->fts_info = FTS_NSOK; + p->fts_info = FTS_NS; + p->fts_errno = cderrno; p->fts_accpath = cur->fts_accpath; - } else if (nlinks == 0 -#ifdef DT_DIR - || (nostat && - dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN) -#endif - ) { - p->fts_accpath = - ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name; - p->fts_info = FTS_NSOK; } else { /* Build a file name for fts_stat to stat. */ if (ISSET(FTS_NOCHDIR)) { p->fts_accpath = p->fts_path; memmove(cp, p->fts_name, p->fts_namelen + 1); } else p->fts_accpath = p->fts_name; /* Stat it. */ p->fts_info = fts_stat(sp, p); - - /* Decrement link count if applicable. */ - if (nlinks > 0 && (p->fts_info == FTS_D || - p->fts_info == FTS_DC || p->fts_info == FTS_DOT)) - --nlinks; } /* We walk in directory order so "ls -f" doesn't get upset. */ p->fts_link = NULL; if (head == NULL) head = tail = p; else { tail->fts_link = p; tail = p; } ++nitems; } if (dirp) (void)closedir(dirp); /* * If realloc() changed the address of the path, adjust the * addresses for the rest of the tree and the dir list. */ if (doadjust) fts_padjust(sp, head); /* * If not changing directories, reset the path back to original * state. */ if (ISSET(FTS_NOCHDIR)) { if (len == sp->fts_pathlen || nitems == 0) --cp; *cp = '\0'; } /* * If descended after called from fts_children or after called from * fts_read and nothing found, get back. At the root level we use * the saved fd; if one of fts_open()'s arguments is a relative path * to an empty directory, we wind up here with no other way back. If * can't get back, we're done. */ if (descend && !nitems && (cur->fts_level == FTS_ROOTLEVEL ? FCHDIR(sp, sp->fts_rfd) : fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) { cur->fts_info = FTS_ERR; SET(FTS_STOP); return (NULL); } /* If didn't find anything, return NULL. */ if (!nitems) { cur->fts_info = FTS_DP; return (NULL); } return (head); } static unsigned short fts_stat(FTS *sp, FTSENT *p) { FTSENT *t; dev_t dev; ino_t ino; struct stat *sbp; /* If user needs stat info, stat buffer already allocated. */ sbp = p->fts_statp; if (lstat(p->fts_accpath, sbp)) { p->fts_errno = errno; memset(sbp, 0, sizeof(struct stat)); return (FTS_NS); } if (S_ISDIR(sbp->st_mode)) { /* * Set the device/inode. Used to find cycles and check for * crossing mount points. Also remember the link count, used * in fts_build to limit the number of stat calls. It is * understood that these fields are only referenced if fts_info * is set to FTS_D. */ dev = p->fts_dev = sbp->st_dev; ino = p->fts_ino = sbp->st_ino; p->fts_nlink = sbp->st_nlink; if (ISDOT(p->fts_name)) return (FTS_DOT); /* * Cycle detection is done by brute force when the directory * is first encountered. If the tree gets deep enough or the * number of symbolic links to directories is high enough, * something faster might be worthwhile. */ for (t = p->fts_parent; t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent) if (ino == t->fts_ino && dev == t->fts_dev) { p->fts_cycle = t; return (FTS_DC); } return (FTS_D); } if (S_ISLNK(sbp->st_mode)) return (FTS_SL); if (S_ISREG(sbp->st_mode)) return (FTS_F); return (FTS_DEFAULT); } static FTSENT * fts_alloc(FTS *sp, const char *name, size_t namelen) { FTSENT *p; size_t len; len = sizeof(FTSENT) + namelen; if ((p = calloc(1, len)) == NULL) return (NULL); p->fts_path = sp->fts_path; p->fts_namelen = namelen; p->fts_instr = FTS_NOINSTR; p->fts_statp = malloc(sizeof(struct stat)); if (p->fts_statp == NULL) { free(p); return (NULL); } memcpy(p->fts_name, name, namelen); return (p); } static void fts_lfree(FTSENT *head) { FTSENT *p; /* Free a linked list of structures. */ while ((p = head)) { head = head->fts_link; free(p); } } /* * Allow essentially unlimited paths; find, rm, ls should all work on any tree. * Most systems will allow creation of paths much longer than PATH_MAX, even * though the kernel won't resolve them. Add the size (not just what's needed) * plus 256 bytes so don't realloc the path 2 bytes at a time. */ static int fts_palloc(FTS *sp, size_t more) { char *p; /* * Check for possible wraparound. */ more += 256; if (sp->fts_pathlen + more < sp->fts_pathlen) { if (sp->fts_path) free(sp->fts_path); sp->fts_path = NULL; errno = ENAMETOOLONG; return (1); } sp->fts_pathlen += more; p = realloc(sp->fts_path, sp->fts_pathlen); if (p == NULL) { if (sp->fts_path) free(sp->fts_path); sp->fts_path = NULL; return (1); } sp->fts_path = p; return (0); } /* * When the path is realloc'd, have to fix all of the pointers in structures * already returned. */ static void fts_padjust(FTS *sp, FTSENT *head) { FTSENT *p; char *addr = sp->fts_path; #define ADJUST(p) { \ if ((p)->fts_accpath != (p)->fts_name) { \ (p)->fts_accpath = \ (char *)addr + ((p)->fts_accpath - (p)->fts_path); \ } \ (p)->fts_path = addr; \ } /* Adjust the current set of children. */ for (p = sp->fts_child; p; p = p->fts_link) ADJUST(p); /* Adjust the rest of the tree, including the current level. */ for (p = head; p->fts_level >= FTS_ROOTLEVEL;) { ADJUST(p); p = p->fts_link ? p->fts_link : p->fts_parent; } } static size_t fts_maxarglen(char * const *argv) { size_t len, max; for (max = 0; *argv; ++argv) if ((len = strlen(*argv)) > max) max = len; return (max + 1); } /* * Change to dir specified by fd or p->fts_accpath without getting * tricked by someone changing the world out from underneath us. * Assumes p->fts_dev and p->fts_ino are filled in. */ static int fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path) { int ret, oerrno, newfd; struct stat sb; newfd = fd; if (ISSET(FTS_NOCHDIR)) return (0); - if (fd < 0 && (newfd = open(path, O_RDONLY, 0)) < 0) + if (fd < 0 && (newfd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC)) < 0) return (-1); if (fstat(newfd, &sb)) { ret = -1; goto bail; } if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) { errno = ENOENT; /* disinformation */ ret = -1; goto bail; } ret = fchdir(newfd); bail: oerrno = errno; if (fd < 0) (void)close(newfd); errno = oerrno; return (ret); } #endif Index: projects/arm_intrng/contrib/mdocml/compat_reallocarray.c =================================================================== --- projects/arm_intrng/contrib/mdocml/compat_reallocarray.c (revision 276247) +++ projects/arm_intrng/contrib/mdocml/compat_reallocarray.c (revision 276248) @@ -1,43 +1,49 @@ #include "config.h" #if HAVE_REALLOCARRAY int dummy; #else -/* $OpenBSD: malloc.c,v 1.158 2014/04/23 15:07:27 tedu Exp $ */ +/* $Id: compat_reallocarray.c,v 1.4 2014/12/11 09:05:01 schwarze Exp $ */ +/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */ /* * Copyright (c) 2008 Otto Moerbeek * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + #include #include #include #include -#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 4)) +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) void * reallocarray(void *optr, size_t nmemb, size_t size) { if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && nmemb > 0 && SIZE_MAX / nmemb < size) { errno = ENOMEM; return NULL; } return realloc(optr, size * nmemb); } #endif /*!HAVE_REALLOCARRAY*/ Index: projects/arm_intrng/contrib/mdocml/compat_strcasestr.c =================================================================== --- projects/arm_intrng/contrib/mdocml/compat_strcasestr.c (revision 276247) +++ projects/arm_intrng/contrib/mdocml/compat_strcasestr.c (revision 276248) @@ -1,72 +1,73 @@ #include "config.h" #if HAVE_STRCASESTR int dummy; #else -/* ($)NetBSD: strcasestr.c,v 1.2 2005/02/09 21:35:47 kleink Exp $ */ +/* $Id: compat_strcasestr.c,v 1.4 2014/12/11 09:19:32 schwarze Exp $ */ +/* $NetBSD: strcasestr.c,v 1.3 2005/11/29 03:12:00 christos Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) /* * Find the first occurrence of find in s, ignore case. */ char * strcasestr(const char *s, const char *find) { char c, sc; size_t len; if ((c = *find++) != 0) { c = tolower((unsigned char)c); len = strlen(find); do { do { if ((sc = *s++) == 0) return (NULL); } while ((char)tolower((unsigned char)sc) != c); } while (strncasecmp(s, find, len) != 0); s--; } return __UNCONST(s); } #endif Index: projects/arm_intrng/contrib/mdocml/compat_strsep.c =================================================================== --- projects/arm_intrng/contrib/mdocml/compat_strsep.c (revision 276247) +++ projects/arm_intrng/contrib/mdocml/compat_strsep.c (revision 276248) @@ -1,78 +1,79 @@ #include "config.h" #if HAVE_STRSEP int dummy; #else -/* ($)OpenBSD: strsep.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */ +/* $Id: compat_strsep.c,v 1.4 2014/12/11 09:05:01 schwarze Exp $ */ +/* $OpenBSD: strsep.c,v 1.7 2014/02/05 20:42:32 stsp Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /* * Get next token from string *stringp, where tokens are possibly-empty * strings separated by characters from delim. * * Writes NULs into the string at *stringp to end tokens. * delim need not remain constant from call to call. * On return, *stringp points past the last NUL written (if there might * be further tokens), or is NULL (if there are definitely no more tokens). * * If *stringp is NULL, strsep returns NULL. */ char * strsep(char **stringp, const char *delim) { char *s; const char *spanp; int c, sc; char *tok; if ((s = *stringp) == NULL) return (NULL); for (tok = s;;) { c = *s++; spanp = delim; do { if ((sc = *spanp++) == c) { if (c == 0) s = NULL; else s[-1] = 0; *stringp = s; return (tok); } } while (sc != 0); } /* NOTREACHED */ } #endif Index: projects/arm_intrng/contrib/mdocml/config.h =================================================================== --- projects/arm_intrng/contrib/mdocml/config.h (revision 276247) +++ projects/arm_intrng/contrib/mdocml/config.h (revision 276248) @@ -1,46 +1,51 @@ #ifndef MANDOC_CONFIG_H #define MANDOC_CONFIG_H #if defined(__linux__) || defined(__MINT__) #define _GNU_SOURCE /* See test-*.c what needs this. */ #endif #include -#define VERSION "1.13.1" +#define VERSION "1.13.2" #define HAVE_DIRENT_NAMLEN 1 #define HAVE_FGETLN 1 #define HAVE_FTS 1 #define HAVE_GETSUBOPT 1 #define HAVE_MMAP 1 #define HAVE_REALLOCARRAY 0 #define HAVE_STRCASESTR 1 #define HAVE_STRLCAT 1 #define HAVE_STRLCPY 1 #define HAVE_STRPTIME 1 #define HAVE_STRSEP 1 #define HAVE_WCHAR 1 #define HAVE_SQLITE3 1 #define HAVE_SQLITE3_ERRSTR 0 #define HAVE_OHASH 1 #define HAVE_MANPATH 1 + +#define BINM_APROPOS "apropos" +#define BINM_MAN "man" +#define BINM_WHATIS "whatis" +#define BINM_MAKEWHATIS "makewhatis" #if !defined(__BEGIN_DECLS) # ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # else # define __BEGIN_DECLS # endif #endif #if !defined(__END_DECLS) # ifdef __cplusplus # define __END_DECLS } # else # define __END_DECLS # endif #endif extern void *reallocarray(void *, size_t, size_t); extern const char *sqlite3_errstr(int); #endif /* MANDOC_CONFIG_H */ Index: projects/arm_intrng/contrib/mdocml/configure =================================================================== --- projects/arm_intrng/contrib/mdocml/configure (revision 276247) +++ projects/arm_intrng/contrib/mdocml/configure (revision 276248) @@ -1,393 +1,420 @@ #!/bin/sh # # Copyright (c) 2014 Ingo Schwarze # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. set -e [ -e config.log ] && mv config.log config.log.old [ -e config.h ] && mv config.h config.h.old # Output file descriptor usage: # 1 (stdout): config.h, Makefile.local # 2 (stderr): original stderr, usually to the console # 3: config.log exec 3> config.log echo "config.log: writing..." # --- default settings ------------------------------------------------- # Initialize all variables here, # such that nothing can leak in from the environment. -VERSION="1.13.1" +VERSION="1.13.2" echo "VERSION=\"${VERSION}\"" 1>&2 echo "VERSION=\"${VERSION}\"" 1>&3 OSNAME= CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make -f -` CFLAGS="-g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings" DBLIB= STATIC="-static" BUILD_DB=1 BUILD_CGI=0 HAVE_DIRENT_NAMLEN= HAVE_FGETLN= HAVE_FTS= HAVE_GETSUBOPT= HAVE_MMAP= HAVE_REALLOCARRAY= HAVE_STRCASESTR= HAVE_STRLCAT= HAVE_STRLCPY= HAVE_STRPTIME= HAVE_STRSEP= HAVE_WCHAR= HAVE_SQLITE3= HAVE_SQLITE3_ERRSTR= HAVE_OHASH= HAVE_MANPATH= PREFIX="/usr/local" BINDIR= SBINDIR= INCLUDEDIR= LIBDIR= MANDIR= EXAMPLEDIR= WWWPREFIX="/var/www" HTDOCDIR= CGIBINDIR= +BINM_APROPOS="apropos" +BINM_MAN="man" +BINM_WHATIS="whatis" +BINM_MAKEWHATIS="makewhatis" +MANM_MAN="man" +MANM_MDOC="mdoc" +MANM_ROFF="roff" +MANM_EQN="eqn" +MANM_TBL="tbl" + INSTALL="install" INSTALL_PROGRAM= INSTALL_LIB= INSTALL_MAN= INSTALL_DATA= # --- manual settings from configure.local ----------------------------- if [ -e ./configure.local ]; then echo "configure.local: reading..." 1>&2 echo "configure.local: reading..." 1>&3 cat ./configure.local 1>&3 . ./configure.local else echo "configure.local: no (fully automatic configuration)" 1>&2 echo "configure.local: no (fully automatic configuration)" 1>&3 fi echo 1>&3 # --- tests for config.h ---------------------------------------------- COMP="${CC} ${CFLAGS} -Wno-unused -Werror" # Check whether this HAVE_ setting is manually overridden. # If yes, use the override, if no, do not decide anything yet. # Arguments: lower-case test name, manual value ismanual() { [ -z "${2}" ] && return 1 echo "${1}: manual (${2})" 1>&2 echo "${1}: manual (${2})" 1>&3 echo 1>&3 return 0 } # Run a single autoconfiguration test. # In case of success, enable the feature. # In case of failure, do not decide anything yet. # Arguments: lower-case test name, upper-case test name, additional CFLAGS singletest() { cat 1>&3 << __HEREDOC__ ${1}: testing... ${COMP} ${3} -o test-${1} test-${1}.c __HEREDOC__ if ${COMP} ${3} -o "test-${1}" "test-${1}.c" 1>&3 2>&3; then echo "${1}: ${CC} succeeded" 1>&3 else echo "${1}: ${CC} failed with $?" 1>&3 echo 1>&3 return 1 fi if ./test-${1} 1>&3 2>&3; then echo "${1}: yes" 1>&2 echo "${1}: yes" 1>&3 echo 1>&3 eval HAVE_${2}=1 rm "test-${1}" return 0 else echo "${1}: execution failed with $?" 1>&3 echo 1>&3 rm "test-${1}" return 1 fi } # Run a complete autoconfiguration test, including the check for # a manual override and disabling the feature on failure. # Arguments: lower case name, upper case name, additional CFLAGS runtest() { eval _manual=\${HAVE_${2}} ismanual "${1}" "${_manual}" && return 0 singletest "${1}" "${2}" "${3}" && return 0 echo "${1}: no" 1>&2 eval HAVE_${2}=0 return 1 } # --- library functions --- runtest dirent-namlen DIRENT_NAMLEN || true runtest fgetln FGETLN || true runtest fts FTS || true runtest getsubopt GETSUBOPT || true runtest mmap MMAP || true runtest reallocarray REALLOCARRAY || true runtest strcasestr STRCASESTR || true runtest strlcat STRLCAT || true runtest strlcpy STRLCPY || true runtest strptime STRPTIME || true runtest strsep STRSEP || true runtest wchar WCHAR || true # --- sqlite3 --- DETECTLIB= if [ ${BUILD_DB} -eq 0 ]; then echo "BUILD_DB=0 (manual)" 1>&2 echo "BUILD_DB=0 (manual)" 1>&3 echo 1>&3 HAVE_SQLITE3=0 elif ismanual sqlite3 "${HAVE_SQLITE3}"; then DETECTLIB="-lsqlite3" elif [ -n "${DBLIB}" ]; then runtest sqlite3 SQLITE3 "${DBLIB}" || true elif singletest sqlite3 SQLITE3 "-lsqlite3"; then DETECTLIB="-lsqlite3" elif runtest sqlite3 SQLITE3 \ "-I/usr/local/include -L/usr/local/lib -lsqlite3"; then DETECTLIB="-L/usr/local/lib -lsqlite3" CFLAGS="${CFLAGS} -I/usr/local/include" fi if [ ${BUILD_DB} -gt 0 -a ${HAVE_SQLITE3} -eq 0 ]; then echo "BUILD_DB=0 (no sqlite3)" 1>&2 echo "BUILD_DB=0 (no sqlite3)" 1>&3 echo 1>&3 BUILD_DB=0 fi # --- sqlite3_errstr --- if [ ${BUILD_DB} -eq 0 ]; then HAVE_SQLITE3_ERRSTR=1 elif ismanual sqlite3_errstr "${HAVE_SQLITE3_ERRSTR}"; then : elif [ -n "${DBLIB}" ]; then runtest sqlite3_errstr SQLITE3_ERRSTR "${DBLIB}" || true else runtest sqlite3_errstr SQLITE3_ERRSTR "${DETECTLIB}" || true fi # --- ohash --- if [ ${BUILD_DB} -eq 0 ]; then HAVE_OHASH=1 elif ismanual ohash "${HAVE_OHASH}"; then : elif [ -n "${DBLIB}" ]; then runtest ohash OHASH "${DBLIB}" || true elif singletest ohash OHASH; then : elif runtest ohash OHASH "-lutil"; then DETECTLIB="${DETECTLIB} -lutil" fi # --- DBLIB --- if [ ${BUILD_DB} -eq 0 ]; then DBLIB= elif [ -z "${DBLIB}" ]; then DBLIB="${DETECTLIB}" echo "DBLIB=\"${DBLIB}\"" 1>&2 echo "DBLIB=\"${DBLIB}\"" 1>&3 echo 1>&3 fi # --- manpath --- if [ ${BUILD_DB} -eq 0 ]; then HAVE_MANPATH=0 elif ismanual manpath "${HAVE_MANPATH}"; then : elif manpath 1>&3 2>&3; then echo "manpath: yes" 1>&2 echo "manpath: yes" 1>&3 echo 1>&3 HAVE_MANPATH=1 else echo "manpath: no" 1>&2 echo "manpath: no" 1>&3 echo 1>&3 HAVE_MANPATH=0 fi # --- write config.h --- exec > config.h cat << __HEREDOC__ #ifndef MANDOC_CONFIG_H #define MANDOC_CONFIG_H #if defined(__linux__) || defined(__MINT__) #define _GNU_SOURCE /* See test-*.c what needs this. */ #endif __HEREDOC__ [ ${HAVE_FGETLN} -eq 0 -o ${HAVE_REALLOCARRAY} -eq 0 -o \ ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 ] \ && echo "#include " [ ${HAVE_FGETLN} -eq 0 ] && echo "#include " echo echo "#define VERSION \"${VERSION}\"" [ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\"" cat << __HEREDOC__ #define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN} #define HAVE_FGETLN ${HAVE_FGETLN} #define HAVE_FTS ${HAVE_FTS} #define HAVE_GETSUBOPT ${HAVE_GETSUBOPT} #define HAVE_MMAP ${HAVE_MMAP} #define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY} #define HAVE_STRCASESTR ${HAVE_STRCASESTR} #define HAVE_STRLCAT ${HAVE_STRLCAT} #define HAVE_STRLCPY ${HAVE_STRLCPY} #define HAVE_STRPTIME ${HAVE_STRPTIME} #define HAVE_STRSEP ${HAVE_STRSEP} #define HAVE_WCHAR ${HAVE_WCHAR} #define HAVE_SQLITE3 ${HAVE_SQLITE3} #define HAVE_SQLITE3_ERRSTR ${HAVE_SQLITE3_ERRSTR} #define HAVE_OHASH ${HAVE_OHASH} #define HAVE_MANPATH ${HAVE_MANPATH} +#define BINM_APROPOS "${BINM_APROPOS}" +#define BINM_MAN "${BINM_MAN}" +#define BINM_WHATIS "${BINM_WHATIS}" +#define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}" + #if !defined(__BEGIN_DECLS) # ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # else # define __BEGIN_DECLS # endif #endif #if !defined(__END_DECLS) # ifdef __cplusplus # define __END_DECLS } # else # define __END_DECLS # endif #endif __HEREDOC__ [ ${HAVE_FGETLN} -eq 0 ] && \ echo "extern char *fgetln(FILE *, size_t *);" [ ${HAVE_GETSUBOPT} -eq 0 ] && \ echo "extern int getsubopt(char **, char * const *, char **);" [ ${HAVE_REALLOCARRAY} -eq 0 ] && \ echo "extern void *reallocarray(void *, size_t, size_t);" [ ${BUILD_DB} -gt 0 -a ${HAVE_SQLITE3_ERRSTR} -eq 0 ] && echo "extern const char *sqlite3_errstr(int);" [ ${HAVE_STRCASESTR} -eq 0 ] && \ echo "extern char *strcasestr(const char *, const char *);" [ ${HAVE_STRLCAT} -eq 0 ] && \ echo "extern size_t strlcat(char *, const char *, size_t);" [ ${HAVE_STRLCPY} -eq 0 ] && \ echo "extern size_t strlcpy(char *, const char *, size_t);" [ ${HAVE_STRSEP} -eq 0 ] && \ echo "extern char *strsep(char **, const char *);" echo echo "#endif /* MANDOC_CONFIG_H */" echo "config.h: written" 1>&2 echo "config.h: written" 1>&3 # --- tests for Makefile.local ----------------------------------------- exec > Makefile.local [ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin" [ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin" [ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include/mandoc" [ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib/mandoc" [ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man" [ -z "${EXAMPLEDIR}" ] && EXAMPLEDIR="${PREFIX}/share/examples/mandoc" [ -z "${HTDOCDIR}" ] && HTDOCDIR="${WWWPREFIX}/htdocs" [ -z "${CGIBINDIR}" ] && CGIBINDIR="${WWWPREFIX}/cgi-bin" [ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555" [ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444" [ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444" [ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444" if [ ${BUILD_DB} -eq 0 -a ${BUILD_CGI} -gt 0 ]; then echo "BUILD_CGI=0 (no BUILD_DB)" 1>&2 echo "BUILD_CGI=0 (no BUILD_DB)" 1>&3 BUILD_CGI=0 fi BUILD_TARGETS="base-build" -[ ${BUILD_DB} -gt 0 ] && BUILD_TARGETS="${BUILD_TARGETS} db-build" [ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="${BUILD_TARGETS} cgi-build" +INSTALL_TARGETS="base-install" +[ ${BUILD_DB} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} db-install" +[ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install" cat << __HEREDOC__ VERSION = ${VERSION} BUILD_TARGETS = ${BUILD_TARGETS} +INSTALL_TARGETS = ${INSTALL_TARGETS} CFLAGS = ${CFLAGS} DBLIB = ${DBLIB} STATIC = ${STATIC} PREFIX = ${PREFIX} BINDIR = ${BINDIR} SBINDIR = ${SBINDIR} INCLUDEDIR = ${INCLUDEDIR} LIBDIR = ${LIBDIR} MANDIR = ${MANDIR} EXAMPLEDIR = ${EXAMPLEDIR} WWWPREFIX = ${WWWPREFIX} HTDOCDIR = ${HTDOCDIR} CGIBINDIR = ${CGIBINDIR} +BINM_APROPOS = ${BINM_APROPOS} +BINM_MAN = ${BINM_MAN} +BINM_WHATIS = ${BINM_WHATIS} +BINM_MAKEWHATIS = ${BINM_MAKEWHATIS} +MANM_MAN = ${MANM_MAN} +MANM_MDOC = ${MANM_MDOC} +MANM_ROFF = ${MANM_ROFF} +MANM_EQN = ${MANM_EQN} +MANM_TBL = ${MANM_TBL} INSTALL = ${INSTALL} INSTALL_PROGRAM = ${INSTALL_PROGRAM} INSTALL_LIB = ${INSTALL_LIB} INSTALL_MAN = ${INSTALL_MAN} INSTALL_DATA = ${INSTALL_DATA} __HEREDOC__ [ ${BUILD_DB} -gt 0 ] && \ - echo "MAN_OBJS = \$(MANDOC_OBJS) \$(APROPOS_OBJS)" + echo "MAIN_OBJS = \$(BASE_OBJS) \$(DB_OBJS)" echo "Makefile.local: written" 1>&2 echo "Makefile.local: written" 1>&3 exit 0 Index: projects/arm_intrng/contrib/mdocml/configure.local.example =================================================================== --- projects/arm_intrng/contrib/mdocml/configure.local.example (revision 276247) +++ projects/arm_intrng/contrib/mdocml/configure.local.example (revision 276248) @@ -1,189 +1,217 @@ -# $Id: configure.local.example,v 1.1 2014/08/16 19:00:01 schwarze Exp $ +# $Id: configure.local.example,v 1.2 2014/12/09 09:14:33 schwarze Exp $ # # Copyright (c) 2014 Ingo Schwarze # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permission notice appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # For all settings documented in this file, there are reasonable # defaults and/or the ./configure script attempts autodetection. # Consequently, you only need to create a file ./configure.local # and put any of these settings into it if ./configure autodetection # fails or if you want to make different choices for other reasons. # If autodetection fails, please tell . # We recommend that you write ./configure.local from scratch and # only put the lines there you need. This file contains examples. # It is not intended as a template to be copied as a whole. # --- user settings relevant for all builds ---------------------------- # For -Tutf8 and -Tlocale operation, mandoc(1) requires # providing setlocale(3) and providing wcwidth(3) and # putwchar(3) with a wchar_t storing UCS-4 values. Theoretically, # the latter should be tested with the __STDC_ISO_10646__ feature # macro. In practice, many headers do not provide that # macro even though they treat wchar_t as UCS-4. So the automatic # test only checks that wchar_t is wide enough, that is, at least # four bytes. # The following line forces multi-byte support. # If your C library does not treat wchar_t as UCS-4, the UTF-8 output # mode will print garbage. HAVE_WCHAR=1 # The following line disables multi-byte support. # The output modes -Tutf8 and -Tlocale will be the same as -Tascii. HAVE_WCHAR=0 # In manual pages written in the mdoc(7) language, the operating system # version is displayed in the page footer line. If an operating system # is specified as an argument to the .Os macro, that is always used. # If the .Os macro has no argument and an operation system is specified # with the mandoc(1) -Ios= command line option, that is used. # Otherwise, the uname(3) library function is called at runtime to find # the name of the operating system. # If you do not want uname(3) to be called but instead want a fixed # string to be used, use the following line: -OSNAME="OpenBSD 5.5" +OSNAME="OpenBSD 5.6" # The following installation directories are used. # It is possible to set only one or a few of these variables, # there is no need to copy the whole block. # Even if you set PREFIX to something else, the other variables # pick it up without copying them all over. PREFIX="/usr/local" BINDIR="${PREFIX}/bin" SBINDIR="${PREFIX}/sbin" INCLUDEDIR="${PREFIX}/include/mandoc" LIBDIR="${PREFIX}/lib/mandoc" MANDIR="${PREFIX}/man" EXAMPLEDIR="${PREFIX}/share/examples/mandoc" +# Some distributions may want to avoid naming conflicts among manuals. +# If you want to change the names of installed section 7 manual pages, +# the following alternative names are suggested. +# The suffix ".7" will automatically be appended. +# It is possible to set only one or a few of these variables, +# there is no need to copy the whole block. + +MANM_MAN="mandoc_man" # default is "man" +MANM_MDOC="mandoc_mdoc" # default is "mdoc" +MANM_ROFF="mandoc_roff" # default is "roff" +MANM_EQN="mandoc_eqn" # default is "eqn" +MANM_TBL="mandoc_tbl" # default is "tbl" + # It is possible to change the utility program used for installation # and the modes files are installed with. The defaults are: INSTALL="install" INSTALL_PROGRAM="${INSTALL} -m 0555" INSTALL_LIB="${INSTALL} -m 0444" INSTALL_MAN="${INSTALL} -m 0444" INSTALL_DATA="${INSTALL} -m 0444" # --- user settings related to database support ------------------------ # By default, building makewhatis(8) and apropos(1) is enabled. # To disable it, for example to avoid the dependency on SQLite3, # use the following line. It that case, the remaining settings # in this section are irrelevant. BUILD_DB=0 # Two libraries are needed: SQLite3 and ohash(3). # Autoconfiguration tries the following linker flags to find them. # If none of these work, add a working DBLIB line to configure.local, # disabling autodetection for library directories. DBLIB="-lsqlite3" DBLIB="-lsqlite3 -lutil" DBLIB="-L/usr/local/lib -lsqlite3" # When library autodetection decides to use -L/usr/local/lib, # -I/usr/local/include is automatically added to CFLAGS. # If you manually set DBLIB to something including -L/usr/local/lib, # chances are you will also need the following line: CFLAGS="${CFLAGS} -I/usr/local/include" # The man(1) utility needs to know where the manuals reside. # We know of two ways to tell it: via manpath(1) or man.conf(5). # The latter is used by OpenBSD and NetBSD, the former by most # other systems. # Force usage of manpath(1). # If it is not installed or not operational, # makewhatis(8) and apropos(1) will not work properly. HAVE_MANPATH=1 # Force usage of man.conf(5). # If it does not exist or contains no valid configuration, # makewhatis(8) and apropos(1) will not work properly. HAVE_MANPATH=0 + +# Some distributions may want to avoid naming conflicts +# with groff, man-db, or other tools. +# If you want to change the names of binary programs, +# the following alternative names are suggested. +# Using other names is possible as well. +# This changes the names of the installed section 1 and section 8 +# manual pages as well. +# It is possible to set only one or a few of these variables, +# there is no need to copy the whole block. + +BINM_APROPOS=mapropos # default is "apropos" +BINM_MAN=mman # default is "man" +BINM_WHATIS=mwhatis # default is "whatis" +BINM_MAKEWHATIS=mandocdb # default is "makewhatis" # --- user settings related man.cgi ------------------------------------ # By default, building man.cgi(8) is disabled. To enable it, copy # cgi.h.example to cgi.h, edit it, and use the following line. # Obviously, this requires that BUILD_DB is enabled, too. BUILD_CGI=1 # The remaining settings in this section are only relevant if BUILD_CGI # is enabled. Otherwise, they have no effect either way. # By default, man.cgi(8) is linked statically. # Some systems do not support static linking, for example Mac OS X. # In that case, use the following line: STATIC= # Some systems, for example Linux, require -pthread for static linking: STATIC="-static -pthread" # Some directories. # This works just like PREFIX, see above. WWWPREFIX="/var/www" HTDOCDIR="${WWWPREFIX}/htdocs" CGIBINDIR="${WWWPREFIX}/cgi-bin" # --- settings that rarely need to be touched -------------------------- # Do not set these variables unless you really need to. # You can manually override the compiler to be used. # But that's rarely useful because ./configure asks your make(1) # which compiler to use, and that answer will hardly be wrong. CC=cc # The default compiler flags are: CFLAGS="-g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings" # In rare cases, it may be required to skip individual automatic tests. # Each of the following variables can be set to 0 (test will not be run # and will be regarded as failed) or 1 (test will not be run and will # be regarded as successful). HAVE_DIRENT_NAMLEN=0 HAVE_FGETLN=0 HAVE_FTS=0 HAVE_GETSUBOPT=0 HAVE_MMAP=0 HAVE_REALLOCARRAY=0 HAVE_STRCASESTR=0 HAVE_STRLCAT=0 HAVE_STRLCPY=0 HAVE_STRPTIME=0 HAVE_STRSEP=0 HAVE_SQLITE3=0 HAVE_SQLITE3_ERRSTR=0 HAVE_OHASH=0 Index: projects/arm_intrng/contrib/mdocml/example.style.css =================================================================== --- projects/arm_intrng/contrib/mdocml/example.style.css (revision 276247) +++ projects/arm_intrng/contrib/mdocml/example.style.css (revision 276248) @@ -1,111 +1,114 @@ -/* $Id: example.style.css,v 1.53 2014/09/27 11:16:24 kristaps Exp $ */ +/* $Id: example.style.css,v 1.54 2014/12/10 22:19:45 schwarze Exp $ */ /* * This is an example style-sheet provided for mandoc(1) and the -Thtml * or -Txhtml output mode. * It mimics the appearance of the legacy man.cgi output. * See mdoc(7) and man(7) for macro explanations. */ div.mandoc { min-width: 102ex; width: 102ex; font-family: monospace; } /* This is the outer node of all mandoc -T[x]html documents. */ div.mandoc h1 { margin-bottom: 0ex; font-size: inherit; margin-left: -4ex; } /* Section header (Sh, SH). */ div.mandoc h2 { margin-bottom: 0ex; font-size: inherit; margin-left: -2ex; } /* Sub-section header (Ss, SS). */ div.mandoc table { width: 100%; margin-top: 0ex; margin-bottom: 0ex; } /* All tables. */ div.mandoc td { vertical-align: top; } /* All table cells. */ div.mandoc p { } /* Paragraph: Pp, Lp. */ div.mandoc blockquote { margin-left: 5ex; margin-top: 0ex; margin-bottom: 0ex; } /* D1, Dl. */ div.mandoc div.section { margin-bottom: 2ex; margin-left: 5ex; } /* Sections (Sh, SH). */ div.mandoc div.subsection { } /* Sub-sections (Ss, SS). */ div.mandoc table.synopsis { } /* SYNOPSIS section table. */ div.mandoc table.foot { } /* Document footer. */ div.mandoc td.foot-date { width: 50%; } /* Document footer: date. */ -div.mandoc td.foot-os { width: 50%; } /* Document footer: OS/source. */ +div.mandoc td.foot-os { width: 50%; + text-align: right; } /* Document footer: OS/source. */ div.mandoc table.head { } /* Document header. */ div.mandoc td.head-ltitle { width: 10%; } /* Document header: left-title. */ -div.mandoc td.head-vol { width: 80%; } /* Document header: volume. */ -div.mandoc td.head-rtitle { width: 10%; } /* Document header: right-title. */ +div.mandoc td.head-vol { width: 80%; + text-align: center; } /* Document header: volume. */ +div.mandoc td.head-rtitle { width: 10%; + text-align: right; } /* Document header: right-title. */ div.mandoc .display { } /* All Bd, D1, Dl. */ div.mandoc .list { } /* All Bl. */ div.mandoc i { } /* Italic: BI, IB, I, (implicit). */ div.mandoc b { } /* Bold: SB, BI, IB, BR, RB, B, (implicit). */ div.mandoc small { } /* Small: SB, SM. */ div.mandoc .emph { font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */ div.mandoc .symb { font-style: normal; font-weight: bold; } /* Symbolic: Sy, Ms, Bf -symbolic. */ div.mandoc .lit { font-style: normal; font-weight: normal; font-family: monospace; } /* Literal: Dl, Li, Ql, Bf -literal, Bl -literal, Bl -unfilled. */ div.mandoc i.addr { font-weight: normal; } /* Address (Ad). */ div.mandoc i.arg { font-weight: normal; } /* Command argument (Ar). */ div.mandoc span.author { } /* Author name (An). */ div.mandoc b.cmd { font-style: normal; } /* Command (Cm). */ div.mandoc b.config { font-style: normal; } /* Config statement (Cd). */ div.mandoc span.define { } /* Defines (Dv). */ div.mandoc span.desc { } /* Nd. After em-dash. */ div.mandoc b.diag { font-style: normal; } /* Diagnostic (Bl -diag). */ div.mandoc span.env { } /* Environment variables (Ev). */ div.mandoc span.errno { } /* Error string (Er). */ div.mandoc i.farg { font-weight: normal; } /* Function argument (Fa, Fn). */ div.mandoc i.file { font-weight: normal; } /* File (Pa). */ div.mandoc b.flag { font-style: normal; } /* Flag (Fl, Cm). */ div.mandoc b.fname { font-style: normal; } /* Function name (Fa, Fn, Rv). */ div.mandoc i.ftype { font-weight: normal; } /* Function types (Ft, Fn). */ div.mandoc b.includes { font-style: normal; } /* Header includes (In). */ div.mandoc span.lib { } /* Library (Lb). */ div.mandoc i.link-sec { font-weight: normal; } /* Section links (Sx). */ div.mandoc b.macro { font-style: normal; } /* Macro-ish thing (Fd). */ div.mandoc b.name { font-style: normal; } /* Name of utility (Nm). */ div.mandoc span.opt { } /* Options (Op, Oo/Oc). */ div.mandoc span.ref { } /* Citations (Rs). */ div.mandoc span.ref-auth { } /* Reference author (%A). */ div.mandoc i.ref-book { font-weight: normal; } /* Reference book (%B). */ div.mandoc span.ref-city { } /* Reference city (%C). */ div.mandoc span.ref-date { } /* Reference date (%D). */ div.mandoc i.ref-issue { font-weight: normal; } /* Reference issuer/publisher (%I). */ div.mandoc i.ref-jrnl { font-weight: normal; } /* Reference journal (%J). */ div.mandoc span.ref-num { } /* Reference number (%N). */ div.mandoc span.ref-opt { } /* Reference optionals (%O). */ div.mandoc span.ref-page { } /* Reference page (%P). */ div.mandoc span.ref-corp { } /* Reference corporate/foreign author (%Q). */ div.mandoc span.ref-rep { } /* Reference report (%R). */ div.mandoc span.ref-title { text-decoration: underline; } /* Reference title (%T). */ div.mandoc span.ref-vol { } /* Reference volume (%V). */ div.mandoc span.type { font-style: italic; font-weight: normal; } /* Variable types (Vt). */ div.mandoc span.unix { } /* Unices (Ux, Ox, Nx, Fx, Bx, Bsx, Dx). */ div.mandoc b.utility { font-style: normal; } /* Name of utility (Ex). */ div.mandoc b.var { font-style: normal; } /* Variables (Rv). */ div.mandoc a.link-ext { } /* Off-site link (Lk). */ div.mandoc a.link-includes { } /* Include-file link (In). */ div.mandoc a.link-mail { } /* Mailto links (Mt). */ div.mandoc a.link-man { } /* Manual links (Xr). */ div.mandoc a.link-ref { } /* Reference section links (%Q). */ div.mandoc a.link-sec { } /* Section links (Sx). */ div.mandoc dl.list-diag { } /* Formatting for lists. See mdoc(7). */ div.mandoc dt.list-diag { } div.mandoc dd.list-diag { } div.mandoc dl.list-hang { } div.mandoc dt.list-hang { } div.mandoc dd.list-hang { } div.mandoc dl.list-inset { } div.mandoc dt.list-inset { } div.mandoc dd.list-inset { } div.mandoc dl.list-ohang { } div.mandoc dt.list-ohang { } div.mandoc dd.list-ohang { margin-left: 0ex; } div.mandoc dl.list-tag { } div.mandoc dt.list-tag { } div.mandoc dd.list-tag { } div.mandoc table.list-col { } div.mandoc tr.list-col { } div.mandoc td.list-col { } div.mandoc ul.list-bul { list-style-type: disc; padding-left: 1em; } div.mandoc li.list-bul { } div.mandoc ul.list-dash { list-style-type: none; padding-left: 0em; } div.mandoc li.list-dash:before { content: "\2014 "; } div.mandoc ul.list-hyph { list-style-type: none; padding-left: 0em; } div.mandoc li.list-hyph:before { content: "\2013 "; } div.mandoc ul.list-item { list-style-type: none; padding-left: 0em; } div.mandoc li.list-item { } div.mandoc ol.list-enum { padding-left: 2em; } div.mandoc li.list-enum { } div.mandoc span.eqn { } /* Equation modes. See eqn(7). */ div.mandoc table.tbl { } /* Table modes. See tbl(7). */ div.mandoc div.spacer { margin: 1em 0; } Index: projects/arm_intrng/contrib/mdocml/html.c =================================================================== --- projects/arm_intrng/contrib/mdocml/html.c (revision 276247) +++ projects/arm_intrng/contrib/mdocml/html.c (revision 276248) @@ -1,759 +1,759 @@ -/* $Id: html.c,v 1.181 2014/10/29 00:17:43 schwarze Exp $ */ +/* $Id: html.c,v 1.183 2014/12/02 10:08:06 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include "mandoc.h" #include "mandoc_aux.h" -#include "libmandoc.h" #include "out.h" #include "html.h" #include "main.h" struct htmldata { const char *name; int flags; #define HTML_CLRLINE (1 << 0) #define HTML_NOSTACK (1 << 1) #define HTML_AUTOCLOSE (1 << 2) /* Tag has auto-closure. */ }; static const struct htmldata htmltags[TAG_MAX] = { {"html", HTML_CLRLINE}, /* TAG_HTML */ {"head", HTML_CLRLINE}, /* TAG_HEAD */ {"body", HTML_CLRLINE}, /* TAG_BODY */ {"meta", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_META */ {"title", HTML_CLRLINE}, /* TAG_TITLE */ {"div", HTML_CLRLINE}, /* TAG_DIV */ {"h1", 0}, /* TAG_H1 */ {"h2", 0}, /* TAG_H2 */ {"span", 0}, /* TAG_SPAN */ {"link", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_LINK */ {"br", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_BR */ {"a", 0}, /* TAG_A */ {"table", HTML_CLRLINE}, /* TAG_TABLE */ {"tbody", HTML_CLRLINE}, /* TAG_TBODY */ {"col", HTML_CLRLINE | HTML_NOSTACK | HTML_AUTOCLOSE}, /* TAG_COL */ {"tr", HTML_CLRLINE}, /* TAG_TR */ {"td", HTML_CLRLINE}, /* TAG_TD */ {"li", HTML_CLRLINE}, /* TAG_LI */ {"ul", HTML_CLRLINE}, /* TAG_UL */ {"ol", HTML_CLRLINE}, /* TAG_OL */ {"dl", HTML_CLRLINE}, /* TAG_DL */ {"dt", HTML_CLRLINE}, /* TAG_DT */ {"dd", HTML_CLRLINE}, /* TAG_DD */ {"blockquote", HTML_CLRLINE}, /* TAG_BLOCKQUOTE */ {"pre", HTML_CLRLINE }, /* TAG_PRE */ {"b", 0 }, /* TAG_B */ {"i", 0 }, /* TAG_I */ {"code", 0 }, /* TAG_CODE */ {"small", 0 }, /* TAG_SMALL */ {"style", HTML_CLRLINE}, /* TAG_STYLE */ {"math", HTML_CLRLINE}, /* TAG_MATH */ {"mrow", 0}, /* TAG_MROW */ {"mi", 0}, /* TAG_MI */ {"mo", 0}, /* TAG_MO */ {"msup", 0}, /* TAG_MSUP */ {"msub", 0}, /* TAG_MSUB */ {"msubsup", 0}, /* TAG_MSUBSUP */ {"mfrac", 0}, /* TAG_MFRAC */ {"msqrt", 0}, /* TAG_MSQRT */ {"mfenced", 0}, /* TAG_MFENCED */ {"mtable", 0}, /* TAG_MTABLE */ {"mtr", 0}, /* TAG_MTR */ {"mtd", 0}, /* TAG_MTD */ {"munderover", 0}, /* TAG_MUNDEROVER */ {"munder", 0}, /* TAG_MUNDER*/ {"mover", 0}, /* TAG_MOVER*/ }; static const char *const htmlattrs[ATTR_MAX] = { "name", /* ATTR_NAME */ "rel", /* ATTR_REL */ "href", /* ATTR_HREF */ "type", /* ATTR_TYPE */ "media", /* ATTR_MEDIA */ "class", /* ATTR_CLASS */ "style", /* ATTR_STYLE */ "id", /* ATTR_ID */ "colspan", /* ATTR_COLSPAN */ "charset", /* ATTR_CHARSET */ "open", /* ATTR_OPEN */ "close", /* ATTR_CLOSE */ "mathvariant", /* ATTR_MATHVARIANT */ }; static const char *const roffscales[SCALE_MAX] = { "cm", /* SCALE_CM */ "in", /* SCALE_IN */ "pc", /* SCALE_PC */ "pt", /* SCALE_PT */ "em", /* SCALE_EM */ "em", /* SCALE_MM */ "ex", /* SCALE_EN */ "ex", /* SCALE_BU */ "em", /* SCALE_VS */ "ex", /* SCALE_FS */ }; static void bufncat(struct html *, const char *, size_t); static void print_ctag(struct html *, enum htmltag); static int print_escape(char); static int print_encode(struct html *, const char *, int); static void print_metaf(struct html *, enum mandoc_esc); static void print_attr(struct html *, const char *, const char *); void * html_alloc(const struct mchars *mchars, char *outopts) { struct html *h; const char *toks[5]; char *v; toks[0] = "style"; toks[1] = "man"; toks[2] = "includes"; toks[3] = "fragment"; toks[4] = NULL; h = mandoc_calloc(1, sizeof(struct html)); h->tags.head = NULL; h->symtab = mchars; while (outopts && *outopts) switch (getsubopt(&outopts, UNCONST(toks), &v)) { case 0: h->style = v; break; case 1: h->base_man = v; break; case 2: h->base_includes = v; break; case 3: h->oflags |= HTML_FRAGMENT; break; default: break; } return(h); } void html_free(void *p) { struct tag *tag; struct html *h; h = (struct html *)p; while ((tag = h->tags.head) != NULL) { h->tags.head = tag->next; free(tag); } free(h); } void print_gen_head(struct html *h) { struct htmlpair tag[4]; struct tag *t; tag[0].key = ATTR_CHARSET; tag[0].val = "utf-8"; print_otag(h, TAG_META, 1, tag); /* * Print a default style-sheet. */ t = print_otag(h, TAG_STYLE, 0, NULL); print_text(h, "table.head, table.foot { width: 100%; }\n" "td.head-rtitle, td.foot-os { text-align: right; }\n" "td.head-vol { text-align: center; }\n" "table.foot td { width: 50%; }\n" "table.head td { width: 33%; }\n" "div.spacer { margin: 1em 0; }\n"); print_tagq(h, t); if (h->style) { tag[0].key = ATTR_REL; tag[0].val = "stylesheet"; tag[1].key = ATTR_HREF; tag[1].val = h->style; tag[2].key = ATTR_TYPE; tag[2].val = "text/css"; tag[3].key = ATTR_MEDIA; tag[3].val = "all"; print_otag(h, TAG_LINK, 4, tag); } } static void print_metaf(struct html *h, enum mandoc_esc deco) { enum htmlfont font; switch (deco) { case ESCAPE_FONTPREV: font = h->metal; break; case ESCAPE_FONTITALIC: font = HTMLFONT_ITALIC; break; case ESCAPE_FONTBOLD: font = HTMLFONT_BOLD; break; case ESCAPE_FONTBI: font = HTMLFONT_BI; break; case ESCAPE_FONT: /* FALLTHROUGH */ case ESCAPE_FONTROMAN: font = HTMLFONT_NONE; break; default: abort(); /* NOTREACHED */ } if (h->metaf) { print_tagq(h, h->metaf); h->metaf = NULL; } h->metal = h->metac; h->metac = font; switch (font) { case HTMLFONT_ITALIC: h->metaf = print_otag(h, TAG_I, 0, NULL); break; case HTMLFONT_BOLD: h->metaf = print_otag(h, TAG_B, 0, NULL); break; case HTMLFONT_BI: h->metaf = print_otag(h, TAG_B, 0, NULL); print_otag(h, TAG_I, 0, NULL); break; default: break; } } int html_strlen(const char *cp) { size_t rsz; int skip, sz; /* * Account for escaped sequences within string length * calculations. This follows the logic in term_strlen() as we * must calculate the width of produced strings. * Assume that characters are always width of "1". This is * hacky, but it gets the job done for approximation of widths. */ sz = 0; skip = 0; while (1) { rsz = strcspn(cp, "\\"); if (rsz) { cp += rsz; if (skip) { skip = 0; rsz--; } sz += rsz; } if ('\0' == *cp) break; cp++; switch (mandoc_escape(&cp, NULL, NULL)) { case ESCAPE_ERROR: return(sz); case ESCAPE_UNICODE: /* FALLTHROUGH */ case ESCAPE_NUMBERED: /* FALLTHROUGH */ case ESCAPE_SPECIAL: if (skip) skip = 0; else sz++; break; case ESCAPE_SKIPCHAR: skip = 1; break; default: break; } } return(sz); } static int print_escape(char c) { switch (c) { case '<': printf("<"); break; case '>': printf(">"); break; case '&': printf("&"); break; case '"': printf("""); break; case ASCII_NBRSP: putchar('-'); break; case ASCII_HYPH: putchar('-'); /* FALLTHROUGH */ case ASCII_BREAK: break; default: return(0); } return(1); } static int print_encode(struct html *h, const char *p, int norecurse) { size_t sz; int c, len, nospace; const char *seq; enum mandoc_esc esc; static const char rejs[9] = { '\\', '<', '>', '&', '"', ASCII_NBRSP, ASCII_HYPH, ASCII_BREAK, '\0' }; nospace = 0; while ('\0' != *p) { if (HTML_SKIPCHAR & h->flags && '\\' != *p) { h->flags &= ~HTML_SKIPCHAR; p++; continue; } sz = strcspn(p, rejs); fwrite(p, 1, sz, stdout); p += (int)sz; if ('\0' == *p) break; if (print_escape(*p++)) continue; esc = mandoc_escape(&p, &seq, &len); if (ESCAPE_ERROR == esc) break; switch (esc) { case ESCAPE_FONT: /* FALLTHROUGH */ case ESCAPE_FONTPREV: /* FALLTHROUGH */ case ESCAPE_FONTBOLD: /* FALLTHROUGH */ case ESCAPE_FONTITALIC: /* FALLTHROUGH */ case ESCAPE_FONTBI: /* FALLTHROUGH */ case ESCAPE_FONTROMAN: if (0 == norecurse) print_metaf(h, esc); continue; case ESCAPE_SKIPCHAR: h->flags |= HTML_SKIPCHAR; continue; default: break; } if (h->flags & HTML_SKIPCHAR) { h->flags &= ~HTML_SKIPCHAR; continue; } switch (esc) { case ESCAPE_UNICODE: /* Skip past "u" header. */ c = mchars_num2uc(seq + 1, len - 1); break; case ESCAPE_NUMBERED: c = mchars_num2char(seq, len); if (c < 0) continue; break; case ESCAPE_SPECIAL: c = mchars_spec2cp(h->symtab, seq, len); if (c <= 0) continue; break; case ESCAPE_NOSPACE: if ('\0' == *p) nospace = 1; continue; default: continue; } if ((c < 0x20 && c != 0x09) || (c > 0x7E && c < 0xA0)) c = 0xFFFD; if (c > 0x7E) printf("&#%d;", c); else if ( ! print_escape(c)) putchar(c); } return(nospace); } static void print_attr(struct html *h, const char *key, const char *val) { printf(" %s=\"", key); (void)print_encode(h, val, 1); putchar('\"'); } struct tag * print_otag(struct html *h, enum htmltag tag, int sz, const struct htmlpair *p) { int i; struct tag *t; /* Push this tags onto the stack of open scopes. */ if ( ! (HTML_NOSTACK & htmltags[tag].flags)) { t = mandoc_malloc(sizeof(struct tag)); t->tag = tag; t->next = h->tags.head; h->tags.head = t; } else t = NULL; if ( ! (HTML_NOSPACE & h->flags)) if ( ! (HTML_CLRLINE & htmltags[tag].flags)) { /* Manage keeps! */ if ( ! (HTML_KEEP & h->flags)) { if (HTML_PREKEEP & h->flags) h->flags |= HTML_KEEP; putchar(' '); } else printf(" "); } if ( ! (h->flags & HTML_NONOSPACE)) h->flags &= ~HTML_NOSPACE; else h->flags |= HTML_NOSPACE; /* Print out the tag name and attributes. */ printf("<%s", htmltags[tag].name); for (i = 0; i < sz; i++) print_attr(h, htmlattrs[p[i].key], p[i].val); /* Accommodate for "well-formed" singleton escaping. */ if (HTML_AUTOCLOSE & htmltags[tag].flags) putchar('/'); putchar('>'); h->flags |= HTML_NOSPACE; if ((HTML_AUTOCLOSE | HTML_CLRLINE) & htmltags[tag].flags) putchar('\n'); return(t); } static void print_ctag(struct html *h, enum htmltag tag) { printf("", htmltags[tag].name); if (HTML_CLRLINE & htmltags[tag].flags) { h->flags |= HTML_NOSPACE; putchar('\n'); } } void print_gen_decls(struct html *h) { puts(""); } void print_text(struct html *h, const char *word) { if ( ! (HTML_NOSPACE & h->flags)) { /* Manage keeps! */ if ( ! (HTML_KEEP & h->flags)) { if (HTML_PREKEEP & h->flags) h->flags |= HTML_KEEP; putchar(' '); } else printf(" "); } assert(NULL == h->metaf); switch (h->metac) { case HTMLFONT_ITALIC: h->metaf = print_otag(h, TAG_I, 0, NULL); break; case HTMLFONT_BOLD: h->metaf = print_otag(h, TAG_B, 0, NULL); break; case HTMLFONT_BI: h->metaf = print_otag(h, TAG_B, 0, NULL); print_otag(h, TAG_I, 0, NULL); break; default: break; } assert(word); if ( ! print_encode(h, word, 0)) { if ( ! (h->flags & HTML_NONOSPACE)) h->flags &= ~HTML_NOSPACE; + h->flags &= ~HTML_NONEWLINE; } else - h->flags |= HTML_NOSPACE; + h->flags |= HTML_NOSPACE | HTML_NONEWLINE; if (h->metaf) { print_tagq(h, h->metaf); h->metaf = NULL; } h->flags &= ~HTML_IGNDELIM; } void print_tagq(struct html *h, const struct tag *until) { struct tag *tag; while ((tag = h->tags.head) != NULL) { /* * Remember to close out and nullify the current * meta-font and table, if applicable. */ if (tag == h->metaf) h->metaf = NULL; if (tag == h->tblt) h->tblt = NULL; print_ctag(h, tag->tag); h->tags.head = tag->next; free(tag); if (until && tag == until) return; } } void print_stagq(struct html *h, const struct tag *suntil) { struct tag *tag; while ((tag = h->tags.head) != NULL) { if (suntil && tag == suntil) return; /* * Remember to close out and nullify the current * meta-font and table, if applicable. */ if (tag == h->metaf) h->metaf = NULL; if (tag == h->tblt) h->tblt = NULL; print_ctag(h, tag->tag); h->tags.head = tag->next; free(tag); } } void print_paragraph(struct html *h) { struct tag *t; struct htmlpair tag; PAIR_CLASS_INIT(&tag, "spacer"); t = print_otag(h, TAG_DIV, 1, &tag); print_tagq(h, t); } void bufinit(struct html *h) { h->buf[0] = '\0'; h->buflen = 0; } void bufcat_style(struct html *h, const char *key, const char *val) { bufcat(h, key); bufcat(h, ":"); bufcat(h, val); bufcat(h, ";"); } void bufcat(struct html *h, const char *p) { /* * XXX This is broken and not easy to fix. * When using the -Oincludes option, buffmt_includes() * may pass in strings overrunning BUFSIZ, causing a crash. */ h->buflen = strlcat(h->buf, p, BUFSIZ); assert(h->buflen < BUFSIZ); } void bufcat_fmt(struct html *h, const char *fmt, ...) { va_list ap; va_start(ap, fmt); (void)vsnprintf(h->buf + (int)h->buflen, BUFSIZ - h->buflen - 1, fmt, ap); va_end(ap); h->buflen = strlen(h->buf); } static void bufncat(struct html *h, const char *p, size_t sz) { assert(h->buflen + sz + 1 < BUFSIZ); strncat(h->buf, p, sz); h->buflen += sz; } void buffmt_includes(struct html *h, const char *name) { const char *p, *pp; pp = h->base_includes; bufinit(h); while (NULL != (p = strchr(pp, '%'))) { bufncat(h, pp, (size_t)(p - pp)); switch (*(p + 1)) { case'I': bufcat(h, name); break; default: bufncat(h, p, 2); break; } pp = p + 2; } if (pp) bufcat(h, pp); } void buffmt_man(struct html *h, const char *name, const char *sec) { const char *p, *pp; pp = h->base_man; bufinit(h); while (NULL != (p = strchr(pp, '%'))) { bufncat(h, pp, (size_t)(p - pp)); switch (*(p + 1)) { case 'S': bufcat(h, sec ? sec : "1"); break; case 'N': bufcat_fmt(h, "%s", name); break; default: bufncat(h, p, 2); break; } pp = p + 2; } if (pp) bufcat(h, pp); } void bufcat_su(struct html *h, const char *p, const struct roffsu *su) { double v; v = su->scale; if (SCALE_MM == su->unit && 0.0 == (v /= 100.0)) v = 1.0; else if (SCALE_BU == su->unit) v /= 24.0; bufcat_fmt(h, "%s: %.2f%s;", p, v, roffscales[su->unit]); } void bufcat_id(struct html *h, const char *src) { /* Cf. . */ while ('\0' != *src) bufcat_fmt(h, "%.2x", *src++); } Index: projects/arm_intrng/contrib/mdocml/html.h =================================================================== --- projects/arm_intrng/contrib/mdocml/html.h (revision 276247) +++ projects/arm_intrng/contrib/mdocml/html.h (revision 276248) @@ -1,180 +1,180 @@ -/* $Id: html.h,v 1.67 2014/10/28 17:36:19 schwarze Exp $ */ +/* $Id: html.h,v 1.70 2014/12/02 10:08:06 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef HTML_H -#define HTML_H -__BEGIN_DECLS - enum htmltag { TAG_HTML, TAG_HEAD, TAG_BODY, TAG_META, TAG_TITLE, TAG_DIV, TAG_H1, TAG_H2, TAG_SPAN, TAG_LINK, TAG_BR, TAG_A, TAG_TABLE, TAG_TBODY, TAG_COL, TAG_TR, TAG_TD, TAG_LI, TAG_UL, TAG_OL, TAG_DL, TAG_DT, TAG_DD, TAG_BLOCKQUOTE, TAG_PRE, TAG_B, TAG_I, TAG_CODE, TAG_SMALL, TAG_STYLE, TAG_MATH, TAG_MROW, TAG_MI, TAG_MO, TAG_MSUP, TAG_MSUB, TAG_MSUBSUP, TAG_MFRAC, TAG_MSQRT, TAG_MFENCED, TAG_MTABLE, TAG_MTR, TAG_MTD, TAG_MUNDEROVER, TAG_MUNDER, TAG_MOVER, TAG_MAX }; enum htmlattr { ATTR_NAME, ATTR_REL, ATTR_HREF, ATTR_TYPE, ATTR_MEDIA, ATTR_CLASS, ATTR_STYLE, ATTR_ID, ATTR_COLSPAN, ATTR_CHARSET, ATTR_OPEN, ATTR_CLOSE, ATTR_MATHVARIANT, ATTR_MAX }; enum htmlfont { HTMLFONT_NONE = 0, HTMLFONT_BOLD, HTMLFONT_ITALIC, HTMLFONT_BI, HTMLFONT_MAX }; struct tag { struct tag *next; enum htmltag tag; }; struct tagq { struct tag *head; }; struct htmlpair { enum htmlattr key; const char *val; }; #define PAIR_INIT(p, t, v) \ do { \ (p)->key = (t); \ (p)->val = (v); \ } while (/* CONSTCOND */ 0) #define PAIR_ID_INIT(p, v) PAIR_INIT(p, ATTR_ID, v) #define PAIR_CLASS_INIT(p, v) PAIR_INIT(p, ATTR_CLASS, v) #define PAIR_HREF_INIT(p, v) PAIR_INIT(p, ATTR_HREF, v) #define PAIR_STYLE_INIT(p, h) PAIR_INIT(p, ATTR_STYLE, (h)->buf) struct html { int flags; #define HTML_NOSPACE (1 << 0) /* suppress next space */ #define HTML_IGNDELIM (1 << 1) #define HTML_KEEP (1 << 2) #define HTML_PREKEEP (1 << 3) #define HTML_NONOSPACE (1 << 4) /* never add spaces */ #define HTML_LITERAL (1 << 5) /* literal (e.g.,
) context */
 #define	HTML_SKIPCHAR	 (1 << 6) /* skip the next character */
 #define	HTML_NOSPLIT	 (1 << 7) /* do not break line before .An */
 #define	HTML_SPLIT	 (1 << 8) /* break line before .An */
+#define	HTML_NONEWLINE	 (1 << 9) /* No line break in nofill mode. */
 	struct tagq	  tags; /* stack of open tags */
 	struct rofftbl	  tbl; /* current table */
 	struct tag	 *tblt; /* current open table scope */
 	const struct mchars *symtab; /* character table */
 	char		 *base_man; /* base for manpage href */
 	char		 *base_includes; /* base for include href */
 	char		 *style; /* style-sheet URI */
 	char		  buf[BUFSIZ]; /* see bufcat and friends */
 	size_t		  buflen;
 	struct tag	 *metaf; /* current open font scope */
 	enum htmlfont	  metal; /* last used font */
 	enum htmlfont	  metac; /* current font mode */
 	int		  oflags; /* output options */
 #define	HTML_FRAGMENT	 (1 << 0) /* don't emit HTML/HEAD/BODY */
 };
 
+__BEGIN_DECLS
+
+struct	tbl_span;
+struct	eqn;
+
 void		  print_gen_decls(struct html *);
 void		  print_gen_head(struct html *);
 struct tag	 *print_otag(struct html *, enum htmltag,
 				int, const struct htmlpair *);
 void		  print_tagq(struct html *, const struct tag *);
 void		  print_stagq(struct html *, const struct tag *);
 void		  print_text(struct html *, const char *);
 void		  print_tblclose(struct html *);
 void		  print_tbl(struct html *, const struct tbl_span *);
 void		  print_eqn(struct html *, const struct eqn *);
 void		  print_paragraph(struct html *);
 
 #if __GNUC__ - 0 >= 4
 __attribute__((__format__ (__printf__, 2, 3)))
 #endif
 void		  bufcat_fmt(struct html *, const char *, ...);
 void		  bufcat(struct html *, const char *);
 void		  bufcat_id(struct html *, const char *);
 void		  bufcat_style(struct html *,
 			const char *, const char *);
 void		  bufcat_su(struct html *, const char *,
 			const struct roffsu *);
 void		  bufinit(struct html *);
 void		  buffmt_man(struct html *,
 			const char *, const char *);
 void		  buffmt_includes(struct html *, const char *);
 
 int		  html_strlen(const char *);
 
 __END_DECLS
-
-#endif /*!HTML_H*/
Index: projects/arm_intrng/contrib/mdocml/libman.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/libman.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/libman.h	(revision 276248)
@@ -1,79 +1,75 @@
-/*	$Id: libman.h,v 1.65 2014/11/28 05:51:32 schwarze Exp $ */
+/*	$Id: libman.h,v 1.66 2014/12/01 04:05:31 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef LIBMAN_H
-#define LIBMAN_H
 
 enum	man_next {
 	MAN_NEXT_SIBLING = 0,
 	MAN_NEXT_CHILD
 };
 
 struct	man {
 	struct mparse	*parse; /* parse pointer */
 	int		 quick; /* abort parse early */
 	int		 flags; /* parse flags */
 #define	MAN_ELINE	(1 << 1) /* Next-line element scope. */
 #define	MAN_BLINE	(1 << 2) /* Next-line block scope. */
 #define	MAN_LITERAL	(1 << 4) /* Literal input. */
 #define	MAN_NEWLINE	(1 << 6) /* first macro/text in a line */
 	enum man_next	 next; /* where to put the next node */
 	struct man_node	*last; /* the last parsed node */
 	struct man_node	*first; /* the first parsed node */
 	struct man_meta	 meta; /* document meta-data */
 	struct roff	*roff;
 };
 
 #define	MACRO_PROT_ARGS	  struct man *man, \
 			  enum mant tok, \
 			  int line, \
 			  int ppos, \
 			  int *pos, \
 			  char *buf
 
 struct	man_macro {
 	void		(*fp)(MACRO_PROT_ARGS);
 	int		  flags;
 #define	MAN_SCOPED	 (1 << 0)
 #define	MAN_EXPLICIT	 (1 << 1)	/* See blk_imp(). */
 #define	MAN_FSCOPED	 (1 << 2)	/* See blk_imp(). */
 #define	MAN_NSCOPED	 (1 << 3)	/* See in_line_eoln(). */
 #define	MAN_NOCLOSE	 (1 << 4)	/* See blk_exp(). */
 #define	MAN_BSCOPE	 (1 << 5)	/* Break BLINE scope. */
 #define	MAN_JOIN	 (1 << 6)	/* Join arguments together. */
 };
 
 extern	const struct man_macro *const man_macros;
 
 __BEGIN_DECLS
 
 void		  man_word_alloc(struct man *, int, int, const char *);
 void		  man_word_append(struct man *, const char *);
 void		  man_block_alloc(struct man *, int, int, enum mant);
 void		  man_head_alloc(struct man *, int, int, enum mant);
 void		  man_body_alloc(struct man *, int, int, enum mant);
 void		  man_elem_alloc(struct man *, int, int, enum mant);
 void		  man_node_delete(struct man *, struct man_node *);
 void		  man_hash_init(void);
 enum mant	  man_hash_find(const char *);
 void		  man_macroend(struct man *);
 void		  man_valid_post(struct man *);
 void		  man_unscope(struct man *, const struct man_node *);
 
 __END_DECLS
-
-#endif /*!LIBMAN_H*/
Index: projects/arm_intrng/contrib/mdocml/libmandoc.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/libmandoc.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/libmandoc.h	(revision 276248)
@@ -1,95 +1,96 @@
-/*	$Id: libmandoc.h,v 1.49 2014/11/28 06:27:05 schwarze Exp $ */
+/*	$Id: libmandoc.h,v 1.51 2014/12/01 08:05:52 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons 
  * Copyright (c) 2013, 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef LIBMANDOC_H
-#define LIBMANDOC_H
 
 enum	rofferr {
 	ROFF_CONT, /* continue processing line */
 	ROFF_RERUN, /* re-run roff interpreter with offset */
 	ROFF_APPEND, /* re-run main parser, appending next line */
 	ROFF_REPARSE, /* re-run main parser on the result */
 	ROFF_SO, /* include another file */
 	ROFF_IGN, /* ignore current line */
 	ROFF_TBL, /* a table row was successfully parsed */
 	ROFF_EQN, /* an equation was successfully parsed */
 	ROFF_ERR /* badness: puke and stop */
 };
 
 struct	buf {
 	char	*buf;
 	size_t	 sz;
 };
 
 __BEGIN_DECLS
 
+struct	mparse;
+struct	mchars;
+enum	mandocerr;
+struct	tbl_span;
+struct	eqn;
 struct	roff;
 struct	mdoc;
 struct	man;
 
 void		 mandoc_msg(enum mandocerr, struct mparse *,
 			int, int, const char *);
 #if __GNUC__ - 0 >= 4
 __attribute__((__format__ (__printf__, 5, 6)))
 #endif
 void		 mandoc_vmsg(enum mandocerr, struct mparse *,
 			int, int, const char *, ...);
 char		*mandoc_getarg(struct mparse *, char **, int, int *);
 char		*mandoc_normdate(struct mparse *, char *, int, int);
 int		 mandoc_eos(const char *, size_t);
 int		 mandoc_strntoi(const char *, size_t, int);
 const char	*mandoc_a2msec(const char*);
 
 void		 mdoc_free(struct mdoc *);
 struct	mdoc	*mdoc_alloc(struct roff *, struct mparse *,
 			const char *, int);
 void		 mdoc_reset(struct mdoc *);
 int		 mdoc_parseln(struct mdoc *, int, char *, int);
 int		 mdoc_endparse(struct mdoc *);
 void		 mdoc_addspan(struct mdoc *, const struct tbl_span *);
 void		 mdoc_addeqn(struct mdoc *, const struct eqn *);
 
 void		 man_free(struct man *);
 struct	man	*man_alloc(struct roff *, struct mparse *, int);
 void		 man_reset(struct man *);
 int		 man_parseln(struct man *, int, char *, int);
 int		 man_endparse(struct man *);
 void		 man_addspan(struct man *, const struct tbl_span *);
 void		 man_addeqn(struct man *, const struct eqn *);
 
 int		 preconv_cue(const struct buf *, size_t);
 int		 preconv_encode(struct buf *, size_t *,
 			struct buf *, size_t *, int *);
 
 void		 roff_free(struct roff *);
 struct roff	*roff_alloc(struct mparse *, const struct mchars *, int);
 void		 roff_reset(struct roff *);
 enum rofferr	 roff_parseln(struct roff *, int, struct buf *, int *);
 void		 roff_endparse(struct roff *);
 void		 roff_setreg(struct roff *, const char *, int, char sign);
 int		 roff_getreg(const struct roff *, const char *);
 char		*roff_strdup(const struct roff *, const char *);
 int		 roff_getcontrol(const struct roff *,
 			const char *, int *);
 int		 roff_getformat(const struct roff *);
 
 const struct tbl_span	*roff_span(const struct roff *);
 const struct eqn	*roff_eqn(const struct roff *);
 
 __END_DECLS
-
-#endif /*!LIBMANDOC_H*/
Index: projects/arm_intrng/contrib/mdocml/libmdoc.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/libmdoc.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/libmdoc.h	(revision 276248)
@@ -1,133 +1,129 @@
-/*	$Id: libmdoc.h,v 1.95 2014/11/29 03:37:44 schwarze Exp $ */
+/*	$Id: libmdoc.h,v 1.96 2014/12/01 04:05:32 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2013, 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef LIBMDOC_H
-#define LIBMDOC_H
 
 enum	mdoc_next {
 	MDOC_NEXT_SIBLING = 0,
 	MDOC_NEXT_CHILD
 };
 
 struct	mdoc {
 	struct mparse	 *parse; /* parse pointer */
 	const char	 *defos; /* default argument for .Os */
 	int		  quick; /* abort parse early */
 	int		  flags; /* parse flags */
 #define	MDOC_LITERAL	 (1 << 1) /* in a literal scope */
 #define	MDOC_PBODY	 (1 << 2) /* in the document body */
 #define	MDOC_NEWLINE	 (1 << 3) /* first macro/text in a line */
 #define	MDOC_PHRASELIT	 (1 << 4) /* literal within a partila phrase */
 #define	MDOC_PPHRASE	 (1 << 5) /* within a partial phrase */
 #define	MDOC_FREECOL	 (1 << 6) /* `It' invocation should close */
 #define	MDOC_SYNOPSIS	 (1 << 7) /* SYNOPSIS-style formatting */
 #define	MDOC_KEEP	 (1 << 8) /* in a word keep */
 #define	MDOC_SMOFF	 (1 << 9) /* spacing is off */
 #define	MDOC_NODELIMC	 (1 << 10) /* disable closing delimiter handling */
 	enum mdoc_next	  next; /* where to put the next node */
 	struct mdoc_node *last; /* the last node parsed */
 	struct mdoc_node *first; /* the first node parsed */
 	struct mdoc_node *last_es; /* the most recent Es node */
 	struct mdoc_meta  meta; /* document meta-data */
 	enum mdoc_sec	  lastnamed;
 	enum mdoc_sec	  lastsec;
 	struct roff	 *roff;
 };
 
 #define	MACRO_PROT_ARGS	struct mdoc *mdoc, \
 			enum mdoct tok, \
 			int line, \
 			int ppos, \
 			int *pos, \
 			char *buf
 
 struct	mdoc_macro {
 	void		(*fp)(MACRO_PROT_ARGS);
 	int		  flags;
 #define	MDOC_CALLABLE	 (1 << 0)
 #define	MDOC_PARSED	 (1 << 1)
 #define	MDOC_EXPLICIT	 (1 << 2)
 #define	MDOC_PROLOGUE	 (1 << 3)
 #define	MDOC_IGNDELIM	 (1 << 4)
 #define	MDOC_JOIN	 (1 << 5)
 };
 
 enum	margserr {
 	ARGS_ERROR,
 	ARGS_EOLN, /* end-of-line */
 	ARGS_WORD, /* normal word */
 	ARGS_PUNCT, /* series of punctuation */
 	ARGS_QWORD, /* quoted word */
 	ARGS_PHRASE, /* Ta'd phrase (-column) */
 	ARGS_PPHRASE, /* tabbed phrase (-column) */
 	ARGS_PEND /* last phrase (-column) */
 };
 
 /*
  * A punctuation delimiter is opening, closing, or "middle mark"
  * punctuation.  These govern spacing.
  * Opening punctuation (e.g., the opening parenthesis) suppresses the
  * following space; closing punctuation (e.g., the closing parenthesis)
  * suppresses the leading space; middle punctuation (e.g., the vertical
  * bar) can do either.  The middle punctuation delimiter bends the rules
  * depending on usage.
  */
 enum	mdelim {
 	DELIM_NONE = 0,
 	DELIM_OPEN,
 	DELIM_MIDDLE,
 	DELIM_CLOSE,
 	DELIM_MAX
 };
 
 extern	const struct mdoc_macro *const mdoc_macros;
 
 __BEGIN_DECLS
 
 void		  mdoc_macro(MACRO_PROT_ARGS);
 void		  mdoc_word_alloc(struct mdoc *, int, int, const char *);
 void		  mdoc_word_append(struct mdoc *, const char *);
 void		  mdoc_elem_alloc(struct mdoc *, int, int,
 			enum mdoct, struct mdoc_arg *);
 struct mdoc_node *mdoc_block_alloc(struct mdoc *, int, int,
 			enum mdoct, struct mdoc_arg *);
 struct mdoc_node *mdoc_head_alloc(struct mdoc *, int, int, enum mdoct);
 void		  mdoc_tail_alloc(struct mdoc *, int, int, enum mdoct);
 struct mdoc_node *mdoc_body_alloc(struct mdoc *, int, int, enum mdoct);
 void		  mdoc_endbody_alloc(struct mdoc *, int, int, enum mdoct,
 			struct mdoc_node *, enum mdoc_endbody);
 void		  mdoc_node_delete(struct mdoc *, struct mdoc_node *);
 void		  mdoc_node_relink(struct mdoc *, struct mdoc_node *);
 void		  mdoc_hash_init(void);
 enum mdoct	  mdoc_hash_find(const char *);
 const char	 *mdoc_a2att(const char *);
 const char	 *mdoc_a2lib(const char *);
 const char	 *mdoc_a2st(const char *);
 const char	 *mdoc_a2arch(const char *);
 void		  mdoc_valid_pre(struct mdoc *, struct mdoc_node *);
 void		  mdoc_valid_post(struct mdoc *);
 void		  mdoc_argv(struct mdoc *, int, enum mdoct,
 			struct mdoc_arg **, int *, char *);
 void		  mdoc_argv_free(struct mdoc_arg *);
 enum margserr	  mdoc_args(struct mdoc *, int,
 			int *, char *, enum mdoct, char **);
 void		  mdoc_macroend(struct mdoc *);
 enum mdelim	  mdoc_isdelim(const char *);
 
 __END_DECLS
-
-#endif /*!LIBMDOC_H*/
Index: projects/arm_intrng/contrib/mdocml/libroff.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/libroff.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/libroff.h	(revision 276248)
@@ -1,88 +1,84 @@
-/*	$Id: libroff.h,v 1.31 2014/10/25 14:35:37 schwarze Exp $ */
+/*	$Id: libroff.h,v 1.33 2014/12/01 08:05:52 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef LIBROFF_H
-#define LIBROFF_H
 
-__BEGIN_DECLS
-
 enum	tbl_part {
 	TBL_PART_OPTS, /* in options (first line) */
 	TBL_PART_LAYOUT, /* describing layout */
 	TBL_PART_DATA, /* creating data rows */
 	TBL_PART_CDATA /* continue previous row */
 };
 
 struct	tbl_node {
 	struct mparse	 *parse; /* parse point */
 	int		  pos; /* invocation column */
 	int		  line; /* invocation line */
 	enum tbl_part	  part;
 	struct tbl_opts	  opts;
 	struct tbl_row	 *first_row;
 	struct tbl_row	 *last_row;
 	struct tbl_span	 *first_span;
 	struct tbl_span	 *current_span;
 	struct tbl_span	 *last_span;
 	struct tbl_head	 *first_head;
 	struct tbl_head	 *last_head;
 	struct tbl_node	 *next;
 };
 
 struct	eqn_node {
 	struct eqn	  eqn;    /* syntax tree of this equation */
 	struct mparse	 *parse;  /* main parser, for error reporting */
 	struct eqn_node  *next;   /* singly linked list of equations */
 	struct eqn_def	 *defs;   /* array of definitions */
 	char		 *data;   /* source code of this equation */
 	size_t		  defsz;  /* number of definitions */
 	size_t		  sz;     /* length of the source code */
 	size_t		  cur;    /* parse point in the source code */
 	size_t		  rew;    /* beginning of the current token */
 	int		  gsize;  /* default point size */
 	int		  delim;  /* in-line delimiters enabled */
 	char		  odelim; /* in-line opening delimiter */
 	char		  cdelim; /* in-line closing delimiter */
 };
 
 struct	eqn_def {
 	char		 *key;
 	size_t		  keysz;
 	char		 *val;
 	size_t		  valsz;
 };
 
+__BEGIN_DECLS
+
 struct tbl_node	*tbl_alloc(int, int, struct mparse *);
 void		 tbl_restart(int, int, struct tbl_node *);
 void		 tbl_free(struct tbl_node *);
 void		 tbl_reset(struct tbl_node *);
 enum rofferr	 tbl_read(struct tbl_node *, int, const char *, int);
 int		 tbl_option(struct tbl_node *, int, const char *);
 int		 tbl_layout(struct tbl_node *, int, const char *);
 int		 tbl_data(struct tbl_node *, int, const char *);
 int		 tbl_cdata(struct tbl_node *, int, const char *);
 const struct tbl_span	*tbl_span(struct tbl_node *);
 void		 tbl_end(struct tbl_node **);
 struct eqn_node	*eqn_alloc(int, int, struct mparse *);
 enum rofferr	 eqn_end(struct eqn_node **);
 void		 eqn_free(struct eqn_node *);
 enum rofferr	 eqn_read(struct eqn_node **, int,
 			const char *, int, int *);
 
 __END_DECLS
-
-#endif /*LIBROFF_H*/
Index: projects/arm_intrng/contrib/mdocml/main.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/main.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/main.c	(revision 276248)
@@ -1,861 +1,897 @@
-/*	$Id: main.c,v 1.200 2014/11/26 21:40:17 schwarze Exp $ */
+/*	$Id: main.c,v 1.205 2014/12/11 19:19:35 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons 
  * Copyright (c) 2010, 2011, 2012, 2014 Ingo Schwarze 
  * Copyright (c) 2010 Joerg Sonnenberger 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "mandoc.h"
 #include "mandoc_aux.h"
 #include "main.h"
 #include "mdoc.h"
 #include "man.h"
 #include "manpath.h"
 #include "mansearch.h"
 
 #if !defined(__GNUC__) || (__GNUC__ < 2)
 # if !defined(lint)
 #  define __attribute__(x)
 # endif
 #endif /* !defined(__GNUC__) || (__GNUC__ < 2) */
 
 enum	outmode {
 	OUTMODE_DEF = 0,
 	OUTMODE_FLN,
 	OUTMODE_LST,
 	OUTMODE_ALL,
 	OUTMODE_INT,
 	OUTMODE_ONE
 };
 
 typedef	void		(*out_mdoc)(void *, const struct mdoc *);
 typedef	void		(*out_man)(void *, const struct man *);
 typedef	void		(*out_free)(void *);
 
 enum	outt {
 	OUTT_ASCII = 0,	/* -Tascii */
 	OUTT_LOCALE,	/* -Tlocale */
 	OUTT_UTF8,	/* -Tutf8 */
 	OUTT_TREE,	/* -Ttree */
 	OUTT_MAN,	/* -Tman */
 	OUTT_HTML,	/* -Thtml */
 	OUTT_LINT,	/* -Tlint */
 	OUTT_PS,	/* -Tps */
 	OUTT_PDF	/* -Tpdf */
 };
 
 struct	curparse {
 	struct mparse	 *mp;
 	struct mchars	 *mchars;	/* character table */
 	enum mandoclevel  wlevel;	/* ignore messages below this */
 	int		  wstop;	/* stop after a file with a warning */
 	enum outt	  outtype;	/* which output to use */
 	out_mdoc	  outmdoc;	/* mdoc output ptr */
 	out_man		  outman;	/* man output ptr */
 	out_free	  outfree;	/* free output ptr */
 	void		 *outdata;	/* data for output */
 	char		  outopts[BUFSIZ]; /* buf of output opts */
 };
 
 static	int		  koptions(int *, char *);
+#if HAVE_SQLITE3
+int			  mandocdb(int, char**);
+#endif
 static	int		  moptions(int *, char *);
 static	void		  mmsg(enum mandocerr, enum mandoclevel,
 				const char *, int, int, const char *);
 static	void		  parse(struct curparse *, int,
 				const char *, enum mandoclevel *);
+#if HAVE_SQLITE3
 static	enum mandoclevel  passthrough(const char *, int, int);
+#endif
 static	void		  spawn_pager(void);
 static	int		  toptions(struct curparse *, char *);
 static	void		  usage(enum argmode) __attribute__((noreturn));
 static	void		  version(void) __attribute__((noreturn));
 static	int		  woptions(struct curparse *, char *);
 
 static	const int sec_prios[] = {1, 4, 5, 8, 6, 3, 7, 2, 9};
+static	char		  help_arg[] = "help";
+static	char		 *help_argv[] = {help_arg, NULL};
 static	const char	 *progname;
 
 
 int
 main(int argc, char *argv[])
 {
 	struct curparse	 curp;
 	struct mansearch search;
 	struct manpaths	 paths;
-	char		*conf_file, *defpaths, *auxpaths;
+	char		*auxpaths;
 	char		*defos;
 #if HAVE_SQLITE3
 	struct manpage	*res, *resp;
+	char		*conf_file, *defpaths;
 	size_t		 isec, i, sz;
-	int		 prio, best_prio;
+	int		 prio, best_prio, synopsis_only;
 	char		 sec;
 #endif
 	enum mandoclevel rc;
 	enum outmode	 outmode;
 	int		 fd;
 	int		 show_usage;
 	int		 use_pager;
-	int		 synopsis_only;
 	int		 options;
 	int		 c;
 
 	progname = strrchr(argv[0], '/');
 	if (progname == NULL)
 		progname = argv[0];
 	else
 		++progname;
 
+#if HAVE_SQLITE3
+	if (strcmp(progname, BINM_MAKEWHATIS) == 0)
+		return(mandocdb(argc, argv));
+#endif
+
 	/* Search options. */
 
 	memset(&paths, 0, sizeof(struct manpaths));
-	conf_file = defpaths = auxpaths = NULL;
+#if HAVE_SQLITE3
+	conf_file = defpaths = NULL;
+#endif
+	auxpaths = NULL;
 
 	memset(&search, 0, sizeof(struct mansearch));
 	search.outkey = "Nd";
 
-	if (strcmp(progname, "man") == 0)
+	if (strcmp(progname, BINM_MAN) == 0)
 		search.argmode = ARG_NAME;
-	else if (strncmp(progname, "apropos", 7) == 0)
+	else if (strcmp(progname, BINM_APROPOS) == 0)
 		search.argmode = ARG_EXPR;
-	else if (strncmp(progname, "whatis", 6) == 0)
+	else if (strcmp(progname, BINM_WHATIS) == 0)
 		search.argmode = ARG_WORD;
+	else if (strncmp(progname, "help", 4) == 0)
+		search.argmode = ARG_NAME;
 	else
 		search.argmode = ARG_FILE;
 
 	/* Parser and formatter options. */
 
 	memset(&curp, 0, sizeof(struct curparse));
-	curp.outtype = OUTT_ASCII;
+	curp.outtype = OUTT_LOCALE;
 	curp.wlevel  = MANDOCLEVEL_FATAL;
 	options = MPARSE_SO | MPARSE_UTF8 | MPARSE_LATIN1;
 	defos = NULL;
 
 	use_pager = 1;
 	show_usage = 0;
+#if HAVE_SQLITE3
 	synopsis_only = 0;
+#endif
 	outmode = OUTMODE_DEF;
 
 	while (-1 != (c = getopt(argc, argv,
 			"aC:cfhI:iK:klM:m:O:S:s:T:VW:w"))) {
 		switch (c) {
 		case 'a':
 			outmode = OUTMODE_ALL;
 			break;
 		case 'C':
+#if HAVE_SQLITE3
 			conf_file = optarg;
+#endif
 			break;
 		case 'c':
 			use_pager = 0;
 			break;
 		case 'f':
 			search.argmode = ARG_WORD;
 			break;
 		case 'h':
 			(void)strlcat(curp.outopts, "synopsis,", BUFSIZ);
+#if HAVE_SQLITE3
 			synopsis_only = 1;
+#endif
 			use_pager = 0;
 			outmode = OUTMODE_ALL;
 			break;
 		case 'I':
 			if (strncmp(optarg, "os=", 3)) {
 				fprintf(stderr,
 				    "%s: -I%s: Bad argument\n",
 				    progname, optarg);
 				return((int)MANDOCLEVEL_BADARG);
 			}
 			if (defos) {
 				fprintf(stderr,
 				    "%s: -I%s: Duplicate argument\n",
 				    progname, optarg);
 				return((int)MANDOCLEVEL_BADARG);
 			}
 			defos = mandoc_strdup(optarg + 3);
 			break;
 		case 'i':
 			outmode = OUTMODE_INT;
 			break;
 		case 'K':
 			if ( ! koptions(&options, optarg))
 				return((int)MANDOCLEVEL_BADARG);
 			break;
 		case 'k':
 			search.argmode = ARG_EXPR;
 			break;
 		case 'l':
 			search.argmode = ARG_FILE;
 			outmode = OUTMODE_ALL;
 			break;
 		case 'M':
+#if HAVE_SQLITE3
 			defpaths = optarg;
+#endif
 			break;
 		case 'm':
 			auxpaths = optarg;
 			break;
 		case 'O':
 			search.outkey = optarg;
 			(void)strlcat(curp.outopts, optarg, BUFSIZ);
 			(void)strlcat(curp.outopts, ",", BUFSIZ);
 			break;
 		case 'S':
 			search.arch = optarg;
 			break;
 		case 's':
 			search.sec = optarg;
 			break;
 		case 'T':
 			if ( ! toptions(&curp, optarg))
 				return((int)MANDOCLEVEL_BADARG);
 			break;
 		case 'W':
 			if ( ! woptions(&curp, optarg))
 				return((int)MANDOCLEVEL_BADARG);
 			break;
 		case 'w':
 			outmode = OUTMODE_FLN;
 			break;
 		case 'V':
 			version();
 			/* NOTREACHED */
 		default:
 			show_usage = 1;
 			break;
 		}
 	}
 
 	if (show_usage)
 		usage(search.argmode);
 
 	/* Postprocess options. */
 
 	if (outmode == OUTMODE_DEF) {
 		switch (search.argmode) {
 		case ARG_FILE:
 			outmode = OUTMODE_ALL;
 			use_pager = 0;
 			break;
 		case ARG_NAME:
 			outmode = OUTMODE_ONE;
 			break;
 		default:
 			outmode = OUTMODE_LST;
 			break;
 		}
 	}
 
 	/* Parse arguments. */
 
 	argc -= optind;
 	argv += optind;
 #if HAVE_SQLITE3
 	resp = NULL;
 #endif
 
-	/* Quirk for a man(1) section argument without -s. */
+	/*
+	 * Quirks for help(1)
+	 * and for a man(1) section argument without -s.
+	 */
 
-	if (search.argmode == ARG_NAME &&
-	    argv[0] != NULL &&
-	    isdigit((unsigned char)argv[0][0]) &&
-	    (argv[0][1] == '\0' || !strcmp(argv[0], "3p"))) {
-		search.sec = argv[0];
-		argv++;
-		argc--;
+	if (search.argmode == ARG_NAME) {
+		if (*progname == 'h') {
+			if (argc == 0) {
+				argv = help_argv;
+				argc = 1;
+			}
+		} else if (argv[0] != NULL &&
+		    isdigit((unsigned char)argv[0][0]) &&
+		    (argv[0][1] == '\0' || !strcmp(argv[0], "3p"))) {
+			search.sec = argv[0];
+			argv++;
+			argc--;
+		}
 	}
 
 	rc = MANDOCLEVEL_OK;
 
 	/* man(1), whatis(1), apropos(1) */
 
 	if (search.argmode != ARG_FILE) {
 #if HAVE_SQLITE3
 		if (argc == 0)
 			usage(search.argmode);
 
 		if (search.argmode == ARG_NAME &&
 		    outmode == OUTMODE_ONE)
 			search.firstmatch = 1;
 
 		/* Access the mandoc database. */
 
 		manpath_parse(&paths, conf_file, defpaths, auxpaths);
 		mansearch_setup(1);
 		if( ! mansearch(&search, &paths, argc, argv, &res, &sz))
 			usage(search.argmode);
 		resp = res;
 
 		if (sz == 0) {
 			if (search.argmode == ARG_NAME)
 				fprintf(stderr, "%s: No entry for %s "
 				    "in the manual.\n", progname, argv[0]);
 			rc = MANDOCLEVEL_BADARG;
 			goto out;
 		}
 
 		/*
 		 * For standard man(1) and -a output mode,
 		 * prepare for copying filename pointers
 		 * into the program parameter array.
 		 */
 
 		if (outmode == OUTMODE_ONE) {
 			argc = 1;
 			best_prio = 10;
 		} else if (outmode == OUTMODE_ALL)
 			argc = (int)sz;
 
 		/* Iterate all matching manuals. */
 
 		for (i = 0; i < sz; i++) {
 			if (outmode == OUTMODE_FLN)
 				puts(res[i].file);
 			else if (outmode == OUTMODE_LST)
 				printf("%s - %s\n", res[i].names,
 				    res[i].output == NULL ? "" :
 				    res[i].output);
 			else if (outmode == OUTMODE_ONE) {
 				/* Search for the best section. */
 				isec = strcspn(res[i].file, "123456789");
 				sec = res[i].file[isec];
 				if ('\0' == sec)
 					continue;
 				prio = sec_prios[sec - '1'];
 				if (prio >= best_prio)
 					continue;
 				best_prio = prio;
 				resp = res + i;
 			}
 		}
 
 		/*
 		 * For man(1), -a and -i output mode, fall through
 		 * to the main mandoc(1) code iterating files
 		 * and running the parsers on each of them.
 		 */
 
 		if (outmode == OUTMODE_FLN || outmode == OUTMODE_LST)
 			goto out;
 #else
 		fputs("mandoc: database support not compiled in\n",
 		    stderr);
 		return((int)MANDOCLEVEL_BADARG);
 #endif
 	}
 
 	/* mandoc(1) */
 
 	if ( ! moptions(&options, auxpaths))
 		return((int)MANDOCLEVEL_BADARG);
 
 	if (use_pager && isatty(STDOUT_FILENO))
 		spawn_pager();
 
 	curp.mchars = mchars_alloc();
 	curp.mp = mparse_alloc(options, curp.wlevel, mmsg,
 	    curp.mchars, defos);
 
 	/*
 	 * Conditionally start up the lookaside buffer before parsing.
 	 */
 	if (OUTT_MAN == curp.outtype)
 		mparse_keep(curp.mp);
 
 	if (argc == 0)
 		parse(&curp, STDIN_FILENO, "", &rc);
 
 	while (argc) {
 #if HAVE_SQLITE3
 		if (resp != NULL) {
 			rc = mparse_open(curp.mp, &fd, resp->file);
 			if (fd == -1)
 				/* nothing */;
 			else if (resp->form & FORM_SRC) {
 				/* For .so only; ignore failure. */
 				chdir(paths.paths[resp->ipath]);
 				parse(&curp, fd, resp->file, &rc);
 			} else
 				rc = passthrough(resp->file, fd,
 				    synopsis_only);
 			resp++;
 		} else
 #endif
 		{
 			rc = mparse_open(curp.mp, &fd, *argv++);
 			if (fd != -1)
 				parse(&curp, fd, argv[-1], &rc);
 		}
 
 		if (mparse_wait(curp.mp) != MANDOCLEVEL_OK)
 			rc = MANDOCLEVEL_SYSERR;
 
 		if (MANDOCLEVEL_OK != rc && curp.wstop)
 			break;
 		argc--;
 	}
 
 	if (curp.outfree)
 		(*curp.outfree)(curp.outdata);
 	mparse_free(curp.mp);
 	mchars_free(curp.mchars);
 
 #if HAVE_SQLITE3
 out:
 	if (search.argmode != ARG_FILE) {
 		manpath_free(&paths);
 		mansearch_free(res, sz);
 		mansearch_setup(0);
 	}
 #endif
 
 	free(defos);
 
 	return((int)rc);
 }
 
 static void
 version(void)
 {
 
 	printf("mandoc %s\n", VERSION);
 	exit((int)MANDOCLEVEL_OK);
 }
 
 static void
 usage(enum argmode argmode)
 {
 
 	switch (argmode) {
 	case ARG_FILE:
 		fputs("usage: mandoc [-acfhklV] [-Ios=name] "
 		    "[-Kencoding] [-mformat] [-Ooption]\n"
 		    "\t      [-Toutput] [-Wlevel] [file ...]\n", stderr);
 		break;
 	case ARG_NAME:
 		fputs("usage: man [-acfhklVw] [-C file] "
 		    "[-M path] [-m path] [-S arch] [-s section]\n"
 		    "\t   [section] name ...\n", stderr);
 		break;
 	case ARG_WORD:
 		fputs("usage: whatis [-acfhklVw] [-C file] "
 		    "[-M path] [-m path] [-O outkey] [-S arch]\n"
 		    "\t      [-s section] name ...\n", stderr);
 		break;
 	case ARG_EXPR:
 		fputs("usage: apropos [-acfhklVw] [-C file] "
 		    "[-M path] [-m path] [-O outkey] [-S arch]\n"
 		    "\t       [-s section] expression ...\n", stderr);
 		break;
 	}
 	exit((int)MANDOCLEVEL_BADARG);
 }
 
 static void
 parse(struct curparse *curp, int fd, const char *file,
 	enum mandoclevel *level)
 {
 	enum mandoclevel  rc;
 	struct mdoc	 *mdoc;
 	struct man	 *man;
 
 	/* Begin by parsing the file itself. */
 
 	assert(file);
 	assert(fd >= -1);
 
 	rc = mparse_readfd(curp->mp, fd, file);
 
 	/* Stop immediately if the parse has failed. */
 
 	if (MANDOCLEVEL_FATAL <= rc)
 		goto cleanup;
 
 	/*
 	 * With -Wstop and warnings or errors of at least the requested
 	 * level, do not produce output.
 	 */
 
 	if (MANDOCLEVEL_OK != rc && curp->wstop)
 		goto cleanup;
 
 	/* If unset, allocate output dev now (if applicable). */
 
 	if ( ! (curp->outman && curp->outmdoc)) {
 		switch (curp->outtype) {
 		case OUTT_HTML:
 			curp->outdata = html_alloc(curp->mchars,
 			    curp->outopts);
 			curp->outfree = html_free;
 			break;
 		case OUTT_UTF8:
 			curp->outdata = utf8_alloc(curp->mchars,
 			    curp->outopts);
 			curp->outfree = ascii_free;
 			break;
 		case OUTT_LOCALE:
 			curp->outdata = locale_alloc(curp->mchars,
 			    curp->outopts);
 			curp->outfree = ascii_free;
 			break;
 		case OUTT_ASCII:
 			curp->outdata = ascii_alloc(curp->mchars,
 			    curp->outopts);
 			curp->outfree = ascii_free;
 			break;
 		case OUTT_PDF:
 			curp->outdata = pdf_alloc(curp->mchars,
 			    curp->outopts);
 			curp->outfree = pspdf_free;
 			break;
 		case OUTT_PS:
 			curp->outdata = ps_alloc(curp->mchars,
 			    curp->outopts);
 			curp->outfree = pspdf_free;
 			break;
 		default:
 			break;
 		}
 
 		switch (curp->outtype) {
 		case OUTT_HTML:
 			curp->outman = html_man;
 			curp->outmdoc = html_mdoc;
 			break;
 		case OUTT_TREE:
 			curp->outman = tree_man;
 			curp->outmdoc = tree_mdoc;
 			break;
 		case OUTT_MAN:
 			curp->outmdoc = man_mdoc;
 			curp->outman = man_man;
 			break;
 		case OUTT_PDF:
 			/* FALLTHROUGH */
 		case OUTT_ASCII:
 			/* FALLTHROUGH */
 		case OUTT_UTF8:
 			/* FALLTHROUGH */
 		case OUTT_LOCALE:
 			/* FALLTHROUGH */
 		case OUTT_PS:
 			curp->outman = terminal_man;
 			curp->outmdoc = terminal_mdoc;
 			break;
 		default:
 			break;
 		}
 	}
 
 	mparse_result(curp->mp, &mdoc, &man, NULL);
 
 	/* Execute the out device, if it exists. */
 
 	if (man && curp->outman)
 		(*curp->outman)(curp->outdata, man);
 	if (mdoc && curp->outmdoc)
 		(*curp->outmdoc)(curp->outdata, mdoc);
 
  cleanup:
 
 	mparse_reset(curp->mp);
 
 	if (*level < rc)
 		*level = rc;
 }
 
+#if HAVE_SQLITE3
 static enum mandoclevel
 passthrough(const char *file, int fd, int synopsis_only)
 {
 	const char	 synb[] = "S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS";
 	const char	 synr[] = "SYNOPSIS";
 
 	FILE		*stream;
 	const char	*syscall;
 	char		*line;
 	size_t		 len, off;
 	ssize_t		 nw;
 	int		 print;
 
 	if ((stream = fdopen(fd, "r")) == NULL) {
 		close(fd);
 		syscall = "fdopen";
 		goto fail;
 	}
 
 	print = 0;
 	while ((line = fgetln(stream, &len)) != NULL) {
 		if (synopsis_only) {
 			if (print) {
 				if ( ! isspace((unsigned char)*line))
 					goto done;
 				while (len &&
 				    isspace((unsigned char)*line)) {
 					line++;
 					len--;
 				}
 			} else {
 				if ((len == sizeof(synb) &&
 				     ! strncmp(line, synb, len - 1)) ||
 				    (len == sizeof(synr) &&
 				     ! strncmp(line, synr, len - 1)))
 					print = 1;
 				continue;
 			}
 		}
 		for (off = 0; off < len; off += nw)
 			if ((nw = write(STDOUT_FILENO, line + off,
 			    len - off)) == -1 || nw == 0) {
 				fclose(stream);
 				syscall = "write";
 				goto fail;
 			}
 	}
 
 	if (ferror(stream)) {
 		fclose(stream);
 		syscall = "fgetln";
 		goto fail;
 	}
 
 done:
 	fclose(stream);
 	return(MANDOCLEVEL_OK);
 
 fail:
 	fprintf(stderr, "%s: %s: SYSERR: %s: %s",
 	    progname, file, syscall, strerror(errno));
 	return(MANDOCLEVEL_SYSERR);
 }
+#endif
 
 static int
 koptions(int *options, char *arg)
 {
 
 	if ( ! strcmp(arg, "utf-8")) {
 		*options |=  MPARSE_UTF8;
 		*options &= ~MPARSE_LATIN1;
 	} else if ( ! strcmp(arg, "iso-8859-1")) {
 		*options |=  MPARSE_LATIN1;
 		*options &= ~MPARSE_UTF8;
 	} else if ( ! strcmp(arg, "us-ascii")) {
 		*options &= ~(MPARSE_UTF8 | MPARSE_LATIN1);
 	} else {
 		fprintf(stderr, "%s: -K%s: Bad argument\n",
 		    progname, arg);
 		return(0);
 	}
 	return(1);
 }
 
 static int
 moptions(int *options, char *arg)
 {
 
 	if (arg == NULL)
 		/* nothing to do */;
 	else if (0 == strcmp(arg, "doc"))
 		*options |= MPARSE_MDOC;
 	else if (0 == strcmp(arg, "andoc"))
 		/* nothing to do */;
 	else if (0 == strcmp(arg, "an"))
 		*options |= MPARSE_MAN;
 	else {
 		fprintf(stderr, "%s: -m%s: Bad argument\n",
 		    progname, arg);
 		return(0);
 	}
 
 	return(1);
 }
 
 static int
 toptions(struct curparse *curp, char *arg)
 {
 
 	if (0 == strcmp(arg, "ascii"))
 		curp->outtype = OUTT_ASCII;
 	else if (0 == strcmp(arg, "lint")) {
 		curp->outtype = OUTT_LINT;
 		curp->wlevel  = MANDOCLEVEL_WARNING;
 	} else if (0 == strcmp(arg, "tree"))
 		curp->outtype = OUTT_TREE;
 	else if (0 == strcmp(arg, "man"))
 		curp->outtype = OUTT_MAN;
 	else if (0 == strcmp(arg, "html"))
 		curp->outtype = OUTT_HTML;
 	else if (0 == strcmp(arg, "utf8"))
 		curp->outtype = OUTT_UTF8;
 	else if (0 == strcmp(arg, "locale"))
 		curp->outtype = OUTT_LOCALE;
 	else if (0 == strcmp(arg, "xhtml"))
 		curp->outtype = OUTT_HTML;
 	else if (0 == strcmp(arg, "ps"))
 		curp->outtype = OUTT_PS;
 	else if (0 == strcmp(arg, "pdf"))
 		curp->outtype = OUTT_PDF;
 	else {
 		fprintf(stderr, "%s: -T%s: Bad argument\n",
 		    progname, arg);
 		return(0);
 	}
 
 	return(1);
 }
 
 static int
 woptions(struct curparse *curp, char *arg)
 {
 	char		*v, *o;
 	const char	*toks[6];
 
 	toks[0] = "stop";
 	toks[1] = "all";
 	toks[2] = "warning";
 	toks[3] = "error";
 	toks[4] = "fatal";
 	toks[5] = NULL;
 
 	while (*arg) {
 		o = arg;
 		switch (getsubopt(&arg, UNCONST(toks), &v)) {
 		case 0:
 			curp->wstop = 1;
 			break;
 		case 1:
 			/* FALLTHROUGH */
 		case 2:
 			curp->wlevel = MANDOCLEVEL_WARNING;
 			break;
 		case 3:
 			curp->wlevel = MANDOCLEVEL_ERROR;
 			break;
 		case 4:
 			curp->wlevel = MANDOCLEVEL_FATAL;
 			break;
 		default:
 			fprintf(stderr, "%s: -W%s: Bad argument\n",
 			    progname, o);
 			return(0);
 		}
 	}
 
 	return(1);
 }
 
 static void
 mmsg(enum mandocerr t, enum mandoclevel lvl,
 		const char *file, int line, int col, const char *msg)
 {
 	const char	*mparse_msg;
 
 	fprintf(stderr, "%s: %s:", progname, file);
 
 	if (line)
 		fprintf(stderr, "%d:%d:", line, col + 1);
 
 	fprintf(stderr, " %s", mparse_strlevel(lvl));
 
 	if (NULL != (mparse_msg = mparse_strerror(t)))
 		fprintf(stderr, ": %s", mparse_msg);
 
 	if (msg)
 		fprintf(stderr, ": %s", msg);
 
 	fputc('\n', stderr);
 }
 
 static void
 spawn_pager(void)
 {
 #define MAX_PAGER_ARGS 16
 	char		*argv[MAX_PAGER_ARGS];
 	const char	*pager;
 	char		*cp;
 	int		 fildes[2];
 	int		 argc;
 
 	if (pipe(fildes) == -1) {
 		fprintf(stderr, "%s: pipe: %s\n",
 		    progname, strerror(errno));
 		return;
 	}
 
 	switch (fork()) {
 	case -1:
 		fprintf(stderr, "%s: fork: %s\n",
 		    progname, strerror(errno));
 		exit((int)MANDOCLEVEL_SYSERR);
 	case 0:
 		close(fildes[0]);
 		if (dup2(fildes[1], STDOUT_FILENO) == -1) {
 			fprintf(stderr, "%s: dup output: %s\n",
 			    progname, strerror(errno));
 			exit((int)MANDOCLEVEL_SYSERR);
 		}
 		return;
 	default:
 		break;
 	}
 
 	/* The original process becomes the pager. */
 
 	close(fildes[1]);
 	if (dup2(fildes[0], STDIN_FILENO) == -1) {
 		fprintf(stderr, "%s: dup input: %s\n",
 		    progname, strerror(errno));
 		exit((int)MANDOCLEVEL_SYSERR);
 	}
 
 	pager = getenv("MANPAGER");
 	if (pager == NULL || *pager == '\0')
 		pager = getenv("PAGER");
 	if (pager == NULL || *pager == '\0')
 		pager = "/usr/bin/more -s";
 	cp = mandoc_strdup(pager);
 
 	/*
 	 * Parse the pager command into words.
 	 * Intentionally do not do anything fancy here.
 	 */
 
 	argc = 0;
 	while (argc + 1 < MAX_PAGER_ARGS) {
 		argv[argc++] = cp;
 		cp = strchr(cp, ' ');
 		if (cp == NULL)
 			break;
 		*cp++ = '\0';
 		while (*cp == ' ')
 			cp++;
 		if (*cp == '\0')
 			break;
 	}
 	argv[argc] = NULL;
 
 	/* Hand over to the pager. */
 
 	execvp(argv[0], argv);
 	fprintf(stderr, "%s: exec: %s\n",
 	    progname, strerror(errno));
 	exit((int)MANDOCLEVEL_SYSERR);
 }
Index: projects/arm_intrng/contrib/mdocml/main.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/main.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/main.h	(revision 276248)
@@ -1,60 +1,56 @@
-/*	$Id: main.h,v 1.17 2014/10/28 17:36:19 schwarze Exp $ */
+/*	$Id: main.h,v 1.19 2014/12/01 08:05:52 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef	MAIN_H
-#define	MAIN_H
 
+#define	UNCONST(a)	((void *)(uintptr_t)(const void *)(a))
+
 __BEGIN_DECLS
 
+struct	mchars;
 struct	mdoc;
 struct	man;
 
-#define	UNCONST(a)	((void *)(uintptr_t)(const void *)(a))
-
-
 /*
  * Definitions for main.c-visible output device functions, e.g., -Thtml
  * and -Tascii.  Note that ascii_alloc() is named as such in
  * anticipation of latin1_alloc() and so on, all of which map into the
  * terminal output routines with different character settings.
  */
 
 void		 *html_alloc(const struct mchars *, char *);
 void		  html_mdoc(void *, const struct mdoc *);
 void		  html_man(void *, const struct man *);
 void		  html_free(void *);
 
 void		  tree_mdoc(void *, const struct mdoc *);
 void		  tree_man(void *, const struct man *);
 
 void		  man_mdoc(void *, const struct mdoc *);
 void		  man_man(void *, const struct man *);
 
 void		 *locale_alloc(const struct mchars *, char *);
 void		 *utf8_alloc(const struct mchars *, char *);
 void		 *ascii_alloc(const struct mchars *, char *);
 void		  ascii_free(void *);
 
 void		 *pdf_alloc(const struct mchars *, char *);
 void		 *ps_alloc(const struct mchars *, char *);
 void		  pspdf_free(void *);
 
 void		  terminal_mdoc(void *, const struct mdoc *);
 void		  terminal_man(void *, const struct man *);
 
 __END_DECLS
-
-#endif /*!MAIN_H*/
Index: projects/arm_intrng/contrib/mdocml/man.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/man.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/man.h	(revision 276248)
@@ -1,120 +1,116 @@
-/*	$Id: man.h,v 1.66 2014/11/28 05:51:32 schwarze Exp $ */
+/*	$Id: man.h,v 1.67 2014/12/01 04:05:32 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef MAN_H
-#define MAN_H
 
 enum	mant {
 	MAN_br = 0,
 	MAN_TH,
 	MAN_SH,
 	MAN_SS,
 	MAN_TP,
 	MAN_LP,
 	MAN_PP,
 	MAN_P,
 	MAN_IP,
 	MAN_HP,
 	MAN_SM,
 	MAN_SB,
 	MAN_BI,
 	MAN_IB,
 	MAN_BR,
 	MAN_RB,
 	MAN_R,
 	MAN_B,
 	MAN_I,
 	MAN_IR,
 	MAN_RI,
 	MAN_na,
 	MAN_sp,
 	MAN_nf,
 	MAN_fi,
 	MAN_RE,
 	MAN_RS,
 	MAN_DT,
 	MAN_UC,
 	MAN_PD,
 	MAN_AT,
 	MAN_in,
 	MAN_ft,
 	MAN_OP,
 	MAN_EX,
 	MAN_EE,
 	MAN_UR,
 	MAN_UE,
 	MAN_ll,
 	MAN_MAX
 };
 
 enum	man_type {
 	MAN_TEXT,
 	MAN_ELEM,
 	MAN_ROOT,
 	MAN_BLOCK,
 	MAN_HEAD,
 	MAN_BODY,
 	MAN_TBL,
 	MAN_EQN
 };
 
 struct	man_meta {
 	char		*msec; /* `TH' section (1, 3p, etc.) */
 	char		*date; /* `TH' normalised date */
 	char		*vol; /* `TH' volume */
 	char		*title; /* `TH' title (e.g., FOO) */
 	char		*source; /* `TH' source (e.g., GNU) */
 	int		 hasbody; /* document is not empty */
 };
 
 struct	man_node {
 	struct man_node	*parent; /* parent AST node */
 	struct man_node	*child; /* first child AST node */
 	struct man_node	*next; /* sibling AST node */
 	struct man_node	*prev; /* prior sibling AST node */
 	int		 nchild; /* number children */
 	int		 line;
 	int		 pos;
 	enum mant	 tok; /* tok or MAN__MAX if none */
 	int		 flags;
 #define	MAN_VALID	(1 << 0) /* has been validated */
 #define	MAN_EOS		(1 << 2) /* at sentence boundary */
 #define	MAN_LINE	(1 << 3) /* first macro/text on line */
 	enum man_type	 type; /* AST node type */
 	char		*string; /* TEXT node argument */
 	struct man_node	*head; /* BLOCK node HEAD ptr */
 	struct man_node *tail; /* BLOCK node TAIL ptr */
 	struct man_node	*body; /* BLOCK node BODY ptr */
 	const struct tbl_span *span; /* TBL */
 	const struct eqn *eqn; /* EQN */
 };
 
 /* Names of macros.  Index is enum mant. */
 extern	const char *const *man_macronames;
 
 __BEGIN_DECLS
 
 struct	man;
 
 const struct man_node *man_node(const struct man *);
 const struct man_meta *man_meta(const struct man *);
 const struct mparse   *man_mparse(const struct man *);
 void man_deroff(char **, const struct man_node *);
 
 __END_DECLS
-
-#endif /*!MAN_H*/
Index: projects/arm_intrng/contrib/mdocml/man_hash.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/man_hash.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/man_hash.c	(revision 276248)
@@ -1,103 +1,102 @@
-/*	$Id: man_hash.c,v 1.28 2014/08/10 23:54:41 schwarze Exp $ */
+/*	$Id: man_hash.c,v 1.29 2014/12/01 08:05:52 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 
 #include "man.h"
-#include "mandoc.h"
 #include "libman.h"
 
 #define	HASH_DEPTH	 6
 
 #define	HASH_ROW(x) do { \
 		if (isupper((unsigned char)(x))) \
 			(x) -= 65; \
 		else \
 			(x) -= 97; \
 		(x) *= HASH_DEPTH; \
 	} while (/* CONSTCOND */ 0)
 
 /*
  * Lookup table is indexed first by lower-case first letter (plus one
  * for the period, which is stored in the last row), then by lower or
  * uppercase second letter.  Buckets correspond to the index of the
  * macro (the integer value of the enum stored as a char to save a bit
  * of space).
  */
 static	unsigned char	 table[26 * HASH_DEPTH];
 
 
 /*
  * XXX - this hash has global scope, so if intended for use as a library
  * with multiple callers, it will need re-invocation protection.
  */
 void
 man_hash_init(void)
 {
 	int		 i, j, x;
 
 	memset(table, UCHAR_MAX, sizeof(table));
 
 	assert(MAN_MAX < UCHAR_MAX);
 
 	for (i = 0; i < (int)MAN_MAX; i++) {
 		x = man_macronames[i][0];
 
 		assert(isalpha((unsigned char)x));
 
 		HASH_ROW(x);
 
 		for (j = 0; j < HASH_DEPTH; j++)
 			if (UCHAR_MAX == table[x + j]) {
 				table[x + j] = (unsigned char)i;
 				break;
 			}
 
 		assert(j < HASH_DEPTH);
 	}
 }
 
 enum mant
 man_hash_find(const char *tmp)
 {
 	int		 x, y, i;
 	enum mant	 tok;
 
 	if ('\0' == (x = tmp[0]))
 		return(MAN_MAX);
 	if ( ! (isalpha((unsigned char)x)))
 		return(MAN_MAX);
 
 	HASH_ROW(x);
 
 	for (i = 0; i < HASH_DEPTH; i++) {
 		if (UCHAR_MAX == (y = table[x + i]))
 			return(MAN_MAX);
 
 		tok = (enum mant)y;
 		if (0 == strcmp(tmp, man_macronames[tok]))
 			return(tok);
 	}
 
 	return(MAN_MAX);
 }
Index: projects/arm_intrng/contrib/mdocml/man_html.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/man_html.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/man_html.c	(revision 276248)
@@ -1,683 +1,675 @@
-/*	$Id: man_html.c,v 1.104 2014/09/27 11:17:19 kristaps Exp $ */
+/*	$Id: man_html.c,v 1.107 2014/12/04 02:05:42 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012, 2014 Kristaps Dzonsons 
  * Copyright (c) 2013, 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
-#include "mandoc.h"
 #include "mandoc_aux.h"
+#include "man.h"
 #include "out.h"
 #include "html.h"
-#include "man.h"
 #include "main.h"
 
 /* TODO: preserve ident widths. */
 /* FIXME: have PD set the default vspace width. */
 
 #define	INDENT		  5
 
 #define	MAN_ARGS	  const struct man_meta *man, \
 			  const struct man_node *n, \
 			  struct mhtml *mh, \
 			  struct html *h
 
 struct	mhtml {
 	int		  fl;
 #define	MANH_LITERAL	 (1 << 0) /* literal context */
 };
 
 struct	htmlman {
 	int		(*pre)(MAN_ARGS);
 	int		(*post)(MAN_ARGS);
 };
 
 static	void		  print_bvspace(struct html *,
 				const struct man_node *);
 static	void		  print_man(MAN_ARGS);
 static	void		  print_man_head(MAN_ARGS);
 static	void		  print_man_nodelist(MAN_ARGS);
 static	void		  print_man_node(MAN_ARGS);
 static	int		  a2width(const struct man_node *,
 				struct roffsu *);
 static	int		  man_B_pre(MAN_ARGS);
 static	int		  man_HP_pre(MAN_ARGS);
 static	int		  man_IP_pre(MAN_ARGS);
 static	int		  man_I_pre(MAN_ARGS);
 static	int		  man_OP_pre(MAN_ARGS);
 static	int		  man_PP_pre(MAN_ARGS);
 static	int		  man_RS_pre(MAN_ARGS);
 static	int		  man_SH_pre(MAN_ARGS);
 static	int		  man_SM_pre(MAN_ARGS);
 static	int		  man_SS_pre(MAN_ARGS);
 static	int		  man_UR_pre(MAN_ARGS);
 static	int		  man_alt_pre(MAN_ARGS);
 static	int		  man_br_pre(MAN_ARGS);
 static	int		  man_ign_pre(MAN_ARGS);
 static	int		  man_in_pre(MAN_ARGS);
 static	int		  man_literal_pre(MAN_ARGS);
 static	void		  man_root_post(MAN_ARGS);
 static	void		  man_root_pre(MAN_ARGS);
 
 static	const struct htmlman mans[MAN_MAX] = {
 	{ man_br_pre, NULL }, /* br */
 	{ NULL, NULL }, /* TH */
 	{ man_SH_pre, NULL }, /* SH */
 	{ man_SS_pre, NULL }, /* SS */
 	{ man_IP_pre, NULL }, /* TP */
 	{ man_PP_pre, NULL }, /* LP */
 	{ man_PP_pre, NULL }, /* PP */
 	{ man_PP_pre, NULL }, /* P */
 	{ man_IP_pre, NULL }, /* IP */
 	{ man_HP_pre, NULL }, /* HP */
 	{ man_SM_pre, NULL }, /* SM */
 	{ man_SM_pre, NULL }, /* SB */
 	{ man_alt_pre, NULL }, /* BI */
 	{ man_alt_pre, NULL }, /* IB */
 	{ man_alt_pre, NULL }, /* BR */
 	{ man_alt_pre, NULL }, /* RB */
 	{ NULL, NULL }, /* R */
 	{ man_B_pre, NULL }, /* B */
 	{ man_I_pre, NULL }, /* I */
 	{ man_alt_pre, NULL }, /* IR */
 	{ man_alt_pre, NULL }, /* RI */
 	{ man_ign_pre, NULL }, /* na */
 	{ man_br_pre, NULL }, /* sp */
 	{ man_literal_pre, NULL }, /* nf */
 	{ man_literal_pre, NULL }, /* fi */
 	{ NULL, NULL }, /* RE */
 	{ man_RS_pre, NULL }, /* RS */
 	{ man_ign_pre, NULL }, /* DT */
 	{ man_ign_pre, NULL }, /* UC */
 	{ man_ign_pre, NULL }, /* PD */
 	{ man_ign_pre, NULL }, /* AT */
 	{ man_in_pre, NULL }, /* in */
 	{ man_ign_pre, NULL }, /* ft */
 	{ man_OP_pre, NULL }, /* OP */
 	{ man_literal_pre, NULL }, /* EX */
 	{ man_literal_pre, NULL }, /* EE */
 	{ man_UR_pre, NULL }, /* UR */
 	{ NULL, NULL }, /* UE */
 	{ man_ign_pre, NULL }, /* ll */
 };
 
 
 /*
  * Printing leading vertical space before a block.
  * This is used for the paragraph macros.
  * The rules are pretty simple, since there's very little nesting going
  * on here.  Basically, if we're the first within another block (SS/SH),
  * then don't emit vertical space.  If we are (RS), then do.  If not the
  * first, print it.
  */
 static void
 print_bvspace(struct html *h, const struct man_node *n)
 {
 
 	if (n->body && n->body->child)
 		if (MAN_TBL == n->body->child->type)
 			return;
 
 	if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok)
 		if (NULL == n->prev)
 			return;
 
 	print_paragraph(h);
 }
 
 void
 html_man(void *arg, const struct man *man)
 {
 	struct mhtml	 mh;
 
 	memset(&mh, 0, sizeof(struct mhtml));
 	print_man(man_meta(man), man_node(man), &mh, (struct html *)arg);
 	putchar('\n');
 }
 
 static void
 print_man(MAN_ARGS)
 {
 	struct tag	*t, *tt;
 	struct htmlpair	 tag;
 
 	PAIR_CLASS_INIT(&tag, "mandoc");
 
 	if ( ! (HTML_FRAGMENT & h->oflags)) {
 		print_gen_decls(h);
 		t = print_otag(h, TAG_HTML, 0, NULL);
 		tt = print_otag(h, TAG_HEAD, 0, NULL);
 		print_man_head(man, n, mh, h);
 		print_tagq(h, tt);
 		print_otag(h, TAG_BODY, 0, NULL);
 		print_otag(h, TAG_DIV, 1, &tag);
 	} else
 		t = print_otag(h, TAG_DIV, 1, &tag);
 
 	print_man_nodelist(man, n, mh, h);
 	print_tagq(h, t);
 }
 
 static void
 print_man_head(MAN_ARGS)
 {
 
 	print_gen_head(h);
 	assert(man->title);
 	assert(man->msec);
 	bufcat_fmt(h, "%s(%s)", man->title, man->msec);
 	print_otag(h, TAG_TITLE, 0, NULL);
 	print_text(h, h->buf);
 }
 
 static void
 print_man_nodelist(MAN_ARGS)
 {
 
 	print_man_node(man, n, mh, h);
 	if (n->next)
 		print_man_nodelist(man, n->next, mh, h);
 }
 
 static void
 print_man_node(MAN_ARGS)
 {
 	int		 child;
 	struct tag	*t;
 
 	child = 1;
 	t = h->tags.head;
 
 	switch (n->type) {
 	case MAN_ROOT:
 		man_root_pre(man, n, mh, h);
 		break;
 	case MAN_TEXT:
-		/*
-		 * If we have a blank line, output a vertical space.
-		 * If we have a space as the first character, break
-		 * before printing the line's data.
-		 */
 		if ('\0' == *n->string) {
 			print_paragraph(h);
 			return;
 		}
-
-		if (' ' == *n->string && MAN_LINE & n->flags)
+		if (n->flags & MAN_LINE && (*n->string == ' ' || 
+		    (n->prev != NULL && mh->fl & MANH_LITERAL &&
+		     ! (h->flags & HTML_NONEWLINE))))
 			print_otag(h, TAG_BR, 0, NULL);
-		else if (MANH_LITERAL & mh->fl && n->prev)
-			print_otag(h, TAG_BR, 0, NULL);
-
 		print_text(h, n->string);
 		return;
 	case MAN_EQN:
 		print_eqn(h, n->eqn);
 		break;
 	case MAN_TBL:
 		/*
 		 * This will take care of initialising all of the table
 		 * state data for the first table, then tearing it down
 		 * for the last one.
 		 */
 		print_tbl(h, n->span);
 		return;
 	default:
 		/*
 		 * Close out scope of font prior to opening a macro
 		 * scope.
 		 */
 		if (HTMLFONT_NONE != h->metac) {
 			h->metal = h->metac;
 			h->metac = HTMLFONT_NONE;
 		}
 
 		/*
 		 * Close out the current table, if it's open, and unset
 		 * the "meta" table state.  This will be reopened on the
 		 * next table element.
 		 */
 		if (h->tblt) {
 			print_tblclose(h);
 			t = h->tags.head;
 		}
 		if (mans[n->tok].pre)
 			child = (*mans[n->tok].pre)(man, n, mh, h);
 		break;
 	}
 
 	if (child && n->child)
 		print_man_nodelist(man, n->child, mh, h);
 
 	/* This will automatically close out any font scope. */
 	print_stagq(h, t);
 
 	switch (n->type) {
 	case MAN_ROOT:
 		man_root_post(man, n, mh, h);
 		break;
 	case MAN_EQN:
 		break;
 	default:
 		if (mans[n->tok].post)
 			(*mans[n->tok].post)(man, n, mh, h);
 		break;
 	}
 }
 
 static int
 a2width(const struct man_node *n, struct roffsu *su)
 {
 
 	if (MAN_TEXT != n->type)
 		return(0);
-	if (a2roffsu(n->string, su, SCALE_BU))
+	if (a2roffsu(n->string, su, SCALE_EN))
 		return(1);
 
 	return(0);
 }
 
 static void
 man_root_pre(MAN_ARGS)
 {
 	struct htmlpair	 tag;
 	struct tag	*t, *tt;
 	char		*title;
 
 	assert(man->title);
 	assert(man->msec);
 	mandoc_asprintf(&title, "%s(%s)", man->title, man->msec);
 
 	PAIR_CLASS_INIT(&tag, "head");
 	t = print_otag(h, TAG_TABLE, 1, &tag);
 
 	print_otag(h, TAG_TBODY, 0, NULL);
 
 	tt = print_otag(h, TAG_TR, 0, NULL);
 
 	PAIR_CLASS_INIT(&tag, "head-ltitle");
 	print_otag(h, TAG_TD, 1, &tag);
 	print_text(h, title);
 	print_stagq(h, tt);
 
 	PAIR_CLASS_INIT(&tag, "head-vol");
 	print_otag(h, TAG_TD, 1, &tag);
 	if (NULL != man->vol)
 		print_text(h, man->vol);
 	print_stagq(h, tt);
 
 	PAIR_CLASS_INIT(&tag, "head-rtitle");
 	print_otag(h, TAG_TD, 1, &tag);
 	print_text(h, title);
 	print_tagq(h, t);
 	free(title);
 }
 
 static void
 man_root_post(MAN_ARGS)
 {
 	struct htmlpair	 tag;
 	struct tag	*t, *tt;
 
 	PAIR_CLASS_INIT(&tag, "foot");
 	t = print_otag(h, TAG_TABLE, 1, &tag);
 
 	tt = print_otag(h, TAG_TR, 0, NULL);
 
 	PAIR_CLASS_INIT(&tag, "foot-date");
 	print_otag(h, TAG_TD, 1, &tag);
 
 	assert(man->date);
 	print_text(h, man->date);
 	print_stagq(h, tt);
 
 	PAIR_CLASS_INIT(&tag, "foot-os");
 	print_otag(h, TAG_TD, 1, &tag);
 
 	if (man->source)
 		print_text(h, man->source);
 	print_tagq(h, t);
 }
 
 
 static int
 man_br_pre(MAN_ARGS)
 {
 	struct roffsu	 su;
 	struct htmlpair	 tag;
 
 	SCALE_VS_INIT(&su, 1);
 
 	if (MAN_sp == n->tok) {
 		if (NULL != (n = n->child))
 			if ( ! a2roffsu(n->string, &su, SCALE_VS))
 				SCALE_VS_INIT(&su, atoi(n->string));
 	} else
 		su.scale = 0.0;
 
 	bufinit(h);
 	bufcat_su(h, "height", &su);
 	PAIR_STYLE_INIT(&tag, h);
 	print_otag(h, TAG_DIV, 1, &tag);
 
 	/* So the div isn't empty: */
 	print_text(h, "\\~");
 
 	return(0);
 }
 
 static int
 man_SH_pre(MAN_ARGS)
 {
 	struct htmlpair	 tag;
 
 	if (MAN_BLOCK == n->type) {
 		mh->fl &= ~MANH_LITERAL;
 		PAIR_CLASS_INIT(&tag, "section");
 		print_otag(h, TAG_DIV, 1, &tag);
 		return(1);
 	} else if (MAN_BODY == n->type)
 		return(1);
 
 	print_otag(h, TAG_H1, 0, NULL);
 	return(1);
 }
 
 static int
 man_alt_pre(MAN_ARGS)
 {
 	const struct man_node	*nn;
 	int		 i, savelit;
 	enum htmltag	 fp;
 	struct tag	*t;
 
 	if ((savelit = mh->fl & MANH_LITERAL))
 		print_otag(h, TAG_BR, 0, NULL);
 
 	mh->fl &= ~MANH_LITERAL;
 
 	for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
 		t = NULL;
 		switch (n->tok) {
 		case MAN_BI:
 			fp = i % 2 ? TAG_I : TAG_B;
 			break;
 		case MAN_IB:
 			fp = i % 2 ? TAG_B : TAG_I;
 			break;
 		case MAN_RI:
 			fp = i % 2 ? TAG_I : TAG_MAX;
 			break;
 		case MAN_IR:
 			fp = i % 2 ? TAG_MAX : TAG_I;
 			break;
 		case MAN_BR:
 			fp = i % 2 ? TAG_MAX : TAG_B;
 			break;
 		case MAN_RB:
 			fp = i % 2 ? TAG_B : TAG_MAX;
 			break;
 		default:
 			abort();
 			/* NOTREACHED */
 		}
 
 		if (i)
 			h->flags |= HTML_NOSPACE;
 
 		if (TAG_MAX != fp)
 			t = print_otag(h, fp, 0, NULL);
 
 		print_man_node(man, nn, mh, h);
 
 		if (t)
 			print_tagq(h, t);
 	}
 
 	if (savelit)
 		mh->fl |= MANH_LITERAL;
 
 	return(0);
 }
 
 static int
 man_SM_pre(MAN_ARGS)
 {
 
 	print_otag(h, TAG_SMALL, 0, NULL);
 	if (MAN_SB == n->tok)
 		print_otag(h, TAG_B, 0, NULL);
 	return(1);
 }
 
 static int
 man_SS_pre(MAN_ARGS)
 {
 	struct htmlpair	 tag;
 
 	if (MAN_BLOCK == n->type) {
 		mh->fl &= ~MANH_LITERAL;
 		PAIR_CLASS_INIT(&tag, "subsection");
 		print_otag(h, TAG_DIV, 1, &tag);
 		return(1);
 	} else if (MAN_BODY == n->type)
 		return(1);
 
 	print_otag(h, TAG_H2, 0, NULL);
 	return(1);
 }
 
 static int
 man_PP_pre(MAN_ARGS)
 {
 
 	if (MAN_HEAD == n->type)
 		return(0);
 	else if (MAN_BLOCK == n->type)
 		print_bvspace(h, n);
 
 	return(1);
 }
 
 static int
 man_IP_pre(MAN_ARGS)
 {
 	const struct man_node	*nn;
 
 	if (MAN_BODY == n->type) {
 		print_otag(h, TAG_DD, 0, NULL);
 		return(1);
 	} else if (MAN_HEAD != n->type) {
 		print_otag(h, TAG_DL, 0, NULL);
 		return(1);
 	}
 
 	/* FIXME: width specification. */
 
 	print_otag(h, TAG_DT, 0, NULL);
 
 	/* For IP, only print the first header element. */
 
 	if (MAN_IP == n->tok && n->child)
 		print_man_node(man, n->child, mh, h);
 
 	/* For TP, only print next-line header elements. */
 
 	if (MAN_TP == n->tok) {
 		nn = n->child;
 		while (NULL != nn && 0 == (MAN_LINE & nn->flags))
 			nn = nn->next;
 		while (NULL != nn) {
 			print_man_node(man, nn, mh, h);
 			nn = nn->next;
 		}
 	}
 
 	return(0);
 }
 
 static int
 man_HP_pre(MAN_ARGS)
 {
 	struct htmlpair	 tag[2];
 	struct roffsu	 su;
 	const struct man_node *np;
 
 	if (MAN_HEAD == n->type)
 		return(0);
 	else if (MAN_BLOCK != n->type)
 		return(1);
 
 	np = n->head->child;
 
 	if (NULL == np || ! a2width(np, &su))
 		SCALE_HS_INIT(&su, INDENT);
 
 	bufinit(h);
 
 	print_bvspace(h, n);
 	bufcat_su(h, "margin-left", &su);
 	su.scale = -su.scale;
 	bufcat_su(h, "text-indent", &su);
 	PAIR_STYLE_INIT(&tag[0], h);
 	PAIR_CLASS_INIT(&tag[1], "spacer");
 	print_otag(h, TAG_DIV, 2, tag);
 	return(1);
 }
 
 static int
 man_OP_pre(MAN_ARGS)
 {
 	struct tag	*tt;
 	struct htmlpair	 tag;
 
 	print_text(h, "[");
 	h->flags |= HTML_NOSPACE;
 	PAIR_CLASS_INIT(&tag, "opt");
 	tt = print_otag(h, TAG_SPAN, 1, &tag);
 
 	if (NULL != (n = n->child)) {
 		print_otag(h, TAG_B, 0, NULL);
 		print_text(h, n->string);
 	}
 
 	print_stagq(h, tt);
 
 	if (NULL != n && NULL != n->next) {
 		print_otag(h, TAG_I, 0, NULL);
 		print_text(h, n->next->string);
 	}
 
 	print_stagq(h, tt);
 	h->flags |= HTML_NOSPACE;
 	print_text(h, "]");
 	return(0);
 }
 
 static int
 man_B_pre(MAN_ARGS)
 {
 
 	print_otag(h, TAG_B, 0, NULL);
 	return(1);
 }
 
 static int
 man_I_pre(MAN_ARGS)
 {
 
 	print_otag(h, TAG_I, 0, NULL);
 	return(1);
 }
 
 static int
 man_literal_pre(MAN_ARGS)
 {
 
 	if (MAN_fi == n->tok || MAN_EE == n->tok) {
 		print_otag(h, TAG_BR, 0, NULL);
 		mh->fl &= ~MANH_LITERAL;
 	} else
 		mh->fl |= MANH_LITERAL;
 
 	return(0);
 }
 
 static int
 man_in_pre(MAN_ARGS)
 {
 
 	print_otag(h, TAG_BR, 0, NULL);
 	return(0);
 }
 
 static int
 man_ign_pre(MAN_ARGS)
 {
 
 	return(0);
 }
 
 static int
 man_RS_pre(MAN_ARGS)
 {
 	struct htmlpair	 tag;
 	struct roffsu	 su;
 
 	if (MAN_HEAD == n->type)
 		return(0);
 	else if (MAN_BODY == n->type)
 		return(1);
 
 	SCALE_HS_INIT(&su, INDENT);
 	if (n->head->child)
 		a2width(n->head->child, &su);
 
 	bufinit(h);
 	bufcat_su(h, "margin-left", &su);
 	PAIR_STYLE_INIT(&tag, h);
 	print_otag(h, TAG_DIV, 1, &tag);
 	return(1);
 }
 
 static int
 man_UR_pre(MAN_ARGS)
 {
 	struct htmlpair		 tag[2];
 
 	n = n->child;
 	assert(MAN_HEAD == n->type);
 	if (n->nchild) {
 		assert(MAN_TEXT == n->child->type);
 		PAIR_CLASS_INIT(&tag[0], "link-ext");
 		PAIR_HREF_INIT(&tag[1], n->child->string);
 		print_otag(h, TAG_A, 2, tag);
 	}
 
 	assert(MAN_BODY == n->next->type);
 	if (n->next->nchild)
 		n = n->next;
 
 	print_man_nodelist(man, n->child, mh, h);
 
 	return(0);
 }
Index: projects/arm_intrng/contrib/mdocml/man_term.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/man_term.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/man_term.c	(revision 276248)
@@ -1,1193 +1,1205 @@
-/*	$Id: man_term.c,v 1.156 2014/11/21 01:52:53 schwarze Exp $ */
+/*	$Id: man_term.c,v 1.159 2014/12/04 02:05:42 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons 
  * Copyright (c) 2010-2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "mandoc.h"
 #include "mandoc_aux.h"
 #include "out.h"
 #include "man.h"
 #include "term.h"
 #include "main.h"
 
 #define	MAXMARGINS	  64 /* maximum number of indented scopes */
 
 struct	mtermp {
 	int		  fl;
 #define	MANT_LITERAL	 (1 << 0)
 	size_t		  lmargin[MAXMARGINS]; /* margins (incl. visible page) */
 	int		  lmargincur; /* index of current margin */
 	int		  lmarginsz; /* actual number of nested margins */
 	size_t		  offset; /* default offset to visible page */
 	int		  pardist; /* vert. space before par., unit: [v] */
 };
 
 #define	DECL_ARGS	  struct termp *p, \
 			  struct mtermp *mt, \
 			  const struct man_node *n, \
 			  const struct man_meta *meta
 
 struct	termact {
 	int		(*pre)(DECL_ARGS);
 	void		(*post)(DECL_ARGS);
 	int		  flags;
 #define	MAN_NOTEXT	 (1 << 0) /* Never has text children. */
 };
 
 static	int		  a2width(const struct termp *, const char *);
 static	size_t		  a2height(const struct termp *, const char *);
 
 static	void		  print_man_nodelist(DECL_ARGS);
 static	void		  print_man_node(DECL_ARGS);
 static	void		  print_man_head(struct termp *, const void *);
 static	void		  print_man_foot(struct termp *, const void *);
 static	void		  print_bvspace(struct termp *,
 				const struct man_node *, int);
 
 static	int		  pre_B(DECL_ARGS);
 static	int		  pre_HP(DECL_ARGS);
 static	int		  pre_I(DECL_ARGS);
 static	int		  pre_IP(DECL_ARGS);
 static	int		  pre_OP(DECL_ARGS);
 static	int		  pre_PD(DECL_ARGS);
 static	int		  pre_PP(DECL_ARGS);
 static	int		  pre_RS(DECL_ARGS);
 static	int		  pre_SH(DECL_ARGS);
 static	int		  pre_SS(DECL_ARGS);
 static	int		  pre_TP(DECL_ARGS);
 static	int		  pre_UR(DECL_ARGS);
 static	int		  pre_alternate(DECL_ARGS);
 static	int		  pre_ft(DECL_ARGS);
 static	int		  pre_ign(DECL_ARGS);
 static	int		  pre_in(DECL_ARGS);
 static	int		  pre_literal(DECL_ARGS);
 static	int		  pre_ll(DECL_ARGS);
 static	int		  pre_sp(DECL_ARGS);
 
 static	void		  post_IP(DECL_ARGS);
 static	void		  post_HP(DECL_ARGS);
 static	void		  post_RS(DECL_ARGS);
 static	void		  post_SH(DECL_ARGS);
 static	void		  post_SS(DECL_ARGS);
 static	void		  post_TP(DECL_ARGS);
 static	void		  post_UR(DECL_ARGS);
 
 static	const struct termact termacts[MAN_MAX] = {
 	{ pre_sp, NULL, MAN_NOTEXT }, /* br */
 	{ NULL, NULL, 0 }, /* TH */
 	{ pre_SH, post_SH, 0 }, /* SH */
 	{ pre_SS, post_SS, 0 }, /* SS */
 	{ pre_TP, post_TP, 0 }, /* TP */
 	{ pre_PP, NULL, 0 }, /* LP */
 	{ pre_PP, NULL, 0 }, /* PP */
 	{ pre_PP, NULL, 0 }, /* P */
 	{ pre_IP, post_IP, 0 }, /* IP */
 	{ pre_HP, post_HP, 0 }, /* HP */
 	{ NULL, NULL, 0 }, /* SM */
 	{ pre_B, NULL, 0 }, /* SB */
 	{ pre_alternate, NULL, 0 }, /* BI */
 	{ pre_alternate, NULL, 0 }, /* IB */
 	{ pre_alternate, NULL, 0 }, /* BR */
 	{ pre_alternate, NULL, 0 }, /* RB */
 	{ NULL, NULL, 0 }, /* R */
 	{ pre_B, NULL, 0 }, /* B */
 	{ pre_I, NULL, 0 }, /* I */
 	{ pre_alternate, NULL, 0 }, /* IR */
 	{ pre_alternate, NULL, 0 }, /* RI */
 	{ pre_ign, NULL, MAN_NOTEXT }, /* na */
 	{ pre_sp, NULL, MAN_NOTEXT }, /* sp */
 	{ pre_literal, NULL, 0 }, /* nf */
 	{ pre_literal, NULL, 0 }, /* fi */
 	{ NULL, NULL, 0 }, /* RE */
 	{ pre_RS, post_RS, 0 }, /* RS */
 	{ pre_ign, NULL, 0 }, /* DT */
-	{ pre_ign, NULL, 0 }, /* UC */
+	{ pre_ign, NULL, MAN_NOTEXT }, /* UC */
 	{ pre_PD, NULL, MAN_NOTEXT }, /* PD */
 	{ pre_ign, NULL, 0 }, /* AT */
 	{ pre_in, NULL, MAN_NOTEXT }, /* in */
 	{ pre_ft, NULL, MAN_NOTEXT }, /* ft */
 	{ pre_OP, NULL, 0 }, /* OP */
 	{ pre_literal, NULL, 0 }, /* EX */
 	{ pre_literal, NULL, 0 }, /* EE */
 	{ pre_UR, post_UR, 0 }, /* UR */
 	{ NULL, NULL, 0 }, /* UE */
 	{ pre_ll, NULL, MAN_NOTEXT }, /* ll */
 };
 
 
 void
 terminal_man(void *arg, const struct man *man)
 {
 	struct termp		*p;
 	const struct man_meta	*meta;
 	struct man_node		*n;
 	struct mtermp		 mt;
 
 	p = (struct termp *)arg;
 
 	p->overstep = 0;
 	p->rmargin = p->maxrmargin = p->defrmargin;
 	p->tabwidth = term_len(p, 5);
 
 	n = man_node(man)->child;
 	meta = man_meta(man);
 
 	memset(&mt, 0, sizeof(struct mtermp));
 
 	mt.lmargin[mt.lmargincur] = term_len(p, p->defindent);
 	mt.offset = term_len(p, p->defindent);
 	mt.pardist = 1;
 
 	if (p->synopsisonly) {
 		while (n != NULL) {
 			if (n->tok == MAN_SH &&
 			    n->child->child->type == MAN_TEXT &&
 			    !strcmp(n->child->child->string, "SYNOPSIS")) {
 				if (n->child->next->child != NULL)
 					print_man_nodelist(p, &mt,
 					    n->child->next->child, meta);
 				term_newln(p);
 				break;
 			}
 			n = n->next;
 		}
 	} else {
 		if (p->defindent == 0)
 			p->defindent = 7;
 		term_begin(p, print_man_head, print_man_foot, meta);
 		p->flags |= TERMP_NOSPACE;
 		if (n != NULL)
 			print_man_nodelist(p, &mt, n, meta);
 		term_end(p);
 	}
 }
 
 
 static size_t
 a2height(const struct termp *p, const char *cp)
 {
 	struct roffsu	 su;
 
 	if ( ! a2roffsu(cp, &su, SCALE_VS))
 		SCALE_VS_INIT(&su, atoi(cp));
 
 	return(term_vspan(p, &su));
 }
 
 static int
 a2width(const struct termp *p, const char *cp)
 {
 	struct roffsu	 su;
 
-	if ( ! a2roffsu(cp, &su, SCALE_BU))
+	if ( ! a2roffsu(cp, &su, SCALE_EN))
 		return(-1);
 
 	return((int)term_hspan(p, &su));
 }
 
 /*
  * Printing leading vertical space before a block.
  * This is used for the paragraph macros.
  * The rules are pretty simple, since there's very little nesting going
  * on here.  Basically, if we're the first within another block (SS/SH),
  * then don't emit vertical space.  If we are (RS), then do.  If not the
  * first, print it.
  */
 static void
 print_bvspace(struct termp *p, const struct man_node *n, int pardist)
 {
 	int	 i;
 
 	term_newln(p);
 
 	if (n->body && n->body->child)
 		if (MAN_TBL == n->body->child->type)
 			return;
 
 	if (MAN_ROOT == n->parent->type || MAN_RS != n->parent->tok)
 		if (NULL == n->prev)
 			return;
 
 	for (i = 0; i < pardist; i++)
 		term_vspace(p);
 }
 
 
 static int
 pre_ign(DECL_ARGS)
 {
 
 	return(0);
 }
 
 static int
 pre_ll(DECL_ARGS)
 {
 
 	term_setwidth(p, n->nchild ? n->child->string : NULL);
 	return(0);
 }
 
 static int
 pre_I(DECL_ARGS)
 {
 
 	term_fontrepl(p, TERMFONT_UNDER);
 	return(1);
 }
 
 static int
 pre_literal(DECL_ARGS)
 {
 
 	term_newln(p);
 
 	if (MAN_nf == n->tok || MAN_EX == n->tok)
 		mt->fl |= MANT_LITERAL;
 	else
 		mt->fl &= ~MANT_LITERAL;
 
 	/*
 	 * Unlike .IP and .TP, .HP does not have a HEAD.
 	 * So in case a second call to term_flushln() is needed,
 	 * indentation has to be set up explicitly.
 	 */
 	if (MAN_HP == n->parent->tok && p->rmargin < p->maxrmargin) {
 		p->offset = p->rmargin;
 		p->rmargin = p->maxrmargin;
 		p->trailspace = 0;
 		p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
 		p->flags |= TERMP_NOSPACE;
 	}
 
 	return(0);
 }
 
 static int
 pre_PD(DECL_ARGS)
 {
 
 	n = n->child;
 	if (0 == n) {
 		mt->pardist = 1;
 		return(0);
 	}
 	assert(MAN_TEXT == n->type);
 	mt->pardist = atoi(n->string);
 	return(0);
 }
 
 static int
 pre_alternate(DECL_ARGS)
 {
 	enum termfont		 font[2];
 	const struct man_node	*nn;
 	int			 savelit, i;
 
 	switch (n->tok) {
 	case MAN_RB:
 		font[0] = TERMFONT_NONE;
 		font[1] = TERMFONT_BOLD;
 		break;
 	case MAN_RI:
 		font[0] = TERMFONT_NONE;
 		font[1] = TERMFONT_UNDER;
 		break;
 	case MAN_BR:
 		font[0] = TERMFONT_BOLD;
 		font[1] = TERMFONT_NONE;
 		break;
 	case MAN_BI:
 		font[0] = TERMFONT_BOLD;
 		font[1] = TERMFONT_UNDER;
 		break;
 	case MAN_IR:
 		font[0] = TERMFONT_UNDER;
 		font[1] = TERMFONT_NONE;
 		break;
 	case MAN_IB:
 		font[0] = TERMFONT_UNDER;
 		font[1] = TERMFONT_BOLD;
 		break;
 	default:
 		abort();
 	}
 
 	savelit = MANT_LITERAL & mt->fl;
 	mt->fl &= ~MANT_LITERAL;
 
 	for (i = 0, nn = n->child; nn; nn = nn->next, i = 1 - i) {
 		term_fontrepl(p, font[i]);
 		if (savelit && NULL == nn->next)
 			mt->fl |= MANT_LITERAL;
 		print_man_node(p, mt, nn, meta);
 		if (nn->next)
 			p->flags |= TERMP_NOSPACE;
 	}
 
 	return(0);
 }
 
 static int
 pre_B(DECL_ARGS)
 {
 
 	term_fontrepl(p, TERMFONT_BOLD);
 	return(1);
 }
 
 static int
 pre_OP(DECL_ARGS)
 {
 
 	term_word(p, "[");
 	p->flags |= TERMP_NOSPACE;
 
 	if (NULL != (n = n->child)) {
 		term_fontrepl(p, TERMFONT_BOLD);
 		term_word(p, n->string);
 	}
 	if (NULL != n && NULL != n->next) {
 		term_fontrepl(p, TERMFONT_UNDER);
 		term_word(p, n->next->string);
 	}
 
 	term_fontrepl(p, TERMFONT_NONE);
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, "]");
 	return(0);
 }
 
 static int
 pre_ft(DECL_ARGS)
 {
 	const char	*cp;
 
 	if (NULL == n->child) {
 		term_fontlast(p);
 		return(0);
 	}
 
 	cp = n->child->string;
 	switch (*cp) {
 	case '4':
 		/* FALLTHROUGH */
 	case '3':
 		/* FALLTHROUGH */
 	case 'B':
 		term_fontrepl(p, TERMFONT_BOLD);
 		break;
 	case '2':
 		/* FALLTHROUGH */
 	case 'I':
 		term_fontrepl(p, TERMFONT_UNDER);
 		break;
 	case 'P':
 		term_fontlast(p);
 		break;
 	case '1':
 		/* FALLTHROUGH */
 	case 'C':
 		/* FALLTHROUGH */
 	case 'R':
 		term_fontrepl(p, TERMFONT_NONE);
 		break;
 	default:
 		break;
 	}
 	return(0);
 }
 
 static int
 pre_in(DECL_ARGS)
 {
 	int		 len, less;
 	size_t		 v;
 	const char	*cp;
 
 	term_newln(p);
 
 	if (NULL == n->child) {
 		p->offset = mt->offset;
 		return(0);
 	}
 
 	cp = n->child->string;
 	less = 0;
 
 	if ('-' == *cp)
 		less = -1;
 	else if ('+' == *cp)
 		less = 1;
 	else
 		cp--;
 
 	if ((len = a2width(p, ++cp)) < 0)
 		return(0);
 
 	v = (size_t)len;
 
 	if (less < 0)
 		p->offset -= p->offset > v ? v : p->offset;
 	else if (less > 0)
 		p->offset += v;
 	else
 		p->offset = v;
 
 	return(0);
 }
 
 static int
 pre_sp(DECL_ARGS)
 {
 	char		*s;
 	size_t		 i, len;
 	int		 neg;
 
 	if ((NULL == n->prev && n->parent)) {
 		switch (n->parent->tok) {
 		case MAN_SH:
 			/* FALLTHROUGH */
 		case MAN_SS:
 			/* FALLTHROUGH */
 		case MAN_PP:
 			/* FALLTHROUGH */
 		case MAN_LP:
 			/* FALLTHROUGH */
 		case MAN_P:
 			/* FALLTHROUGH */
 			return(0);
 		default:
 			break;
 		}
 	}
 
 	neg = 0;
 	switch (n->tok) {
 	case MAN_br:
 		len = 0;
 		break;
 	default:
 		if (NULL == n->child) {
 			len = 1;
 			break;
 		}
 		s = n->child->string;
 		if ('-' == *s) {
 			neg = 1;
 			s++;
 		}
 		len = a2height(p, s);
 		break;
 	}
 
 	if (0 == len)
 		term_newln(p);
 	else if (neg)
 		p->skipvsp += len;
 	else
 		for (i = 0; i < len; i++)
 			term_vspace(p);
 
 	return(0);
 }
 
 static int
 pre_HP(DECL_ARGS)
 {
 	size_t			 len, one;
 	int			 ival;
 	const struct man_node	*nn;
 
 	switch (n->type) {
 	case MAN_BLOCK:
 		print_bvspace(p, n, mt->pardist);
 		return(1);
 	case MAN_BODY:
 		break;
 	default:
 		return(0);
 	}
 
 	if ( ! (MANT_LITERAL & mt->fl)) {
 		p->flags |= TERMP_NOBREAK | TERMP_BRIND;
 		p->trailspace = 2;
 	}
 
 	len = mt->lmargin[mt->lmargincur];
 	ival = -1;
 
 	/* Calculate offset. */
 
 	if (NULL != (nn = n->parent->head->child))
 		if ((ival = a2width(p, nn->string)) >= 0)
 			len = (size_t)ival;
 
 	one = term_len(p, 1);
 	if (len < one)
 		len = one;
 
 	p->offset = mt->offset;
 	p->rmargin = mt->offset + len;
 
 	if (ival >= 0)
 		mt->lmargin[mt->lmargincur] = (size_t)ival;
 
 	return(1);
 }
 
 static void
 post_HP(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MAN_BODY:
 		term_newln(p);
 		p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND);
 		p->trailspace = 0;
 		p->offset = mt->offset;
 		p->rmargin = p->maxrmargin;
 		break;
 	default:
 		break;
 	}
 }
 
 static int
 pre_PP(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MAN_BLOCK:
 		mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
 		print_bvspace(p, n, mt->pardist);
 		break;
 	default:
 		p->offset = mt->offset;
 		break;
 	}
 
 	return(MAN_HEAD != n->type);
 }
 
 static int
 pre_IP(DECL_ARGS)
 {
 	const struct man_node	*nn;
 	size_t			 len;
 	int			 savelit, ival;
 
 	switch (n->type) {
 	case MAN_BODY:
 		p->flags |= TERMP_NOSPACE;
 		break;
 	case MAN_HEAD:
 		p->flags |= TERMP_NOBREAK;
 		p->trailspace = 1;
 		break;
 	case MAN_BLOCK:
 		print_bvspace(p, n, mt->pardist);
 		/* FALLTHROUGH */
 	default:
 		return(1);
 	}
 
 	len = mt->lmargin[mt->lmargincur];
 	ival = -1;
 
 	/* Calculate the offset from the optional second argument. */
 	if (NULL != (nn = n->parent->head->child))
 		if (NULL != (nn = nn->next))
 			if ((ival = a2width(p, nn->string)) >= 0)
 				len = (size_t)ival;
 
 	switch (n->type) {
 	case MAN_HEAD:
 		/* Handle zero-width lengths. */
 		if (0 == len)
 			len = term_len(p, 1);
 
 		p->offset = mt->offset;
 		p->rmargin = mt->offset + len;
 		if (ival < 0)
 			break;
 
 		/* Set the saved left-margin. */
 		mt->lmargin[mt->lmargincur] = (size_t)ival;
 
 		savelit = MANT_LITERAL & mt->fl;
 		mt->fl &= ~MANT_LITERAL;
 
 		if (n->child)
 			print_man_node(p, mt, n->child, meta);
 
 		if (savelit)
 			mt->fl |= MANT_LITERAL;
 
 		return(0);
 	case MAN_BODY:
 		p->offset = mt->offset + len;
 		p->rmargin = p->maxrmargin;
 		break;
 	default:
 		break;
 	}
 
 	return(1);
 }
 
 static void
 post_IP(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MAN_HEAD:
 		term_flushln(p);
 		p->flags &= ~TERMP_NOBREAK;
 		p->trailspace = 0;
 		p->rmargin = p->maxrmargin;
 		break;
 	case MAN_BODY:
 		term_newln(p);
 		p->offset = mt->offset;
 		break;
 	default:
 		break;
 	}
 }
 
 static int
 pre_TP(DECL_ARGS)
 {
 	const struct man_node	*nn;
 	size_t			 len;
 	int			 savelit, ival;
 
 	switch (n->type) {
 	case MAN_HEAD:
 		p->flags |= TERMP_NOBREAK;
 		p->trailspace = 1;
 		break;
 	case MAN_BODY:
 		p->flags |= TERMP_NOSPACE;
 		break;
 	case MAN_BLOCK:
 		print_bvspace(p, n, mt->pardist);
 		/* FALLTHROUGH */
 	default:
 		return(1);
 	}
 
 	len = (size_t)mt->lmargin[mt->lmargincur];
 	ival = -1;
 
 	/* Calculate offset. */
 
 	if (NULL != (nn = n->parent->head->child))
 		if (nn->string && 0 == (MAN_LINE & nn->flags))
 			if ((ival = a2width(p, nn->string)) >= 0)
 				len = (size_t)ival;
 
 	switch (n->type) {
 	case MAN_HEAD:
 		/* Handle zero-length properly. */
 		if (0 == len)
 			len = term_len(p, 1);
 
 		p->offset = mt->offset;
 		p->rmargin = mt->offset + len;
 
 		savelit = MANT_LITERAL & mt->fl;
 		mt->fl &= ~MANT_LITERAL;
 
 		/* Don't print same-line elements. */
 		nn = n->child;
 		while (NULL != nn && 0 == (MAN_LINE & nn->flags))
 			nn = nn->next;
 
 		while (NULL != nn) {
 			print_man_node(p, mt, nn, meta);
 			nn = nn->next;
 		}
 
 		if (savelit)
 			mt->fl |= MANT_LITERAL;
 		if (ival >= 0)
 			mt->lmargin[mt->lmargincur] = (size_t)ival;
 
 		return(0);
 	case MAN_BODY:
 		p->offset = mt->offset + len;
 		p->rmargin = p->maxrmargin;
 		p->trailspace = 0;
 		p->flags &= ~TERMP_NOBREAK;
 		break;
 	default:
 		break;
 	}
 
 	return(1);
 }
 
 static void
 post_TP(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MAN_HEAD:
 		term_flushln(p);
 		break;
 	case MAN_BODY:
 		term_newln(p);
 		p->offset = mt->offset;
 		break;
 	default:
 		break;
 	}
 }
 
 static int
 pre_SS(DECL_ARGS)
 {
 	int	 i;
 
 	switch (n->type) {
 	case MAN_BLOCK:
 		mt->fl &= ~MANT_LITERAL;
 		mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
 		mt->offset = term_len(p, p->defindent);
-		/* If following a prior empty `SS', no vspace. */
-		if (n->prev && MAN_SS == n->prev->tok)
-			if (NULL == n->prev->body->child)
-				break;
-		if (NULL == n->prev)
+
+		/*
+		 * No vertical space before the first subsection
+		 * and after an empty subsection.
+		 */
+
+		do {
+			n = n->prev;
+		} while (n != NULL && termacts[n->tok].flags & MAN_NOTEXT);
+		if (n == NULL || (n->tok == MAN_SS && n->body->child == NULL))
 			break;
+
 		for (i = 0; i < mt->pardist; i++)
 			term_vspace(p);
 		break;
 	case MAN_HEAD:
 		term_fontrepl(p, TERMFONT_BOLD);
 		p->offset = term_len(p, 3);
 		break;
 	case MAN_BODY:
 		p->offset = mt->offset;
 		break;
 	default:
 		break;
 	}
 
 	return(1);
 }
 
 static void
 post_SS(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MAN_HEAD:
 		term_newln(p);
 		break;
 	case MAN_BODY:
 		term_newln(p);
 		break;
 	default:
 		break;
 	}
 }
 
 static int
 pre_SH(DECL_ARGS)
 {
 	int	 i;
 
 	switch (n->type) {
 	case MAN_BLOCK:
 		mt->fl &= ~MANT_LITERAL;
 		mt->lmargin[mt->lmargincur] = term_len(p, p->defindent);
 		mt->offset = term_len(p, p->defindent);
-		/* If following a prior empty `SH', no vspace. */
-		if (n->prev && MAN_SH == n->prev->tok)
-			if (NULL == n->prev->body->child)
-				break;
-		/* If the first macro, no vspae. */
-		if (NULL == n->prev)
+
+		/*
+		 * No vertical space before the first section
+		 * and after an empty section.
+		 */
+
+		do {
+			n = n->prev;
+		} while (n != NULL && termacts[n->tok].flags & MAN_NOTEXT);
+		if (n == NULL || (n->tok == MAN_SH && n->body->child == NULL))
 			break;
+
 		for (i = 0; i < mt->pardist; i++)
 			term_vspace(p);
 		break;
 	case MAN_HEAD:
 		term_fontrepl(p, TERMFONT_BOLD);
 		p->offset = 0;
 		break;
 	case MAN_BODY:
 		p->offset = mt->offset;
 		break;
 	default:
 		break;
 	}
 
 	return(1);
 }
 
 static void
 post_SH(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MAN_HEAD:
 		term_newln(p);
 		break;
 	case MAN_BODY:
 		term_newln(p);
 		break;
 	default:
 		break;
 	}
 }
 
 static int
 pre_RS(DECL_ARGS)
 {
 	int		 ival;
 	size_t		 sz;
 
 	switch (n->type) {
 	case MAN_BLOCK:
 		term_newln(p);
 		return(1);
 	case MAN_HEAD:
 		return(0);
 	default:
 		break;
 	}
 
 	sz = term_len(p, p->defindent);
 
 	if (NULL != (n = n->parent->head->child))
 		if ((ival = a2width(p, n->string)) >= 0)
 			sz = (size_t)ival;
 
 	mt->offset += sz;
 	p->offset = mt->offset;
 	p->rmargin = p->maxrmargin;
 
 	if (++mt->lmarginsz < MAXMARGINS)
 		mt->lmargincur = mt->lmarginsz;
 
 	mt->lmargin[mt->lmargincur] = mt->lmargin[mt->lmargincur - 1];
 	return(1);
 }
 
 static void
 post_RS(DECL_ARGS)
 {
 	int		 ival;
 	size_t		 sz;
 
 	switch (n->type) {
 	case MAN_BLOCK:
 		return;
 	case MAN_HEAD:
 		return;
 	default:
 		term_newln(p);
 		break;
 	}
 
 	sz = term_len(p, p->defindent);
 
 	if (NULL != (n = n->parent->head->child))
 		if ((ival = a2width(p, n->string)) >= 0)
 			sz = (size_t)ival;
 
 	mt->offset = mt->offset < sz ?  0 : mt->offset - sz;
 	p->offset = mt->offset;
 
 	if (--mt->lmarginsz < MAXMARGINS)
 		mt->lmargincur = mt->lmarginsz;
 }
 
 static int
 pre_UR(DECL_ARGS)
 {
 
 	return (MAN_HEAD != n->type);
 }
 
 static void
 post_UR(DECL_ARGS)
 {
 
 	if (MAN_BLOCK != n->type)
 		return;
 
 	term_word(p, "<");
 	p->flags |= TERMP_NOSPACE;
 
 	if (NULL != n->child->child)
 		print_man_node(p, mt, n->child->child, meta);
 
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, ">");
 }
 
 static void
 print_man_node(DECL_ARGS)
 {
 	size_t		 rm, rmax;
 	int		 c;
 
 	switch (n->type) {
 	case MAN_TEXT:
 		/*
 		 * If we have a blank line, output a vertical space.
 		 * If we have a space as the first character, break
 		 * before printing the line's data.
 		 */
 		if ('\0' == *n->string) {
 			term_vspace(p);
 			return;
 		} else if (' ' == *n->string && MAN_LINE & n->flags)
 			term_newln(p);
 
 		term_word(p, n->string);
 		goto out;
 
 	case MAN_EQN:
 		if ( ! (n->flags & MAN_LINE))
 			p->flags |= TERMP_NOSPACE;
 		term_eqn(p, n->eqn);
 		if (n->next != NULL && ! (n->next->flags & MAN_LINE))
 			p->flags |= TERMP_NOSPACE;
 		return;
 	case MAN_TBL:
 		/*
 		 * Tables are preceded by a newline.  Then process a
 		 * table line, which will cause line termination,
 		 */
 		if (TBL_SPAN_FIRST & n->span->flags)
 			term_newln(p);
 		term_tbl(p, n->span);
 		return;
 	default:
 		break;
 	}
 
 	if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
 		term_fontrepl(p, TERMFONT_NONE);
 
 	c = 1;
 	if (termacts[n->tok].pre)
 		c = (*termacts[n->tok].pre)(p, mt, n, meta);
 
 	if (c && n->child)
 		print_man_nodelist(p, mt, n->child, meta);
 
 	if (termacts[n->tok].post)
 		(*termacts[n->tok].post)(p, mt, n, meta);
 	if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
 		term_fontrepl(p, TERMFONT_NONE);
 
 out:
 	/*
 	 * If we're in a literal context, make sure that words
 	 * together on the same line stay together.  This is a
 	 * POST-printing call, so we check the NEXT word.  Since
 	 * -man doesn't have nested macros, we don't need to be
 	 * more specific than this.
 	 */
-	if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) &&
-	    (NULL == n->next || MAN_LINE & n->next->flags)) {
+	if (mt->fl & MANT_LITERAL &&
+	    ! (p->flags & (TERMP_NOBREAK | TERMP_NONEWLINE)) &&
+	    (n->next == NULL || n->next->flags & MAN_LINE)) {
 		rm = p->rmargin;
 		rmax = p->maxrmargin;
 		p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
 		p->flags |= TERMP_NOSPACE;
-		if (NULL != n->string && '\0' != *n->string)
+		if (n->string != NULL && *n->string != '\0')
 			term_flushln(p);
 		else
 			term_newln(p);
 		if (rm < rmax && n->parent->tok == MAN_HP) {
 			p->offset = rm;
 			p->rmargin = rmax;
 		} else
 			p->rmargin = rm;
 		p->maxrmargin = rmax;
 	}
 	if (MAN_EOS & n->flags)
 		p->flags |= TERMP_SENTENCE;
 }
 
 
 static void
 print_man_nodelist(DECL_ARGS)
 {
 
 	print_man_node(p, mt, n, meta);
 	if ( ! n->next)
 		return;
 	print_man_nodelist(p, mt, n->next, meta);
 }
 
 static void
 print_man_foot(struct termp *p, const void *arg)
 {
 	const struct man_meta	*meta;
 	char			*title;
 	size_t			 datelen, titlen;
 
 	meta = (const struct man_meta *)arg;
 	assert(meta->title);
 	assert(meta->msec);
 	assert(meta->date);
 
 	term_fontrepl(p, TERMFONT_NONE);
 
 	if (meta->hasbody)
 		term_vspace(p);
 
 	/*
 	 * Temporary, undocumented option to imitate mdoc(7) output.
 	 * In the bottom right corner, use the source instead of
 	 * the title.
 	 */
 
 	if ( ! p->mdocstyle) {
 		if (meta->hasbody) {
 			term_vspace(p);
 			term_vspace(p);
 		}
 		mandoc_asprintf(&title, "%s(%s)",
 		    meta->title, meta->msec);
 	} else if (meta->source) {
 		title = mandoc_strdup(meta->source);
 	} else {
 		title = mandoc_strdup("");
 	}
 	datelen = term_strlen(p, meta->date);
 
 	/* Bottom left corner: manual source. */
 
 	p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
 	p->trailspace = 1;
 	p->offset = 0;
 	p->rmargin = p->maxrmargin > datelen ?
 	    (p->maxrmargin + term_len(p, 1) - datelen) / 2 : 0;
 
 	if (meta->source)
 		term_word(p, meta->source);
 	term_flushln(p);
 
 	/* At the bottom in the middle: manual date. */
 
 	p->offset = p->rmargin;
 	titlen = term_strlen(p, title);
 	p->rmargin = p->maxrmargin > titlen ? p->maxrmargin - titlen : 0;
 	p->flags |= TERMP_NOSPACE;
 
 	term_word(p, meta->date);
 	term_flushln(p);
 
 	/* Bottom right corner: manual title and section. */
 
 	p->flags &= ~TERMP_NOBREAK;
 	p->flags |= TERMP_NOSPACE;
 	p->trailspace = 0;
 	p->offset = p->rmargin;
 	p->rmargin = p->maxrmargin;
 
 	term_word(p, title);
 	term_flushln(p);
 	free(title);
 }
 
 static void
 print_man_head(struct termp *p, const void *arg)
 {
 	const struct man_meta	*meta;
 	const char		*volume;
 	char			*title;
 	size_t			 vollen, titlen;
 
 	meta = (const struct man_meta *)arg;
 	assert(meta->title);
 	assert(meta->msec);
 
 	volume = NULL == meta->vol ? "" : meta->vol;
 	vollen = term_strlen(p, volume);
 
 	/* Top left corner: manual title and section. */
 
 	mandoc_asprintf(&title, "%s(%s)", meta->title, meta->msec);
 	titlen = term_strlen(p, title);
 
 	p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
 	p->trailspace = 1;
 	p->offset = 0;
 	p->rmargin = 2 * (titlen+1) + vollen < p->maxrmargin ?
 	    (p->maxrmargin - vollen + term_len(p, 1)) / 2 :
 	    vollen < p->maxrmargin ? p->maxrmargin - vollen : 0;
 
 	term_word(p, title);
 	term_flushln(p);
 
 	/* At the top in the middle: manual volume. */
 
 	p->flags |= TERMP_NOSPACE;
 	p->offset = p->rmargin;
 	p->rmargin = p->offset + vollen + titlen < p->maxrmargin ?
 	    p->maxrmargin - titlen : p->maxrmargin;
 
 	term_word(p, volume);
 	term_flushln(p);
 
 	/* Top right corner: title and section, again. */
 
 	p->flags &= ~TERMP_NOBREAK;
 	p->trailspace = 0;
 	if (p->rmargin + titlen <= p->maxrmargin) {
 		p->flags |= TERMP_NOSPACE;
 		p->offset = p->rmargin;
 		p->rmargin = p->maxrmargin;
 		term_word(p, title);
 		term_flushln(p);
 	}
 
 	p->flags &= ~TERMP_NOSPACE;
 	p->offset = 0;
 	p->rmargin = p->maxrmargin;
 
 	/*
 	 * Groff prints three blank lines before the content.
 	 * Do the same, except in the temporary, undocumented
 	 * mode imitating mdoc(7) output.
 	 */
 
 	term_vspace(p);
 	if ( ! p->mdocstyle) {
 		term_vspace(p);
 		term_vspace(p);
 	}
 	free(title);
 }
Index: projects/arm_intrng/contrib/mdocml/mandoc.1
===================================================================
--- projects/arm_intrng/contrib/mdocml/mandoc.1	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/mandoc.1	(revision 276248)
@@ -1,1640 +1,1657 @@
-.\"	$Id: mandoc.1,v 1.125 2014/11/28 18:09:01 schwarze Exp $
+.\"	$Id: mandoc.1,v 1.128 2014/12/02 11:31:51 schwarze Exp $
 .\"
 .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons 
 .\" Copyright (c) 2012, 2014 Ingo Schwarze 
 .\"
 .\" Permission to use, copy, modify, and distribute this software for any
 .\" purpose with or without fee is hereby granted, provided that the above
 .\" copyright notice and this permission notice appear in all copies.
 .\"
 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: November 28 2014 $
+.Dd $Mdocdate: December 2 2014 $
 .Dt MANDOC 1
 .Os
 .Sh NAME
 .Nm mandoc
 .Nd format and display UNIX manuals
 .Sh SYNOPSIS
 .Nm mandoc
 .Op Fl acfhklV
 .Sm off
 .Op Fl I Cm os Li = Ar name
 .Sm on
 .Op Fl K Ns Ar encoding
 .Op Fl m Ns Ar format
 .Op Fl O Ns Ar option
 .Op Fl T Ns Ar output
 .Op Fl W Ns Ar level
 .Op Ar
 .Sh DESCRIPTION
 The
 .Nm
 utility formats
 .Ux
 manual pages for display.
 .Pp
 By default,
 .Nm
 reads
 .Xr mdoc 7
 or
 .Xr man 7
 text from stdin, implying
 .Fl m Ns Cm andoc ,
 and produces
-.Fl T Ns Cm ascii
+.Fl T Ns Cm locale
 output.
 .Pp
 The options are as follows:
 .Bl -tag -width Ds
 .It Fl a
 If the standard output is a terminal device and
 .Fl c
 is not specified, use
 .Xr more 1
 to paginate the output, just like
 .Xr man 1
 would.
 .It Fl c
 Copy the formatted manual pages to the standard output without using
 .Xr more 1
 to paginate them.
 This is the default.
 It can be specified to override
 .Fl a .
 .It Fl f
 A synonym for
 .Xr whatis 1 .
 This overrides any earlier
 .Fl k
 and
 .Fl l
 options.
 .Sm off
 .It Fl I Cm os Li = Ar name
 .Sm on
 Override the default operating system
 .Ar name
 for the
 .Xr mdoc 7
 .Sq \&Os
 macro.
 .It Fl h
 Display only the SYNOPSIS lines.
 Implies
 .Fl c .
 .It Fl K Ns Ar encoding
 Specify the input encoding.
 The supported
 .Ar encoding
 arguments are
 .Cm us-ascii ,
 .Cm iso-8859-1 ,
 and
 .Cm utf-8 .
 If not specified, autodetection uses the first match:
 .Bl -tag -width iso-8859-1
 .It Cm utf-8
 if the first three bytes of the input file
 are the UTF-8 byte order mark (BOM, 0xefbbbf)
 .It Ar encoding
 if the first or second line of the input file matches the
 .Sy emacs
 mode line format
 .Pp
 .D1 .\e" -*- Oo ...; Oc coding: Ar encoding ; No -*-
 .It Cm utf-8
 if the first non-ASCII byte in the file introduces a valid UTF-8 sequence
 .It Cm iso-8859-1
 otherwise
 .El
 .It Fl k
 A synonym for
 .Xr apropos 1 .
 This overrides any earlier
 .Fl f
 and
 .Fl l
 options.
 .It Fl l
 A synonym for
 .Fl a .
 Also reverts any earlier
 .Fl f
 and
 .Fl k
 options.
 .It Fl m Ns Ar format
 Input format.
 See
 .Sx Input Formats
 for available formats.
 Defaults to
 .Fl m Ns Cm andoc .
 .It Fl O Ns Ar option
 Comma-separated output options.
 .It Fl T Ns Ar output
 Output format.
 See
 .Sx Output Formats
 for available formats.
 Defaults to
-.Fl T Ns Cm ascii .
+.Fl T Ns Cm locale .
 .It Fl V
 Print version and exit.
 .It Fl W Ns Ar level
 Specify the minimum message
 .Ar level
 to be reported on the standard error output and to affect the exit status.
 The
 .Ar level
 can be
 .Cm warning ,
 .Cm error ,
 or
 .Cm fatal .
 The default is
 .Fl W Ns Cm fatal ;
 .Fl W Ns Cm all
 is an alias for
 .Fl W Ns Cm warning .
 See
 .Sx EXIT STATUS
 and
 .Sx DIAGNOSTICS
 for details.
 .Pp
 The special option
 .Fl W Ns Cm stop
 tells
 .Nm
 to exit after parsing a file that causes warnings or errors of at least
 the requested level.
 No formatted output will be produced from that file.
 If both a
 .Ar level
 and
 .Cm stop
 are requested, they can be joined with a comma, for example
 .Fl W Ns Cm error , Ns Cm stop .
 .It Ar file
 Read input from zero or more files.
 If unspecified, reads from stdin.
 If multiple files are specified,
 .Nm
 will halt with the first failed parse.
 .El
 .Pp
 In
 .Fl f
 and
 .Fl k
 mode,
 .Nm
 also supports the options
 .Fl CMmOSsw
 described in the
 .Xr apropos 1
 manual.
 .Ss Input Formats
 The
 .Nm
 utility accepts
 .Xr mdoc 7
 and
 .Xr man 7
 input with
 .Fl m Ns Cm doc
 and
 .Fl m Ns Cm an ,
 respectively.
 The
 .Xr mdoc 7
 format is
 .Em strongly
 recommended;
 .Xr man 7
 should only be used for legacy manuals.
 .Pp
 A third option,
 .Fl m Ns Cm andoc ,
 which is also the default, determines encoding on-the-fly: if the first
 non-comment macro is
 .Sq \&Dd
 or
 .Sq \&Dt ,
 the
 .Xr mdoc 7
 parser is used; otherwise, the
 .Xr man 7
 parser is used.
 .Pp
 If multiple
 files are specified with
 .Fl m Ns Cm andoc ,
 each has its file-type determined this way.
 If multiple files are
 specified and
 .Fl m Ns Cm doc
 or
 .Fl m Ns Cm an
 is specified, then this format is used exclusively.
 .Ss Output Formats
 The
 .Nm
 utility accepts the following
 .Fl T
 arguments, which correspond to output modes:
 .Bl -tag -width "-Tlocale"
 .It Fl T Ns Cm ascii
 Produce 7-bit ASCII output.
-This is the default.
 See
 .Sx ASCII Output .
 .It Fl T Ns Cm html
 Produce HTML5, CSS1, and MathML output.
 See
 .Sx HTML Output .
 .It Fl T Ns Cm lint
 Parse only: produce no output.
 Implies
 .Fl W Ns Cm warning .
 .It Fl T Ns Cm locale
 Encode output using the current locale.
+This is the default.
 See
 .Sx Locale Output .
 .It Fl T Ns Cm man
 Produce
 .Xr man 7
 format output.
 See
 .Sx Man Output .
 .It Fl T Ns Cm pdf
 Produce PDF output.
 See
 .Sx PDF Output .
 .It Fl T Ns Cm ps
 Produce PostScript output.
 See
 .Sx PostScript Output .
 .It Fl T Ns Cm tree
 Produce an indented parse tree.
 .It Fl T Ns Cm utf8
 Encode output in the UTF\-8 multi-byte format.
 See
 .Sx UTF\-8 Output .
 .It Fl T Ns Cm xhtml
 This is a synonym for
 .Fl T Ns Cm html .
 .El
 .Pp
 If multiple input files are specified, these will be processed by the
 corresponding filter in-order.
 .Ss ASCII Output
 Output produced by
-.Fl T Ns Cm ascii ,
-which is the default, is rendered in standard 7-bit ASCII documented in
+.Fl T Ns Cm ascii
+is rendered in standard 7-bit ASCII documented in
 .Xr ascii 7 .
 .Pp
 Font styles are applied by using back-spaced encoding such that an
 underlined character
 .Sq c
 is rendered as
 .Sq _ Ns \e[bs] Ns c ,
 where
 .Sq \e[bs]
 is the back-space character number 8.
 Emboldened characters are rendered as
 .Sq c Ns \e[bs] Ns c .
 .Pp
 The special characters documented in
 .Xr mandoc_char 7
 are rendered best-effort in an ASCII equivalent.
 If no equivalent is found,
 .Sq \&?
 is used instead.
 .Pp
 Output width is limited to 78 visible columns unless literal input lines
 exceed this limit.
 .Pp
 The following
 .Fl O
 arguments are accepted:
 .Bl -tag -width Ds
 .It Cm indent Ns = Ns Ar indent
 The left margin for normal text is set to
 .Ar indent
 blank characters instead of the default of five for
 .Xr mdoc 7
 and seven for
 .Xr man 7 .
 Increasing this is not recommended; it may result in degraded formatting,
 for example overfull lines or ugly line breaks.
 .It Cm width Ns = Ns Ar width
 The output width is set to
 .Ar width ,
 which will normalise to \(>=60.
 .El
 .Ss HTML Output
 Output produced by
 .Fl T Ns Cm html
 conforms to HTML5 using optional self-closing tags.
 Default styles use only CSS1.
 Equations rendered from
 .Xr eqn 7
 blocks use MathML.
 .Pp
 The
 .Pa example.style.css
 file documents style-sheet classes available for customising output.
 If a style-sheet is not specified with
 .Fl O Ns Ar style ,
 .Fl T Ns Cm html
 defaults to simple output (via an embedded style-sheet)
 readable in any graphical or text-based web
 browser.
 .Pp
 Special characters are rendered in decimal-encoded UTF\-8.
 .Pp
 The following
 .Fl O
 arguments are accepted:
 .Bl -tag -width Ds
 .It Cm fragment
 Omit the  declaration and the , , and 
 elements and only emit the subtree below the  element.
 The
 .Cm style
 argument will be ignored.
 This is useful when embedding manual content within existing documents.
 .It Cm includes Ns = Ns Ar fmt
 The string
 .Ar fmt ,
 for example,
 .Ar ../src/%I.html ,
 is used as a template for linked header files (usually via the
 .Sq \&In
 macro).
 Instances of
 .Sq \&%I
 are replaced with the include filename.
 The default is not to present a
 hyperlink.
 .It Cm man Ns = Ns Ar fmt
 The string
 .Ar fmt ,
 for example,
 .Ar ../html%S/%N.%S.html ,
 is used as a template for linked manuals (usually via the
 .Sq \&Xr
 macro).
 Instances of
 .Sq \&%N
 and
 .Sq %S
 are replaced with the linked manual's name and section, respectively.
 If no section is included, section 1 is assumed.
 The default is not to
 present a hyperlink.
 .It Cm style Ns = Ns Ar style.css
 The file
 .Ar style.css
 is used for an external style-sheet.
 This must be a valid absolute or
 relative URI.
 .El
 .Ss Locale Output
 Locale-depending output encoding is triggered with
 .Fl T Ns Cm locale .
+This is the default.
+.Pp
 This option is not available on all systems: systems without locale
 support, or those whose internal representation is not natively UCS-4,
 will fall back to
 .Fl T Ns Cm ascii .
 See
 .Sx ASCII Output
 for font style specification and available command-line arguments.
 .Ss Man Output
 Translate input format into
 .Xr man 7
 output format.
 This is useful for distributing manual sources to legacy systems
 lacking
 .Xr mdoc 7
 formatters.
 .Pp
 If
 .Xr mdoc 7
 is passed as input, it is translated into
 .Xr man 7 .
 If the input format is
 .Xr man 7 ,
 the input is copied to the output, expanding any
 .Xr roff 7
 .Sq so
 requests.
 The parser is also run, and as usual, the
 .Fl W
 level controls which
 .Sx DIAGNOSTICS
 are displayed before copying the input to the output.
 .Ss PDF Output
 PDF-1.1 output may be generated by
 .Fl T Ns Cm pdf .
 See
 .Sx PostScript Output
 for
 .Fl O
 arguments and defaults.
 .Ss PostScript Output
 PostScript
 .Qq Adobe-3.0
 Level-2 pages may be generated by
 .Fl T Ns Cm ps .
 Output pages default to letter sized and are rendered in the Times font
 family, 11-point.
 Margins are calculated as 1/9 the page length and width.
 Line-height is 1.4m.
 .Pp
 Special characters are rendered as in
 .Sx ASCII Output .
 .Pp
 The following
 .Fl O
 arguments are accepted:
 .Bl -tag -width Ds
 .It Cm paper Ns = Ns Ar name
 The paper size
 .Ar name
 may be one of
 .Ar a3 ,
 .Ar a4 ,
 .Ar a5 ,
 .Ar legal ,
 or
 .Ar letter .
 You may also manually specify dimensions as
 .Ar NNxNN ,
 width by height in millimetres.
 If an unknown value is encountered,
 .Ar letter
 is used.
 .El
 .Ss UTF\-8 Output
 Use
 .Fl T Ns Cm utf8
 to force a UTF\-8 locale.
 See
 .Sx Locale Output
 for details and options.
 .Sh ENVIRONMENT
 .Bl -tag -width MANPAGER
 .It Ev MANPAGER
 Any non-empty value of the environment variable
 .Ev MANPAGER
 will be used instead of the standard pagination program,
 .Xr more 1 .
 .It Ev PAGER
 Specifies the pagination program to use when
 .Ev MANPAGER
 is not defined.
 If neither PAGER nor MANPAGER is defined,
 .Pa /usr/bin/more Fl s
 will be used.
 .El
 .Sh EXIT STATUS
 The
 .Nm
 utility exits with one of the following values, controlled by the message
 .Ar level
 associated with the
 .Fl W
 option:
 .Pp
 .Bl -tag -width Ds -compact
 .It 0
 No warnings or errors occurred, or those that did were ignored because
 they were lower than the requested
 .Ar level .
 .It 2
 At least one warning occurred, but no error, and
 .Fl W Ns Cm warning
 was specified.
 .It 3
 At least one parsing error occurred, but no fatal error, and
 .Fl W Ns Cm error
 or
 .Fl W Ns Cm warning
 was specified.
 .It 4
 A fatal parsing error occurred.
 .It 5
 Invalid command line arguments were specified.
 No input files have been read.
 .It 6
 An operating system error occurred, for example memory exhaustion or an
 error accessing input files.
 Such errors cause
 .Nm
 to exit at once, possibly in the middle of parsing or formatting a file.
 .El
 .Pp
 Note that selecting
 .Fl T Ns Cm lint
 output mode implies
 .Fl W Ns Cm warning .
 .Sh EXAMPLES
 To page manuals to the terminal:
 .Pp
 .Dl $ mandoc \-Wall,stop mandoc.1 2\*(Gt&1 | less
 .Dl $ mandoc mandoc.1 mdoc.3 mdoc.7 | less
 .Pp
 To produce HTML manuals with
 .Ar style.css
 as the style-sheet:
 .Pp
 .Dl $ mandoc \-Thtml -Ostyle=style.css mdoc.7 \*(Gt mdoc.7.html
 .Pp
 To check over a large set of manuals:
 .Pp
 .Dl $ mandoc \-Tlint `find /usr/src -name \e*\e.[1-9]`
 .Pp
 To produce a series of PostScript manuals for A4 paper:
 .Pp
 .Dl $ mandoc \-Tps \-Opaper=a4 mdoc.7 man.7 \*(Gt manuals.ps
 .Pp
 Convert a modern
 .Xr mdoc 7
 manual to the older
 .Xr man 7
 format, for use on systems lacking an
 .Xr mdoc 7
 parser:
 .Pp
 .Dl $ mandoc \-Tman foo.mdoc \*(Gt foo.man
 .Sh DIAGNOSTICS
 Messages displayed by
 .Nm
 follow this format:
 .Pp
 .D1 Nm Ns : Ar file : Ns Ar line : Ns Ar column : level : message : macro args
 .Pp
 Line and column numbers start at 1.
 Both are omitted for messages referring to an input file as a whole.
 Macro names and arguments are omitted where meaningless.
 Fatal messages about invalid command line arguments
 or operating system errors, for example when memory is exhausted,
 may also omit the
 .Ar file
 and
 .Ar level
 fields.
 .Pp
 Message levels have the following meanings:
 .Bl -tag -width "warning"
 .It Cm syserr
 Opening or reading an input file failed, so the parser cannot
 even be started and no output is produced from that input file.
 .It Cm fatal
 The parser is unable to parse a given input file at all.
 No formatted output is produced from that input file.
 .It Cm error
 An input file contains syntax that cannot be safely interpreted,
 either because it is invalid or because
 .Nm
 does not implement it yet.
 By discarding part of the input or inserting missing tokens,
 the parser is able to continue, and the error does not prevent
 generation of formatted output, but typically, preparing that
 output involves information loss, broken document structure
 or unintended formatting.
 .It Cm warning
 An input file uses obsolete, discouraged or non-portable syntax.
 All the same, the meaning of the input is unambiguous and a correct
 rendering can be produced.
 Documents causing warnings may render poorly when using other
 formatting tools instead of
 .Nm .
 .El
 .Pp
 Messages of the
 .Cm warning
 and
 .Cm error
 levels are hidden unless their level, or a lower level, is requested using a
 .Fl W
 option or
 .Fl T Ns Cm lint
 output mode.
 .Ss Warnings related to the document prologue
 .Bl -ohang
 .It Sy "missing manual title, using UNTITLED"
 .Pq mdoc
 A
 .Ic \&Dt
 macro has no arguments, or there is no
 .Ic \&Dt
 macro before the first non-prologue macro.
 .It Sy "missing manual title, using \(dq\(dq"
 .Pq man
 There is no
 .Ic \&TH
 macro, or it has no arguments.
 .It Sy "lower case character in document title"
 .Pq mdoc , man
 The title is still used as given in the
 .Ic \&Dt
 or
 .Ic \&TH
 macro.
 .It Sy "missing manual section, using \(dq\(dq"
 .Pq mdoc , man
 A
 .Ic \&Dt
 or
 .Ic \&TH
 macro lacks the mandatory section argument.
 .It Sy "unknown manual section"
 .Pq mdoc
 The section number in a
 .Ic \&Dt
 line is invalid, but still used.
 .It Sy "missing date, using today's date"
 .Pq mdoc, man
 The document was parsed as
 .Xr mdoc 7
 and it has no
 .Ic \&Dd
 macro, or the
 .Ic \&Dd
 macro has no arguments or only empty arguments;
 or the document was parsed as
 .Xr man 7
 and it has no
 .Ic \&TH
 macro, or the
 .Ic \&TH
 macro has less than three arguments or its third argument is empty.
 .It Sy "cannot parse date, using it verbatim"
 .Pq mdoc , man
 The date given in a
 .Ic \&Dd
 or
 .Ic \&TH
 macro does not follow the conventional format.
 .It Sy "missing Os macro, using \(dq\(dq"
 .Pq mdoc
 The default or current system is not shown in this case.
 .It Sy "duplicate prologue macro"
 .Pq mdoc
 One of the prologue macros occurs more than once.
 The last instance overrides all previous ones.
 .It Sy "late prologue macro"
 .Pq mdoc
 A
 .Ic \&Dd
 or
 .Ic \&Os
 macro occurs after some non-prologue macro, but still takes effect.
 .It Sy "skipping late title macro"
 .Pq mdoc
 The
 .Ic \&Dt
 macro can only occur before the first non-prologue macro
 because traditional formatters write the page header
 before parsing the document body.
 Even though this technical restriction does not apply to
 .Nm ,
 traditional semantics is preserved.
 The late macro is discarded including its arguments.
 .It Sy "prologue macros out of order"
 .Pq mdoc
 The prologue macros are not given in the conventional order
 .Ic \&Dd ,
 .Ic \&Dt ,
 .Ic \&Os .
 All three macros are used even when given in another order.
 .El
 .Ss Warnings regarding document structure
 .Bl -ohang
 .It Sy ".so is fragile, better use ln(1)"
 .Pq roff
 Including files only works when the parser program runs with the correct
 current working directory.
 .It Sy "no document body"
 .Pq mdoc , man
 The document body contains neither text nor macros.
 An empty document is shown, consisting only of a header and a footer line.
 .It Sy "content before first section header"
 .Pq mdoc , man
 Some macros or text precede the first
 .Ic \&Sh
 or
 .Ic \&SH
 section header.
 The offending macros and text are parsed and added to the top level
 of the syntax tree, outside any section block.
 .It Sy "first section is not NAME"
 .Pq mdoc
 The argument of the first
 .Ic \&Sh
 macro is not
 .Sq NAME .
 This may confuse
 .Xr makewhatis 8
 and
 .Xr apropos 1 .
 .It Sy "bad NAME section contents"
 .Pq mdoc
 The last node in the NAME section is not an
 .Ic \&Nd
 macro, or any preceding macro is not
 .Ic \&Nm ,
 or the NAME section is completely empty.
 This may confuse
 .Xr makewhatis 8
 and
 .Xr apropos 1 .
 .It Sy "sections out of conventional order"
 .Pq mdoc
 A standard section occurs after another section it usually precedes.
 All section titles are used as given,
 and the order of sections is not changed.
 .It Sy "duplicate section title"
 .Pq mdoc
 The same standard section title occurs more than once.
 .It Sy "unexpected section"
 .Pq mdoc
 A standard section header occurs in a section of the manual
 where it normally isn't useful.
 .It Sy "unusual Xr order"
 .Pq mdoc
 In the SEE ALSO section, an
 .Ic \&Xr
 macro with a lower section number follows one with a higher number,
 or two
 .Ic \&Xr
 macros refering to the same section are out of alphabetical order.
 .It Sy "unusual Xr punctuation"
 .Pq mdoc
 In the SEE ALSO section, punctuation between two
 .Ic \&Xr
 macros differs from a single comma, or there is trailing punctuation
 after the last
 .Ic \&Xr
 macro.
 .It Sy "AUTHORS section without An macro"
 .Pq mdoc
 An AUTHORS sections contains no
 .Ic \&An
 macros, or only empty ones.
 Probably, there are author names lacking markup.
 .El
 .Ss "Warnings related to macros and nesting"
 .Bl -ohang
 .It Sy "obsolete macro"
 .Pq mdoc
 See the
 .Xr mdoc 7
 manual for replacements.
+.It Sy "macro neither callable nor escaped"
+.Pq mdoc
+The name of a macro that is not callable appears on a macro line.
+It is printed verbatim.
+If the intention is to call it, move it to its own line;
+otherwise, escape it by prepending
+.Sq \e& .
 .It Sy "skipping paragraph macro"
 In
 .Xr mdoc 7
 documents, this happens
 .Bl -dash -compact
 .It
 at the beginning and end of sections and subsections
 .It
 right before non-compact lists and displays
 .It
 at the end of items in non-column, non-compact lists
 .It
 and for multiple consecutive paragraph macros.
 .El
 In
 .Xr man 7
 documents, it happens
 .Bl -dash -compact
 .It
 for empty
 .Ic \&P ,
 .Ic \&PP ,
 and
 .Ic \&LP
 macros
 .It
 for
 .Ic \&IP
 macros having neither head nor body arguments
 .It
 for
 .Ic \&br
 or
 .Ic \&sp
 right after
 .Ic \&SH
 or
 .Ic \&SS
 .El
 .It Sy "moving paragraph macro out of list"
 .Pq mdoc
 A list item in a
 .Ic \&Bl
 list contains a trailing paragraph macro.
 The paragraph macro is moved after the end of the list.
 .It Sy "skipping no-space macro"
 .Pq mdoc
 An input line begins with an
 .Ic \&Ns
 macro.
 The macro is ignored.
 .It Sy "blocks badly nested"
 .Pq mdoc
 If two blocks intersect, one should completely contain the other.
 Otherwise, rendered output is likely to look strange in any output
 format, and rendering in SGML-based output formats is likely to be
 outright wrong because such languages do not support badly nested
 blocks at all.
 Typical examples of badly nested blocks are
 .Qq Ic \&Ao \&Bo \&Ac \&Bc
 and
 .Qq Ic \&Ao \&Bq \&Ac .
 In these examples,
 .Ic \&Ac
 breaks
 .Ic \&Bo
 and
 .Ic \&Bq ,
 respectively.
 .It Sy "nested displays are not portable"
 .Pq mdoc
 A
 .Ic \&Bd ,
 .Ic \&D1 ,
 or
 .Ic \&Dl
 display occurs nested inside another
 .Ic \&Bd
 display.
 This works with
 .Nm ,
 but fails with most other implementations.
 .It Sy "moving content out of list"
 .Pq mdoc
 A
 .Ic \&Bl
 list block contains text or macros before the first
 .Ic \&It
 macro.
 The offending children are moved before the beginning of the list.
 .It Sy ".Vt block has child macro"
 .Pq mdoc
 The
 .Ic \&Vt
 macro supports plain text arguments only.
 Formatting may be ugly and semantic searching
 for the affected content might not work.
 .It Sy "fill mode already enabled, skipping"
 .Pq man
 A
 .Ic \&fi
 request occurs even though the document is still in fill mode,
 or already switched back to fill mode.
 It has no effect.
 .It Sy "fill mode already disabled, skipping"
 .Pq man
 An
 .Ic \&nf
 request occurs even though the document already switched to no-fill mode
 and did not switch back to fill mode yet.
 It has no effect.
 .It Sy "line scope broken"
 .Pq man
 While parsing the next-line scope of the previous macro,
 another macro is found that prematurely terminates the previous one.
 The previous, interrupted macro is deleted from the parse tree.
 .El
 .Ss "Warnings related to missing arguments"
 .Bl -ohang
 .It Sy "skipping empty request"
 .Pq roff , eqn
 The macro name is missing from a macro definition request,
 or an
 .Xr eqn 7
 control statement or operation keyword lacks its required argument.
 .It Sy "conditional request controls empty scope"
 .Pq roff
 A conditional request is only useful if any of the following
 follows it on the same logical input line:
 .Bl -dash -compact
 .It
 The
 .Sq \e{
 keyword to open a multi-line scope.
 .It
 A request or macro or some text, resulting in a single-line scope.
 .It
 The immediate end of the logical line without any intervening whitespace,
 resulting in next-line scope.
 .El
 Here, a conditional request is followed by trailing whitespace only,
 and there is no other content on its logical input line.
 Note that it doesn't matter whether the logical input line is split
 across multiple physical input lines using
 .Sq \e
 line continuation characters.
 This is one of the rare cases
 where trailing whitespace is syntactically significant.
 The conditional request controls a scope containing whitespace only,
 so it is unlikely to have a significant effect,
 except that it may control a following
 .Ic \&el
 clause.
 .It Sy "skipping empty macro"
 .Pq mdoc
 The indicated macro has no arguments and hence no effect.
 .It Sy "empty argument, using 0n"
 .Pq mdoc
 The required width is missing after
 .Ic \&Bd
 or
 .Ic \&Bl
 .Fl offset
 or
 .Fl width.
 .It Sy "argument count wrong"
 .Pq mdoc , man
 The indicated macro has too few or too many arguments.
 The syntax tree will contain the wrong number of arguments as given.
 Formatting behaviour depends on the specific macro in question.
 Note that the same message may also occur as an ERROR, see below.
 .It Sy "missing display type, using -ragged"
 .Pq mdoc
 The
 .Ic \&Bd
 macro is invoked without the required display type.
 .It Sy "list type is not the first argument"
 .Pq mdoc
 In a
 .Ic \&Bl
 macro, at least one other argument precedes the type argument.
 The
 .Nm
 utility copes with any argument order, but some other
 .Xr mdoc 7
 implementations do not.
 .It Sy "missing -width in -tag list, using 8n"
 .Pq mdoc
 Every
 .Ic \&Bl
 macro having the
 .Fl tag
 argument requires
 .Fl width ,
 too.
 .It Sy "missing utility name, using \(dq\(dq"
 .Pq mdoc
 The
 .Ic \&Ex Fl std
 macro is called without an argument before
 .Ic \&Nm
 has first been called with an argument.
 .It Sy "empty head in list item"
 .Pq mdoc
 In a
 .Ic \&Bl
 .Fl diag ,
 .Fl hang ,
 .Fl inset ,
 .Fl ohang ,
 or
 .Fl tag
 list, an
 .Ic \&It
 macro lacks the required argument.
 The item head is left empty.
 .It Sy "empty list item"
 .Pq mdoc
 In a
 .Ic \&Bl
 .Fl bullet ,
 .Fl dash ,
 .Fl enum ,
 or
 .Fl hyphen
 list, an
 .Ic \&It
 block is empty.
 An empty list item is shown.
 .It Sy "missing font type"
 .Pq mdoc
 A
 .Ic \&Bf
 macro has no argument.
 It switches to the default font,
 .Cm \efR .
 .It Sy "unknown font type"
 .Pq mdoc
 The
 .Ic \&Bf
 argument is invalid.
 The default font
 .Cm \efR
 is used instead.
+.It Sy "nothing follows prefix"
+.Pq mdoc
+A
+.Ic \&Pf
+macro has no argument, or only one argument and no macro follows
+on the same input line.
+This defeats its purpose; in particular, spacing is not suppressed
+before the text or macros following on the next input line.
 .It Sy "missing -std argument, adding it"
 .Pq mdoc
 An
 .Ic \&Ex
 or
 .Ic \&Rv
 macro lacks the required
 .Fl std
 argument.
 The
 .Nm
 utility assumes
 .Fl std
 even when it is not specified, but other implementations may not.
 .It Sy "missing eqn box, using \(dq\(dq"
 .Pq eqn
 A diacritic mark or a binary operator is found,
 but there is nothing to the left of it.
 An empty box is inserted.
 .El
 .Ss "Warnings related to bad macro arguments"
 .Bl -ohang
 .It Sy "unterminated quoted argument"
 .Pq roff
 Macro arguments can be enclosed in double quote characters
 such that space characters and macro names contained in the quoted
 argument need not be escaped.
 The closing quote of the last argument of a macro can be omitted.
 However, omitting it is not recommended because it makes the code
 harder to read.
 .It Sy "duplicate argument"
 .Pq mdoc
 A
 .Ic \&Bd
 or
 .Ic \&Bl
 macro has more than one
 .Fl compact ,
 more than one
 .Fl offset ,
 or more than one
 .Fl width
 argument.
 All but the last instances of these arguments are ignored.
 .It Sy "skipping duplicate argument"
 .Pq mdoc
 An
 .Ic \&An
 macro has more than one
 .Fl split
 or
 .Fl nosplit
 argument.
 All but the first of these arguments are ignored.
 .It Sy "skipping duplicate display type"
 .Pq mdoc
 A
 .Ic \&Bd
 macro has more than one type argument; the first one is used.
 .It Sy "skipping duplicate list type"
 .Pq mdoc
 A
 .Ic \&Bl
 macro has more than one type argument; the first one is used.
 .It Sy "skipping -width argument"
 .Pq mdoc
 A
 .Ic \&Bl
 .Fl column ,
 .Fl diag ,
 .Fl ohang ,
 .Fl inset ,
 or
 .Fl item
 list has a
 .Fl width
 argument.
 That has no effect.
 .It Sy "unknown AT&T UNIX version"
 .Pq mdoc
 An
 .Ic \&At
 macro has an invalid argument.
 It is used verbatim, with
 .Qq "AT&T UNIX "
 prefixed to it.
 .It Sy "comma in function argument"
 .Pq mdoc
 An argument of an
 .Ic \&Fa
 or
 .Ic \&Fn
 macro contains a comma; it should probably be split into two arguments.
 .It Sy "parenthesis in function name"
 .Pq mdoc
 The first argument of an
 .Ic \&Fc
 or
 .Ic \&Fn
 macro contains an opening or closing parenthesis; that's probably wrong,
 parentheses are added automatically.
 .It Sy "invalid content in Rs block"
 .Pq mdoc
 An
 .Ic \&Rs
 block contains plain text or non-% macros.
 The bogus content is left in the syntax tree.
 Formatting may be poor.
 .It Sy "invalid Boolean argument"
 .Pq mdoc
 An
 .Ic \&Sm
 macro has an argument other than
 .Cm on
 or
 .Cm off .
 The invalid argument is moved out of the macro, which leaves the macro
 empty, causing it to toggle the spacing mode.
 .It Sy "unknown font, skipping request"
 .Pq man , tbl
 A
 .Xr roff 7
 .Ic \&ft
 request or a
 .Xr tbl 7
 .Ic \&f
 layout modifier has an unknown
 .Ar font
 argument.
 .El
 .Ss "Warnings related to plain text"
 .Bl -ohang
 .It Sy "blank line in fill mode, using .sp"
 .Pq mdoc
 The meaning of blank input lines is only well-defined in non-fill mode:
 In fill mode, line breaks of text input lines are not supposed to be
 significant.
 However, for compatibility with groff, blank lines in fill mode
 are replaced with
 .Ic \&sp
 requests.
 .It Sy "tab in filled text"
 .Pq mdoc , man
 The meaning of tab characters is only well-defined in non-fill mode:
 In fill mode, whitespace is not supposed to be significant
 on text input lines.
 As an implementation dependent choice, tab characters on text lines
 are passed through to the formatters in any case.
 Given that the text before the tab character will be filled,
 it is hard to predict which tab stop position the tab will advance to.
 .It Sy "whitespace at end of input line"
 .Pq mdoc , man , roff
 Whitespace at the end of input lines is almost never semantically
 significant \(em but in the odd case where it might be, it is
 extremely confusing when reviewing and maintaining documents.
 .It Sy "bad comment style"
 .Pq roff
 Comment lines start with a dot, a backslash, and a double-quote character.
 The
 .Nm
 utility treats the line as a comment line even without the backslash,
 but leaving out the backslash might not be portable.
 .It Sy "invalid escape sequence"
 .Pq roff
 An escape sequence has an invalid opening argument delimiter, lacks the
 closing argument delimiter, or the argument has too few characters.
 If the argument is incomplete,
 .Ic \e*
 and
 .Ic \en
 expand to an empty string,
 .Ic \eB
 to the digit
 .Sq 0 ,
 and
 .Ic \ew
 to the length of the incomplete argument.
 All other invalid escape sequences are ignored.
 .It Sy "undefined string, using \(dq\(dq"
 .Pq roff
 If a string is used without being defined before,
 its value is implicitly set to the empty string.
 However, defining strings explicitly before use
 keeps the code more readable.
 .El
 .Ss "Errors related to equations"
 .Bl -inset -compact
 .It "unexpected equation scope closure"
 .It "equation scope open on exit"
 .It "overlapping equation scopes"
 .It "unexpected end of equation"
 .El
 .Ss "Errors related to tables"
 .Bl -inset -compact
 .It "bad table syntax"
 .It "bad table option"
 .It "bad table layout"
 .It "no table layout cells specified"
 .It "no table data cells specified"
 .It "ignore data in cell"
 .It "data block still open"
 .It "ignoring extra data cells"
 .El
 .Ss "Errors related to roff, mdoc, and man code"
 .Bl -ohang
 .It Sy "input stack limit exceeded, infinite loop?"
 .Pq roff
 Explicit recursion limits are implemented for the following features,
 in order to prevent infinite loops:
 .Bl -dash -compact
 .It
 expansion of nested escape sequences
 including expansion of strings and number registers,
 .It
 expansion of nested user-defined macros,
 .It
 and
 .Ic \&so
 file inclusion.
 .El
 When a limit is hit, the output is incorrect, typically losing
 some content, but the parser can continue.
 .It Sy "skipping bad character"
 .Pq mdoc , man , roff
 The input file contains a byte that is not a printable
 .Xr ascii 7
 character.
 The message mentions the character number.
 The offending byte is replaced with a question mark
 .Pq Sq \&? .
 Consider editing the input file to replace the byte with an ASCII
 transliteration of the intended character.
 .It Sy "skipping unknown macro"
 .Pq mdoc , man , roff
 The first identifier on a request or macro line is neither recognized as a
 .Xr roff 7
 request, nor as a user-defined macro, nor, respectively, as an
 .Xr mdoc 7
 or
 .Xr man 7
 macro.
 It may be mistyped or unsupported.
 The request or macro is discarded including its arguments.
 .It Sy "skipping item outside list"
 .Pq mdoc , eqn
 An
 .Ic \&It
 macro occurs outside any
 .Ic \&Bl
 list, or an
 .Xr eqn 7
 .Ic above
 delimiter occurs outside any pile.
 It is discarded including its arguments.
 .It Sy "skipping column outside column list"
 .Pq mdoc
 A
 .Ic \&Ta
 macro occurs outside any
 .Ic \&Bl Fl column
 block.
 It is discarded including its arguments.
 .It Sy "skipping end of block that is not open"
 .Pq mdoc , man , eqn , tbl , roff
 Various syntax elements can only be used to explicitly close blocks
 that have previously been opened.
 An
 .Xr mdoc 7
 block closing macro, a
 .Xr man 7
 .Ic \&RE
 or
 .Ic \&UE
 macro, an
 .Xr eqn 7
 right delimiter or closing brace, or the end of an equation, table, or
 .Xr roff 7
 conditional request is encountered but no matching block is open.
 The offending request or macro is discarded.
 .It Sy "inserting missing end of block"
 .Pq mdoc , tbl
 Various
 .Xr mdoc 7
 macros as well as tables require explicit closing by dedicated macros.
 A block that doesn't support bad nesting
 ends before all of its children are properly closed.
 The open child nodes are closed implicitly.
 .It Sy "scope open on exit"
 .Pq mdoc , man , eqn , tbl , roff
 At the end of the document, an explicit
 .Xr mdoc 7
 block, a
 .Xr man 7
 next-line scope or
 .Ic \&RS
 or
 .Ic \&UR
 block, an equation, table, or
 .Xr roff 7
 conditional or ignore block is still open.
 The open block is closed implicitly.
 .It Sy "escaped character not allowed in a name"
 .Pq roff
 Macro, string and register identifiers consist of printable,
 non-whitespace ASCII characters.
 Escape sequences and characters and strings expressed in terms of them
 cannot form part of a name.
 The first argument of an
 .Ic \&am ,
 .Ic \&as ,
 .Ic \&de ,
 .Ic \&ds ,
 .Ic \&nr ,
 or
 .Ic \&rr
 request, or any argument of an
 .Ic \&rm
 request, or the name of a request or user defined macro being called,
 is terminated by an escape sequence.
 In the cases of
 .Ic \&as ,
 .Ic \&ds ,
 and
 .Ic \&nr ,
 the request has no effect at all.
 In the cases of
 .Ic \&am ,
 .Ic \&de ,
 .Ic \&rr ,
 and
 .Ic \&rm ,
 what was parsed up to this point is used as the arguments to the request,
 and the rest of the input line is discarded including the escape sequence.
 When parsing for a request or a user-defined macro name to be called,
 only the escape sequence is discarded.
 The characters preceding it are used as the request or macro name,
 the characters following it are used as the arguments to the request or macro.
 .It Sy "argument count wrong"
 .Pq mdoc , man , roff
 The indicated request or macro has too few or too many arguments.
 The syntax tree will contain the wrong number of arguments as given.
 Formatting behaviour depends on the specific request or macro in question.
 Note that the same message may also occur as a WARNING, see above.
 .It Sy "NOT IMPLEMENTED: Bd -file"
 .Pq mdoc
 For security reasons, the
 .Ic \&Bd
 macro does not support the
 .Fl file
 argument.
 By requesting the inclusion of a sensitive file, a malicious document
 might otherwise trick a privileged user into inadvertently displaying
 the file on the screen, revealing the file content to bystanders.
 The argument is ignored including the file name following it.
 .It Sy "missing list type, using -item"
 .Pq mdoc
 A
 .Ic \&Bl
 macro fails to specify the list type.
 .It Sy "missing manual name, using \(dq\(dq"
 .Pq mdoc
 The first call to
 .Ic \&Nm
 lacks the required argument.
 .It Sy "uname(3) system call failed, using UNKNOWN"
 .Pq mdoc
 The
 .Ic \&Os
 macro is called without arguments, and the
 .Xr uname 3
 system call failed.
 As a workaround,
 .Nm
 can be compiled with
 .Sm off
 .Fl D Cm OSNAME=\(dq\e\(dq Ar string Cm \e\(dq\(dq .
 .Sm on
 .It Sy "unknown standard specifier"
 .Pq mdoc
 An
 .Ic \&St
 macro has an unknown argument and is discarded.
 .It Sy "skipping request without numeric argument"
 .Pq roff , eqn
 An
 .Ic \&it
 request or an
 .Xr eqn 7
 .Ic \&size
 or
 .Ic \&gsize
 statement has a non-numeric or negative argument or no argument at all.
 The invalid request or statement is ignored.
 .It Sy "skipping all arguments"
 .Pq mdoc , man , eqn , roff
 An
 .Xr mdoc 7
 .Ic \&Bt ,
 .Ic \&Ed ,
 .Ic \&Ef ,
 .Ic \&Ek ,
 .Ic \&El ,
 .Ic \&Re ,
 or
 .Ic \&Ud
 macro, an
 .Ic \&It
 macro in a list that don't support item heads, a
 .Xr man 7
 .Ic \&LP ,
 .Ic \&P ,
 or
 .Ic \&PP
 macro, an
 .Xr eqn 7
 .Ic \&EQ
 or
 .Ic \&EN
 macro, or a
 .Xr roff 7
 .Sq \&..
 block closing request is invoked with at least one argument.
 All arguments are ignored.
 .It Sy "skipping excess arguments"
 .Pq mdoc , roff
 The
 .Ic \&Bf
 macro is invoked with more than one argument, or a request of the
 .Ic \&de
 family is invoked with more than two arguments.
 The excess arguments are ignored.
 .El
 .Ss FATAL errors
 .Bl -ohang
 .It Sy "input too large"
 .Pq mdoc , man
 Currently,
 .Nm
 cannot handle input files larger than its arbitrary size limit
 of 2^31 bytes (2 Gigabytes).
 Since useful manuals are always small, this is not a problem in practice.
 Parsing is aborted as soon as the condition is detected.
 .It Sy "NOT IMPLEMENTED: .so with absolute path or \(dq..\(dq"
 .Pq roff
 For security reasons,
 .Nm
 allows
 .Ic \&so
 file inclusion requests only with relative paths
 and only without ascending to any parent directory.
 By requesting the inclusion of a sensitive file, a malicious document
 might otherwise trick a privileged user into inadvertently displaying
 the file on the screen, revealing the file content to bystanders.
 The parser exits immediately.
 .It Sy ".so request failed"
 .Pq roff
 Servicing a
 .Ic \&so
 request requires reading an external file.
 While trying to do so, an
 .Xr open 2 ,
 .Xr stat 2 ,
 or
 .Xr read 2
 system call failed.
 The parser exits immediately.
 Before showing this message,
 .Nm
 always shows another message explaining why the system call failed.
 .El
 .Sh COMPATIBILITY
 This section summarises
 .Nm
 compatibility with GNU troff.
 Each input and output format is separately noted.
 .Ss ASCII Compatibility
 .Bl -bullet -compact
 .It
 Unrenderable unicode codepoints specified with
 .Sq \e[uNNNN]
 escapes are printed as
 .Sq \&?
 in mandoc.
 In GNU troff, these raise an error.
 .It
 The
 .Sq \&Bd \-literal
 and
 .Sq \&Bd \-unfilled
 macros of
 .Xr mdoc 7
 in
 .Fl T Ns Cm ascii
 are synonyms, as are \-filled and \-ragged.
 .It
 In historic GNU troff, the
 .Sq \&Pa
 .Xr mdoc 7
 macro does not underline when scoped under an
 .Sq \&It
 in the FILES section.
 This behaves correctly in
 .Nm .
 .It
 A list or display following the
 .Sq \&Ss
 .Xr mdoc 7
 macro in
 .Fl T Ns Cm ascii
 does not assert a prior vertical break, just as it doesn't with
 .Sq \&Sh .
 .It
 The
 .Sq \&na
 .Xr man 7
 macro in
 .Fl T Ns Cm ascii
 has no effect.
 .It
 Words aren't hyphenated.
 .El
 .Ss HTML Compatibility
 .Bl -bullet -compact
 .It
 The
 .Sq \efP
 escape will revert the font to the previous
 .Sq \ef
 escape, not to the last rendered decoration, which is now dictated by
 CSS instead of hard-coded.
 It also will not span past the current scope,
 for the same reason.
 Note that in
 .Sx ASCII Output
 mode, this will work fine.
 .It
 The
 .Xr mdoc 7
 .Sq \&Bl \-hang
 and
 .Sq \&Bl \-tag
 list types render similarly (no break following overreached left-hand
 side) due to the expressive constraints of HTML.
 .It
 The
 .Xr man 7
 .Sq IP
 and
 .Sq TP
 lists render similarly.
 .El
 .Sh SEE ALSO
 .Xr eqn 7 ,
 .Xr man 7 ,
 .Xr mandoc_char 7 ,
 .Xr mdoc 7 ,
 .Xr roff 7 ,
 .Xr tbl 7
 .Sh AUTHORS
 The
 .Nm
 utility was written by
 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv .
 .Sh CAVEATS
 In
 .Fl T Ns Cm html
 and
 .Fl T Ns Cm xhtml ,
 the maximum size of an element attribute is determined by
 .Dv BUFSIZ ,
 which is usually 1024 bytes.
 Be aware of this when setting long link
 formats such as
 .Fl O Ns Cm style Ns = Ns Ar really/long/link .
 .Pp
 Nesting elements within next-line element scopes of
 .Fl m Ns Cm an ,
 such as
 .Sq br
 within an empty
 .Sq B ,
 will confuse
 .Fl T Ns Cm html
 and
 .Fl T Ns Cm xhtml
 and cause them to forget the formatting of the prior next-line scope.
 .Pp
 The
 .Sq \(aq
 control character is an alias for the standard macro control character
 and does not emit a line-break as stipulated in GNU troff.
Index: projects/arm_intrng/contrib/mdocml/mandoc.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/mandoc.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/mandoc.h	(revision 276248)
@@ -1,452 +1,450 @@
-/*	$Id: mandoc.h,v 1.171 2014/11/28 18:09:01 schwarze Exp $ */
+/*	$Id: mandoc.h,v 1.176 2014/12/01 08:05:52 schwarze Exp $ */
 /*
  * Copyright (c) 2010, 2011, 2014 Kristaps Dzonsons 
  * Copyright (c) 2010-2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef MANDOC_H
-#define MANDOC_H
 
 #define ASCII_NBRSP	 31  /* non-breaking space */
 #define	ASCII_HYPH	 30  /* breakable hyphen */
 #define	ASCII_BREAK	 29  /* breakable zero-width space */
 
 /*
  * Status level.  This refers to both internal status (i.e., whilst
  * running, when warnings/errors are reported) and an indicator of a
  * threshold of when to halt (when said internal state exceeds the
  * threshold).
  */
 enum	mandoclevel {
 	MANDOCLEVEL_OK = 0,
 	MANDOCLEVEL_RESERVED,
 	MANDOCLEVEL_WARNING, /* warnings: syntax, whitespace, etc. */
 	MANDOCLEVEL_ERROR, /* input has been thrown away */
 	MANDOCLEVEL_FATAL, /* input is borked */
 	MANDOCLEVEL_BADARG, /* bad argument in invocation */
 	MANDOCLEVEL_SYSERR, /* system error */
 	MANDOCLEVEL_MAX
 };
 
 /*
  * All possible things that can go wrong within a parse, be it libroff,
  * libmdoc, or libman.
  */
 enum	mandocerr {
 	MANDOCERR_OK,
 
 	MANDOCERR_WARNING, /* ===== start of warnings ===== */
 
 	/* related to the prologue */
 	MANDOCERR_DT_NOTITLE, /* missing manual title, using UNTITLED: line */
 	MANDOCERR_TH_NOTITLE, /* missing manual title, using "": [macro] */
 	MANDOCERR_TITLE_CASE, /* lower case character in document title */
 	MANDOCERR_MSEC_MISSING, /* missing manual section, using "": macro */
 	MANDOCERR_MSEC_BAD, /* unknown manual section: Dt ... section */
 	MANDOCERR_DATE_MISSING, /* missing date, using today's date */
 	MANDOCERR_DATE_BAD, /* cannot parse date, using it verbatim: date */
 	MANDOCERR_OS_MISSING, /* missing Os macro, using "" */
 	MANDOCERR_PROLOG_REP, /* duplicate prologue macro: macro */
 	MANDOCERR_PROLOG_LATE, /* late prologue macro: macro */
 	MANDOCERR_DT_LATE, /* skipping late title macro: Dt args */
 	MANDOCERR_PROLOG_ORDER, /* prologue macros out of order: macros */
 
 	/* related to document structure */
 	MANDOCERR_SO, /* .so is fragile, better use ln(1): so path */
 	MANDOCERR_DOC_EMPTY, /* no document body */
 	MANDOCERR_SEC_BEFORE, /* content before first section header: macro */
 	MANDOCERR_NAMESEC_FIRST, /* first section is not NAME: Sh title */
 	MANDOCERR_NAMESEC_BAD, /* bad NAME section contents: macro */
 	MANDOCERR_SEC_ORDER, /* sections out of conventional order: Sh title */
 	MANDOCERR_SEC_REP, /* duplicate section title: Sh title */
 	MANDOCERR_SEC_MSEC, /* unexpected section: Sh title for ... only */
 	MANDOCERR_XR_ORDER, /* unusual Xr order: ... after ... */
 	MANDOCERR_XR_PUNCT, /* unusual Xr punctuation: ... after ... */
 	MANDOCERR_AN_MISSING, /* AUTHORS section without An macro */
 
 	/* related to macros and nesting */
 	MANDOCERR_MACRO_OBS, /* obsolete macro: macro */
+	MANDOCERR_MACRO_CALL, /* macro neither callable nor escaped: macro */
 	MANDOCERR_PAR_SKIP, /* skipping paragraph macro: macro ... */
 	MANDOCERR_PAR_MOVE, /* moving paragraph macro out of list: macro */
 	MANDOCERR_NS_SKIP, /* skipping no-space macro */
 	MANDOCERR_BLK_NEST, /* blocks badly nested: macro ... */
 	MANDOCERR_BD_NEST, /* nested displays are not portable: macro ... */
 	MANDOCERR_BL_MOVE, /* moving content out of list: macro */
 	MANDOCERR_VT_CHILD, /* .Vt block has child macro: macro */
 	MANDOCERR_FI_SKIP, /* fill mode already enabled, skipping: fi */
 	MANDOCERR_NF_SKIP, /* fill mode already disabled, skipping: nf */
 	MANDOCERR_BLK_LINE, /* line scope broken: macro breaks macro */
 
 	/* related to missing arguments */
 	MANDOCERR_REQ_EMPTY, /* skipping empty request: request */
 	MANDOCERR_COND_EMPTY, /* conditional request controls empty scope */
 	MANDOCERR_MACRO_EMPTY, /* skipping empty macro: macro */
 	MANDOCERR_ARG_EMPTY, /* empty argument, using 0n: macro arg */
 	MANDOCERR_ARGCWARN, /* argument count wrong */
 	MANDOCERR_BD_NOTYPE, /* missing display type, using -ragged: Bd */
 	MANDOCERR_BL_LATETYPE, /* list type is not the first argument: Bl arg */
 	MANDOCERR_BL_NOWIDTH, /* missing -width in -tag list, using 8n */
 	MANDOCERR_EX_NONAME, /* missing utility name, using "": Ex */
 	MANDOCERR_IT_NOHEAD, /* empty head in list item: Bl -type It */
 	MANDOCERR_IT_NOBODY, /* empty list item: Bl -type It */
 	MANDOCERR_BF_NOFONT, /* missing font type, using \fR: Bf */
 	MANDOCERR_BF_BADFONT, /* unknown font type, using \fR: Bf font */
+	MANDOCERR_PF_SKIP, /* nothing follows prefix: Pf arg */
 	MANDOCERR_ARG_STD, /* missing -std argument, adding it: macro */
 	MANDOCERR_EQN_NOBOX, /* missing eqn box, using "": op */
 
 	/* related to bad arguments */
 	MANDOCERR_ARG_QUOTE, /* unterminated quoted argument */
 	MANDOCERR_ARG_REP, /* duplicate argument: macro arg */
 	MANDOCERR_AN_REP, /* skipping duplicate argument: An -arg */
 	MANDOCERR_BD_REP, /* skipping duplicate display type: Bd -type */
 	MANDOCERR_BL_REP, /* skipping duplicate list type: Bl -type */
 	MANDOCERR_BL_SKIPW, /* skipping -width argument: Bl -type */
 	MANDOCERR_AT_BAD, /* unknown AT&T UNIX version: At version */
 	MANDOCERR_FA_COMMA, /* comma in function argument: arg */
 	MANDOCERR_FN_PAREN, /* parenthesis in function name: arg */
 	MANDOCERR_RS_BAD, /* invalid content in Rs block: macro */
 	MANDOCERR_SM_BAD, /* invalid Boolean argument: macro arg */
 	MANDOCERR_FT_BAD, /* unknown font, skipping request: ft font */
 
 	/* related to plain text */
 	MANDOCERR_FI_BLANK, /* blank line in fill mode, using .sp */
 	MANDOCERR_FI_TAB, /* tab in filled text */
 	MANDOCERR_SPACE_EOL, /* whitespace at end of input line */
 	MANDOCERR_COMMENT_BAD, /* bad comment style */
 	MANDOCERR_ESC_BAD, /* invalid escape sequence: esc */
 	MANDOCERR_STR_UNDEF, /* undefined string, using "": name */
 
 	MANDOCERR_ERROR, /* ===== start of errors ===== */
 
 	/* related to equations */
 	MANDOCERR_EQNNSCOPE, /* unexpected equation scope closure*/
 	MANDOCERR_EQNSCOPE, /* equation scope open on exit */
 	MANDOCERR_EQNBADSCOPE, /* overlapping equation scopes */
 	MANDOCERR_EQNEOF, /* unexpected end of equation */
 
 	/* related to tables */
 	MANDOCERR_TBL, /* bad table syntax */
 	MANDOCERR_TBLOPT, /* bad table option */
 	MANDOCERR_TBLLAYOUT, /* bad table layout */
 	MANDOCERR_TBLNOLAYOUT, /* no table layout cells specified */
 	MANDOCERR_TBLNODATA, /* no table data cells specified */
 	MANDOCERR_TBLIGNDATA, /* ignore data in cell */
 	MANDOCERR_TBLBLOCK, /* data block still open */
 	MANDOCERR_TBLEXTRADAT, /* ignoring extra data cells */
 
 	/* related to document structure and macros */
 	MANDOCERR_ROFFLOOP, /* input stack limit exceeded, infinite loop? */
 	MANDOCERR_BADCHAR, /* skipping bad character: number */
 	MANDOCERR_MACRO, /* skipping unknown macro: macro */
 	MANDOCERR_IT_STRAY, /* skipping item outside list: It ... */
 	MANDOCERR_TA_STRAY, /* skipping column outside column list: Ta */
 	MANDOCERR_BLK_NOTOPEN, /* skipping end of block that is not open */
 	MANDOCERR_BLK_BROKEN, /* inserting missing end of block: macro ... */
 	MANDOCERR_BLK_NOEND, /* appending missing end of block: macro */
 
 	/* related to request and macro arguments */
 	MANDOCERR_NAMESC, /* escaped character not allowed in a name: name */
 	MANDOCERR_ARGCOUNT, /* argument count wrong */
 	MANDOCERR_BD_FILE, /* NOT IMPLEMENTED: Bd -file */
 	MANDOCERR_BL_NOTYPE, /* missing list type, using -item: Bl */
 	MANDOCERR_NM_NONAME, /* missing manual name, using "": Nm */
 	MANDOCERR_OS_UNAME, /* uname(3) system call failed, using UNKNOWN */
 	MANDOCERR_ST_BAD, /* unknown standard specifier: St standard */
 	MANDOCERR_IT_NONUM, /* skipping request without numeric argument */
 	MANDOCERR_ARG_SKIP, /* skipping all arguments: macro args */
 	MANDOCERR_ARG_EXCESS, /* skipping excess arguments: macro ... args */
 	MANDOCERR_DIVZERO, /* divide by zero */
 
 	MANDOCERR_FATAL, /* ===== start of fatal errors ===== */
 
 	MANDOCERR_TOOLARGE, /* input too large */
 	MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */
 	MANDOCERR_SO_FAIL, /* .so request failed */
 
 	/* ===== system errors ===== */
 
 	MANDOCERR_SYSDUP, /* cannot dup file descriptor */
 	MANDOCERR_SYSEXEC, /* cannot exec */
 	MANDOCERR_SYSEXIT, /* gunzip failed with code */
 	MANDOCERR_SYSFORK, /* cannot fork */
 	MANDOCERR_SYSOPEN, /* cannot open file */
 	MANDOCERR_SYSPIPE, /* cannot open pipe */
 	MANDOCERR_SYSREAD, /* cannot read file */
 	MANDOCERR_SYSSIG, /* gunzip died from signal */
 	MANDOCERR_SYSSTAT, /* cannot stat file */
 	MANDOCERR_SYSWAIT, /* wait failed */
 
 	MANDOCERR_MAX
 };
 
 struct	tbl_opts {
 	char		  tab; /* cell-separator */
 	char		  decimal; /* decimal point */
 	int		  linesize;
 	int		  opts;
 #define	TBL_OPT_CENTRE	 (1 << 0)
 #define	TBL_OPT_EXPAND	 (1 << 1)
 #define	TBL_OPT_BOX	 (1 << 2)
 #define	TBL_OPT_DBOX	 (1 << 3)
 #define	TBL_OPT_ALLBOX	 (1 << 4)
 #define	TBL_OPT_NOKEEP	 (1 << 5)
 #define	TBL_OPT_NOSPACE	 (1 << 6)
 	int		  cols; /* number of columns */
 };
 
 /*
  * The head of a table specifies all of its columns.  When formatting a
  * tbl_span, iterate over these and plug in data from the tbl_span when
  * appropriate, using tbl_cell as a guide to placement.
  */
 struct	tbl_head {
 	int		  ident; /* 0 <= unique id < cols */
 	int		  vert; /* width of preceding vertical line */
 	struct tbl_head	 *next;
 	struct tbl_head	 *prev;
 };
 
 enum	tbl_cellt {
 	TBL_CELL_CENTRE, /* c, C */
 	TBL_CELL_RIGHT, /* r, R */
 	TBL_CELL_LEFT, /* l, L */
 	TBL_CELL_NUMBER, /* n, N */
 	TBL_CELL_SPAN, /* s, S */
 	TBL_CELL_LONG, /* a, A */
 	TBL_CELL_DOWN, /* ^ */
 	TBL_CELL_HORIZ, /* _, - */
 	TBL_CELL_DHORIZ, /* = */
 	TBL_CELL_MAX
 };
 
 /*
  * A cell in a layout row.
  */
 struct	tbl_cell {
 	struct tbl_cell	 *next;
 	int		  vert; /* width of preceding vertical line */
 	enum tbl_cellt	  pos;
 	size_t		  spacing;
 	int		  flags;
 #define	TBL_CELL_TALIGN	 (1 << 0) /* t, T */
 #define	TBL_CELL_BALIGN	 (1 << 1) /* d, D */
 #define	TBL_CELL_BOLD	 (1 << 2) /* fB, B, b */
 #define	TBL_CELL_ITALIC	 (1 << 3) /* fI, I, i */
 #define	TBL_CELL_EQUAL	 (1 << 4) /* e, E */
 #define	TBL_CELL_UP	 (1 << 5) /* u, U */
 #define	TBL_CELL_WIGN	 (1 << 6) /* z, Z */
 #define	TBL_CELL_WMAX	 (1 << 7) /* x, X */
 	struct tbl_head	 *head;
 };
 
 /*
  * A layout row.
  */
 struct	tbl_row {
 	struct tbl_row	 *next;
 	struct tbl_cell	 *first;
 	struct tbl_cell	 *last;
 	int		  vert; /* trailing vertical line */
 };
 
 enum	tbl_datt {
 	TBL_DATA_NONE, /* has no data */
 	TBL_DATA_DATA, /* consists of data/string */
 	TBL_DATA_HORIZ, /* horizontal line */
 	TBL_DATA_DHORIZ, /* double-horizontal line */
 	TBL_DATA_NHORIZ, /* squeezed horizontal line */
 	TBL_DATA_NDHORIZ /* squeezed double-horizontal line */
 };
 
 /*
  * A cell within a row of data.  The "string" field contains the actual
  * string value that's in the cell.  The rest is layout.
  */
 struct	tbl_dat {
 	struct tbl_cell	 *layout; /* layout cell */
 	int		  spans; /* how many spans follow */
 	struct tbl_dat	 *next;
 	char		 *string; /* data (NULL if not TBL_DATA_DATA) */
 	enum tbl_datt	  pos;
 };
 
 enum	tbl_spant {
 	TBL_SPAN_DATA, /* span consists of data */
 	TBL_SPAN_HORIZ, /* span is horizontal line */
 	TBL_SPAN_DHORIZ /* span is double horizontal line */
 };
 
 /*
  * A row of data in a table.
  */
 struct	tbl_span {
 	struct tbl_opts	 *opts;
 	struct tbl_head	 *head;
 	struct tbl_row	 *layout; /* layout row */
 	struct tbl_dat	 *first;
 	struct tbl_dat	 *last;
 	int		  line; /* parse line */
 	int		  flags;
 #define	TBL_SPAN_FIRST	 (1 << 0)
 #define	TBL_SPAN_LAST	 (1 << 1)
 	enum tbl_spant	  pos;
 	struct tbl_span	 *next;
 };
 
 enum	eqn_boxt {
 	EQN_ROOT, /* root of parse tree */
 	EQN_TEXT, /* text (number, variable, whatever) */
 	EQN_SUBEXPR, /* nested `eqn' subexpression */
 	EQN_LIST, /* list (braces, etc.) */
 	EQN_LISTONE, /* singleton list */
 	EQN_PILE, /* vertical pile */
 	EQN_MATRIX /* pile of piles */
 };
 
 enum	eqn_fontt {
 	EQNFONT_NONE = 0,
 	EQNFONT_ROMAN,
 	EQNFONT_BOLD,
 	EQNFONT_FAT,
 	EQNFONT_ITALIC,
 	EQNFONT__MAX
 };
 
 enum	eqn_post {
 	EQNPOS_NONE = 0,
 	EQNPOS_SUP,
 	EQNPOS_SUBSUP,
 	EQNPOS_SUB,
 	EQNPOS_TO,
 	EQNPOS_FROM,
 	EQNPOS_FROMTO,
 	EQNPOS_OVER,
 	EQNPOS_SQRT,
 	EQNPOS__MAX
 };
 
 enum	eqn_pilet {
 	EQNPILE_NONE = 0,
 	EQNPILE_PILE,
 	EQNPILE_CPILE,
 	EQNPILE_RPILE,
 	EQNPILE_LPILE,
 	EQNPILE_COL,
 	EQNPILE_CCOL,
 	EQNPILE_RCOL,
 	EQNPILE_LCOL,
 	EQNPILE__MAX
 };
 
  /*
  * A "box" is a parsed mathematical expression as defined by the eqn.7
  * grammar.
  */
 struct	eqn_box {
 	int		  size; /* font size of expression */
 #define	EQN_DEFSIZE	  INT_MIN
 	enum eqn_boxt	  type; /* type of node */
 	struct eqn_box	 *first; /* first child node */
 	struct eqn_box	 *last; /* last child node */
 	struct eqn_box	 *next; /* node sibling */
 	struct eqn_box	 *prev; /* node sibling */
 	struct eqn_box	 *parent; /* node sibling */
 	char		 *text; /* text (or NULL) */
 	char		 *left; /* fence left-hand */
 	char		 *right; /* fence right-hand */
 	char		 *top; /* expression over-symbol */
 	char		 *bottom; /* expression under-symbol */
 	size_t		  args; /* arguments in parent */
 	size_t		  expectargs; /* max arguments in parent */
 	enum eqn_post	  pos; /* position of next box */
 	enum eqn_fontt	  font; /* font of box */
 	enum eqn_pilet	  pile; /* equation piling */
 };
 
 /*
  * An equation consists of a tree of expressions starting at a given
  * line and position.
  */
 struct	eqn {
 	char		 *name; /* identifier (or NULL) */
 	struct eqn_box	 *root; /* root mathematical expression */
 	int		  ln; /* invocation line */
 	int		  pos; /* invocation position */
 };
 
 /*
  * Parse options.
  */
 #define	MPARSE_MDOC	1  /* assume -mdoc */
 #define	MPARSE_MAN	2  /* assume -man */
 #define	MPARSE_SO	4  /* honour .so requests */
 #define	MPARSE_QUICK	8  /* abort the parse early */
 #define	MPARSE_UTF8	16 /* accept UTF-8 input */
 #define	MPARSE_LATIN1	32 /* accept ISO-LATIN-1 input */
 
 enum	mandoc_esc {
 	ESCAPE_ERROR = 0, /* bail! unparsable escape */
 	ESCAPE_IGNORE, /* escape to be ignored */
 	ESCAPE_SPECIAL, /* a regular special character */
 	ESCAPE_FONT, /* a generic font mode */
 	ESCAPE_FONTBOLD, /* bold font mode */
 	ESCAPE_FONTITALIC, /* italic font mode */
 	ESCAPE_FONTBI, /* bold italic font mode */
 	ESCAPE_FONTROMAN, /* roman font mode */
 	ESCAPE_FONTPREV, /* previous font mode */
 	ESCAPE_NUMBERED, /* a numbered glyph */
 	ESCAPE_UNICODE, /* a unicode codepoint */
 	ESCAPE_NOSPACE, /* suppress space if the last on a line */
 	ESCAPE_SKIPCHAR /* skip the next character */
 };
 
 typedef	void	(*mandocmsg)(enum mandocerr, enum mandoclevel,
 			const char *, int, int, const char *);
 
+__BEGIN_DECLS
+
 struct	mparse;
 struct	mchars;
 struct	mdoc;
 struct	man;
 
-__BEGIN_DECLS
-
 enum mandoc_esc	  mandoc_escape(const char **, const char **, int *);
 struct mchars	 *mchars_alloc(void);
 void		  mchars_free(struct mchars *);
 int		  mchars_num2char(const char *, size_t);
 const char	 *mchars_uc2str(int);
 int		  mchars_num2uc(const char *, size_t);
 int		  mchars_spec2cp(const struct mchars *,
 			const char *, size_t);
 const char	 *mchars_spec2str(const struct mchars *,
 			const char *, size_t, size_t *);
 struct mparse	 *mparse_alloc(int, enum mandoclevel, mandocmsg,
 			const struct mchars *, const char *);
 void		  mparse_free(struct mparse *);
 void		  mparse_keep(struct mparse *);
 enum mandoclevel  mparse_open(struct mparse *, int *, const char *);
 enum mandoclevel  mparse_readfd(struct mparse *, int, const char *);
-enum mandoclevel  mparse_readmem(struct mparse *, const void *, size_t,
+enum mandoclevel  mparse_readmem(struct mparse *, void *, size_t,
 			const char *);
 void		  mparse_reset(struct mparse *);
 void		  mparse_result(struct mparse *,
 			struct mdoc **, struct man **, char **);
 const char	 *mparse_getkeep(const struct mparse *);
 const char	 *mparse_strerror(enum mandocerr);
 const char	 *mparse_strlevel(enum mandoclevel);
 enum mandoclevel  mparse_wait(struct mparse *);
 
 __END_DECLS
-
-#endif /*!MANDOC_H*/
Index: projects/arm_intrng/contrib/mdocml/mandoc_aux.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/mandoc_aux.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/mandoc_aux.h	(revision 276248)
@@ -1,33 +1,29 @@
-/*	$Id: mandoc_aux.h,v 1.2 2014/04/23 21:06:41 schwarze Exp $ */
+/*	$Id: mandoc_aux.h,v 1.3 2014/12/01 04:05:32 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2011 Kristaps Dzonsons 
  * Copyright (c) 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef MANDOC_AUX_H
-#define MANDOC_AUX_H
 
 __BEGIN_DECLS
 
 int		  mandoc_asprintf(char **, const char *, ...);
 void		 *mandoc_calloc(size_t, size_t);
 void		 *mandoc_malloc(size_t);
 void		 *mandoc_realloc(void *, size_t);
 void		 *mandoc_reallocarray(void *, size_t, size_t);
 char		 *mandoc_strdup(const char *);
 char		 *mandoc_strndup(const char *, size_t);
 
 __END_DECLS
-
-#endif /*!MANDOC_AUX_H*/
Index: projects/arm_intrng/contrib/mdocml/mandoc_headers.3
===================================================================
--- projects/arm_intrng/contrib/mdocml/mandoc_headers.3	(nonexistent)
+++ projects/arm_intrng/contrib/mdocml/mandoc_headers.3	(revision 276248)
@@ -0,0 +1,511 @@
+.Dd December 1, 2014
+.Dt MANDOC_HEADERS 3
+.Os
+.Sh NAME
+.Nm mandoc_headers
+.Nd ordering of mandoc include files
+.Sh DESCRIPTION
+To support a cleaner coding style, the mandoc header files do not
+contain any include directives and do not guard against multiple
+inclusion.
+The application developer has to make sure that the headers are
+included in a proper order, and that no header is included more
+than once.
+.Pp
+The headers and functions form three major groups:
+.Sx Parser interface ,
+.Sx Parser internals ,
+and
+.Sx Formatter interface .
+.Pp
+Various rules are given below prohibiting the inclusion of certain
+combinations of headers into the same file.
+The intention is to keep the following functional components
+separate from each other:
+.Pp
+.Bl -dash -offset indent -compact
+.It
+.Xr mdoc 7
+parser
+.It
+.Xr man 7
+parser
+.It
+.Xr roff 7
+parser
+.It
+.Xr tbl 7
+parser
+.It
+.Xr eqn 7
+parser
+.It
+terminal formatters
+.It
+HTML formatters
+.It
+search tools
+.El
+.Pp
+Note that mere usage of an opaque type does
+.Em not
+require inclusion of the header where that type is defined.
+.Ss Parser interface
+Each of the following headers can be included without including
+any other mandoc header.
+These headers should be included before any other mandoc headers.
+Afterwards, any other mandoc headers can be included as needed.
+.Bl -tag -width Ds
+.It Qq Pa mandoc_aux.h
+Requires
+.In sys/types.h
+for
+.Vt size_t .
+Provides the utility functions documented in
+.Xr mandoc_malloc 3 .
+.It Qq Pa mandoc.h
+Requires
+.In sys/types.h
+for
+.Vt size_t .
+.Pp
+Provides
+.Vt enum mandoc_esc ,
+.Vt enum mandocerr ,
+.Vt enum mandoclevel ,
+.Vt enum tbl_cellt ,
+.Vt enum tbl_datt ,
+.Vt enum tbl_spant ,
+.Vt enum eqn_boxt ,
+.Vt enum eqn_fontt ,
+.Vt enum eqn_pilet ,
+.Vt enum eqn_post ,
+.Vt struct tbl_opts ,
+.Vt struct tbl_head ,
+.Vt struct tbl_cell ,
+.Vt struct tbl_row ,
+.Vt struct tbl_dat ,
+.Vt struct tbl_span ,
+.Vt struct eqn_box ,
+.Vt struct eqn ,
+the function prototype typedef
+.Fn mandocmsg ,
+the function
+.Xr mandoc_escape 3 ,
+the functions described in
+.Xr mchars_alloc 3 ,
+and the functions
+.Fn mparse_*
+described in
+.Xr mandoc 3 .
+.Pp
+Uses the opaque types
+.Vt struct mparse
+from
+.Pa read.c
+and
+.Vt struct mchars
+from
+.Pa chars.c
+for function prototypes.
+Uses the types
+.Vt struct mdoc
+from
+.Pa libmdoc.h
+and
+.Vt struct man
+from
+.Pa libman.h
+as opaque types for function prototypes.
+.It Qq Pa mdoc.h
+Requires
+.In sys/types.h
+for
+.Vt size_t .
+.Pp
+Provides
+.Vt enum mdoct ,
+.Vt enum mdocargt ,
+.Vt enum mdoc_type ,
+.Vt enum mdoc_sec ,
+.Vt enum mdoc_endbody ,
+.Vt enum mdoc_disp ,
+.Vt enum mdoc_list ,
+.Vt enum mdoc_auth ,
+.Vt enum mdoc_font ,
+.Vt struct mdoc_meta ,
+.Vt struct mdoc_argv ,
+.Vt struct mdoc_arg ,
+.Vt struct mdoc_bd ,
+.Vt struct mdoc_bl ,
+.Vt struct mdoc_an ,
+.Vt struct mdoc_bf ,
+.Vt struct mdoc_rs ,
+.Vt struct mdoc_node ,
+and the functions
+.Fn mdoc_*
+described in
+.Xr mandoc 3 .
+.Pp
+Uses the type
+.Vt struct mdoc
+from
+.Pa libmdoc.h
+as an opaque type for function prototypes.
+Uses pointers to the types
+.Vt struct tbl_span
+and
+.Vt struct eqn
+as opaque struct members.
+.Pp
+When this header is included, the same file should not include
+.Pa libman.h
+or
+.Pa libroff.h .
+.It Qq Pa man.h
+Provides
+.Vt enum mant ,
+.Vt enum man_type ,
+.Vt struct man_meta ,
+.Vt struct man_node ,
+and the functions
+.Fn man_*
+described in
+.Xr mandoc 3 .
+.Pp
+Uses the opaque type
+.Vt struct mparse
+from
+.Pa read.c
+for function prototypes.
+Uses the type
+.Vt struct man
+from
+.Pa libman.h
+as an opaque type for function prototypes.
+Uses pointers to the types
+.Vt struct tbl_span
+and
+.Vt struct eqn
+as opaque struct members.
+.Pp
+When this header is included, the same file should not include
+.Pa libmdoc.h
+or
+.Pa libroff.h .
+.El
+.Ss Parser internals
+The following headers require inclusion of a parser interface header
+before they can be included.  All parser interface headers should
+precede all parser internal headers.  When any parser internal headers
+are included, the same file should not include any formatter headers.
+.Bl -tag -width Ds
+.It Qq Pa libmandoc.h
+Requires
+.In sys/types.h
+for
+.Vt size_t .
+.Pp
+Provides
+.Vt enum rofferr ,
+.Vt struct buf ,
+utility functions needed by multiple parsers,
+and the top-level functions to call the parsers.
+.Pp
+Uses the opaque types
+.Vt struct mparse
+from
+.Pa read.c
+and
+.Vt struct roff
+from
+.Pa roff.c
+for function prototypes.
+Uses the types
+.Vt enum mandocerr ,
+.Vt struct tbl_span ,
+and
+.Vt struct eqn
+from
+.Pa mandoc.h ,
+.Vt struct mdoc
+from
+.Pa libmdoc.h ,
+and
+.Vt struct man
+from
+.Pa libman.h
+as opaque types for function prototypes.
+.It Qq Pa libmdoc.h
+Requires
+.Qq Pa mdoc.h
+for
+.Vt enum mdoct ,
+.Vt enum mdoc_* ,
+and
+.Vt struct mdoc_* .
+.Pp
+Provides
+.Vt enum mdoc_next ,
+.Vt enum margserr ,
+.Vt enum mdelim ,
+.Vt struct mdoc ,
+.Vt struct mdoc_macro ,
+and many functions internal to the
+.Xr mdoc 7
+parser.
+.Pp
+Uses the opaque types
+.Vt struct mparse
+from
+.Pa read.c
+and
+.Vt struct roff
+from
+.Pa roff.c .
+.Pp
+When this header is included, the same file should not include
+.Pa man.h ,
+.Pa libman.h ,
+or
+.Pa libroff.h .
+.It Qq Pa libman.h
+Requires
+.Qq Pa man.h
+for
+.Vt enum mant
+and
+.Vt struct man_node.
+.Pp
+Provides
+.Vt enum man_next ,
+.Vt struct man ,
+.Vt struct man_macro ,
+and many functions internal to the
+.Xr man 7
+parser.
+.Pp
+Uses the opaque types
+.Vt struct mparse
+from
+.Pa read.c
+and
+.Vt struct roff
+from
+.Pa roff.c .
+.Pp
+When this header is included, the same file should not include
+.Pa mdoc.h ,
+.Pa libmdoc.h ,
+or
+.Pa libroff.h .
+.It Qq Pa libroff.h
+Requires
+.In sys/types.h
+for
+.Vt size_t ,
+.Qq Pa mandoc.h
+for
+.Vt struct tbl_*
+and
+.Vt struct eqn ,
+and
+.Qq Pa libmandoc.h
+for
+.Vt enum rofferr .
+.Pp
+Provides
+.Vt enum tbl_part ,
+.Vt struct tbl_node ,
+.Vt struct eqn_def ,
+.Vt struct eqn_node ,
+and many functions internal to the
+.Xr tbl 7
+and
+.Xr eqn 7
+parsers.
+.Pp
+Uses the opaque type
+.Vt struct mparse
+from
+.Pa read.c .
+.Pp
+When this header is included, the same file should not include
+.Pa man.h ,
+.Pa mdoc.h ,
+.Pa libman.h ,
+or
+.Pa libmdoc.h .
+.El
+.Ss Formatter interface
+These headers should be included after any parser interface headers.
+No parser internal headers should be included by the same file.
+.Bl -tag -width Ds
+.It Qq Pa out.h
+Requires
+.In sys/types.h
+for
+.Vt size_t .
+.Pp
+Provides
+.Vt enum roffscale ,
+.Vt struct roffcol ,
+.Vt struct roffsu ,
+.Vt struct rofftbl ,
+.Fn a2roffsu ,
+and
+.Fn tblcalc .
+.Pp
+Uses
+.Vt struct tbl_span
+from
+.Pa mandoc.h
+as an opaque type for function prototypes.
+.Pp
+When this header is included, the same file should not include
+.Pa manpath.h
+or
+.Pa mansearch.h .
+.It Qq Pa term.h
+Requires
+.In sys/types.h
+for
+.Vt size_t
+and
+.Qq Pa out.h
+for
+.Vt struct roffsu
+and
+.Vt struct rofftbl .
+.Pp
+Provides
+.Vt enum termenc ,
+.Vt enum termfont ,
+.Vt enum termtype ,
+.Vt struct termp_tbl ,
+.Vt struct termp ,
+and many terminal formatting functions.
+.Pp
+Uses the opaque types
+.Vt struct mchars
+from
+.Pa chars.c
+and
+.Vt struct termp_ps
+from
+.Pa term_ps.c .
+Uses
+.Vt struct tbl_span
+and
+.Vt struct eqn
+from
+.Pa mandoc.h
+as opaque types for function prototypes.
+.Pp
+When this header is included, the same file should not include
+.Pa html.h ,
+.Pa manpath.h
+or
+.Pa mansearch.h .
+.It Qq Pa html.h
+Requires
+.In sys/types.h
+for
+.Vt size_t ,
+.In stdio.h
+for
+.Dv BUFSIZ ,
+and
+.Qq Pa out.h
+for
+.Vt struct roffsu
+and
+.Vt struct rofftbl .
+.Pp
+Provides
+.Vt enum htmltag ,
+.Vt enum htmlattr ,
+.Vt enum htmlfont ,
+.Vt struct tag ,
+.Vt struct tagq ,
+.Vt struct htmlpair ,
+.Vt struct html ,
+and many HTML formatting functions.
+.Pp
+Uses the opaque type
+.Vt struct mchars
+from
+.Pa chars.c .
+.Pp
+When this header is included, the same file should not include
+.Pa term.h ,
+.Pa manpath.h
+or
+.Pa mansearch.h .
+.It Qq Pa main.h
+Provides the top level steering functions for all formatters.
+.Pp
+Uses the opaque type
+.Vt struct mchars
+from
+.Pa chars.c .
+Uses the types
+.Vt struct mdoc
+from
+.Pa libmdoc.h
+and
+.Vt struct man
+from
+.Pa libman.h
+as opaque types for function prototypes.
+.It Qq Pa manpath.h
+Requires
+.In sys/types.h
+for
+.Vt size_t .
+.Pp
+Provides
+.Vt struct manpaths
+and the functions
+.Fn manpath_manconf ,
+.Fn manpath_parse ,
+and
+.Fn manpath_free .
+.Pp
+When this header is included, the same file should not include
+.Pa out.h ,
+.Pa term.h ,
+or
+.Pa html.h .
+.It Qq Pa mansearch.h
+Requires
+.In sys/types.h
+for
+.Vt size_t
+and
+.In stdint.h
+for
+.Vt uint64_t .
+.Pp
+Provides
+.Vt enum argmode ,
+.Vt struct manpage ,
+.Vt struct mansearch ,
+and the functions
+.Fn mansearch_setup ,
+.Fn mansearch ,
+and
+.Fn mansearch_free .
+.Pp
+Uses
+.Vt struct manpaths
+from
+.Pa manpath.h
+as an opaque type for function prototypes.
+.Pp
+When this header is included, the same file should not include
+.Pa out.h ,
+.Pa term.h ,
+or
+.Pa html.h .
+.El

Property changes on: projects/arm_intrng/contrib/mdocml/mandoc_headers.3
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+FreeBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/mdocml/mandocdb.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/mandocdb.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/mandocdb.c	(revision 276248)
@@ -1,2477 +1,2542 @@
-/*	$Id: mandocdb.c,v 1.171 2014/11/27 01:58:21 schwarze Exp $ */
+/*	$Id: mandocdb.c,v 1.179 2014/12/09 07:29:42 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2012 Kristaps Dzonsons 
  * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #if HAVE_FTS
 #include 
 #else
 #include "compat_fts.h"
 #endif
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #if HAVE_OHASH
 #include 
 #else
 #include "compat_ohash.h"
 #endif
 #include 
 
 #include "mdoc.h"
 #include "man.h"
 #include "mandoc.h"
 #include "mandoc_aux.h"
 #include "manpath.h"
 #include "mansearch.h"
 
 extern int mansearch_keymax;
 extern const char *const mansearch_keynames[];
 
 #define	SQL_EXEC(_v) \
 	if (SQLITE_OK != sqlite3_exec(db, (_v), NULL, NULL, NULL)) \
 		say("", "%s: %s", (_v), sqlite3_errmsg(db))
 #define	SQL_BIND_TEXT(_s, _i, _v) \
 	if (SQLITE_OK != sqlite3_bind_text \
 		((_s), (_i)++, (_v), -1, SQLITE_STATIC)) \
 		say(mlink->file, "%s", sqlite3_errmsg(db))
 #define	SQL_BIND_INT(_s, _i, _v) \
 	if (SQLITE_OK != sqlite3_bind_int \
 		((_s), (_i)++, (_v))) \
 		say(mlink->file, "%s", sqlite3_errmsg(db))
 #define	SQL_BIND_INT64(_s, _i, _v) \
 	if (SQLITE_OK != sqlite3_bind_int64 \
 		((_s), (_i)++, (_v))) \
 		say(mlink->file, "%s", sqlite3_errmsg(db))
 #define SQL_STEP(_s) \
 	if (SQLITE_DONE != sqlite3_step((_s))) \
 		say(mlink->file, "%s", sqlite3_errmsg(db))
 
 enum	op {
 	OP_DEFAULT = 0, /* new dbs from dir list or default config */
 	OP_CONFFILE, /* new databases from custom config file */
 	OP_UPDATE, /* delete/add entries in existing database */
 	OP_DELETE, /* delete entries from existing database */
 	OP_TEST /* change no databases, report potential problems */
 };
 
 struct	str {
-	char		*rendered; /* key in UTF-8 or ASCII form */
 	const struct mpage *mpage; /* if set, the owning parse */
 	uint64_t	 mask; /* bitmask in sequence */
-	char		 key[]; /* may contain escape sequences */
+	char		 key[]; /* rendered text */
 };
 
 struct	inodev {
 	ino_t		 st_ino;
 	dev_t		 st_dev;
 };
 
 struct	mpage {
 	struct inodev	 inodev;  /* used for hashing routine */
 	int64_t		 pageid;  /* pageid in mpages SQL table */
 	char		*sec;     /* section from file content */
 	char		*arch;    /* architecture from file content */
 	char		*title;   /* title from file content */
 	char		*desc;    /* description from file content */
 	struct mlink	*mlinks;  /* singly linked list */
 	int		 form;    /* format from file content */
+	int		 name_head_done;
 };
 
 struct	mlink {
 	char		 file[PATH_MAX]; /* filename rel. to manpath */
 	char		*dsec;    /* section from directory */
 	char		*arch;    /* architecture from directory */
 	char		*name;    /* name from file name (not empty) */
 	char		*fsec;    /* section from file name suffix */
 	struct mlink	*next;    /* singly linked list */
 	struct mpage	*mpage;   /* parent */
 	int		 dform;   /* format from directory */
 	int		 fform;   /* format from file name suffix */
 	int		 gzip;	  /* filename has a .gz suffix */
 };
 
 enum	stmt {
 	STMT_DELETE_PAGE = 0,	/* delete mpage */
 	STMT_INSERT_PAGE,	/* insert mpage */
 	STMT_INSERT_LINK,	/* insert mlink */
 	STMT_INSERT_NAME,	/* insert name */
+	STMT_SELECT_NAME,	/* retrieve existing name flags */
 	STMT_INSERT_KEY,	/* insert parsed key */
 	STMT__MAX
 };
 
-typedef	int (*mdoc_fp)(struct mpage *, const struct mdoc_node *);
+typedef	int (*mdoc_fp)(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
 
 struct	mdoc_handler {
 	mdoc_fp		 fp; /* optional handler */
 	uint64_t	 mask;  /* set unless handler returns 0 */
 };
 
 static	void	 dbclose(int);
-static	void	 dbadd(struct mpage *, struct mchars *);
+static	void	 dbadd(struct mpage *);
 static	void	 dbadd_mlink(const struct mlink *mlink);
 static	void	 dbadd_mlink_name(const struct mlink *mlink);
 static	int	 dbopen(int);
 static	void	 dbprune(void);
 static	void	 filescan(const char *);
 static	void	*hash_alloc(size_t, void *);
 static	void	 hash_free(void *, void *);
 static	void	*hash_calloc(size_t, size_t, void *);
 static	void	 mlink_add(struct mlink *, const struct stat *);
 static	void	 mlink_check(struct mpage *, struct mlink *);
 static	void	 mlink_free(struct mlink *);
 static	void	 mlinks_undupe(struct mpage *);
 static	void	 mpages_free(void);
-static	void	 mpages_merge(struct mchars *, struct mparse *);
+static	void	 mpages_merge(struct mparse *);
 static	void	 names_check(void);
 static	void	 parse_cat(struct mpage *, int);
-static	void	 parse_man(struct mpage *, const struct man_node *);
-static	void	 parse_mdoc(struct mpage *, const struct mdoc_node *);
-static	int	 parse_mdoc_body(struct mpage *, const struct mdoc_node *);
-static	int	 parse_mdoc_head(struct mpage *, const struct mdoc_node *);
-static	int	 parse_mdoc_Fd(struct mpage *, const struct mdoc_node *);
-static	int	 parse_mdoc_Fn(struct mpage *, const struct mdoc_node *);
-static	int	 parse_mdoc_Nd(struct mpage *, const struct mdoc_node *);
-static	int	 parse_mdoc_Nm(struct mpage *, const struct mdoc_node *);
-static	int	 parse_mdoc_Sh(struct mpage *, const struct mdoc_node *);
-static	int	 parse_mdoc_Xr(struct mpage *, const struct mdoc_node *);
+static	void	 parse_man(struct mpage *, const struct man_meta *,
+			const struct man_node *);
+static	void	 parse_mdoc(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	int	 parse_mdoc_body(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	int	 parse_mdoc_head(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	int	 parse_mdoc_Fd(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	void	 parse_mdoc_fname(struct mpage *, const struct mdoc_node *);
+static	int	 parse_mdoc_Fn(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	int	 parse_mdoc_Fo(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	int	 parse_mdoc_Nd(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	int	 parse_mdoc_Nm(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	int	 parse_mdoc_Sh(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
+static	int	 parse_mdoc_Xr(struct mpage *, const struct mdoc_meta *,
+			const struct mdoc_node *);
 static	void	 putkey(const struct mpage *, char *, uint64_t);
-static	void	 putkeys(const struct mpage *,
-			const char *, size_t, uint64_t);
+static	void	 putkeys(const struct mpage *, char *, size_t, uint64_t);
 static	void	 putmdockey(const struct mpage *,
 			const struct mdoc_node *, uint64_t);
-static	void	 render_key(struct mchars *, struct str *);
+static	int	 render_string(char **, size_t *);
 static	void	 say(const char *, const char *, ...);
 static	int	 set_basedir(const char *, int);
 static	int	 treescan(void);
 static	size_t	 utf8(unsigned int, char [7]);
 
 static	char		 tempfilename[32];
 static	char		*progname;
 static	int		 nodb; /* no database changes */
 static	int		 mparse_options; /* abort the parse early */
 static	int		 use_all; /* use all found files */
 static	int		 debug; /* print what we're doing */
 static	int		 warnings; /* warn about crap */
 static	int		 write_utf8; /* write UTF-8 output; else ASCII */
 static	int		 exitcode; /* to be returned by main */
 static	enum op		 op; /* operational mode */
 static	char		 basedir[PATH_MAX]; /* current base directory */
+static	struct mchars	*mchars; /* table of named characters */
 static	struct ohash	 mpages; /* table of distinct manual pages */
 static	struct ohash	 mlinks; /* table of directory entries */
 static	struct ohash	 names; /* table of all names */
 static	struct ohash	 strings; /* table of all strings */
 static	sqlite3		*db = NULL; /* current database */
 static	sqlite3_stmt	*stmts[STMT__MAX]; /* current statements */
 static	uint64_t	 name_mask;
 
 static	const struct mdoc_handler mdocs[MDOC_MAX] = {
 	{ NULL, 0 },  /* Ap */
 	{ NULL, 0 },  /* Dd */
 	{ NULL, 0 },  /* Dt */
 	{ NULL, 0 },  /* Os */
 	{ parse_mdoc_Sh, TYPE_Sh }, /* Sh */
 	{ parse_mdoc_head, TYPE_Ss }, /* Ss */
 	{ NULL, 0 },  /* Pp */
 	{ NULL, 0 },  /* D1 */
 	{ NULL, 0 },  /* Dl */
 	{ NULL, 0 },  /* Bd */
 	{ NULL, 0 },  /* Ed */
 	{ NULL, 0 },  /* Bl */
 	{ NULL, 0 },  /* El */
 	{ NULL, 0 },  /* It */
 	{ NULL, 0 },  /* Ad */
 	{ NULL, TYPE_An },  /* An */
 	{ NULL, TYPE_Ar },  /* Ar */
 	{ NULL, TYPE_Cd },  /* Cd */
 	{ NULL, TYPE_Cm },  /* Cm */
 	{ NULL, TYPE_Dv },  /* Dv */
 	{ NULL, TYPE_Er },  /* Er */
 	{ NULL, TYPE_Ev },  /* Ev */
 	{ NULL, 0 },  /* Ex */
 	{ NULL, TYPE_Fa },  /* Fa */
 	{ parse_mdoc_Fd, 0 },  /* Fd */
 	{ NULL, TYPE_Fl },  /* Fl */
 	{ parse_mdoc_Fn, 0 },  /* Fn */
 	{ NULL, TYPE_Ft },  /* Ft */
 	{ NULL, TYPE_Ic },  /* Ic */
 	{ NULL, TYPE_In },  /* In */
 	{ NULL, TYPE_Li },  /* Li */
 	{ parse_mdoc_Nd, 0 },  /* Nd */
 	{ parse_mdoc_Nm, 0 },  /* Nm */
 	{ NULL, 0 },  /* Op */
 	{ NULL, 0 },  /* Ot */
 	{ NULL, TYPE_Pa },  /* Pa */
 	{ NULL, 0 },  /* Rv */
 	{ NULL, TYPE_St },  /* St */
 	{ NULL, TYPE_Va },  /* Va */
 	{ parse_mdoc_body, TYPE_Va },  /* Vt */
 	{ parse_mdoc_Xr, 0 },  /* Xr */
 	{ NULL, 0 },  /* %A */
 	{ NULL, 0 },  /* %B */
 	{ NULL, 0 },  /* %D */
 	{ NULL, 0 },  /* %I */
 	{ NULL, 0 },  /* %J */
 	{ NULL, 0 },  /* %N */
 	{ NULL, 0 },  /* %O */
 	{ NULL, 0 },  /* %P */
 	{ NULL, 0 },  /* %R */
 	{ NULL, 0 },  /* %T */
 	{ NULL, 0 },  /* %V */
 	{ NULL, 0 },  /* Ac */
 	{ NULL, 0 },  /* Ao */
 	{ NULL, 0 },  /* Aq */
 	{ NULL, TYPE_At },  /* At */
 	{ NULL, 0 },  /* Bc */
 	{ NULL, 0 },  /* Bf */
 	{ NULL, 0 },  /* Bo */
 	{ NULL, 0 },  /* Bq */
 	{ NULL, TYPE_Bsx },  /* Bsx */
 	{ NULL, TYPE_Bx },  /* Bx */
 	{ NULL, 0 },  /* Db */
 	{ NULL, 0 },  /* Dc */
 	{ NULL, 0 },  /* Do */
 	{ NULL, 0 },  /* Dq */
 	{ NULL, 0 },  /* Ec */
 	{ NULL, 0 },  /* Ef */
 	{ NULL, TYPE_Em },  /* Em */
 	{ NULL, 0 },  /* Eo */
 	{ NULL, TYPE_Fx },  /* Fx */
 	{ NULL, TYPE_Ms },  /* Ms */
 	{ NULL, 0 },  /* No */
 	{ NULL, 0 },  /* Ns */
 	{ NULL, TYPE_Nx },  /* Nx */
 	{ NULL, TYPE_Ox },  /* Ox */
 	{ NULL, 0 },  /* Pc */
 	{ NULL, 0 },  /* Pf */
 	{ NULL, 0 },  /* Po */
 	{ NULL, 0 },  /* Pq */
 	{ NULL, 0 },  /* Qc */
 	{ NULL, 0 },  /* Ql */
 	{ NULL, 0 },  /* Qo */
 	{ NULL, 0 },  /* Qq */
 	{ NULL, 0 },  /* Re */
 	{ NULL, 0 },  /* Rs */
 	{ NULL, 0 },  /* Sc */
 	{ NULL, 0 },  /* So */
 	{ NULL, 0 },  /* Sq */
 	{ NULL, 0 },  /* Sm */
 	{ NULL, 0 },  /* Sx */
 	{ NULL, TYPE_Sy },  /* Sy */
 	{ NULL, TYPE_Tn },  /* Tn */
 	{ NULL, 0 },  /* Ux */
 	{ NULL, 0 },  /* Xc */
 	{ NULL, 0 },  /* Xo */
-	{ parse_mdoc_head, 0 },  /* Fo */
+	{ parse_mdoc_Fo, 0 },  /* Fo */
 	{ NULL, 0 },  /* Fc */
 	{ NULL, 0 },  /* Oo */
 	{ NULL, 0 },  /* Oc */
 	{ NULL, 0 },  /* Bk */
 	{ NULL, 0 },  /* Ek */
 	{ NULL, 0 },  /* Bt */
 	{ NULL, 0 },  /* Hf */
 	{ NULL, 0 },  /* Fr */
 	{ NULL, 0 },  /* Ud */
 	{ NULL, TYPE_Lb },  /* Lb */
 	{ NULL, 0 },  /* Lp */
 	{ NULL, TYPE_Lk },  /* Lk */
 	{ NULL, TYPE_Mt },  /* Mt */
 	{ NULL, 0 },  /* Brq */
 	{ NULL, 0 },  /* Bro */
 	{ NULL, 0 },  /* Brc */
 	{ NULL, 0 },  /* %C */
 	{ NULL, 0 },  /* Es */
 	{ NULL, 0 },  /* En */
 	{ NULL, TYPE_Dx },  /* Dx */
 	{ NULL, 0 },  /* %Q */
 	{ NULL, 0 },  /* br */
 	{ NULL, 0 },  /* sp */
 	{ NULL, 0 },  /* %U */
 	{ NULL, 0 },  /* Ta */
 	{ NULL, 0 },  /* ll */
 };
 
 
 int
-main(int argc, char *argv[])
+mandocdb(int argc, char *argv[])
 {
 	int		  ch, i;
 	size_t		  j, sz;
 	const char	 *path_arg;
-	struct mchars	 *mc;
 	struct manpaths	  dirs;
 	struct mparse	 *mp;
 	struct ohash_info mpages_info, mlinks_info;
 
 	memset(stmts, 0, STMT__MAX * sizeof(sqlite3_stmt *));
 	memset(&dirs, 0, sizeof(struct manpaths));
 
 	mpages_info.alloc  = mlinks_info.alloc  = hash_alloc;
 	mpages_info.calloc = mlinks_info.calloc = hash_calloc;
 	mpages_info.free  = mlinks_info.free  = hash_free;
 
 	mpages_info.key_offset = offsetof(struct mpage, inodev);
 	mlinks_info.key_offset = offsetof(struct mlink, file);
 
 	progname = strrchr(argv[0], '/');
 	if (progname == NULL)
 		progname = argv[0];
 	else
 		++progname;
 
 	/*
 	 * We accept a few different invocations.
 	 * The CHECKOP macro makes sure that invocation styles don't
 	 * clobber each other.
 	 */
 #define	CHECKOP(_op, _ch) do \
 	if (OP_DEFAULT != (_op)) { \
 		fprintf(stderr, "%s: -%c: Conflicting option\n", \
 		    progname, (_ch)); \
 		goto usage; \
 	} while (/*CONSTCOND*/0)
 
 	path_arg = NULL;
 	op = OP_DEFAULT;
 
 	while (-1 != (ch = getopt(argc, argv, "aC:Dd:npQT:tu:v")))
 		switch (ch) {
 		case 'a':
 			use_all = 1;
 			break;
 		case 'C':
 			CHECKOP(op, ch);
 			path_arg = optarg;
 			op = OP_CONFFILE;
 			break;
 		case 'D':
 			debug++;
 			break;
 		case 'd':
 			CHECKOP(op, ch);
 			path_arg = optarg;
 			op = OP_UPDATE;
 			break;
 		case 'n':
 			nodb = 1;
 			break;
 		case 'p':
 			warnings = 1;
 			break;
 		case 'Q':
 			mparse_options |= MPARSE_QUICK;
 			break;
 		case 'T':
 			if (strcmp(optarg, "utf8")) {
 				fprintf(stderr, "%s: -T%s: "
 				    "Unsupported output format\n",
 				    progname, optarg);
 				goto usage;
 			}
 			write_utf8 = 1;
 			break;
 		case 't':
 			CHECKOP(op, ch);
 			dup2(STDOUT_FILENO, STDERR_FILENO);
 			op = OP_TEST;
 			nodb = warnings = 1;
 			break;
 		case 'u':
 			CHECKOP(op, ch);
 			path_arg = optarg;
 			op = OP_DELETE;
 			break;
 		case 'v':
 			/* Compatibility with espie@'s makewhatis. */
 			break;
 		default:
 			goto usage;
 		}
 
 	argc -= optind;
 	argv += optind;
 
 	if (OP_CONFFILE == op && argc > 0) {
 		fprintf(stderr, "%s: -C: Too many arguments\n",
 		    progname);
 		goto usage;
 	}
 
 	exitcode = (int)MANDOCLEVEL_OK;
-	mc = mchars_alloc();
+	mchars = mchars_alloc();
 	mp = mparse_alloc(mparse_options, MANDOCLEVEL_FATAL, NULL,
-	    mc, NULL);
+	    mchars, NULL);
 	ohash_init(&mpages, 6, &mpages_info);
 	ohash_init(&mlinks, 6, &mlinks_info);
 
 	if (OP_UPDATE == op || OP_DELETE == op || OP_TEST == op) {
 
 		/*
 		 * Most of these deal with a specific directory.
 		 * Jump into that directory first.
 		 */
 		if (OP_TEST != op && 0 == set_basedir(path_arg, 1))
 			goto out;
 
 		if (dbopen(1)) {
 			/*
 			 * The existing database is usable.  Process
 			 * all files specified on the command-line.
 			 */
 			use_all = 1;
 			for (i = 0; i < argc; i++)
 				filescan(argv[i]);
 			if (OP_TEST != op)
 				dbprune();
 		} else {
 			/*
 			 * Database missing or corrupt.
 			 * Recreate from scratch.
 			 */
 			exitcode = (int)MANDOCLEVEL_OK;
 			op = OP_DEFAULT;
 			if (0 == treescan())
 				goto out;
 			if (0 == dbopen(0))
 				goto out;
 		}
 		if (OP_DELETE != op)
-			mpages_merge(mc, mp);
+			mpages_merge(mp);
 		dbclose(OP_DEFAULT == op ? 0 : 1);
 	} else {
 		/*
 		 * If we have arguments, use them as our manpaths.
 		 * If we don't, grok from manpath(1) or however else
 		 * manpath_parse() wants to do it.
 		 */
 		if (argc > 0) {
 			dirs.paths = mandoc_reallocarray(NULL,
 			    argc, sizeof(char *));
 			dirs.sz = (size_t)argc;
 			for (i = 0; i < argc; i++)
 				dirs.paths[i] = mandoc_strdup(argv[i]);
 		} else
 			manpath_parse(&dirs, path_arg, NULL, NULL);
 
 		if (0 == dirs.sz) {
 			exitcode = (int)MANDOCLEVEL_BADARG;
 			say("", "Empty manpath");
 		}
 
 		/*
 		 * First scan the tree rooted at a base directory, then
 		 * build a new database and finally move it into place.
 		 * Ignore zero-length directories and strip trailing
 		 * slashes.
 		 */
 		for (j = 0; j < dirs.sz; j++) {
 			sz = strlen(dirs.paths[j]);
 			if (sz && '/' == dirs.paths[j][sz - 1])
 				dirs.paths[j][--sz] = '\0';
 			if (0 == sz)
 				continue;
 
 			if (j) {
 				ohash_init(&mpages, 6, &mpages_info);
 				ohash_init(&mlinks, 6, &mlinks_info);
 			}
 
 			if (0 == set_basedir(dirs.paths[j], argc > 0))
 				continue;
 			if (0 == treescan())
 				continue;
 			if (0 == dbopen(0))
 				continue;
 
-			mpages_merge(mc, mp);
+			mpages_merge(mp);
 			if (warnings && !nodb &&
 			    ! (MPARSE_QUICK & mparse_options))
 				names_check();
 			dbclose(0);
 
 			if (j + 1 < dirs.sz) {
 				mpages_free();
 				ohash_delete(&mpages);
 				ohash_delete(&mlinks);
 			}
 		}
 	}
 out:
 	manpath_free(&dirs);
 	mparse_free(mp);
-	mchars_free(mc);
+	mchars_free(mchars);
 	mpages_free();
 	ohash_delete(&mpages);
 	ohash_delete(&mlinks);
 	return(exitcode);
 usage:
 	fprintf(stderr, "usage: %s [-aDnpQ] [-C file] [-Tutf8]\n"
 			"       %s [-aDnpQ] [-Tutf8] dir ...\n"
 			"       %s [-DnpQ] [-Tutf8] -d dir [file ...]\n"
 			"       %s [-Dnp] -u dir [file ...]\n"
 			"       %s [-Q] -t file ...\n",
 		       progname, progname, progname,
 		       progname, progname);
 
 	return((int)MANDOCLEVEL_BADARG);
 }
 
 /*
  * Scan a directory tree rooted at "basedir" for manpages.
  * We use fts(), scanning directory parts along the way for clues to our
  * section and architecture.
  *
  * If use_all has been specified, grok all files.
  * If not, sanitise paths to the following:
  *
  *   [./]man*[/]/.
* or * [./]cat
[/]/.0 * * TODO: accomodate for multi-language directories. */ static int treescan(void) { char buf[PATH_MAX]; FTS *f; FTSENT *ff; struct mlink *mlink; int dform, gzip; char *dsec, *arch, *fsec, *cp; const char *path; const char *argv[2]; argv[0] = "."; argv[1] = (char *)NULL; f = fts_open((char * const *)argv, FTS_PHYSICAL | FTS_NOCHDIR, NULL); if (NULL == f) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "&fts_open"); return(0); } dsec = arch = NULL; dform = FORM_NONE; while (NULL != (ff = fts_read(f))) { path = ff->fts_path + 2; switch (ff->fts_info) { /* * Symbolic links require various sanity checks, * then get handled just like regular files. */ case FTS_SL: if (NULL == realpath(path, buf)) { if (warnings) say(path, "&realpath"); continue; } if (strstr(buf, basedir) != buf) { if (warnings) say("", "%s: outside base directory", buf); continue; } /* Use logical inode to avoid mpages dupe. */ if (-1 == stat(path, ff->fts_statp)) { if (warnings) say(path, "&stat"); continue; } /* FALLTHROUGH */ /* * If we're a regular file, add an mlink by using the * stored directory data and handling the filename. */ case FTS_F: if (0 == strcmp(path, MANDOC_DB)) continue; if ( ! use_all && ff->fts_level < 2) { if (warnings) say(path, "Extraneous file"); continue; } gzip = 0; fsec = NULL; while (NULL == fsec) { fsec = strrchr(ff->fts_name, '.'); if (NULL == fsec || strcmp(fsec+1, "gz")) break; gzip = 1; *fsec = '\0'; fsec = NULL; } if (NULL == fsec) { if ( ! use_all) { if (warnings) say(path, "No filename suffix"); continue; } } else if (0 == strcmp(++fsec, "html")) { if (warnings) say(path, "Skip html"); continue; } else if (0 == strcmp(fsec, "ps")) { if (warnings) say(path, "Skip ps"); continue; } else if (0 == strcmp(fsec, "pdf")) { if (warnings) say(path, "Skip pdf"); continue; } else if ( ! use_all && ((FORM_SRC == dform && strcmp(fsec, dsec)) || (FORM_CAT == dform && strcmp(fsec, "0")))) { if (warnings) say(path, "Wrong filename suffix"); continue; } else fsec[-1] = '\0'; mlink = mandoc_calloc(1, sizeof(struct mlink)); if (strlcpy(mlink->file, path, sizeof(mlink->file)) >= sizeof(mlink->file)) { say(path, "Filename too long"); free(mlink); continue; } mlink->dform = dform; mlink->dsec = dsec; mlink->arch = arch; mlink->name = ff->fts_name; mlink->fsec = fsec; mlink->gzip = gzip; mlink_add(mlink, ff->fts_statp); continue; case FTS_D: /* FALLTHROUGH */ case FTS_DP: break; default: if (warnings) say(path, "Not a regular file"); continue; } switch (ff->fts_level) { case 0: /* Ignore the root directory. */ break; case 1: /* * This might contain manX/ or catX/. * Try to infer this from the name. * If we're not in use_all, enforce it. */ cp = ff->fts_name; if (FTS_DP == ff->fts_info) break; if (0 == strncmp(cp, "man", 3)) { dform = FORM_SRC; dsec = cp + 3; } else if (0 == strncmp(cp, "cat", 3)) { dform = FORM_CAT; dsec = cp + 3; } else { dform = FORM_NONE; dsec = NULL; } if (NULL != dsec || use_all) break; if (warnings) say(path, "Unknown directory part"); fts_set(f, ff, FTS_SKIP); break; case 2: /* * Possibly our architecture. * If we're descending, keep tabs on it. */ if (FTS_DP != ff->fts_info && NULL != dsec) arch = ff->fts_name; else arch = NULL; break; default: if (FTS_DP == ff->fts_info || use_all) break; if (warnings) say(path, "Extraneous directory part"); fts_set(f, ff, FTS_SKIP); break; } } fts_close(f); return(1); } /* * Add a file to the mlinks table. * Do not verify that it's a "valid" looking manpage (we'll do that * later). * * Try to infer the manual section, architecture, and page name from the * path, assuming it looks like * * [./]man*[/]/.
* or * [./]cat
[/]/.0 * * See treescan() for the fts(3) version of this. */ static void filescan(const char *file) { char buf[PATH_MAX]; struct stat st; struct mlink *mlink; char *p, *start; assert(use_all); if (0 == strncmp(file, "./", 2)) file += 2; /* * We have to do lstat(2) before realpath(3) loses * the information whether this is a symbolic link. * We need to know that because for symbolic links, * we want to use the orginal file name, while for * regular files, we want to use the real path. */ if (-1 == lstat(file, &st)) { exitcode = (int)MANDOCLEVEL_BADARG; say(file, "&lstat"); return; } else if (0 == ((S_IFREG | S_IFLNK) & st.st_mode)) { exitcode = (int)MANDOCLEVEL_BADARG; say(file, "Not a regular file"); return; } /* * We have to resolve the file name to the real path * in any case for the base directory check. */ if (NULL == realpath(file, buf)) { exitcode = (int)MANDOCLEVEL_BADARG; say(file, "&realpath"); return; } if (OP_TEST == op) start = buf; else if (strstr(buf, basedir) == buf) start = buf + strlen(basedir); else { exitcode = (int)MANDOCLEVEL_BADARG; say("", "%s: outside base directory", buf); return; } /* * Now we are sure the file is inside our tree. * If it is a symbolic link, ignore the real path * and use the original name. * This implies passing stuff like "cat1/../man1/foo.1" * on the command line won't work. So don't do that. * Note the stat(2) can still fail if the link target * doesn't exist. */ if (S_IFLNK & st.st_mode) { if (-1 == stat(buf, &st)) { exitcode = (int)MANDOCLEVEL_BADARG; say(file, "&stat"); return; } if (strlcpy(buf, file, sizeof(buf)) >= sizeof(buf)) { say(file, "Filename too long"); return; } start = buf; if (OP_TEST != op && strstr(buf, basedir) == buf) start += strlen(basedir); } mlink = mandoc_calloc(1, sizeof(struct mlink)); mlink->dform = FORM_NONE; if (strlcpy(mlink->file, start, sizeof(mlink->file)) >= sizeof(mlink->file)) { say(start, "Filename too long"); return; } /* * First try to guess our directory structure. * If we find a separator, try to look for man* or cat*. * If we find one of these and what's underneath is a directory, * assume it's an architecture. */ if (NULL != (p = strchr(start, '/'))) { *p++ = '\0'; if (0 == strncmp(start, "man", 3)) { mlink->dform = FORM_SRC; mlink->dsec = start + 3; } else if (0 == strncmp(start, "cat", 3)) { mlink->dform = FORM_CAT; mlink->dsec = start + 3; } start = p; if (NULL != mlink->dsec && NULL != (p = strchr(start, '/'))) { *p++ = '\0'; mlink->arch = start; start = p; } } /* * Now check the file suffix. * Suffix of `.0' indicates a catpage, `.1-9' is a manpage. */ p = strrchr(start, '\0'); while (p-- > start && '/' != *p && '.' != *p) /* Loop. */ ; if ('.' == *p) { *p++ = '\0'; mlink->fsec = p; } /* * Now try to parse the name. * Use the filename portion of the path. */ mlink->name = start; if (NULL != (p = strrchr(start, '/'))) { mlink->name = p + 1; *p = '\0'; } mlink_add(mlink, &st); } static void mlink_add(struct mlink *mlink, const struct stat *st) { struct inodev inodev; struct mpage *mpage; unsigned int slot; assert(NULL != mlink->file); mlink->dsec = mandoc_strdup(mlink->dsec ? mlink->dsec : ""); mlink->arch = mandoc_strdup(mlink->arch ? mlink->arch : ""); mlink->name = mandoc_strdup(mlink->name ? mlink->name : ""); mlink->fsec = mandoc_strdup(mlink->fsec ? mlink->fsec : ""); if ('0' == *mlink->fsec) { free(mlink->fsec); mlink->fsec = mandoc_strdup(mlink->dsec); mlink->fform = FORM_CAT; } else if ('1' <= *mlink->fsec && '9' >= *mlink->fsec) mlink->fform = FORM_SRC; else mlink->fform = FORM_NONE; slot = ohash_qlookup(&mlinks, mlink->file); assert(NULL == ohash_find(&mlinks, slot)); ohash_insert(&mlinks, slot, mlink); inodev.st_ino = st->st_ino; inodev.st_dev = st->st_dev; slot = ohash_lookup_memory(&mpages, (char *)&inodev, sizeof(struct inodev), inodev.st_ino); mpage = ohash_find(&mpages, slot); if (NULL == mpage) { mpage = mandoc_calloc(1, sizeof(struct mpage)); mpage->inodev.st_ino = inodev.st_ino; mpage->inodev.st_dev = inodev.st_dev; ohash_insert(&mpages, slot, mpage); } else mlink->next = mpage->mlinks; mpage->mlinks = mlink; mlink->mpage = mpage; } static void mlink_free(struct mlink *mlink) { free(mlink->dsec); free(mlink->arch); free(mlink->name); free(mlink->fsec); free(mlink); } static void mpages_free(void) { struct mpage *mpage; struct mlink *mlink; unsigned int slot; mpage = ohash_first(&mpages, &slot); while (NULL != mpage) { while (NULL != (mlink = mpage->mlinks)) { mpage->mlinks = mlink->next; mlink_free(mlink); } free(mpage->sec); free(mpage->arch); free(mpage->title); free(mpage->desc); free(mpage); mpage = ohash_next(&mpages, &slot); } } /* * For each mlink to the mpage, check whether the path looks like * it is formatted, and if it does, check whether a source manual * exists by the same name, ignoring the suffix. * If both conditions hold, drop the mlink. */ static void mlinks_undupe(struct mpage *mpage) { char buf[PATH_MAX]; struct mlink **prev; struct mlink *mlink; char *bufp; mpage->form = FORM_CAT; prev = &mpage->mlinks; while (NULL != (mlink = *prev)) { if (FORM_CAT != mlink->dform) { mpage->form = FORM_NONE; goto nextlink; } (void)strlcpy(buf, mlink->file, sizeof(buf)); bufp = strstr(buf, "cat"); assert(NULL != bufp); memcpy(bufp, "man", 3); if (NULL != (bufp = strrchr(buf, '.'))) *++bufp = '\0'; (void)strlcat(buf, mlink->dsec, sizeof(buf)); if (NULL == ohash_find(&mlinks, ohash_qlookup(&mlinks, buf))) goto nextlink; if (warnings) say(mlink->file, "Man source exists: %s", buf); if (use_all) goto nextlink; *prev = mlink->next; mlink_free(mlink); continue; nextlink: prev = &(*prev)->next; } } static void mlink_check(struct mpage *mpage, struct mlink *mlink) { struct str *str; unsigned int slot; /* * Check whether the manual section given in a file * agrees with the directory where the file is located. * Some manuals have suffixes like (3p) on their * section number either inside the file or in the * directory name, some are linked into more than one * section, like encrypt(1) = makekey(8). */ if (FORM_SRC == mpage->form && strcasecmp(mpage->sec, mlink->dsec)) say(mlink->file, "Section \"%s\" manual in %s directory", mpage->sec, mlink->dsec); /* * Manual page directories exist for each kernel * architecture as returned by machine(1). * However, many manuals only depend on the * application architecture as returned by arch(1). * For example, some (2/ARM) manuals are shared * across the "armish" and "zaurus" kernel * architectures. * A few manuals are even shared across completely * different architectures, for example fdformat(1) * on amd64, i386, sparc, and sparc64. */ if (strcasecmp(mpage->arch, mlink->arch)) say(mlink->file, "Architecture \"%s\" manual in " "\"%s\" directory", mpage->arch, mlink->arch); /* * XXX * parse_cat() doesn't set NAME_TITLE yet. */ if (FORM_CAT == mpage->form) return; /* * Check whether this mlink * appears as a name in the NAME section. */ slot = ohash_qlookup(&names, mlink->name); str = ohash_find(&names, slot); assert(NULL != str); if ( ! (NAME_TITLE & str->mask)) say(mlink->file, "Name missing in NAME section"); } /* * Run through the files in the global vector "mpages" * and add them to the database specified in "basedir". * * This handles the parsing scheme itself, using the cues of directory * and filename to determine whether the file is parsable or not. */ static void -mpages_merge(struct mchars *mc, struct mparse *mp) +mpages_merge(struct mparse *mp) { char any[] = "any"; struct ohash_info str_info; struct mpage *mpage, *mpage_dest; struct mlink *mlink, *mlink_dest; struct mdoc *mdoc; struct man *man; char *sodest; char *cp; int fd; unsigned int pslot; enum mandoclevel lvl; str_info.alloc = hash_alloc; str_info.calloc = hash_calloc; str_info.free = hash_free; str_info.key_offset = offsetof(struct str, key); if ( ! nodb) SQL_EXEC("BEGIN TRANSACTION"); mpage = ohash_first(&mpages, &pslot); while (mpage != NULL) { mlinks_undupe(mpage); if (mpage->mlinks == NULL) { mpage = ohash_next(&mpages, &pslot); continue; } name_mask = NAME_MASK; ohash_init(&names, 4, &str_info); ohash_init(&strings, 6, &str_info); mparse_reset(mp); mdoc = NULL; man = NULL; sodest = NULL; mparse_open(mp, &fd, mpage->mlinks->file); if (fd == -1) { say(mpage->mlinks->file, "&open"); goto nextpage; } /* * Try interpreting the file as mdoc(7) or man(7) * source code, unless it is already known to be * formatted. Fall back to formatted mode. */ if (mpage->mlinks->dform != FORM_CAT || mpage->mlinks->fform != FORM_CAT) { lvl = mparse_readfd(mp, fd, mpage->mlinks->file); if (lvl < MANDOCLEVEL_FATAL) mparse_result(mp, &mdoc, &man, &sodest); } if (sodest != NULL) { mlink_dest = ohash_find(&mlinks, ohash_qlookup(&mlinks, sodest)); if (mlink_dest == NULL) { mandoc_asprintf(&cp, "%s.gz", sodest); mlink_dest = ohash_find(&mlinks, ohash_qlookup(&mlinks, cp)); free(cp); } if (mlink_dest != NULL) { /* The .so target exists. */ mpage_dest = mlink_dest->mpage; mlink = mpage->mlinks; while (1) { mlink->mpage = mpage_dest; /* * If the target was already * processed, add the links * to the database now. * Otherwise, this will * happen when we come * to the target. */ if (mpage_dest->pageid) dbadd_mlink_name(mlink); if (mlink->next == NULL) break; mlink = mlink->next; } /* Move all links to the target. */ mlink->next = mlink_dest->next; mlink_dest->next = mpage->mlinks; mpage->mlinks = NULL; } goto nextpage; } else if (mdoc != NULL) { mpage->form = FORM_SRC; mpage->sec = mdoc_meta(mdoc)->msec; mpage->sec = mandoc_strdup( mpage->sec == NULL ? "" : mpage->sec); mpage->arch = mdoc_meta(mdoc)->arch; mpage->arch = mandoc_strdup( mpage->arch == NULL ? "" : mpage->arch); mpage->title = mandoc_strdup(mdoc_meta(mdoc)->title); } else if (man != NULL) { mpage->form = FORM_SRC; mpage->sec = mandoc_strdup(man_meta(man)->msec); mpage->arch = mandoc_strdup(mpage->mlinks->arch); mpage->title = mandoc_strdup(man_meta(man)->title); } else { mpage->form = FORM_CAT; mpage->sec = mandoc_strdup(mpage->mlinks->dsec); mpage->arch = mandoc_strdup(mpage->mlinks->arch); mpage->title = mandoc_strdup(mpage->mlinks->name); } putkey(mpage, mpage->sec, TYPE_sec); if (*mpage->arch != '\0') putkey(mpage, mpage->arch, TYPE_arch); for (mlink = mpage->mlinks; mlink; mlink = mlink->next) { if ('\0' != *mlink->dsec) putkey(mpage, mlink->dsec, TYPE_sec); if ('\0' != *mlink->fsec) putkey(mpage, mlink->fsec, TYPE_sec); putkey(mpage, '\0' == *mlink->arch ? any : mlink->arch, TYPE_arch); putkey(mpage, mlink->name, NAME_FILE); } - assert(NULL == mpage->desc); - if (NULL != mdoc) { - if (NULL != (cp = mdoc_meta(mdoc)->name)) - putkey(mpage, cp, NAME_HEAD); - parse_mdoc(mpage, mdoc_node(mdoc)); - } else if (NULL != man) - parse_man(mpage, man_node(man)); + assert(mpage->desc == NULL); + if (mdoc != NULL) + parse_mdoc(mpage, mdoc_meta(mdoc), mdoc_node(mdoc)); + else if (man != NULL) + parse_man(mpage, man_meta(man), man_node(man)); else parse_cat(mpage, fd); - if (NULL == mpage->desc) + if (mpage->desc == NULL) mpage->desc = mandoc_strdup(mpage->mlinks->name); if (warnings && !use_all) for (mlink = mpage->mlinks; mlink; mlink = mlink->next) mlink_check(mpage, mlink); - dbadd(mpage, mc); + dbadd(mpage); nextpage: if (mparse_wait(mp) != MANDOCLEVEL_OK) { exitcode = (int)MANDOCLEVEL_SYSERR; say(mpage->mlinks->file, "&wait gunzip"); } ohash_delete(&strings); ohash_delete(&names); mpage = ohash_next(&mpages, &pslot); } if (0 == nodb) SQL_EXEC("END TRANSACTION"); } static void names_check(void) { sqlite3_stmt *stmt; const char *name, *sec, *arch, *key; int irc; sqlite3_prepare_v2(db, "SELECT name, sec, arch, key FROM (" "SELECT name AS key, pageid FROM names " "WHERE bits & ? AND NOT EXISTS (" "SELECT pageid FROM mlinks " "WHERE mlinks.pageid == names.pageid " "AND mlinks.name == names.name" ")" ") JOIN (" "SELECT sec, arch, name, pageid FROM mlinks " "GROUP BY pageid" ") USING (pageid);", -1, &stmt, NULL); if (SQLITE_OK != sqlite3_bind_int64(stmt, 1, NAME_TITLE)) say("", "%s", sqlite3_errmsg(db)); while (SQLITE_ROW == (irc = sqlite3_step(stmt))) { name = (const char *)sqlite3_column_text(stmt, 0); sec = (const char *)sqlite3_column_text(stmt, 1); arch = (const char *)sqlite3_column_text(stmt, 2); key = (const char *)sqlite3_column_text(stmt, 3); say("", "%s(%s%s%s) lacks mlink \"%s\"", name, sec, '\0' == *arch ? "" : "/", '\0' == *arch ? "" : arch, key); } sqlite3_finalize(stmt); } static void parse_cat(struct mpage *mpage, int fd) { FILE *stream; char *line, *p, *title; size_t len, plen, titlesz; stream = (-1 == fd) ? fopen(mpage->mlinks->file, "r") : fdopen(fd, "r"); if (NULL == stream) { if (-1 != fd) close(fd); if (warnings) say(mpage->mlinks->file, "&fopen"); return; } /* Skip to first blank line. */ while (NULL != (line = fgetln(stream, &len))) if ('\n' == *line) break; /* * Assume the first line that is not indented * is the first section header. Skip to it. */ while (NULL != (line = fgetln(stream, &len))) if ('\n' != *line && ' ' != *line) break; /* * Read up until the next section into a buffer. * Strip the leading and trailing newline from each read line, * appending a trailing space. * Ignore empty (whitespace-only) lines. */ titlesz = 0; title = NULL; while (NULL != (line = fgetln(stream, &len))) { if (' ' != *line || '\n' != line[len - 1]) break; while (len > 0 && isspace((unsigned char)*line)) { line++; len--; } if (1 == len) continue; title = mandoc_realloc(title, titlesz + len); memcpy(title + titlesz, line, len); titlesz += len; title[titlesz - 1] = ' '; } /* * If no page content can be found, or the input line * is already the next section header, or there is no * trailing newline, reuse the page title as the page * description. */ if (NULL == title || '\0' == *title) { if (warnings) say(mpage->mlinks->file, "Cannot find NAME section"); fclose(stream); free(title); return; } title = mandoc_realloc(title, titlesz + 1); title[titlesz] = '\0'; /* * Skip to the first dash. * Use the remaining line as the description (no more than 70 * bytes). */ if (NULL != (p = strstr(title, "- "))) { for (p += 2; ' ' == *p || '\b' == *p; p++) /* Skip to next word. */ ; } else { if (warnings) say(mpage->mlinks->file, "No dash in title line"); p = title; } plen = strlen(p); /* Strip backspace-encoding from line. */ while (NULL != (line = memchr(p, '\b', plen))) { len = line - p; if (0 == len) { memmove(line, line + 1, plen--); continue; } memmove(line - 1, line + 1, plen - len); plen -= 2; } mpage->desc = mandoc_strdup(p); fclose(stream); free(title); } /* * Put a type/word pair into the word database for this particular file. */ static void putkey(const struct mpage *mpage, char *value, uint64_t type) { char *cp; assert(NULL != value); if (TYPE_arch == type) for (cp = value; *cp; cp++) if (isupper((unsigned char)*cp)) *cp = _tolower((unsigned char)*cp); putkeys(mpage, value, strlen(value), type); } /* * Grok all nodes at or below a certain mdoc node into putkey(). */ static void putmdockey(const struct mpage *mpage, const struct mdoc_node *n, uint64_t m) { for ( ; NULL != n; n = n->next) { if (NULL != n->child) putmdockey(mpage, n->child, m); if (MDOC_TEXT == n->type) putkey(mpage, n->string, m); } } static void -parse_man(struct mpage *mpage, const struct man_node *n) +parse_man(struct mpage *mpage, const struct man_meta *meta, + const struct man_node *n) { const struct man_node *head, *body; char *start, *title; char byte; size_t sz; if (NULL == n) return; /* * We're only searching for one thing: the first text child in * the BODY of a NAME section. Since we don't keep track of * sections in -man, run some hoops to find out whether we're in * the correct section or not. */ if (MAN_BODY == n->type && MAN_SH == n->tok) { body = n; assert(body->parent); if (NULL != (head = body->parent->head) && 1 == head->nchild && NULL != (head = (head->child)) && MAN_TEXT == head->type && 0 == strcmp(head->string, "NAME") && NULL != body->child) { /* * Suck the entire NAME section into memory. * Yes, we might run away. * But too many manuals have big, spread-out * NAME sections over many lines. */ title = NULL; man_deroff(&title, body); if (NULL == title) return; /* * Go through a special heuristic dance here. * Conventionally, one or more manual names are * comma-specified prior to a whitespace, then a * dash, then a description. Try to puzzle out * the name parts here. */ start = title; for ( ;; ) { sz = strcspn(start, " ,"); if ('\0' == start[sz]) break; byte = start[sz]; start[sz] = '\0'; /* * Assume a stray trailing comma in the * name list if a name begins with a dash. */ if ('-' == start[0] || ('\\' == start[0] && '-' == start[1])) break; putkey(mpage, start, NAME_TITLE); + if ( ! (mpage->name_head_done || + strcasecmp(start, meta->title))) { + putkey(mpage, start, NAME_HEAD); + mpage->name_head_done = 1; + } if (' ' == byte) { start += sz + 1; break; } assert(',' == byte); start += sz + 1; while (' ' == *start) start++; } if (start == title) { putkey(mpage, start, NAME_TITLE); + if ( ! (mpage->name_head_done || + strcasecmp(start, meta->title))) { + putkey(mpage, start, NAME_HEAD); + mpage->name_head_done = 1; + } free(title); return; } while (isspace((unsigned char)*start)) start++; if (0 == strncmp(start, "-", 1)) start += 1; else if (0 == strncmp(start, "\\-\\-", 4)) start += 4; else if (0 == strncmp(start, "\\-", 2)) start += 2; else if (0 == strncmp(start, "\\(en", 4)) start += 4; else if (0 == strncmp(start, "\\(em", 4)) start += 4; while (' ' == *start) start++; mpage->desc = mandoc_strdup(start); free(title); return; } } for (n = n->child; n; n = n->next) { if (NULL != mpage->desc) break; - parse_man(mpage, n); + parse_man(mpage, meta, n); } } static void -parse_mdoc(struct mpage *mpage, const struct mdoc_node *n) +parse_mdoc(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) { assert(NULL != n); for (n = n->child; NULL != n; n = n->next) { switch (n->type) { case MDOC_ELEM: /* FALLTHROUGH */ case MDOC_BLOCK: /* FALLTHROUGH */ case MDOC_HEAD: /* FALLTHROUGH */ case MDOC_BODY: /* FALLTHROUGH */ case MDOC_TAIL: if (NULL != mdocs[n->tok].fp) - if (0 == (*mdocs[n->tok].fp)(mpage, n)) + if (0 == (*mdocs[n->tok].fp)(mpage, meta, n)) break; if (mdocs[n->tok].mask) putmdockey(mpage, n->child, mdocs[n->tok].mask); break; default: assert(MDOC_ROOT != n->type); continue; } if (NULL != n->child) - parse_mdoc(mpage, n); + parse_mdoc(mpage, meta, n); } } static int -parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_node *n) +parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) { - const char *start, *end; + char *start, *end; size_t sz; if (SEC_SYNOPSIS != n->sec || NULL == (n = n->child) || MDOC_TEXT != n->type) return(0); /* * Only consider those `Fd' macro fields that begin with an * "inclusion" token (versus, e.g., #define). */ if (strcmp("#include", n->string)) return(0); if (NULL == (n = n->next) || MDOC_TEXT != n->type) return(0); /* * Strip away the enclosing angle brackets and make sure we're * not zero-length. */ start = n->string; if ('<' == *start || '"' == *start) start++; if (0 == (sz = strlen(start))) return(0); end = &start[(int)sz - 1]; if ('>' == *end || '"' == *end) end--; if (end > start) putkeys(mpage, start, end - start + 1, TYPE_In); return(0); } -static int -parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_node *n) +static void +parse_mdoc_fname(struct mpage *mpage, const struct mdoc_node *n) { char *cp; + size_t sz; - if (NULL == (n = n->child) || MDOC_TEXT != n->type) - return(0); + if (n->type != MDOC_TEXT) + return; - /* - * Parse: .Fn "struct type *name" "char *arg". - * First strip away pointer symbol. - * Then store the function name, then type. - * Finally, store the arguments. - */ + /* Skip function pointer punctuation. */ - if (NULL == (cp = strrchr(n->string, ' '))) - cp = n->string; - - while ('*' == *cp) + cp = n->string; + while (*cp == '(' || *cp == '*') cp++; + sz = strcspn(cp, "()"); - putkey(mpage, cp, TYPE_Fn); + putkeys(mpage, cp, sz, TYPE_Fn); + if (n->sec == SEC_SYNOPSIS) + putkeys(mpage, cp, sz, NAME_SYN); +} - if (n->string < cp) - putkeys(mpage, n->string, cp - n->string, TYPE_Ft); +static int +parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) +{ - for (n = n->next; NULL != n; n = n->next) - if (MDOC_TEXT == n->type) + if (n->child == NULL) + return(0); + + parse_mdoc_fname(mpage, n->child); + + for (n = n->child->next; n != NULL; n = n->next) + if (n->type == MDOC_TEXT) putkey(mpage, n->string, TYPE_Fa); return(0); } static int -parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_node *n) +parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) { + + if (n->type != MDOC_HEAD) + return(1); + + if (n->child != NULL) + parse_mdoc_fname(mpage, n->child); + + return(0); +} + +static int +parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) +{ char *cp; if (NULL == (n = n->child)) return(0); if (NULL == n->next) { putkey(mpage, n->string, TYPE_Xr); return(0); } mandoc_asprintf(&cp, "%s(%s)", n->string, n->next->string); putkey(mpage, cp, TYPE_Xr); free(cp); return(0); } static int -parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_node *n) +parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) { if (MDOC_BODY == n->type) mdoc_deroff(&mpage->desc, n); return(0); } static int -parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_node *n) +parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) { if (SEC_NAME == n->sec) putmdockey(mpage, n->child, NAME_TITLE); - else if (SEC_SYNOPSIS == n->sec && MDOC_HEAD == n->type) - putmdockey(mpage, n->child, NAME_SYN); + else if (SEC_SYNOPSIS == n->sec && MDOC_HEAD == n->type) { + if (n->child == NULL) + putkey(mpage, meta->name, NAME_SYN); + else + putmdockey(mpage, n->child, NAME_SYN); + } + if ( ! (mpage->name_head_done || + n->child == NULL || n->child->string == NULL || + strcasecmp(n->child->string, meta->title))) { + putkey(mpage, n->child->string, NAME_HEAD); + mpage->name_head_done = 1; + } return(0); } static int -parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_node *n) +parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) { return(SEC_CUSTOM == n->sec && MDOC_HEAD == n->type); } static int -parse_mdoc_head(struct mpage *mpage, const struct mdoc_node *n) +parse_mdoc_head(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) { return(MDOC_HEAD == n->type); } static int -parse_mdoc_body(struct mpage *mpage, const struct mdoc_node *n) +parse_mdoc_body(struct mpage *mpage, const struct mdoc_meta *meta, + const struct mdoc_node *n) { return(MDOC_BODY == n->type); } /* * Add a string to the hash table for the current manual. * Each string has a bitmask telling which macros it belongs to. * When we finish the manual, we'll dump the table. */ static void -putkeys(const struct mpage *mpage, - const char *cp, size_t sz, uint64_t v) +putkeys(const struct mpage *mpage, char *cp, size_t sz, uint64_t v) { struct ohash *htab; struct str *s; const char *end; unsigned int slot; - int i; + int i, mustfree; if (0 == sz) return; + mustfree = render_string(&cp, &sz); + if (TYPE_Nm & v) { htab = &names; v &= name_mask; if (v & NAME_FIRST) name_mask &= ~NAME_FIRST; if (debug > 1) say(mpage->mlinks->file, - "Adding name %*s", sz, cp); + "Adding name %*s, bits=%d", sz, cp, v); } else { htab = &strings; if (debug > 1) for (i = 0; i < mansearch_keymax; i++) if ((uint64_t)1 << i & v) say(mpage->mlinks->file, "Adding key %s=%*s", mansearch_keynames[i], sz, cp); } end = cp + sz; slot = ohash_qlookupi(htab, cp, &end); s = ohash_find(htab, slot); if (NULL != s && mpage == s->mpage) { s->mask |= v; return; } else if (NULL == s) { s = mandoc_calloc(1, sizeof(struct str) + sz + 1); memcpy(s->key, cp, sz); ohash_insert(htab, slot, s); } s->mpage = mpage; s->mask = v; + + if (mustfree) + free(cp); } /* * Take a Unicode codepoint and produce its UTF-8 encoding. * This isn't the best way to do this, but it works. * The magic numbers are from the UTF-8 packaging. * They're not as scary as they seem: read the UTF-8 spec for details. */ static size_t utf8(unsigned int cp, char out[7]) { size_t rc; rc = 0; if (cp <= 0x0000007F) { rc = 1; out[0] = (char)cp; } else if (cp <= 0x000007FF) { rc = 2; out[0] = (cp >> 6 & 31) | 192; out[1] = (cp & 63) | 128; } else if (cp <= 0x0000FFFF) { rc = 3; out[0] = (cp >> 12 & 15) | 224; out[1] = (cp >> 6 & 63) | 128; out[2] = (cp & 63) | 128; } else if (cp <= 0x001FFFFF) { rc = 4; out[0] = (cp >> 18 & 7) | 240; out[1] = (cp >> 12 & 63) | 128; out[2] = (cp >> 6 & 63) | 128; out[3] = (cp & 63) | 128; } else if (cp <= 0x03FFFFFF) { rc = 5; out[0] = (cp >> 24 & 3) | 248; out[1] = (cp >> 18 & 63) | 128; out[2] = (cp >> 12 & 63) | 128; out[3] = (cp >> 6 & 63) | 128; out[4] = (cp & 63) | 128; } else if (cp <= 0x7FFFFFFF) { rc = 6; out[0] = (cp >> 30 & 1) | 252; out[1] = (cp >> 24 & 63) | 128; out[2] = (cp >> 18 & 63) | 128; out[3] = (cp >> 12 & 63) | 128; out[4] = (cp >> 6 & 63) | 128; out[5] = (cp & 63) | 128; } else return(0); out[rc] = '\0'; return(rc); } /* - * Store the rendered version of a key, or alias the pointer - * if the key contains no escape sequences. + * If the string contains escape sequences, + * replace it with an allocated rendering and return 1, + * such that the caller can free it after use. + * Otherwise, do nothing and return 0. */ -static void -render_key(struct mchars *mc, struct str *key) +static int +render_string(char **public, size_t *psz) { - size_t sz, bsz, pos; + const char *src, *scp, *addcp, *seq; + char *dst; + size_t ssz, dsz, addsz; char utfbuf[7], res[6]; - char *buf; - const char *seq, *cpp, *val; - int len, u; - enum mandoc_esc esc; + int seqlen, unicode; - assert(NULL == key->rendered); - res[0] = '\\'; res[1] = '\t'; res[2] = ASCII_NBRSP; res[3] = ASCII_HYPH; res[4] = ASCII_BREAK; res[5] = '\0'; - val = key->key; - bsz = strlen(val); + src = scp = *public; + ssz = *psz; + dst = NULL; + dsz = 0; - /* - * Pre-check: if we have no stop-characters, then set the - * pointer as ourselvse and get out of here. - */ - if (strcspn(val, res) == bsz) { - key->rendered = key->key; - return; - } + while (scp < src + *psz) { - /* Pre-allocate by the length of the input */ + /* Leave normal characters unchanged. */ - buf = mandoc_malloc(++bsz); - pos = 0; + if (strchr(res, *scp) == NULL) { + if (dst != NULL) + dst[dsz++] = *scp; + scp++; + continue; + } - while ('\0' != *val) { /* - * Halt on the first escape sequence. - * This also halts on the end of string, in which case - * we just copy, fallthrough, and exit the loop. + * Found something that requires replacing, + * make sure we have a destination buffer. */ - if ((sz = strcspn(val, res)) > 0) { - memcpy(&buf[pos], val, sz); - pos += sz; - val += sz; + + if (dst == NULL) { + dst = mandoc_malloc(ssz + 1); + dsz = scp - src; + memcpy(dst, src, dsz); } - switch (*val) { - case ASCII_HYPH: - buf[pos++] = '-'; - val++; - continue; + /* Handle single-char special characters. */ + + switch (*scp) { + case '\\': + break; case '\t': /* FALLTHROUGH */ case ASCII_NBRSP: - buf[pos++] = ' '; - val++; + dst[dsz++] = ' '; + scp++; + continue; + case ASCII_HYPH: + dst[dsz++] = '-'; /* FALLTHROUGH */ case ASCII_BREAK: + scp++; continue; default: - break; + abort(); } - if ('\\' != *val) - break; - /* Read past the slash. */ - - val++; - /* - * Parse the escape sequence and see if it's a - * predefined character or special character. + * Found an escape sequence. + * Read past the slash, then parse it. + * Ignore everything except characters. */ - esc = mandoc_escape((const char **)&val, - &seq, &len); - if (ESCAPE_ERROR == esc) - break; - if (ESCAPE_SPECIAL != esc) + scp++; + if (mandoc_escape(&scp, &seq, &seqlen) != ESCAPE_SPECIAL) continue; /* * Render the special character * as either UTF-8 or ASCII. */ if (write_utf8) { - if ((u = mchars_spec2cp(mc, seq, len)) <= 0) + unicode = mchars_spec2cp(mchars, seq, seqlen); + if (unicode <= 0) continue; - cpp = utfbuf; - if (0 == (sz = utf8(u, utfbuf))) + addsz = utf8(unicode, utfbuf); + if (addsz == 0) continue; - sz = strlen(cpp); + addcp = utfbuf; } else { - cpp = mchars_spec2str(mc, seq, len, &sz); - if (NULL == cpp) + addcp = mchars_spec2str(mchars, seq, seqlen, &addsz); + if (addcp == NULL) continue; - if (ASCII_NBRSP == *cpp) { - cpp = " "; - sz = 1; + if (*addcp == ASCII_NBRSP) { + addcp = " "; + addsz = 1; } } /* Copy the rendered glyph into the stream. */ - bsz += sz; - buf = mandoc_realloc(buf, bsz); - memcpy(&buf[pos], cpp, sz); - pos += sz; + ssz += addsz; + dst = mandoc_realloc(dst, ssz + 1); + memcpy(dst + dsz, addcp, addsz); + dsz += addsz; } + if (dst != NULL) { + *public = dst; + *psz = dsz; + } - buf[pos] = '\0'; - key->rendered = buf; + /* Trim trailing whitespace and NUL-terminate. */ + + while (*psz > 0 && (*public)[*psz - 1] == ' ') + --*psz; + if (dst != NULL) { + (*public)[*psz] = '\0'; + return(1); + } else + return(0); } static void dbadd_mlink(const struct mlink *mlink) { size_t i; i = 1; SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->dsec); SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->arch); SQL_BIND_TEXT(stmts[STMT_INSERT_LINK], i, mlink->name); SQL_BIND_INT64(stmts[STMT_INSERT_LINK], i, mlink->mpage->pageid); SQL_STEP(stmts[STMT_INSERT_LINK]); sqlite3_reset(stmts[STMT_INSERT_LINK]); } static void dbadd_mlink_name(const struct mlink *mlink) { + uint64_t bits; size_t i; dbadd_mlink(mlink); i = 1; - SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, NAME_FILE & NAME_MASK); + SQL_BIND_INT64(stmts[STMT_SELECT_NAME], i, mlink->mpage->pageid); + bits = NAME_FILE & NAME_MASK; + if (sqlite3_step(stmts[STMT_SELECT_NAME]) == SQLITE_ROW) { + bits |= sqlite3_column_int64(stmts[STMT_SELECT_NAME], 0); + sqlite3_reset(stmts[STMT_SELECT_NAME]); + } + + i = 1; + SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, bits); SQL_BIND_TEXT(stmts[STMT_INSERT_NAME], i, mlink->name); SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, mlink->mpage->pageid); SQL_STEP(stmts[STMT_INSERT_NAME]); sqlite3_reset(stmts[STMT_INSERT_NAME]); } /* * Flush the current page's terms (and their bits) into the database. * Wrap the entire set of additions in a transaction to make sqlite be a * little faster. * Also, handle escape sequences at the last possible moment. */ static void -dbadd(struct mpage *mpage, struct mchars *mc) +dbadd(struct mpage *mpage) { struct mlink *mlink; struct str *key; + char *cp; size_t i; unsigned int slot; + int mustfree; mlink = mpage->mlinks; if (nodb) { for (key = ohash_first(&names, &slot); NULL != key; - key = ohash_next(&names, &slot)) { - if (key->rendered != key->key) - free(key->rendered); + key = ohash_next(&names, &slot)) free(key); - } for (key = ohash_first(&strings, &slot); NULL != key; - key = ohash_next(&strings, &slot)) { - if (key->rendered != key->key) - free(key->rendered); + key = ohash_next(&strings, &slot)) free(key); - } if (0 == debug) return; while (NULL != mlink) { fputs(mlink->name, stdout); if (NULL == mlink->next || strcmp(mlink->dsec, mlink->next->dsec) || strcmp(mlink->fsec, mlink->next->fsec) || strcmp(mlink->arch, mlink->next->arch)) { putchar('('); if ('\0' == *mlink->dsec) fputs(mlink->fsec, stdout); else fputs(mlink->dsec, stdout); if ('\0' != *mlink->arch) printf("/%s", mlink->arch); putchar(')'); } mlink = mlink->next; if (NULL != mlink) fputs(", ", stdout); } printf(" - %s\n", mpage->desc); return; } if (debug) say(mlink->file, "Adding to database"); - i = strlen(mpage->desc) + 1; - key = mandoc_calloc(1, sizeof(struct str) + i); - memcpy(key->key, mpage->desc, i); - render_key(mc, key); - + cp = mpage->desc; + i = strlen(cp); + mustfree = render_string(&cp, &i); i = 1; - SQL_BIND_TEXT(stmts[STMT_INSERT_PAGE], i, key->rendered); + SQL_BIND_TEXT(stmts[STMT_INSERT_PAGE], i, cp); SQL_BIND_INT(stmts[STMT_INSERT_PAGE], i, mpage->form); SQL_STEP(stmts[STMT_INSERT_PAGE]); mpage->pageid = sqlite3_last_insert_rowid(db); sqlite3_reset(stmts[STMT_INSERT_PAGE]); + if (mustfree) + free(cp); - if (key->rendered != key->key) - free(key->rendered); - free(key); - while (NULL != mlink) { dbadd_mlink(mlink); mlink = mlink->next; } mlink = mpage->mlinks; for (key = ohash_first(&names, &slot); NULL != key; key = ohash_next(&names, &slot)) { assert(key->mpage == mpage); - if (NULL == key->rendered) - render_key(mc, key); i = 1; SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, key->mask); - SQL_BIND_TEXT(stmts[STMT_INSERT_NAME], i, key->rendered); + SQL_BIND_TEXT(stmts[STMT_INSERT_NAME], i, key->key); SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, mpage->pageid); SQL_STEP(stmts[STMT_INSERT_NAME]); sqlite3_reset(stmts[STMT_INSERT_NAME]); - if (key->rendered != key->key) - free(key->rendered); free(key); } for (key = ohash_first(&strings, &slot); NULL != key; key = ohash_next(&strings, &slot)) { assert(key->mpage == mpage); - if (NULL == key->rendered) - render_key(mc, key); i = 1; SQL_BIND_INT64(stmts[STMT_INSERT_KEY], i, key->mask); - SQL_BIND_TEXT(stmts[STMT_INSERT_KEY], i, key->rendered); + SQL_BIND_TEXT(stmts[STMT_INSERT_KEY], i, key->key); SQL_BIND_INT64(stmts[STMT_INSERT_KEY], i, mpage->pageid); SQL_STEP(stmts[STMT_INSERT_KEY]); sqlite3_reset(stmts[STMT_INSERT_KEY]); - if (key->rendered != key->key) - free(key->rendered); free(key); } } static void dbprune(void) { struct mpage *mpage; struct mlink *mlink; size_t i; unsigned int slot; if (0 == nodb) SQL_EXEC("BEGIN TRANSACTION"); for (mpage = ohash_first(&mpages, &slot); NULL != mpage; mpage = ohash_next(&mpages, &slot)) { mlink = mpage->mlinks; if (debug) say(mlink->file, "Deleting from database"); if (nodb) continue; for ( ; NULL != mlink; mlink = mlink->next) { i = 1; SQL_BIND_TEXT(stmts[STMT_DELETE_PAGE], i, mlink->dsec); SQL_BIND_TEXT(stmts[STMT_DELETE_PAGE], i, mlink->arch); SQL_BIND_TEXT(stmts[STMT_DELETE_PAGE], i, mlink->name); SQL_STEP(stmts[STMT_DELETE_PAGE]); sqlite3_reset(stmts[STMT_DELETE_PAGE]); } } if (0 == nodb) SQL_EXEC("END TRANSACTION"); } /* * Close an existing database and its prepared statements. * If "real" is not set, rename the temporary file into the real one. */ static void dbclose(int real) { size_t i; int status; pid_t child; if (nodb) return; for (i = 0; i < STMT__MAX; i++) { sqlite3_finalize(stmts[i]); stmts[i] = NULL; } sqlite3_close(db); db = NULL; if (real) return; if ('\0' == *tempfilename) { if (-1 == rename(MANDOC_DB "~", MANDOC_DB)) { exitcode = (int)MANDOCLEVEL_SYSERR; say(MANDOC_DB, "&rename"); } return; } switch (child = fork()) { case -1: exitcode = (int)MANDOCLEVEL_SYSERR; say("", "&fork cmp"); return; case 0: execlp("cmp", "cmp", "-s", tempfilename, MANDOC_DB, NULL); say("", "&exec cmp"); exit(0); default: break; } if (-1 == waitpid(child, &status, 0)) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "&wait cmp"); } else if (WIFSIGNALED(status)) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "cmp died from signal %d", WTERMSIG(status)); } else if (WEXITSTATUS(status)) { exitcode = (int)MANDOCLEVEL_SYSERR; say(MANDOC_DB, "Data changed, but cannot replace database"); } *strrchr(tempfilename, '/') = '\0'; switch (child = fork()) { case -1: exitcode = (int)MANDOCLEVEL_SYSERR; say("", "&fork rm"); return; case 0: execlp("rm", "rm", "-rf", tempfilename, NULL); say("", "&exec rm"); exit((int)MANDOCLEVEL_SYSERR); default: break; } if (-1 == waitpid(child, &status, 0)) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "&wait rm"); } else if (WIFSIGNALED(status) || WEXITSTATUS(status)) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "%s: Cannot remove temporary directory", tempfilename); } } /* * This is straightforward stuff. * Open a database connection to a "temporary" database, then open a set * of prepared statements we'll use over and over again. * If "real" is set, we use the existing database; if not, we truncate a * temporary one. * Must be matched by dbclose(). */ static int dbopen(int real) { const char *sql; int rc, ofl; if (nodb) return(1); *tempfilename = '\0'; ofl = SQLITE_OPEN_READWRITE; if (real) { rc = sqlite3_open_v2(MANDOC_DB, &db, ofl, NULL); if (SQLITE_OK != rc) { exitcode = (int)MANDOCLEVEL_SYSERR; if (SQLITE_CANTOPEN != rc) say(MANDOC_DB, "%s", sqlite3_errstr(rc)); return(0); } goto prepare_statements; } ofl |= SQLITE_OPEN_CREATE | SQLITE_OPEN_EXCLUSIVE; remove(MANDOC_DB "~"); rc = sqlite3_open_v2(MANDOC_DB "~", &db, ofl, NULL); if (SQLITE_OK == rc) goto create_tables; if (MPARSE_QUICK & mparse_options) { exitcode = (int)MANDOCLEVEL_SYSERR; say(MANDOC_DB "~", "%s", sqlite3_errstr(rc)); return(0); } (void)strlcpy(tempfilename, "/tmp/mandocdb.XXXXXX", sizeof(tempfilename)); if (NULL == mkdtemp(tempfilename)) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "&%s", tempfilename); return(0); } (void)strlcat(tempfilename, "/" MANDOC_DB, sizeof(tempfilename)); rc = sqlite3_open_v2(tempfilename, &db, ofl, NULL); if (SQLITE_OK != rc) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "%s: %s", tempfilename, sqlite3_errstr(rc)); return(0); } create_tables: sql = "CREATE TABLE \"mpages\" (\n" " \"desc\" TEXT NOT NULL,\n" " \"form\" INTEGER NOT NULL,\n" " \"pageid\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL\n" ");\n" "\n" "CREATE TABLE \"mlinks\" (\n" " \"sec\" TEXT NOT NULL,\n" " \"arch\" TEXT NOT NULL,\n" " \"name\" TEXT NOT NULL,\n" " \"pageid\" INTEGER NOT NULL REFERENCES mpages(pageid) " "ON DELETE CASCADE\n" ");\n" "CREATE INDEX mlinks_pageid_idx ON mlinks (pageid);\n" "\n" "CREATE TABLE \"names\" (\n" " \"bits\" INTEGER NOT NULL,\n" " \"name\" TEXT NOT NULL,\n" " \"pageid\" INTEGER NOT NULL REFERENCES mpages(pageid) " - "ON DELETE CASCADE\n" + "ON DELETE CASCADE,\n" + " UNIQUE (\"name\", \"pageid\") ON CONFLICT REPLACE\n" ");\n" "\n" "CREATE TABLE \"keys\" (\n" " \"bits\" INTEGER NOT NULL,\n" " \"key\" TEXT NOT NULL,\n" " \"pageid\" INTEGER NOT NULL REFERENCES mpages(pageid) " "ON DELETE CASCADE\n" ");\n" "CREATE INDEX keys_pageid_idx ON keys (pageid);\n"; if (SQLITE_OK != sqlite3_exec(db, sql, NULL, NULL, NULL)) { exitcode = (int)MANDOCLEVEL_SYSERR; say(MANDOC_DB, "%s", sqlite3_errmsg(db)); sqlite3_close(db); return(0); } prepare_statements: if (SQLITE_OK != sqlite3_exec(db, "PRAGMA foreign_keys = ON", NULL, NULL, NULL)) { exitcode = (int)MANDOCLEVEL_SYSERR; say(MANDOC_DB, "PRAGMA foreign_keys: %s", sqlite3_errmsg(db)); sqlite3_close(db); return(0); } sql = "DELETE FROM mpages WHERE pageid IN " "(SELECT pageid FROM mlinks WHERE " "sec=? AND arch=? AND name=?)"; sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_DELETE_PAGE], NULL); sql = "INSERT INTO mpages " "(desc,form) VALUES (?,?)"; sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_PAGE], NULL); sql = "INSERT INTO mlinks " "(sec,arch,name,pageid) VALUES (?,?,?,?)"; sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_LINK], NULL); + sql = "SELECT bits FROM names where pageid = ?"; + sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_SELECT_NAME], NULL); sql = "INSERT INTO names " "(bits,name,pageid) VALUES (?,?,?)"; sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_NAME], NULL); sql = "INSERT INTO keys " "(bits,key,pageid) VALUES (?,?,?)"; sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_KEY], NULL); #ifndef __APPLE__ /* * When opening a new database, we can turn off * synchronous mode for much better performance. */ if (real && SQLITE_OK != sqlite3_exec(db, "PRAGMA synchronous = OFF", NULL, NULL, NULL)) { exitcode = (int)MANDOCLEVEL_SYSERR; say(MANDOC_DB, "PRAGMA synchronous: %s", sqlite3_errmsg(db)); sqlite3_close(db); return(0); } #endif return(1); } static void * hash_calloc(size_t n, size_t sz, void *arg) { return(mandoc_calloc(n, sz)); } static void * hash_alloc(size_t sz, void *arg) { return(mandoc_malloc(sz)); } static void hash_free(void *p, void *arg) { free(p); } static int set_basedir(const char *targetdir, int report_baddir) { static char startdir[PATH_MAX]; static int getcwd_status; /* 1 = ok, 2 = failure */ static int chdir_status; /* 1 = changed directory */ char *cp; /* * Remember the original working directory, if possible. * This will be needed if the second or a later directory * on the command line is given as a relative path. * Do not error out if the current directory is not * searchable: Maybe it won't be needed after all. */ if (0 == getcwd_status) { if (NULL == getcwd(startdir, sizeof(startdir))) { getcwd_status = 2; (void)strlcpy(startdir, strerror(errno), sizeof(startdir)); } else getcwd_status = 1; } /* * We are leaving the old base directory. * Do not use it any longer, not even for messages. */ *basedir = '\0'; /* * If and only if the directory was changed earlier and * the next directory to process is given as a relative path, * first go back, or bail out if that is impossible. */ if (chdir_status && '/' != *targetdir) { if (2 == getcwd_status) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "getcwd: %s", startdir); return(0); } if (-1 == chdir(startdir)) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "&chdir %s", startdir); return(0); } } /* * Always resolve basedir to the canonicalized absolute * pathname and append a trailing slash, such that * we can reliably check whether files are inside. */ if (NULL == realpath(targetdir, basedir)) { if (report_baddir || errno != ENOENT) { exitcode = (int)MANDOCLEVEL_BADARG; say("", "&%s: realpath", targetdir); } return(0); } else if (-1 == chdir(basedir)) { if (report_baddir || errno != ENOENT) { exitcode = (int)MANDOCLEVEL_BADARG; say("", "&chdir"); } return(0); } chdir_status = 1; cp = strchr(basedir, '\0'); if ('/' != cp[-1]) { if (cp - basedir >= PATH_MAX - 1) { exitcode = (int)MANDOCLEVEL_SYSERR; say("", "Filename too long"); return(0); } *cp++ = '/'; *cp = '\0'; } return(1); } static void say(const char *file, const char *format, ...) { va_list ap; int use_errno; if ('\0' != *basedir) fprintf(stderr, "%s", basedir); if ('\0' != *basedir && '\0' != *file) fputc('/', stderr); if ('\0' != *file) fprintf(stderr, "%s", file); use_errno = 1; if (NULL != format) { switch (*format) { case '&': format++; break; case '\0': format = NULL; break; default: use_errno = 0; break; } } if (NULL != format) { if ('\0' != *basedir || '\0' != *file) fputs(": ", stderr); va_start(ap, format); vfprintf(stderr, format, ap); va_end(ap); } if (use_errno) { if ('\0' != *basedir || '\0' != *file || NULL != format) fputs(": ", stderr); perror(NULL); } else fputc('\n', stderr); } Index: projects/arm_intrng/contrib/mdocml/manpath.h =================================================================== --- projects/arm_intrng/contrib/mdocml/manpath.h (revision 276247) +++ projects/arm_intrng/contrib/mdocml/manpath.h (revision 276248) @@ -1,38 +1,34 @@ -/* $Id: manpath.h,v 1.6 2012/06/08 10:32:40 kristaps Exp $ */ +/* $Id: manpath.h,v 1.7 2014/12/01 04:05:32 schwarze Exp $ */ /* * Copyright (c) 2011 Ingo Schwarze * Copyright (c) 2011 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef MANPATH_H -#define MANPATH_H /* * Unsorted list of unique, absolute paths to be searched for manual * databases. */ struct manpaths { size_t sz; char **paths; }; __BEGIN_DECLS void manpath_manconf(struct manpaths *, const char *); void manpath_parse(struct manpaths *, const char *, char *, char *); void manpath_free(struct manpaths *); __END_DECLS - -#endif /*!MANPATH_H*/ Index: projects/arm_intrng/contrib/mdocml/mansearch.3 =================================================================== --- projects/arm_intrng/contrib/mdocml/mansearch.3 (revision 276247) +++ projects/arm_intrng/contrib/mdocml/mansearch.3 (revision 276248) @@ -1,228 +1,228 @@ -.\" $Id: mansearch.3,v 1.2 2014/08/05 15:29:30 schwarze Exp $ +.\" $Id: mansearch.3,v 1.3 2014/12/12 21:44:33 schwarze Exp $ .\" .\" Copyright (c) 2014 Ingo Schwarze .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 5 2014 $ +.Dd $Mdocdate: December 12 2014 $ .Dt MANSEARCH 3 .Os .Sh NAME .Nm mansearch , .Nm mansearch_setup .Nd search manual page databases .Sh SYNOPSIS .In stdint.h .In manpath.h .In mansearch.h .Ft int .Fo mansearch_setup .Fa "int start" .Fc .Ft int .Fo mansearch .Fa "const struct mansearch *search" .Fa "const struct manpaths *paths" .Fa "int argc" .Fa "char *argv[]" .Fa "const char *outkey" .Fa "struct manpage **res" .Fa "size_t *sz" .Fc .Sh DESCRIPTION The .Fn mansearch function returns information about manuals matching a search query from a .Xr mandoc.db 5 SQLite3 database. .Pp The query arguments are as follows: .Bl -tag -width Ds .It Fa "const struct mansearch *search" Search options, defined in .In mansearch.h . .It Fa "const struct manpaths *paths" Directories to be searched, defined in .In manpath.h . .It Fa "int argc" , "char *argv[]" Search criteria, usually taken from the command line. .El .Pp The .Fa "const char *outkey" selects which data to return in the .Va output field of the .Fa res structures. It takes any of the macro keys defined in .Pa mansearch_const.c and described in .Xr apropos 1 . .Pp The output arguments are as follows: .Bl -tag -width Ds .It Fa "struct manpage **res" Returns a pointer to an array of result structures defined in .In mansearch.h . The user is expected to call .Xr free 3 on the .Va file , .Va names , and .Va output fields of all structures, as well as the .Fa res array itself. .It Fa "size_t *sz" Returns the number of result structures contained in .Fa res . .El .Pp To speed up searches, the .Fn mansearch_setup function can optionally be called with a .Fa start argument of 1 before .Fn mansearch to set up an SQLite3 pagecache. If it was called, it has to be called again with a .Fa start argument of 0 after the last call to .Fn mansearch to release the memory used for the pagecache. .Sh IMPLEMENTATION NOTES For each manual page tree, the search is done in two steps. In the first step, a list of pages matching the search criteria is built. In the second step, the requested information about these pages is retrieved from the database and assembled into the .Fa res array. .Pp All function mentioned here are defined in the file .Pa mansearch.c . No functions except .Fn mansearch and .Fn sql_statement build any SQL code, and no functions except .Fn mansearch , .Fn buildnames , and .Fn buildoutput execute it. .Ss Finding matches The query is built using the following grammar: .Bd -literal -offset indent ::= "SELECT * FROM mpages WHERE" ::= "(" ")" | "OR" | "AND" | "desc" "?" | "id IN (SELECT pageid FROM" ")" ::= "names WHERE name" "?" | "keys WHERE key" "? AND bits & ?" ::= "MATCH" | "REGEXP" .Ed .Pp The MATCH and REGEXP operators are implemented by the functions .Fn sql_match and .Fn sql_regexp , respectively. This is required because SQLite3 natively neither supports case-insensitive substring matching nor regular expression matching, but only string identity, shell globbing, and the weird home-brewed LIKE operator. .Pp Command line parsing is done by the function .Fn exprcomp building a singly linked list of .Vt expr structures, using the helper functions .Fn exprterm and .Fn exprspec . The resulting SQL statement is assembled by the function .Fn sql_statement and evaluated in the main loop of the .Fn mansearch function. .Ss Assembling the results The names, sections, and architectures of the manuals found are assembled into the .Va names field of the result structure by the function .Fn buildnames , using the following query: .Pp .Dl "SELECT * FROM mlinks WHERE pageid=? ORDER BY sec, arch, name" .Pp If the .Fa outkey differs from -.Qq Nd , +.Qq Ic \&Nd , the requested output data is assembled into the .Va output field of the result structure by the function .Fn buildoutput , using the following query: .Pp .Dl "SELECT * FROM keys WHERE pageid=? AND bits & ?" .Sh FILES .Bl -tag -width mandoc.db -compact .It Pa mandoc.db The manual page database. .El .Sh EXAMPLES The simplest invocation .Pp .Dl apropos keyword .Pp results in the following SQL query: .Bd -literal SELECT * FROM mpages WHERE ( id IN (SELECT pageid FROM names WHERE name MATCH 'keyword') OR desc MATCH 'keyword' ); .Ed .Pp A more complicated request like .Pp .Dl apropos -s 2 Nm,Xr=getuid .Pp results in: .Bd -literal SELECT * FROM mpages WHERE ( id IN (SELECT pageid FROM names WHERE name MATCH 'getuid') OR id IN (SELECT pageid FROM keys WHERE key MATCH 'getuid' AND bits & 4) ) AND id IN (SELECT pageid FROM keys WHERE key REGEXP '^2$' AND bits & 2); .Ed .Sh SEE ALSO .Xr apropos 1 , .Xr mandoc.db 5 , .Xr makewhatis 8 .Sh HISTORY The .Fn mansearch subsystem first appeared in .Ox 5.6 . .Sh AUTHORS .An -nosplit A module to search manual page databases was first written by .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv in 2011, at first using the Berkeley DB; he rewrote it for SQLite3 in 2012. The current version received major changes from .An Ingo Schwarze Aq Mt schwarze@openbsd.org . Index: projects/arm_intrng/contrib/mdocml/mansearch.c =================================================================== --- projects/arm_intrng/contrib/mdocml/mansearch.c (revision 276247) +++ projects/arm_intrng/contrib/mdocml/mansearch.c (revision 276248) @@ -1,877 +1,879 @@ -/* $Id: mansearch.c,v 1.51 2014/11/27 01:58:21 schwarze Exp $ */ +/* $Id: mansearch.c,v 1.52 2014/12/06 01:23:24 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "config.h" #include #include #include +#include #include #include #include #include #include #include #include #include #include #include #if HAVE_OHASH #include #else #include "compat_ohash.h" #endif #include #ifndef SQLITE_DETERMINISTIC #define SQLITE_DETERMINISTIC 0 #endif #include "mandoc.h" #include "mandoc_aux.h" #include "manpath.h" #include "mansearch.h" extern int mansearch_keymax; extern const char *const mansearch_keynames[]; #define SQL_BIND_TEXT(_db, _s, _i, _v) \ do { if (SQLITE_OK != sqlite3_bind_text \ ((_s), (_i)++, (_v), -1, SQLITE_STATIC)) \ fprintf(stderr, "%s\n", sqlite3_errmsg((_db))); \ } while (0) #define SQL_BIND_INT64(_db, _s, _i, _v) \ do { if (SQLITE_OK != sqlite3_bind_int64 \ ((_s), (_i)++, (_v))) \ fprintf(stderr, "%s\n", sqlite3_errmsg((_db))); \ } while (0) #define SQL_BIND_BLOB(_db, _s, _i, _v) \ do { if (SQLITE_OK != sqlite3_bind_blob \ ((_s), (_i)++, (&_v), sizeof(_v), SQLITE_STATIC)) \ fprintf(stderr, "%s\n", sqlite3_errmsg((_db))); \ } while (0) struct expr { regex_t regexp; /* compiled regexp, if applicable */ const char *substr; /* to search for, if applicable */ struct expr *next; /* next in sequence */ uint64_t bits; /* type-mask */ int equal; /* equality, not subsring match */ int open; /* opening parentheses before */ int and; /* logical AND before */ int close; /* closing parentheses after */ }; struct match { uint64_t pageid; /* identifier in database */ uint64_t bits; /* name type mask */ char *desc; /* manual page description */ int form; /* bit field: formatted, zipped? */ }; static void buildnames(struct manpage *, sqlite3 *, sqlite3_stmt *, uint64_t, const char *, int form); static char *buildoutput(sqlite3 *, sqlite3_stmt *, uint64_t, uint64_t); static void *hash_alloc(size_t, void *); static void hash_free(void *, void *); static void *hash_calloc(size_t, size_t, void *); static struct expr *exprcomp(const struct mansearch *, int, char *[]); static void exprfree(struct expr *); static struct expr *exprspec(struct expr *, uint64_t, const char *, const char *); static struct expr *exprterm(const struct mansearch *, char *, int); static int manpage_compare(const void *, const void *); static void sql_append(char **sql, size_t *sz, const char *newstr, int count); static void sql_match(sqlite3_context *context, int argc, sqlite3_value **argv); static void sql_regexp(sqlite3_context *context, int argc, sqlite3_value **argv); static char *sql_statement(const struct expr *); int mansearch_setup(int start) { static void *pagecache; int c; #define PC_PAGESIZE 1280 #define PC_NUMPAGES 256 if (start) { if (NULL != pagecache) { fprintf(stderr, "pagecache already enabled\n"); return((int)MANDOCLEVEL_BADARG); } pagecache = mmap(NULL, PC_PAGESIZE * PC_NUMPAGES, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0); if (MAP_FAILED == pagecache) { perror("mmap"); pagecache = NULL; return((int)MANDOCLEVEL_SYSERR); } c = sqlite3_config(SQLITE_CONFIG_PAGECACHE, pagecache, PC_PAGESIZE, PC_NUMPAGES); if (SQLITE_OK == c) return((int)MANDOCLEVEL_OK); fprintf(stderr, "pagecache: %s\n", sqlite3_errstr(c)); } else if (NULL == pagecache) { fprintf(stderr, "pagecache missing\n"); return((int)MANDOCLEVEL_BADARG); } if (-1 == munmap(pagecache, PC_PAGESIZE * PC_NUMPAGES)) { perror("munmap"); pagecache = NULL; return((int)MANDOCLEVEL_SYSERR); } pagecache = NULL; return((int)MANDOCLEVEL_OK); } int mansearch(const struct mansearch *search, const struct manpaths *paths, int argc, char *argv[], struct manpage **res, size_t *sz) { int fd, rc, c, indexbit; int64_t pageid; uint64_t outbit, iterbit; char buf[PATH_MAX]; char *sql; struct manpage *mpage; struct expr *e, *ep; sqlite3 *db; sqlite3_stmt *s, *s2; struct match *mp; struct ohash_info info; struct ohash htab; unsigned int idx; size_t i, j, cur, maxres; info.calloc = hash_calloc; info.alloc = hash_alloc; info.free = hash_free; info.key_offset = offsetof(struct match, pageid); *sz = cur = maxres = 0; sql = NULL; *res = NULL; fd = -1; e = NULL; rc = 0; if (0 == argc) goto out; if (NULL == (e = exprcomp(search, argc, argv))) goto out; outbit = 0; if (NULL != search->outkey) { for (indexbit = 0, iterbit = 1; indexbit < mansearch_keymax; indexbit++, iterbit <<= 1) { if (0 == strcasecmp(search->outkey, mansearch_keynames[indexbit])) { outbit = iterbit; break; } } } /* * Save a descriptor to the current working directory. * Since pathnames in the "paths" variable might be relative, * and we'll be chdir()ing into them, we need to keep a handle * on our current directory from which to start the chdir(). */ if (NULL == getcwd(buf, PATH_MAX)) { perror("getcwd"); goto out; } else if (-1 == (fd = open(buf, O_RDONLY, 0))) { perror(buf); goto out; } sql = sql_statement(e); /* * Loop over the directories (containing databases) for us to * search. * Don't let missing/bad databases/directories phase us. * In each, try to open the resident database and, if it opens, * scan it for our match expression. */ for (i = 0; i < paths->sz; i++) { if (-1 == fchdir(fd)) { perror(buf); free(*res); break; } else if (-1 == chdir(paths->paths[i])) { perror(paths->paths[i]); continue; } c = sqlite3_open_v2(MANDOC_DB, &db, SQLITE_OPEN_READONLY, NULL); if (SQLITE_OK != c) { - perror(MANDOC_DB); + fprintf(stderr, "%s/%s: %s\n", + paths->paths[i], MANDOC_DB, strerror(errno)); sqlite3_close(db); continue; } /* * Define the SQL functions for substring * and regular expression matching. */ c = sqlite3_create_function(db, "match", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, NULL, sql_match, NULL, NULL); assert(SQLITE_OK == c); c = sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8 | SQLITE_DETERMINISTIC, NULL, sql_regexp, NULL, NULL); assert(SQLITE_OK == c); j = 1; c = sqlite3_prepare_v2(db, sql, -1, &s, NULL); if (SQLITE_OK != c) fprintf(stderr, "%s\n", sqlite3_errmsg(db)); for (ep = e; NULL != ep; ep = ep->next) { if (NULL == ep->substr) { SQL_BIND_BLOB(db, s, j, ep->regexp); } else SQL_BIND_TEXT(db, s, j, ep->substr); if (0 == ((TYPE_Nd | TYPE_Nm) & ep->bits)) SQL_BIND_INT64(db, s, j, ep->bits); } memset(&htab, 0, sizeof(struct ohash)); ohash_init(&htab, 4, &info); /* * Hash each entry on its [unique] document identifier. * This is a uint64_t. * Instead of using a hash function, simply convert the * uint64_t to a uint32_t, the hash value's type. * This gives good performance and preserves the * distribution of buckets in the table. */ while (SQLITE_ROW == (c = sqlite3_step(s))) { pageid = sqlite3_column_int64(s, 2); idx = ohash_lookup_memory(&htab, (char *)&pageid, sizeof(uint64_t), (uint32_t)pageid); if (NULL != ohash_find(&htab, idx)) continue; mp = mandoc_calloc(1, sizeof(struct match)); mp->pageid = pageid; mp->form = sqlite3_column_int(s, 1); mp->bits = sqlite3_column_int64(s, 3); if (TYPE_Nd == outbit) mp->desc = mandoc_strdup((const char *) sqlite3_column_text(s, 0)); ohash_insert(&htab, idx, mp); } if (SQLITE_DONE != c) fprintf(stderr, "%s\n", sqlite3_errmsg(db)); sqlite3_finalize(s); c = sqlite3_prepare_v2(db, "SELECT sec, arch, name, pageid FROM mlinks " "WHERE pageid=? ORDER BY sec, arch, name", -1, &s, NULL); if (SQLITE_OK != c) fprintf(stderr, "%s\n", sqlite3_errmsg(db)); c = sqlite3_prepare_v2(db, "SELECT bits, key, pageid FROM keys " "WHERE pageid=? AND bits & ?", -1, &s2, NULL); if (SQLITE_OK != c) fprintf(stderr, "%s\n", sqlite3_errmsg(db)); for (mp = ohash_first(&htab, &idx); NULL != mp; mp = ohash_next(&htab, &idx)) { if (cur + 1 > maxres) { maxres += 1024; *res = mandoc_reallocarray(*res, maxres, sizeof(struct manpage)); } mpage = *res + cur; mpage->ipath = i; mpage->bits = mp->bits; mpage->sec = 10; mpage->form = mp->form; buildnames(mpage, db, s, mp->pageid, paths->paths[i], mp->form); mpage->output = TYPE_Nd & outbit ? mp->desc : outbit ? buildoutput(db, s2, mp->pageid, outbit) : NULL; free(mp); cur++; } sqlite3_finalize(s); sqlite3_finalize(s2); sqlite3_close(db); ohash_delete(&htab); /* * In man(1) mode, prefer matches in earlier trees * over matches in later trees. */ if (cur && search->firstmatch) break; } qsort(*res, cur, sizeof(struct manpage), manpage_compare); rc = 1; out: if (-1 != fd) { if (-1 == fchdir(fd)) perror(buf); close(fd); } exprfree(e); free(sql); *sz = cur; return(rc); } void mansearch_free(struct manpage *res, size_t sz) { size_t i; for (i = 0; i < sz; i++) { free(res[i].file); free(res[i].names); free(res[i].output); } free(res); } static int manpage_compare(const void *vp1, const void *vp2) { const struct manpage *mp1, *mp2; int diff; mp1 = vp1; mp2 = vp2; return( (diff = mp2->bits - mp1->bits) ? diff : (diff = mp1->sec - mp2->sec) ? diff : strcasecmp(mp1->names, mp2->names)); } static void buildnames(struct manpage *mpage, sqlite3 *db, sqlite3_stmt *s, uint64_t pageid, const char *path, int form) { char *newnames, *prevsec, *prevarch; const char *oldnames, *sep1, *name, *sec, *sep2, *arch, *fsec; size_t i; int c; mpage->file = NULL; mpage->names = NULL; prevsec = prevarch = NULL; i = 1; SQL_BIND_INT64(db, s, i, pageid); while (SQLITE_ROW == (c = sqlite3_step(s))) { /* Decide whether we already have some names. */ if (NULL == mpage->names) { oldnames = ""; sep1 = ""; } else { oldnames = mpage->names; sep1 = ", "; } /* Fetch the next name. */ sec = (const char *)sqlite3_column_text(s, 0); arch = (const char *)sqlite3_column_text(s, 1); name = (const char *)sqlite3_column_text(s, 2); /* Remember the first section found. */ if (9 < mpage->sec && '1' <= *sec && '9' >= *sec) mpage->sec = (*sec - '1') + 1; /* If the section changed, append the old one. */ if (NULL != prevsec && (strcmp(sec, prevsec) || strcmp(arch, prevarch))) { sep2 = '\0' == *prevarch ? "" : "/"; mandoc_asprintf(&newnames, "%s(%s%s%s)", oldnames, prevsec, sep2, prevarch); free(mpage->names); oldnames = mpage->names = newnames; free(prevsec); free(prevarch); prevsec = prevarch = NULL; } /* Save the new section, to append it later. */ if (NULL == prevsec) { prevsec = mandoc_strdup(sec); prevarch = mandoc_strdup(arch); } /* Append the new name. */ mandoc_asprintf(&newnames, "%s%s%s", oldnames, sep1, name); free(mpage->names); mpage->names = newnames; /* Also save the first file name encountered. */ if (mpage->file != NULL) continue; if (form & FORM_SRC) { sep1 = "man"; fsec = sec; } else { sep1 = "cat"; fsec = "0"; } sep2 = *arch == '\0' ? "" : "/"; mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s", path, sep1, sec, sep2, arch, name, fsec); } if (c != SQLITE_DONE) fprintf(stderr, "%s\n", sqlite3_errmsg(db)); sqlite3_reset(s); /* Append one final section to the names. */ if (prevsec != NULL) { sep2 = *prevarch == '\0' ? "" : "/"; mandoc_asprintf(&newnames, "%s(%s%s%s)", mpage->names, prevsec, sep2, prevarch); free(mpage->names); mpage->names = newnames; free(prevsec); free(prevarch); } } static char * buildoutput(sqlite3 *db, sqlite3_stmt *s, uint64_t pageid, uint64_t outbit) { char *output, *newoutput; const char *oldoutput, *sep1, *data; size_t i; int c; output = NULL; i = 1; SQL_BIND_INT64(db, s, i, pageid); SQL_BIND_INT64(db, s, i, outbit); while (SQLITE_ROW == (c = sqlite3_step(s))) { if (NULL == output) { oldoutput = ""; sep1 = ""; } else { oldoutput = output; sep1 = " # "; } data = (const char *)sqlite3_column_text(s, 1); mandoc_asprintf(&newoutput, "%s%s%s", oldoutput, sep1, data); free(output); output = newoutput; } if (SQLITE_DONE != c) fprintf(stderr, "%s\n", sqlite3_errmsg(db)); sqlite3_reset(s); return(output); } /* * Implement substring match as an application-defined SQL function. * Using the SQL LIKE or GLOB operators instead would be a bad idea * because that would require escaping metacharacters in the string * being searched for. */ static void sql_match(sqlite3_context *context, int argc, sqlite3_value **argv) { assert(2 == argc); sqlite3_result_int(context, NULL != strcasestr( (const char *)sqlite3_value_text(argv[1]), (const char *)sqlite3_value_text(argv[0]))); } /* * Implement regular expression match * as an application-defined SQL function. */ static void sql_regexp(sqlite3_context *context, int argc, sqlite3_value **argv) { assert(2 == argc); sqlite3_result_int(context, !regexec( (regex_t *)sqlite3_value_blob(argv[0]), (const char *)sqlite3_value_text(argv[1]), 0, NULL, 0)); } static void sql_append(char **sql, size_t *sz, const char *newstr, int count) { size_t newsz; newsz = 1 < count ? (size_t)count : strlen(newstr); *sql = mandoc_realloc(*sql, *sz + newsz + 1); if (1 < count) memset(*sql + *sz, *newstr, (size_t)count); else memcpy(*sql + *sz, newstr, newsz); *sz += newsz; (*sql)[*sz] = '\0'; } /* * Prepare the search SQL statement. */ static char * sql_statement(const struct expr *e) { char *sql; size_t sz; int needop; sql = mandoc_strdup(e->equal ? "SELECT desc, form, pageid, bits " "FROM mpages NATURAL JOIN names WHERE " : "SELECT desc, form, pageid, 0 FROM mpages WHERE "); sz = strlen(sql); for (needop = 0; NULL != e; e = e->next) { if (e->and) sql_append(&sql, &sz, " AND ", 1); else if (needop) sql_append(&sql, &sz, " OR ", 1); if (e->open) sql_append(&sql, &sz, "(", e->open); sql_append(&sql, &sz, TYPE_Nd & e->bits ? (NULL == e->substr ? "desc REGEXP ?" : "desc MATCH ?") : TYPE_Nm == e->bits ? (NULL == e->substr ? "pageid IN (SELECT pageid FROM names " "WHERE name REGEXP ?)" : e->equal ? "name = ? " : "pageid IN (SELECT pageid FROM names " "WHERE name MATCH ?)") : (NULL == e->substr ? "pageid IN (SELECT pageid FROM keys " "WHERE key REGEXP ? AND bits & ?)" : "pageid IN (SELECT pageid FROM keys " "WHERE key MATCH ? AND bits & ?)"), 1); if (e->close) sql_append(&sql, &sz, ")", e->close); needop = 1; } return(sql); } /* * Compile a set of string tokens into an expression. * Tokens in "argv" are assumed to be individual expression atoms (e.g., * "(", "foo=bar", etc.). */ static struct expr * exprcomp(const struct mansearch *search, int argc, char *argv[]) { uint64_t mask; int i, toopen, logic, igncase, toclose; struct expr *first, *prev, *cur, *next; first = cur = NULL; logic = igncase = toclose = 0; toopen = NULL != search->sec || NULL != search->arch; for (i = 0; i < argc; i++) { if (0 == strcmp("(", argv[i])) { if (igncase) goto fail; toopen++; toclose++; continue; } else if (0 == strcmp(")", argv[i])) { if (toopen || logic || igncase || NULL == cur) goto fail; cur->close++; if (0 > --toclose) goto fail; continue; } else if (0 == strcmp("-a", argv[i])) { if (toopen || logic || igncase || NULL == cur) goto fail; logic = 1; continue; } else if (0 == strcmp("-o", argv[i])) { if (toopen || logic || igncase || NULL == cur) goto fail; logic = 2; continue; } else if (0 == strcmp("-i", argv[i])) { if (igncase) goto fail; igncase = 1; continue; } next = exprterm(search, argv[i], !igncase); if (NULL == next) goto fail; if (NULL == first) first = next; else cur->next = next; prev = cur = next; /* * Searching for descriptions must be split out * because they are stored in the mpages table, * not in the keys table. */ for (mask = TYPE_Nm; mask <= TYPE_Nd; mask <<= 1) { if (mask & cur->bits && ~mask & cur->bits) { next = mandoc_calloc(1, sizeof(struct expr)); memcpy(next, cur, sizeof(struct expr)); prev->open = 1; cur->bits = mask; cur->next = next; cur = next; cur->bits &= ~mask; } } prev->and = (1 == logic); prev->open += toopen; if (cur != prev) cur->close = 1; toopen = logic = igncase = 0; } if (toopen || logic || igncase || toclose) goto fail; if (NULL != search->sec || NULL != search->arch) cur->close++; if (NULL != search->arch) cur = exprspec(cur, TYPE_arch, search->arch, "^(%s|any)$"); if (NULL != search->sec) exprspec(cur, TYPE_sec, search->sec, "^%s$"); return(first); fail: if (NULL != first) exprfree(first); return(NULL); } static struct expr * exprspec(struct expr *cur, uint64_t key, const char *value, const char *format) { char errbuf[BUFSIZ]; char *cp; int irc; mandoc_asprintf(&cp, format, value); cur->next = mandoc_calloc(1, sizeof(struct expr)); cur = cur->next; cur->and = 1; cur->bits = key; if (0 != (irc = regcomp(&cur->regexp, cp, REG_EXTENDED | REG_NOSUB | REG_ICASE))) { regerror(irc, &cur->regexp, errbuf, sizeof(errbuf)); fprintf(stderr, "regcomp: %s\n", errbuf); cur->substr = value; } free(cp); return(cur); } static struct expr * exprterm(const struct mansearch *search, char *buf, int cs) { char errbuf[BUFSIZ]; struct expr *e; char *key, *val; uint64_t iterbit; int i, irc; if ('\0' == *buf) return(NULL); e = mandoc_calloc(1, sizeof(struct expr)); if (search->argmode == ARG_NAME) { e->bits = TYPE_Nm; e->substr = buf; e->equal = 1; return(e); } /* * Separate macro keys from search string. * If needed, request regular expression handling * by setting e->substr to NULL. */ if (search->argmode == ARG_WORD) { e->bits = TYPE_Nm; e->substr = NULL; mandoc_asprintf(&val, "[[:<:]]%s[[:>:]]", buf); cs = 0; } else if ((val = strpbrk(buf, "=~")) == NULL) { e->bits = TYPE_Nm | TYPE_Nd; e->substr = buf; } else { if (val == buf) e->bits = TYPE_Nm | TYPE_Nd; if ('=' == *val) e->substr = val + 1; *val++ = '\0'; if (NULL != strstr(buf, "arch")) cs = 0; } /* Compile regular expressions. */ if (NULL == e->substr) { irc = regcomp(&e->regexp, val, REG_EXTENDED | REG_NOSUB | (cs ? 0 : REG_ICASE)); if (search->argmode == ARG_WORD) free(val); if (irc) { regerror(irc, &e->regexp, errbuf, sizeof(errbuf)); fprintf(stderr, "regcomp: %s\n", errbuf); free(e); return(NULL); } } if (e->bits) return(e); /* * Parse out all possible fields. * If the field doesn't resolve, bail. */ while (NULL != (key = strsep(&buf, ","))) { if ('\0' == *key) continue; for (i = 0, iterbit = 1; i < mansearch_keymax; i++, iterbit <<= 1) { if (0 == strcasecmp(key, mansearch_keynames[i])) { e->bits |= iterbit; break; } } if (i == mansearch_keymax) { if (strcasecmp(key, "any")) { free(e); return(NULL); } e->bits |= ~0ULL; } } return(e); } static void exprfree(struct expr *p) { struct expr *pp; while (NULL != p) { pp = p->next; free(p); p = pp; } } static void * hash_calloc(size_t nmemb, size_t sz, void *arg) { return(mandoc_calloc(nmemb, sz)); } static void * hash_alloc(size_t sz, void *arg) { return(mandoc_malloc(sz)); } static void hash_free(void *p, void *arg) { free(p); } Index: projects/arm_intrng/contrib/mdocml/mansearch.h =================================================================== --- projects/arm_intrng/contrib/mdocml/mansearch.h (revision 276247) +++ projects/arm_intrng/contrib/mdocml/mansearch.h (revision 276248) @@ -1,113 +1,111 @@ -/* $Id: mansearch.h,v 1.21 2014/11/27 01:58:21 schwarze Exp $ */ +/* $Id: mansearch.h,v 1.23 2014/12/01 08:05:52 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef MANSEARCH_H -#define MANSEARCH_H #define MANDOC_DB "mandoc.db" #define TYPE_arch 0x0000000000000001ULL #define TYPE_sec 0x0000000000000002ULL #define TYPE_Xr 0x0000000000000004ULL #define TYPE_Ar 0x0000000000000008ULL #define TYPE_Fa 0x0000000000000010ULL #define TYPE_Fl 0x0000000000000020ULL #define TYPE_Dv 0x0000000000000040ULL #define TYPE_Fn 0x0000000000000080ULL #define TYPE_Ic 0x0000000000000100ULL #define TYPE_Pa 0x0000000000000200ULL #define TYPE_Cm 0x0000000000000400ULL #define TYPE_Li 0x0000000000000800ULL #define TYPE_Em 0x0000000000001000ULL #define TYPE_Cd 0x0000000000002000ULL #define TYPE_Va 0x0000000000004000ULL #define TYPE_Ft 0x0000000000008000ULL #define TYPE_Tn 0x0000000000010000ULL #define TYPE_Er 0x0000000000020000ULL #define TYPE_Ev 0x0000000000040000ULL #define TYPE_Sy 0x0000000000080000ULL #define TYPE_Sh 0x0000000000100000ULL #define TYPE_In 0x0000000000200000ULL #define TYPE_Ss 0x0000000000400000ULL #define TYPE_Ox 0x0000000000800000ULL #define TYPE_An 0x0000000001000000ULL #define TYPE_Mt 0x0000000002000000ULL #define TYPE_St 0x0000000004000000ULL #define TYPE_Bx 0x0000000008000000ULL #define TYPE_At 0x0000000010000000ULL #define TYPE_Nx 0x0000000020000000ULL #define TYPE_Fx 0x0000000040000000ULL #define TYPE_Lk 0x0000000080000000ULL #define TYPE_Ms 0x0000000100000000ULL #define TYPE_Bsx 0x0000000200000000ULL #define TYPE_Dx 0x0000000400000000ULL #define TYPE_Rs 0x0000000800000000ULL #define TYPE_Vt 0x0000001000000000ULL #define TYPE_Lb 0x0000002000000000ULL #define TYPE_Nm 0x0000004000000000ULL #define TYPE_Nd 0x0000008000000000ULL #define NAME_SYN 0x0000004000000001ULL #define NAME_FIRST 0x0000004000000004ULL #define NAME_TITLE 0x0000004000000006ULL #define NAME_HEAD 0x0000004000000008ULL #define NAME_FILE 0x0000004000000010ULL #define NAME_MASK 0x000000000000001fULL #define FORM_CAT 0 /* manual page is preformatted */ #define FORM_SRC 1 /* format is mdoc(7) or man(7) */ #define FORM_NONE 4 /* format is unknown */ enum argmode { ARG_FILE = 0, ARG_NAME, ARG_WORD, ARG_EXPR }; struct manpage { char *file; /* to be prefixed by manpath */ char *names; /* a list of names with sections */ char *output; /* user-defined additional output */ size_t ipath; /* number of the manpath */ uint64_t bits; /* name type mask */ int sec; /* section number, 10 means invalid */ int form; /* 0 == catpage */ }; struct mansearch { const char *arch; /* architecture/NULL */ const char *sec; /* mansection/NULL */ const char *outkey; /* show content of this macro */ enum argmode argmode; /* interpretation of arguments */ int firstmatch; /* first matching database only */ }; __BEGIN_DECLS +struct manpaths; + int mansearch_setup(int); int mansearch(const struct mansearch *cfg, /* options */ const struct manpaths *paths, /* manpaths */ int argc, /* size of argv */ char *argv[], /* search terms */ struct manpage **res, /* results */ size_t *ressz); /* results returned */ void mansearch_free(struct manpage *, size_t); __END_DECLS - -#endif /* MANSEARCH_H */ Index: projects/arm_intrng/contrib/mdocml/mansearch_const.c =================================================================== --- projects/arm_intrng/contrib/mdocml/mansearch_const.c (revision 276247) +++ projects/arm_intrng/contrib/mdocml/mansearch_const.c (revision 276248) @@ -1,34 +1,33 @@ -/* $Id: mansearch_const.c,v 1.6 2014/08/10 23:54:41 schwarze Exp $ */ +/* $Id: mansearch_const.c,v 1.7 2014/12/01 08:05:52 schwarze Exp $ */ /* * Copyright (c) 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "config.h" #include #include -#include "manpath.h" #include "mansearch.h" const int mansearch_keymax = 40; const char *const mansearch_keynames[40] = { "arch", "sec", "Xr", "Ar", "Fa", "Fl", "Dv", "Fn", "Ic", "Pa", "Cm", "Li", "Em", "Cd", "Va", "Ft", "Tn", "Er", "Ev", "Sy", "Sh", "In", "Ss", "Ox", "An", "Mt", "St", "Bx", "At", "Nx", "Fx", "Lk", "Ms", "Bsx", "Dx", "Rs", "Vt", "Lb", "Nm", "Nd" }; Index: projects/arm_intrng/contrib/mdocml/mdoc.7 =================================================================== --- projects/arm_intrng/contrib/mdocml/mdoc.7 (revision 276247) +++ projects/arm_intrng/contrib/mdocml/mdoc.7 (revision 276248) @@ -1,3312 +1,3302 @@ -.\" $Id: mdoc.7,v 1.244 2014/11/28 18:36:35 schwarze Exp $ +.\" $Id: mdoc.7,v 1.245 2014/11/30 21:56:18 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons .\" Copyright (c) 2010, 2011, 2013 Ingo Schwarze .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 28 2014 $ +.Dd $Mdocdate: November 30 2014 $ .Dt MDOC 7 .Os .Sh NAME .Nm mdoc .Nd semantic markup language for formatting manual pages .Sh DESCRIPTION The .Nm mdoc language supports authoring of manual pages for the .Xr man 1 utility by allowing semantic annotations of words, phrases, page sections and complete manual pages. Such annotations are used by formatting tools to achieve a uniform presentation across all manuals written in .Nm , and to support hyperlinking if supported by the output medium. .Pp This reference document describes the structure of manual pages and the syntax and usage of the .Nm language. The reference implementation of a parsing and formatting tool is .Xr mandoc 1 ; the .Sx COMPATIBILITY section describes compatibility with other implementations. .Pp In an .Nm document, lines beginning with the control character .Sq \&. are called .Dq macro lines . The first word is the macro name. It consists of two or three letters. Most macro names begin with a capital letter. For a list of available macros, see .Sx MACRO OVERVIEW . The words following the macro name are arguments to the macro, optionally including the names of other, callable macros; see .Sx MACRO SYNTAX for details. .Pp Lines not beginning with the control character are called .Dq text lines . They provide free-form text to be printed; the formatting of the text depends on the respective processing context: .Bd -literal -offset indent \&.Sh Macro lines change control state. Text lines are interpreted within the current state. .Ed .Pp Many aspects of the basic syntax of the .Nm language are based on the .Xr roff 7 language; see the .Em LANGUAGE SYNTAX and .Em MACRO SYNTAX sections in the .Xr roff 7 manual for details, in particular regarding comments, escape sequences, whitespace, and quoting. However, using .Xr roff 7 requests in .Nm documents is discouraged; .Xr mandoc 1 supports some of them merely for backward compatibility. .Sh MANUAL STRUCTURE A well-formed .Nm document consists of a document prologue followed by one or more sections. .Pp The prologue, which consists of the .Sx \&Dd , .Sx \&Dt , and .Sx \&Os macros in that order, is required for every document. .Pp The first section (sections are denoted by .Sx \&Sh ) must be the NAME section, consisting of at least one .Sx \&Nm followed by .Sx \&Nd . .Pp Following that, convention dictates specifying at least the .Em SYNOPSIS and .Em DESCRIPTION sections, although this varies between manual sections. .Pp The following is a well-formed skeleton .Nm file for a utility .Qq progname : .Bd -literal -offset indent \&.Dd $\&Mdocdate$ \&.Dt PROGNAME section \&.Os \&.Sh NAME \&.Nm progname \&.Nd one line about what it does \&.\e\(dq .Sh LIBRARY \&.\e\(dq For sections 2, 3, and 9 only. \&.\e\(dq Not used in OpenBSD. \&.Sh SYNOPSIS \&.Nm progname \&.Op Fl options \&.Ar \&.Sh DESCRIPTION The \&.Nm utility processes files ... \&.\e\(dq .Sh CONTEXT \&.\e\(dq For section 9 functions only. \&.\e\(dq .Sh IMPLEMENTATION NOTES \&.\e\(dq Not used in OpenBSD. \&.\e\(dq .Sh RETURN VALUES \&.\e\(dq For sections 2, 3, and 9 function return values only. \&.\e\(dq .Sh ENVIRONMENT \&.\e\(dq For sections 1, 6, 7, and 8 only. \&.\e\(dq .Sh FILES \&.\e\(dq .Sh EXIT STATUS \&.\e\(dq For sections 1, 6, and 8 only. \&.\e\(dq .Sh EXAMPLES \&.\e\(dq .Sh DIAGNOSTICS \&.\e\(dq For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only. \&.\e\(dq .Sh ERRORS \&.\e\(dq For sections 2, 3, 4, and 9 errno settings only. \&.\e\(dq .Sh SEE ALSO \&.\e\(dq .Xr foobar 1 \&.\e\(dq .Sh STANDARDS \&.\e\(dq .Sh HISTORY \&.\e\(dq .Sh AUTHORS \&.\e\(dq .Sh CAVEATS \&.\e\(dq .Sh BUGS \&.\e\(dq .Sh SECURITY CONSIDERATIONS \&.\e\(dq Not used in OpenBSD. .Ed .Pp The sections in an .Nm document are conventionally ordered as they appear above. Sections should be composed as follows: .Bl -ohang -offset Ds .It Em NAME The name(s) and a one line description of the documented material. The syntax for this as follows: .Bd -literal -offset indent \&.Nm name0 , \&.Nm name1 , \&.Nm name2 \&.Nd a one line description .Ed .Pp Multiple .Sq \&Nm names should be separated by commas. .Pp The .Sx \&Nm macro(s) must precede the .Sx \&Nd macro. .Pp See .Sx \&Nm and .Sx \&Nd . .It Em LIBRARY The name of the library containing the documented material, which is assumed to be a function in a section 2, 3, or 9 manual. The syntax for this is as follows: .Bd -literal -offset indent \&.Lb libarm .Ed .Pp See .Sx \&Lb . .It Em SYNOPSIS Documents the utility invocation syntax, function call syntax, or device configuration. .Pp For the first, utilities (sections 1, 6, and 8), this is generally structured as follows: .Bd -literal -offset indent \&.Nm bar \&.Op Fl v \&.Op Fl o Ar file \&.Op Ar \&.Nm foo \&.Op Fl v \&.Op Fl o Ar file \&.Op Ar .Ed .Pp Commands should be ordered alphabetically. .Pp For the second, function calls (sections 2, 3, 9): .Bd -literal -offset indent \&.In header.h \&.Vt extern const char *global; \&.Ft "char *" \&.Fn foo "const char *src" \&.Ft "char *" \&.Fn bar "const char *src" .Ed .Pp Ordering of .Sx \&In , .Sx \&Vt , .Sx \&Fn , and .Sx \&Fo macros should follow C header-file conventions. .Pp And for the third, configurations (section 4): .Bd -literal -offset indent \&.Cd \(dqit* at isa? port 0x2e\(dq \&.Cd \(dqit* at isa? port 0x4e\(dq .Ed .Pp Manuals not in these sections generally don't need a .Em SYNOPSIS . .Pp Some macros are displayed differently in the .Em SYNOPSIS section, particularly .Sx \&Nm , .Sx \&Cd , .Sx \&Fd , .Sx \&Fn , .Sx \&Fo , .Sx \&In , .Sx \&Vt , and .Sx \&Ft . All of these macros are output on their own line. If two such dissimilar macros are pairwise invoked (except for .Sx \&Ft before .Sx \&Fo or .Sx \&Fn ) , they are separated by a vertical space, unless in the case of .Sx \&Fo , .Sx \&Fn , and .Sx \&Ft , which are always separated by vertical space. .Pp When text and macros following an .Sx \&Nm macro starting an input line span multiple output lines, all output lines but the first will be indented to align with the text immediately following the .Sx \&Nm macro, up to the next .Sx \&Nm , .Sx \&Sh , or .Sx \&Ss macro or the end of an enclosing block, whichever comes first. .It Em DESCRIPTION This begins with an expansion of the brief, one line description in .Em NAME : .Bd -literal -offset indent The \&.Nm utility does this, that, and the other. .Ed .Pp It usually follows with a breakdown of the options (if documenting a command), such as: .Bd -literal -offset indent The arguments are as follows: \&.Bl \-tag \-width Ds \&.It Fl v Print verbose information. \&.El .Ed .Pp Manuals not documenting a command won't include the above fragment. .Pp Since the .Em DESCRIPTION section usually contains most of the text of a manual, longer manuals often use the .Sx \&Ss macro to form subsections. In very long manuals, the .Em DESCRIPTION may be split into multiple sections, each started by an .Sx \&Sh macro followed by a non-standard section name, and each having several subsections, like in the present .Nm manual. .It Em CONTEXT This section lists the contexts in which functions can be called in section 9. The contexts are autoconf, process, or interrupt. .It Em IMPLEMENTATION NOTES Implementation-specific notes should be kept here. This is useful when implementing standard functions that may have side effects or notable algorithmic implications. .It Em RETURN VALUES This section documents the return values of functions in sections 2, 3, and 9. .Pp See .Sx \&Rv . .It Em ENVIRONMENT Lists the environment variables used by the utility, and explains the syntax and semantics of their values. The .Xr environ 7 manual provides examples of typical content and formatting. .Pp See .Sx \&Ev . .It Em FILES Documents files used. It's helpful to document both the file name and a short description of how the file is used (created, modified, etc.). .Pp See .Sx \&Pa . .It Em EXIT STATUS This section documents the command exit status for section 1, 6, and 8 utilities. Historically, this information was described in .Em DIAGNOSTICS , a practise that is now discouraged. .Pp See .Sx \&Ex . .It Em EXAMPLES Example usages. This often contains snippets of well-formed, well-tested invocations. Make sure that examples work properly! .It Em DIAGNOSTICS Documents error messages. In section 4 and 9 manuals, these are usually messages printed by the kernel to the console and to the kernel log. In section 1, 6, 7, and 8, these are usually messages printed by userland programs to the standard error output. .Pp Historically, this section was used in place of .Em EXIT STATUS for manuals in sections 1, 6, and 8; however, this practise is discouraged. .Pp See .Sx \&Bl .Fl diag . .It Em ERRORS Documents .Xr errno 2 settings in sections 2, 3, 4, and 9. .Pp See .Sx \&Er . .It Em SEE ALSO References other manuals with related topics. This section should exist for most manuals. Cross-references should conventionally be ordered first by section, then alphabetically (ignoring case). .Pp References to other documentation concerning the topic of the manual page, for example authoritative books or journal articles, may also be provided in this section. .Pp See .Sx \&Rs and .Sx \&Xr . .It Em STANDARDS References any standards implemented or used. If not adhering to any standards, the .Em HISTORY section should be used instead. .Pp See .Sx \&St . .It Em HISTORY A brief history of the subject, including where it was first implemented, and when it was ported to or reimplemented for the operating system at hand. .It Em AUTHORS Credits to the person or persons who wrote the code and/or documentation. Authors should generally be noted by both name and email address. .Pp See .Sx \&An . .It Em CAVEATS Common misuses and misunderstandings should be explained in this section. .It Em BUGS Known bugs, limitations, and work-arounds should be described in this section. .It Em SECURITY CONSIDERATIONS Documents any security precautions that operators should consider. .El .Sh MACRO OVERVIEW This overview is sorted such that macros of similar purpose are listed together, to help find the best macro for any given purpose. Deprecated macros are not included in the overview, but can be found below in the alphabetical .Sx MACRO REFERENCE . .Ss Document preamble and NAME section macros .Bl -column "Brq, Bro, Brc" description .It Sx \&Dd Ta document date: Cm $\&Mdocdate$ | Ar month day , year .It Sx \&Dt Ta document title: Ar TITLE section Op Ar arch .It Sx \&Os Ta operating system version: Op Ar system Op Ar version .It Sx \&Nm Ta document name (one argument) .It Sx \&Nd Ta document description (one line) .El .Ss Sections and cross references .Bl -column "Brq, Bro, Brc" description .It Sx \&Sh Ta section header (one line) .It Sx \&Ss Ta subsection header (one line) .It Sx \&Sx Ta internal cross reference to a section or subsection .It Sx \&Xr Ta cross reference to another manual page: Ar name section .It Sx \&Pp , \&Lp Ta start a text paragraph (no arguments) .El .Ss Displays and lists .Bl -column "Brq, Bro, Brc" description .It Sx \&Bd , \&Ed Ta display block: .Fl Ar type .Op Fl offset Ar width .Op Fl compact .It Sx \&D1 Ta indented display (one line) .It Sx \&Dl Ta indented literal display (one line) .It Sx \&Bl , \&El Ta list block: .Fl Ar type .Op Fl width Ar val .Op Fl offset Ar val .Op Fl compact .It Sx \&It Ta list item (syntax depends on Fl Ar type ) .It Sx \&Ta Ta table cell separator in Sx \&Bl Fl column No lists .It Sx \&Rs , \&%* , \&Re Ta bibliographic block (references) .El .Ss Spacing control .Bl -column "Brq, Bro, Brc" description .It Sx \&Pf Ta prefix, no following horizontal space (one argument) .It Sx \&Ns Ta roman font, no preceding horizontal space (no arguments) .It Sx \&Ap Ta apostrophe without surrounding whitespace (no arguments) .It Sx \&Sm Ta switch horizontal spacing mode: Op Cm on | off .It Sx \&Bk , \&Ek Ta keep block: Fl words .It Sx \&br Ta force output line break in text mode (no arguments) .It Sx \&sp Ta force vertical space: Op Ar height .El .Ss Semantic markup for command line utilities: .Bl -column "Brq, Bro, Brc" description .It Sx \&Nm Ta start a SYNOPSIS block with the name of a utility .It Sx \&Fl Ta command line options (flags) (>=0 arguments) .It Sx \&Cm Ta command modifier (>0 arguments) .It Sx \&Ar Ta command arguments (>=0 arguments) .It Sx \&Op , \&Oo , \&Oc Ta optional syntax elements (enclosure) .It Sx \&Ic Ta internal or interactive command (>0 arguments) .It Sx \&Ev Ta environmental variable (>0 arguments) .It Sx \&Pa Ta file system path (>=0 arguments) .El .Ss Semantic markup for function libraries: .Bl -column "Brq, Bro, Brc" description .It Sx \&Lb Ta function library (one argument) .It Sx \&In Ta include file (one argument) .It Sx \&Fd Ta other preprocessor directive (>0 arguments) .It Sx \&Ft Ta function type (>0 arguments) .It Sx \&Fo , \&Fc Ta function block: Ar funcname .It Sx \&Fn Ta function name: .Op Ar functype .Ar funcname .Oo .Op Ar argtype .Ar argname .Oc .It Sx \&Fa Ta function argument (>0 arguments) .It Sx \&Vt Ta variable type (>0 arguments) .It Sx \&Va Ta variable name (>0 arguments) .It Sx \&Dv Ta defined variable or preprocessor constant (>0 arguments) .It Sx \&Er Ta error constant (>0 arguments) .It Sx \&Ev Ta environmental variable (>0 arguments) .El .Ss Various semantic markup: .Bl -column "Brq, Bro, Brc" description .It Sx \&An Ta author name (>0 arguments) .It Sx \&Lk Ta hyperlink: Ar uri Op Ar name .It Sx \&Mt Ta Do mailto Dc hyperlink: Ar address .It Sx \&Cd Ta kernel configuration declaration (>0 arguments) .It Sx \&Ad Ta memory address (>0 arguments) .It Sx \&Ms Ta mathematical symbol (>0 arguments) .El .Ss Physical markup .Bl -column "Brq, Bro, Brc" description .It Sx \&Em Ta italic font or underline (emphasis) (>0 arguments) .It Sx \&Sy Ta boldface font (symbolic) (>0 arguments) .It Sx \&Li Ta typewriter font (literal) (>0 arguments) .It Sx \&No Ta return to roman font (normal) (no arguments) .It Sx \&Bf , \&Ef Ta font block: .Op Fl Ar type | Cm \&Em | \&Li | \&Sy .El .Ss Physical enclosures .Bl -column "Brq, Bro, Brc" description .It Sx \&Dq , \&Do , \&Dc Ta enclose in typographic double quotes: Dq text .It Sx \&Qq , \&Qo , \&Qc Ta enclose in typewriter double quotes: Qq text .It Sx \&Sq , \&So , \&Sc Ta enclose in single quotes: Sq text .It Sx \&Ql Ta single-quoted literal text: Ql text .It Sx \&Pq , \&Po , \&Pc Ta enclose in parentheses: Pq text .It Sx \&Bq , \&Bo , \&Bc Ta enclose in square brackets: Bq text .It Sx \&Brq , \&Bro , \&Brc Ta enclose in curly braces: Brq text .It Sx \&Aq , \&Ao , \&Ac Ta enclose in angle brackets: Aq text .It Sx \&Eo , \&Ec Ta generic enclosure .El .Ss Text production .Bl -column "Brq, Bro, Brc" description .It Sx \&Ex Fl std Ta standard command exit values: Op Ar utility ... .It Sx \&Rv Fl std Ta standard function return values: Op Ar function ... .It Sx \&St Ta reference to a standards document (one argument) .It Sx \&At Ta At .It Sx \&Bx Ta Bx .It Sx \&Bsx Ta Bsx .It Sx \&Nx Ta Nx .It Sx \&Fx Ta Fx .It Sx \&Ox Ta Ox .It Sx \&Dx Ta Dx .El .Sh MACRO REFERENCE This section is a canonical reference of all macros, arranged alphabetically. For the scoping of individual macros, see .Sx MACRO SYNTAX . .Ss \&%A Author name of an .Sx \&Rs block. Multiple authors should each be accorded their own .Sx \%%A line. Author names should be ordered with full or abbreviated forename(s) first, then full surname. .Ss \&%B Book title of an .Sx \&Rs block. This macro may also be used in a non-bibliographic context when referring to book titles. .Ss \&%C Publication city or location of an .Sx \&Rs block. .Ss \&%D Publication date of an .Sx \&Rs block. Recommended formats of arguments are .Ar month day , year or just .Ar year . .Ss \&%I Publisher or issuer name of an .Sx \&Rs block. .Ss \&%J Journal name of an .Sx \&Rs block. .Ss \&%N Issue number (usually for journals) of an .Sx \&Rs block. .Ss \&%O Optional information of an .Sx \&Rs block. .Ss \&%P Book or journal page number of an .Sx \&Rs block. .Ss \&%Q Institutional author (school, government, etc.) of an .Sx \&Rs block. Multiple institutional authors should each be accorded their own .Sx \&%Q line. .Ss \&%R Technical report name of an .Sx \&Rs block. .Ss \&%T Article title of an .Sx \&Rs block. This macro may also be used in a non-bibliographical context when referring to article titles. .Ss \&%U URI of reference document. .Ss \&%V Volume number of an .Sx \&Rs block. .Ss \&Ac Close an .Sx \&Ao block. Does not have any tail arguments. .Ss \&Ad Memory address. Do not use this for postal addresses. .Pp Examples: .Dl \&.Ad [0,$] .Dl \&.Ad 0x00000000 .Ss \&An Author name. Can be used both for the authors of the program, function, or driver documented in the manual, or for the authors of the manual itself. Requires either the name of an author or one of the following arguments: .Pp .Bl -tag -width "-nosplitX" -offset indent -compact .It Fl split Start a new output line before each subsequent invocation of .Sx \&An . .It Fl nosplit The opposite of .Fl split . .El .Pp The default is .Fl nosplit . The effect of selecting either of the .Fl split modes ends at the beginning of the .Em AUTHORS section. In the .Em AUTHORS section, the default is .Fl nosplit for the first author listing and .Fl split for all other author listings. .Pp Examples: .Dl \&.An -nosplit .Dl \&.An Kristaps Dzonsons \&Aq \&Mt kristaps@bsd.lv .Ss \&Ao Begin a block enclosed by angle brackets. Does not have any head arguments. .Pp Examples: .Dl \&.Fl -key= \&Ns \&Ao \&Ar val \&Ac .Pp See also .Sx \&Aq . .Ss \&Ap Inserts an apostrophe without any surrounding whitespace. This is generally used as a grammatical device when referring to the verb form of a function. .Pp Examples: .Dl \&.Fn execve \&Ap d .Ss \&Aq Encloses its arguments in angle brackets. .Pp Examples: .Dl \&.Fl -key= \&Ns \&Aq \&Ar val .Pp .Em Remarks : this macro is often abused for rendering URIs, which should instead use .Sx \&Lk or .Sx \&Mt , or to note pre-processor .Dq Li #include statements, which should use .Sx \&In . .Pp See also .Sx \&Ao . .Ss \&Ar Command arguments. If an argument is not provided, the string .Dq file ...\& is used as a default. .Pp Examples: .Dl ".Fl o Ar file" .Dl ".Ar" .Dl ".Ar arg1 , arg2 ." .Pp The arguments to the .Sx \&Ar macro are names and placeholders for command arguments; for fixed strings to be passed verbatim as arguments, use .Sx \&Fl or .Sx \&Cm . .Ss \&At Formats an .At version. Accepts one optional argument: .Pp .Bl -tag -width "v[1-7] | 32vX" -offset indent -compact .It Cm v[1-7] | 32v A version of .At . .It Cm III .At III . .It Cm V[.[1-4]]? A version of .At V . .El .Pp Note that these arguments do not begin with a hyphen. .Pp Examples: .Dl \&.At .Dl \&.At III .Dl \&.At V.1 .Pp See also .Sx \&Bsx , .Sx \&Bx , .Sx \&Dx , .Sx \&Fx , .Sx \&Nx , and .Sx \&Ox . .Ss \&Bc Close a .Sx \&Bo block. Does not have any tail arguments. .Ss \&Bd Begin a display block. Its syntax is as follows: .Bd -ragged -offset indent .Pf \. Sx \&Bd .Fl Ns Ar type .Op Fl offset Ar width .Op Fl compact .Ed .Pp Display blocks are used to select a different indentation and justification than the one used by the surrounding text. They may contain both macro lines and text lines. By default, a display block is preceded by a vertical space. .Pp The .Ar type must be one of the following: .Bl -tag -width 13n -offset indent .It Fl centered Produce one output line from each input line, and centre-justify each line. Using this display type is not recommended; many .Nm implementations render it poorly. .It Fl filled Change the positions of line breaks to fill each line, and left- and right-justify the resulting block. .It Fl literal Produce one output line from each input line, and do not justify the block at all. Preserve white space as it appears in the input. Always use a constant-width font. Use this for displaying source code. .It Fl ragged Change the positions of line breaks to fill each line, and left-justify the resulting block. .It Fl unfilled The same as .Fl literal , but using the same font as for normal text, which is a variable width font if supported by the output device. .El .Pp The .Ar type must be provided first. Additional arguments may follow: .Bl -tag -width 13n -offset indent .It Fl offset Ar width Indent the display by the .Ar width , which may be one of the following: .Bl -item .It One of the pre-defined strings .Cm indent , the width of a standard indentation (six constant width characters); .Cm indent-two , twice .Cm indent ; .Cm left , which has no effect; .Cm right , which justifies to the right margin; or .Cm center , which aligns around an imagined centre axis. .It A macro invocation, which selects a predefined width associated with that macro. The most popular is the imaginary macro .Ar \&Ds , which resolves to .Sy 6n . .It A scaling width as described in .Xr roff 7 . .It An arbitrary string, which indents by the length of this string. .El .Pp When the argument is missing, .Fl offset is ignored. .It Fl compact Do not assert vertical space before the display. .El .Pp Examples: .Bd -literal -offset indent \&.Bd \-literal \-offset indent \-compact Hello world. \&.Ed .Ed .Pp See also .Sx \&D1 and .Sx \&Dl . .Ss \&Bf Change the font mode for a scoped block of text. Its syntax is as follows: .Bd -ragged -offset indent .Pf \. Sx \&Bf .Oo .Fl emphasis | literal | symbolic | .Cm \&Em | \&Li | \&Sy .Oc .Ed .Pp The .Fl emphasis and .Cm \&Em argument are equivalent, as are .Fl symbolic and .Cm \&Sy , and .Fl literal and .Cm \&Li . Without an argument, this macro does nothing. The font mode continues until broken by a new font mode in a nested scope or .Sx \&Ef is encountered. .Pp See also .Sx \&Li , .Sx \&Ef , .Sx \&Em , and .Sx \&Sy . .Ss \&Bk For each macro, keep its output together on the same output line, until the end of the macro or the end of the input line is reached, whichever comes first. Line breaks in text lines are unaffected. The syntax is as follows: .Pp .D1 Pf \. Sx \&Bk Fl words .Pp The .Fl words argument is required; additional arguments are ignored. .Pp The following example will not break within each .Sx \&Op macro line: .Bd -literal -offset indent \&.Bk \-words \&.Op Fl f Ar flags \&.Op Fl o Ar output \&.Ek .Ed .Pp Be careful in using over-long lines within a keep block! Doing so will clobber the right margin. .Ss \&Bl Begin a list. Lists consist of items specified using the .Sx \&It macro, containing a head or a body or both. The list syntax is as follows: .Bd -ragged -offset indent .Pf \. Sx \&Bl .Fl Ns Ar type .Op Fl width Ar val .Op Fl offset Ar val .Op Fl compact .Op HEAD ... .Ed .Pp The list .Ar type is mandatory and must be specified first. The .Fl width and .Fl offset arguments accept macro names as described for .Sx \&Bd .Fl offset , scaling widths as described in .Xr roff 7 , or use the length of the given string. The .Fl offset is a global indentation for the whole list, affecting both item heads and bodies. For those list types supporting it, the .Fl width argument requests an additional indentation of item bodies, to be added to the .Fl offset . Unless the .Fl compact argument is specified, list entries are separated by vertical space. .Pp A list must specify one of the following list types: .Bl -tag -width 12n -offset indent .It Fl bullet No item heads can be specified, but a bullet will be printed at the head of each item. Item bodies start on the same output line as the bullet and are indented according to the .Fl width argument. .It Fl column A columnated list. The .Fl width argument has no effect; instead, each argument specifies the width of one column, using either the scaling width syntax described in .Xr roff 7 or the string length of the argument. If the first line of the body of a .Fl column list is not an .Sx \&It macro line, .Sx \&It contexts spanning one input line each are implied until an .Sx \&It macro line is encountered, at which point items start being interpreted as described in the .Sx \&It documentation. .It Fl dash Like .Fl bullet , except that dashes are used in place of bullets. .It Fl diag Like .Fl inset , except that item heads are not parsed for macro invocations. Most often used in the .Em DIAGNOSTICS section with error constants in the item heads. .It Fl enum A numbered list. No item heads can be specified. Formatted like .Fl bullet , except that cardinal numbers are used in place of bullets, starting at 1. .It Fl hang Like .Fl tag , except that the first lines of item bodies are not indented, but follow the item heads like in .Fl inset lists. .It Fl hyphen Synonym for .Fl dash . .It Fl inset Item bodies follow items heads on the same line, using normal inter-word spacing. Bodies are not indented, and the .Fl width argument is ignored. .It Fl item No item heads can be specified, and none are printed. Bodies are not indented, and the .Fl width argument is ignored. .It Fl ohang Item bodies start on the line following item heads and are not indented. The .Fl width argument is ignored. .It Fl tag Item bodies are indented according to the .Fl width argument. When an item head fits inside the indentation, the item body follows this head on the same output line. Otherwise, the body starts on the output line following the head. .El .Pp Lists may be nested within lists and displays. Nesting of .Fl column and .Fl enum lists may not be portable. .Pp See also .Sx \&El and .Sx \&It . .Ss \&Bo Begin a block enclosed by square brackets. Does not have any head arguments. .Pp Examples: .Bd -literal -offset indent -compact \&.Bo 1 , \&.Dv BUFSIZ \&Bc .Ed .Pp See also .Sx \&Bq . .Ss \&Bq Encloses its arguments in square brackets. .Pp Examples: .Dl \&.Bq 1 , \&Dv BUFSIZ .Pp .Em Remarks : this macro is sometimes abused to emulate optional arguments for commands; the correct macros to use for this purpose are .Sx \&Op , .Sx \&Oo , and .Sx \&Oc . .Pp See also .Sx \&Bo . .Ss \&Brc Close a .Sx \&Bro block. Does not have any tail arguments. .Ss \&Bro Begin a block enclosed by curly braces. Does not have any head arguments. .Pp Examples: .Bd -literal -offset indent -compact \&.Bro 1 , ... , \&.Va n \&Brc .Ed .Pp See also .Sx \&Brq . .Ss \&Brq Encloses its arguments in curly braces. .Pp Examples: .Dl \&.Brq 1 , ... , \&Va n .Pp See also .Sx \&Bro . .Ss \&Bsx Format the .Bsx version provided as an argument, or a default value if no argument is provided. .Pp Examples: .Dl \&.Bsx 1.0 .Dl \&.Bsx .Pp See also .Sx \&At , .Sx \&Bx , .Sx \&Dx , .Sx \&Fx , .Sx \&Nx , and .Sx \&Ox . .Ss \&Bt Supported only for compatibility, do not use this in new manuals. Prints .Dq is currently in beta test. .Ss \&Bx Format the .Bx version provided as an argument, or a default value if no argument is provided. .Pp Examples: .Dl \&.Bx 4.3 Tahoe .Dl \&.Bx 4.4 .Dl \&.Bx .Pp See also .Sx \&At , .Sx \&Bsx , .Sx \&Dx , .Sx \&Fx , .Sx \&Nx , and .Sx \&Ox . .Ss \&Cd Kernel configuration declaration. This denotes strings accepted by .Xr config 8 . It is most often used in section 4 manual pages. .Pp Examples: .Dl \&.Cd device le0 at scode? .Pp .Em Remarks : this macro is commonly abused by using quoted literals to retain whitespace and align consecutive .Sx \&Cd declarations. This practise is discouraged. .Ss \&Cm Command modifiers. Typically used for fixed strings passed as arguments, unless .Sx \&Fl is more appropriate. Also useful when specifying configuration options or keys. .Pp Examples: .Dl ".Nm mt Fl f Ar device Cm rewind" .Dl ".Nm ps Fl o Cm pid , Ns Cm command" .Dl ".Nm dd Cm if= Ns Ar file1 Cm of= Ns Ar file2" .Dl ".Cm IdentityFile Pa ~/.ssh/id_rsa" .Dl ".Cm LogLevel Dv DEBUG" .Ss \&D1 One-line indented display. This is formatted by the default rules and is useful for simple indented statements. It is followed by a newline. .Pp Examples: .Dl \&.D1 \&Fl abcdefgh .Pp See also .Sx \&Bd and .Sx \&Dl . .Ss \&Db This macro is obsolete. No replacement is needed. It is ignored by .Xr mandoc 1 and groff including its arguments. It was formerly used to toggle a debugging mode. .Ss \&Dc Close a .Sx \&Do block. Does not have any tail arguments. .Ss \&Dd Document date for display in the page footer. This is the mandatory first macro of any .Nm manual. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Dd Ar month day , year .Pp The .Ar month is the full English month name, the .Ar day is an optionally zero-padded numeral, and the .Ar year is the full four-digit year. .Pp Other arguments are not portable; the .Xr mandoc 1 utility handles them as follows: .Bl -dash -offset 3n -compact .It To have the date automatically filled in by the .Ox version of .Xr cvs 1 , the special string .Dq $\&Mdocdate$ can be given as an argument. .It The traditional, purely numeric .Xr man 7 format .Ar year Ns \(en Ns Ar month Ns \(en Ns Ar day is accepted, too. .It If a date string cannot be parsed, it is used verbatim. .It If no date string is given, the current date is used. .El .Pp Examples: .Dl \&.Dd $\&Mdocdate$ .Dl \&.Dd $\&Mdocdate: July 21 2007$ .Dl \&.Dd July 21, 2007 .Pp See also .Sx \&Dt and .Sx \&Os . .Ss \&Dl One-line indented display. This is formatted as literal text and is useful for commands and invocations. It is followed by a newline. .Pp Examples: .Dl \&.Dl % mandoc mdoc.7 \e(ba less .Pp See also .Sx \&Bd and .Sx \&D1 . .Ss \&Do Begin a block enclosed by double quotes. Does not have any head arguments. .Pp Examples: .Bd -literal -offset indent -compact \&.Do April is the cruellest month \&.Dc \e(em T.S. Eliot .Ed .Pp See also .Sx \&Dq . .Ss \&Dq Encloses its arguments in .Dq typographic double-quotes. .Pp Examples: .Bd -literal -offset indent -compact \&.Dq April is the cruellest month \e(em T.S. Eliot .Ed .Pp See also .Sx \&Qq , .Sx \&Sq , and .Sx \&Do . .Ss \&Dt Document title for display in the page header. This is the mandatory second macro of any .Nm file. Its syntax is as follows: .Bd -ragged -offset indent .Pf \. Sx \&Dt .Ar TITLE .Ar section .Op Ar arch .Ed .Pp Its arguments are as follows: .Bl -tag -width section -offset 2n .It Ar TITLE The document's title (name), defaulting to .Dq UNTITLED if unspecified. To achieve a uniform appearance of page header lines, it should by convention be all caps. .It Ar section The manual section. This may be one of .Cm 1 .Pq utilities , .Cm 2 .Pq system calls , .Cm 3 .Pq libraries , .Cm 3p .Pq Perl libraries , .Cm 4 .Pq devices , .Cm 5 .Pq file formats , .Cm 6 .Pq games , .Cm 7 .Pq miscellaneous , .Cm 8 .Pq system utilities , .Cm 9 .Pq kernel functions , .Cm X11 .Pq X Window System , .Cm X11R6 .Pq X Window System , .Cm unass .Pq unassociated , .Cm local .Pq local system , .Cm draft .Pq draft manual , or .Cm paper .Pq paper . It should correspond to the manual's filename suffix and defaults to the empty string if unspecified. .It Ar arch This specifies the machine architecture a manual page applies to, where relevant, for example .Cm alpha , .Cm amd64 , .Cm i386 , or .Cm sparc64 . The list of valid architectures varies by operating system. .El .Pp Examples: .Dl \&.Dt FOO 1 .Dl \&.Dt FOO 9 i386 .Pp See also .Sx \&Dd and .Sx \&Os . .Ss \&Dv Defined variables such as preprocessor constants, constant symbols, enumeration values, and so on. .Pp Examples: .Dl \&.Dv NULL .Dl \&.Dv BUFSIZ .Dl \&.Dv STDOUT_FILENO .Pp See also .Sx \&Er and .Sx \&Ev for special-purpose constants, .Sx \&Va for variable symbols, and .Sx \&Fd for listing preprocessor variable definitions in the .Em SYNOPSIS . .Ss \&Dx Format the .Dx version provided as an argument, or a default value if no argument is provided. .Pp Examples: .Dl \&.Dx 2.4.1 .Dl \&.Dx .Pp See also .Sx \&At , .Sx \&Bsx , .Sx \&Bx , .Sx \&Fx , .Sx \&Nx , and .Sx \&Ox . .Ss \&Ec Close a scope started by .Sx \&Eo . Its syntax is as follows: .Pp .D1 Pf \. Sx \&Ec Op Ar TERM .Pp The .Ar TERM argument is used as the enclosure tail, for example, specifying \e(rq will emulate .Sx \&Dc . .Ss \&Ed End a display context started by .Sx \&Bd . .Ss \&Ef End a font mode context started by .Sx \&Bf . .Ss \&Ek End a keep context started by .Sx \&Bk . .Ss \&El End a list context started by .Sx \&Bl . .Pp See also .Sx \&Bl and .Sx \&It . .Ss \&Em Request an italic font. If the output device does not provide that, underline. .Pp This is most often used for stress emphasis (not to be confused with importance, see .Sx \&Sy ) . In the rare cases where none of the semantic markup macros fit, it can also be used for technical terms and placeholders, except that for syntax elements, .Sx \&Sy and .Sx \&Ar are preferred, respectively. .Pp Examples: .Bd -literal -compact -offset indent Selected lines are those \&.Em not matching any of the specified patterns. Some of the functions use a \&.Em hold space to save the pattern space for subsequent retrieval. .Ed .Pp See also .Sx \&Bf , .Sx \&Li , .Sx \&No , and .Sx \&Sy . .Ss \&En This macro is obsolete. Use .Sx \&Eo or any of the other enclosure macros. .Pp It encloses its argument in the delimiters specified by the last .Sx \&Es macro. .Ss \&Eo An arbitrary enclosure. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Eo Op Ar TERM .Pp The .Ar TERM argument is used as the enclosure head, for example, specifying \e(lq will emulate .Sx \&Do . .Ss \&Er Error constants for definitions of the .Va errno libc global variable. This is most often used in section 2 and 3 manual pages. .Pp Examples: .Dl \&.Er EPERM .Dl \&.Er ENOENT .Pp See also .Sx \&Dv for general constants. .Ss \&Es This macro is obsolete. Use .Sx \&Eo or any of the other enclosure macros. .Pp It takes two arguments, defining the delimiters to be used by subsequent .Sx \&En macros. .Ss \&Ev Environmental variables such as those specified in .Xr environ 7 . .Pp Examples: .Dl \&.Ev DISPLAY .Dl \&.Ev PATH .Pp See also .Sx \&Dv for general constants. .Ss \&Ex Insert a standard sentence regarding command exit values of 0 on success and >0 on failure. This is most often used in section 1, 6, and 8 manual pages. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Ex Fl std Op Ar utility ... .Pp If .Ar utility is not specified, the document's name set by .Sx \&Nm is used. Multiple .Ar utility arguments are treated as separate utilities. .Pp See also .Sx \&Rv . .Ss \&Fa Function argument or parameter. Its syntax is as follows: .Bd -ragged -offset indent .Pf \. Sx \&Fa .Qo .Op Ar argtype .Op Ar argname .Qc Ar \&... .Ed .Pp Each argument may be a name and a type (recommended for the .Em SYNOPSIS section), a name alone (for function invocations), or a type alone (for function prototypes). If both a type and a name are given or if the type consists of multiple words, all words belonging to the same function argument have to be given in a single argument to the .Sx \&Fa macro. .Pp This macro is also used to specify the field name of a structure. .Pp Most often, the .Sx \&Fa macro is used in the .Em SYNOPSIS within .Sx \&Fo blocks when documenting multi-line function prototypes. If invoked with multiple arguments, the arguments are separated by a comma. Furthermore, if the following macro is another .Sx \&Fa , the last argument will also have a trailing comma. .Pp Examples: .Dl \&.Fa \(dqconst char *p\(dq .Dl \&.Fa \(dqint a\(dq \(dqint b\(dq \(dqint c\(dq .Dl \&.Fa \(dqchar *\(dq size_t .Pp See also .Sx \&Fo . .Ss \&Fc End a function context started by .Sx \&Fo . .Ss \&Fd Preprocessor directive, in particular for listing it in the .Em SYNOPSIS . Historically, it was also used to document include files. The latter usage has been deprecated in favour of .Sx \&In . .Pp Its syntax is as follows: .Bd -ragged -offset indent .Pf \. Sx \&Fd .Li # Ns Ar directive .Op Ar argument ... .Ed .Pp Examples: .Dl \&.Fd #define sa_handler __sigaction_u.__sa_handler .Dl \&.Fd #define SIO_MAXNFDS .Dl \&.Fd #ifdef FS_DEBUG .Dl \&.Ft void .Dl \&.Fn dbg_open \(dqconst char *\(dq .Dl \&.Fd #endif .Pp See also .Sx MANUAL STRUCTURE , .Sx \&In , and .Sx \&Dv . .Ss \&Fl Command-line flag or option. Used when listing arguments to command-line utilities. Prints a fixed-width hyphen .Sq \- directly followed by each argument. If no arguments are provided, a hyphen is printed followed by a space. If the argument is a macro, a hyphen is prefixed to the subsequent macro output. .Pp Examples: .Dl ".Fl R Op Fl H | L | P" .Dl ".Op Fl 1AaCcdFfgHhikLlmnopqRrSsTtux" .Dl ".Fl type Cm d Fl name Pa CVS" .Dl ".Fl Ar signal_number" .Dl ".Fl o Fl" .Pp See also .Sx \&Cm . .Ss \&Fn A function name. Its syntax is as follows: .Bd -ragged -offset indent .Pf \. Ns Sx \&Fn .Op Ar functype .Ar funcname .Op Oo Ar argtype Oc Ar argname .Ed .Pp Function arguments are surrounded in parenthesis and are delimited by commas. If no arguments are specified, blank parenthesis are output. In the .Em SYNOPSIS section, this macro starts a new output line, and a blank line is automatically inserted between function definitions. .Pp Examples: .Dl \&.Fn \(dqint funcname\(dq \(dqint arg0\(dq \(dqint arg1\(dq .Dl \&.Fn funcname \(dqint arg0\(dq .Dl \&.Fn funcname arg0 .Pp .Bd -literal -offset indent -compact \&.Ft functype \&.Fn funcname .Ed .Pp When referring to a function documented in another manual page, use .Sx \&Xr instead. See also .Sx MANUAL STRUCTURE , .Sx \&Fo , and .Sx \&Ft . .Ss \&Fo Begin a function block. This is a multi-line version of .Sx \&Fn . Its syntax is as follows: .Pp .D1 Pf \. Sx \&Fo Ar funcname .Pp Invocations usually occur in the following context: .Bd -ragged -offset indent .Pf \. Sx \&Ft Ar functype .br .Pf \. Sx \&Fo Ar funcname .br .Pf \. Sx \&Fa Qq Ar argtype Ar argname .br \&.\.\. .br .Pf \. Sx \&Fc .Ed .Pp A .Sx \&Fo scope is closed by .Sx \&Fc . .Pp See also .Sx MANUAL STRUCTURE , .Sx \&Fa , .Sx \&Fc , and .Sx \&Ft . .Ss \&Fr This macro is obsolete. No replacement markup is needed. .Pp It was used to show numerical function return values in an italic font. .Ss \&Ft A function type. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Ft Ar functype .Pp In the .Em SYNOPSIS section, a new output line is started after this macro. .Pp Examples: .Dl \&.Ft int .Bd -literal -offset indent -compact \&.Ft functype \&.Fn funcname .Ed .Pp See also .Sx MANUAL STRUCTURE , .Sx \&Fn , and .Sx \&Fo . .Ss \&Fx Format the .Fx version provided as an argument, or a default value if no argument is provided. .Pp Examples: .Dl \&.Fx 7.1 .Dl \&.Fx .Pp See also .Sx \&At , .Sx \&Bsx , .Sx \&Bx , .Sx \&Dx , .Sx \&Nx , and .Sx \&Ox . .Ss \&Hf This macro is not implemented in .Xr mandoc 1 . .Pp It was used to include the contents of a (header) file literally. The syntax was: .Pp .Dl Pf . Sx \&Hf Ar filename .Ss \&Ic Designate an internal or interactive command. This is similar to .Sx \&Cm but used for instructions rather than values. .Pp Examples: .Dl \&.Ic :wq .Dl \&.Ic hash .Dl \&.Ic alias .Pp Note that using .Sx \&Bd Fl literal or .Sx \&D1 is preferred for displaying code; the .Sx \&Ic macro is used when referring to specific instructions. .Ss \&In An .Dq include file. When invoked as the first macro on an input line in the .Em SYNOPSIS section, the argument is displayed in angle brackets and preceded by .Dq #include , and a blank line is inserted in front if there is a preceding function declaration. This is most often used in section 2, 3, and 9 manual pages. .Pp Examples: .Dl \&.In sys/types.h .Pp See also .Sx MANUAL STRUCTURE . .Ss \&It A list item. The syntax of this macro depends on the list type. .Pp Lists of type .Fl hang , .Fl ohang , .Fl inset , and .Fl diag have the following syntax: .Pp .D1 Pf \. Sx \&It Ar args .Pp Lists of type .Fl bullet , .Fl dash , .Fl enum , .Fl hyphen and .Fl item have the following syntax: .Pp .D1 Pf \. Sx \&It .Pp with subsequent lines interpreted within the scope of the .Sx \&It until either a closing .Sx \&El or another .Sx \&It . .Pp The .Fl tag list has the following syntax: .Pp .D1 Pf \. Sx \&It Op Cm args .Pp Subsequent lines are interpreted as with .Fl bullet and family. The line arguments correspond to the list's left-hand side; body arguments correspond to the list's contents. .Pp The .Fl column list is the most complicated. Its syntax is as follows: .Pp .D1 Pf \. Sx \&It Ar cell Op Ar cell ... .D1 Pf \. Sx \&It Ar cell Op Sx \&Ta Ar cell ... .Pp The arguments consist of one or more lines of text and macros representing a complete table line. Cells within the line are delimited by tabs or by the special .Sx \&Ta block macro. The tab cell delimiter may only be used within the .Sx \&It line itself; on following lines, only the .Sx \&Ta macro can be used to delimit cells, and .Sx \&Ta is only recognised as a macro when called by other macros, not as the first macro on a line. .Pp Note that quoted strings may span tab-delimited cells on an .Sx \&It line. For example, .Pp .Dl .It \(dqcol1 ; col2 ;\(dq \&; .Pp will preserve the semicolon whitespace except for the last. .Pp See also .Sx \&Bl . .Ss \&Lb Specify a library. The syntax is as follows: .Pp .D1 Pf \. Sx \&Lb Ar library .Pp The .Ar library parameter may be a system library, such as .Cm libz or .Cm libpam , in which case a small library description is printed next to the linker invocation; or a custom library, in which case the library name is printed in quotes. This is most commonly used in the .Em SYNOPSIS section as described in .Sx MANUAL STRUCTURE . .Pp Examples: .Dl \&.Lb libz .Dl \&.Lb libmandoc .Ss \&Li Denotes text that should be in a .Li literal font mode. Note that this is a presentation term and should not be used for stylistically decorating technical terms. .Pp On terminal output devices, this is often indistinguishable from normal text. .Pp See also .Sx \&Bf , .Sx \&Em , .Sx \&No , and .Sx \&Sy . .Ss \&Lk Format a hyperlink. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Lk Ar uri Op Ar name .Pp Examples: .Dl \&.Lk http://bsd.lv \(dqThe BSD.lv Project\(dq .Dl \&.Lk http://bsd.lv .Pp See also .Sx \&Mt . .Ss \&Lp Synonym for .Sx \&Pp . .Ss \&Ms Display a mathematical symbol. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Ms Ar symbol .Pp Examples: .Dl \&.Ms sigma .Dl \&.Ms aleph .Ss \&Mt Format a .Dq mailto: hyperlink. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Mt Ar address .Pp Examples: .Dl \&.Mt discuss@manpages.bsd.lv .Dl \&.An Kristaps Dzonsons \&Aq \&Mt kristaps@bsd.lv .Ss \&Nd A one line description of the manual's content. This may only be invoked in the .Em SYNOPSIS section subsequent the .Sx \&Nm macro. .Pp Examples: .Dl Pf . Sx \&Nd mdoc language reference .Dl Pf . Sx \&Nd format and display UNIX manuals .Pp The .Sx \&Nd macro technically accepts child macros and terminates with a subsequent .Sx \&Sh invocation. Do not assume this behaviour: some .Xr whatis 1 database generators are not smart enough to parse more than the line arguments and will display macros verbatim. .Pp See also .Sx \&Nm . .Ss \&Nm The name of the manual page, or \(em in particular in section 1, 6, and 8 pages \(em of an additional command or feature documented in the manual page. When first invoked, the .Sx \&Nm macro expects a single argument, the name of the manual page. Usually, the first invocation happens in the .Em NAME section of the page. The specified name will be remembered and used whenever the macro is called again without arguments later in the page. The .Sx \&Nm macro uses .Sx Block full-implicit semantics when invoked as the first macro on an input line in the .Em SYNOPSIS section; otherwise, it uses ordinary .Sx In-line semantics. .Pp Examples: .Bd -literal -offset indent \&.Sh SYNOPSIS \&.Nm cat \&.Op Fl benstuv \&.Op Ar .Ed .Pp In the .Em SYNOPSIS of section 2, 3 and 9 manual pages, use the .Sx \&Fn macro rather than .Sx \&Nm to mark up the name of the manual page. .Ss \&No Normal text. Closes the scope of any preceding in-line macro. When used after physical formatting macros like .Sx \&Em or .Sx \&Sy , switches back to the standard font face and weight. Can also be used to embed plain text strings in macro lines using semantic annotation macros. .Pp Examples: .Dl ".Em italic , Sy bold , No and roman" .Pp .Bd -literal -offset indent -compact \&.Sm off \&.Cm :C No / Ar pattern No / Ar replacement No / \&.Sm on .Ed .Pp See also .Sx \&Em , .Sx \&Li , and .Sx \&Sy . .Ss \&Ns Suppress a space between the output of the preceding macro and the following text or macro. Following invocation, input is interpreted as normal text just like after an .Sx \&No macro. .Pp This has no effect when invoked at the start of a macro line. .Pp Examples: .Dl ".Ar name Ns = Ns Ar value" .Dl ".Cm :M Ns Ar pattern" .Dl ".Fl o Ns Ar output" .Pp See also .Sx \&No and .Sx \&Sm . .Ss \&Nx Format the .Nx version provided as an argument, or a default value if no argument is provided. .Pp Examples: .Dl \&.Nx 5.01 .Dl \&.Nx .Pp See also .Sx \&At , .Sx \&Bsx , .Sx \&Bx , .Sx \&Dx , .Sx \&Fx , and .Sx \&Ox . .Ss \&Oc Close multi-line .Sx \&Oo context. .Ss \&Oo Multi-line version of .Sx \&Op . .Pp Examples: .Bd -literal -offset indent -compact \&.Oo \&.Op Fl flag Ns Ar value \&.Oc .Ed .Ss \&Op Optional part of a command line. Prints the argument(s) in brackets. This is most often used in the .Em SYNOPSIS section of section 1 and 8 manual pages. .Pp Examples: .Dl \&.Op \&Fl a \&Ar b .Dl \&.Op \&Ar a | b .Pp See also .Sx \&Oo . .Ss \&Os Operating system version for display in the page footer. This is the mandatory third macro of any .Nm file. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Os Op Ar system Op Ar version .Pp The optional .Ar system parameter specifies the relevant operating system or environment. Left unspecified, it defaults to the local operating system version. This is the suggested form. .Pp Examples: .Dl \&.Os .Dl \&.Os KTH/CSC/TCS .Dl \&.Os BSD 4.3 .Pp See also .Sx \&Dd and .Sx \&Dt . .Ss \&Ot This macro is obsolete. Use .Sx \&Ft instead; with .Xr mandoc 1 , both have the same effect. .Pp Historical .Nm packages described it as .Dq "old function type (FORTRAN)" . .Ss \&Ox Format the .Ox version provided as an argument, or a default value if no argument is provided. .Pp Examples: .Dl \&.Ox 4.5 .Dl \&.Ox .Pp See also .Sx \&At , .Sx \&Bsx , .Sx \&Bx , .Sx \&Dx , .Sx \&Fx , and .Sx \&Nx . .Ss \&Pa An absolute or relative file system path, or a file or directory name. If an argument is not provided, the character .Sq \(ti is used as a default. .Pp Examples: .Dl \&.Pa /usr/bin/mandoc .Dl \&.Pa /usr/share/man/man7/mdoc.7 .Pp See also .Sx \&Lk . .Ss \&Pc Close parenthesised context opened by .Sx \&Po . .Ss \&Pf Removes the space between its argument .Pq Dq prefix and the following macro. Its syntax is as follows: .Pp .D1 .Pf Ar prefix macro arguments ... .Pp This is equivalent to: .Pp .D1 .No Ar prefix No \&Ns Ar macro arguments ... .Pp Examples: .Dl ".Pf $ Ar variable_name" .Dl ".Pf 0x Ar hex_digits" .Pp See also .Sx \&Ns and .Sx \&Sm . .Ss \&Po Multi-line version of .Sx \&Pq . .Ss \&Pp Break a paragraph. This will assert vertical space between prior and subsequent macros and/or text. .Pp Paragraph breaks are not needed before or after .Sx \&Sh or .Sx \&Ss macros or before displays .Pq Sx \&Bd or lists .Pq Sx \&Bl unless the .Fl compact flag is given. .Ss \&Pq Parenthesised enclosure. .Pp See also .Sx \&Po . .Ss \&Qc Close quoted context opened by .Sx \&Qo . .Ss \&Ql Format a single-quoted literal. See also .Sx \&Qq and .Sx \&Sq . .Ss \&Qo Multi-line version of .Sx \&Qq . .Ss \&Qq Encloses its arguments in .Qq typewriter double-quotes. Consider using .Sx \&Dq . .Pp See also .Sx \&Dq , .Sx \&Sq , and .Sx \&Qo . .Ss \&Re Close an .Sx \&Rs block. Does not have any tail arguments. .Ss \&Rs Begin a bibliographic .Pq Dq reference block. Does not have any head arguments. The block macro may only contain .Sx \&%A , .Sx \&%B , .Sx \&%C , .Sx \&%D , .Sx \&%I , .Sx \&%J , .Sx \&%N , .Sx \&%O , .Sx \&%P , .Sx \&%Q , .Sx \&%R , .Sx \&%T , .Sx \&%U , and .Sx \&%V child macros (at least one must be specified). .Pp Examples: .Bd -literal -offset indent -compact \&.Rs \&.%A J. E. Hopcroft \&.%A J. D. Ullman \&.%B Introduction to Automata Theory, Languages, and Computation \&.%I Addison-Wesley \&.%C Reading, Massachusettes \&.%D 1979 \&.Re .Ed .Pp If an .Sx \&Rs block is used within a SEE ALSO section, a vertical space is asserted before the rendered output, else the block continues on the current line. .Ss \&Rv Insert a standard sentence regarding a function call's return value of 0 on success and \-1 on error, with the .Va errno libc global variable set on error. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Rv Fl std Op Ar function ... .Pp If .Ar function is not specified, the document's name set by .Sx \&Nm is used. Multiple .Ar function arguments are treated as separate functions. .Pp See also .Sx \&Ex . .Ss \&Sc Close single-quoted context opened by .Sx \&So . .Ss \&Sh Begin a new section. For a list of conventional manual sections, see .Sx MANUAL STRUCTURE . These sections should be used unless it's absolutely necessary that custom sections be used. .Pp Section names should be unique so that they may be keyed by .Sx \&Sx . Although this macro is parsed, it should not consist of child node or it may not be linked with .Sx \&Sx . .Pp See also .Sx \&Pp , .Sx \&Ss , and .Sx \&Sx . .Ss \&Sm Switches the spacing mode for output generated from macros. Its syntax is as follows: .Pp .D1 Pf \. Sx \&Sm Op Cm on | off .Pp By default, spacing is .Cm on . When switched .Cm off , no white space is inserted between macro arguments and between the output generated from adjacent macros, but text lines still get normal spacing between words and sentences. .Pp When called without an argument, the .Sx \&Sm macro toggles the spacing mode. Using this is not recommended because it makes the code harder to read. .Ss \&So Multi-line version of .Sx \&Sq . .Ss \&Sq Encloses its arguments in .Sq typewriter single-quotes. .Pp See also .Sx \&Dq , .Sx \&Qq , and .Sx \&So . .Ss \&Ss Begin a new subsection. Unlike with .Sx \&Sh , there is no convention for the naming of subsections. Except .Em DESCRIPTION , the conventional sections described in .Sx MANUAL STRUCTURE rarely have subsections. .Pp Sub-section names should be unique so that they may be keyed by .Sx \&Sx . Although this macro is parsed, it should not consist of child node or it may not be linked with .Sx \&Sx . .Pp See also .Sx \&Pp , .Sx \&Sh , and .Sx \&Sx . .Ss \&St Replace an abbreviation for a standard with the full form. The following standards are recognised. Where multiple lines are given without a blank line in between, they all refer to the same standard, and using the first form is recommended. .Bl -tag -width 1n .It C language standards .Pp .Bl -tag -width "-p1003.1g-2000" -compact .It \-ansiC .St -ansiC .It \-ansiC-89 .St -ansiC-89 .It \-isoC .St -isoC .It \-isoC-90 .St -isoC-90 .br The original C standard. .Pp .It \-isoC-amd1 .St -isoC-amd1 .Pp .It \-isoC-tcor1 .St -isoC-tcor1 .Pp .It \-isoC-tcor2 .St -isoC-tcor2 .Pp .It \-isoC-99 .St -isoC-99 -.It \-ansiC-99 -.St -ansiC-99 .br The second major version of the C language standard. .Pp .It \-isoC-2011 .St -isoC-2011 .br The third major version of the C language standard. .El .It POSIX.1 before the Single UNIX Specification .Pp .Bl -tag -width "-p1003.1g-2000" -compact .It \-p1003.1-88 .St -p1003.1-88 .It \-p1003.1 .St -p1003.1 .br The original POSIX standard, based on ANSI C. .Pp .It \-p1003.1-90 .St -p1003.1-90 .It \-iso9945-1-90 .St -iso9945-1-90 .br The first update of POSIX.1. .Pp .It \-p1003.1b-93 .St -p1003.1b-93 .It \-p1003.1b .St -p1003.1b .br Real-time extensions. .Pp .It \-p1003.1c-95 .St -p1003.1c-95 .br POSIX thread interfaces. .Pp .It \-p1003.1i-95 .St -p1003.1i-95 .br Technical Corrigendum. .Pp .It \-p1003.1-96 .St -p1003.1-96 .It \-iso9945-1-96 .St -iso9945-1-96 .br Includes POSIX.1-1990, 1b, 1c, and 1i. .El .It X/Open Portability Guide version 4 and related standards .Pp .Bl -tag -width "-p1003.1g-2000" -compact .It \-xpg3 .St -xpg3 .br An XPG4 precursor, published in 1989. .Pp .It \-p1003.2 .St -p1003.2 .It \-p1003.2-92 .St -p1003.2-92 .It \-iso9945-2-93 .St -iso9945-2-93 .br An XCU4 precursor. .Pp .It \-p1003.2a-92 .St -p1003.2a-92 .br Updates to POSIX.2. .Pp .It \-xpg4 .St -xpg4 .br Based on POSIX.1 and POSIX.2, published in 1992. .El .It Single UNIX Specification version 1 and related standards .Pp .Bl -tag -width "-p1003.1g-2000" -compact .It \-susv1 .St -susv1 .It \-xpg4.2 .St -xpg4.2 .br This standard was published in 1994. It was used as the basis for UNIX 95 certification. The following three refer to parts of it. .Pp .It \-xsh4.2 .St -xsh4.2 .Pp .It \-xcurses4.2 .St -xcurses4.2 .Pp .It \-p1003.1g-2000 .St -p1003.1g-2000 .br Networking APIs, including sockets. .Pp -.It \-xpg4.3 -.St -xpg4.3 -.Pp .It \-svid4 .St -svid4 , .br Published in 1995. .El .It Single UNIX Specification version 2 and related standards .Pp .Bl -tag -width "-p1003.1g-2000" -compact .It \-susv2 .St -susv2 This Standard was published in 1997 and is also called X/Open Portability Guide version 5. It was used as the basis for UNIX 98 certification. The following refer to parts of it. .Pp .It \-xbd5 .St -xbd5 .Pp .It \-xsh5 .St -xsh5 .Pp .It \-xcu5 .St -xcu5 .Pp .It \-xns5 .St -xns5 .It \-xns5.2 .St -xns5.2 .El -.It Single UNIX Specification version 3 and related standards +.It Single UNIX Specification version 3 .Pp -.Bl -tag -width "-p1003.1g-2000X" -compact -.It \-p1003.1d-99 -.St -p1003.1d-99 -.br -Additional real-time extensions. -.Pp +.Bl -tag -width "-p1003.1-2001" -compact .It \-p1003.1-2001 .St -p1003.1-2001 .It \-susv3 .St -susv3 .br This standard is based on C99, SUSv2, POSIX.1-1996, 1d, and 1j. It is also called X/Open Portability Guide version 6. It is used as the basis for UNIX 03 certification. .Pp .It \-p1003.1-2004 .St -p1003.1-2004 .br The second and last Technical Corrigendum. .El .It Single UNIX Specification version 4 .Pp .Bl -tag -width "-p1003.1g-2000" -compact .It \-p1003.1-2008 .St -p1003.1-2008 .It \-susv4 .St -susv4 .br This standard is also called X/Open Portability Guide version 7. .Pp .It \-p1003.1-2013 .St -p1003.1-2013 .br This is the first Technical Corrigendum. .El .It Other standards .Pp .Bl -tag -width "-p1003.1g-2000" -compact .It \-ieee754 .St -ieee754 .br Floating-point arithmetic. .Pp .It \-iso8601 .St -iso8601 .br Representation of dates and times, published in 1988. .Pp .It \-iso8802-3 .St -iso8802-3 .br Ethernet local area networks. .Pp .It \-ieee1275-94 .St -ieee1275-94 .El .El .Ss \&Sx Reference a section or subsection in the same manual page. The referenced section or subsection name must be identical to the enclosed argument, including whitespace. .Pp Examples: .Dl \&.Sx MANUAL STRUCTURE .Pp See also .Sx \&Sh and .Sx \&Ss . .Ss \&Sy Request a boldface font. .Pp This is most often used to indicate importance or seriousness (not to be confused with stress emphasis, see .Sx \&Em ) . When none of the semantic macros fit, it is also adequate for syntax elements that have to be given or that appear verbatim. .Pp Examples: .Bd -literal -compact -offset indent \&.Sy Warning : If \&.Sy s appears in the owner permissions, set-user-ID mode is set. This utility replaces the former \&.Sy dumpdir program. .Ed .Pp See also .Sx \&Bf , .Sx \&Em , .Sx \&Li , and .Sx \&No . .Ss \&Ta Table cell separator in .Sx \&Bl Fl column lists; can only be used below .Sx \&It . .Ss \&Tn Supported only for compatibility, do not use this in new manuals. Even though the macro name .Pq Dq tradename suggests a semantic function, historic usage is inconsistent, mostly using it as a presentation-level macro to request a small caps font. .Ss \&Ud Supported only for compatibility, do not use this in new manuals. Prints out .Dq currently under development. .Ss \&Ux Supported only for compatibility, do not use this in new manuals. Prints out .Dq Ux . .Ss \&Va A variable name. .Pp Examples: .Dl \&.Va foo .Dl \&.Va const char *bar ; .Pp For function arguments and parameters, use .Sx \&Fa instead. For declarations of global variables in the .Em SYNOPSIS section, use .Sx \&Vt . .Ss \&Vt A variable type. .Pp This is also used for indicating global variables in the .Em SYNOPSIS section, in which case a variable name is also specified. Note that it accepts .Sx Block partial-implicit syntax when invoked as the first macro on an input line in the .Em SYNOPSIS section, else it accepts ordinary .Sx In-line syntax. In the former case, this macro starts a new output line, and a blank line is inserted in front if there is a preceding function definition or include directive. .Pp Examples: .Dl \&.Vt unsigned char .Dl \&.Vt extern const char * const sys_signame[] \&; .Pp For parameters in function prototypes, use .Sx \&Fa instead, for function return types .Sx \&Ft , and for variable names outside the .Em SYNOPSIS section .Sx \&Va , even when including a type with the name. See also .Sx MANUAL STRUCTURE . .Ss \&Xc Close a scope opened by .Sx \&Xo . .Ss \&Xo Extend the header of an .Sx \&It macro or the body of a partial-implicit block macro beyond the end of the input line. This macro originally existed to work around the 9-argument limit of historic .Xr roff 7 . .Ss \&Xr Link to another manual .Pq Qq cross-reference . Its syntax is as follows: .Pp .D1 Pf \. Sx \&Xr Ar name Op section .Pp Cross reference the .Ar name and .Ar section number of another man page; omitting the section number is rarely useful. .Pp Examples: .Dl \&.Xr mandoc 1 .Dl \&.Xr mandoc 1 \&; .Dl \&.Xr mandoc 1 \&Ns s behaviour .Ss \&br Emits a line-break. This macro should not be used; it is implemented for compatibility with historical manuals. .Pp Consider using .Sx \&Pp in the event of natural paragraph breaks. .Ss \&sp Emits vertical space. This macro should not be used; it is implemented for compatibility with historical manuals. Its syntax is as follows: .Pp .D1 Pf \. Sx \&sp Op Ar height .Pp The .Ar height argument is a scaling width as described in .Xr roff 7 . If unspecified, .Sx \&sp asserts a single vertical space. .Sh MACRO SYNTAX The syntax of a macro depends on its classification. In this section, .Sq \-arg refers to macro arguments, which may be followed by zero or more .Sq parm parameters; .Sq \&Yo opens the scope of a macro; and if specified, .Sq \&Yc closes it out. .Pp The .Em Callable column indicates that the macro may also be called by passing its name as an argument to another macro. For example, .Sq \&.Op \&Fl O \&Ar file produces .Sq Op Fl O Ar file . To prevent a macro call and render the macro name literally, escape it by prepending a zero-width space, .Sq \e& . For example, .Sq \&Op \e&Fl O produces .Sq Op \&Fl O . If a macro is not callable but its name appears as an argument to another macro, it is interpreted as opaque text. For example, .Sq \&.Fl \&Sh produces .Sq Fl \&Sh . .Pp The .Em Parsed column indicates whether the macro may call other macros by receiving their names as arguments. If a macro is not parsed but the name of another macro appears as an argument, it is interpreted as opaque text. .Pp The .Em Scope column, if applicable, describes closure rules. .Ss Block full-explicit Multi-line scope closed by an explicit closing macro. All macros contains bodies; only .Sx \&Bf and .Pq optionally .Sx \&Bl contain a head. .Bd -literal -offset indent \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \(lBbody...\(rB \&.Yc .Ed .Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXX" -offset indent .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope .It Sx \&Bd Ta \&No Ta \&No Ta closed by Sx \&Ed .It Sx \&Bf Ta \&No Ta \&No Ta closed by Sx \&Ef .It Sx \&Bk Ta \&No Ta \&No Ta closed by Sx \&Ek .It Sx \&Bl Ta \&No Ta \&No Ta closed by Sx \&El .It Sx \&Ed Ta \&No Ta \&No Ta opened by Sx \&Bd .It Sx \&Ef Ta \&No Ta \&No Ta opened by Sx \&Bf .It Sx \&Ek Ta \&No Ta \&No Ta opened by Sx \&Bk .It Sx \&El Ta \&No Ta \&No Ta opened by Sx \&Bl .El .Ss Block full-implicit Multi-line scope closed by end-of-file or implicitly by another macro. All macros have bodies; some .Po .Sx \&It Fl bullet , .Fl hyphen , .Fl dash , .Fl enum , .Fl item .Pc don't have heads; only one .Po .Sx \&It in .Sx \&Bl Fl column .Pc has multiple heads. .Bd -literal -offset indent \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead... \(lBTa head...\(rB\(rB \(lBbody...\(rB .Ed .Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXXXXXXXXX" -offset indent .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope .It Sx \&It Ta \&No Ta Yes Ta closed by Sx \&It , Sx \&El .It Sx \&Nd Ta \&No Ta \&No Ta closed by Sx \&Sh .It Sx \&Nm Ta \&No Ta Yes Ta closed by Sx \&Nm , Sx \&Sh , Sx \&Ss .It Sx \&Sh Ta \&No Ta Yes Ta closed by Sx \&Sh .It Sx \&Ss Ta \&No Ta Yes Ta closed by Sx \&Sh , Sx \&Ss .El .Pp Note that the .Sx \&Nm macro is a .Sx Block full-implicit macro only when invoked as the first macro in a .Em SYNOPSIS section line, else it is .Sx In-line . .Ss Block partial-explicit Like block full-explicit, but also with single-line scope. Each has at least a body and, in limited circumstances, a head .Po .Sx \&Fo , .Sx \&Eo .Pc and/or tail .Pq Sx \&Ec . .Bd -literal -offset indent \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \(lBbody...\(rB \&.Yc \(lBtail...\(rB \&.Yo \(lB\-arg \(lBparm...\(rB\(rB \(lBhead...\(rB \ \(lBbody...\(rB \&Yc \(lBtail...\(rB .Ed .Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXX" -offset indent .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope .It Sx \&Ac Ta Yes Ta Yes Ta opened by Sx \&Ao .It Sx \&Ao Ta Yes Ta Yes Ta closed by Sx \&Ac .It Sx \&Bc Ta Yes Ta Yes Ta closed by Sx \&Bo .It Sx \&Bo Ta Yes Ta Yes Ta opened by Sx \&Bc .It Sx \&Brc Ta Yes Ta Yes Ta opened by Sx \&Bro .It Sx \&Bro Ta Yes Ta Yes Ta closed by Sx \&Brc .It Sx \&Dc Ta Yes Ta Yes Ta opened by Sx \&Do .It Sx \&Do Ta Yes Ta Yes Ta closed by Sx \&Dc .It Sx \&Ec Ta Yes Ta Yes Ta opened by Sx \&Eo .It Sx \&Eo Ta Yes Ta Yes Ta closed by Sx \&Ec .It Sx \&Fc Ta Yes Ta Yes Ta opened by Sx \&Fo .It Sx \&Fo Ta \&No Ta \&No Ta closed by Sx \&Fc .It Sx \&Oc Ta Yes Ta Yes Ta closed by Sx \&Oo .It Sx \&Oo Ta Yes Ta Yes Ta opened by Sx \&Oc .It Sx \&Pc Ta Yes Ta Yes Ta closed by Sx \&Po .It Sx \&Po Ta Yes Ta Yes Ta opened by Sx \&Pc .It Sx \&Qc Ta Yes Ta Yes Ta opened by Sx \&Oo .It Sx \&Qo Ta Yes Ta Yes Ta closed by Sx \&Oc .It Sx \&Re Ta \&No Ta \&No Ta opened by Sx \&Rs .It Sx \&Rs Ta \&No Ta \&No Ta closed by Sx \&Re .It Sx \&Sc Ta Yes Ta Yes Ta opened by Sx \&So .It Sx \&So Ta Yes Ta Yes Ta closed by Sx \&Sc .It Sx \&Xc Ta Yes Ta Yes Ta opened by Sx \&Xo .It Sx \&Xo Ta Yes Ta Yes Ta closed by Sx \&Xc .El .Ss Block partial-implicit Like block full-implicit, but with single-line scope closed by the end of the line. .Bd -literal -offset indent \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBbody...\(rB \(lBres...\(rB .Ed .Bl -column "MacroX" "CallableX" "ParsedX" -offset indent .It Em Macro Ta Em Callable Ta Em Parsed .It Sx \&Aq Ta Yes Ta Yes .It Sx \&Bq Ta Yes Ta Yes .It Sx \&Brq Ta Yes Ta Yes .It Sx \&D1 Ta \&No Ta \&Yes .It Sx \&Dl Ta \&No Ta Yes .It Sx \&Dq Ta Yes Ta Yes .It Sx \&En Ta Yes Ta Yes .It Sx \&Op Ta Yes Ta Yes .It Sx \&Pq Ta Yes Ta Yes .It Sx \&Ql Ta Yes Ta Yes .It Sx \&Qq Ta Yes Ta Yes .It Sx \&Sq Ta Yes Ta Yes .It Sx \&Vt Ta Yes Ta Yes .El .Pp Note that the .Sx \&Vt macro is a .Sx Block partial-implicit only when invoked as the first macro in a .Em SYNOPSIS section line, else it is .Sx In-line . .Ss Special block macro The .Sx \&Ta macro can only be used below .Sx \&It in .Sx \&Bl Fl column lists. It delimits blocks representing table cells; these blocks have bodies, but no heads. .Bl -column "MacroX" "CallableX" "ParsedX" "closed by XXXX" -offset indent .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Scope .It Sx \&Ta Ta Yes Ta Yes Ta closed by Sx \&Ta , Sx \&It .El .Ss In-line Closed by the end of the line, fixed argument lengths, and/or subsequent macros. In-line macros have only text children. If a number (or inequality) of arguments is .Pq n , then the macro accepts an arbitrary number of arguments. .Bd -literal -offset indent \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB \(lBres...\(rB \&.Yo \(lB\-arg \(lBval...\(rB\(rB \(lBargs...\(rB Yc... \&.Yo \(lB\-arg \(lBval...\(rB\(rB arg0 arg1 argN .Ed .Bl -column "MacroX" "CallableX" "ParsedX" "Arguments" -offset indent .It Em Macro Ta Em Callable Ta Em Parsed Ta Em Arguments .It Sx \&%A Ta \&No Ta \&No Ta >0 .It Sx \&%B Ta \&No Ta \&No Ta >0 .It Sx \&%C Ta \&No Ta \&No Ta >0 .It Sx \&%D Ta \&No Ta \&No Ta >0 .It Sx \&%I Ta \&No Ta \&No Ta >0 .It Sx \&%J Ta \&No Ta \&No Ta >0 .It Sx \&%N Ta \&No Ta \&No Ta >0 .It Sx \&%O Ta \&No Ta \&No Ta >0 .It Sx \&%P Ta \&No Ta \&No Ta >0 .It Sx \&%Q Ta \&No Ta \&No Ta >0 .It Sx \&%R Ta \&No Ta \&No Ta >0 .It Sx \&%T Ta \&No Ta \&No Ta >0 .It Sx \&%U Ta \&No Ta \&No Ta >0 .It Sx \&%V Ta \&No Ta \&No Ta >0 .It Sx \&Ad Ta Yes Ta Yes Ta >0 .It Sx \&An Ta Yes Ta Yes Ta >0 .It Sx \&Ap Ta Yes Ta Yes Ta 0 .It Sx \&Ar Ta Yes Ta Yes Ta n .It Sx \&At Ta Yes Ta Yes Ta 1 .It Sx \&Bsx Ta Yes Ta Yes Ta n .It Sx \&Bt Ta \&No Ta \&No Ta 0 .It Sx \&Bx Ta Yes Ta Yes Ta n .It Sx \&Cd Ta Yes Ta Yes Ta >0 .It Sx \&Cm Ta Yes Ta Yes Ta >0 .It Sx \&Db Ta \&No Ta \&No Ta 1 .It Sx \&Dd Ta \&No Ta \&No Ta n .It Sx \&Dt Ta \&No Ta \&No Ta n .It Sx \&Dv Ta Yes Ta Yes Ta >0 .It Sx \&Dx Ta Yes Ta Yes Ta n .It Sx \&Em Ta Yes Ta Yes Ta >0 .It Sx \&Er Ta Yes Ta Yes Ta >0 .It Sx \&Es Ta Yes Ta Yes Ta 2 .It Sx \&Ev Ta Yes Ta Yes Ta >0 .It Sx \&Ex Ta \&No Ta \&No Ta n .It Sx \&Fa Ta Yes Ta Yes Ta >0 .It Sx \&Fd Ta \&No Ta \&No Ta >0 .It Sx \&Fl Ta Yes Ta Yes Ta n .It Sx \&Fn Ta Yes Ta Yes Ta >0 .It Sx \&Fr Ta Yes Ta Yes Ta >0 .It Sx \&Ft Ta Yes Ta Yes Ta >0 .It Sx \&Fx Ta Yes Ta Yes Ta n .It Sx \&Hf Ta \&No Ta \&No Ta n .It Sx \&Ic Ta Yes Ta Yes Ta >0 .It Sx \&In Ta \&No Ta \&No Ta 1 .It Sx \&Lb Ta \&No Ta \&No Ta 1 .It Sx \&Li Ta Yes Ta Yes Ta >0 .It Sx \&Lk Ta Yes Ta Yes Ta >0 .It Sx \&Lp Ta \&No Ta \&No Ta 0 .It Sx \&Ms Ta Yes Ta Yes Ta >0 .It Sx \&Mt Ta Yes Ta Yes Ta >0 .It Sx \&Nm Ta Yes Ta Yes Ta n .It Sx \&No Ta Yes Ta Yes Ta 0 .It Sx \&Ns Ta Yes Ta Yes Ta 0 .It Sx \&Nx Ta Yes Ta Yes Ta n .It Sx \&Os Ta \&No Ta \&No Ta n .It Sx \&Ot Ta Yes Ta Yes Ta >0 .It Sx \&Ox Ta Yes Ta Yes Ta n .It Sx \&Pa Ta Yes Ta Yes Ta n .It Sx \&Pf Ta Yes Ta Yes Ta 1 .It Sx \&Pp Ta \&No Ta \&No Ta 0 .It Sx \&Rv Ta \&No Ta \&No Ta n .It Sx \&Sm Ta \&No Ta \&No Ta <2 .It Sx \&St Ta \&No Ta Yes Ta 1 .It Sx \&Sx Ta Yes Ta Yes Ta >0 .It Sx \&Sy Ta Yes Ta Yes Ta >0 .It Sx \&Tn Ta Yes Ta Yes Ta >0 .It Sx \&Ud Ta \&No Ta \&No Ta 0 .It Sx \&Ux Ta Yes Ta Yes Ta n .It Sx \&Va Ta Yes Ta Yes Ta n .It Sx \&Vt Ta Yes Ta Yes Ta >0 .It Sx \&Xr Ta Yes Ta Yes Ta >0 .It Sx \&br Ta \&No Ta \&No Ta 0 .It Sx \&sp Ta \&No Ta \&No Ta 1 .El .Ss Delimiters When a macro argument consists of one single input character considered as a delimiter, the argument gets special handling. This does not apply when delimiters appear in arguments containing more than one character. Consequently, to prevent special handling and just handle it like any other argument, a delimiter can be escaped by prepending a zero-width space .Pq Sq \e& . In text lines, delimiters never need escaping, but may be used as normal punctuation. .Pp For many macros, when the leading arguments are opening delimiters, these delimiters are put before the macro scope, and when the trailing arguments are closing delimiters, these delimiters are put after the macro scope. For example, .Pp .D1 Pf \. \&Aq "( [ word ] ) ." .Pp renders as: .Pp .D1 Aq ( [ word ] ) . .Pp Opening delimiters are: .Pp .Bl -tag -width Ds -offset indent -compact .It \&( left parenthesis .It \&[ left bracket .El .Pp Closing delimiters are: .Pp .Bl -tag -width Ds -offset indent -compact .It \&. period .It \&, comma .It \&: colon .It \&; semicolon .It \&) right parenthesis .It \&] right bracket .It \&? question mark .It \&! exclamation mark .El .Pp Note that even a period preceded by a backslash .Pq Sq \e.\& gets this special handling; use .Sq \e&. to prevent that. .Pp Many in-line macros interrupt their scope when they encounter delimiters, and resume their scope when more arguments follow that are not delimiters. For example, .Pp .D1 Pf \. \&Fl "a ( b | c \e*(Ba d ) e" .Pp renders as: .Pp .D1 Fl a ( b | c \*(Ba d ) e .Pp This applies to both opening and closing delimiters, and also to the middle delimiter: .Pp .Bl -tag -width Ds -offset indent -compact .It \&| vertical bar .El .Pp As a special case, the predefined string \e*(Ba is handled and rendered in the same way as a plain .Sq \&| character. Using this predefined string is not recommended in new manuals. .Ss Font handling In .Nm documents, usage of semantic markup is recommended in order to have proper fonts automatically selected; only when no fitting semantic markup is available, consider falling back to .Sx Physical markup macros. Whenever any .Nm macro switches the .Xr roff 7 font mode, it will automatically restore the previous font when exiting its scope. Manually switching the font using the .Xr roff 7 .Ql \ef font escape sequences is never required. .Sh COMPATIBILITY This section provides an incomplete list of compatibility issues between mandoc and other troff implementations, at this time limited to GNU troff .Pq Qq groff . The term .Qq historic groff refers to groff versions before 1.17, which featured a significant update of the .Pa doc.tmac file. .Pp Heirloom troff, the other significant troff implementation accepting \-mdoc, is similar to historic groff. .Pp The following problematic behaviour is found in groff: .ds hist (Historic groff only.) .Pp .Bl -dash -compact .It Display macros .Po .Sx \&Bd , .Sx \&Dl , and .Sx \&D1 .Pc may not be nested. \*[hist] .It .Sx \&At with unknown arguments produces no output at all. \*[hist] Newer groff and mandoc print .Qq AT&T UNIX and the arguments. .It .Sx \&Bl Fl column does not recognise trailing punctuation characters when they immediately precede tabulator characters, but treats them as normal text and outputs a space before them. .It .Sx \&Bd Fl ragged compact does not start a new line. \*[hist] .It .Sx \&Dd with non-standard arguments behaves very strangely. When there are three arguments, they are printed verbatim. Any other number of arguments is replaced by the current date, but without any arguments the string .Dq Epoch is printed. .It .Sx \&Fl does not print a dash for an empty argument. \*[hist] .It .Sx \&Fn does not start a new line unless invoked as the line macro in the .Em SYNOPSIS section. \*[hist] .It .Sx \&Fo with .Pf non- Sx \&Fa children causes inconsistent spacing between arguments. In mandoc, a single space is always inserted between arguments. .It .Sx \&Ft in the .Em SYNOPSIS causes inconsistent vertical spacing, depending on whether a prior .Sx \&Fn has been invoked. See .Sx \&Ft and .Sx \&Fn for the normalised behaviour in mandoc. .It .Sx \&In ignores additional arguments and is not treated specially in the .Em SYNOPSIS . \*[hist] .It .Sx \&It sometimes requires a .Fl nested flag. \*[hist] In new groff and mandoc, any list may be nested by default and .Fl enum lists will restart the sequence only for the sub-list. .It .Sx \&Li followed by a delimiter is incorrectly used in some manuals instead of properly quoting that character, which sometimes works with historic groff. .It .Sx \&Lk only accepts a single link-name argument; the remainder is misformatted. .It .Sx \&Pa does not format its arguments when used in the FILES section under certain list types. .It .Sx \&Ta can only be called by other macros, but not at the beginning of a line. .It .Sx \&%C is not implemented (up to and including groff-1.22.2). .It Historic groff only allows up to eight or nine arguments per macro input line, depending on the exact situation. Providing more arguments causes garbled output. The number of arguments on one input line is not limited with mandoc. .It Historic groff has many un-callable macros. Most of these (excluding some block-level macros) are callable in new groff and mandoc. .It .Sq \(ba (vertical bar) is not fully supported as a delimiter. \*[hist] .It .Sq \ef .Pq font face and .Sq \eF .Pq font family face .Sx Text Decoration escapes behave irregularly when specified within line-macro scopes. .It Negative scaling units return to prior lines. Instead, mandoc truncates them to zero. .El .Pp The following features are unimplemented in mandoc: .Pp .Bl -dash -compact .It .Sx \&Bd .Fl file Ar file . .It .Sx \&Bd .Fl offset Cm center and .Fl offset Cm right . Groff does not implement centred and flush-right rendering either, but produces large indentations. .El .Sh SEE ALSO .Xr man 1 , .Xr mandoc 1 , .Xr eqn 7 , .Xr man 7 , .Xr mandoc_char 7 , .Xr roff 7 , .Xr tbl 7 .Sh HISTORY The .Nm language first appeared as a troff macro package in .Bx 4.4 . It was later significantly updated by Werner Lemberg and Ruslan Ermilov in groff-1.17. The standalone implementation that is part of the .Xr mandoc 1 utility written by Kristaps Dzonsons appeared in .Ox 4.6 . .Sh AUTHORS The .Nm reference was written by .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv . Index: projects/arm_intrng/contrib/mdocml/mdoc.h =================================================================== --- projects/arm_intrng/contrib/mdocml/mdoc.h (revision 276247) +++ projects/arm_intrng/contrib/mdocml/mdoc.h (revision 276248) @@ -1,399 +1,395 @@ -/* $Id: mdoc.h,v 1.131 2014/07/29 13:58:18 schwarze Exp $ */ +/* $Id: mdoc.h,v 1.132 2014/12/01 04:05:32 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifndef MDOC_H -#define MDOC_H enum mdoct { MDOC_Ap = 0, MDOC_Dd, MDOC_Dt, MDOC_Os, MDOC_Sh, MDOC_Ss, MDOC_Pp, MDOC_D1, MDOC_Dl, MDOC_Bd, MDOC_Ed, MDOC_Bl, MDOC_El, MDOC_It, MDOC_Ad, MDOC_An, MDOC_Ar, MDOC_Cd, MDOC_Cm, MDOC_Dv, MDOC_Er, MDOC_Ev, MDOC_Ex, MDOC_Fa, MDOC_Fd, MDOC_Fl, MDOC_Fn, MDOC_Ft, MDOC_Ic, MDOC_In, MDOC_Li, MDOC_Nd, MDOC_Nm, MDOC_Op, MDOC_Ot, MDOC_Pa, MDOC_Rv, MDOC_St, MDOC_Va, MDOC_Vt, MDOC_Xr, MDOC__A, MDOC__B, MDOC__D, MDOC__I, MDOC__J, MDOC__N, MDOC__O, MDOC__P, MDOC__R, MDOC__T, MDOC__V, MDOC_Ac, MDOC_Ao, MDOC_Aq, MDOC_At, MDOC_Bc, MDOC_Bf, MDOC_Bo, MDOC_Bq, MDOC_Bsx, MDOC_Bx, MDOC_Db, MDOC_Dc, MDOC_Do, MDOC_Dq, MDOC_Ec, MDOC_Ef, MDOC_Em, MDOC_Eo, MDOC_Fx, MDOC_Ms, MDOC_No, MDOC_Ns, MDOC_Nx, MDOC_Ox, MDOC_Pc, MDOC_Pf, MDOC_Po, MDOC_Pq, MDOC_Qc, MDOC_Ql, MDOC_Qo, MDOC_Qq, MDOC_Re, MDOC_Rs, MDOC_Sc, MDOC_So, MDOC_Sq, MDOC_Sm, MDOC_Sx, MDOC_Sy, MDOC_Tn, MDOC_Ux, MDOC_Xc, MDOC_Xo, MDOC_Fo, MDOC_Fc, MDOC_Oo, MDOC_Oc, MDOC_Bk, MDOC_Ek, MDOC_Bt, MDOC_Hf, MDOC_Fr, MDOC_Ud, MDOC_Lb, MDOC_Lp, MDOC_Lk, MDOC_Mt, MDOC_Brq, MDOC_Bro, MDOC_Brc, MDOC__C, MDOC_Es, MDOC_En, MDOC_Dx, MDOC__Q, MDOC_br, MDOC_sp, MDOC__U, MDOC_Ta, MDOC_ll, MDOC_MAX }; enum mdocargt { MDOC_Split, /* -split */ MDOC_Nosplit, /* -nospli */ MDOC_Ragged, /* -ragged */ MDOC_Unfilled, /* -unfilled */ MDOC_Literal, /* -literal */ MDOC_File, /* -file */ MDOC_Offset, /* -offset */ MDOC_Bullet, /* -bullet */ MDOC_Dash, /* -dash */ MDOC_Hyphen, /* -hyphen */ MDOC_Item, /* -item */ MDOC_Enum, /* -enum */ MDOC_Tag, /* -tag */ MDOC_Diag, /* -diag */ MDOC_Hang, /* -hang */ MDOC_Ohang, /* -ohang */ MDOC_Inset, /* -inset */ MDOC_Column, /* -column */ MDOC_Width, /* -width */ MDOC_Compact, /* -compact */ MDOC_Std, /* -std */ MDOC_Filled, /* -filled */ MDOC_Words, /* -words */ MDOC_Emphasis, /* -emphasis */ MDOC_Symbolic, /* -symbolic */ MDOC_Nested, /* -nested */ MDOC_Centred, /* -centered */ MDOC_ARG_MAX }; enum mdoc_type { MDOC_TEXT, MDOC_ELEM, MDOC_HEAD, MDOC_TAIL, MDOC_BODY, MDOC_BLOCK, MDOC_TBL, MDOC_EQN, MDOC_ROOT }; /* * Section (named/unnamed) of `Sh'. Note that these appear in the * conventional order imposed by mdoc.7. In the case of SEC_NONE, no * section has been invoked (this shouldn't happen). SEC_CUSTOM refers * to other sections. */ enum mdoc_sec { SEC_NONE = 0, SEC_NAME, /* NAME */ SEC_LIBRARY, /* LIBRARY */ SEC_SYNOPSIS, /* SYNOPSIS */ SEC_DESCRIPTION, /* DESCRIPTION */ SEC_CONTEXT, /* CONTEXT */ SEC_IMPLEMENTATION, /* IMPLEMENTATION NOTES */ SEC_RETURN_VALUES, /* RETURN VALUES */ SEC_ENVIRONMENT, /* ENVIRONMENT */ SEC_FILES, /* FILES */ SEC_EXIT_STATUS, /* EXIT STATUS */ SEC_EXAMPLES, /* EXAMPLES */ SEC_DIAGNOSTICS, /* DIAGNOSTICS */ SEC_COMPATIBILITY, /* COMPATIBILITY */ SEC_ERRORS, /* ERRORS */ SEC_SEE_ALSO, /* SEE ALSO */ SEC_STANDARDS, /* STANDARDS */ SEC_HISTORY, /* HISTORY */ SEC_AUTHORS, /* AUTHORS */ SEC_CAVEATS, /* CAVEATS */ SEC_BUGS, /* BUGS */ SEC_SECURITY, /* SECURITY */ SEC_CUSTOM, SEC__MAX }; struct mdoc_meta { char *msec; /* `Dt' section (1, 3p, etc.) */ char *vol; /* `Dt' volume (implied) */ char *arch; /* `Dt' arch (i386, etc.) */ char *date; /* `Dd' normalised date */ char *title; /* `Dt' title (FOO, etc.) */ char *os; /* `Os' system (OpenBSD, etc.) */ char *name; /* leading `Nm' name */ }; /* * An argument to a macro (multiple values = `-column xxx yyy'). */ struct mdoc_argv { enum mdocargt arg; /* type of argument */ int line; int pos; size_t sz; /* elements in "value" */ char **value; /* argument strings */ }; /* * Reference-counted macro arguments. These are refcounted because * blocks have multiple instances of the same arguments spread across * the HEAD, BODY, TAIL, and BLOCK node types. */ struct mdoc_arg { size_t argc; struct mdoc_argv *argv; unsigned int refcnt; }; /* * Indicates that a BODY's formatting has ended, but the scope is still * open. Used for syntax-broken blocks. */ enum mdoc_endbody { ENDBODY_NOT = 0, ENDBODY_SPACE, /* is broken: append a space */ ENDBODY_NOSPACE /* is broken: don't append a space */ }; enum mdoc_list { LIST__NONE = 0, LIST_bullet, /* -bullet */ LIST_column, /* -column */ LIST_dash, /* -dash */ LIST_diag, /* -diag */ LIST_enum, /* -enum */ LIST_hang, /* -hang */ LIST_hyphen, /* -hyphen */ LIST_inset, /* -inset */ LIST_item, /* -item */ LIST_ohang, /* -ohang */ LIST_tag, /* -tag */ LIST_MAX }; enum mdoc_disp { DISP__NONE = 0, DISP_centered, /* -centered */ DISP_ragged, /* -ragged */ DISP_unfilled, /* -unfilled */ DISP_filled, /* -filled */ DISP_literal /* -literal */ }; enum mdoc_auth { AUTH__NONE = 0, AUTH_split, /* -split */ AUTH_nosplit /* -nosplit */ }; enum mdoc_font { FONT__NONE = 0, FONT_Em, /* Em, -emphasis */ FONT_Li, /* Li, -literal */ FONT_Sy /* Sy, -symbolic */ }; struct mdoc_bd { const char *offs; /* -offset */ enum mdoc_disp type; /* -ragged, etc. */ int comp; /* -compact */ }; struct mdoc_bl { const char *width; /* -width */ const char *offs; /* -offset */ enum mdoc_list type; /* -tag, -enum, etc. */ int comp; /* -compact */ size_t ncols; /* -column arg count */ const char **cols; /* -column val ptr */ int count; /* -enum counter */ }; struct mdoc_bf { enum mdoc_font font; /* font */ }; struct mdoc_an { enum mdoc_auth auth; /* -split, etc. */ }; struct mdoc_rs { int quote_T; /* whether to quote %T */ }; /* * Consists of normalised node arguments. These should be used instead * of iterating through the mdoc_arg pointers of a node: defaults are * provided, etc. */ union mdoc_data { struct mdoc_an An; struct mdoc_bd Bd; struct mdoc_bf Bf; struct mdoc_bl Bl; struct mdoc_node *Es; struct mdoc_rs Rs; }; /* * Single node in tree-linked AST. */ struct mdoc_node { struct mdoc_node *parent; /* parent AST node */ struct mdoc_node *child; /* first child AST node */ struct mdoc_node *last; /* last child AST node */ struct mdoc_node *next; /* sibling AST node */ struct mdoc_node *prev; /* prior sibling AST node */ int nchild; /* number children */ int line; /* parse line */ int pos; /* parse column */ int lastline; /* the node ends on this line */ enum mdoct tok; /* tok or MDOC__MAX if none */ int flags; #define MDOC_VALID (1 << 0) /* has been validated */ #define MDOC_EOS (1 << 2) /* at sentence boundary */ #define MDOC_LINE (1 << 3) /* first macro/text on line */ #define MDOC_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting */ #define MDOC_ENDED (1 << 5) /* rendering has been ended */ #define MDOC_DELIMO (1 << 6) #define MDOC_DELIMC (1 << 7) enum mdoc_type type; /* AST node type */ enum mdoc_sec sec; /* current named section */ union mdoc_data *norm; /* normalised args */ const void *prev_font; /* before entering this node */ /* FIXME: these can be union'd to shave a few bytes. */ struct mdoc_arg *args; /* BLOCK/ELEM */ struct mdoc_node *pending; /* BLOCK */ struct mdoc_node *head; /* BLOCK */ struct mdoc_node *body; /* BLOCK */ struct mdoc_node *tail; /* BLOCK */ char *string; /* TEXT */ const struct tbl_span *span; /* TBL */ const struct eqn *eqn; /* EQN */ enum mdoc_endbody end; /* BODY */ }; /* Names of macros. Index is enum mdoct. */ extern const char *const *mdoc_macronames; /* Names of macro args. Index is enum mdocargt. */ extern const char *const *mdoc_argnames; __BEGIN_DECLS struct mdoc; const struct mdoc_node *mdoc_node(const struct mdoc *); const struct mdoc_meta *mdoc_meta(const struct mdoc *); void mdoc_deroff(char **, const struct mdoc_node *); __END_DECLS - -#endif /*!MDOC_H*/ Index: projects/arm_intrng/contrib/mdocml/mdoc_html.c =================================================================== --- projects/arm_intrng/contrib/mdocml/mdoc_html.c (revision 276247) +++ projects/arm_intrng/contrib/mdocml/mdoc_html.c (revision 276248) @@ -1,2212 +1,2213 @@ -/* $Id: mdoc_html.c,v 1.213 2014/11/27 22:27:56 schwarze Exp $ */ +/* $Id: mdoc_html.c,v 1.216 2014/12/02 10:08:06 schwarze Exp $ */ /* * Copyright (c) 2008-2011, 2014 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "config.h" #include #include #include #include #include #include #include -#include "mandoc.h" #include "mandoc_aux.h" +#include "mdoc.h" #include "out.h" #include "html.h" -#include "mdoc.h" #include "main.h" #define INDENT 5 #define MDOC_ARGS const struct mdoc_meta *meta, \ const struct mdoc_node *n, \ struct html *h #ifndef MIN #define MIN(a,b) ((/*CONSTCOND*/(a)<(b))?(a):(b)) #endif struct htmlmdoc { int (*pre)(MDOC_ARGS); void (*post)(MDOC_ARGS); }; static void print_mdoc(MDOC_ARGS); static void print_mdoc_head(MDOC_ARGS); static void print_mdoc_node(MDOC_ARGS); static void print_mdoc_nodelist(MDOC_ARGS); static void synopsis_pre(struct html *, const struct mdoc_node *); static void a2width(const char *, struct roffsu *); static void mdoc_root_post(MDOC_ARGS); static int mdoc_root_pre(MDOC_ARGS); static void mdoc__x_post(MDOC_ARGS); static int mdoc__x_pre(MDOC_ARGS); static int mdoc_ad_pre(MDOC_ARGS); static int mdoc_an_pre(MDOC_ARGS); static int mdoc_ap_pre(MDOC_ARGS); static int mdoc_ar_pre(MDOC_ARGS); static int mdoc_bd_pre(MDOC_ARGS); static int mdoc_bf_pre(MDOC_ARGS); static void mdoc_bk_post(MDOC_ARGS); static int mdoc_bk_pre(MDOC_ARGS); static int mdoc_bl_pre(MDOC_ARGS); static int mdoc_bt_pre(MDOC_ARGS); static int mdoc_bx_pre(MDOC_ARGS); static int mdoc_cd_pre(MDOC_ARGS); static int mdoc_d1_pre(MDOC_ARGS); static int mdoc_dv_pre(MDOC_ARGS); static int mdoc_fa_pre(MDOC_ARGS); static int mdoc_fd_pre(MDOC_ARGS); static int mdoc_fl_pre(MDOC_ARGS); static int mdoc_fn_pre(MDOC_ARGS); static int mdoc_ft_pre(MDOC_ARGS); static int mdoc_em_pre(MDOC_ARGS); static int mdoc_er_pre(MDOC_ARGS); static int mdoc_ev_pre(MDOC_ARGS); static int mdoc_ex_pre(MDOC_ARGS); static void mdoc_fo_post(MDOC_ARGS); static int mdoc_fo_pre(MDOC_ARGS); static int mdoc_ic_pre(MDOC_ARGS); static int mdoc_igndelim_pre(MDOC_ARGS); static int mdoc_in_pre(MDOC_ARGS); static int mdoc_it_pre(MDOC_ARGS); static int mdoc_lb_pre(MDOC_ARGS); static int mdoc_li_pre(MDOC_ARGS); static int mdoc_lk_pre(MDOC_ARGS); static int mdoc_mt_pre(MDOC_ARGS); static int mdoc_ms_pre(MDOC_ARGS); static int mdoc_nd_pre(MDOC_ARGS); static int mdoc_nm_pre(MDOC_ARGS); static int mdoc_no_pre(MDOC_ARGS); static int mdoc_ns_pre(MDOC_ARGS); static int mdoc_pa_pre(MDOC_ARGS); static void mdoc_pf_post(MDOC_ARGS); static int mdoc_pp_pre(MDOC_ARGS); static void mdoc_quote_post(MDOC_ARGS); static int mdoc_quote_pre(MDOC_ARGS); static int mdoc_rs_pre(MDOC_ARGS); static int mdoc_rv_pre(MDOC_ARGS); static int mdoc_sh_pre(MDOC_ARGS); static int mdoc_skip_pre(MDOC_ARGS); static int mdoc_sm_pre(MDOC_ARGS); static int mdoc_sp_pre(MDOC_ARGS); static int mdoc_ss_pre(MDOC_ARGS); static int mdoc_sx_pre(MDOC_ARGS); static int mdoc_sy_pre(MDOC_ARGS); static int mdoc_ud_pre(MDOC_ARGS); static int mdoc_va_pre(MDOC_ARGS); static int mdoc_vt_pre(MDOC_ARGS); static int mdoc_xr_pre(MDOC_ARGS); static int mdoc_xx_pre(MDOC_ARGS); static const struct htmlmdoc mdocs[MDOC_MAX] = { {mdoc_ap_pre, NULL}, /* Ap */ {NULL, NULL}, /* Dd */ {NULL, NULL}, /* Dt */ {NULL, NULL}, /* Os */ {mdoc_sh_pre, NULL }, /* Sh */ {mdoc_ss_pre, NULL }, /* Ss */ {mdoc_pp_pre, NULL}, /* Pp */ {mdoc_d1_pre, NULL}, /* D1 */ {mdoc_d1_pre, NULL}, /* Dl */ {mdoc_bd_pre, NULL}, /* Bd */ {NULL, NULL}, /* Ed */ {mdoc_bl_pre, NULL}, /* Bl */ {NULL, NULL}, /* El */ {mdoc_it_pre, NULL}, /* It */ {mdoc_ad_pre, NULL}, /* Ad */ {mdoc_an_pre, NULL}, /* An */ {mdoc_ar_pre, NULL}, /* Ar */ {mdoc_cd_pre, NULL}, /* Cd */ {mdoc_fl_pre, NULL}, /* Cm */ {mdoc_dv_pre, NULL}, /* Dv */ {mdoc_er_pre, NULL}, /* Er */ {mdoc_ev_pre, NULL}, /* Ev */ {mdoc_ex_pre, NULL}, /* Ex */ {mdoc_fa_pre, NULL}, /* Fa */ {mdoc_fd_pre, NULL}, /* Fd */ {mdoc_fl_pre, NULL}, /* Fl */ {mdoc_fn_pre, NULL}, /* Fn */ {mdoc_ft_pre, NULL}, /* Ft */ {mdoc_ic_pre, NULL}, /* Ic */ {mdoc_in_pre, NULL}, /* In */ {mdoc_li_pre, NULL}, /* Li */ {mdoc_nd_pre, NULL}, /* Nd */ {mdoc_nm_pre, NULL}, /* Nm */ {mdoc_quote_pre, mdoc_quote_post}, /* Op */ {mdoc_ft_pre, NULL}, /* Ot */ {mdoc_pa_pre, NULL}, /* Pa */ {mdoc_rv_pre, NULL}, /* Rv */ {NULL, NULL}, /* St */ {mdoc_va_pre, NULL}, /* Va */ {mdoc_vt_pre, NULL}, /* Vt */ {mdoc_xr_pre, NULL}, /* Xr */ {mdoc__x_pre, mdoc__x_post}, /* %A */ {mdoc__x_pre, mdoc__x_post}, /* %B */ {mdoc__x_pre, mdoc__x_post}, /* %D */ {mdoc__x_pre, mdoc__x_post}, /* %I */ {mdoc__x_pre, mdoc__x_post}, /* %J */ {mdoc__x_pre, mdoc__x_post}, /* %N */ {mdoc__x_pre, mdoc__x_post}, /* %O */ {mdoc__x_pre, mdoc__x_post}, /* %P */ {mdoc__x_pre, mdoc__x_post}, /* %R */ {mdoc__x_pre, mdoc__x_post}, /* %T */ {mdoc__x_pre, mdoc__x_post}, /* %V */ {NULL, NULL}, /* Ac */ {mdoc_quote_pre, mdoc_quote_post}, /* Ao */ {mdoc_quote_pre, mdoc_quote_post}, /* Aq */ {NULL, NULL}, /* At */ {NULL, NULL}, /* Bc */ {mdoc_bf_pre, NULL}, /* Bf */ {mdoc_quote_pre, mdoc_quote_post}, /* Bo */ {mdoc_quote_pre, mdoc_quote_post}, /* Bq */ {mdoc_xx_pre, NULL}, /* Bsx */ {mdoc_bx_pre, NULL}, /* Bx */ {mdoc_skip_pre, NULL}, /* Db */ {NULL, NULL}, /* Dc */ {mdoc_quote_pre, mdoc_quote_post}, /* Do */ {mdoc_quote_pre, mdoc_quote_post}, /* Dq */ {NULL, NULL}, /* Ec */ /* FIXME: no space */ {NULL, NULL}, /* Ef */ {mdoc_em_pre, NULL}, /* Em */ {mdoc_quote_pre, mdoc_quote_post}, /* Eo */ {mdoc_xx_pre, NULL}, /* Fx */ {mdoc_ms_pre, NULL}, /* Ms */ {mdoc_no_pre, NULL}, /* No */ {mdoc_ns_pre, NULL}, /* Ns */ {mdoc_xx_pre, NULL}, /* Nx */ {mdoc_xx_pre, NULL}, /* Ox */ {NULL, NULL}, /* Pc */ {mdoc_igndelim_pre, mdoc_pf_post}, /* Pf */ {mdoc_quote_pre, mdoc_quote_post}, /* Po */ {mdoc_quote_pre, mdoc_quote_post}, /* Pq */ {NULL, NULL}, /* Qc */ {mdoc_quote_pre, mdoc_quote_post}, /* Ql */ {mdoc_quote_pre, mdoc_quote_post}, /* Qo */ {mdoc_quote_pre, mdoc_quote_post}, /* Qq */ {NULL, NULL}, /* Re */ {mdoc_rs_pre, NULL}, /* Rs */ {NULL, NULL}, /* Sc */ {mdoc_quote_pre, mdoc_quote_post}, /* So */ {mdoc_quote_pre, mdoc_quote_post}, /* Sq */ {mdoc_sm_pre, NULL}, /* Sm */ {mdoc_sx_pre, NULL}, /* Sx */ {mdoc_sy_pre, NULL}, /* Sy */ {NULL, NULL}, /* Tn */ {mdoc_xx_pre, NULL}, /* Ux */ {NULL, NULL}, /* Xc */ {NULL, NULL}, /* Xo */ {mdoc_fo_pre, mdoc_fo_post}, /* Fo */ {NULL, NULL}, /* Fc */ {mdoc_quote_pre, mdoc_quote_post}, /* Oo */ {NULL, NULL}, /* Oc */ {mdoc_bk_pre, mdoc_bk_post}, /* Bk */ {NULL, NULL}, /* Ek */ {mdoc_bt_pre, NULL}, /* Bt */ {NULL, NULL}, /* Hf */ {mdoc_em_pre, NULL}, /* Fr */ {mdoc_ud_pre, NULL}, /* Ud */ {mdoc_lb_pre, NULL}, /* Lb */ {mdoc_pp_pre, NULL}, /* Lp */ {mdoc_lk_pre, NULL}, /* Lk */ {mdoc_mt_pre, NULL}, /* Mt */ {mdoc_quote_pre, mdoc_quote_post}, /* Brq */ {mdoc_quote_pre, mdoc_quote_post}, /* Bro */ {NULL, NULL}, /* Brc */ {mdoc__x_pre, mdoc__x_post}, /* %C */ {mdoc_skip_pre, NULL}, /* Es */ {mdoc_quote_pre, mdoc_quote_post}, /* En */ {mdoc_xx_pre, NULL}, /* Dx */ {mdoc__x_pre, mdoc__x_post}, /* %Q */ {mdoc_sp_pre, NULL}, /* br */ {mdoc_sp_pre, NULL}, /* sp */ {mdoc__x_pre, mdoc__x_post}, /* %U */ {NULL, NULL}, /* Ta */ {mdoc_skip_pre, NULL}, /* ll */ }; static const char * const lists[LIST_MAX] = { NULL, "list-bul", "list-col", "list-dash", "list-diag", "list-enum", "list-hang", "list-hyph", "list-inset", "list-item", "list-ohang", "list-tag" }; void html_mdoc(void *arg, const struct mdoc *mdoc) { print_mdoc(mdoc_meta(mdoc), mdoc_node(mdoc), (struct html *)arg); putchar('\n'); } /* * Calculate the scaling unit passed in a `-width' argument. This uses * either a native scaling unit (e.g., 1i, 2m) or the string length of * the value. */ static void a2width(const char *p, struct roffsu *su) { if ( ! a2roffsu(p, su, SCALE_MAX)) { su->unit = SCALE_EN; su->scale = html_strlen(p); } } /* * See the same function in mdoc_term.c for documentation. */ static void synopsis_pre(struct html *h, const struct mdoc_node *n) { if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags)) return; if (n->prev->tok == n->tok && MDOC_Fo != n->tok && MDOC_Ft != n->tok && MDOC_Fn != n->tok) { print_otag(h, TAG_BR, 0, NULL); return; } switch (n->prev->tok) { case MDOC_Fd: /* FALLTHROUGH */ case MDOC_Fn: /* FALLTHROUGH */ case MDOC_Fo: /* FALLTHROUGH */ case MDOC_In: /* FALLTHROUGH */ case MDOC_Vt: print_paragraph(h); break; case MDOC_Ft: if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) { print_paragraph(h); break; } /* FALLTHROUGH */ default: print_otag(h, TAG_BR, 0, NULL); break; } } static void print_mdoc(MDOC_ARGS) { struct tag *t, *tt; struct htmlpair tag; PAIR_CLASS_INIT(&tag, "mandoc"); if ( ! (HTML_FRAGMENT & h->oflags)) { print_gen_decls(h); t = print_otag(h, TAG_HTML, 0, NULL); tt = print_otag(h, TAG_HEAD, 0, NULL); print_mdoc_head(meta, n, h); print_tagq(h, tt); print_otag(h, TAG_BODY, 0, NULL); print_otag(h, TAG_DIV, 1, &tag); } else t = print_otag(h, TAG_DIV, 1, &tag); print_mdoc_nodelist(meta, n, h); print_tagq(h, t); } static void print_mdoc_head(MDOC_ARGS) { print_gen_head(h); bufinit(h); bufcat(h, meta->title); if (meta->msec) bufcat_fmt(h, "(%s)", meta->msec); if (meta->arch) bufcat_fmt(h, " (%s)", meta->arch); print_otag(h, TAG_TITLE, 0, NULL); print_text(h, h->buf); } static void print_mdoc_nodelist(MDOC_ARGS) { print_mdoc_node(meta, n, h); if (n->next) print_mdoc_nodelist(meta, n->next, h); } static void print_mdoc_node(MDOC_ARGS) { int child; struct tag *t; child = 1; t = h->tags.head; switch (n->type) { case MDOC_ROOT: child = mdoc_root_pre(meta, n, h); break; case MDOC_TEXT: /* No tables in this mode... */ assert(NULL == h->tblt); /* * Make sure that if we're in a literal mode already * (i.e., within a
) don't print the newline.
 		 */
 		if (' ' == *n->string && MDOC_LINE & n->flags)
 			if ( ! (HTML_LITERAL & h->flags))
 				print_otag(h, TAG_BR, 0, NULL);
 		if (MDOC_DELIMC & n->flags)
 			h->flags |= HTML_NOSPACE;
 		print_text(h, n->string);
 		if (MDOC_DELIMO & n->flags)
 			h->flags |= HTML_NOSPACE;
 		return;
 	case MDOC_EQN:
 		print_eqn(h, n->eqn);
 		break;
 	case MDOC_TBL:
 		/*
 		 * This will take care of initialising all of the table
 		 * state data for the first table, then tearing it down
 		 * for the last one.
 		 */
 		print_tbl(h, n->span);
 		return;
 	default:
 		/*
 		 * Close out the current table, if it's open, and unset
 		 * the "meta" table state.  This will be reopened on the
 		 * next table element.
 		 */
 		if (h->tblt != NULL) {
 			print_tblclose(h);
 			t = h->tags.head;
 		}
 		assert(h->tblt == NULL);
 		if (mdocs[n->tok].pre && (n->end == ENDBODY_NOT || n->child))
 			child = (*mdocs[n->tok].pre)(meta, n, h);
 		break;
 	}
 
 	if (HTML_KEEP & h->flags) {
 		if (n->prev ? (n->prev->lastline != n->line) :
 		    (n->parent && n->parent->line != n->line)) {
 			h->flags &= ~HTML_KEEP;
 			h->flags |= HTML_PREKEEP;
 		}
 	}
 
 	if (child && n->child)
 		print_mdoc_nodelist(meta, n->child, h);
 
 	print_stagq(h, t);
 
 	switch (n->type) {
 	case MDOC_ROOT:
 		mdoc_root_post(meta, n, h);
 		break;
 	case MDOC_EQN:
 		break;
 	default:
 		if ( ! mdocs[n->tok].post || n->flags & MDOC_ENDED)
 			break;
 		(*mdocs[n->tok].post)(meta, n, h);
 		if (n->end != ENDBODY_NOT)
 			n->pending->flags |= MDOC_ENDED;
 		if (n->end == ENDBODY_NOSPACE)
 			h->flags |= HTML_NOSPACE;
 		break;
 	}
 }
 
 static void
 mdoc_root_post(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 	struct tag	*t, *tt;
 
 	PAIR_CLASS_INIT(&tag, "foot");
 	t = print_otag(h, TAG_TABLE, 1, &tag);
 
 	print_otag(h, TAG_TBODY, 0, NULL);
 
 	tt = print_otag(h, TAG_TR, 0, NULL);
 
 	PAIR_CLASS_INIT(&tag, "foot-date");
 	print_otag(h, TAG_TD, 1, &tag);
 	print_text(h, meta->date);
 	print_stagq(h, tt);
 
 	PAIR_CLASS_INIT(&tag, "foot-os");
 	print_otag(h, TAG_TD, 1, &tag);
 	print_text(h, meta->os);
 	print_tagq(h, t);
 }
 
 static int
 mdoc_root_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 	struct tag	*t, *tt;
 	char		*volume, *title;
 
 	if (NULL == meta->arch)
 		volume = mandoc_strdup(meta->vol);
 	else
 		mandoc_asprintf(&volume, "%s (%s)",
 		    meta->vol, meta->arch);
 
 	if (NULL == meta->msec)
 		title = mandoc_strdup(meta->title);
 	else
 		mandoc_asprintf(&title, "%s(%s)",
 		    meta->title, meta->msec);
 
 	PAIR_CLASS_INIT(&tag, "head");
 	t = print_otag(h, TAG_TABLE, 1, &tag);
 
 	print_otag(h, TAG_TBODY, 0, NULL);
 
 	tt = print_otag(h, TAG_TR, 0, NULL);
 
 	PAIR_CLASS_INIT(&tag, "head-ltitle");
 	print_otag(h, TAG_TD, 1, &tag);
 	print_text(h, title);
 	print_stagq(h, tt);
 
 	PAIR_CLASS_INIT(&tag, "head-vol");
 	print_otag(h, TAG_TD, 1, &tag);
 	print_text(h, volume);
 	print_stagq(h, tt);
 
 	PAIR_CLASS_INIT(&tag, "head-rtitle");
 	print_otag(h, TAG_TD, 1, &tag);
 	print_text(h, title);
 	print_tagq(h, t);
 
 	free(title);
 	free(volume);
 	return(1);
 }
 
 static int
 mdoc_sh_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		PAIR_CLASS_INIT(&tag, "section");
 		print_otag(h, TAG_DIV, 1, &tag);
 		return(1);
 	case MDOC_BODY:
 		if (n->sec == SEC_AUTHORS)
 			h->flags &= ~(HTML_SPLIT|HTML_NOSPLIT);
 		return(1);
 	default:
 		break;
 	}
 
 	bufinit(h);
 	bufcat(h, "x");
 
 	for (n = n->child; n && MDOC_TEXT == n->type; ) {
 		bufcat_id(h, n->string);
 		if (NULL != (n = n->next))
 			bufcat_id(h, " ");
 	}
 
 	if (NULL == n) {
 		PAIR_ID_INIT(&tag, h->buf);
 		print_otag(h, TAG_H1, 1, &tag);
 	} else
 		print_otag(h, TAG_H1, 0, NULL);
 
 	return(1);
 }
 
 static int
 mdoc_ss_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 
 	if (MDOC_BLOCK == n->type) {
 		PAIR_CLASS_INIT(&tag, "subsection");
 		print_otag(h, TAG_DIV, 1, &tag);
 		return(1);
 	} else if (MDOC_BODY == n->type)
 		return(1);
 
 	bufinit(h);
 	bufcat(h, "x");
 
 	for (n = n->child; n && MDOC_TEXT == n->type; ) {
 		bufcat_id(h, n->string);
 		if (NULL != (n = n->next))
 			bufcat_id(h, " ");
 	}
 
 	if (NULL == n) {
 		PAIR_ID_INIT(&tag, h->buf);
 		print_otag(h, TAG_H2, 1, &tag);
 	} else
 		print_otag(h, TAG_H2, 0, NULL);
 
 	return(1);
 }
 
 static int
 mdoc_fl_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 
 	PAIR_CLASS_INIT(&tag, "flag");
 	print_otag(h, TAG_B, 1, &tag);
 
 	/* `Cm' has no leading hyphen. */
 
 	if (MDOC_Cm == n->tok)
 		return(1);
 
 	print_text(h, "\\-");
 
 	if ( ! (n->nchild == 0 &&
 	    (n->next == NULL ||
 	     n->next->type == MDOC_TEXT ||
 	     n->next->flags & MDOC_LINE)))
 		h->flags |= HTML_NOSPACE;
 
 	return(1);
 }
 
 static int
 mdoc_nd_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 
 	if (MDOC_BODY != n->type)
 		return(1);
 
 	/* XXX: this tag in theory can contain block elements. */
 
 	print_text(h, "\\(em");
 	PAIR_CLASS_INIT(&tag, "desc");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_nm_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 	struct roffsu	 su;
 	int		 len;
 
 	switch (n->type) {
 	case MDOC_ELEM:
 		synopsis_pre(h, n);
 		PAIR_CLASS_INIT(&tag, "name");
 		print_otag(h, TAG_B, 1, &tag);
 		if (NULL == n->child && meta->name)
 			print_text(h, meta->name);
 		return(1);
 	case MDOC_HEAD:
 		print_otag(h, TAG_TD, 0, NULL);
 		if (NULL == n->child && meta->name)
 			print_text(h, meta->name);
 		return(1);
 	case MDOC_BODY:
 		print_otag(h, TAG_TD, 0, NULL);
 		return(1);
 	default:
 		break;
 	}
 
 	synopsis_pre(h, n);
 	PAIR_CLASS_INIT(&tag, "synopsis");
 	print_otag(h, TAG_TABLE, 1, &tag);
 
 	for (len = 0, n = n->child; n; n = n->next)
 		if (MDOC_TEXT == n->type)
 			len += html_strlen(n->string);
 
 	if (0 == len && meta->name)
 		len = html_strlen(meta->name);
 
 	SCALE_HS_INIT(&su, len);
 	bufinit(h);
 	bufcat_su(h, "width", &su);
 	PAIR_STYLE_INIT(&tag, h);
 	print_otag(h, TAG_COL, 1, &tag);
 	print_otag(h, TAG_COL, 0, NULL);
 	print_otag(h, TAG_TBODY, 0, NULL);
 	print_otag(h, TAG_TR, 0, NULL);
 	return(1);
 }
 
 static int
 mdoc_xr_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag[2];
 
 	if (NULL == n->child)
 		return(0);
 
 	PAIR_CLASS_INIT(&tag[0], "link-man");
 
 	if (h->base_man) {
 		buffmt_man(h, n->child->string,
 		    n->child->next ?
 		    n->child->next->string : NULL);
 		PAIR_HREF_INIT(&tag[1], h->buf);
 		print_otag(h, TAG_A, 2, tag);
 	} else
 		print_otag(h, TAG_A, 1, tag);
 
 	n = n->child;
 	print_text(h, n->string);
 
 	if (NULL == (n = n->next))
 		return(0);
 
 	h->flags |= HTML_NOSPACE;
 	print_text(h, "(");
 	h->flags |= HTML_NOSPACE;
 	print_text(h, n->string);
 	h->flags |= HTML_NOSPACE;
 	print_text(h, ")");
 	return(0);
 }
 
 static int
 mdoc_ns_pre(MDOC_ARGS)
 {
 
 	if ( ! (MDOC_LINE & n->flags))
 		h->flags |= HTML_NOSPACE;
 	return(1);
 }
 
 static int
 mdoc_ar_pre(MDOC_ARGS)
 {
 	struct htmlpair tag;
 
 	PAIR_CLASS_INIT(&tag, "arg");
 	print_otag(h, TAG_I, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_xx_pre(MDOC_ARGS)
 {
 	const char	*pp;
 	struct htmlpair	 tag;
 	int		 flags;
 
 	switch (n->tok) {
 	case MDOC_Bsx:
 		pp = "BSD/OS";
 		break;
 	case MDOC_Dx:
 		pp = "DragonFly";
 		break;
 	case MDOC_Fx:
 		pp = "FreeBSD";
 		break;
 	case MDOC_Nx:
 		pp = "NetBSD";
 		break;
 	case MDOC_Ox:
 		pp = "OpenBSD";
 		break;
 	case MDOC_Ux:
 		pp = "UNIX";
 		break;
 	default:
 		return(1);
 	}
 
 	PAIR_CLASS_INIT(&tag, "unix");
 	print_otag(h, TAG_SPAN, 1, &tag);
 
 	print_text(h, pp);
 	if (n->child) {
 		flags = h->flags;
 		h->flags |= HTML_KEEP;
 		print_text(h, n->child->string);
 		h->flags = flags;
 	}
 	return(0);
 }
 
 static int
 mdoc_bx_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 
 	PAIR_CLASS_INIT(&tag, "unix");
 	print_otag(h, TAG_SPAN, 1, &tag);
 
 	if (NULL != (n = n->child)) {
 		print_text(h, n->string);
 		h->flags |= HTML_NOSPACE;
 		print_text(h, "BSD");
 	} else {
 		print_text(h, "BSD");
 		return(0);
 	}
 
 	if (NULL != (n = n->next)) {
 		h->flags |= HTML_NOSPACE;
 		print_text(h, "-");
 		h->flags |= HTML_NOSPACE;
 		print_text(h, n->string);
 	}
 
 	return(0);
 }
 
 static int
 mdoc_it_pre(MDOC_ARGS)
 {
 	struct roffsu	 su;
 	enum mdoc_list	 type;
 	struct htmlpair	 tag[2];
 	const struct mdoc_node *bl;
 
 	bl = n->parent;
 	while (bl && MDOC_Bl != bl->tok)
 		bl = bl->parent;
 
 	assert(bl);
 
 	type = bl->norm->Bl.type;
 
 	assert(lists[type]);
 	PAIR_CLASS_INIT(&tag[0], lists[type]);
 
 	bufinit(h);
 
 	if (MDOC_HEAD == n->type) {
 		switch (type) {
 		case LIST_bullet:
 			/* FALLTHROUGH */
 		case LIST_dash:
 			/* FALLTHROUGH */
 		case LIST_item:
 			/* FALLTHROUGH */
 		case LIST_hyphen:
 			/* FALLTHROUGH */
 		case LIST_enum:
 			return(0);
 		case LIST_diag:
 			/* FALLTHROUGH */
 		case LIST_hang:
 			/* FALLTHROUGH */
 		case LIST_inset:
 			/* FALLTHROUGH */
 		case LIST_ohang:
 			/* FALLTHROUGH */
 		case LIST_tag:
 			SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
 			bufcat_su(h, "margin-top", &su);
 			PAIR_STYLE_INIT(&tag[1], h);
 			print_otag(h, TAG_DT, 2, tag);
 			if (LIST_diag != type)
 				break;
 			PAIR_CLASS_INIT(&tag[0], "diag");
 			print_otag(h, TAG_B, 1, tag);
 			break;
 		case LIST_column:
 			break;
 		default:
 			break;
 		}
 	} else if (MDOC_BODY == n->type) {
 		switch (type) {
 		case LIST_bullet:
 			/* FALLTHROUGH */
 		case LIST_hyphen:
 			/* FALLTHROUGH */
 		case LIST_dash:
 			/* FALLTHROUGH */
 		case LIST_enum:
 			/* FALLTHROUGH */
 		case LIST_item:
 			SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
 			bufcat_su(h, "margin-top", &su);
 			PAIR_STYLE_INIT(&tag[1], h);
 			print_otag(h, TAG_LI, 2, tag);
 			break;
 		case LIST_diag:
 			/* FALLTHROUGH */
 		case LIST_hang:
 			/* FALLTHROUGH */
 		case LIST_inset:
 			/* FALLTHROUGH */
 		case LIST_ohang:
 			/* FALLTHROUGH */
 		case LIST_tag:
 			if (NULL == bl->norm->Bl.width) {
 				print_otag(h, TAG_DD, 1, tag);
 				break;
 			}
 			a2width(bl->norm->Bl.width, &su);
 			bufcat_su(h, "margin-left", &su);
 			PAIR_STYLE_INIT(&tag[1], h);
 			print_otag(h, TAG_DD, 2, tag);
 			break;
 		case LIST_column:
 			SCALE_VS_INIT(&su, ! bl->norm->Bl.comp);
 			bufcat_su(h, "margin-top", &su);
 			PAIR_STYLE_INIT(&tag[1], h);
 			print_otag(h, TAG_TD, 2, tag);
 			break;
 		default:
 			break;
 		}
 	} else {
 		switch (type) {
 		case LIST_column:
 			print_otag(h, TAG_TR, 1, tag);
 			break;
 		default:
 			break;
 		}
 	}
 
 	return(1);
 }
 
 static int
 mdoc_bl_pre(MDOC_ARGS)
 {
 	int		 i;
 	struct htmlpair	 tag[3];
 	struct roffsu	 su;
 	char		 buf[BUFSIZ];
 
 	if (MDOC_BODY == n->type) {
 		if (LIST_column == n->norm->Bl.type)
 			print_otag(h, TAG_TBODY, 0, NULL);
 		return(1);
 	}
 
 	if (MDOC_HEAD == n->type) {
 		if (LIST_column != n->norm->Bl.type)
 			return(0);
 
 		/*
 		 * For each column, print out the  tag with our
 		 * suggested width.  The last column gets min-width, as
 		 * in terminal mode it auto-sizes to the width of the
 		 * screen and we want to preserve that behaviour.
 		 */
 
 		for (i = 0; i < (int)n->norm->Bl.ncols; i++) {
 			bufinit(h);
 			a2width(n->norm->Bl.cols[i], &su);
 			if (i < (int)n->norm->Bl.ncols - 1)
 				bufcat_su(h, "width", &su);
 			else
 				bufcat_su(h, "min-width", &su);
 			PAIR_STYLE_INIT(&tag[0], h);
 			print_otag(h, TAG_COL, 1, tag);
 		}
 
 		return(0);
 	}
 
 	SCALE_VS_INIT(&su, 0);
 	bufinit(h);
 	bufcat_su(h, "margin-top", &su);
 	bufcat_su(h, "margin-bottom", &su);
 	PAIR_STYLE_INIT(&tag[0], h);
 
 	assert(lists[n->norm->Bl.type]);
 	(void)strlcpy(buf, "list ", BUFSIZ);
 	(void)strlcat(buf, lists[n->norm->Bl.type], BUFSIZ);
 	PAIR_INIT(&tag[1], ATTR_CLASS, buf);
 
 	/* Set the block's left-hand margin. */
 
 	if (n->norm->Bl.offs) {
 		a2width(n->norm->Bl.offs, &su);
 		bufcat_su(h, "margin-left", &su);
 	}
 
 	switch (n->norm->Bl.type) {
 	case LIST_bullet:
 		/* FALLTHROUGH */
 	case LIST_dash:
 		/* FALLTHROUGH */
 	case LIST_hyphen:
 		/* FALLTHROUGH */
 	case LIST_item:
 		print_otag(h, TAG_UL, 2, tag);
 		break;
 	case LIST_enum:
 		print_otag(h, TAG_OL, 2, tag);
 		break;
 	case LIST_diag:
 		/* FALLTHROUGH */
 	case LIST_hang:
 		/* FALLTHROUGH */
 	case LIST_inset:
 		/* FALLTHROUGH */
 	case LIST_ohang:
 		/* FALLTHROUGH */
 	case LIST_tag:
 		print_otag(h, TAG_DL, 2, tag);
 		break;
 	case LIST_column:
 		print_otag(h, TAG_TABLE, 2, tag);
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 
 	return(1);
 }
 
 static int
 mdoc_ex_pre(MDOC_ARGS)
 {
 	struct tag	*t;
 	struct htmlpair	 tag;
 	int		 nchild;
 
 	if (n->prev)
 		print_otag(h, TAG_BR, 0, NULL);
 
 	PAIR_CLASS_INIT(&tag, "utility");
 
 	print_text(h, "The");
 
 	nchild = n->nchild;
 	for (n = n->child; n; n = n->next) {
 		assert(MDOC_TEXT == n->type);
 
 		t = print_otag(h, TAG_B, 1, &tag);
 		print_text(h, n->string);
 		print_tagq(h, t);
 
 		if (nchild > 2 && n->next) {
 			h->flags |= HTML_NOSPACE;
 			print_text(h, ",");
 		}
 
 		if (n->next && NULL == n->next->next)
 			print_text(h, "and");
 	}
 
 	if (nchild > 1)
 		print_text(h, "utilities exit\\~0");
 	else
 		print_text(h, "utility exits\\~0");
 
 	print_text(h, "on success, and\\~>0 if an error occurs.");
 	return(0);
 }
 
 static int
 mdoc_em_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "emph");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_d1_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag[2];
 	struct roffsu	 su;
 
 	if (MDOC_BLOCK != n->type)
 		return(1);
 
 	SCALE_VS_INIT(&su, 0);
 	bufinit(h);
 	bufcat_su(h, "margin-top", &su);
 	bufcat_su(h, "margin-bottom", &su);
 	PAIR_STYLE_INIT(&tag[0], h);
 	print_otag(h, TAG_BLOCKQUOTE, 1, tag);
 
 	/* BLOCKQUOTE needs a block body. */
 
 	PAIR_CLASS_INIT(&tag[0], "display");
 	print_otag(h, TAG_DIV, 1, tag);
 
 	if (MDOC_Dl == n->tok) {
 		PAIR_CLASS_INIT(&tag[0], "lit");
 		print_otag(h, TAG_CODE, 1, tag);
 	}
 
 	return(1);
 }
 
 static int
 mdoc_sx_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag[2];
 
 	bufinit(h);
 	bufcat(h, "#x");
 
 	for (n = n->child; n; ) {
 		bufcat_id(h, n->string);
 		if (NULL != (n = n->next))
 			bufcat_id(h, " ");
 	}
 
 	PAIR_CLASS_INIT(&tag[0], "link-sec");
 	PAIR_HREF_INIT(&tag[1], h->buf);
 
 	print_otag(h, TAG_I, 1, tag);
 	print_otag(h, TAG_A, 2, tag);
 	return(1);
 }
 
 static int
 mdoc_bd_pre(MDOC_ARGS)
 {
 	struct htmlpair		 tag[2];
 	int			 comp, sv;
 	const struct mdoc_node	*nn;
 	struct roffsu		 su;
 
 	if (MDOC_HEAD == n->type)
 		return(0);
 
 	if (MDOC_BLOCK == n->type) {
 		comp = n->norm->Bd.comp;
 		for (nn = n; nn && ! comp; nn = nn->parent) {
 			if (MDOC_BLOCK != nn->type)
 				continue;
 			if (MDOC_Ss == nn->tok || MDOC_Sh == nn->tok)
 				comp = 1;
 			if (nn->prev)
 				break;
 		}
 		if ( ! comp)
 			print_paragraph(h);
 		return(1);
 	}
 
 	/* Handle the -offset argument. */
 
 	if (n->norm->Bd.offs == NULL ||
 	    ! strcmp(n->norm->Bd.offs, "left"))
 		SCALE_HS_INIT(&su, 0);
 	else if ( ! strcmp(n->norm->Bd.offs, "indent"))
 		SCALE_HS_INIT(&su, INDENT);
 	else if ( ! strcmp(n->norm->Bd.offs, "indent-two"))
 		SCALE_HS_INIT(&su, INDENT * 2);
 	else
 		a2width(n->norm->Bd.offs, &su);
 
 	bufinit(h);
 	bufcat_su(h, "margin-left", &su);
 	PAIR_STYLE_INIT(&tag[0], h);
 
 	if (DISP_unfilled != n->norm->Bd.type &&
 	    DISP_literal != n->norm->Bd.type) {
 		PAIR_CLASS_INIT(&tag[1], "display");
 		print_otag(h, TAG_DIV, 2, tag);
 		return(1);
 	}
 
 	PAIR_CLASS_INIT(&tag[1], "lit display");
 	print_otag(h, TAG_PRE, 2, tag);
 
 	/* This can be recursive: save & set our literal state. */
 
 	sv = h->flags & HTML_LITERAL;
 	h->flags |= HTML_LITERAL;
 
 	for (nn = n->child; nn; nn = nn->next) {
 		print_mdoc_node(meta, nn, h);
 		/*
 		 * If the printed node flushes its own line, then we
 		 * needn't do it here as well.  This is hacky, but the
 		 * notion of selective eoln whitespace is pretty dumb
 		 * anyway, so don't sweat it.
 		 */
 		switch (nn->tok) {
 		case MDOC_Sm:
 			/* FALLTHROUGH */
 		case MDOC_br:
 			/* FALLTHROUGH */
 		case MDOC_sp:
 			/* FALLTHROUGH */
 		case MDOC_Bl:
 			/* FALLTHROUGH */
 		case MDOC_D1:
 			/* FALLTHROUGH */
 		case MDOC_Dl:
 			/* FALLTHROUGH */
 		case MDOC_Lp:
 			/* FALLTHROUGH */
 		case MDOC_Pp:
 			continue;
 		default:
 			break;
 		}
-		if (nn->next && nn->next->line == nn->line)
+		if (h->flags & HTML_NONEWLINE ||
+		    (nn->next && ! (nn->next->flags & MDOC_LINE)))
 			continue;
 		else if (nn->next)
 			print_text(h, "\n");
 
 		h->flags |= HTML_NOSPACE;
 	}
 
 	if (0 == sv)
 		h->flags &= ~HTML_LITERAL;
 
 	return(0);
 }
 
 static int
 mdoc_pa_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "file");
 	print_otag(h, TAG_I, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_ad_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "addr");
 	print_otag(h, TAG_I, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_an_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	if (n->norm->An.auth == AUTH_split) {
 		h->flags &= ~HTML_NOSPLIT;
 		h->flags |= HTML_SPLIT;
 		return(0);
 	}
 	if (n->norm->An.auth == AUTH_nosplit) {
 		h->flags &= ~HTML_SPLIT;
 		h->flags |= HTML_NOSPLIT;
 		return(0);
 	}
 
 	if (n->child == NULL)
 		return(0);
 
 	if (h->flags & HTML_SPLIT)
 		print_otag(h, TAG_BR, 0, NULL);
 
 	if (n->sec == SEC_AUTHORS && ! (h->flags & HTML_NOSPLIT))
 		h->flags |= HTML_SPLIT;
 
 	PAIR_CLASS_INIT(&tag, "author");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_cd_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	synopsis_pre(h, n);
 	PAIR_CLASS_INIT(&tag, "config");
 	print_otag(h, TAG_B, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_dv_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "define");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_ev_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "env");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_er_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "errno");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_fa_pre(MDOC_ARGS)
 {
 	const struct mdoc_node	*nn;
 	struct htmlpair		 tag;
 	struct tag		*t;
 
 	PAIR_CLASS_INIT(&tag, "farg");
 	if (n->parent->tok != MDOC_Fo) {
 		print_otag(h, TAG_I, 1, &tag);
 		return(1);
 	}
 
 	for (nn = n->child; nn; nn = nn->next) {
 		t = print_otag(h, TAG_I, 1, &tag);
 		print_text(h, nn->string);
 		print_tagq(h, t);
 		if (nn->next) {
 			h->flags |= HTML_NOSPACE;
 			print_text(h, ",");
 		}
 	}
 
 	if (n->child && n->next && n->next->tok == MDOC_Fa) {
 		h->flags |= HTML_NOSPACE;
 		print_text(h, ",");
 	}
 
 	return(0);
 }
 
 static int
 mdoc_fd_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag[2];
 	char		 buf[BUFSIZ];
 	size_t		 sz;
 	int		 i;
 	struct tag	*t;
 
 	synopsis_pre(h, n);
 
 	if (NULL == (n = n->child))
 		return(0);
 
 	assert(MDOC_TEXT == n->type);
 
 	if (strcmp(n->string, "#include")) {
 		PAIR_CLASS_INIT(&tag[0], "macro");
 		print_otag(h, TAG_B, 1, tag);
 		return(1);
 	}
 
 	PAIR_CLASS_INIT(&tag[0], "includes");
 	print_otag(h, TAG_B, 1, tag);
 	print_text(h, n->string);
 
 	if (NULL != (n = n->next)) {
 		assert(MDOC_TEXT == n->type);
 
 		/*
 		 * XXX This is broken and not easy to fix.
 		 * When using -Oincludes, truncation may occur.
 		 * Dynamic allocation wouldn't help because
 		 * passing long strings to buffmt_includes()
 		 * does not work either.
 		 */
 
 		strlcpy(buf, '<' == *n->string || '"' == *n->string ?
 		    n->string + 1 : n->string, BUFSIZ);
 
 		sz = strlen(buf);
 		if (sz && ('>' == buf[sz - 1] || '"' == buf[sz - 1]))
 			buf[sz - 1] = '\0';
 
 		PAIR_CLASS_INIT(&tag[0], "link-includes");
 
 		i = 1;
 		if (h->base_includes) {
 			buffmt_includes(h, buf);
 			PAIR_HREF_INIT(&tag[i], h->buf);
 			i++;
 		}
 
 		t = print_otag(h, TAG_A, i, tag);
 		print_text(h, n->string);
 		print_tagq(h, t);
 
 		n = n->next;
 	}
 
 	for ( ; n; n = n->next) {
 		assert(MDOC_TEXT == n->type);
 		print_text(h, n->string);
 	}
 
 	return(0);
 }
 
 static int
 mdoc_vt_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 
 	if (MDOC_BLOCK == n->type) {
 		synopsis_pre(h, n);
 		return(1);
 	} else if (MDOC_ELEM == n->type) {
 		synopsis_pre(h, n);
 	} else if (MDOC_HEAD == n->type)
 		return(0);
 
 	PAIR_CLASS_INIT(&tag, "type");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_ft_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 
 	synopsis_pre(h, n);
 	PAIR_CLASS_INIT(&tag, "ftype");
 	print_otag(h, TAG_I, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_fn_pre(MDOC_ARGS)
 {
 	struct tag	*t;
 	struct htmlpair	 tag[2];
 	char		 nbuf[BUFSIZ];
 	const char	*sp, *ep;
 	int		 sz, i, pretty;
 
 	pretty = MDOC_SYNPRETTY & n->flags;
 	synopsis_pre(h, n);
 
 	/* Split apart into type and name. */
 	assert(n->child->string);
 	sp = n->child->string;
 
 	ep = strchr(sp, ' ');
 	if (NULL != ep) {
 		PAIR_CLASS_INIT(&tag[0], "ftype");
 		t = print_otag(h, TAG_I, 1, tag);
 
 		while (ep) {
 			sz = MIN((int)(ep - sp), BUFSIZ - 1);
 			(void)memcpy(nbuf, sp, (size_t)sz);
 			nbuf[sz] = '\0';
 			print_text(h, nbuf);
 			sp = ++ep;
 			ep = strchr(sp, ' ');
 		}
 		print_tagq(h, t);
 	}
 
 	PAIR_CLASS_INIT(&tag[0], "fname");
 
 	/*
 	 * FIXME: only refer to IDs that we know exist.
 	 */
 
 #if 0
 	if (MDOC_SYNPRETTY & n->flags) {
 		nbuf[0] = '\0';
 		html_idcat(nbuf, sp, BUFSIZ);
 		PAIR_ID_INIT(&tag[1], nbuf);
 	} else {
 		strlcpy(nbuf, "#", BUFSIZ);
 		html_idcat(nbuf, sp, BUFSIZ);
 		PAIR_HREF_INIT(&tag[1], nbuf);
 	}
 #endif
 
 	t = print_otag(h, TAG_B, 1, tag);
 
 	if (sp)
 		print_text(h, sp);
 
 	print_tagq(h, t);
 
 	h->flags |= HTML_NOSPACE;
 	print_text(h, "(");
 	h->flags |= HTML_NOSPACE;
 
 	PAIR_CLASS_INIT(&tag[0], "farg");
 	bufinit(h);
 	bufcat_style(h, "white-space", "nowrap");
 	PAIR_STYLE_INIT(&tag[1], h);
 
 	for (n = n->child->next; n; n = n->next) {
 		i = 1;
 		if (MDOC_SYNPRETTY & n->flags)
 			i = 2;
 		t = print_otag(h, TAG_I, i, tag);
 		print_text(h, n->string);
 		print_tagq(h, t);
 		if (n->next) {
 			h->flags |= HTML_NOSPACE;
 			print_text(h, ",");
 		}
 	}
 
 	h->flags |= HTML_NOSPACE;
 	print_text(h, ")");
 
 	if (pretty) {
 		h->flags |= HTML_NOSPACE;
 		print_text(h, ";");
 	}
 
 	return(0);
 }
 
 static int
 mdoc_sm_pre(MDOC_ARGS)
 {
 
 	if (NULL == n->child)
 		h->flags ^= HTML_NONOSPACE;
 	else if (0 == strcmp("on", n->child->string))
 		h->flags &= ~HTML_NONOSPACE;
 	else
 		h->flags |= HTML_NONOSPACE;
 
 	if ( ! (HTML_NONOSPACE & h->flags))
 		h->flags &= ~HTML_NOSPACE;
 
 	return(0);
 }
 
 static int
 mdoc_skip_pre(MDOC_ARGS)
 {
 
 	return(0);
 }
 
 static int
 mdoc_pp_pre(MDOC_ARGS)
 {
 
 	print_paragraph(h);
 	return(0);
 }
 
 static int
 mdoc_sp_pre(MDOC_ARGS)
 {
 	struct roffsu	 su;
 	struct htmlpair	 tag;
 
 	SCALE_VS_INIT(&su, 1);
 
 	if (MDOC_sp == n->tok) {
 		if (NULL != (n = n->child))
 			if ( ! a2roffsu(n->string, &su, SCALE_VS))
 				SCALE_VS_INIT(&su, atoi(n->string));
 	} else
 		su.scale = 0.0;
 
 	bufinit(h);
 	bufcat_su(h, "height", &su);
 	PAIR_STYLE_INIT(&tag, h);
 	print_otag(h, TAG_DIV, 1, &tag);
 
 	/* So the div isn't empty: */
 	print_text(h, "\\~");
 
 	return(0);
 
 }
 
 static int
 mdoc_lk_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag[2];
 
 	if (NULL == (n = n->child))
 		return(0);
 
 	assert(MDOC_TEXT == n->type);
 
 	PAIR_CLASS_INIT(&tag[0], "link-ext");
 	PAIR_HREF_INIT(&tag[1], n->string);
 
 	print_otag(h, TAG_A, 2, tag);
 
 	if (NULL == n->next)
 		print_text(h, n->string);
 
 	for (n = n->next; n; n = n->next)
 		print_text(h, n->string);
 
 	return(0);
 }
 
 static int
 mdoc_mt_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag[2];
 	struct tag	*t;
 
 	PAIR_CLASS_INIT(&tag[0], "link-mail");
 
 	for (n = n->child; n; n = n->next) {
 		assert(MDOC_TEXT == n->type);
 
 		bufinit(h);
 		bufcat(h, "mailto:");
 		bufcat(h, n->string);
 
 		PAIR_HREF_INIT(&tag[1], h->buf);
 		t = print_otag(h, TAG_A, 2, tag);
 		print_text(h, n->string);
 		print_tagq(h, t);
 	}
 
 	return(0);
 }
 
 static int
 mdoc_fo_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 	struct tag	*t;
 
 	if (MDOC_BODY == n->type) {
 		h->flags |= HTML_NOSPACE;
 		print_text(h, "(");
 		h->flags |= HTML_NOSPACE;
 		return(1);
 	} else if (MDOC_BLOCK == n->type) {
 		synopsis_pre(h, n);
 		return(1);
 	}
 
 	/* XXX: we drop non-initial arguments as per groff. */
 
 	assert(n->child);
 	assert(n->child->string);
 
 	PAIR_CLASS_INIT(&tag, "fname");
 	t = print_otag(h, TAG_B, 1, &tag);
 	print_text(h, n->child->string);
 	print_tagq(h, t);
 	return(0);
 }
 
 static void
 mdoc_fo_post(MDOC_ARGS)
 {
 
 	if (MDOC_BODY != n->type)
 		return;
 	h->flags |= HTML_NOSPACE;
 	print_text(h, ")");
 	h->flags |= HTML_NOSPACE;
 	print_text(h, ";");
 }
 
 static int
 mdoc_in_pre(MDOC_ARGS)
 {
 	struct tag	*t;
 	struct htmlpair	 tag[2];
 	int		 i;
 
 	synopsis_pre(h, n);
 
 	PAIR_CLASS_INIT(&tag[0], "includes");
 	print_otag(h, TAG_B, 1, tag);
 
 	/*
 	 * The first argument of the `In' gets special treatment as
 	 * being a linked value.  Subsequent values are printed
 	 * afterward.  groff does similarly.  This also handles the case
 	 * of no children.
 	 */
 
 	if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags)
 		print_text(h, "#include");
 
 	print_text(h, "<");
 	h->flags |= HTML_NOSPACE;
 
 	if (NULL != (n = n->child)) {
 		assert(MDOC_TEXT == n->type);
 
 		PAIR_CLASS_INIT(&tag[0], "link-includes");
 
 		i = 1;
 		if (h->base_includes) {
 			buffmt_includes(h, n->string);
 			PAIR_HREF_INIT(&tag[i], h->buf);
 			i++;
 		}
 
 		t = print_otag(h, TAG_A, i, tag);
 		print_text(h, n->string);
 		print_tagq(h, t);
 
 		n = n->next;
 	}
 
 	h->flags |= HTML_NOSPACE;
 	print_text(h, ">");
 
 	for ( ; n; n = n->next) {
 		assert(MDOC_TEXT == n->type);
 		print_text(h, n->string);
 	}
 
 	return(0);
 }
 
 static int
 mdoc_ic_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "cmd");
 	print_otag(h, TAG_B, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_rv_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 	struct tag	*t;
 	int		 nchild;
 
 	if (n->prev)
 		print_otag(h, TAG_BR, 0, NULL);
 
 	PAIR_CLASS_INIT(&tag, "fname");
 
 	nchild = n->nchild;
 	if (nchild > 0) {
 		print_text(h, "The");
 
 		for (n = n->child; n; n = n->next) {
 			t = print_otag(h, TAG_B, 1, &tag);
 			print_text(h, n->string);
 			print_tagq(h, t);
 
 			h->flags |= HTML_NOSPACE;
 			print_text(h, "()");
 
 			if (n->next == NULL)
 				continue;
 
 			if (nchild > 2) {
 				h->flags |= HTML_NOSPACE;
 				print_text(h, ",");
 			}
 			if (n->next->next == NULL)
 				print_text(h, "and");
 		}
 
 		if (nchild > 1)
 			print_text(h, "functions return");
 		else
 			print_text(h, "function returns");
 
 		print_text(h, "the value\\~0 if successful;");
 	} else
 		print_text(h, "Upon successful completion,"
                     " the value\\~0 is returned;");
 
 	print_text(h, "otherwise the value\\~\\-1 is returned"
 	   " and the global variable");
 
 	PAIR_CLASS_INIT(&tag, "var");
 	t = print_otag(h, TAG_B, 1, &tag);
 	print_text(h, "errno");
 	print_tagq(h, t);
 	print_text(h, "is set to indicate the error.");
 	return(0);
 }
 
 static int
 mdoc_va_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "var");
 	print_otag(h, TAG_B, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_ap_pre(MDOC_ARGS)
 {
 
 	h->flags |= HTML_NOSPACE;
 	print_text(h, "\\(aq");
 	h->flags |= HTML_NOSPACE;
 	return(1);
 }
 
 static int
 mdoc_bf_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag[2];
 	struct roffsu	 su;
 
 	if (MDOC_HEAD == n->type)
 		return(0);
 	else if (MDOC_BODY != n->type)
 		return(1);
 
 	if (FONT_Em == n->norm->Bf.font)
 		PAIR_CLASS_INIT(&tag[0], "emph");
 	else if (FONT_Sy == n->norm->Bf.font)
 		PAIR_CLASS_INIT(&tag[0], "symb");
 	else if (FONT_Li == n->norm->Bf.font)
 		PAIR_CLASS_INIT(&tag[0], "lit");
 	else
 		PAIR_CLASS_INIT(&tag[0], "none");
 
 	/*
 	 * We want this to be inline-formatted, but needs to be div to
 	 * accept block children.
 	 */
 	bufinit(h);
 	bufcat_style(h, "display", "inline");
 	SCALE_HS_INIT(&su, 1);
 	/* Needs a left-margin for spacing. */
 	bufcat_su(h, "margin-left", &su);
 	PAIR_STYLE_INIT(&tag[1], h);
 	print_otag(h, TAG_DIV, 2, tag);
 	return(1);
 }
 
 static int
 mdoc_ms_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "symb");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_igndelim_pre(MDOC_ARGS)
 {
 
 	h->flags |= HTML_IGNDELIM;
 	return(1);
 }
 
 static void
 mdoc_pf_post(MDOC_ARGS)
 {
 
-	h->flags |= HTML_NOSPACE;
+	if ( ! (n->next == NULL || n->next->flags & MDOC_LINE))
+		h->flags |= HTML_NOSPACE;
 }
 
 static int
 mdoc_rs_pre(MDOC_ARGS)
 {
 	struct htmlpair	 tag;
 
 	if (MDOC_BLOCK != n->type)
 		return(1);
 
 	if (n->prev && SEC_SEE_ALSO == n->sec)
 		print_paragraph(h);
 
 	PAIR_CLASS_INIT(&tag, "ref");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_no_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "none");
 	print_otag(h, TAG_CODE, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_li_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "lit");
 	print_otag(h, TAG_CODE, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_sy_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	PAIR_CLASS_INIT(&tag, "symb");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc_bt_pre(MDOC_ARGS)
 {
 
 	print_text(h, "is currently in beta test.");
 	return(0);
 }
 
 static int
 mdoc_ud_pre(MDOC_ARGS)
 {
 
 	print_text(h, "currently under development.");
 	return(0);
 }
 
 static int
 mdoc_lb_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	if (SEC_LIBRARY == n->sec && MDOC_LINE & n->flags && n->prev)
 		print_otag(h, TAG_BR, 0, NULL);
 
 	PAIR_CLASS_INIT(&tag, "lib");
 	print_otag(h, TAG_SPAN, 1, &tag);
 	return(1);
 }
 
 static int
 mdoc__x_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag[2];
 	enum htmltag	t;
 
 	t = TAG_SPAN;
 
 	switch (n->tok) {
 	case MDOC__A:
 		PAIR_CLASS_INIT(&tag[0], "ref-auth");
 		if (n->prev && MDOC__A == n->prev->tok)
 			if (NULL == n->next || MDOC__A != n->next->tok)
 				print_text(h, "and");
 		break;
 	case MDOC__B:
 		PAIR_CLASS_INIT(&tag[0], "ref-book");
 		t = TAG_I;
 		break;
 	case MDOC__C:
 		PAIR_CLASS_INIT(&tag[0], "ref-city");
 		break;
 	case MDOC__D:
 		PAIR_CLASS_INIT(&tag[0], "ref-date");
 		break;
 	case MDOC__I:
 		PAIR_CLASS_INIT(&tag[0], "ref-issue");
 		t = TAG_I;
 		break;
 	case MDOC__J:
 		PAIR_CLASS_INIT(&tag[0], "ref-jrnl");
 		t = TAG_I;
 		break;
 	case MDOC__N:
 		PAIR_CLASS_INIT(&tag[0], "ref-num");
 		break;
 	case MDOC__O:
 		PAIR_CLASS_INIT(&tag[0], "ref-opt");
 		break;
 	case MDOC__P:
 		PAIR_CLASS_INIT(&tag[0], "ref-page");
 		break;
 	case MDOC__Q:
 		PAIR_CLASS_INIT(&tag[0], "ref-corp");
 		break;
 	case MDOC__R:
 		PAIR_CLASS_INIT(&tag[0], "ref-rep");
 		break;
 	case MDOC__T:
 		PAIR_CLASS_INIT(&tag[0], "ref-title");
 		break;
 	case MDOC__U:
 		PAIR_CLASS_INIT(&tag[0], "link-ref");
 		break;
 	case MDOC__V:
 		PAIR_CLASS_INIT(&tag[0], "ref-vol");
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 
 	if (MDOC__U != n->tok) {
 		print_otag(h, t, 1, tag);
 		return(1);
 	}
 
 	PAIR_HREF_INIT(&tag[1], n->child->string);
 	print_otag(h, TAG_A, 2, tag);
 
 	return(1);
 }
 
 static void
 mdoc__x_post(MDOC_ARGS)
 {
 
 	if (MDOC__A == n->tok && n->next && MDOC__A == n->next->tok)
 		if (NULL == n->next->next || MDOC__A != n->next->next->tok)
 			if (NULL == n->prev || MDOC__A != n->prev->tok)
 				return;
 
 	/* TODO: %U */
 
 	if (NULL == n->parent || MDOC_Rs != n->parent->tok)
 		return;
 
 	h->flags |= HTML_NOSPACE;
 	print_text(h, n->next ? "," : ".");
 }
 
 static int
 mdoc_bk_pre(MDOC_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		break;
 	case MDOC_HEAD:
 		return(0);
 	case MDOC_BODY:
 		if (n->parent->args || 0 == n->prev->nchild)
 			h->flags |= HTML_PREKEEP;
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 
 	return(1);
 }
 
 static void
 mdoc_bk_post(MDOC_ARGS)
 {
 
 	if (MDOC_BODY == n->type)
 		h->flags &= ~(HTML_KEEP | HTML_PREKEEP);
 }
 
 static int
 mdoc_quote_pre(MDOC_ARGS)
 {
 	struct htmlpair	tag;
 
 	if (MDOC_BODY != n->type)
 		return(1);
 
 	switch (n->tok) {
 	case MDOC_Ao:
 		/* FALLTHROUGH */
 	case MDOC_Aq:
 		print_text(h, n->parent->prev != NULL &&
 		    n->parent->prev->tok == MDOC_An ?  "<" : "\\(la");
 		break;
 	case MDOC_Bro:
 		/* FALLTHROUGH */
 	case MDOC_Brq:
 		print_text(h, "\\(lC");
 		break;
 	case MDOC_Bo:
 		/* FALLTHROUGH */
 	case MDOC_Bq:
 		print_text(h, "\\(lB");
 		break;
 	case MDOC_Oo:
 		/* FALLTHROUGH */
 	case MDOC_Op:
 		print_text(h, "\\(lB");
 		h->flags |= HTML_NOSPACE;
 		PAIR_CLASS_INIT(&tag, "opt");
 		print_otag(h, TAG_SPAN, 1, &tag);
 		break;
 	case MDOC_En:
 		if (NULL == n->norm->Es ||
 		    NULL == n->norm->Es->child)
 			return(1);
 		print_text(h, n->norm->Es->child->string);
 		break;
 	case MDOC_Eo:
 		break;
 	case MDOC_Do:
 		/* FALLTHROUGH */
 	case MDOC_Dq:
 		/* FALLTHROUGH */
 	case MDOC_Qo:
 		/* FALLTHROUGH */
 	case MDOC_Qq:
 		print_text(h, "\\(lq");
 		break;
 	case MDOC_Po:
 		/* FALLTHROUGH */
 	case MDOC_Pq:
 		print_text(h, "(");
 		break;
 	case MDOC_Ql:
 		print_text(h, "\\(oq");
 		h->flags |= HTML_NOSPACE;
 		PAIR_CLASS_INIT(&tag, "lit");
 		print_otag(h, TAG_CODE, 1, &tag);
 		break;
 	case MDOC_So:
 		/* FALLTHROUGH */
 	case MDOC_Sq:
 		print_text(h, "\\(oq");
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 
 	h->flags |= HTML_NOSPACE;
 	return(1);
 }
 
 static void
 mdoc_quote_post(MDOC_ARGS)
 {
 
 	if (n->type != MDOC_BODY && n->type != MDOC_ELEM)
 		return;
 
 	if ( ! (n->tok == MDOC_En ||
 	    (n->tok == MDOC_Eo && n->end == ENDBODY_SPACE)))
 		h->flags |= HTML_NOSPACE;
 
 	switch (n->tok) {
 	case MDOC_Ao:
 		/* FALLTHROUGH */
 	case MDOC_Aq:
 		print_text(h, n->parent->prev != NULL &&
 		    n->parent->prev->tok == MDOC_An ?  ">" : "\\(ra");
 		break;
 	case MDOC_Bro:
 		/* FALLTHROUGH */
 	case MDOC_Brq:
 		print_text(h, "\\(rC");
 		break;
 	case MDOC_Oo:
 		/* FALLTHROUGH */
 	case MDOC_Op:
 		/* FALLTHROUGH */
 	case MDOC_Bo:
 		/* FALLTHROUGH */
 	case MDOC_Bq:
 		print_text(h, "\\(rB");
 		break;
 	case MDOC_En:
 		if (NULL != n->norm->Es &&
 		    NULL != n->norm->Es->child &&
 		    NULL != n->norm->Es->child->next) {
 			h->flags |= HTML_NOSPACE;
 			print_text(h, n->norm->Es->child->next->string);
 		}
 		break;
 	case MDOC_Eo:
 		break;
 	case MDOC_Qo:
 		/* FALLTHROUGH */
 	case MDOC_Qq:
 		/* FALLTHROUGH */
 	case MDOC_Do:
 		/* FALLTHROUGH */
 	case MDOC_Dq:
 		print_text(h, "\\(rq");
 		break;
 	case MDOC_Po:
 		/* FALLTHROUGH */
 	case MDOC_Pq:
 		print_text(h, ")");
 		break;
 	case MDOC_Ql:
 		/* FALLTHROUGH */
 	case MDOC_So:
 		/* FALLTHROUGH */
 	case MDOC_Sq:
 		print_text(h, "\\(cq");
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 }
Index: projects/arm_intrng/contrib/mdocml/mdoc_macro.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/mdoc_macro.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/mdoc_macro.c	(revision 276248)
@@ -1,1548 +1,1564 @@
-/*	$Id: mdoc_macro.c,v 1.154 2014/11/29 04:31:35 schwarze Exp $ */
+/*	$Id: mdoc_macro.c,v 1.157 2014/12/13 13:14:39 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons 
  * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "mdoc.h"
 #include "mandoc.h"
 #include "libmdoc.h"
 #include "libmandoc.h"
 
 enum	rew {	/* see rew_dohalt() */
 	REWIND_NONE,
 	REWIND_THIS,
 	REWIND_MORE,
 	REWIND_FORCE,
 	REWIND_LATER,
 	REWIND_ERROR
 };
 
 static	void		blk_full(MACRO_PROT_ARGS);
 static	void		blk_exp_close(MACRO_PROT_ARGS);
 static	void		blk_part_exp(MACRO_PROT_ARGS);
 static	void		blk_part_imp(MACRO_PROT_ARGS);
 static	void		ctx_synopsis(MACRO_PROT_ARGS);
 static	void		in_line_eoln(MACRO_PROT_ARGS);
 static	void		in_line_argn(MACRO_PROT_ARGS);
 static	void		in_line(MACRO_PROT_ARGS);
 static	void		phrase_ta(MACRO_PROT_ARGS);
 
 static	void		dword(struct mdoc *, int, int, const char *,
 				 enum mdelim, int);
 static	void		append_delims(struct mdoc *, int, int *, char *);
-static	enum mdoct	lookup(enum mdoct, const char *);
+static	enum mdoct	lookup(struct mdoc *, enum mdoct,
+				int, int, const char *);
 static	int		macro_or_word(MACRO_PROT_ARGS, int);
 static	int		make_pending(struct mdoc_node *, enum mdoct,
 				struct mdoc *, int, int);
 static	int		parse_rest(struct mdoc *, enum mdoct,
 				int, int *, char *);
 static	enum mdoct	rew_alt(enum mdoct);
 static	enum rew	rew_dohalt(enum mdoct, enum mdoc_type,
 				const struct mdoc_node *);
 static	void		rew_elem(struct mdoc *, enum mdoct);
 static	void		rew_last(struct mdoc *, const struct mdoc_node *);
 static	void		rew_sub(enum mdoc_type, struct mdoc *,
 				enum mdoct, int, int);
 
 const	struct mdoc_macro __mdoc_macros[MDOC_MAX] = {
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ap */
 	{ in_line_eoln, MDOC_PROLOGUE }, /* Dd */
 	{ in_line_eoln, MDOC_PROLOGUE }, /* Dt */
 	{ in_line_eoln, MDOC_PROLOGUE }, /* Os */
 	{ blk_full, MDOC_PARSED | MDOC_JOIN }, /* Sh */
 	{ blk_full, MDOC_PARSED | MDOC_JOIN }, /* Ss */
 	{ in_line_eoln, 0 }, /* Pp */
 	{ blk_part_imp, MDOC_PARSED | MDOC_JOIN }, /* D1 */
 	{ blk_part_imp, MDOC_PARSED | MDOC_JOIN }, /* Dl */
 	{ blk_full, MDOC_EXPLICIT }, /* Bd */
 	{ blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ed */
 	{ blk_full, MDOC_EXPLICIT }, /* Bl */
 	{ blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* El */
 	{ blk_full, MDOC_PARSED | MDOC_JOIN }, /* It */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ad */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* An */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ar */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Cd */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Cm */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Dv */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Er */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ev */
 	{ in_line_eoln, 0 }, /* Ex */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fa */
 	{ in_line_eoln, 0 }, /* Fd */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fl */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fn */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ft */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ic */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* In */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Li */
 	{ blk_full, MDOC_JOIN }, /* Nd */
 	{ ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Nm */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Op */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ot */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */
 	{ in_line_eoln, 0 }, /* Rv */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Va */
 	{ ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Vt */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Xr */
 	{ in_line_eoln, MDOC_JOIN }, /* %A */
 	{ in_line_eoln, MDOC_JOIN }, /* %B */
 	{ in_line_eoln, MDOC_JOIN }, /* %D */
 	{ in_line_eoln, MDOC_JOIN }, /* %I */
 	{ in_line_eoln, MDOC_JOIN }, /* %J */
 	{ in_line_eoln, 0 }, /* %N */
 	{ in_line_eoln, MDOC_JOIN }, /* %O */
 	{ in_line_eoln, 0 }, /* %P */
 	{ in_line_eoln, MDOC_JOIN }, /* %R */
 	{ in_line_eoln, MDOC_JOIN }, /* %T */
 	{ in_line_eoln, 0 }, /* %V */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Ac */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_EXPLICIT | MDOC_JOIN }, /* Ao */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Aq */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* At */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Bc */
 	{ blk_full, MDOC_EXPLICIT }, /* Bf */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_EXPLICIT | MDOC_JOIN }, /* Bo */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Bq */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Bsx */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Bx */
 	{ in_line_eoln, 0 }, /* Db */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Dc */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_EXPLICIT | MDOC_JOIN }, /* Do */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Dq */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Ec */
 	{ blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ef */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Em */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Eo */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Fx */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ms */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* No */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_IGNDELIM | MDOC_JOIN }, /* Ns */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Nx */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Ox */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Pc */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_IGNDELIM }, /* Pf */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_EXPLICIT | MDOC_JOIN }, /* Po */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Pq */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Qc */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ql */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_EXPLICIT | MDOC_JOIN }, /* Qo */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Qq */
 	{ blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Re */
 	{ blk_full, MDOC_EXPLICIT }, /* Rs */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Sc */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_EXPLICIT | MDOC_JOIN }, /* So */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sq */
 	{ in_line_argn, 0 }, /* Sm */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sx */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Sy */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Tn */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ux */
 	{ blk_exp_close, MDOC_EXPLICIT | MDOC_CALLABLE | MDOC_PARSED }, /* Xc */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED | MDOC_EXPLICIT }, /* Xo */
 	{ blk_full, MDOC_EXPLICIT | MDOC_CALLABLE }, /* Fo */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Fc */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_EXPLICIT | MDOC_JOIN }, /* Oo */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Oc */
 	{ blk_full, MDOC_EXPLICIT }, /* Bk */
 	{ blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ek */
 	{ in_line_eoln, 0 }, /* Bt */
 	{ in_line_eoln, 0 }, /* Hf */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fr */
 	{ in_line_eoln, 0 }, /* Ud */
 	{ in_line, 0 }, /* Lb */
 	{ in_line_eoln, 0 }, /* Lp */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Lk */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Mt */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Brq */
 	{ blk_part_exp, MDOC_CALLABLE | MDOC_PARSED |
 			MDOC_EXPLICIT | MDOC_JOIN }, /* Bro */
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Brc */
 	{ in_line_eoln, MDOC_JOIN }, /* %C */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Es */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* En */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */
 	{ in_line_eoln, MDOC_JOIN }, /* %Q */
 	{ in_line_eoln, 0 }, /* br */
 	{ in_line_eoln, 0 }, /* sp */
 	{ in_line_eoln, 0 }, /* %U */
 	{ phrase_ta, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ta */
 	{ in_line_eoln, MDOC_PROLOGUE }, /* ll */
 };
 
 const	struct mdoc_macro * const mdoc_macros = __mdoc_macros;
 
 
 /*
  * This is called at the end of parsing.  It must traverse up the tree,
  * closing out open [implicit] scopes.  Obviously, open explicit scopes
  * are errors.
  */
 void
 mdoc_macroend(struct mdoc *mdoc)
 {
 	struct mdoc_node *n;
 
 	/* Scan for open explicit scopes. */
 
 	n = mdoc->last->flags & MDOC_VALID ?
 	    mdoc->last->parent : mdoc->last;
 
 	for ( ; n; n = n->parent)
 		if (n->type == MDOC_BLOCK &&
 		    mdoc_macros[n->tok].flags & MDOC_EXPLICIT)
 			mandoc_msg(MANDOCERR_BLK_NOEND, mdoc->parse,
 			    n->line, n->pos, mdoc_macronames[n->tok]);
 
 	/* Rewind to the first. */
 
 	rew_last(mdoc, mdoc->first);
 }
 
 /*
  * Look up the macro at *p called by "from",
  * or as a line macro if from == MDOC_MAX.
  */
 static enum mdoct
-lookup(enum mdoct from, const char *p)
+lookup(struct mdoc *mdoc, enum mdoct from, int line, int ppos, const char *p)
 {
 	enum mdoct	 res;
 
 	if (from == MDOC_MAX || mdoc_macros[from].flags & MDOC_PARSED) {
 		res = mdoc_hash_find(p);
-		if (res != MDOC_MAX && mdoc_macros[res].flags & MDOC_CALLABLE)
-			return(res);
+		if (res != MDOC_MAX) {
+			if (mdoc_macros[res].flags & MDOC_CALLABLE)
+				return(res);
+			if (res != MDOC_br && res != MDOC_sp && res != MDOC_ll)
+				mandoc_msg(MANDOCERR_MACRO_CALL,
+				    mdoc->parse, line, ppos, p);
+		}
 	}
 	return(MDOC_MAX);
 }
 
 static void
 rew_last(struct mdoc *mdoc, const struct mdoc_node *to)
 {
 	struct mdoc_node *n, *np;
 
 	assert(to);
 	mdoc->next = MDOC_NEXT_SIBLING;
 	while (mdoc->last != to) {
 		/*
 		 * Save the parent here, because we may delete the
 		 * mdoc->last node in the post-validation phase and reset
 		 * it to mdoc->last->parent, causing a step in the closing
 		 * out to be lost.
 		 */
 		np = mdoc->last->parent;
 		mdoc_valid_post(mdoc);
 		n = mdoc->last;
 		mdoc->last = np;
 		assert(mdoc->last);
 		mdoc->last->last = n;
 	}
 	mdoc_valid_post(mdoc);
 }
 
 /*
  * For a block closing macro, return the corresponding opening one.
  * Otherwise, return the macro itself.
  */
 static enum mdoct
 rew_alt(enum mdoct tok)
 {
 	switch (tok) {
 	case MDOC_Ac:
 		return(MDOC_Ao);
 	case MDOC_Bc:
 		return(MDOC_Bo);
 	case MDOC_Brc:
 		return(MDOC_Bro);
 	case MDOC_Dc:
 		return(MDOC_Do);
 	case MDOC_Ec:
 		return(MDOC_Eo);
 	case MDOC_Ed:
 		return(MDOC_Bd);
 	case MDOC_Ef:
 		return(MDOC_Bf);
 	case MDOC_Ek:
 		return(MDOC_Bk);
 	case MDOC_El:
 		return(MDOC_Bl);
 	case MDOC_Fc:
 		return(MDOC_Fo);
 	case MDOC_Oc:
 		return(MDOC_Oo);
 	case MDOC_Pc:
 		return(MDOC_Po);
 	case MDOC_Qc:
 		return(MDOC_Qo);
 	case MDOC_Re:
 		return(MDOC_Rs);
 	case MDOC_Sc:
 		return(MDOC_So);
 	case MDOC_Xc:
 		return(MDOC_Xo);
 	default:
 		return(tok);
 	}
 	/* NOTREACHED */
 }
 
 /*
  * Rewinding to tok, how do we have to handle *p?
  * REWIND_NONE: *p would delimit tok, but no tok scope is open
  *   inside *p, so there is no need to rewind anything at all.
  * REWIND_THIS: *p matches tok, so rewind *p and nothing else.
  * REWIND_MORE: *p is implicit, rewind it and keep searching for tok.
  * REWIND_FORCE: *p is explicit, but tok is full, force rewinding *p.
  * REWIND_LATER: *p is explicit and still open, postpone rewinding.
  * REWIND_ERROR: No tok block is open at all.
  */
 static enum rew
 rew_dohalt(enum mdoct tok, enum mdoc_type type,
 		const struct mdoc_node *p)
 {
 
 	/*
 	 * No matching token, no delimiting block, no broken block.
 	 * This can happen when full implicit macros are called for
 	 * the first time but try to rewind their previous
 	 * instance anyway.
 	 */
 	if (MDOC_ROOT == p->type)
 		return(MDOC_BLOCK == type &&
 		    MDOC_EXPLICIT & mdoc_macros[tok].flags ?
 		    REWIND_ERROR : REWIND_NONE);
 
 	/*
 	 * When starting to rewind, skip plain text
 	 * and nodes that have already been rewound.
 	 */
 	if (MDOC_TEXT == p->type || MDOC_VALID & p->flags)
 		return(REWIND_MORE);
 
 	/*
 	 * The easiest case:  Found a matching token.
 	 * This applies to both blocks and elements.
 	 */
 	tok = rew_alt(tok);
 	if (tok == p->tok)
 		return(p->end ? REWIND_NONE :
 		    type == p->type ? REWIND_THIS : REWIND_MORE);
 
 	/*
 	 * While elements do require rewinding for themselves,
 	 * they never affect rewinding of other nodes.
 	 */
 	if (MDOC_ELEM == p->type)
 		return(REWIND_MORE);
 
 	/*
 	 * Blocks delimited by our target token get REWIND_MORE.
 	 * Blocks delimiting our target token get REWIND_NONE.
 	 */
 	switch (tok) {
 	case MDOC_Bl:
 		if (MDOC_It == p->tok)
 			return(REWIND_MORE);
 		break;
 	case MDOC_It:
 		if (MDOC_BODY == p->type && MDOC_Bl == p->tok)
 			return(REWIND_NONE);
 		break;
 	/*
 	 * XXX Badly nested block handling still fails badly
 	 * when one block is breaking two blocks of the same type.
 	 * This is an incomplete and extremely ugly workaround,
 	 * required to let the OpenBSD tree build.
 	 */
 	case MDOC_Oo:
 		if (MDOC_Op == p->tok)
 			return(REWIND_MORE);
 		break;
 	case MDOC_Nm:
 		return(REWIND_NONE);
 	case MDOC_Nd:
 		/* FALLTHROUGH */
 	case MDOC_Ss:
 		if (MDOC_BODY == p->type && MDOC_Sh == p->tok)
 			return(REWIND_NONE);
 		/* FALLTHROUGH */
 	case MDOC_Sh:
 		if (MDOC_ROOT == p->parent->type)
 			return(REWIND_THIS);
 		if (MDOC_Nd == p->tok || MDOC_Ss == p->tok ||
 		    MDOC_Sh == p->tok)
 			return(REWIND_MORE);
 		break;
 	default:
 		break;
 	}
 
 	/*
 	 * Default block rewinding rules.
 	 * In particular, always skip block end markers,
 	 * and let all blocks rewind Nm children.
 	 * Do not warn again when closing a block,
 	 * since closing the body already warned.
 	 */
 	if (ENDBODY_NOT != p->end || MDOC_Nm == p->tok ||
 	    MDOC_BLOCK == type || (MDOC_BLOCK == p->type &&
 	    ! (MDOC_EXPLICIT & mdoc_macros[tok].flags)))
 		return(REWIND_MORE);
 
 	/*
 	 * By default, closing out full blocks
 	 * forces closing of broken explicit blocks,
 	 * while closing out partial blocks
 	 * allows delayed rewinding by default.
 	 */
 	return (&blk_full == mdoc_macros[tok].fp ?
 	    REWIND_FORCE : REWIND_LATER);
 }
 
 static void
 rew_elem(struct mdoc *mdoc, enum mdoct tok)
 {
 	struct mdoc_node *n;
 
 	n = mdoc->last;
 	if (MDOC_ELEM != n->type)
 		n = n->parent;
 	assert(MDOC_ELEM == n->type);
 	assert(tok == n->tok);
 	rew_last(mdoc, n);
 }
 
 /*
  * We are trying to close a block identified by tok,
  * but the child block *broken is still open.
  * Thus, postpone closing the tok block
  * until the rew_sub call closing *broken.
  */
 static int
 make_pending(struct mdoc_node *broken, enum mdoct tok,
 		struct mdoc *mdoc, int line, int ppos)
 {
 	struct mdoc_node *breaker;
 
 	/*
 	 * Iterate backwards, searching for the block matching tok,
 	 * that is, the block breaking the *broken block.
 	 */
 	for (breaker = broken->parent; breaker; breaker = breaker->parent) {
 
 		/*
 		 * If the *broken block had already been broken before
 		 * and we encounter its breaker, make the tok block
 		 * pending on the inner breaker.
 		 * Graphically, "[A breaker=[B broken=[C->B B] tok=A] C]"
 		 * becomes "[A broken=[B [C->B B] tok=A] C]"
 		 * and finally "[A [B->A [C->B B] A] C]".
 		 */
 		if (breaker == broken->pending) {
 			broken = breaker;
 			continue;
 		}
 
 		if (REWIND_THIS != rew_dohalt(tok, MDOC_BLOCK, breaker))
 			continue;
 		if (MDOC_BODY == broken->type)
 			broken = broken->parent;
 
 		/*
 		 * Found the breaker.
 		 * If another, outer breaker is already pending on
 		 * the *broken block, we must not clobber the link
 		 * to the outer breaker, but make it pending on the
 		 * new, now inner breaker.
 		 * Graphically, "[A breaker=[B broken=[C->A A] tok=B] C]"
 		 * becomes "[A breaker=[B->A broken=[C A] tok=B] C]"
 		 * and finally "[A [B->A [C->B A] B] C]".
 		 */
 		if (broken->pending) {
 			struct mdoc_node *taker;
 
 			/*
 			 * If the breaker had also been broken before,
 			 * it cannot take on the outer breaker itself,
 			 * but must hand it on to its own breakers.
 			 * Graphically, this is the following situation:
 			 * "[A [B breaker=[C->B B] broken=[D->A A] tok=C] D]"
 			 * "[A taker=[B->A breaker=[C->B B] [D->C A] C] D]"
 			 */
 			taker = breaker;
 			while (taker->pending)
 				taker = taker->pending;
 			taker->pending = broken->pending;
 		}
 		broken->pending = breaker;
 		mandoc_vmsg(MANDOCERR_BLK_NEST, mdoc->parse, line, ppos,
 		    "%s breaks %s", mdoc_macronames[tok],
 		    mdoc_macronames[broken->tok]);
 		return(1);
 	}
 
 	/*
 	 * Found no matching block for tok.
 	 * Are you trying to close a block that is not open?
 	 */
 	return(0);
 }
 
 static void
 rew_sub(enum mdoc_type t, struct mdoc *mdoc,
 		enum mdoct tok, int line, int ppos)
 {
 	struct mdoc_node *n;
 
 	n = mdoc->last;
 	while (n) {
 		switch (rew_dohalt(tok, t, n)) {
 		case REWIND_NONE:
 			return;
 		case REWIND_THIS:
 			n->lastline = line -
 			    (mdoc->flags & MDOC_NEWLINE &&
 			     ! (mdoc_macros[tok].flags & MDOC_EXPLICIT));
 			break;
 		case REWIND_FORCE:
 			mandoc_vmsg(MANDOCERR_BLK_BROKEN, mdoc->parse,
 			    line, ppos, "%s breaks %s",
 			    mdoc_macronames[tok],
 			    mdoc_macronames[n->tok]);
 			/* FALLTHROUGH */
 		case REWIND_MORE:
 			n->lastline = line -
 			    (mdoc->flags & MDOC_NEWLINE ? 1 : 0);
 			n = n->parent;
 			continue;
 		case REWIND_LATER:
 			if (make_pending(n, tok, mdoc, line, ppos) ||
 			    t != MDOC_BLOCK)
 				return;
 			/* FALLTHROUGH */
 		case REWIND_ERROR:
 			mandoc_msg(MANDOCERR_BLK_NOTOPEN,
 			    mdoc->parse, line, ppos,
 			    mdoc_macronames[tok]);
 			return;
 		}
 		break;
 	}
 	assert(n);
 	rew_last(mdoc, n);
 
 	/*
 	 * The current block extends an enclosing block.
 	 * Now that the current block ends, close the enclosing block, too.
 	 */
 	while ((n = n->pending) != NULL) {
 		rew_last(mdoc, n);
 		if (n->type == MDOC_HEAD)
 			mdoc_body_alloc(mdoc, n->line, n->pos, n->tok);
 	}
 }
 
 /*
  * Allocate a word and check whether it's punctuation or not.
  * Punctuation consists of those tokens found in mdoc_isdelim().
  */
 static void
 dword(struct mdoc *mdoc, int line, int col, const char *p,
 		enum mdelim d, int may_append)
 {
 
 	if (d == DELIM_MAX)
 		d = mdoc_isdelim(p);
 
 	if (may_append &&
 	    ! (mdoc->flags & (MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF)) &&
 	    d == DELIM_NONE && mdoc->last->type == MDOC_TEXT &&
 	    mdoc_isdelim(mdoc->last->string) == DELIM_NONE) {
 		mdoc_word_append(mdoc, p);
 		return;
 	}
 
 	mdoc_word_alloc(mdoc, line, col, p);
 
 	/*
 	 * If the word consists of a bare delimiter,
 	 * flag the new node accordingly,
 	 * unless doing so was vetoed by the invoking macro.
 	 * Always clear the veto, it is only valid for one word.
 	 */
 
 	if (d == DELIM_OPEN)
 		mdoc->last->flags |= MDOC_DELIMO;
 	else if (d == DELIM_CLOSE &&
 	    ! (mdoc->flags & MDOC_NODELIMC) &&
 	    mdoc->last->parent->tok != MDOC_Fd)
 		mdoc->last->flags |= MDOC_DELIMC;
 	mdoc->flags &= ~MDOC_NODELIMC;
 }
 
 static void
 append_delims(struct mdoc *mdoc, int line, int *pos, char *buf)
 {
 	char		*p;
 	int		 la;
 
 	if (buf[*pos] == '\0')
 		return;
 
 	for (;;) {
 		la = *pos;
 		if (mdoc_args(mdoc, line, pos, buf, MDOC_MAX, &p) == ARGS_EOLN)
 			break;
 		dword(mdoc, line, la, p, DELIM_MAX, 1);
 
 		/*
 		 * If we encounter end-of-sentence symbols, then trigger
 		 * the double-space.
 		 *
 		 * XXX: it's easy to allow this to propagate outward to
 		 * the last symbol, such that `. )' will cause the
 		 * correct double-spacing.  However, (1) groff isn't
 		 * smart enough to do this and (2) it would require
 		 * knowing which symbols break this behaviour, for
 		 * example, `.  ;' shouldn't propagate the double-space.
 		 */
 
 		if (mandoc_eos(p, strlen(p)))
 			mdoc->last->flags |= MDOC_EOS;
 	}
 }
 
 /*
  * Parse one word.
  * If it is a macro, call it and return 1.
  * Otherwise, allocate it and return 0.
  */
 static int
 macro_or_word(MACRO_PROT_ARGS, int parsed)
 {
 	char		*p;
 	enum mdoct	 ntok;
 
 	p = buf + ppos;
 	ntok = MDOC_MAX;
-	if (mdoc->flags & MDOC_PHRASELIT)
-		/* nothing */;
-	else if (*p == '"')
+	if (*p == '"')
 		p++;
-	else if (parsed)
-		ntok = lookup(tok, p);
+	else if (parsed && ! (mdoc->flags & MDOC_PHRASELIT))
+		ntok = lookup(mdoc, tok, line, ppos, p);
 
 	if (ntok == MDOC_MAX) {
 		dword(mdoc, line, ppos, p, DELIM_MAX, tok == MDOC_MAX ||
 		    mdoc_macros[tok].flags & MDOC_JOIN);
 		return(0);
 	} else {
 		if (mdoc_macros[tok].fp == in_line_eoln)
 			rew_elem(mdoc, tok);
 		mdoc_macro(mdoc, ntok, line, ppos, pos, buf);
 		if (tok == MDOC_MAX)
 			append_delims(mdoc, line, pos, buf);
 		return(1);
 	}
 }
 
 /*
  * Close out block partial/full explicit.
  */
 static void
 blk_exp_close(MACRO_PROT_ARGS)
 {
 	struct mdoc_node *body;		/* Our own body. */
 	struct mdoc_node *endbody;	/* Our own end marker. */
 	struct mdoc_node *later;	/* A sub-block starting later. */
 	struct mdoc_node *n;		/* For searching backwards. */
 
 	int		 j, lastarg, maxargs, flushed, nl;
 	enum margserr	 ac;
 	enum mdoct	 atok, ntok;
 	char		*p;
 
 	nl = MDOC_NEWLINE & mdoc->flags;
 
 	switch (tok) {
 	case MDOC_Ec:
 		maxargs = 1;
 		break;
 	case MDOC_Ek:
 		mdoc->flags &= ~MDOC_KEEP;
 		/* FALLTHROUGH */
 	default:
 		maxargs = 0;
 		break;
 	}
 
 	/*
 	 * Search backwards for beginnings of blocks,
 	 * both of our own and of pending sub-blocks.
 	 */
 
 	atok = rew_alt(tok);
 	body = endbody = later = NULL;
 	for (n = mdoc->last; n; n = n->parent) {
 		if (n->flags & MDOC_VALID)
 			continue;
 
 		/* Remember the start of our own body. */
 
 		if (n->type == MDOC_BODY && atok == n->tok) {
 			if (n->end == ENDBODY_NOT)
 				body = n;
 			continue;
 		}
 
 		if (n->type != MDOC_BLOCK || n->tok == MDOC_Nm)
 			continue;
 		if (atok == n->tok) {
 			assert(body);
 
 			/*
 			 * Found the start of our own block.
 			 * When there is no pending sub block,
 			 * just proceed to closing out.
 			 */
 
 			if (later == NULL)
 				break;
 
 			/*
 			 * When there is a pending sub block,
 			 * postpone closing out the current block
 			 * until the rew_sub() closing out the sub-block.
 			 */
 
 			make_pending(later, tok, mdoc, line, ppos);
 
 			/*
 			 * Mark the place where the formatting - but not
 			 * the scope - of the current block ends.
 			 */
 
 			mdoc_endbody_alloc(mdoc, line, ppos,
 			    atok, body, ENDBODY_SPACE);
 
 			/*
 			 * If a block closing macro taking arguments
 			 * breaks another block, put the arguments
 			 * into the end marker and remeber the
 			 * end marker in order to close it out.
 			 */
 
 			if (maxargs) {
 				endbody = mdoc->last;
 				mdoc->next = MDOC_NEXT_CHILD;
 			}
 			break;
 		}
 
 		/*
 		 * When finding an open sub block, remember the last
 		 * open explicit block, or, in case there are only
 		 * implicit ones, the first open implicit block.
 		 */
 
 		if (later &&
 		    mdoc_macros[later->tok].flags & MDOC_EXPLICIT)
 			continue;
 		if (n->tok != MDOC_It)
 			later = n;
 	}
 	rew_sub(MDOC_BODY, mdoc, tok, line, ppos);
 
 	if ( ! (mdoc_macros[tok].flags & MDOC_PARSED)) {
 		if (buf[*pos] != '\0')
 			mandoc_vmsg(MANDOCERR_ARG_SKIP,
 			    mdoc->parse, line, ppos,
 			    "%s %s", mdoc_macronames[tok],
 			    buf + *pos);
 		rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
 		return;
 	}
 
 	if (maxargs && endbody == NULL) {
 		if (n == NULL) {
 			/*
 			 * Stray .Ec without previous .Eo:
 			 * Break the output line, ignore any arguments.
 			 */
 			mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL);
 			rew_elem(mdoc, MDOC_br);
 		} else
 			mdoc_tail_alloc(mdoc, line, ppos, atok);
 	}
 
 	flushed = n == NULL;
 	for (j = 0; ; j++) {
 		lastarg = *pos;
 
 		if (j == maxargs && ! flushed) {
 			if (endbody == NULL)
 				rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
 			else
 				rew_last(mdoc, endbody);
 			flushed = 1;
 		}
 
 		ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
 		if (ac == ARGS_PUNCT || ac == ARGS_EOLN)
 			break;
 
-		ntok = ac == ARGS_QWORD ? MDOC_MAX : lookup(tok, p);
+		ntok = ac == ARGS_QWORD ? MDOC_MAX :
+		    lookup(mdoc, tok, line, lastarg, p);
 
 		if (ntok == MDOC_MAX) {
 			dword(mdoc, line, lastarg, p, DELIM_MAX,
 			    MDOC_JOIN & mdoc_macros[tok].flags);
 			continue;
 		}
 
 		if ( ! flushed) {
 			if (endbody == NULL)
 				rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
 			else
 				rew_last(mdoc, endbody);
 			flushed = 1;
 		}
 		mdoc->flags &= ~MDOC_NEWLINE;
 		mdoc_macro(mdoc, ntok, line, lastarg, pos, buf);
 		break;
 	}
 
 	if ( ! flushed) {
 		if (endbody == NULL)
 			rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
 		else
 			rew_last(mdoc, endbody);
 	}
 	if (nl)
 		append_delims(mdoc, line, pos, buf);
 }
 
 static void
 in_line(MACRO_PROT_ARGS)
 {
 	int		 la, scope, cnt, firstarg, mayopen, nc, nl;
 	enum mdoct	 ntok;
 	enum margserr	 ac;
 	enum mdelim	 d;
 	struct mdoc_arg	*arg;
 	char		*p;
 
 	nl = MDOC_NEWLINE & mdoc->flags;
 
 	/*
 	 * Whether we allow ignored elements (those without content,
 	 * usually because of reserved words) to squeak by.
 	 */
 
 	switch (tok) {
 	case MDOC_An:
 		/* FALLTHROUGH */
 	case MDOC_Ar:
 		/* FALLTHROUGH */
 	case MDOC_Fl:
 		/* FALLTHROUGH */
 	case MDOC_Mt:
 		/* FALLTHROUGH */
 	case MDOC_Nm:
 		/* FALLTHROUGH */
 	case MDOC_Pa:
 		nc = 1;
 		break;
 	default:
 		nc = 0;
 		break;
 	}
 
 	mdoc_argv(mdoc, line, tok, &arg, pos, buf);
 
 	d = DELIM_NONE;
 	firstarg = 1;
 	mayopen = 1;
 	for (cnt = scope = 0;; ) {
 		la = *pos;
 		ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
 
 		/*
 		 * At the end of a macro line,
 		 * opening delimiters do not suppress spacing.
 		 */
 
 		if (ac == ARGS_EOLN) {
 			if (d == DELIM_OPEN)
 				mdoc->last->flags &= ~MDOC_DELIMO;
 			break;
 		}
 
 		/*
 		 * The rest of the macro line is only punctuation,
 		 * to be handled by append_delims().
 		 * If there were no other arguments,
 		 * do not allow the first one to suppress spacing,
 		 * even if it turns out to be a closing one.
 		 */
 
 		if (ac == ARGS_PUNCT) {
 			if (cnt == 0 && nc == 0)
 				mdoc->flags |= MDOC_NODELIMC;
 			break;
 		}
 
 		ntok = (ac == ARGS_QWORD || (tok == MDOC_Fn && !cnt)) ?
-		    MDOC_MAX : lookup(tok, p);
+		    MDOC_MAX : lookup(mdoc, tok, line, la, p);
 
 		/*
 		 * In this case, we've located a submacro and must
 		 * execute it.  Close out scope, if open.  If no
 		 * elements have been generated, either create one (nc)
 		 * or raise a warning.
 		 */
 
 		if (ntok != MDOC_MAX) {
 			if (scope)
 				rew_elem(mdoc, tok);
 			if (nc && ! cnt) {
 				mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
 				rew_last(mdoc, mdoc->last);
 			} else if ( ! nc && ! cnt) {
 				mdoc_argv_free(arg);
 				mandoc_msg(MANDOCERR_MACRO_EMPTY,
 				    mdoc->parse, line, ppos,
 				    mdoc_macronames[tok]);
 			}
 			mdoc_macro(mdoc, ntok, line, la, pos, buf);
 			if (nl)
 				append_delims(mdoc, line, pos, buf);
 			return;
 		}
 
 		/*
 		 * Non-quote-enclosed punctuation.  Set up our scope, if
 		 * a word; rewind the scope, if a delimiter; then append
 		 * the word.
 		 */
 
 		d = ac == ARGS_QWORD ? DELIM_NONE : mdoc_isdelim(p);
 
 		if (DELIM_NONE != d) {
 			/*
 			 * If we encounter closing punctuation, no word
 			 * has been emitted, no scope is open, and we're
 			 * allowed to have an empty element, then start
 			 * a new scope.
 			 */
 			if ((d == DELIM_CLOSE ||
 			     (d == DELIM_MIDDLE && tok == MDOC_Fl)) &&
 			    !cnt && !scope && nc && mayopen) {
 				mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
 				scope = 1;
 				cnt++;
 				if (tok == MDOC_Nm)
 					mayopen = 0;
 			}
 			/*
 			 * Close out our scope, if one is open, before
 			 * any punctuation.
 			 */
 			if (scope)
 				rew_elem(mdoc, tok);
 			scope = 0;
 			if (tok == MDOC_Fn)
 				mayopen = 0;
 		} else if (mayopen && !scope) {
 			mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
 			scope = 1;
 			cnt++;
 		}
 
 		dword(mdoc, line, la, p, d,
 		    MDOC_JOIN & mdoc_macros[tok].flags);
 
 		/*
 		 * If the first argument is a closing delimiter,
 		 * do not suppress spacing before it.
 		 */
 
 		if (firstarg && d == DELIM_CLOSE && !nc)
 			mdoc->last->flags &= ~MDOC_DELIMC;
 		firstarg = 0;
 
 		/*
 		 * `Fl' macros have their scope re-opened with each new
 		 * word so that the `-' can be added to each one without
 		 * having to parse out spaces.
 		 */
 		if (scope && tok == MDOC_Fl) {
 			rew_elem(mdoc, tok);
 			scope = 0;
 		}
 	}
 
 	if (scope)
 		rew_elem(mdoc, tok);
 
 	/*
 	 * If no elements have been collected and we're allowed to have
 	 * empties (nc), open a scope and close it out.  Otherwise,
 	 * raise a warning.
 	 */
 
 	if ( ! cnt) {
 		if (nc) {
 			mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
 			rew_last(mdoc, mdoc->last);
 		} else {
 			mdoc_argv_free(arg);
 			mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
 			    line, ppos, mdoc_macronames[tok]);
 		}
 	}
 	if (nl)
 		append_delims(mdoc, line, pos, buf);
 }
 
 static void
 blk_full(MACRO_PROT_ARGS)
 {
 	int		  la, nl, parsed;
 	struct mdoc_arg	 *arg;
 	struct mdoc_node *head; /* save of head macro */
 	struct mdoc_node *body; /* save of body macro */
 	struct mdoc_node *n;
 	enum margserr	  ac, lac;
 	char		 *p;
 
 	nl = MDOC_NEWLINE & mdoc->flags;
 
 	/* Skip items outside lists. */
 
 	if (tok == MDOC_It) {
 		for (n = mdoc->last; n; n = n->parent)
 			if (n->tok == MDOC_Bl &&
 			    ! (n->flags & MDOC_VALID))
 				break;
 		if (n == NULL) {
 			mandoc_vmsg(MANDOCERR_IT_STRAY, mdoc->parse,
 			    line, ppos, "It %s", buf + *pos);
 			mdoc_elem_alloc(mdoc, line, ppos, MDOC_br, NULL);
 			rew_elem(mdoc, MDOC_br);
 			return;
 		}
 	}
 
 	/* Close out prior implicit scope. */
 
 	if ( ! (mdoc_macros[tok].flags & MDOC_EXPLICIT)) {
 		rew_sub(MDOC_BODY, mdoc, tok, line, ppos);
 		rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
 	}
 
 	/*
 	 * This routine accommodates implicitly- and explicitly-scoped
 	 * macro openings.  Implicit ones first close out prior scope
 	 * (seen above).  Delay opening the head until necessary to
 	 * allow leading punctuation to print.  Special consideration
 	 * for `It -column', which has phrase-part syntax instead of
 	 * regular child nodes.
 	 */
 
 	mdoc_argv(mdoc, line, tok, &arg, pos, buf);
 	mdoc_block_alloc(mdoc, line, ppos, tok, arg);
 	head = body = NULL;
 
 	/*
 	 * Exception: Heads of `It' macros in `-diag' lists are not
 	 * parsed, even though `It' macros in general are parsed.
 	 */
 
 	parsed = tok != MDOC_It ||
 	    mdoc->last->parent->tok != MDOC_Bl ||
 	    mdoc->last->parent->norm->Bl.type != LIST_diag;
 
 	/*
 	 * The `Nd' macro has all arguments in its body: it's a hybrid
 	 * of block partial-explicit and full-implicit.  Stupid.
 	 */
 
 	if (tok == MDOC_Nd) {
 		head = mdoc_head_alloc(mdoc, line, ppos, tok);
 		rew_sub(MDOC_HEAD, mdoc, tok, line, ppos);
 		body = mdoc_body_alloc(mdoc, line, ppos, tok);
 	}
 
 	if (tok == MDOC_Bk)
 		mdoc->flags |= MDOC_KEEP;
 
 	ac = ARGS_PEND;
 	for (;;) {
 		la = *pos;
 		lac = ac;
 		ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
 		if (ac == ARGS_PUNCT)
 			break;
 		if (ac == ARGS_EOLN) {
 			if (lac != ARGS_PPHRASE && lac != ARGS_PHRASE)
 				break;
 			/*
 			 * This is necessary: if the last token on a
 			 * line is a `Ta' or tab, then we'll get
 			 * ARGS_EOLN, so we must be smart enough to
 			 * reopen our scope if the last parse was a
 			 * phrase or partial phrase.
 			 */
 			rew_sub(MDOC_BODY, mdoc, tok, line, ppos);
 			body = mdoc_body_alloc(mdoc, line, ppos, tok);
 			break;
 		}
 
 		/*
 		 * Emit leading punctuation (i.e., punctuation before
 		 * the MDOC_HEAD) for non-phrase types.
 		 */
 
 		if (head == NULL &&
 		    ac != ARGS_PEND &&
 		    ac != ARGS_PHRASE &&
 		    ac != ARGS_PPHRASE &&
 		    ac != ARGS_QWORD &&
 		    mdoc_isdelim(p) == DELIM_OPEN) {
 			dword(mdoc, line, la, p, DELIM_OPEN, 0);
 			continue;
 		}
 
 		/* Open a head if one hasn't been opened. */
 
 		if (head == NULL)
 			head = mdoc_head_alloc(mdoc, line, ppos, tok);
 
 		if (ac == ARGS_PHRASE ||
 		    ac == ARGS_PEND ||
 		    ac == ARGS_PPHRASE) {
 
 			/*
 			 * If we haven't opened a body yet, rewind the
 			 * head; if we have, rewind that instead.
 			 */
 
 			rew_sub(body ? MDOC_BODY : MDOC_HEAD,
 			    mdoc, tok, line, ppos);
 			body = mdoc_body_alloc(mdoc, line, ppos, tok);
 
 			/*
 			 * Process phrases: set whether we're in a
 			 * partial-phrase (this effects line handling)
 			 * then call down into the phrase parser.
 			 */
 
 			if (ac == ARGS_PPHRASE)
 				mdoc->flags |= MDOC_PPHRASE;
 			if (ac == ARGS_PEND && lac == ARGS_PPHRASE)
 				mdoc->flags |= MDOC_PPHRASE;
 			parse_rest(mdoc, MDOC_MAX, line, &la, buf);
 			mdoc->flags &= ~MDOC_PPHRASE;
 			continue;
 		}
 
 		if (macro_or_word(mdoc, tok, line, la, pos, buf, parsed))
 			break;
 	}
 
 	if (head == NULL)
 		head = mdoc_head_alloc(mdoc, line, ppos, tok);
 	if (nl)
 		append_delims(mdoc, line, pos, buf);
 	if (body != NULL)
 		goto out;
 
 	/*
 	 * If there is an open (i.e., unvalidated) sub-block requiring
 	 * explicit close-out, postpone switching the current block from
 	 * head to body until the rew_sub() call closing out that
 	 * sub-block.
 	 */
 	for (n = mdoc->last; n && n != head; n = n->parent) {
 		if (n->type == MDOC_BLOCK &&
 		    mdoc_macros[n->tok].flags & MDOC_EXPLICIT &&
 		    ! (n->flags & MDOC_VALID)) {
 			n->pending = head;
 			return;
 		}
 	}
 
 	/* Close out scopes to remain in a consistent state. */
 
 	rew_sub(MDOC_HEAD, mdoc, tok, line, ppos);
 	mdoc_body_alloc(mdoc, line, ppos, tok);
 out:
 	if (mdoc->flags & MDOC_FREECOL) {
 		rew_sub(MDOC_BODY, mdoc, tok, line, ppos);
 		rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
 		mdoc->flags &= ~MDOC_FREECOL;
 	}
 }
 
 static void
 blk_part_imp(MACRO_PROT_ARGS)
 {
 	int		  la, nl;
 	enum margserr	  ac;
 	char		 *p;
 	struct mdoc_node *blk; /* saved block context */
 	struct mdoc_node *body; /* saved body context */
 	struct mdoc_node *n;
 
 	nl = MDOC_NEWLINE & mdoc->flags;
 
 	/*
 	 * A macro that spans to the end of the line.  This is generally
 	 * (but not necessarily) called as the first macro.  The block
 	 * has a head as the immediate child, which is always empty,
 	 * followed by zero or more opening punctuation nodes, then the
 	 * body (which may be empty, depending on the macro), then zero
 	 * or more closing punctuation nodes.
 	 */
 
 	blk = mdoc_block_alloc(mdoc, line, ppos, tok, NULL);
 	mdoc_head_alloc(mdoc, line, ppos, tok);
 	rew_sub(MDOC_HEAD, mdoc, tok, line, ppos);
 
 	/*
 	 * Open the body scope "on-demand", that is, after we've
 	 * processed all our the leading delimiters (open parenthesis,
 	 * etc.).
 	 */
 
 	for (body = NULL; ; ) {
 		la = *pos;
 		ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
 		if (ac == ARGS_EOLN || ac == ARGS_PUNCT)
 			break;
 
 		if (body == NULL && ac != ARGS_QWORD &&
 		    mdoc_isdelim(p) == DELIM_OPEN) {
 			dword(mdoc, line, la, p, DELIM_OPEN, 0);
 			continue;
 		}
 
 		if (body == NULL)
 			body = mdoc_body_alloc(mdoc, line, ppos, tok);
 
 		if (macro_or_word(mdoc, tok, line, la, pos, buf, 1))
 			break;
 	}
 	if (body == NULL)
 		body = mdoc_body_alloc(mdoc, line, ppos, tok);
 
 	/*
 	 * If there is an open sub-block requiring explicit close-out,
 	 * postpone closing out the current block
 	 * until the rew_sub() call closing out the sub-block.
 	 */
 
 	for (n = mdoc->last; n && n != body && n != blk->parent;
 	     n = n->parent) {
 		if (n->type == MDOC_BLOCK &&
 		    mdoc_macros[n->tok].flags & MDOC_EXPLICIT &&
 		    ! (n->flags & MDOC_VALID)) {
 			make_pending(n, tok, mdoc, line, ppos);
 			mdoc_endbody_alloc(mdoc, line, ppos,
 			    tok, body, ENDBODY_NOSPACE);
 			return;
 		}
 	}
 	assert(n == body);
 	rew_sub(MDOC_BODY, mdoc, tok, line, ppos);
 	if (nl)
 		append_delims(mdoc, line, pos, buf);
 	rew_sub(MDOC_BLOCK, mdoc, tok, line, ppos);
 
 	/* Move trailing .Ns out of scope. */
 
 	for (n = body->child; n && n->next; n = n->next)
 		/* Do nothing. */ ;
 	if (n && n->tok == MDOC_Ns)
 		mdoc_node_relink(mdoc, n);
 }
 
 static void
 blk_part_exp(MACRO_PROT_ARGS)
 {
 	int		  la, nl;
 	enum margserr	  ac;
 	struct mdoc_node *head; /* keep track of head */
 	struct mdoc_node *body; /* keep track of body */
 	char		 *p;
 
 	nl = MDOC_NEWLINE & mdoc->flags;
 
 	/*
 	 * The opening of an explicit macro having zero or more leading
 	 * punctuation nodes; a head with optional single element (the
 	 * case of `Eo'); and a body that may be empty.
 	 */
 
 	mdoc_block_alloc(mdoc, line, ppos, tok, NULL);
 	for (head = body = NULL; ; ) {
 		la = *pos;
 		ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
 		if (ac == ARGS_PUNCT || ac == ARGS_EOLN)
 			break;
 
 		/* Flush out leading punctuation. */
 
 		if (head == NULL && ac != ARGS_QWORD &&
 		    mdoc_isdelim(p) == DELIM_OPEN) {
 			assert(NULL == body);
 			dword(mdoc, line, la, p, DELIM_OPEN, 0);
 			continue;
 		}
 
 		if (head == NULL) {
 			assert(body == NULL);
 			head = mdoc_head_alloc(mdoc, line, ppos, tok);
 		}
 
 		/*
 		 * `Eo' gobbles any data into the head, but most other
 		 * macros just immediately close out and begin the body.
 		 */
 
 		if (body == NULL) {
 			assert(head);
 			/* No check whether it's a macro! */
 			if (tok == MDOC_Eo)
 				dword(mdoc, line, la, p, DELIM_MAX, 0);
 			rew_sub(MDOC_HEAD, mdoc, tok, line, ppos);
 			body = mdoc_body_alloc(mdoc, line, ppos, tok);
 			if (tok == MDOC_Eo)
 				continue;
 		}
 		assert(head != NULL && body != NULL);
 
 		if (macro_or_word(mdoc, tok, line, la, pos, buf, 1))
 			break;
 	}
 
 	/* Clean-up to leave in a consistent state. */
 
 	if (head == NULL)
 		mdoc_head_alloc(mdoc, line, ppos, tok);
 
 	if (body == NULL) {
 		rew_sub(MDOC_HEAD, mdoc, tok, line, ppos);
 		mdoc_body_alloc(mdoc, line, ppos, tok);
 	}
 	if (nl)
 		append_delims(mdoc, line, pos, buf);
 }
 
 static void
 in_line_argn(MACRO_PROT_ARGS)
 {
 	int		 la, flushed, j, maxargs, nl;
 	enum margserr	 ac;
 	struct mdoc_arg	*arg;
 	char		*p;
 	enum mdoct	 ntok;
 
-	nl = MDOC_NEWLINE & mdoc->flags;
+	nl = mdoc->flags & MDOC_NEWLINE;
 
 	/*
 	 * A line macro that has a fixed number of arguments (maxargs).
 	 * Only open the scope once the first non-leading-punctuation is
 	 * found (unless MDOC_IGNDELIM is noted, like in `Pf'), then
 	 * keep it open until the maximum number of arguments are
 	 * exhausted.
 	 */
 
 	switch (tok) {
 	case MDOC_Ap:
 		/* FALLTHROUGH */
 	case MDOC_Ns:
 		/* FALLTHROUGH */
 	case MDOC_Ux:
 		maxargs = 0;
 		break;
 	case MDOC_Bx:
 		/* FALLTHROUGH */
 	case MDOC_Es:
 		/* FALLTHROUGH */
 	case MDOC_Xr:
 		maxargs = 2;
 		break;
 	default:
 		maxargs = 1;
 		break;
 	}
 
 	mdoc_argv(mdoc, line, tok, &arg, pos, buf);
 
-	for (flushed = j = 0; ; ) {
+	p = NULL;
+	flushed = j = 0;
+	for (;;) {
 		la = *pos;
 		ac = mdoc_args(mdoc, line, pos, buf, tok, &p);
-		if (ac == ARGS_PUNCT || ac == ARGS_EOLN)
+		if (ac == ARGS_PUNCT || ac == ARGS_EOLN) {
+			if (j < 2 && tok == MDOC_Pf)
+				mandoc_vmsg(MANDOCERR_PF_SKIP,
+				    mdoc->parse, line, ppos, "Pf %s",
+				    p == NULL ? "at eol" : p);
 			break;
+		}
 
 		if ( ! (mdoc_macros[tok].flags & MDOC_IGNDELIM) &&
 		    ac != ARGS_QWORD && j == 0 &&
 		    mdoc_isdelim(p) == DELIM_OPEN) {
 			dword(mdoc, line, la, p, DELIM_OPEN, 0);
 			continue;
 		} else if (j == 0)
 		       mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
 
 		if (j == maxargs && ! flushed) {
 			rew_elem(mdoc, tok);
 			flushed = 1;
 		}
 
-		ntok = ac == ARGS_QWORD ? MDOC_MAX : lookup(tok, p);
+		ntok = (ac == ARGS_QWORD || (tok == MDOC_Pf && j == 0)) ?
+		    MDOC_MAX : lookup(mdoc, tok, line, la, p);
 
 		if (ntok != MDOC_MAX) {
 			if ( ! flushed)
 				rew_elem(mdoc, tok);
 			flushed = 1;
 			mdoc_macro(mdoc, ntok, line, la, pos, buf);
 			j++;
 			break;
 		}
 
 		if ( ! (mdoc_macros[tok].flags & MDOC_IGNDELIM) &&
 		    ac != ARGS_QWORD && ! flushed &&
 		    mdoc_isdelim(p) != DELIM_NONE) {
 			rew_elem(mdoc, tok);
 			flushed = 1;
 		}
 
 		dword(mdoc, line, la, p, DELIM_MAX,
 		    MDOC_JOIN & mdoc_macros[tok].flags);
 		j++;
 	}
 
-	if (j == 0)
+	if (j == 0) {
 		mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
+		if (ac == ARGS_PUNCT && tok == MDOC_Pf)
+			append_delims(mdoc, line, pos, buf);
+	}
 	if ( ! flushed)
 		rew_elem(mdoc, tok);
 	if (nl)
 		append_delims(mdoc, line, pos, buf);
 }
 
 static void
 in_line_eoln(MACRO_PROT_ARGS)
 {
 	struct mdoc_arg	*arg;
 
 	if (tok == MDOC_Pp)
 		rew_sub(MDOC_BLOCK, mdoc, MDOC_Nm, line, ppos);
 
 	mdoc_argv(mdoc, line, tok, &arg, pos, buf);
 	mdoc_elem_alloc(mdoc, line, ppos, tok, arg);
 	if (parse_rest(mdoc, tok, line, pos, buf))
 		return;
 	rew_elem(mdoc, tok);
 }
 
 /*
  * The simplest argument parser available: Parse the remaining
  * words until the end of the phrase or line and return 0
  * or until the next macro, call that macro, and return 1.
  */
 static int
 parse_rest(struct mdoc *mdoc, enum mdoct tok, int line, int *pos, char *buf)
 {
 	int		 la;
 
 	for (;;) {
 		la = *pos;
 		if (mdoc_args(mdoc, line, pos, buf, tok, NULL) == ARGS_EOLN)
 			return(0);
 		if (macro_or_word(mdoc, tok, line, la, pos, buf, 1))
 			return(1);
 	}
 }
 
 static void
 ctx_synopsis(MACRO_PROT_ARGS)
 {
 
 	if (~mdoc->flags & (MDOC_SYNOPSIS | MDOC_NEWLINE))
 		in_line(mdoc, tok, line, ppos, pos, buf);
 	else if (tok == MDOC_Nm)
 		blk_full(mdoc, tok, line, ppos, pos, buf);
 	else {
 		assert(tok == MDOC_Vt);
 		blk_part_imp(mdoc, tok, line, ppos, pos, buf);
 	}
 }
 
 /*
  * Phrases occur within `Bl -column' entries, separated by `Ta' or tabs.
  * They're unusual because they're basically free-form text until a
  * macro is encountered.
  */
 static void
 phrase_ta(MACRO_PROT_ARGS)
 {
 	struct mdoc_node *n;
 
 	/* Make sure we are in a column list or ignore this macro. */
 
 	n = mdoc->last;
 	while (n != NULL && n->tok != MDOC_Bl)
 		n = n->parent;
 	if (n == NULL || n->norm->Bl.type != LIST_column) {
 		mandoc_msg(MANDOCERR_TA_STRAY, mdoc->parse,
 		    line, ppos, "Ta");
 		return;
 	}
 
 	/* Advance to the next column. */
 
 	rew_sub(MDOC_BODY, mdoc, MDOC_It, line, ppos);
 	mdoc_body_alloc(mdoc, line, ppos, MDOC_It);
 	parse_rest(mdoc, MDOC_MAX, line, pos, buf);
 }
Index: projects/arm_intrng/contrib/mdocml/mdoc_man.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/mdoc_man.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/mdoc_man.c	(revision 276248)
@@ -1,1790 +1,1791 @@
-/*	$Id: mdoc_man.c,v 1.76 2014/11/27 22:27:56 schwarze Exp $ */
+/*	$Id: mdoc_man.c,v 1.77 2014/11/30 05:29:00 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 
 #include "mandoc.h"
 #include "mandoc_aux.h"
 #include "out.h"
 #include "man.h"
 #include "mdoc.h"
 #include "main.h"
 
 #define	DECL_ARGS const struct mdoc_meta *meta, \
 		  const struct mdoc_node *n
 
 struct	manact {
 	int		(*cond)(DECL_ARGS); /* DON'T run actions */
 	int		(*pre)(DECL_ARGS); /* pre-node action */
 	void		(*post)(DECL_ARGS); /* post-node action */
 	const char	 *prefix; /* pre-node string constant */
 	const char	 *suffix; /* post-node string constant */
 };
 
 static	int	  cond_body(DECL_ARGS);
 static	int	  cond_head(DECL_ARGS);
 static  void	  font_push(char);
 static	void	  font_pop(void);
 static	void	  mid_it(void);
 static	void	  post__t(DECL_ARGS);
 static	void	  post_aq(DECL_ARGS);
 static	void	  post_bd(DECL_ARGS);
 static	void	  post_bf(DECL_ARGS);
 static	void	  post_bk(DECL_ARGS);
 static	void	  post_bl(DECL_ARGS);
 static	void	  post_dl(DECL_ARGS);
 static	void	  post_en(DECL_ARGS);
 static	void	  post_enc(DECL_ARGS);
 static	void	  post_eo(DECL_ARGS);
 static	void	  post_fa(DECL_ARGS);
 static	void	  post_fd(DECL_ARGS);
 static	void	  post_fl(DECL_ARGS);
 static	void	  post_fn(DECL_ARGS);
 static	void	  post_fo(DECL_ARGS);
 static	void	  post_font(DECL_ARGS);
 static	void	  post_in(DECL_ARGS);
 static	void	  post_it(DECL_ARGS);
 static	void	  post_lb(DECL_ARGS);
 static	void	  post_nm(DECL_ARGS);
 static	void	  post_percent(DECL_ARGS);
 static	void	  post_pf(DECL_ARGS);
 static	void	  post_sect(DECL_ARGS);
 static	void	  post_sp(DECL_ARGS);
 static	void	  post_vt(DECL_ARGS);
 static	int	  pre__t(DECL_ARGS);
 static	int	  pre_an(DECL_ARGS);
 static	int	  pre_ap(DECL_ARGS);
 static	int	  pre_aq(DECL_ARGS);
 static	int	  pre_bd(DECL_ARGS);
 static	int	  pre_bf(DECL_ARGS);
 static	int	  pre_bk(DECL_ARGS);
 static	int	  pre_bl(DECL_ARGS);
 static	int	  pre_br(DECL_ARGS);
 static	int	  pre_bx(DECL_ARGS);
 static	int	  pre_dl(DECL_ARGS);
 static	int	  pre_en(DECL_ARGS);
 static	int	  pre_enc(DECL_ARGS);
 static	int	  pre_em(DECL_ARGS);
 static	int	  pre_skip(DECL_ARGS);
 static	int	  pre_eo(DECL_ARGS);
 static	int	  pre_ex(DECL_ARGS);
 static	int	  pre_fa(DECL_ARGS);
 static	int	  pre_fd(DECL_ARGS);
 static	int	  pre_fl(DECL_ARGS);
 static	int	  pre_fn(DECL_ARGS);
 static	int	  pre_fo(DECL_ARGS);
 static	int	  pre_ft(DECL_ARGS);
 static	int	  pre_in(DECL_ARGS);
 static	int	  pre_it(DECL_ARGS);
 static	int	  pre_lk(DECL_ARGS);
 static	int	  pre_li(DECL_ARGS);
 static	int	  pre_ll(DECL_ARGS);
 static	int	  pre_nm(DECL_ARGS);
 static	int	  pre_no(DECL_ARGS);
 static	int	  pre_ns(DECL_ARGS);
 static	int	  pre_pp(DECL_ARGS);
 static	int	  pre_rs(DECL_ARGS);
 static	int	  pre_rv(DECL_ARGS);
 static	int	  pre_sm(DECL_ARGS);
 static	int	  pre_sp(DECL_ARGS);
 static	int	  pre_sect(DECL_ARGS);
 static	int	  pre_sy(DECL_ARGS);
 static	void	  pre_syn(const struct mdoc_node *);
 static	int	  pre_vt(DECL_ARGS);
 static	int	  pre_ux(DECL_ARGS);
 static	int	  pre_xr(DECL_ARGS);
 static	void	  print_word(const char *);
 static	void	  print_line(const char *, int);
 static	void	  print_block(const char *, int);
 static	void	  print_offs(const char *, int);
 static	void	  print_width(const char *,
 				const struct mdoc_node *, size_t);
 static	void	  print_count(int *);
 static	void	  print_node(DECL_ARGS);
 
 static	const struct manact manacts[MDOC_MAX + 1] = {
 	{ NULL, pre_ap, NULL, NULL, NULL }, /* Ap */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Dd */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Dt */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Os */
 	{ NULL, pre_sect, post_sect, ".SH", NULL }, /* Sh */
 	{ NULL, pre_sect, post_sect, ".SS", NULL }, /* Ss */
 	{ NULL, pre_pp, NULL, NULL, NULL }, /* Pp */
 	{ cond_body, pre_dl, post_dl, NULL, NULL }, /* D1 */
 	{ cond_body, pre_dl, post_dl, NULL, NULL }, /* Dl */
 	{ cond_body, pre_bd, post_bd, NULL, NULL }, /* Bd */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ed */
 	{ cond_body, pre_bl, post_bl, NULL, NULL }, /* Bl */
 	{ NULL, NULL, NULL, NULL, NULL }, /* El */
 	{ NULL, pre_it, post_it, NULL, NULL }, /* It */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Ad */
 	{ NULL, pre_an, NULL, NULL, NULL }, /* An */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Ar */
 	{ NULL, pre_sy, post_font, NULL, NULL }, /* Cd */
 	{ NULL, pre_sy, post_font, NULL, NULL }, /* Cm */
 	{ NULL, pre_li, post_font, NULL, NULL }, /* Dv */
 	{ NULL, pre_li, post_font, NULL, NULL }, /* Er */
 	{ NULL, pre_li, post_font, NULL, NULL }, /* Ev */
 	{ NULL, pre_ex, NULL, NULL, NULL }, /* Ex */
 	{ NULL, pre_fa, post_fa, NULL, NULL }, /* Fa */
 	{ NULL, pre_fd, post_fd, NULL, NULL }, /* Fd */
 	{ NULL, pre_fl, post_fl, NULL, NULL }, /* Fl */
 	{ NULL, pre_fn, post_fn, NULL, NULL }, /* Fn */
 	{ NULL, pre_ft, post_font, NULL, NULL }, /* Ft */
 	{ NULL, pre_sy, post_font, NULL, NULL }, /* Ic */
 	{ NULL, pre_in, post_in, NULL, NULL }, /* In */
 	{ NULL, pre_li, post_font, NULL, NULL }, /* Li */
 	{ cond_head, pre_enc, NULL, "\\- ", NULL }, /* Nd */
 	{ NULL, pre_nm, post_nm, NULL, NULL }, /* Nm */
 	{ cond_body, pre_enc, post_enc, "[", "]" }, /* Op */
 	{ NULL, pre_ft, post_font, NULL, NULL }, /* Ot */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Pa */
 	{ NULL, pre_rv, NULL, NULL, NULL }, /* Rv */
 	{ NULL, NULL, NULL, NULL, NULL }, /* St */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Va */
 	{ NULL, pre_vt, post_vt, NULL, NULL }, /* Vt */
 	{ NULL, pre_xr, NULL, NULL, NULL }, /* Xr */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %A */
 	{ NULL, pre_em, post_percent, NULL, NULL }, /* %B */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %D */
 	{ NULL, pre_em, post_percent, NULL, NULL }, /* %I */
 	{ NULL, pre_em, post_percent, NULL, NULL }, /* %J */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %N */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %O */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %P */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %R */
 	{ NULL, pre__t, post__t, NULL, NULL }, /* %T */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %V */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ac */
 	{ cond_body, pre_aq, post_aq, NULL, NULL }, /* Ao */
 	{ cond_body, pre_aq, post_aq, NULL, NULL }, /* Aq */
 	{ NULL, NULL, NULL, NULL, NULL }, /* At */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Bc */
 	{ NULL, pre_bf, post_bf, NULL, NULL }, /* Bf */
 	{ cond_body, pre_enc, post_enc, "[", "]" }, /* Bo */
 	{ cond_body, pre_enc, post_enc, "[", "]" }, /* Bq */
 	{ NULL, pre_ux, NULL, "BSD/OS", NULL }, /* Bsx */
 	{ NULL, pre_bx, NULL, NULL, NULL }, /* Bx */
 	{ NULL, pre_skip, NULL, NULL, NULL }, /* Db */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Dc */
 	{ cond_body, pre_enc, post_enc, "\\(lq", "\\(rq" }, /* Do */
 	{ cond_body, pre_enc, post_enc, "\\(lq", "\\(rq" }, /* Dq */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ec */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ef */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Em */
 	{ cond_body, pre_eo, post_eo, NULL, NULL }, /* Eo */
 	{ NULL, pre_ux, NULL, "FreeBSD", NULL }, /* Fx */
 	{ NULL, pre_sy, post_font, NULL, NULL }, /* Ms */
 	{ NULL, pre_no, NULL, NULL, NULL }, /* No */
 	{ NULL, pre_ns, NULL, NULL, NULL }, /* Ns */
 	{ NULL, pre_ux, NULL, "NetBSD", NULL }, /* Nx */
 	{ NULL, pre_ux, NULL, "OpenBSD", NULL }, /* Ox */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Pc */
 	{ NULL, NULL, post_pf, NULL, NULL }, /* Pf */
 	{ cond_body, pre_enc, post_enc, "(", ")" }, /* Po */
 	{ cond_body, pre_enc, post_enc, "(", ")" }, /* Pq */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Qc */
 	{ cond_body, pre_enc, post_enc, "\\(oq", "\\(cq" }, /* Ql */
 	{ cond_body, pre_enc, post_enc, "\"", "\"" }, /* Qo */
 	{ cond_body, pre_enc, post_enc, "\"", "\"" }, /* Qq */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Re */
 	{ cond_body, pre_rs, NULL, NULL, NULL }, /* Rs */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Sc */
 	{ cond_body, pre_enc, post_enc, "\\(oq", "\\(cq" }, /* So */
 	{ cond_body, pre_enc, post_enc, "\\(oq", "\\(cq" }, /* Sq */
 	{ NULL, pre_sm, NULL, NULL, NULL }, /* Sm */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Sx */
 	{ NULL, pre_sy, post_font, NULL, NULL }, /* Sy */
 	{ NULL, pre_li, post_font, NULL, NULL }, /* Tn */
 	{ NULL, pre_ux, NULL, "UNIX", NULL }, /* Ux */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Xc */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Xo */
 	{ NULL, pre_fo, post_fo, NULL, NULL }, /* Fo */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Fc */
 	{ cond_body, pre_enc, post_enc, "[", "]" }, /* Oo */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Oc */
 	{ NULL, pre_bk, post_bk, NULL, NULL }, /* Bk */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ek */
 	{ NULL, pre_ux, NULL, "is currently in beta test.", NULL }, /* Bt */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Hf */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Fr */
 	{ NULL, pre_ux, NULL, "currently under development.", NULL }, /* Ud */
 	{ NULL, NULL, post_lb, NULL, NULL }, /* Lb */
 	{ NULL, pre_pp, NULL, NULL, NULL }, /* Lp */
 	{ NULL, pre_lk, NULL, NULL, NULL }, /* Lk */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Mt */
 	{ cond_body, pre_enc, post_enc, "{", "}" }, /* Brq */
 	{ cond_body, pre_enc, post_enc, "{", "}" }, /* Bro */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Brc */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %C */
 	{ NULL, pre_skip, NULL, NULL, NULL }, /* Es */
 	{ cond_body, pre_en, post_en, NULL, NULL }, /* En */
 	{ NULL, pre_ux, NULL, "DragonFly", NULL }, /* Dx */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %Q */
 	{ NULL, pre_br, NULL, NULL, NULL }, /* br */
 	{ NULL, pre_sp, post_sp, NULL, NULL }, /* sp */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %U */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ta */
 	{ NULL, pre_ll, post_sp, NULL, NULL }, /* ll */
 	{ NULL, NULL, NULL, NULL, NULL }, /* ROOT */
 };
 
 static	int		outflags;
 #define	MMAN_spc	(1 << 0)  /* blank character before next word */
 #define	MMAN_spc_force	(1 << 1)  /* even before trailing punctuation */
 #define	MMAN_nl		(1 << 2)  /* break man(7) code line */
 #define	MMAN_br		(1 << 3)  /* break output line */
 #define	MMAN_sp		(1 << 4)  /* insert a blank output line */
 #define	MMAN_PP		(1 << 5)  /* reset indentation etc. */
 #define	MMAN_Sm		(1 << 6)  /* horizontal spacing mode */
 #define	MMAN_Bk		(1 << 7)  /* word keep mode */
 #define	MMAN_Bk_susp	(1 << 8)  /* suspend this (after a macro) */
 #define	MMAN_An_split	(1 << 9)  /* author mode is "split" */
 #define	MMAN_An_nosplit	(1 << 10) /* author mode is "nosplit" */
 #define	MMAN_PD		(1 << 11) /* inter-paragraph spacing disabled */
 #define	MMAN_nbrword	(1 << 12) /* do not break the next word */
 
 #define	BL_STACK_MAX	32
 
 static	size_t		Bl_stack[BL_STACK_MAX];  /* offsets [chars] */
 static	int		Bl_stack_post[BL_STACK_MAX];  /* add final .RE */
 static	int		Bl_stack_len;  /* number of nested Bl blocks */
 static	int		TPremain;  /* characters before tag is full */
 
 static	struct {
 	char	*head;
 	char	*tail;
 	size_t	 size;
 }	fontqueue;
 
 
 static void
 font_push(char newfont)
 {
 
 	if (fontqueue.head + fontqueue.size <= ++fontqueue.tail) {
 		fontqueue.size += 8;
 		fontqueue.head = mandoc_realloc(fontqueue.head,
 		    fontqueue.size);
 	}
 	*fontqueue.tail = newfont;
 	print_word("");
 	printf("\\f");
 	putchar(newfont);
 	outflags &= ~MMAN_spc;
 }
 
 static void
 font_pop(void)
 {
 
 	if (fontqueue.tail > fontqueue.head)
 		fontqueue.tail--;
 	outflags &= ~MMAN_spc;
 	print_word("");
 	printf("\\f");
 	putchar(*fontqueue.tail);
 }
 
 static void
 print_word(const char *s)
 {
 
 	if ((MMAN_PP | MMAN_sp | MMAN_br | MMAN_nl) & outflags) {
 		/*
 		 * If we need a newline, print it now and start afresh.
 		 */
 		if (MMAN_PP & outflags) {
 			if (MMAN_sp & outflags) {
 				if (MMAN_PD & outflags) {
 					printf("\n.PD");
 					outflags &= ~MMAN_PD;
 				}
 			} else if ( ! (MMAN_PD & outflags)) {
 				printf("\n.PD 0");
 				outflags |= MMAN_PD;
 			}
 			printf("\n.PP\n");
 		} else if (MMAN_sp & outflags)
 			printf("\n.sp\n");
 		else if (MMAN_br & outflags)
 			printf("\n.br\n");
 		else if (MMAN_nl & outflags)
 			putchar('\n');
 		outflags &= ~(MMAN_PP|MMAN_sp|MMAN_br|MMAN_nl|MMAN_spc);
 		if (1 == TPremain)
 			printf(".br\n");
 		TPremain = 0;
 	} else if (MMAN_spc & outflags) {
 		/*
 		 * If we need a space, only print it if
 		 * (1) it is forced by `No' or
 		 * (2) what follows is not terminating punctuation or
 		 * (3) what follows is longer than one character.
 		 */
 		if (MMAN_spc_force & outflags || '\0' == s[0] ||
 		    NULL == strchr(".,:;)]?!", s[0]) || '\0' != s[1]) {
 			if (MMAN_Bk & outflags &&
 			    ! (MMAN_Bk_susp & outflags))
 				putchar('\\');
 			putchar(' ');
 			if (TPremain)
 				TPremain--;
 		}
 	}
 
 	/*
 	 * Reassign needing space if we're not following opening
 	 * punctuation.
 	 */
 	if (MMAN_Sm & outflags && ('\0' == s[0] ||
 	    (('(' != s[0] && '[' != s[0]) || '\0' != s[1])))
 		outflags |= MMAN_spc;
 	else
 		outflags &= ~MMAN_spc;
 	outflags &= ~(MMAN_spc_force | MMAN_Bk_susp);
 
 	for ( ; *s; s++) {
 		switch (*s) {
 		case ASCII_NBRSP:
 			printf("\\ ");
 			break;
 		case ASCII_HYPH:
 			putchar('-');
 			break;
 		case ASCII_BREAK:
 			printf("\\:");
 			break;
 		case ' ':
 			if (MMAN_nbrword & outflags) {
 				printf("\\ ");
 				break;
 			}
 			/* FALLTHROUGH */
 		default:
 			putchar((unsigned char)*s);
 			break;
 		}
 		if (TPremain)
 			TPremain--;
 	}
 	outflags &= ~MMAN_nbrword;
 }
 
 static void
 print_line(const char *s, int newflags)
 {
 
 	outflags &= ~MMAN_br;
 	outflags |= MMAN_nl;
 	print_word(s);
 	outflags |= newflags;
 }
 
 static void
 print_block(const char *s, int newflags)
 {
 
 	outflags &= ~MMAN_PP;
 	if (MMAN_sp & outflags) {
 		outflags &= ~(MMAN_sp | MMAN_br);
 		if (MMAN_PD & outflags) {
 			print_line(".PD", 0);
 			outflags &= ~MMAN_PD;
 		}
 	} else if (! (MMAN_PD & outflags))
 		print_line(".PD 0", MMAN_PD);
 	outflags |= MMAN_nl;
 	print_word(s);
 	outflags |= MMAN_Bk_susp | newflags;
 }
 
 static void
 print_offs(const char *v, int keywords)
 {
 	char		  buf[24];
 	struct roffsu	  su;
 	size_t		  sz;
 
 	print_line(".RS", MMAN_Bk_susp);
 
 	/* Convert v into a number (of characters). */
 	if (NULL == v || '\0' == *v || (keywords && !strcmp(v, "left")))
 		sz = 0;
 	else if (keywords && !strcmp(v, "indent"))
 		sz = 6;
 	else if (keywords && !strcmp(v, "indent-two"))
 		sz = 12;
 	else if (a2roffsu(v, &su, SCALE_MAX)) {
 		if (SCALE_EN == su.unit)
 			sz = su.scale;
 		else {
 			/*
 			 * XXX
 			 * If we are inside an enclosing list,
 			 * there is no easy way to add the two
 			 * indentations because they are provided
 			 * in terms of different units.
 			 */
 			print_word(v);
 			outflags |= MMAN_nl;
 			return;
 		}
 	} else
 		sz = strlen(v);
 
 	/*
 	 * We are inside an enclosing list.
 	 * Add the two indentations.
 	 */
 	if (Bl_stack_len)
 		sz += Bl_stack[Bl_stack_len - 1];
 
 	(void)snprintf(buf, sizeof(buf), "%zun", sz);
 	print_word(buf);
 	outflags |= MMAN_nl;
 }
 
 /*
  * Set up the indentation for a list item; used from pre_it().
  */
 static void
 print_width(const char *v, const struct mdoc_node *child, size_t defsz)
 {
 	char		  buf[24];
 	struct roffsu	  su;
 	size_t		  sz, chsz;
 	int		  numeric, remain;
 
 	numeric = 1;
 	remain = 0;
 
 	/* Convert v into a number (of characters). */
 	if (NULL == v)
 		sz = defsz;
 	else if (a2roffsu(v, &su, SCALE_MAX)) {
 		if (SCALE_EN == su.unit)
 			sz = su.scale;
 		else {
 			sz = 0;
 			numeric = 0;
 		}
 	} else
 		sz = strlen(v);
 
 	/* XXX Rough estimation, might have multiple parts. */
 	chsz = (NULL != child && MDOC_TEXT == child->type) ?
 	    strlen(child->string) : 0;
 
 	/* Maybe we are inside an enclosing list? */
 	mid_it();
 
 	/*
 	 * Save our own indentation,
 	 * such that child lists can use it.
 	 */
 	Bl_stack[Bl_stack_len++] = sz + 2;
 
 	/* Set up the current list. */
 	if (defsz && chsz > sz)
 		print_block(".HP", 0);
 	else {
 		print_block(".TP", 0);
 		remain = sz + 2;
 	}
 	if (numeric) {
 		(void)snprintf(buf, sizeof(buf), "%zun", sz + 2);
 		print_word(buf);
 	} else
 		print_word(v);
 	TPremain = remain;
 }
 
 static void
 print_count(int *count)
 {
 	char		  buf[24];
 
 	(void)snprintf(buf, sizeof(buf), "%d.", ++*count);
 	print_word(buf);
 }
 
 void
 man_man(void *arg, const struct man *man)
 {
 
 	/*
 	 * Dump the keep buffer.
 	 * We're guaranteed by now that this exists (is non-NULL).
 	 * Flush stdout afterward, just in case.
 	 */
 	fputs(mparse_getkeep(man_mparse(man)), stdout);
 	fflush(stdout);
 }
 
 void
 man_mdoc(void *arg, const struct mdoc *mdoc)
 {
 	const struct mdoc_meta *meta;
 	const struct mdoc_node *n;
 
 	meta = mdoc_meta(mdoc);
 	n = mdoc_node(mdoc);
 
 	printf(".TH \"%s\" \"%s\" \"%s\" \"%s\" \"%s\"\n",
 	    meta->title,
 	    (meta->msec == NULL ? "" : meta->msec),
 	    meta->date, meta->os, meta->vol);
 
 	/* Disable hyphenation and if nroff, disable justification. */
 	printf(".nh\n.if n .ad l");
 
 	outflags = MMAN_nl | MMAN_Sm;
 	if (0 == fontqueue.size) {
 		fontqueue.size = 8;
 		fontqueue.head = fontqueue.tail = mandoc_malloc(8);
 		*fontqueue.tail = 'R';
 	}
 	print_node(meta, n);
 	putchar('\n');
 }
 
 static void
 print_node(DECL_ARGS)
 {
 	const struct mdoc_node	*sub;
 	const struct manact	*act;
 	int			 cond, do_sub;
 
 	/*
 	 * Break the line if we were parsed subsequent the current node.
 	 * This makes the page structure be more consistent.
 	 */
 	if (MMAN_spc & outflags && MDOC_LINE & n->flags)
 		outflags |= MMAN_nl;
 
 	act = NULL;
 	cond = 0;
 	do_sub = 1;
 
 	if (MDOC_TEXT == n->type) {
 		/*
 		 * Make sure that we don't happen to start with a
 		 * control character at the start of a line.
 		 */
 		if (MMAN_nl & outflags &&
 		    ('.' == *n->string || '\'' == *n->string)) {
 			print_word("");
 			printf("\\&");
 			outflags &= ~MMAN_spc;
 		}
 		if (outflags & MMAN_Sm && ! (n->flags & MDOC_DELIMC))
 			outflags |= MMAN_spc_force;
 		print_word(n->string);
 		if (outflags & MMAN_Sm && ! (n->flags & MDOC_DELIMO))
 			outflags |= MMAN_spc;
 	} else {
 		/*
 		 * Conditionally run the pre-node action handler for a
 		 * node.
 		 */
 		act = manacts + n->tok;
 		cond = act->cond == NULL || (*act->cond)(meta, n);
 		if (cond && act->pre && (n->end == ENDBODY_NOT || n->nchild))
 			do_sub = (*act->pre)(meta, n);
 	}
 
 	/*
 	 * Conditionally run all child nodes.
 	 * Note that this iterates over children instead of using
 	 * recursion.  This prevents unnecessary depth in the stack.
 	 */
 	if (do_sub)
 		for (sub = n->child; sub; sub = sub->next)
 			print_node(meta, sub);
 
 	/*
 	 * Lastly, conditionally run the post-node handler.
 	 */
 	if (MDOC_ENDED & n->flags)
 		return;
 
 	if (cond && act->post)
 		(*act->post)(meta, n);
 
 	if (ENDBODY_NOT != n->end)
 		n->pending->flags |= MDOC_ENDED;
 
 	if (ENDBODY_NOSPACE == n->end)
 		outflags &= ~(MMAN_spc | MMAN_nl);
 }
 
 static int
 cond_head(DECL_ARGS)
 {
 
 	return(MDOC_HEAD == n->type);
 }
 
 static int
 cond_body(DECL_ARGS)
 {
 
 	return(MDOC_BODY == n->type);
 }
 
 static int
 pre_enc(DECL_ARGS)
 {
 	const char	*prefix;
 
 	prefix = manacts[n->tok].prefix;
 	if (NULL == prefix)
 		return(1);
 	print_word(prefix);
 	outflags &= ~MMAN_spc;
 	return(1);
 }
 
 static void
 post_enc(DECL_ARGS)
 {
 	const char *suffix;
 
 	suffix = manacts[n->tok].suffix;
 	if (NULL == suffix)
 		return;
 	outflags &= ~(MMAN_spc | MMAN_nl);
 	print_word(suffix);
 }
 
 static int
 pre_ex(DECL_ARGS)
 {
 	int	 nchild;
 
 	outflags |= MMAN_br | MMAN_nl;
 
 	print_word("The");
 
 	nchild = n->nchild;
 	for (n = n->child; n; n = n->next) {
 		font_push('B');
 		print_word(n->string);
 		font_pop();
 
 		if (n->next == NULL)
 			continue;
 
 		if (nchild > 2) {
 			outflags &= ~MMAN_spc;
 			print_word(",");
 		}
 		if (n->next->next == NULL)
 			print_word("and");
 	}
 
 	if (nchild > 1)
 		print_word("utilities exit\\~0");
 	else
 		print_word("utility exits\\~0");
 
 	print_word("on success, and\\~>0 if an error occurs.");
 	outflags |= MMAN_nl;
 	return(0);
 }
 
 static void
 post_font(DECL_ARGS)
 {
 
 	font_pop();
 }
 
 static void
 post_percent(DECL_ARGS)
 {
 
 	if (pre_em == manacts[n->tok].pre)
 		font_pop();
 	if (n->next) {
 		print_word(",");
 		if (n->prev &&	n->prev->tok == n->tok &&
 				n->next->tok == n->tok)
 			print_word("and");
 	} else {
 		print_word(".");
 		outflags |= MMAN_nl;
 	}
 }
 
 static int
 pre__t(DECL_ARGS)
 {
 
 	if (n->parent && MDOC_Rs == n->parent->tok &&
 	    n->parent->norm->Rs.quote_T) {
 		print_word("");
 		putchar('\"');
 		outflags &= ~MMAN_spc;
 	} else
 		font_push('I');
 	return(1);
 }
 
 static void
 post__t(DECL_ARGS)
 {
 
 	if (n->parent && MDOC_Rs == n->parent->tok &&
 	    n->parent->norm->Rs.quote_T) {
 		outflags &= ~MMAN_spc;
 		print_word("");
 		putchar('\"');
 	} else
 		font_pop();
 	post_percent(meta, n);
 }
 
 /*
  * Print before a section header.
  */
 static int
 pre_sect(DECL_ARGS)
 {
 
 	if (MDOC_HEAD == n->type) {
 		outflags |= MMAN_sp;
 		print_block(manacts[n->tok].prefix, 0);
 		print_word("");
 		putchar('\"');
 		outflags &= ~MMAN_spc;
 	}
 	return(1);
 }
 
 /*
  * Print subsequent a section header.
  */
 static void
 post_sect(DECL_ARGS)
 {
 
 	if (MDOC_HEAD != n->type)
 		return;
 	outflags &= ~MMAN_spc;
 	print_word("");
 	putchar('\"');
 	outflags |= MMAN_nl;
 	if (MDOC_Sh == n->tok && SEC_AUTHORS == n->sec)
 		outflags &= ~(MMAN_An_split | MMAN_An_nosplit);
 }
 
 /* See mdoc_term.c, synopsis_pre() for comments. */
 static void
 pre_syn(const struct mdoc_node *n)
 {
 
 	if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags))
 		return;
 
 	if (n->prev->tok == n->tok &&
 	    MDOC_Ft != n->tok &&
 	    MDOC_Fo != n->tok &&
 	    MDOC_Fn != n->tok) {
 		outflags |= MMAN_br;
 		return;
 	}
 
 	switch (n->prev->tok) {
 	case MDOC_Fd:
 		/* FALLTHROUGH */
 	case MDOC_Fn:
 		/* FALLTHROUGH */
 	case MDOC_Fo:
 		/* FALLTHROUGH */
 	case MDOC_In:
 		/* FALLTHROUGH */
 	case MDOC_Vt:
 		outflags |= MMAN_sp;
 		break;
 	case MDOC_Ft:
 		if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
 			outflags |= MMAN_sp;
 			break;
 		}
 		/* FALLTHROUGH */
 	default:
 		outflags |= MMAN_br;
 		break;
 	}
 }
 
 static int
 pre_an(DECL_ARGS)
 {
 
 	switch (n->norm->An.auth) {
 	case AUTH_split:
 		outflags &= ~MMAN_An_nosplit;
 		outflags |= MMAN_An_split;
 		return(0);
 	case AUTH_nosplit:
 		outflags &= ~MMAN_An_split;
 		outflags |= MMAN_An_nosplit;
 		return(0);
 	default:
 		if (MMAN_An_split & outflags)
 			outflags |= MMAN_br;
 		else if (SEC_AUTHORS == n->sec &&
 		    ! (MMAN_An_nosplit & outflags))
 			outflags |= MMAN_An_split;
 		return(1);
 	}
 }
 
 static int
 pre_ap(DECL_ARGS)
 {
 
 	outflags &= ~MMAN_spc;
 	print_word("'");
 	outflags &= ~MMAN_spc;
 	return(0);
 }
 
 static int
 pre_aq(DECL_ARGS)
 {
 
 	print_word(n->parent->prev != NULL &&
 	    n->parent->prev->tok == MDOC_An ?  "<" : "\\(la");
 	outflags &= ~MMAN_spc;
 	return(1);
 }
 
 static void
 post_aq(DECL_ARGS)
 {
 
 	outflags &= ~(MMAN_spc | MMAN_nl);
 	print_word(n->parent->prev != NULL &&
 	    n->parent->prev->tok == MDOC_An ?  ">" : "\\(ra");
 }
 
 static int
 pre_bd(DECL_ARGS)
 {
 
 	outflags &= ~(MMAN_PP | MMAN_sp | MMAN_br);
 
 	if (DISP_unfilled == n->norm->Bd.type ||
 	    DISP_literal  == n->norm->Bd.type)
 		print_line(".nf", 0);
 	if (0 == n->norm->Bd.comp && NULL != n->parent->prev)
 		outflags |= MMAN_sp;
 	print_offs(n->norm->Bd.offs, 1);
 	return(1);
 }
 
 static void
 post_bd(DECL_ARGS)
 {
 
 	/* Close out this display. */
 	print_line(".RE", MMAN_nl);
 	if (DISP_unfilled == n->norm->Bd.type ||
 	    DISP_literal  == n->norm->Bd.type)
 		print_line(".fi", MMAN_nl);
 
 	/* Maybe we are inside an enclosing list? */
 	if (NULL != n->parent->next)
 		mid_it();
 }
 
 static int
 pre_bf(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		return(1);
 	case MDOC_BODY:
 		break;
 	default:
 		return(0);
 	}
 	switch (n->norm->Bf.font) {
 	case FONT_Em:
 		font_push('I');
 		break;
 	case FONT_Sy:
 		font_push('B');
 		break;
 	default:
 		font_push('R');
 		break;
 	}
 	return(1);
 }
 
 static void
 post_bf(DECL_ARGS)
 {
 
 	if (MDOC_BODY == n->type)
 		font_pop();
 }
 
 static int
 pre_bk(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		return(1);
 	case MDOC_BODY:
 		outflags |= MMAN_Bk;
 		return(1);
 	default:
 		return(0);
 	}
 }
 
 static void
 post_bk(DECL_ARGS)
 {
 
 	if (MDOC_BODY == n->type)
 		outflags &= ~MMAN_Bk;
 }
 
 static int
 pre_bl(DECL_ARGS)
 {
 	size_t		 icol;
 
 	/*
 	 * print_offs() will increase the -offset to account for
 	 * a possible enclosing .It, but any enclosed .It blocks
 	 * just nest and do not add up their indentation.
 	 */
 	if (n->norm->Bl.offs) {
 		print_offs(n->norm->Bl.offs, 0);
 		Bl_stack[Bl_stack_len++] = 0;
 	}
 
 	switch (n->norm->Bl.type) {
 	case LIST_enum:
 		n->norm->Bl.count = 0;
 		return(1);
 	case LIST_column:
 		break;
 	default:
 		return(1);
 	}
 
 	print_line(".TS", MMAN_nl);
 	for (icol = 0; icol < n->norm->Bl.ncols; icol++)
 		print_word("l");
 	print_word(".");
 	outflags |= MMAN_nl;
 	return(1);
 }
 
 static void
 post_bl(DECL_ARGS)
 {
 
 	switch (n->norm->Bl.type) {
 	case LIST_column:
 		print_line(".TE", 0);
 		break;
 	case LIST_enum:
 		n->norm->Bl.count = 0;
 		break;
 	default:
 		break;
 	}
 
 	if (n->norm->Bl.offs) {
 		print_line(".RE", MMAN_nl);
 		assert(Bl_stack_len);
 		Bl_stack_len--;
 		assert(0 == Bl_stack[Bl_stack_len]);
 	} else {
 		outflags |= MMAN_PP | MMAN_nl;
 		outflags &= ~(MMAN_sp | MMAN_br);
 	}
 
 	/* Maybe we are inside an enclosing list? */
 	if (NULL != n->parent->next)
 		mid_it();
 
 }
 
 static int
 pre_br(DECL_ARGS)
 {
 
 	outflags |= MMAN_br;
 	return(0);
 }
 
 static int
 pre_bx(DECL_ARGS)
 {
 
 	n = n->child;
 	if (n) {
 		print_word(n->string);
 		outflags &= ~MMAN_spc;
 		n = n->next;
 	}
 	print_word("BSD");
 	if (NULL == n)
 		return(0);
 	outflags &= ~MMAN_spc;
 	print_word("-");
 	outflags &= ~MMAN_spc;
 	print_word(n->string);
 	return(0);
 }
 
 static int
 pre_dl(DECL_ARGS)
 {
 
 	print_offs("6n", 0);
 	return(1);
 }
 
 static void
 post_dl(DECL_ARGS)
 {
 
 	print_line(".RE", MMAN_nl);
 
 	/* Maybe we are inside an enclosing list? */
 	if (NULL != n->parent->next)
 		mid_it();
 }
 
 static int
 pre_em(DECL_ARGS)
 {
 
 	font_push('I');
 	return(1);
 }
 
 static int
 pre_en(DECL_ARGS)
 {
 
 	if (NULL == n->norm->Es ||
 	    NULL == n->norm->Es->child)
 		return(1);
 
 	print_word(n->norm->Es->child->string);
 	outflags &= ~MMAN_spc;
 	return(1);
 }
 
 static void
 post_en(DECL_ARGS)
 {
 
 	if (NULL == n->norm->Es ||
 	    NULL == n->norm->Es->child ||
 	    NULL == n->norm->Es->child->next)
 		return;
 
 	outflags &= ~MMAN_spc;
 	print_word(n->norm->Es->child->next->string);
 	return;
 }
 
 static int
 pre_eo(DECL_ARGS)
 {
 
 	outflags &= ~(MMAN_spc | MMAN_nl);
 	return(1);
 }
 
 static void
 post_eo(DECL_ARGS)
 {
 
 	if (n->end != ENDBODY_SPACE)
 		outflags &= ~MMAN_spc;
 }
 
 static int
 pre_fa(DECL_ARGS)
 {
 	int	 am_Fa;
 
 	am_Fa = MDOC_Fa == n->tok;
 
 	if (am_Fa)
 		n = n->child;
 
 	while (NULL != n) {
 		font_push('I');
 		if (am_Fa || MDOC_SYNPRETTY & n->flags)
 			outflags |= MMAN_nbrword;
 		print_node(meta, n);
 		font_pop();
 		if (NULL != (n = n->next))
 			print_word(",");
 	}
 	return(0);
 }
 
 static void
 post_fa(DECL_ARGS)
 {
 
 	if (NULL != n->next && MDOC_Fa == n->next->tok)
 		print_word(",");
 }
 
 static int
 pre_fd(DECL_ARGS)
 {
 
 	pre_syn(n);
 	font_push('B');
 	return(1);
 }
 
 static void
 post_fd(DECL_ARGS)
 {
 
 	font_pop();
 	outflags |= MMAN_br;
 }
 
 static int
 pre_fl(DECL_ARGS)
 {
 
 	font_push('B');
 	print_word("\\-");
 	if (n->nchild)
 		outflags &= ~MMAN_spc;
 	return(1);
 }
 
 static void
 post_fl(DECL_ARGS)
 {
 
 	font_pop();
 	if ( ! (n->nchild ||
 	    n->next == NULL ||
 	    n->next->type == MDOC_TEXT ||
 	    n->next->flags & MDOC_LINE))
 		outflags &= ~MMAN_spc;
 }
 
 static int
 pre_fn(DECL_ARGS)
 {
 
 	pre_syn(n);
 
 	n = n->child;
 	if (NULL == n)
 		return(0);
 
 	if (MDOC_SYNPRETTY & n->flags)
 		print_block(".HP 4n", MMAN_nl);
 
 	font_push('B');
 	print_node(meta, n);
 	font_pop();
 	outflags &= ~MMAN_spc;
 	print_word("(");
 	outflags &= ~MMAN_spc;
 
 	n = n->next;
 	if (NULL != n)
 		pre_fa(meta, n);
 	return(0);
 }
 
 static void
 post_fn(DECL_ARGS)
 {
 
 	print_word(")");
 	if (MDOC_SYNPRETTY & n->flags) {
 		print_word(";");
 		outflags |= MMAN_PP;
 	}
 }
 
 static int
 pre_fo(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		pre_syn(n);
 		break;
 	case MDOC_HEAD:
 		if (MDOC_SYNPRETTY & n->flags)
 			print_block(".HP 4n", MMAN_nl);
 		font_push('B');
 		break;
 	case MDOC_BODY:
 		outflags &= ~MMAN_spc;
 		print_word("(");
 		outflags &= ~MMAN_spc;
 		break;
 	default:
 		break;
 	}
 	return(1);
 }
 
 static void
 post_fo(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_HEAD:
 		font_pop();
 		break;
 	case MDOC_BODY:
 		post_fn(meta, n);
 		break;
 	default:
 		break;
 	}
 }
 
 static int
 pre_ft(DECL_ARGS)
 {
 
 	pre_syn(n);
 	font_push('I');
 	return(1);
 }
 
 static int
 pre_in(DECL_ARGS)
 {
 
 	if (MDOC_SYNPRETTY & n->flags) {
 		pre_syn(n);
 		font_push('B');
 		print_word("#include <");
 		outflags &= ~MMAN_spc;
 	} else {
 		print_word("<");
 		outflags &= ~MMAN_spc;
 		font_push('I');
 	}
 	return(1);
 }
 
 static void
 post_in(DECL_ARGS)
 {
 
 	if (MDOC_SYNPRETTY & n->flags) {
 		outflags &= ~MMAN_spc;
 		print_word(">");
 		font_pop();
 		outflags |= MMAN_br;
 	} else {
 		font_pop();
 		outflags &= ~MMAN_spc;
 		print_word(">");
 	}
 }
 
 static int
 pre_it(DECL_ARGS)
 {
 	const struct mdoc_node *bln;
 
 	switch (n->type) {
 	case MDOC_HEAD:
 		outflags |= MMAN_PP | MMAN_nl;
 		bln = n->parent->parent;
 		if (0 == bln->norm->Bl.comp ||
 		    (NULL == n->parent->prev &&
 		     NULL == bln->parent->prev))
 			outflags |= MMAN_sp;
 		outflags &= ~MMAN_br;
 		switch (bln->norm->Bl.type) {
 		case LIST_item:
 			return(0);
 		case LIST_inset:
 			/* FALLTHROUGH */
 		case LIST_diag:
 			/* FALLTHROUGH */
 		case LIST_ohang:
 			if (bln->norm->Bl.type == LIST_diag)
 				print_line(".B \"", 0);
 			else
 				print_line(".R \"", 0);
 			outflags &= ~MMAN_spc;
 			return(1);
 		case LIST_bullet:
 			/* FALLTHROUGH */
 		case LIST_dash:
 			/* FALLTHROUGH */
 		case LIST_hyphen:
 			print_width(bln->norm->Bl.width, NULL, 0);
 			TPremain = 0;
 			outflags |= MMAN_nl;
 			font_push('B');
 			if (LIST_bullet == bln->norm->Bl.type)
 				print_word("\\(bu");
 			else
 				print_word("-");
 			font_pop();
 			outflags |= MMAN_nl;
 			return(0);
 		case LIST_enum:
 			print_width(bln->norm->Bl.width, NULL, 0);
 			TPremain = 0;
 			outflags |= MMAN_nl;
 			print_count(&bln->norm->Bl.count);
 			outflags |= MMAN_nl;
 			return(0);
 		case LIST_hang:
 			print_width(bln->norm->Bl.width, n->child, 6);
 			TPremain = 0;
 			outflags |= MMAN_nl;
 			return(1);
 		case LIST_tag:
 			print_width(bln->norm->Bl.width, n->child, 0);
 			putchar('\n');
 			outflags &= ~MMAN_spc;
 			return(1);
 		default:
 			return(1);
 		}
 	default:
 		break;
 	}
 	return(1);
 }
 
 /*
  * This function is called after closing out an indented block.
  * If we are inside an enclosing list, restore its indentation.
  */
 static void
 mid_it(void)
 {
 	char		 buf[24];
 
 	/* Nothing to do outside a list. */
 	if (0 == Bl_stack_len || 0 == Bl_stack[Bl_stack_len - 1])
 		return;
 
 	/* The indentation has already been set up. */
 	if (Bl_stack_post[Bl_stack_len - 1])
 		return;
 
 	/* Restore the indentation of the enclosing list. */
 	print_line(".RS", MMAN_Bk_susp);
 	(void)snprintf(buf, sizeof(buf), "%zun",
 	    Bl_stack[Bl_stack_len - 1]);
 	print_word(buf);
 
 	/* Remeber to close out this .RS block later. */
 	Bl_stack_post[Bl_stack_len - 1] = 1;
 }
 
 static void
 post_it(DECL_ARGS)
 {
 	const struct mdoc_node *bln;
 
 	bln = n->parent->parent;
 
 	switch (n->type) {
 	case MDOC_HEAD:
 		switch (bln->norm->Bl.type) {
 		case LIST_diag:
 			outflags &= ~MMAN_spc;
 			print_word("\\ ");
 			break;
 		case LIST_ohang:
 			outflags |= MMAN_br;
 			break;
 		default:
 			break;
 		}
 		break;
 	case MDOC_BODY:
 		switch (bln->norm->Bl.type) {
 		case LIST_bullet:
 			/* FALLTHROUGH */
 		case LIST_dash:
 			/* FALLTHROUGH */
 		case LIST_hyphen:
 			/* FALLTHROUGH */
 		case LIST_enum:
 			/* FALLTHROUGH */
 		case LIST_hang:
 			/* FALLTHROUGH */
 		case LIST_tag:
 			assert(Bl_stack_len);
 			Bl_stack[--Bl_stack_len] = 0;
 
 			/*
 			 * Our indentation had to be restored
 			 * after a child display or child list.
 			 * Close out that indentation block now.
 			 */
 			if (Bl_stack_post[Bl_stack_len]) {
 				print_line(".RE", MMAN_nl);
 				Bl_stack_post[Bl_stack_len] = 0;
 			}
 			break;
 		case LIST_column:
 			if (NULL != n->next) {
 				putchar('\t');
 				outflags &= ~MMAN_spc;
 			}
 			break;
 		default:
 			break;
 		}
 		break;
 	default:
 		break;
 	}
 }
 
 static void
 post_lb(DECL_ARGS)
 {
 
 	if (SEC_LIBRARY == n->sec)
 		outflags |= MMAN_br;
 }
 
 static int
 pre_lk(DECL_ARGS)
 {
 	const struct mdoc_node *link, *descr;
 
 	if (NULL == (link = n->child))
 		return(0);
 
 	if (NULL != (descr = link->next)) {
 		font_push('I');
 		while (NULL != descr) {
 			print_word(descr->string);
 			descr = descr->next;
 		}
 		print_word(":");
 		font_pop();
 	}
 
 	font_push('B');
 	print_word(link->string);
 	font_pop();
 	return(0);
 }
 
 static int
 pre_ll(DECL_ARGS)
 {
 
 	print_line(".ll", 0);
 	return(1);
 }
 
 static int
 pre_li(DECL_ARGS)
 {
 
 	font_push('R');
 	return(1);
 }
 
 static int
 pre_nm(DECL_ARGS)
 {
 	char	*name;
 
 	if (MDOC_BLOCK == n->type) {
 		outflags |= MMAN_Bk;
 		pre_syn(n);
 	}
 	if (MDOC_ELEM != n->type && MDOC_HEAD != n->type)
 		return(1);
 	name = n->child ? n->child->string : meta->name;
 	if (NULL == name)
 		return(0);
 	if (MDOC_HEAD == n->type) {
 		if (NULL == n->parent->prev)
 			outflags |= MMAN_sp;
 		print_block(".HP", 0);
 		printf(" %zun", strlen(name) + 1);
 		outflags |= MMAN_nl;
 	}
 	font_push('B');
 	if (NULL == n->child)
 		print_word(meta->name);
 	return(1);
 }
 
 static void
 post_nm(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		outflags &= ~MMAN_Bk;
 		break;
 	case MDOC_HEAD:
 		/* FALLTHROUGH */
 	case MDOC_ELEM:
 		if (n->child != NULL || meta->name != NULL)
 			font_pop();
 		break;
 	default:
 		break;
 	}
 }
 
 static int
 pre_no(DECL_ARGS)
 {
 
 	outflags |= MMAN_spc_force;
 	return(1);
 }
 
 static int
 pre_ns(DECL_ARGS)
 {
 
 	outflags &= ~MMAN_spc;
 	return(0);
 }
 
 static void
 post_pf(DECL_ARGS)
 {
 
-	outflags &= ~MMAN_spc;
+	if ( ! (n->next == NULL || n->next->flags & MDOC_LINE))
+		outflags &= ~MMAN_spc;
 }
 
 static int
 pre_pp(DECL_ARGS)
 {
 
 	if (MDOC_It != n->parent->tok)
 		outflags |= MMAN_PP;
 	outflags |= MMAN_sp | MMAN_nl;
 	outflags &= ~MMAN_br;
 	return(0);
 }
 
 static int
 pre_rs(DECL_ARGS)
 {
 
 	if (SEC_SEE_ALSO == n->sec) {
 		outflags |= MMAN_PP | MMAN_sp | MMAN_nl;
 		outflags &= ~MMAN_br;
 	}
 	return(1);
 }
 
 static int
 pre_rv(DECL_ARGS)
 {
 	int	 nchild;
 
 	outflags |= MMAN_br | MMAN_nl;
 
 	nchild = n->nchild;
 	if (nchild > 0) {
 		print_word("The");
 
 		for (n = n->child; n; n = n->next) {
 			font_push('B');
 			print_word(n->string);
 			font_pop();
 
 			outflags &= ~MMAN_spc;
 			print_word("()");
 
 			if (n->next == NULL)
 				continue;
 
 			if (nchild > 2) {
 				outflags &= ~MMAN_spc;
 				print_word(",");
 			}
 			if (n->next->next == NULL)
 				print_word("and");
 		}
 
 		if (nchild > 1)
 			print_word("functions return");
 		else
 			print_word("function returns");
 
 		print_word("the value\\~0 if successful;");
 	} else
 		print_word("Upon successful completion, "
 		    "the value\\~0 is returned;");
 
 	print_word("otherwise the value\\~\\-1 is returned"
 	    " and the global variable");
 
 	font_push('I');
 	print_word("errno");
 	font_pop();
 
 	print_word("is set to indicate the error.");
 	outflags |= MMAN_nl;
 	return(0);
 }
 
 static int
 pre_skip(DECL_ARGS)
 {
 
 	return(0);
 }
 
 static int
 pre_sm(DECL_ARGS)
 {
 
 	if (NULL == n->child)
 		outflags ^= MMAN_Sm;
 	else if (0 == strcmp("on", n->child->string))
 		outflags |= MMAN_Sm;
 	else
 		outflags &= ~MMAN_Sm;
 
 	if (MMAN_Sm & outflags)
 		outflags |= MMAN_spc;
 
 	return(0);
 }
 
 static int
 pre_sp(DECL_ARGS)
 {
 
 	if (MMAN_PP & outflags) {
 		outflags &= ~MMAN_PP;
 		print_line(".PP", 0);
 	} else
 		print_line(".sp", 0);
 	return(1);
 }
 
 static void
 post_sp(DECL_ARGS)
 {
 
 	outflags |= MMAN_nl;
 }
 
 static int
 pre_sy(DECL_ARGS)
 {
 
 	font_push('B');
 	return(1);
 }
 
 static int
 pre_vt(DECL_ARGS)
 {
 
 	if (MDOC_SYNPRETTY & n->flags) {
 		switch (n->type) {
 		case MDOC_BLOCK:
 			pre_syn(n);
 			return(1);
 		case MDOC_BODY:
 			break;
 		default:
 			return(0);
 		}
 	}
 	font_push('I');
 	return(1);
 }
 
 static void
 post_vt(DECL_ARGS)
 {
 
 	if (MDOC_SYNPRETTY & n->flags && MDOC_BODY != n->type)
 		return;
 	font_pop();
 }
 
 static int
 pre_xr(DECL_ARGS)
 {
 
 	n = n->child;
 	if (NULL == n)
 		return(0);
 	print_node(meta, n);
 	n = n->next;
 	if (NULL == n)
 		return(0);
 	outflags &= ~MMAN_spc;
 	print_word("(");
 	print_node(meta, n);
 	print_word(")");
 	return(0);
 }
 
 static int
 pre_ux(DECL_ARGS)
 {
 
 	print_word(manacts[n->tok].prefix);
 	if (NULL == n->child)
 		return(0);
 	outflags &= ~MMAN_spc;
 	print_word("\\ ");
 	outflags &= ~MMAN_spc;
 	return(1);
 }
Index: projects/arm_intrng/contrib/mdocml/mdoc_term.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/mdoc_term.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/mdoc_term.c	(revision 276248)
@@ -1,2219 +1,2221 @@
-/*	$Id: mdoc_term.c,v 1.297 2014/11/28 16:54:23 schwarze Exp $ */
+/*	$Id: mdoc_term.c,v 1.299 2014/12/02 10:08:06 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2010, 2012, 2013, 2014 Ingo Schwarze 
  * Copyright (c) 2013 Franco Fichtner 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "mandoc.h"
 #include "mandoc_aux.h"
 #include "out.h"
 #include "term.h"
 #include "mdoc.h"
 #include "main.h"
 
 struct	termpair {
 	struct termpair	 *ppair;
 	int		  count;
 };
 
 #define	DECL_ARGS struct termp *p, \
 		  struct termpair *pair, \
 		  const struct mdoc_meta *meta, \
 		  struct mdoc_node *n
 
 struct	termact {
 	int	(*pre)(DECL_ARGS);
 	void	(*post)(DECL_ARGS);
 };
 
 static	size_t	  a2width(const struct termp *, const char *);
 static	size_t	  a2height(const struct termp *, const char *);
 
 static	void	  print_bvspace(struct termp *,
 			const struct mdoc_node *,
 			const struct mdoc_node *);
 static	void	  print_mdoc_node(DECL_ARGS);
 static	void	  print_mdoc_nodelist(DECL_ARGS);
 static	void	  print_mdoc_head(struct termp *, const void *);
 static	void	  print_mdoc_foot(struct termp *, const void *);
 static	void	  synopsis_pre(struct termp *,
 			const struct mdoc_node *);
 
 static	void	  termp____post(DECL_ARGS);
 static	void	  termp__t_post(DECL_ARGS);
 static	void	  termp_bd_post(DECL_ARGS);
 static	void	  termp_bk_post(DECL_ARGS);
 static	void	  termp_bl_post(DECL_ARGS);
 static	void	  termp_fd_post(DECL_ARGS);
 static	void	  termp_fo_post(DECL_ARGS);
 static	void	  termp_in_post(DECL_ARGS);
 static	void	  termp_it_post(DECL_ARGS);
 static	void	  termp_lb_post(DECL_ARGS);
 static	void	  termp_nm_post(DECL_ARGS);
 static	void	  termp_pf_post(DECL_ARGS);
 static	void	  termp_quote_post(DECL_ARGS);
 static	void	  termp_sh_post(DECL_ARGS);
 static	void	  termp_ss_post(DECL_ARGS);
 
 static	int	  termp__a_pre(DECL_ARGS);
 static	int	  termp__t_pre(DECL_ARGS);
 static	int	  termp_an_pre(DECL_ARGS);
 static	int	  termp_ap_pre(DECL_ARGS);
 static	int	  termp_bd_pre(DECL_ARGS);
 static	int	  termp_bf_pre(DECL_ARGS);
 static	int	  termp_bk_pre(DECL_ARGS);
 static	int	  termp_bl_pre(DECL_ARGS);
 static	int	  termp_bold_pre(DECL_ARGS);
 static	int	  termp_bt_pre(DECL_ARGS);
 static	int	  termp_bx_pre(DECL_ARGS);
 static	int	  termp_cd_pre(DECL_ARGS);
 static	int	  termp_d1_pre(DECL_ARGS);
 static	int	  termp_ex_pre(DECL_ARGS);
 static	int	  termp_fa_pre(DECL_ARGS);
 static	int	  termp_fd_pre(DECL_ARGS);
 static	int	  termp_fl_pre(DECL_ARGS);
 static	int	  termp_fn_pre(DECL_ARGS);
 static	int	  termp_fo_pre(DECL_ARGS);
 static	int	  termp_ft_pre(DECL_ARGS);
 static	int	  termp_in_pre(DECL_ARGS);
 static	int	  termp_it_pre(DECL_ARGS);
 static	int	  termp_li_pre(DECL_ARGS);
 static	int	  termp_ll_pre(DECL_ARGS);
 static	int	  termp_lk_pre(DECL_ARGS);
 static	int	  termp_nd_pre(DECL_ARGS);
 static	int	  termp_nm_pre(DECL_ARGS);
 static	int	  termp_ns_pre(DECL_ARGS);
 static	int	  termp_quote_pre(DECL_ARGS);
 static	int	  termp_rs_pre(DECL_ARGS);
 static	int	  termp_rv_pre(DECL_ARGS);
 static	int	  termp_sh_pre(DECL_ARGS);
 static	int	  termp_skip_pre(DECL_ARGS);
 static	int	  termp_sm_pre(DECL_ARGS);
 static	int	  termp_sp_pre(DECL_ARGS);
 static	int	  termp_ss_pre(DECL_ARGS);
 static	int	  termp_under_pre(DECL_ARGS);
 static	int	  termp_ud_pre(DECL_ARGS);
 static	int	  termp_vt_pre(DECL_ARGS);
 static	int	  termp_xr_pre(DECL_ARGS);
 static	int	  termp_xx_pre(DECL_ARGS);
 
 static	const struct termact termacts[MDOC_MAX] = {
 	{ termp_ap_pre, NULL }, /* Ap */
 	{ NULL, NULL }, /* Dd */
 	{ NULL, NULL }, /* Dt */
 	{ NULL, NULL }, /* Os */
 	{ termp_sh_pre, termp_sh_post }, /* Sh */
 	{ termp_ss_pre, termp_ss_post }, /* Ss */
 	{ termp_sp_pre, NULL }, /* Pp */
 	{ termp_d1_pre, termp_bl_post }, /* D1 */
 	{ termp_d1_pre, termp_bl_post }, /* Dl */
 	{ termp_bd_pre, termp_bd_post }, /* Bd */
 	{ NULL, NULL }, /* Ed */
 	{ termp_bl_pre, termp_bl_post }, /* Bl */
 	{ NULL, NULL }, /* El */
 	{ termp_it_pre, termp_it_post }, /* It */
 	{ termp_under_pre, NULL }, /* Ad */
 	{ termp_an_pre, NULL }, /* An */
 	{ termp_under_pre, NULL }, /* Ar */
 	{ termp_cd_pre, NULL }, /* Cd */
 	{ termp_bold_pre, NULL }, /* Cm */
 	{ NULL, NULL }, /* Dv */
 	{ NULL, NULL }, /* Er */
 	{ NULL, NULL }, /* Ev */
 	{ termp_ex_pre, NULL }, /* Ex */
 	{ termp_fa_pre, NULL }, /* Fa */
 	{ termp_fd_pre, termp_fd_post }, /* Fd */
 	{ termp_fl_pre, NULL }, /* Fl */
 	{ termp_fn_pre, NULL }, /* Fn */
 	{ termp_ft_pre, NULL }, /* Ft */
 	{ termp_bold_pre, NULL }, /* Ic */
 	{ termp_in_pre, termp_in_post }, /* In */
 	{ termp_li_pre, NULL }, /* Li */
 	{ termp_nd_pre, NULL }, /* Nd */
 	{ termp_nm_pre, termp_nm_post }, /* Nm */
 	{ termp_quote_pre, termp_quote_post }, /* Op */
 	{ termp_ft_pre, NULL }, /* Ot */
 	{ termp_under_pre, NULL }, /* Pa */
 	{ termp_rv_pre, NULL }, /* Rv */
 	{ NULL, NULL }, /* St */
 	{ termp_under_pre, NULL }, /* Va */
 	{ termp_vt_pre, NULL }, /* Vt */
 	{ termp_xr_pre, NULL }, /* Xr */
 	{ termp__a_pre, termp____post }, /* %A */
 	{ termp_under_pre, termp____post }, /* %B */
 	{ NULL, termp____post }, /* %D */
 	{ termp_under_pre, termp____post }, /* %I */
 	{ termp_under_pre, termp____post }, /* %J */
 	{ NULL, termp____post }, /* %N */
 	{ NULL, termp____post }, /* %O */
 	{ NULL, termp____post }, /* %P */
 	{ NULL, termp____post }, /* %R */
 	{ termp__t_pre, termp__t_post }, /* %T */
 	{ NULL, termp____post }, /* %V */
 	{ NULL, NULL }, /* Ac */
 	{ termp_quote_pre, termp_quote_post }, /* Ao */
 	{ termp_quote_pre, termp_quote_post }, /* Aq */
 	{ NULL, NULL }, /* At */
 	{ NULL, NULL }, /* Bc */
 	{ termp_bf_pre, NULL }, /* Bf */
 	{ termp_quote_pre, termp_quote_post }, /* Bo */
 	{ termp_quote_pre, termp_quote_post }, /* Bq */
 	{ termp_xx_pre, NULL }, /* Bsx */
 	{ termp_bx_pre, NULL }, /* Bx */
 	{ termp_skip_pre, NULL }, /* Db */
 	{ NULL, NULL }, /* Dc */
 	{ termp_quote_pre, termp_quote_post }, /* Do */
 	{ termp_quote_pre, termp_quote_post }, /* Dq */
 	{ NULL, NULL }, /* Ec */ /* FIXME: no space */
 	{ NULL, NULL }, /* Ef */
 	{ termp_under_pre, NULL }, /* Em */
 	{ termp_quote_pre, termp_quote_post }, /* Eo */
 	{ termp_xx_pre, NULL }, /* Fx */
 	{ termp_bold_pre, NULL }, /* Ms */
 	{ termp_li_pre, NULL }, /* No */
 	{ termp_ns_pre, NULL }, /* Ns */
 	{ termp_xx_pre, NULL }, /* Nx */
 	{ termp_xx_pre, NULL }, /* Ox */
 	{ NULL, NULL }, /* Pc */
 	{ NULL, termp_pf_post }, /* Pf */
 	{ termp_quote_pre, termp_quote_post }, /* Po */
 	{ termp_quote_pre, termp_quote_post }, /* Pq */
 	{ NULL, NULL }, /* Qc */
 	{ termp_quote_pre, termp_quote_post }, /* Ql */
 	{ termp_quote_pre, termp_quote_post }, /* Qo */
 	{ termp_quote_pre, termp_quote_post }, /* Qq */
 	{ NULL, NULL }, /* Re */
 	{ termp_rs_pre, NULL }, /* Rs */
 	{ NULL, NULL }, /* Sc */
 	{ termp_quote_pre, termp_quote_post }, /* So */
 	{ termp_quote_pre, termp_quote_post }, /* Sq */
 	{ termp_sm_pre, NULL }, /* Sm */
 	{ termp_under_pre, NULL }, /* Sx */
 	{ termp_bold_pre, NULL }, /* Sy */
 	{ NULL, NULL }, /* Tn */
 	{ termp_xx_pre, NULL }, /* Ux */
 	{ NULL, NULL }, /* Xc */
 	{ NULL, NULL }, /* Xo */
 	{ termp_fo_pre, termp_fo_post }, /* Fo */
 	{ NULL, NULL }, /* Fc */
 	{ termp_quote_pre, termp_quote_post }, /* Oo */
 	{ NULL, NULL }, /* Oc */
 	{ termp_bk_pre, termp_bk_post }, /* Bk */
 	{ NULL, NULL }, /* Ek */
 	{ termp_bt_pre, NULL }, /* Bt */
 	{ NULL, NULL }, /* Hf */
 	{ termp_under_pre, NULL }, /* Fr */
 	{ termp_ud_pre, NULL }, /* Ud */
 	{ NULL, termp_lb_post }, /* Lb */
 	{ termp_sp_pre, NULL }, /* Lp */
 	{ termp_lk_pre, NULL }, /* Lk */
 	{ termp_under_pre, NULL }, /* Mt */
 	{ termp_quote_pre, termp_quote_post }, /* Brq */
 	{ termp_quote_pre, termp_quote_post }, /* Bro */
 	{ NULL, NULL }, /* Brc */
 	{ NULL, termp____post }, /* %C */
 	{ termp_skip_pre, NULL }, /* Es */
 	{ termp_quote_pre, termp_quote_post }, /* En */
 	{ termp_xx_pre, NULL }, /* Dx */
 	{ NULL, termp____post }, /* %Q */
 	{ termp_sp_pre, NULL }, /* br */
 	{ termp_sp_pre, NULL }, /* sp */
 	{ NULL, termp____post }, /* %U */
 	{ NULL, NULL }, /* Ta */
 	{ termp_ll_pre, NULL }, /* ll */
 };
 
 
 void
 terminal_mdoc(void *arg, const struct mdoc *mdoc)
 {
 	const struct mdoc_meta	*meta;
 	struct mdoc_node	*n;
 	struct termp		*p;
 
 	p = (struct termp *)arg;
 
 	p->overstep = 0;
 	p->rmargin = p->maxrmargin = p->defrmargin;
 	p->tabwidth = term_len(p, 5);
 
 	n = mdoc_node(mdoc)->child;
 	meta = mdoc_meta(mdoc);
 
 	if (p->synopsisonly) {
 		while (n != NULL) {
 			if (n->tok == MDOC_Sh && n->sec == SEC_SYNOPSIS) {
 				if (n->child->next->child != NULL)
 					print_mdoc_nodelist(p, NULL,
 					    meta, n->child->next->child);
 				term_newln(p);
 				break;
 			}
 			n = n->next;
 		}
 	} else {
 		if (p->defindent == 0)
 			p->defindent = 5;
 		term_begin(p, print_mdoc_head, print_mdoc_foot, meta);
 		if (n != NULL) {
 			if (n->tok != MDOC_Sh)
 				term_vspace(p);
 			print_mdoc_nodelist(p, NULL, meta, n);
 		}
 		term_end(p);
 	}
 }
 
 static void
 print_mdoc_nodelist(DECL_ARGS)
 {
 
 	print_mdoc_node(p, pair, meta, n);
 	if (n->next)
 		print_mdoc_nodelist(p, pair, meta, n->next);
 }
 
 static void
 print_mdoc_node(DECL_ARGS)
 {
 	int		 chld;
 	struct termpair	 npair;
 	size_t		 offset, rmargin;
 
 	chld = 1;
 	offset = p->offset;
 	rmargin = p->rmargin;
 	n->prev_font = term_fontq(p);
 
 	memset(&npair, 0, sizeof(struct termpair));
 	npair.ppair = pair;
 
 	/*
 	 * Keeps only work until the end of a line.  If a keep was
 	 * invoked in a prior line, revert it to PREKEEP.
 	 */
 
 	if (TERMP_KEEP & p->flags) {
 		if (n->prev ? (n->prev->lastline != n->line) :
 		    (n->parent && n->parent->line != n->line)) {
 			p->flags &= ~TERMP_KEEP;
 			p->flags |= TERMP_PREKEEP;
 		}
 	}
 
 	/*
 	 * After the keep flags have been set up, we may now
 	 * produce output.  Note that some pre-handlers do so.
 	 */
 
 	switch (n->type) {
 	case MDOC_TEXT:
 		if (' ' == *n->string && MDOC_LINE & n->flags)
 			term_newln(p);
 		if (MDOC_DELIMC & n->flags)
 			p->flags |= TERMP_NOSPACE;
 		term_word(p, n->string);
 		if (MDOC_DELIMO & n->flags)
 			p->flags |= TERMP_NOSPACE;
 		break;
 	case MDOC_EQN:
 		if ( ! (n->flags & MDOC_LINE))
 			p->flags |= TERMP_NOSPACE;
 		term_eqn(p, n->eqn);
 		if (n->next != NULL && ! (n->next->flags & MDOC_LINE))
 			p->flags |= TERMP_NOSPACE;
 		break;
 	case MDOC_TBL:
 		term_tbl(p, n->span);
 		break;
 	default:
 		if (termacts[n->tok].pre &&
 		    (n->end == ENDBODY_NOT || n->nchild))
 			chld = (*termacts[n->tok].pre)
 				(p, &npair, meta, n);
 		break;
 	}
 
 	if (chld && n->child)
 		print_mdoc_nodelist(p, &npair, meta, n->child);
 
 	term_fontpopq(p,
 	    (ENDBODY_NOT == n->end ? n : n->pending)->prev_font);
 
 	switch (n->type) {
 	case MDOC_TEXT:
 		break;
 	case MDOC_TBL:
 		break;
 	case MDOC_EQN:
 		break;
 	default:
 		if ( ! termacts[n->tok].post || MDOC_ENDED & n->flags)
 			break;
 		(void)(*termacts[n->tok].post)(p, &npair, meta, n);
 
 		/*
 		 * Explicit end tokens not only call the post
 		 * handler, but also tell the respective block
 		 * that it must not call the post handler again.
 		 */
 		if (ENDBODY_NOT != n->end)
 			n->pending->flags |= MDOC_ENDED;
 
 		/*
 		 * End of line terminating an implicit block
 		 * while an explicit block is still open.
 		 * Continue the explicit block without spacing.
 		 */
 		if (ENDBODY_NOSPACE == n->end)
 			p->flags |= TERMP_NOSPACE;
 		break;
 	}
 
 	if (MDOC_EOS & n->flags)
 		p->flags |= TERMP_SENTENCE;
 
 	if (MDOC_ll != n->tok) {
 		p->offset = offset;
 		p->rmargin = rmargin;
 	}
 }
 
 static void
 print_mdoc_foot(struct termp *p, const void *arg)
 {
 	const struct mdoc_meta *meta;
 	size_t sz;
 
 	meta = (const struct mdoc_meta *)arg;
 
 	term_fontrepl(p, TERMFONT_NONE);
 
 	/*
 	 * Output the footer in new-groff style, that is, three columns
 	 * with the middle being the manual date and flanking columns
 	 * being the operating system:
 	 *
 	 * SYSTEM                  DATE                    SYSTEM
 	 */
 
 	term_vspace(p);
 
 	p->offset = 0;
 	sz = term_strlen(p, meta->date);
 	p->rmargin = p->maxrmargin > sz ?
 	    (p->maxrmargin + term_len(p, 1) - sz) / 2 : 0;
 	p->trailspace = 1;
 	p->flags |= TERMP_NOSPACE | TERMP_NOBREAK;
 
 	term_word(p, meta->os);
 	term_flushln(p);
 
 	p->offset = p->rmargin;
 	sz = term_strlen(p, meta->os);
 	p->rmargin = p->maxrmargin > sz ? p->maxrmargin - sz : 0;
 	p->flags |= TERMP_NOSPACE;
 
 	term_word(p, meta->date);
 	term_flushln(p);
 
 	p->offset = p->rmargin;
 	p->rmargin = p->maxrmargin;
 	p->trailspace = 0;
 	p->flags &= ~TERMP_NOBREAK;
 	p->flags |= TERMP_NOSPACE;
 
 	term_word(p, meta->os);
 	term_flushln(p);
 
 	p->offset = 0;
 	p->rmargin = p->maxrmargin;
 	p->flags = 0;
 }
 
 static void
 print_mdoc_head(struct termp *p, const void *arg)
 {
 	const struct mdoc_meta	*meta;
 	char			*volume, *title;
 	size_t			 vollen, titlen;
 
 	meta = (const struct mdoc_meta *)arg;
 
 	/*
 	 * The header is strange.  It has three components, which are
 	 * really two with the first duplicated.  It goes like this:
 	 *
 	 * IDENTIFIER              TITLE                   IDENTIFIER
 	 *
 	 * The IDENTIFIER is NAME(SECTION), which is the command-name
 	 * (if given, or "unknown" if not) followed by the manual page
 	 * section.  These are given in `Dt'.  The TITLE is a free-form
 	 * string depending on the manual volume.  If not specified, it
 	 * switches on the manual section.
 	 */
 
 	assert(meta->vol);
 	if (NULL == meta->arch)
 		volume = mandoc_strdup(meta->vol);
 	else
 		mandoc_asprintf(&volume, "%s (%s)",
 		    meta->vol, meta->arch);
 	vollen = term_strlen(p, volume);
 
 	if (NULL == meta->msec)
 		title = mandoc_strdup(meta->title);
 	else
 		mandoc_asprintf(&title, "%s(%s)",
 		    meta->title, meta->msec);
 	titlen = term_strlen(p, title);
 
 	p->flags |= TERMP_NOBREAK | TERMP_NOSPACE;
 	p->trailspace = 1;
 	p->offset = 0;
 	p->rmargin = 2 * (titlen+1) + vollen < p->maxrmargin ?
 	    (p->maxrmargin - vollen + term_len(p, 1)) / 2 :
 	    vollen < p->maxrmargin ?  p->maxrmargin - vollen : 0;
 
 	term_word(p, title);
 	term_flushln(p);
 
 	p->flags |= TERMP_NOSPACE;
 	p->offset = p->rmargin;
 	p->rmargin = p->offset + vollen + titlen < p->maxrmargin ?
 	    p->maxrmargin - titlen : p->maxrmargin;
 
 	term_word(p, volume);
 	term_flushln(p);
 
 	p->flags &= ~TERMP_NOBREAK;
 	p->trailspace = 0;
 	if (p->rmargin + titlen <= p->maxrmargin) {
 		p->flags |= TERMP_NOSPACE;
 		p->offset = p->rmargin;
 		p->rmargin = p->maxrmargin;
 		term_word(p, title);
 		term_flushln(p);
 	}
 
 	p->flags &= ~TERMP_NOSPACE;
 	p->offset = 0;
 	p->rmargin = p->maxrmargin;
 	free(title);
 	free(volume);
 }
 
 static size_t
 a2height(const struct termp *p, const char *v)
 {
 	struct roffsu	 su;
 
 
 	assert(v);
 	if ( ! a2roffsu(v, &su, SCALE_VS))
 		SCALE_VS_INIT(&su, atoi(v));
 
 	return(term_vspan(p, &su));
 }
 
 static size_t
 a2width(const struct termp *p, const char *v)
 {
 	struct roffsu	 su;
 
 	assert(v);
 	if ( ! a2roffsu(v, &su, SCALE_MAX)) {
 		SCALE_HS_INIT(&su, term_strlen(p, v));
 		su.scale /= term_strlen(p, "0");
 	}
 
 	return(term_hspan(p, &su));
 }
 
 /*
  * Determine how much space to print out before block elements of `It'
  * (and thus `Bl') and `Bd'.  And then go ahead and print that space,
  * too.
  */
 static void
 print_bvspace(struct termp *p,
 	const struct mdoc_node *bl,
 	const struct mdoc_node *n)
 {
 	const struct mdoc_node	*nn;
 
 	assert(n);
 
 	term_newln(p);
 
 	if (MDOC_Bd == bl->tok && bl->norm->Bd.comp)
 		return;
 	if (MDOC_Bl == bl->tok && bl->norm->Bl.comp)
 		return;
 
 	/* Do not vspace directly after Ss/Sh. */
 
 	nn = n;
 	while (nn->prev == NULL) {
 		do {
 			nn = nn->parent;
 			if (nn->type == MDOC_ROOT)
 				return;
 		} while (nn->type != MDOC_BLOCK);
 		if (nn->tok == MDOC_Sh || nn->tok == MDOC_Ss)
 			return;
 		if (nn->tok == MDOC_It &&
 		    nn->parent->parent->norm->Bl.type != LIST_item)
 			break;
 	}
 
 	/* A `-column' does not assert vspace within the list. */
 
 	if (MDOC_Bl == bl->tok && LIST_column == bl->norm->Bl.type)
 		if (n->prev && MDOC_It == n->prev->tok)
 			return;
 
 	/* A `-diag' without body does not vspace. */
 
 	if (MDOC_Bl == bl->tok && LIST_diag == bl->norm->Bl.type)
 		if (n->prev && MDOC_It == n->prev->tok) {
 			assert(n->prev->body);
 			if (NULL == n->prev->body->child)
 				return;
 		}
 
 	term_vspace(p);
 }
 
 
 static int
 termp_ll_pre(DECL_ARGS)
 {
 
 	term_setwidth(p, n->nchild ? n->child->string : NULL);
 	return(0);
 }
 
 static int
 termp_it_pre(DECL_ARGS)
 {
 	const struct mdoc_node *bl, *nn;
 	char			buf[24];
 	int			i;
 	size_t			width, offset, ncols, dcol;
 	enum mdoc_list		type;
 
 	if (MDOC_BLOCK == n->type) {
 		print_bvspace(p, n->parent->parent, n);
 		return(1);
 	}
 
 	bl = n->parent->parent->parent;
 	type = bl->norm->Bl.type;
 
 	/*
 	 * First calculate width and offset.  This is pretty easy unless
 	 * we're a -column list, in which case all prior columns must
 	 * be accounted for.
 	 */
 
 	width = offset = 0;
 
 	if (bl->norm->Bl.offs)
 		offset = a2width(p, bl->norm->Bl.offs);
 
 	switch (type) {
 	case LIST_column:
 		if (MDOC_HEAD == n->type)
 			break;
 
 		/*
 		 * Imitate groff's column handling:
 		 * - For each earlier column, add its width.
 		 * - For less than 5 columns, add four more blanks per
 		 *   column.
 		 * - For exactly 5 columns, add three more blank per
 		 *   column.
 		 * - For more than 5 columns, add only one column.
 		 */
 		ncols = bl->norm->Bl.ncols;
 		dcol = ncols < 5 ? term_len(p, 4) :
 		    ncols == 5 ? term_len(p, 3) : term_len(p, 1);
 
 		/*
 		 * Calculate the offset by applying all prior MDOC_BODY,
 		 * so we stop at the MDOC_HEAD (NULL == nn->prev).
 		 */
 
 		for (i = 0, nn = n->prev;
 		    nn->prev && i < (int)ncols;
 		    nn = nn->prev, i++)
 			offset += dcol + a2width(p,
 			    bl->norm->Bl.cols[i]);
 
 		/*
 		 * When exceeding the declared number of columns, leave
 		 * the remaining widths at 0.  This will later be
 		 * adjusted to the default width of 10, or, for the last
 		 * column, stretched to the right margin.
 		 */
 		if (i >= (int)ncols)
 			break;
 
 		/*
 		 * Use the declared column widths, extended as explained
 		 * in the preceding paragraph.
 		 */
 		width = a2width(p, bl->norm->Bl.cols[i]) + dcol;
 		break;
 	default:
 		if (NULL == bl->norm->Bl.width)
 			break;
 
 		/*
 		 * Note: buffer the width by 2, which is groff's magic
 		 * number for buffering single arguments.  See the above
 		 * handling for column for how this changes.
 		 */
 		assert(bl->norm->Bl.width);
 		width = a2width(p, bl->norm->Bl.width) + term_len(p, 2);
 		break;
 	}
 
 	/*
 	 * List-type can override the width in the case of fixed-head
 	 * values (bullet, dash/hyphen, enum).  Tags need a non-zero
 	 * offset.
 	 */
 
 	switch (type) {
 	case LIST_bullet:
 		/* FALLTHROUGH */
 	case LIST_dash:
 		/* FALLTHROUGH */
 	case LIST_hyphen:
 		/* FALLTHROUGH */
 	case LIST_enum:
 		if (width < term_len(p, 2))
 			width = term_len(p, 2);
 		break;
 	case LIST_hang:
 		if (0 == width)
 			width = term_len(p, 8);
 		break;
 	case LIST_column:
 		/* FALLTHROUGH */
 	case LIST_tag:
 		if (0 == width)
 			width = term_len(p, 10);
 		break;
 	default:
 		break;
 	}
 
 	/*
 	 * Whitespace control.  Inset bodies need an initial space,
 	 * while diagonal bodies need two.
 	 */
 
 	p->flags |= TERMP_NOSPACE;
 
 	switch (type) {
 	case LIST_diag:
 		if (MDOC_BODY == n->type)
 			term_word(p, "\\ \\ ");
 		break;
 	case LIST_inset:
 		if (MDOC_BODY == n->type && n->parent->head->nchild)
 			term_word(p, "\\ ");
 		break;
 	default:
 		break;
 	}
 
 	p->flags |= TERMP_NOSPACE;
 
 	switch (type) {
 	case LIST_diag:
 		if (MDOC_HEAD == n->type)
 			term_fontpush(p, TERMFONT_BOLD);
 		break;
 	default:
 		break;
 	}
 
 	/*
 	 * Pad and break control.  This is the tricky part.  These flags
 	 * are documented in term_flushln() in term.c.  Note that we're
 	 * going to unset all of these flags in termp_it_post() when we
 	 * exit.
 	 */
 
 	switch (type) {
 	case LIST_enum:
 		/*
 		 * Weird special case.
 		 * Very narrow enum lists actually hang.
 		 */
 		if (width == term_len(p, 2))
 			p->flags |= TERMP_HANG;
 		/* FALLTHROUGH */
 	case LIST_bullet:
 		/* FALLTHROUGH */
 	case LIST_dash:
 		/* FALLTHROUGH */
 	case LIST_hyphen:
 		if (MDOC_HEAD != n->type)
 			break;
 		p->flags |= TERMP_NOBREAK;
 		p->trailspace = 1;
 		break;
 	case LIST_hang:
 		if (MDOC_HEAD != n->type)
 			break;
 
 		/*
 		 * This is ugly.  If `-hang' is specified and the body
 		 * is a `Bl' or `Bd', then we want basically to nullify
 		 * the "overstep" effect in term_flushln() and treat
 		 * this as a `-ohang' list instead.
 		 */
 		if (NULL != n->next &&
 		    NULL != n->next->child &&
 		    (MDOC_Bl == n->next->child->tok ||
 		     MDOC_Bd == n->next->child->tok))
 			break;
 
 		p->flags |= TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG;
 		p->trailspace = 1;
 		break;
 	case LIST_tag:
 		if (MDOC_HEAD != n->type)
 			break;
 
 		p->flags |= TERMP_NOBREAK | TERMP_BRIND;
 		p->trailspace = 2;
 
 		if (NULL == n->next || NULL == n->next->child)
 			p->flags |= TERMP_DANGLE;
 		break;
 	case LIST_column:
 		if (MDOC_HEAD == n->type)
 			break;
 
 		if (NULL == n->next) {
 			p->flags &= ~TERMP_NOBREAK;
 			p->trailspace = 0;
 		} else {
 			p->flags |= TERMP_NOBREAK;
 			p->trailspace = 1;
 		}
 
 		break;
 	case LIST_diag:
 		if (MDOC_HEAD != n->type)
 			break;
 		p->flags |= TERMP_NOBREAK | TERMP_BRIND;
 		p->trailspace = 1;
 		break;
 	default:
 		break;
 	}
 
 	/*
 	 * Margin control.  Set-head-width lists have their right
 	 * margins shortened.  The body for these lists has the offset
 	 * necessarily lengthened.  Everybody gets the offset.
 	 */
 
 	p->offset += offset;
 
 	switch (type) {
 	case LIST_hang:
 		/*
 		 * Same stipulation as above, regarding `-hang'.  We
 		 * don't want to recalculate rmargin and offsets when
 		 * using `Bd' or `Bl' within `-hang' overstep lists.
 		 */
 		if (MDOC_HEAD == n->type &&
 		    NULL != n->next &&
 		    NULL != n->next->child &&
 		    (MDOC_Bl == n->next->child->tok ||
 		     MDOC_Bd == n->next->child->tok))
 			break;
 		/* FALLTHROUGH */
 	case LIST_bullet:
 		/* FALLTHROUGH */
 	case LIST_dash:
 		/* FALLTHROUGH */
 	case LIST_enum:
 		/* FALLTHROUGH */
 	case LIST_hyphen:
 		/* FALLTHROUGH */
 	case LIST_tag:
 		assert(width);
 		if (MDOC_HEAD == n->type)
 			p->rmargin = p->offset + width;
 		else
 			p->offset += width;
 		break;
 	case LIST_column:
 		assert(width);
 		p->rmargin = p->offset + width;
 		/*
 		 * XXX - this behaviour is not documented: the
 		 * right-most column is filled to the right margin.
 		 */
 		if (MDOC_HEAD == n->type)
 			break;
 		if (NULL == n->next && p->rmargin < p->maxrmargin)
 			p->rmargin = p->maxrmargin;
 		break;
 	default:
 		break;
 	}
 
 	/*
 	 * The dash, hyphen, bullet and enum lists all have a special
 	 * HEAD character (temporarily bold, in some cases).
 	 */
 
 	if (MDOC_HEAD == n->type)
 		switch (type) {
 		case LIST_bullet:
 			term_fontpush(p, TERMFONT_BOLD);
 			term_word(p, "\\[bu]");
 			term_fontpop(p);
 			break;
 		case LIST_dash:
 			/* FALLTHROUGH */
 		case LIST_hyphen:
 			term_fontpush(p, TERMFONT_BOLD);
 			term_word(p, "\\(hy");
 			term_fontpop(p);
 			break;
 		case LIST_enum:
 			(pair->ppair->ppair->count)++;
 			(void)snprintf(buf, sizeof(buf), "%d.",
 			    pair->ppair->ppair->count);
 			term_word(p, buf);
 			break;
 		default:
 			break;
 		}
 
 	/*
 	 * If we're not going to process our children, indicate so here.
 	 */
 
 	switch (type) {
 	case LIST_bullet:
 		/* FALLTHROUGH */
 	case LIST_item:
 		/* FALLTHROUGH */
 	case LIST_dash:
 		/* FALLTHROUGH */
 	case LIST_hyphen:
 		/* FALLTHROUGH */
 	case LIST_enum:
 		if (MDOC_HEAD == n->type)
 			return(0);
 		break;
 	case LIST_column:
 		if (MDOC_HEAD == n->type)
 			return(0);
 		break;
 	default:
 		break;
 	}
 
 	return(1);
 }
 
 static void
 termp_it_post(DECL_ARGS)
 {
 	enum mdoc_list	   type;
 
 	if (MDOC_BLOCK == n->type)
 		return;
 
 	type = n->parent->parent->parent->norm->Bl.type;
 
 	switch (type) {
 	case LIST_item:
 		/* FALLTHROUGH */
 	case LIST_diag:
 		/* FALLTHROUGH */
 	case LIST_inset:
 		if (MDOC_BODY == n->type)
 			term_newln(p);
 		break;
 	case LIST_column:
 		if (MDOC_BODY == n->type)
 			term_flushln(p);
 		break;
 	default:
 		term_newln(p);
 		break;
 	}
 
 	/*
 	 * Now that our output is flushed, we can reset our tags.  Since
 	 * only `It' sets these flags, we're free to assume that nobody
 	 * has munged them in the meanwhile.
 	 */
 
 	p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND |
 			TERMP_DANGLE | TERMP_HANG);
 	p->trailspace = 0;
 }
 
 static int
 termp_nm_pre(DECL_ARGS)
 {
 	const char	*cp;
 
 	if (MDOC_BLOCK == n->type) {
 		p->flags |= TERMP_PREKEEP;
 		return(1);
 	}
 
 	if (MDOC_BODY == n->type) {
 		if (NULL == n->child)
 			return(0);
 		p->flags |= TERMP_NOSPACE;
 		cp = NULL;
 		if (n->prev->child != NULL)
 		    cp = n->prev->child->string;
 		if (cp == NULL)
 			cp = meta->name;
 		if (cp == NULL)
 			p->offset += term_len(p, 6);
 		else
 			p->offset += term_len(p, 1) + term_strlen(p, cp);
 		return(1);
 	}
 
 	if (NULL == n->child && NULL == meta->name)
 		return(0);
 
 	if (MDOC_HEAD == n->type)
 		synopsis_pre(p, n->parent);
 
 	if (MDOC_HEAD == n->type &&
 	    NULL != n->next && NULL != n->next->child) {
 		p->flags |= TERMP_NOSPACE | TERMP_NOBREAK | TERMP_BRIND;
 		p->trailspace = 1;
 		p->rmargin = p->offset + term_len(p, 1);
 		if (NULL == n->child) {
 			p->rmargin += term_strlen(p, meta->name);
 		} else if (MDOC_TEXT == n->child->type) {
 			p->rmargin += term_strlen(p, n->child->string);
 			if (n->child->next)
 				p->flags |= TERMP_HANG;
 		} else {
 			p->rmargin += term_len(p, 5);
 			p->flags |= TERMP_HANG;
 		}
 	}
 
 	term_fontpush(p, TERMFONT_BOLD);
 	if (NULL == n->child)
 		term_word(p, meta->name);
 	return(1);
 }
 
 static void
 termp_nm_post(DECL_ARGS)
 {
 
 	if (MDOC_BLOCK == n->type) {
 		p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
 	} else if (MDOC_HEAD == n->type &&
 	    NULL != n->next && NULL != n->next->child) {
 		term_flushln(p);
 		p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG);
 		p->trailspace = 0;
 	} else if (MDOC_BODY == n->type && n->child)
 		term_flushln(p);
 }
 
 static int
 termp_fl_pre(DECL_ARGS)
 {
 
 	term_fontpush(p, TERMFONT_BOLD);
 	term_word(p, "\\-");
 
 	if ( ! (n->nchild == 0 &&
 	    (n->next == NULL ||
 	     n->next->type == MDOC_TEXT ||
 	     n->next->flags & MDOC_LINE)))
 		p->flags |= TERMP_NOSPACE;
 
 	return(1);
 }
 
 static int
 termp__a_pre(DECL_ARGS)
 {
 
 	if (n->prev && MDOC__A == n->prev->tok)
 		if (NULL == n->next || MDOC__A != n->next->tok)
 			term_word(p, "and");
 
 	return(1);
 }
 
 static int
 termp_an_pre(DECL_ARGS)
 {
 
 	if (n->norm->An.auth == AUTH_split) {
 		p->flags &= ~TERMP_NOSPLIT;
 		p->flags |= TERMP_SPLIT;
 		return(0);
 	}
 	if (n->norm->An.auth == AUTH_nosplit) {
 		p->flags &= ~TERMP_SPLIT;
 		p->flags |= TERMP_NOSPLIT;
 		return(0);
 	}
 
 	if (n->child == NULL)
 		return(0);
 
 	if (p->flags & TERMP_SPLIT)
 		term_newln(p);
 
 	if (n->sec == SEC_AUTHORS && ! (p->flags & TERMP_NOSPLIT))
 		p->flags |= TERMP_SPLIT;
 
 	return(1);
 }
 
 static int
 termp_ns_pre(DECL_ARGS)
 {
 
 	if ( ! (MDOC_LINE & n->flags))
 		p->flags |= TERMP_NOSPACE;
 	return(1);
 }
 
 static int
 termp_rs_pre(DECL_ARGS)
 {
 
 	if (SEC_SEE_ALSO != n->sec)
 		return(1);
 	if (MDOC_BLOCK == n->type && n->prev)
 		term_vspace(p);
 	return(1);
 }
 
 static int
 termp_rv_pre(DECL_ARGS)
 {
 	int		 nchild;
 
 	term_newln(p);
 
 	nchild = n->nchild;
 	if (nchild > 0) {
 		term_word(p, "The");
 
 		for (n = n->child; n; n = n->next) {
 			term_fontpush(p, TERMFONT_BOLD);
 			term_word(p, n->string);
 			term_fontpop(p);
 
 			p->flags |= TERMP_NOSPACE;
 			term_word(p, "()");
 
 			if (n->next == NULL)
 				continue;
 
 			if (nchild > 2) {
 				p->flags |= TERMP_NOSPACE;
 				term_word(p, ",");
 			}
 			if (n->next->next == NULL)
 				term_word(p, "and");
 		}
 
 		if (nchild > 1)
 			term_word(p, "functions return");
 		else
 			term_word(p, "function returns");
 
 		term_word(p, "the value\\~0 if successful;");
 	} else
 		term_word(p, "Upon successful completion,"
 		    " the value\\~0 is returned;");
 
 	term_word(p, "otherwise the value\\~\\-1 is returned"
 	    " and the global variable");
 
 	term_fontpush(p, TERMFONT_UNDER);
 	term_word(p, "errno");
 	term_fontpop(p);
 
 	term_word(p, "is set to indicate the error.");
 	p->flags |= TERMP_SENTENCE;
 
 	return(0);
 }
 
 static int
 termp_ex_pre(DECL_ARGS)
 {
 	int		 nchild;
 
 	term_newln(p);
 	term_word(p, "The");
 
 	nchild = n->nchild;
 	for (n = n->child; n; n = n->next) {
 		term_fontpush(p, TERMFONT_BOLD);
 		term_word(p, n->string);
 		term_fontpop(p);
 
 		if (nchild > 2 && n->next) {
 			p->flags |= TERMP_NOSPACE;
 			term_word(p, ",");
 		}
 
 		if (n->next && NULL == n->next->next)
 			term_word(p, "and");
 	}
 
 	if (nchild > 1)
 		term_word(p, "utilities exit\\~0");
 	else
 		term_word(p, "utility exits\\~0");
 
 	term_word(p, "on success, and\\~>0 if an error occurs.");
 
 	p->flags |= TERMP_SENTENCE;
 	return(0);
 }
 
 static int
 termp_nd_pre(DECL_ARGS)
 {
 
 	if (n->type == MDOC_BODY)
 		term_word(p, "\\(en");
 	return(1);
 }
 
 static int
 termp_bl_pre(DECL_ARGS)
 {
 
 	return(MDOC_HEAD != n->type);
 }
 
 static void
 termp_bl_post(DECL_ARGS)
 {
 
 	if (MDOC_BLOCK == n->type)
 		term_newln(p);
 }
 
 static int
 termp_xr_pre(DECL_ARGS)
 {
 
 	if (NULL == (n = n->child))
 		return(0);
 
 	assert(MDOC_TEXT == n->type);
 	term_word(p, n->string);
 
 	if (NULL == (n = n->next))
 		return(0);
 
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, "(");
 	p->flags |= TERMP_NOSPACE;
 
 	assert(MDOC_TEXT == n->type);
 	term_word(p, n->string);
 
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, ")");
 
 	return(0);
 }
 
 /*
  * This decides how to assert whitespace before any of the SYNOPSIS set
  * of macros (which, as in the case of Ft/Fo and Ft/Fn, may contain
  * macro combos).
  */
 static void
 synopsis_pre(struct termp *p, const struct mdoc_node *n)
 {
 	/*
 	 * Obviously, if we're not in a SYNOPSIS or no prior macros
 	 * exist, do nothing.
 	 */
 	if (NULL == n->prev || ! (MDOC_SYNPRETTY & n->flags))
 		return;
 
 	/*
 	 * If we're the second in a pair of like elements, emit our
 	 * newline and return.  UNLESS we're `Fo', `Fn', `Fn', in which
 	 * case we soldier on.
 	 */
 	if (n->prev->tok == n->tok &&
 	    MDOC_Ft != n->tok &&
 	    MDOC_Fo != n->tok &&
 	    MDOC_Fn != n->tok) {
 		term_newln(p);
 		return;
 	}
 
 	/*
 	 * If we're one of the SYNOPSIS set and non-like pair-wise after
 	 * another (or Fn/Fo, which we've let slip through) then assert
 	 * vertical space, else only newline and move on.
 	 */
 	switch (n->prev->tok) {
 	case MDOC_Fd:
 		/* FALLTHROUGH */
 	case MDOC_Fn:
 		/* FALLTHROUGH */
 	case MDOC_Fo:
 		/* FALLTHROUGH */
 	case MDOC_In:
 		/* FALLTHROUGH */
 	case MDOC_Vt:
 		term_vspace(p);
 		break;
 	case MDOC_Ft:
 		if (MDOC_Fn != n->tok && MDOC_Fo != n->tok) {
 			term_vspace(p);
 			break;
 		}
 		/* FALLTHROUGH */
 	default:
 		term_newln(p);
 		break;
 	}
 }
 
 static int
 termp_vt_pre(DECL_ARGS)
 {
 
 	if (MDOC_ELEM == n->type) {
 		synopsis_pre(p, n);
 		return(termp_under_pre(p, pair, meta, n));
 	} else if (MDOC_BLOCK == n->type) {
 		synopsis_pre(p, n);
 		return(1);
 	} else if (MDOC_HEAD == n->type)
 		return(0);
 
 	return(termp_under_pre(p, pair, meta, n));
 }
 
 static int
 termp_bold_pre(DECL_ARGS)
 {
 
 	term_fontpush(p, TERMFONT_BOLD);
 	return(1);
 }
 
 static int
 termp_fd_pre(DECL_ARGS)
 {
 
 	synopsis_pre(p, n);
 	return(termp_bold_pre(p, pair, meta, n));
 }
 
 static void
 termp_fd_post(DECL_ARGS)
 {
 
 	term_newln(p);
 }
 
 static int
 termp_sh_pre(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		/*
 		 * Vertical space before sections, except
 		 * when the previous section was empty.
 		 */
 		if (n->prev == NULL ||
 		    MDOC_Sh != n->prev->tok ||
 		    (n->prev->body != NULL &&
 		     n->prev->body->child != NULL))
 			term_vspace(p);
 		break;
 	case MDOC_HEAD:
 		term_fontpush(p, TERMFONT_BOLD);
 		break;
 	case MDOC_BODY:
 		p->offset = term_len(p, p->defindent);
 		if (SEC_AUTHORS == n->sec)
 			p->flags &= ~(TERMP_SPLIT|TERMP_NOSPLIT);
 		break;
 	default:
 		break;
 	}
 	return(1);
 }
 
 static void
 termp_sh_post(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_HEAD:
 		term_newln(p);
 		break;
 	case MDOC_BODY:
 		term_newln(p);
 		p->offset = 0;
 		break;
 	default:
 		break;
 	}
 }
 
 static int
 termp_bt_pre(DECL_ARGS)
 {
 
 	term_word(p, "is currently in beta test.");
 	p->flags |= TERMP_SENTENCE;
 	return(0);
 }
 
 static void
 termp_lb_post(DECL_ARGS)
 {
 
 	if (SEC_LIBRARY == n->sec && MDOC_LINE & n->flags)
 		term_newln(p);
 }
 
 static int
 termp_ud_pre(DECL_ARGS)
 {
 
 	term_word(p, "currently under development.");
 	p->flags |= TERMP_SENTENCE;
 	return(0);
 }
 
 static int
 termp_d1_pre(DECL_ARGS)
 {
 
 	if (MDOC_BLOCK != n->type)
 		return(1);
 	term_newln(p);
 	p->offset += term_len(p, p->defindent + 1);
 	return(1);
 }
 
 static int
 termp_ft_pre(DECL_ARGS)
 {
 
 	/* NB: MDOC_LINE does not effect this! */
 	synopsis_pre(p, n);
 	term_fontpush(p, TERMFONT_UNDER);
 	return(1);
 }
 
 static int
 termp_fn_pre(DECL_ARGS)
 {
 	size_t		 rmargin = 0;
 	int		 pretty;
 
 	pretty = MDOC_SYNPRETTY & n->flags;
 
 	synopsis_pre(p, n);
 
 	if (NULL == (n = n->child))
 		return(0);
 
 	if (pretty) {
 		rmargin = p->rmargin;
 		p->rmargin = p->offset + term_len(p, 4);
 		p->flags |= TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG;
 	}
 
 	assert(MDOC_TEXT == n->type);
 	term_fontpush(p, TERMFONT_BOLD);
 	term_word(p, n->string);
 	term_fontpop(p);
 
 	if (pretty) {
 		term_flushln(p);
 		p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND | TERMP_HANG);
 		p->offset = p->rmargin;
 		p->rmargin = rmargin;
 	}
 
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, "(");
 	p->flags |= TERMP_NOSPACE;
 
 	for (n = n->next; n; n = n->next) {
 		assert(MDOC_TEXT == n->type);
 		term_fontpush(p, TERMFONT_UNDER);
 		if (pretty)
 			p->flags |= TERMP_NBRWORD;
 		term_word(p, n->string);
 		term_fontpop(p);
 
 		if (n->next) {
 			p->flags |= TERMP_NOSPACE;
 			term_word(p, ",");
 		}
 	}
 
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, ")");
 
 	if (pretty) {
 		p->flags |= TERMP_NOSPACE;
 		term_word(p, ";");
 		term_flushln(p);
 	}
 
 	return(0);
 }
 
 static int
 termp_fa_pre(DECL_ARGS)
 {
 	const struct mdoc_node	*nn;
 
 	if (n->parent->tok != MDOC_Fo) {
 		term_fontpush(p, TERMFONT_UNDER);
 		return(1);
 	}
 
 	for (nn = n->child; nn; nn = nn->next) {
 		term_fontpush(p, TERMFONT_UNDER);
 		p->flags |= TERMP_NBRWORD;
 		term_word(p, nn->string);
 		term_fontpop(p);
 
 		if (nn->next || (n->next && n->next->tok == MDOC_Fa)) {
 			p->flags |= TERMP_NOSPACE;
 			term_word(p, ",");
 		}
 	}
 
 	return(0);
 }
 
 static int
 termp_bd_pre(DECL_ARGS)
 {
 	size_t			 tabwidth, lm, len, rm, rmax;
 	struct mdoc_node	*nn;
 
 	if (MDOC_BLOCK == n->type) {
 		print_bvspace(p, n, n);
 		return(1);
 	} else if (MDOC_HEAD == n->type)
 		return(0);
 
 	/* Handle the -offset argument. */
 
 	if (n->norm->Bd.offs == NULL ||
 	    ! strcmp(n->norm->Bd.offs, "left"))
 		/* nothing */;
 	else if ( ! strcmp(n->norm->Bd.offs, "indent"))
 		p->offset += term_len(p, p->defindent + 1);
 	else if ( ! strcmp(n->norm->Bd.offs, "indent-two"))
 		p->offset += term_len(p, (p->defindent + 1) * 2);
 	else
 		p->offset += a2width(p, n->norm->Bd.offs);
 
 	/*
 	 * If -ragged or -filled are specified, the block does nothing
 	 * but change the indentation.  If -unfilled or -literal are
 	 * specified, text is printed exactly as entered in the display:
 	 * for macro lines, a newline is appended to the line.  Blank
 	 * lines are allowed.
 	 */
 
 	if (DISP_literal != n->norm->Bd.type &&
 	    DISP_unfilled != n->norm->Bd.type &&
 	    DISP_centered != n->norm->Bd.type)
 		return(1);
 
 	tabwidth = p->tabwidth;
 	if (DISP_literal == n->norm->Bd.type)
 		p->tabwidth = term_len(p, 8);
 
 	lm = p->offset;
 	rm = p->rmargin;
 	rmax = p->maxrmargin;
 	p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
 
 	for (nn = n->child; nn; nn = nn->next) {
 		if (DISP_centered == n->norm->Bd.type) {
 			if (MDOC_TEXT == nn->type) {
 				len = term_strlen(p, nn->string);
 				p->offset = len >= rm ? 0 :
 				    lm + len >= rm ? rm - len :
 				    (lm + rm - len) / 2;
 			} else
 				p->offset = lm;
 		}
 		print_mdoc_node(p, pair, meta, nn);
 		/*
 		 * If the printed node flushes its own line, then we
 		 * needn't do it here as well.  This is hacky, but the
 		 * notion of selective eoln whitespace is pretty dumb
 		 * anyway, so don't sweat it.
 		 */
 		switch (nn->tok) {
 		case MDOC_Sm:
 			/* FALLTHROUGH */
 		case MDOC_br:
 			/* FALLTHROUGH */
 		case MDOC_sp:
 			/* FALLTHROUGH */
 		case MDOC_Bl:
 			/* FALLTHROUGH */
 		case MDOC_D1:
 			/* FALLTHROUGH */
 		case MDOC_Dl:
 			/* FALLTHROUGH */
 		case MDOC_Lp:
 			/* FALLTHROUGH */
 		case MDOC_Pp:
 			continue;
 		default:
 			break;
 		}
-		if (nn->next && nn->next->line == nn->line)
+		if (p->flags & TERMP_NONEWLINE ||
+		    (nn->next && ! (nn->next->flags & MDOC_LINE)))
 			continue;
 		term_flushln(p);
 		p->flags |= TERMP_NOSPACE;
 	}
 
 	p->tabwidth = tabwidth;
 	p->rmargin = rm;
 	p->maxrmargin = rmax;
 	return(0);
 }
 
 static void
 termp_bd_post(DECL_ARGS)
 {
 	size_t		 rm, rmax;
 
 	if (MDOC_BODY != n->type)
 		return;
 
 	rm = p->rmargin;
 	rmax = p->maxrmargin;
 
 	if (DISP_literal == n->norm->Bd.type ||
 	    DISP_unfilled == n->norm->Bd.type)
 		p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
 
 	p->flags |= TERMP_NOSPACE;
 	term_newln(p);
 
 	p->rmargin = rm;
 	p->maxrmargin = rmax;
 }
 
 static int
 termp_bx_pre(DECL_ARGS)
 {
 
 	if (NULL != (n = n->child)) {
 		term_word(p, n->string);
 		p->flags |= TERMP_NOSPACE;
 		term_word(p, "BSD");
 	} else {
 		term_word(p, "BSD");
 		return(0);
 	}
 
 	if (NULL != (n = n->next)) {
 		p->flags |= TERMP_NOSPACE;
 		term_word(p, "-");
 		p->flags |= TERMP_NOSPACE;
 		term_word(p, n->string);
 	}
 
 	return(0);
 }
 
 static int
 termp_xx_pre(DECL_ARGS)
 {
 	const char	*pp;
 	int		 flags;
 
 	pp = NULL;
 	switch (n->tok) {
 	case MDOC_Bsx:
 		pp = "BSD/OS";
 		break;
 	case MDOC_Dx:
 		pp = "DragonFly";
 		break;
 	case MDOC_Fx:
 		pp = "FreeBSD";
 		break;
 	case MDOC_Nx:
 		pp = "NetBSD";
 		break;
 	case MDOC_Ox:
 		pp = "OpenBSD";
 		break;
 	case MDOC_Ux:
 		pp = "UNIX";
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 
 	term_word(p, pp);
 	if (n->child) {
 		flags = p->flags;
 		p->flags |= TERMP_KEEP;
 		term_word(p, n->child->string);
 		p->flags = flags;
 	}
 	return(0);
 }
 
 static void
 termp_pf_post(DECL_ARGS)
 {
 
-	p->flags |= TERMP_NOSPACE;
+	if ( ! (n->next == NULL || n->next->flags & MDOC_LINE))
+		p->flags |= TERMP_NOSPACE;
 }
 
 static int
 termp_ss_pre(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		term_newln(p);
 		if (n->prev)
 			term_vspace(p);
 		break;
 	case MDOC_HEAD:
 		term_fontpush(p, TERMFONT_BOLD);
 		p->offset = term_len(p, (p->defindent+1)/2);
 		break;
 	case MDOC_BODY:
 		p->offset = term_len(p, p->defindent);
 		break;
 	default:
 		break;
 	}
 
 	return(1);
 }
 
 static void
 termp_ss_post(DECL_ARGS)
 {
 
 	if (n->type == MDOC_HEAD || n->type == MDOC_BODY)
 		term_newln(p);
 }
 
 static int
 termp_cd_pre(DECL_ARGS)
 {
 
 	synopsis_pre(p, n);
 	term_fontpush(p, TERMFONT_BOLD);
 	return(1);
 }
 
 static int
 termp_in_pre(DECL_ARGS)
 {
 
 	synopsis_pre(p, n);
 
 	if (MDOC_SYNPRETTY & n->flags && MDOC_LINE & n->flags) {
 		term_fontpush(p, TERMFONT_BOLD);
 		term_word(p, "#include");
 		term_word(p, "<");
 	} else {
 		term_word(p, "<");
 		term_fontpush(p, TERMFONT_UNDER);
 	}
 
 	p->flags |= TERMP_NOSPACE;
 	return(1);
 }
 
 static void
 termp_in_post(DECL_ARGS)
 {
 
 	if (MDOC_SYNPRETTY & n->flags)
 		term_fontpush(p, TERMFONT_BOLD);
 
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, ">");
 
 	if (MDOC_SYNPRETTY & n->flags)
 		term_fontpop(p);
 }
 
 static int
 termp_sp_pre(DECL_ARGS)
 {
 	size_t		 i, len;
 
 	switch (n->tok) {
 	case MDOC_sp:
 		len = n->child ? a2height(p, n->child->string) : 1;
 		break;
 	case MDOC_br:
 		len = 0;
 		break;
 	default:
 		len = 1;
 		break;
 	}
 
 	if (0 == len)
 		term_newln(p);
 	for (i = 0; i < len; i++)
 		term_vspace(p);
 
 	return(0);
 }
 
 static int
 termp_skip_pre(DECL_ARGS)
 {
 
 	return(0);
 }
 
 static int
 termp_quote_pre(DECL_ARGS)
 {
 
 	if (MDOC_BODY != n->type && MDOC_ELEM != n->type)
 		return(1);
 
 	switch (n->tok) {
 	case MDOC_Ao:
 		/* FALLTHROUGH */
 	case MDOC_Aq:
 		term_word(p, n->parent->prev != NULL &&
 		    n->parent->prev->tok == MDOC_An ?  "<" : "\\(la");
 		break;
 	case MDOC_Bro:
 		/* FALLTHROUGH */
 	case MDOC_Brq:
 		term_word(p, "{");
 		break;
 	case MDOC_Oo:
 		/* FALLTHROUGH */
 	case MDOC_Op:
 		/* FALLTHROUGH */
 	case MDOC_Bo:
 		/* FALLTHROUGH */
 	case MDOC_Bq:
 		term_word(p, "[");
 		break;
 	case MDOC_Do:
 		/* FALLTHROUGH */
 	case MDOC_Dq:
 		term_word(p, "\\(lq");
 		break;
 	case MDOC_En:
 		if (NULL == n->norm->Es ||
 		    NULL == n->norm->Es->child)
 			return(1);
 		term_word(p, n->norm->Es->child->string);
 		break;
 	case MDOC_Eo:
 		break;
 	case MDOC_Po:
 		/* FALLTHROUGH */
 	case MDOC_Pq:
 		term_word(p, "(");
 		break;
 	case MDOC__T:
 		/* FALLTHROUGH */
 	case MDOC_Qo:
 		/* FALLTHROUGH */
 	case MDOC_Qq:
 		term_word(p, "\"");
 		break;
 	case MDOC_Ql:
 		/* FALLTHROUGH */
 	case MDOC_So:
 		/* FALLTHROUGH */
 	case MDOC_Sq:
 		term_word(p, "\\(oq");
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 
 	p->flags |= TERMP_NOSPACE;
 	return(1);
 }
 
 static void
 termp_quote_post(DECL_ARGS)
 {
 
 	if (n->type != MDOC_BODY && n->type != MDOC_ELEM)
 		return;
 
 	if ( ! (n->tok == MDOC_En ||
 	    (n->tok == MDOC_Eo && n->end == ENDBODY_SPACE)))
 		p->flags |= TERMP_NOSPACE;
 
 	switch (n->tok) {
 	case MDOC_Ao:
 		/* FALLTHROUGH */
 	case MDOC_Aq:
 		term_word(p, n->parent->prev != NULL &&
 		    n->parent->prev->tok == MDOC_An ?  ">" : "\\(ra");
 		break;
 	case MDOC_Bro:
 		/* FALLTHROUGH */
 	case MDOC_Brq:
 		term_word(p, "}");
 		break;
 	case MDOC_Oo:
 		/* FALLTHROUGH */
 	case MDOC_Op:
 		/* FALLTHROUGH */
 	case MDOC_Bo:
 		/* FALLTHROUGH */
 	case MDOC_Bq:
 		term_word(p, "]");
 		break;
 	case MDOC_Do:
 		/* FALLTHROUGH */
 	case MDOC_Dq:
 		term_word(p, "\\(rq");
 		break;
 	case MDOC_En:
 		if (NULL != n->norm->Es &&
 		    NULL != n->norm->Es->child &&
 		    NULL != n->norm->Es->child->next) {
 			p->flags |= TERMP_NOSPACE;
 			term_word(p, n->norm->Es->child->next->string);
 		}
 		break;
 	case MDOC_Eo:
 		break;
 	case MDOC_Po:
 		/* FALLTHROUGH */
 	case MDOC_Pq:
 		term_word(p, ")");
 		break;
 	case MDOC__T:
 		/* FALLTHROUGH */
 	case MDOC_Qo:
 		/* FALLTHROUGH */
 	case MDOC_Qq:
 		term_word(p, "\"");
 		break;
 	case MDOC_Ql:
 		/* FALLTHROUGH */
 	case MDOC_So:
 		/* FALLTHROUGH */
 	case MDOC_Sq:
 		term_word(p, "\\(cq");
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 }
 
 static int
 termp_fo_pre(DECL_ARGS)
 {
 	size_t		 rmargin = 0;
 	int		 pretty;
 
 	pretty = MDOC_SYNPRETTY & n->flags;
 
 	if (MDOC_BLOCK == n->type) {
 		synopsis_pre(p, n);
 		return(1);
 	} else if (MDOC_BODY == n->type) {
 		if (pretty) {
 			rmargin = p->rmargin;
 			p->rmargin = p->offset + term_len(p, 4);
 			p->flags |= TERMP_NOBREAK | TERMP_BRIND |
 					TERMP_HANG;
 		}
 		p->flags |= TERMP_NOSPACE;
 		term_word(p, "(");
 		p->flags |= TERMP_NOSPACE;
 		if (pretty) {
 			term_flushln(p);
 			p->flags &= ~(TERMP_NOBREAK | TERMP_BRIND |
 					TERMP_HANG);
 			p->offset = p->rmargin;
 			p->rmargin = rmargin;
 		}
 		return(1);
 	}
 
 	if (NULL == n->child)
 		return(0);
 
 	/* XXX: we drop non-initial arguments as per groff. */
 
 	assert(n->child->string);
 	term_fontpush(p, TERMFONT_BOLD);
 	term_word(p, n->child->string);
 	return(0);
 }
 
 static void
 termp_fo_post(DECL_ARGS)
 {
 
 	if (MDOC_BODY != n->type)
 		return;
 
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, ")");
 
 	if (MDOC_SYNPRETTY & n->flags) {
 		p->flags |= TERMP_NOSPACE;
 		term_word(p, ";");
 		term_flushln(p);
 	}
 }
 
 static int
 termp_bf_pre(DECL_ARGS)
 {
 
 	if (MDOC_HEAD == n->type)
 		return(0);
 	else if (MDOC_BODY != n->type)
 		return(1);
 
 	if (FONT_Em == n->norm->Bf.font)
 		term_fontpush(p, TERMFONT_UNDER);
 	else if (FONT_Sy == n->norm->Bf.font)
 		term_fontpush(p, TERMFONT_BOLD);
 	else
 		term_fontpush(p, TERMFONT_NONE);
 
 	return(1);
 }
 
 static int
 termp_sm_pre(DECL_ARGS)
 {
 
 	if (NULL == n->child)
 		p->flags ^= TERMP_NONOSPACE;
 	else if (0 == strcmp("on", n->child->string))
 		p->flags &= ~TERMP_NONOSPACE;
 	else
 		p->flags |= TERMP_NONOSPACE;
 
 	if (p->col && ! (TERMP_NONOSPACE & p->flags))
 		p->flags &= ~TERMP_NOSPACE;
 
 	return(0);
 }
 
 static int
 termp_ap_pre(DECL_ARGS)
 {
 
 	p->flags |= TERMP_NOSPACE;
 	term_word(p, "'");
 	p->flags |= TERMP_NOSPACE;
 	return(1);
 }
 
 static void
 termp____post(DECL_ARGS)
 {
 
 	/*
 	 * Handle lists of authors.  In general, print each followed by
 	 * a comma.  Don't print the comma if there are only two
 	 * authors.
 	 */
 	if (MDOC__A == n->tok && n->next && MDOC__A == n->next->tok)
 		if (NULL == n->next->next || MDOC__A != n->next->next->tok)
 			if (NULL == n->prev || MDOC__A != n->prev->tok)
 				return;
 
 	/* TODO: %U. */
 
 	if (NULL == n->parent || MDOC_Rs != n->parent->tok)
 		return;
 
 	p->flags |= TERMP_NOSPACE;
 	if (NULL == n->next) {
 		term_word(p, ".");
 		p->flags |= TERMP_SENTENCE;
 	} else
 		term_word(p, ",");
 }
 
 static int
 termp_li_pre(DECL_ARGS)
 {
 
 	term_fontpush(p, TERMFONT_NONE);
 	return(1);
 }
 
 static int
 termp_lk_pre(DECL_ARGS)
 {
 	const struct mdoc_node *link, *descr;
 
 	if (NULL == (link = n->child))
 		return(0);
 
 	if (NULL != (descr = link->next)) {
 		term_fontpush(p, TERMFONT_UNDER);
 		while (NULL != descr) {
 			term_word(p, descr->string);
 			descr = descr->next;
 		}
 		p->flags |= TERMP_NOSPACE;
 		term_word(p, ":");
 		term_fontpop(p);
 	}
 
 	term_fontpush(p, TERMFONT_BOLD);
 	term_word(p, link->string);
 	term_fontpop(p);
 
 	return(0);
 }
 
 static int
 termp_bk_pre(DECL_ARGS)
 {
 
 	switch (n->type) {
 	case MDOC_BLOCK:
 		break;
 	case MDOC_HEAD:
 		return(0);
 	case MDOC_BODY:
 		if (n->parent->args || 0 == n->prev->nchild)
 			p->flags |= TERMP_PREKEEP;
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 
 	return(1);
 }
 
 static void
 termp_bk_post(DECL_ARGS)
 {
 
 	if (MDOC_BODY == n->type)
 		p->flags &= ~(TERMP_KEEP | TERMP_PREKEEP);
 }
 
 static void
 termp__t_post(DECL_ARGS)
 {
 
 	/*
 	 * If we're in an `Rs' and there's a journal present, then quote
 	 * us instead of underlining us (for disambiguation).
 	 */
 	if (n->parent && MDOC_Rs == n->parent->tok &&
 	    n->parent->norm->Rs.quote_T)
 		termp_quote_post(p, pair, meta, n);
 
 	termp____post(p, pair, meta, n);
 }
 
 static int
 termp__t_pre(DECL_ARGS)
 {
 
 	/*
 	 * If we're in an `Rs' and there's a journal present, then quote
 	 * us instead of underlining us (for disambiguation).
 	 */
 	if (n->parent && MDOC_Rs == n->parent->tok &&
 	    n->parent->norm->Rs.quote_T)
 		return(termp_quote_pre(p, pair, meta, n));
 
 	term_fontpush(p, TERMFONT_UNDER);
 	return(1);
 }
 
 static int
 termp_under_pre(DECL_ARGS)
 {
 
 	term_fontpush(p, TERMFONT_UNDER);
 	return(1);
 }
Index: projects/arm_intrng/contrib/mdocml/mdoc_validate.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/mdoc_validate.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/mdoc_validate.c	(revision 276248)
@@ -1,2491 +1,2491 @@
-/*	$Id: mdoc_validate.c,v 1.262 2014/11/28 18:36:35 schwarze Exp $ */
+/*	$Id: mdoc_validate.c,v 1.263 2014/11/30 05:29:00 schwarze Exp $ */
 /*
  * Copyright (c) 2008-2012 Kristaps Dzonsons 
  * Copyright (c) 2010-2014 Ingo Schwarze 
  * Copyright (c) 2010 Joerg Sonnenberger 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 #ifndef OSNAME
 #include 
 #endif
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "mdoc.h"
 #include "mandoc.h"
 #include "mandoc_aux.h"
 #include "libmdoc.h"
 #include "libmandoc.h"
 
 /* FIXME: .Bl -diag can't have non-text children in HEAD. */
 
 #define	PRE_ARGS  struct mdoc *mdoc, struct mdoc_node *n
 #define	POST_ARGS struct mdoc *mdoc
 
 enum	check_ineq {
 	CHECK_LT,
 	CHECK_GT,
 	CHECK_EQ
 };
 
 enum	check_lvl {
 	CHECK_WARN,
 	CHECK_ERROR,
 };
 
 typedef	void	(*v_pre)(PRE_ARGS);
 typedef	void	(*v_post)(POST_ARGS);
 
 struct	valids {
 	v_pre	 pre;
 	v_post	 post;
 };
 
 static	void	 check_count(struct mdoc *, enum mdoc_type,
 			enum check_lvl, enum check_ineq, int);
 static	void	 check_text(struct mdoc *, int, int, char *);
 static	void	 check_argv(struct mdoc *,
 			struct mdoc_node *, struct mdoc_argv *);
 static	void	 check_args(struct mdoc *, struct mdoc_node *);
 static	int	 child_an(const struct mdoc_node *);
 static	enum mdoc_sec	a2sec(const char *);
 static	size_t		macro2len(enum mdoct);
 static	void	 rewrite_macro2len(char **);
 
 static	void	 bwarn_ge1(POST_ARGS);
 static	void	 ewarn_eq1(POST_ARGS);
 static	void	 ewarn_ge1(POST_ARGS);
 static	void	 hwarn_eq0(POST_ARGS);
 
 static	void	 post_an(POST_ARGS);
 static	void	 post_at(POST_ARGS);
 static	void	 post_bf(POST_ARGS);
 static	void	 post_bk(POST_ARGS);
 static	void	 post_bl(POST_ARGS);
 static	void	 post_bl_block(POST_ARGS);
 static	void	 post_bl_block_tag(POST_ARGS);
 static	void	 post_bl_head(POST_ARGS);
 static	void	 post_bx(POST_ARGS);
 static	void	 post_d1(POST_ARGS);
 static	void	 post_defaults(POST_ARGS);
 static	void	 post_dd(POST_ARGS);
 static	void	 post_dt(POST_ARGS);
 static	void	 post_en(POST_ARGS);
 static	void	 post_es(POST_ARGS);
 static	void	 post_eoln(POST_ARGS);
 static	void	 post_ex(POST_ARGS);
 static	void	 post_fa(POST_ARGS);
 static	void	 post_fn(POST_ARGS);
 static	void	 post_fname(POST_ARGS);
 static	void	 post_fo(POST_ARGS);
 static	void	 post_hyph(POST_ARGS);
 static	void	 post_hyphtext(POST_ARGS);
 static	void	 post_ignpar(POST_ARGS);
 static	void	 post_it(POST_ARGS);
 static	void	 post_lb(POST_ARGS);
 static	void	 post_literal(POST_ARGS);
 static	void	 post_nd(POST_ARGS);
 static	void	 post_nm(POST_ARGS);
 static	void	 post_ns(POST_ARGS);
 static	void	 post_os(POST_ARGS);
 static	void	 post_par(POST_ARGS);
 static	void	 post_root(POST_ARGS);
 static	void	 post_rs(POST_ARGS);
 static	void	 post_sh(POST_ARGS);
 static	void	 post_sh_head(POST_ARGS);
 static	void	 post_sh_name(POST_ARGS);
 static	void	 post_sh_see_also(POST_ARGS);
 static	void	 post_sh_authors(POST_ARGS);
 static	void	 post_sm(POST_ARGS);
 static	void	 post_st(POST_ARGS);
 static	void	 post_vt(POST_ARGS);
 
 static	void	 pre_an(PRE_ARGS);
 static	void	 pre_bd(PRE_ARGS);
 static	void	 pre_bl(PRE_ARGS);
 static	void	 pre_dd(PRE_ARGS);
 static	void	 pre_display(PRE_ARGS);
 static	void	 pre_dt(PRE_ARGS);
 static	void	 pre_literal(PRE_ARGS);
 static	void	 pre_obsolete(PRE_ARGS);
 static	void	 pre_os(PRE_ARGS);
 static	void	 pre_par(PRE_ARGS);
 static	void	 pre_std(PRE_ARGS);
 
 static	const struct valids mdoc_valids[MDOC_MAX] = {
 	{ NULL, NULL },				/* Ap */
 	{ pre_dd, post_dd },			/* Dd */
 	{ pre_dt, post_dt },			/* Dt */
 	{ pre_os, post_os },			/* Os */
 	{ NULL, post_sh },			/* Sh */
 	{ NULL, post_ignpar },			/* Ss */
 	{ pre_par, post_par },			/* Pp */
 	{ pre_display, post_d1 },		/* D1 */
 	{ pre_literal, post_literal },		/* Dl */
 	{ pre_bd, post_literal },		/* Bd */
 	{ NULL, NULL },				/* Ed */
 	{ pre_bl, post_bl },			/* Bl */
 	{ NULL, NULL },				/* El */
 	{ pre_par, post_it },			/* It */
 	{ NULL, NULL },				/* Ad */
 	{ pre_an, post_an },			/* An */
 	{ NULL, post_defaults },		/* Ar */
 	{ NULL, NULL },				/* Cd */
 	{ NULL, NULL },				/* Cm */
 	{ NULL, NULL },				/* Dv */
 	{ NULL, NULL },				/* Er */
 	{ NULL, NULL },				/* Ev */
 	{ pre_std, post_ex },			/* Ex */
 	{ NULL, post_fa },			/* Fa */
 	{ NULL, ewarn_ge1 },			/* Fd */
 	{ NULL, NULL },				/* Fl */
 	{ NULL, post_fn },			/* Fn */
 	{ NULL, NULL },				/* Ft */
 	{ NULL, NULL },				/* Ic */
 	{ NULL, ewarn_eq1 },			/* In */
 	{ NULL, post_defaults },		/* Li */
 	{ NULL, post_nd },			/* Nd */
 	{ NULL, post_nm },			/* Nm */
 	{ NULL, NULL },				/* Op */
 	{ pre_obsolete, NULL },			/* Ot */
 	{ NULL, post_defaults },		/* Pa */
 	{ pre_std, NULL },			/* Rv */
 	{ NULL, post_st },			/* St */
 	{ NULL, NULL },				/* Va */
 	{ NULL, post_vt },			/* Vt */
 	{ NULL, ewarn_ge1 },			/* Xr */
 	{ NULL, ewarn_ge1 },			/* %A */
 	{ NULL, post_hyphtext },		/* %B */ /* FIXME: can be used outside Rs/Re. */
 	{ NULL, ewarn_ge1 },			/* %D */
 	{ NULL, ewarn_ge1 },			/* %I */
 	{ NULL, ewarn_ge1 },			/* %J */
 	{ NULL, post_hyphtext },		/* %N */
 	{ NULL, post_hyphtext },		/* %O */
 	{ NULL, ewarn_ge1 },			/* %P */
 	{ NULL, post_hyphtext },		/* %R */
 	{ NULL, post_hyphtext },		/* %T */ /* FIXME: can be used outside Rs/Re. */
 	{ NULL, ewarn_ge1 },			/* %V */
 	{ NULL, NULL },				/* Ac */
 	{ NULL, NULL },				/* Ao */
 	{ NULL, NULL },				/* Aq */
 	{ NULL, post_at },			/* At */
 	{ NULL, NULL },				/* Bc */
 	{ NULL, post_bf },			/* Bf */
 	{ NULL, NULL },				/* Bo */
 	{ NULL, NULL },				/* Bq */
 	{ NULL, NULL },				/* Bsx */
 	{ NULL, post_bx },			/* Bx */
 	{ pre_obsolete, NULL },			/* Db */
 	{ NULL, NULL },				/* Dc */
 	{ NULL, NULL },				/* Do */
 	{ NULL, NULL },				/* Dq */
 	{ NULL, NULL },				/* Ec */
 	{ NULL, NULL },				/* Ef */
 	{ NULL, NULL },				/* Em */
 	{ NULL, NULL },				/* Eo */
 	{ NULL, NULL },				/* Fx */
 	{ NULL, NULL },				/* Ms */
 	{ NULL, NULL },				/* No */
 	{ NULL, post_ns },			/* Ns */
 	{ NULL, NULL },				/* Nx */
 	{ NULL, NULL },				/* Ox */
 	{ NULL, NULL },				/* Pc */
-	{ NULL, ewarn_eq1 },			/* Pf */
+	{ NULL, NULL },				/* Pf */
 	{ NULL, NULL },				/* Po */
 	{ NULL, NULL },				/* Pq */
 	{ NULL, NULL },				/* Qc */
 	{ NULL, NULL },				/* Ql */
 	{ NULL, NULL },				/* Qo */
 	{ NULL, NULL },				/* Qq */
 	{ NULL, NULL },				/* Re */
 	{ NULL, post_rs },			/* Rs */
 	{ NULL, NULL },				/* Sc */
 	{ NULL, NULL },				/* So */
 	{ NULL, NULL },				/* Sq */
 	{ NULL, post_sm },			/* Sm */
 	{ NULL, post_hyph },			/* Sx */
 	{ NULL, NULL },				/* Sy */
 	{ NULL, NULL },				/* Tn */
 	{ NULL, NULL },				/* Ux */
 	{ NULL, NULL },				/* Xc */
 	{ NULL, NULL },				/* Xo */
 	{ NULL, post_fo },			/* Fo */
 	{ NULL, NULL },				/* Fc */
 	{ NULL, NULL },				/* Oo */
 	{ NULL, NULL },				/* Oc */
 	{ NULL, post_bk },			/* Bk */
 	{ NULL, NULL },				/* Ek */
 	{ NULL, post_eoln },			/* Bt */
 	{ NULL, NULL },				/* Hf */
 	{ pre_obsolete, NULL },			/* Fr */
 	{ NULL, post_eoln },			/* Ud */
 	{ NULL, post_lb },			/* Lb */
 	{ pre_par, post_par },			/* Lp */
 	{ NULL, NULL },				/* Lk */
 	{ NULL, post_defaults },		/* Mt */
 	{ NULL, NULL },				/* Brq */
 	{ NULL, NULL },				/* Bro */
 	{ NULL, NULL },				/* Brc */
 	{ NULL, ewarn_ge1 },			/* %C */
 	{ pre_obsolete, post_es },		/* Es */
 	{ pre_obsolete, post_en },		/* En */
 	{ NULL, NULL },				/* Dx */
 	{ NULL, ewarn_ge1 },			/* %Q */
 	{ NULL, post_par },			/* br */
 	{ NULL, post_par },			/* sp */
 	{ NULL, ewarn_eq1 },			/* %U */
 	{ NULL, NULL },				/* Ta */
 	{ NULL, NULL },				/* ll */
 };
 
 #define	RSORD_MAX 14 /* Number of `Rs' blocks. */
 
 static	const enum mdoct rsord[RSORD_MAX] = {
 	MDOC__A,
 	MDOC__T,
 	MDOC__B,
 	MDOC__I,
 	MDOC__J,
 	MDOC__R,
 	MDOC__N,
 	MDOC__V,
 	MDOC__U,
 	MDOC__P,
 	MDOC__Q,
 	MDOC__C,
 	MDOC__D,
 	MDOC__O
 };
 
 static	const char * const secnames[SEC__MAX] = {
 	NULL,
 	"NAME",
 	"LIBRARY",
 	"SYNOPSIS",
 	"DESCRIPTION",
 	"CONTEXT",
 	"IMPLEMENTATION NOTES",
 	"RETURN VALUES",
 	"ENVIRONMENT",
 	"FILES",
 	"EXIT STATUS",
 	"EXAMPLES",
 	"DIAGNOSTICS",
 	"COMPATIBILITY",
 	"ERRORS",
 	"SEE ALSO",
 	"STANDARDS",
 	"HISTORY",
 	"AUTHORS",
 	"CAVEATS",
 	"BUGS",
 	"SECURITY CONSIDERATIONS",
 	NULL
 };
 
 
 void
 mdoc_valid_pre(struct mdoc *mdoc, struct mdoc_node *n)
 {
 	v_pre	 p;
 
 	switch (n->type) {
 	case MDOC_TEXT:
 		check_text(mdoc, n->line, n->pos, n->string);
 		/* FALLTHROUGH */
 	case MDOC_TBL:
 		/* FALLTHROUGH */
 	case MDOC_EQN:
 		/* FALLTHROUGH */
 	case MDOC_ROOT:
 		return;
 	default:
 		break;
 	}
 
 	check_args(mdoc, n);
 	p = mdoc_valids[n->tok].pre;
 	if (*p)
 		(*p)(mdoc, n);
 }
 
 void
 mdoc_valid_post(struct mdoc *mdoc)
 {
 	struct mdoc_node *n;
 	v_post p;
 
 	n = mdoc->last;
 	if (n->flags & MDOC_VALID)
 		return;
 	n->flags |= MDOC_VALID;
 
 	switch (n->type) {
 	case MDOC_TEXT:
 		/* FALLTHROUGH */
 	case MDOC_EQN:
 		/* FALLTHROUGH */
 	case MDOC_TBL:
 		break;
 	case MDOC_ROOT:
 		post_root(mdoc);
 		break;
 	default:
 
 		/*
 		 * Closing delimiters are not special at the
 		 * beginning of a block, opening delimiters
 		 * are not special at the end.
 		 */
 
 		if (n->child != NULL)
 			n->child->flags &= ~MDOC_DELIMC;
 		if (n->last != NULL)
 			n->last->flags &= ~MDOC_DELIMO;
 
 		/* Call the macro's postprocessor. */
 
 		p = mdoc_valids[n->tok].post;
 		if (*p)
 			(*p)(mdoc);
 		break;
 	}
 }
 
 static void
 check_count(struct mdoc *mdoc, enum mdoc_type type,
 		enum check_lvl lvl, enum check_ineq ineq, int val)
 {
 	const char	*p;
 	enum mandocerr	 t;
 
 	if (mdoc->last->type != type)
 		return;
 
 	switch (ineq) {
 	case CHECK_LT:
 		p = "less than ";
 		if (mdoc->last->nchild < val)
 			return;
 		break;
 	case CHECK_GT:
 		p = "more than ";
 		if (mdoc->last->nchild > val)
 			return;
 		break;
 	case CHECK_EQ:
 		p = "";
 		if (val == mdoc->last->nchild)
 			return;
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 
 	t = lvl == CHECK_WARN ? MANDOCERR_ARGCWARN : MANDOCERR_ARGCOUNT;
 	mandoc_vmsg(t, mdoc->parse, mdoc->last->line,
 	    mdoc->last->pos, "want %s%d children (have %d)",
 	    p, val, mdoc->last->nchild);
 }
 
 static void
 bwarn_ge1(POST_ARGS)
 {
 	check_count(mdoc, MDOC_BODY, CHECK_WARN, CHECK_GT, 0);
 }
 
 static void
 ewarn_eq1(POST_ARGS)
 {
 	check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1);
 }
 
 static void
 ewarn_ge1(POST_ARGS)
 {
 	check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_GT, 0);
 }
 
 static void
 hwarn_eq0(POST_ARGS)
 {
 	check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_EQ, 0);
 }
 
 static void
 check_args(struct mdoc *mdoc, struct mdoc_node *n)
 {
 	int		 i;
 
 	if (NULL == n->args)
 		return;
 
 	assert(n->args->argc);
 	for (i = 0; i < (int)n->args->argc; i++)
 		check_argv(mdoc, n, &n->args->argv[i]);
 }
 
 static void
 check_argv(struct mdoc *mdoc, struct mdoc_node *n, struct mdoc_argv *v)
 {
 	int		 i;
 
 	for (i = 0; i < (int)v->sz; i++)
 		check_text(mdoc, v->line, v->pos, v->value[i]);
 }
 
 static void
 check_text(struct mdoc *mdoc, int ln, int pos, char *p)
 {
 	char		*cp;
 
 	if (MDOC_LITERAL & mdoc->flags)
 		return;
 
 	for (cp = p; NULL != (p = strchr(p, '\t')); p++)
 		mandoc_msg(MANDOCERR_FI_TAB, mdoc->parse,
 		    ln, pos + (int)(p - cp), NULL);
 }
 
 static void
 pre_display(PRE_ARGS)
 {
 	struct mdoc_node *node;
 
 	if (MDOC_BLOCK != n->type)
 		return;
 
 	for (node = mdoc->last->parent; node; node = node->parent)
 		if (MDOC_BLOCK == node->type)
 			if (MDOC_Bd == node->tok)
 				break;
 
 	if (node)
 		mandoc_vmsg(MANDOCERR_BD_NEST,
 		    mdoc->parse, n->line, n->pos,
 		    "%s in Bd", mdoc_macronames[n->tok]);
 }
 
 static void
 pre_bl(PRE_ARGS)
 {
 	struct mdoc_node *np;
 	struct mdoc_argv *argv, *wa;
 	int		  i;
 	enum mdocargt	  mdoclt;
 	enum mdoc_list	  lt;
 
 	if (MDOC_BLOCK != n->type) {
 		if (ENDBODY_NOT != n->end) {
 			assert(n->pending);
 			np = n->pending->parent;
 		} else
 			np = n->parent;
 
 		assert(np);
 		assert(MDOC_BLOCK == np->type);
 		assert(MDOC_Bl == np->tok);
 		return;
 	}
 
 	/*
 	 * First figure out which kind of list to use: bind ourselves to
 	 * the first mentioned list type and warn about any remaining
 	 * ones.  If we find no list type, we default to LIST_item.
 	 */
 
 	wa = (n->args == NULL) ? NULL : n->args->argv;
 	mdoclt = MDOC_ARG_MAX;
 	for (i = 0; n->args && i < (int)n->args->argc; i++) {
 		argv = n->args->argv + i;
 		lt = LIST__NONE;
 		switch (argv->arg) {
 		/* Set list types. */
 		case MDOC_Bullet:
 			lt = LIST_bullet;
 			break;
 		case MDOC_Dash:
 			lt = LIST_dash;
 			break;
 		case MDOC_Enum:
 			lt = LIST_enum;
 			break;
 		case MDOC_Hyphen:
 			lt = LIST_hyphen;
 			break;
 		case MDOC_Item:
 			lt = LIST_item;
 			break;
 		case MDOC_Tag:
 			lt = LIST_tag;
 			break;
 		case MDOC_Diag:
 			lt = LIST_diag;
 			break;
 		case MDOC_Hang:
 			lt = LIST_hang;
 			break;
 		case MDOC_Ohang:
 			lt = LIST_ohang;
 			break;
 		case MDOC_Inset:
 			lt = LIST_inset;
 			break;
 		case MDOC_Column:
 			lt = LIST_column;
 			break;
 		/* Set list arguments. */
 		case MDOC_Compact:
 			if (n->norm->Bl.comp)
 				mandoc_msg(MANDOCERR_ARG_REP,
 				    mdoc->parse, argv->line,
 				    argv->pos, "Bl -compact");
 			n->norm->Bl.comp = 1;
 			break;
 		case MDOC_Width:
 			wa = argv;
 			if (0 == argv->sz) {
 				mandoc_msg(MANDOCERR_ARG_EMPTY,
 				    mdoc->parse, argv->line,
 				    argv->pos, "Bl -width");
 				n->norm->Bl.width = "0n";
 				break;
 			}
 			if (NULL != n->norm->Bl.width)
 				mandoc_vmsg(MANDOCERR_ARG_REP,
 				    mdoc->parse, argv->line,
 				    argv->pos, "Bl -width %s",
 				    argv->value[0]);
 			rewrite_macro2len(argv->value);
 			n->norm->Bl.width = argv->value[0];
 			break;
 		case MDOC_Offset:
 			if (0 == argv->sz) {
 				mandoc_msg(MANDOCERR_ARG_EMPTY,
 				    mdoc->parse, argv->line,
 				    argv->pos, "Bl -offset");
 				break;
 			}
 			if (NULL != n->norm->Bl.offs)
 				mandoc_vmsg(MANDOCERR_ARG_REP,
 				    mdoc->parse, argv->line,
 				    argv->pos, "Bl -offset %s",
 				    argv->value[0]);
 			rewrite_macro2len(argv->value);
 			n->norm->Bl.offs = argv->value[0];
 			break;
 		default:
 			continue;
 		}
 		if (LIST__NONE == lt)
 			continue;
 		mdoclt = argv->arg;
 
 		/* Check: multiple list types. */
 
 		if (LIST__NONE != n->norm->Bl.type) {
 			mandoc_vmsg(MANDOCERR_BL_REP,
 			    mdoc->parse, n->line, n->pos,
 			    "Bl -%s", mdoc_argnames[argv->arg]);
 			continue;
 		}
 
 		/* The list type should come first. */
 
 		if (n->norm->Bl.width ||
 		    n->norm->Bl.offs ||
 		    n->norm->Bl.comp)
 			mandoc_vmsg(MANDOCERR_BL_LATETYPE,
 			    mdoc->parse, n->line, n->pos, "Bl -%s",
 			    mdoc_argnames[n->args->argv[0].arg]);
 
 		n->norm->Bl.type = lt;
 		if (LIST_column == lt) {
 			n->norm->Bl.ncols = argv->sz;
 			n->norm->Bl.cols = (void *)argv->value;
 		}
 	}
 
 	/* Allow lists to default to LIST_item. */
 
 	if (LIST__NONE == n->norm->Bl.type) {
 		mandoc_msg(MANDOCERR_BL_NOTYPE, mdoc->parse,
 		    n->line, n->pos, "Bl");
 		n->norm->Bl.type = LIST_item;
 	}
 
 	/*
 	 * Validate the width field.  Some list types don't need width
 	 * types and should be warned about them.  Others should have it
 	 * and must also be warned.  Yet others have a default and need
 	 * no warning.
 	 */
 
 	switch (n->norm->Bl.type) {
 	case LIST_tag:
 		if (NULL == n->norm->Bl.width)
 			mandoc_msg(MANDOCERR_BL_NOWIDTH, mdoc->parse,
 			    n->line, n->pos, "Bl -tag");
 		break;
 	case LIST_column:
 		/* FALLTHROUGH */
 	case LIST_diag:
 		/* FALLTHROUGH */
 	case LIST_ohang:
 		/* FALLTHROUGH */
 	case LIST_inset:
 		/* FALLTHROUGH */
 	case LIST_item:
 		if (n->norm->Bl.width)
 			mandoc_vmsg(MANDOCERR_BL_SKIPW, mdoc->parse,
 			    wa->line, wa->pos, "Bl -%s",
 			    mdoc_argnames[mdoclt]);
 		break;
 	case LIST_bullet:
 		/* FALLTHROUGH */
 	case LIST_dash:
 		/* FALLTHROUGH */
 	case LIST_hyphen:
 		if (NULL == n->norm->Bl.width)
 			n->norm->Bl.width = "2n";
 		break;
 	case LIST_enum:
 		if (NULL == n->norm->Bl.width)
 			n->norm->Bl.width = "3n";
 		break;
 	default:
 		break;
 	}
 	pre_par(mdoc, n);
 }
 
 static void
 pre_bd(PRE_ARGS)
 {
 	struct mdoc_node *np;
 	struct mdoc_argv *argv;
 	int		  i;
 	enum mdoc_disp	  dt;
 
 	pre_literal(mdoc, n);
 
 	if (MDOC_BLOCK != n->type) {
 		if (ENDBODY_NOT != n->end) {
 			assert(n->pending);
 			np = n->pending->parent;
 		} else
 			np = n->parent;
 
 		assert(np);
 		assert(MDOC_BLOCK == np->type);
 		assert(MDOC_Bd == np->tok);
 		return;
 	}
 
 	for (i = 0; n->args && i < (int)n->args->argc; i++) {
 		argv = n->args->argv + i;
 		dt = DISP__NONE;
 
 		switch (argv->arg) {
 		case MDOC_Centred:
 			dt = DISP_centered;
 			break;
 		case MDOC_Ragged:
 			dt = DISP_ragged;
 			break;
 		case MDOC_Unfilled:
 			dt = DISP_unfilled;
 			break;
 		case MDOC_Filled:
 			dt = DISP_filled;
 			break;
 		case MDOC_Literal:
 			dt = DISP_literal;
 			break;
 		case MDOC_File:
 			mandoc_msg(MANDOCERR_BD_FILE, mdoc->parse,
 			    n->line, n->pos, NULL);
 			break;
 		case MDOC_Offset:
 			if (0 == argv->sz) {
 				mandoc_msg(MANDOCERR_ARG_EMPTY,
 				    mdoc->parse, argv->line,
 				    argv->pos, "Bd -offset");
 				break;
 			}
 			if (NULL != n->norm->Bd.offs)
 				mandoc_vmsg(MANDOCERR_ARG_REP,
 				    mdoc->parse, argv->line,
 				    argv->pos, "Bd -offset %s",
 				    argv->value[0]);
 			rewrite_macro2len(argv->value);
 			n->norm->Bd.offs = argv->value[0];
 			break;
 		case MDOC_Compact:
 			if (n->norm->Bd.comp)
 				mandoc_msg(MANDOCERR_ARG_REP,
 				    mdoc->parse, argv->line,
 				    argv->pos, "Bd -compact");
 			n->norm->Bd.comp = 1;
 			break;
 		default:
 			abort();
 			/* NOTREACHED */
 		}
 		if (DISP__NONE == dt)
 			continue;
 
 		if (DISP__NONE == n->norm->Bd.type)
 			n->norm->Bd.type = dt;
 		else
 			mandoc_vmsg(MANDOCERR_BD_REP,
 			    mdoc->parse, n->line, n->pos,
 			    "Bd -%s", mdoc_argnames[argv->arg]);
 	}
 
 	if (DISP__NONE == n->norm->Bd.type) {
 		mandoc_msg(MANDOCERR_BD_NOTYPE, mdoc->parse,
 		    n->line, n->pos, "Bd");
 		n->norm->Bd.type = DISP_ragged;
 	}
 	pre_par(mdoc, n);
 }
 
 static void
 pre_an(PRE_ARGS)
 {
 	struct mdoc_argv *argv;
 	size_t	 i;
 
 	if (n->args == NULL)
 		return;
 
 	for (i = 1; i < n->args->argc; i++) {
 		argv = n->args->argv + i;
 		mandoc_vmsg(MANDOCERR_AN_REP,
 		    mdoc->parse, argv->line, argv->pos,
 		    "An -%s", mdoc_argnames[argv->arg]);
 	}
 
 	argv = n->args->argv;
 	if (argv->arg == MDOC_Split)
 		n->norm->An.auth = AUTH_split;
 	else if (argv->arg == MDOC_Nosplit)
 		n->norm->An.auth = AUTH_nosplit;
 	else
 		abort();
 }
 
 static void
 pre_std(PRE_ARGS)
 {
 
 	if (n->args && 1 == n->args->argc)
 		if (MDOC_Std == n->args->argv[0].arg)
 			return;
 
 	mandoc_msg(MANDOCERR_ARG_STD, mdoc->parse,
 	    n->line, n->pos, mdoc_macronames[n->tok]);
 }
 
 static void
 pre_obsolete(PRE_ARGS)
 {
 
 	if (MDOC_ELEM == n->type || MDOC_BLOCK == n->type)
 		mandoc_msg(MANDOCERR_MACRO_OBS, mdoc->parse,
 		    n->line, n->pos, mdoc_macronames[n->tok]);
 }
 
 static void
 pre_dt(PRE_ARGS)
 {
 
 	if (mdoc->meta.title != NULL)
 		mandoc_msg(MANDOCERR_PROLOG_REP, mdoc->parse,
 		    n->line, n->pos, "Dt");
 	else if (mdoc->meta.os != NULL)
 		mandoc_msg(MANDOCERR_PROLOG_ORDER, mdoc->parse,
 		    n->line, n->pos, "Dt after Os");
 }
 
 static void
 pre_os(PRE_ARGS)
 {
 
 	if (mdoc->meta.os != NULL)
 		mandoc_msg(MANDOCERR_PROLOG_REP, mdoc->parse,
 		    n->line, n->pos, "Os");
 	else if (mdoc->flags & MDOC_PBODY)
 		mandoc_msg(MANDOCERR_PROLOG_LATE, mdoc->parse,
 		    n->line, n->pos, "Os");
 }
 
 static void
 pre_dd(PRE_ARGS)
 {
 
 	if (mdoc->meta.date != NULL)
 		mandoc_msg(MANDOCERR_PROLOG_REP, mdoc->parse,
 		    n->line, n->pos, "Dd");
 	else if (mdoc->flags & MDOC_PBODY)
 		mandoc_msg(MANDOCERR_PROLOG_LATE, mdoc->parse,
 		    n->line, n->pos, "Dd");
 	else if (mdoc->meta.title != NULL)
 		mandoc_msg(MANDOCERR_PROLOG_ORDER, mdoc->parse,
 		    n->line, n->pos, "Dd after Dt");
 	else if (mdoc->meta.os != NULL)
 		mandoc_msg(MANDOCERR_PROLOG_ORDER, mdoc->parse,
 		    n->line, n->pos, "Dd after Os");
 }
 
 static void
 post_bf(POST_ARGS)
 {
 	struct mdoc_node *np, *nch;
 	enum mdocargt	  arg;
 
 	/*
 	 * Unlike other data pointers, these are "housed" by the HEAD
 	 * element, which contains the goods.
 	 */
 
 	if (MDOC_HEAD != mdoc->last->type) {
 		if (ENDBODY_NOT != mdoc->last->end) {
 			assert(mdoc->last->pending);
 			np = mdoc->last->pending->parent->head;
 		} else if (MDOC_BLOCK != mdoc->last->type) {
 			np = mdoc->last->parent->head;
 		} else
 			np = mdoc->last->head;
 
 		assert(np);
 		assert(MDOC_HEAD == np->type);
 		assert(MDOC_Bf == np->tok);
 		return;
 	}
 
 	np = mdoc->last;
 	assert(MDOC_BLOCK == np->parent->type);
 	assert(MDOC_Bf == np->parent->tok);
 
 	/* Check the number of arguments. */
 
 	nch = np->child;
 	if (NULL == np->parent->args) {
 		if (NULL == nch) {
 			mandoc_msg(MANDOCERR_BF_NOFONT, mdoc->parse,
 			    np->line, np->pos, "Bf");
 			return;
 		}
 		nch = nch->next;
 	}
 	if (NULL != nch)
 		mandoc_vmsg(MANDOCERR_ARG_EXCESS, mdoc->parse,
 		    nch->line, nch->pos, "Bf ... %s", nch->string);
 
 	/* Extract argument into data. */
 
 	if (np->parent->args) {
 		arg = np->parent->args->argv[0].arg;
 		if (MDOC_Emphasis == arg)
 			np->norm->Bf.font = FONT_Em;
 		else if (MDOC_Literal == arg)
 			np->norm->Bf.font = FONT_Li;
 		else if (MDOC_Symbolic == arg)
 			np->norm->Bf.font = FONT_Sy;
 		else
 			abort();
 		return;
 	}
 
 	/* Extract parameter into data. */
 
 	if (0 == strcmp(np->child->string, "Em"))
 		np->norm->Bf.font = FONT_Em;
 	else if (0 == strcmp(np->child->string, "Li"))
 		np->norm->Bf.font = FONT_Li;
 	else if (0 == strcmp(np->child->string, "Sy"))
 		np->norm->Bf.font = FONT_Sy;
 	else
 		mandoc_vmsg(MANDOCERR_BF_BADFONT, mdoc->parse,
 		    np->child->line, np->child->pos,
 		    "Bf %s", np->child->string);
 }
 
 static void
 post_lb(POST_ARGS)
 {
 	struct mdoc_node	*n;
 	const char		*stdlibname;
 	char			*libname;
 
 	check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 1);
 	n = mdoc->last->child;
 	assert(MDOC_TEXT == n->type);
 
 	if (NULL == (stdlibname = mdoc_a2lib(n->string)))
 		mandoc_asprintf(&libname,
 		    "library \\(lq%s\\(rq", n->string);
 	else
 		libname = mandoc_strdup(stdlibname);
 
 	free(n->string);
 	n->string = libname;
 }
 
 static void
 post_eoln(POST_ARGS)
 {
 	const struct mdoc_node *n;
 
 	n = mdoc->last;
 	if (n->child)
 		mandoc_vmsg(MANDOCERR_ARG_SKIP,
 		    mdoc->parse, n->line, n->pos,
 		    "%s %s", mdoc_macronames[n->tok],
 		    n->child->string);
 }
 
 static void
 post_fname(POST_ARGS)
 {
 	const struct mdoc_node	*n;
 	const char		*cp;
 	size_t			 pos;
 
 	n = mdoc->last->child;
 	pos = strcspn(n->string, "()");
 	cp = n->string + pos;
 	if ( ! (cp[0] == '\0' || (cp[0] == '(' && cp[1] == '*')))
 		mandoc_msg(MANDOCERR_FN_PAREN, mdoc->parse,
 		    n->line, n->pos + pos, n->string);
 }
 
 static void
 post_fn(POST_ARGS)
 {
 
 	post_fname(mdoc);
 	post_fa(mdoc);
 }
 
 static void
 post_fo(POST_ARGS)
 {
 
 	check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_EQ, 1);
 	bwarn_ge1(mdoc);
 	if (mdoc->last->type == MDOC_HEAD && mdoc->last->nchild)
 		post_fname(mdoc);
 }
 
 static void
 post_fa(POST_ARGS)
 {
 	const struct mdoc_node *n;
 	const char *cp;
 
 	for (n = mdoc->last->child; n != NULL; n = n->next) {
 		for (cp = n->string; *cp != '\0'; cp++) {
 			/* Ignore callbacks and alterations. */
 			if (*cp == '(' || *cp == '{')
 				break;
 			if (*cp != ',')
 				continue;
 			mandoc_msg(MANDOCERR_FA_COMMA, mdoc->parse,
 			    n->line, n->pos + (cp - n->string),
 			    n->string);
 			break;
 		}
 	}
 }
 
 static void
 post_vt(POST_ARGS)
 {
 	const struct mdoc_node *n;
 
 	/*
 	 * The Vt macro comes in both ELEM and BLOCK form, both of which
 	 * have different syntaxes (yet more context-sensitive
 	 * behaviour).  ELEM types must have a child, which is already
 	 * guaranteed by the in_line parsing routine; BLOCK types,
 	 * specifically the BODY, should only have TEXT children.
 	 */
 
 	if (MDOC_BODY != mdoc->last->type)
 		return;
 
 	for (n = mdoc->last->child; n; n = n->next)
 		if (MDOC_TEXT != n->type)
 			mandoc_msg(MANDOCERR_VT_CHILD, mdoc->parse,
 			    n->line, n->pos, mdoc_macronames[n->tok]);
 }
 
 static void
 post_nm(POST_ARGS)
 {
 
 	if (NULL != mdoc->meta.name)
 		return;
 
 	mdoc_deroff(&mdoc->meta.name, mdoc->last);
 
 	if (NULL == mdoc->meta.name)
 		mandoc_msg(MANDOCERR_NM_NONAME, mdoc->parse,
 		    mdoc->last->line, mdoc->last->pos, "Nm");
 }
 
 static void
 post_nd(POST_ARGS)
 {
 
 	check_count(mdoc, MDOC_BODY, CHECK_ERROR, CHECK_GT, 0);
 	post_hyph(mdoc);
 }
 
 static void
 post_d1(POST_ARGS)
 {
 
 	bwarn_ge1(mdoc);
 	post_hyph(mdoc);
 }
 
 static void
 post_literal(POST_ARGS)
 {
 
 	if (mdoc->last->tok == MDOC_Bd)
 		hwarn_eq0(mdoc);
 	bwarn_ge1(mdoc);
 
 	/*
 	 * The `Dl' (note "el" not "one") and `Bd' macros unset the
 	 * MDOC_LITERAL flag as they leave.  Note that `Bd' only sets
 	 * this in literal mode, but it doesn't hurt to just switch it
 	 * off in general since displays can't be nested.
 	 */
 
 	if (MDOC_BODY == mdoc->last->type)
 		mdoc->flags &= ~MDOC_LITERAL;
 }
 
 static void
 post_defaults(POST_ARGS)
 {
 	struct mdoc_node *nn;
 
 	/*
 	 * The `Ar' defaults to "file ..." if no value is provided as an
 	 * argument; the `Mt' and `Pa' macros use "~"; the `Li' just
 	 * gets an empty string.
 	 */
 
 	if (mdoc->last->child)
 		return;
 
 	nn = mdoc->last;
 	mdoc->next = MDOC_NEXT_CHILD;
 
 	switch (nn->tok) {
 	case MDOC_Ar:
 		mdoc_word_alloc(mdoc, nn->line, nn->pos, "file");
 		mdoc_word_alloc(mdoc, nn->line, nn->pos, "...");
 		break;
 	case MDOC_Pa:
 		/* FALLTHROUGH */
 	case MDOC_Mt:
 		mdoc_word_alloc(mdoc, nn->line, nn->pos, "~");
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 	mdoc->last = nn;
 }
 
 static void
 post_at(POST_ARGS)
 {
 	struct mdoc_node	*n;
 	const char		*std_att;
 	char			*att;
 
 	n = mdoc->last;
 	if (n->child == NULL) {
 		mdoc->next = MDOC_NEXT_CHILD;
 		mdoc_word_alloc(mdoc, n->line, n->pos, "AT&T UNIX");
 		mdoc->last = n;
 		return;
 	}
 
 	/*
 	 * If we have a child, look it up in the standard keys.  If a
 	 * key exist, use that instead of the child; if it doesn't,
 	 * prefix "AT&T UNIX " to the existing data.
 	 */
 
 	n = n->child;
 	assert(MDOC_TEXT == n->type);
 	if (NULL == (std_att = mdoc_a2att(n->string))) {
 		mandoc_vmsg(MANDOCERR_AT_BAD, mdoc->parse,
 		    n->line, n->pos, "At %s", n->string);
 		mandoc_asprintf(&att, "AT&T UNIX %s", n->string);
 	} else
 		att = mandoc_strdup(std_att);
 
 	free(n->string);
 	n->string = att;
 }
 
 static void
 post_an(POST_ARGS)
 {
 	struct mdoc_node *np;
 
 	np = mdoc->last;
 	if (AUTH__NONE == np->norm->An.auth) {
 		if (0 == np->child)
 			check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_GT, 0);
 	} else if (np->child)
 		check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 0);
 }
 
 static void
 post_en(POST_ARGS)
 {
 
 	if (MDOC_BLOCK == mdoc->last->type)
 		mdoc->last->norm->Es = mdoc->last_es;
 }
 
 static void
 post_es(POST_ARGS)
 {
 
 	mdoc->last_es = mdoc->last;
 }
 
 static void
 post_it(POST_ARGS)
 {
 	int		  i, cols;
 	enum mdoc_list	  lt;
 	struct mdoc_node *nbl, *nit, *nch;
 
 	nit = mdoc->last;
 	if (MDOC_BLOCK != nit->type)
 		return;
 
 	nbl = nit->parent->parent;
 	lt = nbl->norm->Bl.type;
 
 	switch (lt) {
 	case LIST_tag:
 		/* FALLTHROUGH */
 	case LIST_hang:
 		/* FALLTHROUGH */
 	case LIST_ohang:
 		/* FALLTHROUGH */
 	case LIST_inset:
 		/* FALLTHROUGH */
 	case LIST_diag:
 		if (NULL == nit->head->child)
 			mandoc_vmsg(MANDOCERR_IT_NOHEAD,
 			    mdoc->parse, nit->line, nit->pos,
 			    "Bl -%s It",
 			    mdoc_argnames[nbl->args->argv[0].arg]);
 		break;
 	case LIST_bullet:
 		/* FALLTHROUGH */
 	case LIST_dash:
 		/* FALLTHROUGH */
 	case LIST_enum:
 		/* FALLTHROUGH */
 	case LIST_hyphen:
 		if (NULL == nit->body->child)
 			mandoc_vmsg(MANDOCERR_IT_NOBODY,
 			    mdoc->parse, nit->line, nit->pos,
 			    "Bl -%s It",
 			    mdoc_argnames[nbl->args->argv[0].arg]);
 		/* FALLTHROUGH */
 	case LIST_item:
 		if (NULL != nit->head->child)
 			mandoc_vmsg(MANDOCERR_ARG_SKIP,
 			    mdoc->parse, nit->line, nit->pos,
 			    "It %s", nit->head->child->string);
 		break;
 	case LIST_column:
 		cols = (int)nbl->norm->Bl.ncols;
 
 		assert(NULL == nit->head->child);
 
 		for (i = 0, nch = nit->child; nch; nch = nch->next)
 			if (MDOC_BODY == nch->type)
 				i++;
 
 		if (i < cols || i > cols + 1)
 			mandoc_vmsg(MANDOCERR_ARGCOUNT,
 			    mdoc->parse, nit->line, nit->pos,
 			    "columns == %d (have %d)", cols, i);
 		break;
 	default:
 		abort();
 	}
 }
 
 static void
 post_bl_block(POST_ARGS)
 {
 	struct mdoc_node *n, *ni, *nc;
 
 	/*
 	 * These are fairly complicated, so we've broken them into two
 	 * functions.  post_bl_block_tag() is called when a -tag is
 	 * specified, but no -width (it must be guessed).  The second
 	 * when a -width is specified (macro indicators must be
 	 * rewritten into real lengths).
 	 */
 
 	n = mdoc->last;
 
 	if (LIST_tag == n->norm->Bl.type &&
 	    NULL == n->norm->Bl.width) {
 		post_bl_block_tag(mdoc);
 		assert(n->norm->Bl.width);
 	}
 
 	for (ni = n->body->child; ni; ni = ni->next) {
 		if (NULL == ni->body)
 			continue;
 		nc = ni->body->last;
 		while (NULL != nc) {
 			switch (nc->tok) {
 			case MDOC_Pp:
 				/* FALLTHROUGH */
 			case MDOC_Lp:
 				/* FALLTHROUGH */
 			case MDOC_br:
 				break;
 			default:
 				nc = NULL;
 				continue;
 			}
 			if (NULL == ni->next) {
 				mandoc_msg(MANDOCERR_PAR_MOVE,
 				    mdoc->parse, nc->line, nc->pos,
 				    mdoc_macronames[nc->tok]);
 				mdoc_node_relink(mdoc, nc);
 			} else if (0 == n->norm->Bl.comp &&
 			    LIST_column != n->norm->Bl.type) {
 				mandoc_vmsg(MANDOCERR_PAR_SKIP,
 				    mdoc->parse, nc->line, nc->pos,
 				    "%s before It",
 				    mdoc_macronames[nc->tok]);
 				mdoc_node_delete(mdoc, nc);
 			} else
 				break;
 			nc = ni->body->last;
 		}
 	}
 }
 
 /*
  * If the argument of -offset or -width is a macro,
  * replace it with the associated default width.
  */
 void
 rewrite_macro2len(char **arg)
 {
 	size_t		  width;
 	enum mdoct	  tok;
 
 	if (*arg == NULL)
 		return;
 	else if ( ! strcmp(*arg, "Ds"))
 		width = 6;
 	else if ((tok = mdoc_hash_find(*arg)) == MDOC_MAX)
 		return;
 	else
 		width = macro2len(tok);
 
 	free(*arg);
 	mandoc_asprintf(arg, "%zun", width);
 }
 
 static void
 post_bl_block_tag(POST_ARGS)
 {
 	struct mdoc_node *n, *nn;
 	size_t		  sz, ssz;
 	int		  i;
 	char		  buf[24];
 
 	/*
 	 * Calculate the -width for a `Bl -tag' list if it hasn't been
 	 * provided.  Uses the first head macro.  NOTE AGAIN: this is
 	 * ONLY if the -width argument has NOT been provided.  See
 	 * rewrite_macro2len() for converting the -width string.
 	 */
 
 	sz = 10;
 	n = mdoc->last;
 
 	for (nn = n->body->child; nn; nn = nn->next) {
 		if (MDOC_It != nn->tok)
 			continue;
 
 		assert(MDOC_BLOCK == nn->type);
 		nn = nn->head->child;
 
 		if (nn == NULL)
 			break;
 
 		if (MDOC_TEXT == nn->type) {
 			sz = strlen(nn->string) + 1;
 			break;
 		}
 
 		if (0 != (ssz = macro2len(nn->tok)))
 			sz = ssz;
 
 		break;
 	}
 
 	/* Defaults to ten ens. */
 
 	(void)snprintf(buf, sizeof(buf), "%un", (unsigned int)sz);
 
 	/*
 	 * We have to dynamically add this to the macro's argument list.
 	 * We're guaranteed that a MDOC_Width doesn't already exist.
 	 */
 
 	assert(n->args);
 	i = (int)(n->args->argc)++;
 
 	n->args->argv = mandoc_reallocarray(n->args->argv,
 	    n->args->argc, sizeof(struct mdoc_argv));
 
 	n->args->argv[i].arg = MDOC_Width;
 	n->args->argv[i].line = n->line;
 	n->args->argv[i].pos = n->pos;
 	n->args->argv[i].sz = 1;
 	n->args->argv[i].value = mandoc_malloc(sizeof(char *));
 	n->args->argv[i].value[0] = mandoc_strdup(buf);
 
 	/* Set our width! */
 	n->norm->Bl.width = n->args->argv[i].value[0];
 }
 
 static void
 post_bl_head(POST_ARGS)
 {
 	struct mdoc_node *np, *nn, *nnp;
 	struct mdoc_argv *argv;
 	int		  i, j;
 
 	if (LIST_column != mdoc->last->norm->Bl.type) {
 		/* FIXME: this should be ERROR class... */
 		hwarn_eq0(mdoc);
 		return;
 	}
 
 	/*
 	 * Append old-style lists, where the column width specifiers
 	 * trail as macro parameters, to the new-style ("normal-form")
 	 * lists where they're argument values following -column.
 	 */
 
 	if (mdoc->last->child == NULL)
 		return;
 
 	np = mdoc->last->parent;
 	assert(np->args);
 
 	for (j = 0; j < (int)np->args->argc; j++)
 		if (MDOC_Column == np->args->argv[j].arg)
 			break;
 
 	assert(j < (int)np->args->argc);
 
 	/*
 	 * Accommodate for new-style groff column syntax.  Shuffle the
 	 * child nodes, all of which must be TEXT, as arguments for the
 	 * column field.  Then, delete the head children.
 	 */
 
 	argv = np->args->argv + j;
 	i = argv->sz;
 	argv->sz += mdoc->last->nchild;
 	argv->value = mandoc_reallocarray(argv->value,
 	    argv->sz, sizeof(char *));
 
 	mdoc->last->norm->Bl.ncols = argv->sz;
 	mdoc->last->norm->Bl.cols = (void *)argv->value;
 
 	for (nn = mdoc->last->child; nn; i++) {
 		argv->value[i] = nn->string;
 		nn->string = NULL;
 		nnp = nn;
 		nn = nn->next;
 		mdoc_node_delete(NULL, nnp);
 	}
 
 	mdoc->last->nchild = 0;
 	mdoc->last->child = NULL;
 }
 
 static void
 post_bl(POST_ARGS)
 {
 	struct mdoc_node	*nparent, *nprev; /* of the Bl block */
 	struct mdoc_node	*nblock, *nbody;  /* of the Bl */
 	struct mdoc_node	*nchild, *nnext;  /* of the Bl body */
 
 	nbody = mdoc->last;
 	switch (nbody->type) {
 	case MDOC_BLOCK:
 		post_bl_block(mdoc);
 		return;
 	case MDOC_HEAD:
 		post_bl_head(mdoc);
 		return;
 	case MDOC_BODY:
 		break;
 	default:
 		return;
 	}
 
 	bwarn_ge1(mdoc);
 
 	nchild = nbody->child;
 	while (NULL != nchild) {
 		if (MDOC_It == nchild->tok || MDOC_Sm == nchild->tok) {
 			nchild = nchild->next;
 			continue;
 		}
 
 		mandoc_msg(MANDOCERR_BL_MOVE, mdoc->parse,
 		    nchild->line, nchild->pos,
 		    mdoc_macronames[nchild->tok]);
 
 		/*
 		 * Move the node out of the Bl block.
 		 * First, collect all required node pointers.
 		 */
 
 		nblock  = nbody->parent;
 		nprev   = nblock->prev;
 		nparent = nblock->parent;
 		nnext   = nchild->next;
 
 		/*
 		 * Unlink this child.
 		 */
 
 		assert(NULL == nchild->prev);
 		if (0 == --nbody->nchild) {
 			nbody->child = NULL;
 			nbody->last  = NULL;
 			assert(NULL == nnext);
 		} else {
 			nbody->child = nnext;
 			nnext->prev = NULL;
 		}
 
 		/*
 		 * Relink this child.
 		 */
 
 		nchild->parent = nparent;
 		nchild->prev   = nprev;
 		nchild->next   = nblock;
 
 		nblock->prev = nchild;
 		nparent->nchild++;
 		if (NULL == nprev)
 			nparent->child = nchild;
 		else
 			nprev->next = nchild;
 
 		nchild = nnext;
 	}
 }
 
 static void
 post_bk(POST_ARGS)
 {
 
 	hwarn_eq0(mdoc);
 	bwarn_ge1(mdoc);
 }
 
 static void
 post_sm(struct mdoc *mdoc)
 {
 	struct mdoc_node	*nch;
 
 	nch = mdoc->last->child;
 
 	if (nch == NULL) {
 		mdoc->flags ^= MDOC_SMOFF;
 		return;
 	}
 
 	assert(nch->type == MDOC_TEXT);
 
 	if ( ! strcmp(nch->string, "on")) {
 		mdoc->flags &= ~MDOC_SMOFF;
 		return;
 	}
 	if ( ! strcmp(nch->string, "off")) {
 		mdoc->flags |= MDOC_SMOFF;
 		return;
 	}
 
 	mandoc_vmsg(MANDOCERR_SM_BAD,
 	    mdoc->parse, nch->line, nch->pos,
 	    "%s %s", mdoc_macronames[mdoc->last->tok], nch->string);
 	mdoc_node_relink(mdoc, nch);
 	return;
 }
 
 static void
 post_root(POST_ARGS)
 {
 	struct mdoc_node *n;
 
 	/* Add missing prologue data. */
 
 	if (mdoc->meta.date == NULL)
 		mdoc->meta.date = mdoc->quick ?
 		    mandoc_strdup("") :
 		    mandoc_normdate(mdoc->parse, NULL, 0, 0);
 
 	if (mdoc->meta.title == NULL) {
 		mandoc_msg(MANDOCERR_DT_NOTITLE,
 		    mdoc->parse, 0, 0, "EOF");
 		mdoc->meta.title = mandoc_strdup("UNTITLED");
 	}
 
 	if (mdoc->meta.vol == NULL)
 		mdoc->meta.vol = mandoc_strdup("LOCAL");
 
 	if (mdoc->meta.os == NULL) {
 		mandoc_msg(MANDOCERR_OS_MISSING,
 		    mdoc->parse, 0, 0, NULL);
 		mdoc->meta.os = mandoc_strdup("");
 	}
 
 	/* Check that we begin with a proper `Sh'. */
 
 	n = mdoc->first->child;
 	while (n != NULL && mdoc_macros[n->tok].flags & MDOC_PROLOGUE)
 		n = n->next;
 
 	if (n == NULL)
 		mandoc_msg(MANDOCERR_DOC_EMPTY, mdoc->parse, 0, 0, NULL);
 	else if (n->tok != MDOC_Sh)
 		mandoc_msg(MANDOCERR_SEC_BEFORE, mdoc->parse,
 		    n->line, n->pos, mdoc_macronames[n->tok]);
 }
 
 static void
 post_st(POST_ARGS)
 {
 	struct mdoc_node	 *n, *nch;
 	const char		 *p;
 
 	n = mdoc->last;
 	nch = n->child;
 
 	if (NULL == nch) {
 		mandoc_msg(MANDOCERR_MACRO_EMPTY, mdoc->parse,
 		    n->line, n->pos, mdoc_macronames[n->tok]);
 		mdoc_node_delete(mdoc, n);
 		return;
 	}
 
 	assert(MDOC_TEXT == nch->type);
 
 	if (NULL == (p = mdoc_a2st(nch->string))) {
 		mandoc_vmsg(MANDOCERR_ST_BAD, mdoc->parse,
 		    nch->line, nch->pos, "St %s", nch->string);
 		mdoc_node_delete(mdoc, n);
 	} else {
 		free(nch->string);
 		nch->string = mandoc_strdup(p);
 	}
 }
 
 static void
 post_rs(POST_ARGS)
 {
 	struct mdoc_node *nn, *next, *prev;
 	int		  i, j;
 
 	switch (mdoc->last->type) {
 	case MDOC_HEAD:
 		check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_EQ, 0);
 		return;
 	case MDOC_BODY:
 		if (mdoc->last->child)
 			break;
 		check_count(mdoc, MDOC_BODY, CHECK_WARN, CHECK_GT, 0);
 		return;
 	default:
 		return;
 	}
 
 	/*
 	 * The full `Rs' block needs special handling to order the
 	 * sub-elements according to `rsord'.  Pick through each element
 	 * and correctly order it.  This is an insertion sort.
 	 */
 
 	next = NULL;
 	for (nn = mdoc->last->child->next; nn; nn = next) {
 		/* Determine order of `nn'. */
 		for (i = 0; i < RSORD_MAX; i++)
 			if (rsord[i] == nn->tok)
 				break;
 
 		if (i == RSORD_MAX) {
 			mandoc_msg(MANDOCERR_RS_BAD,
 			    mdoc->parse, nn->line, nn->pos,
 			    mdoc_macronames[nn->tok]);
 			i = -1;
 		} else if (MDOC__J == nn->tok || MDOC__B == nn->tok)
 			mdoc->last->norm->Rs.quote_T++;
 
 		/*
 		 * Remove `nn' from the chain.  This somewhat
 		 * repeats mdoc_node_unlink(), but since we're
 		 * just re-ordering, there's no need for the
 		 * full unlink process.
 		 */
 
 		if (NULL != (next = nn->next))
 			next->prev = nn->prev;
 
 		if (NULL != (prev = nn->prev))
 			prev->next = nn->next;
 
 		nn->prev = nn->next = NULL;
 
 		/*
 		 * Scan back until we reach a node that's
 		 * ordered before `nn'.
 		 */
 
 		for ( ; prev ; prev = prev->prev) {
 			/* Determine order of `prev'. */
 			for (j = 0; j < RSORD_MAX; j++)
 				if (rsord[j] == prev->tok)
 					break;
 			if (j == RSORD_MAX)
 				j = -1;
 
 			if (j <= i)
 				break;
 		}
 
 		/*
 		 * Set `nn' back into its correct place in front
 		 * of the `prev' node.
 		 */
 
 		nn->prev = prev;
 
 		if (prev) {
 			if (prev->next)
 				prev->next->prev = nn;
 			nn->next = prev->next;
 			prev->next = nn;
 		} else {
 			mdoc->last->child->prev = nn;
 			nn->next = mdoc->last->child;
 			mdoc->last->child = nn;
 		}
 	}
 }
 
 /*
  * For some arguments of some macros,
  * convert all breakable hyphens into ASCII_HYPH.
  */
 static void
 post_hyph(POST_ARGS)
 {
 	struct mdoc_node	*n, *nch;
 	char			*cp;
 
 	n = mdoc->last;
 	switch (n->type) {
 	case MDOC_HEAD:
 		if (MDOC_Sh == n->tok || MDOC_Ss == n->tok)
 			break;
 		return;
 	case MDOC_BODY:
 		if (MDOC_D1 == n->tok || MDOC_Nd == n->tok)
 			break;
 		return;
 	case MDOC_ELEM:
 		break;
 	default:
 		return;
 	}
 
 	for (nch = n->child; nch; nch = nch->next) {
 		if (MDOC_TEXT != nch->type)
 			continue;
 		cp = nch->string;
 		if ('\0' == *cp)
 			continue;
 		while ('\0' != *(++cp))
 			if ('-' == *cp &&
 			    isalpha((unsigned char)cp[-1]) &&
 			    isalpha((unsigned char)cp[1]))
 				*cp = ASCII_HYPH;
 	}
 }
 
 static void
 post_hyphtext(POST_ARGS)
 {
 
 	ewarn_ge1(mdoc);
 	post_hyph(mdoc);
 }
 
 static void
 post_ns(POST_ARGS)
 {
 
 	if (MDOC_LINE & mdoc->last->flags)
 		mandoc_msg(MANDOCERR_NS_SKIP, mdoc->parse,
 		    mdoc->last->line, mdoc->last->pos, NULL);
 }
 
 static void
 post_sh(POST_ARGS)
 {
 
 	post_ignpar(mdoc);
 
 	switch (mdoc->last->type) {
 	case MDOC_HEAD:
 		post_sh_head(mdoc);
 		break;
 	case MDOC_BODY:
 		switch (mdoc->lastsec)  {
 		case SEC_NAME:
 			post_sh_name(mdoc);
 			break;
 		case SEC_SEE_ALSO:
 			post_sh_see_also(mdoc);
 			break;
 		case SEC_AUTHORS:
 			post_sh_authors(mdoc);
 			break;
 		default:
 			break;
 		}
 		break;
 	default:
 		break;
 	}
 }
 
 static void
 post_sh_name(POST_ARGS)
 {
 	struct mdoc_node *n;
 
 	/*
 	 * Warn if the NAME section doesn't contain the `Nm' and `Nd'
 	 * macros (can have multiple `Nm' and one `Nd').  Note that the
 	 * children of the BODY declaration can also be "text".
 	 */
 
 	if (NULL == (n = mdoc->last->child)) {
 		mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse,
 		    mdoc->last->line, mdoc->last->pos, "empty");
 		return;
 	}
 
 	for ( ; n && n->next; n = n->next) {
 		if (MDOC_ELEM == n->type && MDOC_Nm == n->tok)
 			continue;
 		if (MDOC_TEXT == n->type)
 			continue;
 		mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse,
 		    n->line, n->pos, mdoc_macronames[n->tok]);
 	}
 
 	assert(n);
 	if (MDOC_BLOCK == n->type && MDOC_Nd == n->tok)
 		return;
 
 	mandoc_msg(MANDOCERR_NAMESEC_BAD, mdoc->parse,
 	    n->line, n->pos, mdoc_macronames[n->tok]);
 }
 
 static void
 post_sh_see_also(POST_ARGS)
 {
 	const struct mdoc_node	*n;
 	const char 		*name, *sec;
 	const char		*lastname, *lastsec, *lastpunct;
 	int			 cmp;
 
 	n = mdoc->last->child;
 	lastname = lastsec = lastpunct = NULL;
 	while (n != NULL) {
 		if (n->tok != MDOC_Xr || n->nchild < 2)
 			break;
 
 		/* Process one .Xr node. */
 
 		name = n->child->string;
 		sec = n->child->next->string;
 		if (lastsec != NULL) {
 			if (lastpunct[0] != ',' || lastpunct[1] != '\0')
 				mandoc_vmsg(MANDOCERR_XR_PUNCT,
 				    mdoc->parse, n->line, n->pos,
 				    "%s before %s(%s)", lastpunct,
 				    name, sec);
 			cmp = strcmp(lastsec, sec);
 			if (cmp > 0)
 				mandoc_vmsg(MANDOCERR_XR_ORDER,
 				    mdoc->parse, n->line, n->pos,
 				    "%s(%s) after %s(%s)", name,
 				    sec, lastname, lastsec);
 			else if (cmp == 0 &&
 			    strcasecmp(lastname, name) > 0)
 				mandoc_vmsg(MANDOCERR_XR_ORDER,
 				    mdoc->parse, n->line, n->pos,
 				    "%s after %s", name, lastname);
 		}
 		lastname = name;
 		lastsec = sec;
 
 		/* Process the following node. */
 
 		n = n->next;
 		if (n == NULL)
 			break;
 		if (n->tok == MDOC_Xr) {
 			lastpunct = "none";
 			continue;
 		}
 		if (n->type != MDOC_TEXT)
 			break;
 		for (name = n->string; *name != '\0'; name++)
 			if (isalpha((const unsigned char)*name))
 				return;
 		lastpunct = n->string;
 		if (n->next == NULL)
 			mandoc_vmsg(MANDOCERR_XR_PUNCT, mdoc->parse,
 			    n->line, n->pos, "%s after %s(%s)",
 			    lastpunct, lastname, lastsec);
 		n = n->next;
 	}
 }
 
 static int
 child_an(const struct mdoc_node *n)
 {
 
 	for (n = n->child; n != NULL; n = n->next)
 		if ((n->tok == MDOC_An && n->nchild) || child_an(n))
 			return(1);
 	return(0);
 }
 
 static void
 post_sh_authors(POST_ARGS)
 {
 
 	if ( ! child_an(mdoc->last))
 		mandoc_msg(MANDOCERR_AN_MISSING, mdoc->parse,
 		    mdoc->last->line, mdoc->last->pos, NULL);
 }
 
 static void
 post_sh_head(POST_ARGS)
 {
 	struct mdoc_node *n;
 	const char	*goodsec;
 	char		*secname;
 	enum mdoc_sec	 sec;
 
 	/*
 	 * Process a new section.  Sections are either "named" or
 	 * "custom".  Custom sections are user-defined, while named ones
 	 * follow a conventional order and may only appear in certain
 	 * manual sections.
 	 */
 
 	secname = NULL;
 	sec = SEC_CUSTOM;
 	mdoc_deroff(&secname, mdoc->last);
 	sec = NULL == secname ? SEC_CUSTOM : a2sec(secname);
 
 	/* The NAME should be first. */
 
 	if (SEC_NAME != sec && SEC_NONE == mdoc->lastnamed)
 		mandoc_vmsg(MANDOCERR_NAMESEC_FIRST, mdoc->parse,
 		    mdoc->last->line, mdoc->last->pos,
 		    "Sh %s", secname);
 
 	/* The SYNOPSIS gets special attention in other areas. */
 
 	if (SEC_SYNOPSIS == sec) {
 		roff_setreg(mdoc->roff, "nS", 1, '=');
 		mdoc->flags |= MDOC_SYNOPSIS;
 	} else {
 		roff_setreg(mdoc->roff, "nS", 0, '=');
 		mdoc->flags &= ~MDOC_SYNOPSIS;
 	}
 
 	/* Mark our last section. */
 
 	mdoc->lastsec = sec;
 
 	/*
 	 * Set the section attribute for the current HEAD, for its
 	 * parent BLOCK, and for the HEAD children; the latter can
 	 * only be TEXT nodes, so no recursion is needed.
 	 * For other blocks and elements, including .Sh BODY, this is
 	 * done when allocating the node data structures, but for .Sh
 	 * BLOCK and HEAD, the section is still unknown at that time.
 	 */
 
 	mdoc->last->parent->sec = sec;
 	mdoc->last->sec = sec;
 	for (n = mdoc->last->child; n; n = n->next)
 		n->sec = sec;
 
 	/* We don't care about custom sections after this. */
 
 	if (SEC_CUSTOM == sec) {
 		free(secname);
 		return;
 	}
 
 	/*
 	 * Check whether our non-custom section is being repeated or is
 	 * out of order.
 	 */
 
 	if (sec == mdoc->lastnamed)
 		mandoc_vmsg(MANDOCERR_SEC_REP, mdoc->parse,
 		    mdoc->last->line, mdoc->last->pos,
 		    "Sh %s", secname);
 
 	if (sec < mdoc->lastnamed)
 		mandoc_vmsg(MANDOCERR_SEC_ORDER, mdoc->parse,
 		    mdoc->last->line, mdoc->last->pos,
 		    "Sh %s", secname);
 
 	/* Mark the last named section. */
 
 	mdoc->lastnamed = sec;
 
 	/* Check particular section/manual conventions. */
 
 	if (mdoc->meta.msec == NULL) {
 		free(secname);
 		return;
 	}
 
 	goodsec = NULL;
 	switch (sec) {
 	case SEC_ERRORS:
 		if (*mdoc->meta.msec == '4')
 			break;
 		goodsec = "2, 3, 4, 9";
 		/* FALLTHROUGH */
 	case SEC_RETURN_VALUES:
 		/* FALLTHROUGH */
 	case SEC_LIBRARY:
 		if (*mdoc->meta.msec == '2')
 			break;
 		if (*mdoc->meta.msec == '3')
 			break;
 		if (NULL == goodsec)
 			goodsec = "2, 3, 9";
 		/* FALLTHROUGH */
 	case SEC_CONTEXT:
 		if (*mdoc->meta.msec == '9')
 			break;
 		if (NULL == goodsec)
 			goodsec = "9";
 		mandoc_vmsg(MANDOCERR_SEC_MSEC, mdoc->parse,
 		    mdoc->last->line, mdoc->last->pos,
 		    "Sh %s for %s only", secname, goodsec);
 		break;
 	default:
 		break;
 	}
 	free(secname);
 }
 
 static void
 post_ignpar(POST_ARGS)
 {
 	struct mdoc_node *np;
 
 	check_count(mdoc, MDOC_HEAD, CHECK_WARN, CHECK_GT, 0);
 	post_hyph(mdoc);
 
 	if (MDOC_BODY != mdoc->last->type)
 		return;
 
 	if (NULL != (np = mdoc->last->child))
 		if (MDOC_Pp == np->tok || MDOC_Lp == np->tok) {
 			mandoc_vmsg(MANDOCERR_PAR_SKIP,
 			    mdoc->parse, np->line, np->pos,
 			    "%s after %s", mdoc_macronames[np->tok],
 			    mdoc_macronames[mdoc->last->tok]);
 			mdoc_node_delete(mdoc, np);
 		}
 
 	if (NULL != (np = mdoc->last->last))
 		if (MDOC_Pp == np->tok || MDOC_Lp == np->tok) {
 			mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
 			    np->line, np->pos, "%s at the end of %s",
 			    mdoc_macronames[np->tok],
 			    mdoc_macronames[mdoc->last->tok]);
 			mdoc_node_delete(mdoc, np);
 		}
 }
 
 static void
 pre_par(PRE_ARGS)
 {
 
 	if (NULL == mdoc->last)
 		return;
 	if (MDOC_ELEM != n->type && MDOC_BLOCK != n->type)
 		return;
 
 	/*
 	 * Don't allow prior `Lp' or `Pp' prior to a paragraph-type
 	 * block:  `Lp', `Pp', or non-compact `Bd' or `Bl'.
 	 */
 
 	if (MDOC_Pp != mdoc->last->tok &&
 	    MDOC_Lp != mdoc->last->tok &&
 	    MDOC_br != mdoc->last->tok)
 		return;
 	if (MDOC_Bl == n->tok && n->norm->Bl.comp)
 		return;
 	if (MDOC_Bd == n->tok && n->norm->Bd.comp)
 		return;
 	if (MDOC_It == n->tok && n->parent->norm->Bl.comp)
 		return;
 
 	mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
 	    mdoc->last->line, mdoc->last->pos,
 	    "%s before %s", mdoc_macronames[mdoc->last->tok],
 	    mdoc_macronames[n->tok]);
 	mdoc_node_delete(mdoc, mdoc->last);
 }
 
 static void
 post_par(POST_ARGS)
 {
 	struct mdoc_node *np;
 
 	if (mdoc->last->tok == MDOC_sp)
 		check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_LT, 2);
 	else
 		check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 0);
 
 	if (MDOC_ELEM != mdoc->last->type &&
 	    MDOC_BLOCK != mdoc->last->type)
 		return;
 
 	if (NULL == (np = mdoc->last->prev)) {
 		np = mdoc->last->parent;
 		if (MDOC_Sh != np->tok && MDOC_Ss != np->tok)
 			return;
 	} else if (MDOC_Pp != np->tok && MDOC_Lp != np->tok &&
 	    (MDOC_br != mdoc->last->tok ||
 	     (MDOC_sp != np->tok && MDOC_br != np->tok)))
 		return;
 
 	mandoc_vmsg(MANDOCERR_PAR_SKIP, mdoc->parse,
 	    mdoc->last->line, mdoc->last->pos,
 	    "%s after %s", mdoc_macronames[mdoc->last->tok],
 	    mdoc_macronames[np->tok]);
 	mdoc_node_delete(mdoc, mdoc->last);
 }
 
 static void
 pre_literal(PRE_ARGS)
 {
 
 	pre_display(mdoc, n);
 
 	if (MDOC_BODY != n->type)
 		return;
 
 	/*
 	 * The `Dl' (note "el" not "one") and `Bd -literal' and `Bd
 	 * -unfilled' macros set MDOC_LITERAL on entrance to the body.
 	 */
 
 	switch (n->tok) {
 	case MDOC_Dl:
 		mdoc->flags |= MDOC_LITERAL;
 		break;
 	case MDOC_Bd:
 		if (DISP_literal == n->norm->Bd.type)
 			mdoc->flags |= MDOC_LITERAL;
 		if (DISP_unfilled == n->norm->Bd.type)
 			mdoc->flags |= MDOC_LITERAL;
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 }
 
 static void
 post_dd(POST_ARGS)
 {
 	struct mdoc_node *n;
 	char		 *datestr;
 
 	if (mdoc->meta.date)
 		free(mdoc->meta.date);
 
 	n = mdoc->last;
 	if (NULL == n->child || '\0' == n->child->string[0]) {
 		mdoc->meta.date = mdoc->quick ? mandoc_strdup("") :
 		    mandoc_normdate(mdoc->parse, NULL, n->line, n->pos);
 		goto out;
 	}
 
 	datestr = NULL;
 	mdoc_deroff(&datestr, n);
 	if (mdoc->quick)
 		mdoc->meta.date = datestr;
 	else {
 		mdoc->meta.date = mandoc_normdate(mdoc->parse,
 		    datestr, n->line, n->pos);
 		free(datestr);
 	}
 out:
 	mdoc_node_delete(mdoc, n);
 }
 
 static void
 post_dt(POST_ARGS)
 {
 	struct mdoc_node *nn, *n;
 	const char	 *cp;
 	char		 *p;
 
 	n = mdoc->last;
 
 	free(mdoc->meta.title);
 	free(mdoc->meta.msec);
 	free(mdoc->meta.vol);
 	free(mdoc->meta.arch);
 
 	mdoc->meta.title = NULL;
 	mdoc->meta.msec = NULL;
 	mdoc->meta.vol = NULL;
 	mdoc->meta.arch = NULL;
 
 	/* First check that all characters are uppercase. */
 
 	if (NULL != (nn = n->child))
 		for (p = nn->string; *p; p++) {
 			if (toupper((unsigned char)*p) == *p)
 				continue;
 			mandoc_vmsg(MANDOCERR_TITLE_CASE,
 			    mdoc->parse, nn->line,
 			    nn->pos + (p - nn->string),
 			    "Dt %s", nn->string);
 			break;
 		}
 
 	/* No argument: msec and arch remain NULL. */
 
 	if (NULL == (nn = n->child)) {
 		mandoc_msg(MANDOCERR_DT_NOTITLE,
 		    mdoc->parse, n->line, n->pos, "Dt");
 		mdoc->meta.title = mandoc_strdup("UNTITLED");
 		mdoc->meta.vol = mandoc_strdup("LOCAL");
 		goto out;
 	}
 
 	/* One argument: msec and arch remain NULL. */
 
 	mdoc->meta.title = mandoc_strdup(
 	    '\0' == nn->string[0] ? "UNTITLED" : nn->string);
 
 	if (NULL == (nn = nn->next)) {
 		mandoc_vmsg(MANDOCERR_MSEC_MISSING,
 		    mdoc->parse, n->line, n->pos,
 		    "Dt %s", mdoc->meta.title);
 		mdoc->meta.vol = mandoc_strdup("LOCAL");
 		goto out;
 	}
 
 	/* Handles: `.Dt TITLE SEC'
 	 * title = TITLE,
 	 * volume = SEC is msec ? format(msec) : SEC,
 	 * msec = SEC is msec ? atoi(msec) : 0,
 	 * arch = NULL
 	 */
 
 	cp = mandoc_a2msec(nn->string);
 	if (cp) {
 		mdoc->meta.vol = mandoc_strdup(cp);
 		mdoc->meta.msec = mandoc_strdup(nn->string);
 	} else {
 		mandoc_vmsg(MANDOCERR_MSEC_BAD, mdoc->parse,
 		    nn->line, nn->pos, "Dt ... %s", nn->string);
 		mdoc->meta.vol = mandoc_strdup(nn->string);
 		mdoc->meta.msec = mandoc_strdup(nn->string);
 	}
 
 	/* Handle an optional architecture */
 
 	if ((nn = nn->next) != NULL) {
 		for (p = nn->string; *p; p++)
 			*p = tolower((unsigned char)*p);
 		mdoc->meta.arch = mandoc_strdup(nn->string);
 	}
 
 	/* Ignore any subsequent parameters... */
 	/* FIXME: warn about subsequent parameters. */
 out:
 	mdoc_node_delete(mdoc, n);
 }
 
 static void
 post_bx(POST_ARGS)
 {
 	struct mdoc_node	*n;
 
 	/*
 	 * Make `Bx's second argument always start with an uppercase
 	 * letter.  Groff checks if it's an "accepted" term, but we just
 	 * uppercase blindly.
 	 */
 
 	n = mdoc->last->child;
 	if (n && NULL != (n = n->next))
 		*n->string = (char)toupper((unsigned char)*n->string);
 }
 
 static void
 post_os(POST_ARGS)
 {
 #ifndef OSNAME
 	struct utsname	  utsname;
 	static char	 *defbuf;
 #endif
 	struct mdoc_node *n;
 
 	n = mdoc->last;
 
 	/*
 	 * Set the operating system by way of the `Os' macro.
 	 * The order of precedence is:
 	 * 1. the argument of the `Os' macro, unless empty
 	 * 2. the -Ios=foo command line argument, if provided
 	 * 3. -DOSNAME="\"foo\"", if provided during compilation
 	 * 4. "sysname release" from uname(3)
 	 */
 
 	free(mdoc->meta.os);
 	mdoc->meta.os = NULL;
 	mdoc_deroff(&mdoc->meta.os, n);
 	if (mdoc->meta.os)
 		goto out;
 
 	if (mdoc->defos) {
 		mdoc->meta.os = mandoc_strdup(mdoc->defos);
 		goto out;
 	}
 
 #ifdef OSNAME
 	mdoc->meta.os = mandoc_strdup(OSNAME);
 #else /*!OSNAME */
 	if (NULL == defbuf) {
 		if (-1 == uname(&utsname)) {
 			mandoc_msg(MANDOCERR_OS_UNAME, mdoc->parse,
 			    n->line, n->pos, "Os");
 			defbuf = mandoc_strdup("UNKNOWN");
 		} else
 			mandoc_asprintf(&defbuf, "%s %s",
 			    utsname.sysname, utsname.release);
 	}
 	mdoc->meta.os = mandoc_strdup(defbuf);
 #endif /*!OSNAME*/
 
 out:
 	mdoc_node_delete(mdoc, n);
 }
 
 /*
  * If no argument is provided,
  * fill in the name of the current manual page.
  */
 static void
 post_ex(POST_ARGS)
 {
 	struct mdoc_node *n;
 
 	n = mdoc->last;
 
 	if (n->child)
 		return;
 
 	if (mdoc->meta.name == NULL) {
 		mandoc_msg(MANDOCERR_EX_NONAME, mdoc->parse,
 		    n->line, n->pos, "Ex");
 		return;
 	}
 
 	mdoc->next = MDOC_NEXT_CHILD;
 	mdoc_word_alloc(mdoc, n->line, n->pos, mdoc->meta.name);
 	mdoc->last = n;
 }
 
 static enum mdoc_sec
 a2sec(const char *p)
 {
 	int		 i;
 
 	for (i = 0; i < (int)SEC__MAX; i++)
 		if (secnames[i] && 0 == strcmp(p, secnames[i]))
 			return((enum mdoc_sec)i);
 
 	return(SEC_CUSTOM);
 }
 
 static size_t
 macro2len(enum mdoct macro)
 {
 
 	switch (macro) {
 	case MDOC_Ad:
 		return(12);
 	case MDOC_Ao:
 		return(12);
 	case MDOC_An:
 		return(12);
 	case MDOC_Aq:
 		return(12);
 	case MDOC_Ar:
 		return(12);
 	case MDOC_Bo:
 		return(12);
 	case MDOC_Bq:
 		return(12);
 	case MDOC_Cd:
 		return(12);
 	case MDOC_Cm:
 		return(10);
 	case MDOC_Do:
 		return(10);
 	case MDOC_Dq:
 		return(12);
 	case MDOC_Dv:
 		return(12);
 	case MDOC_Eo:
 		return(12);
 	case MDOC_Em:
 		return(10);
 	case MDOC_Er:
 		return(17);
 	case MDOC_Ev:
 		return(15);
 	case MDOC_Fa:
 		return(12);
 	case MDOC_Fl:
 		return(10);
 	case MDOC_Fo:
 		return(16);
 	case MDOC_Fn:
 		return(16);
 	case MDOC_Ic:
 		return(10);
 	case MDOC_Li:
 		return(16);
 	case MDOC_Ms:
 		return(6);
 	case MDOC_Nm:
 		return(10);
 	case MDOC_No:
 		return(12);
 	case MDOC_Oo:
 		return(10);
 	case MDOC_Op:
 		return(14);
 	case MDOC_Pa:
 		return(32);
 	case MDOC_Pf:
 		return(12);
 	case MDOC_Po:
 		return(12);
 	case MDOC_Pq:
 		return(12);
 	case MDOC_Ql:
 		return(16);
 	case MDOC_Qo:
 		return(12);
 	case MDOC_So:
 		return(12);
 	case MDOC_Sq:
 		return(12);
 	case MDOC_Sy:
 		return(6);
 	case MDOC_Sx:
 		return(16);
 	case MDOC_Tn:
 		return(10);
 	case MDOC_Va:
 		return(12);
 	case MDOC_Vt:
 		return(12);
 	case MDOC_Xr:
 		return(10);
 	default:
 		break;
 	};
 	return(0);
 }
Index: projects/arm_intrng/contrib/mdocml/msec.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/msec.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/msec.c	(revision 276248)
@@ -1,36 +1,35 @@
-/*	$Id: msec.c,v 1.12 2014/08/10 23:54:41 schwarze Exp $ */
+/*	$Id: msec.c,v 1.13 2014/12/01 08:05:52 schwarze Exp $ */
 /*
  * Copyright (c) 2009 Kristaps Dzonsons 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 
-#include "mandoc.h"
 #include "libmandoc.h"
 
 #define LINE(x, y) \
 	if (0 == strcmp(p, x)) return(y);
 
 const char *
 mandoc_a2msec(const char *p)
 {
 
 #include "msec.in"
 
 	return(NULL);
 }
Index: projects/arm_intrng/contrib/mdocml/out.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/out.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/out.c	(revision 276248)
@@ -1,345 +1,345 @@
-/*	$Id: out.c,v 1.53 2014/10/14 18:18:05 schwarze Exp $ */
+/*	$Id: out.c,v 1.54 2014/12/04 02:05:42 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2011, 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "mandoc_aux.h"
 #include "mandoc.h"
 #include "out.h"
 
 static	void	tblcalc_data(struct rofftbl *, struct roffcol *,
 			const struct tbl_opts *, const struct tbl_dat *);
 static	void	tblcalc_literal(struct rofftbl *, struct roffcol *,
 			const struct tbl_dat *);
 static	void	tblcalc_number(struct rofftbl *, struct roffcol *,
 			const struct tbl_opts *, const struct tbl_dat *);
 
 
 /*
  * Convert a `scaling unit' to a consistent form, or fail.  Scaling
  * units are documented in groff.7, mdoc.7, man.7.
  */
 int
 a2roffsu(const char *src, struct roffsu *dst, enum roffscale def)
 {
 	char		 buf[BUFSIZ], hasd;
 	int		 i;
 	enum roffscale	 unit;
 
 	if ('\0' == *src)
 		return(0);
 
 	i = hasd = 0;
 
 	switch (*src) {
 	case '+':
 		src++;
 		break;
 	case '-':
 		buf[i++] = *src++;
 		break;
 	default:
 		break;
 	}
 
 	if ('\0' == *src)
 		return(0);
 
 	while (i < BUFSIZ) {
 		if ( ! isdigit((unsigned char)*src)) {
 			if ('.' != *src)
 				break;
 			else if (hasd)
 				break;
 			else
 				hasd = 1;
 		}
 		buf[i++] = *src++;
 	}
 
 	if (BUFSIZ == i || (*src && *(src + 1)))
 		return(0);
 
 	buf[i] = '\0';
 
 	switch (*src) {
 	case 'c':
 		unit = SCALE_CM;
 		break;
 	case 'i':
 		unit = SCALE_IN;
 		break;
 	case 'P':
 		unit = SCALE_PC;
 		break;
 	case 'p':
 		unit = SCALE_PT;
 		break;
 	case 'f':
 		unit = SCALE_FS;
 		break;
 	case 'v':
 		unit = SCALE_VS;
 		break;
 	case 'm':
 		unit = SCALE_EM;
 		break;
 	case '\0':
 		if (SCALE_MAX == def)
 			return(0);
-		unit = SCALE_EN;
+		unit = def;
 		break;
 	case 'u':
 		unit = SCALE_BU;
 		break;
 	case 'M':
 		unit = SCALE_MM;
 		break;
 	case 'n':
 		unit = SCALE_EN;
 		break;
 	default:
 		return(0);
 	}
 
 	/* FIXME: do this in the caller. */
 	if ((dst->scale = atof(buf)) < 0.0)
 		dst->scale = 0.0;
 	dst->unit = unit;
 	return(1);
 }
 
 /*
  * Calculate the abstract widths and decimal positions of columns in a
  * table.  This routine allocates the columns structures then runs over
  * all rows and cells in the table.  The function pointers in "tbl" are
  * used for the actual width calculations.
  */
 void
 tblcalc(struct rofftbl *tbl, const struct tbl_span *sp,
 	size_t totalwidth)
 {
 	const struct tbl_dat	*dp;
 	struct roffcol		*col;
 	size_t			 ewidth, xwidth;
 	int			 spans;
 	int			 icol, maxcol, necol, nxcol;
 
 	/*
 	 * Allocate the master column specifiers.  These will hold the
 	 * widths and decimal positions for all cells in the column.  It
 	 * must be freed and nullified by the caller.
 	 */
 
 	assert(NULL == tbl->cols);
 	tbl->cols = mandoc_calloc((size_t)sp->opts->cols,
 	    sizeof(struct roffcol));
 
 	for (maxcol = -1; sp; sp = sp->next) {
 		if (TBL_SPAN_DATA != sp->pos)
 			continue;
 		spans = 1;
 		/*
 		 * Account for the data cells in the layout, matching it
 		 * to data cells in the data section.
 		 */
 		for (dp = sp->first; dp; dp = dp->next) {
 			/* Do not used spanned cells in the calculation. */
 			if (0 < --spans)
 				continue;
 			spans = dp->spans;
 			if (1 < spans)
 				continue;
 			icol = dp->layout->head->ident;
 			if (maxcol < icol)
 				maxcol = icol;
 			col = tbl->cols + icol;
 			col->flags |= dp->layout->flags;
 			if (dp->layout->flags & TBL_CELL_WIGN)
 				continue;
 			tblcalc_data(tbl, col, sp->opts, dp);
 		}
 	}
 
 	/*
 	 * Count columns to equalize and columns to maximize.
 	 * Find maximum width of the columns to equalize.
 	 * Find total width of the columns *not* to maximize.
 	 */
 
 	necol = nxcol = 0;
 	ewidth = xwidth = 0;
 	for (icol = 0; icol <= maxcol; icol++) {
 		col = tbl->cols + icol;
 		if (col->flags & TBL_CELL_EQUAL) {
 			necol++;
 			if (ewidth < col->width)
 				ewidth = col->width;
 		}
 		if (col->flags & TBL_CELL_WMAX)
 			nxcol++;
 		else
 			xwidth += col->width;
 	}
 
 	/*
 	 * Equalize columns, if requested for any of them.
 	 * Update total width of the columns not to maximize.
 	 */
 
 	if (necol) {
 		for (icol = 0; icol <= maxcol; icol++) {
 			col = tbl->cols + icol;
 			if ( ! (col->flags & TBL_CELL_EQUAL))
 				continue;
 			if (col->width == ewidth)
 				continue;
 			if (nxcol && totalwidth)
 				xwidth += ewidth - col->width;
 			col->width = ewidth;
 		}
 	}
 
 	/*
 	 * If there are any columns to maximize, find the total
 	 * available width, deducting 3n margins between columns.
 	 * Distribute the available width evenly.
 	 */
 
 	if (nxcol && totalwidth) {
 		xwidth = totalwidth - 3*maxcol - xwidth;
 		for (icol = 0; icol <= maxcol; icol++) {
 			col = tbl->cols + icol;
 			if ( ! (col->flags & TBL_CELL_WMAX))
 				continue;
 			col->width = xwidth / nxcol--;
 			xwidth -= col->width;
 		}
 	}
 }
 
 static void
 tblcalc_data(struct rofftbl *tbl, struct roffcol *col,
 		const struct tbl_opts *opts, const struct tbl_dat *dp)
 {
 	size_t		 sz;
 
 	/* Branch down into data sub-types. */
 
 	switch (dp->layout->pos) {
 	case TBL_CELL_HORIZ:
 		/* FALLTHROUGH */
 	case TBL_CELL_DHORIZ:
 		sz = (*tbl->len)(1, tbl->arg);
 		if (col->width < sz)
 			col->width = sz;
 		break;
 	case TBL_CELL_LONG:
 		/* FALLTHROUGH */
 	case TBL_CELL_CENTRE:
 		/* FALLTHROUGH */
 	case TBL_CELL_LEFT:
 		/* FALLTHROUGH */
 	case TBL_CELL_RIGHT:
 		tblcalc_literal(tbl, col, dp);
 		break;
 	case TBL_CELL_NUMBER:
 		tblcalc_number(tbl, col, opts, dp);
 		break;
 	case TBL_CELL_DOWN:
 		break;
 	default:
 		abort();
 		/* NOTREACHED */
 	}
 }
 
 static void
 tblcalc_literal(struct rofftbl *tbl, struct roffcol *col,
 		const struct tbl_dat *dp)
 {
 	size_t		 sz;
 	const char	*str;
 
 	str = dp->string ? dp->string : "";
 	sz = (*tbl->slen)(str, tbl->arg);
 
 	if (col->width < sz)
 		col->width = sz;
 }
 
 static void
 tblcalc_number(struct rofftbl *tbl, struct roffcol *col,
 		const struct tbl_opts *opts, const struct tbl_dat *dp)
 {
 	int		 i;
 	size_t		 sz, psz, ssz, d;
 	const char	*str;
 	char		*cp;
 	char		 buf[2];
 
 	/*
 	 * First calculate number width and decimal place (last + 1 for
 	 * non-decimal numbers).  If the stored decimal is subsequent to
 	 * ours, make our size longer by that difference
 	 * (right-"shifting"); similarly, if ours is subsequent the
 	 * stored, then extend the stored size by the difference.
 	 * Finally, re-assign the stored values.
 	 */
 
 	str = dp->string ? dp->string : "";
 	sz = (*tbl->slen)(str, tbl->arg);
 
 	/* FIXME: TBL_DATA_HORIZ et al.? */
 
 	buf[0] = opts->decimal;
 	buf[1] = '\0';
 
 	psz = (*tbl->slen)(buf, tbl->arg);
 
 	if (NULL != (cp = strrchr(str, opts->decimal))) {
 		buf[1] = '\0';
 		for (ssz = 0, i = 0; cp != &str[i]; i++) {
 			buf[0] = str[i];
 			ssz += (*tbl->slen)(buf, tbl->arg);
 		}
 		d = ssz + psz;
 	} else
 		d = sz + psz;
 
 	/* Adjust the settings for this column. */
 
 	if (col->decimal > d) {
 		sz += col->decimal - d;
 		d = col->decimal;
 	} else
 		col->width += d - col->decimal;
 
 	if (sz > col->width)
 		col->width = sz;
 	if (d > col->decimal)
 		col->decimal = d;
 }
Index: projects/arm_intrng/contrib/mdocml/out.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/out.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/out.h	(revision 276248)
@@ -1,73 +1,71 @@
-/*	$Id: out.h,v 1.24 2014/10/14 02:16:06 schwarze Exp $ */
+/*	$Id: out.h,v 1.26 2014/12/01 08:05:52 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef OUT_H
-#define OUT_H
 
 enum	roffscale {
 	SCALE_CM, /* centimeters (c) */
 	SCALE_IN, /* inches (i) */
 	SCALE_PC, /* pica (P) */
 	SCALE_PT, /* points (p) */
 	SCALE_EM, /* ems (m) */
 	SCALE_MM, /* mini-ems (M) */
 	SCALE_EN, /* ens (n) */
 	SCALE_BU, /* default horizontal (u) */
 	SCALE_VS, /* default vertical (v) */
 	SCALE_FS, /* syn. for u (f) */
 	SCALE_MAX
 };
 
 struct	roffcol {
 	size_t		 width; /* width of cell */
 	size_t		 decimal; /* decimal position in cell */
 	int		 flags; /* layout flags, see tbl_cell */
 };
 
 struct	roffsu {
 	enum roffscale	  unit;
 	double		  scale;
 };
 
 typedef	size_t	(*tbl_strlen)(const char *, void *);
 typedef	size_t	(*tbl_len)(size_t, void *);
 
 struct	rofftbl {
 	tbl_strlen	 slen; /* calculate string length */
 	tbl_len		 len; /* produce width of empty space */
 	struct roffcol	*cols; /* master column specifiers */
 	void		*arg; /* passed to slen and len */
 };
 
-__BEGIN_DECLS
-
 #define	SCALE_VS_INIT(p, v) \
 	do { (p)->unit = SCALE_VS; \
 	     (p)->scale = (v); } \
 	while (/* CONSTCOND */ 0)
 
 #define	SCALE_HS_INIT(p, v) \
 	do { (p)->unit = SCALE_EN; \
 	     (p)->scale = (v); } \
 	while (/* CONSTCOND */ 0)
 
+__BEGIN_DECLS
+
+struct	tbl_span;
+
 int		  a2roffsu(const char *, struct roffsu *, enum roffscale);
 void		  tblcalc(struct rofftbl *tbl,
 			const struct tbl_span *, size_t);
 
 __END_DECLS
-
-#endif /*!OUT_H*/
Index: projects/arm_intrng/contrib/mdocml/read.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/read.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/read.c	(revision 276248)
@@ -1,1063 +1,1064 @@
-/*	$Id: read.c,v 1.101 2014/11/28 18:09:01 schwarze Exp $ */
+/*	$Id: read.c,v 1.104 2014/12/01 04:14:14 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2010-2014 Ingo Schwarze 
  * Copyright (c) 2010, 2012 Joerg Sonnenberger 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 #if HAVE_MMAP
 #include 
 #include 
 #endif
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "mandoc.h"
 #include "mandoc_aux.h"
 #include "libmandoc.h"
 #include "mdoc.h"
 #include "man.h"
-#include "main.h"
 
 #define	REPARSE_LIMIT	1000
 
 struct	mparse {
 	struct man	 *pman; /* persistent man parser */
 	struct mdoc	 *pmdoc; /* persistent mdoc parser */
 	struct man	 *man; /* man parser */
 	struct mdoc	 *mdoc; /* mdoc parser */
 	struct roff	 *roff; /* roff parser (!NULL) */
 	const struct mchars *mchars; /* character table */
 	char		 *sodest; /* filename pointed to by .so */
 	const char	 *file; /* filename of current input file */
 	struct buf	 *primary; /* buffer currently being parsed */
 	struct buf	 *secondary; /* preprocessed copy of input */
 	const char	 *defos; /* default operating system */
 	mandocmsg	  mmsg; /* warning/error message handler */
 	enum mandoclevel  file_status; /* status of current parse */
 	enum mandoclevel  wlevel; /* ignore messages below this */
 	int		  options; /* parser options */
 	int		  filenc; /* encoding of the current file */
 	int		  reparse_count; /* finite interp. stack */
 	int		  line; /* line number in the file */
 	pid_t		  child; /* the gunzip(1) process */
 };
 
 static	void	  choose_parser(struct mparse *);
 static	void	  resize_buf(struct buf *, size_t);
 static	void	  mparse_buf_r(struct mparse *, struct buf, size_t, int);
 static	int	  read_whole_file(struct mparse *, const char *, int,
 				struct buf *, int *);
 static	void	  mparse_end(struct mparse *);
 static	void	  mparse_parse_buffer(struct mparse *, struct buf,
 			const char *);
 
 static	const enum mandocerr	mandoclimits[MANDOCLEVEL_MAX] = {
 	MANDOCERR_OK,
 	MANDOCERR_WARNING,
 	MANDOCERR_WARNING,
 	MANDOCERR_ERROR,
 	MANDOCERR_FATAL,
 	MANDOCERR_MAX,
 	MANDOCERR_MAX
 };
 
 static	const char * const	mandocerrs[MANDOCERR_MAX] = {
 	"ok",
 
 	"generic warning",
 
 	/* related to the prologue */
 	"missing manual title, using UNTITLED",
 	"missing manual title, using \"\"",
 	"lower case character in document title",
 	"missing manual section, using \"\"",
 	"unknown manual section",
 	"missing date, using today's date",
 	"cannot parse date, using it verbatim",
 	"missing Os macro, using \"\"",
 	"duplicate prologue macro",
 	"late prologue macro",
 	"skipping late title macro",
 	"prologue macros out of order",
 
 	/* related to document structure */
 	".so is fragile, better use ln(1)",
 	"no document body",
 	"content before first section header",
 	"first section is not \"NAME\"",
 	"bad NAME section contents",
 	"sections out of conventional order",
 	"duplicate section title",
 	"unexpected section",
 	"unusual Xr order",
 	"unusual Xr punctuation",
 	"AUTHORS section without An macro",
 
 	/* related to macros and nesting */
 	"obsolete macro",
+	"macro neither callable nor escaped",
 	"skipping paragraph macro",
 	"moving paragraph macro out of list",
 	"skipping no-space macro",
 	"blocks badly nested",
 	"nested displays are not portable",
 	"moving content out of list",
 	".Vt block has child macro",
 	"fill mode already enabled, skipping",
 	"fill mode already disabled, skipping",
 	"line scope broken",
 
 	/* related to missing macro arguments */
 	"skipping empty request",
 	"conditional request controls empty scope",
 	"skipping empty macro",
 	"empty argument, using 0n",
 	"argument count wrong",
 	"missing display type, using -ragged",
 	"list type is not the first argument",
 	"missing -width in -tag list, using 8n",
 	"missing utility name, using \"\"",
 	"empty head in list item",
 	"empty list item",
 	"missing font type, using \\fR",
 	"unknown font type, using \\fR",
+	"nothing follows prefix",
 	"missing -std argument, adding it",
 	"missing eqn box, using \"\"",
 
 	/* related to bad macro arguments */
 	"unterminated quoted argument",
 	"duplicate argument",
 	"skipping duplicate argument",
 	"skipping duplicate display type",
 	"skipping duplicate list type",
 	"skipping -width argument",
 	"unknown AT&T UNIX version",
 	"comma in function argument",
 	"parenthesis in function name",
 	"invalid content in Rs block",
 	"invalid Boolean argument",
 	"unknown font, skipping request",
 
 	/* related to plain text */
 	"blank line in fill mode, using .sp",
 	"tab in filled text",
 	"whitespace at end of input line",
 	"bad comment style",
 	"invalid escape sequence",
 	"undefined string, using \"\"",
 
 	"generic error",
 
 	/* related to equations */
 	"unexpected equation scope closure",
 	"equation scope open on exit",
 	"overlapping equation scopes",
 	"unexpected end of equation",
 
 	/* related to tables */
 	"bad table syntax",
 	"bad table option",
 	"bad table layout",
 	"no table layout cells specified",
 	"no table data cells specified",
 	"ignore data in cell",
 	"data block still open",
 	"ignoring extra data cells",
 
 	/* related to document structure and macros */
 	"input stack limit exceeded, infinite loop?",
 	"skipping bad character",
 	"skipping unknown macro",
 	"skipping item outside list",
 	"skipping column outside column list",
 	"skipping end of block that is not open",
 	"inserting missing end of block",
 	"appending missing end of block",
 
 	/* related to request and macro arguments */
 	"escaped character not allowed in a name",
 	"argument count wrong",
 	"NOT IMPLEMENTED: Bd -file",
 	"missing list type, using -item",
 	"missing manual name, using \"\"",
 	"uname(3) system call failed, using UNKNOWN",
 	"unknown standard specifier",
 	"skipping request without numeric argument",
 	"skipping all arguments",
 	"skipping excess arguments",
 	"divide by zero",
 
 	"generic fatal error",
 
 	"input too large",
 	"NOT IMPLEMENTED: .so with absolute path or \"..\"",
 	".so request failed",
 
 	/* system errors */
 	"cannot dup file descriptor",
 	"cannot exec",
 	"gunzip failed with code",
 	"cannot fork",
 	NULL,
 	"cannot open pipe",
 	"cannot read file",
 	"gunzip died from signal",
 	"cannot stat file",
 	"wait failed",
 };
 
 static	const char * const	mandoclevels[MANDOCLEVEL_MAX] = {
 	"SUCCESS",
 	"RESERVED",
 	"WARNING",
 	"ERROR",
 	"FATAL",
 	"BADARG",
 	"SYSERR"
 };
 
 
 static void
 resize_buf(struct buf *buf, size_t initial)
 {
 
 	buf->sz = buf->sz > initial/2 ? 2 * buf->sz : initial;
 	buf->buf = mandoc_realloc(buf->buf, buf->sz);
 }
 
 static void
 choose_parser(struct mparse *curp)
 {
 	char		*cp, *ep;
 	int		 format;
 
 	/*
 	 * If neither command line arguments -mdoc or -man select
 	 * a parser nor the roff parser found a .Dd or .TH macro
 	 * yet, look ahead in the main input buffer.
 	 */
 
 	if ((format = roff_getformat(curp->roff)) == 0) {
 		cp = curp->primary->buf;
 		ep = cp + curp->primary->sz;
 		while (cp < ep) {
 			if (*cp == '.' || *cp == '\'') {
 				cp++;
 				if (cp[0] == 'D' && cp[1] == 'd') {
 					format = MPARSE_MDOC;
 					break;
 				}
 				if (cp[0] == 'T' && cp[1] == 'H') {
 					format = MPARSE_MAN;
 					break;
 				}
 			}
 			cp = memchr(cp, '\n', ep - cp);
 			if (cp == NULL)
 				break;
 			cp++;
 		}
 	}
 
 	if (format == MPARSE_MDOC) {
 		if (NULL == curp->pmdoc)
 			curp->pmdoc = mdoc_alloc(
 			    curp->roff, curp, curp->defos,
 			    MPARSE_QUICK & curp->options ? 1 : 0);
 		assert(curp->pmdoc);
 		curp->mdoc = curp->pmdoc;
 		return;
 	}
 
 	/* Fall back to man(7) as a last resort. */
 
 	if (NULL == curp->pman)
 		curp->pman = man_alloc(curp->roff, curp,
 		    MPARSE_QUICK & curp->options ? 1 : 0);
 	assert(curp->pman);
 	curp->man = curp->pman;
 }
 
 /*
  * Main parse routine for a buffer.
  * It assumes encoding and line numbering are already set up.
  * It can recurse directly (for invocations of user-defined
  * macros, inline equations, and input line traps)
  * and indirectly (for .so file inclusion).
  */
 static void
 mparse_buf_r(struct mparse *curp, struct buf blk, size_t i, int start)
 {
 	const struct tbl_span	*span;
 	struct buf	 ln;
 	size_t		 pos; /* byte number in the ln buffer */
 	enum rofferr	 rr;
 	int		 of;
 	int		 lnn; /* line number in the real file */
 	unsigned char	 c;
 
 	memset(&ln, 0, sizeof(ln));
 
 	lnn = curp->line;
 	pos = 0;
 
 	while (i < blk.sz) {
 		if (0 == pos && '\0' == blk.buf[i])
 			break;
 
 		if (start) {
 			curp->line = lnn;
 			curp->reparse_count = 0;
 
 			if (lnn < 3 &&
 			    curp->filenc & MPARSE_UTF8 &&
 			    curp->filenc & MPARSE_LATIN1)
 				curp->filenc = preconv_cue(&blk, i);
 		}
 
 		while (i < blk.sz && (start || blk.buf[i] != '\0')) {
 
 			/*
 			 * When finding an unescaped newline character,
 			 * leave the character loop to process the line.
 			 * Skip a preceding carriage return, if any.
 			 */
 
 			if ('\r' == blk.buf[i] && i + 1 < blk.sz &&
 			    '\n' == blk.buf[i + 1])
 				++i;
 			if ('\n' == blk.buf[i]) {
 				++i;
 				++lnn;
 				break;
 			}
 
 			/*
 			 * Make sure we have space for the worst
 			 * case of 11 bytes: "\\[u10ffff]\0"
 			 */
 
 			if (pos + 11 > ln.sz)
 				resize_buf(&ln, 256);
 
 			/*
 			 * Encode 8-bit input.
 			 */
 
 			c = blk.buf[i];
 			if (c & 0x80) {
 				if ( ! (curp->filenc && preconv_encode(
 				    &blk, &i, &ln, &pos, &curp->filenc))) {
 					mandoc_vmsg(MANDOCERR_BADCHAR,
 					    curp, curp->line, pos,
 					    "0x%x", c);
 					ln.buf[pos++] = '?';
 					i++;
 				}
 				continue;
 			}
 
 			/*
 			 * Exclude control characters.
 			 */
 
 			if (c == 0x7f || (c < 0x20 && c != 0x09)) {
 				mandoc_vmsg(MANDOCERR_BADCHAR, curp,
 				    curp->line, pos, "0x%x", c);
 				i++;
 				ln.buf[pos++] = '?';
 				continue;
 			}
 
 			/* Trailing backslash = a plain char. */
 
 			if (blk.buf[i] != '\\' || i + 1 == blk.sz) {
 				ln.buf[pos++] = blk.buf[i++];
 				continue;
 			}
 
 			/*
 			 * Found escape and at least one other character.
 			 * When it's a newline character, skip it.
 			 * When there is a carriage return in between,
 			 * skip that one as well.
 			 */
 
 			if ('\r' == blk.buf[i + 1] && i + 2 < blk.sz &&
 			    '\n' == blk.buf[i + 2])
 				++i;
 			if ('\n' == blk.buf[i + 1]) {
 				i += 2;
 				++lnn;
 				continue;
 			}
 
 			if ('"' == blk.buf[i + 1] || '#' == blk.buf[i + 1]) {
 				i += 2;
 				/* Comment, skip to end of line */
 				for (; i < blk.sz; ++i) {
 					if ('\n' == blk.buf[i]) {
 						++i;
 						++lnn;
 						break;
 					}
 				}
 
 				/* Backout trailing whitespaces */
 				for (; pos > 0; --pos) {
 					if (ln.buf[pos - 1] != ' ')
 						break;
 					if (pos > 2 && ln.buf[pos - 2] == '\\')
 						break;
 				}
 				break;
 			}
 
 			/* Catch escaped bogus characters. */
 
 			c = (unsigned char) blk.buf[i+1];
 
 			if ( ! (isascii(c) &&
 			    (isgraph(c) || isblank(c)))) {
 				mandoc_vmsg(MANDOCERR_BADCHAR, curp,
 				    curp->line, pos, "0x%x", c);
 				i += 2;
 				ln.buf[pos++] = '?';
 				continue;
 			}
 
 			/* Some other escape sequence, copy & cont. */
 
 			ln.buf[pos++] = blk.buf[i++];
 			ln.buf[pos++] = blk.buf[i++];
 		}
 
 		if (pos >= ln.sz)
 			resize_buf(&ln, 256);
 
 		ln.buf[pos] = '\0';
 
 		/*
 		 * A significant amount of complexity is contained by
 		 * the roff preprocessor.  It's line-oriented but can be
 		 * expressed on one line, so we need at times to
 		 * readjust our starting point and re-run it.  The roff
 		 * preprocessor can also readjust the buffers with new
 		 * data, so we pass them in wholesale.
 		 */
 
 		of = 0;
 
 		/*
 		 * Maintain a lookaside buffer of all parsed lines.  We
 		 * only do this if mparse_keep() has been invoked (the
 		 * buffer may be accessed with mparse_getkeep()).
 		 */
 
 		if (curp->secondary) {
 			curp->secondary->buf = mandoc_realloc(
 			    curp->secondary->buf,
 			    curp->secondary->sz + pos + 2);
 			memcpy(curp->secondary->buf +
 			    curp->secondary->sz,
 			    ln.buf, pos);
 			curp->secondary->sz += pos;
 			curp->secondary->buf
 				[curp->secondary->sz] = '\n';
 			curp->secondary->sz++;
 			curp->secondary->buf
 				[curp->secondary->sz] = '\0';
 		}
 rerun:
 		rr = roff_parseln(curp->roff, curp->line, &ln, &of);
 
 		switch (rr) {
 		case ROFF_REPARSE:
 			if (REPARSE_LIMIT >= ++curp->reparse_count)
 				mparse_buf_r(curp, ln, of, 0);
 			else
 				mandoc_msg(MANDOCERR_ROFFLOOP, curp,
 				    curp->line, pos, NULL);
 			pos = 0;
 			continue;
 		case ROFF_APPEND:
 			pos = strlen(ln.buf);
 			continue;
 		case ROFF_RERUN:
 			goto rerun;
 		case ROFF_IGN:
 			pos = 0;
 			continue;
 		case ROFF_ERR:
 			assert(MANDOCLEVEL_FATAL <= curp->file_status);
 			break;
 		case ROFF_SO:
 			if ( ! (curp->options & MPARSE_SO) &&
 			    (i >= blk.sz || blk.buf[i] == '\0')) {
 				curp->sodest = mandoc_strdup(ln.buf + of);
 				free(ln.buf);
 				return;
 			}
 			/*
 			 * We remove `so' clauses from our lookaside
 			 * buffer because we're going to descend into
 			 * the file recursively.
 			 */
 			if (curp->secondary)
 				curp->secondary->sz -= pos + 1;
 			mparse_readfd(curp, -1, ln.buf + of);
 			if (MANDOCLEVEL_FATAL <= curp->file_status) {
 				mandoc_vmsg(MANDOCERR_SO_FAIL,
 				    curp, curp->line, pos,
 				    ".so %s", ln.buf + of);
 				break;
 			}
 			pos = 0;
 			continue;
 		default:
 			break;
 		}
 
 		/*
 		 * If we encounter errors in the recursive parse, make
 		 * sure we don't continue parsing.
 		 */
 
 		if (MANDOCLEVEL_FATAL <= curp->file_status)
 			break;
 
 		/*
 		 * If input parsers have not been allocated, do so now.
 		 * We keep these instanced between parsers, but set them
 		 * locally per parse routine since we can use different
 		 * parsers with each one.
 		 */
 
 		if ( ! (curp->man || curp->mdoc))
 			choose_parser(curp);
 
 		/*
 		 * Lastly, push down into the parsers themselves.
 		 * If libroff returns ROFF_TBL, then add it to the
 		 * currently open parse.  Since we only get here if
 		 * there does exist data (see tbl_data.c), we're
 		 * guaranteed that something's been allocated.
 		 * Do the same for ROFF_EQN.
 		 */
 
 		if (rr == ROFF_TBL) {
 			while ((span = roff_span(curp->roff)) != NULL)
 				if (curp->man == NULL)
 					mdoc_addspan(curp->mdoc, span);
 				else
 					man_addspan(curp->man, span);
 		} else if (rr == ROFF_EQN) {
 			if (curp->man == NULL)
 				mdoc_addeqn(curp->mdoc, roff_eqn(curp->roff));
 			else
 				man_addeqn(curp->man, roff_eqn(curp->roff));
 		} else if ((curp->man == NULL ?
 		    mdoc_parseln(curp->mdoc, curp->line, ln.buf, of) :
 		    man_parseln(curp->man, curp->line, ln.buf, of)) == 2)
 				break;
 
 		/* Temporary buffers typically are not full. */
 
 		if (0 == start && '\0' == blk.buf[i])
 			break;
 
 		/* Start the next input line. */
 
 		pos = 0;
 	}
 
 	free(ln.buf);
 }
 
 static int
 read_whole_file(struct mparse *curp, const char *file, int fd,
 		struct buf *fb, int *with_mmap)
 {
 	size_t		 off;
 	ssize_t		 ssz;
 
 #if HAVE_MMAP
 	struct stat	 st;
 	if (-1 == fstat(fd, &st)) {
 		curp->file_status = MANDOCLEVEL_SYSERR;
 		if (curp->mmsg)
 			(*curp->mmsg)(MANDOCERR_SYSSTAT, curp->file_status,
 			    file, 0, 0, strerror(errno));
 		return(0);
 	}
 
 	/*
 	 * If we're a regular file, try just reading in the whole entry
 	 * via mmap().  This is faster than reading it into blocks, and
 	 * since each file is only a few bytes to begin with, I'm not
 	 * concerned that this is going to tank any machines.
 	 */
 
 	if (S_ISREG(st.st_mode)) {
 		if (st.st_size >= (1U << 31)) {
 			curp->file_status = MANDOCLEVEL_FATAL;
 			if (curp->mmsg)
 				(*curp->mmsg)(MANDOCERR_TOOLARGE,
 				    curp->file_status, file, 0, 0, NULL);
 			return(0);
 		}
 		*with_mmap = 1;
 		fb->sz = (size_t)st.st_size;
 		fb->buf = mmap(NULL, fb->sz, PROT_READ, MAP_SHARED, fd, 0);
 		if (fb->buf != MAP_FAILED)
 			return(1);
 	}
 #endif
 
 	/*
 	 * If this isn't a regular file (like, say, stdin), then we must
 	 * go the old way and just read things in bit by bit.
 	 */
 
 	*with_mmap = 0;
 	off = 0;
 	fb->sz = 0;
 	fb->buf = NULL;
 	for (;;) {
 		if (off == fb->sz) {
 			if (fb->sz == (1U << 31)) {
 				curp->file_status = MANDOCLEVEL_FATAL;
 				if (curp->mmsg)
 					(*curp->mmsg)(MANDOCERR_TOOLARGE,
 					    curp->file_status,
 					    file, 0, 0, NULL);
 				break;
 			}
 			resize_buf(fb, 65536);
 		}
 		ssz = read(fd, fb->buf + (int)off, fb->sz - off);
 		if (ssz == 0) {
 			fb->sz = off;
 			return(1);
 		}
 		if (ssz == -1) {
 			curp->file_status = MANDOCLEVEL_SYSERR;
 			if (curp->mmsg)
 				(*curp->mmsg)(MANDOCERR_SYSREAD,
 				    curp->file_status, file, 0, 0,
 				    strerror(errno));
 			break;
 		}
 		off += (size_t)ssz;
 	}
 
 	free(fb->buf);
 	fb->buf = NULL;
 	return(0);
 }
 
 static void
 mparse_end(struct mparse *curp)
 {
 
 	if (MANDOCLEVEL_FATAL <= curp->file_status)
 		return;
 
 	if (curp->mdoc == NULL &&
 	    curp->man == NULL &&
 	    curp->sodest == NULL) {
 		if (curp->options & MPARSE_MDOC)
 			curp->mdoc = curp->pmdoc;
 		else {
 			if (curp->pman == NULL)
 				curp->pman = man_alloc(curp->roff, curp,
 				    curp->options & MPARSE_QUICK ? 1 : 0);
 			curp->man = curp->pman;
 		}
 	}
 
 	if (curp->mdoc && ! mdoc_endparse(curp->mdoc)) {
 		assert(MANDOCLEVEL_FATAL <= curp->file_status);
 		return;
 	}
 
 	if (curp->man && ! man_endparse(curp->man)) {
 		assert(MANDOCLEVEL_FATAL <= curp->file_status);
 		return;
 	}
 
 	roff_endparse(curp->roff);
 }
 
 static void
 mparse_parse_buffer(struct mparse *curp, struct buf blk, const char *file)
 {
 	struct buf	*svprimary;
 	const char	*svfile;
 	size_t		 offset;
 	static int	 recursion_depth;
 
 	if (64 < recursion_depth) {
 		mandoc_msg(MANDOCERR_ROFFLOOP, curp, curp->line, 0, NULL);
 		return;
 	}
 
 	/* Line number is per-file. */
 	svfile = curp->file;
 	curp->file = file;
 	svprimary = curp->primary;
 	curp->primary = &blk;
 	curp->line = 1;
 	recursion_depth++;
 
 	/* Skip an UTF-8 byte order mark. */
 	if (curp->filenc & MPARSE_UTF8 && blk.sz > 2 &&
 	    (unsigned char)blk.buf[0] == 0xef &&
 	    (unsigned char)blk.buf[1] == 0xbb &&
 	    (unsigned char)blk.buf[2] == 0xbf) {
 		offset = 3;
 		curp->filenc &= ~MPARSE_LATIN1;
 	} else
 		offset = 0;
 
 	mparse_buf_r(curp, blk, offset, 1);
 
 	if (0 == --recursion_depth && MANDOCLEVEL_FATAL > curp->file_status)
 		mparse_end(curp);
 
 	curp->primary = svprimary;
 	curp->file = svfile;
 }
 
 enum mandoclevel
-mparse_readmem(struct mparse *curp, const void *buf, size_t len,
+mparse_readmem(struct mparse *curp, void *buf, size_t len,
 		const char *file)
 {
 	struct buf blk;
 
-	blk.buf = UNCONST(buf);
+	blk.buf = buf;
 	blk.sz = len;
 
 	mparse_parse_buffer(curp, blk, file);
 	return(curp->file_status);
 }
 
 /*
  * If a file descriptor is given, use it and assume it points
  * to the named file.  Otherwise, open the named file.
  * Read the whole file into memory and call the parsers.
  * Called recursively when an .so request is encountered.
  */
 enum mandoclevel
 mparse_readfd(struct mparse *curp, int fd, const char *file)
 {
 	struct buf	 blk;
 	int		 with_mmap;
 	int		 save_filenc;
 	pid_t		 save_child;
 
 	save_child = curp->child;
 	if (fd != -1)
 		curp->child = 0;
 	else if (mparse_open(curp, &fd, file) >= MANDOCLEVEL_SYSERR)
 		goto out;
 
 	if (read_whole_file(curp, file, fd, &blk, &with_mmap)) {
 		save_filenc = curp->filenc;
 		curp->filenc = curp->options &
 		    (MPARSE_UTF8 | MPARSE_LATIN1);
 		mparse_parse_buffer(curp, blk, file);
 		curp->filenc = save_filenc;
 #if HAVE_MMAP
 		if (with_mmap)
 			munmap(blk.buf, blk.sz);
 		else
 #endif
 			free(blk.buf);
 	}
 
 	if (fd != STDIN_FILENO && close(fd) == -1)
 		perror(file);
 
 	mparse_wait(curp);
 out:
 	curp->child = save_child;
 	return(curp->file_status);
 }
 
 enum mandoclevel
 mparse_open(struct mparse *curp, int *fd, const char *file)
 {
 	int		  pfd[2];
 	int		  save_errno;
 	char		 *cp;
 	enum mandocerr	  err;
 
 	pfd[1] = -1;
 	curp->file = file;
 
 	/* Unless zipped, try to just open the file. */
 
 	if ((cp = strrchr(file, '.')) == NULL ||
 	    strcmp(cp + 1, "gz")) {
 		curp->child = 0;
 		if ((*fd = open(file, O_RDONLY)) != -1)
 			return(MANDOCLEVEL_OK);
 
 		/* Open failed; try to append ".gz". */
 
 		mandoc_asprintf(&cp, "%s.gz", file);
 		file = cp;
 	} else
 		cp = NULL;
 
 	/* Before forking, make sure the file can be read. */
 
 	save_errno = errno;
 	if (access(file, R_OK) == -1) {
 		if (cp != NULL)
 			errno = save_errno;
 		err = MANDOCERR_SYSOPEN;
 		goto out;
 	}
 
 	/* Run gunzip(1). */
 
 	if (pipe(pfd) == -1) {
 		err = MANDOCERR_SYSPIPE;
 		goto out;
 	}
 
 	switch (curp->child = fork()) {
 	case -1:
 		err = MANDOCERR_SYSFORK;
 		close(pfd[0]);
 		close(pfd[1]);
 		pfd[1] = -1;
 		break;
 	case 0:
 		close(pfd[0]);
 		if (dup2(pfd[1], STDOUT_FILENO) == -1) {
 			err = MANDOCERR_SYSDUP;
 			break;
 		}
 		execlp("gunzip", "gunzip", "-c", file, NULL);
 		err = MANDOCERR_SYSEXEC;
 		break;
 	default:
 		close(pfd[1]);
 		*fd = pfd[0];
 		return(MANDOCLEVEL_OK);
 	}
 
 out:
 	free(cp);
 	*fd = -1;
 	curp->child = 0;
 	curp->file_status = MANDOCLEVEL_SYSERR;
 	if (curp->mmsg)
 		(*curp->mmsg)(err, curp->file_status, curp->file,
 		    0, 0, strerror(errno));
 	if (pfd[1] != -1)
 		exit(1);
 	return(curp->file_status);
 }
 
 enum mandoclevel
 mparse_wait(struct mparse *curp)
 {
 	int	  status;
 
 	if (curp->child == 0)
 		return(MANDOCLEVEL_OK);
 
 	if (waitpid(curp->child, &status, 0) == -1) {
 		mandoc_msg(MANDOCERR_SYSWAIT, curp, 0, 0,
 		    strerror(errno));
 		curp->file_status = MANDOCLEVEL_SYSERR;
 		return(curp->file_status);
 	}
 	if (WIFSIGNALED(status)) {
 		mandoc_vmsg(MANDOCERR_SYSSIG, curp, 0, 0,
 		    "%d", WTERMSIG(status));
 		curp->file_status = MANDOCLEVEL_SYSERR;
 		return(curp->file_status);
 	}
 	if (WEXITSTATUS(status)) {
 		mandoc_vmsg(MANDOCERR_SYSEXIT, curp, 0, 0,
 		    "%d", WEXITSTATUS(status));
 		curp->file_status = MANDOCLEVEL_SYSERR;
 		return(curp->file_status);
 	}
 	return(MANDOCLEVEL_OK);
 }
 
 struct mparse *
 mparse_alloc(int options, enum mandoclevel wlevel, mandocmsg mmsg,
     const struct mchars *mchars, const char *defos)
 {
 	struct mparse	*curp;
 
 	assert(wlevel <= MANDOCLEVEL_FATAL);
 
 	curp = mandoc_calloc(1, sizeof(struct mparse));
 
 	curp->options = options;
 	curp->wlevel = wlevel;
 	curp->mmsg = mmsg;
 	curp->defos = defos;
 
 	curp->mchars = mchars;
 	curp->roff = roff_alloc(curp, curp->mchars, options);
 	if (curp->options & MPARSE_MDOC)
 		curp->pmdoc = mdoc_alloc(
 		    curp->roff, curp, curp->defos,
 		    curp->options & MPARSE_QUICK ? 1 : 0);
 	if (curp->options & MPARSE_MAN)
 		curp->pman = man_alloc(curp->roff, curp,
 		    curp->options & MPARSE_QUICK ? 1 : 0);
 
 	return(curp);
 }
 
 void
 mparse_reset(struct mparse *curp)
 {
 
 	roff_reset(curp->roff);
 
 	if (curp->mdoc)
 		mdoc_reset(curp->mdoc);
 	if (curp->man)
 		man_reset(curp->man);
 	if (curp->secondary)
 		curp->secondary->sz = 0;
 
 	curp->file_status = MANDOCLEVEL_OK;
 	curp->mdoc = NULL;
 	curp->man = NULL;
 
 	free(curp->sodest);
 	curp->sodest = NULL;
 }
 
 void
 mparse_free(struct mparse *curp)
 {
 
 	if (curp->pmdoc)
 		mdoc_free(curp->pmdoc);
 	if (curp->pman)
 		man_free(curp->pman);
 	if (curp->roff)
 		roff_free(curp->roff);
 	if (curp->secondary)
 		free(curp->secondary->buf);
 
 	free(curp->secondary);
 	free(curp->sodest);
 	free(curp);
 }
 
 void
 mparse_result(struct mparse *curp,
 	struct mdoc **mdoc, struct man **man, char **sodest)
 {
 
 	if (sodest && NULL != (*sodest = curp->sodest)) {
 		*mdoc = NULL;
 		*man = NULL;
 		return;
 	}
 	if (mdoc)
 		*mdoc = curp->mdoc;
 	if (man)
 		*man = curp->man;
 }
 
 void
 mandoc_vmsg(enum mandocerr t, struct mparse *m,
 		int ln, int pos, const char *fmt, ...)
 {
 	char		 buf[256];
 	va_list		 ap;
 
 	va_start(ap, fmt);
 	(void)vsnprintf(buf, sizeof(buf), fmt, ap);
 	va_end(ap);
 
 	mandoc_msg(t, m, ln, pos, buf);
 }
 
 void
 mandoc_msg(enum mandocerr er, struct mparse *m,
 		int ln, int col, const char *msg)
 {
 	enum mandoclevel level;
 
 	level = MANDOCLEVEL_FATAL;
 	while (er < mandoclimits[level])
 		level--;
 
 	if (level < m->wlevel)
 		return;
 
 	if (m->mmsg)
 		(*m->mmsg)(er, level, m->file, ln, col, msg);
 
 	if (m->file_status < level)
 		m->file_status = level;
 }
 
 const char *
 mparse_strerror(enum mandocerr er)
 {
 
 	return(mandocerrs[er]);
 }
 
 const char *
 mparse_strlevel(enum mandoclevel lvl)
 {
 	return(mandoclevels[lvl]);
 }
 
 void
 mparse_keep(struct mparse *p)
 {
 
 	assert(NULL == p->secondary);
 	p->secondary = mandoc_calloc(1, sizeof(struct buf));
 }
 
 const char *
 mparse_getkeep(const struct mparse *p)
 {
 
 	assert(p->secondary);
 	return(p->secondary->sz ? p->secondary->buf : NULL);
 }
Index: projects/arm_intrng/contrib/mdocml/roff.7
===================================================================
--- projects/arm_intrng/contrib/mdocml/roff.7	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/roff.7	(revision 276248)
@@ -1,1442 +1,1444 @@
-.\"	$Id: roff.7,v 1.59 2014/11/19 01:20:25 schwarze Exp $
+.\"	$Id: roff.7,v 1.60 2014/12/02 10:08:06 schwarze Exp $
 .\"
 .\" Copyright (c) 2010, 2011, 2012 Kristaps Dzonsons 
 .\" Copyright (c) 2010, 2011, 2013, 2014 Ingo Schwarze 
 .\"
 .\" Permission to use, copy, modify, and distribute this software for any
 .\" purpose with or without fee is hereby granted, provided that the above
 .\" copyright notice and this permission notice appear in all copies.
 .\"
 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: November 19 2014 $
+.Dd $Mdocdate: December 2 2014 $
 .Dt ROFF 7
 .Os
 .Sh NAME
 .Nm roff
 .Nd roff language reference for mandoc
 .Sh DESCRIPTION
 The
 .Nm roff
 language is a general purpose text formatting language.
 Since traditional implementations of the
 .Xr mdoc 7
 and
 .Xr man 7
 manual formatting languages are based on it,
 many real-world manuals use small numbers of
 .Nm
 requests and escape sequences intermixed with their
 .Xr mdoc 7
 or
 .Xr man 7
 code.
 To properly format such manuals, the
 .Xr mandoc 1
 utility supports a tiny subset of
 .Nm
 requests and escapes.
 Only these requests and escapes supported by
 .Xr mandoc 1
 are documented in the present manual,
 together with the basic language syntax shared by
 .Nm ,
 .Xr mdoc 7 ,
 and
 .Xr man 7 .
 For complete
 .Nm
 manuals, consult the
 .Sx SEE ALSO
 section.
 .Pp
 Input lines beginning with the control character
 .Sq \&.
 are parsed for requests and macros.
 Such lines are called
 .Dq request lines
 or
 .Dq macro lines ,
 respectively.
 Requests change the processing state and manipulate the formatting;
 some macros also define the document structure and produce formatted
 output.
 The single quote
 .Pq Qq \(aq
 is accepted as an alternative control character,
 treated by
 .Xr mandoc 1
 just like
 .Ql \&.
 .Pp
 Lines not beginning with control characters are called
 .Dq text lines .
 They provide free-form text to be printed; the formatting of the text
 depends on the respective processing context.
 .Sh LANGUAGE SYNTAX
 .Nm
 documents may contain only graphable 7-bit ASCII characters, the space
 character, and, in certain circumstances, the tab character.
 The backslash character
 .Sq \e
 indicates the start of an escape sequence, used for example for
 .Sx Comments ,
 .Sx Special Characters ,
 .Sx Predefined Strings ,
 and
 user-defined strings defined using the
 .Sx ds
 request.
 For a listing of escape sequences, consult the
 .Sx ESCAPE SEQUENCE REFERENCE
 below.
 .Ss Comments
 Text following an escaped double-quote
 .Sq \e\(dq ,
 whether in a request, macro, or text line, is ignored to the end of the line.
 A request line beginning with a control character and comment escape
 .Sq \&.\e\(dq
 is also ignored.
 Furthermore, request lines with only a control character and optional
 trailing whitespace are stripped from input.
 .Pp
 Examples:
 .Bd -literal -offset indent -compact
 \&.\e\(dq This is a comment line.
 \&.\e\(dq The next line is ignored:
 \&.
 \&.Sh EXAMPLES \e\(dq This is a comment, too.
 \&example text \e\(dq And so is this.
 .Ed
 .Ss Special Characters
 Special characters are used to encode special glyphs and are rendered
 differently across output media.
 They may occur in request, macro, and text lines.
 Sequences begin with the escape character
 .Sq \e
 followed by either an open-parenthesis
 .Sq \&(
 for two-character sequences; an open-bracket
 .Sq \&[
 for n-character sequences (terminated at a close-bracket
 .Sq \&] ) ;
 or a single one character sequence.
 .Pp
 Examples:
 .Bl -tag -width Ds -offset indent -compact
 .It Li \e(em
 Two-letter em dash escape.
 .It Li \ee
 One-letter backslash escape.
 .El
 .Pp
 See
 .Xr mandoc_char 7
 for a complete list.
 .Ss Text Decoration
 Terms may be text-decorated using the
 .Sq \ef
 escape followed by an indicator: B (bold), I (italic), R (regular), or P
 (revert to previous mode).
 A numerical representation 3, 2, or 1 (bold, italic, and regular,
 respectively) may be used instead.
 The indicator or numerical representative may be preceded by C
 (constant-width), which is ignored.
 .Pp
 The two-character indicator
 .Sq BI
 requests a font that is both bold and italic.
 It may not be portable to old roff implementations.
 .Pp
 Examples:
 .Bl -tag -width Ds -offset indent -compact
 .It Li \efBbold\efR
 Write in \fBbold\fP, then switch to regular font mode.
 .It Li \efIitalic\efP
 Write in \fIitalic\fP, then return to previous font mode.
 .It Li \ef(BIbold italic\efP
 Write in \f(BIbold italic\fP, then return to previous font mode.
 .El
 .Pp
 Text decoration is
 .Em not
 recommended for
 .Xr mdoc 7 ,
 which encourages semantic annotation.
 .Ss Predefined Strings
 Predefined strings, like
 .Sx Special Characters ,
 mark special output glyphs.
 Predefined strings are escaped with the slash-asterisk,
 .Sq \e* :
 single-character
 .Sq \e*X ,
 two-character
 .Sq \e*(XX ,
 and N-character
 .Sq \e*[N] .
 .Pp
 Examples:
 .Bl -tag -width Ds -offset indent -compact
 .It Li \e*(Am
 Two-letter ampersand predefined string.
 .It Li \e*q
 One-letter double-quote predefined string.
 .El
 .Pp
 Predefined strings are not recommended for use,
 as they differ across implementations.
 Those supported by
 .Xr mandoc 1
 are listed in
 .Xr mandoc_char 7 .
 Manuals using these predefined strings are almost certainly not portable.
 .Ss Whitespace
 Whitespace consists of the space character.
 In text lines, whitespace is preserved within a line.
 In request and macro lines, whitespace delimits arguments and is discarded.
 .Pp
 Unescaped trailing spaces are stripped from text line input unless in a
 literal context.
 In general, trailing whitespace on any input line is discouraged for
 reasons of portability.
 In the rare case that a blank character is needed at the end of an
 input line, it may be forced by
 .Sq \e\ \e& .
 .Pp
 Literal space characters can be produced in the output
 using escape sequences.
 In macro lines, they can also be included in arguments using quotation; see
 .Sx MACRO SYNTAX
 for details.
 .Pp
 Blank text lines, which may include whitespace, are only permitted
 within literal contexts.
 If the first character of a text line is a space, that line is printed
 with a leading newline.
 .Ss Scaling Widths
 Many requests and macros support scaled widths for their arguments.
 The syntax for a scaled width is
 .Sq Li [+-]?[0-9]*.[0-9]*[:unit:] ,
 where a decimal must be preceded or followed by at least one digit.
 Negative numbers, while accepted, are truncated to zero.
 .Pp
 The following scaling units are accepted:
 .Pp
 .Bl -tag -width Ds -offset indent -compact
 .It c
 centimetre
 .It i
 inch
 .It P
 pica (~1/6 inch)
 .It p
 point (~1/72 inch)
 .It f
 scale
 .Sq u
 by 65536
 .It v
 default vertical span
 .It m
 width of rendered
 .Sq m
 .Pq em
 character
 .It n
 width of rendered
 .Sq n
 .Pq en
 character
 .It u
 default horizontal span for the terminal
 .It M
 mini-em (~1/100 em)
 .El
 .Pp
 Using anything other than
 .Sq m ,
 .Sq n ,
 or
 .Sq v
 is necessarily non-portable across output media.
 See
 .Sx COMPATIBILITY .
 .Pp
 If a scaling unit is not provided, the numerical value is interpreted
 under the default rules of
 .Sq v
 for vertical spaces and
 .Sq u
 for horizontal ones.
 .Pp
 Examples:
 .Bl -tag -width ".Bl -tag -width 2i" -offset indent -compact
 .It Li \&.Bl -tag -width 2i
 two-inch tagged list indentation in
 .Xr mdoc 7
 .It Li \&.HP 2i
 two-inch tagged list indentation in
 .Xr man 7
 .It Li \&.sp 2v
 two vertical spaces
 .El
 .Ss Sentence Spacing
 Each sentence should terminate at the end of an input line.
 By doing this, a formatter will be able to apply the proper amount of
 spacing after the end of sentence (unescaped) period, exclamation mark,
 or question mark followed by zero or more non-sentence closing
 delimiters
 .Po
 .Sq \&) ,
 .Sq \&] ,
 .Sq \&' ,
 .Sq \&"
 .Pc .
 .Pp
 The proper spacing is also intelligently preserved if a sentence ends at
 the boundary of a macro line.
 .Pp
 Examples:
 .Bd -literal -offset indent -compact
 Do not end sentences mid-line like this.  Instead,
 end a sentence like this.
 A macro would end like this:
 \&.Xr mandoc 1 \&.
 .Ed
 .Sh REQUEST SYNTAX
 A request or macro line consists of:
 .Pp
 .Bl -enum -compact
 .It
 the control character
 .Sq \&.
 or
 .Sq \(aq
 at the beginning of the line,
 .It
 optionally an arbitrary amount of whitespace,
 .It
 the name of the request or the macro, which is one word of arbitrary
 length, terminated by whitespace,
 .It
 and zero or more arguments delimited by whitespace.
 .El
 .Pp
 Thus, the following request lines are all equivalent:
 .Bd -literal -offset indent
 \&.ig end
 \&.ig    end
 \&.   ig end
 .Ed
 .Sh MACRO SYNTAX
 Macros are provided by the
 .Xr mdoc 7
 and
 .Xr man 7
 languages and can be defined by the
 .Sx \&de
 request.
 When called, they follow the same syntax as requests, except that
 macro arguments may optionally be quoted by enclosing them
 in double quote characters
 .Pq Sq \(dq .
 Quoted text, even if it contains whitespace or would cause
 a macro invocation when unquoted, is always considered literal text.
 Inside quoted text, pairs of double quote characters
 .Pq Sq Qq
 resolve to single double quote characters.
 .Pp
 To be recognised as the beginning of a quoted argument, the opening
 quote character must be preceded by a space character.
 A quoted argument extends to the next double quote character that is not
 part of a pair, or to the end of the input line, whichever comes earlier.
 Leaving out the terminating double quote character at the end of the line
 is discouraged.
 For clarity, if more arguments follow on the same input line,
 it is recommended to follow the terminating double quote character
 by a space character; in case the next character after the terminating
 double quote character is anything else, it is regarded as the beginning
 of the next, unquoted argument.
 .Pp
 Both in quoted and unquoted arguments, pairs of backslashes
 .Pq Sq \e\e
 resolve to single backslashes.
 In unquoted arguments, space characters can alternatively be included
 by preceding them with a backslash
 .Pq Sq \e\~ ,
 but quoting is usually better for clarity.
 .Pp
 Examples:
 .Bl -tag -width Ds -offset indent -compact
 .It Li .Fn strlen \(dqconst char *s\(dq
 Group arguments
 .Qq const char *s
 into one function argument.
 If unspecified,
 .Qq const ,
 .Qq char ,
 and
 .Qq *s
 would be considered separate arguments.
 .It Li .Op \(dqFl a\(dq
 Consider
 .Qq \&Fl a
 as literal text instead of a flag macro.
 .El
 .Sh REQUEST REFERENCE
 The
 .Xr mandoc 1
 .Nm
 parser recognises the following requests.
 Note that the
 .Nm
 language defines many more requests not implemented in
 .Xr mandoc 1 .
 .Ss \&ad
 Set line adjustment mode.
 This line-scoped request is intended to have one argument to select
 normal, left, right, or centre adjustment for subsequent text.
 Currently, it is ignored including its arguments,
 and the number of arguments is not checked.
 .Ss \&am
 Append to a macro definition.
 The syntax of this request is the same as that of
 .Sx \&de .
 .Ss \&ami
 Append to a macro definition, specifying the macro name indirectly.
 The syntax of this request is the same as that of
 .Sx \&dei .
 .Ss \&am1
 Append to a macro definition, switching roff compatibility mode off
 during macro execution.
 The syntax of this request is the same as that of
 .Sx \&de1 .
 Since
 .Xr mandoc 1
 does not implement
 .Nm
 compatibility mode at all, it handles this request as an alias for
 .Sx \&am .
 .Ss \&as
 Append to a user-defined string.
 The syntax of this request is the same as that of
 .Sx \&ds .
 If a user-defined string with the specified name does not yet exist,
 it is set to the empty string before appending.
 .Ss \&cc
 Changes the control character.
 Its syntax is as follows:
 .Bd -literal -offset indent
 .Pf . Cm \&cc Op Ar c
 .Ed
 .Pp
 If
 .Ar c
 is not specified, the control character is reset to
 .Sq \&. .
 Trailing characters are ignored.
 .Ss \&ce
 Center some lines.
 This line-scoped request is intended to take one integer argument,
 specifying how many lines to center.
 Currently, it is ignored including its arguments, and the number
 of arguments is not checked.
 .Ss \&de
 Define a
 .Nm
 macro.
 Its syntax can be either
 .Bd -literal -offset indent
 .Pf . Cm \&de Ar name
 .Ar macro definition
 \&..
 .Ed
 .Pp
 or
 .Bd -literal -offset indent
 .Pf . Cm \&de Ar name Ar end
 .Ar macro definition
 .Pf . Ar end
 .Ed
 .Pp
 Both forms define or redefine the macro
 .Ar name
 to represent the
 .Ar macro definition ,
 which may consist of one or more input lines, including the newline
 characters terminating each line, optionally containing calls to
 .Nm
 requests,
 .Nm
 macros or high-level macros like
 .Xr man 7
 or
 .Xr mdoc 7
 macros, whichever applies to the document in question.
 .Pp
 Specifying a custom
 .Ar end
 macro works in the same way as for
 .Sx \&ig ;
 namely, the call to
 .Sq Pf . Ar end
 first ends the
 .Ar macro definition ,
 and after that, it is also evaluated as a
 .Nm
 request or
 .Nm
 macro, but not as a high-level macro.
 .Pp
 The macro can be invoked later using the syntax
 .Pp
 .D1 Pf . Ar name Op Ar argument Op Ar argument ...
 .Pp
 Regarding argument parsing, see
 .Sx MACRO SYNTAX
 above.
 .Pp
 The line invoking the macro will be replaced
 in the input stream by the
 .Ar macro definition ,
 replacing all occurrences of
 .No \e\e$ Ns Ar N ,
 where
 .Ar N
 is a digit, by the
 .Ar N Ns th Ar argument .
 For example,
 .Bd -literal -offset indent
 \&.de ZN
 \efI\e^\e\e$1\e^\efP\e\e$2
 \&..
 \&.ZN XtFree .
 .Ed
 .Pp
 produces
 .Pp
 .D1 \efI\e^XtFree\e^\efP.
 .Pp
 in the input stream, and thus in the output: \fI\^XtFree\^\fP.
 .Pp
 Since macros and user-defined strings share a common string table,
 defining a macro
 .Ar name
 clobbers the user-defined string
 .Ar name ,
 and the
 .Ar macro definition
 can also be printed using the
 .Sq \e*
 string interpolation syntax described below
 .Sx ds ,
 but this is rarely useful because every macro definition contains at least
 one explicit newline character.
 .Pp
 In order to prevent endless recursion, both groff and
 .Xr mandoc 1
 limit the stack depth for expanding macros and strings
 to a large, but finite number.
 Do not rely on the exact value of this limit.
 .Ss \&dei
 Define a
 .Nm
 macro, specifying the macro name indirectly.
 The syntax of this request is the same as that of
 .Sx \&de .
 The request
 .Pp
 .D1 Pf . Cm \&dei Ar name Op Ar end
 .Pp
 has the same effect as:
 .Pp
 .D1 Pf . Cm \&de No \e* Ns Bo Ar name Bc Op \e* Ns Bq Ar end
 .Ss \&de1
 Define a
 .Nm
 macro that will be executed with
 .Nm
 compatibility mode switched off during macro execution.
 This is a GNU extension not available in traditional
 .Nm
 implementations and not even in older versions of groff.
 Since
 .Xr mandoc 1
 does not implement
 .Nm
 compatibility mode at all, it handles this request as an alias for
 .Sx \&de .
 .Ss \&ds
 Define a user-defined string.
 Its syntax is as follows:
 .Pp
 .D1 Pf . Cm \&ds Ar name Oo \(dq Oc Ns Ar string
 .Pp
 The
 .Ar name
 and
 .Ar string
 arguments are space-separated.
 If the
 .Ar string
 begins with a double-quote character, that character will not be part
 of the string.
 All remaining characters on the input line form the
 .Ar string ,
 including whitespace and double-quote characters, even trailing ones.
 .Pp
 The
 .Ar string
 can be interpolated into subsequent text by using
 .No \e* Ns Bq Ar name
 for a
 .Ar name
 of arbitrary length, or \e*(NN or \e*N if the length of
 .Ar name
 is two or one characters, respectively.
 Interpolation can be prevented by escaping the leading backslash;
 that is, an asterisk preceded by an even number of backslashes
 does not trigger string interpolation.
 .Pp
 Since user-defined strings and macros share a common string table,
 defining a string
 .Ar name
 clobbers the macro
 .Ar name ,
 and the
 .Ar name
 used for defining a string can also be invoked as a macro,
 in which case the following input line will be appended to the
 .Ar string ,
 forming a new input line passed to the
 .Nm
 parser.
 For example,
 .Bd -literal -offset indent
 \&.ds badidea .S
 \&.badidea
 H SYNOPSIS
 .Ed
 .Pp
 invokes the
 .Cm SH
 macro when used in a
 .Xr man 7
 document.
 Such abuse is of course strongly discouraged.
 .Ss \&el
 The
 .Qq else
 half of an if/else conditional.
 Pops a result off the stack of conditional evaluations pushed by
 .Sx \&ie
 and uses it as its conditional.
 If no stack entries are present (e.g., due to no prior
 .Sx \&ie
 calls)
 then false is assumed.
 The syntax of this request is similar to
 .Sx \&if
 except that the conditional is missing.
 .Ss \&EN
 End an equation block.
 See
 .Sx \&EQ .
 .Ss \&EQ
 Begin an equation block.
 See
 .Xr eqn 7
 for a description of the equation language.
 .Ss \&fam
 Change the font family.
 This line-scoped request is intended to have one argument specifying
 the font family to be selected.
 It is a groff extension, and currently, it is ignored including its
 arguments, and the number of arguments is not checked.
 .Ss \&ft
 Change the font.
 Its syntax is as follows:
 .Pp
 .D1 Pf . Cm \&ft Op Ar font
 .Pp
 The following
 .Ar font
 arguments are supported:
 .Bl -tag -width 4n -offset indent
 .It Cm B , BI , 3 , 4
 switches to
 .Sy bold
 font
 .It Cm I , 2
 switches to
 .Em underlined
 font
 .It Cm R , CW , 1
 switches to normal font
 .It Cm P No "or no argument"
 switches back to the previous font
 .El
 .Pp
 This request takes effect only locally, may be overridden by macros
 and escape sequences, and is only supported in
 .Xr man 7
 for now.
 .Ss \&hw
 Specify hyphenation points in words.
 This line-scoped request is currently ignored.
 .Ss \&hy
 Set automatic hyphenation mode.
 This line-scoped request is currently ignored.
 .Ss \&ie
 The
 .Qq if
 half of an if/else conditional.
 The result of the conditional is pushed into a stack used by subsequent
 invocations of
 .Sx \&el ,
 which may be separated by any intervening input (or not exist at all).
 Its syntax is equivalent to
 .Sx \&if .
 .Ss \&if
 Begins a conditional.
 This request has the following syntax:
 .Bd -literal -offset indent
 \&.if COND BODY
 .Ed
 .Bd -literal -offset indent
 \&.if COND \e{BODY
 BODY...\e}
 .Ed
 .Bd -literal -offset indent
 \&.if COND \e{\e
 BODY...
 \&.\e}
 .Ed
 .Pp
 COND is a conditional statement.
 Currently,
 .Xr mandoc 1
 supports the following subset of roff conditionals:
 .Bl -bullet
 .It
 If
 .Sq \&!
 is prefixed to COND, the condition is logically inverted.
 .It
 If the first character of COND is
 .Sq n
 .Pq nroff mode
 or
 .Sq o
 .Pq odd page ,
 COND evaluates to true.
 .It
 If the first character of COND is
 .Sq c
 .Pq character available ,
 .Sq d
 .Pq string defined ,
 .Sq e
 .Pq even page ,
 .Sq r
 .Pq register accessed ,
 .Sq t
 .Pq troff mode ,
 or
 .Sq v
 .Pq vroff mode ,
 COND evaluates to false.
 .It
 If COND starts with a parenthesis or with an optionally signed
 integer number, it is evaluated according to the rules of
 .Sx Numerical expressions
 explained below.
 It evaluates to true if the result is positive,
 or to false if the result is zero or negative.
 .It
 Otherwise, the first character of COND is regarded as a delimiter
 and COND evaluates to true if the string extending from its first
 to its second occurrence is equal to the string extending from its
 second to its third occurrence.
 .It
 If COND cannot be parsed, it evaluates to false.
 .El
 .Pp
 If a conditional is false, its children are not processed, but are
 syntactically interpreted to preserve the integrity of the input
 document.
 Thus,
 .Pp
 .D1 \&.if t .ig
 .Pp
 will discard the
 .Sq \&.ig ,
 which may lead to interesting results, but
 .Pp
 .D1 \&.if t .if t \e{\e
 .Pp
 will continue to syntactically interpret to the block close of the final
 conditional.
 Sub-conditionals, in this case, obviously inherit the truth value of
 the parent.
 .Pp
 If the BODY section is begun by an escaped brace
 .Sq \e{ ,
 scope continues until the end of the input line containing the
 matching closing-brace escape sequence
 .Sq \e} .
 If the BODY is not enclosed in braces, scope continues until
 the end of the line.
 If the COND is followed by a BODY on the same line, whether after a
 brace or not, then requests and macros
 .Em must
 begin with a control character.
 It is generally more intuitive, in this case, to write
 .Bd -literal -offset indent
 \&.if COND \e{\e
 \&.foo
 bar
 \&.\e}
 .Ed
 .Pp
 than having the request or macro follow as
 .Pp
 .D1 \&.if COND \e{ .foo
 .Pp
 The scope of a conditional is always parsed, but only executed if the
 conditional evaluates to true.
 .Pp
 Note that the
 .Sq \e}
 is converted into a zero-width escape sequence if not passed as a
 standalone macro
 .Sq \&.\e} .
 For example,
 .Pp
 .D1 \&.Fl a \e} b
 .Pp
 will result in
 .Sq \e}
 being considered an argument of the
 .Sq \&Fl
 macro.
 .Ss \&ig
 Ignore input.
 Its syntax can be either
 .Bd -literal -offset indent
 .Pf . Cm \&ig
 .Ar ignored text
 \&..
 .Ed
 .Pp
 or
 .Bd -literal -offset indent
 .Pf . Cm \&ig Ar end
 .Ar ignored text
 .Pf . Ar end
 .Ed
 .Pp
 In the first case, input is ignored until a
 .Sq \&..
 request is encountered on its own line.
 In the second case, input is ignored until the specified
 .Sq Pf . Ar end
 macro is encountered.
 Do not use the escape character
 .Sq \e
 anywhere in the definition of
 .Ar end ;
 it would cause very strange behaviour.
 .Pp
 When the
 .Ar end
 macro is a roff request or a roff macro, like in
 .Pp
 .D1 \&.ig if
 .Pp
 the subsequent invocation of
 .Sx \&if
 will first terminate the
 .Ar ignored text ,
 then be invoked as usual.
 Otherwise, it only terminates the
 .Ar ignored text ,
 and arguments following it or the
 .Sq \&..
 request are discarded.
 .Ss \&ll
 Change the output line length.
 Its syntax is as follows:
 .Pp
 .D1 Pf . Cm \&ll Op Oo +|- Oc Ns Ar width
 .Pp
 If the
 .Ar width
 argument is omitted, the line length is reset to its previous value.
 The default setting for terminal output is 78n.
 If a sign is given, the line length is added to or subtracted from;
 otherwise, it is set to the provided value.
 Using this request in new manuals is discouraged for several reasons,
 among others because it overrides the
 .Xr mandoc 1
 .Fl O Cm width
 command line option.
 .Ss \&ne
 Declare the need for the specified minimum vertical space
 before the next trap or the bottom of the page.
 This line-scoped request is currently ignored.
 .Ss \&nh
 Turn off automatic hyphenation mode.
 This line-scoped request is currently ignored.
 .Ss \&nr
 Define or change a register.
 A register is an arbitrary string value that defines some sort of state,
 which influences parsing and/or formatting.
 Its syntax is as follows:
 .Pp
 .D1 Pf \. Cm \&nr Ar name Oo +|- Oc Ns Ar expression
 .Pp
 For the syntax of
 .Ar expression ,
 see
 .Sx Numerical expressions
 below.
 If it is prefixed by a sign, the register will be
 incremented or decremented instead of assigned to.
 .Pp
 The following register
 .Ar name
 is handled specially:
 .Bl -tag -width Ds
 .It Cm nS
 If set to a positive integer value, certain
 .Xr mdoc 7
 macros will behave in the same way as in the
 .Em SYNOPSIS
 section.
 If set to 0, these macros will behave in the same way as outside the
 .Em SYNOPSIS
 section, even when called within the
 .Em SYNOPSIS
 section itself.
 Note that starting a new
 .Xr mdoc 7
 section with the
 .Cm \&Sh
 macro will reset this register.
 .El
 .Ss \&ns
 Turn on no-space mode.
 This line-scoped request is intended to take no arguments.
 Currently, it is ignored including its arguments,
 and the number of arguments is not checked.
 .Ss \&pl
 Change page length.
 This line-scoped request is intended to take one height argument.
 Currently, it is ignored including its arguments,
 and the number of arguments is not checked.
 .Ss \&ps
 Change point size.
 This line-scoped request is intended to take one numerical argument.
 Currently, it is ignored including its arguments,
 and the number of arguments is not checked.
 .Ss \&rm
 Remove a request, macro or string.
 Its syntax is as follows:
 .Pp
 .D1 Pf \. Cm \&rm Ar name
 .Ss \&rr
 Remove a register.
 Its syntax is as follows:
 .Pp
 .D1 Pf \. Cm \&rr Ar name
 .Ss \&so
 Include a source file.
 Its syntax is as follows:
 .Pp
 .D1 Pf \. Cm \&so Ar file
 .Pp
 The
 .Ar file
 will be read and its contents processed as input in place of the
 .Sq \&.so
 request line.
 To avoid inadvertent inclusion of unrelated files,
 .Xr mandoc 1
 only accepts relative paths not containing the strings
 .Qq ../
 and
 .Qq /.. .
 .Pp
 This request requires
 .Xr man 1
 to change to the right directory before calling
 .Xr mandoc 1 ,
 per convention to the root of the manual tree.
 Typical usage looks like:
 .Pp
 .Dl \&.so man3/Xcursor.3
 .Pp
 As the whole concept is rather fragile, the use of
 .Sx \&so
 is discouraged.
 Use
 .Xr ln 1
 instead.
 .Ss \&ta
 Set tab stops.
 This line-scoped request can take an arbitrary number of arguments.
 Currently, it is ignored including its arguments.
 .Ss \&tr
 Output character translation.
 Its syntax is as follows:
 .Pp
 .D1 Pf \. Cm \&tr Ar [ab]+
 .Pp
 Pairs of
 .Ar ab
 characters are replaced
 .Ar ( a
 for
 .Ar b ) .
 Replacement (or origin) characters may also be character escapes; thus,
 .Pp
 .Dl tr \e(xx\e(yy
 .Pp
 replaces all invocations of \e(xx with \e(yy.
 .Ss \&T&
 Re-start a table layout, retaining the options of the prior table
 invocation.
 See
 .Sx \&TS .
 .Ss \&TE
 End a table context.
 See
 .Sx \&TS .
 .Ss \&TS
 Begin a table, which formats input in aligned rows and columns.
 See
 .Xr tbl 7
 for a description of the tbl language.
 .Ss Numerical expressions
 The
 .Sx \&nr ,
 .Sx \&if ,
 and
 .Sx \&ie
 requests accept integer numerical expressions as arguments.
 These are always evaluated using the C
 .Vt int
 type; integer overflow works the same way as in the C language.
 Numbers consist of an arbitrary number of digits
 .Sq 0
 to
 .Sq 9
 prefixed by an optional sign
 .Sq +
 or
 .Sq - .
 .Pp
 The following binary operators are implemented.
 Unless otherwise stated, they behave as in the C language:
 .Pp
 .Bl -tag -width 2n -compact
 .It Ic +
 addition
 .It Ic -
 subtraction
 .It Ic *
 multiplication
 .It Ic /
 division
 .It Ic %
 remainder of division
 .It Ic <
 less than
 .It Ic >
 greater than
 .It Ic ==
 equal to
 .It Ic =
 equal to, same effect as
 .Ic ==
 (this differs from C)
 .It Ic <=
 less than or equal to
 .It Ic >=
 greater than or equal to
 .It Ic <>
 not equal to (corresponds to C
 .Ic != ;
 this one is of limited portability, it is supported by Heirloom roff,
 but not by groff)
 .It Ic &
 logical and (corresponds to C
 .Ic && )
 .It Ic \&:
 logical or (corresponds to C
 .Ic \&|| )
 .It Ic ?
 maximum (not available in C)
 .El
 .Pp
 There is no concept of precendence; evaluation proceeds from left to right,
 except when subexpressions are enclosed in parantheses.
 Inside parentheses, whitespace is ignored.
 .Sh ESCAPE SEQUENCE REFERENCE
 The
 .Xr mandoc 1
 .Nm
 parser recognises the following escape sequences.
 Note that the
 .Nm
 language defines more escape sequences not implemented in
 .Xr mandoc 1 .
 In
 .Xr mdoc 7
 and
 .Xr man 7
 documents, using escape sequences is discouraged except for those
 described in the
 .Sx LANGUAGE SYNTAX
 section above.
 .Pp
 A backslash followed by any character not listed here
 simply prints that character itself.
 .Ss \e
 A backslash at the end of an input line can be used to continue the
 logical input line on the next physical input line, joining the text
 on both lines together as if it were on a single input line.
 .Ss \e
 The escape sequence backslash-space
 .Pq Sq \e\ \&
 is an unpaddable space-sized non-breaking space character; see
 .Sx Whitespace .
 .Ss \e\(dq
 The rest of the input line is treated as
 .Sx Comments .
 .Ss \e%
 Hyphenation allowed at this point of the word; ignored by
 .Xr mandoc 1 .
 .Ss \e&
 Non-printing zero-width character; see
 .Sx Whitespace .
 .Ss \e\(aq
 Acute accent special character; use
 .Sq \e(aa
 instead.
 .Ss \e( Ns Ar cc
 .Sx Special Characters
 with two-letter names, see
 .Xr mandoc_char 7 .
 .Ss \e*[ Ns Ar name ]
 Interpolate the string with the
 .Ar name ;
 see
 .Sx Predefined Strings
 and
 .Sx ds .
 For short names, there are variants
 .No \e* Ns Ar c
 and
 .No \e*( Ns Ar cc .
 .Ss \e-
 Special character
 .Dq mathematical minus sign .
 .Ss \e[ Ns Ar name ]
 .Sx Special Characters
 with names of arbitrary length, see
 .Xr mandoc_char 7 .
 .Ss \e^
 One-twelfth em half-narrow space character, effectively zero-width in
 .Xr mandoc 1 .
 .Ss \e`
 Grave accent special character; use
 .Sq \e(ga
 instead.
 .Ss \e{
 Begin conditional input; see
 .Sx if .
 .Ss \e\(ba
 One-sixth em narrow space character, effectively zero-width in
 .Xr mandoc 1 .
 .Ss \e}
 End conditional input; see
 .Sx if .
 .Ss \e~
 Paddable non-breaking space character.
 .Ss \e0
 Digit width space character.
 .Ss \eA\(aq Ns Ar string Ns \(aq
 Anchor definition; ignored by
 .Xr mandoc 1 .
 .Ss \eB\(aq Ns Ar string Ns \(aq
 Interpolate
 .Sq 1
 if
 .Ar string
 conforms to the syntax of
 .Sx Numerical expressions
 explained above and
 .Sq 0
 otherwise.
 .Ss \eb\(aq Ns Ar string Ns \(aq
 Bracket building function; ignored by
 .Xr mandoc 1 .
 .Ss \eC\(aq Ns Ar name Ns \(aq
 .Sx Special Characters
 with names of arbitrary length.
 .Ss \ec
-Interrupt text processing to insert requests or macros; ignored by
-.Xr mandoc 1 .
+When encountered at the end of an input text line,
+the next input text line is considered to continue that line,
+even if there are request or macro lines in between.
+No whitespace is inserted.
 .Ss \eD\(aq Ns Ar string Ns \(aq
 Draw graphics function; ignored by
 .Xr mandoc 1 .
 .Ss \ed
 Move down by half a line; ignored by
 .Xr mandoc 1 .
 .Ss \ee
 Backslash special character.
 .Ss \eF[ Ns Ar name ]
 Switch font family (groff extension); ignored by
 .Xr mandoc 1 .
 For short names, there are variants
 .No \eF Ns Ar c
 and
 .No \eF( Ns Ar cc .
 .Ss \ef[ Ns Ar name ]
 Switch to the font
 .Ar name ,
 see
 .Sx Text Decoration .
 For short names, there are variants
 .No \ef Ns Ar c
 and
 .No \ef( Ns Ar cc .
 .Ss \eg[ Ns Ar name ]
 Interpolate the format of a number register; ignored by
 .Xr mandoc 1 .
 For short names, there are variants
 .No \eg Ns Ar c
 and
 .No \eg( Ns Ar cc .
 .Ss \eH\(aq Ns Oo +|- Oc Ns Ar number Ns \(aq
 Set the height of the current font; ignored by
 .Xr mandoc 1 .
 .Ss \eh\(aq Ns Ar number Ns \(aq
 Horizontal motion; ignored by
 .Xr mandoc 1 .
 .Ss \ek[ Ns Ar name ]
 Mark horizontal input place in register; ignored by
 .Xr mandoc 1 .
 For short names, there are variants
 .No \ek Ns Ar c
 and
 .No \ek( Ns Ar cc .
 .Ss \eL\(aq Ns Ar number Ns Oo Ar c Oc Ns \(aq
 Vertical line drawing function; ignored by
 .Xr mandoc 1 .
 .Ss \el\(aq Ns Ar number Ns Oo Ar c Oc Ns \(aq
 Horizontal line drawing function; ignored by
 .Xr mandoc 1 .
 .Ss \eM[ Ns Ar name ]
 Set fill (background) color (groff extension); ignored by
 .Xr mandoc 1 .
 For short names, there are variants
 .No \eM Ns Ar c
 and
 .No \eM( Ns Ar cc .
 .Ss \em[ Ns Ar name ]
 Set glyph drawing color (groff extension); ignored by
 .Xr mandoc 1 .
 For short names, there are variants
 .No \em Ns Ar c
 and
 .No \em( Ns Ar cc .
 .Ss \eN\(aq Ns Ar number Ns \(aq
 Character
 .Ar number
 on the current font.
 .Ss \en[ Ns Ar name ]
 Interpolate the number register
 .Ar name .
 For short names, there are variants
 .No \en Ns Ar c
 and
 .No \en( Ns Ar cc .
 .Ss \eo\(aq Ns Ar string Ns \(aq
 Overstrike
 .Ar string ;
 ignored by
 .Xr mandoc 1 .
 .Ss \eR\(aq Ns Ar name Oo +|- Oc Ns Ar number Ns \(aq
 Set number register; ignored by
 .Xr mandoc 1 .
 .Ss \eS\(aq Ns Ar number Ns \(aq
 Slant output; ignored by
 .Xr mandoc 1 .
 .Ss \es\(aq Ns Oo +|- Oc Ns Ar number Ns \(aq
 Change point size; ignored by
 .Xr mandoc 1 .
 Alternative forms
 .No \es Ns Oo +|- Oc Ns Ar n ,
 .No \es Ns Oo +|- Oc Ns \(aq Ns Ar number Ns \(aq ,
 .No \es Ns [ Oo +|- Oc Ns Ar number ] ,
 and
 .No \es Ns Oo +|- Oc Ns [ Ar number Ns ]
 are also parsed and ignored.
 .Ss \et
 Horizontal tab; ignored by
 .Xr mandoc 1 .
 .Ss \eu
 Move up by half a line; ignored by
 .Xr mandoc 1 .
 .Ss \eV[ Ns Ar name ]
 Interpolate an environment variable; ignored by
 .Xr mandoc 1 .
 For short names, there are variants
 .No \eV Ns Ar c
 and
 .No \eV( Ns Ar cc .
 .Ss \ev\(aq Ns Ar number Ns \(aq
 Vertical motion; ignored by
 .Xr mandoc 1 .
 .Ss \ew\(aq Ns Ar string Ns \(aq
 Interpolate the width of the
 .Ar string .
 The
 .Xr mandoc 1
 implementation assumes that after expansion of user-defined strings, the
 .Ar string
 only contains normal characters, no escape sequences, and that each
 character has a width of 24 basic units.
 .Ss \eX\(aq Ns Ar string Ns \(aq
 Output
 .Ar string
 as device control function; ignored in nroff mode and by
 .Xr mandoc 1 .
 .Ss \ex\(aq Ns Ar number Ns \(aq
 Extra line space function; ignored by
 .Xr mandoc 1 .
 .Ss \eY[ Ns Ar name ]
 Output a string as a device control function; ignored in nroff mode and by
 .Xr mandoc 1 .
 For short names, there are variants
 .No \eY Ns Ar c
 and
 .No \eY( Ns Ar cc .
 .Ss \eZ\(aq Ns Ar string Ns \(aq
 Print
 .Ar string
 with zero width and height; ignored by
 .Xr mandoc 1 .
 .Ss \ez
 Output the next character without advancing the cursor position;
 approximated in
 .Xr mandoc 1
 by simply skipping the next character.
 .Sh COMPATIBILITY
 This section documents compatibility between mandoc and other
 .Nm
 implementations, at this time limited to GNU troff
 .Pq Qq groff .
 The term
 .Qq historic groff
 refers to groff version 1.15.
 .Pp
 .Bl -dash -compact
 .It
 The
 .Sq u
 scaling unit is the default terminal unit.
 In traditional troff systems, this unit would change depending on the
 output media.
 .It
 In mandoc, the
 .Sx \&EQ ,
 .Sx \&TE ,
 .Sx \&TS ,
 and
 .Sx \&T& ,
 macros are considered regular macros.
 In all other
 .Nm
 implementations, these are special macros that must be specified without
 spacing between the control character (which must be a period) and the
 macro name.
 .It
 The
 .Cm nS
 register is only compatible with OpenBSD's groff-1.15.
 .It
 Historic groff did not accept white-space before a custom
 .Ar end
 macro for the
 .Sx \&ig
 request.
 .It
 The
 .Sx \&if
 and family would print funny white-spaces with historic groff when
 using the next-line syntax.
 .El
 .Sh SEE ALSO
 .Xr mandoc 1 ,
 .Xr eqn 7 ,
 .Xr man 7 ,
 .Xr mandoc_char 7 ,
 .Xr mdoc 7 ,
 .Xr tbl 7
 .Rs
 .%A Joseph F. Ossanna
 .%A Brian W. Kernighan
 .%I AT&T Bell Laboratories
 .%T Troff User's Manual
 .%R Computing Science Technical Report
 .%N 54
 .%C Murray Hill, New Jersey
 .%D 1976 and 1992
 .%U http://www.kohala.com/start/troff/cstr54.ps
 .Re
 .Rs
 .%A Joseph F. Ossanna
 .%A Brian W. Kernighan
 .%A Gunnar Ritter
 .%T Heirloom Documentation Tools Nroff/Troff User's Manual
 .%D September 17, 2007
 .%U http://heirloom.sourceforge.net/doctools/troff.pdf
 .Re
 .Sh HISTORY
 The RUNOFF typesetting system, whose input forms the basis for
 .Nm ,
 was written in MAD and FAP for the CTSS operating system by Jerome E.
 Saltzer in 1964.
 Doug McIlroy rewrote it in BCPL in 1969, renaming it
 .Nm .
 Dennis M. Ritchie rewrote McIlroy's
 .Nm
 in PDP-11 assembly for
 .At v1 ,
 Joseph F. Ossanna improved roff and renamed it nroff
 for
 .At v2 ,
 then ported nroff to C as troff, which Brian W. Kernighan released with
 .At v7 .
 In 1989, James Clarke re-implemented troff in C++, naming it groff.
 .Sh AUTHORS
 .An -nosplit
 This
 .Nm
 reference was written by
 .An Kristaps Dzonsons Aq Mt kristaps@bsd.lv
 and
 .An Ingo Schwarze Aq Mt schwarze@openbsd.org .
Index: projects/arm_intrng/contrib/mdocml/st.in
===================================================================
--- projects/arm_intrng/contrib/mdocml/st.in	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/st.in	(revision 276248)
@@ -1,80 +1,77 @@
-/*	$Id: st.in,v 1.26 2014/11/16 20:46:21 schwarze Exp $ */
+/*	$Id: st.in,v 1.27 2014/11/30 21:56:18 schwarze Exp $ */
 /*
  * Copyright (c) 2009, 2010 Kristaps Dzonsons 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
 /*
  * This file defines the .St macro arguments.  If you add a new
  * standard, make sure that the left-and side corresponds to the .St
  * argument (like .St -p1003.1) and the right-hand side corresponds to
  * the formatted output string.
  *
  * Be sure to escape strings.
  * The non-breaking blanks prevent ending an output line right before
  * a number.  Groff prevent line breaks at the same places.
  *
  * REMEMBER TO ADD NEW STANDARDS TO MDOC.7!
  */
 
 LINE("-p1003.1-88",	"IEEE Std 1003.1-1988 (\\(lqPOSIX.1\\(rq)")
 LINE("-p1003.1-90",	"IEEE Std 1003.1-1990 (\\(lqPOSIX.1\\(rq)")
 LINE("-p1003.1-96",	"ISO/IEC 9945-1:1996 (\\(lqPOSIX.1\\(rq)")
 LINE("-p1003.1-2001",	"IEEE Std 1003.1-2001 (\\(lqPOSIX.1\\(rq)")
 LINE("-p1003.1-2004",	"IEEE Std 1003.1-2004 (\\(lqPOSIX.1\\(rq)")
 LINE("-p1003.1-2008",	"IEEE Std 1003.1-2008 (\\(lqPOSIX.1\\(rq)")
 LINE("-p1003.1-2013",	"IEEE Std 1003.1-2008/Cor 1-2013 (\\(lqPOSIX.1\\(rq)")
 LINE("-p1003.1",	"IEEE Std 1003.1 (\\(lqPOSIX.1\\(rq)")
 LINE("-p1003.1b",	"IEEE Std 1003.1b (\\(lqPOSIX.1b\\(rq)")
 LINE("-p1003.1b-93",	"IEEE Std 1003.1b-1993 (\\(lqPOSIX.1b\\(rq)")
 LINE("-p1003.1c-95",	"IEEE Std 1003.1c-1995 (\\(lqPOSIX.1c\\(rq)")
-LINE("-p1003.1d-99",	"IEEE Std 1003.1d-1999 (\\(lqPOSIX.1d\\(rq)")
 LINE("-p1003.1g-2000",	"IEEE Std 1003.1g-2000 (\\(lqPOSIX.1g\\(rq)")
 LINE("-p1003.1i-95",	"IEEE Std 1003.1i-1995 (\\(lqPOSIX.1i\\(rq)")
 LINE("-p1003.2",	"IEEE Std 1003.2 (\\(lqPOSIX.2\\(rq)")
 LINE("-p1003.2-92",	"IEEE Std 1003.2-1992 (\\(lqPOSIX.2\\(rq)")
 LINE("-p1003.2a-92",	"IEEE Std 1003.2a-1992 (\\(lqPOSIX.2\\(rq)")
 LINE("-isoC",		"ISO/IEC 9899:1990 (\\(lqISO\\~C90\\(rq)")
 LINE("-isoC-90",	"ISO/IEC 9899:1990 (\\(lqISO\\~C90\\(rq)")
 LINE("-isoC-amd1",	"ISO/IEC 9899/AMD1:1995 (\\(lqISO\\~C90, Amendment 1\\(rq)")
 LINE("-isoC-tcor1",	"ISO/IEC 9899/TCOR1:1994 (\\(lqISO\\~C90, Technical Corrigendum 1\\(rq)")
 LINE("-isoC-tcor2",	"ISO/IEC 9899/TCOR2:1995 (\\(lqISO\\~C90, Technical Corrigendum 2\\(rq)")
 LINE("-isoC-99",	"ISO/IEC 9899:1999 (\\(lqISO\\~C99\\(rq)")
 LINE("-isoC-2011",	"ISO/IEC 9899:2011 (\\(lqISO\\~C11\\(rq)")
 LINE("-iso9945-1-90",	"ISO/IEC 9945-1:1990 (\\(lqPOSIX.1\\(rq)")
 LINE("-iso9945-1-96",	"ISO/IEC 9945-1:1996 (\\(lqPOSIX.1\\(rq)")
 LINE("-iso9945-2-93",	"ISO/IEC 9945-2:1993 (\\(lqPOSIX.2\\(rq)")
 LINE("-ansiC",		"ANSI X3.159-1989 (\\(lqANSI\\~C89\\(rq)")
 LINE("-ansiC-89",	"ANSI X3.159-1989 (\\(lqANSI\\~C89\\(rq)")
-LINE("-ansiC-99",	"ANSI/ISO/IEC 9899-1999 (\\(lqANSI\\~C99\\(rq)")
 LINE("-ieee754",	"IEEE Std 754-1985")
 LINE("-iso8802-3",	"ISO 8802-3: 1989")
 LINE("-iso8601",	"ISO 8601")
 LINE("-ieee1275-94",	"IEEE Std 1275-1994 (\\(lqOpen Firmware\\(rq)")
 LINE("-xpg3",		"X/Open Portability Guide Issue\\~3 (\\(lqXPG3\\(rq)")
 LINE("-xpg4",		"X/Open Portability Guide Issue\\~4 (\\(lqXPG4\\(rq)")
 LINE("-xpg4.2",		"X/Open Portability Guide Issue\\~4, Version\\~2 (\\(lqXPG4.2\\(rq)")
-LINE("-xpg4.3",		"X/Open Portability Guide Issue\\~4, Version\\~3 (\\(lqXPG4.3\\(rq)")
 LINE("-xbd5",		"X/Open Base Definitions Issue\\~5 (\\(lqXBD5\\(rq)")
 LINE("-xcu5",		"X/Open Commands and Utilities Issue\\~5 (\\(lqXCU5\\(rq)")
 LINE("-xsh4.2",		"X/Open System Interfaces and Headers Issue\\~4, Version\\~2 (\\(lqXSH4.2\\(rq)")
 LINE("-xsh5",		"X/Open System Interfaces and Headers Issue\\~5 (\\(lqXSH5\\(rq)")
 LINE("-xns5",		"X/Open Networking Services Issue\\~5 (\\(lqXNS5\\(rq)")
 LINE("-xns5.2",		"X/Open Networking Services Issue\\~5.2 (\\(lqXNS5.2\\(rq)")
 LINE("-xcurses4.2",	"X/Open Curses Issue\\~4, Version\\~2 (\\(lqXCURSES4.2\\(rq)")
 LINE("-susv1",		"Version\\~1 of the Single UNIX Specification (\\(lqSUSv1\\(rq)")
 LINE("-susv2",		"Version\\~2 of the Single UNIX Specification (\\(lqSUSv2\\(rq)")
 LINE("-susv3",		"Version\\~3 of the Single UNIX Specification (\\(lqSUSv3\\(rq)")
 LINE("-susv4",		"Version\\~4 of the Single UNIX Specification (\\(lqSUSv4\\(rq)")
 LINE("-svid4",		"System\\~V Interface Definition, Fourth Edition (\\(lqSVID4\\(rq)")
Index: projects/arm_intrng/contrib/mdocml/term.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/term.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/term.c	(revision 276248)
@@ -1,812 +1,812 @@
-/*	$Id: term.c,v 1.236 2014/11/21 01:52:53 schwarze Exp $ */
+/*	$Id: term.c,v 1.237 2014/12/02 10:08:06 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2010-2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "mandoc.h"
 #include "mandoc_aux.h"
 #include "out.h"
 #include "term.h"
 #include "main.h"
 
 static	size_t		 cond_width(const struct termp *, int, int *);
 static	void		 adjbuf(struct termp *p, size_t);
 static	void		 bufferc(struct termp *, char);
 static	void		 encode(struct termp *, const char *, size_t);
 static	void		 encode1(struct termp *, int);
 
 
 void
 term_free(struct termp *p)
 {
 
 	free(p->buf);
 	free(p);
 }
 
 void
 term_begin(struct termp *p, term_margin head,
 		term_margin foot, const void *arg)
 {
 
 	p->headf = head;
 	p->footf = foot;
 	p->argf = arg;
 	(*p->begin)(p);
 }
 
 void
 term_end(struct termp *p)
 {
 
 	(*p->end)(p);
 }
 
 /*
  * Flush a chunk of text.  By default, break the output line each time
  * the right margin is reached, and continue output on the next line
  * at the same offset as the chunk itself.  By default, also break the
  * output line at the end of the chunk.
  * The following flags may be specified:
  *
  *  - TERMP_NOBREAK: Do not break the output line at the right margin,
  *    but only at the max right margin.  Also, do not break the output
  *    line at the end of the chunk, such that the next call can pad to
  *    the next column.  However, if less than p->trailspace blanks,
  *    which can be 0, 1, or 2, remain to the right margin, the line
  *    will be broken.
  *  - TERMP_BRIND: If the chunk does not fit and the output line has
  *    to be broken, start the next line at the right margin instead
  *    of at the offset.  Used together with TERMP_NOBREAK for the tags
  *    in various kinds of tagged lists.
  *  - TERMP_DANGLE: Do not break the output line at the right margin,
  *    append the next chunk after it even if this one is too long.
  *    To be used together with TERMP_NOBREAK.
  *  - TERMP_HANG: Like TERMP_DANGLE, and also suppress padding before
  *    the next chunk if this column is not full.
  */
 void
 term_flushln(struct termp *p)
 {
 	size_t		 i;     /* current input position in p->buf */
 	int		 ntab;	/* number of tabs to prepend */
 	size_t		 vis;   /* current visual position on output */
 	size_t		 vbl;   /* number of blanks to prepend to output */
 	size_t		 vend;	/* end of word visual position on output */
 	size_t		 bp;    /* visual right border position */
 	size_t		 dv;    /* temporary for visual pos calculations */
 	size_t		 j;     /* temporary loop index for p->buf */
 	size_t		 jhy;	/* last hyph before overflow w/r/t j */
 	size_t		 maxvis; /* output position of visible boundary */
 	size_t		 rmargin; /* the rightmost of the two margins */
 
 	/*
 	 * First, establish the maximum columns of "visible" content.
 	 * This is usually the difference between the right-margin and
 	 * an indentation, but can be, for tagged lists or columns, a
 	 * small set of values.
 	 *
 	 * The following unsigned-signed subtractions look strange,
 	 * but they are actually correct.  If the int p->overstep
 	 * is negative, it gets sign extended.  Subtracting that
 	 * very large size_t effectively adds a small number to dv.
 	 */
 	rmargin = p->rmargin > p->offset ? p->rmargin : p->offset;
 	dv = p->rmargin - p->offset;
 	maxvis = (int)dv > p->overstep ? dv - (size_t)p->overstep : 0;
 
 	if (p->flags & TERMP_NOBREAK) {
 		dv = p->maxrmargin > p->offset ?
 		     p->maxrmargin - p->offset : 0;
 		bp = (int)dv > p->overstep ?
 		     dv - (size_t)p->overstep : 0;
 	} else
 		bp = maxvis;
 
 	/*
 	 * Calculate the required amount of padding.
 	 */
 	vbl = p->offset + p->overstep > p->viscol ?
 	      p->offset + p->overstep - p->viscol : 0;
 
 	vis = vend = 0;
 	i = 0;
 
 	while (i < p->col) {
 		/*
 		 * Handle literal tab characters: collapse all
 		 * subsequent tabs into a single huge set of spaces.
 		 */
 		ntab = 0;
 		while (i < p->col && '\t' == p->buf[i]) {
 			vend = (vis / p->tabwidth + 1) * p->tabwidth;
 			vbl += vend - vis;
 			vis = vend;
 			ntab++;
 			i++;
 		}
 
 		/*
 		 * Count up visible word characters.  Control sequences
 		 * (starting with the CSI) aren't counted.  A space
 		 * generates a non-printing word, which is valid (the
 		 * space is printed according to regular spacing rules).
 		 */
 
 		for (j = i, jhy = 0; j < p->col; j++) {
 			if (' ' == p->buf[j] || '\t' == p->buf[j])
 				break;
 
 			/* Back over the the last printed character. */
 			if (8 == p->buf[j]) {
 				assert(j);
 				vend -= (*p->width)(p, p->buf[j - 1]);
 				continue;
 			}
 
 			/* Regular word. */
 			/* Break at the hyphen point if we overrun. */
 			if (vend > vis && vend < bp &&
 			    (ASCII_HYPH == p->buf[j] ||
 			     ASCII_BREAK == p->buf[j]))
 				jhy = j;
 
 			/*
 			 * Hyphenation now decided, put back a real
 			 * hyphen such that we get the correct width.
 			 */
 			if (ASCII_HYPH == p->buf[j])
 				p->buf[j] = '-';
 
 			vend += (*p->width)(p, p->buf[j]);
 		}
 
 		/*
 		 * Find out whether we would exceed the right margin.
 		 * If so, break to the next line.
 		 */
 		if (vend > bp && 0 == jhy && vis > 0) {
 			vend -= vis;
 			(*p->endline)(p);
 			p->viscol = 0;
 			if (TERMP_BRIND & p->flags) {
 				vbl = rmargin;
 				vend += rmargin - p->offset;
 			} else
 				vbl = p->offset;
 
 			/* use pending tabs on the new line */
 
 			if (0 < ntab)
 				vbl += ntab * p->tabwidth;
 
 			/*
 			 * Remove the p->overstep width.
 			 * Again, if p->overstep is negative,
 			 * sign extension does the right thing.
 			 */
 
 			bp += (size_t)p->overstep;
 			p->overstep = 0;
 		}
 
 		/* Write out the [remaining] word. */
 		for ( ; i < p->col; i++) {
 			if (vend > bp && jhy > 0 && i > jhy)
 				break;
 			if ('\t' == p->buf[i])
 				break;
 			if (' ' == p->buf[i]) {
 				j = i;
 				while (i < p->col && ' ' == p->buf[i])
 					i++;
 				dv = (i - j) * (*p->width)(p, ' ');
 				vbl += dv;
 				vend += dv;
 				break;
 			}
 			if (ASCII_NBRSP == p->buf[i]) {
 				vbl += (*p->width)(p, ' ');
 				continue;
 			}
 			if (ASCII_BREAK == p->buf[i])
 				continue;
 
 			/*
 			 * Now we definitely know there will be
 			 * printable characters to output,
 			 * so write preceding white space now.
 			 */
 			if (vbl) {
 				(*p->advance)(p, vbl);
 				p->viscol += vbl;
 				vbl = 0;
 			}
 
 			(*p->letter)(p, p->buf[i]);
 			if (8 == p->buf[i])
 				p->viscol -= (*p->width)(p, p->buf[i-1]);
 			else
 				p->viscol += (*p->width)(p, p->buf[i]);
 		}
 		vis = vend;
 	}
 
 	/*
 	 * If there was trailing white space, it was not printed;
 	 * so reset the cursor position accordingly.
 	 */
 	if (vis > vbl)
 		vis -= vbl;
 	else
 		vis = 0;
 
 	p->col = 0;
 	p->overstep = 0;
 
 	if ( ! (TERMP_NOBREAK & p->flags)) {
 		p->viscol = 0;
 		(*p->endline)(p);
 		return;
 	}
 
 	if (TERMP_HANG & p->flags) {
 		p->overstep = (int)(vis - maxvis +
 		    p->trailspace * (*p->width)(p, ' '));
 
 		/*
 		 * If we have overstepped the margin, temporarily move
 		 * it to the right and flag the rest of the line to be
 		 * shorter.
 		 * If there is a request to keep the columns together,
 		 * allow negative overstep when the column is not full.
 		 */
 		if (p->trailspace && p->overstep < 0)
 			p->overstep = 0;
 		return;
 
 	} else if (TERMP_DANGLE & p->flags)
 		return;
 
 	/* If the column was overrun, break the line. */
 	if (maxvis < vis + p->trailspace * (*p->width)(p, ' ')) {
 		(*p->endline)(p);
 		p->viscol = 0;
 	}
 }
 
 /*
  * A newline only breaks an existing line; it won't assert vertical
  * space.  All data in the output buffer is flushed prior to the newline
  * assertion.
  */
 void
 term_newln(struct termp *p)
 {
 
 	p->flags |= TERMP_NOSPACE;
 	if (p->col || p->viscol)
 		term_flushln(p);
 }
 
 /*
  * Asserts a vertical space (a full, empty line-break between lines).
  * Note that if used twice, this will cause two blank spaces and so on.
  * All data in the output buffer is flushed prior to the newline
  * assertion.
  */
 void
 term_vspace(struct termp *p)
 {
 
 	term_newln(p);
 	p->viscol = 0;
 	if (0 < p->skipvsp)
 		p->skipvsp--;
 	else
 		(*p->endline)(p);
 }
 
 void
 term_fontlast(struct termp *p)
 {
 	enum termfont	 f;
 
 	f = p->fontl;
 	p->fontl = p->fontq[p->fonti];
 	p->fontq[p->fonti] = f;
 }
 
 void
 term_fontrepl(struct termp *p, enum termfont f)
 {
 
 	p->fontl = p->fontq[p->fonti];
 	p->fontq[p->fonti] = f;
 }
 
 void
 term_fontpush(struct termp *p, enum termfont f)
 {
 
 	assert(p->fonti + 1 < 10);
 	p->fontl = p->fontq[p->fonti];
 	p->fontq[++p->fonti] = f;
 }
 
 const void *
 term_fontq(struct termp *p)
 {
 
 	return(&p->fontq[p->fonti]);
 }
 
 enum termfont
 term_fonttop(struct termp *p)
 {
 
 	return(p->fontq[p->fonti]);
 }
 
 void
 term_fontpopq(struct termp *p, const void *key)
 {
 
 	while (p->fonti >= 0 && key < (void *)(p->fontq + p->fonti))
 		p->fonti--;
 	assert(p->fonti >= 0);
 }
 
 void
 term_fontpop(struct termp *p)
 {
 
 	assert(p->fonti);
 	p->fonti--;
 }
 
 /*
  * Handle pwords, partial words, which may be either a single word or a
  * phrase that cannot be broken down (such as a literal string).  This
  * handles word styling.
  */
 void
 term_word(struct termp *p, const char *word)
 {
 	const char	 nbrsp[2] = { ASCII_NBRSP, 0 };
 	const char	*seq, *cp;
 	int		 sz, uc;
 	size_t		 ssz;
 	enum mandoc_esc	 esc;
 
 	if ( ! (TERMP_NOSPACE & p->flags)) {
 		if ( ! (TERMP_KEEP & p->flags)) {
 			bufferc(p, ' ');
 			if (TERMP_SENTENCE & p->flags)
 				bufferc(p, ' ');
 		} else
 			bufferc(p, ASCII_NBRSP);
 	}
 	if (TERMP_PREKEEP & p->flags)
 		p->flags |= TERMP_KEEP;
 
 	if ( ! (p->flags & TERMP_NONOSPACE))
 		p->flags &= ~TERMP_NOSPACE;
 	else
 		p->flags |= TERMP_NOSPACE;
 
-	p->flags &= ~TERMP_SENTENCE;
+	p->flags &= ~(TERMP_SENTENCE | TERMP_NONEWLINE);
 
 	while ('\0' != *word) {
 		if ('\\' != *word) {
 			if (TERMP_SKIPCHAR & p->flags) {
 				p->flags &= ~TERMP_SKIPCHAR;
 				word++;
 				continue;
 			}
 			if (TERMP_NBRWORD & p->flags) {
 				if (' ' == *word) {
 					encode(p, nbrsp, 1);
 					word++;
 					continue;
 				}
 				ssz = strcspn(word, "\\ ");
 			} else
 				ssz = strcspn(word, "\\");
 			encode(p, word, ssz);
 			word += (int)ssz;
 			continue;
 		}
 
 		word++;
 		esc = mandoc_escape(&word, &seq, &sz);
 		if (ESCAPE_ERROR == esc)
 			continue;
 
 		switch (esc) {
 		case ESCAPE_UNICODE:
 			uc = mchars_num2uc(seq + 1, sz - 1);
 			break;
 		case ESCAPE_NUMBERED:
 			uc = mchars_num2char(seq, sz);
 			if (uc < 0)
 				continue;
 			break;
 		case ESCAPE_SPECIAL:
 			if (p->enc == TERMENC_ASCII) {
 				cp = mchars_spec2str(p->symtab,
 				    seq, sz, &ssz);
 				if (cp != NULL)
 					encode(p, cp, ssz);
 			} else {
 				uc = mchars_spec2cp(p->symtab, seq, sz);
 				if (uc > 0)
 					encode1(p, uc);
 			}
 			continue;
 		case ESCAPE_FONTBOLD:
 			term_fontrepl(p, TERMFONT_BOLD);
 			continue;
 		case ESCAPE_FONTITALIC:
 			term_fontrepl(p, TERMFONT_UNDER);
 			continue;
 		case ESCAPE_FONTBI:
 			term_fontrepl(p, TERMFONT_BI);
 			continue;
 		case ESCAPE_FONT:
 			/* FALLTHROUGH */
 		case ESCAPE_FONTROMAN:
 			term_fontrepl(p, TERMFONT_NONE);
 			continue;
 		case ESCAPE_FONTPREV:
 			term_fontlast(p);
 			continue;
 		case ESCAPE_NOSPACE:
 			if (TERMP_SKIPCHAR & p->flags)
 				p->flags &= ~TERMP_SKIPCHAR;
 			else if ('\0' == *word)
-				p->flags |= TERMP_NOSPACE;
+				p->flags |= (TERMP_NOSPACE | TERMP_NONEWLINE);
 			continue;
 		case ESCAPE_SKIPCHAR:
 			p->flags |= TERMP_SKIPCHAR;
 			continue;
 		default:
 			continue;
 		}
 
 		/*
 		 * Common handling for Unicode and numbered
 		 * character escape sequences.
 		 */
 
 		if (p->enc == TERMENC_ASCII) {
 			cp = ascii_uc2str(uc);
 			encode(p, cp, strlen(cp));
 		} else {
 			if ((uc < 0x20 && uc != 0x09) ||
 			    (uc > 0x7E && uc < 0xA0))
 				uc = 0xFFFD;
 			encode1(p, uc);
 		}
 	}
 	p->flags &= ~TERMP_NBRWORD;
 }
 
 static void
 adjbuf(struct termp *p, size_t sz)
 {
 
 	if (0 == p->maxcols)
 		p->maxcols = 1024;
 	while (sz >= p->maxcols)
 		p->maxcols <<= 2;
 
 	p->buf = mandoc_reallocarray(p->buf, p->maxcols, sizeof(int));
 }
 
 static void
 bufferc(struct termp *p, char c)
 {
 
 	if (p->col + 1 >= p->maxcols)
 		adjbuf(p, p->col + 1);
 
 	p->buf[p->col++] = c;
 }
 
 /*
  * See encode().
  * Do this for a single (probably unicode) value.
  * Does not check for non-decorated glyphs.
  */
 static void
 encode1(struct termp *p, int c)
 {
 	enum termfont	  f;
 
 	if (TERMP_SKIPCHAR & p->flags) {
 		p->flags &= ~TERMP_SKIPCHAR;
 		return;
 	}
 
 	if (p->col + 6 >= p->maxcols)
 		adjbuf(p, p->col + 6);
 
 	f = term_fonttop(p);
 
 	if (TERMFONT_UNDER == f || TERMFONT_BI == f) {
 		p->buf[p->col++] = '_';
 		p->buf[p->col++] = 8;
 	}
 	if (TERMFONT_BOLD == f || TERMFONT_BI == f) {
 		if (ASCII_HYPH == c)
 			p->buf[p->col++] = '-';
 		else
 			p->buf[p->col++] = c;
 		p->buf[p->col++] = 8;
 	}
 	p->buf[p->col++] = c;
 }
 
 static void
 encode(struct termp *p, const char *word, size_t sz)
 {
 	size_t		  i;
 
 	if (TERMP_SKIPCHAR & p->flags) {
 		p->flags &= ~TERMP_SKIPCHAR;
 		return;
 	}
 
 	/*
 	 * Encode and buffer a string of characters.  If the current
 	 * font mode is unset, buffer directly, else encode then buffer
 	 * character by character.
 	 */
 
 	if (TERMFONT_NONE == term_fonttop(p)) {
 		if (p->col + sz >= p->maxcols)
 			adjbuf(p, p->col + sz);
 		for (i = 0; i < sz; i++)
 			p->buf[p->col++] = word[i];
 		return;
 	}
 
 	/* Pre-buffer, assuming worst-case. */
 
 	if (p->col + 1 + (sz * 5) >= p->maxcols)
 		adjbuf(p, p->col + 1 + (sz * 5));
 
 	for (i = 0; i < sz; i++) {
 		if (ASCII_HYPH == word[i] ||
 		    isgraph((unsigned char)word[i]))
 			encode1(p, word[i]);
 		else
 			p->buf[p->col++] = word[i];
 	}
 }
 
 void
 term_setwidth(struct termp *p, const char *wstr)
 {
 	struct roffsu	 su;
 	size_t		 width;
 	int		 iop;
 
 	iop = 0;
 	width = 0;
 	if (NULL != wstr) {
 		switch (*wstr) {
 		case '+':
 			iop = 1;
 			wstr++;
 			break;
 		case '-':
 			iop = -1;
 			wstr++;
 			break;
 		default:
 			break;
 		}
 		if (a2roffsu(wstr, &su, SCALE_MAX))
 			width = term_hspan(p, &su);
 		else
 			iop = 0;
 	}
 	(*p->setwidth)(p, iop, width);
 }
 
 size_t
 term_len(const struct termp *p, size_t sz)
 {
 
 	return((*p->width)(p, ' ') * sz);
 }
 
 static size_t
 cond_width(const struct termp *p, int c, int *skip)
 {
 
 	if (*skip) {
 		(*skip) = 0;
 		return(0);
 	} else
 		return((*p->width)(p, c));
 }
 
 size_t
 term_strlen(const struct termp *p, const char *cp)
 {
 	size_t		 sz, rsz, i;
 	int		 ssz, skip, uc;
 	const char	*seq, *rhs;
 	enum mandoc_esc	 esc;
 	static const char rej[] = { '\\', ASCII_NBRSP, ASCII_HYPH,
 			ASCII_BREAK, '\0' };
 
 	/*
 	 * Account for escaped sequences within string length
 	 * calculations.  This follows the logic in term_word() as we
 	 * must calculate the width of produced strings.
 	 */
 
 	sz = 0;
 	skip = 0;
 	while ('\0' != *cp) {
 		rsz = strcspn(cp, rej);
 		for (i = 0; i < rsz; i++)
 			sz += cond_width(p, *cp++, &skip);
 
 		switch (*cp) {
 		case '\\':
 			cp++;
 			esc = mandoc_escape(&cp, &seq, &ssz);
 			if (ESCAPE_ERROR == esc)
 				continue;
 
 			rhs = NULL;
 
 			switch (esc) {
 			case ESCAPE_UNICODE:
 				uc = mchars_num2uc(seq + 1, ssz - 1);
 				break;
 			case ESCAPE_NUMBERED:
 				uc = mchars_num2char(seq, ssz);
 				if (uc < 0)
 					continue;
 				break;
 			case ESCAPE_SPECIAL:
 				if (p->enc == TERMENC_ASCII) {
 					rhs = mchars_spec2str(p->symtab,
 					    seq, ssz, &rsz);
 					if (rhs != NULL)
 						break;
 				} else {
 					uc = mchars_spec2cp(p->symtab,
 					    seq, ssz);
 					if (uc > 0)
 						sz += cond_width(p, uc, &skip);
 				}
 				continue;
 			case ESCAPE_SKIPCHAR:
 				skip = 1;
 				continue;
 			default:
 				continue;
 			}
 
 			/*
 			 * Common handling for Unicode and numbered
 			 * character escape sequences.
 			 */
 
 			if (rhs == NULL) {
 				if (p->enc == TERMENC_ASCII) {
 					rhs = ascii_uc2str(uc);
 					rsz = strlen(rhs);
 				} else {
 					if ((uc < 0x20 && uc != 0x09) ||
 					    (uc > 0x7E && uc < 0xA0))
 						uc = 0xFFFD;
 					sz += cond_width(p, uc, &skip);
 					continue;
 				}
 			}
 
 			if (skip) {
 				skip = 0;
 				break;
 			}
 
 			/*
 			 * Common handling for all escape sequences
 			 * printing more than one character.
 			 */
 
 			for (i = 0; i < rsz; i++)
 				sz += (*p->width)(p, *rhs++);
 			break;
 		case ASCII_NBRSP:
 			sz += cond_width(p, ' ', &skip);
 			cp++;
 			break;
 		case ASCII_HYPH:
 			sz += cond_width(p, '-', &skip);
 			cp++;
 			/* FALLTHROUGH */
 		case ASCII_BREAK:
 			break;
 		default:
 			break;
 		}
 	}
 
 	return(sz);
 }
 
 size_t
 term_vspan(const struct termp *p, const struct roffsu *su)
 {
 	double		 r;
 
 	switch (su->unit) {
 	case SCALE_CM:
 		r = su->scale * 2.0;
 		break;
 	case SCALE_IN:
 		r = su->scale * 6.0;
 		break;
 	case SCALE_PC:
 		r = su->scale;
 		break;
 	case SCALE_PT:
 		r = su->scale / 8.0;
 		break;
 	case SCALE_MM:
 		r = su->scale / 1000.0;
 		break;
 	case SCALE_VS:
 		r = su->scale;
 		break;
 	default:
 		r = su->scale - 1.0;
 		break;
 	}
 
 	if (r < 0.0)
 		r = 0.0;
 	return((size_t)(r + 0.0005));
 }
 
 size_t
 term_hspan(const struct termp *p, const struct roffsu *su)
 {
 	double		 v;
 
 	v = (*p->hspan)(p, su);
 	if (v < 0.0)
 		v = 0.0;
 	return((size_t)(v + 0.0005));
 }
Index: projects/arm_intrng/contrib/mdocml/term.h
===================================================================
--- projects/arm_intrng/contrib/mdocml/term.h	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/term.h	(revision 276248)
@@ -1,138 +1,138 @@
-/*	$Id: term.h,v 1.105 2014/10/28 17:36:19 schwarze Exp $ */
+/*	$Id: term.h,v 1.108 2014/12/02 10:08:06 schwarze Exp $ */
 /*
  * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifndef TERM_H
-#define TERM_H
 
-__BEGIN_DECLS
-
-struct	termp;
-
 enum	termenc {
 	TERMENC_ASCII,
 	TERMENC_LOCALE,
 	TERMENC_UTF8
 };
 
 enum	termtype {
 	TERMTYPE_CHAR,
 	TERMTYPE_PS,
 	TERMTYPE_PDF
 };
 
 enum	termfont {
 	TERMFONT_NONE = 0,
 	TERMFONT_BOLD,
 	TERMFONT_UNDER,
 	TERMFONT_BI,
 	TERMFONT__MAX
 };
 
 #define	TERM_MAXMARGIN	  100000 /* FIXME */
 
+struct	termp;
+
 typedef void	(*term_margin)(struct termp *, const void *);
 
 struct	termp_tbl {
 	int		  width;	/* width in fixed chars */
 	int		  decimal;	/* decimal point position */
 };
 
 struct	termp {
 	enum termtype	  type;
 	struct rofftbl	  tbl;		/* table configuration */
 	int		  synopsisonly; /* print the synopsis only */
 	int		  mdocstyle;	/* imitate mdoc(7) output */
 	size_t		  defindent;	/* Default indent for text. */
 	size_t		  defrmargin;	/* Right margin of the device. */
 	size_t		  lastrmargin;	/* Right margin before the last ll. */
 	size_t		  rmargin;	/* Current right margin. */
 	size_t		  maxrmargin;	/* Max right margin. */
 	size_t		  maxcols;	/* Max size of buf. */
 	size_t		  offset;	/* Margin offest. */
 	size_t		  tabwidth;	/* Distance of tab positions. */
 	size_t		  col;		/* Bytes in buf. */
 	size_t		  viscol;	/* Chars on current line. */
 	size_t		  trailspace;	/* See termp_flushln(). */
 	int		  overstep;	/* See termp_flushln(). */
 	int		  skipvsp;	/* Vertical space to skip. */
 	int		  flags;
 #define	TERMP_SENTENCE	 (1 << 1)	/* Space before a sentence. */
 #define	TERMP_NOSPACE	 (1 << 2)	/* No space before words. */
 #define	TERMP_NONOSPACE	 (1 << 3)	/* No space (no autounset). */
 #define	TERMP_NBRWORD	 (1 << 4)	/* Make next word nonbreaking. */
 #define	TERMP_KEEP	 (1 << 5)	/* Keep words together. */
 #define	TERMP_PREKEEP	 (1 << 6)	/* ...starting with the next one. */
 #define	TERMP_SKIPCHAR	 (1 << 7)	/* Skip the next character. */
 #define	TERMP_NOBREAK	 (1 << 8)	/* See term_flushln(). */
 #define	TERMP_BRIND	 (1 << 9)	/* See term_flushln(). */
 #define	TERMP_DANGLE	 (1 << 10)	/* See term_flushln(). */
 #define	TERMP_HANG	 (1 << 11)	/* See term_flushln(). */
 #define	TERMP_NOSPLIT	 (1 << 12)	/* Do not break line before .An. */
 #define	TERMP_SPLIT	 (1 << 13)	/* Break line before .An. */
+#define	TERMP_NONEWLINE	 (1 << 14)	/* No line break in nofill mode. */
 	int		 *buf;		/* Output buffer. */
 	enum termenc	  enc;		/* Type of encoding. */
 	const struct mchars *symtab;	/* Character table. */
 	enum termfont	  fontl;	/* Last font set. */
 	enum termfont	  fontq[10];	/* Symmetric fonts. */
 	int		  fonti;	/* Index of font stack. */
 	term_margin	  headf;	/* invoked to print head */
 	term_margin	  footf;	/* invoked to print foot */
 	void		(*letter)(struct termp *, int);
 	void		(*begin)(struct termp *);
 	void		(*end)(struct termp *);
 	void		(*endline)(struct termp *);
 	void		(*advance)(struct termp *, size_t);
 	void		(*setwidth)(struct termp *, int, size_t);
 	size_t		(*width)(const struct termp *, int);
 	double		(*hspan)(const struct termp *,
 				const struct roffsu *);
 	const void	 *argf;		/* arg for headf/footf */
 	struct termp_ps	 *ps;
 };
 
+__BEGIN_DECLS
+
+struct	tbl_span;
+struct	eqn;
+
 const char	 *ascii_uc2str(int);
 
 void		  term_eqn(struct termp *, const struct eqn *);
 void		  term_tbl(struct termp *, const struct tbl_span *);
 void		  term_free(struct termp *);
 void		  term_newln(struct termp *);
 void		  term_vspace(struct termp *);
 void		  term_word(struct termp *, const char *);
 void		  term_flushln(struct termp *);
 void		  term_begin(struct termp *, term_margin,
 			term_margin, const void *);
 void		  term_end(struct termp *);
 
 void		  term_setwidth(struct termp *, const char *);
 size_t		  term_hspan(const struct termp *,
 			const struct roffsu *);
 size_t		  term_vspan(const struct termp *,
 			const struct roffsu *);
 size_t		  term_strlen(const struct termp *, const char *);
 size_t		  term_len(const struct termp *, size_t);
 
 enum termfont	  term_fonttop(struct termp *);
 const void	 *term_fontq(struct termp *);
 void		  term_fontpush(struct termp *, enum termfont);
 void		  term_fontpop(struct termp *);
 void		  term_fontpopq(struct termp *, const void *);
 void		  term_fontrepl(struct termp *, enum termfont);
 void		  term_fontlast(struct termp *);
 
 __END_DECLS
-
-#endif /*!TERM_H*/
Index: projects/arm_intrng/contrib/mdocml/term_ps.c
===================================================================
--- projects/arm_intrng/contrib/mdocml/term_ps.c	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml/term_ps.c	(revision 276248)
@@ -1,1323 +1,1322 @@
-/*	$Id: term_ps.c,v 1.69 2014/11/20 13:56:20 schwarze Exp $ */
+/*	$Id: term_ps.c,v 1.70 2014/12/01 08:05:52 schwarze Exp $ */
 /*
  * Copyright (c) 2010, 2011 Kristaps Dzonsons 
  * Copyright (c) 2014 Ingo Schwarze 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
  * copyright notice and this permission notice appear in all copies.
  *
  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include "config.h"
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
-#include "mandoc.h"
 #include "mandoc_aux.h"
 #include "out.h"
-#include "main.h"
 #include "term.h"
+#include "main.h"
 
 /* These work the buffer used by the header and footer. */
 #define	PS_BUFSLOP	  128
 
 /* Convert PostScript point "x" to an AFM unit. */
 #define	PNT2AFM(p, x) \
 	(size_t)((double)(x) * (1000.0 / (double)(p)->ps->scale))
 
 /* Convert an AFM unit "x" to a PostScript points */
 #define	AFM2PNT(p, x) \
 	((double)(x) / (1000.0 / (double)(p)->ps->scale))
 
 struct	glyph {
 	unsigned short	  wx; /* WX in AFM */
 };
 
 struct	font {
 	const char	 *name; /* FontName in AFM */
 #define	MAXCHAR		  95 /* total characters we can handle */
 	struct glyph	  gly[MAXCHAR]; /* glyph metrics */
 };
 
 struct	termp_ps {
 	int		  flags;
 #define	PS_INLINE	 (1 << 0)	/* we're in a word */
 #define	PS_MARGINS	 (1 << 1)	/* we're in the margins */
 #define	PS_NEWPAGE	 (1 << 2)	/* new page, no words yet */
 #define	PS_BACKSP	 (1 << 3)	/* last character was backspace */
 	size_t		  pscol;	/* visible column (AFM units) */
 	size_t		  psrow;	/* visible row (AFM units) */
 	char		 *psmarg;	/* margin buf */
 	size_t		  psmargsz;	/* margin buf size */
 	size_t		  psmargcur;	/* cur index in margin buf */
 	char		  last;		/* last non-backspace seen */
 	enum termfont	  lastf;	/* last set font */
 	enum termfont	  nextf;	/* building next font here */
 	size_t		  scale;	/* font scaling factor */
 	size_t		  pages;	/* number of pages shown */
 	size_t		  lineheight;	/* line height (AFM units) */
 	size_t		  top;		/* body top (AFM units) */
 	size_t		  bottom;	/* body bottom (AFM units) */
 	size_t		  height;	/* page height (AFM units */
 	size_t		  width;	/* page width (AFM units) */
 	size_t		  lastwidth;	/* page width before last ll */
 	size_t		  left;		/* body left (AFM units) */
 	size_t		  header;	/* header pos (AFM units) */
 	size_t		  footer;	/* footer pos (AFM units) */
 	size_t		  pdfbytes;	/* current output byte */
 	size_t		  pdflastpg;	/* byte of last page mark */
 	size_t		  pdfbody;	/* start of body object */
 	size_t		 *pdfobjs;	/* table of object offsets */
 	size_t		  pdfobjsz;	/* size of pdfobjs */
 };
 
 static	double		  ps_hspan(const struct termp *,
 				const struct roffsu *);
 static	size_t		  ps_width(const struct termp *, int);
 static	void		  ps_advance(struct termp *, size_t);
 static	void		  ps_begin(struct termp *);
 static	void		  ps_closepage(struct termp *);
 static	void		  ps_end(struct termp *);
 static	void		  ps_endline(struct termp *);
 static	void		  ps_fclose(struct termp *);
 static	void		  ps_growbuf(struct termp *, size_t);
 static	void		  ps_letter(struct termp *, int);
 static	void		  ps_pclose(struct termp *);
 static	void		  ps_pletter(struct termp *, int);
 #if __GNUC__ - 0 >= 4
 __attribute__((__format__ (__printf__, 2, 3)))
 #endif
 static	void		  ps_printf(struct termp *, const char *, ...);
 static	void		  ps_putchar(struct termp *, char);
 static	void		  ps_setfont(struct termp *, enum termfont);
 static	void		  ps_setwidth(struct termp *, int, size_t);
 static	struct termp	 *pspdf_alloc(const struct mchars *, char *);
 static	void		  pdf_obj(struct termp *, size_t);
 
 /*
  * We define, for the time being, three fonts: bold, oblique/italic, and
  * normal (roman).  The following table hard-codes the font metrics for
  * ASCII, i.e., 32--127.
  */
 
 static	const struct font fonts[TERMFONT__MAX] = {
 	{ "Times-Roman", {
 		{ 250 },
 		{ 333 },
 		{ 408 },
 		{ 500 },
 		{ 500 },
 		{ 833 },
 		{ 778 },
 		{ 333 },
 		{ 333 },
 		{ 333 },
 		{ 500 },
 		{ 564 },
 		{ 250 },
 		{ 333 },
 		{ 250 },
 		{ 278 },
 		{ 500 },
 		{ 500 },
 		{ 500 },
 		{ 500 },
 		{ 500 },
 		{ 500 },
 		{ 500 },
 		{ 500 },
 		{ 500 },
 		{ 500 },
 		{ 278 },
 		{ 278 },
 		{ 564 },
 		{ 564 },
 		{ 564 },
 		{ 444 },
 		{ 921 },
 		{ 722 },
 		{ 667 },
 		{ 667 },
 		{ 722 },
 		{ 611 },
 		{ 556 },
 		{ 722 },
 		{ 722 },
 		{ 333 },
 		{ 389 },
 		{ 722 },
 		{ 611 },
 		{ 889 },
 		{ 722 },
 		{ 722 },
 		{ 556 },
 		{ 722 },
 		{ 667 },
 		{ 556 },
 		{ 611 },
 		{ 722 },
 		{ 722 },
 		{ 944 },
 		{ 722 },
 		{ 722 },
 		{ 611 },
 		{ 333 },
 		{ 278 },
 		{ 333 },
 		{ 469 },
 		{ 500 },
 		{ 333 },
 		{ 444 },
 		{ 500 },
 		{ 444 },
 		{  500},
 		{  444},
 		{  333},
 		{  500},
 		{  500},
 		{  278},
 		{  278},
 		{  500},
 		{  278},
 		{  778},
 		{  500},
 		{  500},
 		{  500},
 		{  500},
 		{  333},
 		{  389},
 		{  278},
 		{  500},
 		{  500},
 		{  722},
 		{  500},
 		{  500},
 		{  444},
 		{  480},
 		{  200},
 		{  480},
 		{  541},
 	} },
 	{ "Times-Bold", {
 		{ 250  },
 		{ 333  },
 		{ 555  },
 		{ 500  },
 		{ 500  },
 		{ 1000 },
 		{ 833  },
 		{ 333  },
 		{ 333  },
 		{ 333  },
 		{ 500  },
 		{ 570  },
 		{ 250  },
 		{ 333  },
 		{ 250  },
 		{ 278  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 333  },
 		{ 333  },
 		{ 570  },
 		{ 570  },
 		{ 570  },
 		{ 500  },
 		{ 930  },
 		{ 722  },
 		{ 667  },
 		{ 722  },
 		{ 722  },
 		{ 667  },
 		{ 611  },
 		{ 778  },
 		{ 778  },
 		{ 389  },
 		{ 500  },
 		{ 778  },
 		{ 667  },
 		{ 944  },
 		{ 722  },
 		{ 778  },
 		{ 611  },
 		{ 778  },
 		{ 722  },
 		{ 556  },
 		{ 667  },
 		{ 722  },
 		{ 722  },
 		{ 1000 },
 		{ 722  },
 		{ 722  },
 		{ 667  },
 		{ 333  },
 		{ 278  },
 		{ 333  },
 		{ 581  },
 		{ 500  },
 		{ 333  },
 		{ 500  },
 		{ 556  },
 		{ 444  },
 		{  556 },
 		{  444 },
 		{  333 },
 		{  500 },
 		{  556 },
 		{  278 },
 		{  333 },
 		{  556 },
 		{  278 },
 		{  833 },
 		{  556 },
 		{  500 },
 		{  556 },
 		{  556 },
 		{  444 },
 		{  389 },
 		{  333 },
 		{  556 },
 		{  500 },
 		{  722 },
 		{  500 },
 		{  500 },
 		{  444 },
 		{  394 },
 		{  220 },
 		{  394 },
 		{  520 },
 	} },
 	{ "Times-Italic", {
 		{ 250  },
 		{ 333  },
 		{ 420  },
 		{ 500  },
 		{ 500  },
 		{ 833  },
 		{ 778  },
 		{ 333  },
 		{ 333  },
 		{ 333  },
 		{ 500  },
 		{ 675  },
 		{ 250  },
 		{ 333  },
 		{ 250  },
 		{ 278  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 500  },
 		{ 333  },
 		{ 333  },
 		{ 675  },
 		{ 675  },
 		{ 675  },
 		{ 500  },
 		{ 920  },
 		{ 611  },
 		{ 611  },
 		{ 667  },
 		{ 722  },
 		{ 611  },
 		{ 611  },
 		{ 722  },
 		{ 722  },
 		{ 333  },
 		{ 444  },
 		{ 667  },
 		{ 556  },
 		{ 833  },
 		{ 667  },
 		{ 722  },
 		{ 611  },
 		{ 722  },
 		{ 611  },
 		{ 500  },
 		{ 556  },
 		{ 722  },
 		{ 611  },
 		{ 833  },
 		{ 611  },
 		{ 556  },
 		{ 556  },
 		{ 389  },
 		{ 278  },
 		{ 389  },
 		{ 422  },
 		{ 500  },
 		{ 333  },
 		{ 500  },
 		{ 500  },
 		{ 444  },
 		{  500 },
 		{  444 },
 		{  278 },
 		{  500 },
 		{  500 },
 		{  278 },
 		{  278 },
 		{  444 },
 		{  278 },
 		{  722 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  389 },
 		{  389 },
 		{  278 },
 		{  500 },
 		{  444 },
 		{  667 },
 		{  444 },
 		{  444 },
 		{  389 },
 		{  400 },
 		{  275 },
 		{  400 },
 		{  541 },
 	} },
 	{ "Times-BoldItalic", {
 		{  250 },
 		{  389 },
 		{  555 },
 		{  500 },
 		{  500 },
 		{  833 },
 		{  778 },
 		{  333 },
 		{  333 },
 		{  333 },
 		{  500 },
 		{  570 },
 		{  250 },
 		{  333 },
 		{  250 },
 		{  278 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  333 },
 		{  333 },
 		{  570 },
 		{  570 },
 		{  570 },
 		{  500 },
 		{  832 },
 		{  667 },
 		{  667 },
 		{  667 },
 		{  722 },
 		{  667 },
 		{  667 },
 		{  722 },
 		{  778 },
 		{  389 },
 		{  500 },
 		{  667 },
 		{  611 },
 		{  889 },
 		{  722 },
 		{  722 },
 		{  611 },
 		{  722 },
 		{  667 },
 		{  556 },
 		{  611 },
 		{  722 },
 		{  667 },
 		{  889 },
 		{  667 },
 		{  611 },
 		{  611 },
 		{  333 },
 		{  278 },
 		{  333 },
 		{  570 },
 		{  500 },
 		{  333 },
 		{  500 },
 		{  500 },
 		{  444 },
 		{  500 },
 		{  444 },
 		{  333 },
 		{  500 },
 		{  556 },
 		{  278 },
 		{  278 },
 		{  500 },
 		{  278 },
 		{  778 },
 		{  556 },
 		{  500 },
 		{  500 },
 		{  500 },
 		{  389 },
 		{  389 },
 		{  278 },
 		{  556 },
 		{  444 },
 		{  667 },
 		{  500 },
 		{  444 },
 		{  389 },
 		{  348 },
 		{  220 },
 		{  348 },
 		{  570 },
 	} },
 };
 
 void *
 pdf_alloc(const struct mchars *mchars, char *outopts)
 {
 	struct termp	*p;
 
 	if (NULL != (p = pspdf_alloc(mchars, outopts)))
 		p->type = TERMTYPE_PDF;
 
 	return(p);
 }
 
 void *
 ps_alloc(const struct mchars *mchars, char *outopts)
 {
 	struct termp	*p;
 
 	if (NULL != (p = pspdf_alloc(mchars, outopts)))
 		p->type = TERMTYPE_PS;
 
 	return(p);
 }
 
 static struct termp *
 pspdf_alloc(const struct mchars *mchars, char *outopts)
 {
 	struct termp	*p;
 	unsigned int	 pagex, pagey;
 	size_t		 marginx, marginy, lineheight;
 	const char	*toks[2];
 	const char	*pp;
 	char		*v;
 
 	p = mandoc_calloc(1, sizeof(struct termp));
 	p->symtab = mchars;
 	p->enc = TERMENC_ASCII;
 	p->ps = mandoc_calloc(1, sizeof(struct termp_ps));
 
 	p->advance = ps_advance;
 	p->begin = ps_begin;
 	p->end = ps_end;
 	p->endline = ps_endline;
 	p->hspan = ps_hspan;
 	p->letter = ps_letter;
 	p->setwidth = ps_setwidth;
 	p->width = ps_width;
 
 	toks[0] = "paper";
 	toks[1] = NULL;
 
 	pp = NULL;
 
 	while (outopts && *outopts)
 		switch (getsubopt(&outopts, UNCONST(toks), &v)) {
 		case 0:
 			pp = v;
 			break;
 		default:
 			break;
 		}
 
 	/* Default to US letter (millimetres). */
 
 	pagex = 216;
 	pagey = 279;
 
 	/*
 	 * The ISO-269 paper sizes can be calculated automatically, but
 	 * it would require bringing in -lm for pow() and I'd rather not
 	 * do that.  So just do it the easy way for now.  Since this
 	 * only happens once, I'm not terribly concerned.
 	 */
 
 	if (pp && strcasecmp(pp, "letter")) {
 		if (0 == strcasecmp(pp, "a3")) {
 			pagex = 297;
 			pagey = 420;
 		} else if (0 == strcasecmp(pp, "a4")) {
 			pagex = 210;
 			pagey = 297;
 		} else if (0 == strcasecmp(pp, "a5")) {
 			pagex = 148;
 			pagey = 210;
 		} else if (0 == strcasecmp(pp, "legal")) {
 			pagex = 216;
 			pagey = 356;
 		} else if (2 != sscanf(pp, "%ux%u", &pagex, &pagey))
 			fprintf(stderr, "%s: Unknown paper\n", pp);
 	}
 
 	/*
 	 * This MUST be defined before any PNT2AFM or AFM2PNT
 	 * calculations occur.
 	 */
 
 	p->ps->scale = 11;
 
 	/* Remember millimetres -> AFM units. */
 
 	pagex = PNT2AFM(p, ((double)pagex * 2.834));
 	pagey = PNT2AFM(p, ((double)pagey * 2.834));
 
 	/* Margins are 1/9 the page x and y. */
 
 	marginx = (size_t)((double)pagex / 9.0);
 	marginy = (size_t)((double)pagey / 9.0);
 
 	/* Line-height is 1.4em. */
 
 	lineheight = PNT2AFM(p, ((double)p->ps->scale * 1.4));
 
 	p->ps->width = p->ps->lastwidth = (size_t)pagex;
 	p->ps->height = (size_t)pagey;
 	p->ps->header = pagey - (marginy / 2) - (lineheight / 2);
 	p->ps->top = pagey - marginy;
 	p->ps->footer = (marginy / 2) - (lineheight / 2);
 	p->ps->bottom = marginy;
 	p->ps->left = marginx;
 	p->ps->lineheight = lineheight;
 
 	p->defrmargin = pagex - (marginx * 2);
 	return(p);
 }
 
 static void
 ps_setwidth(struct termp *p, int iop, size_t width)
 {
 	size_t	 lastwidth;
 
 	lastwidth = p->ps->width;
 	if (iop > 0)
 		p->ps->width += width;
 	else if (iop == 0)
 		p->ps->width = width ? width : p->ps->lastwidth;
 	else if (p->ps->width > width)
 		p->ps->width -= width;
 	else
 		p->ps->width = 0;
 	p->ps->lastwidth = lastwidth;
 }
 
 void
 pspdf_free(void *arg)
 {
 	struct termp	*p;
 
 	p = (struct termp *)arg;
 
 	if (p->ps->psmarg)
 		free(p->ps->psmarg);
 	if (p->ps->pdfobjs)
 		free(p->ps->pdfobjs);
 
 	free(p->ps);
 	term_free(p);
 }
 
 static void
 ps_printf(struct termp *p, const char *fmt, ...)
 {
 	va_list		 ap;
 	int		 pos, len;
 
 	va_start(ap, fmt);
 
 	/*
 	 * If we're running in regular mode, then pipe directly into
 	 * vprintf().  If we're processing margins, then push the data
 	 * into our growable margin buffer.
 	 */
 
 	if ( ! (PS_MARGINS & p->ps->flags)) {
 		len = vprintf(fmt, ap);
 		va_end(ap);
 		p->ps->pdfbytes += len < 0 ? 0 : (size_t)len;
 		return;
 	}
 
 	/*
 	 * XXX: I assume that the in-margin print won't exceed
 	 * PS_BUFSLOP (128 bytes), which is reasonable but still an
 	 * assumption that will cause pukeage if it's not the case.
 	 */
 
 	ps_growbuf(p, PS_BUFSLOP);
 
 	pos = (int)p->ps->psmargcur;
 	vsnprintf(&p->ps->psmarg[pos], PS_BUFSLOP, fmt, ap);
 
 	va_end(ap);
 
 	p->ps->psmargcur = strlen(p->ps->psmarg);
 }
 
 static void
 ps_putchar(struct termp *p, char c)
 {
 	int		 pos;
 
 	/* See ps_printf(). */
 
 	if ( ! (PS_MARGINS & p->ps->flags)) {
 		putchar(c);
 		p->ps->pdfbytes++;
 		return;
 	}
 
 	ps_growbuf(p, 2);
 
 	pos = (int)p->ps->psmargcur++;
 	p->ps->psmarg[pos++] = c;
 	p->ps->psmarg[pos] = '\0';
 }
 
 static void
 pdf_obj(struct termp *p, size_t obj)
 {
 
 	assert(obj > 0);
 
 	if ((obj - 1) >= p->ps->pdfobjsz) {
 		p->ps->pdfobjsz = obj + 128;
 		p->ps->pdfobjs = mandoc_reallocarray(p->ps->pdfobjs,
 		    p->ps->pdfobjsz, sizeof(size_t));
 	}
 
 	p->ps->pdfobjs[(int)obj - 1] = p->ps->pdfbytes;
 	ps_printf(p, "%zu 0 obj\n", obj);
 }
 
 static void
 ps_closepage(struct termp *p)
 {
 	int		 i;
 	size_t		 len, base;
 
 	/*
 	 * Close out a page that we've already flushed to output.  In
 	 * PostScript, we simply note that the page must be showed.  In
 	 * PDF, we must now create the Length, Resource, and Page node
 	 * for the page contents.
 	 */
 
 	assert(p->ps->psmarg && p->ps->psmarg[0]);
 	ps_printf(p, "%s", p->ps->psmarg);
 
 	if (TERMTYPE_PS != p->type) {
 		ps_printf(p, "ET\n");
 
 		len = p->ps->pdfbytes - p->ps->pdflastpg;
 		base = p->ps->pages * 4 + p->ps->pdfbody;
 
 		ps_printf(p, "endstream\nendobj\n");
 
 		/* Length of content. */
 		pdf_obj(p, base + 1);
 		ps_printf(p, "%zu\nendobj\n", len);
 
 		/* Resource for content. */
 		pdf_obj(p, base + 2);
 		ps_printf(p, "<<\n/ProcSet [/PDF /Text]\n");
 		ps_printf(p, "/Font <<\n");
 		for (i = 0; i < (int)TERMFONT__MAX; i++)
 			ps_printf(p, "/F%d %d 0 R\n", i, 3 + i);
 		ps_printf(p, ">>\n>>\n");
 
 		/* Page node. */
 		pdf_obj(p, base + 3);
 		ps_printf(p, "<<\n");
 		ps_printf(p, "/Type /Page\n");
 		ps_printf(p, "/Parent 2 0 R\n");
 		ps_printf(p, "/Resources %zu 0 R\n", base + 2);
 		ps_printf(p, "/Contents %zu 0 R\n", base);
 		ps_printf(p, ">>\nendobj\n");
 	} else
 		ps_printf(p, "showpage\n");
 
 	p->ps->pages++;
 	p->ps->psrow = p->ps->top;
 	assert( ! (PS_NEWPAGE & p->ps->flags));
 	p->ps->flags |= PS_NEWPAGE;
 }
 
 static void
 ps_end(struct termp *p)
 {
 	size_t		 i, xref, base;
 
 	/*
 	 * At the end of the file, do one last showpage.  This is the
 	 * same behaviour as groff(1) and works for multiple pages as
 	 * well as just one.
 	 */
 
 	if ( ! (PS_NEWPAGE & p->ps->flags)) {
 		assert(0 == p->ps->flags);
 		assert('\0' == p->ps->last);
 		ps_closepage(p);
 	}
 
 	if (TERMTYPE_PS == p->type) {
 		ps_printf(p, "%%%%Trailer\n");
 		ps_printf(p, "%%%%Pages: %zu\n", p->ps->pages);
 		ps_printf(p, "%%%%EOF\n");
 		return;
 	}
 
 	pdf_obj(p, 2);
 	ps_printf(p, "<<\n/Type /Pages\n");
 	ps_printf(p, "/MediaBox [0 0 %zu %zu]\n",
 			(size_t)AFM2PNT(p, p->ps->width),
 			(size_t)AFM2PNT(p, p->ps->height));
 
 	ps_printf(p, "/Count %zu\n", p->ps->pages);
 	ps_printf(p, "/Kids [");
 
 	for (i = 0; i < p->ps->pages; i++)
 		ps_printf(p, " %zu 0 R", i * 4 + p->ps->pdfbody + 3);
 
 	base = (p->ps->pages - 1) * 4 + p->ps->pdfbody + 4;
 
 	ps_printf(p, "]\n>>\nendobj\n");
 	pdf_obj(p, base);
 	ps_printf(p, "<<\n");
 	ps_printf(p, "/Type /Catalog\n");
 	ps_printf(p, "/Pages 2 0 R\n");
 	ps_printf(p, ">>\n");
 	xref = p->ps->pdfbytes;
 	ps_printf(p, "xref\n");
 	ps_printf(p, "0 %zu\n", base + 1);
 	ps_printf(p, "0000000000 65535 f \n");
 
 	for (i = 0; i < base; i++)
 		ps_printf(p, "%.10zu 00000 n \n",
 		    p->ps->pdfobjs[(int)i]);
 
 	ps_printf(p, "trailer\n");
 	ps_printf(p, "<<\n");
 	ps_printf(p, "/Size %zu\n", base + 1);
 	ps_printf(p, "/Root %zu 0 R\n", base);
 	ps_printf(p, "/Info 1 0 R\n");
 	ps_printf(p, ">>\n");
 	ps_printf(p, "startxref\n");
 	ps_printf(p, "%zu\n", xref);
 	ps_printf(p, "%%%%EOF\n");
 }
 
 static void
 ps_begin(struct termp *p)
 {
 	int		 i;
 
 	/*
 	 * Print margins into margin buffer.  Nothing gets output to the
 	 * screen yet, so we don't need to initialise the primary state.
 	 */
 
 	if (p->ps->psmarg) {
 		assert(p->ps->psmargsz);
 		p->ps->psmarg[0] = '\0';
 	}
 
 	/*p->ps->pdfbytes = 0;*/
 	p->ps->psmargcur = 0;
 	p->ps->flags = PS_MARGINS;
 	p->ps->pscol = p->ps->left;
 	p->ps->psrow = p->ps->header;
 
 	ps_setfont(p, TERMFONT_NONE);
 
 	(*p->headf)(p, p->argf);
 	(*p->endline)(p);
 
 	p->ps->pscol = p->ps->left;
 	p->ps->psrow = p->ps->footer;
 
 	(*p->footf)(p, p->argf);
 	(*p->endline)(p);
 
 	p->ps->flags &= ~PS_MARGINS;
 
 	assert(0 == p->ps->flags);
 	assert(p->ps->psmarg);
 	assert('\0' != p->ps->psmarg[0]);
 
 	/*
 	 * Print header and initialise page state.  Following this,
 	 * stuff gets printed to the screen, so make sure we're sane.
 	 */
 
 	if (TERMTYPE_PS == p->type) {
 		ps_printf(p, "%%!PS-Adobe-3.0\n");
 		ps_printf(p, "%%%%DocumentData: Clean7Bit\n");
 		ps_printf(p, "%%%%Orientation: Portrait\n");
 		ps_printf(p, "%%%%Pages: (atend)\n");
 		ps_printf(p, "%%%%PageOrder: Ascend\n");
 		ps_printf(p, "%%%%DocumentMedia: "
 		    "Default %zu %zu 0 () ()\n",
 		    (size_t)AFM2PNT(p, p->ps->width),
 		    (size_t)AFM2PNT(p, p->ps->height));
 		ps_printf(p, "%%%%DocumentNeededResources: font");
 
 		for (i = 0; i < (int)TERMFONT__MAX; i++)
 			ps_printf(p, " %s", fonts[i].name);
 
 		ps_printf(p, "\n%%%%EndComments\n");
 	} else {
 		ps_printf(p, "%%PDF-1.1\n");
 		pdf_obj(p, 1);
 		ps_printf(p, "<<\n");
 		ps_printf(p, ">>\n");
 		ps_printf(p, "endobj\n");
 
 		for (i = 0; i < (int)TERMFONT__MAX; i++) {
 			pdf_obj(p, (size_t)i + 3);
 			ps_printf(p, "<<\n");
 			ps_printf(p, "/Type /Font\n");
 			ps_printf(p, "/Subtype /Type1\n");
 			ps_printf(p, "/Name /F%d\n", i);
 			ps_printf(p, "/BaseFont /%s\n", fonts[i].name);
 			ps_printf(p, ">>\n");
 		}
 	}
 
 	p->ps->pdfbody = (size_t)TERMFONT__MAX + 3;
 	p->ps->pscol = p->ps->left;
 	p->ps->psrow = p->ps->top;
 	p->ps->flags |= PS_NEWPAGE;
 	ps_setfont(p, TERMFONT_NONE);
 }
 
 static void
 ps_pletter(struct termp *p, int c)
 {
 	int		 f;
 
 	/*
 	 * If we haven't opened a page context, then output that we're
 	 * in a new page and make sure the font is correctly set.
 	 */
 
 	if (PS_NEWPAGE & p->ps->flags) {
 		if (TERMTYPE_PS == p->type) {
 			ps_printf(p, "%%%%Page: %zu %zu\n",
 			    p->ps->pages + 1, p->ps->pages + 1);
 			ps_printf(p, "/%s %zu selectfont\n",
 			    fonts[(int)p->ps->lastf].name,
 			    p->ps->scale);
 		} else {
 			pdf_obj(p, p->ps->pdfbody +
 			    p->ps->pages * 4);
 			ps_printf(p, "<<\n");
 			ps_printf(p, "/Length %zu 0 R\n",
 			    p->ps->pdfbody + 1 + p->ps->pages * 4);
 			ps_printf(p, ">>\nstream\n");
 		}
 		p->ps->pdflastpg = p->ps->pdfbytes;
 		p->ps->flags &= ~PS_NEWPAGE;
 	}
 
 	/*
 	 * If we're not in a PostScript "word" context, then open one
 	 * now at the current cursor.
 	 */
 
 	if ( ! (PS_INLINE & p->ps->flags)) {
 		if (TERMTYPE_PS != p->type) {
 			ps_printf(p, "BT\n/F%d %zu Tf\n",
 			    (int)p->ps->lastf, p->ps->scale);
 			ps_printf(p, "%.3f %.3f Td\n(",
 			    AFM2PNT(p, p->ps->pscol),
 			    AFM2PNT(p, p->ps->psrow));
 		} else
 			ps_printf(p, "%.3f %.3f moveto\n(",
 			    AFM2PNT(p, p->ps->pscol),
 			    AFM2PNT(p, p->ps->psrow));
 		p->ps->flags |= PS_INLINE;
 	}
 
 	assert( ! (PS_NEWPAGE & p->ps->flags));
 
 	/*
 	 * We need to escape these characters as per the PostScript
 	 * specification.  We would also escape non-graphable characters
 	 * (like tabs), but none of them would get to this point and
 	 * it's superfluous to abort() on them.
 	 */
 
 	switch (c) {
 	case '(':
 		/* FALLTHROUGH */
 	case ')':
 		/* FALLTHROUGH */
 	case '\\':
 		ps_putchar(p, '\\');
 		break;
 	default:
 		break;
 	}
 
 	/* Write the character and adjust where we are on the page. */
 
 	f = (int)p->ps->lastf;
 
 	if (c <= 32 || c - 32 >= MAXCHAR)
 		c = 32;
 
 	ps_putchar(p, (char)c);
 	c -= 32;
 	p->ps->pscol += (size_t)fonts[f].gly[c].wx;
 }
 
 static void
 ps_pclose(struct termp *p)
 {
 
 	/*
 	 * Spit out that we're exiting a word context (this is a
 	 * "partial close" because we don't check the last-char buffer
 	 * or anything).
 	 */
 
 	if ( ! (PS_INLINE & p->ps->flags))
 		return;
 
 	if (TERMTYPE_PS != p->type) {
 		ps_printf(p, ") Tj\nET\n");
 	} else
 		ps_printf(p, ") show\n");
 
 	p->ps->flags &= ~PS_INLINE;
 }
 
 static void
 ps_fclose(struct termp *p)
 {
 
 	/*
 	 * Strong closure: if we have a last-char, spit it out after
 	 * checking that we're in the right font mode.  This will of
 	 * course open a new scope, if applicable.
 	 *
 	 * Following this, close out any scope that's open.
 	 */
 
 	if (p->ps->last != '\0') {
 		assert( ! (p->ps->flags & PS_BACKSP));
 		if (p->ps->nextf != p->ps->lastf) {
 			ps_pclose(p);
 			ps_setfont(p, p->ps->nextf);
 		}
 		p->ps->nextf = TERMFONT_NONE;
 		ps_pletter(p, p->ps->last);
 		p->ps->last = '\0';
 	}
 
 	if ( ! (PS_INLINE & p->ps->flags))
 		return;
 
 	ps_pclose(p);
 }
 
 static void
 ps_letter(struct termp *p, int arg)
 {
 	size_t		savecol;
 	char		c;
 
 	c = arg >= 128 || arg <= 0 ? '?' : arg;
 
 	/*
 	 * When receiving a backspace, merely flag it.
 	 * We don't know yet whether it is
 	 * a font instruction or an overstrike.
 	 */
 
 	if (c == '\b') {
 		assert(p->ps->last != '\0');
 		assert( ! (p->ps->flags & PS_BACKSP));
 		p->ps->flags |= PS_BACKSP;
 		return;
 	}
 
 	/*
 	 * Decode font instructions.
 	 */
 
 	if (p->ps->flags & PS_BACKSP) {
 		if (p->ps->last == '_') {
 			switch (p->ps->nextf) {
 			case TERMFONT_BI:
 				break;
 			case TERMFONT_BOLD:
 				p->ps->nextf = TERMFONT_BI;
 				break;
 			default:
 				p->ps->nextf = TERMFONT_UNDER;
 			}
 			p->ps->last = c;
 			p->ps->flags &= ~PS_BACKSP;
 			return;
 		}
 		if (p->ps->last == c) {
 			switch (p->ps->nextf) {
 			case TERMFONT_BI:
 				break;
 			case TERMFONT_UNDER:
 				p->ps->nextf = TERMFONT_BI;
 				break;
 			default:
 				p->ps->nextf = TERMFONT_BOLD;
 			}
 			p->ps->flags &= ~PS_BACKSP;
 			return;
 		}
 
 		/*
 		 * This is not a font instruction, but rather
 		 * the next character.  Prepare for overstrike.
 		 */
 
 		savecol = p->ps->pscol;
 	} else
 		savecol = SIZE_MAX;
 
 	/*
 	 * We found the next character, so the font instructions
 	 * for the previous one are complete.
 	 * Use them and print it.
 	 */
 
 	if (p->ps->last != '\0') {
 		if (p->ps->nextf != p->ps->lastf) {
 			ps_pclose(p);
 			ps_setfont(p, p->ps->nextf);
 		}
 		p->ps->nextf = TERMFONT_NONE;
 		ps_pletter(p, p->ps->last);
 	}
 
 	/*
 	 * Do not print the current character yet because font
 	 * instructions might follow; only remember it.
 	 * For the first character, nothing else is done.
 	 * The final character will get printed from ps_fclose().
 	 */
 
 	p->ps->last = c;
 
 	/*
 	 * For an overstrike, back up to the previous position.
 	 */
 
 	if (savecol != SIZE_MAX) {
 		ps_pclose(p);
 		p->ps->pscol = savecol;
 		p->ps->flags &= ~PS_BACKSP;
 	}
 }
 
 static void
 ps_advance(struct termp *p, size_t len)
 {
 
 	/*
 	 * Advance some spaces.  This can probably be made smarter,
 	 * i.e., to have multiple space-separated words in the same
 	 * scope, but this is easier:  just close out the current scope
 	 * and readjust our column settings.
 	 */
 
 	ps_fclose(p);
 	p->ps->pscol += len;
 }
 
 static void
 ps_endline(struct termp *p)
 {
 
 	/* Close out any scopes we have open: we're at eoln. */
 
 	ps_fclose(p);
 
 	/*
 	 * If we're in the margin, don't try to recalculate our current
 	 * row.  XXX: if the column tries to be fancy with multiple
 	 * lines, we'll do nasty stuff.
 	 */
 
 	if (PS_MARGINS & p->ps->flags)
 		return;
 
 	/* Left-justify. */
 
 	p->ps->pscol = p->ps->left;
 
 	/* If we haven't printed anything, return. */
 
 	if (PS_NEWPAGE & p->ps->flags)
 		return;
 
 	/*
 	 * Put us down a line.  If we're at the page bottom, spit out a
 	 * showpage and restart our row.
 	 */
 
 	if (p->ps->psrow >= p->ps->lineheight + p->ps->bottom) {
 		p->ps->psrow -= p->ps->lineheight;
 		return;
 	}
 
 	ps_closepage(p);
 }
 
 static void
 ps_setfont(struct termp *p, enum termfont f)
 {
 
 	assert(f < TERMFONT__MAX);
 	p->ps->lastf = f;
 
 	/*
 	 * If we're still at the top of the page, let the font-setting
 	 * be delayed until we actually have stuff to print.
 	 */
 
 	if (PS_NEWPAGE & p->ps->flags)
 		return;
 
 	if (TERMTYPE_PS == p->type)
 		ps_printf(p, "/%s %zu selectfont\n",
 		    fonts[(int)f].name, p->ps->scale);
 	else
 		ps_printf(p, "/F%d %zu Tf\n",
 		    (int)f, p->ps->scale);
 }
 
 static size_t
 ps_width(const struct termp *p, int c)
 {
 
 	if (c <= 32 || c - 32 >= MAXCHAR)
 		c = 0;
 	else
 		c -= 32;
 
 	return((size_t)fonts[(int)TERMFONT_NONE].gly[c].wx);
 }
 
 static double
 ps_hspan(const struct termp *p, const struct roffsu *su)
 {
 	double		 r;
 
 	/*
 	 * All of these measurements are derived by converting from the
 	 * native measurement to AFM units.
 	 */
 	switch (su->unit) {
 	case SCALE_BU:
 		/*
 		 * Traditionally, the default unit is fixed to the
 		 * output media.  So this would refer to the point.  In
 		 * mandoc(1), however, we stick to the default terminal
 		 * scaling unit so that output is the same regardless
 		 * the media.
 		 */
 		r = PNT2AFM(p, su->scale * 72.0 / 240.0);
 		break;
 	case SCALE_CM:
 		r = PNT2AFM(p, su->scale * 72.0 / 2.54);
 		break;
 	case SCALE_EM:
 		r = su->scale *
 		    fonts[(int)TERMFONT_NONE].gly[109 - 32].wx;
 		break;
 	case SCALE_EN:
 		r = su->scale *
 		    fonts[(int)TERMFONT_NONE].gly[110 - 32].wx;
 		break;
 	case SCALE_IN:
 		r = PNT2AFM(p, su->scale * 72.0);
 		break;
 	case SCALE_MM:
 		r = su->scale *
 		    fonts[(int)TERMFONT_NONE].gly[109 - 32].wx / 100.0;
 		break;
 	case SCALE_PC:
 		r = PNT2AFM(p, su->scale * 12.0);
 		break;
 	case SCALE_PT:
 		r = PNT2AFM(p, su->scale * 1.0);
 		break;
 	case SCALE_VS:
 		r = su->scale * p->ps->lineheight;
 		break;
 	default:
 		r = su->scale;
 		break;
 	}
 
 	return(r);
 }
 
 static void
 ps_growbuf(struct termp *p, size_t sz)
 {
 	if (p->ps->psmargcur + sz <= p->ps->psmargsz)
 		return;
 
 	if (sz < PS_BUFSLOP)
 		sz = PS_BUFSLOP;
 
 	p->ps->psmargsz += sz;
 	p->ps->psmarg = mandoc_realloc(p->ps->psmarg, p->ps->psmargsz);
 }
Index: projects/arm_intrng/contrib/mdocml
===================================================================
--- projects/arm_intrng/contrib/mdocml	(revision 276247)
+++ projects/arm_intrng/contrib/mdocml	(revision 276248)

Property changes on: projects/arm_intrng/contrib/mdocml
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,2 ##
   Merged /vendor/mdocml/dist:r275432-276217
   Merged /head/contrib/mdocml:r276010-276247
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/Makefile	(revision 276247)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/Makefile	(nonexistent)
@@ -1,28 +0,0 @@
-CFLAGS=	-I../../../../sys/ofed/include -libverbs -lmlx4 -lmthca -pthread
-
-all:	asyncwatch devinfo device_list rc_pingpong srq_pingpong uc_pingpong ud_pingpong
-
-clean:
-	rm asyncwatch devinfo device_list rc_pingpong srq_pingpong uc_pingpong ud_pingpong
-
-asyncwatch:
-	gcc -o asyncwatch asyncwatch.c ${CFLAGS}
-
-devinfo:
-	gcc -o devinfo devinfo.c ${CFLAGS}
-
-device_list:
-	gcc -o device_list device_list.c  ${CFLAGS}
-
-rc_pingpong:
-	gcc -o rc_pingpong rc_pingpong.c pingpong.c ${CFLAGS}
-
-srq_pingpong:
-	gcc -o srq_pingpong srq_pingpong.c pingpong.c ${CFLAGS}
-
-uc_pingpong:
-	gcc -o uc_pingpong uc_pingpong.c pingpong.c ${CFLAGS}
-
-ud_pingpong:
-	gcc -o ud_pingpong ud_pingpong.c pingpong.c ${CFLAGS}
-

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/Makefile
___________________________________________________________________
Deleted: fbsd:nokeywords
## -1 +0,0 ##
-true
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/Makefile	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/Makefile	(revision 276248)
@@ -0,0 +1,4 @@
+SUBDIR= asyncwatch devinfo device_list rc_pingpong \
+	srq_pingpong uc_pingpong ud_pingpong
+
+.include 

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/Makefile.inc
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/Makefile.inc	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/Makefile.inc	(revision 276248)
@@ -0,0 +1,7 @@
+CFLAGS+= \
+	-I../../../../../../sys/ofed/include \
+	-I../../../../libibverbs/include \
+	-I../../../../include
+
+LDADD+= -libverbs -lmlx4 -lmthca -pthread
+

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/Makefile.inc
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/asyncwatch/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/asyncwatch/Makefile	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/asyncwatch/Makefile	(revision 276248)
@@ -0,0 +1,9 @@
+#
+# $FreeBSD$
+#
+.PATH: ${.CURDIR}/../..
+PROG=	asyncwatch
+MAN=
+SRCS=	asyncwatch.c
+
+.include 

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/asyncwatch/Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/device_list/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/device_list/Makefile	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/device_list/Makefile	(revision 276248)
@@ -0,0 +1,9 @@
+#
+# $FreeBSD$
+#
+.PATH: ${.CURDIR}/../..
+PROG=	device_list
+MAN=
+SRCS=	device_list.c
+
+.include 

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/device_list/Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/devinfo/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/devinfo/Makefile	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/devinfo/Makefile	(revision 276248)
@@ -0,0 +1,9 @@
+#
+# $FreeBSD$
+#
+.PATH: ${.CURDIR}/../..
+PROG=	devinfo
+MAN=
+SRCS=	devinfo.c
+
+.include 

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/devinfo/Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/rc_pingpong/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/rc_pingpong/Makefile	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/rc_pingpong/Makefile	(revision 276248)
@@ -0,0 +1,9 @@
+#
+# $FreeBSD$
+#
+.PATH: ${.CURDIR}/../..
+PROG=	rc_pingpong
+MAN=
+SRCS=	rc_pingpong.c pingpong.c
+
+.include 

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/rc_pingpong/Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/srq_pingpong/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/srq_pingpong/Makefile	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/srq_pingpong/Makefile	(revision 276248)
@@ -0,0 +1,9 @@
+#
+# $FreeBSD$
+#
+.PATH: ${.CURDIR}/../..
+PROG=	srq_pingpong
+MAN=
+SRCS=	srq_pingpong.c pingpong.c
+
+.include 

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/srq_pingpong/Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/uc_pingpong/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/uc_pingpong/Makefile	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/uc_pingpong/Makefile	(revision 276248)
@@ -0,0 +1,9 @@
+#
+# $FreeBSD$
+#
+.PATH: ${.CURDIR}/../..
+PROG=	uc_pingpong
+MAN=
+SRCS=	uc_pingpong.c pingpong.c
+
+.include 

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/uc_pingpong/Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/ud_pingpong/Makefile
===================================================================
--- projects/arm_intrng/contrib/ofed/libibverbs/examples/build/ud_pingpong/Makefile	(nonexistent)
+++ projects/arm_intrng/contrib/ofed/libibverbs/examples/build/ud_pingpong/Makefile	(revision 276248)
@@ -0,0 +1,9 @@
+#
+# $FreeBSD$
+#
+.PATH: ${.CURDIR}/../..
+PROG=	ud_pingpong
+MAN=
+SRCS=	ud_pingpong.c pingpong.c
+
+.include 

Property changes on: projects/arm_intrng/contrib/ofed/libibverbs/examples/build/ud_pingpong/Makefile
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+true
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Index: projects/arm_intrng/gnu/usr.bin/gdb/kgdb/trgt_arm.c
===================================================================
--- projects/arm_intrng/gnu/usr.bin/gdb/kgdb/trgt_arm.c	(revision 276247)
+++ projects/arm_intrng/gnu/usr.bin/gdb/kgdb/trgt_arm.c	(revision 276248)
@@ -1,247 +1,239 @@
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * 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 AUTHORS ``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 AUTHORS 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.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 #ifndef CROSS_DEBUGGER
 #include 
 #include 
 #include 
 #endif
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "kgdb.h"
 
 CORE_ADDR
 kgdb_trgt_core_pcb(u_int cpuid)
 {
 #ifndef CROSS_DEBUGGER
 	return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb)));
 #else
 	return -1;
 #endif
 }
 
 void
 kgdb_trgt_fetch_registers(int regno __unused)
 {
 #ifndef CROSS_DEBUGGER
 	struct kthr *kt;
 	struct pcb pcb;
 	int i, reg;
 
 	kt = kgdb_thr_lookup_tid(ptid_get_pid(inferior_ptid));
 	if (kt == NULL)
 		return;
 	if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) {
 		warnx("kvm_read: %s", kvm_geterr(kvm));
 		memset(&pcb, 0, sizeof(pcb));
 	}
-	for (i = ARM_A1_REGNUM + 8; i <= ARM_SP_REGNUM; i++) {
-		supply_register(i, (char *)&pcb.un_32.pcb32_r8 +
-		    (i - (ARM_A1_REGNUM + 8 )) * 4);
+	for (i = ARM_A1_REGNUM + 4; i <= ARM_SP_REGNUM; i++) {
+		supply_register(i, (char *)&pcb.pcb_regs.sf_r4 +
+		    (i - (ARM_A1_REGNUM + 4 )) * 4);
 	}
-	if (pcb.un_32.pcb32_sp != 0) {
-		for (i = 0; i < 4; i++) {
-			if (kvm_read(kvm, pcb.un_32.pcb32_sp + (i) * 4,
-			    ®, 4) != 4) {
-				warnx("kvm_read: %s", kvm_geterr(kvm));
-				break;
-			}
-			supply_register(ARM_A1_REGNUM + 4 + i, (char *)®);
-		}
-		if (kvm_read(kvm, pcb.un_32.pcb32_sp + 4 * 4, ®, 4) != 4)
+	if (pcb.pcb_regs.sf_sp != 0) {
+		if (kvm_read(kvm, pcb.pcb_regs.sf_sp + 4 * 4, ®, 4) != 4)
 			warnx("kvm_read :%s", kvm_geterr(kvm));
 		else
 			supply_register(ARM_PC_REGNUM, (char *)®);
 	}
 #endif
 }
 
 void
 kgdb_trgt_store_registers(int regno __unused)
 {
 	fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
 }
 
 void
 kgdb_trgt_new_objfile(struct objfile *objfile)
 {
 }
 
 #ifndef CROSS_DEBUGGER
 struct kgdb_frame_cache {
 	CORE_ADDR	fp;
 	CORE_ADDR	sp;
 };
 
 static int kgdb_trgt_frame_offset[26] = {
 	offsetof(struct trapframe, tf_r0),
 	offsetof(struct trapframe, tf_r1),
 	offsetof(struct trapframe, tf_r2),
 	offsetof(struct trapframe, tf_r3),
 	offsetof(struct trapframe, tf_r4),
 	offsetof(struct trapframe, tf_r5),
 	offsetof(struct trapframe, tf_r6),
 	offsetof(struct trapframe, tf_r7),
 	offsetof(struct trapframe, tf_r8),
 	offsetof(struct trapframe, tf_r9),
 	offsetof(struct trapframe, tf_r10),
 	offsetof(struct trapframe, tf_r11),
 	offsetof(struct trapframe, tf_r12),
 	offsetof(struct trapframe, tf_svc_sp),
 	offsetof(struct trapframe, tf_svc_lr),
 	offsetof(struct trapframe, tf_pc),
 	-1, -1, -1, -1, -1, -1, -1, -1, -1,
 	offsetof(struct trapframe, tf_spsr)
 };
 
 static struct kgdb_frame_cache *
 kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
 {
 	char buf[MAX_REGISTER_SIZE];
 	struct kgdb_frame_cache *cache;
 
 	cache = *this_cache;
 	if (cache == NULL) {
 		cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache);
 		*this_cache = cache;
 		frame_unwind_register(next_frame, ARM_SP_REGNUM, buf);
 		cache->sp = extract_unsigned_integer(buf,
 		    register_size(current_gdbarch, ARM_SP_REGNUM));
 		frame_unwind_register(next_frame, ARM_FP_REGNUM, buf);
 		cache->fp = extract_unsigned_integer(buf,
 		    register_size(current_gdbarch, ARM_FP_REGNUM));
 	}
 	return (cache);
 }
 
 static int is_undef;
 
 static void
 kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
     struct frame_id *this_id)
 {
 	struct kgdb_frame_cache *cache;
 
 	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
 	*this_id = frame_id_build(cache->fp, 0);
 }
 
 static void
 kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
     void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
     CORE_ADDR *addrp, int *realnump, void *valuep)
 {
 	char dummy_valuep[MAX_REGISTER_SIZE];
 	struct kgdb_frame_cache *cache;
 	int ofs, regsz;
 	int is_undefined = 0;
 
 	regsz = register_size(current_gdbarch, regnum);
 
 	if (valuep == NULL)
 		valuep = dummy_valuep;
 	memset(valuep, 0, regsz);
 	*optimizedp = 0;
 	*addrp = 0;
 	*lvalp = not_lval;
 	*realnump = -1;
 
 	ofs = (regnum >= 0 && regnum <= ARM_PS_REGNUM)
 	    ? kgdb_trgt_frame_offset[regnum] : -1;
 	if (ofs == -1)
 		return;
 
 	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
 
 	if (is_undef && (regnum == ARM_SP_REGNUM || regnum == ARM_PC_REGNUM)) {
 		*addrp = cache->sp + offsetof(struct trapframe, tf_spsr);
 		target_read_memory(*addrp, valuep, regsz);
 		is_undefined = 1;
 		ofs = kgdb_trgt_frame_offset[ARM_SP_REGNUM];
 
 	}
 	*addrp = cache->sp + ofs;
 	*lvalp = lval_memory;
 	target_read_memory(*addrp, valuep, regsz);
 
 	if (is_undefined) {
 		*addrp = *(unsigned int *)valuep + (regnum == ARM_SP_REGNUM ?
 		    0 : 8);
 		target_read_memory(*addrp, valuep, regsz);
 
 	}
 }
 
 static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
         UNKNOWN_FRAME,
         &kgdb_trgt_trapframe_this_id,
         &kgdb_trgt_trapframe_prev_register
 };
 #endif
 
 const struct frame_unwind *
 kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
 {
 #ifndef CROSS_DEBUGGER
 	char *pname;
 	CORE_ADDR pc;
 
 	pc = frame_pc_unwind(next_frame);
 	pname = NULL;
 	find_pc_partial_function(pc, &pname, NULL, NULL);
 	if (pname == NULL) {
 		is_undef = 0;
 		return (NULL);
 	}
 	if (!strcmp(pname, "undefinedinstruction"))
 		is_undef = 1;
 	if (strcmp(pname, "Laddress_exception_entry") == 0 ||
 	    strcmp(pname, "undefined_entry") == 0 ||
 	    strcmp(pname, "exception_exit") == 0 ||
 	    strcmp(pname, "Laddress_exception_msg") == 0 ||
 	    strcmp(pname, "irq_entry") == 0)
 		return (&kgdb_trgt_trapframe_unwind);
 	if (!strcmp(pname, "undefinedinstruction"))
 		is_undef = 1;
 	else
 		is_undef = 0;
 #endif
 	return (NULL);
 }
Index: projects/arm_intrng/gnu/usr.bin/gdb
===================================================================
--- projects/arm_intrng/gnu/usr.bin/gdb	(revision 276247)
+++ projects/arm_intrng/gnu/usr.bin/gdb	(revision 276248)

Property changes on: projects/arm_intrng/gnu/usr.bin/gdb
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head/gnu/usr.bin/gdb:r276010-276247
Index: projects/arm_intrng/include/Makefile
===================================================================
--- projects/arm_intrng/include/Makefile	(revision 276247)
+++ projects/arm_intrng/include/Makefile	(revision 276248)
@@ -1,350 +1,346 @@
 #	@(#)Makefile	8.2 (Berkeley) 1/4/94
 # $FreeBSD$
 #
 # Doing a "make install" builds /usr/include.
 
 .include 
 
 CLEANFILES= osreldate.h version vers.c
 SUBDIR= arpa protocols rpcsvc rpc xlocale
 INCS=	a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
 	db.h \
 	dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
 	fts.h ftw.h getopt.h glob.h grp.h \
 	ieeefp.h ifaddrs.h \
 	inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
 	locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
 	ndbm.h netconfig.h \
 	netdb.h nl_types.h nlist.h nss.h nsswitch.h paths.h \
 	printf.h proc_service.h pthread.h \
 	pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \
 	res_update.h resolv.h runetype.h search.h semaphore.h setjmp.h \
 	signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \
 	stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \
 	strings.h sysexits.h tar.h termios.h tgmath.h \
 	time.h timeconv.h timers.h ttyent.h \
 	uchar.h ulimit.h unistd.h utime.h utmpx.h uuid.h varargs.h \
 	wchar.h wctype.h wordexp.h xlocale.h
 
 .PATH: ${.CURDIR}/../contrib/libc-vis
 INCS+=	vis.h
 
 MHDRS=	float.h floatingpoint.h stdarg.h
 
 PHDRS=	sched.h _semaphore.h
 
 LHDRS=	aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \
 	syslog.h ucontext.h
 
 LDIRS=	bsm cam geom net net80211 netgraph netinet netinet6 \
 	netipsec netnatm netsmb nfs nfsclient nfsserver sys vm
 
 LSUBDIRS=	cam/ata cam/scsi \
 	dev/acpica dev/agp dev/an dev/bktr dev/ciss dev/filemon dev/firewire \
 	dev/hwpmc \
-	dev/ic dev/iicbus ${_dev_ieee488} dev/io dev/lmc dev/mfi dev/nvme \
+	dev/ic dev/iicbus dev/io dev/lmc dev/mfi dev/nvme \
 	dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \
 	dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \
 	fs/cuse \
 	fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \
 	fs/procfs fs/smbfs fs/udf fs/unionfs \
 	geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \
 	geom/mirror geom/mountver geom/multipath geom/nop \
 	geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \
 	netgraph/atm netgraph/netflow \
 	security/audit \
 	security/mac_biba security/mac_bsdextended security/mac_lomac \
 	security/mac_mls security/mac_partition \
 	ufs/ffs ufs/ufs
 
 LSUBSUBDIRS=	dev/mpt/mpilib
 
 .if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
 _dev_powermac_nvram=	dev/powermac_nvram
-.endif
-
-.if ${MK_GPIB} != "no"
-_dev_ieee488=	dev/ieee488
 .endif
 
 .if ${MK_GSSAPI} != "no"
 SUBDIR+=	gssapi
 INCS+=		gssapi.h
 .endif
 
 .if ${MK_HESIOD} != "no"
 INCS+=	hesiod.h
 .endif
 
 .if ${MK_BLUETOOTH} != "no"
 LSUBSUBDIRS+=	netgraph/bluetooth/include
 .endif
 
 # Handle the #define aliases for libiconv
 .if ${MK_ICONV} == "yes"
 INCS+=		iconv.h
 .endif
 	
 
 # Define SHARED to indicate whether you want symbolic links to the system
 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
 # probably only useful for developers and should be avoided if you do not
 # wish to tie your /usr/include and /usr/src together.
 #SHARED=	symlinks
 SHARED?=	copies
 
 INCS+=	osreldate.h
 
 SYSDIR=			${.CURDIR}/../sys
 NEWVERS_SH=		${SYSDIR}/conf/newvers.sh
 PARAM_H=		${SYSDIR}/sys/param.h
 MK_OSRELDATE_SH=	${.CURDIR}/mk-osreldate.sh
 
 osreldate.h vers.c: ${NEWVERS_SH} ${PARAM_H} ${MK_OSRELDATE_SH}
 	env ECHO="${ECHO}" \
 	    MAKE="${MAKE}" \
 	    NEWVERS_SH=${NEWVERS_SH} \
 	    PARAM_H=${PARAM_H} \
 	    SYSDIR=${SYSDIR} \
 	    sh ${MK_OSRELDATE_SH}
 
 .for i in ${LHDRS}
 INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
 .endfor
 .for i in ${MHDRS}
 INCSLINKS+=	machine/$i ${INCLUDEDIR}/$i
 .endfor
 .for i in ${PHDRS}
 INCSLINKS+=	sys/$i ${INCLUDEDIR}/$i
 .endfor
 
 .if ${MACHINE} != ${MACHINE_CPUARCH}
 _MARCHS=	${MACHINE_CPUARCH}
 .endif
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
 _MARCHS+=	x86
 .endif
 
 .include 
 
 installincludes: ${SHARED}
 ${SHARED}: compat
 
 # Take care of stale directory-level symlinks.
 compat:
 .for i in ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} crypto
 	if [ -L ${DESTDIR}${INCLUDEDIR}/$i ]; then \
 		rm -f ${DESTDIR}${INCLUDEDIR}/$i; \
 	fi
 .endfor
 	mtree -deU ${MTREE_FOLLOWS_SYMLINKS} \
 	    -f ${.CURDIR}/../etc/mtree/BSD.include.dist \
 	    -p ${DESTDIR}${INCLUDEDIR}
 
 copies:
 .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} altq crypto machine machine/pc \
 	${_MARCHS}
 .if exists(${DESTDIR}${INCLUDEDIR}/$i)
 	cd ${DESTDIR}${INCLUDEDIR}/$i; \
 	for h in *.h; do \
 		if [ -L $$h ]; then rm -f $$h; fi; \
 	done
 .endif
 .endfor
 .for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci} ${LSUBSUBDIRS}
 	cd ${.CURDIR}/../sys; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \
 	    ${DESTDIR}${INCLUDEDIR}/$i
 .endfor
 	cd ${.CURDIR}/../sys/dev/acpica; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/acpica
 	cd ${.CURDIR}/../sys/dev/agp; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/agp
 	cd ${.CURDIR}/../sys/dev/bktr; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ioctl_*.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/bktr
 .if ${MK_NAND} != "no"
 	cd ${.CURDIR}/../sys/dev/nand; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nandsim.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 nand_dev.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/nand
 .endif
 	cd ${.CURDIR}/../sys/dev/pci; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 pcireg.h \
 	    ${DESTDIR}${INCLUDEDIR}/dev/pci
 	cd ${.CURDIR}/../sys/contrib/altq/altq; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/altq
 	cd ${.CURDIR}/../sys/fs/cd9660/; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660
 .if ${MK_IPFILTER} != "no"
 	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/netinet
 .endif
 .if ${MK_PF} != "no"
 	cd ${.CURDIR}/../sys/netpfil/pf; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/netpfil/pf
 .endif
 	cd ${.CURDIR}/../sys/crypto; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 rijndael/rijndael.h \
 	    ${DESTDIR}${INCLUDEDIR}/crypto
 	cd ${.CURDIR}/../sys/opencrypto; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/crypto
 	cd ${.CURDIR}/../sys/${MACHINE}/include; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/machine
 .if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
 	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/machine/pc
 .endif
 .for _MARCH in ${_MARCHS}
 .if exists(${.CURDIR}/../sys/${_MARCH}/include)
 	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
 	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
 	cd ${.CURDIR}/../sys/${_MARCH}/include; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}
 .if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
 	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
 	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
 	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 *.h \
 	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc
 .endif
 .endif
 .endfor
 	cd ${.CURDIR}/../sys/rpc; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 types.h \
 	    ${DESTDIR}${INCLUDEDIR}/rpc
 	cd ${.CURDIR}/../sys/teken; \
 	${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 teken.h \
 	    ${DESTDIR}${INCLUDEDIR}/teken
 
 symlinks:
 	@${ECHO} "Setting up symlinks to kernel source tree..."
 .for i in ${LDIRS}
 	cd ${.CURDIR}/../sys/$i; \
 	for h in *.h; do \
 		ln -fs ../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
 	done
 .endfor
 .for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/bktr:Ndev/nand:Ndev/pci}
 	cd ${.CURDIR}/../sys/$i; \
 	for h in *.h; do \
 		ln -fs ../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
 	done
 .endfor
 	cd ${.CURDIR}/../sys/dev/acpica; \
 	for h in acpiio.h acpi_hpet.h; do \
 		ln -fs ../../../../sys/dev/acpica/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/dev/acpica; \
 	done
 	cd ${.CURDIR}/../sys/dev/agp; \
 	for h in agpreg.h; do \
 		ln -fs ../../../../sys/dev/agp/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/dev/agp; \
 	done
 	cd ${.CURDIR}/../sys/dev/bktr; \
 	for h in ioctl_*.h; do \
 		ln -fs ../../../../sys/dev/bktr/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/dev/bktr; \
 	done
 .if ${MK_NAND} != "no"
 	cd ${.CURDIR}/../sys/dev/nand; \
 	for h in nandsim.h nand_dev.h; do \
 		ln -fs ../../../../sys/dev/nand/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/dev/nand; \
 	done
 .endif
 	cd ${.CURDIR}/../sys/dev/pci; \
 	for h in pcireg.h; do \
 		ln -fs ../../../../sys/dev/pci/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/dev/pci; \
 	done
 .for i in ${LSUBSUBDIRS}
 	cd ${.CURDIR}/../sys/$i; \
 	for h in *.h; do \
 		ln -fs ../../../../../sys/$i/$$h ${DESTDIR}${INCLUDEDIR}/$i; \
 	done
 .endfor
 	cd ${.CURDIR}/../sys/contrib/altq/altq; \
 	for h in *.h; do \
 		ln -fs ../../../sys/contrib/altq/altq/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/altq; \
 	done
 .if ${MK_IPFILTER} != "no"
 	cd ${.CURDIR}/../sys/contrib/ipfilter/netinet; \
 	for h in *.h; do \
 		ln -fs ../../../sys/contrib/ipfilter/netinet/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/netinet; \
 	done
 .endif
 .if ${MK_PF} != "no"
 	cd ${.CURDIR}/../sys/netpfil/pf; \
 	for h in *.h; do \
 		ln -fs ../../../../sys/netpfil/pf/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/netpfil/pf; \
 	done
 .endif
 	cd ${.CURDIR}/../sys/crypto; \
 	for h in rijndael/rijndael.h; do \
 		ln -fs ../../../sys/crypto/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/crypto; \
 	done
 	cd ${.CURDIR}/../sys/opencrypto; \
 	for h in *.h; do \
 		ln -fs ../../../sys/opencrypto/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/crypto; \
 	done
 	cd ${.CURDIR}/../sys/${MACHINE}/include; \
 	for h in *.h; do \
 		ln -fs ../../../sys/${MACHINE}/include/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/machine; \
 	done
 .if exists(${.CURDIR}/../sys/${MACHINE}/include/pc)
 	cd ${.CURDIR}/../sys/${MACHINE}/include/pc; \
 	for h in *.h; do \
 		ln -fs ../../../../sys/${MACHINE}/include/pc/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/machine/pc; \
 	done
 .endif
 .for _MARCH in ${_MARCHS}
 .if exists(${.CURDIR}/../sys/${_MARCH}/include)
 	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
 	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
 	cd ${.CURDIR}/../sys/${_MARCH}/include; \
 	for h in *.h; do \
 		ln -fs ../../../sys/${_MARCH}/include/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}; \
 	done
 .if exists(${.CURDIR}/../sys/${_MARCH}/include/pc)
 	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 755 \
 	    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
 	cd ${.CURDIR}/../sys/${_MARCH}/include/pc; \
 	for h in *.h; do \
 		ln -fs ../../../../sys/${_MARCH}/include/pc/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \
 	done
 .endif
 .endif
 .endfor
 	cd ${.CURDIR}/../sys/fs/cd9660; \
 	for h in *.h; do \
 		ln -fs ../../../../sys/fs/cd9660/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/isofs/cd9660; \
 	done
 	cd ${.CURDIR}/../sys/rpc; \
 	for h in types.h; do \
 		ln -fs ../../../sys/rpc/$$h \
 		    ${DESTDIR}${INCLUDEDIR}/rpc; \
 	done
Index: projects/arm_intrng/include
===================================================================
--- projects/arm_intrng/include	(revision 276247)
+++ projects/arm_intrng/include	(revision 276248)

Property changes on: projects/arm_intrng/include
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head/include:r276010-276247
Index: projects/arm_intrng/lib/Makefile
===================================================================
--- projects/arm_intrng/lib/Makefile	(revision 276247)
+++ projects/arm_intrng/lib/Makefile	(revision 276248)
@@ -1,314 +1,309 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
 .include 
 
 # The SUBDIR_ORDERED list is a small set of libraries which are used by many
 # of the other libraries.  These are built first with a .WAIT between them
 # and the main list to avoid needing a SUBDIR_DEPEND line on every library
 # naming just these few items.
 
 SUBDIR_ORDERED=	${_csu} \
 	.WAIT \
 	libc \
 	libc_nonshared \
 	libcompiler_rt \
 	${_libcplusplus} \
 	${_libcxxrt} \
 	libelf \
 	msun
 
 # The main list; please keep these sorted alphabetically.
 
 SUBDIR=	${SUBDIR_ORDERED} \
 	.WAIT \
 	libalias \
 	libarchive \
 	${_libatm} \
 	libauditd \
 	libbegemot \
 	libblocksruntime \
 	${_libbluetooth} \
 	${_libbsnmp} \
 	libbsdstat \
 	libbsm \
 	libbz2 \
 	libcalendar \
 	libcam \
 	${_libcapsicum} \
 	${_libcasper} \
 	${_libcom_err} \
 	libcompat \
 	libcrypt \
 	libdevinfo \
 	libdevstat \
 	libdpv \
 	libdwarf \
 	libedit \
 	${_libelftc} \
 	${_libevent} \
 	libexecinfo \
 	libexpat \
 	libfetch \
 	libfigpar \
 	libgeom \
-	${_libgpib} \
 	libgpio \
 	${_libgssapi} \
 	${_librpcsec_gss} \
 	${_libiconv_modules} \
 	libipsec \
 	libjail \
 	libkiconv \
 	libkvm \
 	${_libldns} \
 	liblzma \
 	libmagic \
 	libmandoc \
 	libmemstat \
 	libmd \
 	${_libmilter} \
 	${_libmp} \
 	${_libnandfs} \
 	libnetbsd \
 	${_libnetgraph} \
 	${_libngatm} \
 	libnv \
 	libohash \
 	libopie \
 	libpam \
 	libpcap \
 	libpjdlog \
 	${_libpmc} \
 	${_libproc} \
 	libprocstat \
 	libradius \
 	librpcsvc \
 	librt \
 	${_librtld_db} \
 	libsbuf \
 	${_libsdp} \
 	${_libsm} \
 	${_libsmb} \
 	${_libsmdb} \
 	${_libsmutil} \
 	libsqlite3 \
 	libstand \
 	libstdbuf \
 	libstdthreads \
 	libtacplus \
 	${_libtelnet} \
 	${_libthr} \
 	libthread_db \
 	libucl \
 	libufs \
 	libugidfw \
 	libulog \
 	${_libunbound} \
 	${_libusbhid} \
 	${_libusb} \
 	libutil \
 	${_libvgl} \
 	${_libvmmapi} \
 	libwrap \
 	libxo \
 	liby \
 	${_libypclnt} \
 	libz \
 	ncurses \
 	${_atf} \
 	${_clang} \
 	${_cuse} \
 	${_tests}
 
 # Inter-library dependencies.  When the makefile for a library contains LDADD
 # libraries, those libraries should be listed as build order dependencies here.
 
 SUBDIR_DEPEND_libarchive= libz libbz2 libexpat liblzma libmd
 SUBDIR_DEPEND_libatm= libmd
 SUBDIR_DEPEND_libauditdm= libbsm
 SUBDIR_DEPEND_libbsnmp= ${_libnetgraph}
 SUBDIR_DEPEND_libc++= libcxxrt
 SUBDIR_DEPEND_libc= libcompiler_rt
 SUBDIR_DEPEND_libcam= libsbuf
 SUBDIR_DEPEND_libcapsicum= libnv
 SUBDIR_DEPEND_libcasper= libcapsicum libnv libpjdlog
 SUBDIR_DEPEND_libdevstat= libkvm
 SUBDIR_DEPEND_libdpv= libfigpar ncurses libutil
 SUBDIR_DEPEND_libedit= ncurses
 SUBDIR_DEPEND_libg++= msun
 SUBDIR_DEPEND_libgeom= libexpat libsbuf
 SUBDIR_DEPEND_liblibrpcsec_gss= libgssapi
 SUBDIR_DEPEND_libmagic= libz
 SUBDIR_DEPEND_libmemstat= libkvm
 SUBDIR_DEPEND_libopie= libmd
 SUBDIR_DEPEND_libpam= libcrypt libopie libradius librpcsvc libtacplus libutil ${_libypclnt} ${_libcom_err} 
 SUBDIR_DEPEND_libpjdlog= libutil
 SUBDIR_DEPEND_libprocstat= libkvm libutil
 SUBDIR_DEPEND_libradius= libmd
 SUBDIR_DEPEND_libreadline= ncurses
 SUBDIR_DEPEND_libsmb= libkiconv
 SUBDIR_DEPEND_libstdc++= msun
 SUBDIR_DEPEND_libtacplus= libmd
 SUBDIR_DEPEND_libulog= libmd
 SUBDIR_DEPEND_libunbound= ${_libldns}
 
 .if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf)
 _csu=csu/${MACHINE_ARCH}-elf
 .elif exists(${.CURDIR}/csu/${MACHINE_ARCH})
 _csu=csu/${MACHINE_ARCH}
 .elif exists(${.CURDIR}/csu/${MACHINE_CPUARCH}/Makefile)
 _csu=csu/${MACHINE_CPUARCH}
 .else
 _csu=csu
 .endif
 
 # NB: keep these sorted by MK_* knobs
 
 .if ${MK_ATM} != "no"
 _libngatm=	libngatm
 .endif
 
 .if ${MK_BLUETOOTH} != "no"
 _libbluetooth=	libbluetooth
 _libsdp=	libsdp
 .endif
 
 .if ${MK_BSNMP} != "no"
 _libbsnmp=	libbsnmp
 .endif
 
 .if ${MK_CASPER} != "no"
 _libcapsicum=	libcapsicum
 _libcasper=	libcasper
 .endif
 
 .if ${MK_CLANG} != "no" && !defined(COMPAT_32BIT)
 _clang=		clang
 .endif
 
 .if ${MK_CUSE} != "no"
 _cuse=		libcuse
 .endif
 
 .if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
 _libelftc=	libelftc
-.endif
-
-.if ${MK_GPIB} != "no"
-_libgpib=	libgpib
 .endif
 
 .if ${MK_GSSAPI} != "no"
 _libgssapi=	libgssapi
 _librpcsec_gss=	librpcsec_gss
 .endif
 
 .if ${MK_ICONV} != "no"
 _libiconv_modules=	libiconv_modules
 .endif
 
 .if ${MK_KERBEROS_SUPPORT} != "no"
 _libcom_err= libcom_err
 .endif
 
 .if ${MK_LDNS} != "no"
 _libldns=	libldns
 .endif
 
 .if ${MK_LIBCPLUSPLUS} != "no"
 _libcxxrt=	libcxxrt
 _libcplusplus=	libc++
 .endif
 
 .if ${MK_LIBTHR} != "no"
 _libthr=	libthr
 .endif
 
 .if ${MK_NAND} != "no"
 _libnandfs=	libnandfs
 .endif
 
 .if ${MK_NETGRAPH} != "no"
 _libnetgraph=	libnetgraph
 .endif
 
 .if ${MK_NIS} != "no"
 _libypclnt=	libypclnt
 .endif
 
 .if ${MK_PF} != "no"
 _libevent=	libevent
 .endif
 
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
 _libsmb=	libsmb
 _libvgl=	libvgl
 _libproc=	libproc
 _librtld_db=	librtld_db
 .endif
 
 .if ${MACHINE_CPUARCH} == "amd64"
 _libvmmapi=	libvmmapi
 .endif
 
 .if ${MACHINE_CPUARCH} == "mips"
 _libproc=	libproc
 _librtld_db=	librtld_db
 .endif
 
 .if ${MACHINE_CPUARCH} == "powerpc"
 _libproc=	libproc
 _librtld_db=	librtld_db
 _libsmb=	libsmb
 .endif
 
 .if ${MACHINE_CPUARCH} == "sparc64"
 _libsmb=	libsmb
 .endif
 
 .if ${MK_OPENSSL} != "no"
 _libmp=		libmp
 .endif
 
 .if ${MK_PMC} != "no"
 _libpmc=	libpmc
 .endif
 
 .if ${MK_SENDMAIL} != "no"
 _libmilter=	libmilter
 _libsm=		libsm
 _libsmdb=	libsmdb
 _libsmutil=	libsmutil
 .endif
 
 .if ${MK_TELNET} != "no"
 _libtelnet=	libtelnet
 .endif
 
 .if ${MK_TESTS_SUPPORT} != "no"
 _atf=		atf
 .endif
 .if ${MK_TESTS} != "no"
 _tests=		tests
 .endif
 
 .if ${MK_UNBOUND} != "no"
 _libunbound=	libunbound
 .endif
 
 .if ${MK_USB} != "no"
 _libusbhid=	libusbhid
 _libusb=	libusb
 .endif
 
 .if !defined(LIBRARIES_ONLY)
 afterinstall:
 	${INSTALL_SYMLINK} ../include ${DESTDIR}/usr/lib/include
 .endif
 
 .if !make(install)
 SUBDIR_PARALLEL=
 .endif
 
 .include 
Index: projects/arm_intrng/lib/libmandoc/Makefile
===================================================================
--- projects/arm_intrng/lib/libmandoc/Makefile	(revision 276247)
+++ projects/arm_intrng/lib/libmandoc/Makefile	(revision 276248)
@@ -1,46 +1,46 @@
 # $FreeBSD$
 
 MDOCMLDIR=	${.CURDIR}/../../contrib/mdocml
 .PATH: ${MDOCMLDIR}
 
 LIB=	mandoc
 #NO_PIC=
 INTERNALLIB=
-MAN=	mandoc.3
+MAN=	mandoc.3 mandoc_headers.3
 LIBMAN_SRCS=	man.c \
 		man_hash.c \
 		man_macro.c \
 		man_validate.c
 
 LIBMDOC_SRCS=	att.c \
 		lib.c \
 		mdoc.c \
 		mdoc_argv.c \
 		mdoc_hash.c \
 		mdoc_macro.c \
 		mdoc_validate.c \
 		st.c
 
 LIBROFF_SRCS=	eqn.c \
 		roff.c \
 		tbl.c \
 		tbl_data.c \
 		tbl_layout.c \
 		tbl_opts.c
 
 COMPAT_SRCS=	compat_reallocarray.c
 SRCS=		${LIBMAN_SRCS} \
 		${LIBMDOC_SRCS} \
 		${LIBROFF_SRCS} \
 		${COMPAT_SRCS} \
 		chars.c \
 		mandoc.c \
 		mandoc_aux.c \
 		msec.c \
 		preconv.c \
 		read.c
 
 WARNS?=	3
 CFLAGS+= -DHAVE_CONFIG_H
 
 .include 
Index: projects/arm_intrng/lib/libxo/Makefile
===================================================================
--- projects/arm_intrng/lib/libxo/Makefile	(revision 276247)
+++ projects/arm_intrng/lib/libxo/Makefile	(revision 276248)
@@ -1,79 +1,81 @@
 # $FreeBSD$
 
 LIBXO=	${.CURDIR:H:H}/contrib/libxo
 
 .PATH:	${LIBXO}/libxo
 
 LIB=	xo
 SHLIB_MAJOR=0
 
+SHLIBDIR?=      /lib
+
 SRCS=	libxo.c
 
 CFLAGS+=-I${LIBXO}/libxo
 
 INCS=	xo.h
 INCSDIR=${INCLUDEDIR}/libxo
 
 MAN+=	libxo.3
 MAN+=	xo_attr.3 \
 	xo_create.3 \
 	xo_emit.3 \
 	xo_err.3 \
 	xo_finish.3 \
 	xo_flush.3 \
 	xo_no_setlocale.3 \
 	xo_open_container.3 \
 	xo_open_list.3 \
 	xo_parse_args.3 \
 	xo_set_allocator.3 \
 	xo_set_flags.3 \
 	xo_set_info.3 \
 	xo_set_options.3 \
 	xo_set_style.3 \
 	xo_set_writer.3
 MAN+=	xo_format.5
 
 MLINKS=	xo_attr.3 xo_attr_h.3 \
 	xo_attr.3 xo_attr_hv.3 \
 	xo_create.3 xo_create_to_file.3 \
 	xo_create.3 xo_destroy.3 \
 	xo_emit.3 xo_emit_h.3 \
 	xo_emit.3 xo_emit_hv.3 \
 	xo_err.3 xo_warn.3 \
 	xo_err.3 xo_warnx.3 \
 	xo_err.3 xo_warn_c.3 \
 	xo_err.3 xo_warn_hc.3 \
 	xo_err.3 xo_errc.3 \
 	xo_err.3 xo_errx.3 \
 	xo_err.3 xo_message.3 \
 	xo_err.3 xo_message_c.3 \
 	xo_err.3 xo_message_hc.3 \
 	xo_err.3 xo_message_hcv.3 \
 	xo_finish.3 xo_finish_h.3 \
 	xo_flush.3 xo_flush_h.3 \
 	xo_open_container.3 xo_open_container_h.3 \
 	xo_open_container.3 xo_open_container_hd.3 \
 	xo_open_container.3 xo_open_container_d.3 \
 	xo_open_container.3 xo_close_container.3 \
 	xo_open_container.3 xo_close_container_h.3 \
 	xo_open_container.3 xo_close_container_hd.3 \
 	xo_open_container.3 xo_close_container_d.3 \
 	xo_open_list.3 xo_open_list_h.3 \
 	xo_open_list.3 xo_open_list_hd.3 \
 	xo_open_list.3 xo_open_list_d.3 \
 	xo_open_list.3 xo_open_instance.3 \
 	xo_open_list.3 xo_open_instance_h.3 \
 	xo_open_list.3 xo_open_instance_hd.3 \
 	xo_open_list.3 xo_open_instance_d.3 \
 	xo_open_list.3 xo_close_instance.3 \
 	xo_open_list.3 xo_close_instance_h.3 \
 	xo_open_list.3 xo_close_instance_hd.3 \
 	xo_open_list.3 xo_close_instance_d.3 \
 	xo_open_list.3 xo_close_list.3 \
 	xo_open_list.3 xo_close_list_h.3 \
 	xo_open_list.3 xo_close_list_hd.3 \
 	xo_open_list.3 xo_close_list_d.3 \
 	xo_set_flags.3 xo_clear_flags.3 \
 	xo_set_style.3 xo_set_style_name.3
 
 .include 
Index: projects/arm_intrng/lib/msun/man/csqrt.3
===================================================================
--- projects/arm_intrng/lib/msun/man/csqrt.3	(revision 276247)
+++ projects/arm_intrng/lib/msun/man/csqrt.3	(revision 276248)
@@ -1,102 +1,102 @@
 .\" Copyright (c) 2007-2008 David Schultz 
 .\" 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 AUTHOR 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 AUTHOR 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.
 .\"
 .\" $FreeBSD$
 .\"
 .Dd March 30, 2008
 .Dt CSQRT 3
 .Os
 .Sh NAME
 .Nm csqrt ,
 .Nm csqrtf ,
 .Nm csqrtl
 .Nd complex square root functions
 .Sh LIBRARY
 .Lb libm
 .Sh SYNOPSIS
 .In complex.h
 .Ft double complex
 .Fn csqrt "double complex z"
 .Ft float complex
 .Fn csqrtf "float complex z"
 .Ft long double complex
 .Fn csqrtl "long double complex z"
 .Sh DESCRIPTION
 The
 .Fn csqrt ,
 .Fn csqrtf ,
 and
 .Fn csqrtl
 functions compute the square root of
 .Fa z
 in the complex plane, with a branch cut along the negative real axis.
 In other words,
 .Fn csqrt ,
 .Fn csqrtf ,
 and
 .Fn csqrtl
 always return the square root whose real part is non-negative.
 .Sh RETURN VALUES
 These functions return the requested square root.
 The square root of 0 is
 .Li +0 \*(Pm 0 ,
 where the imaginary parts of the input and respective result have
 the same sign.
 For infinities and \*(Nas, the following rules apply, with the
 earlier rules having precedence:
 .Bl -column -offset indent "-\*(If + \*(Na*I" "\*(If \*(Pm \*(If*I  " "(for all k)"
 .Em "Input" Ta Em "Result" Ta \&
 k + \*(If*I	\*(If + \*(If*I	(for all k)
 -\*(If + \*(Na*I	\*(Na \*(Pm \*(If*I	\&
 \*(If + \*(Na*I	\*(If + \*(Na*I	\&
 k + \*(Na*I	\*(Na + \*(Na*I	\&
 \*(Na + k*I	\*(Na + \*(Na*I	\&
 -\*(If + k*I	+0 + \*(If*I	\&
 \*(If + k*I	\*(If + 0*I	\&
 .El
 .Pp
 For numbers with negative imaginary parts, the above special cases
 apply given the identity:
 .Dl csqrt(conj(z) = conj(sqrt(z))
 Note that the sign of \*(Na is indeterminate.
 Also, if the real or imaginary part of the input is finite and
 an \*(Na is generated, an invalid exception will be thrown.
 .Sh SEE ALSO
 .Xr cabs 3 ,
 .Xr fenv 3 ,
-.Xr math 3 ,
+.Xr math 3
 .Sh STANDARDS
 The
 .Fn csqrt ,
 .Fn csqrtf ,
 and
 .Fn csqrtl
 functions conform to
 .St -isoC-99 .
 .Sh BUGS
 For
 .Fn csqrt
 and
 .Fn csqrtl ,
 inexact results are not always correctly rounded.
Index: projects/arm_intrng/release/arm/release.sh
===================================================================
--- projects/arm_intrng/release/arm/release.sh	(revision 276247)
+++ projects/arm_intrng/release/arm/release.sh	(revision 276248)
@@ -1,147 +1,155 @@
 #!/bin/sh
 #-
 # Copyright (c) 2013, 2014 The FreeBSD Foundation
 # All rights reserved.
 #
 # This software was developed by Glen Barber
 # under sponsorship from the FreeBSD Foundation.
 #
 # 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 AUTHOR 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 AUTHOR 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.
 #
 # $FreeBSD$
 #
 
 # This script is intended to be called by release/release.sh to build ARM
 # images for release.  It is not intended to be run directly.  This sets up
 # the software needed within a build chroot, then runs crochet to provide
 # downloadable images for embedded devices.
 
 set -e
 
 before_build() {
 	WANT_UBOOT=
 	KNOWNHASH=
 	UBOOT_VERSION=
 	case ${KERNEL} in
 		BEAGLEBONE)
 			WANT_UBOOT=1
 			KNOWNHASH="7b6444bd23eb61068c43bd1d44ec7e7bfdbce5cadeca20c833eee186b4d3fd31"
 			UBOOT_VERSION="u-boot-2014.04"
 			;;
 		PANDABOARD)
 			WANT_UBOOT=1
 			KNOWNHASH="e08e20a6979bfca6eebb9a2b0e42aa4416af3d796332fd63a3470495a089d496"
 			UBOOT_VERSION="u-boot-2012.07"
 			;;
 		WANDBOARD-QUAD)
 			WANT_UBOOT=1
 			KNOWNHASH="b4f83b8db325c21671a997198ec3a373e2e00dde2fcf17be9b9afd7cfd727f56"
 			UBOOT_VERSION="u-boot-2014.07"
 			;;
 		*)
 			# Fallthrough.
 			;;
 	esac
 	if [ ! -z ${WANT_UBOOT} ]; then
 		chroot ${CHROOTDIR} fetch -o /tmp/crochet/${UBOOT_VERSION}.tar.bz2 \
 			http://people.freebsd.org/~gjb/${UBOOT_VERSION}.tar.bz2
 		UBOOT_HASH="$(sha256 -q ${CHROOTDIR}/tmp/crochet/${UBOOT_VERSION}.tar.bz2)"
 		if [ "${UBOOT_HASH}" != "${KNOWNHASH}" ]; then
 			echo "Checksum mismatch!  Exiting now."
 			exit 1
 		fi
 		chroot ${CHROOTDIR} tar xf /tmp/crochet/${UBOOT_VERSION}.tar.bz2 \
 			-C /tmp/crochet/ 
 	fi
 }
 
 install_crochet() {
 	chroot ${CHROOTDIR} svn co -q ${CROCHETSRC}/${CROCHETBRANCH} \
 		/tmp/crochet
 }
 
 install_uboot() {
 	# Only fetch u-boot sources if UBOOTSRC is set; otherwise it is
 	# not needed.
 	if [ -n "${UBOOTSRC}" ]; then
 		continue
 	else
 		return 0
 	fi
 	chroot ${CHROOTDIR} svn co -q ${UBOOTSRC}/${UBOOTBRANCH} \
 		/${UBOOTDIR}
 }
 
 main() {
 	# Fix broken ports that use kern.osreldate.
 	OSVERSION=$(chroot ${CHROOTDIR} /usr/bin/uname -U)
 	export OSVERSION
 	REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION)
 	BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH)
 	UNAME_r=${REVISION}-${BRANCH}
 	export UNAME_r
 
 	# Build the 'xdev' target for crochet.
 	eval chroot ${CHROOTDIR} make -C /usr/src \
 		${XDEV_FLAGS} XDEV=${XDEV} XDEV_ARCH=${XDEV_ARCH} \
 		TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
 		${WORLD_FLAGS} xdev
 
 	# Install the cross-build symlinks to /usr/bin to make crochet
 	# happy.
 	eval chroot ${CHROOTDIR} make -C /usr/src \
 		${XDEV_FLAGS} XDEV=${XDEV} XDEV_ARCH=${XDEV_ARCH} \
 		TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
 		${WORLD_FLAGS} xdev-links || true
 
 	# Run the ldconfig(8) startup script so /var/run/ld-elf*.so.hints
 	# is created.
 	eval chroot ${CHROOTDIR} /etc/rc.d/ldconfig forcerestart
 	# Install security/ca_root_nss since we need to check the https
 	# certificate of github.
 	eval chroot ${CHROOTDIR} make -C /usr/ports/security/ca_root_nss \
 		OPTIONS_SET="ETCSYMLINK" BATCH=1 FORCE_PKG_REGISTER=1 \
 		install clean distclean
 	EMBEDDEDPORTS="${EMBEDDEDPORTS} devel/subversion"
 	for _PORT in ${EMBEDDEDPORTS}; do
 		eval chroot ${CHROOTDIR} make -C /usr/ports/${_PORT} \
 			BATCH=1 FORCE_PKG_REGISTER=1 install clean distclean
 	done
 
+	# Certain u-boot versions hardcode the use of a host gcc, and gcc's
+	# build relies on having gperf installed.
+	eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/gperf \
+		WITH_GCC=1 ${WORLD_FLAGS} obj
+	eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/gperf \
+		WITH_GCC=1 ${WORLD_FLAGS} -j1 depend all
+	eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/gperf \
+		WITH_GCC=1 ${WORLD_FLAGS} -j1 install
 	eval chroot ${CHROOTDIR} make -C /usr/src/gnu/usr.bin/cc \
 		WITH_GCC=1 ${WORLD_FLAGS} -j1 obj depend all install
 
 	mkdir -p ${CHROOTDIR}/tmp/crochet/work
 	before_build
 	install_crochet
 	install_uboot
 	eval chroot ${CHROOTDIR} /bin/sh /tmp/crochet/crochet.sh \
 		-c /tmp/external/${XDEV}/crochet-${KERNEL}.conf
 	mkdir -p ${CHROOTDIR}/R/
 	cp -p ${CHROOTDIR}/usr/obj/*.img ${CHROOTDIR}/R/
 	bzip2 ${CHROOTDIR}/R/FreeBSD*.img
 	cd ${CHROOTDIR}/R/ && sha256 FreeBSD*.img.bz2 > CHECKSUM.SHA256
 	cd ${CHROOTDIR}/R/ && md5 FreeBSD*.img.bz2 > CHECKSUM.MD5
 }
 
 main "$@"
 exit 0
Index: projects/arm_intrng/share/man/man4/gpib.4
===================================================================
--- projects/arm_intrng/share/man/man4/gpib.4	(revision 276247)
+++ projects/arm_intrng/share/man/man4/gpib.4	(nonexistent)
@@ -1,100 +0,0 @@
-.\" Copyright (c) 2010, Joerg Wunsch
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 24, 2010
-.Dt GPIB 4
-.Os
-.Sh NAME
-.Nm gpib
-.Nd General-Purpose Instrument Bus (GPIB) driver
-.Sh SYNOPSIS
-Either of the
-.Xr pcii 4
-or
-.Xr tnt4882 4
-drivers use this driver as the backend.
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for driving an IEEE-488 bus, also called
-IEC-625 (or just "IEC bus"), or HP-IB (Hewlett Packard Instrument
-Bus), or GPIB (General Purpose Instrument Bus).
-The device can become either a listener, talker, controller, and
-in particular a master controller on the bus.
-.Ss Example
-The following example code queries the device provided as
-.Va argv[1]
-for its identification response.
-.Bd -literal
-/* compile with:  cc -O -o ibtest ibtest.c -lgpib */
-
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-int
-main(int argc, char **argv)
-{
-	int dmm;
-        unsigned char buf[100];
-        char vbuf[sizeof(buf) * 4];
-
-        /* DVM */
-        dmm = ibdev(0, (argc > 1? atoi(argv[1]): 7), 0,
-		    T10s, 1, 0);
-        if (dmm < 0)
-                errx(1, "ibdev = %d\\n", dmm);
-        ibwrt(dmm, "*IDN?\\r\\n", 7);
-        ibrd(dmm, buf, sizeof(buf) - 1);
-        strvisx(vbuf, buf, ibcnt, VIS_WHITE | VIS_CSTYLE);
-        printf("%s\\n", vbuf);
-        return (0);
-}
-.Ed
-.Sh FILES
-.Bl -tag -width /dev/gpibNNib
-.It Pa /dev/gpib Ns Em N Ns "ib"
-Main device node to access the driver.
-.It Pa /dev/gpib Ns Em N Ns "l"
-Listen-only entry to the driver.
-When opening, an instrument can send data to this device on the
-bus in an unaddressed mode, for example hard-copy printer data.
-.El
-.Sh SEE ALSO
-.Xr gpib 3 ,
-.Xr pcii 4 ,
-.Xr tnt4882 4
-.Sh HISTORY
-The
-.Nm
-driver was written by Poul-Henning Kamp, and first appeared in
-.Fx 5.4 .
-.Sh AUTHORS
-This manual page was written by
-.An J\(:org Wunsch .

Property changes on: projects/arm_intrng/share/man/man4/gpib.4
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/share/man/man4/tnt4882.4
===================================================================
--- projects/arm_intrng/share/man/man4/tnt4882.4	(revision 276247)
+++ projects/arm_intrng/share/man/man4/tnt4882.4	(nonexistent)
@@ -1,55 +0,0 @@
-.\" Copyright (c) 2010, Joerg Wunsch
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 24, 2010
-.Dt TNT4882 4
-.Os
-.Sh NAME
-.Nm tnt4882
-.Nd National Instruments TNT4882A GPIB controller driver
-.Sh SYNOPSIS
-.Cd "device tnt4882"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for driving an IEEE-488 bus, also called
-IEC-625 (or just "IEC bus"), or HP-IB (Hewlett Packard Instrument
-Bus), or GPIB (General Purpose Instrument Bus).
-The driver supports National Instruments PCI GPIB cards using
-the TNT4882 bus interface chip.
-This chip emulates a NEC \(mcPD7210 controller IC as the main
-interface between the host computer and the instrument bus.
-.Sh SEE ALSO
-.Xr gpib 3 ,
-.Xr gpib 4
-.Sh HISTORY
-The
-.Nm
-driver was written by Poul-Henning Kamp, and first appeared in
-.Fx 5.4 .
-.Sh AUTHORS
-This manual page was written by
-.An J\(:org Wunsch .

Property changes on: projects/arm_intrng/share/man/man4/tnt4882.4
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/share/man/man4/pcii.4
===================================================================
--- projects/arm_intrng/share/man/man4/pcii.4	(revision 276247)
+++ projects/arm_intrng/share/man/man4/pcii.4	(nonexistent)
@@ -1,97 +0,0 @@
-.\" Copyright (c) 2010, Joerg Wunsch
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 24, 2010
-.Dt PCII 4
-.Os
-.Sh NAME
-.Nm pcii
-.Nd National Instruments PCIIA GPIB controller driver
-.Sh SYNOPSIS
-.Cd "device pcii"
-.Pp
-In
-.Pa /boot/device.hints :
-.Cd hint.pcii.0.at="isa"
-.Cd hint.pcii.0.port="0x2e1"
-.Cd hint.pcii.0.irq="7"
-.Cd hint.pcii.0.drq="1"
-.Sh DESCRIPTION
-The
-.Nm
-driver provides support for driving an IEEE-488 bus, also called
-IEC-625 (or just "IEC bus"), or HP-IB (Hewlett Packard Instrument
-Bus), or GPIB (General Purpose Instrument Bus).
-The driver supports National Instruments PCIIA cards (sometimes
-also referred to as PC2A) and compatibles.
-These cards use a NEC \(mcPD7210 controller IC as the main
-interface between the host computer and the instrument bus.
-.Ss IO memory space layout
-The PCIIA cards use a very specific IO memory space allocation layout.
-The address bits A0 through A9 (which have traditionally been the only
-address bits evaluated on IBM PC XT extension cards) are hardwired to
-address 0x2e1.
-Bits A10 through A12 are used by the \(mcPD7210 register select lines.
-This makes the individual 7210 registers being 0x400 bytes apart in the
-ISA bus address space.
-Address bits A13 and A14 are compared to a DIP switch setting on the
-card, allowing for up to 4 different cards being installed (at base
-addresses 0x2e1, 0x22e1, 0x42e1, and 0x62e1, respectively).
-A15 has been used to select an optional on-board time-of-day clock
-chip (MM58167A) on the original PCIIA rather than the \(mcPD7210
-(which is not implemented on later boards and clones).
-Finally, the IO addresses 0x2f0 ... 0x2f7 are used for a
-.Em special interrupt handling feature
-(re-enable interrupts so the IRQ can be shared), where actually only
-address 0x2f0 plus the actual IRQ level is required for each card.
-Some clones do not appear to require this special IRQ handling, and
-are thus likely to not support the shared IRQ feature.
-.Pp
-Only the base address of the card needs to be specified in the ISA
-device hints; the driver takes care to derive all other IO addresses
-needed during the probe phase.
-.Ss Supported cards
-The following cards are known to be supported:
-.Bl -bullet -offset indent
-.It
-B&C Microsystems PC488A-0
-.It
-National Instruments GPIB-PCII/PCIIA (in PCIIa mode)
-.It
-Axiom AX5488
-.El
-.Sh SEE ALSO
-.Xr gpib 3 ,
-.Xr gpib 4 ,
-.Xr device.hints 5
-.Sh HISTORY
-The
-.Nm
-driver was written by Poul-Henning Kamp, and first appeared in
-.Fx 5.4 .
-.Sh AUTHORS
-This manual page was written by
-.An J\(:org Wunsch .

Property changes on: projects/arm_intrng/share/man/man4/pcii.4
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/share/man/man4/Makefile
===================================================================
--- projects/arm_intrng/share/man/man4/Makefile	(revision 276247)
+++ projects/arm_intrng/share/man/man4/Makefile	(revision 276248)
@@ -1,873 +1,870 @@
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 # $FreeBSD$
 
 .include 
 
 MAN=	aac.4 \
 	aacraid.4 \
 	acpi.4 \
 	${_acpi_asus.4} \
 	${_acpi_asus_wmi.4} \
 	${_acpi_dock.4} \
 	${_acpi_fujitsu.4} \
 	${_acpi_hp.4} \
 	${_acpi_ibm.4} \
 	${_acpi_panasonic.4} \
 	${_acpi_rapidstart.4} \
 	${_acpi_sony.4} \
 	acpi_thermal.4 \
 	${_acpi_toshiba.4} \
 	acpi_video.4 \
 	${_acpi_wmi.4} \
 	ada.4 \
 	adv.4 \
 	adw.4 \
 	ae.4 \
 	${_aesni.4} \
 	age.4 \
 	agp.4 \
 	aha.4 \
 	ahb.4 \
 	ahc.4 \
 	ahci.4 \
 	ahd.4 \
 	${_aibs.4} \
 	aio.4 \
 	alc.4 \
 	ale.4 \
 	alpm.4 \
 	altera_atse.4 \
 	altera_avgen.4 \
 	altera_jtag_uart.4 \
 	altera_sdcard.4 \
 	altq.4 \
 	amdpm.4 \
 	${_amdsbwd.4} \
 	${_amdsmb.4} \
 	${_amdtemp.4} \
 	${_bxe.4} \
 	amr.4 \
 	an.4 \
 	${_aout.4} \
 	${_apic.4} \
 	arcmsr.4 \
 	${_asmc.4} \
 	asr.4 \
 	ata.4 \
 	ath.4 \
 	ath_ahb.4 \
 	ath_hal.4 \
 	ath_pci.4 \
 	atkbd.4 \
 	atkbdc.4 \
 	atp.4 \
 	${_atf_test_case.4} \
 	${_atrtc.4} \
 	${_attimer.4} \
 	audit.4 \
 	auditpipe.4 \
 	aue.4 \
 	axe.4 \
 	axge.4 \
 	bce.4 \
 	bfe.4 \
 	bge.4 \
 	${_bhyve.4} \
 	bktr.4 \
 	blackhole.4 \
 	bpf.4 \
 	bridge.4 \
 	bt.4 \
 	bwi.4 \
 	bwn.4 \
 	capsicum.4 \
 	cardbus.4 \
 	carp.4 \
 	cas.4 \
 	cc_cdg.4 \
 	cc_chd.4 \
 	cc_cubic.4 \
 	cc_hd.4 \
 	cc_htcp.4 \
 	cc_newreno.4 \
 	cc_vegas.4 \
 	ccd.4 \
 	cd.4 \
 	cdce.4 \
 	ch.4 \
 	ciss.4 \
 	cm.4 \
 	cmx.4 \
 	${_coretemp.4} \
 	${_cpuctl.4} \
 	cpufreq.4 \
 	crypto.4 \
 	ctl.4 \
 	cue.4 \
 	cxgb.4 \
 	cxgbe.4 \
 	cy.4 \
 	da.4 \
 	dc.4 \
 	dcons.4 \
 	dcons_crom.4 \
 	ddb.4 \
 	de.4 \
 	devctl.4 \
 	digi.4 \
 	disc.4 \
 	divert.4 \
 	${_dpms.4} \
 	dpt.4 \
 	dummynet.4 \
 	ed.4 \
 	edsc.4 \
 	ehci.4 \
 	em.4 \
 	en.4 \
 	enc.4 \
 	epair.4 \
 	esp.4 \
 	est.4 \
 	et.4 \
 	eventtimers.4 \
 	exca.4 \
 	fatm.4 \
 	fd.4 \
 	fdc.4 \
 	fdt.4 \
 	fdtbus.4 \
 	ffclock.4 \
 	filemon.4 \
 	firewire.4 \
 	fpa.4 \
 	full.4 \
 	fwe.4 \
 	fwip.4 \
 	fwohci.4 \
 	fxp.4 \
 	gbde.4 \
 	gdb.4 \
 	gem.4 \
 	geom.4 \
 	geom_fox.4 \
 	geom_linux_lvm.4 \
 	geom_map.4 \
 	geom_uncompress.4 \
 	geom_uzip.4 \
 	gif.4 \
-	gpib.4 \
 	gpio.4 \
 	gpioiic.4 \
 	gpioled.4 \
 	gre.4 \
 	h_ertt.4 \
 	hatm.4 \
 	hifn.4 \
 	hme.4 \
 	hpet.4 \
 	${_hpt27xx.4} \
 	${_hptiop.4} \
 	${_hptmv.4} \
 	${_hptnr.4} \
 	${_hptrr.4} \
 	hv_ata_pci_disengage.4 \
 	hv_kvp.4 \
 	hv_netvsc.4 \
 	hv_storvsc.4 \
 	hv_utils.4 \
 	hv_vmbus.4 \
 	hwpmc.4 \
 	ichsmb.4 \
 	${_ichwd.4} \
 	icmp.4 \
 	icmp6.4 \
 	ida.4 \
 	ifmib.4 \
 	igb.4 \
 	igmp.4 \
 	iic.4 \
 	iicbb.4 \
 	iicbus.4 \
 	iicsmb.4 \
 	iir.4 \
 	inet.4 \
 	inet6.4 \
 	intpm.4 \
 	intro.4 \
 	${_io.4} \
 	ip.4 \
 	ip6.4 \
 	ipfirewall.4 \
 	ipheth.4 \
 	${_ipmi.4} \
 	ips.4 \
 	ipsec.4 \
 	ipw.4 \
 	ipwfw.4 \
 	isci.4 \
 	iscsi.4 \
 	iscsi_initiator.4 \
 	ismt.4 \
 	isp.4 \
 	ispfw.4 \
 	iwi.4 \
 	iwifw.4 \
 	iwn.4 \
 	iwnfw.4 \
 	ixgb.4 \
 	ixgbe.4 \
 	jme.4 \
 	joy.4 \
 	kbdmux.4 \
 	keyboard.4 \
 	kld.4 \
 	ksyms.4 \
 	ktr.4 \
 	kue.4 \
 	lagg.4 \
 	le.4 \
 	led.4 \
 	lge.4 \
 	${_linux.4} \
 	lm75.4 \
 	lmc.4 \
 	lo.4 \
 	lp.4 \
 	lpbb.4 \
 	lpt.4 \
 	mac.4 \
 	mac_biba.4 \
 	mac_bsdextended.4 \
 	mac_ifoff.4 \
 	mac_lomac.4 \
 	mac_mls.4 \
 	mac_none.4 \
 	mac_partition.4 \
 	mac_portacl.4 \
 	mac_seeotheruids.4 \
 	mac_stub.4 \
 	mac_test.4 \
 	malo.4 \
 	mcd.4 \
 	md.4 \
 	me.4 \
 	mem.4 \
 	meteor.4 \
 	mfi.4 \
 	miibus.4 \
 	mk48txx.4 \
 	mld.4 \
 	mlx.4 \
 	mly.4 \
 	mmc.4 \
 	mmcsd.4 \
 	mn.4 \
 	mod_cc.4 \
 	mos.4 \
 	mouse.4 \
 	mpr.4 \
 	mps.4 \
 	mpt.4 \
 	mrsas.4 \
 	msk.4 \
 	mtio.4 \
 	multicast.4 \
 	mvs.4 \
 	mwl.4 \
 	mwlfw.4 \
 	mxge.4 \
 	my.4 \
 	nand.4 \
 	nandsim.4 \
 	natm.4 \
 	natmip.4 \
 	ncr.4 \
 	ncv.4 \
 	${_ndis.4} \
 	net80211.4 \
 	netfpga10g_nf10bmac.4 \
 	netgraph.4 \
 	netintro.4 \
 	netmap.4 \
 	${_nfe.4} \
 	${_nfsmb.4} \
 	ng_async.4 \
 	ng_atm.4 \
 	ngatmbase.4 \
 	ng_atmllc.4 \
 	ng_bluetooth.4 \
 	ng_bpf.4 \
 	ng_bridge.4 \
 	ng_bt3c.4 \
 	ng_btsocket.4 \
 	ng_car.4 \
 	ng_ccatm.4 \
 	ng_cisco.4 \
 	ng_deflate.4 \
 	ng_device.4 \
 	nge.4 \
 	ng_echo.4 \
 	ng_eiface.4 \
 	ng_etf.4 \
 	ng_ether.4 \
 	ng_ether_echo.4 \
 	ng_frame_relay.4 \
 	ng_gif.4 \
 	ng_gif_demux.4 \
 	ng_h4.4 \
 	ng_hci.4 \
 	ng_hole.4 \
 	ng_hub.4 \
 	ng_iface.4 \
 	ng_ipfw.4 \
 	ng_ip_input.4 \
 	ng_ksocket.4 \
 	ng_l2cap.4 \
 	ng_l2tp.4 \
 	ng_lmi.4 \
 	ng_mppc.4 \
 	ng_nat.4 \
 	ng_netflow.4 \
 	ng_one2many.4 \
 	ng_patch.4 \
 	ng_ppp.4 \
 	ng_pppoe.4 \
 	ng_pptpgre.4 \
 	ng_pred1.4 \
 	ng_rfc1490.4 \
 	ng_socket.4 \
 	ng_source.4 \
 	ng_split.4 \
 	ng_sppp.4 \
 	ng_sscfu.4 \
 	ng_sscop.4 \
 	ng_tag.4 \
 	ng_tcpmss.4 \
 	ng_tee.4 \
 	ng_tty.4 \
 	ng_ubt.4 \
 	ng_UI.4 \
 	ng_uni.4 \
 	ng_vjc.4 \
 	ng_vlan.4 \
 	nmdm.4 \
 	nsp.4 \
 	${_ntb.4} \
 	null.4 \
 	${_nvd.4} \
 	${_nvme.4} \
 	${_nvram.4} \
 	${_nvram2env.4} \
 	${_nxge.4} \
 	oce.4 \
 	ohci.4 \
 	orm.4 \
 	${_padlock.4} \
 	pass.4 \
 	patm.4 \
 	pccard.4 \
 	pccbb.4 \
 	pcf.4 \
 	pci.4 \
 	pcib.4 \
 	pcic.4 \
-	pcii.4 \
 	pcm.4 \
 	pcn.4 \
 	${_pf.4} \
 	${_pflog.4} \
 	${_pfsync.4} \
 	pim.4 \
 	polling.4 \
 	ppbus.4 \
 	ppc.4 \
 	ppi.4 \
 	procdesc.4 \
 	proto.4 \
 	psm.4 \
 	pst.4 \
 	pt.4 \
 	pts.4 \
 	pty.4 \
 	puc.4 \
 	${_qlxge.4} \
 	${_qlxgb.4} \
 	${_qlxgbe.4} \
 	ral.4 \
 	random.4 \
 	rc.4 \
 	re.4 \
 	rgephy.4 \
 	rights.4 \
 	rl.4 \
 	rndtest.4 \
 	route.4 \
 	rp.4 \
 	rsu.4 \
 	rsufw.4 \
 	rue.4 \
 	rum.4 \
 	run.4 \
 	runfw.4 \
 	sa.4 \
 	safe.4 \
 	sbp.4 \
 	sbp_targ.4 \
 	scc.4 \
 	scd.4 \
 	sched_4bsd.4 \
 	sched_ule.4 \
 	screen.4 \
 	scsi.4 \
 	sctp.4 \
 	sdhci.4 \
 	sem.4 \
 	send.4 \
 	ses.4 \
 	sf.4 \
 	${_sfxge.4} \
 	sge.4 \
 	si.4 \
 	siba.4 \
 	siftr.4 \
 	siis.4 \
 	simplebus.4 \
 	sio.4 \
 	sis.4 \
 	sk.4 \
 	smb.4 \
 	smbus.4 \
 	smp.4 \
 	smsc.4 \
 	sn.4 \
 	snd_ad1816.4 \
 	snd_als4000.4 \
 	snd_atiixp.4 \
 	snd_cmi.4 \
 	snd_cs4281.4 \
 	snd_csa.4 \
 	snd_ds1.4 \
 	snd_emu10k1.4 \
 	snd_emu10kx.4 \
 	snd_envy24.4 \
 	snd_envy24ht.4 \
 	snd_es137x.4 \
 	snd_ess.4 \
 	snd_fm801.4 \
 	snd_gusc.4 \
 	snd_hda.4 \
 	snd_hdspe.4 \
 	snd_ich.4 \
 	snd_maestro3.4 \
 	snd_maestro.4 \
 	snd_mss.4 \
 	snd_neomagic.4 \
 	snd_sbc.4 \
 	snd_solo.4 \
 	snd_spicds.4 \
 	snd_t4dwave.4 \
 	snd_uaudio.4 \
 	snd_via8233.4 \
 	snd_via82c686.4 \
 	snd_vibes.4 \
 	snp.4 \
 	spic.4 \
 	${_spkr.4} \
 	splash.4 \
 	sppp.4 \
 	ste.4 \
 	stf.4 \
 	stg.4 \
 	stge.4 \
 	sym.4 \
 	syncache.4 \
 	syncer.4 \
 	syscons.4 \
 	sysmouse.4 \
 	tap.4 \
 	targ.4 \
 	tcp.4 \
 	tdfx.4 \
 	terasic_mtl.4 \
 	termios.4 \
 	textdump.4 \
 	ti.4 \
 	timecounters.4 \
 	tl.4 \
-	tnt4882.4 \
 	${_tpm.4} \
 	trm.4 \
 	tty.4 \
 	tun.4 \
 	twa.4 \
 	twe.4 \
 	tws.4 \
 	tx.4 \
 	txp.4 \
 	u3g.4 \
 	uark.4 \
 	uart.4 \
 	uath.4 \
 	ubsa.4 \
 	ubsec.4 \
 	ubser.4 \
 	ubtbcmfw.4 \
 	uchcom.4 \
 	ucom.4 \
 	ucycom.4 \
 	udav.4 \
 	udbp.4 \
 	udp.4 \
 	udplite.4 \
 	uep.4 \
 	ufm.4 \
 	ufoma.4 \
 	uftdi.4 \
 	ugen.4 \
 	uhci.4 \
 	uhid.4 \
 	uhso.4 \
 	uipaq.4 \
 	ukbd.4 \
 	uled.4 \
 	ulpt.4 \
 	umass.4 \
 	umcs.4 \
 	umct.4 \
 	umodem.4 \
 	umoscom.4 \
 	ums.4 \
 	unix.4 \
 	upgt.4 \
 	uplcom.4 \
 	ural.4 \
 	urio.4 \
 	urndis.4 \
 	${_urtw.4} \
 	urtwn.4 \
 	urtwnfw.4 \
 	usb.4 \
 	usb_template.4 \
 	usb_quirk.4 \
 	uslcom.4 \
 	usfs.4 \
 	utopia.4 \
 	uvisor.4 \
 	uvscom.4 \
 	vale.4 \
 	vga.4 \
 	vge.4 \
 	viapm.4 \
 	${_viawd.4} \
 	${_virtio.4} \
 	${_virtio_balloon.4} \
 	${_virtio_blk.4} \
 	${_virtio_console.4} \
 	${_virtio_random.4} \
 	${_virtio_scsi.4} \
 	vkbd.4 \
 	vlan.4 \
 	vxlan.4 \
 	${_vmx.4} \
 	vpo.4 \
 	vr.4 \
 	vt.4 \
 	vte.4 \
 	${_vtnet.4} \
 	${_vxge.4} \
 	watchdog.4 \
 	wb.4 \
 	${_wbwd.4} \
 	wi.4 \
 	witness.4 \
 	wlan.4 \
 	wlan_acl.4 \
 	wlan_amrr.4 \
 	wlan_ccmp.4 \
 	wlan_tkip.4 \
 	wlan_wep.4 \
 	wlan_xauth.4 \
 	${_wpi.4} \
 	wsp.4 \
 	xe.4 \
 	${_xen.4} \
 	xhci.4 \
 	xl.4 \
 	${_xnb.4} \
 	xpt.4 \
 	zero.4 \
 	zyd.4
 
 MLINKS=	ae.4 if_ae.4
 MLINKS+=age.4 if_age.4
 MLINKS+=agp.4 agpgart.4
 MLINKS+=alc.4 if_alc.4
 MLINKS+=ale.4 if_ale.4
 MLINKS+=altera_atse.4 atse.4
 MLINKS+=altera_sdcard.4 altera_sdcardc.4
 MLINKS+=altq.4 ALTQ.4
 MLINKS+=ath.4 if_ath.4
 MLINKS+=ath_pci.4 if_ath_pci.4
 MLINKS+=an.4 if_an.4
 MLINKS+=aue.4 if_aue.4
 MLINKS+=axe.4 if_axe.4
 MLINKS+=bce.4 if_bce.4
 MLINKS+=bfe.4 if_bfe.4
 MLINKS+=bge.4 if_bge.4
 MLINKS+=bktr.4 brooktree.4
 MLINKS+=bridge.4 if_bridge.4
 MLINKS+=bwi.4 if_bwi.4
 MLINKS+=bwn.4 if_bwn.4
 MLINKS+=${_bxe.4} ${_if_bxe.4}
 MLINKS+=cas.4 if_cas.4
 MLINKS+=cdce.4 if_cdce.4
 MLINKS+=crypto.4 cryptodev.4
 MLINKS+=cue.4 if_cue.4
 MLINKS+=cxgb.4 if_cxgb.4
 MLINKS+=cxgbe.4 if_cxgbe.4
 MLINKS+=dc.4 if_dc.4
 MLINKS+=de.4 if_de.4
 MLINKS+=disc.4 if_disc.4
 MLINKS+=ed.4 if_ed.4
 MLINKS+=edsc.4 if_edsc.4
 MLINKS+=em.4 if_em.4
 MLINKS+=en.4 if_en.4
 MLINKS+=enc.4 if_enc.4
 MLINKS+=epair.4 if_epair.4
 MLINKS+=et.4 if_et.4
 MLINKS+=fatm.4 if_fatm.4
 MLINKS+=fd.4 stderr.4 \
 	fd.4 stdin.4 \
 	fd.4 stdout.4
 MLINKS+=fdt.4 FDT.4
 MLINKS+=firewire.4 ieee1394.4
 MLINKS+=fpa.4 fea.4
 MLINKS+=fwe.4 if_fwe.4
 MLINKS+=fwip.4 if_fwip.4
 MLINKS+=fxp.4 if_fxp.4
 MLINKS+=gem.4 if_gem.4
 MLINKS+=geom.4 GEOM.4
 MLINKS+=gif.4 if_gif.4
 MLINKS+=gpio.4 gpiobus.4
 MLINKS+=gre.4 if_gre.4
 MLINKS+=hatm.4 if_hatm.4
 MLINKS+=hme.4 if_hme.4
 MLINKS+=hpet.4 acpi_hpet.4
 MLINKS+=${_hptrr.4} ${_rr232x.4}
 MLINKS+=${_attimer.4} ${_i8254.4}
 MLINKS+=igb.4 if_igb.4
 MLINKS+=ip.4 rawip.4
 MLINKS+=ipfirewall.4 ipaccounting.4 \
 	ipfirewall.4 ipacct.4 \
 	ipfirewall.4 ipfw.4
 MLINKS+=ipheth.4 if_ipheth.4
 MLINKS+=ipw.4 if_ipw.4
 MLINKS+=iwi.4 if_iwi.4
 MLINKS+=iwn.4 if_iwn.4
 MLINKS+=ixgb.4 if_ixgb.4
 MLINKS+=ixgbe.4 ix.4
 MLINKS+=ixgbe.4 if_ix.4
 MLINKS+=ixgbe.4 if_ixgbe.4
 MLINKS+=jme.4 if_jme.4
 MLINKS+=kue.4 if_kue.4
 MLINKS+=lagg.4 trunk.4
 MLINKS+=lagg.4 if_lagg.4
 MLINKS+=le.4 if_le.4
 MLINKS+=lge.4 if_lge.4
 MLINKS+=lmc.4 if_lmc.4
 MLINKS+=lo.4 loop.4
 MLINKS+=lp.4 plip.4
 MLINKS+=malo.4 if_malo.4
 MLINKS+=md.4 vn.4
 MLINKS+=mem.4 kmem.4
 MLINKS+=mn.4 if_mn.4
 MLINKS+=mos.4 if_mos.4
 MLINKS+=msk.4 if_msk.4
 MLINKS+=mwl.4 if_mwl.4
 MLINKS+=mxge.4 if_mxge.4
 MLINKS+=my.4 if_my.4
 MLINKS+=${_ndis.4} ${_if_ndis.4}
 MLINKS+=netfpga10g_nf10bmac.4 if_nf10bmac.4
 MLINKS+=netintro.4 net.4 \
 	netintro.4 networking.4
 MLINKS+=${_nfe.4} ${_if_nfe.4}
 MLINKS+=nge.4 if_nge.4
 MLINKS+=${_ntb.4} ${_if_ntb.4} \
 	${_ntb.4} ${_ntb_hw.4}
 MLINKS+=${_nxge.4} ${_if_nxge.4}
 MLINKS+=patm.4 if_patm.4
 MLINKS+=pccbb.4 cbb.4
 MLINKS+=pcm.4 snd.4 \
 	pcm.4 sound.4
 MLINKS+=pcn.4 if_pcn.4
 MLINKS+=ral.4 if_ral.4
 MLINKS+=re.4 if_re.4
 MLINKS+=rl.4 if_rl.4
 MLINKS+=rue.4 if_rue.4
 MLINKS+=rum.4 if_rum.4
 MLINKS+=run.4 if_run.4
 MLINKS+=scsi.4 CAM.4 \
 	scsi.4 cam.4 \
 	scsi.4 scbus.4 \
 	scsi.4 SCSI.4
 MLINKS+=sf.4 if_sf.4
 MLINKS+=sge.4 if_sge.4
 MLINKS+=sis.4 if_sis.4
 MLINKS+=sk.4 if_sk.4
 MLINKS+=smp.4 SMP.4
 MLINKS+=smsc.4 if_smsc.4
 MLINKS+=sn.4 if_sn.4
 MLINKS+=snd_envy24.4 snd_ak452x.4
 MLINKS+=snd_sbc.4 snd_sb16.4 \
 	snd_sbc.4 snd_sb8.4
 MLINKS+=${_spkr.4} ${_speaker.4}
 MLINKS+=splash.4 screensaver.4
 MLINKS+=ste.4 if_ste.4
 MLINKS+=stf.4 if_stf.4
 MLINKS+=stge.4 if_stge.4
 MLINKS+=syncache.4 syncookies.4
 MLINKS+=syscons.4 sc.4
 MLINKS+=tap.4 if_tap.4
 MLINKS+=tdfx.4 tdfx_linux.4
 MLINKS+=ti.4 if_ti.4
 MLINKS+=tl.4 if_tl.4
 MLINKS+=tun.4 if_tun.4
 MLINKS+=tx.4 if_tx.4
 MLINKS+=txp.4 if_txp.4
 MLINKS+=u3g.4 u3gstub.4
 MLINKS+=uath.4 if_uath.4
 MLINKS+=udav.4 if_udav.4
 MLINKS+=upgt.4 if_upgt.4
 MLINKS+=ural.4 if_ural.4
 MLINKS+=urndis.4 if_urndis.4
 MLINKS+=${_urtw.4} ${_if_urtw.4}
 MLINKS+=vge.4 if_vge.4
 MLINKS+=vlan.4 if_vlan.4
 MLINKS+=vxlan.4 if_vxlan.4
 MLINKS+=${_vmx.4} ${_if_vmx.4}
 MLINKS+=vpo.4 imm.4
 MLINKS+=vr.4 if_vr.4
 MLINKS+=vte.4 if_vte.4
 MLINKS+=${_vtnet.4} ${_if_vtnet.4}
 MLINKS+=${_vxge.4} ${_if_vxge.4}
 MLINKS+=watchdog.4 SW_WATCHDOG.4
 MLINKS+=wb.4 if_wb.4
 MLINKS+=wi.4 if_wi.4
 MLINKS+=${_wpi.4} ${_if_wpi.4}
 MLINKS+=xe.4 if_xe.4
 MLINKS+=xl.4 if_xl.4
 MLINKS+=zyd.4 if_zyd.4
 
 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
 _acpi_asus.4=	acpi_asus.4
 _acpi_asus_wmi.4=	acpi_asus_wmi.4
 _acpi_dock.4=	acpi_dock.4
 _acpi_fujitsu.4=acpi_fujitsu.4
 _acpi_hp.4=	acpi_hp.4
 _acpi_ibm.4=	acpi_ibm.4
 _acpi_panasonic.4=acpi_panasonic.4
 _acpi_rapidstart.4=acpi_rapidstart.4
 _acpi_sony.4=	acpi_sony.4
 _acpi_toshiba.4=acpi_toshiba.4
 _acpi_wmi.4=	acpi_wmi.4
 _aesni.4=	aesni.4
 _aout.4=	aout.4
 _apic.4=	apic.4
 _atrtc.4=	atrtc.4
 _attimer.4=	attimer.4
 _aibs.4=	aibs.4
 _amdsbwd.4=	amdsbwd.4
 _amdsmb.4=	amdsmb.4
 _amdtemp.4=	amdtemp.4
 _asmc.4=	asmc.4
 _bxe.4=		bxe.4
 _coretemp.4=	coretemp.4
 _cpuctl.4=	cpuctl.4
 _dpms.4=	dpms.4
 _hpt27xx.4=	hpt27xx.4
 _hptiop.4=	hptiop.4
 _hptmv.4=	hptmv.4
 _hptnr.4=	hptnr.4
 _hptrr.4=	hptrr.4
 _i8254.4=	i8254.4
 _ichwd.4=	ichwd.4
 _if_bxe.4=	if_bxe.4
 _if_ndis.4=	if_ndis.4
 _if_nfe.4=	if_nfe.4
 _if_nxge.4=	if_nxge.4
 _if_urtw.4=	if_urtw.4
 _if_vmx.4=	if_vmx.4
 _if_vtnet.4=	if_vtnet.4
 _if_vxge.4=	if_vxge.4
 _if_wpi.4=	if_wpi.4
 _ipmi.4=	ipmi.4
 _io.4=		io.4
 _linux.4=	linux.4
 _ndis.4=	ndis.4
 _nfe.4=		nfe.4
 _nfsmb.4=	nfsmb.4
 _nvd.4=		nvd.4
 _nvme.4=	nvme.4
 _nvram.4=	nvram.4
 _nxge.4=	nxge.4
 _virtio.4=	virtio.4
 _virtio_balloon.4=virtio_balloon.4
 _virtio_blk.4=	virtio_blk.4
 _virtio_console.4=virtio_console.4
 _virtio_random.4= virtio_random.4
 _virtio_scsi.4= virtio_scsi.4
 _vmx.4=		vmx.4
 _vtnet.4=	vtnet.4
 _vxge.4=	vxge.4
 _padlock.4=	padlock.4
 _rr232x.4=	rr232x.4
 _speaker.4=	speaker.4
 _spkr.4=	spkr.4
 _tpm.4=		tpm.4
 _urtw.4=	urtw.4
 _viawd.4=	viawd.4
 _wbwd.4=	wbwd.4
 _wpi.4=		wpi.4
 _xen.4=		xen.4
 _xnb.4=		xnb.4
 
 .endif
 
 .if ${MACHINE_CPUARCH} == "amd64"
 _bhyve.4=	bhyve.4
 _if_ntb.4=	if_ntb.4
 _ntb.4=		ntb.4
 _ntb_hw.4=	ntb_hw.4
 _qlxge.4=	qlxge.4
 _qlxgb.4=	qlxgb.4
 _qlxgbe.4=	qlxgbe.4
 _sfxge.4=	sfxge.4
 
 MLINKS+=qlxge.4 if_qlxge.4
 MLINKS+=qlxgb.4 if_qlxgb.4
 MLINKS+=qlxgbe.4 if_qlxgbe.4
 MLINKS+=sfxge.4 if_sfxge.4
 .endif
 
 .if ${MACHINE_CPUARCH} == "mips"
 _nvram2env.4=	nvram2env.4
 .endif
 
 .if exists(${.CURDIR}/man4.${MACHINE_CPUARCH})
 SUBDIR=	man4.${MACHINE_CPUARCH}
 .endif
 
 .if ${MK_TESTS} != "no"
 ATF=            ${.CURDIR}/../../../contrib/atf
 .PATH:          ${ATF}/doc
 _atf_test_case.4=	atf-test-case.4
 .endif
 
 .if ${MK_PF} != "no"
 _pf.4=		pf.4
 _pflog.4=	pflog.4
 _pfsync.4=	pfsync.4
 .endif
 
 .include 
Index: projects/arm_intrng/share/man/man4/mod_cc.4
===================================================================
--- projects/arm_intrng/share/man/man4/mod_cc.4	(revision 276247)
+++ projects/arm_intrng/share/man/man4/mod_cc.4	(revision 276248)
@@ -1,117 +1,118 @@
 .\"
 .\" Copyright (c) 2010-2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
 .\" This documentation was written at the Centre for Advanced Internet
 .\" Architectures, Swinburne University of Technology, Melbourne, Australia by
 .\" David Hayes and Lawrence Stewart under sponsorship from the FreeBSD
 .\" Foundation.
 .\"
 .\" 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 AUTHOR 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 AUTHOR 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.
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 15, 2011
+.Dd December 26, 2014
 .Dt MOD_CC 4
 .Os
 .Sh NAME
 .Nm mod_cc
 .Nd Modular congestion control
 .Sh DESCRIPTION
 The modular congestion control framework allows the TCP implementation to
 dynamically change the congestion control algorithm used by new and existing
 connections.
 Algorithms are identified by a unique
 .Xr ascii 7
 name.
 Algorithm modules can be compiled into the kernel or loaded as kernel modules
 using the
 .Xr kld 4
 facility.
 .Pp
 The default algorithm is NewReno, and all connections use the default unless
 explicitly overridden using the TCP_CONGESTION socket option (see
 .Xr tcp 4
 for details).
 The default can be changed using a
 .Xr sysctl 3
 MIB variable detailed in the
 .Sx MIB Variables
 section below.
 .Sh MIB Variables
 The framework exposes the following variables in the
 .Va net.inet.tcp.cc
 branch of the
 .Xr sysctl 3
 MIB:
 .Bl -tag -width ".Va available"
 .It Va available
 Read-only list of currently available congestion control algorithms by name.
 .It Va algorithm
 Returns the current default congestion control algorithm when read, and changes
 the default when set.
 When attempting to change the default algorithm, this variable should be set to
 one of the names listed by the
 .Va net.inet.tcp.cc.available
 MIB variable.
 .El
 .Sh SEE ALSO
+.Xr cc_cdg 4 ,
 .Xr cc_chd 4 ,
 .Xr cc_cubic 4 ,
 .Xr cc_hd 4 ,
 .Xr cc_htcp 4 ,
 .Xr cc_newreno 4 ,
 .Xr cc_vegas 4 ,
 .Xr tcp 4 ,
 .Xr mod_cc 9
 .Sh ACKNOWLEDGEMENTS
 Development and testing of this software were made possible in part by grants
 from the FreeBSD Foundation and Cisco University Research Program Fund at
 Community Foundation Silicon Valley.
 .Sh HISTORY
 The
 .Nm
 modular congestion control framework first appeared in
 .Fx 9.0 .
 .Pp
 The framework was first released in 2007 by James Healy and Lawrence Stewart
 whilst working on the NewTCP research project at Swinburne University of
 Technology's Centre for Advanced Internet Architectures, Melbourne, Australia,
 which was made possible in part by a grant from the Cisco University Research
 Program Fund at Community Foundation Silicon Valley.
 More details are available at:
 .Pp
 http://caia.swin.edu.au/urp/newtcp/
 .Sh AUTHORS
 .An -nosplit
 The
 .Nm
 facility was written by
 .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org ,
 .An James Healy Aq Mt jimmy@deefa.com
 and
 .An David Hayes Aq Mt david.hayes@ieee.org .
 .Pp
 This manual page was written by
 .An David Hayes Aq Mt david.hayes@ieee.org
 and
 .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org .
Index: projects/arm_intrng/share/man/man4/netmap.4
===================================================================
--- projects/arm_intrng/share/man/man4/netmap.4	(revision 276247)
+++ projects/arm_intrng/share/man/man4/netmap.4	(revision 276248)
@@ -1,1067 +1,1059 @@
 .\" Copyright (c) 2011-2014 Matteo Landi, Luigi Rizzo, Universita` di Pisa
 .\" 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 AUTHOR 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 AUTHOR 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.
 .\"
 .\" This document is derived in part from the enet man page (enet.4)
 .\" distributed with 4.3BSD Unix.
 .\"
 .\" $FreeBSD$
 .\"
 .Dd February 13, 2014
 .Dt NETMAP 4
 .Os
 .Sh NAME
 .Nm netmap
 .Nd a framework for fast packet I/O
 .br
 .Nm VALE
 .Nd a fast VirtuAl Local Ethernet using the netmap API
 .br
 .Nm netmap pipes
 .Nd a shared memory packet transport channel
 .Sh SYNOPSIS
 .Cd device netmap
 .Sh DESCRIPTION
 .Nm
 is a framework for extremely fast and efficient packet I/O
 for both userspace and kernel clients.
 It runs on FreeBSD and Linux,
 and includes
 .Nm VALE ,
 a very fast and modular in-kernel software switch/dataplane,
 and
 .Nm netmap pipes ,
 a shared memory packet transport channel.
 All these are accessed interchangeably with the same API.
 .Pp
 .Nm , VALE
 and
 .Nm netmap pipes
 are at least one order of magnitude faster than
 standard OS mechanisms
 (sockets, bpf, tun/tap interfaces, native switches, pipes),
 reaching 14.88 million packets per second (Mpps)
 with much less than one core on a 10 Gbit NIC,
 about 20 Mpps per core for VALE ports,
 and over 100 Mpps for netmap pipes.
 .Pp
 Userspace clients can dynamically switch NICs into
 .Nm
 mode and send and receive raw packets through
 memory mapped buffers.
 Similarly,
 .Nm VALE
 switch instances and ports, and
 .Nm netmap pipes
 can be created dynamically,
 providing high speed packet I/O between processes,
 virtual machines, NICs and the host stack.
 .Pp
 .Nm
 suports both non-blocking I/O through
 .Xr ioctls() ,
 synchronization and blocking I/O through a file descriptor
 and standard OS mechanisms such as
 .Xr select 2 ,
 .Xr poll 2 ,
 .Xr epoll 2 ,
 .Xr kqueue 2 .
 .Nm VALE
 and
 .Nm netmap pipes
 are implemented by a single kernel module, which also emulates the
 .Nm
 API over standard drivers for devices without native
 .Nm
 support.
 For best performance,
 .Nm
 requires explicit support in device drivers.
 .Pp
 In the rest of this (long) manual page we document
 various aspects of the
 .Nm
 and
 .Nm VALE
 architecture, features and usage.
 .Sh ARCHITECTURE
 .Nm
 supports raw packet I/O through a
 .Em port ,
 which can be connected to a physical interface
 .Em ( NIC ) ,
 to the host stack,
 or to a
 .Nm VALE
 switch).
 Ports use preallocated circular queues of buffers
 .Em ( rings )
 residing in an mmapped region.
 There is one ring for each transmit/receive queue of a
 NIC or virtual port.
 An additional ring pair connects to the host stack.
 .Pp
 After binding a file descriptor to a port, a
 .Nm
 client can send or receive packets in batches through
 the rings, and possibly implement zero-copy forwarding
 between ports.
 .Pp
 All NICs operating in
 .Nm
 mode use the same memory region,
 accessible to all processes who own
 .Nm /dev/netmap
 file descriptors bound to NICs.
 Independent
 .Nm VALE
 and
 .Nm netmap pipe
 ports
 by default use separate memory regions,
 but can be independently configured to share memory.
 .Sh ENTERING AND EXITING NETMAP MODE
 The following section describes the system calls to create
 and control
 .Nm netmap
 ports (including
 .Nm VALE
 and
 .Nm netmap pipe
 ports).
 Simpler, higher level functions are described in section
 .Xr LIBRARIES .
 .Pp
 Ports and rings are created and controlled through a file descriptor,
 created by opening a special device
 .Dl fd = open("/dev/netmap");
 and then bound to a specific port with an
 .Dl ioctl(fd, NIOCREGIF, (struct nmreq *)arg);
 .Pp
 .Nm
 has multiple modes of operation controlled by the
 .Vt struct nmreq
 argument.
 .Va arg.nr_name
 specifies the port name, as follows:
 .Bl -tag -width XXXX
 .It Dv OS network interface name (e.g. 'em0', 'eth1', ... )
 the data path of the NIC is disconnected from the host stack,
 and the file descriptor is bound to the NIC (one or all queues),
 or to the host stack;
 .It Dv valeXXX:YYY (arbitrary XXX and YYY)
 the file descriptor is bound to port YYY of a VALE switch called XXX,
 both dynamically created if necessary.
 The string cannot exceed IFNAMSIZ characters, and YYY cannot
 be the name of any existing OS network interface.
 .El
 .Pp
 On return,
 .Va arg
 indicates the size of the shared memory region,
 and the number, size and location of all the
 .Nm
 data structures, which can be accessed by mmapping the memory
 .Dl char *mem = mmap(0, arg.nr_memsize, fd);
 .Pp
 Non blocking I/O is done with special
 .Xr ioctl 2
 .Xr select 2
 and
 .Xr poll 2
 on the file descriptor permit blocking I/O.
 .Xr epoll 2
 and
 .Xr kqueue 2
 are not supported on
 .Nm
 file descriptors.
 .Pp
 While a NIC is in
 .Nm
 mode, the OS will still believe the interface is up and running.
 OS-generated packets for that NIC end up into a
 .Nm
 ring, and another ring is used to send packets into the OS network stack.
 A
 .Xr close 2
 on the file descriptor removes the binding,
 and returns the NIC to normal mode (reconnecting the data path
 to the host stack), or destroys the virtual port.
 .Sh DATA STRUCTURES
 The data structures in the mmapped memory region are detailed in
 .Xr sys/net/netmap.h ,
 which is the ultimate reference for the
 .Nm
 API. The main structures and fields are indicated below:
 .Bl -tag -width XXX
 .It Dv struct netmap_if (one per interface)
 .Bd -literal
 struct netmap_if {
     ...
     const uint32_t   ni_flags;      /* properties              */
     ...
     const uint32_t   ni_tx_rings;   /* NIC tx rings            */
     const uint32_t   ni_rx_rings;   /* NIC rx rings            */
     uint32_t         ni_bufs_head;  /* head of extra bufs list */
     ...
 };
 .Ed
 .Pp
 Indicates the number of available rings
 .Pa ( struct netmap_rings )
 and their position in the mmapped region.
 The number of tx and rx rings
 .Pa ( ni_tx_rings , ni_rx_rings )
 normally depends on the hardware.
 NICs also have an extra tx/rx ring pair connected to the host stack.
 .Em NIOCREGIF
 can also request additional unbound buffers in the same memory space,
 to be used as temporary storage for packets.
 .Pa ni_bufs_head
 contains the index of the first of these free rings,
 which are connected in a list (the first uint32_t of each
 buffer being the index of the next buffer in the list).
 A 0 indicates the end of the list.
-.Pp
 .It Dv struct netmap_ring (one per ring)
 .Bd -literal
 struct netmap_ring {
     ...
     const uint32_t num_slots;   /* slots in each ring            */
     const uint32_t nr_buf_size; /* size of each buffer           */
     ...
     uint32_t       head;        /* (u) first buf owned by user   */
     uint32_t       cur;         /* (u) wakeup position           */
     const uint32_t tail;        /* (k) first buf owned by kernel */
     ...
     uint32_t       flags;
     struct timeval ts;          /* (k) time of last rxsync()     */
     ...
     struct netmap_slot slot[0]; /* array of slots                */
 }
 .Ed
 .Pp
 Implements transmit and receive rings, with read/write
 pointers, metadata and and an array of
 .Pa slots
 describing the buffers.
-.Pp
 .It Dv struct netmap_slot (one per buffer)
 .Bd -literal
 struct netmap_slot {
     uint32_t buf_idx;           /* buffer index                 */
     uint16_t len;               /* packet length                */
     uint16_t flags;             /* buf changed, etc.            */
     uint64_t ptr;               /* address for indirect buffers */
 };
 .Ed
 .Pp
 Describes a packet buffer, which normally is identified by
 an index and resides in the mmapped region.
 .It Dv packet buffers
 Fixed size (normally 2 KB) packet buffers allocated by the kernel.
 .El
 .Pp
 The offset of the
 .Pa struct netmap_if
 in the mmapped region is indicated by the
 .Pa nr_offset
 field in the structure returned by
 .Pa NIOCREGIF .
 From there, all other objects are reachable through
 relative references (offsets or indexes).
 Macros and functions in 
 help converting them into actual pointers:
 .Pp
 .Dl struct netmap_if  *nifp = NETMAP_IF(mem, arg.nr_offset);
 .Dl struct netmap_ring *txr = NETMAP_TXRING(nifp, ring_index);
 .Dl struct netmap_ring *rxr = NETMAP_RXRING(nifp, ring_index);
 .Pp
 .Dl char *buf = NETMAP_BUF(ring, buffer_index);
 .Sh RINGS, BUFFERS AND DATA I/O
 .Va Rings
 are circular queues of packets with three indexes/pointers
 .Va ( head , cur , tail ) ;
 one slot is always kept empty.
 The ring size
 .Va ( num_slots )
 should not be assumed to be a power of two.
 .br
 (NOTE: older versions of netmap used head/count format to indicate
 the content of a ring).
 .Pp
 .Va head
 is the first slot available to userspace;
 .br
 .Va cur
 is the wakeup point:
 select/poll will unblock when
 .Va tail
 passes
 .Va cur ;
 .br
 .Va tail
 is the first slot reserved to the kernel.
 .Pp
 Slot indexes MUST only move forward;
 for convenience, the function
 .Dl nm_ring_next(ring, index)
 returns the next index modulo the ring size.
 .Pp
 .Va head
 and
 .Va cur
 are only modified by the user program;
 .Va tail
 is only modified by the kernel.
 The kernel only reads/writes the
 .Vt struct netmap_ring
 slots and buffers
 during the execution of a netmap-related system call.
 The only exception are slots (and buffers) in the range
 .Va tail\  . . . head-1 ,
 that are explicitly assigned to the kernel.
 .Pp
 .Ss TRANSMIT RINGS
 On transmit rings, after a
 .Nm
 system call, slots in the range
 .Va head\  . . . tail-1
 are available for transmission.
 User code should fill the slots sequentially
 and advance
 .Va head
 and
 .Va cur
 past slots ready to transmit.
 .Va cur
 may be moved further ahead if the user code needs
 more slots before further transmissions (see
 .Sx SCATTER GATHER I/O ) .
 .Pp
 At the next NIOCTXSYNC/select()/poll(),
 slots up to
 .Va head-1
 are pushed to the port, and
 .Va tail
 may advance if further slots have become available.
 Below is an example of the evolution of a TX ring:
-.Pp
 .Bd -literal
     after the syscall, slots between cur and tail are (a)vailable
               head=cur   tail
                |          |
                v          v
      TX  [.....aaaaaaaaaaa.............]
 
     user creates new packets to (T)ransmit
                 head=cur tail
                     |     |
                     v     v
      TX  [.....TTTTTaaaaaa.............]
 
     NIOCTXSYNC/poll()/select() sends packets and reports new slots
                 head=cur      tail
                     |          |
                     v          v
      TX  [..........aaaaaaaaaaa........]
 .Ed
 .Pp
 select() and poll() wlll block if there is no space in the ring, i.e.
 .Dl ring->cur == ring->tail
 and return when new slots have become available.
 .Pp
 High speed applications may want to amortize the cost of system calls
 by preparing as many packets as possible before issuing them.
 .Pp
 A transmit ring with pending transmissions has
 .Dl ring->head != ring->tail + 1 (modulo the ring size).
 The function
 .Va int nm_tx_pending(ring)
 implements this test.
 .Ss RECEIVE RINGS
 On receive rings, after a
 .Nm
 system call, the slots in the range
 .Va head\& . . . tail-1
 contain received packets.
 User code should process them and advance
 .Va head
 and
 .Va cur
 past slots it wants to return to the kernel.
 .Va cur
 may be moved further ahead if the user code wants to
 wait for more packets
 without returning all the previous slots to the kernel.
 .Pp
 At the next NIOCRXSYNC/select()/poll(),
 slots up to
 .Va head-1
 are returned to the kernel for further receives, and
 .Va tail
 may advance to report new incoming packets.
 .br
 Below is an example of the evolution of an RX ring:
 .Bd -literal
     after the syscall, there are some (h)eld and some (R)eceived slots
            head  cur     tail
             |     |       |
             v     v       v
      RX  [..hhhhhhRRRRRRRR..........]
 
     user advances head and cur, releasing some slots and holding others
                head cur  tail
                  |  |     |
                  v  v     v
      RX  [..*****hhhRRRRRR...........]
 
     NICRXSYNC/poll()/select() recovers slots and reports new packets
                head cur        tail
                  |  |           |
                  v  v           v
      RX  [.......hhhRRRRRRRRRRRR....]
 .Ed
 .Sh SLOTS AND PACKET BUFFERS
 Normally, packets should be stored in the netmap-allocated buffers
 assigned to slots when ports are bound to a file descriptor.
 One packet is fully contained in a single buffer.
 .Pp
 The following flags affect slot and buffer processing:
 .Bl -tag -width XXX
 .It NS_BUF_CHANGED
 it MUST be used when the buf_idx in the slot is changed.
 This can be used to implement
 zero-copy forwarding, see
 .Sx ZERO-COPY FORWARDING .
-.Pp
 .It NS_REPORT
 reports when this buffer has been transmitted.
 Normally,
 .Nm
 notifies transmit completions in batches, hence signals
 can be delayed indefinitely. This flag helps detecting
 when packets have been send and a file descriptor can be closed.
 .It NS_FORWARD
 When a ring is in 'transparent' mode (see
 .Sx TRANSPARENT MODE ) ,
 packets marked with this flags are forwarded to the other endpoint
 at the next system call, thus restoring (in a selective way)
 the connection between a NIC and the host stack.
 .It NS_NO_LEARN
 tells the forwarding code that the SRC MAC address for this
 packet must not be used in the learning bridge code.
 .It NS_INDIRECT
 indicates that the packet's payload is in a user-supplied buffer,
 whose user virtual address is in the 'ptr' field of the slot.
 The size can reach 65535 bytes.
 .br
 This is only supported on the transmit ring of
 .Nm VALE
 ports, and it helps reducing data copies in the interconnection
 of virtual machines.
 .It NS_MOREFRAG
 indicates that the packet continues with subsequent buffers;
 the last buffer in a packet must have the flag clear.
 .El
 .Sh SCATTER GATHER I/O
 Packets can span multiple slots if the
 .Va NS_MOREFRAG
 flag is set in all but the last slot.
 The maximum length of a chain is 64 buffers.
 This is normally used with
 .Nm VALE
 ports when connecting virtual machines, as they generate large
 TSO segments that are not split unless they reach a physical device.
 .Pp
 NOTE: The length field always refers to the individual
 fragment; there is no place with the total length of a packet.
 .Pp
 On receive rings the macro
 .Va NS_RFRAGS(slot)
 indicates the remaining number of slots for this packet,
 including the current one.
 Slots with a value greater than 1 also have NS_MOREFRAG set.
 .Sh IOCTLS
 .Nm
 uses two ioctls (NIOCTXSYNC, NIOCRXSYNC)
 for non-blocking I/O. They take no argument.
 Two more ioctls (NIOCGINFO, NIOCREGIF) are used
 to query and configure ports, with the following argument:
 .Bd -literal
 struct nmreq {
     char      nr_name[IFNAMSIZ]; /* (i) port name                  */
     uint32_t  nr_version;        /* (i) API version                */
     uint32_t  nr_offset;         /* (o) nifp offset in mmap region */
     uint32_t  nr_memsize;        /* (o) size of the mmap region    */
     uint32_t  nr_tx_slots;       /* (i/o) slots in tx rings        */
     uint32_t  nr_rx_slots;       /* (i/o) slots in rx rings        */
     uint16_t  nr_tx_rings;       /* (i/o) number of tx rings       */
     uint16_t  nr_rx_rings;       /* (i/o) number of tx rings       */
     uint16_t  nr_ringid;         /* (i/o) ring(s) we care about    */
     uint16_t  nr_cmd;            /* (i) special command            */
     uint16_t  nr_arg1;           /* (i/o) extra arguments          */
     uint16_t  nr_arg2;           /* (i/o) extra arguments          */
     uint32_t  nr_arg3;           /* (i/o) extra arguments          */
     uint32_t  nr_flags           /* (i/o) open mode                */
     ...
 };
 .Ed
 .Pp
 A file descriptor obtained through
 .Pa /dev/netmap
 also supports the ioctl supported by network devices, see
 .Xr netintro 4 .
-.Pp
 .Bl -tag -width XXXX
 .It Dv NIOCGINFO
 returns EINVAL if the named port does not support netmap.
 Otherwise, it returns 0 and (advisory) information
 about the port.
 Note that all the information below can change before the
 interface is actually put in netmap mode.
-.Pp
 .Bl -tag -width XX
 .It Pa nr_memsize
 indicates the size of the
 .Nm
 memory region. NICs in
 .Nm
 mode all share the same memory region,
 whereas
 .Nm VALE
 ports have independent regions for each port.
 .It Pa nr_tx_slots , nr_rx_slots
 indicate the size of transmit and receive rings.
 .It Pa nr_tx_rings , nr_rx_rings
 indicate the number of transmit
 and receive rings.
 Both ring number and sizes may be configured at runtime
 using interface-specific functions (e.g.
 .Xr ethtool
 ).
 .El
 .It Dv NIOCREGIF
 binds the port named in
 .Va nr_name
 to the file descriptor. For a physical device this also switches it into
 .Nm
 mode, disconnecting
 it from the host stack.
 Multiple file descriptors can be bound to the same port,
 with proper synchronization left to the user.
 .Pp
 .Dv NIOCREGIF can also bind a file descriptor to one endpoint of a
 .Em netmap pipe ,
 consisting of two netmap ports with a crossover connection.
 A netmap pipe share the same memory space of the parent port,
 and is meant to enable configuration where a master process acts
 as a dispatcher towards slave processes.
 .Pp
 To enable this function, the
 .Pa nr_arg1
 field of the structure can be used as a hint to the kernel to
 indicate how many pipes we expect to use, and reserve extra space
 in the memory region.
 .Pp
 On return, it gives the same info as NIOCGINFO,
 with
 .Pa nr_ringid
 and
 .Pa nr_flags
 indicating the identity of the rings controlled through the file
 descriptor.
 .Pp
 .Va nr_flags
 .Va nr_ringid
 selects which rings are controlled through this file descriptor.
 Possible values of
 .Pa nr_flags
 are indicated below, together with the naming schemes
 that application libraries (such as the
 .Nm nm_open
 indicated below) can use to indicate the specific set of rings.
 In the example below, "netmap:foo" is any valid netmap port name.
-.Pp
 .Bl -tag -width XXXXX
 .It NR_REG_ALL_NIC                         "netmap:foo"
 (default) all hardware ring pairs
 .It NR_REG_SW            "netmap:foo^"
 the ``host rings'', connecting to the host stack.
 .It NR_REG_NIC_SW        "netmap:foo+"
 all hardware rings and the host rings
 .It NR_REG_ONE_NIC       "netmap:foo-i"
 only the i-th hardware ring pair, where the number is in
 .Pa nr_ringid ;
 .It NR_REG_PIPE_MASTER  "netmap:foo{i"
 the master side of the netmap pipe whose identifier (i) is in
 .Pa nr_ringid ;
 .It NR_REG_PIPE_SLAVE   "netmap:foo}i"
 the slave side of the netmap pipe whose identifier (i) is in
 .Pa nr_ringid .
 .Pp
 The identifier of a pipe must be thought as part of the pipe name,
 and does not need to be sequential. On return the pipe
 will only have a single ring pair with index 0,
 irrespective of the value of i.
 .El
 .Pp
 By default, a
 .Xr poll 2
 or
 .Xr select 2
 call pushes out any pending packets on the transmit ring, even if
 no write events are specified.
 The feature can be disabled by or-ing
 .Va NETMAP_NO_TX_POLL
 to the value written to
 .Va nr_ringid.
 When this feature is used,
 packets are transmitted only on
 .Va ioctl(NIOCTXSYNC)
 or select()/poll() are called with a write event (POLLOUT/wfdset) or a full ring.
 .Pp
 When registering a virtual interface that is dynamically created to a
 .Xr vale 4
 switch, we can specify the desired number of rings (1 by default,
 and currently up to 16) on it using nr_tx_rings and nr_rx_rings fields.
 .It Dv NIOCTXSYNC
 tells the hardware of new packets to transmit, and updates the
 number of slots available for transmission.
 .It Dv NIOCRXSYNC
 tells the hardware of consumed packets, and asks for newly available
 packets.
 .El
 .Sh SELECT, POLL, EPOLL, KQUEUE.
 .Xr select 2
 and
 .Xr poll 2
 on a
 .Nm
 file descriptor process rings as indicated in
 .Sx TRANSMIT RINGS
 and
 .Sx RECEIVE RINGS ,
 respectively when write (POLLOUT) and read (POLLIN) events are requested.
 Both block if no slots are available in the ring
 .Va ( ring->cur == ring->tail ) .
 Depending on the platform,
 .Xr epoll 2
 and
 .Xr kqueue 2
 are supported too.
 .Pp
 Packets in transmit rings are normally pushed out
 (and buffers reclaimed) even without
 requesting write events. Passing the NETMAP_NO_TX_POLL flag to
 .Em NIOCREGIF
 disables this feature.
 By default, receive rings are processed only if read
 events are requested. Passing the NETMAP_DO_RX_POLL flag to
 .Em NIOCREGIF updates receive rings even without read events.
 Note that on epoll and kqueue, NETMAP_NO_TX_POLL and NETMAP_DO_RX_POLL
 only have an effect when some event is posted for the file descriptor.
 .Sh LIBRARIES
 The
 .Nm
 API is supposed to be used directly, both because of its simplicity and
 for efficient integration with applications.
 .Pp
 For conveniency, the
 .Va 
 header provides a few macros and functions to ease creating
 a file descriptor and doing I/O with a
 .Nm
 port. These are loosely modeled after the
 .Xr pcap 3
 API, to ease porting of libpcap-based applications to
 .Nm .
 To use these extra functions, programs should
 .Dl #define NETMAP_WITH_LIBS
 before
 .Dl #include 
 .Pp
 The following functions are available:
 .Bl -tag -width XXXXX
 .It Va  struct nm_desc * nm_open(const char *ifname, const struct nmreq *req, uint64_t flags, const struct nm_desc *arg)
 similar to
 .Xr pcap_open ,
 binds a file descriptor to a port.
 .Bl -tag -width XX
 .It Va ifname
 is a port name, in the form "netmap:XXX" for a NIC and "valeXXX:YYY" for a
 .Nm VALE
 port.
 .It Va req
 provides the initial values for the argument to the NIOCREGIF ioctl.
 The nm_flags and nm_ringid values are overwritten by parsing
 ifname and flags, and other fields can be overridden through
 the other two arguments.
 .It Va arg
 points to a struct nm_desc containing arguments (e.g. from a previously
 open file descriptor) that should override the defaults.
 The fields are used as described below
 .It Va flags
 can be set to a combination of the following flags:
 .Va NETMAP_NO_TX_POLL ,
 .Va NETMAP_DO_RX_POLL
 (copied into nr_ringid);
 .Va NM_OPEN_NO_MMAP (if arg points to the same memory region,
 avoids the mmap and uses the values from it);
 .Va NM_OPEN_IFNAME (ignores ifname and uses the values in arg);
 .Va NM_OPEN_ARG1 ,
 .Va NM_OPEN_ARG2 ,
 .Va NM_OPEN_ARG3 (uses the fields from arg);
 .Va NM_OPEN_RING_CFG (uses the ring number and sizes from arg).
 .El
 .It Va int nm_close(struct nm_desc *d)
 closes the file descriptor, unmaps memory, frees resources.
 .It Va int nm_inject(struct nm_desc *d, const void *buf, size_t size)
 similar to pcap_inject(), pushes a packet to a ring, returns the size
 of the packet is successful, or 0 on error;
 .It Va int nm_dispatch(struct nm_desc *d, int cnt, nm_cb_t cb, u_char *arg)
 similar to pcap_dispatch(), applies a callback to incoming packets
 .It Va u_char * nm_nextpkt(struct nm_desc *d, struct nm_pkthdr *hdr)
 similar to pcap_next(), fetches the next packet
 .El
 .Sh SUPPORTED DEVICES
 .Nm
 natively supports the following devices:
 .Pp
 On FreeBSD:
 .Xr em 4 ,
 .Xr igb 4 ,
 .Xr ixgbe 4 ,
 .Xr lem 4 ,
 .Xr re 4 .
 .Pp
 On Linux
 .Xr e1000 4 ,
 .Xr e1000e 4 ,
 .Xr igb 4 ,
 .Xr ixgbe 4 ,
 .Xr mlx4 4 ,
 .Xr forcedeth 4 ,
 .Xr r8169 4 .
 .Pp
 NICs without native support can still be used in
 .Nm
 mode through emulation. Performance is inferior to native netmap
 mode but still significantly higher than sockets, and approaching
 that of in-kernel solutions such as Linux's
 .Xr pktgen .
 .Pp
 Emulation is also available for devices with native netmap support,
 which can be used for testing or performance comparison.
 The sysctl variable
 .Va dev.netmap.admode
 globally controls how netmap mode is implemented.
 .Sh SYSCTL VARIABLES AND MODULE PARAMETERS
 Some aspect of the operation of
 .Nm
 are controlled through sysctl variables on FreeBSD
 .Em ( dev.netmap.* )
 and module parameters on Linux
 .Em ( /sys/module/netmap_lin/parameters/* ) :
-.Pp
 .Bl -tag -width indent
 .It Va dev.netmap.admode: 0
 Controls the use of native or emulated adapter mode.
 0 uses the best available option, 1 forces native and
 fails if not available, 2 forces emulated hence never fails.
 .It Va dev.netmap.generic_ringsize: 1024
 Ring size used for emulated netmap mode
 .It Va dev.netmap.generic_mit: 100000
 Controls interrupt moderation for emulated mode
 .It Va dev.netmap.mmap_unreg: 0
 .It Va dev.netmap.fwd: 0
 Forces NS_FORWARD mode
 .It Va dev.netmap.flags: 0
 .It Va dev.netmap.txsync_retry: 2
 .It Va dev.netmap.no_pendintr: 1
 Forces recovery of transmit buffers on system calls
 .It Va dev.netmap.mitigate: 1
 Propagates interrupt mitigation to user processes
 .It Va dev.netmap.no_timestamp: 0
 Disables the update of the timestamp in the netmap ring
 .It Va dev.netmap.verbose: 0
 Verbose kernel messages
 .It Va dev.netmap.buf_num: 163840
 .It Va dev.netmap.buf_size: 2048
 .It Va dev.netmap.ring_num: 200
 .It Va dev.netmap.ring_size: 36864
 .It Va dev.netmap.if_num: 100
 .It Va dev.netmap.if_size: 1024
 Sizes and number of objects (netmap_if, netmap_ring, buffers)
 for the global memory region. The only parameter worth modifying is
 .Va dev.netmap.buf_num
 as it impacts the total amount of memory used by netmap.
 .It Va dev.netmap.buf_curr_num: 0
 .It Va dev.netmap.buf_curr_size: 0
 .It Va dev.netmap.ring_curr_num: 0
 .It Va dev.netmap.ring_curr_size: 0
 .It Va dev.netmap.if_curr_num: 0
 .It Va dev.netmap.if_curr_size: 0
 Actual values in use.
 .It Va dev.netmap.bridge_batch: 1024
 Batch size used when moving packets across a
 .Nm VALE
 switch. Values above 64 generally guarantee good
 performance.
 .El
 .Sh SYSTEM CALLS
 .Nm
 uses
 .Xr select 2 ,
 .Xr poll 2 ,
 .Xr epoll
 and
 .Xr kqueue
 to wake up processes when significant events occur, and
 .Xr mmap 2
 to map memory.
 .Xr ioctl 2
 is used to configure ports and
 .Nm VALE switches .
 .Pp
 Applications may need to create threads and bind them to
 specific cores to improve performance, using standard
 OS primitives, see
 .Xr pthread 3 .
 In particular,
 .Xr pthread_setaffinity_np 3
 may be of use.
-.Sh CAVEATS
-No matter how fast the CPU and OS are,
-achieving line rate on 10G and faster interfaces
-requires hardware with sufficient performance.
-Several NICs are unable to sustain line rate with
-small packet sizes. Insufficient PCIe or memory bandwidth
-can also cause reduced performance.
-.Pp
-Another frequent reason for low performance is the use
-of flow control on the link: a slow receiver can limit
-the transmit speed.
-Be sure to disable flow control when running high
-speed experiments.
-.Pp
-.Ss SPECIAL NIC FEATURES
-.Nm
-is orthogonal to some NIC features such as
-multiqueue, schedulers, packet filters.
-.Pp
-Multiple transmit and receive rings are supported natively
-and can be configured with ordinary OS tools,
-such as
-.Xr ethtool
-or
-device-specific sysctl variables.
-The same goes for Receive Packet Steering (RPS)
-and filtering of incoming traffic.
-.Pp
-.Nm
-.Em does not use
-features such as
-.Em checksum offloading , TCP segmentation offloading ,
-.Em encryption , VLAN encapsulation/decapsulation ,
-etc. .
-When using netmap to exchange packets with the host stack,
-make sure to disable these features.
 .Sh EXAMPLES
 .Ss TEST PROGRAMS
 .Nm
 comes with a few programs that can be used for testing or
 simple applications.
 See the
 .Va examples/
 directory in
 .Nm
 distributions, or
 .Va tools/tools/netmap/
 directory in FreeBSD distributions.
 .Pp
 .Xr pkt-gen
 is a general purpose traffic source/sink.
 .Pp
 As an example
 .Dl pkt-gen -i ix0 -f tx -l 60
 can generate an infinite stream of minimum size packets, and
 .Dl pkt-gen -i ix0 -f rx
 is a traffic sink.
 Both print traffic statistics, to help monitor
 how the system performs.
 .Pp
 .Xr pkt-gen
 has many options can be uses to set packet sizes, addresses,
 rates, and use multiple send/receive threads and cores.
 .Pp
 .Xr bridge
 is another test program which interconnects two
 .Nm
 ports. It can be used for transparent forwarding between
 interfaces, as in
 .Dl bridge -i ix0 -i ix1
 or even connect the NIC to the host stack using netmap
 .Dl bridge -i ix0 -i ix0
 .Ss USING THE NATIVE API
 The following code implements a traffic generator
 .Pp
 .Bd -literal -compact
 #include 
 ...
 void sender(void)
 {
     struct netmap_if *nifp;
     struct netmap_ring *ring;
     struct nmreq nmr;
     struct pollfd fds;
 
     fd = open("/dev/netmap", O_RDWR);
     bzero(&nmr, sizeof(nmr));
     strcpy(nmr.nr_name, "ix0");
     nmr.nm_version = NETMAP_API;
     ioctl(fd, NIOCREGIF, &nmr);
     p = mmap(0, nmr.nr_memsize, fd);
     nifp = NETMAP_IF(p, nmr.nr_offset);
     ring = NETMAP_TXRING(nifp, 0);
     fds.fd = fd;
     fds.events = POLLOUT;
     for (;;) {
 	poll(&fds, 1, -1);
 	while (!nm_ring_empty(ring)) {
 	    i = ring->cur;
 	    buf = NETMAP_BUF(ring, ring->slot[i].buf_index);
 	    ... prepare packet in buf ...
 	    ring->slot[i].len = ... packet length ...
 	    ring->head = ring->cur = nm_ring_next(ring, i);
 	}
     }
 }
 .Ed
 .Ss HELPER FUNCTIONS
 A simple receiver can be implemented using the helper functions
 .Bd -literal -compact
 #define NETMAP_WITH_LIBS
 #include 
 ...
 void receiver(void)
 {
     struct nm_desc *d;
     struct pollfd fds;
     u_char *buf;
     struct nm_pkthdr h;
     ...
     d = nm_open("netmap:ix0", NULL, 0, 0);
     fds.fd = NETMAP_FD(d);
     fds.events = POLLIN;
     for (;;) {
 	poll(&fds, 1, -1);
         while ( (buf = nm_nextpkt(d, &h)) )
 	    consume_pkt(buf, h->len);
     }
     nm_close(d);
 }
 .Ed
 .Ss ZERO-COPY FORWARDING
 Since physical interfaces share the same memory region,
 it is possible to do packet forwarding between ports
 swapping buffers. The buffer from the transmit ring is used
 to replenish the receive ring:
 .Bd -literal -compact
     uint32_t tmp;
     struct netmap_slot *src, *dst;
     ...
     src = &src_ring->slot[rxr->cur];
     dst = &dst_ring->slot[txr->cur];
     tmp = dst->buf_idx;
     dst->buf_idx = src->buf_idx;
     dst->len = src->len;
     dst->flags = NS_BUF_CHANGED;
     src->buf_idx = tmp;
     src->flags = NS_BUF_CHANGED;
     rxr->head = rxr->cur = nm_ring_next(rxr, rxr->cur);
     txr->head = txr->cur = nm_ring_next(txr, txr->cur);
     ...
 .Ed
 .Ss ACCESSING THE HOST STACK
 The host stack is for all practical purposes just a regular ring pair,
 which you can access with the netmap API (e.g. with
 .Dl nm_open("netmap:eth0^", ... ) ;
 All packets that the host would send to an interface in
 .Nm
 mode end up into the RX ring, whereas all packets queued to the
 TX ring are send up to the host stack.
 .Ss VALE SWITCH
 A simple way to test the performance of a
 .Nm VALE
 switch is to attach a sender and a receiver to it,
 e.g. running the following in two different terminals:
 .Dl pkt-gen -i vale1:a -f rx # receiver
 .Dl pkt-gen -i vale1:b -f tx # sender
 The same example can be used to test netmap pipes, by simply
 changing port names, e.g.
 .Dl pkt-gen -i vale:x{3 -f rx # receiver on the master side
 .Dl pkt-gen -i vale:x}3 -f tx # sender on the slave side
 .Pp
 The following command attaches an interface and the host stack
 to a switch:
 .Dl vale-ctl -h vale2:em0
 Other
 .Nm
 clients attached to the same switch can now communicate
 with the network card or the host.
 .Sh SEE ALSO
 .Pa http://info.iet.unipi.it/~luigi/netmap/
 .Pp
 Luigi Rizzo, Revisiting network I/O APIs: the netmap framework,
 Communications of the ACM, 55 (3), pp.45-51, March 2012
 .Pp
 Luigi Rizzo, netmap: a novel framework for fast packet I/O,
 Usenix ATC'12, June 2012, Boston
 .Pp
 Luigi Rizzo, Giuseppe Lettieri,
 VALE, a switched ethernet for virtual machines,
 ACM CoNEXT'12, December 2012, Nice
 .Pp
 Luigi Rizzo, Giuseppe Lettieri, Vincenzo Maffione,
 Speeding up packet I/O in virtual machines,
 ACM/IEEE ANCS'13, October 2013, San Jose
 .Sh AUTHORS
 .An -nosplit
 The
 .Nm
 framework has been originally designed and implemented at the
 Universita` di Pisa in 2011 by
 .An Luigi Rizzo ,
 and further extended with help from
 .An Matteo Landi ,
 .An Gaetano Catalli ,
 .An Giuseppe Lettieri ,
 .An Vincenzo Maffione .
 .Pp
 .Nm
 and
 .Nm VALE
 have been funded by the European Commission within FP7 Projects
 CHANGE (257422) and OPENLAB (287581).
+.Sh CAVEATS
+No matter how fast the CPU and OS are,
+achieving line rate on 10G and faster interfaces
+requires hardware with sufficient performance.
+Several NICs are unable to sustain line rate with
+small packet sizes. Insufficient PCIe or memory bandwidth
+can also cause reduced performance.
+.Pp
+Another frequent reason for low performance is the use
+of flow control on the link: a slow receiver can limit
+the transmit speed.
+Be sure to disable flow control when running high
+speed experiments.
+.Pp
+.Ss SPECIAL NIC FEATURES
+.Nm
+is orthogonal to some NIC features such as
+multiqueue, schedulers, packet filters.
+.Pp
+Multiple transmit and receive rings are supported natively
+and can be configured with ordinary OS tools,
+such as
+.Xr ethtool
+or
+device-specific sysctl variables.
+The same goes for Receive Packet Steering (RPS)
+and filtering of incoming traffic.
+.Pp
+.Nm
+.Em does not use
+features such as
+.Em checksum offloading , TCP segmentation offloading ,
+.Em encryption , VLAN encapsulation/decapsulation ,
+etc. .
+When using netmap to exchange packets with the host stack,
+make sure to disable these features.
Index: projects/arm_intrng/share/man/man4
===================================================================
--- projects/arm_intrng/share/man/man4	(revision 276247)
+++ projects/arm_intrng/share/man/man4	(revision 276248)

Property changes on: projects/arm_intrng/share/man/man4
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head/share/man/man4:r276010-276247
Index: projects/arm_intrng/share/man/man9/Makefile
===================================================================
--- projects/arm_intrng/share/man/man9/Makefile	(revision 276247)
+++ projects/arm_intrng/share/man/man9/Makefile	(revision 276248)
@@ -1,1758 +1,1760 @@
 # $FreeBSD$
 
 MAN=	accept_filter.9 \
 	accf_data.9 \
 	accf_dns.9 \
 	accf_http.9 \
 	acl.9 \
 	alq.9 \
 	altq.9 \
 	atomic.9 \
 	bios.9 \
 	boot.9 \
 	bpf.9 \
 	buf.9 \
 	buf_ring.9 \
 	BUF_ISLOCKED.9 \
 	BUF_LOCK.9 \
 	BUF_LOCKFREE.9 \
 	BUF_LOCKINIT.9 \
 	BUF_RECURSED.9 \
 	BUF_TIMELOCK.9 \
 	BUF_UNLOCK.9 \
 	bus_activate_resource.9 \
 	BUS_ADD_CHILD.9 \
 	bus_adjust_resource.9 \
 	bus_alloc_resource.9 \
 	BUS_BIND_INTR.9 \
 	bus_child_present.9 \
 	BUS_CHILD_DELETED.9 \
 	BUS_CHILD_DETACHED.9 \
 	BUS_CONFIG_INTR.9 \
 	BUS_DESCRIBE_INTR.9 \
 	bus_dma.9 \
 	bus_generic_attach.9 \
 	bus_generic_detach.9 \
 	bus_generic_new_pass.9 \
 	bus_generic_print_child.9 \
 	bus_generic_read_ivar.9 \
 	bus_generic_shutdown.9 \
 	BUS_NEW_PASS.9 \
 	BUS_PRINT_CHILD.9 \
 	BUS_READ_IVAR.9 \
 	bus_release_resource.9 \
 	bus_set_pass.9 \
 	bus_set_resource.9 \
 	BUS_SETUP_INTR.9 \
 	bus_space.9 \
 	byteorder.9 \
 	casuword.9 \
 	cd.9 \
 	condvar.9 \
 	config_intrhook.9 \
 	contigmalloc.9 \
 	copy.9 \
 	counter.9 \
 	cr_cansee.9 \
 	critical_enter.9 \
 	cr_seeothergids.9 \
 	cr_seeotheruids.9 \
 	crypto.9 \
 	CTASSERT.9 \
 	DB_COMMAND.9 \
 	DECLARE_GEOM_CLASS.9 \
 	DECLARE_MODULE.9 \
 	DELAY.9 \
 	devclass.9 \
 	devclass_find.9 \
 	devclass_get_device.9 \
 	devclass_get_devices.9 \
 	devclass_get_drivers.9 \
 	devclass_get_maxunit.9 \
 	devclass_get_name.9 \
 	devclass_get_softc.9 \
 	dev_clone.9 \
 	devfs_set_cdevpriv.9 \
 	device.9 \
 	device_add_child.9 \
 	DEVICE_ATTACH.9 \
 	device_delete_child.9 \
 	DEVICE_DETACH.9 \
 	device_enable.9 \
 	device_find_child.9 \
 	device_get_children.9 \
 	device_get_devclass.9 \
 	device_get_driver.9 \
 	device_get_ivars.9 \
 	device_get_name.9 \
 	device_get_parent.9 \
 	device_get_softc.9 \
 	device_get_state.9 \
 	device_get_sysctl.9 \
 	device_get_unit.9 \
 	DEVICE_IDENTIFY.9 \
 	device_printf.9 \
 	DEVICE_PROBE.9 \
 	device_probe_and_attach.9 \
 	device_quiet.9 \
 	device_set_desc.9 \
 	device_set_driver.9 \
 	device_set_flags.9 \
 	DEVICE_SHUTDOWN.9 \
 	DEV_MODULE.9 \
 	devstat.9 \
 	devtoname.9 \
 	disk.9 \
 	domain.9 \
 	drbr.9 \
 	driver.9 \
 	DRIVER_MODULE.9 \
 	EVENTHANDLER.9 \
 	eventtimers.9 \
 	extattr.9 \
 	fail.9 \
 	fetch.9 \
 	firmware.9 \
 	fpu_kern.9 \
 	g_access.9 \
 	g_attach.9 \
 	g_bio.9 \
 	g_consumer.9 \
 	g_data.9 \
 	get_cyclecount.9 \
 	getenv.9 \
 	getnewvnode.9 \
 	g_event.9 \
 	g_geom.9 \
 	g_provider.9 \
 	g_provider_by_name.9 \
 	groupmember.9 \
 	g_wither_geom.9 \
 	hash.9 \
 	hashinit.9 \
 	hexdump.9 \
 	hhook.9 \
 	ieee80211.9 \
 	ieee80211_amrr.9 \
 	ieee80211_beacon.9 \
 	ieee80211_bmiss.9 \
 	ieee80211_crypto.9 \
 	ieee80211_ddb.9 \
 	ieee80211_input.9 \
 	ieee80211_node.9 \
 	ieee80211_output.9 \
 	ieee80211_proto.9 \
 	ieee80211_radiotap.9 \
 	ieee80211_regdomain.9 \
 	ieee80211_scan.9 \
 	ieee80211_vap.9 \
 	ifnet.9 \
 	inittodr.9 \
 	insmntque.9 \
 	intro.9 \
 	ithread.9 \
 	KASSERT.9 \
 	kernacc.9 \
 	kernel_mount.9 \
 	khelp.9 \
 	kobj.9 \
 	kproc.9 \
 	kqueue.9 \
 	kthread.9 \
 	ktr.9 \
 	lock.9 \
 	locking.9 \
 	LOCK_PROFILING.9 \
 	mac.9 \
 	make_dev.9 \
 	malloc.9 \
 	mbchain.9 \
 	mbpool.9 \
 	mbuf.9 \
 	mbuf_tags.9 \
 	MD5.9 \
 	mdchain.9 \
 	memcchr.9 \
 	memguard.9 \
 	microseq.9 \
 	microtime.9 \
 	microuptime.9 \
 	mi_switch.9 \
 	mod_cc.9 \
 	module.9 \
 	MODULE_DEPEND.9 \
 	MODULE_VERSION.9 \
 	mtx_pool.9 \
 	mutex.9 \
 	namei.9 \
 	netisr.9 \
 	osd.9 \
 	panic.9 \
 	pbuf.9 \
 	PCBGROUP.9 \
 	p_candebug.9 \
 	p_cansee.9 \
 	pci.9 \
 	pfil.9 \
 	pfind.9 \
 	pget.9 \
 	pgfind.9 \
 	physio.9 \
 	pmap.9 \
 	pmap_activate.9 \
 	pmap_clear_modify.9 \
 	pmap_copy.9 \
 	pmap_enter.9 \
 	pmap_extract.9 \
 	pmap_growkernel.9 \
 	pmap_init.9 \
 	pmap_is_modified.9 \
 	pmap_is_prefaultable.9 \
 	pmap_map.9 \
 	pmap_mincore.9 \
 	pmap_object_init_pt.9 \
 	pmap_page_exists_quick.9 \
 	pmap_page_init.9 \
 	pmap_pinit.9 \
 	pmap_protect.9 \
 	pmap_qenter.9 \
 	pmap_release.9 \
 	pmap_remove.9 \
 	pmap_resident_count.9 \
 	pmap_unwire.9 \
 	pmap_zero_page.9 \
 	printf.9 \
 	prison_check.9 \
 	priv.9 \
 	pseudofs.9 \
 	psignal.9 \
 	random.9 \
 	random_harvest.9 \
 	redzone.9 \
 	refcount.9 \
 	resettodr.9 \
 	resource_int_value.9 \
 	rijndael.9 \
 	rman.9 \
 	rmlock.9 \
 	rtalloc.9 \
 	rtentry.9 \
 	runqueue.9 \
 	rwlock.9 \
 	sbuf.9 \
 	scheduler.9 \
 	SDT.9 \
 	securelevel_gt.9 \
 	selrecord.9 \
 	sema.9 \
 	sf_buf.9 \
 	sglist.9 \
 	shm_map.9 \
 	signal.9 \
 	sleep.9 \
 	sleepqueue.9 \
 	socket.9 \
 	spl.9 \
 	stack.9 \
 	store.9 \
 	style.9 \
 	swi.9 \
 	sx.9 \
 	SYSCALL_MODULE.9 \
 	sysctl.9 \
 	sysctl_add_oid.9 \
 	sysctl_ctx_init.9 \
 	SYSINIT.9 \
 	taskqueue.9 \
 	thread_exit.9 \
 	time.9 \
 	timeout.9 \
 	tvtohz.9 \
 	ucred.9 \
 	uidinfo.9 \
 	uio.9 \
 	unr.9 \
 	usbdi.9 \
 	utopia.9 \
 	vaccess.9 \
 	vaccess_acl_nfs4.9 \
 	vaccess_acl_posix1e.9 \
 	vcount.9 \
 	vflush.9 \
 	VFS.9 \
 	vfs_busy.9 \
 	VFS_CHECKEXP.9 \
 	vfsconf.9 \
 	VFS_FHTOVP.9 \
 	vfs_getnewfsid.9 \
 	vfs_getopt.9 \
 	vfs_getvfs.9 \
 	VFS_MOUNT.9 \
 	vfs_mountedfrom.9 \
 	VFS_QUOTACTL.9 \
 	VFS_ROOT.9 \
 	vfs_rootmountalloc.9 \
 	VFS_SET.9 \
 	VFS_STATFS.9 \
 	vfs_suser.9 \
 	VFS_SYNC.9 \
 	vfs_timestamp.9 \
 	vfs_unbusy.9 \
 	VFS_UNMOUNT.9 \
 	vfs_unmountall.9 \
 	VFS_VGET.9 \
 	vget.9 \
 	vgone.9 \
 	vhold.9 \
 	vinvalbuf.9 \
 	vm_fault_prefault.9 \
 	vm_map.9 \
 	vm_map_check_protection.9 \
 	vm_map_create.9 \
 	vm_map_delete.9 \
 	vm_map_entry_resize_free.9 \
 	vm_map_find.9 \
 	vm_map_findspace.9 \
 	vm_map_inherit.9 \
 	vm_map_init.9 \
 	vm_map_insert.9 \
 	vm_map_lock.9 \
 	vm_map_lookup.9 \
 	vm_map_madvise.9 \
 	vm_map_max.9 \
 	vm_map_protect.9 \
 	vm_map_remove.9 \
 	vm_map_simplify_entry.9 \
 	vm_map_stack.9 \
 	vm_map_submap.9 \
 	vm_map_sync.9 \
 	vm_map_wire.9 \
 	vm_page_alloc.9 \
 	vm_page_bits.9 \
 	vm_page_busy.9 \
 	vm_page_cache.9 \
 	vm_page_deactivate.9 \
 	vm_page_dontneed.9 \
 	vm_page_aflag.9 \
 	vm_page_free.9 \
 	vm_page_grab.9 \
 	vm_page_hold.9 \
 	vm_page_insert.9 \
 	vm_page_lookup.9 \
 	vm_page_rename.9 \
 	vm_page_wire.9 \
 	vm_set_page_size.9 \
 	vmem.9 \
 	vn_fullpath.9 \
 	vn_isdisk.9 \
 	vnet.9 \
 	vnode.9 \
 	VOP_ACCESS.9 \
 	VOP_ACLCHECK.9 \
 	VOP_ADVISE.9 \
 	VOP_ADVLOCK.9 \
 	VOP_ALLOCATE.9 \
 	VOP_ATTRIB.9 \
 	VOP_BWRITE.9 \
 	VOP_CREATE.9 \
 	VOP_FSYNC.9 \
 	VOP_GETACL.9 \
 	VOP_GETEXTATTR.9 \
 	VOP_GETPAGES.9 \
 	VOP_INACTIVE.9 \
 	VOP_IOCTL.9 \
 	VOP_LINK.9 \
 	VOP_LISTEXTATTR.9 \
 	VOP_LOCK.9 \
 	VOP_LOOKUP.9 \
 	VOP_OPENCLOSE.9 \
 	VOP_PATHCONF.9 \
 	VOP_PRINT.9 \
 	VOP_RDWR.9 \
 	VOP_READDIR.9 \
 	VOP_READLINK.9 \
 	VOP_REALLOCBLKS.9 \
 	VOP_REMOVE.9 \
 	VOP_RENAME.9 \
 	VOP_REVOKE.9 \
 	VOP_SETACL.9 \
 	VOP_SETEXTATTR.9 \
 	VOP_STRATEGY.9 \
 	VOP_VPTOCNP.9 \
 	VOP_VPTOFH.9 \
 	vref.9 \
 	vrefcnt.9 \
 	vrele.9 \
 	vslock.9 \
 	watchdog.9 \
 	zone.9
 
 MLINKS=	unr.9 alloc_unr.9 \
 	unr.9 alloc_unrl.9 \
 	unr.9 alloc_unr_specific.9 \
 	unr.9 delete_unrhdr.9 \
 	unr.9 free_unr.9 \
 	unr.9 new_unrhdr.9
 MLINKS+=accept_filter.9 accept_filt_add.9 \
 	accept_filter.9 accept_filt_del.9 \
 	accept_filter.9 accept_filt_generic_mod_event.9 \
 	accept_filter.9 accept_filt_get.9
 MLINKS+=alq.9 ALQ.9 \
 	alq.9 alq_close.9 \
 	alq.9 alq_flush.9 \
 	alq.9 alq_get.9 \
 	alq.9 alq_getn.9 \
 	alq.9 alq_open.9 \
 	alq.9 alq_open_flags.9 \
 	alq.9 alq_post.9 \
 	alq.9 alq_post_flags.9 \
 	alq.9 alq_write.9 \
 	alq.9 alq_writen.9
 MLINKS+=altq.9 ALTQ.9
 MLINKS+=atomic.9 atomic_add.9 \
 	atomic.9 atomic_clear.9 \
 	atomic.9 atomic_cmpset.9 \
 	atomic.9 atomic_fetchadd.9 \
 	atomic.9 atomic_load.9 \
 	atomic.9 atomic_readandclear.9 \
 	atomic.9 atomic_set.9 \
 	atomic.9 atomic_store.9 \
 	atomic.9 atomic_subtract.9 \
 	atomic.9 atomic_swap.9 \
 	atomic.9 atomic_testandset.9
 MLINKS+=bpf.9 bpfattach.9 \
 	bpf.9 bpfattach2.9 \
 	bpf.9 bpfdetach.9 \
 	bpf.9 bpf_filter.9 \
 	bpf.9 bpf_mtap.9 \
 	bpf.9 bpf_mtap2.9 \
 	bpf.9 bpf_tap.9 \
 	bpf.9 bpf_validate.9
 MLINKS+=buf.9 bp.9
 MLINKS+=buf_ring.9 buf_ring_alloc.9 \
 	buf_ring.9 buf_ring_free.9 \
 	buf_ring.9 buf_ring_enqueue.9 \
 	buf_ring.9 buf_ring_enqueue_bytes.9 \
 	buf_ring.9 buf_ring_dequeue_mc.9 \
 	buf_ring.9 buf_ring_dequeue_sc.9 \
 	buf_ring.9 buf_ring_count.9 \
 	buf_ring.9 buf_ring_empty.9 \
 	buf_ring.9 buf_ring_full.9 \
 	buf_ring.9 buf_ring_peek.9
 MLINKS+=bus_activate_resource.9 bus_deactivate_resource.9
 MLINKS+=bus_alloc_resource.9 bus_alloc_resource_any.9
 MLINKS+=BUS_BIND_INTR.9 bus_bind_intr.9
 MLINKS+=BUS_DESCRIBE_INTR.9 bus_describe_intr.9
 MLINKS+=bus_dma.9 busdma.9 \
 	bus_dma.9 bus_dmamap_create.9 \
 	bus_dma.9 bus_dmamap_destroy.9 \
 	bus_dma.9 bus_dmamap_load.9 \
 	bus_dma.9 bus_dmamap_load_bio.9 \
 	bus_dma.9 bus_dmamap_load_ccb.9 \
 	bus_dma.9 bus_dmamap_load_mbuf.9 \
 	bus_dma.9 bus_dmamap_load_mbuf_sg.9 \
 	bus_dma.9 bus_dmamap_load_uio.9 \
 	bus_dma.9 bus_dmamap_sync.9 \
 	bus_dma.9 bus_dmamap_unload.9 \
 	bus_dma.9 bus_dmamem_alloc.9 \
 	bus_dma.9 bus_dmamem_free.9 \
 	bus_dma.9 bus_dma_tag_create.9 \
 	bus_dma.9 bus_dma_tag_destroy.9
 MLINKS+=bus_generic_read_ivar.9 bus_generic_write_ivar.9
 MLINKS+=BUS_READ_IVAR.9 BUS_WRITE_IVAR.9
 MLINKS+=BUS_SETUP_INTR.9 bus_setup_intr.9 \
 	BUS_SETUP_INTR.9 BUS_TEARDOWN_INTR.9 \
 	BUS_SETUP_INTR.9 bus_teardown_intr.9
 MLINKS+=bus_space.9 bus_space_alloc.9 \
 	bus_space.9 bus_space_barrier.9 \
 	bus_space.9 bus_space_copy_region_1.9 \
 	bus_space.9 bus_space_copy_region_2.9 \
 	bus_space.9 bus_space_copy_region_4.9 \
 	bus_space.9 bus_space_copy_region_8.9 \
 	bus_space.9 bus_space_copy_region_stream_1.9 \
 	bus_space.9 bus_space_copy_region_stream_2.9 \
 	bus_space.9 bus_space_copy_region_stream_4.9 \
 	bus_space.9 bus_space_copy_region_stream_8.9 \
 	bus_space.9 bus_space_free.9 \
 	bus_space.9 bus_space_map.9 \
 	bus_space.9 bus_space_read_1.9 \
 	bus_space.9 bus_space_read_2.9 \
 	bus_space.9 bus_space_read_4.9 \
 	bus_space.9 bus_space_read_8.9 \
 	bus_space.9 bus_space_read_multi_1.9 \
 	bus_space.9 bus_space_read_multi_2.9 \
 	bus_space.9 bus_space_read_multi_4.9 \
 	bus_space.9 bus_space_read_multi_8.9 \
 	bus_space.9 bus_space_read_multi_stream_1.9 \
 	bus_space.9 bus_space_read_multi_stream_2.9 \
 	bus_space.9 bus_space_read_multi_stream_4.9 \
 	bus_space.9 bus_space_read_multi_stream_8.9 \
 	bus_space.9 bus_space_read_region_1.9 \
 	bus_space.9 bus_space_read_region_2.9 \
 	bus_space.9 bus_space_read_region_4.9 \
 	bus_space.9 bus_space_read_region_8.9 \
 	bus_space.9 bus_space_read_region_stream_1.9 \
 	bus_space.9 bus_space_read_region_stream_2.9 \
 	bus_space.9 bus_space_read_region_stream_4.9 \
 	bus_space.9 bus_space_read_region_stream_8.9 \
 	bus_space.9 bus_space_read_stream_1.9 \
 	bus_space.9 bus_space_read_stream_2.9 \
 	bus_space.9 bus_space_read_stream_4.9 \
 	bus_space.9 bus_space_read_stream_8.9 \
 	bus_space.9 bus_space_set_multi_1.9 \
 	bus_space.9 bus_space_set_multi_2.9 \
 	bus_space.9 bus_space_set_multi_4.9 \
 	bus_space.9 bus_space_set_multi_8.9 \
 	bus_space.9 bus_space_set_multi_stream_1.9 \
 	bus_space.9 bus_space_set_multi_stream_2.9 \
 	bus_space.9 bus_space_set_multi_stream_4.9 \
 	bus_space.9 bus_space_set_multi_stream_8.9 \
 	bus_space.9 bus_space_set_region_1.9 \
 	bus_space.9 bus_space_set_region_2.9 \
 	bus_space.9 bus_space_set_region_4.9 \
 	bus_space.9 bus_space_set_region_8.9 \
 	bus_space.9 bus_space_set_region_stream_1.9 \
 	bus_space.9 bus_space_set_region_stream_2.9 \
 	bus_space.9 bus_space_set_region_stream_4.9 \
 	bus_space.9 bus_space_set_region_stream_8.9 \
 	bus_space.9 bus_space_subregion.9 \
 	bus_space.9 bus_space_unmap.9 \
 	bus_space.9 bus_space_write_1.9 \
 	bus_space.9 bus_space_write_2.9 \
 	bus_space.9 bus_space_write_4.9 \
 	bus_space.9 bus_space_write_8.9 \
 	bus_space.9 bus_space_write_multi_1.9 \
 	bus_space.9 bus_space_write_multi_2.9 \
 	bus_space.9 bus_space_write_multi_4.9 \
 	bus_space.9 bus_space_write_multi_8.9 \
 	bus_space.9 bus_space_write_multi_stream_1.9 \
 	bus_space.9 bus_space_write_multi_stream_2.9 \
 	bus_space.9 bus_space_write_multi_stream_4.9 \
 	bus_space.9 bus_space_write_multi_stream_8.9 \
 	bus_space.9 bus_space_write_region_1.9 \
 	bus_space.9 bus_space_write_region_2.9 \
 	bus_space.9 bus_space_write_region_4.9 \
 	bus_space.9 bus_space_write_region_8.9 \
 	bus_space.9 bus_space_write_region_stream_1.9 \
 	bus_space.9 bus_space_write_region_stream_2.9 \
 	bus_space.9 bus_space_write_region_stream_4.9 \
 	bus_space.9 bus_space_write_region_stream_8.9 \
 	bus_space.9 bus_space_write_stream_1.9 \
 	bus_space.9 bus_space_write_stream_2.9 \
 	bus_space.9 bus_space_write_stream_4.9 \
 	bus_space.9 bus_space_write_stream_8.9
 MLINKS+=byteorder.9 be16dec.9 \
 	byteorder.9 be16enc.9 \
 	byteorder.9 be16toh.9 \
 	byteorder.9 be32dec.9 \
 	byteorder.9 be32enc.9 \
 	byteorder.9 be32toh.9 \
 	byteorder.9 be64dec.9 \
 	byteorder.9 be64enc.9 \
 	byteorder.9 be64toh.9 \
 	byteorder.9 bswap16.9 \
 	byteorder.9 bswap32.9 \
 	byteorder.9 bswap64.9 \
 	byteorder.9 htobe16.9 \
 	byteorder.9 htobe32.9 \
 	byteorder.9 htobe64.9 \
 	byteorder.9 htole16.9 \
 	byteorder.9 htole32.9 \
 	byteorder.9 htole64.9 \
 	byteorder.9 le16dec.9 \
 	byteorder.9 le16enc.9 \
 	byteorder.9 le16toh.9 \
 	byteorder.9 le32dec.9 \
 	byteorder.9 le32enc.9 \
 	byteorder.9 le32toh.9 \
 	byteorder.9 le64dec.9 \
 	byteorder.9 le64enc.9 \
 	byteorder.9 le64toh.9
 MLINKS+=condvar.9 cv_broadcast.9 \
 	condvar.9 cv_broadcastpri.9 \
 	condvar.9 cv_destroy.9 \
 	condvar.9 cv_init.9 \
 	condvar.9 cv_signal.9 \
 	condvar.9 cv_timedwait.9 \
 	condvar.9 cv_timedwait_sig.9 \
 	condvar.9 cv_timedwait_sig_sbt.9 \
 	condvar.9 cv_wait.9 \
 	condvar.9 cv_wait_sig.9 \
 	condvar.9 cv_wait_unlock.9 \
 	condvar.9 cv_wmesg.9
 MLINKS+=config_intrhook.9 config_intrhook_disestablish.9 \
 	config_intrhook.9 config_intrhook_establish.9
 MLINKS+=contigmalloc.9 contigfree.9
 MLINKS+=casuword.9 casueword.9 \
 	casuword.9 casueword32.9 \
 	casuword.9 casuword32.9
 MLINKS+=copy.9 copyin.9 \
 	copy.9 copyin_nofault.9 \
 	copy.9 copyinstr.9 \
 	copy.9 copyout.9 \
 	copy.9 copyout_nofault.9 \
 	copy.9 copystr.9
 MLINKS+=counter.9 counter_u64_alloc.9 \
 	counter.9 counter_u64_free.9 \
 	counter.9 counter_u64_add.9 \
 	counter.9 counter_enter.9 \
 	counter.9 counter_exit.9 \
 	counter.9 counter_u64_add_protected.9 \
 	counter.9 counter_u64_fetch.9 \
 	counter.9 counter_u64_zero.9
 MLINKS+=critical_enter.9 critical.9 \
 	critical_enter.9 critical_exit.9
 MLINKS+=crypto.9 crypto_dispatch.9 \
 	crypto.9 crypto_done.9 \
 	crypto.9 crypto_freereq.9 \
 	crypto.9 crypto_freesession.9 \
 	crypto.9 crypto_get_driverid.9 \
 	crypto.9 crypto_getreq.9 \
 	crypto.9 crypto_kdispatch.9 \
 	crypto.9 crypto_kdone.9 \
 	crypto.9 crypto_kregister.9 \
 	crypto.9 crypto_newsession.9 \
 	crypto.9 crypto_register.9 \
 	crypto.9 crypto_unblock.9 \
 	crypto.9 crypto_unregister.9 \
 	crypto.9 crypto_unregister_all.9
 MLINKS+=DB_COMMAND.9 DB_SHOW_ALL_COMMAND.9 \
 	DB_COMMAND.9 DB_SHOW_COMMAND.9
 MLINKS+=dev_clone.9 drain_dev_clone_events.9
 MLINKS+=devfs_set_cdevpriv.9 devfs_clear_cdevpriv.9 \
 	devfs_set_cdevpriv.9 devfs_get_cdevpriv.9
 MLINKS+=device_add_child.9 device_add_child_ordered.9
 MLINKS+=device_enable.9 device_disable.9 \
 	device_enable.9 device_is_enabled.9
 MLINKS+=device_get_ivars.9 device_set_ivars.9
 MLINKS+=device_get_name.9 device_get_nameunit.9
 MLINKS+=device_get_state.9 device_busy.9 \
 	device_get_state.9 device_is_alive.9 \
 	device_get_state.9 device_is_attached.9 \
 	device_get_state.9 device_unbusy.9
 MLINKS+=device_get_sysctl.9 device_get_sysctl_ctx.9 \
 	device_get_sysctl.9 device_get_sysctl_tree.9
 MLINKS+=device_quiet.9 device_is_quiet.9 \
 	device_quiet.9 device_verbose.9
 MLINKS+=device_set_desc.9 device_get_desc.9 \
 	device_set_desc.9 device_set_desc_copy.9
 MLINKS+=device_set_flags.9 device_get_flags.9
 MLINKS+=devstat.9 devicestat.9 \
 	devstat.9 devstat_add_entry.9 \
 	devstat.9 devstat_end_transaction.9 \
 	devstat.9 devstat_remove_entry.9 \
 	devstat.9 devstat_start_transaction.9
 MLINKS+=disk.9 disk_alloc.9 \
 	disk.9 disk_create.9 \
 	disk.9 disk_destroy.9 \
 	disk.9 disk_gone.9 \
 	disk.9 disk_resize.9
 MLINKS+=domain.9 DOMAIN_SET.9 \
 	domain.9 domain_add.9 \
 	domain.9 pfctlinput.9 \
 	domain.9 pfctlinput2.9 \
 	domain.9 pffinddomain.9 \
 	domain.9 pffindproto.9 \
 	domain.9 pffindtype.9
 MLINKS+=drbr.9 drbr_free.9 \
 	drbr.9 drbr_enqueue.9 \
 	drbr.9 drbr_dequeue.9 \
 	drbr.9 drbr_dequeue_cond.9 \
 	drbr.9 drbr_flush.9 \
 	drbr.9 drbr_empty.9 \
 	drbr.9 drbr_inuse.9 \
 	drbr.9 drbr_stats_update.9
 MLINKS+=DRIVER_MODULE.9 DRIVER_MODULE_ORDERED.9 \
 	DRIVER_MODULE.9 EARLY_DRIVER_MODULE.9 \
 	DRIVER_MODULE.9 EARLY_DRIVER_MODULE_ORDERED.9
 MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \
 	EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \
 	EVENTHANDLER.9 eventhandler_deregister.9 \
 	EVENTHANDLER.9 eventhandler_find_list.9 \
 	EVENTHANDLER.9 EVENTHANDLER_INVOKE.9 \
 	EVENTHANDLER.9 eventhandler_prune_list.9 \
 	EVENTHANDLER.9 EVENTHANDLER_REGISTER.9 \
 	EVENTHANDLER.9 eventhandler_register.9
 MLINKS+=eventtimers.9 et_register.9 \
 	eventtimers.9 et_deregister.9 \
 	eventtimers.9 et_ban.9 \
 	eventtimers.9 et_find.9 \
 	eventtimers.9 et_free.9 \
 	eventtimers.9 et_init.9 \
 	eventtimers.9 ET_LOCK.9 \
 	eventtimers.9 ET_UNLOCK.9 \
 	eventtimers.9 et_start.9 \
 	eventtimers.9 et_stop.9
 MLINKS+=fail.9 KFAIL_POINT_CODE.9 \
 	fail.9 KFAIL_POINT_ERROR.9 \
 	fail.9 KFAIL_POINT_GOTO.9 \
 	fail.9 KFAIL_POINT_RETURN.9 \
 	fail.9 KFAIL_POINT_RETURN_VOID.9
 MLINKS+=fetch.9 fubyte.9 \
 	fetch.9 fuswintr.9 \
 	fetch.9 fuword.9 \
 	fetch.9 fuword16.9 \
 	fetch.9 fuword32.9 \
 	fetch.9 fuword64.9 \
 	fetch.9 fueword.9 \
 	fetch.9 fueword32.9 \
 	fetch.9 fueword64.9
 MLINKS+=firmware.9 firmware_get.9 \
 	firmware.9 firmware_put.9 \
 	firmware.9 firmware_register.9 \
 	firmware.9 firmware_unregister.9
 MLINKS+=fpu_kern.9 fpu_kern_alloc_ctx.9 \
 	fpu_kern.9 fpu_kern_free_ctx.9 \
 	fpu_kern.9 fpu_kern_enter.9 \
 	fpu_kern.9 fpu_kern_leave.9 \
 	fpu_kern.9 fpu_kern_thread.9 \
 	fpu_kern.9 is_fpu_kern_thread.9
 MLINKS+=g_attach.9 g_detach.9
 MLINKS+=g_bio.9 g_alloc_bio.9 \
 	g_bio.9 g_clone_bio.9 \
 	g_bio.9 g_destroy_bio.9 \
 	g_bio.9 g_duplicate_bio.9 \
 	g_bio.9 g_new_bio.9 \
 	g_bio.9 g_print_bio.9
 MLINKS+=g_consumer.9 g_destroy_consumer.9 \
 	g_consumer.9 g_new_consumer.9
 MLINKS+=g_data.9 g_read_data.9 \
 	g_data.9 g_write_data.9
 MLINKS+=getenv.9 freeenv.9 \
 	getenv.9 getenv_int.9 \
 	getenv.9 getenv_long.9 \
 	getenv.9 getenv_string.9 \
 	getenv.9 getenv_quad.9 \
 	getenv.9 getenv_uint.9 \
 	getenv.9 getenv_ulong.9 \
 	getenv.9 setenv.9 \
 	getenv.9 testenv.9 \
 	getenv.9 unsetenv.9
 MLINKS+=g_event.9 g_cancel_event.9 \
 	g_event.9 g_post_event.9 \
 	g_event.9 g_waitfor_event.9
 MLINKS+=g_geom.9 g_destroy_geom.9 \
 	g_geom.9 g_new_geomf.9
 MLINKS+=g_provider.9 g_destroy_provider.9 \
 	g_provider.9 g_error_provider.9 \
 	g_provider.9 g_new_providerf.9
 MLINKS+=hash.9 hash32.9 \
 	hash.9 hash32_buf.9 \
 	hash.9 hash32_str.9 \
 	hash.9 hash32_stre.9 \
 	hash.9 hash32_strn.9 \
 	hash.9 hash32_strne.9 \
 	hash.9 jenkins_hash.9 \
 	hash.9 jenkins_hash32.9
 MLINKS+=hashinit.9 hashdestroy.9 \
 	hashinit.9 hashinit_flags.9 \
 	hashinit.9 phashinit.9
 MLINKS+=hhook.9 hhook_head_register.9 \
 	hhook.9 hhook_head_deregister.9 \
 	hhook.9 hhook_head_deregister_lookup.9 \
 	hhook.9 hhook_run_hooks.9 \
 	hhook.9 HHOOKS_RUN_IF.9 \
 	hhook.9 HHOOKS_RUN_LOOKUP_IF.9
 MLINKS+=ieee80211.9 ieee80211_ifattach.9 \
 	ieee80211.9 ieee80211_ifdetach.9
 MLINKS+=ieee80211_amrr.9 ieee80211_amrr_choose.9 \
 	ieee80211_amrr.9 ieee80211_amrr_cleanup.9 \
 	ieee80211_amrr.9 ieee80211_amrr_init.9 \
 	ieee80211_amrr.9 ieee80211_amrr_node_init.9 \
 	ieee80211_amrr.9 ieee80211_amrr_setinterval.9 \
 	ieee80211_amrr.9 ieee80211_amrr_tx_complete.9 \
 	ieee80211_amrr.9 ieee80211_amrr_tx_update.9
 MLINKS+=ieee80211_beacon.9 ieee80211_beacon_alloc.9 \
 	ieee80211_beacon.9 ieee80211_beacon_notify.9 \
 	ieee80211_beacon.9 ieee80211_beacon_update.9
 MLINKS+=ieee80211_bmiss.9 ieee80211_beacon_miss.9
 MLINKS+=ieee80211_crypto.9 ieee80211_crypto_available.9 \
 	ieee80211_crypto.9 ieee80211_crypto_decap.9 \
 	ieee80211_crypto.9 ieee80211_crypto_delglobalkeys.9 \
 	ieee80211_crypto.9 ieee80211_crypto_delkey.9 \
 	ieee80211_crypto.9 ieee80211_crypto_demic.9 \
 	ieee80211_crypto.9 ieee80211_crypto_encap.9 \
 	ieee80211_crypto.9 ieee80211_crypto_enmic.9 \
 	ieee80211_crypto.9 ieee80211_crypto_newkey.9 \
 	ieee80211_crypto.9 ieee80211_crypto_register.9 \
 	ieee80211_crypto.9 ieee80211_crypto_reload_keys.9 \
 	ieee80211_crypto.9 ieee80211_crypto_setkey.9 \
 	ieee80211_crypto.9 ieee80211_crypto_unregister.9 \
 	ieee80211_crypto.9 ieee80211_key_update_begin.9 \
 	ieee80211_crypto.9 ieee80211_key_update_end.9 \
 	ieee80211_crypto.9 ieee80211_notify_michael_failure.9 \
 	ieee80211_crypto.9 ieee80211_notify_replay_failure.9
 MLINKS+=ieee80211_input.9 ieee80211_input_all.9
 MLINKS+=ieee80211_node.9 ieee80211_dump_node.9 \
 	ieee80211_node.9 ieee80211_dump_nodes.9 \
 	ieee80211_node.9 ieee80211_find_rxnode.9 \
 	ieee80211_node.9 ieee80211_find_rxnode_withkey.9 \
 	ieee80211_node.9 ieee80211_free_node.9 \
 	ieee80211_node.9 ieee80211_iterate_nodes.9 \
 	ieee80211_node.9 ieee80211_ref_node.9 \
 	ieee80211_node.9 ieee80211_unref_node.9
 MLINKS+=ieee80211_output.9 ieee80211_process_callback.9 \
 	ieee80211_output.9 M_SEQNO_GET.9 \
 	ieee80211_output.9 M_WME_GETAC.9
 MLINKS+=ieee80211_proto.9 ieee80211_new_state.9 \
 	ieee80211_proto.9 ieee80211_resume_all.9 \
 	ieee80211_proto.9 ieee80211_start_all.9 \
 	ieee80211_proto.9 ieee80211_stop_all.9 \
 	ieee80211_proto.9 ieee80211_suspend_all.9 \
 	ieee80211_proto.9 ieee80211_waitfor_parent.9
 MLINKS+=ieee80211_radiotap.9 ieee80211_radiotap_active.9 \
 	ieee80211_radiotap.9 ieee80211_radiotap_active_vap.9 \
 	ieee80211_radiotap.9 ieee80211_radiotap_attach.9 \
 	ieee80211_radiotap.9 ieee80211_radiotap_tx.9 \
 	ieee80211_radiotap.9 radiotap.9
 MLINKS+=ieee80211_regdomain.9 ieee80211_alloc_countryie.9 \
 	ieee80211_regdomain.9 ieee80211_init_channels.9 \
 	ieee80211_regdomain.9 ieee80211_sort_channels.9
 MLINKS+=ieee80211_scan.9 ieee80211_add_scan.9 \
 	ieee80211_scan.9 ieee80211_bg_scan.9 \
 	ieee80211_scan.9 ieee80211_cancel_scan.9 \
 	ieee80211_scan.9 ieee80211_cancel_scan_any.9 \
 	ieee80211_scan.9 ieee80211_check_scan.9 \
 	ieee80211_scan.9 ieee80211_check_scan_current.9 \
 	ieee80211_scan.9 ieee80211_flush.9 \
 	ieee80211_scan.9 ieee80211_probe_curchan.9 \
 	ieee80211_scan.9 ieee80211_scan_assoc_fail.9 \
 	ieee80211_scan.9 ieee80211_scan_done.9 \
 	ieee80211_scan.9 ieee80211_scan_dump_channels.9 \
 	ieee80211_scan.9 ieee80211_scan_flush.9 \
 	ieee80211_scan.9 ieee80211_scan_iterate.9 \
 	ieee80211_scan.9 ieee80211_scan_next.9 \
 	ieee80211_scan.9 ieee80211_scan_timeout.9 \
 	ieee80211_scan.9 ieee80211_scanner_get.9 \
 	ieee80211_scan.9 ieee80211_scanner_register.9 \
 	ieee80211_scan.9 ieee80211_scanner_unregister.9 \
 	ieee80211_scan.9 ieee80211_scanner_unregister_all.9 \
 	ieee80211_scan.9 ieee80211_start_scan.9
 MLINKS+=ieee80211_vap.9 ieee80211_vap_attach.9 \
 	ieee80211_vap.9 ieee80211_vap_detach.9 \
 	ieee80211_vap.9 ieee80211_vap_setup.9
 MLINKS+=ifnet.9 if_addmulti.9 \
 	ifnet.9 if_alloc.9 \
 	ifnet.9 if_allmulti.9 \
 	ifnet.9 if_attach.9 \
 	ifnet.9 if_data.9 \
 	ifnet.9 IF_DEQUEUE.9 \
 	ifnet.9 if_delmulti.9 \
 	ifnet.9 if_detach.9 \
 	ifnet.9 if_down.9 \
 	ifnet.9 if_findmulti.9 \
 	ifnet.9 if_free.9 \
 	ifnet.9 if_free_type.9 \
 	ifnet.9 if_up.9 \
 	ifnet.9 ifa_free.9 \
 	ifnet.9 ifa_ifwithaddr.9 \
 	ifnet.9 ifa_ifwithdstaddr.9 \
 	ifnet.9 ifa_ifwithnet.9 \
 	ifnet.9 ifa_ref.9 \
 	ifnet.9 ifaddr.9 \
 	ifnet.9 ifaddr_byindex.9 \
 	ifnet.9 ifaof_ifpforaddr.9 \
 	ifnet.9 ifioctl.9 \
 	ifnet.9 ifpromisc.9 \
 	ifnet.9 ifqueue.9 \
 	ifnet.9 ifunit.9 \
 	ifnet.9 ifunit_ref.9
 MLINKS+=insmntque.9 insmntque1.9
 MLINKS+=ithread.9 ithread_add_handler.9 \
 	ithread.9 ithread_create.9 \
 	ithread.9 ithread_destroy.9 \
 	ithread.9 ithread_priority.9 \
 	ithread.9 ithread_remove_handler.9 \
 	ithread.9 ithread_schedule.9
 MLINKS+=kernacc.9 useracc.9
 MLINKS+=kernel_mount.9 free_mntarg.9 \
 	kernel_mount.9 kernel_vmount.9 \
 	kernel_mount.9 mount_arg.9 \
 	kernel_mount.9 mount_argb.9 \
 	kernel_mount.9 mount_argf.9 \
 	kernel_mount.9 mount_argsu.9
 MLINKS+=khelp.9 khelp_add_hhook.9 \
 	khelp.9 KHELP_DECLARE_MOD.9 \
 	khelp.9 KHELP_DECLARE_MOD_UMA.9 \
 	khelp.9 khelp_destroy_osd.9 \
 	khelp.9 khelp_get_id.9 \
 	khelp.9 khelp_get_osd.9 \
 	khelp.9 khelp_init_osd.9 \
 	khelp.9 khelp_remove_hhook.9
 MLINKS+=kobj.9 DEFINE_CLASS.9 \
 	kobj.9 kobj_class_compile.9 \
 	kobj.9 kobj_class_compile_static.9 \
 	kobj.9 kobj_class_free.9 \
 	kobj.9 kobj_create.9 \
 	kobj.9 kobj_delete.9 \
 	kobj.9 kobj_init.9 \
 	kobj.9 kobj_init_static.9
 MLINKS+=kproc.9 kproc_create.9 \
 	kproc.9 kproc_exit.9 \
 	kproc.9 kproc_kthread_add.9 \
 	kproc.9 kproc_resume.9 \
 	kproc.9 kproc_shutdown.9 \
 	kproc.9 kproc_start.9 \
 	kproc.9 kproc_suspend.9 \
 	kproc.9 kproc_suspend_check.9 \
 	kproc.9 kthread_create.9
 MLINKS+=kqueue.9 knlist_add.9 \
 	kqueue.9 knlist_clear.9 \
 	kqueue.9 knlist_delete.9 \
 	kqueue.9 knlist_destroy.9 \
 	kqueue.9 knlist_empty.9 \
 	kqueue.9 knlist_init.9 \
 	kqueue.9 knlist_init_mtx.9 \
 	kqueue.9 knlist_init_rw_reader.9 \
 	kqueue.9 knlist_remove.9 \
 	kqueue.9 knlist_remove_inevent.9 \
 	kqueue.9 knote_fdclose.9 \
 	kqueue.9 KNOTE_LOCKED.9 \
 	kqueue.9 KNOTE_UNLOCKED.9 \
 	kqueue.9 kqfd_register.9 \
 	kqueue.9 kqueue_add_filteropts.9 \
 	kqueue.9 kqueue_del_filteropts.9
 MLINKS+=kthread.9 kthread_add.9 \
 	kthread.9 kthread_exit.9 \
 	kthread.9 kthread_resume.9 \
 	kthread.9 kthread_shutdown.9 \
 	kthread.9 kthread_start.9 \
 	kthread.9 kthread_suspend.9 \
 	kthread.9 kthread_suspend_check.9
 MLINKS+=ktr.9 CTR0.9 \
 	ktr.9 CTR1.9 \
 	ktr.9 CTR2.9 \
 	ktr.9 CTR3.9 \
 	ktr.9 CTR4.9 \
 	ktr.9 CTR5.9 \
 	ktr.9 CTR6.9
 MLINKS+=lock.9 lockdestroy.9 \
 	lock.9 lockinit.9 \
 	lock.9 lockmgr.9 \
 	lock.9 lockmgr_args.9 \
 	lock.9 lockmgr_args_rw.9 \
 	lock.9 lockmgr_assert.9 \
 	lock.9 lockmgr_disown.9 \
 	lock.9 lockmgr_printinfo.9 \
 	lock.9 lockmgr_recursed.9 \
 	lock.9 lockmgr_rw.9 \
 	lock.9 lockmgr_waiters.9 \
 	lock.9 lockstatus.9
 MLINKS+=LOCK_PROFILING.9 MUTEX_PROFILING.9
 MLINKS+=make_dev.9 destroy_dev.9 \
 	make_dev.9 destroy_dev_drain.9 \
 	make_dev.9 destroy_dev_sched.9 \
 	make_dev.9 destroy_dev_sched_cb.9 \
 	make_dev.9 dev_depends.9 \
 	make_dev.9 make_dev_alias.9 \
 	make_dev.9 make_dev_alias_p.9 \
 	make_dev.9 make_dev_cred.9 \
 	make_dev.9 make_dev_credf.9 \
 	make_dev.9 make_dev_p.9
 MLINKS+=malloc.9 free.9 \
 	malloc.9 MALLOC_DECLARE.9 \
 	malloc.9 MALLOC_DEFINE.9 \
 	malloc.9 realloc.9 \
 	malloc.9 reallocf.9
 MLINKS+=mbchain.9 mb_detach.9 \
 	mbchain.9 mb_done.9 \
 	mbchain.9 mb_fixhdr.9 \
 	mbchain.9 mb_init.9 \
 	mbchain.9 mb_initm.9 \
 	mbchain.9 mb_put_int64be.9 \
 	mbchain.9 mb_put_int64le.9 \
 	mbchain.9 mb_put_mbuf.9 \
 	mbchain.9 mb_put_mem.9 \
 	mbchain.9 mb_put_uint16be.9 \
 	mbchain.9 mb_put_uint16le.9 \
 	mbchain.9 mb_put_uint32be.9 \
 	mbchain.9 mb_put_uint32le.9 \
 	mbchain.9 mb_put_uint8.9 \
 	mbchain.9 mb_put_uio.9 \
 	mbchain.9 mb_reserve.9
 MLINKS+=mbpool.9 mbp_alloc.9 \
 	mbpool.9 mbp_card_free.9 \
 	mbpool.9 mbp_count.9 \
 	mbpool.9 mbp_create.9 \
 	mbpool.9 mbp_destroy.9 \
 	mbpool.9 mbp_ext_free.9 \
 	mbpool.9 mbp_free.9 \
 	mbpool.9 mbp_get.9 \
 	mbpool.9 mbp_get_keep.9 \
 	mbpool.9 mbp_sync.9
 MLINKS+=\
 	mbuf.9 m_adj.9 \
 	mbuf.9 m_align.9 \
 	mbuf.9 M_ALIGN.9 \
 	mbuf.9 m_append.9 \
 	mbuf.9 m_apply.9 \
 	mbuf.9 m_cat.9 \
 	mbuf.9 MCHTYPE.9 \
 	mbuf.9 MCLGET.9 \
 	mbuf.9 m_copyback.9 \
 	mbuf.9 m_copydata.9 \
 	mbuf.9 m_copym.9 \
 	mbuf.9 m_copypacket.9 \
 	mbuf.9 m_copyup.9 \
 	mbuf.9 m_defrag.9 \
 	mbuf.9 m_devget.9 \
 	mbuf.9 m_dup.9 \
 	mbuf.9 m_dup_pkthdr.9 \
 	mbuf.9 MEXTADD.9 \
 	mbuf.9 MEXT_ADD_REF.9 \
 	mbuf.9 MEXTFREE.9 \
 	mbuf.9 MEXT_IS_REF.9 \
 	mbuf.9 MEXT_REM_REF.9 \
 	mbuf.9 m_fixhdr.9 \
 	mbuf.9 MFREE.9 \
 	mbuf.9 m_free.9 \
 	mbuf.9 m_freem.9 \
 	mbuf.9 MGET.9 \
 	mbuf.9 m_get.9 \
 	mbuf.9 m_get2.9 \
 	mbuf.9 m_getjcl.9 \
 	mbuf.9 m_getcl.9 \
 	mbuf.9 m_getclr.9 \
 	mbuf.9 MGETHDR.9 \
 	mbuf.9 m_gethdr.9 \
 	mbuf.9 m_getm.9 \
 	mbuf.9 m_getptr.9 \
 	mbuf.9 MH_ALIGN.9 \
 	mbuf.9 M_LEADINGSPACE.9 \
 	mbuf.9 m_length.9 \
 	mbuf.9 M_MOVE_PKTHDR.9 \
 	mbuf.9 m_move_pkthdr.9 \
 	mbuf.9 M_PREPEND.9 \
 	mbuf.9 m_prepend.9 \
 	mbuf.9 m_pulldown.9 \
 	mbuf.9 m_pullup.9 \
 	mbuf.9 m_split.9 \
 	mbuf.9 mtod.9 \
 	mbuf.9 M_TRAILINGSPACE.9 \
 	mbuf.9 m_unshare.9 \
 	mbuf.9 M_WRITABLE.9
 MLINKS+=\
 	mbuf_tags.9 m_tag_alloc.9 \
 	mbuf_tags.9 m_tag_copy.9 \
 	mbuf_tags.9 m_tag_copy_chain.9 \
 	mbuf_tags.9 m_tag_delete.9 \
 	mbuf_tags.9 m_tag_delete_chain.9 \
 	mbuf_tags.9 m_tag_delete_nonpersistent.9 \
 	mbuf_tags.9 m_tag_find.9 \
 	mbuf_tags.9 m_tag_first.9 \
 	mbuf_tags.9 m_tag_free.9 \
 	mbuf_tags.9 m_tag_get.9 \
 	mbuf_tags.9 m_tag_init.9 \
 	mbuf_tags.9 m_tag_locate.9 \
 	mbuf_tags.9 m_tag_next.9 \
 	mbuf_tags.9 m_tag_prepend.9 \
 	mbuf_tags.9 m_tag_unlink.9
 MLINKS+=MD5.9 MD5Init.9 \
 	MD5.9 MD5Transform.9
 MLINKS+=mdchain.9 md_append_record.9 \
 	mdchain.9 md_done.9 \
 	mdchain.9 md_get_int64.9 \
 	mdchain.9 md_get_int64be.9 \
 	mdchain.9 md_get_int64le.9 \
 	mdchain.9 md_get_mbuf.9 \
 	mdchain.9 md_get_mem.9 \
 	mdchain.9 md_get_uint16.9 \
 	mdchain.9 md_get_uint16be.9 \
 	mdchain.9 md_get_uint16le.9 \
 	mdchain.9 md_get_uint32.9 \
 	mdchain.9 md_get_uint32be.9 \
 	mdchain.9 md_get_uint32le.9 \
 	mdchain.9 md_get_uint8.9 \
 	mdchain.9 md_get_uio.9 \
 	mdchain.9 md_initm.9 \
 	mdchain.9 md_next_record.9
 MLINKS+=microtime.9 bintime.9 \
 	microtime.9 getbintime.9 \
 	microtime.9 getmicrotime.9 \
 	microtime.9 getnanotime.9 \
 	microtime.9 nanotime.9
 MLINKS+=microuptime.9 binuptime.9 \
 	microuptime.9 getbinuptime.9 \
 	microuptime.9 getmicrouptime.9 \
 	microuptime.9 getnanouptime.9 \
 	microuptime.9 getsbinuptime.9 \
 	microuptime.9 nanouptime.9 \
 	microuptime.9 sbinuptime.9
 MLINKS+=mi_switch.9 cpu_switch.9 \
 	mi_switch.9 cpu_throw.9
+MLINKS+=mod_cc.9 CCV.9 \
+	mod_cc.9 DECLARE_CC_MODULE.9
 MLINKS+=mtx_pool.9 mtx_pool_alloc.9 \
 	mtx_pool.9 mtx_pool_create.9 \
 	mtx_pool.9 mtx_pool_destroy.9 \
 	mtx_pool.9 mtx_pool_find.9 \
 	mtx_pool.9 mtx_pool_lock.9 \
 	mtx_pool.9 mtx_pool_lock_spin.9 \
 	mtx_pool.9 mtx_pool_unlock.9 \
 	mtx_pool.9 mtx_pool_unlock_spin.9
 MLINKS+=mutex.9 mtx_assert.9 \
 	mutex.9 mtx_destroy.9 \
 	mutex.9 mtx_init.9 \
 	mutex.9 mtx_initialized.9 \
 	mutex.9 mtx_lock.9 \
 	mutex.9 mtx_lock_flags.9 \
 	mutex.9 mtx_lock_spin.9 \
 	mutex.9 mtx_lock_spin_flags.9 \
 	mutex.9 mtx_owned.9 \
 	mutex.9 mtx_recursed.9 \
 	mutex.9 mtx_sleep.9 \
 	mutex.9 MTX_SYSINIT.9 \
 	mutex.9 mtx_trylock.9 \
 	mutex.9 mtx_trylock_flags.9 \
 	mutex.9 mtx_unlock.9 \
 	mutex.9 mtx_unlock_flags.9 \
 	mutex.9 mtx_unlock_spin.9 \
 	mutex.9 mtx_unlock_spin_flags.9
 MLINKS+=namei.9 NDFREE.9 \
 	namei.9 NDHASGIANT.9 \
 	namei.9 NDINIT.9
 MLINKS+=netisr.9 netisr_clearqdrops.9 \
 	netisr.9 netisr_default_flow2cpu.9 \
 	netisr.9 netisr_dispatch.9 \
 	netisr.9 netisr_dispatch_src.9 \
 	netisr.9 netisr_get_cpucount.9 \
 	netisr.9 netisr_get_cpuid.9 \
 	netisr.9 netisr_getqdrops.9 \
 	netisr.9 netisr_getqlimit.9 \
 	netisr.9 netisr_queue.9 \
 	netisr.9 netisr_queue_src.9 \
 	netisr.9 netisr_register.9 \
 	netisr.9 netisr_setqlimit.9 \
 	netisr.9 netisr_unregister.9
 MLINKS+=osd.9 osd_call.9 \
 	osd.9 osd_del.9 \
 	osd.9 osd_deregister.9 \
 	osd.9 osd_exit.9 \
 	osd.9 osd_get.9 \
 	osd.9 osd_register.9 \
 	osd.9 osd_set.9
 MLINKS+=pbuf.9 getpbuf.9 \
 	pbuf.9 relpbuf.9 \
 	pbuf.9 trypbuf.9
 MLINKS+=PCBGROUP.9 in_pcbgroup_byhash.9 \
 	PCBGROUP.9 in_pcbgroup_byinpcb.9 \
 	PCBGROUP.9 in_pcbgroup_destroy.9 \
 	PCBGROUP.9 in_pcbgroup_enabled.9 \
 	PCBGROUP.9 in_pcbgroup_init.9 \
 	PCBGROUP.9 in_pcbgroup_remove.9 \
 	PCBGROUP.9 in_pcbgroup_update.9 \
 	PCBGROUP.9 in_pcbgroup_update_mbuf.9 \
 	PCBGROUP.9 in6_pcbgroup_byhash.9
 MLINKS+=pci.9 pci_alloc_msi.9 \
 	pci.9 pci_alloc_msix.9 \
 	pci.9 pci_disable_busmaster.9 \
 	pci.9 pci_disable_io.9 \
 	pci.9 pci_enable_busmaster.9 \
 	pci.9 pci_enable_io.9 \
 	pci.9 pci_find_bsf.9 \
 	pci.9 pci_find_cap.9 \
 	pci.9 pci_find_dbsf.9 \
 	pci.9 pci_find_device.9 \
 	pci.9 pci_find_extcap.9 \
 	pci.9 pci_find_htcap.9 \
 	pci.9 pci_get_max_read_req.9 \
 	pci.9 pci_get_powerstate.9 \
 	pci.9 pci_get_vpd_ident.9 \
 	pci.9 pci_get_vpd_readonly.9 \
 	pci.9 pci_msi_count.9 \
 	pci.9 pci_msix_count.9 \
 	pci.9 pci_pending_msix.9 \
 	pci.9 pci_read_config.9 \
 	pci.9 pci_release_msi.9 \
 	pci.9 pci_remap_msix.9 \
 	pci.9 pci_restore_state.9 \
 	pci.9 pci_save_state.9 \
 	pci.9 pci_set_powerstate.9 \
 	pci.9 pci_set_max_read_req.9 \
 	pci.9 pci_write_config.9
 MLINKS+=pfil.9 pfil_add_hook.9 \
 	pfil.9 pfil_head_register.9 \
 	pfil.9 pfil_head_unregister.9 \
 	pfil.9 pfil_hook_get.9 \
 	pfil.9 pfil_remove_hook.9 \
 	pfil.9 pfil_rlock.9 \
 	pfil.9 pfil_run_hooks.9 \
 	pfil.9 pfil_runlock.9 \
 	pfil.9 pfil_wlock.9 \
 	pfil.9 pfil_wunlock.9
 MLINKS+=pfind.9 zpfind.9
 MLINKS+=pmap_copy.9 pmap_copy_page.9
 MLINKS+=pmap_extract.9 pmap_extract_and_hold.9
 MLINKS+=pmap_init.9 pmap_init2.9
 MLINKS+=pmap_is_modified.9 pmap_ts_referenced.9
 MLINKS+=pmap_pinit.9 pmap_pinit0.9 \
 	pmap_pinit.9 pmap_pinit2.9
 MLINKS+=pmap_qenter.9 pmap_qremove.9
 MLINKS+=pmap_remove.9 pmap_remove_all.9 \
 	pmap_remove.9 pmap_remove_pages.9
 MLINKS+=pmap_resident_count.9 pmap_wired_count.9
 MLINKS+=pmap_zero_page.9 pmap_zero_area.9 \
 	pmap_zero_page.9 pmap_zero_idle.9
 MLINKS+=printf.9 log.9 \
 	printf.9 tprintf.9 \
 	printf.9 uprintf.9
 MLINKS+=priv.9 priv_check.9 \
 	priv.9 priv_check_cred.9
 MLINKS+=psignal.9 gsignal.9 \
 	psignal.9 pgsignal.9 \
 	psignal.9 tdsignal.9
 MLINKS+=random.9 arc4rand.9 \
 	random.9 arc4random.9 \
 	random.9 read_random.9 \
 	random.9 srandom.9
 MLINKS+=refcount.9 refcount_acquire.9 \
 	refcount.9 refcount_init.9 \
 	refcount.9 refcount_release.9
 MLINKS+=resource_int_value.9 resource_long_value.9 \
 	resource_int_value.9 resource_string_value.9
 MLINKS+=rman.9 rman_activate_resource.9 \
 	rman.9 rman_adjust_resource.9 \
 	rman.9 rman_await_resource.9 \
 	rman.9 rman_deactivate_resource.9 \
 	rman.9 rman_fini.9 \
 	rman.9 rman_first_free_region.9 \
 	rman.9 rman_get_bushandle.9 \
 	rman.9 rman_get_bustag.9 \
 	rman.9 rman_get_device.9 \
 	rman.9 rman_get_end.9 \
 	rman.9 rman_get_flags.9 \
 	rman.9 rman_get_rid.9 \
 	rman.9 rman_get_size.9 \
 	rman.9 rman_get_start.9 \
 	rman.9 rman_get_virtual.9 \
 	rman.9 rman_init.9 \
 	rman.9 rman_init_from_resource.9 \
 	rman.9 rman_is_region_manager.9 \
 	rman.9 rman_last_free_region.9 \
 	rman.9 rman_make_alignment_flags.9 \
 	rman.9 rman_manage_region.9 \
 	rman.9 rman_release_resource.9 \
 	rman.9 rman_reserve_resource.9 \
 	rman.9 rman_reserve_resource_bound.9 \
 	rman.9 rman_set_bushandle.9 \
 	rman.9 rman_set_bustag.9 \
 	rman.9 rman_set_rid.9 \
 	rman.9 rman_set_virtual.9
 MLINKS+=rmlock.9 rm_assert.9 \
 	rmlock.9 rm_destroy.9 \
 	rmlock.9 rm_init.9 \
 	rmlock.9 rm_init_flags.9 \
 	rmlock.9 rm_rlock.9 \
 	rmlock.9 rm_runlock.9 \
 	rmlock.9 rm_sleep.9 \
 	rmlock.9 RM_SYSINIT.9 \
 	rmlock.9 rm_try_rlock.9 \
 	rmlock.9 rm_wlock.9 \
 	rmlock.9 rm_wowned.9 \
 	rmlock.9 rm_wunlock.9
 MLINKS+=rtalloc.9 rtalloc1.9 \
 	rtalloc.9 rtalloc_ign.9 \
 	rtalloc.9 RT_ADDREF.9 \
 	rtalloc.9 RT_LOCK.9 \
 	rtalloc.9 RT_REMREF.9 \
 	rtalloc.9 RT_RTFREE.9 \
 	rtalloc.9 RT_UNLOCK.9 \
 	rtalloc.9 RTFREE_LOCKED.9 \
 	rtalloc.9 RTFREE.9 \
 	rtalloc.9 rtfree.9 \
 	rtalloc.9 rtalloc1_fib.9 \
 	rtalloc.9 rtalloc_ign_fib.9 \
 	rtalloc.9 rtalloc_fib.9
 MLINKS+=runqueue.9 choosethread.9 \
 	runqueue.9 procrunnable.9 \
 	runqueue.9 remrunqueue.9 \
 	runqueue.9 setrunqueue.9
 MLINKS+=rwlock.9 rw_assert.9 \
 	rwlock.9 rw_destroy.9 \
 	rwlock.9 rw_downgrade.9 \
 	rwlock.9 rw_init.9 \
 	rwlock.9 rw_init_flags.9 \
 	rwlock.9 rw_initialized.9 \
 	rwlock.9 rw_rlock.9 \
 	rwlock.9 rw_runlock.9 \
 	rwlock.9 rw_sleep.9 \
 	rwlock.9 RW_SYSINIT.9 \
 	rwlock.9 rw_try_rlock.9 \
 	rwlock.9 rw_try_upgrade.9 \
 	rwlock.9 rw_try_wlock.9 \
 	rwlock.9 rw_wlock.9 \
 	rwlock.9 rw_wowned.9 \
 	rwlock.9 rw_wunlock.9
 MLINKS+=sbuf.9 sbuf_bcat.9 \
 	sbuf.9 sbuf_bcopyin.9 \
 	sbuf.9 sbuf_bcpy.9 \
 	sbuf.9 sbuf_cat.9 \
 	sbuf.9 sbuf_clear.9 \
 	sbuf.9 sbuf_copyin.9 \
 	sbuf.9 sbuf_cpy.9 \
 	sbuf.9 sbuf_data.9 \
 	sbuf.9 sbuf_delete.9 \
 	sbuf.9 sbuf_done.9 \
 	sbuf.9 sbuf_error.9 \
 	sbuf.9 sbuf_finish.9 \
 	sbuf.9 sbuf_len.9 \
 	sbuf.9 sbuf_new.9 \
 	sbuf.9 sbuf_new_auto.9 \
 	sbuf.9 sbuf_new_for_sysctl.9 \
 	sbuf.9 sbuf_printf.9 \
 	sbuf.9 sbuf_putc.9 \
 	sbuf.9 sbuf_set_drain.9 \
 	sbuf.9 sbuf_setpos.9 \
 	sbuf.9 sbuf_start_section.9 \
 	sbuf.9 sbuf_end_section.9  \
 	sbuf.9 sbuf_trim.9 \
 	sbuf.9 sbuf_vprintf.9
 MLINKS+=scheduler.9 curpriority_cmp.9 \
 	scheduler.9 maybe_resched.9 \
 	scheduler.9 propagate_priority.9 \
 	scheduler.9 resetpriority.9 \
 	scheduler.9 roundrobin.9 \
 	scheduler.9 roundrobin_interval.9 \
 	scheduler.9 schedclock.9 \
 	scheduler.9 schedcpu.9 \
 	scheduler.9 sched_setup.9 \
 	scheduler.9 setrunnable.9 \
 	scheduler.9 updatepri.9
 MLINKS+=SDT.9 SDT_PROVIDER_DECLARE.9 \
 	SDT.9 SDT_PROVIDER_DEFINE.9 \
 	SDT.9 SDT_PROBE_DECLARE.9 \
 	SDT.9 SDT_PROBE_DEFINE.9 \
 	SDT.9 SDT_PROBE.9
 MLINKS+=securelevel_gt.9 securelevel_ge.9
 MLINKS+=selrecord.9 seldrain.9 \
 	selrecord.9 selwakeup.9
 MLINKS+=sema.9 sema_destroy.9 \
 	sema.9 sema_init.9 \
 	sema.9 sema_post.9 \
 	sema.9 sema_timedwait.9 \
 	sema.9 sema_trywait.9 \
 	sema.9 sema_value.9 \
 	sema.9 sema_wait.9
 MLINKS+=sf_buf.9 sf_buf_alloc.9 \
 	sf_buf.9 sf_buf_free.9 \
 	sf_buf.9 sf_buf_kva.9 \
 	sf_buf.9 sf_buf_page.9
 MLINKS+=sglist.9 sglist_alloc.9 \
 	sglist.9 sglist_append.9 \
 	sglist.9 sglist_append_bio.9 \
 	sglist.9 sglist_append_mbuf.9 \
 	sglist.9 sglist_append_phys.9 \
 	sglist.9 sglist_append_uio.9 \
 	sglist.9 sglist_append_user.9 \
 	sglist.9 sglist_build.9 \
 	sglist.9 sglist_clone.9 \
 	sglist.9 sglist_consume_uio.9 \
 	sglist.9 sglist_count.9 \
 	sglist.9 sglist_free.9 \
 	sglist.9 sglist_hold.9 \
 	sglist.9 sglist_init.9 \
 	sglist.9 sglist_join.9 \
 	sglist.9 sglist_length.9 \
 	sglist.9 sglist_reset.9 \
 	sglist.9 sglist_slice.9 \
 	sglist.9 sglist_split.9
 MLINKS+=shm_map.9 shm_unmap.9
 MLINKS+=signal.9 cursig.9 \
 	signal.9 execsigs.9 \
 	signal.9 issignal.9 \
 	signal.9 killproc.9 \
 	signal.9 pgsigio.9 \
 	signal.9 postsig.9 \
 	signal.9 SETSETNEQ.9 \
 	signal.9 SETSETOR.9 \
 	signal.9 SIGADDSET.9 \
 	signal.9 SIG_CONTSIGMASK.9 \
 	signal.9 SIGDELSET.9 \
 	signal.9 SIGEMPTYSET.9 \
 	signal.9 sigexit.9 \
 	signal.9 SIGFILLSET.9 \
 	signal.9 siginit.9 \
 	signal.9 SIGISEMPTY.9 \
 	signal.9 SIGISMEMBER.9 \
 	signal.9 SIGNOTEMPTY.9 \
 	signal.9 signotify.9 \
 	signal.9 SIGPENDING.9 \
 	signal.9 SIGSETAND.9 \
 	signal.9 SIGSETCANTMASK.9 \
 	signal.9 SIGSETEQ.9 \
 	signal.9 SIGSETNAND.9 \
 	signal.9 SIG_STOPSIGMASK.9 \
 	signal.9 trapsignal.9
 MLINKS+=sleep.9 msleep.9 \
 	sleep.9 msleep_sbt.9 \
 	sleep.9 msleep_spin.9 \
 	sleep.9 msleep_spin_sbt.9 \
 	sleep.9 pause.9 \
 	sleep.9 pause_sbt.9 \
 	sleep.9 tsleep.9 \
 	sleep.9 tsleep_sbt.9 \
 	sleep.9 wakeup.9 \
 	sleep.9 wakeup_one.9
 MLINKS+=sleepqueue.9 init_sleepqueues.9 \
 	sleepqueue.9 sleepq_abort.9 \
 	sleepqueue.9 sleepq_add.9 \
 	sleepqueue.9 sleepq_alloc.9 \
 	sleepqueue.9 sleepq_broadcast.9 \
 	sleepqueue.9 sleepq_free.9 \
 	sleepqueue.9 sleepq_lookup.9 \
 	sleepqueue.9 sleepq_lock.9 \
 	sleepqueue.9 sleepq_release.9 \
 	sleepqueue.9 sleepq_remove.9 \
 	sleepqueue.9 sleepq_set_timeout.9 \
 	sleepqueue.9 sleepq_set_timeout_sbt.9 \
 	sleepqueue.9 sleepq_signal.9 \
 	sleepqueue.9 sleepq_sleepcnt.9 \
 	sleepqueue.9 sleepq_timedwait.9 \
 	sleepqueue.9 sleepq_timedwait_sig.9 \
 	sleepqueue.9 sleepq_type.9 \
 	sleepqueue.9 sleepq_wait.9 \
 	sleepqueue.9 sleepq_wait_sig.9
 MLINKS+=socket.9 soabort.9 \
 	socket.9 soaccept.9 \
 	socket.9 sobind.9 \
 	socket.9 socheckuid.9 \
 	socket.9 soclose.9 \
 	socket.9 soconnect.9 \
 	socket.9 socreate.9 \
 	socket.9 sodisconnect.9 \
 	socket.9 sodupsockaddr.9 \
 	socket.9 sofree.9 \
 	socket.9 sogetopt.9 \
 	socket.9 sohasoutofband.9 \
 	socket.9 solisten.9 \
 	socket.9 solisten_proto.9 \
 	socket.9 solisten_proto_check.9 \
 	socket.9 sonewconn.9 \
 	socket.9 sooptcopyin.9 \
 	socket.9 sooptcopyout.9 \
 	socket.9 sopoll.9 \
 	socket.9 sopoll_generic.9 \
 	socket.9 soreceive.9 \
 	socket.9 soreceive_dgram.9 \
 	socket.9 soreceive_generic.9 \
 	socket.9 soreceive_stream.9 \
 	socket.9 soreserve.9 \
 	socket.9 sorflush.9 \
 	socket.9 sosend.9 \
 	socket.9 sosend_dgram.9 \
 	socket.9 sosend_generic.9 \
 	socket.9 sosetopt.9 \
 	socket.9 soshutdown.9 \
 	socket.9 sotoxsocket.9 \
 	socket.9 soupcall_clear.9 \
 	socket.9 soupcall_set.9 \
 	socket.9 sowakeup.9
 MLINKS+=spl.9 spl0.9 \
 	spl.9 splbio.9 \
 	spl.9 splclock.9 \
 	spl.9 splhigh.9 \
 	spl.9 splimp.9 \
 	spl.9 splnet.9 \
 	spl.9 splsoftclock.9 \
 	spl.9 splsofttty.9 \
 	spl.9 splstatclock.9 \
 	spl.9 spltty.9 \
 	spl.9 splvm.9 \
 	spl.9 splx.9
 MLINKS+=stack.9 stack_copy.9 \
 	stack.9 stack_create.9 \
 	stack.9 stack_destroy.9 \
 	stack.9 stack_print.9 \
 	stack.9 stack_print_ddb.9 \
 	stack.9 stack_print_short.9 \
 	stack.9 stack_print_short_ddb.9 \
 	stack.9 stack_put.9 \
 	stack.9 stack_save.9 \
 	stack.9 stack_sbuf_print.9 \
 	stack.9 stack_sbuf_print_ddb.9 \
 	stack.9 stack_zero.9
 MLINKS+=store.9 subyte.9 \
 	store.9 suswintr.9 \
 	store.9 suword.9 \
 	store.9 suword16.9 \
 	store.9 suword32.9 \
 	store.9 suword64.9
 MLINKS+=swi.9 swi_add.9 \
 	swi.9 swi_remove.9 \
 	swi.9 swi_sched.9
 MLINKS+=sx.9 sx_assert.9 \
 	sx.9 sx_destroy.9 \
 	sx.9 sx_downgrade.9 \
 	sx.9 sx_init.9 \
 	sx.9 sx_init_flags.9 \
 	sx.9 sx_sleep.9 \
 	sx.9 sx_slock.9 \
 	sx.9 sx_slock_sig.9 \
 	sx.9 sx_sunlock.9 \
 	sx.9 SX_SYSINIT.9 \
 	sx.9 sx_try_slock.9 \
 	sx.9 sx_try_upgrade.9 \
 	sx.9 sx_try_xlock.9 \
 	sx.9 sx_unlock.9 \
 	sx.9 sx_xholder.9 \
 	sx.9 sx_xlock.9 \
 	sx.9 sx_xlock_sig.9 \
 	sx.9 sx_xlocked.9 \
 	sx.9 sx_xunlock.9
 MLINKS+=sysctl.9 SYSCTL_DECL.9 \
 	sysctl.9 SYSCTL_ADD_INT.9 \
 	sysctl.9 SYSCTL_ADD_LONG.9 \
 	sysctl.9 SYSCTL_ADD_NODE.9 \
 	sysctl.9 SYSCTL_ADD_OPAQUE.9 \
 	sysctl.9 SYSCTL_ADD_PROC.9 \
 	sysctl.9 SYSCTL_ADD_QUAD.9 \
 	sysctl.9 SYSCTL_ADD_ROOT_NODE.9 \
 	sysctl.9 SYSCTL_ADD_STRING.9 \
 	sysctl.9 SYSCTL_ADD_STRUCT.9 \
 	sysctl.9 SYSCTL_ADD_UAUTO.9 \
 	sysctl.9 SYSCTL_ADD_UINT.9 \
 	sysctl.9 SYSCTL_ADD_ULONG.9 \
 	sysctl.9 SYSCTL_ADD_UQUAD.9 \
 	sysctl.9 SYSCTL_CHILDREN.9 \
 	sysctl.9 SYSCTL_STATIC_CHILDREN.9 \
 	sysctl.9 SYSCTL_NODE_CHILDREN.9 \
 	sysctl.9 SYSCTL_PARENT.9 \
 	sysctl.9 SYSCTL_INT.9 \
 	sysctl.9 SYSCTL_LONG.9 \
 	sysctl.9 SYSCTL_NODE.9 \
 	sysctl.9 SYSCTL_OPAQUE.9 \
 	sysctl.9 SYSCTL_PROC.9 \
 	sysctl.9 SYSCTL_QUAD.9 \
 	sysctl.9 SYSCTL_ROOT_NODE.9 \
 	sysctl.9 SYSCTL_STRING.9 \
 	sysctl.9 SYSCTL_STRUCT.9 \
 	sysctl.9 SYSCTL_UINT.9 \
 	sysctl.9 SYSCTL_ULONG.9 \
 	sysctl.9 SYSCTL_UQUAD.9
 MLINKS+=sysctl_add_oid.9 sysctl_move_oid.9 \
 	sysctl_add_oid.9 sysctl_remove_oid.9 \
 	sysctl_add_oid.9 sysctl_remove_name.9
 MLINKS+=sysctl_ctx_init.9 sysctl_ctx_entry_add.9 \
 	sysctl_ctx_init.9 sysctl_ctx_entry_del.9 \
 	sysctl_ctx_init.9 sysctl_ctx_entry_find.9 \
 	sysctl_ctx_init.9 sysctl_ctx_free.9
 MLINKS+=SYSINIT.9 SYSUNINIT.9
 MLINKS+=taskqueue.9 TASK_INIT.9 \
 	taskqueue.9 TASK_INITIALIZER.9 \
 	taskqueue.9 taskqueue_block.9 \
 	taskqueue.9 taskqueue_cancel.9 \
 	taskqueue.9 taskqueue_cancel_timeout.9 \
 	taskqueue.9 taskqueue_create.9 \
 	taskqueue.9 taskqueue_create_fast.9 \
 	taskqueue.9 TASKQUEUE_DECLARE.9 \
 	taskqueue.9 TASKQUEUE_DEFINE.9 \
 	taskqueue.9 TASKQUEUE_DEFINE_THREAD.9 \
 	taskqueue.9 taskqueue_drain.9 \
 	taskqueue.9 taskqueue_drain_all.9 \
 	taskqueue.9 taskqueue_drain_timeout.9 \
 	taskqueue.9 taskqueue_enqueue.9 \
 	taskqueue.9 taskqueue_enqueue_fast.9 \
 	taskqueue.9 taskqueue_enqueue_timeout.9 \
 	taskqueue.9 TASKQUEUE_FAST_DEFINE.9 \
 	taskqueue.9 TASKQUEUE_FAST_DEFINE_THREAD.9 \
 	taskqueue.9 taskqueue_free.9 \
 	taskqueue.9 taskqueue_member.9 \
 	taskqueue.9 taskqueue_run.9 \
 	taskqueue.9 taskqueue_set_callback.9 \
 	taskqueue.9 taskqueue_start_threads.9 \
 	taskqueue.9 taskqueue_start_threads_pinned.9 \
 	taskqueue.9 taskqueue_unblock.9 \
 	taskqueue.9 TIMEOUT_TASK_INIT.9
 MLINKS+=time.9 boottime.9 \
 	time.9 time_second.9 \
 	time.9 time_uptime.9
 MLINKS+=timeout.9 callout.9 \
 	timeout.9 callout_active.9 \
 	timeout.9 callout_deactivate.9 \
 	timeout.9 callout_drain.9 \
 	timeout.9 callout_handle_init.9 \
 	timeout.9 callout_init.9 \
 	timeout.9 callout_init_mtx.9 \
 	timeout.9 callout_init_rm.9 \
 	timeout.9 callout_init_rw.9 \
 	timeout.9 callout_pending.9 \
 	timeout.9 callout_reset.9 \
 	timeout.9 callout_reset_curcpu.9 \
 	timeout.9 callout_reset_on.9 \
 	timeout.9 callout_reset_sbt.9 \
 	timeout.9 callout_reset_sbt_curcpu.9 \
 	timeout.9 callout_reset_sbt_on.9 \
 	timeout.9 callout_schedule.9 \
 	timeout.9 callout_schedule_curcpu.9 \
 	timeout.9 callout_schedule_on.9 \
 	timeout.9 callout_schedule_sbt.9 \
 	timeout.9 callout_schedule_sbt_curcpu.9 \
 	timeout.9 callout_schedule_sbt_on.9 \
 	timeout.9 callout_stop.9 \
 	timeout.9 untimeout.9
 MLINKS+=ucred.9 cred_update_thread.9 \
 	ucred.9 crcopy.9 \
 	ucred.9 crcopysafe.9 \
 	ucred.9 crdup.9 \
 	ucred.9 crfree.9 \
 	ucred.9 crget.9 \
 	ucred.9 crhold.9 \
 	ucred.9 crsetgroups.9 \
 	ucred.9 crshared.9 \
 	ucred.9 cru2x.9
 MLINKS+=uidinfo.9 uifind.9 \
 	uidinfo.9 uifree.9 \
 	uidinfo.9 uihashinit.9 \
 	uidinfo.9 uihold.9
 MLINKS+=uio.9 uiomove.9 \
 	uio.9 uiomove_nofault.9
 MLINKS+=usbdi.9 usbd_do_request.9 \
 	usbdi.9 usbd_do_request_flags.9 \
 	usbdi.9 usbd_errstr.9 \
 	usbdi.9 usbd_lookup_id_by_info.9 \
 	usbdi.9 usbd_lookup_id_by_uaa.9 \
 	usbdi.9 usbd_transfer_clear_stall.9 \
 	usbdi.9 usbd_transfer_drain.9 \
 	usbdi.9 usbd_transfer_pending.9 \
 	usbdi.9 usbd_transfer_poll.9 \
 	usbdi.9 usbd_transfer_setup.9 \
 	usbdi.9 usbd_transfer_start.9 \
 	usbdi.9 usbd_transfer_stop.9 \
 	usbdi.9 usbd_transfer_submit.9 \
 	usbdi.9 usbd_transfer_unsetup.9 \
 	usbdi.9 usbd_xfer_clr_flag.9 \
 	usbdi.9 usbd_xfer_frame_data.9 \
 	usbdi.9 usbd_xfer_frame_len.9 \
 	usbdi.9 usbd_xfer_get_frame.9 \
 	usbdi.9 usbd_xfer_get_priv.9 \
 	usbdi.9 usbd_xfer_is_stalled.9 \
 	usbdi.9 usbd_xfer_max_framelen.9 \
 	usbdi.9 usbd_xfer_max_frames.9 \
 	usbdi.9 usbd_xfer_max_len.9 \
 	usbdi.9 usbd_xfer_set_flag.9 \
 	usbdi.9 usbd_xfer_set_frame_data.9 \
 	usbdi.9 usbd_xfer_set_frame_len.9 \
 	usbdi.9 usbd_xfer_set_frame_offset.9 \
 	usbdi.9 usbd_xfer_set_frames.9 \
 	usbdi.9 usbd_xfer_set_interval.9 \
 	usbdi.9 usbd_xfer_set_priv.9 \
 	usbdi.9 usbd_xfer_set_stall.9 \
 	usbdi.9 usbd_xfer_set_timeout.9 \
 	usbdi.9 usbd_xfer_softc.9 \
 	usbdi.9 usbd_xfer_state.9 \
 	usbdi.9 usbd_xfer_status.9 \
 	usbdi.9 usb_fifo_alloc_buffer.9 \
 	usbdi.9 usb_fifo_attach.9 \
 	usbdi.9 usb_fifo_detach.9 \
 	usbdi.9 usb_fifo_free_buffer.9 \
 	usbdi.9 usb_fifo_get_data.9 \
 	usbdi.9 usb_fifo_get_data_buffer.9 \
 	usbdi.9 usb_fifo_get_data_error.9 \
 	usbdi.9 usb_fifo_get_data_linear.9 \
 	usbdi.9 usb_fifo_put_bytes_max.9 \
 	usbdi.9 usb_fifo_put_data.9 \
 	usbdi.9 usb_fifo_put_data_buffer.9 \
 	usbdi.9 usb_fifo_put_data_error.9 \
 	usbdi.9 usb_fifo_put_data_linear.9 \
 	usbdi.9 usb_fifo_reset.9 \
 	usbdi.9 usb_fifo_softc.9 \
 	usbdi.9 usb_fifo_wakeup.9
 MLINKS+=vcount.9 count_dev.9
 MLINKS+=vfsconf.9 vfs_modevent.9 \
 	vfsconf.9 vfs_register.9 \
 	vfsconf.9 vfs_unregister.9
 MLINKS+=vfs_getopt.9 vfs_copyopt.9 \
 	vfs_getopt.9 vfs_filteropt.9 \
 	vfs_getopt.9 vfs_flagopt.9 \
 	vfs_getopt.9 vfs_getopts.9 \
 	vfs_getopt.9 vfs_scanopt.9 \
 	vfs_getopt.9 vfs_setopt.9 \
 	vfs_getopt.9 vfs_setopt_part.9 \
 	vfs_getopt.9 vfs_setopts.9
 MLINKS+=vhold.9 vdrop.9 \
 	vhold.9 vdropl.9 \
 	vhold.9 vholdl.9
 MLINKS+=vmem.9 vmem_add.9 \
 	vmem.9 vmem_alloc.9 \
 	vmem.9 vmem_create.9 \
 	vmem.9 vmem_destroy.9 \
 	vmem.9 vmem_free.9 \
 	vmem.9 vmem_xalloc.9 \
 	vmem.9 vmem_xfree.9  
 MLINKS+=vm_map_lock.9 vm_map_lock_downgrade.9 \
 	vm_map_lock.9 vm_map_lock_read.9 \
 	vm_map_lock.9 vm_map_lock_upgrade.9 \
 	vm_map_lock.9 vm_map_trylock.9 \
 	vm_map_lock.9 vm_map_trylock_read.9 \
 	vm_map_lock.9 vm_map_unlock.9 \
 	vm_map_lock.9 vm_map_unlock_read.9
 MLINKS+=vm_map_lookup.9 vm_map_lookup_done.9
 MLINKS+=vm_map_max.9 vm_map_min.9 \
 	vm_map_max.9 vm_map_pmap.9
 MLINKS+=vm_map_stack.9 vm_map_growstack.9
 MLINKS+=vm_map_wire.9 vm_map_unwire.9
 MLINKS+=vm_page_bits.9 vm_page_clear_dirty.9 \
 	vm_page_bits.9 vm_page_dirty.9 \
 	vm_page_bits.9 vm_page_is_valid.9 \
 	vm_page_bits.9 vm_page_set_invalid.9 \
 	vm_page_bits.9 vm_page_set_validclean.9 \
 	vm_page_bits.9 vm_page_test_dirty.9 \
 	vm_page_bits.9 vm_page_undirty.9 \
 	vm_page_bits.9 vm_page_zero_invalid.9
 MLINKS+=vm_page_busy.9 vm_page_busied.9 \
 	vm_page_busy.9 vm_page_busy_downgrade.9 \
 	vm_page_busy.9 vm_page_busy_sleep.9 \
 	vm_page_busy.9 vm_page_sbusied.9 \
 	vm_page_busy.9 vm_page_sbusy.9 \
 	vm_page_busy.9 vm_page_sleep_if_busy.9 \
 	vm_page_busy.9 vm_page_sunbusy.9 \
 	vm_page_busy.9 vm_page_trysbusy.9 \
 	vm_page_busy.9 vm_page_tryxbusy.9 \
 	vm_page_busy.9 vm_page_xbusied.9 \
 	vm_page_busy.9 vm_page_xbusy.9 \
 	vm_page_busy.9 vm_page_xunbusy.9 \
 	vm_page_busy.9 vm_page_assert_sbusied.9 \
 	vm_page_busy.9 vm_page_assert_unbusied.9 \
 	vm_page_busy.9 vm_page_assert_xbusied.9
 MLINKS+=vm_page_aflag.9 vm_page_aflag_clear.9 \
 	vm_page_aflag.9 vm_page_aflag_set.9 \
 	vm_page_aflag.9 vm_page_reference.9
 MLINKS+=vm_page_free.9 vm_page_free_toq.9 \
 	vm_page_free.9 vm_page_free_zero.9 \
 	vm_page_free.9 vm_page_try_to_free.9
 MLINKS+=vm_page_hold.9 vm_page_unhold.9
 MLINKS+=vm_page_insert.9 vm_page_remove.9
 MLINKS+=vm_page_wire.9 vm_page_unwire.9
 MLINKS+=VOP_ACCESS.9 VOP_ACCESSX.9
 MLINKS+=VOP_ATTRIB.9 VOP_GETATTR.9 \
 	VOP_ATTRIB.9 VOP_SETATTR.9
 MLINKS+=VOP_CREATE.9 VOP_MKDIR.9 \
 	VOP_CREATE.9 VOP_MKNOD.9 \
 	VOP_CREATE.9 VOP_SYMLINK.9
 MLINKS+=VOP_GETPAGES.9 VOP_PUTPAGES.9
 MLINKS+=VOP_INACTIVE.9 VOP_RECLAIM.9
 MLINKS+=VOP_LOCK.9 vn_lock.9 \
 	VOP_LOCK.9 VOP_ISLOCKED.9 \
 	VOP_LOCK.9 VOP_UNLOCK.9
 MLINKS+=VOP_OPENCLOSE.9 VOP_CLOSE.9 \
 	VOP_OPENCLOSE.9 VOP_OPEN.9
 MLINKS+=VOP_RDWR.9 VOP_READ.9 \
 	VOP_RDWR.9 VOP_WRITE.9
 MLINKS+=VOP_REMOVE.9 VOP_RMDIR.9
 MLINKS+=vnet.9 vimage.9
 MLINKS+=vref.9 VREF.9
 MLINKS+=vrele.9 vput.9 \
 	vrele.9 vunref.9
 MLINKS+=vslock.9 vsunlock.9
 MLINKS+=zone.9 uma.9 \
 	zone.9 uma_find_refcnt.9 \
 	zone.9 uma_zalloc.9 \
 	zone.9 uma_zalloc_arg.9 \
 	zone.9 uma_zcreate.9 \
 	zone.9 uma_zdestroy.9 \
 	zone.9 uma_zfree.9 \
 	zone.9 uma_zfree_arg.9 \
 	zone.9 uma_zone_get_cur.9 \
 	zone.9 uma_zone_get_max.9 \
 	zone.9 uma_zone_set_max.9 \
 	zone.9 uma_zone_set_warning.9
 
 .include 
Index: projects/arm_intrng/share/man/man9/mod_cc.9
===================================================================
--- projects/arm_intrng/share/man/man9/mod_cc.9	(revision 276247)
+++ projects/arm_intrng/share/man/man9/mod_cc.9	(revision 276248)
@@ -1,333 +1,334 @@
 .\"
 .\" Copyright (c) 2008-2009 Lawrence Stewart 
 .\" Copyright (c) 2010-2011 The FreeBSD Foundation
 .\" All rights reserved.
 .\"
 .\" Portions of this documentation were written at the Centre for Advanced
 .\" Internet Architectures, Swinburne University of Technology, Melbourne,
 .\" Australia by David Hayes and Lawrence Stewart under sponsorship from the
 .\" FreeBSD Foundation.
 .\"
 .\" 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 AUTHOR 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 AUTHOR 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.
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 15, 2011
+.Dd December 26, 2014
 .Dt MOD_CC 9
 .Os
 .Sh NAME
 .Nm mod_cc ,
 .Nm DECLARE_CC_MODULE ,
-.Nm CC_VAR
+.Nm CCV
 .Nd Modular Congestion Control
 .Sh SYNOPSIS
 .In netinet/cc.h
 .In netinet/cc/cc_module.h
 .Fn DECLARE_CC_MODULE "ccname" "ccalgo"
-.Fn CC_VAR "ccv" "what"
+.Fn CCV "ccv" "what"
 .Sh DESCRIPTION
 The
 .Nm
 framework allows congestion control algorithms to be implemented as dynamically
 loadable kernel modules via the
 .Xr kld 4
 facility.
 Transport protocols can select from the list of available algorithms on a
 connection-by-connection basis, or use the system default (see
 .Xr mod_cc 4
 for more details).
 .Pp
 .Nm
 modules are identified by an
 .Xr ascii 7
 name and set of hook functions encapsulated in a
 .Vt "struct cc_algo" ,
 which has the following members:
 .Bd -literal -offset indent
 struct cc_algo {
 	char	name[TCP_CA_NAME_MAX];
 	int	(*mod_init) (void);
 	int	(*mod_destroy) (void);
 	int	(*cb_init) (struct cc_var *ccv);
 	void	(*cb_destroy) (struct cc_var *ccv);
 	void	(*conn_init) (struct cc_var *ccv);
 	void	(*ack_received) (struct cc_var *ccv, uint16_t type);
 	void	(*cong_signal) (struct cc_var *ccv, uint32_t type);
 	void	(*post_recovery) (struct cc_var *ccv);
 	void	(*after_idle) (struct cc_var *ccv);
 };
 .Ed
 .Pp
 The
 .Va name
 field identifies the unique name of the algorithm, and should be no longer than
 TCP_CA_NAME_MAX-1 characters in length (the TCP_CA_NAME_MAX define lives in
 .In netinet/tcp.h
 for compatibility reasons).
 .Pp
 The
 .Va mod_init
 function is called when a new module is loaded into the system but before the
 registration process is complete.
 It should be implemented if a module needs to set up some global state prior to
 being available for use by new connections.
 Returning a non-zero value from
 .Va mod_init
 will cause the loading of the module to fail.
 .Pp
 The
 .Va mod_destroy
 function is called prior to unloading an existing module from the kernel.
 It should be implemented if a module needs to clean up any global state before
 being removed from the kernel.
 The return value is currently ignored.
 .Pp
 The
 .Va cb_init
 function is called when a TCP control block
 .Vt struct tcpcb
 is created.
 It should be implemented if a module needs to allocate memory for storing
 private per-connection state.
 Returning a non-zero value from
 .Va cb_init
 will cause the connection set up to be aborted, terminating the connection as a
 result.
 .Pp
 The
 .Va cb_destroy
 function is called when a TCP control block
 .Vt struct tcpcb
 is destroyed.
 It should be implemented if a module needs to free memory allocated in
 .Va cb_init .
 .Pp
 The
 .Va conn_init
 function is called when a new connection has been established and variables are
 being initialised.
 It should be implemented to initialise congestion control algorithm variables
 for the newly established connection.
 .Pp
 The
 .Va ack_received
 function is called when a TCP acknowledgement (ACK) packet is received.
 Modules use the
 .Fa type
 argument as an input to their congestion management algorithms.
 The ACK types currently reported by the stack are CC_ACK and CC_DUPACK.
 CC_ACK indicates the received ACK acknowledges previously unacknowledged data.
 CC_DUPACK indicates the received ACK acknowledges data we have already received
 an ACK for.
 .Pp
 The
 .Va cong_signal
 function is called when a congestion event is detected by the TCP stack.
 Modules use the
 .Fa type
 argument as an input to their congestion management algorithms.
 The congestion event types currently reported by the stack are CC_ECN, CC_RTO,
 CC_RTO_ERR and CC_NDUPACK.
 CC_ECN is reported when the TCP stack receives an explicit congestion notification
 (RFC3168).
 CC_RTO is reported when the retransmission time out timer fires.
 CC_RTO_ERR is reported if the retransmission time out timer fired in error.
 CC_NDUPACK is reported if N duplicate ACKs have been received back-to-back,
 where N is the fast retransmit duplicate ack threshold (N=3 currently as per
 RFC5681).
 .Pp
 The
 .Va post_recovery
 function is called after the TCP connection has recovered from a congestion event.
 It should be implemented to adjust state as required.
 .Pp
 The
 .Va after_idle
 function is called when data transfer resumes after an idle period.
 It should be implemented to adjust state as required.
 .Pp
 The
 .Fn DECLARE_CC_MODULE
 macro provides a convenient wrapper around the
 .Xr DECLARE_MODULE 9
 macro, and is used to register a
 .Nm
 module with the
 .Nm
 framework.
 The
 .Fa ccname
 argument specifies the module's name.
 The
 .Fa ccalgo
 argument points to the module's
 .Vt struct cc_algo .
 .Pp
 .Nm
 modules must instantiate a
 .Vt struct cc_algo ,
 but are only required to set the name field, and optionally any of the function
 pointers.
 The stack will skip calling any function pointer which is NULL, so there is no
 requirement to implement any of the function pointers.
 Using the C99 designated initialiser feature to set fields is encouraged.
 .Pp
 Each function pointer which deals with congestion control state is passed a
 pointer to a
 .Vt struct cc_var ,
 which has the following members:
 .Bd -literal -offset indent
 struct cc_var {
 	void		*cc_data;
 	int		bytes_this_ack;
 	tcp_seq		curack;
 	uint32_t	flags;
 	int		type;
 	union ccv_container {
 		struct tcpcb		*tcp;
 		struct sctp_nets	*sctp;
 	} ccvc;
 };
 .Ed
 .Pp
 .Vt struct cc_var
 groups congestion control related variables into a single, embeddable structure
 and adds a layer of indirection to accessing transport protocol control blocks.
 The eventual goal is to allow a single set of
 .Nm
 modules to be shared between all congestion aware transport protocols, though
 currently only
 .Xr tcp 4
 is supported.
 .Pp
 To aid the eventual transition towards this goal, direct use of variables from
 the transport protocol's data structures is strongly discouraged.
 However, it is inevitable at the current time to require access to some of these
 variables, and so the
-.Fn CC_VAR
+.Fn CCV
 macro exists as a convenience accessor.
 The
 .Fa ccv
 argument points to the
 .Vt struct cc_var
 passed into the function by the
 .Nm
 framework.
 The
 .Fa what
 argument specifies the name of the variable to access.
 .Pp
 Apart from the
 .Va type
 and
 .Va ccv_container
 fields, the remaining fields in
 .Vt struct cc_var
 are for use by
 .Nm
 modules.
 .Pp
 The
 .Va cc_data
 field is available for algorithms requiring additional per-connection state to
 attach a dynamic memory pointer to.
 The memory should be allocated and attached in the module's
 .Va cb_init
 hook function.
 .Pp
 The
 .Va bytes_this_ack
 field specifies the number of new bytes acknowledged by the most recently
 received ACK packet.
 It is only valid in the
 .Va ack_received
 hook function.
 .Pp
 The
 .Va curack
 field specifies the sequence number of the most recently received ACK packet.
 It is only valid in the
 .Va ack_received ,
 .Va cong_signal
 and
 .Va post_recovery
 hook functions.
 .Pp
 The
 .Va flags
 field is used to pass useful information from the stack to a
 .Nm
 module.
 The CCF_ABC_SENTAWND flag is relevant in
 .Va ack_received
 and is set when appropriate byte counting (RFC3465) has counted a window's worth
 of bytes has been sent.
 It is the module's responsibility to clear the flag after it has processed the
 signal.
 The CCF_CWND_LIMITED flag is relevant in
 .Va ack_received
 and is set when the connection's ability to send data is currently constrained
 by the value of the congestion window.
 Algorithms should use the absence of this flag being set to avoid accumulating
 a large difference between the congestion window and send window.
 .Sh SEE ALSO
+.Xr cc_cdg 4 ,
 .Xr cc_chd 4 ,
 .Xr cc_cubic 4 ,
 .Xr cc_hd 4 ,
 .Xr cc_htcp 4 ,
 .Xr cc_newreno 4 ,
 .Xr cc_vegas 4 ,
 .Xr mod_cc 4 ,
 .Xr tcp 4
 .Sh ACKNOWLEDGEMENTS
 Development and testing of this software were made possible in part by grants
 from the FreeBSD Foundation and Cisco University Research Program Fund at
 Community Foundation Silicon Valley.
 .Sh FUTURE WORK
 Integrate with
 .Xr sctp 4 .
 .Sh HISTORY
 The modular Congestion Control (CC) framework first appeared in
 .Fx 9.0 .
 .Pp
 The framework was first released in 2007 by James Healy and Lawrence Stewart
 whilst working on the NewTCP research project at Swinburne University of
 Technology's Centre for Advanced Internet Architectures, Melbourne, Australia,
 which was made possible in part by a grant from the Cisco University Research
 Program Fund at Community Foundation Silicon Valley.
 More details are available at:
 .Pp
 http://caia.swin.edu.au/urp/newtcp/
 .Sh AUTHORS
 .An -nosplit
 The
 .Nm
 framework was written by
 .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org ,
 .An James Healy Aq Mt jimmy@deefa.com
 and
 .An David Hayes Aq Mt david.hayes@ieee.org .
 .Pp
 This manual page was written by
 .An David Hayes Aq Mt david.hayes@ieee.org
 and
 .An Lawrence Stewart Aq Mt lstewart@FreeBSD.org .
Index: projects/arm_intrng/share/mk/src.opts.mk
===================================================================
--- projects/arm_intrng/share/mk/src.opts.mk	(revision 276247)
+++ projects/arm_intrng/share/mk/src.opts.mk	(revision 276248)
@@ -1,371 +1,370 @@
 # $FreeBSD$
 #
 # Option file for FreeBSD /usr/src builds.
 #
 # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf
 # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no}
 # with sensible (usually) defaults.
 #
 # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that
 # are applicable for that Makefile (typically there are none, but sometimes there
 # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish
 # to omit from that make.
 #
 # Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO
 # variable.
 #
 # Makefiles may also assume that this file is included by src.opts.mk should it
 # need variables defined there prior to the end of the Makefile where
 # bsd.{subdir,lib.bin}.mk is traditionally included.
 #
 # The old-style YES_FOO and NO_FOO are being phased out. No new instances of them
 # should be added. Old instances should be removed since they were just to
 # bridge the gap between FreeBSD 4 and FreeBSD 5.
 #
 # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an
 # exception is made for _WITHOUT_SRCONF which turns off this mechanism
 # completely inside bsd.*.mk files).
 #
 
 .if !target(____)
 ____:
 
 .include 
 
 #
 # Define MK_* variables (which are either "yes" or "no") for users
 # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the
 # make(1) environment.
 # These should be tested with `== "no"' or `!= "no"' in makefiles.
 # The NO_* variables should only be set by makefiles for variables
 # that haven't been converted over.
 #
 
 # These options are used by src the builds
 
 __DEFAULT_YES_OPTIONS = \
     ACCT \
     ACPI \
     AMD \
     APM \
     AT \
     ATM \
     AUDIT \
     AUTHPF \
     BINUTILS \
     BINUTILS_BOOTSTRAP \
     BLUETOOTH \
     BOOT \
     BSD_CPIO \
     BSNMP \
     BZIP2 \
     CALENDAR \
     CAPSICUM \
     CASPER \
     CDDL \
     CPP \
     CROSS_COMPILER \
     CRYPT \
     CTM \
     CUSE \
     CXX \
     DICT \
     DMAGENT \
     DYNAMICROOT \
     ED_CRYPTO \
     EXAMPLES \
     FDT \
     FLOPPY \
     FMTREE \
     FORTH \
     FP_LIBC \
     FREEBSD_UPDATE \
     GAMES \
     GCOV \
     GDB \
     GNU \
     GNU_GREP_COMPAT \
-    GPIB \
     GPIO \
     GPL_DTC \
     GROFF \
     HTML \
     HYPERV \
     ICONV \
     INET \
     INET6 \
     IPFILTER \
     IPFW \
     JAIL \
     KDUMP \
     KVM \
     LDNS \
     LDNS_UTILS \
     LEGACY_CONSOLE \
     LIB32 \
     LIBPTHREAD \
     LIBTHR \
     LOCALES \
     LOCATE \
     LPR \
     LS_COLORS \
     LZMA_SUPPORT \
     MAIL \
     MAILWRAPPER \
     MAKE \
     NDIS \
     NETCAT \
     NETGRAPH \
     NLS_CATALOGS \
     NS_CACHING \
     NTP \
     OPENSSL \
     PAM \
     PC_SYSINSTALL \
     PF \
     PKGBOOTSTRAP \
     PMC \
     PORTSNAP \
     PPP \
     QUOTAS \
     RCMDS \
     RCS \
     RESCUE \
     ROUTED \
     SENDMAIL \
     SETUID_LOGIN \
     SHAREDOCS \
     SOURCELESS \
     SOURCELESS_HOST \
     SOURCELESS_UCODE \
     SVNLITE \
     SYSCALL_COMPAT \
     SYSCONS \
     SYSINSTALL \
     TCSH \
     TELNET \
     TESTS \
     TEXTPROC \
     UNBOUND \
     USB \
     UTMPX \
     VI \
     VT \
     WIRELESS \
     WPA_SUPPLICANT_EAPOL \
     ZFS \
     ZONEINFO
 
 __DEFAULT_NO_OPTIONS = \
     BSD_GREP \
     CLANG_EXTRAS \
     EISA \
     ELFTOOLCHAIN_TOOLS \
     FMAKE \
     HESIOD \
     LLDB \
     NAND \
     OFED \
     OPENLDAP \
     OPENSSH_NONE_CIPHER \
     SHARED_TOOLCHAIN \
     SORT_THREADS \
     SVN
 
 #
 # Default behaviour of some options depends on the architecture.  Unfortunately
 # this means that we have to test TARGET_ARCH (the buildworld case) as well
 # as MACHINE_ARCH (the non-buildworld case).  Normally TARGET_ARCH is not
 # used at all in bsd.*.mk, but we have to make an exception here if we want
 # to allow defaults for some things like clang to vary by target architecture.
 # Additional, per-target behavior should be rarely added only after much
 # gnashing of teeth and grinding of gears.
 #
 .if defined(TARGET_ARCH)
 __T=${TARGET_ARCH}
 .else
 __T=${MACHINE_ARCH}
 .endif
 .if defined(TARGET)
 __TT=${TARGET}
 .else
 __TT=${MACHINE}
 .endif
 # Clang is only for x86, powerpc and little-endian arm right now, by default.
 .if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
 .elif ${__TT} == "arm" && ${__T:Marm*eb*} == ""
 __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP
 # GCC is unable to build the full clang on arm, disable it by default.
 __DEFAULT_NO_OPTIONS+=CLANG_FULL
 .else
 __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL CLANG_BOOTSTRAP
 .endif
 # Clang the default system compiler only on little-endian arm and x86.
 .if ${__T} == "amd64" || (${__TT} == "arm" && ${__T:Marm*eb*} == "") || \
     ${__T} == "i386"
 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
 __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
 .else
 # If clang is not cc, then build gcc by default
 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP
 __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX
 .endif
 
 .include 
 
 #
 # MK_* options that default to "yes" if the compiler is a C++11 compiler.
 #
 .include 
 .for var in \
     LIBCPLUSPLUS
 .if !defined(MK_${var})
 .if ${COMPILER_FEATURES:Mc++11}
 .if defined(WITHOUT_${var})
 MK_${var}:=	no
 .else
 MK_${var}:=	yes
 .endif
 .else
 .if defined(WITH_${var})
 MK_${var}:=	yes
 .else
 MK_${var}:=	no
 .endif
 .endif
 .endif
 .endfor
 
 #
 # Force some options off if their dependencies are off.
 # Order is somewhat important.
 #
 .if ${MK_LIBPTHREAD} == "no"
 MK_LIBTHR:=	no
 .endif
 
 .if ${MK_LDNS} == "no"
 MK_LDNS_UTILS:=	no
 MK_UNBOUND:= no
 .endif
 
 .if ${MK_SOURCELESS} == "no"
 MK_SOURCELESS_HOST:=	no
 MK_SOURCELESS_UCODE:= no
 .endif
 
 .if ${MK_CDDL} == "no"
 MK_ZFS:=	no
 MK_CTF:=	no
 .endif
 
 .if ${MK_CRYPT} == "no"
 MK_OPENSSL:=	no
 MK_OPENSSH:=	no
 MK_KERBEROS:=	no
 .endif
 
 .if ${MK_CXX} == "no"
 MK_CLANG:=	no
 MK_GROFF:=	no
 MK_GNUCXX:=	no
 .endif
 
 .if ${MK_MAIL} == "no"
 MK_MAILWRAPPER:= no
 MK_SENDMAIL:=	no
 MK_DMAGENT:=	no
 .endif
 
 .if ${MK_NETGRAPH} == "no"
 MK_ATM:=	no
 MK_BLUETOOTH:=	no
 .endif
 
 .if ${MK_OPENSSL} == "no"
 MK_OPENSSH:=	no
 MK_KERBEROS:=	no
 .endif
 
 .if ${MK_PF} == "no"
 MK_AUTHPF:=	no
 .endif
 
 .if ${MK_TEXTPROC} == "no"
 MK_GROFF:=	no
 .endif
 
 .if ${MK_CROSS_COMPILER} == "no"
 MK_BINUTILS_BOOTSTRAP:= no
 MK_CLANG_BOOTSTRAP:= no
 MK_GCC_BOOTSTRAP:= no
 .endif
 
 .if ${MK_TOOLCHAIN} == "no"
 MK_BINUTILS:=	no
 MK_CLANG:=	no
 MK_GCC:=	no
 MK_GDB:=	no
 MK_INCLUDES:=	no
 .endif
 
 .if ${MK_CLANG} == "no"
 MK_CLANG_EXTRAS:= no
 MK_CLANG_FULL:= no
 .endif
 
 #
 # Set defaults for the MK_*_SUPPORT variables.
 #
 
 #
 # MK_*_SUPPORT options which default to "yes" unless their corresponding
 # MK_* variable is set to "no".
 #
 .for var in \
     BZIP2 \
     GNU \
     INET \
     INET6 \
     KERBEROS \
     KVM \
     NETGRAPH \
     PAM \
     TESTS \
     WIRELESS
 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no"
 MK_${var}_SUPPORT:= no
 .else
 MK_${var}_SUPPORT:= yes
 .endif
 .endfor
 
 #
 # MK_* options whose default value depends on another option.
 #
 .for vv in \
     GSSAPI/KERBEROS \
     MAN_UTILS/MAN
 .if defined(WITH_${vv:H})
 MK_${vv:H}:=	yes
 .elif defined(WITHOUT_${vv:H})
 MK_${vv:H}:=	no
 .else
 MK_${vv:H}:=	${MK_${vv:T}}
 .endif
 .endfor
 
 .if !${COMPILER_FEATURES:Mc++11}
 MK_LLDB:=	no
 .endif
 
 # gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case.
 # while in theory we could build it with that, we don't want to do
 # that since it creates too much confusion for too little gain.
 .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800
 MK_GNUCXX:=no
 MK_GCC:=no
 .endif
 
 .endif #  !target(____)
Index: projects/arm_intrng/share
===================================================================
--- projects/arm_intrng/share	(revision 276247)
+++ projects/arm_intrng/share	(revision 276248)

Property changes on: projects/arm_intrng/share
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head/share:r276183-276247
Index: projects/arm_intrng/sys/amd64/conf/NOTES
===================================================================
--- projects/arm_intrng/sys/amd64/conf/NOTES	(revision 276247)
+++ projects/arm_intrng/sys/amd64/conf/NOTES	(revision 276248)
@@ -1,670 +1,670 @@
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
 # This file contains machine dependent kernel configuration notes.  For
 # machine independent notes, look in /sys/conf/NOTES.
 #
 # $FreeBSD$
 #
 
 #
 # We want LINT to cover profiling as well.
 profile         2
 
 #
 # Enable the kernel DTrace hooks which are required to load the DTrace
 # kernel modules.
 #
 options 	KDTRACE_HOOKS
 
 
 #####################################################################
 # SMP OPTIONS:
 #
 # Notes:
 #
 # IPI_PREEMPTION instructs the kernel to preempt threads running on other
 #	  CPUS if needed.  Relies on the PREEMPTION option
 
 # Optional:
 options 	IPI_PREEMPTION
 device		atpic			# Optional legacy pic support
 device		mptable			# Optional MPSPEC mptable support
 
 #
 # Watchdog routines.
 #
 options 	MP_WATCHDOG
 
 # Debugging options.
 #
 options 	COUNT_XINVLTLB_HITS	# Counters for TLB events
 options 	COUNT_IPIS		# Per-CPU IPI interrupt counters
 
 
 
 #####################################################################
 # CPU OPTIONS
 
 #
 # You must specify at least one CPU (the one you intend to run on);
 # deleting the specification for CPUs you don't need to use may make
 # parts of the system run faster.
 #
 cpu		HAMMER			# aka K8, aka Opteron & Athlon64
 
 #
 # Options for CPU features.
 #
 
 #
 # PERFMON causes the driver for Pentium/Pentium Pro performance counters
 # to be compiled.  See perfmon(4) for more information.
 #
 #XXX#options 	PERFMON
 
 
 #####################################################################
 # NETWORKING OPTIONS
 
 #
 # DEVICE_POLLING adds support for mixed interrupt-polling handling
 # of network device drivers, which has significant benefits in terms
 # of robustness to overloads and responsivity, as well as permitting
 # accurate scheduling of the CPU time between kernel network processing
 # and other activities.  The drawback is a moderate (up to 1/HZ seconds)
 # potential increase in response times.
 # It is strongly recommended to use HZ=1000 or 2000 with DEVICE_POLLING
 # to achieve smoother behaviour.
 # Additionally, you can enable/disable polling at runtime with help of
 # the ifconfig(8) utility, and select the CPU fraction reserved to
 # userland with the sysctl variable kern.polling.user_frac
 # (default 50, range 0..100).
 #
 # Not all device drivers support this mode of operation at the time of
 # this writing.  See polling(4) for more details.
 
 options 	DEVICE_POLLING
 
 # BPF_JITTER adds support for BPF just-in-time compiler.
 
 options 	BPF_JITTER
 
 # OpenFabrics Enterprise Distribution (Infiniband).
 options 	OFED
 options 	OFED_DEBUG_INIT
 
 # Sockets Direct Protocol
 options 	SDP
 options 	SDP_DEBUG
 
 # IP over Infiniband
 options 	IPOIB
 options 	IPOIB_DEBUG
 options 	IPOIB_CM
 
 
 #####################################################################
 # CLOCK OPTIONS
 
 # Provide read/write access to the memory in the clock chip.
 device		nvram		# Access to rtc cmos via /dev/nvram
 
 
 #####################################################################
 # MISCELLANEOUS DEVICES AND OPTIONS
 
 device		speaker		#Play IBM BASIC-style noises out your speaker
 hint.speaker.0.at="isa"
 hint.speaker.0.port="0x61"
 device		gzip		#Exec gzipped a.out's.  REQUIRES COMPAT_AOUT!
 
 
 #####################################################################
 # HARDWARE BUS CONFIGURATION
 
 #
 # ISA bus
 #
 device		isa
 
 #
 # Options for `isa':
 #
 # AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A
 # interrupt controller.  This saves about 0.7-1.25 usec for each interrupt.
 # This option breaks suspend/resume on some portables.
 #
 # AUTO_EOI_2 enables the `automatic EOI' feature for the slave 8259A
 # interrupt controller.  This saves about 0.7-1.25 usec for each interrupt.
 # Automatic EOI is documented not to work for for the slave with the
 # original i8259A, but it works for some clones and some integrated
 # versions.
 #
 # MAXMEM specifies the amount of RAM on the machine; if this is not
 # specified, FreeBSD will first read the amount of memory from the CMOS
 # RAM, so the amount of memory will initially be limited to 64MB or 16MB
 # depending on the BIOS.  If the BIOS reports 64MB, a memory probe will
 # then attempt to detect the installed amount of RAM.  If this probe
 # fails to detect >64MB RAM you will have to use the MAXMEM option.
 # The amount is in kilobytes, so for a machine with 128MB of RAM, it would
 # be 131072 (128 * 1024).
 #
 # BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to
 # reset the CPU for reboot.  This is needed on some systems with broken
 # keyboard controllers.
 
 options 	AUTO_EOI_1
 #options 	AUTO_EOI_2
 
 options 	MAXMEM=(128*1024)
 #options 	BROKEN_KEYBOARD_RESET
 
 #
 # PCI bus & PCI options:
 #
 device		pci
 
 #
 # AGP GART support
 device		agp
 
 #
 # AGP debugging.
 #
 options 	AGP_DEBUG
 
 
 #####################################################################
 # HARDWARE DEVICE CONFIGURATION
 
 # To include support for VGA VESA video modes
 options 	VESA
 
 # Turn on extra debugging checks and output for VESA support.
 options 	VESA_DEBUG
 
 device		dpms		# DPMS suspend & resume via VESA BIOS
 
 # x86 real mode BIOS emulator, required by atkbdc/dpms/vesa
 options 	X86BIOS
 
 #
 # Optional devices:
 #
 
 # PS/2 mouse
 device		psm
 hint.psm.0.at="atkbdc"
 hint.psm.0.irq="12"
 
 # Options for psm:
 options 	PSM_HOOKRESUME		#hook the system resume event, useful
 					#for some laptops
 options 	PSM_RESETAFTERSUSPEND	#reset the device at the resume event
 
 # The keyboard controller; it controls the keyboard and the PS/2 mouse.
 device		atkbdc
 hint.atkbdc.0.at="isa"
 hint.atkbdc.0.port="0x060"
 
 # The AT keyboard
 device		atkbd
 hint.atkbd.0.at="atkbdc"
 hint.atkbd.0.irq="1"
 
 # Options for atkbd:
 options 	ATKBD_DFLT_KEYMAP	# specify the built-in keymap
-makeoptions	ATKBD_DFLT_KEYMAP=jp.106
+makeoptions	ATKBD_DFLT_KEYMAP=fr.dvorak
 
 # `flags' for atkbd:
 #       0x01    Force detection of keyboard, else we always assume a keyboard
 #       0x02    Don't reset keyboard, useful for some newer ThinkPads
 #	0x03	Force detection and avoid reset, might help with certain
 #		dockingstations
 #       0x04    Old-style (XT) keyboard support, useful for older ThinkPads
 
 # Video card driver for VGA adapters.
 device		vga
 hint.vga.0.at="isa"
 
 # Options for vga:
 # Try the following option if the mouse pointer is not drawn correctly
 # or font does not seem to be loaded properly.  May cause flicker on
 # some systems.
 options 	VGA_ALT_SEQACCESS
 
 # If you can dispense with some vga driver features, you may want to
 # use the following options to save some memory.
 #options 	VGA_NO_FONT_LOADING	# don't save/load font
 #options 	VGA_NO_MODE_CHANGE	# don't change video modes
 
 # Older video cards may require this option for proper operation.
 options 	VGA_SLOW_IOACCESS	# do byte-wide i/o's to TS and GDC regs
 
 # The following option probably won't work with the LCD displays.
 options 	VGA_WIDTH90		# support 90 column modes
 
 # Debugging.
 options 	VGA_DEBUG
 
 # vt(4) drivers.
 device		vt_vga		# VGA
 device		vt_efifb	# EFI framebuffer
 
 # Linear framebuffer driver for S3 VESA 1.2 cards. Works on top of VESA.
 device		s3pci
 
 # 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support.  This will create
 # the /dev/3dfx0 device to work with glide implementations.  This should get
 # linked to /dev/3dfx and /dev/voodoo.  Note that this is not the same as
 # the tdfx DRI module from XFree86 and is completely unrelated.
 #
 # To enable Linuxulator support, one must also include COMPAT_LINUX in the
 # config as well.  The other option is to load both as modules.
 
 device		tdfx			# Enable 3Dfx Voodoo support
 #XXX#device 	tdfx_linux		# Enable Linuxulator support
 
 #
 # ACPI support using the Intel ACPI Component Architecture reference
 # implementation.
 #
 # ACPI_DEBUG enables the use of the debug.acpi.level and debug.acpi.layer
 # kernel environment variables to select initial debugging levels for the
 # Intel ACPICA code.  (Note that the Intel code must also have USE_DEBUGGER
 # defined when it is built).
 
 device		acpi
 options 	ACPI_DEBUG
 
 # The cpufreq(4) driver provides support for non-ACPI CPU frequency control
 device		cpufreq
 
 # Direct Rendering modules for 3D acceleration.
 device		drm		# DRM core module required by DRM drivers
 device		i915drm		# Intel i830 through i915
 device		mach64drm	# ATI Rage Pro, Rage Mobility P/M, Rage XL
 device		mgadrm		# AGP Matrox G200, G400, G450, G550
 device		r128drm		# ATI Rage 128
 device		radeondrm	# ATI Radeon
 device		savagedrm	# S3 Savage3D, Savage4
 device		sisdrm		# SiS 300/305, 540, 630
 device		tdfxdrm		# 3dfx Voodoo 3/4/5 and Banshee
 device		viadrm		# VIA
 options 	DRM_DEBUG	# Include debug printfs (slow)
 
 #
 # Network interfaces:
 #
 
 # bxe:  Broadcom NetXtreme II (BCM5771X/BCM578XX) PCIe 10Gb Ethernet
 #       adapters.
 # ed:   Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503
 #       HP PC Lan+, various PC Card devices
 #       (requires miibus)
 # ipw:	Intel PRO/Wireless 2100 IEEE 802.11 adapter
 #	Requires the ipw firmware module
 # iwi:	Intel PRO/Wireless 2200BG/2225BG/2915ABG IEEE 802.11 adapters
 #	Requires the iwi firmware module
 # iwn:	Intel Wireless WiFi Link 1000/105/135/2000/4965/5000/6000/6050 abgn
 #	802.11 network adapters
 #	Requires the iwn firmware module
 # ixl:	Intel XL710 40Gbe PCIE Ethernet
 # ixlv:	Intel XL710 40Gbe VF PCIE Ethernet
 # mlx4ib: Mellanox ConnectX HCA InfiniBand
 # mlxen: Mellanox ConnectX HCA Ethernet
 # mthca: Mellanox HCA InfiniBand
 # nfe:	nVidia nForce MCP on-board Ethernet Networking (BSD open source)
 # sfxge: Solarflare SFC9000 family 10Gb Ethernet adapters
 # vmx:	VMware VMXNET3 Ethernet (BSD open source)
 # wpi:	Intel 3945ABG Wireless LAN controller
 #	Requires the wpi firmware module
 
 device		bxe		# Broadcom NetXtreme II BCM5771X/BCM578XX 10GbE
 device		ed		# NE[12]000, SMC Ultra, 3c503, DS8390 cards
 options 	ED_3C503
 options 	ED_HPP
 options 	ED_SIC
 device		ipw		# Intel 2100 wireless NICs.
 device		iwi		# Intel 2200BG/2225BG/2915ABG wireless NICs.
 device		iwn		# Intel 4965/1000/5000/6000 wireless NICs.
 device		ixl		# Intel XL710 40Gbe PCIE Ethernet
 device		ixlv		# Intel XL710 40Gbe VF PCIE Ethernet
 device  	mlx4ib		# Mellanox ConnectX HCA InfiniBand
 device  	mlxen		# Mellanox ConnectX HCA Ethernet
 device  	mthca		# Mellanox HCA InfiniBand
 device		nfe		# nVidia nForce MCP on-board Ethernet
 device		sfxge		# Solarflare SFC9000 10Gb Ethernet
 device		vmx		# VMware VMXNET3 Ethernet
 device		wpi		# Intel 3945ABG wireless NICs.
 
 # IEEE 802.11 adapter firmware modules
 
 # Intel PRO/Wireless 2100 firmware:
 #   ipwfw:		BSS/IBSS/monitor mode firmware
 #   ipwbssfw:		BSS mode firmware
 #   ipwibssfw:		IBSS mode firmware
 #   ipwmonitorfw:	Monitor mode firmware
 # Intel PRO/Wireless 2200BG/2225BG/2915ABG firmware:
 #   iwifw:		BSS/IBSS/monitor mode firmware
 #   iwibssfw:		BSS mode firmware
 #   iwiibssfw:		IBSS mode firmware
 #   iwimonitorfw:	Monitor mode firmware
 # Intel Wireless WiFi Link 4965/1000/5000/6000 series firmware:
 #   iwnfw:		Single module to support all devices
 #   iwn1000fw:		Specific module for the 1000 only
 #   iwn105fw:		Specific module for the 105 only
 #   iwn135fw:		Specific module for the 135 only
 #   iwn2000fw:		Specific module for the 2000 only
 #   iwn2030fw:		Specific module for the 2030 only
 #   iwn4965fw:		Specific module for the 4965 only
 #   iwn5000fw:		Specific module for the 5000 only
 #   iwn5150fw:		Specific module for the 5150 only
 #   iwn6000fw:		Specific module for the 6000 only
 #   iwn6000g2afw:	Specific module for the 6000g2a only
 #   iwn6000g2bfw:	Specific module for the 6000g2b only
 #   iwn6050fw:		Specific module for the 6050 only
 # wpifw:	Intel 3945ABG Wireless LAN Controller firmware
 
 device		iwifw
 device		iwibssfw
 device		iwiibssfw
 device		iwimonitorfw
 device		ipwfw
 device		ipwbssfw
 device		ipwibssfw
 device		ipwmonitorfw
 device		iwnfw
 device		iwn1000fw
 device		iwn105fw
 device		iwn135fw
 device		iwn2000fw
 device		iwn2030fw
 device		iwn4965fw
 device		iwn5000fw
 device		iwn5150fw
 device		iwn6000fw
 device		iwn6000g2afw
 device		iwn6000g2bfw
 device		iwn6050fw
 device		wpifw
 
 # Intel Non-Transparent Bridge (NTB) hardware
 device		ntb_hw	# Hardware Abstraction Layer for the NTB
 device		if_ntb	# Simulated ethernet device using the NTB
 
 #
 #XXX this stores pointers in a 32bit field that is defined by the hardware
 #device	pst
 
 #
 # Areca 11xx and 12xx series of SATA II RAID controllers.
 # CAM is required.
 #
 device		arcmsr		# Areca SATA II RAID
 
 #
 # 3ware 9000 series PATA/SATA RAID controller driver and options.
 # The driver is implemented as a SIM, and so, needs the CAM infrastructure.
 #
 options 	TWA_DEBUG		# 0-10; 10 prints the most messages.
 options 	TWA_FLASH_FIRMWARE	# firmware image bundled when defined.
 device		twa			# 3ware 9000 series PATA/SATA RAID
 
 #
 # SCSI host adapters:
 #
 # ncv: NCR 53C500 based SCSI host adapters.
 # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters.
 # stg: TMC 18C30, 18C50 based SCSI host adapters.
 
 device		ncv
 device		nsp
 device		stg
 
 #
 # Adaptec FSA RAID controllers, including integrated DELL controllers,
 # the Dell PERC 2/QC and the HP NetRAID-4M
 device		aac
 device		aacp	# SCSI Passthrough interface (optional, CAM required)
 
 #
 # Adaptec by PMC RAID controllers, Series 6/7/8 and upcoming families
 device		aacraid		# Container interface, CAM required
 
 #
 # Highpoint RocketRAID 27xx.
 device		hpt27xx
 
 #
 # Highpoint RocketRAID 182x.
 device		hptmv
 
 #
 # Highpoint DC7280 and R750.
 device		hptnr
 
 #
 # Highpoint RocketRAID.  Supports RR172x, RR222x, RR2240, RR232x, RR2340,
 # RR2210, RR174x, RR2522, RR231x, RR230x.
 device		hptrr
 
 #
 # Highpoint RocketRaid 3xxx series SATA RAID
 device		hptiop
 
 #
 # IBM (now Adaptec) ServeRAID controllers
 device		ips
 
 #
 # Intel C600 (Patsburg) integrated SAS controller
 device		isci
 options 	ISCI_LOGGING	# enable debugging in isci HAL
 
 #
 # NVM Express (NVMe) support
 device         nvme    # base NVMe driver
 device         nvd     # expose NVMe namespaces as disks, depends on nvme
 
 #
 # SafeNet crypto driver: can be moved to the MI NOTES as soon as
 # it's tested on a big-endian machine
 #
 device		safe		# SafeNet 1141
 options 	SAFE_DEBUG	# enable debugging support: hw.safe.debug
 options 	SAFE_RNDTEST	# enable rndtest support
 
 #
 # VirtIO support
 #
 # The virtio entry provides a generic bus for use by the device drivers.
 # It must be combined with an interface that communicates with the host.
 # Multiple such interfaces are defined by the VirtIO specification. FreeBSD
 # only has support for PCI. Therefore, virtio_pci must be statically
 # compiled in or loaded as a module for the device drivers to function.
 #
 device		virtio		# Generic VirtIO bus (required)
 device		virtio_pci	# VirtIO PCI Interface
 device		vtnet		# VirtIO Ethernet device
 device		virtio_blk	# VirtIO Block device
 device		virtio_scsi	# VirtIO SCSI device
 device		virtio_balloon	# VirtIO Memory Balloon device
 device		virtio_random	# VirtIO Entropy device
 device		virtio_console	# VirtIO Console device
 
 device 		hyperv		# HyperV drivers
 
 # Xen HVM Guest Optimizations
 options 	XENHVM		# Xen HVM kernel infrastructure
 device 		xenpci		# Xen HVM Hypervisor services driver
 
 #####################################################################
 
 #
 # Miscellaneous hardware:
 #
 # ipmi: Intelligent Platform Management Interface
 # pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724)
 # smbios: DMI/SMBIOS entry point
 # vpd: Vital Product Data kernel interface
 # asmc: Apple System Management Controller
 # si: Specialix International SI/XIO or SX intelligent serial card
 # tpm: Trusted Platform Module
 
 # Notes on the Specialix SI/XIO driver:
 #  The host card is memory, not IO mapped.
 #  The Rev 1 host cards use a 64K chunk, on a 32K boundary.
 #  The Rev 2 host cards use a 32K chunk, on a 32K boundary.
 #  The cards can use an IRQ of 11, 12 or 15.
 
 device		ipmi
 device		pbio
 hint.pbio.0.at="isa"
 hint.pbio.0.port="0x360"
 device		smbios
 device		vpd
 device		asmc
 device		si
 device		tpm
 device		padlock_rng	# VIA Padlock RNG
 device		rdrand_rng	# Intel Bull Mountain RNG
 device		aesni		# AES-NI OpenCrypto module
 
 #
 # Laptop/Notebook options:
 #
 
 
 #
 # I2C Bus
 #
 
 #
 # Hardware watchdog timers:
 #
 # ichwd: Intel ICH watchdog timer
 # amdsbwd: AMD SB7xx watchdog timer
 # viawd: VIA south bridge watchdog timer
 # wbwd: Winbond watchdog timer
 #
 device		ichwd
 device		amdsbwd
 device		viawd
 device		wbwd
 
 #
 # Temperature sensors:
 #
 # coretemp: on-die sensor on Intel Core and newer CPUs
 # amdtemp: on-die sensor on AMD K8/K10/K11 CPUs
 #
 device		coretemp
 device		amdtemp
 
 #
 # CPU control pseudo-device. Provides access to MSRs, CPUID info and
 # microcode update feature.
 #
 device		cpuctl
 
 #
 # System Management Bus (SMB)
 #
 options 	ENABLE_ALART		# Control alarm on Intel intpm driver
 
 #
 # Number of initial kernel page table pages used for early bootstrap.
 # This number should include enough pages to map the kernel and any
 # modules or other data loaded with the kernel by the loader.  Each
 # page table page maps 2MB.
 #
 options 	NKPT=31
 
 
 #####################################################################
 # ABI Emulation
 
 #XXX keep these here for now and reactivate when support for emulating
 #XXX these 32 bit binaries is added.
 
 # Enable 32-bit runtime support for FreeBSD/i386 binaries.
 options 	COMPAT_FREEBSD32
 
 # Enable iBCS2 runtime support for SCO and ISC binaries
 #XXX#options 	IBCS2
 
 # Emulate spx device for client side of SVR3 local X interface
 #XXX#options 	SPX_HACK
 
 # Enable Linux ABI emulation
 #XXX#options 	COMPAT_LINUX
 
 # Enable 32-bit Linux ABI emulation (requires COMPAT_43 and COMPAT_FREEBSD32)
 options 	COMPAT_LINUX32
 
 # Enable the linux-like proc filesystem support (requires COMPAT_LINUX32
 # and PSEUDOFS)
 options 	LINPROCFS
 
 #Enable the linux-like sys filesystem support (requires COMPAT_LINUX32
 # and PSEUDOFS)
 options 	LINSYSFS
 
 #
 # SysVR4 ABI emulation
 #
 # The svr4 ABI emulator can be statically compiled into the kernel or loaded as
 # a KLD module.
 # The STREAMS network emulation code can also be compiled statically or as a
 # module.  If loaded as a module, it must be loaded before the svr4 module
 # (the /usr/sbin/svr4 script does this for you).  If compiling statically,
 # the `streams' device must be configured into any kernel which also
 # specifies COMPAT_SVR4.  It is possible to have a statically-configured
 # STREAMS device and a dynamically loadable svr4 emulator;  the /usr/sbin/svr4
 # script understands that it doesn't need to load the `streams' module under
 # those circumstances.
 # Caveat:  At this time, `options KTRACE' is required for the svr4 emulator
 # (whether static or dynamic).
 #
 #XXX#options 	COMPAT_SVR4	# build emulator statically
 #XXX#options 	DEBUG_SVR4	# enable verbose debugging
 #XXX#device	streams		# STREAMS network driver (required for svr4).
 
 
 #####################################################################
 # VM OPTIONS
 
 # KSTACK_PAGES is the number of memory pages to assign to the kernel
 # stack of each thread.
 
 options 	KSTACK_PAGES=5
 
 # Enable detailed accounting by the PV entry allocator.
 
 options 	PV_STATS
 
 #####################################################################
 
 # More undocumented options for linting.
 # Note that documenting these are not considered an affront.
 
 options 	FB_INSTALL_CDEV		# install a CDEV entry in /dev
 
 options 	KBDIO_DEBUG=2
 options 	KBD_MAXRETRY=4
 options 	KBD_MAXWAIT=6
 options 	KBD_RESETDELAY=201
 
 options 	PSM_DEBUG=1
 
 options 	TIMER_FREQ=((14318182+6)/12)
 
 options 	VM_KMEM_SIZE
 options 	VM_KMEM_SIZE_MAX
 options 	VM_KMEM_SIZE_SCALE
 
 # Enable NDIS binary driver support
 options 	NDISAPI
 device		ndis
Index: projects/arm_intrng/sys/arm/arm/db_trace.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/db_trace.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/db_trace.c	(revision 276248)
@@ -1,648 +1,648 @@
 /*	$NetBSD: db_trace.c,v 1.8 2003/01/17 22:28:48 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 Ben Harris
  * Copyright (c) 1996 Scott K. Stevens
  *
  * Mach Operating System
  * Copyright (c) 1991,1990 Carnegie Mellon University
  * All Rights Reserved.
  *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
  * software, derivative works or modified versions, and any portions
  * thereof, and that both notices appear in supporting documentation.
  *
  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  *
  * Carnegie Mellon requests users of this software to return to
  *
  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  *  School of Computer Science
  *  Carnegie Mellon University
  *  Pittsburgh PA 15213-3890
  *
  * any improvements or extensions that they make and grant Carnegie the
  * rights to redistribute these changes.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 #include 
 #include 
 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #ifdef __ARM_EABI__
 /*
  * Definitions for the instruction interpreter.
  *
  * The ARM EABI specifies how to perform the frame unwinding in the
  * Exception Handling ABI for the ARM Architecture document. To perform
  * the unwind we need to know the initial frame pointer, stack pointer,
  * link register and program counter. We then find the entry within the
  * index table that points to the function the program counter is within.
  * This gives us either a list of three instructions to process, a 31-bit
  * relative offset to a table of instructions, or a value telling us
  * we can't unwind any further.
  *
  * When we have the instructions to process we need to decode them
  * following table 4 in section 9.3. This describes a collection of bit
  * patterns to encode that steps to take to update the stack pointer and
  * link register to the correct values at the start of the function.
  */
 
 /* A special case when we are unable to unwind past this function */
 #define	EXIDX_CANTUNWIND	1
 
 /* The register names */
 #define	FP	11
 #define	SP	13
 #define	LR	14
 #define	PC	15
 
 /*
  * These are set in the linker script. Their addresses will be
  * either the start or end of the exception table or index.
  */
 extern int extab_start, extab_end, exidx_start, exidx_end;
 
 /*
  * Entry types.
  * These are the only entry types that have been seen in the kernel.
  */
 #define	ENTRY_MASK	0xff000000
 #define	ENTRY_ARM_SU16	0x80000000
 #define	ENTRY_ARM_LU16	0x81000000
 
 /* Instruction masks. */
 #define	INSN_VSP_MASK		0xc0
 #define	INSN_VSP_SIZE_MASK	0x3f
 #define	INSN_STD_MASK		0xf0
 #define	INSN_STD_DATA_MASK	0x0f
 #define	INSN_POP_TYPE_MASK	0x08
 #define	INSN_POP_COUNT_MASK	0x07
 #define	INSN_VSP_LARGE_INC_MASK	0xff
 
 /* Instruction definitions */
 #define	INSN_VSP_INC		0x00
 #define	INSN_VSP_DEC		0x40
 #define	INSN_POP_MASKED		0x80
 #define	INSN_VSP_REG		0x90
 #define	INSN_POP_COUNT		0xa0
 #define	INSN_FINISH		0xb0
 #define	INSN_POP_REGS		0xb1
 #define	INSN_VSP_LARGE_INC	0xb2
 
 /* An item in the exception index table */
 struct unwind_idx {
 	uint32_t offset;
 	uint32_t insn;
 };
 
 /* The state of the unwind process */
 struct unwind_state {
 	uint32_t registers[16];
 	uint32_t start_pc;
 	uint32_t *insn;
 	u_int entries;
 	u_int byte;
 	uint16_t update_mask;
 };
 
 /* Expand a 31-bit signed value to a 32-bit signed value */
 static __inline int32_t
 db_expand_prel31(uint32_t prel31)
 {
 
 	return ((int32_t)(prel31 & 0x7fffffffu) << 1) / 2;
 }
 
 /*
  * Perform a binary search of the index table to find the function
  * with the largest address that doesn't exceed addr.
  */
 static struct unwind_idx *
 db_find_index(uint32_t addr)
 {
 	unsigned int min, mid, max;
 	struct unwind_idx *start;
 	struct unwind_idx *item;
 	int32_t prel31_addr;
 	uint32_t func_addr;
 
 	start = (struct unwind_idx *)&exidx_start;
 
 	min = 0;
 	max = (&exidx_end - &exidx_start) / 2;
 
 	while (min != max) {
 		mid = min + (max - min + 1) / 2;
 
 		item = &start[mid];
 
 	 	prel31_addr = db_expand_prel31(item->offset);
 		func_addr = (uint32_t)&item->offset + prel31_addr;
 
 		if (func_addr <= addr) {
 			min = mid;
 		} else {
 			max = mid - 1;
 		}
 	}
 
 	return &start[min];
 }
 
 /* Reads the next byte from the instruction list */
 static uint8_t
 db_unwind_exec_read_byte(struct unwind_state *state)
 {
 	uint8_t insn;
 
 	/* Read the unwind instruction */
 	insn = (*state->insn) >> (state->byte * 8);
 
 	/* Update the location of the next instruction */
 	if (state->byte == 0) {
 		state->byte = 3;
 		state->insn++;
 		state->entries--;
 	} else
 		state->byte--;
 
 	return insn;
 }
 
 /* Executes the next instruction on the list */
 static int
 db_unwind_exec_insn(struct unwind_state *state)
 {
 	unsigned int insn;
 	uint32_t *vsp = (uint32_t *)state->registers[SP];
 	int update_vsp = 0;
 
 	/* This should never happen */
 	if (state->entries == 0)
 		return 1;
 
 	/* Read the next instruction */
 	insn = db_unwind_exec_read_byte(state);
 
 	if ((insn & INSN_VSP_MASK) == INSN_VSP_INC) {
 		state->registers[SP] += ((insn & INSN_VSP_SIZE_MASK) << 2) + 4;
 
 	} else if ((insn & INSN_VSP_MASK) == INSN_VSP_DEC) {
 		state->registers[SP] -= ((insn & INSN_VSP_SIZE_MASK) << 2) + 4;
 
 	} else if ((insn & INSN_STD_MASK) == INSN_POP_MASKED) {
 		unsigned int mask, reg;
 
 		/* Load the mask */
 		mask = db_unwind_exec_read_byte(state);
 		mask |= (insn & INSN_STD_DATA_MASK) << 8;
 
 		/* We have a refuse to unwind instruction */
 		if (mask == 0)
 			return 1;
 
 		/* Update SP */
 		update_vsp = 1;
 
 		/* Load the registers */
 		for (reg = 4; mask && reg < 16; mask >>= 1, reg++) {
 			if (mask & 1) {
 				state->registers[reg] = *vsp++;
 				state->update_mask |= 1 << reg;
 
 				/* If we have updated SP kep its value */
 				if (reg == SP)
 					update_vsp = 0;
 			}
 		}
 
 	} else if ((insn & INSN_STD_MASK) == INSN_VSP_REG &&
 	    ((insn & INSN_STD_DATA_MASK) != 13) &&
 	    ((insn & INSN_STD_DATA_MASK) != 15)) {
 		/* sp = register */
 		state->registers[SP] =
 		    state->registers[insn & INSN_STD_DATA_MASK];
 
 	} else if ((insn & INSN_STD_MASK) == INSN_POP_COUNT) {
 		unsigned int count, reg;
 
 		/* Read how many registers to load */
 		count = insn & INSN_POP_COUNT_MASK;
 
 		/* Update sp */
 		update_vsp = 1;
 
 		/* Pop the registers */
 		for (reg = 4; reg <= 4 + count; reg++) {
 			state->registers[reg] = *vsp++;
 			state->update_mask |= 1 << reg;
 		}
 
 		/* Check if we are in the pop r14 version */
 		if ((insn & INSN_POP_TYPE_MASK) != 0) {
 			state->registers[14] = *vsp++;
 		}
 
 	} else if (insn == INSN_FINISH) {
 		/* Stop processing */
 		state->entries = 0;
 
 	} else if (insn == INSN_POP_REGS) {
 		unsigned int mask, reg;
 
 		mask = db_unwind_exec_read_byte(state);
 		if (mask == 0 || (mask & 0xf0) != 0)
 			return 1;
 
 		/* Update SP */
 		update_vsp = 1;
 
 		/* Load the registers */
 		for (reg = 0; mask && reg < 4; mask >>= 1, reg++) {
 			if (mask & 1) {
 				state->registers[reg] = *vsp++;
 				state->update_mask |= 1 << reg;
 			}
 		}
 
 	} else if ((insn & INSN_VSP_LARGE_INC_MASK) == INSN_VSP_LARGE_INC) {
 		unsigned int uleb128;
 
 		/* Read the increment value */
 		uleb128 = db_unwind_exec_read_byte(state);
 
 		state->registers[SP] += 0x204 + (uleb128 << 2);
 
 	} else {
 		/* We hit a new instruction that needs to be implemented */
 		db_printf("Unhandled instruction %.2x\n", insn);
 		return 1;
 	}
 
 	if (update_vsp) {
 		state->registers[SP] = (uint32_t)vsp;
 	}
 
 #if 0
 	db_printf("fp = %08x, sp = %08x, lr = %08x, pc = %08x\n",
 	    state->registers[FP], state->registers[SP], state->registers[LR],
 	    state->registers[PC]);
 #endif
 
 	return 0;
 }
 
 /* Performs the unwind of a function */
 static int
 db_unwind_tab(struct unwind_state *state)
 {
 	uint32_t entry;
 
 	/* Set PC to a known value */
 	state->registers[PC] = 0;
 
 	/* Read the personality */
 	entry = *state->insn & ENTRY_MASK;
 
 	if (entry == ENTRY_ARM_SU16) {
 		state->byte = 2;
 		state->entries = 1;
 	} else if (entry == ENTRY_ARM_LU16) {
 		state->byte = 1;
 		state->entries = ((*state->insn >> 16) & 0xFF) + 1;
 	} else {
 		db_printf("Unknown entry: %x\n", entry);
 		return 1;
 	}
 
 	while (state->entries > 0) {
 		if (db_unwind_exec_insn(state) != 0)
 			return 1;
 	}
 
 	/*
 	 * The program counter was not updated, load it from the link register.
 	 */
 	if (state->registers[PC] == 0) {
 		state->registers[PC] = state->registers[LR];
 
 		/*
 		 * If the program counter changed, flag it in the update mask.
 		 */
 		if (state->start_pc != state->registers[PC])
 			state->update_mask |= 1 << PC;
 	}
 
 	return 0;
 }
 
 static void
 db_stack_trace_cmd(struct unwind_state *state)
 {
 	struct unwind_idx *index;
 	const char *name;
 	db_expr_t value;
 	db_expr_t offset;
 	c_db_sym_t sym;
 	u_int reg, i;
 	char *sep;
 	uint16_t upd_mask;
 	bool finished;
 
 	finished = false;
 	while (!finished) {
 		/* Reset the mask of updated registers */
 		state->update_mask = 0;
 
 		/* The pc value is correct and will be overwritten, save it */
 		state->start_pc = state->registers[PC];
 
 		/* Find the item to run */
 		index = db_find_index(state->start_pc);
 
 		if (index->insn != EXIDX_CANTUNWIND) {
 			if (index->insn & (1U << 31)) {
 				/* The data is within the instruction */
 				state->insn = &index->insn;
 			} else {
 				/* A prel31 offset to the unwind table */
 				state->insn = (uint32_t *)
 				    ((uintptr_t)&index->insn +
 				     db_expand_prel31(index->insn));
 			}
 			/* Run the unwind function */
 			finished = db_unwind_tab(state);
 		}
 
 		/* Print the frame details */
 		sym = db_search_symbol(state->start_pc, DB_STGY_ANY, &offset);
 		if (sym == C_DB_SYM_NULL) {
 			value = 0;
 			name = "(null)";
 		} else
 			db_symbol_values(sym, &name, &value);
 		db_printf("%s() at ", name);
 		db_printsym(state->start_pc, DB_STGY_PROC);
 		db_printf("\n");
 		db_printf("\t pc = 0x%08x  lr = 0x%08x (", state->start_pc,
 		    state->registers[LR]);
 		db_printsym(state->registers[LR], DB_STGY_PROC);
 		db_printf(")\n");
 		db_printf("\t sp = 0x%08x  fp = 0x%08x",
 		    state->registers[SP], state->registers[FP]);
 
 		/* Don't print the registers we have already printed */
 		upd_mask = state->update_mask &
 		    ~((1 << SP) | (1 << FP) | (1 << LR) | (1 << PC));
 		sep = "\n\t";
 		for (i = 0, reg = 0; upd_mask != 0; upd_mask >>= 1, reg++) {
 			if ((upd_mask & 1) != 0) {
 				db_printf("%s%sr%d = 0x%08x", sep,
 				    (reg < 10) ? " " : "", reg,
 				    state->registers[reg]);
 				i++;
 				if (i == 2) {
 					sep = "\n\t";
 					i = 0;
 				} else
 					sep = " ";
 
 			}
 		}
 		db_printf("\n");
 
 		/*
 		 * Stop if directed to do so, or if we've unwound back to the
 		 * kernel entry point, or if the unwind function didn't change
 		 * anything (to avoid getting stuck in this loop forever).
 		 * If the latter happens, it's an indication that the unwind
 		 * information is incorrect somehow for the function named in
 		 * the last frame printed before you see the unwind failure
 		 * message (maybe it needs a STOP_UNWINDING).
 		 */
 		if (index->insn == EXIDX_CANTUNWIND) {
 			finished = true;
 		} else if (state->registers[PC] < VM_MIN_KERNEL_ADDRESS) {
 			db_printf("Unable to unwind into user mode\n");
 			finished = true;
 		} else if (state->update_mask == 0) {
 			db_printf("Unwind failure (no registers changed)\n");
 			finished = true;
 		}
 	}
 }
 #endif
 
 /*
  * APCS stack frames are awkward beasts, so I don't think even trying to use
  * a structure to represent them is a good idea.
  *
  * Here's the diagram from the APCS.  Increasing address is _up_ the page.
  *
  *          save code pointer       [fp]        <- fp points to here
  *          return link value       [fp, #-4]
  *          return sp value         [fp, #-8]
  *          return fp value         [fp, #-12]
  *          [saved v7 value]
  *          [saved v6 value]
  *          [saved v5 value]
  *          [saved v4 value]
  *          [saved v3 value]
  *          [saved v2 value]
  *          [saved v1 value]
  *          [saved a4 value]
  *          [saved a3 value]
  *          [saved a2 value]
  *          [saved a1 value]
  *
  * The save code pointer points twelve bytes beyond the start of the
  * code sequence (usually a single STM) that created the stack frame.
  * We have to disassemble it if we want to know which of the optional
  * fields are actually present.
  */
 
 #ifndef __ARM_EABI__	/* The frame format is differend in AAPCS */
 static void
 db_stack_trace_cmd(db_expr_t addr, db_expr_t count, boolean_t kernel_only)
 {
 	u_int32_t	*frame, *lastframe;
 	c_db_sym_t sym;
 	const char *name;
 	db_expr_t value;
 	db_expr_t offset;
 	int	scp_offset;
 
 	frame = (u_int32_t *)addr;
 	lastframe = NULL;
 	scp_offset = -(get_pc_str_offset() >> 2);
 
 	while (count-- && frame != NULL && !db_pager_quit) {
 		db_addr_t	scp;
 		u_int32_t	savecode;
 		int		r;
 		u_int32_t	*rp;
 		const char	*sep;
 
 		/*
 		 * In theory, the SCP isn't guaranteed to be in the function
 		 * that generated the stack frame.  We hope for the best.
 		 */
 		scp = frame[FR_SCP];
 
 		sym = db_search_symbol(scp, DB_STGY_ANY, &offset);
 		if (sym == C_DB_SYM_NULL) {
 			value = 0;
 			name = "(null)";
 		} else
 			db_symbol_values(sym, &name, &value);
 		db_printf("%s() at ", name);
 		db_printsym(scp, DB_STGY_PROC);
 		db_printf("\n");
 #ifdef __PROG26
 		db_printf("\tscp=0x%08x rlv=0x%08x (", scp, frame[FR_RLV] & R15_PC);
 		db_printsym(frame[FR_RLV] & R15_PC, DB_STGY_PROC);
 		db_printf(")\n");
 #else
 		db_printf("\tscp=0x%08x rlv=0x%08x (", scp, frame[FR_RLV]);
 		db_printsym(frame[FR_RLV], DB_STGY_PROC);
 		db_printf(")\n");
 #endif
 		db_printf("\trsp=0x%08x rfp=0x%08x", frame[FR_RSP], frame[FR_RFP]);
 
 		savecode = ((u_int32_t *)scp)[scp_offset];
 		if ((savecode & 0x0e100000) == 0x08000000) {
 			/* Looks like an STM */
 			rp = frame - 4;
 			sep = "\n\t";
 			for (r = 10; r >= 0; r--) {
 				if (savecode & (1 << r)) {
 					db_printf("%sr%d=0x%08x",
 					    sep, r, *rp--);
 					sep = (frame - rp) % 4 == 2 ?
 					    "\n\t" : " ";
 				}
 			}
 		}
 
 		db_printf("\n");
 
 		/*
 		 * Switch to next frame up
 		 */
 		if (frame[FR_RFP] == 0)
 			break; /* Top of stack */
 
 		lastframe = frame;
 		frame = (u_int32_t *)(frame[FR_RFP]);
 
 		if (INKERNEL((int)frame)) {
 			/* staying in kernel */
 			if (frame <= lastframe) {
 				db_printf("Bad frame pointer: %p\n", frame);
 				break;
 			}
 		} else if (INKERNEL((int)lastframe)) {
 			/* switch from user to kernel */
 			if (kernel_only)
 				break;	/* kernel stack only */
 		} else {
 			/* in user */
 			if (frame <= lastframe) {
 				db_printf("Bad user frame pointer: %p\n",
 					  frame);
 				break;
 			}
 		}
 	}
 }
 #endif
 
 /* XXX stubs */
 void
 db_md_list_watchpoints()
 {
 }
 
 int
 db_md_clr_watchpoint(db_expr_t addr, db_expr_t size)
 {
 	return (0);
 }
 
 int
 db_md_set_watchpoint(db_expr_t addr, db_expr_t size)
 {
 	return (0);
 }
 
 int
 db_trace_thread(struct thread *thr, int count)
 {
 #ifdef __ARM_EABI__
 	struct unwind_state state;
 #endif
 	struct pcb *ctx;
 
 	if (thr != curthread) {
 		ctx = kdb_thr_ctx(thr);
 
 #ifdef __ARM_EABI__
-		state.registers[FP] = ctx->un_32.pcb32_r11;
-		state.registers[SP] = ctx->un_32.pcb32_sp;
-		state.registers[LR] = ctx->un_32.pcb32_lr;
-		state.registers[PC] = ctx->un_32.pcb32_pc;
+		state.registers[FP] = ctx->pcb_regs.sf_r11;
+		state.registers[SP] = ctx->pcb_regs.sf_sp;
+		state.registers[LR] = ctx->pcb_regs.sf_lr;
+		state.registers[PC] = ctx->pcb_regs.sf_pc;
 
 		db_stack_trace_cmd(&state);
 #else
-		db_stack_trace_cmd(ctx->un_32.pcb32_r11, -1, TRUE);
+		db_stack_trace_cmd(ctx->pcb_regs.sf_r11, -1, TRUE);
 #endif
 	} else
 		db_trace_self();
 	return (0);
 }
 
 void
 db_trace_self(void)
 {
 #ifdef __ARM_EABI__
 	struct unwind_state state;
 	uint32_t sp;
 
 	/* Read the stack pointer */
 	__asm __volatile("mov %0, sp" : "=&r" (sp));
 
 	state.registers[FP] = (uint32_t)__builtin_frame_address(0);
 	state.registers[SP] = sp;
 	state.registers[LR] = (uint32_t)__builtin_return_address(0);
 	state.registers[PC] = (uint32_t)db_trace_self;
 
 	db_stack_trace_cmd(&state);
 #else
 	db_addr_t addr;
 
 	addr = (db_addr_t)__builtin_frame_address(0);
 	db_stack_trace_cmd(addr, -1, FALSE);
 #endif
 }
Index: projects/arm_intrng/sys/arm/arm/dump_machdep.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/dump_machdep.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/dump_machdep.c	(revision 276248)
@@ -1,407 +1,407 @@
 /*-
  * Copyright (c) 2002 Marcel Moolenaar
  * 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 AUTHOR ``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 AUTHOR 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.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include "opt_watchdog.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #ifdef SW_WATCHDOG
 #include 
 #endif
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 CTASSERT(sizeof(struct kerneldumpheader) == 512);
 
 int do_minidump = 1;
 SYSCTL_INT(_debug, OID_AUTO, minidump, CTLFLAG_RWTUN, &do_minidump, 0,
     "Enable mini crash dumps");
 
 /*
  * Don't touch the first SIZEOF_METADATA bytes on the dump device. This
  * is to protect us from metadata and to protect metadata from us.
  */
 #define	SIZEOF_METADATA		(64*1024)
 
 #define	MD_ALIGN(x)	(((off_t)(x) + PAGE_MASK) & ~PAGE_MASK)
 #define	DEV_ALIGN(x)	(((off_t)(x) + (DEV_BSIZE-1)) & ~(DEV_BSIZE-1))
 extern struct pcb dumppcb;
 
 struct md_pa {
 	vm_paddr_t md_start;
 	vm_paddr_t md_size;
 };
 
 typedef int callback_t(struct md_pa *, int, void *);
 
 static struct kerneldumpheader kdh;
 static off_t dumplo, fileofs;
 
 /* Handle buffered writes. */
 static char buffer[DEV_BSIZE];
 static size_t fragsz;
 
 /* XXX: I suppose 20 should be enough. */
 static struct md_pa dump_map[20];
 
 static void
 md_pa_init(void)
 {
 	int n, idx;
 
 	bzero(dump_map, sizeof(dump_map));
 	for (n = 0; n < sizeof(dump_map) / sizeof(dump_map[0]); n++) {
 		idx = n * 2;
 		if (dump_avail[idx] == 0 && dump_avail[idx + 1] == 0)
 			break;
 		dump_map[n].md_start = dump_avail[idx];
 		dump_map[n].md_size = dump_avail[idx + 1] - dump_avail[idx];
 	}
 }
 
 static struct md_pa *
 md_pa_first(void)
 {
 
 	return (&dump_map[0]);
 }
 
 static struct md_pa *
 md_pa_next(struct md_pa *mdp)
 {
 
 	mdp++;
 	if (mdp->md_size == 0)
 		mdp = NULL;
 	return (mdp);
 }
 
 static int
 buf_write(struct dumperinfo *di, char *ptr, size_t sz)
 {
 	size_t len;
 	int error;
 
 	while (sz) {
 		len = DEV_BSIZE - fragsz;
 		if (len > sz)
 			len = sz;
 		bcopy(ptr, buffer + fragsz, len);
 		fragsz += len;
 		ptr += len;
 		sz -= len;
 		if (fragsz == DEV_BSIZE) {
 			error = dump_write(di, buffer, 0, dumplo,
 			    DEV_BSIZE);
 			if (error)
 				return error;
 			dumplo += DEV_BSIZE;
 			fragsz = 0;
 		}
 	}
 
 	return (0);
 }
 
 static int
 buf_flush(struct dumperinfo *di)
 {
 	int error;
 
 	if (fragsz == 0)
 		return (0);
 
 	error = dump_write(di, buffer, 0, dumplo, DEV_BSIZE);
 	dumplo += DEV_BSIZE;
 	fragsz = 0;
 	return (error);
 }
 
 extern vm_offset_t kernel_l1kva;
 extern char *pouet2;
 
 static int
 cb_dumpdata(struct md_pa *mdp, int seqnr, void *arg)
 {
 	struct dumperinfo *di = (struct dumperinfo*)arg;
-	vm_paddr_t pa;
+	vm_paddr_t a, pa;
+	void *va;
 	uint32_t pgs;
 	size_t counter, sz, chunk;
-	int c, error;
+	int i, c, error;
 
+	va = 0;
 	error = 0;	/* catch case in which chunk size is 0 */
 	counter = 0;
 	pgs = mdp->md_size / PAGE_SIZE;
 	pa = mdp->md_start;
 
 	printf("  chunk %d: %dMB (%d pages)", seqnr, pgs * PAGE_SIZE / (
 	    1024*1024), pgs);
 
 	/*
 	 * Make sure we write coherent data.  Note that in the SMP case this
 	 * only operates on the L1 cache of the current CPU, but all other CPUs
 	 * have already been stopped, and their flush/invalidate was done as
 	 * part of stopping.
 	 */
 	cpu_idcache_wbinv_all();
 	cpu_l2cache_wbinv_all();
 #ifdef __XSCALE__
 	xscale_cache_clean_minidata();
 #endif
 	while (pgs) {
 		chunk = pgs;
 		if (chunk > MAXDUMPPGS)
 			chunk = MAXDUMPPGS;
 		sz = chunk << PAGE_SHIFT;
 		counter += sz;
 		if (counter >> 24) {
 			printf(" %d", pgs * PAGE_SIZE);
 			counter &= (1<<24) - 1;
 		}
-		if (pa == (pa & L1_ADDR_BITS)) {
-			pmap_kenter_section(0, pa & L1_ADDR_BITS, 0);
-			cpu_tlb_flushID_SE(0);
-			cpu_cpwait();
+		for (i = 0; i < chunk; i++) {
+			a = pa + i * PAGE_SIZE;
+			va = pmap_kenter_temporary(trunc_page(a), i);
 		}
 #ifdef SW_WATCHDOG
 		wdog_kern_pat(WD_LASTVAL);
 #endif
-		error = dump_write(di,
-		    (void *)(pa - (pa & L1_ADDR_BITS)),0, dumplo, sz);
+		error = dump_write(di, va, 0, dumplo, sz);
 		if (error)
 			break;
 		dumplo += sz;
 		pgs -= chunk;
 		pa += sz;
 
 		/* Check for user abort. */
 		c = cncheckc();
 		if (c == 0x03)
 			return (ECANCELED);
 		if (c != -1)
 			printf(" (CTRL-C to abort) ");
 	}
 	printf(" ... %s\n", (error) ? "fail" : "ok");
 	return (error);
 }
 
 static int
 cb_dumphdr(struct md_pa *mdp, int seqnr, void *arg)
 {
 	struct dumperinfo *di = (struct dumperinfo*)arg;
 	Elf_Phdr phdr;
 	uint64_t size;
 	int error;
 
 	size = mdp->md_size;
 	bzero(&phdr, sizeof(phdr));
 	phdr.p_type = PT_LOAD;
 	phdr.p_flags = PF_R;			/* XXX */
 	phdr.p_offset = fileofs;
 	phdr.p_vaddr = mdp->md_start;
 	phdr.p_paddr = mdp->md_start;
 	phdr.p_filesz = size;
 	phdr.p_memsz = size;
 	phdr.p_align = PAGE_SIZE;
 
 	error = buf_write(di, (char*)&phdr, sizeof(phdr));
 	fileofs += phdr.p_filesz;
 	return (error);
 }
 
 /*
  * Add a header to be used by libkvm to get the va to pa delta
  */
 static int
 dump_os_header(struct dumperinfo *di)
 {
 	Elf_Phdr phdr;
 	int error;
 
 	bzero(&phdr, sizeof(phdr));
 	phdr.p_type = PT_DUMP_DELTA;
 	phdr.p_flags = PF_R;			/* XXX */
 	phdr.p_offset = 0;
 	phdr.p_vaddr = KERNVIRTADDR;
 	phdr.p_paddr = pmap_kextract(KERNVIRTADDR);
 	phdr.p_filesz = 0;
 	phdr.p_memsz = 0;
 	phdr.p_align = PAGE_SIZE;
 
 	error = buf_write(di, (char*)&phdr, sizeof(phdr));
 	return (error);
 }
 
 static int
 cb_size(struct md_pa *mdp, int seqnr, void *arg)
 {
 	uint32_t *sz = (uint32_t*)arg;
 
 	*sz += (uint32_t)mdp->md_size;
 	return (0);
 }
 
 static int
 foreach_chunk(callback_t cb, void *arg)
 {
 	struct md_pa *mdp;
 	int error, seqnr;
 
 	seqnr = 0;
 	mdp = md_pa_first();
 	while (mdp != NULL) {
 		error = (*cb)(mdp, seqnr++, arg);
 		if (error)
 			return (-error);
 		mdp = md_pa_next(mdp);
 	}
 	return (seqnr);
 }
 
 int
 dumpsys(struct dumperinfo *di)
 {
 	Elf_Ehdr ehdr;
 	uint32_t dumpsize;
 	off_t hdrgap;
 	size_t hdrsz;
 	int error;
 
 	if (do_minidump)
 		return (minidumpsys(di));
 
 	bzero(&ehdr, sizeof(ehdr));
 	ehdr.e_ident[EI_MAG0] = ELFMAG0;
 	ehdr.e_ident[EI_MAG1] = ELFMAG1;
 	ehdr.e_ident[EI_MAG2] = ELFMAG2;
 	ehdr.e_ident[EI_MAG3] = ELFMAG3;
 	ehdr.e_ident[EI_CLASS] = ELF_CLASS;
 #if BYTE_ORDER == LITTLE_ENDIAN
 	ehdr.e_ident[EI_DATA] = ELFDATA2LSB;
 #else
 	ehdr.e_ident[EI_DATA] = ELFDATA2MSB;
 #endif
 	ehdr.e_ident[EI_VERSION] = EV_CURRENT;
 	ehdr.e_ident[EI_OSABI] = ELFOSABI_STANDALONE;	/* XXX big picture? */
 	ehdr.e_type = ET_CORE;
 	ehdr.e_machine = EM_ARM;
 	ehdr.e_phoff = sizeof(ehdr);
 	ehdr.e_flags = 0;
 	ehdr.e_ehsize = sizeof(ehdr);
 	ehdr.e_phentsize = sizeof(Elf_Phdr);
 	ehdr.e_shentsize = sizeof(Elf_Shdr);
 
 	md_pa_init();
 
 	/* Calculate dump size. */
 	dumpsize = 0L;
 	ehdr.e_phnum = foreach_chunk(cb_size, &dumpsize) + 1;
 	hdrsz = ehdr.e_phoff + ehdr.e_phnum * ehdr.e_phentsize;
 	fileofs = MD_ALIGN(hdrsz);
 	dumpsize += fileofs;
 	hdrgap = fileofs - DEV_ALIGN(hdrsz);
 
 	/* Determine dump offset on device. */
 	if (di->mediasize < SIZEOF_METADATA + dumpsize + sizeof(kdh) * 2) {
 		error = ENOSPC;
 		goto fail;
 	}
 	dumplo = di->mediaoffset + di->mediasize - dumpsize;
 	dumplo -= sizeof(kdh) * 2;
 
 	mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize, di->blocksize);
 
 	printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20,
 	    ehdr.e_phnum - 1);
 
 	/* Dump leader */
 	error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh));
 	if (error)
 		goto fail;
 	dumplo += sizeof(kdh);
 
 	/* Dump ELF header */
 	error = buf_write(di, (char*)&ehdr, sizeof(ehdr));
 	if (error)
 		goto fail;
 
 	/* Dump program headers */
 	error = foreach_chunk(cb_dumphdr, di);
 	if (error >= 0)
 		error = dump_os_header(di);
 	if (error < 0)
 		goto fail;
 	buf_flush(di);
 
 	/*
 	 * All headers are written using blocked I/O, so we know the
 	 * current offset is (still) block aligned. Skip the alignement
 	 * in the file to have the segment contents aligned at page
 	 * boundary. We cannot use MD_ALIGN on dumplo, because we don't
 	 * care and may very well be unaligned within the dump device.
 	 */
 	dumplo += hdrgap;
 
 	/* Dump memory chunks (updates dumplo) */
 	error = foreach_chunk(cb_dumpdata, di);
 	if (error < 0)
 		goto fail;
 
 	/* Dump trailer */
 	error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh));
 	if (error)
 		goto fail;
 
 	/* Signal completion, signoff and exit stage left. */
 	dump_write(di, NULL, 0, 0, 0);
 	printf("\nDump complete\n");
 	return (0);
 
  fail:
 	if (error < 0)
 		error = -error;
 
 	if (error == ECANCELED)
 		printf("\nDump aborted\n");
 	else if (error == ENOSPC)
 		printf("\nDump failed. Partition too small.\n");
 	else
 		printf("\n** DUMP FAILED (ERROR %d) **\n", error);
 	return (error);
 }
Index: projects/arm_intrng/sys/arm/arm/exception.S
===================================================================
--- projects/arm_intrng/sys/arm/arm/exception.S	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/exception.S	(revision 276248)
@@ -1,463 +1,465 @@
 /*	$NetBSD: exception.S,v 1.13 2003/10/31 16:30:15 scw Exp $	*/
 
 /*-
  * Copyright (c) 1994-1997 Mark Brinicombe.
  * Copyright (c) 1994 Brini.
  * All rights reserved.
  *
  * This code is derived from software written for Brini by Mark Brinicombe
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by Brini.
  * 4. The name of the company nor the name of the author may be used to
  *    endorse or promote products derived from this software without specific
  *    prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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.
  *
  * RiscBSD kernel project
  *
  * exception.S
  *
  * Low level handlers for exception vectors
  *
  * Created      : 24/09/94
  *
  * Based on kate/display/abort.s
  *
  */
 
 #include "assym.s"
 
 #include 
 #include 
 #include 
 __FBSDID("$FreeBSD$");
 
 	.text	
 	.align	0
 
 /*
  * ASM macros for pushing and pulling trapframes from the stack
  *
  * These macros are used to handle the irqframe and trapframe structures
  * defined above.
  */
 
 /*
  * PUSHFRAME - macro to push a trap frame on the stack in the current mode
  * Since the current mode is used, the SVC lr field is not defined.
  *
  * NOTE: r13 and r14 are stored separately as a work around for the
  * SA110 rev 2 STM^ bug
  */
 #ifdef ARM_TP_ADDRESS
 #define PUSHFRAME							   \
 	sub	sp, sp, #4;		/* Align the stack */		   \
 	str	lr, [sp, #-4]!;		/* Push the return address */	   \
 	sub	sp, sp, #(4*17);	/* Adjust the stack pointer */	   \
 	stmia	sp, {r0-r12};		/* Push the user mode registers */ \
 	add	r0, sp, #(4*13);	/* Adjust the stack pointer */	   \
 	stmia	r0, {r13-r14}^;		/* Push the user mode registers */ \
 	mov	r0, r0;			/* NOP for previous instruction */ \
 	mrs	r0, spsr;		/* Put the SPSR on the stack */	   \
 	str	r0, [sp, #-4]!;						   \
 	ldr	r0, =ARM_RAS_START;					   \
 	mov	r1, #0;							   \
 	str	r1, [r0];						   \
 	mov	r1, #0xffffffff;					   \
 	str	r1, [r0, #4];
 #else
 #define PUSHFRAME							   \
 	sub	sp, sp, #4;		/* Align the stack */		   \
 	str	lr, [sp, #-4]!;		/* Push the return address */	   \
 	sub	sp, sp, #(4*17);	/* Adjust the stack pointer */	   \
 	stmia	sp, {r0-r12};		/* Push the user mode registers */ \
 	add	r0, sp, #(4*13);	/* Adjust the stack pointer */	   \
 	stmia	r0, {r13-r14}^;		/* Push the user mode registers */ \
 	mov	r0, r0;			/* NOP for previous instruction */ \
 	mrs	r0, spsr;		/* Put the SPSR on the stack */	   \
 	str	r0, [sp, #-4]!;
 #endif
 
 /*
  * PULLFRAME - macro to pull a trap frame from the stack in the current mode
  * Since the current mode is used, the SVC lr field is ignored.
  */
 
 #ifdef ARM_TP_ADDRESS
 #define PULLFRAME							   \
 	ldr	r0, [sp], #4;		/* Get the SPSR from stack */	   \
 	msr	spsr_fsxc, r0;						   \
 	ldmia	sp, {r0-r14}^;		/* Restore registers (usr mode) */ \
 	mov	r0, r0;			/* NOP for previous instruction */ \
 	add	sp, sp, #(4*17);	/* Adjust the stack pointer */	   \
  	ldr	lr, [sp], #4;		/* Pull the return address */	   \
 	add	sp, sp, #4		/* Align the stack */
 #else 
 #define PULLFRAME							   \
 	ldr	r0, [sp], #4	;	/* Get the SPSR from stack */	   \
 	msr	spsr_fsxc, r0;						   \
 	clrex;								   \
 	ldmia   sp, {r0-r14}^;		/* Restore registers (usr mode) */ \
 	mov	r0, r0;			/* NOP for previous instruction */ \
 	add	sp, sp, #(4*17);	/* Adjust the stack pointer */	   \
  	ldr	lr, [sp], #4;		/* Pull the return address */	   \
 	add	sp, sp, #4		/* Align the stack */
 #endif
 
 /*
  * PUSHFRAMEINSVC - macro to push a trap frame on the stack in SVC32 mode
  * This should only be used if the processor is not currently in SVC32
  * mode. The processor mode is switched to SVC mode and the trap frame is
  * stored. The SVC lr field is used to store the previous value of
  * lr in SVC mode.
  *
  * NOTE: r13 and r14 are stored separately as a work around for the
  * SA110 rev 2 STM^ bug
  */
 #ifdef ARM_TP_ADDRESS
 #define PUSHFRAMEINSVC							   \
 	stmdb	sp, {r0-r3};		/* Save 4 registers */		   \
 	mov	r0, lr;			/* Save xxx32 r14 */		   \
 	mov	r1, sp;			/* Save xxx32 sp */		   \
 	mrs	r3, spsr;		/* Save xxx32 spsr */		   \
 	mrs	r2, cpsr; 		/* Get the CPSR */		   \
 	bic	r2, r2, #(PSR_MODE);	/* Fix for SVC mode */		   \
 	orr	r2, r2, #(PSR_SVC32_MODE);				   \
 	msr	cpsr_c, r2;		/* Punch into SVC mode */	   \
 	mov	r2, sp;			/* Save	SVC sp */		   \
 	bic	sp, sp, #7;		/* Align sp to an 8-byte addrress */  \
 	sub	sp, sp, #4;		/* Pad trapframe to keep alignment */ \
 	str	r0, [sp, #-4]!;		/* Push return address */	   \
 	str	lr, [sp, #-4]!;		/* Push SVC lr */		   \
 	str	r2, [sp, #-4]!;		/* Push SVC sp */		   \
 	msr	spsr_fsxc, r3;		/* Restore correct spsr */	   \
 	ldmdb	r1, {r0-r3};		/* Restore 4 regs from xxx mode */ \
 	sub	sp, sp, #(4*15);	/* Adjust the stack pointer */	   \
 	stmia	sp, {r0-r12};		/* Push the user mode registers */ \
 	add	r0, sp, #(4*13);	/* Adjust the stack pointer */	   \
 	stmia	r0, {r13-r14}^;		/* Push the user mode registers */ \
 	mov	r0, r0;			/* NOP for previous instruction */ \
 	ldr	r5, =ARM_RAS_START;	/* Check if there's any RAS */	   \
 	ldr	r4, [r5, #4];		/* reset it to point at the     */ \
 	cmp	r4, #0xffffffff;	/* end of memory if necessary;  */ \
 	movne	r1, #0xffffffff;	/* leave value in r4 for later  */ \
 	strne	r1, [r5, #4];		/* comparision against PC.      */ \
 	ldr	r3, [r5];		/* Retrieve global RAS_START    */ \
 	cmp	r3, #0;			/* and reset it if non-zero.    */ \
 	movne	r1, #0;			/* If non-zero RAS_START and    */ \
 	strne	r1, [r5];		/* PC was lower than RAS_END,   */ \
 	ldrne	r1, [r0, #16];		/* adjust the saved PC so that  */ \
 	cmpne	r4, r1;			/* execution later resumes at   */ \
 	strhi	r3, [r0, #16];		/* the RAS_START location.      */ \
 	mrs	r0, spsr;						   \
 	str	r0, [sp, #-4]!
 #else
 #define PUSHFRAMEINSVC							   \
 	stmdb	sp, {r0-r3};		/* Save 4 registers */		   \
 	mov	r0, lr;			/* Save xxx32 r14 */		   \
 	mov	r1, sp;			/* Save xxx32 sp */		   \
 	mrs	r3, spsr;		/* Save xxx32 spsr */		   \
 	mrs	r2, cpsr;		/* Get the CPSR */		   \
 	bic	r2, r2, #(PSR_MODE);	/* Fix for SVC mode */		   \
 	orr	r2, r2, #(PSR_SVC32_MODE);				   \
 	msr	cpsr_c, r2;		/* Punch into SVC mode */	   \
 	mov	r2, sp;			/* Save	SVC sp */		   \
 	bic	sp, sp, #7;		/* Align sp to an 8-byte addrress */  \
 	sub	sp, sp, #4;		/* Pad trapframe to keep alignment */ \
 	str	r0, [sp, #-4]!;		/* Push return address */	   \
 	str	lr, [sp, #-4]!;		/* Push SVC lr */		   \
 	str	r2, [sp, #-4]!;		/* Push SVC sp */		   \
 	msr	spsr_fsxc, r3;		/* Restore correct spsr */	   \
 	ldmdb	r1, {r0-r3};		/* Restore 4 regs from xxx mode */ \
 	sub	sp, sp, #(4*15);	/* Adjust the stack pointer */	   \
 	stmia	sp, {r0-r12};		/* Push the user mode registers */ \
 	add	r0, sp, #(4*13);	/* Adjust the stack pointer */	   \
 	stmia	r0, {r13-r14}^;		/* Push the user mode registers */ \
 	mov	r0, r0;			/* NOP for previous instruction */ \
 	mrs	r0, spsr;		/* Put the SPSR on the stack */	   \
 	str	r0, [sp, #-4]!
 #endif
 
 /*
  * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack
  * in SVC32 mode and restore the saved processor mode and PC.
  * This should be used when the SVC lr register needs to be restored on
  * exit.
  */
 
 #ifdef ARM_TP_ADDRESS
 #define PULLFRAMEFROMSVCANDEXIT						   \
 	ldr	r0, [sp], #4;		/* Get the SPSR from stack */	   \
 	msr	spsr_fsxc, r0;		/* restore SPSR */		   \
 	ldmia	sp, {r0-r14}^;		/* Restore registers (usr mode) */ \
 	mov	r0, r0;	  		/* NOP for previous instruction */ \
 	add	sp, sp, #(4*15);	/* Adjust the stack pointer */	   \
 	ldmia	sp, {sp, lr, pc}^	/* Restore lr and exit */
 #else 
 #define PULLFRAMEFROMSVCANDEXIT						   \
 	ldr	r0, [sp], #4;		/* Get the SPSR from stack */	   \
 	msr	spsr_fsxc, r0;		/* restore SPSR */		   \
 	clrex;								   \
 	ldmia	sp, {r0-r14}^;		/* Restore registers (usr mode) */ \
 	mov	r0, r0;	  		/* NOP for previous instruction */ \
 	add	sp, sp, #(4*15);	/* Adjust the stack pointer */	   \
 	ldmia	sp, {sp, lr, pc}^	/* Restore lr and exit */
 #endif
 
 #if defined(__ARM_EABI__)
 /*
  * Unwind hints so we can unwind past functions that use
  * PULLFRAMEFROMSVCANDEXIT. They are run in reverse order.
  * As the last thing we do is restore the stack pointer
  * we can ignore the padding at the end of struct trapframe.
  */
 #define	UNWINDSVCFRAME							   \
 	.save {r13-r15};		/* Restore sp, lr, pc */	   \
 	.pad #(2*4);			/* Skip user sp and lr */	   \
 	.save {r0-r12};			/* Restore r0-r12 */		   \
 	.pad #(4)			/* Skip spsr */
 #else
 #define	UNWINDSVCFRAME
 #endif
 
-#define	DO_AST								\
-	ldr	r0, [sp]		/* Get the SPSR from stack */	;\
-	mrs	r4, cpsr		/* save CPSR */			;\
-	orr	r1, r4, #(PSR_I|PSR_F)					;\
-	msr	cpsr_c, r1		/* Disable interrupts */	;\
-	and	r0, r0, #(PSR_MODE)	/* Returning to USR mode? */	;\
-	teq	r0, #(PSR_USR32_MODE)					;\
-	bne	2f			/* Nope, get out now */		;\
-	bic	r4, r4, #(PSR_I|PSR_F)					;\
-1:	GET_CURTHREAD_PTR(r5)						;\
-	ldr	r1, [r5, #(TD_FLAGS)]					;\
-	and	r1, r1, #(TDF_ASTPENDING|TDF_NEEDRESCHED)		;\
-	teq	r1, #0x00000000						;\
-	beq	2f			/* Nope. Just bail */		;\
-	msr	cpsr_c, r4		/* Restore interrupts */	;\
-	mov	r0, sp							;\
-	bl	_C_LABEL(ast)		/* ast(frame) */		;\
-	orr	r0, r4, #(PSR_I|PSR_F)					;\
-	msr	cpsr_c, r0						;\
-	b	1b							;\
+#define	DO_AST								   \
+	ldr	r0, [sp];		/* Get the SPSR from stack */	   \
+	mrs	r4, cpsr;		/* save CPSR */			   \
+	orr	r1, r4, #(PSR_I|PSR_F);					   \
+	msr	cpsr_c, r1;		/* Disable interrupts */	   \
+	and	r0, r0, #(PSR_MODE);	/* Returning to USR mode? */	   \
+	teq	r0, #(PSR_USR32_MODE);					   \
+	bne	2f;			/* Nope, get out now */		   \
+	bic	r4, r4, #(PSR_I|PSR_F);					   \
+1:	GET_CURTHREAD_PTR(r5);						   \
+	ldr	r1, [r5, #(TD_FLAGS)];					   \
+	and	r1, r1, #(TDF_ASTPENDING|TDF_NEEDRESCHED);		   \
+	teq	r1, #0;							   \
+	beq	2f;			/* Nope. Just bail */		   \
+	msr	cpsr_c, r4;		/* Restore interrupts */	   \
+	mov	r0, sp;							   \
+	bl	_C_LABEL(ast);		/* ast(frame) */		   \
+	orr	r0, r4, #(PSR_I|PSR_F);					   \
+	msr	cpsr_c, r0;						   \
+	b	1b;							   \
 2:
 
 
 /*
  * Entry point for a Software Interrupt (SWI).
  *
  * The hardware switches to svc32 mode on a swi, so we're already on the
  * right stack; just build a trapframe and call the handler.
  */
 ASENTRY_NP(swi_entry)
 	PUSHFRAME			/* Build the trapframe on the */
 	mov	r0, sp			/* scv32 stack, pass it to the */
 	bl	_C_LABEL(swi_handler)	/* swi handler. */
 	/*
 	 * The fork_trampoline() code in swtch.S aranges for the MI fork_exit()
 	 * to return to swi_exit here, to return to userland.  The net effect is
 	 * that a newly created thread appears to return from a SWI just like
 	 * the parent thread that created it.
 	 */
 ASEENTRY_NP(swi_exit)
 	DO_AST				/* Handle pending signals. */
 	PULLFRAME			/* Deallocate trapframe. */
 	movs	pc, lr			/* Return to userland. */
 	STOP_UNWINDING			/* Don't unwind into user mode. */
 EEND(swi_exit)
 END(swi_entry)
 
 /*
  * Standard exception exit handler.
  *
  * This is used to return from all exceptions except SWI.  It uses DO_AST and
  * PULLFRAMEFROMSVCANDEXIT and can only be called if the exception entry code
  * used PUSHFRAMEINSVC.
  *
  * If the return is to user mode, this uses DO_AST to deliver any pending
  * signals and/or handle TDF_NEEDRESCHED first.
  */
 ASENTRY_NP(exception_exit)
 	DO_AST				/* Handle pending signals. */
 	PULLFRAMEFROMSVCANDEXIT		/* Return. */
 	UNWINDSVCFRAME			/* Special unwinding for exceptions. */
 END(exception_exit)
 
 /*
  * Entry point for a Prefetch Abort exception.
  *
  * The hardware switches to the abort mode stack; we switch to svc32 before
  * calling the handler, then return directly to the original mode/stack 
  * on exit (without transitioning back through the abort mode stack).
  */
 ASENTRY_NP(prefetch_abort_entry)
 #ifdef __XSCALE__
 	nop				/* Make absolutely sure any pending */
 	nop				/* imprecise aborts have occurred. */
 #endif
 	sub	lr, lr, #4		/* Adjust the lr. Transition to scv32 */
 	PUSHFRAMEINSVC			/* mode stack, build trapframe there. */
 	adr	lr, exception_exit	/* Return from handler via standard */
 	mov	r0, sp			/* exception exit routine.  Pass the */
-	b	prefetch_abort_handler	/* trapframe to the handler. */
+	mov	r1, #1			/* Type flag */
+	b	_C_LABEL(abort_handler)
 END(prefetch_abort_entry)
 
 /*
  * Entry point for a Data Abort exception.
  *
  * The hardware switches to the abort mode stack; we switch to svc32 before
  * calling the handler, then return directly to the original mode/stack 
  * on exit (without transitioning back through the abort mode stack).
  */
 ASENTRY_NP(data_abort_entry)
 #ifdef __XSCALE__
 	nop				/* Make absolutely sure any pending */
 	nop				/* imprecise aborts have occurred. */
 #endif
 	sub	lr, lr, #8		/* Adjust the lr. Transition to scv32 */
 	PUSHFRAMEINSVC			/* mode stack, build trapframe there. */
-	adr	lr, exception_exit	/* Return from handler via standard */
-	mov	r0, sp			/* exception exit routine.  Pass the */
-	b	data_abort_handler	/* trapframe to the handler. */
+	adr	lr, exception_exit	/* Exception exit routine */
+	mov	r0, sp			/* Trapframe to the handler */
+	mov	r1, #0			/* Type flag */
+	b	_C_LABEL(abort_handler)
 END(data_abort_entry)
 
 /*
  * Entry point for an Undefined Instruction exception.
  *
  * The hardware switches to the undefined mode stack; we switch to svc32 before
  * calling the handler, then return directly to the original mode/stack 
  * on exit (without transitioning back through the undefined mode stack).
  */
 ASENTRY_NP(undefined_entry)
 	sub	lr, lr, #4		/* Adjust the lr. Transition to scv32 */
 	PUSHFRAMEINSVC			/* mode stack, build trapframe there. */
 	adr	lr, exception_exit      /* Return from handler via standard */
 	mov	r0, sp			/* exception exit routine.  Pass the */
 	b	undefinedinstruction	/* trapframe to the handler. */
 END(undefined_entry)
 
 /*
  * Entry point for a normal IRQ.
  *
  * The hardware switches to the IRQ mode stack; we switch to svc32 before
  * calling the handler, then return directly to the original mode/stack 
  * on exit (without transitioning back through the IRQ mode stack).
  */
 ASENTRY_NP(irq_entry)
 	sub	lr, lr, #4		/* Adjust the lr. Transition to scv32 */
 	PUSHFRAMEINSVC			/* mode stack, build trapframe there. */
 	adr	lr, exception_exit	/* Return from handler via standard */
 	mov	r0, sp			/* exception exit routine.  Pass the */
 	b	_C_LABEL(arm_irq_handler)/* trapframe to the handler. */
 END(irq_entry)                           
 
 /*
  * Entry point for an FIQ interrupt.
  *
  * We don't currently support FIQ handlers very much.  Something can 
  * install itself in the FIQ vector using code (that may or may not work
  * these days) in fiq.c.  If nobody does that and an FIQ happens, this
  * default handler just disables FIQs and otherwise ignores it.
  */
 ASENTRY_NP(fiq_entry)
 	mrs	r8, cpsr		/* FIQ handling isn't supported, */
 	bic	r8, #(PSR_F)		/* just disable FIQ and return.  */
 	msr	cpsr_c, r8		/* The r8 we trash here is the  */
 	subs	pc, lr, #4		/* banked FIQ-mode r8. */
 END(fiq_entry)
 
 /*
  * Entry point for an Address Exception exception.
  * This is an arm26 exception that should never happen.
  */
 ASENTRY_NP(addr_exception_entry)
 	mov	r3, lr
 	mrs	r2, spsr
 	mrs	r1, cpsr
 	adr	r0, Laddr_exception_msg
 	b	_C_LABEL(panic)
 Laddr_exception_msg:
 	.asciz	"Address Exception CPSR=0x%08x SPSR=0x%08x LR=0x%08x\n"
 	.balign	4
 END(addr_exception_entry)
 
 /*
  * Entry point for the system Reset vector.  
  * This should never happen, so panic.
  */
 ASENTRY_NP(reset_entry)
 	mov	r1, lr
 	adr	r0, Lreset_panicmsg
 	b	_C_LABEL(panic)
 	/* NOTREACHED */
 Lreset_panicmsg:
 	.asciz	"Reset vector called, LR = 0x%08x"
 	.balign	4
 END(reset_entry)
 
 /*
  * page0 and page0_data -- An image of the ARM vectors which is copied to
  * the ARM vectors page (high or low) as part of CPU initialization.  The
  * code that does the copy assumes that page0_data holds one 32-bit word
  * of data for each of the predefined ARM vectors.  It also assumes that
  * page0_data follows the vectors in page0, but other stuff can appear 
  * between the two.  We currently leave room between the two for some fiq 
  * handler code to be copied in.
  */
 	.global	_C_LABEL(page0), _C_LABEL(page0_data)
 
 _C_LABEL(page0):
 	ldr	pc, .Lreset_entry
 	ldr	pc, .Lundefined_entry
 	ldr	pc, .Lswi_entry
 	ldr	pc, .Lprefetch_abort_entry
 	ldr	pc, .Ldata_abort_entry
 	ldr	pc, .Laddr_exception_entry
 	ldr	pc, .Lirq_entry
 .fiqv:	ldr	pc, .Lfiq_entry
 	.space 256	/* room for some fiq handler code */
 
 _C_LABEL(page0_data):
 .Lreset_entry:		.word	reset_entry
 .Lundefined_entry:	.word	undefined_entry
 .Lswi_entry:		.word	swi_entry
 .Lprefetch_abort_entry:	.word	prefetch_abort_entry
 .Ldata_abort_entry:	.word	data_abort_entry
 .Laddr_exception_entry:	.word	addr_exception_entry
 .Lirq_entry:		.word	irq_entry
 .Lfiq_entry:		.word	fiq_entry
 
 /*
  * These items are used by the code in fiq.c to install what it calls the
  * "null" handler.  It's actually our default vector entry that just jumps
  * to the default handler which just disables FIQs and returns.
  */
 	.global _C_LABEL(fiq_nullhandler_code), _C_LABEL(fiq_nullhandler_size)
 
 _C_LABEL(fiq_nullhandler_code):
 	.word	.fiqv
 _C_LABEL(fiq_nullhandler_size):
 	.word	4
 
 
Index: projects/arm_intrng/sys/arm/arm/gdb_machdep.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/gdb_machdep.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/gdb_machdep.c	(revision 276248)
@@ -1,111 +1,115 @@
 /*-
  * Copyright (c) 2006 Olivier Houchard
  * 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 AUTHORS ``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 AUTHORS 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.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 
 static register_t stacktest;
 
 void *
 gdb_cpu_getreg(int regnum, size_t *regsz)
 {
 
 	*regsz = gdb_cpu_regsz(regnum);
 
 	if (kdb_thread == curthread) {
 		if (regnum < 13)
 			return (&kdb_frame->tf_r0 + regnum);
 		if (regnum == 13)
 			return (&kdb_frame->tf_svc_sp);
 		if (regnum == 14)
 			return (&kdb_frame->tf_svc_lr);
 		if (regnum == 15)
 			return (&kdb_frame->tf_pc);
 		if (regnum == 25)
 			return (&kdb_frame->tf_spsr);
 	}
 
 	switch (regnum) {
-	case 8:  return (&kdb_thrctx->un_32.pcb32_r8);
-	case 9:  return (&kdb_thrctx->un_32.pcb32_r9);
-	case 10:  return (&kdb_thrctx->un_32.pcb32_r10);
-	case 11:  return (&kdb_thrctx->un_32.pcb32_r11);
-	case 12:  return (&kdb_thrctx->un_32.pcb32_r12);
-	case 13:  stacktest = kdb_thrctx->un_32.pcb32_sp + 5 * 4;
+	case 4:  return (&kdb_thrctx->pcb_regs.sf_r4);
+	case 5:  return (&kdb_thrctx->pcb_regs.sf_r5);
+	case 6:  return (&kdb_thrctx->pcb_regs.sf_r6);
+	case 7:  return (&kdb_thrctx->pcb_regs.sf_r7);
+	case 8:  return (&kdb_thrctx->pcb_regs.sf_r8);
+	case 9:  return (&kdb_thrctx->pcb_regs.sf_r9);
+	case 10:  return (&kdb_thrctx->pcb_regs.sf_r10);
+	case 11:  return (&kdb_thrctx->pcb_regs.sf_r11);
+	case 12:  return (&kdb_thrctx->pcb_regs.sf_r12);
+	case 13:  stacktest = kdb_thrctx->pcb_regs.sf_sp + 5 * 4;
 		  return (&stacktest);
 	case 15:
 		  /*
 		   * On context switch, the PC is not put in the PCB, but
 		   * we can retrieve it from the stack.
 		   */
-		  if (kdb_thrctx->un_32.pcb32_sp > KERNBASE) {
-			  kdb_thrctx->un_32.pcb32_pc = *(register_t *)
-			      (kdb_thrctx->un_32.pcb32_sp + 4 * 4);
-			  return (&kdb_thrctx->un_32.pcb32_pc);
+		  if (kdb_thrctx->pcb_regs.sf_sp > KERNBASE) {
+			  kdb_thrctx->pcb_regs.sf_pc = *(register_t *)
+			      (kdb_thrctx->pcb_regs.sf_sp + 4 * 4);
+			  return (&kdb_thrctx->pcb_regs.sf_pc);
 		  }
 	}
 
 	return (NULL);
 }
 
 void
 gdb_cpu_setreg(int regnum, void *val)
 {
 
 	switch (regnum) {
 	case GDB_REG_PC:
 		if (kdb_thread  == curthread)
 			kdb_frame->tf_pc = *(register_t *)val;
 	}
 }
 
 int
 gdb_cpu_signal(int type, int code)
 {
 
 	switch (type) {
 	case T_BREAKPOINT: return (SIGTRAP);
 	}
 	return (SIGEMT);
 }
Index: projects/arm_intrng/sys/arm/arm/genassym.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/genassym.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/genassym.c	(revision 276248)
@@ -1,142 +1,147 @@
 /*-
  * Copyright (c) 2004 Olivier Houchard
  * 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 AUTHOR 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 AUTHOR 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.
  *
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 ASSYM(KERNBASE, KERNBASE);
 ASSYM(PCB_NOALIGNFLT, PCB_NOALIGNFLT);
 ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
 ASSYM(PCB_DACR, offsetof(struct pcb, pcb_dacr));
 ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
 ASSYM(PCB_PAGEDIR, offsetof(struct pcb, pcb_pagedir));
 ASSYM(PCB_L1VEC, offsetof(struct pcb, pcb_l1vec));
 ASSYM(PCB_PL1VEC, offsetof(struct pcb, pcb_pl1vec));
-ASSYM(PCB_R8, offsetof(struct pcb, un_32.pcb32_r8));
-ASSYM(PCB_R9, offsetof(struct pcb, un_32.pcb32_r9));
-ASSYM(PCB_R10, offsetof(struct pcb, un_32.pcb32_r10));
-ASSYM(PCB_R11, offsetof(struct pcb, un_32.pcb32_r11));
-ASSYM(PCB_R12, offsetof(struct pcb, un_32.pcb32_r12));
-ASSYM(PCB_PC, offsetof(struct pcb, un_32.pcb32_pc));
-ASSYM(PCB_SP, offsetof(struct pcb, un_32.pcb32_sp));
+ASSYM(PCB_R4, offsetof(struct pcb, pcb_regs.sf_r4));
+ASSYM(PCB_R5, offsetof(struct pcb, pcb_regs.sf_r5));
+ASSYM(PCB_R6, offsetof(struct pcb, pcb_regs.sf_r6));
+ASSYM(PCB_R7, offsetof(struct pcb, pcb_regs.sf_r7));
+ASSYM(PCB_R8, offsetof(struct pcb, pcb_regs.sf_r8));
+ASSYM(PCB_R9, offsetof(struct pcb, pcb_regs.sf_r9));
+ASSYM(PCB_R10, offsetof(struct pcb, pcb_regs.sf_r10));
+ASSYM(PCB_R11, offsetof(struct pcb, pcb_regs.sf_r11));
+ASSYM(PCB_R12, offsetof(struct pcb, pcb_regs.sf_r12));
+ASSYM(PCB_SP, offsetof(struct pcb, pcb_regs.sf_sp));
+ASSYM(PCB_LR, offsetof(struct pcb, pcb_regs.sf_lr));
+ASSYM(PCB_PC, offsetof(struct pcb, pcb_regs.sf_pc));
 
 ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb));
 ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread));
 ASSYM(M_LEN, offsetof(struct mbuf, m_len));
 ASSYM(M_DATA, offsetof(struct mbuf, m_data));
 ASSYM(M_NEXT, offsetof(struct mbuf, m_next));
 ASSYM(IP_SRC, offsetof(struct ip, ip_src));
 ASSYM(IP_DST, offsetof(struct ip, ip_dst));
 ASSYM(CF_SETTTB, offsetof(struct cpu_functions, cf_setttb));
 ASSYM(CF_CONTROL, offsetof(struct cpu_functions, cf_control));
 ASSYM(CF_CONTEXT_SWITCH, offsetof(struct cpu_functions, cf_context_switch));
 ASSYM(CF_DCACHE_WB_RANGE, offsetof(struct cpu_functions, cf_dcache_wb_range));
 ASSYM(CF_L2CACHE_WB_RANGE, offsetof(struct cpu_functions, cf_l2cache_wb_range));
 ASSYM(CF_IDCACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_idcache_wbinv_all));
 ASSYM(CF_L2CACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_l2cache_wbinv_all));
 ASSYM(CF_TLB_FLUSHID_SE, offsetof(struct cpu_functions, cf_tlb_flushID_SE));
 ASSYM(CF_ICACHE_SYNC, offsetof(struct cpu_functions, cf_icache_sync_all));
 
 ASSYM(V_TRAP, offsetof(struct vmmeter, v_trap));
 ASSYM(V_SOFT, offsetof(struct vmmeter, v_soft));
 ASSYM(V_INTR, offsetof(struct vmmeter, v_intr));
 
 ASSYM(TD_PCB, offsetof(struct thread, td_pcb));
 ASSYM(TD_FLAGS, offsetof(struct thread, td_flags));
 ASSYM(TD_PROC, offsetof(struct thread, td_proc));
 ASSYM(TD_FRAME, offsetof(struct thread, td_frame));
 ASSYM(TD_MD, offsetof(struct thread, td_md));
 ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
 ASSYM(MD_TP, offsetof(struct mdthread, md_tp));
 ASSYM(MD_RAS_START, offsetof(struct mdthread, md_ras_start));
 ASSYM(MD_RAS_END, offsetof(struct mdthread, md_ras_end));
 
 ASSYM(TF_R0, offsetof(struct trapframe, tf_r0));
 ASSYM(TF_R1, offsetof(struct trapframe, tf_r1));
 ASSYM(TF_PC, offsetof(struct trapframe, tf_pc));
 ASSYM(P_PID, offsetof(struct proc, p_pid));
 ASSYM(P_FLAG, offsetof(struct proc, p_flag));
 
 ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc));
 
 #ifdef ARM_TP_ADDRESS
 ASSYM(ARM_TP_ADDRESS, ARM_TP_ADDRESS);
 ASSYM(ARM_RAS_START, ARM_RAS_START);
 ASSYM(ARM_RAS_END, ARM_RAS_END);
 #endif
 
 #ifdef VFP
 ASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate));
 
 ASSYM(PC_CPU, offsetof(struct pcpu, pc_cpu));
 
 ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap));
 #endif
 
 ASSYM(PAGE_SIZE, PAGE_SIZE);
 ASSYM(PDESIZE, PDESIZE);
 ASSYM(PMAP_DOMAIN_KERNEL, PMAP_DOMAIN_KERNEL);
 #ifdef PMAP_INCLUDE_PTE_SYNC
 ASSYM(PMAP_INCLUDE_PTE_SYNC, 1);
 #endif
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
 ASSYM(P_TRACED, P_TRACED);
 ASSYM(P_SIGEVENT, P_SIGEVENT);
 ASSYM(P_PROFIL, P_PROFIL);
 ASSYM(TRAPFRAMESIZE, sizeof(struct trapframe));
 
 ASSYM(MAXCOMLEN, MAXCOMLEN);
 ASSYM(NIRQ, NIRQ);
 ASSYM(PCPU_SIZE, sizeof(struct pcpu));
Index: projects/arm_intrng/sys/arm/arm/identcpu.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/identcpu.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/identcpu.c	(revision 276248)
@@ -1,528 +1,528 @@
 /*	$NetBSD: cpu.c,v 1.55 2004/02/13 11:36:10 wiz Exp $	*/
 
 /*-
  * Copyright (c) 1995 Mark Brinicombe.
  * Copyright (c) 1995 Brini.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by Brini.
  * 4. The name of the company nor the name of the author may be used to
  *    endorse or promote products derived from this software without specific
  *    prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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.
  *
  * RiscBSD kernel project
  *
  * cpu.c
  *
  * Probing and configuration for the master CPU
  *
  * Created      : 10/10/95
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 
 char machine[] = "arm";
 
 SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
 	machine, 0, "Machine class");
 
 static const char * const generic_steppings[16] = {
 	"rev 0",	"rev 1",	"rev 2",	"rev 3",
 	"rev 4",	"rev 5",	"rev 6",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 static const char * const xscale_steppings[16] = {
 	"step A-0",	"step A-1",	"step B-0",	"step C-0",
 	"step D-0",	"rev 5",	"rev 6",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 static const char * const i80219_steppings[16] = {
 	"step A-0",	"rev 1",	"rev 2",	"rev 3",
 	"rev 4",	"rev 5",	"rev 6",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 static const char * const i80321_steppings[16] = {
 	"step A-0",	"step B-0",	"rev 2",	"rev 3",
 	"rev 4",	"rev 5",	"rev 6",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 static const char * const i81342_steppings[16] = {
 	"step A-0",	"rev 1",	"rev 2",	"rev 3",
 	"rev 4",	"rev 5",	"rev 6",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 /* Steppings for PXA2[15]0 */
 static const char * const pxa2x0_steppings[16] = {
 	"step A-0",	"step A-1",	"step B-0",	"step B-1",
 	"step B-2",	"step C-0",	"rev 6",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 /* Steppings for PXA255/26x.
  * rev 5: PXA26x B0, rev 6: PXA255 A0
  */
 static const char * const pxa255_steppings[16] = {
 	"rev 0",	"rev 1",	"rev 2",	"step A-0",
 	"rev 4",	"step B-0",	"step A-0",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 /* Stepping for PXA27x */
 static const char * const pxa27x_steppings[16] = {
 	"step A-0",	"step A-1",	"step B-0",	"step B-1",
 	"step C-0",	"rev 5",	"rev 6",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 static const char * const ixp425_steppings[16] = {
 	"step 0 (A0)",	"rev 1 (ARMv5TE)", "rev 2",	"rev 3",
 	"rev 4",	"rev 5",	"rev 6",	"rev 7",
 	"rev 8",	"rev 9",	"rev 10",	"rev 11",
 	"rev 12",	"rev 13",	"rev 14",	"rev 15",
 };
 
 struct cpuidtab {
 	u_int32_t	cpuid;
 	enum		cpu_class cpu_class;
 	const char	*cpu_name;
 	const char * const *cpu_steppings;
 };
 
 const struct cpuidtab cpuids[] = {
 	{ CPU_ID_ARM920T,	CPU_CLASS_ARM9TDMI,	"ARM920T",
 	  generic_steppings },
 	{ CPU_ID_ARM920T_ALT,	CPU_CLASS_ARM9TDMI,	"ARM920T",
 	  generic_steppings },
 	{ CPU_ID_ARM922T,	CPU_CLASS_ARM9TDMI,	"ARM922T",
 	  generic_steppings },
 	{ CPU_ID_ARM926EJS,	CPU_CLASS_ARM9EJS,	"ARM926EJ-S",
 	  generic_steppings },
 	{ CPU_ID_ARM940T,	CPU_CLASS_ARM9TDMI,	"ARM940T",
 	  generic_steppings },
 	{ CPU_ID_ARM946ES,	CPU_CLASS_ARM9ES,	"ARM946E-S",
 	  generic_steppings },
 	{ CPU_ID_ARM966ES,	CPU_CLASS_ARM9ES,	"ARM966E-S",
 	  generic_steppings },
 	{ CPU_ID_ARM966ESR1,	CPU_CLASS_ARM9ES,	"ARM966E-S",
 	  generic_steppings },
 	{ CPU_ID_FA526,		CPU_CLASS_ARM9TDMI,	"FA526",
 	  generic_steppings },
 	{ CPU_ID_FA626TE,	CPU_CLASS_ARM9ES,	"FA626TE",
 	  generic_steppings },
 
 	{ CPU_ID_TI925T,	CPU_CLASS_ARM9TDMI,	"TI ARM925T",
 	  generic_steppings },
 
 	{ CPU_ID_ARM1020E,	CPU_CLASS_ARM10E,	"ARM1020E",
 	  generic_steppings },
 	{ CPU_ID_ARM1022ES,	CPU_CLASS_ARM10E,	"ARM1022E-S",
 	  generic_steppings },
 	{ CPU_ID_ARM1026EJS,	CPU_CLASS_ARM10EJ,	"ARM1026EJ-S",
 	  generic_steppings },
 
 	{ CPU_ID_CORTEXA5,	CPU_CLASS_CORTEXA,	"Cortex A5",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA7,	CPU_CLASS_CORTEXA,	"Cortex A7",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA8R1,	CPU_CLASS_CORTEXA,	"Cortex A8-r1",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA8R2,	CPU_CLASS_CORTEXA,	"Cortex A8-r2",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA8R3,	CPU_CLASS_CORTEXA,	"Cortex A8-r3",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA9R1,	CPU_CLASS_CORTEXA,	"Cortex A9-r1",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA9R2,	CPU_CLASS_CORTEXA,	"Cortex A9-r2",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA9R3,	CPU_CLASS_CORTEXA,	"Cortex A9-r3",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA15R0,	CPU_CLASS_CORTEXA,	"Cortex A15-r0",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA15R1,	CPU_CLASS_CORTEXA,	"Cortex A15-r1",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA15R2,	CPU_CLASS_CORTEXA,	"Cortex A15-r2",
 	  generic_steppings },
 	{ CPU_ID_CORTEXA15R3,	CPU_CLASS_CORTEXA,	"Cortex A15-r3",
 	  generic_steppings },
 	{ CPU_ID_KRAIT,		CPU_CLASS_KRAIT,	"Krait",
 	  generic_steppings },
 
 	{ CPU_ID_80200,		CPU_CLASS_XSCALE,	"i80200",
 	  xscale_steppings },
 
 	{ CPU_ID_80321_400,	CPU_CLASS_XSCALE,	"i80321 400MHz",
 	  i80321_steppings },
 	{ CPU_ID_80321_600,	CPU_CLASS_XSCALE,	"i80321 600MHz",
 	  i80321_steppings },
 	{ CPU_ID_80321_400_B0,	CPU_CLASS_XSCALE,	"i80321 400MHz",
 	  i80321_steppings },
 	{ CPU_ID_80321_600_B0,	CPU_CLASS_XSCALE,	"i80321 600MHz",
 	  i80321_steppings },
 
 	{ CPU_ID_81342,		CPU_CLASS_XSCALE,	"i81342",
 	  i81342_steppings },
 
 	{ CPU_ID_80219_400,	CPU_CLASS_XSCALE,	"i80219 400MHz",
 	  i80219_steppings },
 	{ CPU_ID_80219_600,	CPU_CLASS_XSCALE,	"i80219 600MHz",
 	  i80219_steppings },
 
 	{ CPU_ID_PXA27X,	CPU_CLASS_XSCALE,	"PXA27x",
 	  pxa27x_steppings },
 	{ CPU_ID_PXA250A,	CPU_CLASS_XSCALE,	"PXA250",
 	  pxa2x0_steppings },
 	{ CPU_ID_PXA210A,	CPU_CLASS_XSCALE,	"PXA210",
 	  pxa2x0_steppings },
 	{ CPU_ID_PXA250B,	CPU_CLASS_XSCALE,	"PXA250",
 	  pxa2x0_steppings },
 	{ CPU_ID_PXA210B,	CPU_CLASS_XSCALE,	"PXA210",
 	  pxa2x0_steppings },
 	{ CPU_ID_PXA250C, 	CPU_CLASS_XSCALE,	"PXA255",
 	  pxa255_steppings },
 	{ CPU_ID_PXA210C, 	CPU_CLASS_XSCALE,	"PXA210",
 	  pxa2x0_steppings },
 
 	{ CPU_ID_IXP425_533,	CPU_CLASS_XSCALE,	"IXP425 533MHz",
 	  ixp425_steppings },
 	{ CPU_ID_IXP425_400,	CPU_CLASS_XSCALE,	"IXP425 400MHz",
 	  ixp425_steppings },
 	{ CPU_ID_IXP425_266,	CPU_CLASS_XSCALE,	"IXP425 266MHz",
 	  ixp425_steppings },
 
 	/* XXX ixp435 steppings? */
 	{ CPU_ID_IXP435,	CPU_CLASS_XSCALE,	"IXP435",
 	  ixp425_steppings },
 
 	{ CPU_ID_ARM1136JS,	CPU_CLASS_ARM11J,	"ARM1136J-S",
 	  generic_steppings },
 	{ CPU_ID_ARM1136JSR1,	CPU_CLASS_ARM11J,	"ARM1136J-S R1",
 	  generic_steppings },
 	{ CPU_ID_ARM1176JZS,	CPU_CLASS_ARM11J,	"ARM1176JZ-S",
 	  generic_steppings },
 
 	{ CPU_ID_MV88FR131,	CPU_CLASS_MARVELL,	"Feroceon 88FR131",
 	  generic_steppings },
 
 	{ CPU_ID_MV88FR571_VD,	CPU_CLASS_MARVELL,	"Feroceon 88FR571-VD",
 	  generic_steppings },
 	{ CPU_ID_MV88SV581X_V7,	CPU_CLASS_MARVELL,	"Sheeva 88SV581x",
 	  generic_steppings },
 	{ CPU_ID_ARM_88SV581X_V7, CPU_CLASS_MARVELL,	"Sheeva 88SV581x",
 	  generic_steppings },
 	{ CPU_ID_MV88SV584X_V7,	CPU_CLASS_MARVELL,	"Sheeva 88SV584x",
 	  generic_steppings },
 
 	{ 0, CPU_CLASS_NONE, NULL, NULL }
 };
 
 struct cpu_classtab {
 	const char	*class_name;
 	const char	*class_option;
 };
 
 const struct cpu_classtab cpu_classes[] = {
 	{ "unknown",	NULL },			/* CPU_CLASS_NONE */
 	{ "ARM9TDMI",	"CPU_ARM9TDMI" },	/* CPU_CLASS_ARM9TDMI */
 	{ "ARM9E-S",	"CPU_ARM9E" },		/* CPU_CLASS_ARM9ES */
 	{ "ARM9EJ-S",	"CPU_ARM9E" },		/* CPU_CLASS_ARM9EJS */
 	{ "ARM10E",	"CPU_ARM10" },		/* CPU_CLASS_ARM10E */
 	{ "ARM10EJ",	"CPU_ARM10" },		/* CPU_CLASS_ARM10EJ */
 	{ "Cortex-A",	"CPU_CORTEXA" },	/* CPU_CLASS_CORTEXA */
 	{ "Krait",	"CPU_KRAIT" },		/* CPU_CLASS_KRAIT */
 	{ "XScale",	"CPU_XSCALE_..." },	/* CPU_CLASS_XSCALE */
 	{ "ARM11J",	"CPU_ARM11" },		/* CPU_CLASS_ARM11J */
 	{ "Marvell",	"CPU_MARVELL" },	/* CPU_CLASS_MARVELL */
 };
 
 /*
  * Report the type of the specified arm processor. This uses the generic and
  * arm specific information in the cpu structure to identify the processor.
  * The remaining fields in the cpu structure are filled in appropriately.
  */
 
 static const char * const wtnames[] = {
 	"write-through",
 	"write-back",
 	"write-back",
 	"**unknown 3**",
 	"**unknown 4**",
 	"write-back-locking",		/* XXX XScale-specific? */
 	"write-back-locking-A",
 	"write-back-locking-B",
 	"**unknown 8**",
 	"**unknown 9**",
 	"**unknown 10**",
 	"**unknown 11**",
 	"**unknown 12**",
 	"**unknown 13**",
 	"write-back-locking-C",
 	"**unknown 15**",
 };
 
 static void
 print_enadis(int enadis, char *s)
 {
 
 	printf(" %s %sabled", s, (enadis == 0) ? "dis" : "en");
 }
 
 extern int ctrl;
 enum cpu_class cpu_class = CPU_CLASS_NONE;
 
 u_int cpu_pfr(int num)
 {
 	u_int feat;
 
 	switch (num) {
 	case 0:
 		__asm __volatile("mrc p15, 0, %0, c0, c1, 0"
 		    : "=r" (feat));
 		break;
 	case 1:
 		__asm __volatile("mrc p15, 0, %0, c0, c1, 1"
 		    : "=r" (feat));
 		break;
 	default:
 		panic("Processor Feature Register %d not implemented", num);
 		break;
 	}
 
 	return (feat);
 }
 
 static
 void identify_armv7(void)
 {
 	u_int feature;
 
 	printf("Supported features:");
 	/* Get Processor Feature Register 0 */
 	feature = cpu_pfr(0);
 
 	if (feature & ARM_PFR0_ARM_ISA_MASK)
 		printf(" ARM_ISA");
 
 	if (feature & ARM_PFR0_THUMB2)
 		printf(" THUMB2");
 	else if (feature & ARM_PFR0_THUMB)
 		printf(" THUMB");
 
 	if (feature & ARM_PFR0_JAZELLE_MASK)
 		printf(" JAZELLE");
 
 	if (feature & ARM_PFR0_THUMBEE_MASK)
 		printf(" THUMBEE");
 
 
 	/* Get Processor Feature Register 1 */
 	feature = cpu_pfr(1);
 
 	if (feature & ARM_PFR1_ARMV4_MASK)
 		printf(" ARMv4");
 
 	if (feature & ARM_PFR1_SEC_EXT_MASK)
 		printf(" Security_Ext");
 
 	if (feature & ARM_PFR1_MICROCTRL_MASK)
 		printf(" M_profile");
 
 	printf("\n");
 }
 
 void
 identify_arm_cpu(void)
 {
 	u_int cpuid, reg, size, sets, ways;
 	u_int8_t type, linesize;
 	int i;
 
 	cpuid = cpu_id();
 
 	if (cpuid == 0) {
 		printf("Processor failed probe - no CPU ID\n");
 		return;
 	}
 
 	for (i = 0; cpuids[i].cpuid != 0; i++)
 		if (cpuids[i].cpuid == (cpuid & CPU_ID_CPU_MASK)) {
 			cpu_class = cpuids[i].cpu_class;
 			printf("CPU: %s %s (%s core)\n",
 			    cpuids[i].cpu_name,
 			    cpuids[i].cpu_steppings[cpuid &
 			    CPU_ID_REVISION_MASK],
 			    cpu_classes[cpu_class].class_name);
 			break;
 		}
 	if (cpuids[i].cpuid == 0)
 		printf("unknown CPU (ID = 0x%x)\n", cpuid);
 
 	printf(" ");
 
 	if ((cpuid & CPU_ID_ARCH_MASK) == CPU_ID_CPUID_SCHEME) {
 		identify_armv7();
 	} else {
 		if (ctrl & CPU_CONTROL_BEND_ENABLE)
 			printf(" Big-endian");
 		else
 			printf(" Little-endian");
 
 		switch (cpu_class) {
 		case CPU_CLASS_ARM9TDMI:
 		case CPU_CLASS_ARM9ES:
 		case CPU_CLASS_ARM9EJS:
 		case CPU_CLASS_ARM10E:
 		case CPU_CLASS_ARM10EJ:
 		case CPU_CLASS_XSCALE:
 		case CPU_CLASS_ARM11J:
 		case CPU_CLASS_MARVELL:
 			print_enadis(ctrl & CPU_CONTROL_DC_ENABLE, "DC");
 			print_enadis(ctrl & CPU_CONTROL_IC_ENABLE, "IC");
 #ifdef CPU_XSCALE_81342
 			print_enadis(ctrl & CPU_CONTROL_L2_ENABLE, "L2");
 #endif
 #if defined(SOC_MV_KIRKWOOD) || defined(SOC_MV_DISCOVERY)
 			i = sheeva_control_ext(0, 0);
 			print_enadis(i & MV_WA_ENABLE, "WA");
 			print_enadis(i & MV_DC_STREAM_ENABLE, "DC streaming");
 			printf("\n ");
 			print_enadis((i & MV_BTB_DISABLE) == 0, "BTB");
 			print_enadis(i & MV_L2_ENABLE, "L2");
 			print_enadis((i & MV_L2_PREFETCH_DISABLE) == 0,
 			    "L2 prefetch");
 			printf("\n ");
 #endif
 			break;
 		default:
 			break;
 		}
 	}
 
 	print_enadis(ctrl & CPU_CONTROL_WBUF_ENABLE, "WB");
 	if (ctrl & CPU_CONTROL_LABT_ENABLE)
 		printf(" LABT");
 	else
 		printf(" EABT");
 
 	print_enadis(ctrl & CPU_CONTROL_BPRD_ENABLE, "branch prediction");
 	printf("\n");
 
 	if (arm_cache_level) {
 		printf("LoUU:%d LoC:%d LoUIS:%d \n", CPU_CLIDR_LOUU(arm_cache_level) + 1,
-		    arm_cache_loc, CPU_CLIDR_LOUIS(arm_cache_level) + 1);
+		    arm_cache_loc + 1, CPU_CLIDR_LOUIS(arm_cache_level) + 1);
 		i = 0;
 		while (((type = CPU_CLIDR_CTYPE(arm_cache_level, i)) != 0) && i < 7) {
 			printf("Cache level %d: \n", i + 1);
 			if (type == CACHE_DCACHE || type == CACHE_UNI_CACHE ||
 			    type == CACHE_SEP_CACHE) {
 				reg = arm_cache_type[2 * i];
 				ways = CPUV7_CT_xSIZE_ASSOC(reg) + 1;
 				sets = CPUV7_CT_xSIZE_SET(reg) + 1;
 				linesize = 1 << (CPUV7_CT_xSIZE_LEN(reg) + 4);
 				size = (ways * sets * linesize) / 1024;
 
 				if (type == CACHE_UNI_CACHE)
 					printf(" %dKB/%dB %d-way unified cache", size, linesize,ways);
 				else
 					printf(" %dKB/%dB %d-way data cache", size, linesize, ways);
 				if (reg & CPUV7_CT_CTYPE_WT)
 					printf(" WT");
 				if (reg & CPUV7_CT_CTYPE_WB)
 					printf(" WB");
 				if (reg & CPUV7_CT_CTYPE_RA)
 					printf(" Read-Alloc");
 				if (reg & CPUV7_CT_CTYPE_WA)
 					printf(" Write-Alloc");
 				printf("\n");
 			}
 
 			if (type == CACHE_ICACHE || type == CACHE_SEP_CACHE) {
 				reg = arm_cache_type[(2 * i) + 1];
 
 				ways = CPUV7_CT_xSIZE_ASSOC(reg) + 1;
 				sets = CPUV7_CT_xSIZE_SET(reg) + 1;
 				linesize = 1 << (CPUV7_CT_xSIZE_LEN(reg) + 4);
 				size = (ways * sets * linesize) / 1024;
 
 				printf(" %dKB/%dB %d-way instruction cache", size, linesize, ways);
 				if (reg & CPUV7_CT_CTYPE_WT)
 					printf(" WT");
 				if (reg & CPUV7_CT_CTYPE_WB)
 					printf(" WB");
 				if (reg & CPUV7_CT_CTYPE_RA)
 					printf(" Read-Alloc");
 				if (reg & CPUV7_CT_CTYPE_WA)
 					printf(" Write-Alloc");
 				printf("\n");
 			}
 			i++;
 		}
 	} else {
 		/* Print cache info. */
 		if (arm_picache_line_size == 0 && arm_pdcache_line_size == 0)
 			return;
 
 		if (arm_pcache_unified) {
 			printf("  %dKB/%dB %d-way %s unified cache\n",
 			    arm_pdcache_size / 1024,
 			    arm_pdcache_line_size, arm_pdcache_ways,
 			    wtnames[arm_pcache_type]);
 		} else {
 			printf("  %dKB/%dB %d-way instruction cache\n",
 			    arm_picache_size / 1024,
 			    arm_picache_line_size, arm_picache_ways);
 			printf("  %dKB/%dB %d-way %s data cache\n",
 			    arm_pdcache_size / 1024,
 			    arm_pdcache_line_size, arm_pdcache_ways,
 			    wtnames[arm_pcache_type]);
 		}
 	}
 }
Index: projects/arm_intrng/sys/arm/arm/machdep.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/machdep.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/machdep.c	(revision 276248)
@@ -1,1312 +1,1316 @@
 /*	$NetBSD: arm32_machdep.c,v 1.44 2004/03/24 15:34:47 atatat Exp $	*/
 
 /*-
  * Copyright (c) 2004 Olivier Houchard
  * Copyright (c) 1994-1998 Mark Brinicombe.
  * Copyright (c) 1994 Brini.
  * All rights reserved.
  *
  * This code is derived from software written for Brini by Mark Brinicombe
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by Mark Brinicombe
  *	for the NetBSD Project.
  * 4. The name of the company nor the name of the author may be used to
  *    endorse or promote products derived from this software without specific
  *    prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
  *
  * Machine dependant functions for kernel setup
  *
  * Created      : 17/09/94
  * Updated	: 18/04/01 updated for new wscons
  */
 
 #include "opt_compat.h"
 #include "opt_ddb.h"
 #include "opt_platform.h"
 #include "opt_sched.h"
 #include "opt_timer.h"
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #ifdef FDT
 #include 
 #include 
 #endif
 
 #ifdef DDB
 #include 
 #endif
 
 #ifdef DEBUG
 #define	debugf(fmt, args...) printf(fmt, ##args)
 #else
 #define	debugf(fmt, args...)
 #endif
 
 struct pcpu __pcpu[MAXCPU];
 struct pcpu *pcpup = &__pcpu[0];
 
 static struct trapframe proc0_tf;
 uint32_t cpu_reset_address = 0;
 int cold = 1;
 vm_offset_t vector_page;
 
 int (*_arm_memcpy)(void *, void *, int, int) = NULL;
 int (*_arm_bzero)(void *, int, int) = NULL;
 int _min_memcpy_size = 0;
 int _min_bzero_size = 0;
 
 extern int *end;
 
 #ifdef FDT
 /*
  * This is the number of L2 page tables required for covering max
  * (hypothetical) memsize of 4GB and all kernel mappings (vectors, msgbuf,
  * stacks etc.), uprounded to be divisible by 4.
  */
 #define KERNEL_PT_MAX	78
 
 static struct pv_addr kernel_pt_table[KERNEL_PT_MAX];
 
 vm_paddr_t pmap_pa;
 
 struct pv_addr systempage;
 static struct pv_addr msgbufpv;
 struct pv_addr irqstack;
 struct pv_addr undstack;
 struct pv_addr abtstack;
 static struct pv_addr kernelstack;
 
 #endif
 
 #if defined(LINUX_BOOT_ABI)
 #define LBABI_MAX_BANKS	10
 
 uint32_t board_id;
 struct arm_lbabi_tag *atag_list;
 char linux_command_line[LBABI_MAX_COMMAND_LINE + 1];
 char atags[LBABI_MAX_COMMAND_LINE * 2];
 uint32_t memstart[LBABI_MAX_BANKS];
 uint32_t memsize[LBABI_MAX_BANKS];
 uint32_t membanks;
 #endif
 
 static uint32_t board_revision;
 /* hex representation of uint64_t */
 static char board_serial[32];
 
 SYSCTL_NODE(_hw, OID_AUTO, board, CTLFLAG_RD, 0, "Board attributes");
 SYSCTL_UINT(_hw_board, OID_AUTO, revision, CTLFLAG_RD,
     &board_revision, 0, "Board revision");
 SYSCTL_STRING(_hw_board, OID_AUTO, serial, CTLFLAG_RD,
     board_serial, 0, "Board serial");
 
 int vfp_exists;
 SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
     &vfp_exists, 0, "Floating point support enabled");
 
 void
 board_set_serial(uint64_t serial)
 {
 
 	snprintf(board_serial, sizeof(board_serial)-1, 
 		    "%016jx", serial);
 }
 
 void
 board_set_revision(uint32_t revision)
 {
 
 	board_revision = revision;
 }
 
 void
 sendsig(catcher, ksi, mask)
 	sig_t catcher;
 	ksiginfo_t *ksi;
 	sigset_t *mask;
 {
 	struct thread *td;
 	struct proc *p;
 	struct trapframe *tf;
 	struct sigframe *fp, frame;
 	struct sigacts *psp;
 	int onstack;
 	int sig;
 	int code;
 
 	td = curthread;
 	p = td->td_proc;
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	sig = ksi->ksi_signo;
 	code = ksi->ksi_code;
 	psp = p->p_sigacts;
 	mtx_assert(&psp->ps_mtx, MA_OWNED);
 	tf = td->td_frame;
 	onstack = sigonstack(tf->tf_usr_sp);
 
 	CTR4(KTR_SIG, "sendsig: td=%p (%s) catcher=%p sig=%d", td, p->p_comm,
 	    catcher, sig);
 
 	/* Allocate and validate space for the signal handler context. */
 	if ((td->td_pflags & TDP_ALTSTACK) != 0 && !(onstack) &&
 	    SIGISMEMBER(psp->ps_sigonstack, sig)) {
 		fp = (struct sigframe *)(td->td_sigstk.ss_sp +
 		    td->td_sigstk.ss_size);
 #if defined(COMPAT_43)
 		td->td_sigstk.ss_flags |= SS_ONSTACK;
 #endif
 	} else
 		fp = (struct sigframe *)td->td_frame->tf_usr_sp;
 
 	/* make room on the stack */
 	fp--;
 	
 	/* make the stack aligned */
 	fp = (struct sigframe *)STACKALIGN(fp);
 	/* Populate the siginfo frame. */
 	get_mcontext(td, &frame.sf_uc.uc_mcontext, 0);
 	frame.sf_si = ksi->ksi_info;
 	frame.sf_uc.uc_sigmask = *mask;
 	frame.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK )
 	    ? ((onstack) ? SS_ONSTACK : 0) : SS_DISABLE;
 	frame.sf_uc.uc_stack = td->td_sigstk;
 	mtx_unlock(&psp->ps_mtx);
 	PROC_UNLOCK(td->td_proc);
 
 	/* Copy the sigframe out to the user's stack. */
 	if (copyout(&frame, fp, sizeof(*fp)) != 0) {
 		/* Process has trashed its stack. Kill it. */
 		CTR2(KTR_SIG, "sendsig: sigexit td=%p fp=%p", td, fp);
 		PROC_LOCK(p);
 		sigexit(td, SIGILL);
 	}
 
 	/* Translate the signal if appropriate. */
 	if (p->p_sysent->sv_sigtbl && sig <= p->p_sysent->sv_sigsize)
 		sig = p->p_sysent->sv_sigtbl[_SIG_IDX(sig)];
 
 	/*
 	 * Build context to run handler in.  We invoke the handler
 	 * directly, only returning via the trampoline.  Note the
 	 * trampoline version numbers are coordinated with machine-
 	 * dependent code in libc.
 	 */
 	
 	tf->tf_r0 = sig;
 	tf->tf_r1 = (register_t)&fp->sf_si;
 	tf->tf_r2 = (register_t)&fp->sf_uc;
 
 	/* the trampoline uses r5 as the uc address */
 	tf->tf_r5 = (register_t)&fp->sf_uc;
 	tf->tf_pc = (register_t)catcher;
 	tf->tf_usr_sp = (register_t)fp;
 	tf->tf_usr_lr = (register_t)(PS_STRINGS - *(p->p_sysent->sv_szsigcode));
 
 	CTR3(KTR_SIG, "sendsig: return td=%p pc=%#x sp=%#x", td, tf->tf_usr_lr,
 	    tf->tf_usr_sp);
 
 	PROC_LOCK(p);
 	mtx_lock(&psp->ps_mtx);
 }
 
 struct kva_md_info kmi;
 
 /*
  * arm32_vector_init:
  *
  *	Initialize the vector page, and select whether or not to
  *	relocate the vectors.
  *
  *	NOTE: We expect the vector page to be mapped at its expected
  *	destination.
  */
 
 extern unsigned int page0[], page0_data[];
 void
 arm_vector_init(vm_offset_t va, int which)
 {
 	unsigned int *vectors = (int *) va;
 	unsigned int *vectors_data = vectors + (page0_data - page0);
 	int vec;
 
 	/*
 	 * Loop through the vectors we're taking over, and copy the
 	 * vector's insn and data word.
 	 */
 	for (vec = 0; vec < ARM_NVEC; vec++) {
 		if ((which & (1 << vec)) == 0) {
 			/* Don't want to take over this vector. */
 			continue;
 		}
 		vectors[vec] = page0[vec];
 		vectors_data[vec] = page0_data[vec];
 	}
 
 	/* Now sync the vectors. */
 	cpu_icache_sync_range(va, (ARM_NVEC * 2) * sizeof(u_int));
 
 	vector_page = va;
 
 	if (va == ARM_VECTORS_HIGH) {
 		/*
 		 * Assume the MD caller knows what it's doing here, and
 		 * really does want the vector page relocated.
 		 *
 		 * Note: This has to be done here (and not just in
 		 * cpu_setup()) because the vector page needs to be
 		 * accessible *before* cpu_startup() is called.
 		 * Think ddb(9) ...
 		 *
 		 * NOTE: If the CPU control register is not readable,
 		 * this will totally fail!  We'll just assume that
 		 * any system that has high vector support has a
 		 * readable CPU control register, for now.  If we
 		 * ever encounter one that does not, we'll have to
 		 * rethink this.
 		 */
 		cpu_control(CPU_CONTROL_VECRELOC, CPU_CONTROL_VECRELOC);
 	}
 }
 
 static void
 cpu_startup(void *dummy)
 {
 	struct pcb *pcb = thread0.td_pcb;
 	const unsigned int mbyte = 1024 * 1024;
 #ifdef ARM_TP_ADDRESS
 #ifndef ARM_CACHE_LOCK_ENABLE
 	vm_page_t m;
 #endif
 #endif
 
 	identify_arm_cpu();
 
 	vm_ksubmap_init(&kmi);
 
 	/*
 	 * Display the RAM layout.
 	 */
 	printf("real memory  = %ju (%ju MB)\n", 
 	    (uintmax_t)arm32_ptob(realmem),
 	    (uintmax_t)arm32_ptob(realmem) / mbyte);
 	printf("avail memory = %ju (%ju MB)\n",
 	    (uintmax_t)arm32_ptob(vm_cnt.v_free_count),
 	    (uintmax_t)arm32_ptob(vm_cnt.v_free_count) / mbyte);
 	if (bootverbose) {
 		arm_physmem_print_tables();
 		arm_devmap_print_table();
 	}
 
 	bufinit();
 	vm_pager_bufferinit();
-	pcb->un_32.pcb32_sp = (u_int)thread0.td_kstack +
+	pcb->pcb_regs.sf_sp = (u_int)thread0.td_kstack +
 	    USPACE_SVC_STACK_TOP;
 	vector_page_setprot(VM_PROT_READ);
 	pmap_set_pcb_pagedir(pmap_kernel(), pcb);
 	pmap_postinit();
 #ifdef ARM_TP_ADDRESS
 #ifdef ARM_CACHE_LOCK_ENABLE
 	pmap_kenter_user(ARM_TP_ADDRESS, ARM_TP_ADDRESS);
 	arm_lock_cache_line(ARM_TP_ADDRESS);
 #else
 	m = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_ZERO);
 	pmap_kenter_user(ARM_TP_ADDRESS, VM_PAGE_TO_PHYS(m));
 #endif
 	*(uint32_t *)ARM_RAS_START = 0;
 	*(uint32_t *)ARM_RAS_END = 0xffffffff;
 #endif
 }
 
 SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
 
 /*
  * Flush the D-cache for non-DMA I/O so that the I-cache can
  * be made coherent later.
  */
 void
 cpu_flush_dcache(void *ptr, size_t len)
 {
 
 	cpu_dcache_wb_range((uintptr_t)ptr, len);
 #ifdef ARM_L2_PIPT
 	cpu_l2cache_wb_range((uintptr_t)vtophys(ptr), len);
 #else
 	cpu_l2cache_wb_range((uintptr_t)ptr, len);
 #endif
 }
 
 /* Get current clock frequency for the given cpu id. */
 int
 cpu_est_clockrate(int cpu_id, uint64_t *rate)
 {
 
 	return (ENXIO);
 }
 
 void
 cpu_idle(int busy)
 {
 	
 	CTR2(KTR_SPARE2, "cpu_idle(%d) at %d", busy, curcpu);
 	spinlock_enter();
 #ifndef NO_EVENTTIMERS
 	if (!busy)
 		cpu_idleclock();
 #endif
 	if (!sched_runnable())
 		cpu_sleep(0);
 #ifndef NO_EVENTTIMERS
 	if (!busy)
 		cpu_activeclock();
 #endif
 	spinlock_exit();
 	CTR2(KTR_SPARE2, "cpu_idle(%d) at %d done", busy, curcpu);
 }
 
 int
 cpu_idle_wakeup(int cpu)
 {
 
 	return (0);
 }
 
 /*
  * Most ARM platforms don't need to do anything special to init their clocks
  * (they get intialized during normal device attachment), and by not defining a
  * cpu_initclocks() function they get this generic one.  Any platform that needs
  * to do something special can just provide their own implementation, which will
  * override this one due to the weak linkage.
  */
 void
 arm_generic_initclocks(void)
 {
 
 #ifndef NO_EVENTTIMERS
 #ifdef SMP
 	if (PCPU_GET(cpuid) == 0)
 		cpu_initclocks_bsp();
 	else
 		cpu_initclocks_ap();
 #else
 	cpu_initclocks_bsp();
 #endif
 #endif
 }
 __weak_reference(arm_generic_initclocks, cpu_initclocks);
 
 int
 fill_regs(struct thread *td, struct reg *regs)
 {
 	struct trapframe *tf = td->td_frame;
 	bcopy(&tf->tf_r0, regs->r, sizeof(regs->r));
 	regs->r_sp = tf->tf_usr_sp;
 	regs->r_lr = tf->tf_usr_lr;
 	regs->r_pc = tf->tf_pc;
 	regs->r_cpsr = tf->tf_spsr;
 	return (0);
 }
 int
 fill_fpregs(struct thread *td, struct fpreg *regs)
 {
 	bzero(regs, sizeof(*regs));
 	return (0);
 }
 
 int
 set_regs(struct thread *td, struct reg *regs)
 {
 	struct trapframe *tf = td->td_frame;
 	
 	bcopy(regs->r, &tf->tf_r0, sizeof(regs->r));
 	tf->tf_usr_sp = regs->r_sp;
 	tf->tf_usr_lr = regs->r_lr;
 	tf->tf_pc = regs->r_pc;
 	tf->tf_spsr &=  ~PSR_FLAGS;
 	tf->tf_spsr |= regs->r_cpsr & PSR_FLAGS;
 	return (0);								
 }
 
 int
 set_fpregs(struct thread *td, struct fpreg *regs)
 {
 	return (0);
 }
 
 int
 fill_dbregs(struct thread *td, struct dbreg *regs)
 {
 	return (0);
 }
 int
 set_dbregs(struct thread *td, struct dbreg *regs)
 {
 	return (0);
 }
 
 
 static int
 ptrace_read_int(struct thread *td, vm_offset_t addr, u_int32_t *v)
 {
 	struct iovec iov;
 	struct uio uio;
 
 	PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED);
 	iov.iov_base = (caddr_t) v;
 	iov.iov_len = sizeof(u_int32_t);
 	uio.uio_iov = &iov;
 	uio.uio_iovcnt = 1;
 	uio.uio_offset = (off_t)addr;
 	uio.uio_resid = sizeof(u_int32_t);
 	uio.uio_segflg = UIO_SYSSPACE;
 	uio.uio_rw = UIO_READ;
 	uio.uio_td = td;
 	return proc_rwmem(td->td_proc, &uio);
 }
 
 static int
 ptrace_write_int(struct thread *td, vm_offset_t addr, u_int32_t v)
 {
 	struct iovec iov;
 	struct uio uio;
 
 	PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED);
 	iov.iov_base = (caddr_t) &v;
 	iov.iov_len = sizeof(u_int32_t);
 	uio.uio_iov = &iov;
 	uio.uio_iovcnt = 1;
 	uio.uio_offset = (off_t)addr;
 	uio.uio_resid = sizeof(u_int32_t);
 	uio.uio_segflg = UIO_SYSSPACE;
 	uio.uio_rw = UIO_WRITE;
 	uio.uio_td = td;
 	return proc_rwmem(td->td_proc, &uio);
 }
 
 int
 ptrace_single_step(struct thread *td)
 {
 	struct proc *p;
 	int error;
 	
 	KASSERT(td->td_md.md_ptrace_instr == 0,
 	 ("Didn't clear single step"));
 	p = td->td_proc;
 	PROC_UNLOCK(p);
 	error = ptrace_read_int(td, td->td_frame->tf_pc + 4,
 	    &td->td_md.md_ptrace_instr);
 	if (error)
 		goto out;
 	error = ptrace_write_int(td, td->td_frame->tf_pc + 4,
 	    PTRACE_BREAKPOINT);
 	if (error)
 		td->td_md.md_ptrace_instr = 0;
 	td->td_md.md_ptrace_addr = td->td_frame->tf_pc + 4;
 out:
 	PROC_LOCK(p);
 	return (error);
 }
 
 int
 ptrace_clear_single_step(struct thread *td)
 {
 	struct proc *p;
 
 	if (td->td_md.md_ptrace_instr) {
 		p = td->td_proc;
 		PROC_UNLOCK(p);
 		ptrace_write_int(td, td->td_md.md_ptrace_addr,
 		    td->td_md.md_ptrace_instr);
 		PROC_LOCK(p);
 		td->td_md.md_ptrace_instr = 0;
 	}
 	return (0);
 }
 
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {
 	td->td_frame->tf_pc = addr;
 	return (0);
 }
 
 void
 cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
 {
 }
 
 void
 spinlock_enter(void)
 {
 	struct thread *td;
 	register_t cspr;
 
 	td = curthread;
 	if (td->td_md.md_spinlock_count == 0) {
 		cspr = disable_interrupts(PSR_I | PSR_F);
 		td->td_md.md_spinlock_count = 1;
 		td->td_md.md_saved_cspr = cspr;
 	} else
 		td->td_md.md_spinlock_count++;
 	critical_enter();
 }
 
 void
 spinlock_exit(void)
 {
 	struct thread *td;
 	register_t cspr;
 
 	td = curthread;
 	critical_exit();
 	cspr = td->td_md.md_saved_cspr;
 	td->td_md.md_spinlock_count--;
 	if (td->td_md.md_spinlock_count == 0)
 		restore_interrupts(cspr);
 }
 
 /*
  * Clear registers on exec
  */
 void
 exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
 {
 	struct trapframe *tf = td->td_frame;
 
 	memset(tf, 0, sizeof(*tf));
 	tf->tf_usr_sp = stack;
 	tf->tf_usr_lr = imgp->entry_addr;
 	tf->tf_svc_lr = 0x77777777;
 	tf->tf_pc = imgp->entry_addr;
 	tf->tf_spsr = PSR_USR32_MODE;
 }
 
 /*
  * Get machine context.
  */
 int
 get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret)
 {
 	struct trapframe *tf = td->td_frame;
 	__greg_t *gr = mcp->__gregs;
 
 	if (clear_ret & GET_MC_CLEAR_RET)
 		gr[_REG_R0] = 0;
 	else
 		gr[_REG_R0]   = tf->tf_r0;
 	gr[_REG_R1]   = tf->tf_r1;
 	gr[_REG_R2]   = tf->tf_r2;
 	gr[_REG_R3]   = tf->tf_r3;
 	gr[_REG_R4]   = tf->tf_r4;
 	gr[_REG_R5]   = tf->tf_r5;
 	gr[_REG_R6]   = tf->tf_r6;
 	gr[_REG_R7]   = tf->tf_r7;
 	gr[_REG_R8]   = tf->tf_r8;
 	gr[_REG_R9]   = tf->tf_r9;
 	gr[_REG_R10]  = tf->tf_r10;
 	gr[_REG_R11]  = tf->tf_r11;
 	gr[_REG_R12]  = tf->tf_r12;
 	gr[_REG_SP]   = tf->tf_usr_sp;
 	gr[_REG_LR]   = tf->tf_usr_lr;
 	gr[_REG_PC]   = tf->tf_pc;
 	gr[_REG_CPSR] = tf->tf_spsr;
 
 	return (0);
 }
 
 /*
  * Set machine context.
  *
  * However, we don't set any but the user modifiable flags, and we won't
  * touch the cs selector.
  */
 int
 set_mcontext(struct thread *td, const mcontext_t *mcp)
 {
 	struct trapframe *tf = td->td_frame;
 	const __greg_t *gr = mcp->__gregs;
 
 	tf->tf_r0 = gr[_REG_R0];
 	tf->tf_r1 = gr[_REG_R1];
 	tf->tf_r2 = gr[_REG_R2];
 	tf->tf_r3 = gr[_REG_R3];
 	tf->tf_r4 = gr[_REG_R4];
 	tf->tf_r5 = gr[_REG_R5];
 	tf->tf_r6 = gr[_REG_R6];
 	tf->tf_r7 = gr[_REG_R7];
 	tf->tf_r8 = gr[_REG_R8];
 	tf->tf_r9 = gr[_REG_R9];
 	tf->tf_r10 = gr[_REG_R10];
 	tf->tf_r11 = gr[_REG_R11];
 	tf->tf_r12 = gr[_REG_R12];
 	tf->tf_usr_sp = gr[_REG_SP];
 	tf->tf_usr_lr = gr[_REG_LR];
 	tf->tf_pc = gr[_REG_PC];
 	tf->tf_spsr = gr[_REG_CPSR];
 
 	return (0);
 }
 
 /*
  * MPSAFE
  */
 int
 sys_sigreturn(td, uap)
 	struct thread *td;
 	struct sigreturn_args /* {
 		const struct __ucontext *sigcntxp;
 	} */ *uap;
 {
 	ucontext_t uc;
 	int spsr;
 	
 	if (uap == NULL)
 		return (EFAULT);
 	if (copyin(uap->sigcntxp, &uc, sizeof(uc)))
 		return (EFAULT);
 	/*
 	 * Make sure the processor mode has not been tampered with and
 	 * interrupts have not been disabled.
 	 */
 	spsr = uc.uc_mcontext.__gregs[_REG_CPSR];
 	if ((spsr & PSR_MODE) != PSR_USR32_MODE ||
 	    (spsr & (PSR_I | PSR_F)) != 0)
 		return (EINVAL);
 		/* Restore register context. */
 	set_mcontext(td, &uc.uc_mcontext);
 
 	/* Restore signal mask. */
 	kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
 
 	return (EJUSTRETURN);
 }
 
 
 /*
  * Construct a PCB from a trapframe. This is called from kdb_trap() where
  * we want to start a backtrace from the function that caused us to enter
  * the debugger. We have the context in the trapframe, but base the trace
  * on the PCB. The PCB doesn't have to be perfect, as long as it contains
  * enough for a backtrace.
  */
 void
 makectx(struct trapframe *tf, struct pcb *pcb)
 {
-	pcb->un_32.pcb32_r8 = tf->tf_r8;
-	pcb->un_32.pcb32_r9 = tf->tf_r9;
-	pcb->un_32.pcb32_r10 = tf->tf_r10;
-	pcb->un_32.pcb32_r11 = tf->tf_r11;
-	pcb->un_32.pcb32_r12 = tf->tf_r12;
-	pcb->un_32.pcb32_pc = tf->tf_pc;
-	pcb->un_32.pcb32_lr = tf->tf_usr_lr;
-	pcb->un_32.pcb32_sp = tf->tf_usr_sp;
+	pcb->pcb_regs.sf_r4 = tf->tf_r4;
+	pcb->pcb_regs.sf_r5 = tf->tf_r5;
+	pcb->pcb_regs.sf_r6 = tf->tf_r6;
+	pcb->pcb_regs.sf_r7 = tf->tf_r7;
+	pcb->pcb_regs.sf_r8 = tf->tf_r8;
+	pcb->pcb_regs.sf_r9 = tf->tf_r9;
+	pcb->pcb_regs.sf_r10 = tf->tf_r10;
+	pcb->pcb_regs.sf_r11 = tf->tf_r11;
+	pcb->pcb_regs.sf_r12 = tf->tf_r12;
+	pcb->pcb_regs.sf_pc = tf->tf_pc;
+	pcb->pcb_regs.sf_lr = tf->tf_usr_lr;
+	pcb->pcb_regs.sf_sp = tf->tf_usr_sp;
 }
 
 /*
  * Fake up a boot descriptor table
  */
 vm_offset_t
 fake_preload_metadata(struct arm_boot_params *abp __unused)
 {
 #ifdef DDB
 	vm_offset_t zstart = 0, zend = 0;
 #endif
 	vm_offset_t lastaddr;
 	int i = 0;
 	static uint32_t fake_preload[35];
 
 	fake_preload[i++] = MODINFO_NAME;
 	fake_preload[i++] = strlen("kernel") + 1;
 	strcpy((char*)&fake_preload[i++], "kernel");
 	i += 1;
 	fake_preload[i++] = MODINFO_TYPE;
 	fake_preload[i++] = strlen("elf kernel") + 1;
 	strcpy((char*)&fake_preload[i++], "elf kernel");
 	i += 2;
 	fake_preload[i++] = MODINFO_ADDR;
 	fake_preload[i++] = sizeof(vm_offset_t);
 	fake_preload[i++] = KERNVIRTADDR;
 	fake_preload[i++] = MODINFO_SIZE;
 	fake_preload[i++] = sizeof(uint32_t);
 	fake_preload[i++] = (uint32_t)&end - KERNVIRTADDR;
 #ifdef DDB
 	if (*(uint32_t *)KERNVIRTADDR == MAGIC_TRAMP_NUMBER) {
 		fake_preload[i++] = MODINFO_METADATA|MODINFOMD_SSYM;
 		fake_preload[i++] = sizeof(vm_offset_t);
 		fake_preload[i++] = *(uint32_t *)(KERNVIRTADDR + 4);
 		fake_preload[i++] = MODINFO_METADATA|MODINFOMD_ESYM;
 		fake_preload[i++] = sizeof(vm_offset_t);
 		fake_preload[i++] = *(uint32_t *)(KERNVIRTADDR + 8);
 		lastaddr = *(uint32_t *)(KERNVIRTADDR + 8);
 		zend = lastaddr;
 		zstart = *(uint32_t *)(KERNVIRTADDR + 4);
 		db_fetch_ksymtab(zstart, zend);
 	} else
 #endif
 		lastaddr = (vm_offset_t)&end;
 	fake_preload[i++] = 0;
 	fake_preload[i] = 0;
 	preload_metadata = (void *)fake_preload;
 
 	return (lastaddr);
 }
 
 void
 pcpu0_init(void)
 {
 #if ARM_ARCH_6 || ARM_ARCH_7A || defined(CPU_MV_PJ4B)
 	set_curthread(&thread0);
 #endif
 	pcpu_init(pcpup, 0, sizeof(struct pcpu));
 	PCPU_SET(curthread, &thread0);
 #ifdef VFP
 	PCPU_SET(cpu, 0);
 #endif
 }
 
 #if defined(LINUX_BOOT_ABI)
 vm_offset_t
 linux_parse_boot_param(struct arm_boot_params *abp)
 {
 	struct arm_lbabi_tag *walker;
 	uint32_t revision;
 	uint64_t serial;
 
 	/*
 	 * Linux boot ABI: r0 = 0, r1 is the board type (!= 0) and r2
 	 * is atags or dtb pointer.  If all of these aren't satisfied,
 	 * then punt.
 	 */
 	if (!(abp->abp_r0 == 0 && abp->abp_r1 != 0 && abp->abp_r2 != 0))
 		return 0;
 
 	board_id = abp->abp_r1;
 	walker = (struct arm_lbabi_tag *)
 	    (abp->abp_r2 + KERNVIRTADDR - abp->abp_physaddr);
 
 	/* xxx - Need to also look for binary device tree */
 	if (ATAG_TAG(walker) != ATAG_CORE)
 		return 0;
 
 	atag_list = walker;
 	while (ATAG_TAG(walker) != ATAG_NONE) {
 		switch (ATAG_TAG(walker)) {
 		case ATAG_CORE:
 			break;
 		case ATAG_MEM:
 			arm_physmem_hardware_region(walker->u.tag_mem.start,
 			    walker->u.tag_mem.size);
 			break;
 		case ATAG_INITRD2:
 			break;
 		case ATAG_SERIAL:
 			serial = walker->u.tag_sn.low |
 			    ((uint64_t)walker->u.tag_sn.high << 32);
 			board_set_serial(serial);
 			break;
 		case ATAG_REVISION:
 			revision = walker->u.tag_rev.rev;
 			board_set_revision(revision);
 			break;
 		case ATAG_CMDLINE:
 			/* XXX open question: Parse this for boothowto? */
 			bcopy(walker->u.tag_cmd.command, linux_command_line,
 			      ATAG_SIZE(walker));
 			break;
 		default:
 			break;
 		}
 		walker = ATAG_NEXT(walker);
 	}
 
 	/* Save a copy for later */
 	bcopy(atag_list, atags,
 	    (char *)walker - (char *)atag_list + ATAG_SIZE(walker));
 
 	return fake_preload_metadata(abp);
 }
 #endif
 
 #if defined(FREEBSD_BOOT_LOADER)
 vm_offset_t
 freebsd_parse_boot_param(struct arm_boot_params *abp)
 {
 	vm_offset_t lastaddr = 0;
 	void *mdp;
 	void *kmdp;
 #ifdef DDB
 	vm_offset_t ksym_start;
 	vm_offset_t ksym_end;
 #endif
 
 	/*
 	 * Mask metadata pointer: it is supposed to be on page boundary. If
 	 * the first argument (mdp) doesn't point to a valid address the
 	 * bootloader must have passed us something else than the metadata
 	 * ptr, so we give up.  Also give up if we cannot find metadta section
 	 * the loader creates that we get all this data out of.
 	 */
 
 	if ((mdp = (void *)(abp->abp_r0 & ~PAGE_MASK)) == NULL)
 		return 0;
 	preload_metadata = mdp;
 	kmdp = preload_search_by_type("elf kernel");
 	if (kmdp == NULL)
 		return 0;
 
 	boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int);
 	kern_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *);
 	lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t);
 #ifdef DDB
 	ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t);
 	ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t);
 	db_fetch_ksymtab(ksym_start, ksym_end);
 #endif
 	preload_addr_relocate = KERNVIRTADDR - abp->abp_physaddr;
 	return lastaddr;
 }
 #endif
 
 vm_offset_t
 default_parse_boot_param(struct arm_boot_params *abp)
 {
 	vm_offset_t lastaddr;
 
 #if defined(LINUX_BOOT_ABI)
 	if ((lastaddr = linux_parse_boot_param(abp)) != 0)
 		return lastaddr;
 #endif
 #if defined(FREEBSD_BOOT_LOADER)
 	if ((lastaddr = freebsd_parse_boot_param(abp)) != 0)
 		return lastaddr;
 #endif
 	/* Fall back to hardcoded metadata. */
 	lastaddr = fake_preload_metadata(abp);
 
 	return lastaddr;
 }
 
 /*
  * Stub version of the boot parameter parsing routine.  We are
  * called early in initarm, before even VM has been initialized.
  * This routine needs to preserve any data that the boot loader
  * has passed in before the kernel starts to grow past the end
  * of the BSS, traditionally the place boot-loaders put this data.
  *
  * Since this is called so early, things that depend on the vm system
  * being setup (including access to some SoC's serial ports), about
  * all that can be done in this routine is to copy the arguments.
  *
  * This is the default boot parameter parsing routine.  Individual
  * kernels/boards can override this weak function with one of their
  * own.  We just fake metadata...
  */
 __weak_reference(default_parse_boot_param, parse_boot_param);
 
 /*
  * Initialize proc0
  */
 void
 init_proc0(vm_offset_t kstack)
 {
 	proc_linkup0(&proc0, &thread0);
 	thread0.td_kstack = kstack;
 	thread0.td_pcb = (struct pcb *)
 		(thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1;
 	thread0.td_pcb->pcb_flags = 0;
 	thread0.td_pcb->pcb_vfpcpu = -1;
 	thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ;
 	thread0.td_frame = &proc0_tf;
 	pcpup->pc_curpcb = thread0.td_pcb;
 }
 
 void
 set_stackptrs(int cpu)
 {
 
 	set_stackptr(PSR_IRQ32_MODE,
 	    irqstack.pv_va + ((IRQ_STACK_SIZE * PAGE_SIZE) * (cpu + 1)));
 	set_stackptr(PSR_ABT32_MODE,
 	    abtstack.pv_va + ((ABT_STACK_SIZE * PAGE_SIZE) * (cpu + 1)));
 	set_stackptr(PSR_UND32_MODE,
 	    undstack.pv_va + ((UND_STACK_SIZE * PAGE_SIZE) * (cpu + 1)));
 }
 
 #ifdef FDT
 static char *
 kenv_next(char *cp)
 {
 
 	if (cp != NULL) {
 		while (*cp != 0)
 			cp++;
 		cp++;
 		if (*cp == 0)
 			cp = NULL;
 	}
 	return (cp);
 }
 
 static void
 print_kenv(void)
 {
 	int len;
 	char *cp;
 
 	debugf("loader passed (static) kenv:\n");
 	if (kern_envp == NULL) {
 		debugf(" no env, null ptr\n");
 		return;
 	}
 	debugf(" kern_envp = 0x%08x\n", (uint32_t)kern_envp);
 
 	len = 0;
 	for (cp = kern_envp; cp != NULL; cp = kenv_next(cp))
 		debugf(" %x %s\n", (uint32_t)cp, cp);
 }
 
 void *
 initarm(struct arm_boot_params *abp)
 {
 	struct mem_region mem_regions[FDT_MEM_REGIONS];
 	struct pv_addr kernel_l1pt;
 	struct pv_addr dpcpu;
 	vm_offset_t dtbp, freemempos, l2_start, lastaddr;
 	uint32_t memsize, l2size;
 	char *env;
 	void *kmdp;
 	u_int l1pagetable;
 	int i, j, err_devmap, mem_regions_sz;
 
 	lastaddr = parse_boot_param(abp);
 	arm_physmem_kernaddr = abp->abp_physaddr;
 
 	memsize = 0;
 	set_cpufuncs();
 
 	/*
 	 * Find the dtb passed in by the boot loader.
 	 */
 	kmdp = preload_search_by_type("elf kernel");
 	if (kmdp != NULL)
 		dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t);
 	else
 		dtbp = (vm_offset_t)NULL;
 
 #if defined(FDT_DTB_STATIC)
 	/*
 	 * In case the device tree blob was not retrieved (from metadata) try
 	 * to use the statically embedded one.
 	 */
 	if (dtbp == (vm_offset_t)NULL)
 		dtbp = (vm_offset_t)&fdt_static_dtb;
 #endif
 
 	if (OF_install(OFW_FDT, 0) == FALSE)
 		panic("Cannot install FDT");
 
 	if (OF_init((void *)dtbp) != 0)
 		panic("OF_init failed with the found device tree");
 
 	/* Grab physical memory regions information from device tree. */
 	if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, &memsize) != 0)
 		panic("Cannot get physical memory regions");
 	arm_physmem_hardware_regions(mem_regions, mem_regions_sz);
 
 	/* Grab reserved memory regions information from device tree. */
 	if (fdt_get_reserved_regions(mem_regions, &mem_regions_sz) == 0)
 		arm_physmem_exclude_regions(mem_regions, mem_regions_sz, 
 		    EXFLAG_NODUMP | EXFLAG_NOALLOC);
 
 	/* Platform-specific initialisation */
 	platform_probe_and_attach();
 
 	pcpu0_init();
 
 	/* Do basic tuning, hz etc */
 	init_param1();
 
 	/* Calculate number of L2 tables needed for mapping vm_page_array */
 	l2size = (memsize / PAGE_SIZE) * sizeof(struct vm_page);
 	l2size = (l2size >> L1_S_SHIFT) + 1;
 
 	/*
 	 * Add one table for end of kernel map, one for stacks, msgbuf and
 	 * L1 and L2 tables map and one for vectors map.
 	 */
 	l2size += 3;
 
 	/* Make it divisible by 4 */
 	l2size = (l2size + 3) & ~3;
 
 	freemempos = (lastaddr + PAGE_MASK) & ~PAGE_MASK;
 
 	/* Define a macro to simplify memory allocation */
 #define valloc_pages(var, np)						\
 	alloc_pages((var).pv_va, (np));					\
 	(var).pv_pa = (var).pv_va + (abp->abp_physaddr - KERNVIRTADDR);
 
 #define alloc_pages(var, np)						\
 	(var) = freemempos;						\
 	freemempos += (np * PAGE_SIZE);					\
 	memset((char *)(var), 0, ((np) * PAGE_SIZE));
 
 	while (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) != 0)
 		freemempos += PAGE_SIZE;
 	valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
 
 	for (i = 0, j = 0; i < l2size; ++i) {
 		if (!(i % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) {
 			valloc_pages(kernel_pt_table[i],
 			    L2_TABLE_SIZE / PAGE_SIZE);
 			j = i;
 		} else {
 			kernel_pt_table[i].pv_va = kernel_pt_table[j].pv_va +
 			    L2_TABLE_SIZE_REAL * (i - j);
 			kernel_pt_table[i].pv_pa =
 			    kernel_pt_table[i].pv_va - KERNVIRTADDR +
 			    abp->abp_physaddr;
 
 		}
 	}
 	/*
 	 * Allocate a page for the system page mapped to 0x00000000
 	 * or 0xffff0000. This page will just contain the system vectors
 	 * and can be shared by all processes.
 	 */
 	valloc_pages(systempage, 1);
 
 	/* Allocate dynamic per-cpu area. */
 	valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE);
 	dpcpu_init((void *)dpcpu.pv_va, 0);
 
 	/* Allocate stacks for all modes */
 	valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU);
 	valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU);
 	valloc_pages(undstack, UND_STACK_SIZE * MAXCPU);
 	valloc_pages(kernelstack, KSTACK_PAGES * MAXCPU);
 	valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE);
 
 	/*
 	 * Now we start construction of the L1 page table
 	 * We start by mapping the L2 page tables into the L1.
 	 * This means that we can replace L1 mappings later on if necessary
 	 */
 	l1pagetable = kernel_l1pt.pv_va;
 
 	/*
 	 * Try to map as much as possible of kernel text and data using
 	 * 1MB section mapping and for the rest of initial kernel address
 	 * space use L2 coarse tables.
 	 *
 	 * Link L2 tables for mapping remainder of kernel (modulo 1MB)
 	 * and kernel structures
 	 */
 	l2_start = lastaddr & ~(L1_S_OFFSET);
 	for (i = 0 ; i < l2size - 1; i++)
 		pmap_link_l2pt(l1pagetable, l2_start + i * L1_S_SIZE,
 		    &kernel_pt_table[i]);
 
 	pmap_curmaxkvaddr = l2_start + (l2size - 1) * L1_S_SIZE;
 
 	/* Map kernel code and data */
 	pmap_map_chunk(l1pagetable, KERNVIRTADDR, abp->abp_physaddr,
 	   (((uint32_t)(lastaddr) - KERNVIRTADDR) + PAGE_MASK) & ~PAGE_MASK,
 	    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
 
 	/* Map L1 directory and allocated L2 page tables */
 	pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
 	    L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
 
 	pmap_map_chunk(l1pagetable, kernel_pt_table[0].pv_va,
 	    kernel_pt_table[0].pv_pa,
 	    L2_TABLE_SIZE_REAL * l2size,
 	    VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
 
 	/* Map allocated DPCPU, stacks and msgbuf */
 	pmap_map_chunk(l1pagetable, dpcpu.pv_va, dpcpu.pv_pa,
 	    freemempos - dpcpu.pv_va,
 	    VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
 
 	/* Link and map the vector page */
 	pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH,
 	    &kernel_pt_table[l2size - 1]);
 	pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
 	    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE);
 
 	/* Establish static device mappings. */
 	err_devmap = platform_devmap_init();
 	arm_devmap_bootstrap(l1pagetable, NULL);
 	vm_max_kernel_address = platform_lastaddr();
 
 	cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT);
 	pmap_pa = kernel_l1pt.pv_pa;
 	setttb(kernel_l1pt.pv_pa);
 	cpu_tlb_flushID();
 	cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2));
 
 	/*
 	 * Now that proper page tables are installed, call cpu_setup() to enable
 	 * instruction and data caches and other chip-specific features.
 	 */
 	cpu_setup("");
 
 	/*
 	 * Only after the SOC registers block is mapped we can perform device
 	 * tree fixups, as they may attempt to read parameters from hardware.
 	 */
 	OF_interpret("perform-fixup", 0);
 
 	platform_gpio_init();
 
 	cninit();
 
 	debugf("initarm: console initialized\n");
 	debugf(" arg1 kmdp = 0x%08x\n", (uint32_t)kmdp);
 	debugf(" boothowto = 0x%08x\n", boothowto);
 	debugf(" dtbp = 0x%08x\n", (uint32_t)dtbp);
 	print_kenv();
 
 	env = kern_getenv("kernelname");
 	if (env != NULL) {
 		strlcpy(kernelname, env, sizeof(kernelname));
 		freeenv(env);
 	}
 
 	if (err_devmap != 0)
 		printf("WARNING: could not fully configure devmap, error=%d\n",
 		    err_devmap);
 
 	platform_late_init();
 
 	/*
 	 * Pages were allocated during the secondary bootstrap for the
 	 * stacks for different CPU modes.
 	 * We must now set the r13 registers in the different CPU modes to
 	 * point to these stacks.
 	 * Since the ARM stacks use STMFD etc. we must set r13 to the top end
 	 * of the stack memory.
 	 */
 	cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE);
 
 	set_stackptrs(0);
 
 	/*
 	 * We must now clean the cache again....
 	 * Cleaning may be done by reading new data to displace any
 	 * dirty data in the cache. This will have happened in setttb()
 	 * but since we are boot strapping the addresses used for the read
 	 * may have just been remapped and thus the cache could be out
 	 * of sync. A re-clean after the switch will cure this.
 	 * After booting there are no gross relocations of the kernel thus
 	 * this problem will not occur after initarm().
 	 */
 	cpu_idcache_wbinv_all();
 
 	undefined_init();
 
 	init_proc0(kernelstack.pv_va);
 
 	arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
 	pmap_bootstrap(freemempos, &kernel_l1pt);
 	msgbufp = (void *)msgbufpv.pv_va;
 	msgbufinit(msgbufp, msgbufsize);
 	mutex_init();
 
 	/*
 	 * Exclude the kernel (and all the things we allocated which immediately
 	 * follow the kernel) from the VM allocation pool but not from crash
 	 * dumps.  virtual_avail is a global variable which tracks the kva we've
 	 * "allocated" while setting up pmaps.
 	 *
 	 * Prepare the list of physical memory available to the vm subsystem.
 	 */
 	arm_physmem_exclude_region(abp->abp_physaddr, 
 	    (virtual_avail - KERNVIRTADDR), EXFLAG_NOALLOC);
 	arm_physmem_init_kernel_globals();
 
 	init_param2(physmem);
 	kdb_init();
 
 	return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
 	    sizeof(struct pcb)));
 }
 #endif
Index: projects/arm_intrng/sys/arm/arm/stack_machdep.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/stack_machdep.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/stack_machdep.c	(revision 276248)
@@ -1,92 +1,92 @@
 /*-
  * Copyright (c) 2005 Antoine Brodin
  * 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 AUTHOR 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 AUTHOR 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.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 
 /*
  * This code makes assumptions about the stack layout. These are correct
  * when using APCS (the old ABI), but are no longer true with AAPCS and the
  * ARM EABI. There is also an issue with clang and llvm when building for
  * APCS where it lays out the stack incorrectly. Because of this we disable
  * this when building for ARM EABI or when building with clang.
  */
 
 extern vm_offset_t kernel_vm_end;
 
 static void
 stack_capture(struct stack *st, u_int32_t *frame)
 {
 #if !defined(__ARM_EABI__) && !defined(__clang__)
 	vm_offset_t callpc;
 
 	while (INKERNEL(frame) && (vm_offset_t)frame < kernel_vm_end) {
 		callpc = frame[FR_SCP];
 		if (stack_put(st, callpc) == -1)
 			break;
 		frame = (u_int32_t *)(frame[FR_RFP]);
 	}
 #endif
 }
 
 void
 stack_save_td(struct stack *st, struct thread *td)
 {
 	u_int32_t *frame;
 
 	if (TD_IS_SWAPPED(td))
 		panic("stack_save_td: swapped");
 	if (TD_IS_RUNNING(td))
 		panic("stack_save_td: running");
 
 	/*
 	 * This register, the frame pointer, is incorrect for the ARM EABI
 	 * as it doesn't have a frame pointer, however it's value is not used
 	 * when building for EABI.
 	 */
-	frame = (u_int32_t *)td->td_pcb->un_32.pcb32_r11;
+	frame = (u_int32_t *)td->td_pcb->pcb_regs.sf_r11;
 	stack_zero(st);
 	stack_capture(st, frame);
 }
 
 void
 stack_save(struct stack *st)
 {
 	u_int32_t *frame;
 
 	frame = (u_int32_t *)__builtin_frame_address(0);
 	stack_zero(st);
 	stack_capture(st, frame);
 }
Index: projects/arm_intrng/sys/arm/arm/swtch.S
===================================================================
--- projects/arm_intrng/sys/arm/arm/swtch.S	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/swtch.S	(revision 276248)
@@ -1,497 +1,443 @@
 /*	$NetBSD: cpuswitch.S,v 1.41 2003/11/15 08:44:18 scw Exp $	*/
 
 /*-
  * Copyright 2003 Wasabi Systems, Inc.
  * All rights reserved.
  *
  * Written by Steve C. Woodford for Wasabi Systems, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *      This product includes software developed for the NetBSD Project by
  *      Wasabi Systems, Inc.
  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
  *    or promote products derived from this software without specific prior
  *    written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*-
  * Copyright (c) 1994-1998 Mark Brinicombe.
  * Copyright (c) 1994 Brini.
  * All rights reserved.
  *
  * This code is derived from software written for Brini by Mark Brinicombe
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by Brini.
  * 4. The name of the company nor the name of the author may be used to
  *    endorse or promote products derived from this software without specific
  *    prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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.
  *
  * RiscBSD kernel project
  *
  * cpuswitch.S
  *
  * cpu switching functions
  *
  * Created      : 15/10/94
  *
  */
 
 #include "assym.s"
 #include "opt_sched.h"
 
 #include 
 #include 
 #include 
 #include 
 
 __FBSDID("$FreeBSD$");
 
 #define DOMAIN_CLIENT	0x01
 
 #if defined(_ARM_ARCH_6) && defined(SMP)
 #define GET_PCPU(tmp, tmp2) \
 	mrc 	p15, 0, tmp, c0, c0, 5;	\
 	and	tmp, tmp, #0xf;		\
 	ldr 	tmp2, .Lcurpcpu+4;	\
 	mul 	tmp, tmp, tmp2;		\
 	ldr	tmp2, .Lcurpcpu;	\
 	add	tmp, tmp, tmp2;
 #else
 
 #define GET_PCPU(tmp, tmp2) \
 	ldr	tmp, .Lcurpcpu
 #endif
 
 #ifdef VFP
 	.fpu vfp	/* allow VFP instructions */
 #endif
 
 .Lcurpcpu:
         .word   _C_LABEL(__pcpu)
 	.word	PCPU_SIZE
 .Lcpufuncs:	
 	.word	_C_LABEL(cpufuncs)
 .Lblocked_lock:
 	.word	_C_LABEL(blocked_lock)
 
+/*
+ * cpu_throw(oldtd, newtd)
+ *
+ * Remove current thread state, then select the next thread to run
+ * and load its state.
+ * r0 = oldtd
+ * r1 = newtd
+ */
 ENTRY(cpu_throw)
 	mov	r5, r1
 
 	/*
 	 * r0 = oldtd
 	 * r5 = newtd
 	 */
 
 #ifdef VFP				/* This thread is dying, disable */
 	bl	_C_LABEL(vfp_discard)	/* VFP without preserving state. */
 #endif
 
 	GET_PCPU(r7, r9)
 	ldr	r7, [r5, #(TD_PCB)]		/* r7 = new thread's PCB */
   
 	/* Switch to lwp0 context */
 
 	ldr	r9, .Lcpufuncs
 #if !defined(CPU_ARM11) && !defined(CPU_CORTEXA) && !defined(CPU_MV_PJ4B) && !defined(CPU_KRAIT)
 	mov	lr, pc
 	ldr	pc, [r9, #CF_IDCACHE_WBINV_ALL]
 #endif
 	ldr	r0, [r7, #(PCB_PL1VEC)]
 	ldr	r1, [r7, #(PCB_DACR)]
 	/*
 	 * r0 = Pointer to L1 slot for vector_page (or NULL)
 	 * r1 = lwp0's DACR
 	 * r5 = lwp0
-	 * r6 = exit func
 	 * r7 = lwp0's PCB
 	 * r9 = cpufuncs
 	 */
 
 	/*
 	 * Ensure the vector table is accessible by fixing up lwp0's L1
 	 */
 	cmp	r0, #0			/* No need to fixup vector table? */
 	ldrne	r3, [r0]		/* But if yes, fetch current value */
 	ldrne	r2, [r7, #(PCB_L1VEC)]	/* Fetch new vector_page value */
 	mcr	p15, 0, r1, c3, c0, 0	/* Update DACR for lwp0's context */
 	cmpne	r3, r2			/* Stuffing the same value? */
 	strne	r2, [r0]		/* Store if not. */
 
 #ifdef PMAP_INCLUDE_PTE_SYNC
 	/*
 	 * Need to sync the cache to make sure that last store is
 	 * visible to the MMU.
 	 */
 	movne	r1, #4
 	movne	lr, pc
 	ldrne	pc, [r9, #CF_DCACHE_WB_RANGE]
 #endif /* PMAP_INCLUDE_PTE_SYNC */
 
 	/*
 	 * Note: We don't do the same optimisation as cpu_switch() with
 	 * respect to avoiding flushing the TLB if we're switching to
 	 * the same L1 since this process' VM space may be about to go
 	 * away, so we don't want *any* turds left in the TLB.
 	 */
 
 	/* Switch the memory to the new process */
 	ldr	r0, [r7, #(PCB_PAGEDIR)]
 	mov	lr, pc
 	ldr	pc, [r9, #CF_CONTEXT_SWITCH]
 
-	/* Restore all the save registers */
-#ifndef _ARM_ARCH_5E
-	add	r1, r7, #PCB_R8
-	ldmia	r1, {r8-r13}
-#else
-	ldr	r8, [r7, #(PCB_R8)]
-	ldr	r9, [r7, #(PCB_R9)]
-	ldr	r10, [r7, #(PCB_R10)]
-	ldr	r11, [r7, #(PCB_R11)]
-	ldr	r12, [r7, #(PCB_R12)]
-	ldr	r13, [r7, #(PCB_SP)]
-#endif
-
 	GET_PCPU(r6, r4)
 	/* Hook in a new pcb */
 	str	r7, [r6, #PC_CURPCB]
 	/* We have a new curthread now so make a note it */
-	add	r6, r6, #PC_CURTHREAD
-	str	r5, [r6]
+	str	r5, [r6, #PC_CURTHREAD]
 #ifndef ARM_TP_ADDRESS
 	mcr	p15, 0, r5, c13, c0, 4
 #endif
 	/* Set the new tp */
 	ldr	r6, [r5, #(TD_MD + MD_TP)]
 #ifdef ARM_TP_ADDRESS
 	ldr	r4, =ARM_TP_ADDRESS
 	str	r6, [r4]
 	ldr	r6, [r5, #(TD_MD + MD_RAS_START)]
 	str	r6, [r4, #4] /* ARM_RAS_START */
 	ldr	r6, [r5, #(TD_MD + MD_RAS_END)]
 	str	r6, [r4, #8] /* ARM_RAS_END */
 #else
 	mcr p15, 0, r6, c13, c0, 3
 #endif
-
-	add	sp, sp, #4;
-	ldmfd	sp!, {r4-r7, pc}
+	/* Restore all the saved registers and exit */
+	add	r3, r7, #PCB_R4
+	ldmia	r3, {r4-r12, sp, pc}
 END(cpu_throw)
 
+/*
+ * cpu_switch(oldtd, newtd, lock)
+ *
+ * Save the current thread state, then select the next thread to run
+ * and load its state.
+ * r0 = oldtd
+ * r1 = newtd
+ * r2 = lock (new lock for old thread)
+ */
 ENTRY(cpu_switch)
-	stmfd	sp!, {r4-r7, lr}
-	sub	sp, sp, #4;
-#ifdef __ARM_EABI__
-	.save	{r4-r7, lr}
-	.pad	#4
-#endif
+	/* Interrupts are disabled. */
+	/* Save all the registers in the old thread's pcb. */
+	ldr	r3, [r0, #(TD_PCB)]
 
+	/* Restore all the saved registers and exit */
+	add	r3, #(PCB_R4)
+	stmia	r3, {r4-r12, sp, lr, pc}
+
 	mov	r6, r2 /* Save the mutex */
 
-.Lswitch_resume:
 	/* rem: r0 = old lwp */
 	/* rem: interrupts are disabled */
 
 	/* Process is now on a processor. */
 	/* We have a new curthread now so make a note it */
 	GET_PCPU(r7, r2)
 	str	r1, [r7, #PC_CURTHREAD]
 #ifndef ARM_TP_ADDRESS
 	mcr	p15, 0, r1, c13, c0, 4
 #endif
 
 	/* Hook in a new pcb */
 	ldr	r2, [r1, #TD_PCB]
 	str	r2, [r7, #PC_CURPCB]
 
-	/* rem: r1 = new process */
-	/* rem: interrupts are enabled */
-
 	/* Stage two : Save old context */
 
 	/* Get the user structure for the old thread. */
 	ldr	r2, [r0, #(TD_PCB)]
 	mov	r4, r0 /* Save the old thread. */
 
-	/* Save all the registers in the old thread's pcb */
-#ifndef _ARM_ARCH_5E
-	add	r7, r2, #(PCB_R8)
-	stmia	r7, {r8-r13}
-#else
-	strd	r8, [r2, #(PCB_R8)]
-	strd	r10, [r2, #(PCB_R10)]
-	strd	r12, [r2, #(PCB_R12)]
-#endif
-	str	pc, [r2, #(PCB_PC)]
-
-	/*
-	 * NOTE: We can now use r8-r13 until it is time to restore
-	 * them for the new process.
-	 */
 #ifdef ARM_TP_ADDRESS
 	/* Store the old tp */
 	ldr	r3, =ARM_TP_ADDRESS
 	ldr	r9, [r3]
 	str	r9, [r0, #(TD_MD + MD_TP)]
 	ldr	r9, [r3, #4]
 	str	r9, [r0, #(TD_MD + MD_RAS_START)]
 	ldr	r9, [r3, #8]
 	str	r9, [r0, #(TD_MD + MD_RAS_END)]
 
 	/* Set the new tp */
 	ldr	r9, [r1, #(TD_MD + MD_TP)]
 	str	r9, [r3]
 	ldr	r9, [r1, #(TD_MD + MD_RAS_START)]
 	str	r9, [r3, #4]
 	ldr	r9, [r1, #(TD_MD + MD_RAS_END)]
 	str	r9, [r3, #8]
 #else
 	/* Store the old tp */
 	mrc p15, 0, r9, c13, c0, 3
 	str	r9, [r0, #(TD_MD + MD_TP)]
 
 	/* Set the new tp */
 	ldr	r9, [r1, #(TD_MD + MD_TP)]
 	mcr p15, 0, r9, c13, c0, 3
 #endif
 	
 	/* Get the user structure for the new process in r9 */
 	ldr	r9, [r1, #(TD_PCB)]
 
 	/* rem: r2 = old PCB */
 	/* rem: r9 = new PCB */
 	/* rem: interrupts are enabled */
 
 #ifdef VFP
 	fmrx	r0, fpexc		/* If the VFP is enabled */
 	tst	r0, #(VFPEXC_EN)	/* the current thread has */
 	movne	r1, #1			/* used it, so go save */
 	addne	r0, r2, #(PCB_VFPSTATE)	/* the state into the PCB */
 	blne	_C_LABEL(vfp_store)	/* and disable the VFP. */
 #endif
 
 	/* r0-r3 now free! */
 
 	/* Third phase : restore saved context */
 
 	/* rem: r2 = old PCB */
 	/* rem: r9 = new PCB */
-	/* rem: interrupts are enabled */
 
 	ldr	r5, [r9, #(PCB_DACR)]		/* r5 = new DACR */
 	mov	r2, #DOMAIN_CLIENT
 	cmp     r5, r2, lsl #(PMAP_DOMAIN_KERNEL * 2) /* Sw to kernel thread? */
 	beq     .Lcs_context_switched        /* Yup. Don't flush cache */
 	mrc	p15, 0, r0, c3, c0, 0		/* r0 = old DACR */
 	/*
 	 * Get the new L1 table pointer into r11.  If we're switching to
 	 * an LWP with the same address space as the outgoing one, we can
 	 * skip the cache purge and the TTB load.
 	 *
 	 * To avoid data dep stalls that would happen anyway, we try
 	 * and get some useful work done in the mean time.
 	 */
 	mrc	p15, 0, r10, c2, c0, 0		/* r10 = old L1 */
 	ldr	r11, [r9, #(PCB_PAGEDIR)]	/* r11 = new L1 */
 
-
 	teq	r10, r11			/* Same L1? */
 	cmpeq	r0, r5				/* Same DACR? */
 	beq	.Lcs_context_switched		/* yes! */
 
 #if !defined(CPU_ARM11) && !defined(CPU_CORTEXA) && !defined(CPU_MV_PJ4B) && !defined(CPU_KRAIT)
 	/*
 	 * Definately need to flush the cache.
 	 */
 
 	ldr	r1, .Lcpufuncs
 	mov	lr, pc
 	ldr	pc, [r1, #CF_IDCACHE_WBINV_ALL]
 #endif
 .Lcs_cache_purge_skipped:
 	/* rem: r6 = lock */
 	/* rem: r9 = new PCB */
 	/* rem: r10 = old L1 */
 	/* rem: r11 = new L1 */
 
 	mov	r2, #0x00000000
 	ldr	r7, [r9, #(PCB_PL1VEC)]
 
 	/*
 	 * Ensure the vector table is accessible by fixing up the L1
 	 */
 	cmp	r7, #0			/* No need to fixup vector table? */
 	ldrne	r2, [r7]		/* But if yes, fetch current value */
 	ldrne	r0, [r9, #(PCB_L1VEC)]	/* Fetch new vector_page value */
 	mcr	p15, 0, r5, c3, c0, 0	/* Update DACR for new context */
 	cmpne	r2, r0			/* Stuffing the same value? */
 #ifndef PMAP_INCLUDE_PTE_SYNC
 	strne	r0, [r7]		/* Nope, update it */
 #else
 	beq	.Lcs_same_vector
 	str	r0, [r7]		/* Otherwise, update it */
 
 	/*
 	 * Need to sync the cache to make sure that last store is
 	 * visible to the MMU.
 	 */
 	ldr	r2, .Lcpufuncs
 	mov	r0, r7
 	mov	r1, #4
 	mov	lr, pc
 	ldr	pc, [r2, #CF_DCACHE_WB_RANGE]
 
 .Lcs_same_vector:
 #endif /* PMAP_INCLUDE_PTE_SYNC */
 
 	cmp	r10, r11		/* Switching to the same L1? */
 	ldr	r10, .Lcpufuncs
 	beq	.Lcs_same_l1		/* Yup. */
 	/*
 	 * Do a full context switch, including full TLB flush.
 	 */
 	mov	r0, r11
 	mov	lr, pc
 	ldr	pc, [r10, #CF_CONTEXT_SWITCH]
 
 	b	.Lcs_context_switched
 
 	/*
 	 * We're switching to a different process in the same L1.
 	 * In this situation, we only need to flush the TLB for the
 	 * vector_page mapping, and even then only if r7 is non-NULL.
 	 */
 .Lcs_same_l1:
 	cmp	r7, #0
 	movne	r0, #0			/* We *know* vector_page's VA is 0x0 */
 	movne	lr, pc
 	ldrne	pc, [r10, #CF_TLB_FLUSHID_SE]
 
 .Lcs_context_switched:
 
 	/* Release the old thread */
 	str	r6, [r4, #TD_LOCK]
 #if defined(SCHED_ULE) && defined(SMP)
 	ldr	r6, .Lblocked_lock
 	GET_CURTHREAD_PTR(r3)
 1:
 	ldr	r4, [r3, #TD_LOCK]
 	cmp	r4, r6
 	beq	1b
 #endif
 	
 	/* XXXSCW: Safe to re-enable FIQs here */
 
 	/* rem: r9 = new PCB */
 
-	/* Restore all the save registers */
-#ifndef _ARM_ARCH_5E
-	add	r7, r9, #PCB_R8
-	ldmia	r7, {r8-r13}
-	sub	r7, r7, #PCB_R8		/* restore PCB pointer */
-#else
-	mov	r7, r9
-	ldr	r8, [r7, #(PCB_R8)]
-	ldr	r9, [r7, #(PCB_R9)]
-	ldr	r10, [r7, #(PCB_R10)]
-	ldr	r11, [r7, #(PCB_R11)]
-	ldr	r12, [r7, #(PCB_R12)]
-	ldr	r13, [r7, #(PCB_SP)]
-#endif
-
-	/* rem: r5 = new lwp's proc */
-	/* rem: r6 = lock */
-	/* rem: r7 = new PCB */
-
-.Lswitch_return:
-
-	/*
-	 * Pull the registers that got pushed when either savectx() or
-	 * cpu_switch() was called and return.
-	 */
-	add	sp, sp, #4;
-	ldmfd	sp!, {r4-r7, pc}
-#ifdef DIAGNOSTIC
-.Lswitch_bogons:
-	adr	r0, .Lswitch_panic_str
-	bl	_C_LABEL(panic)
-1:	nop
-	b	1b
-
-.Lswitch_panic_str:
-	.asciz	"cpu_switch: sched_qs empty with non-zero sched_whichqs!\n"
-#endif
+	/* Restore all the saved registers and exit */
+	add	r3, r9, #PCB_R4
+	ldmia	r3, {r4-r12, sp, pc}
 END(cpu_switch)
 
 ENTRY(savectx)
-	stmfd   sp!, {r4-r7, lr}
+	stmfd	sp!, {lr}
 	sub	sp, sp, #4
-	/*
-	 * r0 = pcb
-	 */
-	/* Store all the registers in the process's pcb */
-	add	r2, r0, #(PCB_R8)
-	stmia	r2, {r8-r13}
+	
+	/* Store all the registers in the thread's pcb */
+	add	r3, r0, #(PCB_R4)
+	stmia	r3, {r4-r12, sp, lr, pc}
 #ifdef VFP
 	fmrx	r2, fpexc		/* If the VFP is enabled */
 	tst	r2, #(VFPEXC_EN)	/* the current thread has */
 	movne	r1, #1			/* used it, so go save */
 	addne	r0, r0, #(PCB_VFPSTATE)	/* the state into the PCB */
 	blne	_C_LABEL(vfp_store)	/* and disable the VFP. */
 #endif
 	add	sp, sp, #4;
-	ldmfd	sp!, {r4-r7, pc}
+	ldmfd	sp!, {pc}
 END(savectx)
 
 ENTRY(fork_trampoline)
 	STOP_UNWINDING	/* EABI: Don't unwind beyond the thread enty point. */
 	mov	fp, #0	/* OABI: Stack traceback via fp stops here. */
 	mov	r2, sp
 	mov	r1, r5
 	mov	r0, r4
 	ldr	lr, =swi_exit		/* Go finish forking, then return */
 	b	_C_LABEL(fork_exit)	/* to userland via swi_exit code. */
 END(fork_trampoline)
 
Index: projects/arm_intrng/sys/arm/arm/trap.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/trap.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/trap.c	(revision 276248)
@@ -1,753 +1,756 @@
 /*	$NetBSD: fault.c,v 1.45 2003/11/20 14:44:36 scw Exp $	*/
 
 /*-
  * Copyright 2004 Olivier Houchard
  * Copyright 2003 Wasabi Systems, Inc.
  * All rights reserved.
  *
  * Written by Steve C. Woodford for Wasabi Systems, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *      This product includes software developed for the NetBSD Project by
  *      Wasabi Systems, Inc.
  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
  *    or promote products derived from this software without specific prior
  *    written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*-
  * Copyright (c) 1994-1997 Mark Brinicombe.
  * Copyright (c) 1994 Brini.
  * All rights reserved.
  *
  * This code is derived from software written for Brini by Mark Brinicombe
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by Brini.
  * 4. The name of the company nor the name of the author may be used to
  *    endorse or promote products derived from this software without specific
  *    prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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.
  *
  * RiscBSD kernel project
  *
  * fault.c
  *
  * Fault handlers
  *
  * Created      : 28/11/94
  */
 
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #ifdef KDB
 #include 
 #endif
 
 extern char fusubailout[];
 
 #ifdef DEBUG
 int last_fault_code;	/* For the benefit of pmap_fault_fixup() */
 #endif
 
 struct ksig {
 	int signb;
 	u_long code;
 };
 struct data_abort {
 	int (*func)(struct trapframe *, u_int, u_int, struct thread *, 
 	    struct ksig *);
 	const char *desc;
 };
 
 static int dab_fatal(struct trapframe *, u_int, u_int, struct thread *,
     struct ksig *);
 static int dab_align(struct trapframe *, u_int, u_int, struct thread *,
     struct ksig *);
 static int dab_buserr(struct trapframe *, u_int, u_int, struct thread *,
     struct ksig *);
+static void prefetch_abort_handler(struct trapframe *);
 
 static const struct data_abort data_aborts[] = {
 	{dab_fatal,	"Vector Exception"},
 	{dab_align,	"Alignment Fault 1"},
 	{dab_fatal,	"Terminal Exception"},
 	{dab_align,	"Alignment Fault 3"},
 	{dab_buserr,	"External Linefetch Abort (S)"},
 	{NULL,		"Translation Fault (S)"},
 #if (ARM_MMU_V6 + ARM_MMU_V7) != 0
 	{NULL,		"Translation Flag Fault"},
 #else
 	{dab_buserr,	"External Linefetch Abort (P)"},
 #endif
 	{NULL,		"Translation Fault (P)"},
 	{dab_buserr,	"External Non-Linefetch Abort (S)"},
 	{NULL,		"Domain Fault (S)"},
 	{dab_buserr,	"External Non-Linefetch Abort (P)"},
 	{NULL,		"Domain Fault (P)"},
 	{dab_buserr,	"External Translation Abort (L1)"},
 	{NULL,		"Permission Fault (S)"},
 	{dab_buserr,	"External Translation Abort (L2)"},
 	{NULL,		"Permission Fault (P)"}
 };
 
 /* Determine if a fault came from user mode */
 #define	TRAP_USERMODE(tf)	((tf->tf_spsr & PSR_MODE) == PSR_USR32_MODE)
 
 /* Determine if 'x' is a permission fault */
 #define	IS_PERMISSION_FAULT(x)					\
 	(((1 << ((x) & FAULT_TYPE_MASK)) &			\
 	  ((1 << FAULT_PERM_P) | (1 << FAULT_PERM_S))) != 0)
 
 static __inline void
 call_trapsignal(struct thread *td, int sig, u_long code)
 {
 	ksiginfo_t ksi;
 
 	ksiginfo_init_trap(&ksi);
 	ksi.ksi_signo = sig;
 	ksi.ksi_code = (int)code;
 	trapsignal(td, &ksi);
 }
 
 void
-data_abort_handler(struct trapframe *tf)
+abort_handler(struct trapframe *tf, int type)
 {
 	struct vm_map *map;
 	struct pcb *pcb;
 	struct thread *td;
 	u_int user, far, fsr;
 	vm_prot_t ftype;
 	void *onfault;
 	vm_offset_t va;
 	int error = 0;
 	struct ksig ksig;
 	struct proc *p;
 
+	if (type == 1)
+		return (prefetch_abort_handler(tf));
 
 	/* Grab FAR/FSR before enabling interrupts */
 	far = cpu_faultaddress();
 	fsr = cpu_faultstatus();
 #if 0
 	printf("data abort: fault address=%p (from pc=%p lr=%p)\n",
 	       (void*)far, (void*)tf->tf_pc, (void*)tf->tf_svc_lr);
 #endif
 
 	/* Update vmmeter statistics */
 #if 0
 	vmexp.traps++;
 #endif
 
 	td = curthread;
 	p = td->td_proc;
 
 	PCPU_INC(cnt.v_trap);
 	/* Data abort came from user mode? */
 	user = TRAP_USERMODE(tf);
 
 	if (user) {
 		td->td_pticks = 0;
 		td->td_frame = tf;
 		if (td->td_ucred != td->td_proc->p_ucred)
 			cred_update_thread(td);
 
 	}
 	/* Grab the current pcb */
 	pcb = td->td_pcb;
 	/* Re-enable interrupts if they were enabled previously */
 	if (td->td_md.md_spinlock_count == 0) {
 		if (__predict_true(tf->tf_spsr & PSR_I) == 0)
 			enable_interrupts(PSR_I);
 		if (__predict_true(tf->tf_spsr & PSR_F) == 0)
 			enable_interrupts(PSR_F);
 	}
 
 
 	/* Invoke the appropriate handler, if necessary */
 	if (__predict_false(data_aborts[fsr & FAULT_TYPE_MASK].func != NULL)) {
 		if ((data_aborts[fsr & FAULT_TYPE_MASK].func)(tf, fsr, far,
 		    td, &ksig)) {
 			goto do_trapsignal;
 		}
 		goto out;
 	}
 
 	/*
 	 * At this point, we're dealing with one of the following data aborts:
 	 *
 	 *  FAULT_TRANS_S  - Translation -- Section
 	 *  FAULT_TRANS_P  - Translation -- Page
 	 *  FAULT_DOMAIN_S - Domain -- Section
 	 *  FAULT_DOMAIN_P - Domain -- Page
 	 *  FAULT_PERM_S   - Permission -- Section
 	 *  FAULT_PERM_P   - Permission -- Page
 	 *
 	 * These are the main virtual memory-related faults signalled by
 	 * the MMU.
 	 */
 
 	/* fusubailout is used by [fs]uswintr to avoid page faulting */
 	if (__predict_false(pcb->pcb_onfault == fusubailout)) {
 		tf->tf_r0 = EFAULT;
 		tf->tf_pc = (register_t)(intptr_t) pcb->pcb_onfault;
 		return;
 	}
 
 	/*
 	 * Make sure the Program Counter is sane. We could fall foul of
 	 * someone executing Thumb code, in which case the PC might not
 	 * be word-aligned. This would cause a kernel alignment fault
 	 * further down if we have to decode the current instruction.
 	 * XXX: It would be nice to be able to support Thumb at some point.
 	 */
 	if (__predict_false((tf->tf_pc & 3) != 0)) {
 		if (user) {
 			/*
 			 * Give the user an illegal instruction signal.
 			 */
 			/* Deliver a SIGILL to the process */
 			ksig.signb = SIGILL;
 			ksig.code = 0;
 			goto do_trapsignal;
 		}
 
 		/*
 		 * The kernel never executes Thumb code.
 		 */
 		printf("\ndata_abort_fault: Misaligned Kernel-mode "
 		    "Program Counter\n");
 		dab_fatal(tf, fsr, far, td, &ksig);
 	}
 
 	va = trunc_page((vm_offset_t)far);
 
 	/*
 	 * It is only a kernel address space fault iff:
 	 *	1. user == 0  and
 	 *	2. pcb_onfault not set or
 	 *	3. pcb_onfault set and not LDRT/LDRBT/STRT/STRBT instruction.
 	 */
 	if (user == 0 && (va >= VM_MIN_KERNEL_ADDRESS ||
 	    (va < VM_MIN_ADDRESS && vector_page == ARM_VECTORS_LOW)) &&
 	    __predict_true((pcb->pcb_onfault == NULL ||
 	     (ReadWord(tf->tf_pc) & 0x05200000) != 0x04200000))) {
 		map = kernel_map;
 
 		/* Was the fault due to the FPE/IPKDB ? */
 		if (__predict_false((tf->tf_spsr & PSR_MODE)==PSR_UND32_MODE)) {
 
 			/*
 			 * Force exit via userret()
 			 * This is necessary as the FPE is an extension to
 			 * userland that actually runs in a priveledged mode
 			 * but uses USR mode permissions for its accesses.
 			 */
 			user = 1;
 			ksig.signb = SIGSEGV;
 			ksig.code = 0;
 			goto do_trapsignal;
 		}
 	} else {
 		map = &td->td_proc->p_vmspace->vm_map;
 	}
 
 	/*
 	 * We need to know whether the page should be mapped as R or R/W.  On
 	 * armv6 and later the fault status register indicates whether the
 	 * access was a read or write.  Prior to armv6, we know that a
 	 * permission fault can only be the result of a write to a read-only
 	 * location, so we can deal with those quickly.  Otherwise we need to
 	 * disassemble the faulting instruction to determine if it was a write.
 	 */
 #if ARM_ARCH_6 || ARM_ARCH_7A
 	ftype = (fsr & FAULT_WNR) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ;
 #else
 	if (IS_PERMISSION_FAULT(fsr))
 		ftype = VM_PROT_WRITE;
 	else {
 		u_int insn = ReadWord(tf->tf_pc);
 
 		if (((insn & 0x0c100000) == 0x04000000) ||	/* STR/STRB */
 		    ((insn & 0x0e1000b0) == 0x000000b0) ||	/* STRH/STRD */
 		    ((insn & 0x0a100000) == 0x08000000)) {	/* STM/CDT */
 			ftype = VM_PROT_WRITE;
 		} else {
 			if ((insn & 0x0fb00ff0) == 0x01000090)	/* SWP */
 				ftype = VM_PROT_READ | VM_PROT_WRITE;
 			else
 				ftype = VM_PROT_READ;
 		}
 	}
 #endif
 
 	/*
 	 * See if the fault is as a result of ref/mod emulation,
 	 * or domain mismatch.
 	 */
 #ifdef DEBUG
 	last_fault_code = fsr;
 #endif
 	if (td->td_critnest != 0 || WITNESS_CHECK(WARN_SLEEPOK | WARN_GIANTOK,
 	    NULL, "Kernel page fault") != 0)
 		goto fatal_pagefault;
 
 	if (pmap_fault_fixup(vmspace_pmap(td->td_proc->p_vmspace), va, ftype,
 	    user)) {
 		goto out;
 	}
 
 	onfault = pcb->pcb_onfault;
 	pcb->pcb_onfault = NULL;
 	if (map != kernel_map) {
 		PROC_LOCK(p);
 		p->p_lock++;
 		PROC_UNLOCK(p);
 	}
 	error = vm_fault(map, va, ftype, VM_FAULT_NORMAL);
 	pcb->pcb_onfault = onfault;
 
 	if (map != kernel_map) {
 		PROC_LOCK(p);
 		p->p_lock--;
 		PROC_UNLOCK(p);
 	}
 	if (__predict_true(error == 0))
 		goto out;
 fatal_pagefault:
 	if (user == 0) {
 		if (pcb->pcb_onfault) {
 			tf->tf_r0 = error;
 			tf->tf_pc = (register_t)(intptr_t) pcb->pcb_onfault;
 			return;
 		}
 
 		printf("\nvm_fault(%p, %x, %x, 0) -> %x\n", map, va, ftype,
 		    error);
 		dab_fatal(tf, fsr, far, td, &ksig);
 	}
 
 
 	if (error == ENOMEM) {
 		printf("VM: pid %d (%s), uid %d killed: "
 		    "out of swap\n", td->td_proc->p_pid, td->td_name,
 		    (td->td_proc->p_ucred) ?
 		     td->td_proc->p_ucred->cr_uid : -1);
 		ksig.signb = SIGKILL;
 	} else {
 		ksig.signb = SIGSEGV;
 	}
 	ksig.code = 0;
 do_trapsignal:
 	call_trapsignal(td, ksig.signb, ksig.code);
 out:
 	/* If returning to user mode, make sure to invoke userret() */
 	if (user)
 		userret(td, tf);
 }
 
 /*
  * dab_fatal() handles the following data aborts:
  *
  *  FAULT_WRTBUF_0 - Vector Exception
  *  FAULT_WRTBUF_1 - Terminal Exception
  *
  * We should never see these on a properly functioning system.
  *
  * This function is also called by the other handlers if they
  * detect a fatal problem.
  *
  * Note: If 'l' is NULL, we assume we're dealing with a prefetch abort.
  */
 static int
 dab_fatal(struct trapframe *tf, u_int fsr, u_int far, struct thread *td,
     struct ksig *ksig)
 {
 	const char *mode;
 
 	mode = TRAP_USERMODE(tf) ? "user" : "kernel";
 
 	disable_interrupts(PSR_I|PSR_F);
 	if (td != NULL) {
 		printf("Fatal %s mode data abort: '%s'\n", mode,
 		    data_aborts[fsr & FAULT_TYPE_MASK].desc);
 		printf("trapframe: %p\nFSR=%08x, FAR=", tf, fsr);
 		if ((fsr & FAULT_IMPRECISE) == 0)
 			printf("%08x, ", far);
 		else
 			printf("Invalid,  ");
 		printf("spsr=%08x\n", tf->tf_spsr);
 	} else {
 		printf("Fatal %s mode prefetch abort at 0x%08x\n",
 		    mode, tf->tf_pc);
 		printf("trapframe: %p, spsr=%08x\n", tf, tf->tf_spsr);
 	}
 
 	printf("r0 =%08x, r1 =%08x, r2 =%08x, r3 =%08x\n",
 	    tf->tf_r0, tf->tf_r1, tf->tf_r2, tf->tf_r3);
 	printf("r4 =%08x, r5 =%08x, r6 =%08x, r7 =%08x\n",
 	    tf->tf_r4, tf->tf_r5, tf->tf_r6, tf->tf_r7);
 	printf("r8 =%08x, r9 =%08x, r10=%08x, r11=%08x\n",
 	    tf->tf_r8, tf->tf_r9, tf->tf_r10, tf->tf_r11);
 	printf("r12=%08x, ", tf->tf_r12);
 
 	if (TRAP_USERMODE(tf))
 		printf("usp=%08x, ulr=%08x",
 		    tf->tf_usr_sp, tf->tf_usr_lr);
 	else
 		printf("ssp=%08x, slr=%08x",
 		    tf->tf_svc_sp, tf->tf_svc_lr);
 	printf(", pc =%08x\n\n", tf->tf_pc);
 
 #ifdef KDB
 	if (debugger_on_panic || kdb_active)
 		if (kdb_trap(fsr, 0, tf))
 			return (0);
 #endif
 	panic("Fatal abort");
 	/*NOTREACHED*/
 }
 
 /*
  * dab_align() handles the following data aborts:
  *
  *  FAULT_ALIGN_0 - Alignment fault
  *  FAULT_ALIGN_1 - Alignment fault
  *
  * These faults are fatal if they happen in kernel mode. Otherwise, we
  * deliver a bus error to the process.
  */
 static int
 dab_align(struct trapframe *tf, u_int fsr, u_int far, struct thread *td,
     struct ksig *ksig)
 {
 
 	/* Alignment faults are always fatal if they occur in kernel mode */
 	if (!TRAP_USERMODE(tf)) {
 		if (!td || !td->td_pcb->pcb_onfault)
 			dab_fatal(tf, fsr, far, td, ksig);
 		tf->tf_r0 = EFAULT;
 		tf->tf_pc = (int)td->td_pcb->pcb_onfault;
 		return (0);
 	}
 
 	/* pcb_onfault *must* be NULL at this point */
 
 	/* Deliver a bus error signal to the process */
 	ksig->code = 0;
 	ksig->signb = SIGBUS;
 	td->td_frame = tf;
 
 	return (1);
 }
 
 /*
  * dab_buserr() handles the following data aborts:
  *
  *  FAULT_BUSERR_0 - External Abort on Linefetch -- Section
  *  FAULT_BUSERR_1 - External Abort on Linefetch -- Page
  *  FAULT_BUSERR_2 - External Abort on Non-linefetch -- Section
  *  FAULT_BUSERR_3 - External Abort on Non-linefetch -- Page
  *  FAULT_BUSTRNL1 - External abort on Translation -- Level 1
  *  FAULT_BUSTRNL2 - External abort on Translation -- Level 2
  *
  * If pcb_onfault is set, flag the fault and return to the handler.
  * If the fault occurred in user mode, give the process a SIGBUS.
  *
  * Note: On XScale, FAULT_BUSERR_0, FAULT_BUSERR_1, and FAULT_BUSERR_2
  * can be flagged as imprecise in the FSR. This causes a real headache
  * since some of the machine state is lost. In this case, tf->tf_pc
  * may not actually point to the offending instruction. In fact, if
  * we've taken a double abort fault, it generally points somewhere near
  * the top of "data_abort_entry" in exception.S.
  *
  * In all other cases, these data aborts are considered fatal.
  */
 static int
 dab_buserr(struct trapframe *tf, u_int fsr, u_int far, struct thread *td,
     struct ksig *ksig)
 {
 	struct pcb *pcb = td->td_pcb;
 
 #ifdef __XSCALE__
 	if ((fsr & FAULT_IMPRECISE) != 0 &&
 	    (tf->tf_spsr & PSR_MODE) == PSR_ABT32_MODE) {
 		/*
 		 * Oops, an imprecise, double abort fault. We've lost the
 		 * r14_abt/spsr_abt values corresponding to the original
 		 * abort, and the spsr saved in the trapframe indicates
 		 * ABT mode.
 		 */
 		tf->tf_spsr &= ~PSR_MODE;
 
 		/*
 		 * We use a simple heuristic to determine if the double abort
 		 * happened as a result of a kernel or user mode access.
 		 * If the current trapframe is at the top of the kernel stack,
 		 * the fault _must_ have come from user mode.
 		 */
-		if (tf != ((struct trapframe *)pcb->un_32.pcb32_sp) - 1) {
+		if (tf != ((struct trapframe *)pcb->pcb_regs.sf_sp) - 1) {
 			/*
 			 * Kernel mode. We're either about to die a
 			 * spectacular death, or pcb_onfault will come
 			 * to our rescue. Either way, the current value
 			 * of tf->tf_pc is irrelevant.
 			 */
 			tf->tf_spsr |= PSR_SVC32_MODE;
 			if (pcb->pcb_onfault == NULL)
 				printf("\nKernel mode double abort!\n");
 		} else {
 			/*
 			 * User mode. We've lost the program counter at the
 			 * time of the fault (not that it was accurate anyway;
 			 * it's not called an imprecise fault for nothing).
 			 * About all we can do is copy r14_usr to tf_pc and
 			 * hope for the best. The process is about to get a
 			 * SIGBUS, so it's probably history anyway.
 			 */
 			tf->tf_spsr |= PSR_USR32_MODE;
 			tf->tf_pc = tf->tf_usr_lr;
 		}
 	}
 
 	/* FAR is invalid for imprecise exceptions */
 	if ((fsr & FAULT_IMPRECISE) != 0)
 		far = 0;
 #endif /* __XSCALE__ */
 
 	if (pcb->pcb_onfault) {
 		tf->tf_r0 = EFAULT;
 		tf->tf_pc = (register_t)(intptr_t) pcb->pcb_onfault;
 		return (0);
 	}
 
 	/*
 	 * At this point, if the fault happened in kernel mode, we're toast
 	 */
 	if (!TRAP_USERMODE(tf))
 		dab_fatal(tf, fsr, far, td, ksig);
 
 	/* Deliver a bus error signal to the process */
 	ksig->signb = SIGBUS;
 	ksig->code = 0;
 	td->td_frame = tf;
 
 	return (1);
 }
 
 /*
  * void prefetch_abort_handler(struct trapframe *tf)
  *
  * Abort handler called when instruction execution occurs at
  * a non existent or restricted (access permissions) memory page.
  * If the address is invalid and we were in SVC mode then panic as
  * the kernel should never prefetch abort.
  * If the address is invalid and the page is mapped then the user process
  * does no have read permission so send it a signal.
  * Otherwise fault the page in and try again.
  */
-void
+static void
 prefetch_abort_handler(struct trapframe *tf)
 {
 	struct thread *td;
 	struct proc * p;
 	struct vm_map *map;
 	vm_offset_t fault_pc, va;
 	int error = 0;
 	struct ksig ksig;
 
 
 #if 0
 	/* Update vmmeter statistics */
 	uvmexp.traps++;
 #endif
 #if 0
 	printf("prefetch abort handler: %p %p\n", (void*)tf->tf_pc,
 	    (void*)tf->tf_usr_lr);
 #endif
 
  	td = curthread;
 	p = td->td_proc;
 	PCPU_INC(cnt.v_trap);
 
 	if (TRAP_USERMODE(tf)) {
 		td->td_frame = tf;
 		if (td->td_ucred != td->td_proc->p_ucred)
 			cred_update_thread(td);
 	}
 	fault_pc = tf->tf_pc;
 	if (td->td_md.md_spinlock_count == 0) {
 		if (__predict_true(tf->tf_spsr & PSR_I) == 0)
 			enable_interrupts(PSR_I);
 		if (__predict_true(tf->tf_spsr & PSR_F) == 0)
 			enable_interrupts(PSR_F);
 	}
 
 	/* Prefetch aborts cannot happen in kernel mode */
 	if (__predict_false(!TRAP_USERMODE(tf)))
 		dab_fatal(tf, 0, tf->tf_pc, NULL, &ksig);
 	td->td_pticks = 0;
 
 
 	/* Ok validate the address, can only execute in USER space */
 	if (__predict_false(fault_pc >= VM_MAXUSER_ADDRESS ||
 	    (fault_pc < VM_MIN_ADDRESS && vector_page == ARM_VECTORS_LOW))) {
 		ksig.signb = SIGSEGV;
 		ksig.code = 0;
 		goto do_trapsignal;
 	}
 
 	map = &td->td_proc->p_vmspace->vm_map;
 	va = trunc_page(fault_pc);
 
 	/*
 	 * See if the pmap can handle this fault on its own...
 	 */
 #ifdef DEBUG
 	last_fault_code = -1;
 #endif
 	if (pmap_fault_fixup(map->pmap, va, VM_PROT_READ, 1))
 		goto out;
 
 	if (map != kernel_map) {
 		PROC_LOCK(p);
 		p->p_lock++;
 		PROC_UNLOCK(p);
 	}
 
 	error = vm_fault(map, va, VM_PROT_READ | VM_PROT_EXECUTE,
 	    VM_FAULT_NORMAL);
 	if (map != kernel_map) {
 		PROC_LOCK(p);
 		p->p_lock--;
 		PROC_UNLOCK(p);
 	}
 
 	if (__predict_true(error == 0))
 		goto out;
 
 	if (error == ENOMEM) {
 		printf("VM: pid %d (%s), uid %d killed: "
 		    "out of swap\n", td->td_proc->p_pid, td->td_name,
 		    (td->td_proc->p_ucred) ?
 		     td->td_proc->p_ucred->cr_uid : -1);
 		ksig.signb = SIGKILL;
 	} else {
 		ksig.signb = SIGSEGV;
 	}
 	ksig.code = 0;
 
 do_trapsignal:
 	call_trapsignal(td, ksig.signb, ksig.code);
 
 out:
 	userret(td, tf);
 
 }
 
 extern int badaddr_read_1(const uint8_t *, uint8_t *);
 extern int badaddr_read_2(const uint16_t *, uint16_t *);
 extern int badaddr_read_4(const uint32_t *, uint32_t *);
 /*
  * Tentatively read an 8, 16, or 32-bit value from 'addr'.
  * If the read succeeds, the value is written to 'rptr' and zero is returned.
  * Else, return EFAULT.
  */
 int
 badaddr_read(void *addr, size_t size, void *rptr)
 {
 	union {
 		uint8_t v1;
 		uint16_t v2;
 		uint32_t v4;
 	} u;
 	int rv;
 
 	cpu_drain_writebuf();
 
 	/* Read from the test address. */
 	switch (size) {
 	case sizeof(uint8_t):
 		rv = badaddr_read_1(addr, &u.v1);
 		if (rv == 0 && rptr)
 			*(uint8_t *) rptr = u.v1;
 		break;
 
 	case sizeof(uint16_t):
 		rv = badaddr_read_2(addr, &u.v2);
 		if (rv == 0 && rptr)
 			*(uint16_t *) rptr = u.v2;
 		break;
 
 	case sizeof(uint32_t):
 		rv = badaddr_read_4(addr, &u.v4);
 		if (rv == 0 && rptr)
 			*(uint32_t *) rptr = u.v4;
 		break;
 
 	default:
 		panic("badaddr: invalid size (%lu)", (u_long) size);
 	}
 
 	/* Return EFAULT if the address was invalid, else zero */
 	return (rv);
 }
\ No newline at end of file
Index: projects/arm_intrng/sys/arm/arm/vm_machdep.c
===================================================================
--- projects/arm_intrng/sys/arm/arm/vm_machdep.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/arm/vm_machdep.c	(revision 276248)
@@ -1,348 +1,346 @@
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
  * Copyright (c) 1989, 1990 William Jolitz
  * Copyright (c) 1994 John Dyson
  * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * the Systems Programming Group of the University of Utah Computer
  * Science Department, and William Jolitz.
  *
  * Redistribution and use in source and binary :forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by the University of
  *	California, Berkeley and its contributors.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  *	from: @(#)vm_machdep.c	7.3 (Berkeley) 5/13/91
  *	Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 
 /*
  * struct switchframe and trapframe must both be a multiple of 8
  * for correct stack alignment.
  */
-CTASSERT(sizeof(struct switchframe) == 24);
+CTASSERT(sizeof(struct switchframe) == 48);
 CTASSERT(sizeof(struct trapframe) == 80);
 
 /*
  * Finish a fork operation, with process p2 nearly set up.
  * Copy and update the pcb, set up the stack so that the child
  * ready to run and return to user mode.
  */
 void
 cpu_fork(register struct thread *td1, register struct proc *p2,
     struct thread *td2, int flags)
 {
 	struct pcb *pcb2;
 	struct trapframe *tf;
-	struct switchframe *sf;
 	struct mdproc *mdp2;
 
 	if ((flags & RFPROC) == 0)
 		return;
-	pcb2 = (struct pcb *)(td2->td_kstack + td2->td_kstack_pages * PAGE_SIZE) - 1;
+
+	/* Point the pcb to the top of the stack */
+	pcb2 = (struct pcb *)
+	    (td2->td_kstack + td2->td_kstack_pages * PAGE_SIZE) - 1;
 #ifdef __XSCALE__
 #ifndef CPU_XSCALE_CORE3
 	pmap_use_minicache(td2->td_kstack, td2->td_kstack_pages * PAGE_SIZE);
 #endif
 #endif
 	td2->td_pcb = pcb2;
+	
+	/* Clone td1's pcb */
 	bcopy(td1->td_pcb, pcb2, sizeof(*pcb2));
+	
+	/* Point to mdproc and then copy over td1's contents */
 	mdp2 = &p2->p_md;
 	bcopy(&td1->td_proc->p_md, mdp2, sizeof(*mdp2));
-	pcb2->un_32.pcb32_sp = td2->td_kstack +
-	    USPACE_SVC_STACK_TOP - sizeof(*pcb2);
+
+	/* Point the frame to the stack in front of pcb and copy td1's frame */
+	td2->td_frame = (struct trapframe *)pcb2 - 1;
+	*td2->td_frame = *td1->td_frame;
+
+	/*
+	 * Create a new fresh stack for the new process.
+	 * Copy the trap frame for the return to user mode as if from a
+	 * syscall.  This copies most of the user mode register values.
+	 */
+	pmap_set_pcb_pagedir(vmspace_pmap(p2->p_vmspace), pcb2);
+	pcb2->pcb_regs.sf_r4 = (register_t)fork_return;
+	pcb2->pcb_regs.sf_r5 = (register_t)td2;
+	pcb2->pcb_regs.sf_lr = (register_t)fork_trampoline;
+	pcb2->pcb_regs.sf_sp = STACKALIGN(td2->td_frame);
+
 	pcb2->pcb_vfpcpu = -1;
 	pcb2->pcb_vfpstate.fpscr = VFPSCR_DN | VFPSCR_FZ;
-	pmap_activate(td2);
-	td2->td_frame = tf = (struct trapframe *)STACKALIGN(
-	    pcb2->un_32.pcb32_sp - sizeof(struct trapframe));
-	*tf = *td1->td_frame;
-	sf = (struct switchframe *)tf - 1;
-	sf->sf_r4 = (u_int)fork_return;
-	sf->sf_r5 = (u_int)td2;
-	sf->sf_pc = (u_int)fork_trampoline;
+	
+	tf = td2->td_frame;
 	tf->tf_spsr &= ~PSR_C;
 	tf->tf_r0 = 0;
 	tf->tf_r1 = 0;
-	pcb2->un_32.pcb32_sp = (u_int)sf;
-	KASSERT((pcb2->un_32.pcb32_sp & 7) == 0,
-	    ("cpu_fork: Incorrect stack alignment"));
 
+
 	/* Setup to release spin count in fork_exit(). */
 	td2->td_md.md_spinlock_count = 1;
-	td2->td_md.md_saved_cspr = 0;
+	td2->td_md.md_saved_cspr = PSR_SVC32_MODE;;
 #ifdef ARM_TP_ADDRESS
 	td2->td_md.md_tp = *(register_t *)ARM_TP_ADDRESS;
 #else
 	td2->td_md.md_tp = (register_t) get_tls();
 #endif
 }
 				
 void
 cpu_thread_swapin(struct thread *td)
 {
 }
 
 void
 cpu_thread_swapout(struct thread *td)
 {
 }
 
 void
 cpu_set_syscall_retval(struct thread *td, int error)
 {
 	struct trapframe *frame;
 	int fixup;
 #ifdef __ARMEB__
 	u_int call;
 #endif
 
 	frame = td->td_frame;
 	fixup = 0;
 
 #ifdef __ARMEB__
 	/*
 	 * __syscall returns an off_t while most other syscalls return an
 	 * int. As an off_t is 64-bits and an int is 32-bits we need to
 	 * place the returned data into r1. As the lseek and frerebsd6_lseek
 	 * syscalls also return an off_t they do not need this fixup.
 	 */
 #ifdef __ARM_EABI__
 	call = frame->tf_r7;
 #else
 	call = *(u_int32_t *)(frame->tf_pc - INSN_SIZE) & 0x000fffff;
 #endif
 	if (call == SYS___syscall) {
 		register_t *ap = &frame->tf_r0;
 		register_t code = ap[_QUAD_LOWWORD];
 		if (td->td_proc->p_sysent->sv_mask)
 			code &= td->td_proc->p_sysent->sv_mask;
 		fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek)
 		    ? 1 : 0;
 	}
 #endif
 
 	switch (error) {
 	case 0:
 		if (fixup) {
 			frame->tf_r0 = 0;
 			frame->tf_r1 = td->td_retval[0];
 		} else {
 			frame->tf_r0 = td->td_retval[0];
 			frame->tf_r1 = td->td_retval[1];
 		}
 		frame->tf_spsr &= ~PSR_C;   /* carry bit */
 		break;
 	case ERESTART:
 		/*
 		 * Reconstruct the pc to point at the swi.
 		 */
 		frame->tf_pc -= INSN_SIZE;
 		break;
 	case EJUSTRETURN:
 		/* nothing to do */
 		break;
 	default:
 		frame->tf_r0 = error;
 		frame->tf_spsr |= PSR_C;    /* carry bit */
 		break;
 	}
 }
 
 /*
  * Initialize machine state (pcb and trap frame) for a new thread about to
  * upcall. Put enough state in the new thread's PCB to get it to go back
  * userret(), where we can intercept it again to set the return (upcall)
  * Address and stack, along with those from upcals that are from other sources
  * such as those generated in thread_userret() itself.
  */
 void
 cpu_set_upcall(struct thread *td, struct thread *td0)
 {
-	struct trapframe *tf;
-	struct switchframe *sf;
 
 	bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe));
 	bcopy(td0->td_pcb, td->td_pcb, sizeof(struct pcb));
-	tf = td->td_frame;
-	sf = (struct switchframe *)tf - 1;
-	sf->sf_r4 = (u_int)fork_return;
-	sf->sf_r5 = (u_int)td;
-	sf->sf_pc = (u_int)fork_trampoline;
-	tf->tf_spsr &= ~PSR_C;
-	tf->tf_r0 = 0;
-	td->td_pcb->un_32.pcb32_sp = (u_int)sf;
-	KASSERT((td->td_pcb->un_32.pcb32_sp & 7) == 0,
-	    ("cpu_set_upcall: Incorrect stack alignment"));
 
+	td->td_pcb->pcb_regs.sf_r4 = (register_t)fork_return;
+	td->td_pcb->pcb_regs.sf_r5 = (register_t)td;
+	td->td_pcb->pcb_regs.sf_lr = (register_t)fork_trampoline;
+	td->td_pcb->pcb_regs.sf_sp = STACKALIGN(td->td_frame);
+
+	td->td_frame->tf_spsr &= ~PSR_C;
+	td->td_frame->tf_r0 = 0;
+
 	/* Setup to release spin count in fork_exit(). */
 	td->td_md.md_spinlock_count = 1;
-	td->td_md.md_saved_cspr = 0;
+	td->td_md.md_saved_cspr = PSR_SVC32_MODE;
 }
 
 /*
  * Set that machine state for performing an upcall that has to
  * be done in thread_userret() so that those upcalls generated
  * in thread_userret() itself can be done as well.
  */
 void
 cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg,
 	stack_t *stack)
 {
 	struct trapframe *tf = td->td_frame;
 
-	tf->tf_usr_sp = STACKALIGN((int)stack->ss_sp + stack->ss_size
-	    - sizeof(struct trapframe));
+	tf->tf_usr_sp = STACKALIGN((int)stack->ss_sp + stack->ss_size);
 	tf->tf_pc = (int)entry;
 	tf->tf_r0 = (int)arg;
 	tf->tf_spsr = PSR_USR32_MODE;
 }
 
 int
 cpu_set_user_tls(struct thread *td, void *tls_base)
 {
 
 	td->td_md.md_tp = (register_t)tls_base;
 	if (td == curthread) {
 		critical_enter();
 #ifdef ARM_TP_ADDRESS
 		*(register_t *)ARM_TP_ADDRESS = (register_t)tls_base;
 #else
 		set_tls((void *)tls_base);
 #endif
 		critical_exit();
 	}
 	return (0);
 }
 
 void
 cpu_thread_exit(struct thread *td)
 {
 }
 
 void
 cpu_thread_alloc(struct thread *td)
 {
 	td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages *
 	    PAGE_SIZE) - 1;
 	/*
 	 * Ensure td_frame is aligned to an 8 byte boundary as it will be
 	 * placed into the stack pointer which must be 8 byte aligned in
 	 * the ARM EABI.
 	 */
-	td->td_frame = (struct trapframe *)STACKALIGN((u_int)td->td_kstack +
-	    USPACE_SVC_STACK_TOP - sizeof(struct pcb) -
-	    sizeof(struct trapframe));
+	td->td_frame = (struct trapframe *)((caddr_t)td->td_pcb) - 1;
+
 #ifdef __XSCALE__
 #ifndef CPU_XSCALE_CORE3
 	pmap_use_minicache(td->td_kstack, td->td_kstack_pages * PAGE_SIZE);
 #endif
 #endif
 }
 
 void
 cpu_thread_free(struct thread *td)
 {
 }
 
 void
 cpu_thread_clean(struct thread *td)
 {
 }
 
 /*
  * Intercept the return address from a freshly forked process that has NOT
  * been scheduled yet.
  *
  * This is needed to make kernel threads stay in kernel mode.
  */
 void
 cpu_set_fork_handler(struct thread *td, void (*func)(void *), void *arg)
 {
-	struct switchframe *sf;
-	struct trapframe *tf;
-	
-	tf = td->td_frame;
-	sf = (struct switchframe *)tf - 1;
-	sf->sf_r4 = (u_int)func;
-	sf->sf_r5 = (u_int)arg;
-	td->td_pcb->un_32.pcb32_sp = (u_int)sf;
-	KASSERT((td->td_pcb->un_32.pcb32_sp & 7) == 0,
-	    ("cpu_set_fork_handler: Incorrect stack alignment"));
+	td->td_pcb->pcb_regs.sf_r4 = (register_t)func;	/* function */
+	td->td_pcb->pcb_regs.sf_r5 = (register_t)arg;	/* first arg */
 }
 
 /*
  * Software interrupt handler for queued VM system processing.
  */
 void
 swi_vm(void *dummy)
 {
 	
 	if (busdma_swi_pending)
 		busdma_swi();
 }
 
 void
 cpu_exit(struct thread *td)
 {
 }
 
Index: projects/arm_intrng/sys/arm/include/asm.h
===================================================================
--- projects/arm_intrng/sys/arm/include/asm.h	(revision 276247)
+++ projects/arm_intrng/sys/arm/include/asm.h	(revision 276248)
@@ -1,212 +1,240 @@
 /*	$NetBSD: asm.h,v 1.5 2003/08/07 16:26:53 agc Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * William Jolitz.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  *	from: @(#)asm.h	5.5 (Berkeley) 5/7/91
  *
  * $FreeBSD$
  */
 
 #ifndef _MACHINE_ASM_H_
 #define _MACHINE_ASM_H_
 #include 
+#include 
+#include 
 
 #define	_C_LABEL(x)	x
 #define	_ASM_LABEL(x)	x
 
 #ifndef _ALIGN_TEXT
 # define _ALIGN_TEXT .align 0
 #endif
 
 #if defined(__ARM_EABI__) && !defined(_STANDALONE)
 #define	STOP_UNWINDING	.cantunwind
 #define	_FNSTART	.fnstart
 #define	_FNEND		.fnend
 #else
 #define	STOP_UNWINDING
 #define	_FNSTART
 #define	_FNEND
 #endif
 
 /*
+ * gas/arm uses @ as a single comment character and thus cannot be used here.
+ * It recognises the # instead of an @ symbol in .type directives.
+ */
+#define	_ASM_TYPE_FUNCTION	#function
+#define	_ASM_TYPE_OBJECT	#object
+
+/* XXX Is this still the right prologue for profiling? */
+#ifdef GPROF
+#define	_PROF_PROLOGUE	\
+	mov ip, lr;	\
+	bl __mcount
+#else
+#define	_PROF_PROLOGUE
+#endif
+
+/*
  * EENTRY()/EEND() mark "extra" entry/exit points from a function.
+ * LEENTRY()/LEEND() are the the same for local symbols.
  * The unwind info cannot handle the concept of a nested function, or a function
  * with multiple .fnstart directives, but some of our assembler code is written
  * with multiple labels to allow entry at several points.  The EENTRY() macro
  * defines such an extra entry point without a new .fnstart, so that it's
  * basically just a label that you can jump to.  The EEND() macro does nothing
  * at all, except document the exit point associated with the same-named entry.
  */
-#define	_EENTRY(x) 	.globl x; .type x,_ASM_TYPE_FUNCTION; x:
-#define	_EEND(x)	/* nothing */
+#define	GLOBAL(x)	.global x
 
-/*
- * gas/arm uses @ as a single comment character and thus cannot be used here
- * Instead it recognised the # instead of an @ symbols in .type directives
- * We define a couple of macros so that assembly code will not be dependent
- * on one or the other.
- */
-#define _ASM_TYPE_FUNCTION	#function
-#define _ASM_TYPE_OBJECT	#object
-#define GLOBAL(X) .globl x
-#define	_ENTRY(x) \
-	.text; _ALIGN_TEXT; _EENTRY(x) _FNSTART
-#define	_END(x)	.size x, . - x; _FNEND
+#define	_LEENTRY(x) 	.type x,_ASM_TYPE_FUNCTION; x:
+#define	_LEEND(x)	/* nothing */
+#define	_EENTRY(x) 	GLOBAL(x); _LEENTRY(x)
+#define	_EEND(x)	_LEEND(x)
 
-#ifdef GPROF
-#  define _PROF_PROLOGUE	\
-	mov ip, lr; bl __mcount
-#else
-# define _PROF_PROLOGUE
-#endif
+#define	_LENTRY(x)	.text; _ALIGN_TEXT; _LEENTRY(x); _FNSTART
+#define	_LEND(x)	.size x, . - x; _FNEND
+#define	_ENTRY(x)	.text; _ALIGN_TEXT; _EENTRY(x); _FNSTART
+#define	_END(x)		_LEND(x)
 
 #define	ENTRY(y)	_ENTRY(_C_LABEL(y)); _PROF_PROLOGUE
-#define	EENTRY(y)	_EENTRY(_C_LABEL(y)); _PROF_PROLOGUE
+#define	EENTRY(y)	_EENTRY(_C_LABEL(y));
 #define	ENTRY_NP(y)	_ENTRY(_C_LABEL(y))
 #define	EENTRY_NP(y)	_EENTRY(_C_LABEL(y))
 #define	END(y)		_END(_C_LABEL(y))
-#define	EEND(y)
+#define	EEND(y)		_EEND(_C_LABEL(y))
 #define	ASENTRY(y)	_ENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
-#define	ASEENTRY(y)	_EENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
+#define	ASLENTRY(y)	_LENTRY(_ASM_LABEL(y)); _PROF_PROLOGUE
+#define	ASEENTRY(y)	_EENTRY(_ASM_LABEL(y));
+#define	ASLEENTRY(y)	_LEENTRY(_ASM_LABEL(y));
 #define	ASENTRY_NP(y)	_ENTRY(_ASM_LABEL(y))
+#define	ASLENTRY_NP(y)	_LENTRY(_ASM_LABEL(y))
 #define	ASEENTRY_NP(y)	_EENTRY(_ASM_LABEL(y))
+#define	ASLEENTRY_NP(y)	_LEENTRY(_ASM_LABEL(y))
 #define	ASEND(y)	_END(_ASM_LABEL(y))
-#define	ASEEND(y)
+#define	ASLEND(y)	_LEND(_ASM_LABEL(y))
+#define	ASEEND(y)	_EEND(_ASM_LABEL(y))
+#define	ASLEEND(y)	_LEEND(_ASM_LABEL(y))
 
 #define	ASMSTR		.asciz
 
 #if defined(PIC)
 #define	PLT_SYM(x)	PIC_SYM(x, PLT)
 #define	GOT_SYM(x)	PIC_SYM(x, GOT)
 #define	GOT_GET(x,got,sym)	\
 	ldr	x, sym;		\
 	ldr	x, [x, got]
 #define	GOT_INIT(got,gotsym,pclabel) \
 	ldr	got, gotsym;	\
 	pclabel: add	got, got, pc
 #ifdef __thumb__
 #define	GOT_INITSYM(gotsym,pclabel) \
 	.align 0;		\
 	gotsym: .word _C_LABEL(_GLOBAL_OFFSET_TABLE_) - (pclabel+4)
 #else
 #define	GOT_INITSYM(gotsym,pclabel) \
 	.align 0;		\
 	gotsym: .word _C_LABEL(_GLOBAL_OFFSET_TABLE_) - (pclabel+8)
 #endif
 
 #ifdef __STDC__
 #define	PIC_SYM(x,y)	x ## ( ## y ## )
 #else
 #define	PIC_SYM(x,y)	x/**/(/**/y/**/)
 #endif
 
 #else
 #define	PLT_SYM(x)	x
 #define	GOT_SYM(x)	x
 #define	GOT_GET(x,got,sym)	\
 	ldr	x, sym;
 #define	GOT_INIT(got,gotsym,pclabel)
 #define	GOT_INITSYM(gotsym,pclabel)
 #define	PIC_SYM(x,y)	x
 #endif	/* PIC */
 
 #undef __FBSDID
 #if !defined(lint) && !defined(STRIP_FBSDID)
 #define __FBSDID(s)     .ident s
 #else
 #define __FBSDID(s)     /* nothing */
 #endif
 	
 
 #define	WEAK_ALIAS(alias,sym)						\
 	.weak alias;							\
 	alias = sym
 
 #ifdef __STDC__
 #define	WARN_REFERENCES(sym,msg)					\
 	.stabs msg ## ,30,0,0,0 ;					\
 	.stabs __STRING(_C_LABEL(sym)) ## ,1,0,0,0
 #else
 #define	WARN_REFERENCES(sym,msg)					\
 	.stabs msg,30,0,0,0 ;						\
 	.stabs __STRING(sym),1,0,0,0
 #endif /* __STDC__ */
 
 /* Exactly one of the __ARM_ARCH_*__ macros will be defined by the compiler. */
 /* The _ARM_ARCH_* macros are deprecated and will be removed soon. */
 /* This should be moved into another header so it can be used in
  * both asm and C code. machine/asm.h cannot be included in C code. */
 #if defined (__ARM_ARCH_7__) || defined (__ARM_ARCH_7A__)
 #define _ARM_ARCH_7
 #define _HAVE_ARMv7_INSTRUCTIONS 1
 #endif
 
 #if defined (_HAVE_ARMv7_INSTRUCTIONS) || defined (__ARM_ARCH_6__) || \
 	defined (__ARM_ARCH_6J__) || defined (__ARM_ARCH_6K__) || \
 	defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)
 #define _ARM_ARCH_6
 #define _HAVE_ARMv6_INSTRUCTIONS 1
 #endif
 
 #if defined (_HAVE_ARMv6_INSTRUCTIONS) || defined (__ARM_ARCH_5TE__) || \
     defined (__ARM_ARCH_5TEJ__) || defined (__ARM_ARCH_5E__)
 #define _ARM_ARCH_5E
 #define _HAVE_ARMv5E_INSTRUCTIONS 1
 #endif
 
 #if defined (_HAVE_ARMv5E_INSTRUCTIONS) || defined (__ARM_ARCH_5__) || \
     defined (__ARM_ARCH_5T__)
 #define _ARM_ARCH_5
 #define _HAVE_ARMv5_INSTRUCTIONS 1
 #endif
 
 #if defined (_HAVE_ARMv5_INSTRUCTIONS) || defined (__ARM_ARCH_4T__)
 #define _ARM_ARCH_4T
 #define _HAVE_ARMv4T_INSTRUCTIONS 1
 #endif
 
 /* FreeBSD requires ARMv4, so this is always set. */
 #define _HAVE_ARMv4_INSTRUCTIONS 1
 
 #if defined (_HAVE_ARMv4T_INSTRUCTIONS)
 # define RET	bx	lr
 # define RETeq	bxeq	lr
 # define RETne	bxne	lr
 # define RETc(c) bx##c	lr
 #else
 # define RET	mov	pc, lr
 # define RETeq	moveq	pc, lr
 # define RETne	movne	pc, lr
 # define RETc(c) mov##c	pc, lr
+#endif
+
+#if __ARM_ARCH >= 7
+#define ISB	isb
+#define DSB	dsb
+#define DMB	dmb
+#elif __ARM_ARCH == 6
+#define ISB	mcr CP15_CP15ISB
+#define DSB	mcr CP15_CP15DSB
+#define DMB	mcr CP15_CP15DMB
+#else
+#define ISB	mcr CP15_CP15ISB
+#define DSB	mcr CP15_CP15DSB	/* DSB and DMB are the */
+#define DMB	mcr CP15_CP15DSB	/* same prior to v6.*/
 #endif
 
 #endif /* !_MACHINE_ASM_H_ */
Index: projects/arm_intrng/sys/arm/include/db_machdep.h
===================================================================
--- projects/arm_intrng/sys/arm/include/db_machdep.h	(revision 276247)
+++ projects/arm_intrng/sys/arm/include/db_machdep.h	(revision 276248)
@@ -1,98 +1,98 @@
 /*-
  * Mach Operating System
  * Copyright (c) 1991,1990 Carnegie Mellon University
  * All Rights Reserved.
  *
  * Permission to use, copy, modify and distribute this software and its
  * documentation is hereby granted, provided that both the copyright
  * notice and this permission notice appear in all copies of the
  * software, derivative works or modified versions, and any portions
  * thereof, and that both notices appear in supporting documentation.
  *
  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  *
  * Carnegie Mellon requests users of this software to return to
  *
  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  *  School of Computer Science
  *  Carnegie Mellon University
  *  Pittsburgh PA 15213-3890
  *
  * any improvements or extensions that they make and grant Carnegie Mellon
  * the rights to redistribute these changes.
  *
  *	from: FreeBSD: src/sys/i386/include/db_machdep.h,v 1.16 1999/10/04
  * $FreeBSD$
  */
 
 #ifndef	_MACHINE_DB_MACHDEP_H_
 #define	_MACHINE_DB_MACHDEP_H_
 
 #include 
 #include 
 #include 
 
 #define T_BREAKPOINT	(1)
 typedef vm_offset_t	db_addr_t;
 typedef int		db_expr_t;
 
-#define	PC_REGS()	((db_addr_t)kdb_thrctx->un_32.pcb32_pc)
+#define	PC_REGS()	((db_addr_t)kdb_thrctx->pcb_regs.sf_pc)
 
 #define	BKPT_INST	(KERNEL_BREAKPOINT)
 #define	BKPT_SIZE	(INSN_SIZE)
 #define	BKPT_SET(inst)	(BKPT_INST)
 
 #define	BKPT_SKIP do {							\
 	kdb_frame->tf_pc += BKPT_SIZE; \
 } while (0)
 
 #define SOFTWARE_SSTEP	1
 
 #define	IS_BREAKPOINT_TRAP(type, code)	(type == T_BREAKPOINT)
 #define	IS_WATCHPOINT_TRAP(type, code)	(0)
 
 
 #define	inst_trap_return(ins)	(0)
 /* ldmxx reg, {..., pc}
 					    01800000  stack mode
 					    000f0000  register
 					    0000ffff  register list */
 /* mov pc, reg
 					    0000000f  register */
 #define	inst_return(ins)	(((ins) & 0x0e108000) == 0x08108000 || \
 				 ((ins) & 0x0ff0fff0) == 0x01a0f000 ||	\
 				 ((ins) & 0x0ffffff0) == 0x012fff10) /* bx */
 /* bl ...
 					    00ffffff  offset>>2 */
 #define	inst_call(ins)		(((ins) & 0x0f000000) == 0x0b000000)
 /* b ...
 					    00ffffff  offset>>2 */
 /* ldr pc, [pc, reg, lsl #2]
 					    0000000f  register */
 
 #define	inst_branch(ins)	(((ins) & 0x0f000000) == 0x0a000000 || \
 				 ((ins) & 0x0fdffff0) == 0x079ff100 || \
 				 ((ins) & 0x0cf0f000) == 0x0490f000 || \
 				 ((ins) & 0x0ffffff0) == 0x012fff30 || /* blx */ \
 				 ((ins) & 0x0de0f000) == 0x0080f000)
 
 #define	inst_load(ins)		(0)
 #define	inst_store(ins)		(0)
 
 #define next_instr_address(pc, bd)	((bd) ? (pc) : ((pc) + INSN_SIZE))
 
 #define	DB_SMALL_VALUE_MAX	(0x7fffffff)
 #define	DB_SMALL_VALUE_MIN	(-0x40001)
 
 #define	DB_ELFSIZE		32
 
 int db_validate_address(vm_offset_t);
 
 u_int branch_taken (u_int insn, u_int pc);
 
 #ifdef __ARMEB__
 #define BYTE_MSF	(1)
 #endif
 #endif /* !_MACHINE_DB_MACHDEP_H_ */
Index: projects/arm_intrng/sys/arm/include/frame.h
===================================================================
--- projects/arm_intrng/sys/arm/include/frame.h	(revision 276247)
+++ projects/arm_intrng/sys/arm/include/frame.h	(revision 276248)
@@ -1,169 +1,135 @@
 /*	$NetBSD: frame.h,v 1.5 2002/10/19 00:10:54 bjh21 Exp $	*/
 
 /*-
  * Copyright (c) 1994-1997 Mark Brinicombe.
  * Copyright (c) 1994 Brini.
  * All rights reserved.
  *
  * This code is derived from software written for Brini by Mark Brinicombe
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by Brini.
  * 4. The name of the company nor the name of the author may be used to
  *    endorse or promote products derived from this software without specific
  *    prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY BRINI ``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 BRINI 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.
  *
  * RiscBSD kernel project
  *
  * frame.h
  *
  * Stack frames structures
  *
  * Created      : 30/09/94
  *
  * $FreeBSD$
  *
  */
 
 #ifndef _MACHINE_FRAME_H_
 #define _MACHINE_FRAME_H_
 
 #ifndef _LOCORE
 
 #include 
 #include 
 
 
 /*
  * Trap frame.  Pushed onto the kernel stack on a trap (synchronous exception).
  */
 
 struct trapframe {
 	register_t tf_spsr; /* Zero on arm26 */
 	register_t tf_r0;
 	register_t tf_r1;
 	register_t tf_r2;
 	register_t tf_r3;
 	register_t tf_r4;
 	register_t tf_r5;
 	register_t tf_r6;
 	register_t tf_r7;
 	register_t tf_r8;
 	register_t tf_r9;
 	register_t tf_r10;
 	register_t tf_r11;
 	register_t tf_r12;
 	register_t tf_usr_sp;
 	register_t tf_usr_lr;
 	register_t tf_svc_sp; /* Not used on arm26 */
 	register_t tf_svc_lr; /* Not used on arm26 */
 	register_t tf_pc;
 	register_t tf_pad;
 };
 
 /* Register numbers */
 #define tf_r13 tf_usr_sp
 #define tf_r14 tf_usr_lr
 #define tf_r15 tf_pc
-/*
- *  * Scheduler activations upcall frame.  Pushed onto user stack before
- *   * calling an SA upcall.
- *    */
 
-struct saframe {
-#if 0 /* in registers on entry to upcall */
-	int             sa_type;
-	struct sa_t **  sa_sas;
-	int             sa_events;
-	int             sa_interrupted;
-#endif
-	void *          sa_arg;
-};
-
 /*
- *  * Signal frame.  Pushed onto user stack before calling sigcode.
- *   */
-
-/* the pointers are use in the trampoline code to locate the ucontext */
+ * Signal frame.  Pushed onto user stack before calling sigcode.
+ * The pointers are used in the trampoline code to locate the ucontext.
+ */
 struct sigframe {
-       	siginfo_t       sf_si;          /* actual saved siginfo */
+	siginfo_t       sf_si;          /* actual saved siginfo */
 	ucontext_t      sf_uc;          /* actual saved ucontext */
 };
 
-/*
- * System stack frames.
- */
 
-
-typedef struct irqframe {
-	unsigned int if_spsr;
-	unsigned int if_r0;
-	unsigned int if_r1;
-	unsigned int if_r2;
-	unsigned int if_r3;
-	unsigned int if_r4;
-	unsigned int if_r5;
-	unsigned int if_r6;
-	unsigned int if_r7;
-	unsigned int if_r8;
-	unsigned int if_r9;
-	unsigned int if_r10;
-	unsigned int if_r11;
-	unsigned int if_r12;
-	unsigned int if_usr_sp;
-	unsigned int if_usr_lr;
-	unsigned int if_svc_sp;
-	unsigned int if_svc_lr;
-	unsigned int if_pc;
-} irqframe_t;
-
 /*
  * Switch frame.
  *
  * It is important this is a multiple of 8 bytes so the stack is correctly
  * aligned when we create new threads.
  */
-
-struct switchframe {
-	u_int	pad;	/* Used to pad the struct to a multiple of 8-bytes */
-	u_int	sf_r4;
-	u_int	sf_r5;
-	u_int	sf_r6;
-	u_int	sf_r7;
-	u_int	sf_pc;
+struct switchframe
+{
+        register_t sf_r4;
+        register_t sf_r5;
+        register_t sf_r6;
+        register_t sf_r7;
+        register_t sf_r8;
+        register_t sf_r9;
+        register_t sf_r10;
+        register_t sf_r11;
+        register_t sf_r12;
+        register_t sf_sp;
+        register_t sf_lr;
+        register_t sf_pc;
 };
+
 
 /*
  * Stack frame. Used during stack traces (db_trace.c)
  */
 struct frame {
 	u_int	fr_fp;
 	u_int	fr_sp;
 	u_int	fr_lr;
 	u_int	fr_pc;
 };
 
 #endif /* !_LOCORE */
 
 #endif /* _MACHINE_FRAME_H_ */
Index: projects/arm_intrng/sys/arm/include/machdep.h
===================================================================
--- projects/arm_intrng/sys/arm/include/machdep.h	(revision 276247)
+++ projects/arm_intrng/sys/arm/include/machdep.h	(revision 276248)
@@ -1,41 +1,40 @@
 /* $NetBSD: machdep.h,v 1.7 2002/02/21 02:52:21 thorpej Exp $ */
 /* $FreeBSD$ */
 
 #ifndef _MACHDEP_BOOT_MACHDEP_H_
 #define _MACHDEP_BOOT_MACHDEP_H_
 
 /* Structs that need to be initialised by initarm */
 struct pv_addr;
 extern struct pv_addr irqstack;
 extern struct pv_addr undstack;
 extern struct pv_addr abtstack;
 
 /* Define various stack sizes in pages */
 #define IRQ_STACK_SIZE	1
 #define ABT_STACK_SIZE	1
 #define UND_STACK_SIZE	1
 
 /* misc prototypes used by the many arm machdeps */
 struct trapframe;
 void arm_lock_cache_line(vm_offset_t);
 void init_proc0(vm_offset_t kstack);
 void halt(void);
-void data_abort_handler(struct trapframe *);
-void prefetch_abort_handler(struct trapframe *);
+void abort_handler(struct trapframe *, int );
 void set_stackptrs(int cpu);
 void undefinedinstruction_bounce(struct trapframe *);
 
 /* Early boot related helper functions */
 struct arm_boot_params;
 vm_offset_t default_parse_boot_param(struct arm_boot_params *abp);
 vm_offset_t freebsd_parse_boot_param(struct arm_boot_params *abp);
 vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp);
 vm_offset_t fake_preload_metadata(struct arm_boot_params *abp);
 vm_offset_t parse_boot_param(struct arm_boot_params *abp);
 void arm_generic_initclocks(void);
 
 /* Board-specific attributes */
 void board_set_serial(uint64_t);
 void board_set_revision(uint32_t);
 
 #endif /* !_MACHINE_MACHDEP_H_ */
Index: projects/arm_intrng/sys/arm/include/pcb.h
===================================================================
--- projects/arm_intrng/sys/arm/include/pcb.h	(revision 276247)
+++ projects/arm_intrng/sys/arm/include/pcb.h	(revision 276248)
@@ -1,103 +1,82 @@
 /*	$NetBSD: pcb.h,v 1.10 2003/10/13 21:46:39 scw Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas .
  * Copyright (c) 1994 Mark Brinicombe.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by the RiscBSD team.
  * 4. The name "RiscBSD" nor the name of the author may be used to
  *    endorse or promote products derived from this software without specific
  *    prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY RISCBSD ``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 RISCBSD 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.
  *
  * $FreeBSD$
  */
 
 #ifndef	_MACHINE_PCB_H_
 #define	_MACHINE_PCB_H_
 
 #include 
+#include 
 
 
-struct trapframe;
-
-struct pcb_arm32 {
-	vm_offset_t	pcb32_pagedir;		/* PT hooks */
-	uint32_t *pcb32_pl1vec;		/* PTR to vector_base L1 entry*/
-	uint32_t pcb32_l1vec;			/* Value to stuff on ctx sw */
-	u_int	pcb32_dacr;			/* Domain Access Control Reg */
-	/*
-	 * WARNING!
-	 * cpuswitch.S relies on pcb32_r8 being quad-aligned in struct pcb
-	 * (due to the use of "strd" when compiled for XSCALE)
-	 */
-	u_int	pcb32_r8;			/* used */
-	u_int	pcb32_r9;			/* used */
-	u_int	pcb32_r10;			/* used */
-	u_int	pcb32_r11;			/* used */
-	u_int	pcb32_r12;			/* used */
-	u_int	pcb32_sp;			/* used */
-	u_int	pcb32_lr;
-	u_int	pcb32_pc;
-};
-#define	pcb_pagedir	un_32.pcb32_pagedir
-#define	pcb_pl1vec	un_32.pcb32_pl1vec
-#define	pcb_l1vec	un_32.pcb32_l1vec
-#define	pcb_dacr	un_32.pcb32_dacr
-#define	pcb_cstate	un_32.pcb32_cstate
-
 /*
  * WARNING!
- * See warning for struct pcb_arm32, above, before changing struct pcb!
+ * Keep pcb_regs first for faster access in switch.S
  */
 struct pcb {
+	struct switchframe pcb_regs;		/* CPU state */
 	u_int	pcb_flags;
 #define	PCB_OWNFPU	0x00000001
 #define PCB_NOALIGNFLT	0x00000002
 	caddr_t	pcb_onfault;			/* On fault handler */
-	struct	pcb_arm32 un_32;
+	vm_offset_t	pcb_pagedir;		/* PT hooks */
+	uint32_t *pcb_pl1vec;			/* PTR to vector_base L1 entry*/
+	uint32_t pcb_l1vec;			/* Value to stuff on ctx sw */
+	u_int	pcb_dacr;			/* Domain Access Control Reg */
+
 	struct vfp_state pcb_vfpstate;          /* VP/NEON state */
 	u_int pcb_vfpcpu;                       /* VP/NEON last cpu */
 } __aligned(8); /* 
 		 * We need the PCB to be aligned on 8 bytes, as we may
-		 * access it using ldrd/strd, and some CPUs require it
+		 * access it using ldrd/strd, and ARM ABI require it
 		 * to by aligned on 8 bytes.
 		 */
 
 /*
  * No additional data for core dumps.
  */
 struct md_coredump {
 	int	md_empty;
 };
 
 void	makectx(struct trapframe *tf, struct pcb *pcb);
 
 #ifdef _KERNEL
 
 void    savectx(struct pcb *) __returns_twice;
 #endif	/* _KERNEL */
 
 #endif	/* !_MACHINE_PCB_H_ */
Index: projects/arm_intrng/sys/arm/include/sysreg.h
===================================================================
--- projects/arm_intrng/sys/arm/include/sysreg.h	(revision 276247)
+++ projects/arm_intrng/sys/arm/include/sysreg.h	(revision 276248)
@@ -1,232 +1,238 @@
 /*-
  * Copyright 2014 Svatopluk Kraus 
  * Copyright 2014 Michal Meloun 
  * 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 AUTHOR 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 AUTHOR 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.
  *
  * $FreeBSD$
  */
 
 /*
  * Macros to make working with the System Control Registers simpler.
  */
 
 #ifndef MACHINE_SYSREG_H
 #define	MACHINE_SYSREG_H
 
 #include 
 
 /*
  * CP15 C0 registers
  */
 #define	CP15_MIDR(rr)		p15, 0, rr, c0, c0,  0 /* Main ID Register */
 #define	CP15_CTR(rr)		p15, 0, rr, c0, c0,  1 /* Cache Type Register */
 #define	CP15_TCMTR(rr)		p15, 0, rr, c0, c0,  2 /* TCM Type Register */
 #define	CP15_TLBTR(rr)		p15, 0, rr, c0, c0,  3 /* TLB Type Register */
 #define	CP15_MPIDR(rr)		p15, 0, rr, c0, c0,  5 /* Multiprocessor Affinity Register */
 #define	CP15_REVIDR(rr)		p15, 0, rr, c0, c0,  6 /* Revision ID Register */
 
 #define	CP15_ID_PFR0(rr)	p15, 0, rr, c0, c1,  0 /* Processor Feature Register 0 */
 #define	CP15_ID_PFR1(rr)	p15, 0, rr, c0, c1,  1 /* Processor Feature Register 1 */
 #define	CP15_ID_DFR0(rr)	p15, 0, rr, c0, c1,  2 /* Debug Feature Register 0 */
 #define	CP15_ID_AFR0(rr)	p15, 0, rr, c0, c1,  3 /* Auxiliary Feature Register  0 */
 #define	CP15_ID_MMFR0(rr)	p15, 0, rr, c0, c1,  4 /* Memory Model Feature Register 0 */
 #define	CP15_ID_MMFR1(rr)	p15, 0, rr, c0, c1,  5 /* Memory Model Feature Register 1 */
 #define	CP15_ID_MMFR2(rr)	p15, 0, rr, c0, c1,  6 /* Memory Model Feature Register 2 */
 #define	CP15_ID_MMFR3(rr)	p15, 0, rr, c0, c1,  7 /* Memory Model Feature Register 3 */
 
 #define	CP15_ID_ISAR0(rr)	p15, 0, rr, c0, c2,  0 /* Instruction Set Attribute Register 0 */
 #define	CP15_ID_ISAR1(rr)	p15, 0, rr, c0, c2,  1 /* Instruction Set Attribute Register 1 */
 #define	CP15_ID_ISAR2(rr)	p15, 0, rr, c0, c2,  2 /* Instruction Set Attribute Register 2 */
 #define	CP15_ID_ISAR3(rr)	p15, 0, rr, c0, c2,  3 /* Instruction Set Attribute Register 3 */
 #define	CP15_ID_ISAR4(rr)	p15, 0, rr, c0, c2,  4 /* Instruction Set Attribute Register 4 */
 #define	CP15_ID_ISAR5(rr)	p15, 0, rr, c0, c2,  5 /* Instruction Set Attribute Register 5 */
 
 #define	CP15_CCSIDR(rr)		p15, 1, rr, c0, c0,  0 /* Cache Size ID Registers */
 #define	CP15_CLIDR(rr)		p15, 1, rr, c0, c0,  1 /* Cache Level ID Register */
 #define	CP15_AIDR(rr)		p15, 1, rr, c0, c0,  7 /* Auxiliary ID Register */
 
 #define	CP15_CSSELR(rr)		p15, 2, rr, c0, c0,  0 /* Cache Size Selection Register */
 
 /*
  * CP15 C1 registers
  */
 #define	CP15_SCTLR(rr)		p15, 0, rr, c1, c0,  0 /* System Control Register */
 #define	CP15_ACTLR(rr)		p15, 0, rr, c1, c0,  1 /* IMPLEMENTATION DEFINED Auxiliary Control Register */
 #define	CP15_CPACR(rr)		p15, 0, rr, c1, c0,  2 /* Coprocessor Access Control Register */
 
 #define	CP15_SCR(rr)		p15, 0, rr, c1, c1,  0 /* Secure Configuration Register */
 #define	CP15_SDER(rr)		p15, 0, rr, c1, c1,  1 /* Secure Debug Enable Register */
 #define	CP15_NSACR(rr)		p15, 0, rr, c1, c1,  2 /* Non-Secure Access Control Register */
 
 /*
  * CP15 C2 registers
  */
 #define	CP15_TTBR0(rr)		p15, 0, rr, c2, c0,  0 /* Translation Table Base Register 0 */
 #define	CP15_TTBR1(rr)		p15, 0, rr, c2, c0,  1 /* Translation Table Base Register 1 */
 #define	CP15_TTBCR(rr)		p15, 0, rr, c2, c0,  2 /* Translation Table Base Control Register */
 
 /*
  * CP15 C3 registers
  */
 #define	CP15_DACR(rr)		p15, 0, rr, c3, c0,  0 /* Domain Access Control Register */
 
 /*
  * CP15 C5 registers
  */
 #define	CP15_DFSR(rr)		p15, 0, rr, c5, c0,  0 /* Data Fault Status Register */
 
 #if __ARM_ARCH >= 6
 /* From ARMv6: */
 #define	CP15_IFSR(rr)		p15, 0, rr, c5, c0,  1 /* Instruction Fault Status Register */
+#endif
+#if __ARM_ARCH >= 7
 /* From ARMv7: */
 #define	CP15_ADFSR(rr)		p15, 0, rr, c5, c1,  0 /* Auxiliary Data Fault Status Register */
 #define	CP15_AIFSR(rr)		p15, 0, rr, c5, c1,  1 /* Auxiliary Instruction Fault Status Register */
 #endif
 
-
 /*
  * CP15 C6 registers
  */
 #define	CP15_DFAR(rr)		p15, 0, rr, c6, c0,  0 /* Data Fault Address Register */
 
 #if __ARM_ARCH >= 6
 /* From ARMv6k: */
 #define	CP15_IFAR(rr)		p15, 0, rr, c6, c0,  2 /* Instruction Fault Address Register */
 #endif
 
 /*
  * CP15 C7 registers
  */
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH >= 7 && defined(SMP)
 /* From ARMv7: */
 #define	CP15_ICIALLUIS		p15, 0, r0, c7, c1,  0 /* Instruction cache invalidate all PoU, IS */
 #define	CP15_BPIALLIS		p15, 0, r0, c7, c1,  6 /* Branch predictor invalidate all IS */
 #endif
 
 #define	CP15_PAR		p15, 0, r0, c7, c4,  0 /* Physical Address Register */
 
 #define	CP15_ICIALLU		p15, 0, r0, c7, c5,  0 /* Instruction cache invalidate all PoU */
 #define	CP15_ICIMVAU(rr)	p15, 0, rr, c7, c5,  1 /* Instruction cache invalidate */
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH == 6
 /* Deprecated in ARMv7 */
 #define	CP15_CP15ISB		p15, 0, r0, c7, c5,  4 /* ISB */
 #endif
 #define	CP15_BPIALL		p15, 0, r0, c7, c5,  6 /* Branch predictor invalidate all */
 #define	CP15_BPIMVA		p15, 0, rr, c7, c5,  7 /* Branch predictor invalidate by MVA */
 
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH == 6
 /* Only ARMv6: */
 #define	CP15_DCIALL		p15, 0, r0, c7, c6,  0 /* Data cache invalidate all */
 #endif
 #define	CP15_DCIMVAC(rr)	p15, 0, rr, c7, c6,  1 /* Data cache invalidate by MVA PoC */
 #define	CP15_DCISW(rr)		p15, 0, rr, c7, c6,  2 /* Data cache invalidate by set/way */
 
 #define	CP15_ATS1CPR(rr)	p15, 0, rr, c7, c8,  0 /* Stage 1 Current state PL1 read */
 #define	CP15_ATS1CPW(rr)	p15, 0, rr, c7, c8,  1 /* Stage 1 Current state PL1 write */
 #define	CP15_ATS1CUR(rr)	p15, 0, rr, c7, c8,  2 /* Stage 1 Current state unprivileged read */
 #define	CP15_ATS1CUW(rr)	p15, 0, rr, c7, c8,  3 /* Stage 1 Current state unprivileged write */
 
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH >= 7
 /* From ARMv7: */
 #define	CP15_ATS12NSOPR(rr)	p15, 0, rr, c7, c8,  4 /* Stages 1 and 2 Non-secure only PL1 read */
 #define	CP15_ATS12NSOPW(rr)	p15, 0, rr, c7, c8,  5 /* Stages 1 and 2 Non-secure only PL1 write */
 #define	CP15_ATS12NSOUR(rr)	p15, 0, rr, c7, c8,  6 /* Stages 1 and 2 Non-secure only unprivileged read */
 #define	CP15_ATS12NSOUW(rr)	p15, 0, rr, c7, c8,  7 /* Stages 1 and 2 Non-secure only unprivileged write */
 #endif
 
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH == 6
 /* Only ARMv6: */
 #define	CP15_DCCALL		p15, 0, r0, c7, c10, 0 /* Data cache clean all */
 #endif
 #define	CP15_DCCMVAC(rr)	p15, 0, rr, c7, c10, 1 /* Data cache clean by MVA PoC */
 #define	CP15_DCCSW(rr)		p15, 0, rr, c7, c10, 2 /* Data cache clean by set/way */
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH == 6
 /* Only ARMv6: */
 #define	CP15_CP15DSB		p15, 0, r0, c7, c10, 4 /* DSB */
 #define	CP15_CP15DMB		p15, 0, r0, c7, c10, 5 /* DMB */
 #endif
 
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH >= 7
 /* From ARMv7: */
 #define	CP15_DCCMVAU(rr)	p15, 0, rr, c7, c11, 1 /* Data cache clean by MVA PoU */
 #endif
 
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH == 6
 /* Only ARMv6: */
 #define	CP15_DCCIALL		p15, 0, r0, c7, c14, 0 /* Data cache clean and invalidate all */
 #endif
 #define	CP15_DCCIMVAC(rr)	p15, 0, rr, c7, c14, 1 /* Data cache clean and invalidate by MVA PoC */
 #define	CP15_DCCISW(rr)		p15, 0, rr, c7, c14, 2 /* Data cache clean and invalidate by set/way */
 
 /*
  * CP15 C8 registers
  */
-#if __ARM_ARCH >= 6
+#if __ARM_ARCH >= 7 && defined(SMP)
 /* From ARMv7: */
 #define	CP15_TLBIALLIS		p15, 0, r0, c8, c3, 0 /* Invalidate entire unified TLB IS */
 #define	CP15_TLBIMVAIS(rr)	p15, 0, rr, c8, c3, 1 /* Invalidate unified TLB by MVA IS */
 #define	CP15_TLBIASIDIS(rr)	p15, 0, rr, c8, c3, 2 /* Invalidate unified TLB by ASID IS */
 #define	CP15_TLBIMVAAIS(rr)	p15, 0, rr, c8, c3, 3 /* Invalidate unified TLB by MVA, all ASID IS */
 #endif
 
 #define	CP15_TLBIALL		p15, 0, r0, c8, c7, 0 /* Invalidate entire unified TLB */
 #define	CP15_TLBIMVA(rr)	p15, 0, rr, c8, c7, 1 /* Invalidate unified TLB by MVA */
 #define	CP15_TLBIASID(rr)	p15, 0, rr, c8, c7, 2 /* Invalidate unified TLB by ASID */
 
 #if __ARM_ARCH >= 6
 /* From ARMv6: */
 #define	CP15_TLBIMVAA(rr)	p15, 0, rr, c8, c7, 3 /* Invalidate unified TLB by MVA, all ASID */
 #endif
 
 /*
  * CP15 C10 registers
  */
 /* Without LPAE this is PRRR, with LPAE it's MAIR0 */
 #define	CP15_PRRR(rr)		p15, 0, rr, c10, c2, 0 /* Primary Region Remap Register */
 #define	CP15_MAIR0(rr)		p15, 0, rr, c10, c2, 0 /* Memory Attribute Indirection Register 0 */
 /* Without LPAE this is NMRR, with LPAE it's MAIR1 */
 #define	CP15_NMRR(rr)		p15, 0, rr, c10, c2, 1 /* Normal Memory Remap Register */
 #define	CP15_MAIR1(rr)		p15, 0, rr, c10, c2, 1 /* Memory Attribute Indirection Register 1 */
 
 #define	CP15_AMAIR0(rr)		p15, 0, rr, c10, c3, 0 /* Auxiliary Memory Attribute Indirection Register 0 */
 #define	CP15_AMAIR1(rr)		p15, 0, rr, c10, c3, 1 /* Auxiliary Memory Attribute Indirection Register 1 */
 
 /*
  * CP15 C12 registers
  */
 #define	CP15_VBAR(rr)		p15, 0, rr, c12, c0, 0 /* Vector Base Address Register */
 #define	CP15_MVBAR(rr)		p15, 0, rr, c12, c0, 1 /* Monitor Vector Base Address Register */
 
 #define	CP15_ISR(rr)		p15, 0, rr, c12, c1, 0 /* Interrupt Status Register */
 
 /*
  * CP15 C13 registers
  */
 #define	CP15_FCSEIDR(rr)	p15, 0, rr, c13, c0, 0 /* FCSE Process ID Register */
 #define	CP15_CONTEXTIDR(rr)	p15, 0, rr, c13, c0, 1 /* Context ID Register */
 #define	CP15_TPIDRURW(rr)	p15, 0, rr, c13, c0, 2 /* User Read/Write Thread ID Register */
 #define	CP15_TPIDRURO(rr)	p15, 0, rr, c13, c0, 3 /* User Read-Only Thread ID Register */
 #define	CP15_TPIDRPRW(rr)	p15, 0, rr, c13, c0, 4 /* PL1 only Thread ID Register */
+
+/*
+ * CP15 C15 registers
+ */
+#define CP15_CBAR(rr)		p15, 4, rr, c15, c0, 0 /* Configuration Base Address Register */
 
 #endif /* !MACHINE_SYSREG_H */
Index: projects/arm_intrng/sys/arm/ti/ti_gpio.c
===================================================================
--- projects/arm_intrng/sys/arm/ti/ti_gpio.c	(revision 276247)
+++ projects/arm_intrng/sys/arm/ti/ti_gpio.c	(revision 276248)
@@ -1,829 +1,1097 @@
 /*-
- * Copyright (c) 2011
- *	Ben Gray .
+ * Copyright (c) 2011 Ben Gray .
+ * Copyright (c) 2014 Luiz Otavio O Souza .
  * 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 AUTHOR 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 AUTHOR 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.
  */
 
 /**
- *	Very simple GPIO (general purpose IO) driver module for TI OMAP SoC's.
- *
- *	Currently this driver only does the basics, get a value on a pin & set a
- *	value on a pin. Hopefully over time I'll expand this to be a bit more generic
- *	and support interrupts and other various bits on the SoC can do ... in the
- *	meantime this is all you get.
- *
- *	Beware the OMA datasheet(s) lists GPIO banks 1-6, whereas I've used 0-5 here
- *	in the code.
- *
- *
+ * Beware that the OMAP4 datasheet(s) lists GPIO banks 1-6, whereas the code
+ * here uses 0-5.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 
 #include "gpio_if.h"
 #include "ti_gpio_if.h"
 
 #if !defined(SOC_OMAP4) && !defined(SOC_TI_AM335X)
 #error "Unknown SoC"
 #endif
 
 /* Register definitions */
 #define	TI_GPIO_REVISION		0x0000
 #define	TI_GPIO_SYSCONFIG		0x0010
 #define	TI_GPIO_IRQSTATUS_RAW_0		0x0024
 #define	TI_GPIO_IRQSTATUS_RAW_1		0x0028
 #define	TI_GPIO_IRQSTATUS_0		0x002C
 #define	TI_GPIO_IRQSTATUS_1		0x0030
 #define	TI_GPIO_IRQSTATUS_SET_0		0x0034
 #define	TI_GPIO_IRQSTATUS_SET_1		0x0038
 #define	TI_GPIO_IRQSTATUS_CLR_0		0x003C
 #define	TI_GPIO_IRQSTATUS_CLR_1		0x0040
 #define	TI_GPIO_IRQWAKEN_0		0x0044
 #define	TI_GPIO_IRQWAKEN_1		0x0048
 #define	TI_GPIO_SYSSTATUS		0x0114
 #define	TI_GPIO_IRQSTATUS1		0x0118
 #define	TI_GPIO_IRQENABLE1		0x011C
 #define	TI_GPIO_WAKEUPENABLE		0x0120
 #define	TI_GPIO_IRQSTATUS2		0x0128
 #define	TI_GPIO_IRQENABLE2		0x012C
 #define	TI_GPIO_CTRL			0x0130
 #define	TI_GPIO_OE			0x0134
 #define	TI_GPIO_DATAIN			0x0138
 #define	TI_GPIO_DATAOUT			0x013C
 #define	TI_GPIO_LEVELDETECT0		0x0140
 #define	TI_GPIO_LEVELDETECT1		0x0144
 #define	TI_GPIO_RISINGDETECT		0x0148
 #define	TI_GPIO_FALLINGDETECT		0x014C
 #define	TI_GPIO_DEBOUNCENABLE		0x0150
 #define	TI_GPIO_DEBOUNCINGTIME		0x0154
 #define	TI_GPIO_CLEARWKUPENA		0x0180
 #define	TI_GPIO_SETWKUENA		0x0184
 #define	TI_GPIO_CLEARDATAOUT		0x0190
 #define	TI_GPIO_SETDATAOUT		0x0194
 
 /* Other SoC Specific definitions */
 #define	OMAP4_MAX_GPIO_BANKS		6
 #define	OMAP4_FIRST_GPIO_BANK		1
 #define	OMAP4_INTR_PER_BANK		1
 #define	OMAP4_GPIO_REV			0x50600801
 #define	AM335X_MAX_GPIO_BANKS		4
 #define	AM335X_FIRST_GPIO_BANK		0
 #define	AM335X_INTR_PER_BANK		2
 #define	AM335X_GPIO_REV			0x50600801
 #define	PINS_PER_BANK			32
 #define	TI_GPIO_BANK(p)			((p) / PINS_PER_BANK)
 #define	TI_GPIO_MASK(p)			(1U << ((p) % PINS_PER_BANK))
 
+static struct ti_gpio_softc *ti_gpio_sc = NULL;
+
 static u_int
 ti_max_gpio_banks(void)
 {
 	switch(ti_chip()) {
 #ifdef SOC_OMAP4
 	case CHIP_OMAP_4:
 		return (OMAP4_MAX_GPIO_BANKS);
 #endif
 #ifdef SOC_TI_AM335X
 	case CHIP_AM335X:
 		return (AM335X_MAX_GPIO_BANKS);
 #endif
 	}
 	return (0);
 }
 
 static u_int
 ti_max_gpio_intrs(void)
 {
 	switch(ti_chip()) {
 #ifdef SOC_OMAP4
 	case CHIP_OMAP_4:
 		return (OMAP4_MAX_GPIO_BANKS * OMAP4_INTR_PER_BANK);
 #endif
 #ifdef SOC_TI_AM335X
 	case CHIP_AM335X:
 		return (AM335X_MAX_GPIO_BANKS * AM335X_INTR_PER_BANK);
 #endif
 	}
 	return (0);
 }
 
 static u_int
 ti_first_gpio_bank(void)
 {
 	switch(ti_chip()) {
 #ifdef SOC_OMAP4
 	case CHIP_OMAP_4:
 		return (OMAP4_FIRST_GPIO_BANK);
 #endif
 #ifdef SOC_TI_AM335X
 	case CHIP_AM335X:
 		return (AM335X_FIRST_GPIO_BANK);
 #endif
 	}
 	return (0);
 }
 
 static uint32_t
 ti_gpio_rev(void)
 {
 	switch(ti_chip()) {
 #ifdef SOC_OMAP4
 	case CHIP_OMAP_4:
 		return (OMAP4_GPIO_REV);
 #endif
 #ifdef SOC_TI_AM335X
 	case CHIP_AM335X:
 		return (AM335X_GPIO_REV);
 #endif
 	}
 	return (0);
 }
 
 /**
  *	ti_gpio_mem_spec - Resource specification used when allocating resources
  *	ti_gpio_irq_spec - Resource specification used when allocating resources
  *
  *	This driver module can have up to six independent memory regions, each
  *	region typically controls 32 GPIO pins.
  *
  *	On OMAP3 and OMAP4 there is only one physical interrupt line per bank,
  *	but there are two set of registers which control the interrupt delivery
  *	to internal subsystems.  The first set of registers control the
  *	interrupts delivery to the MPU and the second set control the
  *	interrupts delivery to the DSP.
  *
  *	On AM335x there are two physical interrupt lines for each GPIO module.
  *	Each interrupt line is controlled by a set of registers.
  */
 static struct resource_spec ti_gpio_mem_spec[] = {
 	{ SYS_RES_MEMORY,   0,  RF_ACTIVE },
 	{ SYS_RES_MEMORY,   1,  RF_ACTIVE | RF_OPTIONAL },
 	{ SYS_RES_MEMORY,   2,  RF_ACTIVE | RF_OPTIONAL },
 	{ SYS_RES_MEMORY,   3,  RF_ACTIVE | RF_OPTIONAL },
 #if !defined(SOC_TI_AM335X)
 	{ SYS_RES_MEMORY,   4,  RF_ACTIVE | RF_OPTIONAL },
 	{ SYS_RES_MEMORY,   5,  RF_ACTIVE | RF_OPTIONAL },
 #endif
 	{ -1,               0,  0 }
 };
 static struct resource_spec ti_gpio_irq_spec[] = {
 	{ SYS_RES_IRQ,      0,  RF_ACTIVE },
 	{ SYS_RES_IRQ,      1,  RF_ACTIVE | RF_OPTIONAL },
 	{ SYS_RES_IRQ,      2,  RF_ACTIVE | RF_OPTIONAL },
 	{ SYS_RES_IRQ,      3,  RF_ACTIVE | RF_OPTIONAL },
 	{ SYS_RES_IRQ,      4,  RF_ACTIVE | RF_OPTIONAL },
 	{ SYS_RES_IRQ,      5,  RF_ACTIVE | RF_OPTIONAL },
 #if defined(SOC_TI_AM335X)
 	{ SYS_RES_IRQ,      6,  RF_ACTIVE | RF_OPTIONAL },
 	{ SYS_RES_IRQ,      7,  RF_ACTIVE | RF_OPTIONAL },
 #endif
 	{ -1,               0,  0 }
 };
 
 /**
  *	Macros for driver mutex locking
  */
-#define	TI_GPIO_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
-#define	TI_GPIO_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
+#define	TI_GPIO_LOCK(_sc)		mtx_lock_spin(&(_sc)->sc_mtx)
+#define	TI_GPIO_UNLOCK(_sc)		mtx_unlock_spin(&(_sc)->sc_mtx)
 #define	TI_GPIO_LOCK_INIT(_sc)		\
-	mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), \
-	    "ti_gpio", MTX_DEF)
-#define	TI_GPIO_LOCK_DESTROY(_sc)	mtx_destroy(&_sc->sc_mtx)
-#define	TI_GPIO_ASSERT_LOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_OWNED)
-#define	TI_GPIO_ASSERT_UNLOCKED(_sc)	mtx_assert(&_sc->sc_mtx, MA_NOTOWNED)
+	mtx_init(&_sc->sc_mtx, device_get_nameunit((_sc)->sc_dev), \
+	    "ti_gpio", MTX_SPIN)
+#define	TI_GPIO_LOCK_DESTROY(_sc)	mtx_destroy(&(_sc)->sc_mtx)
+#define	TI_GPIO_ASSERT_LOCKED(_sc)	mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
+#define	TI_GPIO_ASSERT_UNLOCKED(_sc)	mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED)
 
 /**
  *	ti_gpio_read_4 - reads a 32-bit value from one of the GPIO registers
  *	@sc: GPIO device context
  *	@bank: The bank to read from
  *	@off: The offset of a register from the GPIO register address range
  *
  *
  *	RETURNS:
  *	32-bit value read from the register.
  */
 static inline uint32_t
 ti_gpio_read_4(struct ti_gpio_softc *sc, unsigned int bank, bus_size_t off)
 {
 	return (bus_read_4(sc->sc_mem_res[bank], off));
 }
 
 /**
  *	ti_gpio_write_4 - writes a 32-bit value to one of the GPIO registers
  *	@sc: GPIO device context
  *	@bank: The bank to write to
  *	@off: The offset of a register from the GPIO register address range
  *	@val: The value to write into the register
  *
  *	RETURNS:
  *	nothing
  */
 static inline void
 ti_gpio_write_4(struct ti_gpio_softc *sc, unsigned int bank, bus_size_t off,
                  uint32_t val)
 {
 	bus_write_4(sc->sc_mem_res[bank], off, val);
 }
 
 static inline void
 ti_gpio_intr_clr(struct ti_gpio_softc *sc, unsigned int bank, uint32_t mask)
 {
 
 	/* We clear both set of registers. */
 	ti_gpio_write_4(sc, bank, TI_GPIO_IRQSTATUS_CLR_0, mask);
 	ti_gpio_write_4(sc, bank, TI_GPIO_IRQSTATUS_CLR_1, mask);
 }
 
+static inline void
+ti_gpio_intr_set(struct ti_gpio_softc *sc, unsigned int bank, uint32_t mask)
+{
+
+	/*
+	 * On OMAP4 we unmask only the MPU interrupt and on AM335x we
+	 * also activate only the first interrupt.
+	 */
+	ti_gpio_write_4(sc, bank, TI_GPIO_IRQSTATUS_SET_0, mask);
+}
+
+static inline void
+ti_gpio_intr_ack(struct ti_gpio_softc *sc, unsigned int bank, uint32_t mask)
+{
+
+	/*
+	 * Acknowledge the interrupt on both registers even if we use only
+	 * the first one.
+	 */
+	ti_gpio_write_4(sc, bank, TI_GPIO_IRQSTATUS_0, mask);
+	ti_gpio_write_4(sc, bank, TI_GPIO_IRQSTATUS_1, mask);
+}
+
+static inline uint32_t
+ti_gpio_intr_status(struct ti_gpio_softc *sc, unsigned int bank)
+{
+	uint32_t reg;
+
+	/* Get the status from both registers. */
+	reg = ti_gpio_read_4(sc, bank, TI_GPIO_IRQSTATUS_0);
+	reg |= ti_gpio_read_4(sc, bank, TI_GPIO_IRQSTATUS_1);
+
+	return (reg);
+}
+
 /**
  *	ti_gpio_pin_max - Returns the maximum number of GPIO pins
  *	@dev: gpio device handle
  *	@maxpin: pointer to a value that upon return will contain the maximum number
  *	         of pins in the device.
  *
  *
  *	LOCKING:
  *	No locking required, returns static data.
  *
  *	RETURNS:
  *	Returns 0 on success otherwise an error code
  */
 static int
 ti_gpio_pin_max(device_t dev, int *maxpin)
 {
 
 	*maxpin = ti_max_gpio_banks() * PINS_PER_BANK - 1;
 
 	return (0);
 }
 
 static int
 ti_gpio_valid_pin(struct ti_gpio_softc *sc, int pin)
 {
 
 	if (pin > sc->sc_maxpin ||
 	    TI_GPIO_BANK(pin) >= ti_max_gpio_banks() ||
 	    sc->sc_mem_res[TI_GPIO_BANK(pin)] == NULL) {
 		return (EINVAL);
 	}
 
 	return (0);
 }
 
 /**
  *	ti_gpio_pin_getcaps - Gets the capabilties of a given pin
  *	@dev: gpio device handle
  *	@pin: the number of the pin
  *	@caps: pointer to a value that upon return will contain the capabilities
  *
  *	Currently all pins have the same capability, notably:
  *	  - GPIO_PIN_INPUT
  *	  - GPIO_PIN_OUTPUT
  *	  - GPIO_PIN_PULLUP
  *	  - GPIO_PIN_PULLDOWN
  *
  *	LOCKING:
  *	No locking required, returns static data.
  *
  *	RETURNS:
  *	Returns 0 on success otherwise an error code
  */
 static int
 ti_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps)
 {
 	struct ti_gpio_softc *sc;
 
 	sc = device_get_softc(dev);
 	if (ti_gpio_valid_pin(sc, pin) != 0)
 		return (EINVAL);
 
 	*caps = (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | GPIO_PIN_PULLUP |
 	    GPIO_PIN_PULLDOWN);
 
 	return (0);
 }
 
 /**
  *	ti_gpio_pin_getflags - Gets the current flags of a given pin
  *	@dev: gpio device handle
  *	@pin: the number of the pin
  *	@flags: upon return will contain the current flags of the pin
  *
  *	Reads the current flags of a given pin, here we actually read the H/W
  *	registers to determine the flags, rather than storing the value in the
  *	setflags call.
  *
  *	LOCKING:
  *	Internally locks the context
  *
  *	RETURNS:
  *	Returns 0 on success otherwise an error code
  */
 static int
 ti_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
 {
 	struct ti_gpio_softc *sc;
 
 	sc = device_get_softc(dev);
 	if (ti_gpio_valid_pin(sc, pin) != 0)
 		return (EINVAL);
 
 	/* Get the current pin state */
 	TI_GPIO_LOCK(sc);
 	TI_GPIO_GET_FLAGS(dev, pin, flags);
 	TI_GPIO_UNLOCK(sc);
 
 	return (0);
 }
 
 /**
  *	ti_gpio_pin_getname - Gets the name of a given pin
  *	@dev: gpio device handle
  *	@pin: the number of the pin
  *	@name: buffer to put the name in
  *
  *	The driver simply calls the pins gpio_n, where 'n' is obviously the number
  *	of the pin.
  *
  *	LOCKING:
  *	No locking required, returns static data.
  *
  *	RETURNS:
  *	Returns 0 on success otherwise an error code
  */
 static int
 ti_gpio_pin_getname(device_t dev, uint32_t pin, char *name)
 {
 	struct ti_gpio_softc *sc;
 
 	sc = device_get_softc(dev);
 	if (ti_gpio_valid_pin(sc, pin) != 0)
 		return (EINVAL);
 
 	/* Set a very simple name */
 	snprintf(name, GPIOMAXNAME, "gpio_%u", pin);
 	name[GPIOMAXNAME - 1] = '\0';
 
 	return (0);
 }
 
 /**
  *	ti_gpio_pin_setflags - Sets the flags for a given pin
  *	@dev: gpio device handle
  *	@pin: the number of the pin
  *	@flags: the flags to set
  *
  *	The flags of the pin correspond to things like input/output mode, pull-ups,
  *	pull-downs, etc.  This driver doesn't support all flags, only the following:
  *	  - GPIO_PIN_INPUT
  *	  - GPIO_PIN_OUTPUT
  *	  - GPIO_PIN_PULLUP
  *	  - GPIO_PIN_PULLDOWN
  *
  *	LOCKING:
  *	Internally locks the context
  *
  *	RETURNS:
  *	Returns 0 on success otherwise an error code
  */
 static int
 ti_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
 {
 	struct ti_gpio_softc *sc;
 	uint32_t oe;
 
 	sc = device_get_softc(dev);
 	if (ti_gpio_valid_pin(sc, pin) != 0)
 		return (EINVAL);
 
 	/* Set the GPIO mode and state */
 	TI_GPIO_LOCK(sc);
 	if (TI_GPIO_SET_FLAGS(dev, pin, flags) != 0) {
 		TI_GPIO_UNLOCK(sc);
 		return (EINVAL);
 	}
 
 	/* If configuring as an output set the "output enable" bit */
 	oe = ti_gpio_read_4(sc, TI_GPIO_BANK(pin), TI_GPIO_OE);
 	if (flags & GPIO_PIN_INPUT)
 		oe |= TI_GPIO_MASK(pin);
 	else
 		oe &= ~TI_GPIO_MASK(pin);
 	ti_gpio_write_4(sc, TI_GPIO_BANK(pin), TI_GPIO_OE, oe);
 	TI_GPIO_UNLOCK(sc);
 	
 	return (0);
 }
 
 /**
  *	ti_gpio_pin_set - Sets the current level on a GPIO pin
  *	@dev: gpio device handle
  *	@pin: the number of the pin
  *	@value: non-zero value will drive the pin high, otherwise the pin is
  *	        driven low.
  *
  *
  *	LOCKING:
  *	Internally locks the context
  *
  *	RETURNS:
  *	Returns 0 on success otherwise a error code
  */
 static int
 ti_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value)
 {
 	struct ti_gpio_softc *sc;
 	uint32_t reg;
 
 	sc = device_get_softc(dev);
 	if (ti_gpio_valid_pin(sc, pin) != 0)
 		return (EINVAL);
 
 	TI_GPIO_LOCK(sc);
 	if (value == GPIO_PIN_LOW)
 		reg = TI_GPIO_CLEARDATAOUT;
 	else
 		reg = TI_GPIO_SETDATAOUT;
 	ti_gpio_write_4(sc, TI_GPIO_BANK(pin), reg, TI_GPIO_MASK(pin));
 	TI_GPIO_UNLOCK(sc);
 
 	return (0);
 }
 
 /**
  *	ti_gpio_pin_get - Gets the current level on a GPIO pin
  *	@dev: gpio device handle
  *	@pin: the number of the pin
  *	@value: pointer to a value that upond return will contain the pin value
  *
  *	The pin must be configured as an input pin beforehand, otherwise this
  *	function will fail.
  *
  *	LOCKING:
  *	Internally locks the context
  *
  *	RETURNS:
  *	Returns 0 on success otherwise a error code
  */
 static int
 ti_gpio_pin_get(device_t dev, uint32_t pin, unsigned int *value)
 {
 	struct ti_gpio_softc *sc;
 	uint32_t oe, reg, val;
 
 	sc = device_get_softc(dev);
 	if (ti_gpio_valid_pin(sc, pin) != 0)
 		return (EINVAL);
 
 	/*
 	 * Return data from output latch when set as output and from the 
 	 * input register otherwise.
 	 */
 	TI_GPIO_LOCK(sc);
 	oe = ti_gpio_read_4(sc, TI_GPIO_BANK(pin), TI_GPIO_OE);
 	if (oe & TI_GPIO_MASK(pin))
 		reg = TI_GPIO_DATAIN;
 	else
 		reg = TI_GPIO_DATAOUT;
 	val = ti_gpio_read_4(sc, TI_GPIO_BANK(pin), reg);
 	*value = (val & TI_GPIO_MASK(pin)) ? 1 : 0;
 	TI_GPIO_UNLOCK(sc);
 
 	return (0);
 }
 
 /**
  *	ti_gpio_pin_toggle - Toggles a given GPIO pin
  *	@dev: gpio device handle
  *	@pin: the number of the pin
  *
  *
  *	LOCKING:
  *	Internally locks the context
  *
  *	RETURNS:
  *	Returns 0 on success otherwise a error code
  */
 static int
 ti_gpio_pin_toggle(device_t dev, uint32_t pin)
 {
 	struct ti_gpio_softc *sc;
 	uint32_t reg, val;
 
 	sc = device_get_softc(dev);
 	if (ti_gpio_valid_pin(sc, pin) != 0)
 		return (EINVAL);
 
 	/* Toggle the pin */
 	TI_GPIO_LOCK(sc);
 	val = ti_gpio_read_4(sc, TI_GPIO_BANK(pin), TI_GPIO_DATAOUT);
 	if (val & TI_GPIO_MASK(pin))
 		reg = TI_GPIO_CLEARDATAOUT;
 	else
 		reg = TI_GPIO_SETDATAOUT;
 	ti_gpio_write_4(sc, TI_GPIO_BANK(pin), reg, TI_GPIO_MASK(pin));
 	TI_GPIO_UNLOCK(sc);
 
 	return (0);
 }
 
 /**
  *	ti_gpio_intr - ISR for all GPIO modules
  *	@arg: the soft context pointer
  *
- *	Unsused
- *
  *	LOCKING:
  *	Internally locks the context
  *
  */
-static void
+static int
 ti_gpio_intr(void *arg)
 {
-	struct ti_gpio_softc *sc = arg;
+	int bank_last, irq;
+	struct intr_event *event;
+	struct ti_gpio_softc *sc;
+	uint32_t reg;
 
-	TI_GPIO_LOCK(sc);
-	/* TODO: something useful */
-	TI_GPIO_UNLOCK(sc);
+	sc = (struct ti_gpio_softc *)arg;
+	bank_last = -1;
+	reg = 0; /* squelch bogus gcc warning */
+	for (irq = 0; irq < sc->sc_maxpin; irq++) {
+
+		/* Read interrupt status only once for each bank. */
+		if (TI_GPIO_BANK(irq) != bank_last) {
+			reg = ti_gpio_intr_status(sc, TI_GPIO_BANK(irq));
+			bank_last = TI_GPIO_BANK(irq);
+		}
+		if ((reg & TI_GPIO_MASK(irq)) == 0)
+			continue;
+		event = sc->sc_events[irq];
+		if (event != NULL && !TAILQ_EMPTY(&event->ie_handlers))
+			intr_event_handle(event, NULL);
+		else
+			device_printf(sc->sc_dev, "Stray IRQ %d\n", irq);
+		/* Ack the IRQ Status bit. */
+		ti_gpio_intr_ack(sc, TI_GPIO_BANK(irq), TI_GPIO_MASK(irq));
+	}
+
+	return (FILTER_HANDLED);
 }
 
 static int
 ti_gpio_attach_intr(device_t dev)
 {
 	int i;
 	struct ti_gpio_softc *sc;
 
 	sc = device_get_softc(dev);
 	for (i = 0; i < ti_max_gpio_intrs(); i++) {
 		if (sc->sc_irq_res[i] == NULL)
 			break;
 
 		/*
-		 * Register our interrupt handler for each of the IRQ resources.
+		 * Register our interrupt filter for each of the IRQ resources.
 		 */
 		if (bus_setup_intr(dev, sc->sc_irq_res[i],
-		    INTR_TYPE_MISC | INTR_MPSAFE, NULL, ti_gpio_intr, sc,
+		    INTR_TYPE_MISC | INTR_MPSAFE, ti_gpio_intr, NULL, sc,
 		    &sc->sc_irq_hdl[i]) != 0) {
 			device_printf(dev,
-			    "WARNING: unable to register interrupt handler\n");
+			    "WARNING: unable to register interrupt filter\n");
 			return (-1);
 		}
 	}
 
 	return (0);
 }
 
 static int
 ti_gpio_detach_intr(device_t dev)
 {
 	int i;
 	struct ti_gpio_softc *sc;
 
-	/* Teardown our interrupt handlers. */
+	/* Teardown our interrupt filters. */
 	sc = device_get_softc(dev);
 	for (i = 0; i < ti_max_gpio_intrs(); i++) {
 		if (sc->sc_irq_res[i] == NULL)
 			break;
 
 		if (sc->sc_irq_hdl[i]) {
 			bus_teardown_intr(dev, sc->sc_irq_res[i],
 			    sc->sc_irq_hdl[i]);
 		}
 	}
 
 	return (0);
 }
 
 static int
 ti_gpio_bank_init(device_t dev, int bank)
 {
 	int pin;
 	struct ti_gpio_softc *sc;
 	uint32_t flags, reg_oe, rev;
 
 	sc = device_get_softc(dev);
 
 	/* Enable the interface and functional clocks for the module. */
 	ti_prcm_clk_enable(GPIO0_CLK + ti_first_gpio_bank() + bank);
 
 	/*
 	 * Read the revision number of the module.  TI don't publish the
 	 * actual revision numbers, so instead the values have been
 	 * determined by experimentation.
 	 */
 	rev = ti_gpio_read_4(sc, bank, TI_GPIO_REVISION);
 
 	/* Check the revision. */
 	if (rev != ti_gpio_rev()) {
 		device_printf(dev, "Warning: could not determine the revision "
 		    "of GPIO module %d (revision:0x%08x)\n", bank, rev);
 		return (EINVAL);
 	}
 
 	/* Disable interrupts for all pins. */
 	ti_gpio_intr_clr(sc, bank, 0xffffffff);
 
 	/* Init OE register based on pads configuration. */
 	reg_oe = 0xffffffff;
 	for (pin = 0; pin < PINS_PER_BANK; pin++) {
 		TI_GPIO_GET_FLAGS(dev, PINS_PER_BANK * bank + pin, &flags);
 		if (flags & GPIO_PIN_OUTPUT)
 			reg_oe &= ~(1UL << pin);
 	}
 	ti_gpio_write_4(sc, bank, TI_GPIO_OE, reg_oe);
 
 	return (0);
 }
 
 /**
  *	ti_gpio_attach - attach function for the driver
  *	@dev: gpio device handle
  *
  *	Allocates and sets up the driver context for all GPIO banks.  This function
  *	expects the memory ranges and IRQs to already be allocated to the driver.
  *
  *	LOCKING:
  *	None
  *
  *	RETURNS:
  *	Always returns 0
  */
 static int
 ti_gpio_attach(device_t dev)
 {
 	struct ti_gpio_softc *sc;
 	unsigned int i;
 	int err;
 
- 	sc = device_get_softc(dev);
+	if (ti_gpio_sc != NULL)
+		return (ENXIO);
+
+	ti_gpio_sc = sc = device_get_softc(dev);
 	sc->sc_dev = dev;
 	TI_GPIO_LOCK_INIT(sc);
 	ti_gpio_pin_max(dev, &sc->sc_maxpin);
 
 	/* There are up to 6 different GPIO register sets located in different
 	 * memory areas on the chip.  The memory range should have been set for
 	 * the driver when it was added as a child.
 	 */
 	if (bus_alloc_resources(dev, ti_gpio_mem_spec, sc->sc_mem_res) != 0) {
 		device_printf(dev, "Error: could not allocate mem resources\n");
 		return (ENXIO);
 	}
 
 	/* Request the IRQ resources */
 	if (bus_alloc_resources(dev, ti_gpio_irq_spec, sc->sc_irq_res) != 0) {
 		bus_release_resources(dev, ti_gpio_mem_spec, sc->sc_mem_res);
 		device_printf(dev, "Error: could not allocate irq resources\n");
 		return (ENXIO);
 	}
 
 	/* Setup the IRQ resources */
 	if (ti_gpio_attach_intr(dev) != 0) {
 		ti_gpio_detach_intr(dev);
 		bus_release_resources(dev, ti_gpio_irq_spec, sc->sc_irq_res);
 		bus_release_resources(dev, ti_gpio_mem_spec, sc->sc_mem_res);
 		return (ENXIO);
 	}
 
+	/*
+	 * Initialize the interrupt settings.  The default is active-low
+	 * interrupts.
+	 */
+	sc->sc_irq_trigger = malloc(
+	    sizeof(*sc->sc_irq_trigger) * sc->sc_maxpin,
+	    M_DEVBUF, M_WAITOK | M_ZERO);
+	sc->sc_irq_polarity = malloc(
+	    sizeof(*sc->sc_irq_polarity) * sc->sc_maxpin,
+	    M_DEVBUF, M_WAITOK | M_ZERO);
+	for (i = 0; i < sc->sc_maxpin; i++) {
+		sc->sc_irq_trigger[i] = INTR_TRIGGER_LEVEL;
+		sc->sc_irq_polarity[i] = INTR_POLARITY_LOW;
+	}
+
+	sc->sc_events = malloc(sizeof(struct intr_event *) * sc->sc_maxpin,
+	    M_DEVBUF, M_WAITOK | M_ZERO);
+
 	/* We need to go through each block and ensure the clocks are running and
 	 * the module is enabled.  It might be better to do this only when the
 	 * pins are configured which would result in less power used if the GPIO
 	 * pins weren't used ... 
 	 */
 	for (i = 0; i < ti_max_gpio_banks(); i++) {
 		if (sc->sc_mem_res[i] != NULL) {
 			/* Initialize the GPIO module. */
 			err = ti_gpio_bank_init(dev, i);
 			if (err != 0) {
 				ti_gpio_detach_intr(dev);
 				bus_release_resources(dev, ti_gpio_irq_spec,
 				    sc->sc_irq_res);
 				bus_release_resources(dev, ti_gpio_mem_spec,
 				    sc->sc_mem_res);
 				return (err);
 			}
 		}
 	}
 
 	/* Finish of the probe call */
 	device_add_child(dev, "gpioc", -1);
 	device_add_child(dev, "gpiobus", -1);
 
 	return (bus_generic_attach(dev));
 }
 
 /**
  *	ti_gpio_detach - detach function for the driver
  *	@dev: scm device handle
  *
  *	Allocates and sets up the driver context, this simply entails creating a
  *	bus mappings for the SCM register set.
  *
  *	LOCKING:
  *	None
  *
  *	RETURNS:
  *	Always returns 0
  */
 static int
 ti_gpio_detach(device_t dev)
 {
 	struct ti_gpio_softc *sc = device_get_softc(dev);
 	unsigned int i;
 
 	KASSERT(mtx_initialized(&sc->sc_mtx), ("gpio mutex not initialized"));
 
 	/* Disable all interrupts */
 	for (i = 0; i < ti_max_gpio_banks(); i++) {
 		if (sc->sc_mem_res[i] != NULL)
 			ti_gpio_intr_clr(sc, i, 0xffffffff);
 	}
 
 	bus_generic_detach(dev);
 
+	free(sc->sc_events, M_DEVBUF);
+	free(sc->sc_irq_polarity, M_DEVBUF);
+	free(sc->sc_irq_trigger, M_DEVBUF);
+
 	/* Release the memory and IRQ resources. */
 	ti_gpio_detach_intr(dev);
 	bus_release_resources(dev, ti_gpio_irq_spec, sc->sc_irq_res);
 	bus_release_resources(dev, ti_gpio_mem_spec, sc->sc_mem_res);
 
 	TI_GPIO_LOCK_DESTROY(sc);
 
 	return (0);
 }
 
+static uint32_t
+ti_gpio_intr_reg(struct ti_gpio_softc *sc, int irq)
+{
+
+	if (ti_gpio_valid_pin(sc, irq) != 0)
+		return (0);
+
+	if (sc->sc_irq_trigger[irq] == INTR_TRIGGER_LEVEL) {
+		if (sc->sc_irq_polarity[irq] == INTR_POLARITY_LOW)
+			return (TI_GPIO_LEVELDETECT0);
+		else if (sc->sc_irq_polarity[irq] == INTR_POLARITY_HIGH)
+			return (TI_GPIO_LEVELDETECT1);
+	} else if (sc->sc_irq_trigger[irq] == INTR_TRIGGER_EDGE) {
+		if (sc->sc_irq_polarity[irq] == INTR_POLARITY_LOW)
+			return (TI_GPIO_FALLINGDETECT);
+		else if (sc->sc_irq_polarity[irq] == INTR_POLARITY_HIGH)
+			return (TI_GPIO_RISINGDETECT);
+	}
+
+	return (0);
+}
+
+static void
+ti_gpio_mask_irq(void *source)
+{
+	int irq;
+	uint32_t reg, val;
+
+	irq = (int)source;
+	if (ti_gpio_valid_pin(ti_gpio_sc, irq) != 0)
+		return;
+
+	TI_GPIO_LOCK(ti_gpio_sc);
+	ti_gpio_intr_clr(ti_gpio_sc, TI_GPIO_BANK(irq), TI_GPIO_MASK(irq));
+	reg = ti_gpio_intr_reg(ti_gpio_sc, irq);
+	if (reg != 0) {
+		val = ti_gpio_read_4(ti_gpio_sc, TI_GPIO_BANK(irq), reg);
+		val &= ~TI_GPIO_MASK(irq);
+		ti_gpio_write_4(ti_gpio_sc, TI_GPIO_BANK(irq), reg, val);
+	}
+	TI_GPIO_UNLOCK(ti_gpio_sc);
+}
+
+static void
+ti_gpio_unmask_irq(void *source)
+{
+	int irq;
+	uint32_t reg, val;
+
+	irq = (int)source;
+	if (ti_gpio_valid_pin(ti_gpio_sc, irq) != 0)
+		return;
+
+	TI_GPIO_LOCK(ti_gpio_sc);
+	reg = ti_gpio_intr_reg(ti_gpio_sc, irq);
+	if (reg != 0) {
+		val = ti_gpio_read_4(ti_gpio_sc, TI_GPIO_BANK(irq), reg);
+		val |= TI_GPIO_MASK(irq);
+		ti_gpio_write_4(ti_gpio_sc, TI_GPIO_BANK(irq), reg, val);
+		ti_gpio_intr_set(ti_gpio_sc, TI_GPIO_BANK(irq),
+		    TI_GPIO_MASK(irq));
+	}
+	TI_GPIO_UNLOCK(ti_gpio_sc);
+}
+
+static int
+ti_gpio_activate_resource(device_t dev, device_t child, int type, int rid,
+	struct resource *res)
+{
+	int pin;
+
+	if (type != SYS_RES_IRQ)
+		return (ENXIO);
+
+	/* Unmask the interrupt. */
+	pin = rman_get_start(res);
+	ti_gpio_unmask_irq((void *)(uintptr_t)pin);
+
+	return (0);
+}
+
+static int
+ti_gpio_deactivate_resource(device_t dev, device_t child, int type, int rid,
+	struct resource *res)
+{
+	int pin;
+
+	if (type != SYS_RES_IRQ)
+		return (ENXIO);
+
+	/* Mask the interrupt. */
+	pin = rman_get_start(res);
+	ti_gpio_mask_irq((void *)(uintptr_t)pin);
+
+	return (0);
+}
+
+static int
+ti_gpio_config_intr(device_t dev, int irq, enum intr_trigger trig,
+	enum intr_polarity pol)
+{
+	struct ti_gpio_softc *sc;
+	uint32_t oldreg, reg, val;
+
+	sc = device_get_softc(dev);
+	if (ti_gpio_valid_pin(sc, irq) != 0)
+		return (EINVAL);
+
+	/* There is no standard trigger or polarity. */
+	if (trig == INTR_TRIGGER_CONFORM || pol == INTR_POLARITY_CONFORM)
+		return (EINVAL);
+
+	TI_GPIO_LOCK(sc);
+	/*
+	 * TRM recommends add the new event before remove the old one to
+	 * avoid losing interrupts.
+	 */
+	oldreg = ti_gpio_intr_reg(sc, irq);
+	sc->sc_irq_trigger[irq] = trig;
+	sc->sc_irq_polarity[irq] = pol;
+	reg = ti_gpio_intr_reg(sc, irq);
+	if (reg != 0) {
+		/* Apply the new settings. */
+		val = ti_gpio_read_4(sc, TI_GPIO_BANK(irq), reg);
+		val |= TI_GPIO_MASK(irq);
+		ti_gpio_write_4(sc, TI_GPIO_BANK(irq), reg, val);
+	}
+	if (oldreg != 0) {
+		/* Remove the old settings. */
+		val = ti_gpio_read_4(sc, TI_GPIO_BANK(irq), oldreg);
+		val &= ~TI_GPIO_MASK(irq);
+		ti_gpio_write_4(sc, TI_GPIO_BANK(irq), oldreg, val);
+	}
+	TI_GPIO_UNLOCK(sc);
+
+	return (0);
+}
+
+static int
+ti_gpio_setup_intr(device_t dev, device_t child, struct resource *ires,
+	int flags, driver_filter_t *filt, driver_intr_t *handler,
+	void *arg, void **cookiep)
+{
+	struct ti_gpio_softc *sc;
+	struct intr_event *event;
+	int pin, error;
+
+	sc = device_get_softc(dev);
+	pin = rman_get_start(ires);
+	if (ti_gpio_valid_pin(sc, pin) != 0)
+		panic("%s: bad pin %d", __func__, pin);
+
+	event = sc->sc_events[pin];
+	if (event == NULL) {
+		error = intr_event_create(&event, (void *)(uintptr_t)pin, 0,
+		    pin, ti_gpio_mask_irq, ti_gpio_unmask_irq, NULL, NULL,
+		    "gpio%d pin%d:", device_get_unit(dev), pin);
+		if (error != 0)
+			return (error);
+		sc->sc_events[pin] = event;
+	}
+	intr_event_add_handler(event, device_get_nameunit(child), filt,
+	    handler, arg, intr_priority(flags), flags, cookiep);
+
+	return (0);
+}
+
+static int
+ti_gpio_teardown_intr(device_t dev, device_t child, struct resource *ires,
+	void *cookie)
+{
+	struct ti_gpio_softc *sc;
+	int pin, err;
+
+	sc = device_get_softc(dev);
+	pin = rman_get_start(ires);
+	if (ti_gpio_valid_pin(sc, pin) != 0)
+		panic("%s: bad pin %d", __func__, pin);
+	if (sc->sc_events[pin] == NULL)
+		panic("Trying to teardown unoccupied IRQ");
+	err = intr_event_remove_handler(cookie);
+	if (!err)
+		sc->sc_events[pin] = NULL;
+
+	return (err);
+}
+
 static phandle_t
 ti_gpio_get_node(device_t bus, device_t dev)
 {
 
 	/* We only have one child, the GPIO bus, which needs our own node. */
 	return (ofw_bus_get_node(bus));
 }
 
 static device_method_t ti_gpio_methods[] = {
 	DEVMETHOD(device_attach, ti_gpio_attach),
 	DEVMETHOD(device_detach, ti_gpio_detach),
 
 	/* GPIO protocol */
 	DEVMETHOD(gpio_pin_max, ti_gpio_pin_max),
 	DEVMETHOD(gpio_pin_getname, ti_gpio_pin_getname),
 	DEVMETHOD(gpio_pin_getflags, ti_gpio_pin_getflags),
 	DEVMETHOD(gpio_pin_getcaps, ti_gpio_pin_getcaps),
 	DEVMETHOD(gpio_pin_setflags, ti_gpio_pin_setflags),
 	DEVMETHOD(gpio_pin_get, ti_gpio_pin_get),
 	DEVMETHOD(gpio_pin_set, ti_gpio_pin_set),
 	DEVMETHOD(gpio_pin_toggle, ti_gpio_pin_toggle),
+
+	/* Bus interface */
+	DEVMETHOD(bus_activate_resource, ti_gpio_activate_resource),
+	DEVMETHOD(bus_deactivate_resource, ti_gpio_deactivate_resource),
+	DEVMETHOD(bus_config_intr, ti_gpio_config_intr),
+	DEVMETHOD(bus_setup_intr, ti_gpio_setup_intr),
+	DEVMETHOD(bus_teardown_intr, ti_gpio_teardown_intr),
 
 	/* ofw_bus interface */
 	DEVMETHOD(ofw_bus_get_node, ti_gpio_get_node),
 
 	{0, 0},
 };
 
 driver_t ti_gpio_driver = {
 	"gpio",
 	ti_gpio_methods,
 	sizeof(struct ti_gpio_softc),
 };
Index: projects/arm_intrng/sys/arm/ti/ti_gpio.h
===================================================================
--- projects/arm_intrng/sys/arm/ti/ti_gpio.h	(revision 276247)
+++ projects/arm_intrng/sys/arm/ti/ti_gpio.h	(revision 276248)
@@ -1,64 +1,72 @@
 /*-
  * Copyright (c) 2011
  *	Ben Gray .
  * 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 AUTHOR 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 AUTHOR 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.
  *
  * $FreeBSD$
  */
 
 #ifndef TI_GPIO_H
 #define	TI_GPIO_H
 
 /* The maximum number of banks for any SoC */
 #define	MAX_GPIO_BANKS			6
 
 /*
  * Maximum GPIOS possible, max of *_MAX_GPIO_BANKS * *_INTR_PER_BANK.
  * These are defined in ti_gpio.c
  */
 #define	MAX_GPIO_INTRS			8
 
 /**
  *	Structure that stores the driver context.
  *
  *	This structure is allocated during driver attach.
  */
 struct ti_gpio_softc {
 	device_t		sc_dev;
+
+	/* Interrupt trigger type and level. */
+	enum intr_trigger	*sc_irq_trigger;
+	enum intr_polarity	*sc_irq_polarity;
+
 	int			sc_maxpin;
 	struct mtx		sc_mtx;
 
 	/*
 	 * The memory resource(s) for the PRCM register set, when the device is
 	 * created the caller can assign up to 6 memory regions depending on
 	 * the SoC type.
 	 */
 	struct resource		*sc_mem_res[MAX_GPIO_BANKS];
 	struct resource		*sc_irq_res[MAX_GPIO_INTRS];
+
+	/* Interrupt events. */
+	struct intr_event	**sc_events;
 
 	/* The handle for the register IRQ handlers. */
 	void			*sc_irq_hdl[MAX_GPIO_INTRS];
 };
 
 #endif /* TI_GPIO_H */
Index: projects/arm_intrng/sys/boot/fdt/dts/arm/am335x.dtsi
===================================================================
--- projects/arm_intrng/sys/boot/fdt/dts/arm/am335x.dtsi	(revision 276247)
+++ projects/arm_intrng/sys/boot/fdt/dts/arm/am335x.dtsi	(revision 276248)
@@ -1,335 +1,337 @@
 /*-
  * Copyright (c) 2012 Damjan Marion 
  * 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 AUTHOR 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 AUTHOR 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.
  * 
  * $FreeBSD$
  */
 
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
 
 	interrupt-parent = <&AINTC>;
 
 	SOC: am335x {
 		#address-cells = <1>;
 		#size-cells = <1>;
 		compatible = "simple-bus";
 		ranges;
 		bus-frequency = <0>;
 
 		AINTC: interrupt-controller@48200000 {
 			compatible = "ti,aintc";
 			interrupt-controller;
 			#address-cells = <0>;
 			#interrupt-cells = <1>;
 			reg =	< 0x48200000 0x1000 >;
 		};
 
 		scm@44e10000 {
 			compatible = "ti,scm";
 			reg =	< 0x44e10000 0x2000 >;
 		};
 
 		prcm@44E00000 {
 			compatible = "am335x,prcm";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			reg = < 0x44E00000 0x1300 >;
 		};
 
 		dmtimers@44E05000 {
 			compatible = "ti,am335x-dmtimer";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			reg =	< 0x44E05000 0x1000
 				  0x44E31000 0x1000
 				  0x48040000 0x1000
 				  0x48042000 0x1000
 				  0x48044000 0x1000
 				  0x48046000 0x1000
 				  0x48048000 0x1000
 				  0x4804A000 0x1000 >;
 			interrupts = < 66 67 68 69 92 93 94 95 >;
 			interrupt-parent = <&AINTC>;
 		};
 
 		adc0: adc@44E0D000 {
 			compatible = "ti,adc";
 			reg = <0x44E0D000 0x2000>;
 			interrupts = < 16 >;
 			interrupt-parent = <&AINTC>;
  		};
 
 		wdt1@44E35000 {
 			compatible = "ti,omap3-wdt";
 			reg = <0x44E35000 0x1000>;
 			interrupts = <91>;
 			interrupt-parent = <&AINTC>;
 		};
  		
 		GPIO: gpio {
 			#gpio-cells = <3>;
 			compatible = "ti,gpio";
 			gpio-controller;
 			reg =<	0x44E07000 0x1000
 				0x4804C000 0x1000
 				0x481AC000 0x1000
 				0x481AE000 0x1000 >;
 			interrupts = < 96 97 98 99 32 33 62 63 >;
 			interrupt-parent = <&AINTC>;
+			interrupt-controller;
+			#interrupt-cells = <1>;
 		};
 
 		uart0: serial@44E09000 {
 			compatible = "ti,ns16550";
 			reg = <0x44E09000 0x1000>;
 			reg-shift = <2>;
 			interrupts = < 72 >;
 			interrupt-parent = <&AINTC>;
  			clock-frequency = < 48000000 >;
 			uart-device-id = < 0 >;
  		};
  		
  		uart1: serial@48022000 {
  			compatible = "ti,ns16550";
  			reg = <0x48022000 0x1000>;
  			reg-shift = <2>;
  			interrupts = < 73 >;
  			interrupt-parent = <&AINTC>;
  			clock-frequency = < 48000000 >; 
 			uart-device-id = < 1 >;
 			status = "disabled";
  		};
  		
  		uart2: serial@48024000 {
  			compatible = "ti,ns16550";
  			reg = <0x48024000 0x1000>;
  			reg-shift = <2>;
  			interrupts = < 74 >;
  			interrupt-parent = <&AINTC>;
  			clock-frequency = < 48000000 >; 
 			uart-device-id = < 2 >;
 			status = "disabled";
  		};
  		
  		uart3: serial@481a6000 {
  			compatible = "ti,ns16550";
  			reg = <0x481A6000 0x1000>;
  			reg-shift = <2>;
  			interrupts = < 44 >;
  			interrupt-parent = <&AINTC>;
  			clock-frequency = < 48000000 >; 
 			uart-device-id = < 3 >;
 			status = "disabled";
  		};
  
  		uart4: serial@481a8000 {
  			compatible = "ti,ns16550";
  			reg = <0x481A8000 0x1000>;
  			reg-shift = <2>;
  			interrupts = < 45 >;
  			interrupt-parent = <&AINTC>;
  			clock-frequency = < 48000000 >; 
 			uart-device-id = < 4 >;
 			status = "disabled";
  		};
  
  		uart5: serial@481aa000 {
  			compatible = "ti,ns16550";
  			reg = <0x481AA000 0x1000>;
  			reg-shift = <2>;
  			interrupts = < 46 >;
  			interrupt-parent = <&AINTC>;
  			clock-frequency = < 48000000 >; 
 			uart-device-id = < 5 >;
 			status = "disabled";
   		};
 
 		edma3@49000000 {
 			compatible = "ti,edma3";
 			reg =<	0x49000000 0x100000	/* Channel Controller Regs */
 				0x49800000 0x100000	/* Transfer Controller 0 Regs */
 				0x49900000 0x100000	/* Transfer Controller 1 Regs */
 				0x49a00000 0x100000 >;	/* Transfer Controller 2 Regs */
 			interrupts = <12 13 14>;
 			interrupt-parent = <&AINTC>;
 		};
 
 		mmchs0@48060000 {
 			compatible = "ti,omap3-hsmmc", "ti,mmchs";
 			reg =<0x48060000 0x1000 >;
 			interrupts = <64>;
 			interrupt-parent = <&AINTC>;
 			mmchs-device-id = <0>;
 			mmchs-wp-gpio-pin = <0xffffffff>;
 			ti,dual-volt;
 		};
 
 		mmchs1@481D8000 {
 			compatible = "ti,omap3-hsmmc", "ti,mmchs";
 			reg =<0x481D8000 0x1000 >;
 			interrupts = <28>;
 			interrupt-parent = <&AINTC>;
 			mmchs-device-id = <1>;
 			mmchs-wp-gpio-pin = <0xffffffff>;
 			status = "disabled";
 		};
 
 		enet0: ethernet@4A100000 {
 			#address-cells = <1>;
 			#size-cells = <1>;
 			compatible = "ti,cpsw";
 			reg = <0x4A100000 0x4000>;
 			interrupts = <40 41 42 43>;
 			interrupt-parent = <&AINTC>;
 			phy-handle = <&phy0>;
 			mdio@0 {
 				#address-cells = <1>;
 				#size-cells = <0>;
 				compatible = "ti,cpsw-mdio";
 				phy0: ethernet-phy@0 {
 					reg = <0x0>;
 				};
 			};
 		};
 
 		i2c0: i2c@44e0b000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "ti,i2c";
 			reg =<	0x44e0b000 0x1000 >;
 			interrupts = <70>;
 			interrupt-parent = <&AINTC>;
 			i2c-device-id = <0>;
 		};
 
 		i2c1: i2c@4802a000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "ti,i2c";
 			reg =<  0x4802a000 0x1000 >;
 			interrupts = <71>;
 			interrupt-parent = <&AINTC>;
 			i2c-device-id = <1>;
 		};
 
 		i2c2: i2c@4819c000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "ti,i2c";
 			reg =<  0x4819c000 0x1000 >;
 			interrupts = <30>;
 			interrupt-parent = <&AINTC>;
 			i2c-device-id = <2>;
 		};
 
 		pwm@48300000 {
 			compatible = "ti,am335x-pwm";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			reg = < 0x48300000 0x100	/* PWMSS0 */
 				0x48300100 0x80		/* eCAP0 */
 				0x48300180 0x80		/* eQEP0 */
 				0x48300200 0x60		/* ePWM0 */
 			>;
 			interrupts = <86 58>; /* ePWM0INT, ePWM0_TZINT */
 			interrupt-parent = <&AINTC>;
 			pwm-device-id = <0>;
 		};
 
 		pwm@48302000 {
 			compatible = "ti,am335x-pwm";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			reg = < 0x48302000 0x100	/* PWMSS1 */
 				0x48302100 0x80		/* eCAP1 */
 				0x48302180 0x80		/* eQEP1 */
 				0x48302200 0x60		/* ePWM1 */
 			>;
 			interrupts = <87 59>; /* ePWM1INT, ePWM1_TZINT */
 			interrupt-parent = <&AINTC>;
 			pwm-device-id = <1>;
 		};
 
 		pwm@48304000 {
 			compatible = "ti,am335x-pwm";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			reg = < 0x48304000 0x100	/* PWMSS2 */
 				0x48304100 0x80		/* eCAP2 */
 				0x48304180 0x80		/* eQEP2 */
 				0x48304200 0x60		/* ePWM2 */
 			>;
 			interrupts = <88 60>; /* ePWM2INT, ePWM2_TZINT */
 			interrupt-parent = <&AINTC>;
 			pwm-device-id = <2>;
 		};
 
 		lcd: lcd@4830e000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
 			compatible = "ti,am335x-lcd";
 			reg =<	0x4830e000 0x1000 >;
 			interrupts = <36>;
 			interrupt-parent = <&AINTC>;
 		};
 
  		usb@47400000 {
  			#address-cells = <1>;
  			#size-cells = <0>;
  			compatible = "ti,musb-am33xx";
  			reg =<	0x47400000 0x1000	/* USBSS */
  				0x47401000 0x300	/* USB0 */
  				0x47401300 0x100 	/* USB0_PHY */
  				0x47401400 0x400 	/* USB0_CORE */
  				0x47401800 0x300 	/* USB1 */
  				0x47401B00 0x100 	/* USB1_PHY */
  				0x47401C00 0x400 	/* USB1_CORE */
  			>;
  			interrupts = <17 18 19>;
  			interrupt-parent = <&AINTC>;
  			/* 1 - Host Mode, 0 - Device Mode */
  			modemask = <2>;
  		};
 
 		mbox0@480C8000 {
 			compatible = "am335x,system-mbox";
 			reg = < 0x480C8000 0x1000 >;
 			interrupts = <77>;
 			interrupt-parent = <&AINTC>;
 		};
 
 		spinlock0@480CA000 {
 			compatible = "am335x,spinlock";
 			reg = < 0x480CA000 0x1000 >;
 		};
 
 		pruss@4A300000 {
 			compatible = "ti,pruss-v2";
 			reg = <0x4A300000 0x80000>;
  			interrupt-parent = <&AINTC>;
 			interrupts = <20 21 22 23 24 25 26 27>;
 		};
 	};
 };
Index: projects/arm_intrng/sys/boot
===================================================================
--- projects/arm_intrng/sys/boot	(revision 276247)
+++ projects/arm_intrng/sys/boot	(revision 276248)

Property changes on: projects/arm_intrng/sys/boot
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head/sys/boot:r276183-276247
Index: projects/arm_intrng/sys/conf/NOTES
===================================================================
--- projects/arm_intrng/sys/conf/NOTES	(revision 276247)
+++ projects/arm_intrng/sys/conf/NOTES	(revision 276248)
@@ -1,2999 +1,2986 @@
 # $FreeBSD$
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
 # Lines that begin with 'device', 'options', 'machine', 'ident', 'maxusers',
 # 'makeoptions', 'hints', etc. go into the kernel configuration that you
 # run config(8) with.
 #
 # Lines that begin with 'hint.' are NOT for config(8), they go into your
 # hints file.  See /boot/device.hints and/or the 'hints' config(8) directive.
 #
 # Please use ``make LINT'' to create an old-style LINT file if you want to
 # do kernel test-builds.
 #
 # This file contains machine independent kernel configuration notes.  For
 # machine dependent notes, look in /sys//conf/NOTES.
 #
 
 #
 # NOTES conventions and style guide:
 #
 # Large block comments should begin and end with a line containing only a
 # comment character.
 #
 # To describe a particular object, a block comment (if it exists) should
 # come first.  Next should come device, options, and hints lines in that
 # order.  All device and option lines must be described by a comment that
 # doesn't just expand the device or option name.  Use only a concise
 # comment on the same line if possible.  Very detailed descriptions of
 # devices and subsystems belong in man pages.
 #
 # A space followed by a tab separates 'options' from an option name.  Two
 # spaces followed by a tab separate 'device' from a device name.  Comments
 # after an option or device should use one space after the comment character.
 # To comment out a negative option that disables code and thus should not be
 # enabled for LINT builds, precede 'options' with "#!".
 #
 
 #
 # This is the ``identification'' of the kernel.  Usually this should
 # be the same as the name of your kernel.
 #
 ident		LINT
 
 #
 # The `maxusers' parameter controls the static sizing of a number of
 # internal system tables by a formula defined in subr_param.c.
 # Omitting this parameter or setting it to 0 will cause the system to
 # auto-size based on physical memory.
 #
 maxusers	10
 
 # To statically compile in device wiring instead of /boot/device.hints
 #hints		"LINT.hints"		# Default places to look for devices.
 
 # Use the following to compile in values accessible to the kernel
 # through getenv() (or kenv(1) in userland). The format of the file
 # is 'variable=value', see kenv(1)
 #
 #env		"LINT.env"
 
 #
 # The `makeoptions' parameter allows variables to be passed to the
 # generated Makefile in the build area.
 #
 # CONF_CFLAGS gives some extra compiler flags that are added to ${CFLAGS}
 # after most other flags.  Here we use it to inhibit use of non-optimal
 # gcc built-in functions (e.g., memcmp).
 #
 # DEBUG happens to be magic.
 # The following is equivalent to 'config -g KERNELNAME' and creates
 # 'kernel.debug' compiled with -g debugging as well as a normal
 # 'kernel'.  Use 'make install.debug' to install the debug kernel
 # but that isn't normally necessary as the debug symbols are not loaded
 # by the kernel and are not useful there anyway.
 #
 # KERNEL can be overridden so that you can change the default name of your
 # kernel.
 #
 # MODULES_OVERRIDE can be used to limit modules built to a specific list.
 #
 makeoptions	CONF_CFLAGS=-fno-builtin  #Don't allow use of memcmp, etc.
 #makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
 #makeoptions	KERNEL=foo		#Build kernel "foo" and install "/foo"
 # Only build ext2fs module plus those parts of the sound system I need.
 #makeoptions	MODULES_OVERRIDE="ext2fs sound/sound sound/driver/maestro3"
 makeoptions	DESTDIR=/tmp
 
 #
 # FreeBSD processes are subject to certain limits to their consumption
 # of system resources.  See getrlimit(2) for more details.  Each
 # resource limit has two values, a "soft" limit and a "hard" limit.
 # The soft limits can be modified during normal system operation, but
 # the hard limits are set at boot time.  Their default values are
 # in sys//include/vmparam.h.  There are two ways to change them:
 # 
 # 1.  Set the values at kernel build time.  The options below are one
 #     way to allow that limit to grow to 1GB.  They can be increased
 #     further by changing the parameters:
 #	
 # 2.  In /boot/loader.conf, set the tunables kern.maxswzone,
 #     kern.maxbcache, kern.maxtsiz, kern.dfldsiz, kern.maxdsiz,
 #     kern.dflssiz, kern.maxssiz and kern.sgrowsiz.
 #
 # The options in /boot/loader.conf override anything in the kernel
 # configuration file.  See the function init_param1 in
 # sys/kern/subr_param.c for more details.
 #
 
 options 	MAXDSIZ=(1024UL*1024*1024)
 options 	MAXSSIZ=(128UL*1024*1024)
 options 	DFLDSIZ=(1024UL*1024*1024)
 
 #
 # BLKDEV_IOSIZE sets the default block size used in user block
 # device I/O.  Note that this value will be overridden by the label
 # when specifying a block device from a label with a non-0
 # partition blocksize.  The default is PAGE_SIZE.
 #
 options 	BLKDEV_IOSIZE=8192
 
 #
 # MAXPHYS and DFLTPHYS
 #
 # These are the maximal and safe 'raw' I/O block device access sizes.
 # Reads and writes will be split into MAXPHYS chunks for known good
 # devices and DFLTPHYS for the rest. Some applications have better
 # performance with larger raw I/O access sizes. Note that certain VM
 # parameters are derived from these values and making them too large
 # can make an unbootable kernel.
 #
 # The defaults are 64K and 128K respectively.
 options 	DFLTPHYS=(64*1024)
 options 	MAXPHYS=(128*1024)
 
 
 # This allows you to actually store this configuration file into
 # the kernel binary itself. See config(8) for more details.
 #
 options 	INCLUDE_CONFIG_FILE     # Include this file in kernel
 
 #
 # Compile-time defaults for various boot parameters
 #
 options 	BOOTVERBOSE=1
 options 	BOOTHOWTO=RB_MULTIPLE
 
 options 	GEOM_AES		# Don't use, use GEOM_BDE
 options 	GEOM_BDE		# Disk encryption.
 options 	GEOM_BSD		# BSD disklabels
 options 	GEOM_CACHE		# Disk cache.
 options 	GEOM_CONCAT		# Disk concatenation.
 options 	GEOM_ELI		# Disk encryption.
 options 	GEOM_FOX		# Redundant path mitigation
 options 	GEOM_GATE		# Userland services.
 options 	GEOM_JOURNAL		# Journaling.
 options 	GEOM_LABEL		# Providers labelization.
 options 	GEOM_LINUX_LVM		# Linux LVM2 volumes
 options 	GEOM_MBR		# DOS/MBR partitioning
 options 	GEOM_MIRROR		# Disk mirroring.
 options 	GEOM_MULTIPATH		# Disk multipath
 options 	GEOM_NOP		# Test class.
 options 	GEOM_PART_APM		# Apple partitioning
 options 	GEOM_PART_BSD		# BSD disklabel
 options 	GEOM_PART_BSD64		# BSD disklabel64
 options 	GEOM_PART_EBR		# Extended Boot Records
 options 	GEOM_PART_EBR_COMPAT	# Backward compatible partition names
 options 	GEOM_PART_GPT		# GPT partitioning
 options 	GEOM_PART_LDM		# Logical Disk Manager
 options 	GEOM_PART_MBR		# MBR partitioning
 options 	GEOM_PART_PC98		# PC-9800 disk partitioning
 options 	GEOM_PART_VTOC8		# SMI VTOC8 disk label
 options 	GEOM_PC98		# NEC PC9800 partitioning
 options 	GEOM_RAID		# Soft RAID functionality.
 options 	GEOM_RAID3		# RAID3 functionality.
 options 	GEOM_SHSEC		# Shared secret.
 options 	GEOM_STRIPE		# Disk striping.
 options 	GEOM_SUNLABEL		# Sun/Solaris partitioning
 options 	GEOM_UZIP		# Read-only compressed disks
 options 	GEOM_VINUM		# Vinum logical volume manager
 options 	GEOM_VIRSTOR		# Virtual storage.
 options 	GEOM_VOL		# Volume names from UFS superblock
 options 	GEOM_ZERO		# Performance testing helper.
 
 #
 # The root device and filesystem type can be compiled in;
 # this provides a fallback option if the root device cannot
 # be correctly guessed by the bootstrap code, or an override if
 # the RB_DFLTROOT flag (-r) is specified when booting the kernel.
 #
 options 	ROOTDEVNAME=\"ufs:da0s2e\"
 
 
 #####################################################################
 # Scheduler options:
 #
 # Specifying one of SCHED_4BSD or SCHED_ULE is mandatory.  These options
 # select which scheduler is compiled in.
 #
 # SCHED_4BSD is the historical, proven, BSD scheduler.  It has a global run
 # queue and no CPU affinity which makes it suboptimal for SMP.  It has very
 # good interactivity and priority selection.
 #
 # SCHED_ULE provides significant performance advantages over 4BSD on many
 # workloads on SMP machines.  It supports cpu-affinity, per-cpu runqueues
 # and scheduler locks.  It also has a stronger notion of interactivity 
 # which leads to better responsiveness even on uniprocessor machines.  This
 # is the default scheduler.
 #
 # SCHED_STATS is a debugging option which keeps some stats in the sysctl
 # tree at 'kern.sched.stats' and is useful for debugging scheduling decisions.
 #
 options 	SCHED_4BSD
 options 	SCHED_STATS
 #options 	SCHED_ULE
 
 #####################################################################
 # SMP OPTIONS:
 #
 # SMP enables building of a Symmetric MultiProcessor Kernel.
 
 # Mandatory:
 options 	SMP			# Symmetric MultiProcessor Kernel
 
 # MAXCPU defines the maximum number of CPUs that can boot in the system.
 # A default value should be already present, for every architecture.
 options 	MAXCPU=32
 
 # MAXMEMDOM defines the maximum number of memory domains that can boot in the
 # system.  A default value should already be defined by every architecture.
 options 	MAXMEMDOM=1
 
 # ADAPTIVE_MUTEXES changes the behavior of blocking mutexes to spin
 # if the thread that currently owns the mutex is executing on another
 # CPU.  This behavior is enabled by default, so this option can be used
 # to disable it.
 options 	NO_ADAPTIVE_MUTEXES
 
 # ADAPTIVE_RWLOCKS changes the behavior of reader/writer locks to spin
 # if the thread that currently owns the rwlock is executing on another
 # CPU.  This behavior is enabled by default, so this option can be used
 # to disable it.
 options 	NO_ADAPTIVE_RWLOCKS
 
 # ADAPTIVE_SX changes the behavior of sx locks to spin if the thread that
 # currently owns the sx lock is executing on another CPU.
 # This behavior is enabled by default, so this option can be used to
 # disable it.
 options 	NO_ADAPTIVE_SX
 
 # MUTEX_NOINLINE forces mutex operations to call functions to perform each
 # operation rather than inlining the simple cases.  This can be used to
 # shrink the size of the kernel text segment.  Note that this behavior is
 # already implied by the INVARIANT_SUPPORT, INVARIANTS, KTR, LOCK_PROFILING,
 # and WITNESS options.
 options 	MUTEX_NOINLINE
 
 # RWLOCK_NOINLINE forces rwlock operations to call functions to perform each
 # operation rather than inlining the simple cases.  This can be used to
 # shrink the size of the kernel text segment.  Note that this behavior is
 # already implied by the INVARIANT_SUPPORT, INVARIANTS, KTR, LOCK_PROFILING,
 # and WITNESS options.
 options 	RWLOCK_NOINLINE
 
 # SX_NOINLINE forces sx lock operations to call functions to perform each
 # operation rather than inlining the simple cases.  This can be used to
 # shrink the size of the kernel text segment.  Note that this behavior is
 # already implied by the INVARIANT_SUPPORT, INVARIANTS, KTR, LOCK_PROFILING,
 # and WITNESS options.
 options 	SX_NOINLINE
 
 # SMP Debugging Options:
 #
 # CALLOUT_PROFILING enables rudimentary profiling of the callwheel data
 #	  structure used as backend in callout(9).
 # PREEMPTION allows the threads that are in the kernel to be preempted by
 #	  higher priority [interrupt] threads.  It helps with interactivity
 #	  and allows interrupt threads to run sooner rather than waiting.
 #	  WARNING! Only tested on amd64 and i386.
 # FULL_PREEMPTION instructs the kernel to preempt non-realtime kernel
 #	  threads.  Its sole use is to expose race conditions and other
 #	  bugs during development.  Enabling this option will reduce
 #	  performance and increase the frequency of kernel panics by
 #	  design.  If you aren't sure that you need it then you don't.
 #	  Relies on the PREEMPTION option.  DON'T TURN THIS ON.
 # MUTEX_DEBUG enables various extra assertions in the mutex code.
 # SLEEPQUEUE_PROFILING enables rudimentary profiling of the hash table
 #	  used to hold active sleep queues as well as sleep wait message
 #	  frequency.
 # TURNSTILE_PROFILING enables rudimentary profiling of the hash table
 #	  used to hold active lock queues.
 # UMTX_PROFILING enables rudimentary profiling of the hash table used 
 	  to hold active lock queues.
 # WITNESS enables the witness code which detects deadlocks and cycles
 #         during locking operations.
 # WITNESS_KDB causes the witness code to drop into the kernel debugger if
 #	  a lock hierarchy violation occurs or if locks are held when going to
 #	  sleep.
 # WITNESS_SKIPSPIN disables the witness checks on spin mutexes.
 options 	PREEMPTION
 options 	FULL_PREEMPTION
 options 	MUTEX_DEBUG
 options 	WITNESS
 options 	WITNESS_KDB
 options 	WITNESS_SKIPSPIN
 
 # LOCK_PROFILING - Profiling locks.  See LOCK_PROFILING(9) for details.
 options 	LOCK_PROFILING
 # Set the number of buffers and the hash size.  The hash size MUST be larger
 # than the number of buffers.  Hash size should be prime.
 options 	MPROF_BUFFERS="1536"
 options 	MPROF_HASH_SIZE="1543"
 
 # Profiling for the callout(9) backend.
 options 	CALLOUT_PROFILING
 
 # Profiling for internal hash tables.
 options 	SLEEPQUEUE_PROFILING
 options 	TURNSTILE_PROFILING
 options 	UMTX_PROFILING
 
 
 #####################################################################
 # COMPATIBILITY OPTIONS
 
 #
 # Implement system calls compatible with 4.3BSD and older versions of
 # FreeBSD.  You probably do NOT want to remove this as much current code
 # still relies on the 4.3 emulation.  Note that some architectures that
 # are supported by FreeBSD do not include support for certain important
 # aspects of this compatibility option, namely those related to the
 # signal delivery mechanism.
 #
 options 	COMPAT_43
 
 # Old tty interface.
 options 	COMPAT_43TTY
 
 # Note that as a general rule, COMPAT_FREEBSD depends on
 # COMPAT_FREEBSD, COMPAT_FREEBSD, etc.
 
 # Enable FreeBSD4 compatibility syscalls
 options 	COMPAT_FREEBSD4
 
 # Enable FreeBSD5 compatibility syscalls
 options 	COMPAT_FREEBSD5
 
 # Enable FreeBSD6 compatibility syscalls
 options 	COMPAT_FREEBSD6
 
 # Enable FreeBSD7 compatibility syscalls
 options 	COMPAT_FREEBSD7
 
 # Enable FreeBSD9 compatibility syscalls
 options 	COMPAT_FREEBSD9
 
 # Enable FreeBSD10 compatibility syscalls
 options 	COMPAT_FREEBSD10
 
 #
 # These three options provide support for System V Interface
 # Definition-style interprocess communication, in the form of shared
 # memory, semaphores, and message queues, respectively.
 #
 options 	SYSVSHM
 options 	SYSVSEM
 options 	SYSVMSG
 
 
 #####################################################################
 # DEBUGGING OPTIONS
 
 #
 # Compile with kernel debugger related code.
 #
 options 	KDB
 
 #
 # Print a stack trace of the current thread on the console for a panic.
 #
 options 	KDB_TRACE
 
 #
 # Don't enter the debugger for a panic. Intended for unattended operation
 # where you may want to enter the debugger from the console, but still want
 # the machine to recover from a panic.
 #
 options 	KDB_UNATTENDED
 
 #
 # Enable the ddb debugger backend.
 #
 options 	DDB
 
 #
 # Print the numerical value of symbols in addition to the symbolic
 # representation.
 #
 options 	DDB_NUMSYM
 
 #
 # Enable the remote gdb debugger backend.
 #
 options 	GDB
 
 #
 # SYSCTL_DEBUG enables a 'sysctl' debug tree that can be used to dump the
 # contents of the registered sysctl nodes on the console.  It is disabled by
 # default because it generates excessively verbose console output that can
 # interfere with serial console operation.
 #
 options 	SYSCTL_DEBUG
 
 #
 # Enable textdump by default, this disables kernel core dumps.
 #
 options		TEXTDUMP_PREFERRED
 
 #
 # Enable extra debug messages while performing textdumps.
 #
 options		TEXTDUMP_VERBOSE
 
 #
 # NO_SYSCTL_DESCR omits the sysctl node descriptions to save space in the
 # resulting kernel.
 options		NO_SYSCTL_DESCR
 
 #
 # MALLOC_DEBUG_MAXZONES enables multiple uma zones for malloc(9)
 # allocations that are smaller than a page.  The purpose is to isolate
 # different malloc types into hash classes, so that any buffer
 # overruns or use-after-free will usually only affect memory from
 # malloc types in that hash class.  This is purely a debugging tool;
 # by varying the hash function and tracking which hash class was
 # corrupted, the intersection of the hash classes from each instance
 # will point to a single malloc type that is being misused.  At this
 # point inspection or memguard(9) can be used to catch the offending
 # code.
 #
 options 	MALLOC_DEBUG_MAXZONES=8
 
 #
 # DEBUG_MEMGUARD builds and enables memguard(9), a replacement allocator
 # for the kernel used to detect modify-after-free scenarios.  See the
 # memguard(9) man page for more information on usage.
 #
 options 	DEBUG_MEMGUARD
 
 #
 # DEBUG_REDZONE enables buffer underflows and buffer overflows detection for
 # malloc(9).
 #
 options 	DEBUG_REDZONE
 
 #
 # EARLY_PRINTF enables support for calling a special printf (eprintf)
 # very early in the kernel (before cn_init() has been called).  This
 # should only be used for debugging purposes early in boot.  Normally,
 # it is not defined.  It is commented out here because this feature
 # isn't generally available. And the required eputc() isn't defined.
 #
 #options	EARLY_PRINTF
 
 #
 # KTRACE enables the system-call tracing facility ktrace(2).  To be more
 # SMP-friendly, KTRACE uses a worker thread to process most trace events
 # asynchronously to the thread generating the event.  This requires a
 # pre-allocated store of objects representing trace events.  The
 # KTRACE_REQUEST_POOL option specifies the initial size of this store.
 # The size of the pool can be adjusted both at boottime and runtime via
 # the kern.ktrace_request_pool tunable and sysctl.
 #
 options 	KTRACE			#kernel tracing
 options 	KTRACE_REQUEST_POOL=101
 
 #
 # KTR is a kernel tracing facility imported from BSD/OS.  It is
 # enabled with the KTR option.  KTR_ENTRIES defines the number of
 # entries in the circular trace buffer; it may be an arbitrary number.
 # KTR_BOOT_ENTRIES defines the number of entries during the early boot,
 # before malloc(9) is functional.
 # KTR_COMPILE defines the mask of events to compile into the kernel as
 # defined by the KTR_* constants in .  KTR_MASK defines the
 # initial value of the ktr_mask variable which determines at runtime
 # what events to trace.  KTR_CPUMASK determines which CPU's log
 # events, with bit X corresponding to CPU X.  The layout of the string
 # passed as KTR_CPUMASK must match a series of bitmasks each of them
 # separated by the "," character (ie:
 # KTR_CPUMASK=0xAF,0xFFFFFFFFFFFFFFFF).  KTR_VERBOSE enables
 # dumping of KTR events to the console by default.  This functionality
 # can be toggled via the debug.ktr_verbose sysctl and defaults to off
 # if KTR_VERBOSE is not defined.  See ktr(4) and ktrdump(8) for details.
 #
 options 	KTR
 options 	KTR_BOOT_ENTRIES=1024
 options 	KTR_ENTRIES=(128*1024)
 options 	KTR_COMPILE=(KTR_INTR|KTR_PROC)
 options 	KTR_MASK=KTR_INTR
 options 	KTR_CPUMASK=0x3
 options 	KTR_VERBOSE
 
 #
 # ALQ(9) is a facility for the asynchronous queuing of records from the kernel
 # to a vnode, and is employed by services such as ktr(4) to produce trace
 # files based on a kernel event stream.  Records are written asynchronously
 # in a worker thread.
 #
 options 	ALQ
 options 	KTR_ALQ
 
 #
 # The INVARIANTS option is used in a number of source files to enable
 # extra sanity checking of internal structures.  This support is not
 # enabled by default because of the extra time it would take to check
 # for these conditions, which can only occur as a result of
 # programming errors.
 #
 options 	INVARIANTS
 
 #
 # The INVARIANT_SUPPORT option makes us compile in support for
 # verifying some of the internal structures.  It is a prerequisite for
 # 'INVARIANTS', as enabling 'INVARIANTS' will make these functions be
 # called.  The intent is that you can set 'INVARIANTS' for single
 # source files (by changing the source file or specifying it on the
 # command line) if you have 'INVARIANT_SUPPORT' enabled.  Also, if you
 # wish to build a kernel module with 'INVARIANTS', then adding
 # 'INVARIANT_SUPPORT' to your kernel will provide all the necessary
 # infrastructure without the added overhead.
 #
 options 	INVARIANT_SUPPORT
 
 #
 # The DIAGNOSTIC option is used to enable extra debugging information
 # from some parts of the kernel.  As this makes everything more noisy,
 # it is disabled by default.
 #
 options 	DIAGNOSTIC
 
 #
 # REGRESSION causes optional kernel interfaces necessary only for regression
 # testing to be enabled.  These interfaces may constitute security risks
 # when enabled, as they permit processes to easily modify aspects of the
 # run-time environment to reproduce unlikely or unusual (possibly normally
 # impossible) scenarios.
 #
 options 	REGRESSION
 
 #
 # This option lets some drivers co-exist that can't co-exist in a running
 # system.  This is used to be able to compile all kernel code in one go for
 # quality assurance purposes (like this file, which the option takes it name
 # from.)
 #
 options 	COMPILING_LINT
 
 #
 # STACK enables the stack(9) facility, allowing the capture of kernel stack
 # for the purpose of procinfo(1), etc.  stack(9) will also be compiled in
 # automatically if DDB(4) is compiled into the kernel.
 #
 options 	STACK
 
 
 #####################################################################
 # PERFORMANCE MONITORING OPTIONS
 
 #
 # The hwpmc driver that allows the use of in-CPU performance monitoring
 # counters for performance monitoring.  The base kernel needs to be configured
 # with the 'options' line, while the hwpmc device can be either compiled
 # in or loaded as a loadable kernel module.
 #
 # Additional configuration options may be required on specific architectures,
 # please see hwpmc(4).
 
 device		hwpmc			# Driver (also a loadable module)
 options 	HWPMC_HOOKS		# Other necessary kernel hooks
 
 
 #####################################################################
 # NETWORKING OPTIONS
 
 #
 # Protocol families
 #
 options 	INET			#Internet communications protocols
 options 	INET6			#IPv6 communications protocols
 
 options 	ROUTETABLES=2		# allocated fibs up to 65536. default is 1.
 					# but that would be a bad idea as they are large.
 
 options 	TCP_OFFLOAD		# TCP offload support.
 
 # In order to enable IPSEC you MUST also add device crypto to 
 # your kernel configuration
 options 	IPSEC			#IP security (requires device crypto)
 #options 	IPSEC_DEBUG		#debug for IP security
 #
 # #DEPRECATED#
 # Set IPSEC_FILTERTUNNEL to change the default of the sysctl to force packets
 # coming through a tunnel to be processed by any configured packet filtering
 # twice. The default is that packets coming out of a tunnel are _not_ processed;
 # they are assumed trusted.
 #
 # IPSEC history is preserved for such packets, and can be filtered
 # using ipfw(8)'s 'ipsec' keyword, when this option is enabled.
 #
 #options 	IPSEC_FILTERTUNNEL	#filter ipsec packets from a tunnel
 #
 # Set IPSEC_NAT_T to enable NAT-Traversal support.  This enables
 # optional UDP encapsulation of ESP packets.
 #
 options		IPSEC_NAT_T		#NAT-T support, UDP encap of ESP
 
 #
 # SMB/CIFS requester
 # NETSMB enables support for SMB protocol, it requires LIBMCHAIN and LIBICONV
 # options.
 options 	NETSMB			#SMB/CIFS requester
 
 # mchain library. It can be either loaded as KLD or compiled into kernel
 options 	LIBMCHAIN
 
 # libalias library, performing NAT
 options 	LIBALIAS
 
 # flowtable cache
 options 	FLOWTABLE
 
 #
 # SCTP is a NEW transport protocol defined by
 # RFC2960 updated by RFC3309 and RFC3758.. and
 # soon to have a new base RFC and many many more
 # extensions. This release supports all the extensions
 # including many drafts (most about to become RFC's).
 # It is the reference implementation of SCTP
 # and is quite well tested.
 #
 # Note YOU MUST have both INET and INET6 defined.
 # You don't have to enable V6, but SCTP is 
 # dual stacked and so far we have not torn apart
 # the V6 and V4.. since an association can span
 # both a V6 and V4 address at the SAME time :-)
 #
 options 	SCTP
 # There are bunches of options:
 # this one turns on all sorts of
 # nastily printing that you can
 # do. It's all controlled by a
 # bit mask (settable by socket opt and
 # by sysctl). Including will not cause
 # logging until you set the bits.. but it
 # can be quite verbose.. so without this
 # option we don't do any of the tests for
 # bits and prints.. which makes the code run
 # faster.. if you are not debugging don't use.
 options 	SCTP_DEBUG
 #
 # This option turns off the CRC32c checksum. Basically,
 # you will not be able to talk to anyone else who
 # has not done this. Its more for experimentation to
 # see how much CPU the CRC32c really takes. Most new
 # cards for TCP support checksum offload.. so this 
 # option gives you a "view" into what SCTP would be
 # like with such an offload (which only exists in
 # high in iSCSI boards so far). With the new
 # splitting 8's algorithm its not as bad as it used
 # to be.. but it does speed things up try only
 # for in a captured lab environment :-)
 options 	SCTP_WITH_NO_CSUM
 #
 
 #
 # All that options after that turn on specific types of
 # logging. You can monitor CWND growth, flight size
 # and all sorts of things. Go look at the code and
 # see. I have used this to produce interesting 
 # charts and graphs as well :->
 # 
 # I have not yet committed the tools to get and print
 # the logs, I will do that eventually .. before then
 # if you want them send me an email rrs@freebsd.org
 # You basically must have ktr(4) enabled for these
 # and you then set the sysctl to turn on/off various
 # logging bits. Use ktrdump(8) to pull the log and run
 # it through a display program.. and graphs and other
 # things too.
 #
 options 	SCTP_LOCK_LOGGING
 options 	SCTP_MBUF_LOGGING
 options 	SCTP_MBCNT_LOGGING
 options 	SCTP_PACKET_LOGGING
 options 	SCTP_LTRACE_CHUNKS
 options 	SCTP_LTRACE_ERRORS
 
 
 # altq(9). Enable the base part of the hooks with the ALTQ option.
 # Individual disciplines must be built into the base system and can not be
 # loaded as modules at this point. ALTQ requires a stable TSC so if yours is
 # broken or changes with CPU throttling then you must also have the ALTQ_NOPCC
 # option.
 options 	ALTQ
 options 	ALTQ_CBQ	# Class Based Queueing
 options 	ALTQ_RED	# Random Early Detection
 options 	ALTQ_RIO	# RED In/Out
 options 	ALTQ_HFSC	# Hierarchical Packet Scheduler
 options 	ALTQ_CDNR	# Traffic conditioner
 options 	ALTQ_PRIQ	# Priority Queueing
 options 	ALTQ_NOPCC	# Required if the TSC is unusable
 options 	ALTQ_DEBUG
 
 # netgraph(4). Enable the base netgraph code with the NETGRAPH option.
 # Individual node types can be enabled with the corresponding option
 # listed below; however, this is not strictly necessary as netgraph
 # will automatically load the corresponding KLD module if the node type
 # is not already compiled into the kernel. Each type below has a
 # corresponding man page, e.g., ng_async(8).
 options 	NETGRAPH		# netgraph(4) system
 options 	NETGRAPH_DEBUG		# enable extra debugging, this
 					# affects netgraph(4) and nodes
 # Node types
 options 	NETGRAPH_ASYNC
 options 	NETGRAPH_ATMLLC
 options 	NETGRAPH_ATM_ATMPIF
 options 	NETGRAPH_BLUETOOTH		# ng_bluetooth(4)
 options 	NETGRAPH_BLUETOOTH_BT3C		# ng_bt3c(4)
 options 	NETGRAPH_BLUETOOTH_HCI		# ng_hci(4)
 options 	NETGRAPH_BLUETOOTH_L2CAP	# ng_l2cap(4)
 options 	NETGRAPH_BLUETOOTH_SOCKET	# ng_btsocket(4)
 options 	NETGRAPH_BLUETOOTH_UBT		# ng_ubt(4)
 options 	NETGRAPH_BLUETOOTH_UBTBCMFW	# ubtbcmfw(4)
 options 	NETGRAPH_BPF
 options 	NETGRAPH_BRIDGE
 options 	NETGRAPH_CAR
 options 	NETGRAPH_CISCO
 options 	NETGRAPH_DEFLATE
 options 	NETGRAPH_DEVICE
 options 	NETGRAPH_ECHO
 options 	NETGRAPH_EIFACE
 options 	NETGRAPH_ETHER
 options 	NETGRAPH_FRAME_RELAY
 options 	NETGRAPH_GIF
 options 	NETGRAPH_GIF_DEMUX
 options 	NETGRAPH_HOLE
 options 	NETGRAPH_IFACE
 options 	NETGRAPH_IP_INPUT
 options 	NETGRAPH_IPFW
 options 	NETGRAPH_KSOCKET
 options 	NETGRAPH_L2TP
 options 	NETGRAPH_LMI
 # MPPC compression requires proprietary files (not included)
 #options 	NETGRAPH_MPPC_COMPRESSION
 options 	NETGRAPH_MPPC_ENCRYPTION
 options 	NETGRAPH_NETFLOW
 options 	NETGRAPH_NAT
 options 	NETGRAPH_ONE2MANY
 options 	NETGRAPH_PATCH
 options 	NETGRAPH_PIPE
 options 	NETGRAPH_PPP
 options 	NETGRAPH_PPPOE
 options 	NETGRAPH_PPTPGRE
 options 	NETGRAPH_PRED1
 options 	NETGRAPH_RFC1490
 options 	NETGRAPH_SOCKET
 options 	NETGRAPH_SPLIT
 options 	NETGRAPH_SPPP
 options 	NETGRAPH_TAG
 options 	NETGRAPH_TCPMSS
 options 	NETGRAPH_TEE
 options 	NETGRAPH_UI
 options 	NETGRAPH_VJC
 options 	NETGRAPH_VLAN
 
 # NgATM - Netgraph ATM
 options 	NGATM_ATM
 options 	NGATM_ATMBASE
 options 	NGATM_SSCOP
 options 	NGATM_SSCFU
 options 	NGATM_UNI
 options 	NGATM_CCATM
 
 device		mn	# Munich32x/Falc54 Nx64kbit/sec cards.
 
 # Network stack virtualization.
 #options	VIMAGE
 #options	VNET_DEBUG	# debug for VIMAGE
 
 #
 # Network interfaces:
 #  The `loop' device is MANDATORY when networking is enabled.
 device		loop
 
 #  The `ether' device provides generic code to handle
 #  Ethernets; it is MANDATORY when an Ethernet device driver is
 #  configured or token-ring is enabled.
 device		ether
 
 #  The `vlan' device implements the VLAN tagging of Ethernet frames
 #  according to IEEE 802.1Q.
 device		vlan
 
 # The `vxlan' device implements the VXLAN encapsulation of Ethernet
 # frames in UDP packets according to RFC7348.
 device		vxlan
 
 #  The `wlan' device provides generic code to support 802.11
 #  drivers, including host AP mode; it is MANDATORY for the wi,
 #  and ath drivers and will eventually be required by all 802.11 drivers.
 device		wlan
 options 	IEEE80211_DEBUG		#enable debugging msgs
 options 	IEEE80211_AMPDU_AGE	#age frames in AMPDU reorder q's
 options 	IEEE80211_SUPPORT_MESH	#enable 802.11s D3.0 support
 options 	IEEE80211_SUPPORT_TDMA	#enable TDMA support
 
 #  The `wlan_wep', `wlan_tkip', and `wlan_ccmp' devices provide
 #  support for WEP, TKIP, and AES-CCMP crypto protocols optionally
 #  used with 802.11 devices that depend on the `wlan' module.
 device		wlan_wep
 device		wlan_ccmp
 device		wlan_tkip
 
 #  The `wlan_xauth' device provides support for external (i.e. user-mode)
 #  authenticators for use with 802.11 drivers that use the `wlan'
 #  module and support 802.1x and/or WPA security protocols.
 device		wlan_xauth
 
 #  The `wlan_acl' device provides a MAC-based access control mechanism
 #  for use with 802.11 drivers operating in ap mode and using the
 #  `wlan' module.
 #  The 'wlan_amrr' device provides AMRR transmit rate control algorithm
 device		wlan_acl
 device		wlan_amrr
 
 # Generic TokenRing
 device		token
 
 #  The `fddi' device provides generic code to support FDDI.
 device		fddi
 
 #  The `arcnet' device provides generic code to support Arcnet.
 device		arcnet
 
 #  The `sppp' device serves a similar role for certain types
 #  of synchronous PPP links (like `cx', `ar').
 device		sppp
 
 #  The `bpf' device enables the Berkeley Packet Filter.  Be
 #  aware of the legal and administrative consequences of enabling this
 #  option.  DHCP requires bpf.
 device		bpf
 
 #  The `netmap' device implements memory-mapped access to network
 #  devices from userspace, enabling wire-speed packet capture and
 #  generation even at 10Gbit/s. Requires support in the device
 #  driver. Supported drivers are ixgbe, e1000, re.
 device		netmap
 
 #  The `disc' device implements a minimal network interface,
 #  which throws away all packets sent and never receives any.  It is
 #  included for testing and benchmarking purposes.
 device		disc
 
 # The `epair' device implements a virtual back-to-back connected Ethernet
 # like interface pair.
 device		epair
 
 #  The `edsc' device implements a minimal Ethernet interface,
 #  which discards all packets sent and receives none.
 device		edsc
 
 #  The `tap' device is a pty-like virtual Ethernet interface
 device		tap
 
 #  The `tun' device implements (user-)ppp and nos-tun(8)
 device		tun
 
 #  The `gif' device implements IPv6 over IP4 tunneling,
 #  IPv4 over IPv6 tunneling, IPv4 over IPv4 tunneling and
 #  IPv6 over IPv6 tunneling.
 #  The `gre' device implements GRE (Generic Routing Encapsulation) tunneling,
 #  as specified in the RFC 2784 and RFC 2890.
 #  The `me' device implements Minimal Encapsulation within IPv4 as
 #  specified in the RFC 2004.
 #  The XBONEHACK option allows the same pair of addresses to be configured on
 #  multiple gif interfaces.
 device		gif
 device		gre
 device		me
 options 	XBONEHACK
 
 #  The `stf' device implements 6to4 encapsulation.
 device		stf
 
 # The pf packet filter consists of three devices:
 #  The `pf' device provides /dev/pf and the firewall code itself.
 #  The `pflog' device provides the pflog0 interface which logs packets.
 #  The `pfsync' device provides the pfsync0 interface used for
 #   synchronization of firewall state tables (over the net).
 device		pf
 device		pflog
 device		pfsync
 
 # Bridge interface.
 device		if_bridge
 
 # Common Address Redundancy Protocol. See carp(4) for more details.
 device		carp
 
 # IPsec interface.
 device		enc
 
 # Link aggregation interface.
 device		lagg
 
 #
 # Internet family options:
 #
 # MROUTING enables the kernel multicast packet forwarder, which works
 # with mrouted and XORP.
 #
 # IPFIREWALL enables support for IP firewall construction, in
 # conjunction with the `ipfw' program.  IPFIREWALL_VERBOSE sends
 # logged packets to the system logger.  IPFIREWALL_VERBOSE_LIMIT
 # limits the number of times a matching entry can be logged.
 #
 # WARNING:  IPFIREWALL defaults to a policy of "deny ip from any to any"
 # and if you do not add other rules during startup to allow access,
 # YOU WILL LOCK YOURSELF OUT.  It is suggested that you set firewall_type=open
 # in /etc/rc.conf when first enabling this feature, then refining the
 # firewall rules in /etc/rc.firewall after you've tested that the new kernel
 # feature works properly.
 #
 # IPFIREWALL_DEFAULT_TO_ACCEPT causes the default rule (at boot) to
 # allow everything.  Use with care, if a cracker can crash your
 # firewall machine, they can get to your protected machines.  However,
 # if you are using it as an as-needed filter for specific problems as
 # they arise, then this may be for you.  Changing the default to 'allow'
 # means that you won't get stuck if the kernel and /sbin/ipfw binary get
 # out of sync.
 #
 # IPDIVERT enables the divert IP sockets, used by ``ipfw divert''.  It
 # depends on IPFIREWALL if compiled into the kernel.
 #
 # IPFIREWALL_NAT adds support for in kernel nat in ipfw, and it requires
 # LIBALIAS.
 #
 # IPSTEALTH enables code to support stealth forwarding (i.e., forwarding
 # packets without touching the TTL).  This can be useful to hide firewalls
 # from traceroute and similar tools.
 #
 # PF_DEFAULT_TO_DROP causes the default pf(4) rule to deny everything.
 #
 # TCPDEBUG enables code which keeps traces of the TCP state machine
 # for sockets with the SO_DEBUG option set, which can then be examined
 # using the trpt(8) utility.
 #
 # RADIX_MPATH provides support for equal-cost multi-path routing.
 #
 options 	MROUTING		# Multicast routing
 options 	IPFIREWALL		#firewall
 options 	IPFIREWALL_VERBOSE	#enable logging to syslogd(8)
 options 	IPFIREWALL_VERBOSE_LIMIT=100	#limit verbosity
 options 	IPFIREWALL_DEFAULT_TO_ACCEPT	#allow everything by default
 options 	IPFIREWALL_NAT		#ipfw kernel nat support
 options 	IPDIVERT		#divert sockets
 options 	IPFILTER		#ipfilter support
 options 	IPFILTER_LOG		#ipfilter logging
 options 	IPFILTER_LOOKUP		#ipfilter pools
 options 	IPFILTER_DEFAULT_BLOCK	#block all packets by default
 options 	IPSTEALTH		#support for stealth forwarding
 options 	PF_DEFAULT_TO_DROP	#drop everything by default
 options 	TCPDEBUG
 options 	RADIX_MPATH
 
 # The MBUF_STRESS_TEST option enables options which create
 # various random failures / extreme cases related to mbuf
 # functions.  See mbuf(9) for a list of available test cases.
 # MBUF_PROFILING enables code to profile the mbuf chains
 # exiting the system (via participating interfaces) and
 # return a logarithmic histogram of monitored parameters
 # (e.g. packet size, wasted space, number of mbufs in chain).
 options 	MBUF_STRESS_TEST
 options 	MBUF_PROFILING
 
 # Statically link in accept filters
 options 	ACCEPT_FILTER_DATA
 options 	ACCEPT_FILTER_DNS
 options 	ACCEPT_FILTER_HTTP
 
 # TCP_SIGNATURE adds support for RFC 2385 (TCP-MD5) digests. These are
 # carried in TCP option 19. This option is commonly used to protect
 # TCP sessions (e.g. BGP) where IPSEC is not available nor desirable.
 # This is enabled on a per-socket basis using the TCP_MD5SIG socket option.
 # This requires the use of 'device crypto', 'options IPSEC'
 # or 'device cryptodev'.
 options 	TCP_SIGNATURE		#include support for RFC 2385
 
 # DUMMYNET enables the "dummynet" bandwidth limiter.  You need IPFIREWALL
 # as well.  See dummynet(4) and ipfw(8) for more info.  When you run
 # DUMMYNET it is advisable to also have at least "options HZ=1000" to achieve
 # a smooth scheduling of the traffic.
 options 	DUMMYNET
 
 #####################################################################
 # FILESYSTEM OPTIONS
 
 #
 # Only the root filesystem needs to be statically compiled or preloaded
 # as module; everything else will be automatically loaded at mount
 # time.  Some people still prefer to statically compile other
 # filesystems as well.
 #
 # NB: The UNION filesystem was known to be buggy in the past.  It is now
 # being actively maintained, although there are still some issues being
 # resolved.
 #
 
 # One of these is mandatory:
 options 	FFS			#Fast filesystem
 options 	NFSCL		#Network File System client
 
 # The rest are optional:
 options 	AUTOFS			#Automounter filesystem
 options 	CD9660			#ISO 9660 filesystem
 options 	FDESCFS			#File descriptor filesystem
 options 	FUSE			#FUSE support module
 options 	MSDOSFS			#MS DOS File System (FAT, FAT32)
 options 	NFSLOCKD		#Network Lock Manager
 options 	NFSCL			#New Network Filesystem Client
 options 	NFSD			#New Network Filesystem Server
 options 	KGSSAPI			#Kernel GSSAPI implementation
 
 options 	NULLFS			#NULL filesystem
 options 	PROCFS			#Process filesystem (requires PSEUDOFS)
 options 	PSEUDOFS		#Pseudo-filesystem framework
 options 	PSEUDOFS_TRACE		#Debugging support for PSEUDOFS
 options 	SMBFS			#SMB/CIFS filesystem
 options 	TMPFS			#Efficient memory filesystem
 options 	UDF			#Universal Disk Format
 options 	UNIONFS			#Union filesystem
 # The xFS_ROOT options REQUIRE the associated ``options xFS''
 options 	NFS_ROOT		#NFS usable as root device
 
 # Soft updates is a technique for improving filesystem speed and
 # making abrupt shutdown less risky.
 #
 options 	SOFTUPDATES
 
 # Extended attributes allow additional data to be associated with files,
 # and is used for ACLs, Capabilities, and MAC labels.
 # See src/sys/ufs/ufs/README.extattr for more information.
 options 	UFS_EXTATTR
 options 	UFS_EXTATTR_AUTOSTART
 
 # Access Control List support for UFS filesystems.  The current ACL
 # implementation requires extended attribute support, UFS_EXTATTR,
 # for the underlying filesystem.
 # See src/sys/ufs/ufs/README.acls for more information.
 options 	UFS_ACL
 
 # Directory hashing improves the speed of operations on very large
 # directories at the expense of some memory.
 options 	UFS_DIRHASH
 
 # Gjournal-based UFS journaling support.
 options 	UFS_GJOURNAL
 
 # Make space in the kernel for a root filesystem on a md device.
 # Define to the number of kilobytes to reserve for the filesystem.
 options 	MD_ROOT_SIZE=10
 
 # Make the md device a potential root device, either with preloaded
 # images of type mfs_root or md_root.
 options 	MD_ROOT
 
 # Disk quotas are supported when this option is enabled.
 options 	QUOTA			#enable disk quotas
 
 # If you are running a machine just as a fileserver for PC and MAC
 # users, using SAMBA, you may consider setting this option
 # and keeping all those users' directories on a filesystem that is
 # mounted with the suiddir option. This gives new files the same
 # ownership as the directory (similar to group). It's a security hole
 # if you let these users run programs, so confine it to file-servers
 # (but it'll save you lots of headaches in those cases). Root owned
 # directories are exempt and X bits are cleared. The suid bit must be
 # set on the directory as well; see chmod(1). PC owners can't see/set
 # ownerships so they keep getting their toes trodden on. This saves
 # you all the support calls as the filesystem it's used on will act as
 # they expect: "It's my dir so it must be my file".
 #
 options 	SUIDDIR
 
 # NFS options:
 options 	NFS_MINATTRTIMO=3	# VREG attrib cache timeout in sec
 options 	NFS_MAXATTRTIMO=60
 options 	NFS_MINDIRATTRTIMO=30	# VDIR attrib cache timeout in sec
 options 	NFS_MAXDIRATTRTIMO=60
 options 	NFS_DEBUG		# Enable NFS Debugging
 
 #
 # Add support for the EXT2FS filesystem of Linux fame.  Be a bit
 # careful with this - the ext2fs code has a tendency to lag behind
 # changes and not be exercised very much, so mounting read/write could
 # be dangerous (and even mounting read only could result in panics.)
 #
 options 	EXT2FS
 
 #
 # Add support for the ReiserFS filesystem (used in Linux). Currently,
 # this is limited to read-only access.
 #
 options 	REISERFS
 
 # Use real implementations of the aio_* system calls.  There are numerous
 # stability and security issues in the current aio code that make it
 # unsuitable for inclusion on machines with untrusted local users.
 options 	VFS_AIO
 
 # Cryptographically secure random number generator; /dev/random
 device		random
 
 # The system memory devices; /dev/mem, /dev/kmem
 device		mem
 
 # The kernel symbol table device; /dev/ksyms
 device		ksyms
 
 # Optional character code conversion support with LIBICONV.
 # Each option requires their base file system and LIBICONV.
 options 	CD9660_ICONV
 options 	MSDOSFS_ICONV
 options 	UDF_ICONV
 
 
 #####################################################################
 # POSIX P1003.1B
 
 # Real time extensions added in the 1993 POSIX
 # _KPOSIX_PRIORITY_SCHEDULING: Build in _POSIX_PRIORITY_SCHEDULING
 
 options 	_KPOSIX_PRIORITY_SCHEDULING
 # p1003_1b_semaphores are very experimental,
 # user should be ready to assist in debugging if problems arise.
 options 	P1003_1B_SEMAPHORES
 
 # POSIX message queue
 options 	P1003_1B_MQUEUE
 
 #####################################################################
 # SECURITY POLICY PARAMETERS
 
 # Support for BSM audit
 options 	AUDIT
 
 # Support for Mandatory Access Control (MAC):
 options 	MAC
 options 	MAC_BIBA
 options 	MAC_BSDEXTENDED
 options 	MAC_IFOFF
 options 	MAC_LOMAC
 options 	MAC_MLS
 options 	MAC_NONE
 options 	MAC_PARTITION
 options 	MAC_PORTACL
 options 	MAC_SEEOTHERUIDS
 options 	MAC_STUB
 options 	MAC_TEST
 
 # Support for Capsicum
 options 	CAPABILITIES	# fine-grained rights on file descriptors
 options 	CAPABILITY_MODE	# sandboxes with no global namespace access
 
 
 #####################################################################
 # CLOCK OPTIONS
 
 # The granularity of operation is controlled by the kernel option HZ whose
 # default value (1000 on most architectures) means a granularity of 1ms
 # (1s/HZ).  Historically, the default was 100, but finer granularity is
 # required for DUMMYNET and other systems on modern hardware.  There are
 # reasonable arguments that HZ should, in fact, be 100 still; consider,
 # that reducing the granularity too much might cause excessive overhead in
 # clock interrupt processing, potentially causing ticks to be missed and thus
 # actually reducing the accuracy of operation.
 
 options 	HZ=100
 
 # Enable support for the kernel PLL to use an external PPS signal,
 # under supervision of [x]ntpd(8)
 # More info in ntpd documentation: http://www.eecis.udel.edu/~ntp
 
 options 	PPS_SYNC
 
 # Enable support for generic feed-forward clocks in the kernel.
 # The feed-forward clock support is an alternative to the feedback oriented
 # ntpd/system clock approach, and is to be used with a feed-forward
 # synchronization algorithm such as the RADclock:
 # More info here: http://www.synclab.org/radclock
 
 options 	FFCLOCK
 
 
 #####################################################################
 # SCSI DEVICES
 
 # SCSI DEVICE CONFIGURATION
 
 # The SCSI subsystem consists of the `base' SCSI code, a number of
 # high-level SCSI device `type' drivers, and the low-level host-adapter
 # device drivers.  The host adapters are listed in the ISA and PCI
 # device configuration sections below.
 #
 # It is possible to wire down your SCSI devices so that a given bus,
 # target, and LUN always come on line as the same device unit.  In
 # earlier versions the unit numbers were assigned in the order that
 # the devices were probed on the SCSI bus.  This means that if you
 # removed a disk drive, you may have had to rewrite your /etc/fstab
 # file, and also that you had to be careful when adding a new disk
 # as it may have been probed earlier and moved your device configuration
 # around.  (See also option GEOM_VOL for a different solution to this
 # problem.)
 
 # This old behavior is maintained as the default behavior.  The unit
 # assignment begins with the first non-wired down unit for a device
 # type.  For example, if you wire a disk as "da3" then the first
 # non-wired disk will be assigned da4.
 
 # The syntax for wiring down devices is:
 
 hint.scbus.0.at="ahc0"
 hint.scbus.1.at="ahc1"
 hint.scbus.1.bus="0"
 hint.scbus.3.at="ahc2"
 hint.scbus.3.bus="0"
 hint.scbus.2.at="ahc2"
 hint.scbus.2.bus="1"
 hint.da.0.at="scbus0"
 hint.da.0.target="0"
 hint.da.0.unit="0"
 hint.da.1.at="scbus3"
 hint.da.1.target="1"
 hint.da.2.at="scbus2"
 hint.da.2.target="3"
 hint.sa.1.at="scbus1"
 hint.sa.1.target="6"
 
 # "units" (SCSI logical unit number) that are not specified are
 # treated as if specified as LUN 0.
 
 # All SCSI devices allocate as many units as are required.
 
 # The ch driver drives SCSI Media Changer ("jukebox") devices.
 #
 # The da driver drives SCSI Direct Access ("disk") and Optical Media
 # ("WORM") devices.
 #
 # The sa driver drives SCSI Sequential Access ("tape") devices.
 #
 # The cd driver drives SCSI Read Only Direct Access ("cd") devices.
 #
 # The ses driver drives SCSI Environment Services ("ses") and
 # SAF-TE ("SCSI Accessible Fault-Tolerant Enclosure") devices.
 #
 # The pt driver drives SCSI Processor devices.
 #
 # The sg driver provides a passthrough API that is compatible with the
 # Linux SG driver.  It will work in conjunction with the COMPAT_LINUX
 # option to run linux SG apps.  It can also stand on its own and provide
 # source level API compatibility for porting apps to FreeBSD.
 #
 # Target Mode support is provided here but also requires that a SIM
 # (SCSI Host Adapter Driver) provide support as well.
 #
 # The targ driver provides target mode support as a Processor type device.
 # It exists to give the minimal context necessary to respond to Inquiry
 # commands. There is a sample user application that shows how the rest
 # of the command support might be done in /usr/share/examples/scsi_target.
 #
 # The targbh driver provides target mode support and exists to respond
 # to incoming commands that do not otherwise have a logical unit assigned
 # to them.
 #
 # The pass driver provides a passthrough API to access the CAM subsystem.
 
 device		scbus		#base SCSI code
 device		ch		#SCSI media changers
 device		da		#SCSI direct access devices (aka disks)
 device		sa		#SCSI tapes
 device		cd		#SCSI CD-ROMs
 device		ses		#Enclosure Services (SES and SAF-TE)
 device		pt		#SCSI processor
 device		targ		#SCSI Target Mode Code
 device		targbh		#SCSI Target Mode Blackhole Device
 device		pass		#CAM passthrough driver
 device		sg		#Linux SCSI passthrough
 device		ctl		#CAM Target Layer
 
 # CAM OPTIONS:
 # debugging options:
 # CAMDEBUG		Compile in all possible debugging.
 # CAM_DEBUG_COMPILE	Debug levels to compile in.
 # CAM_DEBUG_FLAGS	Debug levels to enable on boot.
 # CAM_DEBUG_BUS		Limit debugging to the given bus.
 # CAM_DEBUG_TARGET	Limit debugging to the given target.
 # CAM_DEBUG_LUN		Limit debugging to the given lun.
 # CAM_DEBUG_DELAY	Delay in us after printing each debug line.
 #
 # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds
 # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions
 # SCSI_NO_OP_STRINGS: When defined disables opcode descriptions
 # SCSI_DELAY: The number of MILLISECONDS to freeze the SIM (scsi adapter)
 #             queue after a bus reset, and the number of milliseconds to
 #             freeze the device queue after a bus device reset.  This
 #             can be changed at boot and runtime with the
 #             kern.cam.scsi_delay tunable/sysctl.
 options 	CAMDEBUG
 options 	CAM_DEBUG_COMPILE=-1
 options 	CAM_DEBUG_FLAGS=(CAM_DEBUG_INFO|CAM_DEBUG_PROBE|CAM_DEBUG_PERIPH)
 options 	CAM_DEBUG_BUS=-1
 options 	CAM_DEBUG_TARGET=-1
 options 	CAM_DEBUG_LUN=-1
 options 	CAM_DEBUG_DELAY=1
 options 	CAM_MAX_HIGHPOWER=4
 options 	SCSI_NO_SENSE_STRINGS
 options 	SCSI_NO_OP_STRINGS
 options 	SCSI_DELAY=5000	# Be pessimistic about Joe SCSI device
 
 # Options for the CAM CDROM driver:
 # CHANGER_MIN_BUSY_SECONDS: Guaranteed minimum time quantum for a changer LUN
 # CHANGER_MAX_BUSY_SECONDS: Maximum time quantum per changer LUN, only
 #                           enforced if there is I/O waiting for another LUN
 # The compiled in defaults for these variables are 2 and 10 seconds,
 # respectively.
 #
 # These can also be changed on the fly with the following sysctl variables:
 # kern.cam.cd.changer.min_busy_seconds
 # kern.cam.cd.changer.max_busy_seconds
 #
 options 	CHANGER_MIN_BUSY_SECONDS=2
 options 	CHANGER_MAX_BUSY_SECONDS=10
 
 # Options for the CAM sequential access driver:
 # SA_IO_TIMEOUT: Timeout for read/write/wfm  operations, in minutes
 # SA_SPACE_TIMEOUT: Timeout for space operations, in minutes
 # SA_REWIND_TIMEOUT: Timeout for rewind operations, in minutes
 # SA_ERASE_TIMEOUT: Timeout for erase operations, in minutes
 # SA_1FM_AT_EOD: Default to model which only has a default one filemark at EOT.
 options 	SA_IO_TIMEOUT=4
 options 	SA_SPACE_TIMEOUT=60
 options 	SA_REWIND_TIMEOUT=(2*60)
 options 	SA_ERASE_TIMEOUT=(4*60)
 options 	SA_1FM_AT_EOD
 
 # Optional timeout for the CAM processor target (pt) device
 # This is specified in seconds.  The default is 60 seconds.
 options 	SCSI_PT_DEFAULT_TIMEOUT=60
 
 # Optional enable of doing SES passthrough on other devices (e.g., disks)
 #
 # Normally disabled because a lot of newer SCSI disks report themselves
 # as having SES capabilities, but this can then clot up attempts to build
 # a topology with the SES device that's on the box these drives are in....
 options 	SES_ENABLE_PASSTHROUGH
 
 
 #####################################################################
 # MISCELLANEOUS DEVICES AND OPTIONS
 
 device		pty		#BSD-style compatibility pseudo ttys
 device		nmdm		#back-to-back tty devices
 device		md		#Memory/malloc disk
 device		snp		#Snoop device - to look at pty/vty/etc..
 device		ccd		#Concatenated disk driver
 device		firmware	#firmware(9) support
 
 # Kernel side iconv library
 options 	LIBICONV
 
 # Size of the kernel message buffer.  Should be N * pagesize.
 options 	MSGBUF_SIZE=40960
 
 
 #####################################################################
 # HARDWARE DEVICE CONFIGURATION
 
 # For ISA the required hints are listed.
 # EISA, MCA, PCI, CardBus, SD/MMC and pccard are self identifying buses, so
 # no hints are needed.
 
 #
 # Mandatory devices:
 #
 
 # These options are valid for other keyboard drivers as well.
 options 	KBD_DISABLE_KEYMAP_LOAD	# refuse to load a keymap
 options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
 
 options 	FB_DEBUG		# Frame buffer debugging
 
 device		splash			# Splash screen and screen saver support
 
 # Various screen savers.
 device		blank_saver
 device		daemon_saver
 device		dragon_saver
 device		fade_saver
 device		fire_saver
 device		green_saver
 device		logo_saver
 device		rain_saver
 device		snake_saver
 device		star_saver
 device		warp_saver
 
 # The syscons console driver (SCO color console compatible).
 device		sc
 hint.sc.0.at="isa"
 options 	MAXCONS=16		# number of virtual consoles
 options 	SC_ALT_MOUSE_IMAGE	# simplified mouse cursor in text mode
 options 	SC_DFLT_FONT		# compile font in
 makeoptions	SC_DFLT_FONT=cp850
 options 	SC_DISABLE_KDBKEY	# disable `debug' key
 options 	SC_DISABLE_REBOOT	# disable reboot key sequence
 options 	SC_HISTORY_SIZE=200	# number of history buffer lines
 options 	SC_MOUSE_CHAR=0x3	# char code for text mode mouse cursor
 options 	SC_PIXEL_MODE		# add support for the raster text mode
 
 # The following options will let you change the default colors of syscons.
 options 	SC_NORM_ATTR=(FG_GREEN|BG_BLACK)
 options 	SC_NORM_REV_ATTR=(FG_YELLOW|BG_GREEN)
 options 	SC_KERNEL_CONS_ATTR=(FG_RED|BG_BLACK)
 options 	SC_KERNEL_CONS_REV_ATTR=(FG_BLACK|BG_RED)
 
 # The following options will let you change the default behavior of
 # cut-n-paste feature
 options 	SC_CUT_SPACES2TABS	# convert leading spaces into tabs
 options 	SC_CUT_SEPCHARS=\"x09\"	# set of characters that delimit words
 					# (default is single space - \"x20\")
 
 # If you have a two button mouse, you may want to add the following option
 # to use the right button of the mouse to paste text.
 options 	SC_TWOBUTTON_MOUSE
 
 # You can selectively disable features in syscons.
 options 	SC_NO_CUTPASTE
 options 	SC_NO_FONT_LOADING
 options 	SC_NO_HISTORY
 options 	SC_NO_MODE_CHANGE
 options 	SC_NO_SYSMOUSE
 options 	SC_NO_SUSPEND_VTYSWITCH
 
 # `flags' for sc
 #	0x80	Put the video card in the VESA 800x600 dots, 16 color mode
 #	0x100	Probe for a keyboard device periodically if one is not present
 
 # Enable experimental features of the syscons terminal emulator (teken).
 options 	TEKEN_CONS25		# cons25-style terminal emulation
 options 	TEKEN_UTF8		# UTF-8 output handling
 
 # The vt video console driver.
 device		vt
 options		VT_ALT_TO_ESC_HACK=1	# Prepend ESC sequence to ALT keys
 options		VT_MAXWINDOWS=16	# Number of virtual consoles
 options		VT_TWOBUTTON_MOUSE	# Use right mouse button to paste
 
 # The following options set the default framebuffer size.
 options		VT_FB_DEFAULT_HEIGHT=480
 options		VT_FB_DEFAULT_WIDTH=640
 
 # The following options will let you change the default vt terminal colors.
 options		TERMINAL_NORM_ATTR=(FG_GREEN|BG_BLACK)
 options		TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK)
 
 #
 # Optional devices:
 #
 
 #
 # SCSI host adapters:
 #
 # adv: All Narrow SCSI bus AdvanSys controllers.
 # adw: Second Generation AdvanSys controllers including the ADV940UW.
 # aha: Adaptec 154x/1535/1640
 # ahb: Adaptec 174x EISA controllers
 # ahc: Adaptec 274x/284x/2910/293x/294x/394x/3950x/3960x/398X/4944/
 #      19160x/29160x, aic7770/aic78xx
 # ahd: Adaptec 29320/39320 Controllers.
 # aic: Adaptec 6260/6360, APA-1460 (PC Card), NEC PC9801-100 (C-BUS)
 # bt:  Most Buslogic controllers: including BT-445, BT-54x, BT-64x, BT-74x,
 #      BT-75x, BT-946, BT-948, BT-956, BT-958, SDC3211B, SDC3211F, SDC3222F
 # esp: Emulex ESP, NCR 53C9x and QLogic FAS families based controllers
 #      including the AMD Am53C974 (found on devices such as the Tekram
 #      DC-390(T)) and the Sun ESP and FAS families of controllers
 # isp: Qlogic ISP 1020, 1040 and 1040B PCI SCSI host adapters,
 #      ISP 1240 Dual Ultra SCSI, ISP 1080 and 1280 (Dual) Ultra2,
 #      ISP 12160 Ultra3 SCSI,
 #      Qlogic ISP 2100 and ISP 2200 1Gb Fibre Channel host adapters.
 #      Qlogic ISP 2300 and ISP 2312 2Gb Fibre Channel host adapters.
 #      Qlogic ISP 2322 and ISP 6322 2Gb Fibre Channel host adapters.
 # ispfw: Firmware module for Qlogic host adapters
 # mpt: LSI-Logic MPT/Fusion 53c1020 or 53c1030 Ultra4
 #      or FC9x9 Fibre Channel host adapters.
 # ncr: NCR 53C810, 53C825 self-contained SCSI host adapters.
 # sym: Symbios/Logic 53C8XX family of PCI-SCSI I/O processors:
 #      53C810, 53C810A, 53C815, 53C825,  53C825A, 53C860, 53C875,
 #      53C876, 53C885,  53C895, 53C895A, 53C896,  53C897, 53C1510D,
 #      53C1010-33, 53C1010-66.
 # trm: Tekram DC395U/UW/F DC315U adapters.
 # wds: WD7000
 
 #
 # Note that the order is important in order for Buslogic ISA/EISA cards to be
 # probed correctly.
 #
 device		bt
 hint.bt.0.at="isa"
 hint.bt.0.port="0x330"
 device		adv
 hint.adv.0.at="isa"
 device		adw
 device		aha
 hint.aha.0.at="isa"
 device		aic
 hint.aic.0.at="isa"
 device		ahb
 device		ahc
 device		ahd
 device		esp
 device		iscsi_initiator
 device		isp
 hint.isp.0.disable="1"
 hint.isp.0.role="3"
 hint.isp.0.prefer_iomap="1"
 hint.isp.0.prefer_memmap="1"
 hint.isp.0.fwload_disable="1"
 hint.isp.0.ignore_nvram="1"
 hint.isp.0.fullduplex="1"
 hint.isp.0.topology="lport"
 hint.isp.0.topology="nport"
 hint.isp.0.topology="lport-only"
 hint.isp.0.topology="nport-only"
 # we can't get u_int64_t types, nor can we get strings if it's got
 # a leading 0x, hence this silly dodge.
 hint.isp.0.portwnn="w50000000aaaa0000"
 hint.isp.0.nodewnn="w50000000aaaa0001"
 device		ispfw
 device		mpt
 device		ncr
 device		sym
 device		trm
 device		wds
 hint.wds.0.at="isa"
 hint.wds.0.port="0x350"
 hint.wds.0.irq="11"
 hint.wds.0.drq="6"
 
 # The aic7xxx driver will attempt to use memory mapped I/O for all PCI
 # controllers that have it configured only if this option is set. Unfortunately,
 # this doesn't work on some motherboards, which prevents it from being the
 # default.
 options 	AHC_ALLOW_MEMIO
 
 # Dump the contents of the ahc controller configuration PROM.
 options 	AHC_DUMP_EEPROM
 
 # Bitmap of units to enable targetmode operations.
 options 	AHC_TMODE_ENABLE
 
 # Compile in Aic7xxx Debugging code.
 options 	AHC_DEBUG
 
 # Aic7xxx driver debugging options. See sys/dev/aic7xxx/aic7xxx.h
 options 	AHC_DEBUG_OPTS
 
 # Print register bitfields in debug output.  Adds ~128k to driver
 # See ahc(4).
 options 	AHC_REG_PRETTY_PRINT
 
 # Compile in aic79xx debugging code.
 options 	AHD_DEBUG
 
 # Aic79xx driver debugging options.  Adds ~215k to driver.  See ahd(4).
 options 	AHD_DEBUG_OPTS=0xFFFFFFFF
 
 # Print human-readable register definitions when debugging
 options 	AHD_REG_PRETTY_PRINT
 
 # Bitmap of units to enable targetmode operations.
 options 	AHD_TMODE_ENABLE
 
 # The adw driver will attempt to use memory mapped I/O for all PCI
 # controllers that have it configured only if this option is set.
 options 	ADW_ALLOW_MEMIO
 
 # Options used in dev/iscsi (Software iSCSI stack)
 #
 options 	ISCSI_INITIATOR_DEBUG=9
 
 # Options used in dev/isp/ (Qlogic SCSI/FC driver).
 #
 #	ISP_TARGET_MODE		-	enable target mode operation
 #
 options 	ISP_TARGET_MODE=1
 #
 #	ISP_DEFAULT_ROLES	-	default role
 #		none=0
 #		target=1
 #		initiator=2
 #		both=3			(not supported currently)
 #
 #	ISP_INTERNAL_TARGET		(trivial internal disk target, for testing)
 #
 options 	ISP_DEFAULT_ROLES=0
 
 # Options used in dev/sym/ (Symbios SCSI driver).
 #options 	SYM_SETUP_LP_PROBE_MAP	#-Low Priority Probe Map (bits)
 					# Allows the ncr to take precedence
 					# 1 (1<<0) -> 810a, 860
 					# 2 (1<<1) -> 825a, 875, 885, 895
 					# 4 (1<<2) -> 895a, 896, 1510d
 #options 	SYM_SETUP_SCSI_DIFF	#-HVD support for 825a, 875, 885
 					# disabled:0 (default), enabled:1
 #options 	SYM_SETUP_PCI_PARITY	#-PCI parity checking
 					# disabled:0, enabled:1 (default)
 #options 	SYM_SETUP_MAX_LUN	#-Number of LUNs supported
 					# default:8, range:[1..64]
 
 # The 'dpt' driver provides support for old DPT controllers (http://www.dpt.com/).
 # These have hardware RAID-{0,1,5} support, and do multi-initiator I/O.
 # The DPT controllers are commonly re-licensed under other brand-names -
 # some controllers by Olivetti, Dec, HP, AT&T, SNI, AST, Alphatronic, NEC and
 # Compaq are actually DPT controllers.
 #
 # See src/sys/dev/dpt for debugging and other subtle options.
 #  DPT_MEASURE_PERFORMANCE  Enables a set of (semi)invasive metrics. Various
 #                           instruments are enabled.  The tools in
 #                           /usr/sbin/dpt_* assume these to be enabled.
 #  DPT_DEBUG_xxxx           These are controllable from sys/dev/dpt/dpt.h
 #  DPT_RESET_HBA            Make "reset" actually reset the controller
 #                           instead of fudging it.  Only enable this if you
 #			    are 100% certain you need it.
 
 device		dpt
 
 # DPT options
 #!CAM# options 	DPT_MEASURE_PERFORMANCE
 options 	DPT_RESET_HBA
 
 #
 # Compaq "CISS" RAID controllers (SmartRAID 5* series)
 # These controllers have a SCSI-like interface, and require the
 # CAM infrastructure.
 #
 device		ciss
 
 #
 # Intel Integrated RAID controllers.
 # This driver was developed and is maintained by Intel.  Contacts
 # at Intel for this driver are
 # "Kannanthanam, Boji T"  and
 # "Leubner, Achim" .
 #
 device		iir
 
 #
 # Mylex AcceleRAID and eXtremeRAID controllers with v6 and later
 # firmware.  These controllers have a SCSI-like interface, and require
 # the CAM infrastructure.
 #
 device		mly
 
 #
 # Compaq Smart RAID, Mylex DAC960 and AMI MegaRAID controllers.  Only
 # one entry is needed; the code will find and configure all supported
 # controllers.
 #
 device		ida		# Compaq Smart RAID
 device		mlx		# Mylex DAC960
 device		amr		# AMI MegaRAID
 device		amrp		# SCSI Passthrough interface (optional, CAM req.)
 device		mfi		# LSI MegaRAID SAS
 device		mfip		# LSI MegaRAID SAS passthrough, requires CAM
 options 	MFI_DEBUG
 device		mrsas		# LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s
 
 #
 # 3ware ATA RAID
 #
 device		twe		# 3ware ATA RAID
 
 #
 # Serial ATA host controllers:
 #
 # ahci: Advanced Host Controller Interface (AHCI) compatible
 # mvs:  Marvell 88SX50XX/88SX60XX/88SX70XX/SoC controllers
 # siis: SiliconImage SiI3124/SiI3132/SiI3531 controllers
 #
 # These drivers are part of cam(4) subsystem. They supersede less featured
 # ata(4) subsystem drivers, supporting same hardware.
 
 device		ahci
 device		mvs
 device		siis
 
 #
 # The 'ATA' driver supports all legacy ATA/ATAPI controllers, including
 # PC Card devices. You only need one "device ata" for it to find all
 # PCI and PC Card ATA/ATAPI devices on modern machines.
 # Alternatively, individual bus and chipset drivers may be chosen by using
 # the 'atacore' driver then selecting the drivers on a per vendor basis.
 # For example to build a system which only supports a VIA chipset,
 # omit 'ata' and include the 'atacore', 'atapci' and 'atavia' drivers.
 device		ata
 
 # Modular ATA
 #device		atacore		# Core ATA functionality
 #device		atacard		# CARDBUS support
 #device		atabus		# PC98 cbus support
 #device		ataisa		# ISA bus support
 #device		atapci		# PCI bus support; only generic chipset support
 
 # PCI ATA chipsets
 #device		ataahci		# AHCI SATA
 #device		ataacard	# ACARD
 #device		ataacerlabs	# Acer Labs Inc. (ALI)
 #device		ataadaptec	# Adaptec
 #device		ataamd		# American Micro Devices (AMD)
 #device		ataati		# ATI
 #device		atacenatek	# Cenatek
 #device		atacypress	# Cypress
 #device		atacyrix	# Cyrix
 #device		atahighpoint	# HighPoint
 #device		ataintel	# Intel
 #device		ataite		# Integrated Technology Inc. (ITE)
 #device		atajmicron	# JMicron
 #device		atamarvell	# Marvell
 #device		atamicron	# Micron
 #device		atanational	# National
 #device		atanetcell	# NetCell
 #device		atanvidia	# nVidia
 #device		atapromise	# Promise
 #device		ataserverworks	# ServerWorks
 #device		atasiliconimage	# Silicon Image Inc. (SiI) (formerly CMD)
 #device		atasis		# Silicon Integrated Systems Corp.(SiS)
 #device		atavia		# VIA Technologies Inc.
 
 #
 # For older non-PCI, non-PnPBIOS systems, these are the hints lines to add:
 hint.ata.0.at="isa"
 hint.ata.0.port="0x1f0"
 hint.ata.0.irq="14"
 hint.ata.1.at="isa"
 hint.ata.1.port="0x170"
 hint.ata.1.irq="15"
 
 #
 # The following options are valid on the ATA driver:
 #
 # ATA_STATIC_ID:	controller numbering is static ie depends on location
 #			else the device numbers are dynamically allocated.
 # ATA_REQUEST_TIMEOUT:	the number of seconds to wait for an ATA request
 #			before timing out.
 
 options 	ATA_STATIC_ID
 #options 	ATA_REQUEST_TIMEOUT=10
 
 #
 # Standard floppy disk controllers and floppy tapes, supports
 # the Y-E DATA External FDD (PC Card)
 #
 device		fdc
 hint.fdc.0.at="isa"
 hint.fdc.0.port="0x3F0"
 hint.fdc.0.irq="6"
 hint.fdc.0.drq="2"
 #
 # FDC_DEBUG enables floppy debugging.  Since the debug output is huge, you
 # gotta turn it actually on by setting the variable fd_debug with DDB,
 # however.
 options 	FDC_DEBUG
 #
 # Activate this line if you happen to have an Insight floppy tape.
 # Probing them proved to be dangerous for people with floppy disks only,
 # so it's "hidden" behind a flag:
 #hint.fdc.0.flags="1"
 
 # Specify floppy devices
 hint.fd.0.at="fdc0"
 hint.fd.0.drive="0"
 hint.fd.1.at="fdc0"
 hint.fd.1.drive="1"
 
 #
 # uart: newbusified driver for serial interfaces.  It consolidates the sio(4),
 #	sab(4) and zs(4) drivers.
 #
 device		uart
 
 # Options for uart(4)
 options 	UART_PPS_ON_CTS		# Do time pulse capturing using CTS
 					# instead of DCD.
 options 	UART_POLL_FREQ		# Set polling rate, used when hw has
 					# no interrupt support (50 Hz default).
 
 # The following hint should only be used for pure ISA devices.  It is not
 # needed otherwise.  Use of hints is strongly discouraged.
 hint.uart.0.at="isa"
 
 # The following 3 hints are used when the UART is a system device (i.e., a
 # console or debug port), but only on platforms that don't have any other
 # means to pass the information to the kernel.  The unit number of the hint
 # is only used to bundle the hints together.  There is no relation to the
 # unit number of the probed UART.
 hint.uart.0.port="0x3f8"
 hint.uart.0.flags="0x10"
 hint.uart.0.baud="115200"
 
 # `flags' for serial drivers that support consoles like sio(4) and uart(4):
 #	0x10	enable console support for this unit.  Other console flags
 #		(if applicable) are ignored unless this is set.  Enabling
 #		console support does not make the unit the preferred console.
 #		Boot with -h or set boot_serial=YES in the loader.  For sio(4)
 #		specifically, the 0x20 flag can also be set (see above).
 #		Currently, at most one unit can have console support; the
 #		first one (in config file order) with this flag set is
 #		preferred.  Setting this flag for sio0 gives the old behavior.
 #	0x80	use this port for serial line gdb support in ddb.  Also known
 #		as debug port.
 #
 
 # Options for serial drivers that support consoles:
 options 	BREAK_TO_DEBUGGER	# A BREAK/DBG on the console goes to
 					# ddb, if available.
 
 # Solaris implements a new BREAK which is initiated by a character
 # sequence CR ~ ^b which is similar to a familiar pattern used on
 # Sun servers by the Remote Console.  There are FreeBSD extensions:
 # CR ~ ^p requests force panic and CR ~ ^r requests a clean reboot.
 options 	ALT_BREAK_TO_DEBUGGER
 
 # Serial Communications Controller
 # Supports the Siemens SAB 82532 and Zilog Z8530 multi-channel
 # communications controllers.
 device		scc
 
 # PCI Universal Communications driver
 # Supports various multi port PCI I/O cards.
 device		puc
 
 #
 # Network interfaces:
 #
 # MII bus support is required for many PCI Ethernet NICs,
 # namely those which use MII-compliant transceivers or implement
 # transceiver control interfaces that operate like an MII.  Adding
 # "device miibus" to the kernel config pulls in support for the generic
 # miibus API, the common support for for bit-bang'ing the MII and all
 # of the PHY drivers, including a generic one for PHYs that aren't
 # specifically handled by an individual driver.  Support for specific
 # PHYs may be built by adding "device mii", "device mii_bitbang" if
 # needed by the NIC driver and then adding the appropriate PHY driver.
 device  	mii		# Minimal MII support
 device  	mii_bitbang	# Common module for bit-bang'ing the MII
 device  	miibus		# MII support w/ bit-bang'ing and all PHYs
 
 device  	acphy		# Altima Communications AC101
 device  	amphy		# AMD AM79c873 / Davicom DM910{1,2}
 device  	atphy		# Attansic/Atheros F1
 device  	axphy		# Asix Semiconductor AX88x9x
 device  	bmtphy		# Broadcom BCM5201/BCM5202 and 3Com 3c905C
 device  	brgphy		# Broadcom BCM54xx/57xx 1000baseTX
 device  	ciphy		# Cicada/Vitesse CS/VSC8xxx
 device  	e1000phy	# Marvell 88E1000 1000/100/10-BT
 device  	gentbi		# Generic 10-bit 1000BASE-{LX,SX} fiber ifaces
 device  	icsphy		# ICS ICS1889-1893
 device  	ip1000phy	# IC Plus IP1000A/IP1001
 device  	jmphy		# JMicron JMP211/JMP202
 device  	lxtphy		# Level One LXT-970
 device  	mlphy		# Micro Linear 6692
 device  	nsgphy		# NatSemi DP8361/DP83865/DP83891
 device  	nsphy		# NatSemi DP83840A
 device  	nsphyter	# NatSemi DP83843/DP83815
 device  	pnaphy		# HomePNA
 device  	qsphy		# Quality Semiconductor QS6612
 device  	rdcphy		# RDC Semiconductor R6040
 device  	rgephy		# RealTek 8169S/8110S/8211B/8211C
 device  	rlphy		# RealTek 8139
 device  	rlswitch	# RealTek 8305
 device  	smcphy		# SMSC LAN91C111
 device  	tdkphy		# TDK 89Q2120
 device  	tlphy		# Texas Instruments ThunderLAN
 device  	truephy		# LSI TruePHY
 device		xmphy		# XaQti XMAC II
 
 # an:   Aironet 4500/4800 802.11 wireless adapters. Supports the PCMCIA,
 #       PCI and ISA varieties.
 # ae:   Support for gigabit ethernet adapters based on the Attansic/Atheros
 #       L2 PCI-Express FastEthernet controllers.
 # age:  Support for gigabit ethernet adapters based on the Attansic/Atheros
 #       L1 PCI express gigabit ethernet controllers.
 # alc:  Support for Atheros AR8131/AR8132 PCIe ethernet controllers.
 # ale:  Support for Atheros AR8121/AR8113/AR8114 PCIe ethernet controllers.
 # ath:  Atheros a/b/g WiFi adapters (requires ath_hal and wlan)
 # bce:	Broadcom NetXtreme II (BCM5706/BCM5708) PCI/PCIe Gigabit Ethernet
 #       adapters.
 # bfe:	Broadcom BCM4401 Ethernet adapter.
 # bge:	Support for gigabit ethernet adapters based on the Broadcom
 #	BCM570x family of controllers, including the 3Com 3c996-T,
 #	the Netgear GA302T, the SysKonnect SK-9D21 and SK-9D41, and
 #	the embedded gigE NICs on Dell PowerEdge 2550 servers.
 # bxe:	Broadcom NetXtreme II (BCM5771X/BCM578XX) PCIe 10Gb Ethernet
 #       adapters.
 # bwi:	Broadcom BCM430* and BCM431* family of wireless adapters.
 # bwn:	Broadcom BCM43xx family of wireless adapters.
 # cas:	Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn
 # cm:	Arcnet SMC COM90c26 / SMC COM90c56
 #	(and SMC COM90c66 in '56 compatibility mode) adapters.
 # cxgbe: Support for PCI express 10Gb/1Gb adapters based on the Chelsio T4
 #       (Terminator 4) ASIC.
 # dc:   Support for PCI fast ethernet adapters based on the DEC/Intel 21143
 #       and various workalikes including:
 #       the ADMtek AL981 Comet and AN985 Centaur, the ASIX Electronics
 #       AX88140A and AX88141, the Davicom DM9100 and DM9102, the Lite-On
 #       82c168 and 82c169 PNIC, the Lite-On/Macronix LC82C115 PNIC II
 #       and the Macronix 98713/98713A/98715/98715A/98725 PMAC. This driver
 #       replaces the old al, ax, dm, pn and mx drivers.  List of brands:
 #       Digital DE500-BA, Kingston KNE100TX, D-Link DFE-570TX, SOHOware SFA110,
 #       SVEC PN102-TX, CNet Pro110B, 120A, and 120B, Compex RL100-TX,
 #       LinkSys LNE100TX, LNE100TX V2.0, Jaton XpressNet, Alfa Inc GFC2204,
 #       KNE110TX.
 # de:   Digital Equipment DC21040
 # em:   Intel Pro/1000 Gigabit Ethernet 82542, 82543, 82544 based adapters.
 # igb:  Intel Pro/1000 PCI Express Gigabit Ethernet: 82575 and later adapters.
 # ep:   3Com 3C509, 3C529, 3C556, 3C562D, 3C563D, 3C572, 3C574X, 3C579, 3C589
 #       and PC Card devices using these chipsets.
 # ex:   Intel EtherExpress Pro/10 and other i82595-based adapters,
 #       Olicom Ethernet PC Card devices.
 # fe:   Fujitsu MB86960A/MB86965A Ethernet
 # fea:  DEC DEFEA EISA FDDI adapter
 # fpa:  Support for the Digital DEFPA PCI FDDI. `device fddi' is also needed.
 # fxp:  Intel EtherExpress Pro/100B
 #	(hint of prefer_iomap can be done to prefer I/O instead of Mem mapping)
 # gem:  Apple GMAC/Sun ERI/Sun GEM
 # hme:  Sun HME (Happy Meal Ethernet)
 # jme:  JMicron JMC260 Fast Ethernet/JMC250 Gigabit Ethernet based adapters.
 # le:   AMD Am7900 LANCE and Am79C9xx PCnet
 # lge:	Support for PCI gigabit ethernet adapters based on the Level 1
 #	LXT1001 NetCellerator chipset. This includes the D-Link DGE-500SX,
 #	SMC TigerCard 1000 (SMC9462SX), and some Addtron cards.
 # malo: Marvell Libertas wireless NICs.
 # mwl:  Marvell 88W8363 802.11n wireless NICs.
 #	Requires the mwl firmware module
 # mwlfw: Marvell 88W8363 firmware
 # msk:	Support for gigabit ethernet adapters based on the Marvell/SysKonnect
 #	Yukon II Gigabit controllers, including 88E8021, 88E8022, 88E8061,
 #	88E8062, 88E8035, 88E8036, 88E8038, 88E8050, 88E8052, 88E8053,
 #	88E8055, 88E8056 and D-Link 560T/550SX.
 # lmc:	Support for the LMC/SBE wide-area network interface cards.
 # my:	Myson Fast Ethernet (MTD80X, MTD89X)
 # nge:	Support for PCI gigabit ethernet adapters based on the National
 #	Semiconductor DP83820 and DP83821 chipset. This includes the
 #	SMC EZ Card 1000 (SMC9462TX), D-Link DGE-500T, Asante FriendlyNet
 #	GigaNIX 1000TA and 1000TPC, the Addtron AEG320T, the Surecom
 #	EP-320G-TX and the Netgear GA622T.
 # oce:	Emulex 10 Gbit adapters (OneConnect Ethernet)
 # pcn:	Support for PCI fast ethernet adapters based on the AMD Am79c97x
 #	PCnet-FAST, PCnet-FAST+, PCnet-FAST III, PCnet-PRO and PCnet-Home
 #	chipsets. These can also be handled by the le(4) driver if the
 #	pcn(4) driver is left out of the kernel. The le(4) driver does not
 #	support the additional features like the MII bus and burst mode of
 #	the PCnet-FAST and greater chipsets though.
 # ral:	Ralink Technology IEEE 802.11 wireless adapter
 # re:   RealTek 8139C+/8169/816xS/811xS/8101E PCI/PCIe Ethernet adapter
 # rl:   Support for PCI fast ethernet adapters based on the RealTek 8129/8139
 #       chipset.  Note that the RealTek driver defaults to using programmed
 #       I/O to do register accesses because memory mapped mode seems to cause
 #       severe lockups on SMP hardware.  This driver also supports the
 #       Accton EN1207D `Cheetah' adapter, which uses a chip called
 #       the MPX 5030/5038, which is either a RealTek in disguise or a
 #       RealTek workalike.  Note that the D-Link DFE-530TX+ uses the RealTek
 #       chipset and is supported by this driver, not the 'vr' driver.
 # sf:   Support for Adaptec Duralink PCI fast ethernet adapters based on the
 #       Adaptec AIC-6915 "starfire" controller.
 #       This includes dual and quad port cards, as well as one 100baseFX card.
 #       Most of these are 64-bit PCI devices, except for one single port
 #       card which is 32-bit.
 # sge:  Silicon Integrated Systems SiS190/191 Fast/Gigabit Ethernet adapter
 # sis:  Support for NICs based on the Silicon Integrated Systems SiS 900,
 #       SiS 7016 and NS DP83815 PCI fast ethernet controller chips.
 # sk:   Support for the SysKonnect SK-984x series PCI gigabit ethernet NICs.
 #       This includes the SK-9841 and SK-9842 single port cards (single mode
 #       and multimode fiber) and the SK-9843 and SK-9844 dual port cards
 #       (also single mode and multimode).
 #       The driver will autodetect the number of ports on the card and
 #       attach each one as a separate network interface.
 # sn:   Support for ISA and PC Card Ethernet devices using the
 #       SMC91C90/92/94/95 chips.
 # ste:  Sundance Technologies ST201 PCI fast ethernet controller, includes
 #       the D-Link DFE-550TX.
 # stge: Support for gigabit ethernet adapters based on the Sundance/Tamarack
 #       TC9021 family of controllers, including the Sundance ST2021/ST2023,
 #       the Sundance/Tamarack TC9021, the D-Link DL-4000 and ASUS NX1101.
 # ti:   Support for PCI gigabit ethernet NICs based on the Alteon Networks
 #       Tigon 1 and Tigon 2 chipsets.  This includes the Alteon AceNIC, the
 #       3Com 3c985, the Netgear GA620 and various others.  Note that you will
 #       probably want to bump up kern.ipc.nmbclusters a lot to use this driver.
 # tl:   Support for the Texas Instruments TNETE100 series 'ThunderLAN'
 #       cards and integrated ethernet controllers.  This includes several
 #       Compaq Netelligent 10/100 cards and the built-in ethernet controllers
 #       in several Compaq Prosignia, Proliant and Deskpro systems.  It also
 #       supports several Olicom 10Mbps and 10/100 boards.
 # tx:   SMC 9432 TX, BTX and FTX cards. (SMC EtherPower II series)
 # txp:	Support for 3Com 3cR990 cards with the "Typhoon" chipset
 # vr:   Support for various fast ethernet adapters based on the VIA
 #       Technologies VT3043 `Rhine I' and VT86C100A `Rhine II' chips,
 #       including the D-Link DFE520TX and D-Link DFE530TX (see 'rl' for
 #       DFE530TX+), the Hawking Technologies PN102TX, and the AOpen/Acer ALN-320.
 # vte:  DM&P Vortex86 RDC R6040 Fast Ethernet
 # vx:   3Com 3C590 and 3C595
 # wb:   Support for fast ethernet adapters based on the Winbond W89C840F chip.
 #       Note: this is not the same as the Winbond W89C940F, which is a
 #       NE2000 clone.
 # wi:   Lucent WaveLAN/IEEE 802.11 PCMCIA adapters. Note: this supports both
 #       the PCMCIA and ISA cards: the ISA card is really a PCMCIA to ISA
 #       bridge with a PCMCIA adapter plugged into it.
 # xe:   Xircom/Intel EtherExpress Pro100/16 PC Card ethernet controller,
 #       Accton Fast EtherCard-16, Compaq Netelligent 10/100 PC Card,
 #       Toshiba 10/100 Ethernet PC Card, Xircom 16-bit Ethernet + Modem 56
 # xl:   Support for the 3Com 3c900, 3c905, 3c905B and 3c905C (Fast)
 #       Etherlink XL cards and integrated controllers.  This includes the
 #       integrated 3c905B-TX chips in certain Dell Optiplex and Dell
 #       Precision desktop machines and the integrated 3c905-TX chips
 #       in Dell Latitude laptop docking stations.
 #       Also supported: 3Com 3c980(C)-TX, 3Com 3cSOHO100-TX, 3Com 3c450-TX
 
 # Order for ISA/EISA devices is important here
 
 device		cm
 hint.cm.0.at="isa"
 hint.cm.0.port="0x2e0"
 hint.cm.0.irq="9"
 hint.cm.0.maddr="0xdc000"
 device		ep
 device		ex
 device		fe
 hint.fe.0.at="isa"
 hint.fe.0.port="0x300"
 device		fea
 device		sn
 hint.sn.0.at="isa"
 hint.sn.0.port="0x300"
 hint.sn.0.irq="10"
 device		an
 device		wi
 device		xe
 
 # PCI Ethernet NICs that use the common MII bus controller code.
 device		ae		# Attansic/Atheros L2 FastEthernet
 device		age		# Attansic/Atheros L1 Gigabit Ethernet
 device		alc		# Atheros AR8131/AR8132 Ethernet
 device		ale		# Atheros AR8121/AR8113/AR8114 Ethernet
 device		bce		# Broadcom BCM5706/BCM5708 Gigabit Ethernet
 device		bfe		# Broadcom BCM440x 10/100 Ethernet
 device		bge		# Broadcom BCM570xx Gigabit Ethernet
 device		cas		# Sun Cassini/Cassini+ and NS DP83065 Saturn
 device		cxgb		# Chelsio T3 10 Gigabit Ethernet
 device		cxgb_t3fw	# Chelsio T3 10 Gigabit Ethernet firmware
 device		dc		# DEC/Intel 21143 and various workalikes
 device		et		# Agere ET1310 10/100/Gigabit Ethernet
 device		fxp		# Intel EtherExpress PRO/100B (82557, 82558)
 hint.fxp.0.prefer_iomap="0"
 device		gem		# Apple GMAC/Sun ERI/Sun GEM
 device		hme		# Sun HME (Happy Meal Ethernet)
 device		jme		# JMicron JMC250 Gigabit/JMC260 Fast Ethernet
 device		lge		# Level 1 LXT1001 gigabit Ethernet
 device		msk		# Marvell/SysKonnect Yukon II Gigabit Ethernet
 device		my		# Myson Fast Ethernet (MTD80X, MTD89X)
 device		nge		# NatSemi DP83820 gigabit Ethernet
 device		re		# RealTek 8139C+/8169/8169S/8110S
 device		rl		# RealTek 8129/8139
 device		pcn		# AMD Am79C97x PCI 10/100 NICs
 device		sf		# Adaptec AIC-6915 (``Starfire'')
 device		sge		# Silicon Integrated Systems SiS190/191
 device		sis		# Silicon Integrated Systems SiS 900/SiS 7016
 device		sk		# SysKonnect SK-984x & SK-982x gigabit Ethernet
 device		ste		# Sundance ST201 (D-Link DFE-550TX)
 device		stge		# Sundance/Tamarack TC9021 gigabit Ethernet
 device		tl		# Texas Instruments ThunderLAN
 device		tx		# SMC EtherPower II (83c170 ``EPIC'')
 device		vr		# VIA Rhine, Rhine II
 device		vte		# DM&P Vortex86 RDC R6040 Fast Ethernet
 device		wb		# Winbond W89C840F
 device		xl		# 3Com 3c90x (``Boomerang'', ``Cyclone'')
 
 # PCI Ethernet NICs.
 device		cxgbe		# Chelsio T4 10GbE PCIe adapter
 device		de		# DEC/Intel DC21x4x (``Tulip'')
 device		em		# Intel Pro/1000 Gigabit Ethernet
 device		igb		# Intel Pro/1000 PCIE Gigabit Ethernet
 device		ixgb		# Intel Pro/10Gbe PCI-X Ethernet
 device		ixgbe		# Intel Pro/10Gbe PCIE Ethernet
 device		le		# AMD Am7900 LANCE and Am79C9xx PCnet
 device		mxge		# Myricom Myri-10G 10GbE NIC
 device		nxge		# Neterion Xframe 10GbE Server/Storage Adapter
 device		oce		# Emulex 10 GbE (OneConnect Ethernet)
 device		ti		# Alteon Networks Tigon I/II gigabit Ethernet
 device		txp		# 3Com 3cR990 (``Typhoon'')
 device		vx		# 3Com 3c590, 3c595 (``Vortex'')
 device		vxge		# Exar/Neterion XFrame 3100 10GbE
 
 # PCI FDDI NICs.
 device		fpa
 
 # PCI WAN adapters.
 device		lmc
 
 # PCI IEEE 802.11 Wireless NICs
 device		ath		# Atheros pci/cardbus NIC's
 device		ath_hal		# pci/cardbus chip support
 #device		ath_ar5210	# AR5210 chips
 #device		ath_ar5211	# AR5211 chips
 #device		ath_ar5212	# AR5212 chips
 #device		ath_rf2413
 #device		ath_rf2417
 #device		ath_rf2425
 #device		ath_rf5111
 #device		ath_rf5112
 #device		ath_rf5413
 #device		ath_ar5416	# AR5416 chips
 options 	AH_SUPPORT_AR5416	# enable AR5416 tx/rx descriptors
 # All of the AR5212 parts have a problem when paired with the AR71xx
 # CPUS.  These parts have a bug that triggers a fatal bus error on the AR71xx
 # only.  Details of the exact nature of the bug are sketchy, but some can be
 # found at https://forum.openwrt.org/viewtopic.php?pid=70060 on pages 4, 5 and
 # 6.  This option enables this workaround.  There is a performance penalty
 # for this work around, but without it things don't work at all.  The DMA
 # from the card usually bursts 128 bytes, but on the affected CPUs, only
 # 4 are safe.
 options	   	AH_RXCFG_SDMAMW_4BYTES
 #device		ath_ar9160	# AR9160 chips
 #device		ath_ar9280	# AR9280 chips
 #device		ath_ar9285	# AR9285 chips
 device		ath_rate_sample	# SampleRate tx rate control for ath
 device		bwi		# Broadcom BCM430* BCM431*
 device		bwn		# Broadcom BCM43xx
 device		malo		# Marvell Libertas wireless NICs.
 device		mwl		# Marvell 88W8363 802.11n wireless NICs.
 device		mwlfw
 device		ral		# Ralink Technology RT2500 wireless NICs.
 
 # Use sf_buf(9) interface for jumbo buffers on ti(4) controllers.
 #options 	TI_SF_BUF_JUMBO
 # Turn on the header splitting option for the ti(4) driver firmware.  This
 # only works for Tigon II chips, and has no effect for Tigon I chips.
 # This option requires the TI_SF_BUF_JUMBO option above.
 #options 	TI_JUMBO_HDRSPLIT
 
 # These two options allow manipulating the mbuf cluster size and mbuf size,
 # respectively.  Be very careful with NIC driver modules when changing
 # these from their default values, because that can potentially cause a
 # mismatch between the mbuf size assumed by the kernel and the mbuf size
 # assumed by a module.  The only driver that currently has the ability to
 # detect a mismatch is ti(4).
 options 	MCLSHIFT=12	# mbuf cluster shift in bits, 12 == 4KB
 options 	MSIZE=512	# mbuf size in bytes
 
 #
 # ATM related options (Cranor version)
 # (note: this driver cannot be used with the HARP ATM stack)
 #
 # The `en' device provides support for Efficient Networks (ENI)
 # ENI-155 PCI midway cards, and the Adaptec 155Mbps PCI ATM cards (ANA-59x0).
 #
 # The `hatm' device provides support for Fore/Marconi HE155 and HE622
 # ATM PCI cards.
 #
 # The `fatm' device provides support for Fore PCA200E ATM PCI cards.
 #
 # The `patm' device provides support for IDT77252 based cards like
 # ProSum's ProATM-155 and ProATM-25 and IDT's evaluation boards.
 #
 # atm device provides generic atm functions and is required for
 # atm devices.
 # NATM enables the netnatm protocol family that can be used to
 # bypass TCP/IP.
 #
 # utopia provides the access to the ATM PHY chips and is required for en,
 # hatm and fatm.
 #
 # the current driver supports only PVC operations (no atm-arp, no multicast).
 # for more details, please read the original documents at
 # http://www.ccrc.wustl.edu/pub/chuck/tech/bsdatm/bsdatm.html
 #
 device		atm
 device		en
 device		fatm			#Fore PCA200E
 device		hatm			#Fore/Marconi HE155/622
 device		patm			#IDT77252 cards (ProATM and IDT)
 device		utopia			#ATM PHY driver
 options 	NATM			#native ATM
 
 options 	LIBMBPOOL		#needed by patm, iatm
 
 #
 # Sound drivers
 #
 # sound: The generic sound driver.
 #
 
 device		sound
 
 #
 # snd_*: Device-specific drivers.
 #
 # The flags of the device tell the device a bit more info about the
 # device that normally is obtained through the PnP interface.
 #	bit  2..0   secondary DMA channel;
 #	bit  4      set if the board uses two dma channels;
 #	bit 15..8   board type, overrides autodetection; leave it
 #		    zero if don't know what to put in (and you don't,
 #		    since this is unsupported at the moment...).
 #
 # snd_ad1816:		Analog Devices AD1816 ISA PnP/non-PnP.
 # snd_als4000:		Avance Logic ALS4000 PCI.
 # snd_atiixp:		ATI IXP 200/300/400 PCI.
 # snd_audiocs:		Crystal Semiconductor CS4231 SBus/EBus. Only
 #			for sparc64.
 # snd_cmi:		CMedia CMI8338/CMI8738 PCI.
 # snd_cs4281:		Crystal Semiconductor CS4281 PCI.
 # snd_csa:		Crystal Semiconductor CS461x/428x PCI. (except
 #			4281)
 # snd_ds1:		Yamaha DS-1 PCI.
 # snd_emu10k1:		Creative EMU10K1 PCI and EMU10K2 (Audigy) PCI.
 # snd_emu10kx:		Creative SoundBlaster Live! and Audigy
 # snd_envy24:		VIA Envy24 and compatible, needs snd_spicds.
 # snd_envy24ht:		VIA Envy24HT and compatible, needs snd_spicds.
 # snd_es137x:		Ensoniq AudioPCI ES137x PCI.
 # snd_ess:		Ensoniq ESS ISA PnP/non-PnP, to be used in
 #			conjunction with snd_sbc.
 # snd_fm801:		Forte Media FM801 PCI.
 # snd_gusc:		Gravis UltraSound ISA PnP/non-PnP.
 # snd_hda:		Intel High Definition Audio (Controller) and
 #			compatible.
 # snd_hdspe:		RME HDSPe AIO and RayDAT.
 # snd_ich:		Intel ICH AC'97 and some more audio controllers
 #			embedded in a chipset, for example nVidia
 #			nForce controllers.
 # snd_maestro:		ESS Technology Maestro-1/2x PCI.
 # snd_maestro3:		ESS Technology Maestro-3/Allegro PCI.
 # snd_mss:		Microsoft Sound System ISA PnP/non-PnP.
 # snd_neomagic:		Neomagic 256 AV/ZX PCI.
 # snd_sb16:		Creative SoundBlaster16, to be used in
 #			conjunction with snd_sbc.
 # snd_sb8:		Creative SoundBlaster (pre-16), to be used in
 #			conjunction with snd_sbc.
 # snd_sbc:		Creative SoundBlaster ISA PnP/non-PnP.
 #			Supports ESS and Avance ISA chips as well.
 # snd_solo:		ESS Solo-1x PCI.
 # snd_spicds:		SPI codec driver, needed by Envy24/Envy24HT drivers.
 # snd_t4dwave:		Trident 4DWave DX/NX PCI, Sis 7018 PCI and Acer Labs
 #			M5451 PCI.
 # snd_uaudio:		USB audio.
 # snd_via8233:		VIA VT8233x PCI.
 # snd_via82c686:	VIA VT82C686A PCI.
 # snd_vibes:		S3 Sonicvibes PCI.
 
 device		snd_ad1816
 device		snd_als4000
 device		snd_atiixp
 #device		snd_audiocs
 device		snd_cmi
 device		snd_cs4281
 device		snd_csa
 device		snd_ds1
 device		snd_emu10k1
 device		snd_emu10kx
 device		snd_envy24
 device		snd_envy24ht
 device		snd_es137x
 device		snd_ess
 device		snd_fm801
 device		snd_gusc
 device		snd_hda
 device		snd_hdspe
 device		snd_ich
 device		snd_maestro
 device		snd_maestro3
 device		snd_mss
 device		snd_neomagic
 device		snd_sb16
 device		snd_sb8
 device		snd_sbc
 device		snd_solo
 device		snd_spicds
 device		snd_t4dwave
 device		snd_uaudio
 device		snd_via8233
 device		snd_via82c686
 device		snd_vibes
 
 # For non-PnP sound cards:
 hint.pcm.0.at="isa"
 hint.pcm.0.irq="10"
 hint.pcm.0.drq="1"
 hint.pcm.0.flags="0x0"
 hint.sbc.0.at="isa"
 hint.sbc.0.port="0x220"
 hint.sbc.0.irq="5"
 hint.sbc.0.drq="1"
 hint.sbc.0.flags="0x15"
 hint.gusc.0.at="isa"
 hint.gusc.0.port="0x220"
 hint.gusc.0.irq="5"
 hint.gusc.0.drq="1"
 hint.gusc.0.flags="0x13"
 
 #
 # Following options are intended for debugging/testing purposes:
 #
 # SND_DEBUG                    Enable extra debugging code that includes
 #                              sanity checking and possible increase of
 #                              verbosity.
 #
 # SND_DIAGNOSTIC               Similar in a spirit of INVARIANTS/DIAGNOSTIC,
 #                              zero tolerance against inconsistencies.
 #
 # SND_FEEDER_MULTIFORMAT       By default, only 16/32 bit feeders are compiled
 #                              in. This options enable most feeder converters
 #                              except for 8bit. WARNING: May bloat the kernel.
 #
 # SND_FEEDER_FULL_MULTIFORMAT  Ditto, but includes 8bit feeders as well.
 #
 # SND_FEEDER_RATE_HP           (feeder_rate) High precision 64bit arithmetic
 #                              as much as possible (the default trying to
 #                              avoid it). Possible slowdown.
 #
 # SND_PCM_64                   (Only applicable for i386/32bit arch)
 #                              Process 32bit samples through 64bit
 #                              integer/arithmetic. Slight increase of dynamic
 #                              range at a cost of possible slowdown.
 #
 # SND_OLDSTEREO                Only 2 channels are allowed, effectively
 #                              disabling multichannel processing.
 #
 options		SND_DEBUG
 options		SND_DIAGNOSTIC
 options		SND_FEEDER_MULTIFORMAT
 options		SND_FEEDER_FULL_MULTIFORMAT
 options		SND_FEEDER_RATE_HP
 options		SND_PCM_64
 options		SND_OLDSTEREO
 
 #
-# IEEE-488 hardware:
-# pcii:		PCIIA cards (uPD7210 based isa cards)
-# tnt4882:	National Instruments PCI-GPIB card.
-
-device	pcii
-hint.pcii.0.at="isa"
-hint.pcii.0.port="0x2e1"
-hint.pcii.0.irq="5"
-hint.pcii.0.drq="1"
-
-device	tnt4882
-
-#
 # Miscellaneous hardware:
 #
 # scd: Sony CD-ROM using proprietary (non-ATAPI) interface
 # mcd: Mitsumi CD-ROM using proprietary (non-ATAPI) interface
 # bktr: Brooktree bt848/848a/849a/878/879 video capture and TV Tuner board
 # joy: joystick (including IO DATA PCJOY PC Card joystick)
 # cmx: OmniKey CardMan 4040 pccard smartcard reader
 
 # Mitsumi CD-ROM
 device		mcd
 hint.mcd.0.at="isa"
 hint.mcd.0.port="0x300"
 # for the Sony CDU31/33A CDROM
 device		scd
 hint.scd.0.at="isa"
 hint.scd.0.port="0x230"
 device		joy			# PnP aware, hints for non-PnP only
 hint.joy.0.at="isa"
 hint.joy.0.port="0x201"
 device		cmx
 
 #
 # The 'bktr' device is a PCI video capture device using the Brooktree
 # bt848/bt848a/bt849a/bt878/bt879 chipset. When used with a TV Tuner it forms a
 # TV card, e.g. Miro PC/TV, Hauppauge WinCast/TV WinTV, VideoLogic Captivator,
 # Intel Smart Video III, AverMedia, IMS Turbo, FlyVideo.
 #
 # options 	OVERRIDE_CARD=xxx
 # options 	OVERRIDE_TUNER=xxx
 # options 	OVERRIDE_MSP=1
 # options 	OVERRIDE_DBX=1
 # These options can be used to override the auto detection
 # The current values for xxx are found in src/sys/dev/bktr/bktr_card.h
 # Using sysctl(8) run-time overrides on a per-card basis can be made
 #
 # options 	BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_PAL
 # or
 # options 	BROOKTREE_SYSTEM_DEFAULT=BROOKTREE_NTSC
 # Specifies the default video capture mode.
 # This is required for Dual Crystal (28&35MHz) boards where PAL is used
 # to prevent hangs during initialization, e.g. VideoLogic Captivator PCI.
 #
 # options 	BKTR_USE_PLL
 # This is required for PAL or SECAM boards with a 28MHz crystal and no 35MHz
 # crystal, e.g. some new Bt878 cards.
 #
 # options 	BKTR_GPIO_ACCESS
 # This enables IOCTLs which give user level access to the GPIO port.
 #
 # options 	BKTR_NO_MSP_RESET
 # Prevents the MSP34xx reset. Good if you initialize the MSP in another OS first
 #
 # options 	BKTR_430_FX_MODE
 # Switch Bt878/879 cards into Intel 430FX chipset compatibility mode.
 #
 # options 	BKTR_SIS_VIA_MODE
 # Switch Bt878/879 cards into SIS/VIA chipset compatibility mode which is
 # needed for some old SiS and VIA chipset motherboards.
 # This also allows Bt878/879 chips to work on old OPTi (<1997) chipset
 # motherboards and motherboards with bad or incomplete PCI 2.1 support.
 # As a rough guess, old = before 1998
 #
 # options 	BKTR_NEW_MSP34XX_DRIVER
 # Use new, more complete initialization scheme for the msp34* soundchip.
 # Should fix stereo autodetection if the old driver does only output
 # mono sound.
 
 #
 # options 	BKTR_USE_FREEBSD_SMBUS
 # Compile with FreeBSD SMBus implementation
 #
 # Brooktree driver has been ported to the new I2C framework. Thus,
 # you'll need to have the following 3 lines in the kernel config.
 #     device smbus
 #     device iicbus
 #     device iicbb
 #     device iicsmb
 # The iic and smb devices are only needed if you want to control other
 # I2C slaves connected to the external connector of some cards.
 #
 device		bktr
  
 #
 # PC Card/PCMCIA and Cardbus
 #
 # cbb: pci/cardbus bridge implementing YENTA interface
 # pccard: pccard slots
 # cardbus: cardbus slots
 device		cbb
 device		pccard
 device		cardbus
 
 #
 # MMC/SD
 #
 # mmc 		MMC/SD bus
 # mmcsd		MMC/SD memory card
 # sdhci		Generic PCI SD Host Controller
 #
 device		mmc
 device		mmcsd
 device		sdhci
 
 #
 # SMB bus
 #
 # System Management Bus support is provided by the 'smbus' device.
 # Access to the SMBus device is via the 'smb' device (/dev/smb*),
 # which is a child of the 'smbus' device.
 #
 # Supported devices:
 # smb		standard I/O through /dev/smb*
 #
 # Supported SMB interfaces:
 # iicsmb	I2C to SMB bridge with any iicbus interface
 # bktr		brooktree848 I2C hardware interface
 # intpm		Intel PIIX4 (82371AB, 82443MX) Power Management Unit
 # alpm		Acer Aladdin-IV/V/Pro2 Power Management Unit
 # ichsmb	Intel ICH SMBus controller chips (82801AA, 82801AB, 82801BA)
 # viapm		VIA VT82C586B/596B/686A and VT8233 Power Management Unit
 # amdpm		AMD 756 Power Management Unit
 # amdsmb	AMD 8111 SMBus 2.0 Controller
 # nfpm		NVIDIA nForce Power Management Unit
 # nfsmb		NVIDIA nForce2/3/4 MCP SMBus 2.0 Controller
 # ismt		Intel SMBus 2.0 controller chips (on Atom S1200, C2000)
 #
 device		smbus		# Bus support, required for smb below.
 
 device		intpm
 device		alpm
 device		ichsmb
 device		viapm
 device		amdpm
 device		amdsmb
 device		nfpm
 device		nfsmb
 device		ismt
 
 device		smb
 
 #
 # I2C Bus
 #
 # Philips i2c bus support is provided by the `iicbus' device.
 #
 # Supported devices:
 # ic	i2c network interface
 # iic	i2c standard io
 # iicsmb i2c to smb bridge. Allow i2c i/o with smb commands.
 # iicoc simple polling driver for OpenCores I2C controller
 #
 # Supported interfaces:
 # bktr	brooktree848 I2C software interface
 #
 # Other:
 # iicbb	generic I2C bit-banging code (needed by lpbb, bktr)
 #
 device		iicbus		# Bus support, required for ic/iic/iicsmb below.
 device		iicbb
 
 device		ic
 device		iic
 device		iicsmb		# smb over i2c bridge
 device		iicoc		# OpenCores I2C controller support
 
 # I2C peripheral devices
 #
 # ds133x	Dallas Semiconductor DS1337, DS1338 and DS1339 RTC
 # ds1374	Dallas Semiconductor DS1374 RTC
 # ds1672	Dallas Semiconductor DS1672 RTC
 # s35390a	Seiko Instruments S-35390A RTC
 #
 device		ds133x
 device		ds1374
 device		ds1672
 device		s35390a
 
 # Parallel-Port Bus
 #
 # Parallel port bus support is provided by the `ppbus' device.
 # Multiple devices may be attached to the parallel port, devices
 # are automatically probed and attached when found.
 #
 # Supported devices:
 # vpo	Iomega Zip Drive
 #	Requires SCSI disk support ('scbus' and 'da'), best
 #	performance is achieved with ports in EPP 1.9 mode.
 # lpt	Parallel Printer
 # plip	Parallel network interface
 # ppi	General-purpose I/O ("Geek Port") + IEEE1284 I/O
 # pps	Pulse per second Timing Interface
 # lpbb	Philips official parallel port I2C bit-banging interface
 # pcfclock Parallel port clock driver.
 #
 # Supported interfaces:
 # ppc	ISA-bus parallel port interfaces.
 #
 
 options 	PPC_PROBE_CHIPSET # Enable chipset specific detection
 				  # (see flags in ppc(4))
 options 	DEBUG_1284	# IEEE1284 signaling protocol debug
 options 	PERIPH_1284	# Makes your computer act as an IEEE1284
 				# compliant peripheral
 options 	DONTPROBE_1284	# Avoid boot detection of PnP parallel devices
 options 	VP0_DEBUG	# ZIP/ZIP+ debug
 options 	LPT_DEBUG	# Printer driver debug
 options 	PPC_DEBUG	# Parallel chipset level debug
 options 	PLIP_DEBUG	# Parallel network IP interface debug
 options 	PCFCLOCK_VERBOSE         # Verbose pcfclock driver
 options 	PCFCLOCK_MAX_RETRIES=5   # Maximum read tries (default 10)
 
 device		ppc
 hint.ppc.0.at="isa"
 hint.ppc.0.irq="7"
 device		ppbus
 device		vpo
 device		lpt
 device		plip
 device		ppi
 device		pps
 device		lpbb
 device		pcfclock
 
 # Kernel BOOTP support
 
 options 	BOOTP		# Use BOOTP to obtain IP address/hostname
 				# Requires NFSCL and NFS_ROOT
 options 	BOOTP_NFSROOT	# NFS mount root filesystem using BOOTP info
 options 	BOOTP_NFSV3	# Use NFS v3 to NFS mount root
 options 	BOOTP_COMPAT	# Workaround for broken bootp daemons.
 options 	BOOTP_WIRED_TO=fxp0 # Use interface fxp0 for BOOTP
 options 	BOOTP_BLOCKSIZE=8192 # Override NFS block size
 
 #
 # Add software watchdog routines.
 #
 options 	SW_WATCHDOG
 
 #
 # Add the software deadlock resolver thread.
 #
 options 	DEADLKRES
 
 #
 # Disable swapping of stack pages.  This option removes all
 # code which actually performs swapping, so it's not possible to turn
 # it back on at run-time.
 #
 # This is sometimes usable for systems which don't have any swap space
 # (see also sysctls "vm.defer_swapspace_pageouts" and
 # "vm.disable_swapspace_pageouts")
 #
 #options 	NO_SWAPPING
 
 # Set the number of sf_bufs to allocate. sf_bufs are virtual buffers
 # for sendfile(2) that are used to map file VM pages, and normally
 # default to a quantity that is roughly 16*MAXUSERS+512. You would
 # typically want about 4 of these for each simultaneous file send.
 #
 options 	NSFBUFS=1024
 
 #
 # Enable extra debugging code for locks.  This stores the filename and
 # line of whatever acquired the lock in the lock itself, and changes a
 # number of function calls to pass around the relevant data.  This is
 # not at all useful unless you are debugging lock code.  Note that
 # modules should be recompiled as this option modifies KBI.
 #
 options 	DEBUG_LOCKS
 
 
 #####################################################################
 # USB support
 # UHCI controller
 device		uhci
 # OHCI controller
 device		ohci
 # EHCI controller
 device		ehci
 # XHCI controller
 device		xhci
 # SL811 Controller
 #device		slhci
 # General USB code (mandatory for USB)
 device		usb
 #
 # USB Double Bulk Pipe devices
 device		udbp
 # USB Fm Radio
 device		ufm
 # USB LED
 device		uled
 # Human Interface Device (anything with buttons and dials)
 device		uhid
 # USB keyboard
 device		ukbd
 # USB printer
 device		ulpt
 # USB mass storage driver (Requires scbus and da)
 device		umass
 # USB mass storage driver for device-side mode
 device		usfs
 # USB support for Belkin F5U109 and Magic Control Technology serial adapters
 device		umct
 # USB modem support
 device		umodem
 # USB mouse
 device		ums
 # USB touchpad(s)
 device		atp
 device		wsp
 # eGalax USB touch screen
 device		uep
 # Diamond Rio 500 MP3 player
 device		urio
 #
 # USB serial support
 device		ucom
 # USB support for 3G modem cards by Option, Novatel, Huawei and Sierra
 device		u3g
 # USB support for Technologies ARK3116 based serial adapters
 device		uark
 # USB support for Belkin F5U103 and compatible serial adapters
 device		ubsa
 # USB support for serial adapters based on the FT8U100AX and FT8U232AM
 device		uftdi
 # USB support for some Windows CE based serial communication.
 device		uipaq
 # USB support for Prolific PL-2303 serial adapters
 device		uplcom
 # USB support for Silicon Laboratories CP2101/CP2102 based USB serial adapters
 device		uslcom
 # USB Visor and Palm devices
 device		uvisor
 # USB serial support for DDI pocket's PHS
 device		uvscom
 #
 # ADMtek USB ethernet. Supports the LinkSys USB100TX,
 # the Billionton USB100, the Melco LU-ATX, the D-Link DSB-650TX
 # and the SMC 2202USB. Also works with the ADMtek AN986 Pegasus
 # eval board.
 device		aue
 
 # ASIX Electronics AX88172 USB 2.0 ethernet driver. Used in the
 # LinkSys USB200M and various other adapters.
 device		axe
 # ASIX Electronics AX88178A/AX88179 USB 2.0/3.0 gigabit ethernet driver.
 device		axge
 
 #
 # Devices which communicate using Ethernet over USB, particularly
 # Communication Device Class (CDC) Ethernet specification. Supports
 # Sharp Zaurus PDAs, some DOCSIS cable modems and so on.
 device		cdce
 #
 # CATC USB-EL1201A USB ethernet. Supports the CATC Netmate
 # and Netmate II, and the Belkin F5U111.
 device		cue
 #
 # Kawasaki LSI ethernet. Supports the LinkSys USB10T,
 # Entrega USB-NET-E45, Peracom Ethernet Adapter, the
 # 3Com 3c19250, the ADS Technologies USB-10BT, the ATen UC10T,
 # the Netgear EA101, the D-Link DSB-650, the SMC 2102USB
 # and 2104USB, and the Corega USB-T.
 device		kue
 #
 # RealTek RTL8150 USB to fast ethernet. Supports the Melco LUA-KTX
 # and the GREEN HOUSE GH-USB100B.
 device		rue
 #
 # Davicom DM9601E USB to fast ethernet. Supports the Corega FEther USB-TXC.
 device		udav
 #
 # Moschip MCS7730/MCS7840 USB to fast ethernet. Supports the Sitecom LN030.
 device		mos
 #
 # HSxPA devices from Option N.V
 device		uhso
 
 # Realtek RTL8188SU/RTL8191SU/RTL8192SU wireless driver
 device		rsu
 #
 # Ralink Technology RT2501USB/RT2601USB wireless driver
 device		rum
 # Ralink Technology RT2700U/RT2800U/RT3000U wireless driver
 device		run
 #
 # Atheros AR5523 wireless driver
 device		uath
 #
 # Conexant/Intersil PrismGT wireless driver
 device		upgt
 #
 # Ralink Technology RT2500USB wireless driver
 device		ural
 #
 # RNDIS USB ethernet driver
 device		urndis
 # Realtek RTL8187B/L wireless driver
 device		urtw
 #
 # Realtek RTL8188CU/RTL8192CU wireless driver
 device		urtwn
 #
 # ZyDas ZD1211/ZD1211B wireless driver
 device		zyd
 #
 # Sierra USB wireless driver
 device		usie
 
 # 
 # debugging options for the USB subsystem
 #
 options 	USB_DEBUG
 options 	U3G_DEBUG
 
 # options for ukbd:
 options 	UKBD_DFLT_KEYMAP	# specify the built-in keymap
-makeoptions	UKBD_DFLT_KEYMAP=it.iso
+makeoptions	UKBD_DFLT_KEYMAP=jp.pc98
 
 # options for uplcom:
 options 	UPLCOM_INTR_INTERVAL=100	# interrupt pipe interval
 						# in milliseconds
 
 # options for uvscom:
 options 	UVSCOM_DEFAULT_OPKTSIZE=8	# default output packet size
 options 	UVSCOM_INTR_INTERVAL=100	# interrupt pipe interval
 						# in milliseconds
 
 #####################################################################
 # FireWire support
 
 device		firewire	# FireWire bus code
 device		sbp		# SCSI over Firewire (Requires scbus and da)
 device		sbp_targ	# SBP-2 Target mode  (Requires scbus and targ)
 device		fwe		# Ethernet over FireWire (non-standard!)
 device		fwip		# IP over FireWire (RFC2734 and RFC3146)
 
 #####################################################################
 # dcons support (Dumb Console Device)
 
 device		dcons			# dumb console driver
 device		dcons_crom		# FireWire attachment
 options 	DCONS_BUF_SIZE=16384	# buffer size
 options 	DCONS_POLL_HZ=100	# polling rate
 options 	DCONS_FORCE_CONSOLE=0	# force to be the primary console
 options 	DCONS_FORCE_GDB=1	# force to be the gdb device
 
 #####################################################################
 # crypto subsystem
 #
 # This is a port of the OpenBSD crypto framework.  Include this when
 # configuring IPSEC and when you have a h/w crypto device to accelerate
 # user applications that link to OpenSSL.
 #
 # Drivers are ports from OpenBSD with some simple enhancements that have
 # been fed back to OpenBSD.
 
 device		crypto		# core crypto support
 device		cryptodev	# /dev/crypto for access to h/w
 
 device		rndtest		# FIPS 140-2 entropy tester
 
 device		hifn		# Hifn 7951, 7781, etc.
 options 	HIFN_DEBUG	# enable debugging support: hw.hifn.debug
 options 	HIFN_RNDTEST	# enable rndtest support
 
 device		ubsec		# Broadcom 5501, 5601, 58xx
 options 	UBSEC_DEBUG	# enable debugging support: hw.ubsec.debug
 options 	UBSEC_RNDTEST	# enable rndtest support
 
 #####################################################################
 
 
 #
 # Embedded system options:
 #
 # An embedded system might want to run something other than init.
 options 	INIT_PATH=/sbin/init:/rescue/init
 
 # Debug options
 options 	BUS_DEBUG	# enable newbus debugging
 options 	DEBUG_VFS_LOCKS	# enable VFS lock debugging
 options 	SOCKBUF_DEBUG	# enable sockbuf last record/mb tail checking
 
 #
 # Verbose SYSINIT
 #
 # Make the SYSINIT process performed by mi_startup() verbose.  This is very
 # useful when porting to a new architecture.  If DDB is also enabled, this
 # will print function names instead of addresses.
 options 	VERBOSE_SYSINIT
 
 #####################################################################
 # SYSV IPC KERNEL PARAMETERS
 #
 # Maximum number of System V semaphores that can be used on the system at
 # one time.
 options 	SEMMNI=11
 
 # Total number of semaphores system wide
 options 	SEMMNS=61
 
 # Total number of undo structures in system
 options 	SEMMNU=31
 
 # Maximum number of System V semaphores that can be used by a single process
 # at one time.
 options 	SEMMSL=61
 
 # Maximum number of operations that can be outstanding on a single System V
 # semaphore at one time.
 options 	SEMOPM=101
 
 # Maximum number of undo operations that can be outstanding on a single
 # System V semaphore at one time.
 options 	SEMUME=11
 
 # Maximum number of shared memory pages system wide.
 options 	SHMALL=1025
 
 # Maximum size, in bytes, of a single System V shared memory region.
 options 	SHMMAX=(SHMMAXPGS*PAGE_SIZE+1)
 options 	SHMMAXPGS=1025
 
 # Minimum size, in bytes, of a single System V shared memory region.
 options 	SHMMIN=2
 
 # Maximum number of shared memory regions that can be used on the system
 # at one time.
 options 	SHMMNI=33
 
 # Maximum number of System V shared memory regions that can be attached to
 # a single process at one time.
 options 	SHMSEG=9
 
 # Compress user core dumps.
 options		COMPRESS_USER_CORES
 # required to compress file output from kernel for COMPRESS_USER_CORES.
 device		gzio	    
 
 # Set the amount of time (in seconds) the system will wait before
 # rebooting automatically when a kernel panic occurs.  If set to (-1),
 # the system will wait indefinitely until a key is pressed on the
 # console.
 options 	PANIC_REBOOT_WAIT_TIME=16
 
 # Attempt to bypass the buffer cache and put data directly into the
 # userland buffer for read operation when O_DIRECT flag is set on the
 # file.  Both offset and length of the read operation must be
 # multiples of the physical media sector size.
 #
 options 	DIRECTIO
 
 # Specify a lower limit for the number of swap I/O buffers.  They are
 # (among other things) used when bypassing the buffer cache due to
 # DIRECTIO kernel option enabled and O_DIRECT flag set on file.
 #
 options 	NSWBUF_MIN=120
 
 #####################################################################
 
 # More undocumented options for linting.
 # Note that documenting these is not considered an affront.
 
 options 	CAM_DEBUG_DELAY
 
 # VFS cluster debugging.
 options 	CLUSTERDEBUG
 
 options 	DEBUG
 
 # Kernel filelock debugging.
 options 	LOCKF_DEBUG
 
 # System V compatible message queues
 # Please note that the values provided here are used to test kernel
 # building.  The defaults in the sources provide almost the same numbers.
 # MSGSSZ must be a power of 2 between 8 and 1024.
 options 	MSGMNB=2049	# Max number of chars in queue
 options 	MSGMNI=41	# Max number of message queue identifiers
 options 	MSGSEG=2049	# Max number of message segments
 options 	MSGSSZ=16	# Size of a message segment
 options 	MSGTQL=41	# Max number of messages in system
 
 options 	NBUF=512	# Number of buffer headers
 
 options 	SCSI_NCR_DEBUG
 options 	SCSI_NCR_MAX_SYNC=10000
 options 	SCSI_NCR_MAX_WIDE=1
 options 	SCSI_NCR_MYADDR=7
 
 options 	SC_DEBUG_LEVEL=5	# Syscons debug level
 options 	SC_RENDER_DEBUG	# syscons rendering debugging
 
 options 	VFS_BIO_DEBUG	# VFS buffer I/O debugging
 
 options 	KSTACK_MAX_PAGES=32 # Maximum pages to give the kernel stack
 options 	KSTACK_USAGE_PROF
 
 # Adaptec Array Controller driver options
 options 	AAC_DEBUG	# Debugging levels:
 				# 0 - quiet, only emit warnings
 				# 1 - noisy, emit major function
 				#     points and things done
 				# 2 - extremely noisy, emit trace
 				#     items in loops, etc.
 
 # Resource Accounting
 options 	RACCT
 
 # Resource Limits
 options 	RCTL
 
 # Yet more undocumented options for linting.
 # BKTR_ALLOC_PAGES has no effect except to cause warnings, and
 # BROOKTREE_ALLOC_PAGES hasn't actually been superseded by it, since the
 # driver still mostly spells this option BROOKTREE_ALLOC_PAGES.
 ##options 	BKTR_ALLOC_PAGES=(217*4+1)
 options 	BROOKTREE_ALLOC_PAGES=(217*4+1)
 options 	MAXFILES=999
 
 # Random number generator
 # Only ONE of the below two may be used; they are mutually exclusive.
 options 	RANDOM_YARROW	# Yarrow CSPRNG (Default)
 #options 	RANDOM_FORTUNA	# Fortuna CSPRNG
 options 	RANDOM_DEBUG	# Debugging messages
 
 # Module to enable execution of application via emulators like QEMU
 options         IMAGACT_BINMISC
Index: projects/arm_intrng/sys/conf/files
===================================================================
--- projects/arm_intrng/sys/conf/files	(revision 276247)
+++ projects/arm_intrng/sys/conf/files	(revision 276248)
@@ -1,4008 +1,4004 @@
 # $FreeBSD$
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
 # dependency lines other than the first are silently ignored.
 #
 acpi_quirks.h			optional acpi				   \
 	dependency	"$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \
 	compile-with	"${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"acpi_quirks.h"
 #
 # The 'fdt_dtb_file' target covers an actual DTB file name, which is derived
 # from the specified source (DTS) file: .dts -> .dtb
 #
 fdt_dtb_file			optional fdt fdt_dtb_static \
 	compile-with "sh -c 'MACHINE=${MACHINE} $S/tools/fdt/make_dtb.sh $S ${FDT_DTS_FILE} ${.CURDIR}'" \
 	no-obj no-implicit-rule before-depend	\
 	clean		"${FDT_DTS_FILE:R}.dtb"
 fdt_static_dtb.h		optional fdt fdt_dtb_static \
 	compile-with "sh -c 'MACHINE=${MACHINE} $S/tools/fdt/make_dtbh.sh ${FDT_DTS_FILE} ${.CURDIR}'" \
 	dependency	"fdt_dtb_file" \
 	no-obj no-implicit-rule before-depend \
 	clean		"fdt_static_dtb.h"
 feeder_eq_gen.h			optional sound				   \
 	dependency	"$S/tools/sound/feeder_eq_mkfilter.awk"		   \
 	compile-with	"${AWK} -f $S/tools/sound/feeder_eq_mkfilter.awk -- ${FEEDER_EQ_PRESETS} > feeder_eq_gen.h" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"feeder_eq_gen.h"
 feeder_rate_gen.h		optional sound				   \
 	dependency	"$S/tools/sound/feeder_rate_mkfilter.awk"	   \
 	compile-with	"${AWK} -f $S/tools/sound/feeder_rate_mkfilter.awk -- ${FEEDER_RATE_PRESETS} > feeder_rate_gen.h" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"feeder_rate_gen.h"
 snd_fxdiv_gen.h			optional sound				   \
 	dependency	"$S/tools/sound/snd_fxdiv_gen.awk"		   \
 	compile-with	"${AWK} -f $S/tools/sound/snd_fxdiv_gen.awk -- > snd_fxdiv_gen.h" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"snd_fxdiv_gen.h"
 miidevs.h			optional miibus | mii			   \
 	dependency	"$S/tools/miidevs2h.awk $S/dev/mii/miidevs"	   \
 	compile-with	"${AWK} -f $S/tools/miidevs2h.awk $S/dev/mii/miidevs" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"miidevs.h"
 pccarddevs.h			standard				   \
 	dependency	"$S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \
 	compile-with	"${AWK} -f $S/tools/pccarddevs2h.awk $S/dev/pccard/pccarddevs" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"pccarddevs.h"
 teken_state.h		optional sc | vt				   \
 	dependency	"$S/teken/gensequences $S/teken/sequences" \
 	compile-with	"${AWK} -f $S/teken/gensequences $S/teken/sequences > teken_state.h" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"teken_state.h"
 usbdevs.h			optional usb				   \
 	dependency	"$S/tools/usbdevs2h.awk $S/dev/usb/usbdevs" \
 	compile-with	"${AWK} -f $S/tools/usbdevs2h.awk $S/dev/usb/usbdevs -h" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"usbdevs.h"
 usbdevs_data.h			optional usb				   \
 	dependency	"$S/tools/usbdevs2h.awk $S/dev/usb/usbdevs" \
 	compile-with	"${AWK} -f $S/tools/usbdevs2h.awk $S/dev/usb/usbdevs -d" \
 	no-obj no-implicit-rule before-depend				   \
 	clean		"usbdevs_data.h"
 cam/cam.c			optional scbus
 cam/cam_compat.c		optional scbus
 cam/cam_periph.c		optional scbus
 cam/cam_queue.c			optional scbus
 cam/cam_sim.c			optional scbus
 cam/cam_xpt.c			optional scbus
 cam/ata/ata_all.c		optional scbus
 cam/ata/ata_xpt.c		optional scbus
 cam/ata/ata_pmp.c		optional scbus
 cam/scsi/scsi_xpt.c		optional scbus
 cam/scsi/scsi_all.c		optional scbus
 cam/scsi/scsi_cd.c		optional cd
 cam/scsi/scsi_ch.c		optional ch
 cam/ata/ata_da.c		optional ada | da
 cam/ctl/ctl.c			optional ctl
 cam/ctl/ctl_backend.c		optional ctl
 cam/ctl/ctl_backend_block.c	optional ctl
 cam/ctl/ctl_backend_ramdisk.c	optional ctl
 cam/ctl/ctl_cmd_table.c		optional ctl
 cam/ctl/ctl_frontend.c		optional ctl
 cam/ctl/ctl_frontend_cam_sim.c	optional ctl
 cam/ctl/ctl_frontend_internal.c	optional ctl
 cam/ctl/ctl_frontend_iscsi.c	optional ctl
 cam/ctl/ctl_scsi_all.c		optional ctl
 cam/ctl/ctl_tpc.c		optional ctl
 cam/ctl/ctl_tpc_local.c		optional ctl
 cam/ctl/ctl_error.c		optional ctl
 cam/ctl/ctl_util.c		optional ctl
 cam/ctl/scsi_ctl.c		optional ctl
 cam/scsi/scsi_da.c		optional da
 cam/scsi/scsi_low.c		optional ct | ncv | nsp | stg
 cam/scsi/scsi_pass.c		optional pass
 cam/scsi/scsi_pt.c		optional pt
 cam/scsi/scsi_sa.c		optional sa
 cam/scsi/scsi_enc.c		optional ses
 cam/scsi/scsi_enc_ses.c		optional ses
 cam/scsi/scsi_enc_safte.c	optional ses
 cam/scsi/scsi_sg.c		optional sg
 cam/scsi/scsi_targ_bh.c		optional targbh
 cam/scsi/scsi_target.c		optional targ
 cam/scsi/smp_all.c		optional scbus
 # shared between zfs and dtrace
 cddl/compat/opensolaris/kern/opensolaris.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_cmn_err.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_kmem.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_misc.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_sunddi.c			optional zfs compile-with "${ZFS_C}"
 # zfs specific
 cddl/compat/opensolaris/kern/opensolaris_acl.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_dtrace.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_kobj.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_kstat.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_lookup.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_policy.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_string.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_sysevent.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_taskq.c			optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_uio.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_vfs.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_vm.c				optional zfs compile-with "${ZFS_C}"
 cddl/compat/opensolaris/kern/opensolaris_zone.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/acl/acl_common.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/avl/avl.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/nvpair/fnvpair.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/nvpair/nvpair.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/nvpair/nvpair_alloc_fixed.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/unicode/u8_textprep.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zfeature_common.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zfs_comutil.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zfs_deleg.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zfs_fletcher.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zfs_prop.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zpool_prop.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/common/zfs/zprop_common.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/gfs.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/vnode.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/blkptr.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/ddt.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/ddt_zap.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_diff.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c			optional zfs compile-with "${ZFS_C}" \
 	warning "kernel contains CDDL licensed ZFS filesystem"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/space_reftree.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/trim_map.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/uberblock.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/unique.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_onexit.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_sa.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zio_compress.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zle.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zrlock.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/os/callb.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/os/fm.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/os/list.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/os/nvpair_alloc_system.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/adler32.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/deflate.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/inffast.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/inflate.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/inftrees.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c		optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/trees.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/zmod.c				optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/zmod_subr.c			optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/zmod/zutil.c			optional zfs compile-with "${ZFS_C}"
 compat/freebsd32/freebsd32_capability.c	optional compat_freebsd32
 compat/freebsd32/freebsd32_ioctl.c	optional compat_freebsd32
 compat/freebsd32/freebsd32_misc.c	optional compat_freebsd32
 compat/freebsd32/freebsd32_syscalls.c	optional compat_freebsd32
 compat/freebsd32/freebsd32_sysent.c	optional compat_freebsd32
 contrib/altq/altq/altq_cbq.c		optional altq
 contrib/altq/altq/altq_cdnr.c		optional altq
 contrib/altq/altq/altq_hfsc.c		optional altq
 contrib/altq/altq/altq_priq.c		optional altq
 contrib/altq/altq/altq_red.c		optional altq
 contrib/altq/altq/altq_rio.c		optional altq
 contrib/altq/altq/altq_rmclass.c	optional altq
 contrib/altq/altq/altq_subr.c		optional altq
 contrib/dev/acpica/common/ahids.c			optional acpi acpi_debug
 contrib/dev/acpica/common/ahuuids.c			optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbcmds.c		optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbconvert.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbdisply.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbexec.c		optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbfileio.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbhistry.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbinput.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbmethod.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbnames.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbstats.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbtest.c		optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbutils.c	optional acpi acpi_debug
 contrib/dev/acpica/components/debugger/dbxface.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmbuffer.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmdeferred.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmnames.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmopcode.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmobject.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmresrc.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmresrcl.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmresrcl2.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmresrcs.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmutils.c	optional acpi acpi_debug
 contrib/dev/acpica/components/disassembler/dmwalk.c	optional acpi acpi_debug
 contrib/dev/acpica/components/dispatcher/dsargs.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dscontrol.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dsfield.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dsinit.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dsmethod.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dsmthdat.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dsobject.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dsopcode.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dsutils.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dswexec.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dswload.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dswload2.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dswscope.c	optional acpi
 contrib/dev/acpica/components/dispatcher/dswstate.c	optional acpi
 contrib/dev/acpica/components/events/evevent.c		optional acpi
 contrib/dev/acpica/components/events/evglock.c		optional acpi
 contrib/dev/acpica/components/events/evgpe.c		optional acpi
 contrib/dev/acpica/components/events/evgpeblk.c		optional acpi
 contrib/dev/acpica/components/events/evgpeinit.c	optional acpi
 contrib/dev/acpica/components/events/evgpeutil.c	optional acpi
 contrib/dev/acpica/components/events/evhandler.c	optional acpi
 contrib/dev/acpica/components/events/evmisc.c		optional acpi
 contrib/dev/acpica/components/events/evregion.c		optional acpi
 contrib/dev/acpica/components/events/evrgnini.c		optional acpi
 contrib/dev/acpica/components/events/evsci.c		optional acpi
 contrib/dev/acpica/components/events/evxface.c		optional acpi
 contrib/dev/acpica/components/events/evxfevnt.c		optional acpi
 contrib/dev/acpica/components/events/evxfgpe.c		optional acpi
 contrib/dev/acpica/components/events/evxfregn.c		optional acpi
 contrib/dev/acpica/components/executer/exconfig.c	optional acpi
 contrib/dev/acpica/components/executer/exconvrt.c	optional acpi
 contrib/dev/acpica/components/executer/excreate.c	optional acpi
 contrib/dev/acpica/components/executer/exdebug.c	optional acpi
 contrib/dev/acpica/components/executer/exdump.c		optional acpi
 contrib/dev/acpica/components/executer/exfield.c	optional acpi
 contrib/dev/acpica/components/executer/exfldio.c	optional acpi
 contrib/dev/acpica/components/executer/exmisc.c		optional acpi
 contrib/dev/acpica/components/executer/exmutex.c	optional acpi
 contrib/dev/acpica/components/executer/exnames.c	optional acpi
 contrib/dev/acpica/components/executer/exoparg1.c	optional acpi
 contrib/dev/acpica/components/executer/exoparg2.c	optional acpi
 contrib/dev/acpica/components/executer/exoparg3.c	optional acpi
 contrib/dev/acpica/components/executer/exoparg6.c	optional acpi
 contrib/dev/acpica/components/executer/exprep.c		optional acpi
 contrib/dev/acpica/components/executer/exregion.c	optional acpi
 contrib/dev/acpica/components/executer/exresnte.c	optional acpi
 contrib/dev/acpica/components/executer/exresolv.c	optional acpi
 contrib/dev/acpica/components/executer/exresop.c	optional acpi
 contrib/dev/acpica/components/executer/exstore.c	optional acpi
 contrib/dev/acpica/components/executer/exstoren.c	optional acpi
 contrib/dev/acpica/components/executer/exstorob.c	optional acpi
 contrib/dev/acpica/components/executer/exsystem.c	optional acpi
 contrib/dev/acpica/components/executer/exutils.c	optional acpi
 contrib/dev/acpica/components/hardware/hwacpi.c		optional acpi
 contrib/dev/acpica/components/hardware/hwesleep.c	optional acpi
 contrib/dev/acpica/components/hardware/hwgpe.c		optional acpi
 contrib/dev/acpica/components/hardware/hwpci.c		optional acpi
 contrib/dev/acpica/components/hardware/hwregs.c		optional acpi
 contrib/dev/acpica/components/hardware/hwsleep.c	optional acpi
 contrib/dev/acpica/components/hardware/hwtimer.c	optional acpi
 contrib/dev/acpica/components/hardware/hwvalid.c	optional acpi
 contrib/dev/acpica/components/hardware/hwxface.c	optional acpi
 contrib/dev/acpica/components/hardware/hwxfsleep.c	optional acpi
 contrib/dev/acpica/components/namespace/nsaccess.c	optional acpi
 contrib/dev/acpica/components/namespace/nsalloc.c	optional acpi
 contrib/dev/acpica/components/namespace/nsarguments.c	optional acpi
 contrib/dev/acpica/components/namespace/nsconvert.c	optional acpi
 contrib/dev/acpica/components/namespace/nsdump.c	optional acpi
 contrib/dev/acpica/components/namespace/nseval.c	optional acpi
 contrib/dev/acpica/components/namespace/nsinit.c	optional acpi
 contrib/dev/acpica/components/namespace/nsload.c	optional acpi
 contrib/dev/acpica/components/namespace/nsnames.c	optional acpi
 contrib/dev/acpica/components/namespace/nsobject.c	optional acpi
 contrib/dev/acpica/components/namespace/nsparse.c	optional acpi
 contrib/dev/acpica/components/namespace/nspredef.c	optional acpi
 contrib/dev/acpica/components/namespace/nsprepkg.c	optional acpi
 contrib/dev/acpica/components/namespace/nsrepair.c	optional acpi
 contrib/dev/acpica/components/namespace/nsrepair2.c	optional acpi
 contrib/dev/acpica/components/namespace/nssearch.c	optional acpi
 contrib/dev/acpica/components/namespace/nsutils.c	optional acpi
 contrib/dev/acpica/components/namespace/nswalk.c	optional acpi
 contrib/dev/acpica/components/namespace/nsxfeval.c	optional acpi
 contrib/dev/acpica/components/namespace/nsxfname.c	optional acpi
 contrib/dev/acpica/components/namespace/nsxfobj.c	optional acpi
 contrib/dev/acpica/components/parser/psargs.c		optional acpi
 contrib/dev/acpica/components/parser/psloop.c		optional acpi
 contrib/dev/acpica/components/parser/psobject.c		optional acpi
 contrib/dev/acpica/components/parser/psopcode.c		optional acpi
 contrib/dev/acpica/components/parser/psopinfo.c		optional acpi
 contrib/dev/acpica/components/parser/psparse.c		optional acpi
 contrib/dev/acpica/components/parser/psscope.c		optional acpi
 contrib/dev/acpica/components/parser/pstree.c		optional acpi
 contrib/dev/acpica/components/parser/psutils.c		optional acpi
 contrib/dev/acpica/components/parser/pswalk.c		optional acpi
 contrib/dev/acpica/components/parser/psxface.c		optional acpi
 contrib/dev/acpica/components/resources/rsaddr.c	optional acpi
 contrib/dev/acpica/components/resources/rscalc.c	optional acpi
 contrib/dev/acpica/components/resources/rscreate.c	optional acpi
 contrib/dev/acpica/components/resources/rsdump.c	optional acpi
 contrib/dev/acpica/components/resources/rsdumpinfo.c	optional acpi
 contrib/dev/acpica/components/resources/rsinfo.c	optional acpi
 contrib/dev/acpica/components/resources/rsio.c		optional acpi
 contrib/dev/acpica/components/resources/rsirq.c		optional acpi
 contrib/dev/acpica/components/resources/rslist.c	optional acpi
 contrib/dev/acpica/components/resources/rsmemory.c	optional acpi
 contrib/dev/acpica/components/resources/rsmisc.c	optional acpi
 contrib/dev/acpica/components/resources/rsserial.c	optional acpi
 contrib/dev/acpica/components/resources/rsutils.c	optional acpi
 contrib/dev/acpica/components/resources/rsxface.c	optional acpi
 contrib/dev/acpica/components/tables/tbdata.c		optional acpi
 contrib/dev/acpica/components/tables/tbfadt.c		optional acpi
 contrib/dev/acpica/components/tables/tbfind.c		optional acpi
 contrib/dev/acpica/components/tables/tbinstal.c		optional acpi
 contrib/dev/acpica/components/tables/tbprint.c		optional acpi
 contrib/dev/acpica/components/tables/tbutils.c		optional acpi
 contrib/dev/acpica/components/tables/tbxface.c		optional acpi
 contrib/dev/acpica/components/tables/tbxfload.c		optional acpi
 contrib/dev/acpica/components/tables/tbxfroot.c		optional acpi
 contrib/dev/acpica/components/utilities/utaddress.c	optional acpi
 contrib/dev/acpica/components/utilities/utalloc.c	optional acpi
 contrib/dev/acpica/components/utilities/utbuffer.c	optional acpi
 contrib/dev/acpica/components/utilities/utcache.c	optional acpi
 contrib/dev/acpica/components/utilities/utcopy.c	optional acpi
 contrib/dev/acpica/components/utilities/utdebug.c	optional acpi
 contrib/dev/acpica/components/utilities/utdecode.c	optional acpi
 contrib/dev/acpica/components/utilities/utdelete.c	optional acpi
 contrib/dev/acpica/components/utilities/uterror.c	optional acpi
 contrib/dev/acpica/components/utilities/uteval.c	optional acpi
 contrib/dev/acpica/components/utilities/utexcep.c	optional acpi
 contrib/dev/acpica/components/utilities/utglobal.c	optional acpi
 contrib/dev/acpica/components/utilities/uthex.c		optional acpi
 contrib/dev/acpica/components/utilities/utids.c		optional acpi
 contrib/dev/acpica/components/utilities/utinit.c	optional acpi
 contrib/dev/acpica/components/utilities/utlock.c	optional acpi
 contrib/dev/acpica/components/utilities/utmath.c	optional acpi
 contrib/dev/acpica/components/utilities/utmisc.c	optional acpi
 contrib/dev/acpica/components/utilities/utmutex.c	optional acpi
 contrib/dev/acpica/components/utilities/utobject.c	optional acpi
 contrib/dev/acpica/components/utilities/utosi.c		optional acpi
 contrib/dev/acpica/components/utilities/utownerid.c	optional acpi
 contrib/dev/acpica/components/utilities/utpredef.c	optional acpi
 contrib/dev/acpica/components/utilities/utresrc.c	optional acpi
 contrib/dev/acpica/components/utilities/utstate.c	optional acpi
 contrib/dev/acpica/components/utilities/utstring.c	optional acpi
 contrib/dev/acpica/components/utilities/utuuid.c	optional acpi acpi_debug
 contrib/dev/acpica/components/utilities/utxface.c	optional acpi
 contrib/dev/acpica/components/utilities/utxferror.c	optional acpi
 contrib/dev/acpica/components/utilities/utxfinit.c	optional acpi
 #contrib/dev/acpica/components/utilities/utxfmutex.c	optional acpi
 contrib/ipfilter/netinet/fil.c	optional ipfilter inet \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_auth.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_fil_freebsd.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_frag.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_log.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_nat.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_proxy.c optional ipfilter inet \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_state.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_lookup.c optional ipfilter inet \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN} -Wno-unused -Wno-error -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_pool.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_htable.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_sync.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/mlfk_ipl.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_nat6.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_rules.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_scan.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/ip_dstlist.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -Wno-unused -I$S/contrib/ipfilter"
 contrib/ipfilter/netinet/radix_ipf.c optional ipfilter inet \
 	compile-with "${NORMAL_C} -I$S/contrib/ipfilter"
 contrib/libfdt/fdt.c		optional fdt
 contrib/libfdt/fdt_ro.c		optional fdt
 contrib/libfdt/fdt_rw.c		optional fdt
 contrib/libfdt/fdt_strerror.c	optional fdt
 contrib/libfdt/fdt_sw.c		optional fdt
 contrib/libfdt/fdt_wip.c	optional fdt
 contrib/ngatm/netnatm/api/cc_conn.c optional ngatm_ccatm \
 	compile-with "${NORMAL_C_NOWERROR} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/api/cc_data.c optional ngatm_ccatm \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/api/cc_dump.c optional ngatm_ccatm \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/api/cc_port.c optional ngatm_ccatm \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/api/cc_sig.c optional ngatm_ccatm \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/api/cc_user.c optional ngatm_ccatm \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/api/unisap.c optional ngatm_ccatm \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/misc/straddr.c optional ngatm_atmbase \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/misc/unimsg_common.c optional ngatm_atmbase \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/msg/traffic.c optional ngatm_atmbase \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/msg/uni_ie.c optional ngatm_atmbase \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/msg/uni_msg.c optional ngatm_atmbase \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/saal/saal_sscfu.c	optional ngatm_sscfu \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/saal/saal_sscop.c	optional ngatm_sscop \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/sig/sig_call.c optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/sig/sig_coord.c optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/sig/sig_party.c optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/sig/sig_print.c optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/sig/sig_reset.c optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/sig/sig_uni.c optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/sig/sig_unimsgcpy.c optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 contrib/ngatm/netnatm/sig/sig_verify.c optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 crypto/blowfish/bf_ecb.c	optional ipsec
 crypto/blowfish/bf_skey.c	optional crypto | ipsec
 crypto/camellia/camellia.c	optional crypto | ipsec
 crypto/camellia/camellia-api.c	optional crypto | ipsec
 crypto/des/des_ecb.c		optional crypto | ipsec | netsmb
 crypto/des/des_setkey.c		optional crypto | ipsec | netsmb
 crypto/rc4/rc4.c		optional netgraph_mppc_encryption | kgssapi
 crypto/rijndael/rijndael-alg-fst.c optional crypto | geom_bde | \
 					 ipsec | random | wlan_ccmp
 crypto/rijndael/rijndael-api-fst.c optional geom_bde | random
 crypto/rijndael/rijndael-api.c	optional crypto | ipsec | wlan_ccmp
 crypto/sha1.c			optional carp | crypto | ipsec | \
 					 netgraph_mppc_encryption | sctp
 crypto/sha2/sha2.c		optional crypto | geom_bde | ipsec | random | \
 					 sctp | zfs
 crypto/sha2/sha256c.c		optional crypto | geom_bde | ipsec | random | \
 					 sctp | zfs
 crypto/siphash/siphash.c	optional inet | inet6
 crypto/siphash/siphash_test.c	optional inet | inet6
 ddb/db_access.c			optional ddb
 ddb/db_break.c			optional ddb
 ddb/db_capture.c		optional ddb
 ddb/db_command.c		optional ddb
 ddb/db_examine.c		optional ddb
 ddb/db_expr.c			optional ddb
 ddb/db_input.c			optional ddb
 ddb/db_lex.c			optional ddb
 ddb/db_main.c			optional ddb
 ddb/db_output.c			optional ddb
 ddb/db_print.c			optional ddb
 ddb/db_ps.c			optional ddb
 ddb/db_run.c			optional ddb
 ddb/db_script.c			optional ddb
 ddb/db_sym.c			optional ddb
 ddb/db_thread.c			optional ddb
 ddb/db_textdump.c		optional ddb
 ddb/db_variables.c		optional ddb
 ddb/db_watch.c			optional ddb
 ddb/db_write_cmd.c		optional ddb
 dev/aac/aac.c			optional aac
 dev/aac/aac_cam.c		optional aacp aac
 dev/aac/aac_debug.c		optional aac
 dev/aac/aac_disk.c		optional aac
 dev/aac/aac_linux.c		optional aac compat_linux
 dev/aac/aac_pci.c		optional aac pci
 dev/aacraid/aacraid.c		optional aacraid
 dev/aacraid/aacraid_cam.c	optional aacraid scbus
 dev/aacraid/aacraid_debug.c	optional aacraid
 dev/aacraid/aacraid_linux.c	optional aacraid compat_linux
 dev/aacraid/aacraid_pci.c	optional aacraid pci
 dev/acpi_support/acpi_wmi.c	optional acpi_wmi acpi
 dev/acpi_support/acpi_asus.c	optional acpi_asus acpi
 dev/acpi_support/acpi_asus_wmi.c	optional acpi_asus_wmi acpi
 dev/acpi_support/acpi_fujitsu.c	optional acpi_fujitsu acpi
 dev/acpi_support/acpi_hp.c	optional acpi_hp acpi
 dev/acpi_support/acpi_ibm.c	optional acpi_ibm acpi
 dev/acpi_support/acpi_panasonic.c optional acpi_panasonic acpi
 dev/acpi_support/acpi_sony.c	optional acpi_sony acpi
 dev/acpi_support/acpi_toshiba.c	optional acpi_toshiba acpi
 dev/acpi_support/atk0110.c	optional aibs acpi
 dev/acpica/Osd/OsdDebug.c	optional acpi
 dev/acpica/Osd/OsdHardware.c	optional acpi
 dev/acpica/Osd/OsdInterrupt.c	optional acpi
 dev/acpica/Osd/OsdMemory.c	optional acpi
 dev/acpica/Osd/OsdSchedule.c	optional acpi
 dev/acpica/Osd/OsdStream.c	optional acpi
 dev/acpica/Osd/OsdSynch.c	optional acpi
 dev/acpica/Osd/OsdTable.c	optional acpi
 dev/acpica/acpi.c		optional acpi
 dev/acpica/acpi_acad.c		optional acpi
 dev/acpica/acpi_battery.c	optional acpi
 dev/acpica/acpi_button.c	optional acpi
 dev/acpica/acpi_cmbat.c		optional acpi
 dev/acpica/acpi_cpu.c		optional acpi
 dev/acpica/acpi_ec.c		optional acpi
 dev/acpica/acpi_hpet.c		optional acpi
 dev/acpica/acpi_isab.c		optional acpi isa
 dev/acpica/acpi_lid.c		optional acpi
 dev/acpica/acpi_package.c	optional acpi
 dev/acpica/acpi_pci.c		optional acpi pci
 dev/acpica/acpi_pci_link.c	optional acpi pci
 dev/acpica/acpi_pcib.c		optional acpi pci
 dev/acpica/acpi_pcib_acpi.c	optional acpi pci
 dev/acpica/acpi_pcib_pci.c	optional acpi pci
 dev/acpica/acpi_perf.c		optional acpi
 dev/acpica/acpi_powerres.c	optional acpi
 dev/acpica/acpi_quirk.c		optional acpi
 dev/acpica/acpi_resource.c	optional acpi
 dev/acpica/acpi_smbat.c		optional acpi
 dev/acpica/acpi_thermal.c	optional acpi
 dev/acpica/acpi_throttle.c	optional acpi
 dev/acpica/acpi_timer.c		optional acpi
 dev/acpica/acpi_video.c		optional acpi_video acpi
 dev/acpica/acpi_dock.c		optional acpi_dock acpi
 dev/adlink/adlink.c		optional adlink
 dev/advansys/adv_eisa.c		optional adv eisa
 dev/advansys/adv_pci.c		optional adv pci
 dev/advansys/advansys.c		optional adv
 dev/advansys/advlib.c		optional adv
 dev/advansys/advmcode.c		optional adv
 dev/advansys/adw_pci.c		optional adw pci
 dev/advansys/adwcam.c		optional adw
 dev/advansys/adwlib.c		optional adw
 dev/advansys/adwmcode.c		optional adw
 dev/ae/if_ae.c			optional ae pci
 dev/age/if_age.c		optional age pci
 dev/agp/agp.c			optional agp pci
 dev/agp/agp_if.m		optional agp pci
 dev/aha/aha.c			optional aha
 dev/aha/aha_isa.c		optional aha isa
 dev/aha/aha_mca.c		optional aha mca
 dev/ahb/ahb.c			optional ahb eisa
 dev/ahci/ahci.c			optional ahci
 dev/ahci/ahciem.c		optional ahci
 dev/ahci/ahci_pci.c		optional ahci pci
 dev/aic/aic.c			optional aic
 dev/aic/aic_pccard.c		optional aic pccard
 dev/aic7xxx/ahc_eisa.c		optional ahc eisa
 dev/aic7xxx/ahc_isa.c		optional ahc isa
 dev/aic7xxx/ahc_pci.c		optional ahc pci \
 	compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}"
 dev/aic7xxx/ahd_pci.c		optional ahd pci \
 	compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}"
 dev/aic7xxx/aic7770.c		optional ahc
 dev/aic7xxx/aic79xx.c		optional ahd pci
 dev/aic7xxx/aic79xx_osm.c	optional ahd pci
 dev/aic7xxx/aic79xx_pci.c	optional ahd pci
 dev/aic7xxx/aic79xx_reg_print.c	optional ahd pci ahd_reg_pretty_print
 dev/aic7xxx/aic7xxx.c		optional ahc
 dev/aic7xxx/aic7xxx_93cx6.c	optional ahc
 dev/aic7xxx/aic7xxx_osm.c	optional ahc
 dev/aic7xxx/aic7xxx_pci.c	optional ahc pci
 dev/aic7xxx/aic7xxx_reg_print.c	optional ahc ahc_reg_pretty_print
 dev/alc/if_alc.c		optional alc pci
 dev/ale/if_ale.c		optional ale pci
 dev/alpm/alpm.c			optional alpm pci
 dev/altera/avgen/altera_avgen.c		optional altera_avgen
 dev/altera/avgen/altera_avgen_fdt.c	optional altera_avgen fdt
 dev/altera/avgen/altera_avgen_nexus.c	optional altera_avgen
 dev/altera/sdcard/altera_sdcard.c	optional altera_sdcard
 dev/altera/sdcard/altera_sdcard_disk.c	optional altera_sdcard
 dev/altera/sdcard/altera_sdcard_io.c	optional altera_sdcard
 dev/altera/sdcard/altera_sdcard_fdt.c	optional altera_sdcard fdt
 dev/altera/sdcard/altera_sdcard_nexus.c	optional altera_sdcard
 dev/altera/pio/pio.c		optional altera_pio
 dev/altera/pio/pio_if.m		optional altera_pio
 dev/amdpm/amdpm.c		optional amdpm pci | nfpm pci
 dev/amdsmb/amdsmb.c		optional amdsmb pci
 dev/amr/amr.c			optional amr
 dev/amr/amr_cam.c		optional amrp amr
 dev/amr/amr_disk.c		optional amr
 dev/amr/amr_linux.c		optional amr compat_linux
 dev/amr/amr_pci.c		optional amr pci
 dev/an/if_an.c			optional an
 dev/an/if_an_isa.c		optional an isa
 dev/an/if_an_pccard.c		optional an pccard
 dev/an/if_an_pci.c		optional an pci
 dev/asr/asr.c			optional asr pci \
 	compile-with "${NORMAL_C} ${NO_WARRAY_BOUNDS}"
 #
 dev/ata/ata_if.m		optional ata | atacore
 dev/ata/ata-all.c		optional ata | atacore
 dev/ata/ata-dma.c		optional ata | atacore
 dev/ata/ata-lowlevel.c		optional ata | atacore
 dev/ata/ata-sata.c		optional ata | atacore
 dev/ata/ata-card.c		optional ata pccard | atapccard
 dev/ata/ata-cbus.c		optional ata pc98 | atapc98
 dev/ata/ata-isa.c		optional ata isa | ataisa
 dev/ata/ata-pci.c		optional ata pci | atapci
 dev/ata/chipsets/ata-ahci.c	optional ata pci | ataahci | ataacerlabs | \
 					 ataati | ataintel | atajmicron | \
 					 atavia | atanvidia
 dev/ata/chipsets/ata-acard.c	optional ata pci | ataacard
 dev/ata/chipsets/ata-acerlabs.c	optional ata pci | ataacerlabs
 dev/ata/chipsets/ata-adaptec.c	optional ata pci | ataadaptec
 dev/ata/chipsets/ata-amd.c	optional ata pci | ataamd
 dev/ata/chipsets/ata-ati.c	optional ata pci | ataati
 dev/ata/chipsets/ata-cenatek.c	optional ata pci | atacenatek
 dev/ata/chipsets/ata-cypress.c	optional ata pci | atacypress
 dev/ata/chipsets/ata-cyrix.c	optional ata pci | atacyrix
 dev/ata/chipsets/ata-highpoint.c	optional ata pci | atahighpoint
 dev/ata/chipsets/ata-intel.c	optional ata pci | ataintel
 dev/ata/chipsets/ata-ite.c	optional ata pci | ataite
 dev/ata/chipsets/ata-jmicron.c	optional ata pci | atajmicron
 dev/ata/chipsets/ata-marvell.c	optional ata pci | atamarvell | ataadaptec
 dev/ata/chipsets/ata-micron.c	optional ata pci | atamicron
 dev/ata/chipsets/ata-national.c	optional ata pci | atanational
 dev/ata/chipsets/ata-netcell.c	optional ata pci | atanetcell
 dev/ata/chipsets/ata-nvidia.c	optional ata pci | atanvidia
 dev/ata/chipsets/ata-promise.c	optional ata pci | atapromise
 dev/ata/chipsets/ata-serverworks.c	optional ata pci | ataserverworks
 dev/ata/chipsets/ata-siliconimage.c	optional ata pci | atasiliconimage | ataati
 dev/ata/chipsets/ata-sis.c	optional ata pci | atasis
 dev/ata/chipsets/ata-via.c	optional ata pci | atavia
 #
 dev/ath/if_ath_pci.c		optional ath_pci pci \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 #
 dev/ath/if_ath_ahb.c		optional ath_ahb \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 #
 dev/ath/if_ath.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_alq.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_beacon.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_btcoex.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_debug.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_keycache.c	optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_led.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_lna_div.c	optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_tx.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_tx_edma.c	optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_tx_ht.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_tdma.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_sysctl.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_rx.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_rx_edma.c	optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/if_ath_spectral.c	optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ah_osdep.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 #
 dev/ath/ath_hal/ah.c		optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_hal/ah_eeprom_v1.c	optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_hal/ah_eeprom_v3.c	optional ath_hal | ath_ar5211 | ath_ar5212 \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_hal/ah_eeprom_v14.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_hal/ah_eeprom_v4k.c \
 	optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_hal/ah_eeprom_9287.c \
 	optional ath_hal | ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_hal/ah_regdomain.c	optional ath \
 	compile-with "${NORMAL_C} ${NO_WSHIFT_COUNT_NEGATIVE} ${NO_WSHIFT_COUNT_OVERFLOW} -I$S/dev/ath"
 # ar5210
 dev/ath/ath_hal/ar5210/ar5210_attach.c		optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_beacon.c		optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_interrupts.c	optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_keycache.c	optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_misc.c		optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_phy.c		optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_power.c		optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_recv.c		optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_reset.c		optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5210/ar5210_xmit.c		optional ath_hal | ath_ar5210 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar5211
 dev/ath/ath_hal/ar5211/ar5211_attach.c		optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_beacon.c		optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_interrupts.c	optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_keycache.c	optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_misc.c		optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_phy.c		optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_power.c		optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_recv.c		optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_reset.c		optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5211/ar5211_xmit.c		optional ath_hal | ath_ar5211 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar5212
 dev/ath/ath_hal/ar5212/ar5212_ani.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_attach.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_beacon.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_eeprom.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_gpio.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_interrupts.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_keycache.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_misc.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_phy.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_power.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_recv.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_reset.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_rfgain.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5212_xmit.c \
 	optional ath_hal | ath_ar5212 | ath_ar5416 | ath_ar9160 | ath_ar9280 | \
 	ath_ar9285 ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar5416 (depends on ar5212)
 dev/ath/ath_hal/ar5416/ar5416_ani.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_attach.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_beacon.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_btcoex.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_cal.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_cal_iq.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_cal_adcgain.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_cal_adcdc.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_eeprom.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_gpio.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_interrupts.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_keycache.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_misc.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_phy.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_power.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_radar.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_recv.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_reset.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_spectral.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar5416_xmit.c \
 	optional ath_hal | ath_ar5416 | ath_ar9160 | ath_ar9280 | ath_ar9285 | \
 	ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar9130 (depends upon ar5416) - also requires AH_SUPPORT_AR9130
 #
 # Since this is an embedded MAC SoC, there's no need to compile it into the
 # default HAL.
 dev/ath/ath_hal/ar9001/ar9130_attach.c optional ath_ar9130 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9001/ar9130_phy.c optional ath_ar9130 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9001/ar9130_eeprom.c optional ath_ar9130 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar9160 (depends on ar5416)
 dev/ath/ath_hal/ar9001/ar9160_attach.c optional ath_hal | ath_ar9160 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar9280 (depends on ar5416)
 dev/ath/ath_hal/ar9002/ar9280_attach.c optional ath_hal | ath_ar9280 | \
 	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9280_olc.c optional ath_hal | ath_ar9280 | \
 	ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar9285 (depends on ar5416 and ar9280)
 dev/ath/ath_hal/ar9002/ar9285_attach.c optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9285_btcoex.c optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9285_reset.c optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9285_cal.c optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9285_phy.c optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9285_diversity.c optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 # ar9287 (depends on ar5416)
 dev/ath/ath_hal/ar9002/ar9287_attach.c optional ath_hal | ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9287_reset.c optional ath_hal | ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9287_cal.c optional ath_hal | ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9287_olc.c optional ath_hal | ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 
 # ar9300
 contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_beacon.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal ${NO_WCONSTANT_CONVERSION}"
 contrib/dev/ath/ath_hal/ar9300/ar9300_freebsd.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_gpio.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_interrupts.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_keycache.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_mci.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_paprd.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_phy.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_power.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_radar.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_radio.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_recv.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_recv_ds.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_reset.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal ${NO_WSOMETIMES_UNINITIALIZED} -Wno-unused-function"
 contrib/dev/ath/ath_hal/ar9300/ar9300_stub.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_stub_funcs.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_timer.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_xmit.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 contrib/dev/ath/ath_hal/ar9300/ar9300_xmit_ds.c optional ath_hal | ath_ar9300 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal -I$S/contrib/dev/ath/ath_hal"
 
 # rf backends
 dev/ath/ath_hal/ar5212/ar2316.c	optional ath_rf2316 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar2317.c	optional ath_rf2317 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar2413.c	optional ath_hal | ath_rf2413 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar2425.c	optional ath_hal | ath_rf2425 | ath_rf2417 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5111.c	optional ath_hal | ath_rf5111 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5112.c	optional ath_hal | ath_rf5112 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5212/ar5413.c	optional ath_hal | ath_rf5413 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar5416/ar2133.c optional ath_hal | ath_ar5416 | \
 	ath_ar9130 | ath_ar9160 | ath_ar9280 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9280.c optional ath_hal | ath_ar9280 | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9285.c optional ath_hal | ath_ar9285 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 dev/ath/ath_hal/ar9002/ar9287.c optional ath_hal | ath_ar9287 \
 	compile-with "${NORMAL_C} -I$S/dev/ath -I$S/dev/ath/ath_hal"
 
 # ath rate control algorithms
 dev/ath/ath_rate/amrr/amrr.c	optional ath_rate_amrr \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_rate/onoe/onoe.c	optional ath_rate_onoe \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 dev/ath/ath_rate/sample/sample.c	optional ath_rate_sample \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 # ath DFS modules
 dev/ath/ath_dfs/null/dfs_null.c	optional ath \
 	compile-with "${NORMAL_C} -I$S/dev/ath"
 #
 dev/bce/if_bce.c		optional bce
 dev/bfe/if_bfe.c		optional bfe
 dev/bge/if_bge.c		optional bge
 dev/bktr/bktr_audio.c		optional bktr pci
 dev/bktr/bktr_card.c		optional bktr pci
 dev/bktr/bktr_core.c		optional bktr pci
 dev/bktr/bktr_i2c.c		optional bktr pci smbus
 dev/bktr/bktr_os.c		optional bktr pci
 dev/bktr/bktr_tuner.c		optional bktr pci
 dev/bktr/msp34xx.c		optional bktr pci
 dev/buslogic/bt.c		optional bt
 dev/buslogic/bt_eisa.c		optional bt eisa
 dev/buslogic/bt_isa.c		optional bt isa
 dev/buslogic/bt_mca.c		optional bt mca
 dev/buslogic/bt_pci.c		optional bt pci
 dev/bwi/bwimac.c		optional bwi
 dev/bwi/bwiphy.c		optional bwi
 dev/bwi/bwirf.c			optional bwi
 dev/bwi/if_bwi.c		optional bwi
 dev/bwi/if_bwi_pci.c		optional bwi pci
 # XXX Work around clang warning, until maintainer approves fix.
 dev/bwn/if_bwn.c		optional bwn siba_bwn \
 	compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
 dev/cardbus/cardbus.c		optional cardbus
 dev/cardbus/cardbus_cis.c	optional cardbus
 dev/cardbus/cardbus_device.c	optional cardbus
 dev/cas/if_cas.c		optional cas
 dev/cfi/cfi_bus_fdt.c		optional cfi fdt
 dev/cfi/cfi_bus_nexus.c		optional cfi
 dev/cfi/cfi_core.c		optional cfi
 dev/cfi/cfi_dev.c		optional cfi
 dev/cfi/cfi_disk.c		optional cfid
 dev/ciss/ciss.c			optional ciss
 dev/cm/smc90cx6.c		optional cm
 dev/cmx/cmx.c			optional cmx
 dev/cmx/cmx_pccard.c		optional cmx pccard
 dev/cpufreq/ichss.c		optional cpufreq
 dev/cs/if_cs.c			optional cs
 dev/cs/if_cs_isa.c		optional cs isa
 dev/cs/if_cs_pccard.c		optional cs pccard
 dev/cxgb/cxgb_main.c		optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/cxgb_sge.c		optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_mc5.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_vsc7323.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_vsc8211.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_ael1002.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_aq100x.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_mv88e1xxx.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_xgmac.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_t3_hw.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/common/cxgb_tn1010.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/sys/uipc_mvec.c	optional cxgb pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgb/cxgb_t3fw.c		optional cxgb cxgb_t3fw \
 	compile-with "${NORMAL_C} -I$S/dev/cxgb"
 dev/cxgbe/t4_main.c		optional cxgbe pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_netmap.c		optional cxgbe pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_sge.c		optional cxgbe pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_l2t.c		optional cxgbe pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/t4_tracer.c		optional cxgbe pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 dev/cxgbe/common/t4_hw.c	optional cxgbe pci \
 	compile-with "${NORMAL_C} -I$S/dev/cxgbe"
 t4fw_cfg.c		optional cxgbe					\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk t4fw_cfg.fw:t4fw_cfg t4fw_cfg_uwire.fw:t4fw_cfg_uwire t4fw.fw:t4fw -mt4fw_cfg -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"t4fw_cfg.c"
 t4fw_cfg.fwo		optional cxgbe					\
 	dependency	"t4fw_cfg.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"t4fw_cfg.fwo"
 t4fw_cfg.fw		optional cxgbe					\
 	dependency	"$S/dev/cxgbe/firmware/t4fw_cfg.txt"		\
 	compile-with	"${CP} ${.ALLSRC} ${.TARGET}"			\
 	no-obj no-implicit-rule						\
 	clean		"t4fw_cfg.fw"
 t4fw_cfg_uwire.fwo	optional cxgbe					\
 	dependency	"t4fw_cfg_uwire.fw"				\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"t4fw_cfg_uwire.fwo"
 t4fw_cfg_uwire.fw	optional cxgbe					\
 	dependency	"$S/dev/cxgbe/firmware/t4fw_cfg_uwire.txt"	\
 	compile-with	"${CP} ${.ALLSRC} ${.TARGET}"			\
 	no-obj no-implicit-rule						\
 	clean		"t4fw_cfg_uwire.fw"
 t4fw.fwo		optional cxgbe					\
 	dependency	"t4fw.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"t4fw.fwo"
 t4fw.fw			optional cxgbe					\
 	dependency	"$S/dev/cxgbe/firmware/t4fw-1.11.27.0.bin.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"t4fw.fw"
 t5fw_cfg.c		optional cxgbe					\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk t5fw_cfg.fw:t5fw_cfg t5fw.fw:t5fw -mt5fw_cfg -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"t5fw_cfg.c"
 t5fw_cfg.fwo		optional cxgbe					\
 	dependency	"t5fw_cfg.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"t5fw_cfg.fwo"
 t5fw_cfg.fw		optional cxgbe					\
 	dependency	"$S/dev/cxgbe/firmware/t5fw_cfg.txt"		\
 	compile-with	"${CP} ${.ALLSRC} ${.TARGET}"			\
 	no-obj no-implicit-rule						\
 	clean		"t5fw_cfg.fw"
 t5fw.fwo		optional cxgbe					\
 	dependency	"t5fw.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"t5fw.fwo"
 t5fw.fw			optional cxgbe					\
 	dependency	"$S/dev/cxgbe/firmware/t5fw-1.11.27.0.bin.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"t5fw.fw"
 dev/cy/cy.c			optional cy
 dev/cy/cy_isa.c			optional cy isa
 dev/cy/cy_pci.c			optional cy pci
 dev/dc/if_dc.c			optional dc pci
 dev/dc/dcphy.c			optional dc pci
 dev/dc/pnphy.c			optional dc pci
 dev/dcons/dcons.c		optional dcons
 dev/dcons/dcons_crom.c		optional dcons_crom
 dev/dcons/dcons_os.c		optional dcons
 dev/de/if_de.c			optional de pci
 dev/digi/CX.c			optional digi_CX
 dev/digi/CX_PCI.c		optional digi_CX_PCI
 dev/digi/EPCX.c			optional digi_EPCX
 dev/digi/EPCX_PCI.c		optional digi_EPCX_PCI
 dev/digi/Xe.c			optional digi_Xe
 dev/digi/Xem.c			optional digi_Xem
 dev/digi/Xr.c			optional digi_Xr
 dev/digi/digi.c			optional digi
 dev/digi/digi_isa.c		optional digi isa
 dev/digi/digi_pci.c		optional digi pci
 dev/dpt/dpt_eisa.c		optional dpt eisa
 dev/dpt/dpt_pci.c		optional dpt pci
 dev/dpt/dpt_scsi.c		optional dpt
 dev/drm/ati_pcigart.c		optional drm
 dev/drm/drm_agpsupport.c	optional drm
 dev/drm/drm_auth.c		optional drm
 dev/drm/drm_bufs.c		optional drm
 dev/drm/drm_context.c		optional drm
 dev/drm/drm_dma.c		optional drm
 dev/drm/drm_drawable.c		optional drm
 dev/drm/drm_drv.c		optional drm
 dev/drm/drm_fops.c		optional drm
 dev/drm/drm_hashtab.c		optional drm
 dev/drm/drm_ioctl.c		optional drm
 dev/drm/drm_irq.c		optional drm
 dev/drm/drm_lock.c		optional drm
 dev/drm/drm_memory.c		optional drm
 dev/drm/drm_mm.c		optional drm
 dev/drm/drm_pci.c		optional drm
 dev/drm/drm_scatter.c		optional drm
 dev/drm/drm_sman.c		optional drm
 dev/drm/drm_sysctl.c		optional drm
 dev/drm/drm_vm.c		optional drm
 dev/drm/i915_dma.c		optional i915drm
 dev/drm/i915_drv.c		optional i915drm
 dev/drm/i915_irq.c		optional i915drm
 dev/drm/i915_mem.c		optional i915drm
 dev/drm/i915_suspend.c		optional i915drm
 dev/drm/mach64_dma.c		optional mach64drm
 dev/drm/mach64_drv.c		optional mach64drm
 dev/drm/mach64_irq.c		optional mach64drm
 dev/drm/mach64_state.c		optional mach64drm
 dev/drm/mga_dma.c		optional mgadrm
 dev/drm/mga_drv.c		optional mgadrm
 dev/drm/mga_irq.c		optional mgadrm
 dev/drm/mga_state.c		optional mgadrm
 dev/drm/mga_warp.c		optional mgadrm
 dev/drm/r128_cce.c		optional r128drm \
 	compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}"
 dev/drm/r128_drv.c		optional r128drm
 dev/drm/r128_irq.c		optional r128drm
 dev/drm/r128_state.c		optional r128drm \
 	compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE}"
 dev/drm/r300_cmdbuf.c		optional radeondrm
 dev/drm/r600_blit.c		optional radeondrm
 dev/drm/r600_cp.c		optional radeondrm \
 	compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}"
 dev/drm/radeon_cp.c		optional radeondrm \
 	compile-with "${NORMAL_C} ${NO_WUNUSED_VALUE} ${NO_WCONSTANT_CONVERSION}"
 dev/drm/radeon_cs.c		optional radeondrm
 dev/drm/radeon_drv.c		optional radeondrm
 dev/drm/radeon_irq.c		optional radeondrm
 dev/drm/radeon_mem.c		optional radeondrm
 dev/drm/radeon_state.c		optional radeondrm
 dev/drm/savage_bci.c		optional savagedrm
 dev/drm/savage_drv.c		optional savagedrm
 dev/drm/savage_state.c		optional savagedrm
 dev/drm/sis_drv.c		optional sisdrm
 dev/drm/sis_ds.c		optional sisdrm
 dev/drm/sis_mm.c		optional sisdrm
 dev/drm/tdfx_drv.c		optional tdfxdrm
 dev/drm/via_dma.c		optional viadrm
 dev/drm/via_dmablit.c		optional viadrm
 dev/drm/via_drv.c		optional viadrm
 dev/drm/via_irq.c		optional viadrm
 dev/drm/via_map.c		optional viadrm
 dev/drm/via_mm.c		optional viadrm
 dev/drm/via_verifier.c		optional viadrm
 dev/drm/via_video.c		optional viadrm
 dev/ed/if_ed.c			optional ed
 dev/ed/if_ed_novell.c		optional ed
 dev/ed/if_ed_rtl80x9.c		optional ed
 dev/ed/if_ed_pccard.c		optional ed pccard
 dev/ed/if_ed_pci.c		optional ed pci
 dev/eisa/eisa_if.m		standard
 dev/eisa/eisaconf.c		optional eisa
 dev/e1000/if_em.c		optional em \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/if_lem.c		optional em \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/if_igb.c		optional igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_80003es2lan.c	optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_82540.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_82541.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_82542.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_82543.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_82571.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_82575.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_ich8lan.c	optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_i210.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_api.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_mac.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_manage.c	optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_nvm.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_phy.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_vf.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_mbx.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/e1000/e1000_osdep.c		optional em | igb \
 	compile-with "${NORMAL_C} -I$S/dev/e1000"
 dev/et/if_et.c			optional et
 dev/en/if_en_pci.c		optional en pci
 dev/en/midway.c			optional en
 dev/ep/if_ep.c			optional ep
 dev/ep/if_ep_eisa.c		optional ep eisa
 dev/ep/if_ep_isa.c		optional ep isa
 dev/ep/if_ep_mca.c		optional ep mca
 dev/ep/if_ep_pccard.c		optional ep pccard
 dev/esp/esp_pci.c		optional esp pci
 dev/esp/ncr53c9x.c		optional esp
 dev/etherswitch/arswitch/arswitch.c		optional arswitch
 dev/etherswitch/arswitch/arswitch_reg.c		optional arswitch
 dev/etherswitch/arswitch/arswitch_phy.c		optional arswitch
 dev/etherswitch/arswitch/arswitch_8216.c	optional arswitch
 dev/etherswitch/arswitch/arswitch_8226.c	optional arswitch
 dev/etherswitch/arswitch/arswitch_8316.c	optional arswitch
 dev/etherswitch/arswitch/arswitch_8327.c	optional arswitch
 dev/etherswitch/arswitch/arswitch_7240.c	optional arswitch
 dev/etherswitch/arswitch/arswitch_9340.c	optional arswitch
 dev/etherswitch/arswitch/arswitch_vlans.c	optional arswitch
 dev/etherswitch/etherswitch.c		optional etherswitch
 dev/etherswitch/etherswitch_if.m	optional etherswitch
 dev/etherswitch/ip17x/ip17x.c		optional ip17x
 dev/etherswitch/ip17x/ip175c.c		optional ip17x
 dev/etherswitch/ip17x/ip175d.c		optional ip17x
 dev/etherswitch/ip17x/ip17x_phy.c	optional ip17x
 dev/etherswitch/ip17x/ip17x_vlans.c	optional ip17x
 dev/etherswitch/mdio_if.m		optional miiproxy
 dev/etherswitch/mdio.c			optional miiproxy
 dev/etherswitch/miiproxy.c		optional miiproxy
 dev/etherswitch/rtl8366/rtl8366rb.c	optional rtl8366rb
 dev/etherswitch/ukswitch/ukswitch.c	optional ukswitch
 dev/ex/if_ex.c			optional ex
 dev/ex/if_ex_isa.c		optional ex isa
 dev/ex/if_ex_pccard.c		optional ex pccard
 dev/exca/exca.c			optional cbb
 dev/fatm/if_fatm.c		optional fatm pci
 dev/fb/fbd.c			optional fbd | vt
 dev/fb/fb_if.m			standard
 dev/fb/splash.c			optional sc splash
 dev/fdt/fdt_clock.c		optional fdt fdt_clock
 dev/fdt/fdt_clock_if.m		optional fdt fdt_clock
 dev/fdt/fdt_common.c		optional fdt
 dev/fdt/fdt_pinctrl.c		optional fdt fdt_pinctrl
 dev/fdt/fdt_pinctrl_if.m	optional fdt fdt_pinctrl
 dev/fdt/fdt_slicer.c		optional fdt cfi | fdt nand
 dev/fdt/fdt_static_dtb.S	optional fdt fdt_dtb_static \
 	dependency	"$S/boot/fdt/dts/${MACHINE}/${FDT_DTS_FILE}"
 dev/fdt/simplebus.c		optional fdt
 dev/fe/if_fe.c			optional fe
 dev/fe/if_fe_pccard.c		optional fe pccard
 dev/filemon/filemon.c		optional filemon
 dev/firewire/firewire.c		optional firewire
 dev/firewire/fwcrom.c		optional firewire
 dev/firewire/fwdev.c		optional firewire
 dev/firewire/fwdma.c		optional firewire
 dev/firewire/fwmem.c		optional firewire
 dev/firewire/fwohci.c		optional firewire
 dev/firewire/fwohci_pci.c	optional firewire pci
 dev/firewire/if_fwe.c		optional fwe
 dev/firewire/if_fwip.c		optional fwip
 dev/firewire/sbp.c		optional sbp
 dev/firewire/sbp_targ.c		optional sbp_targ
 dev/flash/at45d.c		optional at45d
 dev/flash/mx25l.c		optional mx25l
 dev/fxp/if_fxp.c		optional fxp
 dev/fxp/inphy.c			optional fxp
 dev/gem/if_gem.c		optional gem
 dev/gem/if_gem_pci.c		optional gem pci
 dev/gem/if_gem_sbus.c		optional gem sbus
 dev/gpio/gpiobus.c		optional gpio				\
 	dependency	"gpiobus_if.h"
 dev/gpio/gpioc.c		optional gpio				\
 	dependency	"gpio_if.h"
 dev/gpio/gpioiic.c		optional gpioiic
 dev/gpio/gpioled.c		optional gpioled
 dev/gpio/gpio_if.m		optional gpio
 dev/gpio/gpiobus_if.m		optional gpio
 dev/gpio/ofw_gpiobus.c		optional fdt gpio
 dev/hatm/if_hatm.c		optional hatm pci
 dev/hatm/if_hatm_intr.c		optional hatm pci
 dev/hatm/if_hatm_ioctl.c	optional hatm pci
 dev/hatm/if_hatm_rx.c		optional hatm pci
 dev/hatm/if_hatm_tx.c		optional hatm pci
 dev/hifn/hifn7751.c		optional hifn
 dev/hme/if_hme.c		optional hme
 dev/hme/if_hme_pci.c		optional hme pci
 dev/hme/if_hme_sbus.c		optional hme sbus
 dev/hptiop/hptiop.c		optional hptiop scbus
 dev/hwpmc/hwpmc_logging.c	optional hwpmc
 dev/hwpmc/hwpmc_mod.c		optional hwpmc
 dev/hwpmc/hwpmc_soft.c		optional hwpmc
 dev/ichsmb/ichsmb.c		optional ichsmb
 dev/ichsmb/ichsmb_pci.c		optional ichsmb pci
 dev/ida/ida.c			optional ida
 dev/ida/ida_disk.c		optional ida
 dev/ida/ida_eisa.c		optional ida eisa
 dev/ida/ida_pci.c		optional ida pci
 dev/ie/if_ie.c			optional ie isa nowerror
 dev/ie/if_ie_isa.c		optional ie isa
-dev/ieee488/ibfoo.c		optional pcii | tnt4882
-dev/ieee488/pcii.c		optional pcii
-dev/ieee488/tnt4882.c		optional tnt4882
-dev/ieee488/upd7210.c		optional pcii | tnt4882
 dev/iicbus/ad7418.c		optional ad7418
 dev/iicbus/ds133x.c		optional ds133x
 dev/iicbus/ds1374.c		optional ds1374
 dev/iicbus/ds1672.c		optional ds1672
 dev/iicbus/icee.c		optional icee
 dev/iicbus/if_ic.c		optional ic
 dev/iicbus/iic.c		optional iic
 dev/iicbus/iicbb.c		optional iicbb
 dev/iicbus/iicbb_if.m		optional iicbb
 dev/iicbus/iicbus.c		optional iicbus
 dev/iicbus/iicbus_if.m		optional iicbus
 dev/iicbus/iiconf.c		optional iicbus
 dev/iicbus/iicsmb.c		optional iicsmb				\
 	dependency	"iicbus_if.h"
 dev/iicbus/iicoc.c		optional iicoc
 dev/iicbus/lm75.c		optional lm75
 dev/iicbus/pcf8563.c		optional pcf8563
 dev/iicbus/s35390a.c		optional s35390a
 dev/iir/iir.c			optional iir
 dev/iir/iir_ctrl.c		optional iir
 dev/iir/iir_pci.c		optional iir pci
 dev/intpm/intpm.c		optional intpm pci
 # XXX Work around clang warning, until maintainer approves fix.
 dev/ips/ips.c			optional ips \
 	compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
 dev/ips/ips_commands.c		optional ips
 dev/ips/ips_disk.c		optional ips
 dev/ips/ips_ioctl.c		optional ips
 dev/ips/ips_pci.c		optional ips pci
 dev/ipw/if_ipw.c		optional ipw
 ipwbssfw.c			optional ipwbssfw | ipwfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk ipw_bss.fw:ipw_bss:130 -lintel_ipw -mipw_bss -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"ipwbssfw.c"
 ipw_bss.fwo			optional ipwbssfw | ipwfw		\
 	dependency	"ipw_bss.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"ipw_bss.fwo"
 ipw_bss.fw			optional ipwbssfw | ipwfw		\
 	dependency	"$S/contrib/dev/ipw/ipw2100-1.3.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"ipw_bss.fw"
 ipwibssfw.c			optional ipwibssfw | ipwfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk ipw_ibss.fw:ipw_ibss:130 -lintel_ipw -mipw_ibss -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"ipwibssfw.c"
 ipw_ibss.fwo			optional ipwibssfw | ipwfw		\
 	dependency	"ipw_ibss.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"ipw_ibss.fwo"
 ipw_ibss.fw			optional ipwibssfw | ipwfw		\
 	dependency	"$S/contrib/dev/ipw/ipw2100-1.3-i.fw.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"ipw_ibss.fw"
 ipwmonitorfw.c			optional ipwmonitorfw | ipwfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk ipw_monitor.fw:ipw_monitor:130 -lintel_ipw -mipw_monitor -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"ipwmonitorfw.c"
 ipw_monitor.fwo			optional ipwmonitorfw | ipwfw		\
 	dependency	"ipw_monitor.fw"				\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"ipw_monitor.fwo"
 ipw_monitor.fw			optional ipwmonitorfw | ipwfw		\
 	dependency	"$S/contrib/dev/ipw/ipw2100-1.3-p.fw.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"ipw_monitor.fw"
 dev/iscsi/icl.c			optional iscsi | ctl 
 dev/iscsi/icl_proxy.c		optional iscsi | ctl
 dev/iscsi/iscsi.c		optional iscsi scbus
 dev/iscsi_initiator/iscsi.c	optional iscsi_initiator scbus
 dev/iscsi_initiator/iscsi_subr.c	optional iscsi_initiator scbus
 dev/iscsi_initiator/isc_cam.c	optional iscsi_initiator scbus
 dev/iscsi_initiator/isc_soc.c	optional iscsi_initiator scbus
 dev/iscsi_initiator/isc_sm.c	optional iscsi_initiator scbus
 dev/iscsi_initiator/isc_subr.c	optional iscsi_initiator scbus
 dev/ismt/ismt.c			optional ismt
 dev/isp/isp.c			optional isp
 dev/isp/isp_freebsd.c		optional isp
 dev/isp/isp_library.c		optional isp
 dev/isp/isp_pci.c		optional isp pci
 dev/isp/isp_sbus.c		optional isp sbus
 dev/isp/isp_target.c		optional isp
 dev/ispfw/ispfw.c		optional ispfw
 dev/iwi/if_iwi.c		optional iwi
 iwibssfw.c			optional iwibssfw | iwifw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwi_bss.fw:iwi_bss:300 -lintel_iwi -miwi_bss -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwibssfw.c"
 iwi_bss.fwo			optional iwibssfw | iwifw		\
 	dependency	"iwi_bss.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwi_bss.fwo"
 iwi_bss.fw			optional iwibssfw | iwifw		\
 	dependency	"$S/contrib/dev/iwi/ipw2200-bss.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwi_bss.fw"
 iwiibssfw.c			optional iwiibssfw | iwifw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwi_ibss.fw:iwi_ibss:300 -lintel_iwi -miwi_ibss -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwiibssfw.c"
 iwi_ibss.fwo			optional iwiibssfw | iwifw		\
 	dependency	"iwi_ibss.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwi_ibss.fwo"
 iwi_ibss.fw			optional iwiibssfw | iwifw		\
 	dependency	"$S/contrib/dev/iwi/ipw2200-ibss.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwi_ibss.fw"
 iwimonitorfw.c			optional iwimonitorfw | iwifw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwi_monitor.fw:iwi_monitor:300 -lintel_iwi -miwi_monitor -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwimonitorfw.c"
 iwi_monitor.fwo			optional iwimonitorfw | iwifw		\
 	dependency	"iwi_monitor.fw"				\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwi_monitor.fwo"
 iwi_monitor.fw			optional iwimonitorfw | iwifw		\
 	dependency	"$S/contrib/dev/iwi/ipw2200-sniffer.fw.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwi_monitor.fw"
 dev/iwn/if_iwn.c		optional iwn
 iwn1000fw.c			optional iwn1000fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn1000.fw:iwn1000fw -miwn1000fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn1000fw.c"
 iwn1000fw.fwo			optional iwn1000fw | iwnfw		\
 	dependency	"iwn1000.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn1000fw.fwo"
 iwn1000.fw			optional iwn1000fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-1000-39.31.5.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn1000.fw"
 iwn100fw.c			optional iwn100fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn100.fw:iwn100fw -miwn100fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn100fw.c"
 iwn100fw.fwo			optional iwn100fw | iwnfw		\
 	dependency	"iwn100.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn100fw.fwo"
 iwn100.fw			optional iwn100fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-100-39.31.5.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn100.fw"
 iwn105fw.c			optional iwn105fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn105.fw:iwn105fw -miwn105fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn105fw.c"
 iwn105fw.fwo			optional iwn105fw | iwnfw		\
 	dependency	"iwn105.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn105fw.fwo"
 iwn105.fw			optional iwn105fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-105-6-18.168.6.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn105.fw"
 iwn135fw.c			optional iwn135fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn135.fw:iwn135fw -miwn135fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn135fw.c"
 iwn135fw.fwo			optional iwn135fw | iwnfw		\
 	dependency	"iwn135.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn135fw.fwo"
 iwn135.fw			optional iwn135fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-135-6-18.168.6.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn135.fw"
 iwn2000fw.c			optional iwn2000fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn2000.fw:iwn2000fw -miwn2000fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn2000fw.c"
 iwn2000fw.fwo			optional iwn2000fw | iwnfw		\
 	dependency	"iwn2000.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn2000fw.fwo"
 iwn2000.fw			optional iwn2000fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-2000-18.168.6.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn2000.fw"
 iwn2030fw.c			optional iwn2030fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn2030.fw:iwn2030fw -miwn2030fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn2030fw.c"
 iwn2030fw.fwo			optional iwn2030fw | iwnfw		\
 	dependency	"iwn2030.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn2030fw.fwo"
 iwn2030.fw			optional iwn2030fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwnwifi-2030-18.168.6.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn2030.fw"
 iwn4965fw.c			optional iwn4965fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn4965.fw:iwn4965fw -miwn4965fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn4965fw.c"
 iwn4965fw.fwo			optional iwn4965fw | iwnfw		\
 	dependency	"iwn4965.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn4965fw.fwo"
 iwn4965.fw			optional iwn4965fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-4965-228.61.2.24.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn4965.fw"
 iwn5000fw.c			optional iwn5000fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn5000.fw:iwn5000fw -miwn5000fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn5000fw.c"
 iwn5000fw.fwo		optional iwn5000fw | iwnfw			\
 	dependency	"iwn5000.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn5000fw.fwo"
 iwn5000.fw			optional iwn5000fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-5000-8.83.5.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn5000.fw"
 iwn5150fw.c			optional iwn5150fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn5150.fw:iwn5150fw -miwn5150fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn5150fw.c"
 iwn5150fw.fwo			optional iwn5150fw | iwnfw		\
 	dependency	"iwn5150.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn5150fw.fwo"
 iwn5150.fw			optional iwn5150fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-5150-8.24.2.2.fw.uu"\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn5150.fw"
 iwn6000fw.c			optional iwn6000fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn6000.fw:iwn6000fw -miwn6000fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn6000fw.c"
 iwn6000fw.fwo			optional iwn6000fw | iwnfw		\
 	dependency	"iwn6000.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn6000fw.fwo"
 iwn6000.fw			optional iwn6000fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-6000-9.221.4.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn6000.fw"
 iwn6000g2afw.c			optional iwn6000g2afw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn6000g2a.fw:iwn6000g2afw -miwn6000g2afw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn6000g2afw.c"
 iwn6000g2afw.fwo		optional iwn6000g2afw | iwnfw		\
 	dependency	"iwn6000g2a.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn6000g2afw.fwo"
 iwn6000g2a.fw			optional iwn6000g2afw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-6000g2a-17.168.5.2.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn6000g2a.fw"
 iwn6000g2bfw.c			optional iwn6000g2bfw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn6000g2b.fw:iwn6000g2bfw -miwn6000g2bfw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn6000g2bfw.c"
 iwn6000g2bfw.fwo		optional iwn6000g2bfw | iwnfw		\
 	dependency	"iwn6000g2b.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn6000g2bfw.fwo"
 iwn6000g2b.fw			optional iwn6000g2bfw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-6000g2b-17.168.5.2.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn6000g2b.fw"
 iwn6050fw.c			optional iwn6050fw | iwnfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk iwn6050.fw:iwn6050fw -miwn6050fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"iwn6050fw.c"
 iwn6050fw.fwo			optional iwn6050fw | iwnfw		\
 	dependency	"iwn6050.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"iwn6050fw.fwo"
 iwn6050.fw			optional iwn6050fw | iwnfw		\
 	dependency	"$S/contrib/dev/iwn/iwlwifi-6050-41.28.5.1.fw.uu" \
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"iwn6050.fw"
 dev/ixgb/if_ixgb.c		optional ixgb
 dev/ixgb/ixgb_ee.c		optional ixgb
 dev/ixgb/ixgb_hw.c		optional ixgb
 dev/ixgbe/ixgbe.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe -DSMP"
 dev/ixgbe/ixv.c			optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_phy.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_api.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_common.c	optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_mbx.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_vf.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_82598.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_82599.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_x540.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_dcb.c		optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_dcb_82598.c	optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_dcb_82599.c	optional ixgbe inet \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/jme/if_jme.c		optional jme pci
 dev/joy/joy.c			optional joy
 dev/joy/joy_isa.c		optional joy isa
 dev/kbdmux/kbdmux.c		optional kbdmux
 dev/ksyms/ksyms.c		optional ksyms
 dev/le/am7990.c			optional le
 dev/le/am79900.c		optional le
 dev/le/if_le_pci.c		optional le pci
 dev/le/lance.c			optional le
 dev/led/led.c			standard
 dev/lge/if_lge.c		optional lge
 dev/lmc/if_lmc.c		optional lmc
 dev/malo/if_malo.c		optional malo
 dev/malo/if_malohal.c		optional malo
 dev/malo/if_malo_pci.c		optional malo pci
 dev/mc146818/mc146818.c		optional mc146818
 dev/mca/mca_bus.c		optional mca
 dev/mcd/mcd.c			optional mcd isa nowerror
 dev/mcd/mcd_isa.c		optional mcd isa nowerror
 dev/md/md.c			optional md
 dev/mem/memdev.c		optional mem
 dev/mem/memutil.c		optional mem
 dev/mfi/mfi.c			optional mfi
 dev/mfi/mfi_debug.c		optional mfi
 dev/mfi/mfi_pci.c		optional mfi pci
 dev/mfi/mfi_disk.c		optional mfi
 dev/mfi/mfi_syspd.c		optional mfi
 dev/mfi/mfi_tbolt.c		optional mfi
 dev/mfi/mfi_linux.c		optional mfi compat_linux
 dev/mfi/mfi_cam.c		optional mfip scbus
 dev/mii/acphy.c			optional miibus | acphy
 dev/mii/amphy.c			optional miibus | amphy
 dev/mii/atphy.c			optional miibus | atphy
 dev/mii/axphy.c			optional miibus | axphy
 dev/mii/bmtphy.c		optional miibus | bmtphy
 dev/mii/brgphy.c		optional miibus | brgphy
 dev/mii/ciphy.c			optional miibus | ciphy
 dev/mii/e1000phy.c		optional miibus | e1000phy
 dev/mii/gentbi.c		optional miibus | gentbi
 dev/mii/icsphy.c		optional miibus | icsphy
 dev/mii/ip1000phy.c		optional miibus | ip1000phy
 dev/mii/jmphy.c			optional miibus | jmphy
 dev/mii/lxtphy.c		optional miibus | lxtphy
 dev/mii/mii.c			optional miibus | mii
 dev/mii/mii_bitbang.c		optional miibus | mii_bitbang
 dev/mii/mii_physubr.c		optional miibus | mii
 dev/mii/miibus_if.m		optional miibus | mii
 dev/mii/mlphy.c			optional miibus | mlphy
 dev/mii/nsgphy.c		optional miibus | nsgphy
 dev/mii/nsphy.c			optional miibus | nsphy
 dev/mii/nsphyter.c		optional miibus | nsphyter
 dev/mii/pnaphy.c		optional miibus | pnaphy
 dev/mii/qsphy.c			optional miibus | qsphy
 dev/mii/rdcphy.c		optional miibus | rdcphy
 dev/mii/rgephy.c		optional miibus | rgephy
 dev/mii/rlphy.c			optional miibus | rlphy
 dev/mii/rlswitch.c		optional rlswitch
 dev/mii/smcphy.c		optional miibus | smcphy
 dev/mii/smscphy.c		optional miibus | smscphy
 dev/mii/tdkphy.c		optional miibus | tdkphy
 dev/mii/tlphy.c			optional miibus | tlphy
 dev/mii/truephy.c		optional miibus | truephy
 dev/mii/ukphy.c			optional miibus | mii
 dev/mii/ukphy_subr.c		optional miibus | mii
 dev/mii/xmphy.c			optional miibus | xmphy
 dev/mk48txx/mk48txx.c		optional mk48txx
 dev/mlx/mlx.c			optional mlx
 dev/mlx/mlx_disk.c		optional mlx
 dev/mlx/mlx_pci.c		optional mlx pci
 dev/mly/mly.c			optional mly
 dev/mmc/mmc.c			optional mmc
 dev/mmc/mmcbr_if.m		standard
 dev/mmc/mmcbus_if.m		standard
 dev/mmc/mmcsd.c			optional mmcsd
 dev/mn/if_mn.c			optional mn pci
 dev/mpr/mpr.c			optional mpr
 dev/mpr/mpr_config.c		optional mpr
 # XXX Work around clang warning, until maintainer approves fix.
 dev/mpr/mpr_mapping.c		optional mpr \
 	compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
 dev/mpr/mpr_pci.c		optional mpr pci
 dev/mpr/mpr_sas.c		optional mpr \
 	compile-with "${NORMAL_C} ${NO_WUNNEEDED_INTERNAL_DECL}"
 dev/mpr/mpr_sas_lsi.c		optional mpr
 dev/mpr/mpr_table.c		optional mpr
 dev/mpr/mpr_user.c		optional mpr
 dev/mps/mps.c			optional mps
 dev/mps/mps_config.c		optional mps
 # XXX Work around clang warning, until maintainer approves fix.
 dev/mps/mps_mapping.c		optional mps \
 	compile-with "${NORMAL_C} ${NO_WSOMETIMES_UNINITIALIZED}"
 dev/mps/mps_pci.c		optional mps pci
 dev/mps/mps_sas.c		optional mps \
 	compile-with "${NORMAL_C} ${NO_WUNNEEDED_INTERNAL_DECL}"
 dev/mps/mps_sas_lsi.c		optional mps
 dev/mps/mps_table.c		optional mps
 dev/mps/mps_user.c		optional mps
 dev/mpt/mpt.c			optional mpt
 dev/mpt/mpt_cam.c		optional mpt
 dev/mpt/mpt_debug.c		optional mpt
 dev/mpt/mpt_pci.c		optional mpt pci
 dev/mpt/mpt_raid.c		optional mpt
 dev/mpt/mpt_user.c		optional mpt
 dev/mrsas/mrsas.c		optional mrsas
 dev/mrsas/mrsas_cam.c		optional mrsas
 dev/mrsas/mrsas_ioctl.c		optional mrsas
 dev/mrsas/mrsas_fp.c		optional mrsas
 dev/msk/if_msk.c		optional msk
 dev/mvs/mvs.c			optional mvs
 dev/mvs/mvs_if.m		optional mvs
 dev/mvs/mvs_pci.c		optional mvs pci
 dev/mwl/if_mwl.c		optional mwl
 dev/mwl/if_mwl_pci.c		optional mwl pci
 dev/mwl/mwlhal.c		optional mwl
 mwlfw.c				optional mwlfw				\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk mw88W8363.fw:mw88W8363fw mwlboot.fw:mwlboot -mmwl -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"mwlfw.c"
 mw88W8363.fwo		optional mwlfw					\
 	dependency	"mw88W8363.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"mw88W8363.fwo"
 mw88W8363.fw		optional mwlfw					\
 	dependency	"$S/contrib/dev/mwl/mw88W8363.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"mw88W8363.fw"
 mwlboot.fwo		optional mwlfw					\
 	dependency	"mwlboot.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"mwlboot.fwo"
 mwlboot.fw		optional mwlfw					\
 	dependency	"$S/contrib/dev/mwl/mwlboot.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"mwlboot.fw"
 dev/mxge/if_mxge.c		optional mxge pci
 dev/mxge/mxge_eth_z8e.c		optional mxge pci
 dev/mxge/mxge_ethp_z8e.c	optional mxge pci
 dev/mxge/mxge_rss_eth_z8e.c	optional mxge pci
 dev/mxge/mxge_rss_ethp_z8e.c	optional mxge pci
 dev/my/if_my.c			optional my
 dev/nand/nand.c			optional nand
 dev/nand/nand_bbt.c		optional nand
 dev/nand/nand_cdev.c		optional nand
 dev/nand/nand_generic.c		optional nand
 dev/nand/nand_geom.c		optional nand
 dev/nand/nand_id.c		optional nand
 dev/nand/nandbus.c		optional nand
 dev/nand/nandbus_if.m		optional nand
 dev/nand/nand_if.m		optional nand
 dev/nand/nandsim.c		optional nandsim nand
 dev/nand/nandsim_chip.c		optional nandsim nand
 dev/nand/nandsim_ctrl.c		optional nandsim nand
 dev/nand/nandsim_log.c		optional nandsim nand
 dev/nand/nandsim_swap.c		optional nandsim nand
 dev/nand/nfc_if.m		optional nand
 dev/ncr/ncr.c			optional ncr pci
 dev/ncv/ncr53c500.c		optional ncv
 dev/ncv/ncr53c500_pccard.c	optional ncv pccard
 dev/netmap/netmap.c		optional netmap
 dev/netmap/netmap_freebsd.c	optional netmap
 dev/netmap/netmap_generic.c	optional netmap
 dev/netmap/netmap_mbq.c		optional netmap
 dev/netmap/netmap_mem2.c	optional netmap
 dev/netmap/netmap_monitor.c	optional netmap
 dev/netmap/netmap_offloadings.c	optional netmap
 dev/netmap/netmap_pipe.c	optional netmap
 dev/netmap/netmap_vale.c	optional netmap
 # compile-with "${NORMAL_C} -Wconversion -Wextra"
 dev/nfsmb/nfsmb.c		optional nfsmb pci
 dev/nge/if_nge.c		optional nge
 dev/nxge/if_nxge.c		optional nxge \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}"
 dev/nxge/xgehal/xgehal-device.c	optional nxge \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}"
 dev/nxge/xgehal/xgehal-mm.c	optional nxge
 dev/nxge/xgehal/xge-queue.c	optional nxge
 dev/nxge/xgehal/xgehal-driver.c	optional nxge \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}"
 dev/nxge/xgehal/xgehal-ring.c	optional nxge \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}"
 dev/nxge/xgehal/xgehal-channel.c	optional nxge \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}"
 dev/nxge/xgehal/xgehal-fifo.c	optional nxge \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}"
 dev/nxge/xgehal/xgehal-stats.c	optional nxge \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}"
 dev/nxge/xgehal/xgehal-config.c	optional nxge
 dev/nxge/xgehal/xgehal-mgmt.c	optional nxge \
 	compile-with "${NORMAL_C} ${NO_WSELF_ASSIGN}"
 dev/nmdm/nmdm.c			optional nmdm
 dev/nsp/nsp.c			optional nsp
 dev/nsp/nsp_pccard.c		optional nsp pccard
 dev/null/null.c			standard
 dev/oce/oce_hw.c		optional oce pci
 dev/oce/oce_if.c		optional oce pci
 dev/oce/oce_mbox.c		optional oce pci
 dev/oce/oce_queue.c		optional oce pci
 dev/oce/oce_sysctl.c		optional oce pci
 dev/oce/oce_util.c		optional oce pci
 dev/ofw/ofw_bus_if.m		optional fdt
 dev/ofw/ofw_bus_subr.c		optional fdt
 dev/ofw/ofw_fdt.c		optional fdt
 dev/ofw/ofw_if.m		optional fdt
 dev/ofw/ofw_iicbus.c		optional fdt iicbus
 dev/ofw/ofwbus.c		optional fdt
 dev/ofw/openfirm.c		optional fdt
 dev/ofw/openfirmio.c		optional fdt
 dev/patm/if_patm.c		optional patm pci
 dev/patm/if_patm_attach.c	optional patm pci
 dev/patm/if_patm_intr.c		optional patm pci
 dev/patm/if_patm_ioctl.c	optional patm pci
 dev/patm/if_patm_rtables.c	optional patm pci
 dev/patm/if_patm_rx.c		optional patm pci
 dev/patm/if_patm_tx.c		optional patm pci
 dev/pbio/pbio.c			optional pbio isa
 dev/pccard/card_if.m		standard
 dev/pccard/pccard.c		optional pccard
 dev/pccard/pccard_cis.c		optional pccard
 dev/pccard/pccard_cis_quirks.c	optional pccard
 dev/pccard/pccard_device.c	optional pccard
 dev/pccard/power_if.m		standard
 dev/pccbb/pccbb.c		optional cbb
 dev/pccbb/pccbb_isa.c		optional cbb isa
 dev/pccbb/pccbb_pci.c		optional cbb pci
 dev/pcf/pcf.c			optional pcf
 dev/pci/eisa_pci.c		optional pci eisa
 dev/pci/fixup_pci.c		optional pci
 dev/pci/hostb_pci.c		optional pci
 dev/pci/ignore_pci.c		optional pci
 dev/pci/isa_pci.c		optional pci isa
 dev/pci/pci.c			optional pci
 dev/pci/pci_if.m		standard
 dev/pci/pci_pci.c		optional pci
 dev/pci/pci_subr.c		optional pci
 dev/pci/pci_user.c		optional pci
 dev/pci/pcib_if.m		standard
 dev/pci/pcib_support.c		standard
 dev/pci/vga_pci.c		optional pci
 dev/pcn/if_pcn.c		optional pcn pci
 dev/pdq/if_fea.c		optional fea eisa
 dev/pdq/if_fpa.c		optional fpa pci
 dev/pdq/pdq.c			optional nowerror fea eisa | fpa pci
 dev/pdq/pdq_ifsubr.c		optional nowerror fea eisa | fpa pci
 dev/ppbus/if_plip.c		optional plip
 dev/ppbus/immio.c		optional vpo
 dev/ppbus/lpbb.c		optional lpbb
 dev/ppbus/lpt.c			optional lpt
 dev/ppbus/pcfclock.c		optional pcfclock
 dev/ppbus/ppb_1284.c		optional ppbus
 dev/ppbus/ppb_base.c		optional ppbus
 dev/ppbus/ppb_msq.c		optional ppbus
 dev/ppbus/ppbconf.c		optional ppbus
 dev/ppbus/ppbus_if.m		optional ppbus
 dev/ppbus/ppi.c			optional ppi
 dev/ppbus/pps.c			optional pps
 dev/ppbus/vpo.c			optional vpo
 dev/ppbus/vpoio.c		optional vpo
 dev/ppc/ppc.c			optional ppc
 dev/ppc/ppc_acpi.c		optional ppc acpi
 dev/ppc/ppc_isa.c		optional ppc isa
 dev/ppc/ppc_pci.c		optional ppc pci
 dev/ppc/ppc_puc.c		optional ppc puc
 dev/pst/pst-iop.c		optional pst
 dev/pst/pst-pci.c		optional pst pci
 dev/pst/pst-raid.c		optional pst
 dev/pty/pty.c			optional pty
 dev/puc/puc.c			optional puc
 dev/puc/puc_cfg.c		optional puc
 dev/puc/puc_pccard.c		optional puc pccard
 dev/puc/puc_pci.c		optional puc pci
 dev/puc/pucdata.c		optional puc pci
 dev/quicc/quicc_core.c		optional quicc
 dev/ral/rt2560.c		optional ral
 dev/ral/rt2661.c		optional ral
 dev/ral/rt2860.c		optional ral
 dev/ral/if_ral_pci.c		optional ral pci
 rt2561fw.c			optional rt2561fw | ralfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk rt2561.fw:rt2561fw -mrt2561 -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"rt2561fw.c"
 rt2561fw.fwo			optional rt2561fw | ralfw		\
 	dependency	"rt2561.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"rt2561fw.fwo"
 rt2561.fw			optional rt2561fw | ralfw		\
 	dependency	"$S/contrib/dev/ral/rt2561.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"rt2561.fw"
 rt2561sfw.c			optional rt2561sfw | ralfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk rt2561s.fw:rt2561sfw -mrt2561s -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"rt2561sfw.c"
 rt2561sfw.fwo			optional rt2561sfw | ralfw		\
 	dependency	"rt2561s.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"rt2561sfw.fwo"
 rt2561s.fw			optional rt2561sfw | ralfw		\
 	dependency	"$S/contrib/dev/ral/rt2561s.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"rt2561s.fw"
 rt2661fw.c			optional rt2661fw | ralfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk rt2661.fw:rt2661fw -mrt2661 -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"rt2661fw.c"
 rt2661fw.fwo			optional rt2661fw | ralfw		\
 	dependency	"rt2661.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"rt2661fw.fwo"
 rt2661.fw			optional rt2661fw | ralfw		\
 	dependency	"$S/contrib/dev/ral/rt2661.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"rt2661.fw"
 rt2860fw.c			optional rt2860fw | ralfw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk rt2860.fw:rt2860fw -mrt2860 -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"rt2860fw.c"
 rt2860fw.fwo			optional rt2860fw | ralfw		\
 	dependency	"rt2860.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"rt2860fw.fwo"
 rt2860.fw			optional rt2860fw | ralfw		\
 	dependency	"$S/contrib/dev/ral/rt2860.fw.uu"		\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"rt2860.fw"
 dev/random/randomdev.c		standard
 dev/random/random_adaptors.c	standard
 dev/random/dummy_rng.c		standard
 dev/random/live_entropy_sources.c	standard
 dev/random/random_harvestq.c	standard
 dev/random/randomdev_soft.c	optional random
 dev/random/yarrow.c		optional random
 dev/random/fortuna.c		optional random
 dev/random/hash.c		optional random
 dev/rc/rc.c			optional rc
 dev/re/if_re.c			optional re
 dev/rl/if_rl.c			optional rl pci
 dev/rndtest/rndtest.c		optional rndtest
 dev/rp/rp.c			optional rp
 dev/rp/rp_isa.c			optional rp isa
 dev/rp/rp_pci.c			optional rp pci
 dev/safe/safe.c			optional safe
 dev/scc/scc_if.m		optional scc
 dev/scc/scc_bfe_ebus.c		optional scc ebus
 dev/scc/scc_bfe_quicc.c		optional scc quicc
 dev/scc/scc_bfe_sbus.c		optional scc fhc | scc sbus
 dev/scc/scc_core.c		optional scc
 dev/scc/scc_dev_quicc.c		optional scc quicc
 dev/scc/scc_dev_sab82532.c	optional scc
 dev/scc/scc_dev_z8530.c		optional scc
 dev/scd/scd.c			optional scd isa
 dev/scd/scd_isa.c		optional scd isa
 dev/sdhci/sdhci.c		optional sdhci
 dev/sdhci/sdhci_if.m		optional sdhci
 dev/sdhci/sdhci_pci.c		optional sdhci pci
 dev/sf/if_sf.c			optional sf pci
 dev/sge/if_sge.c		optional sge pci
 dev/si/si.c			optional si
 dev/si/si2_z280.c		optional si
 dev/si/si3_t225.c		optional si
 dev/si/si_eisa.c		optional si eisa
 dev/si/si_isa.c			optional si isa
 dev/si/si_pci.c			optional si pci
 dev/siba/siba.c			optional siba
 dev/siba/siba_bwn.c		optional siba_bwn pci
 dev/siba/siba_cc.c		optional siba
 dev/siba/siba_core.c		optional siba | siba_bwn pci
 dev/siba/siba_pcib.c		optional siba pci
 dev/siis/siis.c			optional siis pci
 dev/sis/if_sis.c		optional sis pci
 dev/sk/if_sk.c			optional sk pci
 dev/smbus/smb.c			optional smb
 dev/smbus/smbconf.c		optional smbus
 dev/smbus/smbus.c		optional smbus
 dev/smbus/smbus_if.m		optional smbus
 dev/smc/if_smc.c		optional smc
 dev/smc/if_smc_fdt.c		optional smc fdt
 dev/sn/if_sn.c			optional sn
 dev/sn/if_sn_isa.c		optional sn isa
 dev/sn/if_sn_pccard.c		optional sn pccard
 dev/snp/snp.c			optional snp
 dev/sound/clone.c		optional sound
 dev/sound/unit.c		optional sound
 dev/sound/isa/ad1816.c		optional snd_ad1816 isa
 dev/sound/isa/ess.c		optional snd_ess isa
 dev/sound/isa/gusc.c		optional snd_gusc isa
 dev/sound/isa/mss.c		optional snd_mss isa
 dev/sound/isa/sb16.c		optional snd_sb16 isa
 dev/sound/isa/sb8.c		optional snd_sb8 isa
 dev/sound/isa/sbc.c		optional snd_sbc isa
 dev/sound/isa/sndbuf_dma.c	optional sound isa
 dev/sound/pci/als4000.c		optional snd_als4000 pci
 dev/sound/pci/atiixp.c		optional snd_atiixp pci
 dev/sound/pci/cmi.c		optional snd_cmi pci
 dev/sound/pci/cs4281.c		optional snd_cs4281 pci
 dev/sound/pci/csa.c		optional snd_csa pci
 dev/sound/pci/csapcm.c		optional snd_csa pci
 dev/sound/pci/ds1.c		optional snd_ds1 pci
 dev/sound/pci/emu10k1.c		optional snd_emu10k1 pci
 dev/sound/pci/emu10kx.c		optional snd_emu10kx pci
 dev/sound/pci/emu10kx-pcm.c	optional snd_emu10kx pci
 dev/sound/pci/emu10kx-midi.c	optional snd_emu10kx pci
 dev/sound/pci/envy24.c		optional snd_envy24 pci
 dev/sound/pci/envy24ht.c	optional snd_envy24ht pci
 dev/sound/pci/es137x.c		optional snd_es137x pci
 dev/sound/pci/fm801.c		optional snd_fm801 pci
 dev/sound/pci/ich.c		optional snd_ich pci
 dev/sound/pci/maestro.c		optional snd_maestro pci
 dev/sound/pci/maestro3.c	optional snd_maestro3 pci
 dev/sound/pci/neomagic.c	optional snd_neomagic pci
 dev/sound/pci/solo.c		optional snd_solo pci
 dev/sound/pci/spicds.c		optional snd_spicds pci
 dev/sound/pci/t4dwave.c		optional snd_t4dwave pci
 dev/sound/pci/via8233.c		optional snd_via8233 pci
 dev/sound/pci/via82c686.c	optional snd_via82c686 pci
 dev/sound/pci/vibes.c		optional snd_vibes pci
 dev/sound/pci/hda/hdaa.c	optional snd_hda pci
 dev/sound/pci/hda/hdaa_patches.c	optional snd_hda pci
 dev/sound/pci/hda/hdac.c	optional snd_hda pci
 dev/sound/pci/hda/hdac_if.m	optional snd_hda pci
 dev/sound/pci/hda/hdacc.c	optional snd_hda pci
 dev/sound/pci/hdspe.c		optional snd_hdspe pci
 dev/sound/pci/hdspe-pcm.c	optional snd_hdspe pci
 dev/sound/pcm/ac97.c		optional sound
 dev/sound/pcm/ac97_if.m		optional sound
 dev/sound/pcm/ac97_patch.c	optional sound
 dev/sound/pcm/buffer.c		optional sound	\
 	dependency	"snd_fxdiv_gen.h"
 dev/sound/pcm/channel.c		optional sound
 dev/sound/pcm/channel_if.m	optional sound
 dev/sound/pcm/dsp.c		optional sound
 dev/sound/pcm/feeder.c		optional sound
 dev/sound/pcm/feeder_chain.c	optional sound
 dev/sound/pcm/feeder_eq.c	optional sound	\
 	dependency	"feeder_eq_gen.h"	\
 	dependency	"snd_fxdiv_gen.h"
 dev/sound/pcm/feeder_if.m	optional sound
 dev/sound/pcm/feeder_format.c	optional sound  \
 	dependency	"snd_fxdiv_gen.h"
 dev/sound/pcm/feeder_matrix.c	optional sound  \
 	dependency	"snd_fxdiv_gen.h"
 dev/sound/pcm/feeder_mixer.c	optional sound  \
 	dependency	"snd_fxdiv_gen.h"
 dev/sound/pcm/feeder_rate.c	optional sound	\
 	dependency	"feeder_rate_gen.h"	\
 	dependency	"snd_fxdiv_gen.h"
 dev/sound/pcm/feeder_volume.c	optional sound  \
 	dependency	"snd_fxdiv_gen.h"
 dev/sound/pcm/mixer.c		optional sound
 dev/sound/pcm/mixer_if.m	optional sound
 dev/sound/pcm/sndstat.c		optional sound
 dev/sound/pcm/sound.c		optional sound
 dev/sound/pcm/vchan.c		optional sound
 dev/sound/usb/uaudio.c		optional snd_uaudio usb
 dev/sound/usb/uaudio_pcm.c	optional snd_uaudio usb
 dev/sound/midi/midi.c		optional sound
 dev/sound/midi/mpu401.c		optional sound
 dev/sound/midi/mpu_if.m		optional sound
 dev/sound/midi/mpufoi_if.m	optional sound
 dev/sound/midi/sequencer.c	optional sound
 dev/sound/midi/synth_if.m	optional sound
 dev/spibus/ofw_spibus.c		optional fdt spibus
 dev/spibus/spibus.c		optional spibus				\
 	dependency	"spibus_if.h"
 dev/spibus/spibus_if.m		optional spibus
 dev/ste/if_ste.c		optional ste pci
 dev/stg/tmc18c30.c		optional stg
 dev/stg/tmc18c30_isa.c		optional stg isa
 dev/stg/tmc18c30_pccard.c	optional stg pccard
 dev/stg/tmc18c30_pci.c		optional stg pci
 dev/stg/tmc18c30_subr.c		optional stg
 dev/stge/if_stge.c		optional stge
 dev/streams/streams.c		optional streams
 dev/sym/sym_hipd.c		optional sym				\
 	dependency	"$S/dev/sym/sym_{conf,defs}.h"
 dev/syscons/blank/blank_saver.c	optional blank_saver
 dev/syscons/daemon/daemon_saver.c optional daemon_saver
 dev/syscons/dragon/dragon_saver.c optional dragon_saver
 dev/syscons/fade/fade_saver.c	optional fade_saver
 dev/syscons/fire/fire_saver.c	optional fire_saver
 dev/syscons/green/green_saver.c	optional green_saver
 dev/syscons/logo/logo.c		optional logo_saver
 dev/syscons/logo/logo_saver.c	optional logo_saver
 dev/syscons/rain/rain_saver.c	optional rain_saver
 dev/syscons/schistory.c		optional sc
 dev/syscons/scmouse.c		optional sc
 dev/syscons/scterm.c		optional sc
 dev/syscons/scvidctl.c		optional sc
 dev/syscons/snake/snake_saver.c	optional snake_saver
 dev/syscons/star/star_saver.c	optional star_saver
 dev/syscons/syscons.c		optional sc
 dev/syscons/sysmouse.c		optional sc
 dev/syscons/warp/warp_saver.c	optional warp_saver
 dev/tdfx/tdfx_linux.c		optional tdfx_linux tdfx compat_linux
 dev/tdfx/tdfx_pci.c		optional tdfx pci
 dev/ti/if_ti.c			optional ti pci
 dev/tl/if_tl.c			optional tl pci
 dev/trm/trm.c			optional trm
 dev/twa/tw_cl_init.c		optional twa \
 	compile-with "${NORMAL_C} -I$S/dev/twa"
 dev/twa/tw_cl_intr.c		optional twa \
 	compile-with "${NORMAL_C} -I$S/dev/twa"
 dev/twa/tw_cl_io.c		optional twa \
 	compile-with "${NORMAL_C} -I$S/dev/twa"
 dev/twa/tw_cl_misc.c		optional twa \
 	compile-with "${NORMAL_C} -I$S/dev/twa"
 dev/twa/tw_osl_cam.c		optional twa \
 	compile-with "${NORMAL_C} -I$S/dev/twa"
 dev/twa/tw_osl_freebsd.c	optional twa \
 	compile-with "${NORMAL_C} -I$S/dev/twa"
 dev/twe/twe.c			optional twe
 dev/twe/twe_freebsd.c		optional twe
 dev/tws/tws.c			optional tws
 dev/tws/tws_cam.c		optional tws
 dev/tws/tws_hdm.c		optional tws
 dev/tws/tws_services.c		optional tws
 dev/tws/tws_user.c		optional tws
 dev/tx/if_tx.c			optional tx
 dev/txp/if_txp.c		optional txp
 dev/uart/uart_bus_acpi.c	optional uart acpi
 #dev/uart/uart_bus_cbus.c	optional uart cbus
 dev/uart/uart_bus_ebus.c	optional uart ebus
 dev/uart/uart_bus_fdt.c		optional uart fdt
 dev/uart/uart_bus_isa.c		optional uart isa
 dev/uart/uart_bus_pccard.c	optional uart pccard
 dev/uart/uart_bus_pci.c		optional uart pci
 dev/uart/uart_bus_puc.c		optional uart puc
 dev/uart/uart_bus_scc.c		optional uart scc
 dev/uart/uart_core.c		optional uart
 dev/uart/uart_dbg.c		optional uart gdb
 dev/uart/uart_dev_ns8250.c	optional uart uart_ns8250
 dev/uart/uart_dev_pl011.c	optional uart pl011
 dev/uart/uart_dev_quicc.c	optional uart quicc
 dev/uart/uart_dev_sab82532.c	optional uart uart_sab82532
 dev/uart/uart_dev_sab82532.c	optional uart scc
 dev/uart/uart_dev_z8530.c	optional uart uart_z8530
 dev/uart/uart_dev_z8530.c	optional uart scc
 dev/uart/uart_if.m		optional uart
 dev/uart/uart_subr.c		optional uart
 dev/uart/uart_tty.c		optional uart
 dev/ubsec/ubsec.c		optional ubsec
 #
 # USB controller drivers
 #
 dev/usb/controller/at91dci.c		optional at91dci
 dev/usb/controller/at91dci_atmelarm.c	optional at91dci at91rm9200
 dev/usb/controller/musb_otg.c		optional musb
 dev/usb/controller/musb_otg_atmelarm.c	optional musb at91rm9200
 dev/usb/controller/dwc_otg.c		optional dwcotg
 dev/usb/controller/dwc_otg_fdt.c	optional dwcotg fdt
 dev/usb/controller/ehci.c		optional ehci
 dev/usb/controller/ehci_pci.c		optional ehci pci
 dev/usb/controller/ohci.c		optional ohci
 dev/usb/controller/ohci_atmelarm.c	optional ohci at91rm9200
 dev/usb/controller/ohci_pci.c		optional ohci pci
 dev/usb/controller/uhci.c		optional uhci
 dev/usb/controller/uhci_pci.c		optional uhci pci
 dev/usb/controller/xhci.c		optional xhci
 dev/usb/controller/xhci_pci.c		optional xhci pci
 dev/usb/controller/saf1761_otg.c	optional saf1761otg
 dev/usb/controller/saf1761_otg_fdt.c	optional saf1761otg fdt
 dev/usb/controller/uss820dci.c		optional uss820dci
 dev/usb/controller/uss820dci_atmelarm.c	optional uss820dci at91rm9200
 dev/usb/controller/usb_controller.c	optional usb
 #
 # USB storage drivers
 #
 dev/usb/storage/umass.c		optional umass
 dev/usb/storage/urio.c		optional urio
 dev/usb/storage/ustorage_fs.c	optional usfs
 #
 # USB core
 #
 dev/usb/usb_busdma.c		optional usb
 dev/usb/usb_compat_linux.c	optional usb
 dev/usb/usb_core.c		optional usb
 dev/usb/usb_debug.c		optional usb
 dev/usb/usb_dev.c		optional usb
 dev/usb/usb_device.c		optional usb
 dev/usb/usb_dynamic.c		optional usb
 dev/usb/usb_error.c		optional usb
 dev/usb/usb_generic.c		optional usb
 dev/usb/usb_handle_request.c	optional usb
 dev/usb/usb_hid.c		optional usb
 dev/usb/usb_hub.c		optional usb
 dev/usb/usb_if.m		optional usb
 dev/usb/usb_lookup.c		optional usb
 dev/usb/usb_mbuf.c		optional usb
 dev/usb/usb_msctest.c		optional usb
 dev/usb/usb_parse.c		optional usb
 dev/usb/usb_pf.c		optional usb
 dev/usb/usb_process.c		optional usb
 dev/usb/usb_request.c		optional usb
 dev/usb/usb_transfer.c		optional usb
 dev/usb/usb_util.c		optional usb
 #
 # USB network drivers
 #
 dev/usb/net/if_aue.c		optional aue
 dev/usb/net/if_axe.c		optional axe
 dev/usb/net/if_axge.c		optional axge
 dev/usb/net/if_cdce.c		optional cdce
 dev/usb/net/if_cue.c		optional cue
 dev/usb/net/if_ipheth.c		optional ipheth
 dev/usb/net/if_kue.c		optional kue
 dev/usb/net/if_mos.c		optional mos
 dev/usb/net/if_rue.c		optional rue
 dev/usb/net/if_smsc.c		optional smsc
 dev/usb/net/if_udav.c		optional udav
 dev/usb/net/if_usie.c		optional usie
 dev/usb/net/if_urndis.c		optional urndis
 dev/usb/net/ruephy.c		optional rue
 dev/usb/net/usb_ethernet.c	optional aue | axe | axge | cdce | cue | kue | \
 					 mos | rue | smsc | udav | ipheth | \
 					 urndis
 dev/usb/net/uhso.c		optional uhso
 #
 # USB WLAN drivers
 #
 dev/usb/wlan/if_rsu.c		optional rsu
 rsu-rtl8712fw.c			optional rsu-rtl8712fw | rsufw		\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk rsu-rtl8712fw.fw:rsu-rtl8712fw:120 -mrsu-rtl8712fw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"rsu-rtl8712fw.c"
 rsu-rtl8712fw.fwo		optional rsu-rtl8712fw | rsufw		\
 	dependency	"rsu-rtl8712fw.fw"				\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"rsu-rtl8712fw.fwo"
 rsu-rtl8712fw.fw		optional rsu-rtl8712.fw | rsufw		\
 	dependency	"$S/contrib/dev/rsu/rsu-rtl8712fw.fw.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"rsu-rtl8712fw.fw"
 dev/usb/wlan/if_rum.c		optional rum
 dev/usb/wlan/if_run.c		optional run
 runfw.c				optional runfw							\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk run.fw:runfw -mrunfw -c${.TARGET}"	\
 	no-implicit-rule before-depend local							\
 	clean		"runfw.c"
 runfw.fwo			optional runfw							\
 	dependency	"run.fw"								\
 	compile-with	"${NORMAL_FWO}"								\
 	no-implicit-rule									\
 	clean		"runfw.fwo"
 run.fw				optional runfw							\
 	dependency	"$S/contrib/dev/run/rt2870.fw.uu"					\
 	compile-with	"${NORMAL_FW}"								\
 	no-obj no-implicit-rule									\
 	clean		"run.fw"
 dev/usb/wlan/if_uath.c		optional uath
 dev/usb/wlan/if_upgt.c		optional upgt
 dev/usb/wlan/if_ural.c		optional ural
 dev/usb/wlan/if_urtw.c		optional urtw
 dev/usb/wlan/if_urtwn.c		optional urtwn
 urtwn-rtl8188eufw.c		optional urtwn-rtl8188eufw | urtwnfw	\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk urtwn-rtl8188eufw.fw:urtwn-rtl8188eufw:111 -murtwn-rtl8188eufw -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"urtwn-rtl8188eufw.c"
 urtwn-rtl8188eufw.fwo		optional urtwn-rtl8188eufw | urtwnfw	\
 	dependency	"urtwn-rtl8188eufw.fw"				\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"urtwn-rtl8188eufw.fwo"
 urtwn-rtl8188eufw.fw		optional urtwn-rtl8188eufw | urtwnfw	\
 	dependency	"$S/contrib/dev/urtwn/urtwn-rtl8188eufw.fw.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"urtwn-rtl8188eufw.fw"
 urtwn-rtl8192cfwT.c		optional urtwn-rtl8192cfwT | urtwnfw	\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk urtwn-rtl8192cfwT.fw:urtwn-rtl8192cfwT:111 -murtwn-rtl8192cfwT -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"urtwn-rtl8192cfwT.c"
 urtwn-rtl8192cfwT.fwo		optional urtwn-rtl8192cfwT | urtwnfw	\
 	dependency	"urtwn-rtl8192cfwT.fw"				\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"urtwn-rtl8192cfwT.fwo"
 urtwn-rtl8192cfwT.fw		optional urtwn-rtl8192cfwT | urtwnfw	\
 	dependency	"$S/contrib/dev/urtwn/urtwn-rtl8192cfwT.fw.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"urtwn-rtl8192cfwT.fw"
 urtwn-rtl8192cfwU.c		optional urtwn-rtl8192cfwU | urtwnfw	\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk urtwn-rtl8192cfwU.fw:urtwn-rtl8192cfwU:111 -murtwn-rtl8192cfwU -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"urtwn-rtl8192cfwU.c"
 urtwn-rtl8192cfwU.fwo		optional urtwn-rtl8192cfwU | urtwnfw	\
 	dependency	"urtwn-rtl8192cfwU.fw"				\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"urtwn-rtl8192cfwU.fwo"
 urtwn-rtl8192cfwU.fw		optional urtwn-rtl8192cfwU | urtwnfw	\
 	dependency	"$S/contrib/dev/urtwn/urtwn-rtl8192cfwU.fw.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"urtwn-rtl8192cfwU.fw"
 
 dev/usb/wlan/if_zyd.c		optional zyd
 #
 # USB serial and parallel port drivers
 #
 dev/usb/serial/u3g.c		optional u3g
 dev/usb/serial/uark.c		optional uark
 dev/usb/serial/ubsa.c		optional ubsa
 dev/usb/serial/ubser.c		optional ubser
 dev/usb/serial/uchcom.c		optional uchcom
 dev/usb/serial/ucycom.c		optional ucycom
 dev/usb/serial/ufoma.c		optional ufoma
 dev/usb/serial/uftdi.c		optional uftdi
 dev/usb/serial/ugensa.c		optional ugensa
 dev/usb/serial/uipaq.c		optional uipaq
 dev/usb/serial/ulpt.c		optional ulpt
 dev/usb/serial/umcs.c		optional umcs
 dev/usb/serial/umct.c		optional umct
 dev/usb/serial/umodem.c		optional umodem
 dev/usb/serial/umoscom.c	optional umoscom
 dev/usb/serial/uplcom.c		optional uplcom
 dev/usb/serial/uslcom.c		optional uslcom
 dev/usb/serial/uvisor.c		optional uvisor
 dev/usb/serial/uvscom.c		optional uvscom
 dev/usb/serial/usb_serial.c 	optional ucom | u3g | uark | ubsa | ubser | \
 					 uchcom | ucycom | ufoma | uftdi | \
 					 ugensa | uipaq | umcs | umct | \
 					 umodem | umoscom | uplcom | usie | \
 					 uslcom | uvisor | uvscom
 #
 # USB misc drivers
 #
 dev/usb/misc/ufm.c		optional ufm
 dev/usb/misc/udbp.c		optional udbp
 dev/usb/misc/uled.c		optional uled
 #
 # USB input drivers
 #
 dev/usb/input/atp.c		optional atp
 dev/usb/input/uep.c		optional uep
 dev/usb/input/uhid.c		optional uhid
 dev/usb/input/ukbd.c		optional ukbd
 dev/usb/input/ums.c		optional ums
 dev/usb/input/wsp.c		optional wsp
 #
 # USB quirks
 #
 dev/usb/quirk/usb_quirk.c	optional usb
 #
 # USB templates
 #
 dev/usb/template/usb_template.c		optional usb_template
 dev/usb/template/usb_template_audio.c	optional usb_template
 dev/usb/template/usb_template_cdce.c	optional usb_template
 dev/usb/template/usb_template_kbd.c	optional usb_template
 dev/usb/template/usb_template_modem.c	optional usb_template
 dev/usb/template/usb_template_mouse.c	optional usb_template
 dev/usb/template/usb_template_msc.c	optional usb_template
 dev/usb/template/usb_template_mtp.c	optional usb_template
 dev/usb/template/usb_template_phone.c	optional usb_template
 #
 # USB END
 #
 dev/utopia/idtphy.c		optional utopia
 dev/utopia/suni.c		optional utopia
 dev/utopia/utopia.c		optional utopia
 dev/vge/if_vge.c		optional vge
 dev/viapm/viapm.c		optional viapm pci
 dev/virtio/virtio.c			optional	virtio
 dev/virtio/virtqueue.c			optional	virtio
 dev/virtio/virtio_bus_if.m		optional	virtio
 dev/virtio/virtio_if.m			optional	virtio
 dev/virtio/pci/virtio_pci.c		optional	virtio_pci
 dev/virtio/mmio/virtio_mmio.c		optional	virtio_mmio
 dev/virtio/mmio/virtio_mmio_if.m	optional	virtio_mmio
 dev/virtio/network/if_vtnet.c		optional	vtnet
 dev/virtio/block/virtio_blk.c		optional	virtio_blk
 dev/virtio/balloon/virtio_balloon.c	optional	virtio_balloon
 dev/virtio/scsi/virtio_scsi.c		optional	virtio_scsi
 dev/virtio/random/virtio_random.c	optional	virtio_random
 dev/virtio/console/virtio_console.c	optional	virtio_console
 dev/vkbd/vkbd.c			optional vkbd
 dev/vr/if_vr.c			optional vr pci
 dev/vt/colors/vt_termcolors.c	optional vt
 dev/vt/font/vt_font_default.c	optional vt
 dev/vt/font/vt_mouse_cursor.c	optional vt
 dev/vt/hw/efifb/efifb.c		optional vt_efifb
 dev/vt/hw/fb/vt_fb.c		optional vt
 dev/vt/hw/vga/vt_vga.c		optional vt vt_vga
 dev/vt/logo/logo_freebsd.c	optional vt splash
 dev/vt/vt_buf.c			optional vt
 dev/vt/vt_consolectl.c		optional vt
 dev/vt/vt_core.c		optional vt
 dev/vt/vt_font.c		optional vt
 dev/vt/vt_sysmouse.c		optional vt
 dev/vte/if_vte.c		optional vte pci
 dev/vx/if_vx.c			optional vx
 dev/vx/if_vx_eisa.c		optional vx eisa
 dev/vx/if_vx_pci.c		optional vx pci
 dev/vxge/vxge.c				optional vxge
 dev/vxge/vxgehal/vxgehal-ifmsg.c	optional vxge
 dev/vxge/vxgehal/vxgehal-mrpcim.c	optional vxge
 dev/vxge/vxgehal/vxge-queue.c		optional vxge
 dev/vxge/vxgehal/vxgehal-ring.c		optional vxge
 dev/vxge/vxgehal/vxgehal-swapper.c	optional vxge
 dev/vxge/vxgehal/vxgehal-mgmt.c		optional vxge
 dev/vxge/vxgehal/vxgehal-srpcim.c	optional vxge
 dev/vxge/vxgehal/vxgehal-config.c	optional vxge
 dev/vxge/vxgehal/vxgehal-blockpool.c	optional vxge
 dev/vxge/vxgehal/vxgehal-doorbells.c	optional vxge
 dev/vxge/vxgehal/vxgehal-mgmtaux.c	optional vxge
 dev/vxge/vxgehal/vxgehal-device.c	optional vxge
 dev/vxge/vxgehal/vxgehal-mm.c		optional vxge
 dev/vxge/vxgehal/vxgehal-driver.c	optional vxge
 dev/vxge/vxgehal/vxgehal-virtualpath.c	optional vxge
 dev/vxge/vxgehal/vxgehal-channel.c	optional vxge
 dev/vxge/vxgehal/vxgehal-fifo.c		optional vxge
 dev/watchdog/watchdog.c		standard
 dev/wb/if_wb.c			optional wb pci
 dev/wds/wd7000.c		optional wds isa
 dev/wi/if_wi.c			optional wi
 dev/wi/if_wi_pccard.c		optional wi pccard
 dev/wi/if_wi_pci.c		optional wi pci
 dev/wl/if_wl.c			optional wl isa
 dev/wpi/if_wpi.c		optional wpi pci
 wpifw.c			optional wpifw					\
 	compile-with	"${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:153229 -mwpi -c${.TARGET}" \
 	no-implicit-rule before-depend local				\
 	clean		"wpifw.c"
 wpifw.fwo			optional wpifw				\
 	dependency	"wpi.fw"					\
 	compile-with	"${NORMAL_FWO}"					\
 	no-implicit-rule						\
 	clean		"wpifw.fwo"
 wpi.fw			optional wpifw					\
 	dependency	"$S/contrib/dev/wpi/iwlwifi-3945-15.32.2.9.fw.uu"	\
 	compile-with	"${NORMAL_FW}"					\
 	no-obj no-implicit-rule						\
 	clean		"wpi.fw"
 dev/xe/if_xe.c			optional xe
 dev/xe/if_xe_pccard.c		optional xe pccard
 dev/xen/balloon/balloon.c	optional xen | xenhvm
 dev/xen/blkfront/blkfront.c	optional xen | xenhvm
 dev/xen/blkback/blkback.c	optional xen | xenhvm
 dev/xen/console/console.c	optional xen | xenhvm
 dev/xen/console/xencons_ring.c	optional xen | xenhvm
 dev/xen/control/control.c	optional xen | xenhvm
 dev/xen/grant_table/grant_table.c	optional xen | xenhvm
 dev/xen/netback/netback.c	optional xen | xenhvm
 dev/xen/netfront/netfront.c	optional xen | xenhvm
 dev/xen/xenpci/xenpci.c		optional xenpci
 dev/xen/timer/timer.c		optional xen | xenhvm
 dev/xen/pvcpu/pvcpu.c		optional xen | xenhvm
 dev/xen/xenstore/xenstore.c	optional xen | xenhvm
 dev/xen/xenstore/xenstore_dev.c	optional xen | xenhvm
 dev/xen/xenstore/xenstored_dev.c	optional xen | xenhvm
 dev/xen/evtchn/evtchn_dev.c	optional xen | xenhvm
 dev/xen/privcmd/privcmd.c	optional xen | xenhvm
 dev/xl/if_xl.c			optional xl pci
 dev/xl/xlphy.c			optional xl pci
 fs/autofs/autofs.c		optional autofs
 fs/autofs/autofs_vfsops.c	optional autofs
 fs/autofs/autofs_vnops.c	optional autofs
 fs/deadfs/dead_vnops.c		standard
 fs/devfs/devfs_devs.c		standard
 fs/devfs/devfs_dir.c		standard
 fs/devfs/devfs_rule.c		standard
 fs/devfs/devfs_vfsops.c		standard
 fs/devfs/devfs_vnops.c		standard
 fs/fdescfs/fdesc_vfsops.c	optional fdescfs
 fs/fdescfs/fdesc_vnops.c	optional fdescfs
 fs/fifofs/fifo_vnops.c		standard
 fs/cuse/cuse.c			optional cuse
 fs/fuse/fuse_device.c		optional fuse
 fs/fuse/fuse_file.c		optional fuse
 fs/fuse/fuse_internal.c		optional fuse
 fs/fuse/fuse_io.c		optional fuse
 fs/fuse/fuse_ipc.c		optional fuse
 fs/fuse/fuse_main.c		optional fuse
 fs/fuse/fuse_node.c		optional fuse
 fs/fuse/fuse_vfsops.c		optional fuse
 fs/fuse/fuse_vnops.c		optional fuse
 fs/msdosfs/msdosfs_conv.c	optional msdosfs
 fs/msdosfs/msdosfs_denode.c	optional msdosfs
 fs/msdosfs/msdosfs_fat.c	optional msdosfs
 fs/msdosfs/msdosfs_fileno.c	optional msdosfs
 fs/msdosfs/msdosfs_iconv.c	optional msdosfs_iconv
 fs/msdosfs/msdosfs_lookup.c	optional msdosfs
 fs/msdosfs/msdosfs_vfsops.c	optional msdosfs
 fs/msdosfs/msdosfs_vnops.c	optional msdosfs
 fs/nandfs/bmap.c		optional nandfs
 fs/nandfs/nandfs_alloc.c	optional nandfs
 fs/nandfs/nandfs_bmap.c		optional nandfs
 fs/nandfs/nandfs_buffer.c	optional nandfs
 fs/nandfs/nandfs_cleaner.c	optional nandfs
 fs/nandfs/nandfs_cpfile.c	optional nandfs
 fs/nandfs/nandfs_dat.c		optional nandfs
 fs/nandfs/nandfs_dir.c		optional nandfs
 fs/nandfs/nandfs_ifile.c	optional nandfs
 fs/nandfs/nandfs_segment.c	optional nandfs
 fs/nandfs/nandfs_subr.c		optional nandfs
 fs/nandfs/nandfs_sufile.c	optional nandfs
 fs/nandfs/nandfs_vfsops.c	optional nandfs
 fs/nandfs/nandfs_vnops.c	optional nandfs
 fs/nfs/nfs_commonkrpc.c		optional nfscl | nfsd
 fs/nfs/nfs_commonsubs.c		optional nfscl | nfsd
 fs/nfs/nfs_commonport.c		optional nfscl | nfsd
 fs/nfs/nfs_commonacl.c		optional nfscl | nfsd
 fs/nfsclient/nfs_clcomsubs.c	optional nfscl
 fs/nfsclient/nfs_clsubs.c	optional nfscl
 fs/nfsclient/nfs_clstate.c	optional nfscl
 fs/nfsclient/nfs_clkrpc.c	optional nfscl
 fs/nfsclient/nfs_clrpcops.c	optional nfscl
 fs/nfsclient/nfs_clvnops.c	optional nfscl
 fs/nfsclient/nfs_clnode.c	optional nfscl
 fs/nfsclient/nfs_clvfsops.c	optional nfscl
 fs/nfsclient/nfs_clport.c	optional nfscl
 fs/nfsclient/nfs_clbio.c	optional nfscl
 fs/nfsclient/nfs_clnfsiod.c	optional nfscl
 fs/nfsserver/nfs_fha_new.c	optional nfsd inet
 fs/nfsserver/nfs_nfsdsocket.c	optional nfsd inet
 fs/nfsserver/nfs_nfsdsubs.c	optional nfsd inet
 fs/nfsserver/nfs_nfsdstate.c	optional nfsd inet
 fs/nfsserver/nfs_nfsdkrpc.c	optional nfsd inet
 fs/nfsserver/nfs_nfsdserv.c	optional nfsd inet
 fs/nfsserver/nfs_nfsdport.c	optional nfsd inet
 fs/nfsserver/nfs_nfsdcache.c	optional nfsd inet
 fs/nullfs/null_subr.c		optional nullfs
 fs/nullfs/null_vfsops.c		optional nullfs
 fs/nullfs/null_vnops.c		optional nullfs
 fs/procfs/procfs.c		optional procfs
 fs/procfs/procfs_ctl.c		optional procfs
 fs/procfs/procfs_dbregs.c	optional procfs
 fs/procfs/procfs_fpregs.c	optional procfs
 fs/procfs/procfs_ioctl.c	optional procfs
 fs/procfs/procfs_map.c		optional procfs
 fs/procfs/procfs_mem.c		optional procfs
 fs/procfs/procfs_note.c		optional procfs
 fs/procfs/procfs_osrel.c	optional procfs
 fs/procfs/procfs_regs.c		optional procfs
 fs/procfs/procfs_rlimit.c	optional procfs
 fs/procfs/procfs_status.c	optional procfs
 fs/procfs/procfs_type.c		optional procfs
 fs/pseudofs/pseudofs.c		optional pseudofs
 fs/pseudofs/pseudofs_fileno.c	optional pseudofs
 fs/pseudofs/pseudofs_vncache.c	optional pseudofs
 fs/pseudofs/pseudofs_vnops.c	optional pseudofs
 fs/smbfs/smbfs_io.c		optional smbfs
 fs/smbfs/smbfs_node.c		optional smbfs
 fs/smbfs/smbfs_smb.c		optional smbfs
 fs/smbfs/smbfs_subr.c		optional smbfs
 fs/smbfs/smbfs_vfsops.c		optional smbfs
 fs/smbfs/smbfs_vnops.c		optional smbfs
 fs/udf/osta.c			optional udf
 fs/udf/udf_iconv.c		optional udf_iconv
 fs/udf/udf_vfsops.c		optional udf
 fs/udf/udf_vnops.c		optional udf
 fs/unionfs/union_subr.c		optional unionfs
 fs/unionfs/union_vfsops.c	optional unionfs
 fs/unionfs/union_vnops.c	optional unionfs
 fs/tmpfs/tmpfs_vnops.c		optional tmpfs
 fs/tmpfs/tmpfs_fifoops.c 	optional tmpfs
 fs/tmpfs/tmpfs_vfsops.c 	optional tmpfs
 fs/tmpfs/tmpfs_subr.c 		optional tmpfs
 gdb/gdb_cons.c			optional gdb
 gdb/gdb_main.c			optional gdb
 gdb/gdb_packet.c		optional gdb
 geom/bde/g_bde.c		optional geom_bde
 geom/bde/g_bde_crypt.c		optional geom_bde
 geom/bde/g_bde_lock.c		optional geom_bde
 geom/bde/g_bde_work.c		optional geom_bde
 geom/cache/g_cache.c		optional geom_cache
 geom/concat/g_concat.c		optional geom_concat
 geom/eli/g_eli.c		optional geom_eli
 geom/eli/g_eli_crypto.c		optional geom_eli
 geom/eli/g_eli_ctl.c		optional geom_eli
 geom/eli/g_eli_integrity.c	optional geom_eli
 geom/eli/g_eli_key.c		optional geom_eli
 geom/eli/g_eli_key_cache.c	optional geom_eli
 geom/eli/g_eli_privacy.c	optional geom_eli
 geom/eli/pkcs5v2.c		optional geom_eli
 geom/gate/g_gate.c		optional geom_gate
 geom/geom_aes.c			optional geom_aes
 geom/geom_bsd.c			optional geom_bsd
 geom/geom_bsd_enc.c		optional geom_bsd | geom_part_bsd
 geom/geom_ccd.c			optional ccd | geom_ccd
 geom/geom_ctl.c			standard
 geom/geom_dev.c			standard
 geom/geom_disk.c		standard
 geom/geom_dump.c		standard
 geom/geom_event.c		standard
 geom/geom_fox.c			optional geom_fox
 geom/geom_flashmap.c		optional fdt cfi | fdt nand
 geom/geom_io.c			standard
 geom/geom_kern.c		standard
 geom/geom_map.c			optional geom_map
 geom/geom_mbr.c			optional geom_mbr
 geom/geom_mbr_enc.c		optional geom_mbr
 geom/geom_pc98.c		optional geom_pc98
 geom/geom_pc98_enc.c		optional geom_pc98
 geom/geom_redboot.c		optional geom_redboot
 geom/geom_slice.c		standard
 geom/geom_subr.c		standard
 geom/geom_sunlabel.c		optional geom_sunlabel
 geom/geom_sunlabel_enc.c	optional geom_sunlabel
 geom/geom_vfs.c			standard
 geom/geom_vol_ffs.c		optional geom_vol
 geom/journal/g_journal.c	optional geom_journal
 geom/journal/g_journal_ufs.c	optional geom_journal
 geom/label/g_label.c		optional geom_label | geom_label_gpt
 geom/label/g_label_ext2fs.c	optional geom_label
 geom/label/g_label_iso9660.c	optional geom_label
 geom/label/g_label_msdosfs.c	optional geom_label
 geom/label/g_label_ntfs.c	optional geom_label
 geom/label/g_label_reiserfs.c	optional geom_label
 geom/label/g_label_ufs.c	optional geom_label
 geom/label/g_label_gpt.c	optional geom_label | geom_label_gpt
 geom/label/g_label_disk_ident.c	optional geom_label
 geom/linux_lvm/g_linux_lvm.c	optional geom_linux_lvm
 geom/mirror/g_mirror.c		optional geom_mirror
 geom/mirror/g_mirror_ctl.c	optional geom_mirror
 geom/mountver/g_mountver.c	optional geom_mountver
 geom/multipath/g_multipath.c	optional geom_multipath
 geom/nop/g_nop.c		optional geom_nop
 geom/part/g_part.c		standard
 geom/part/g_part_if.m		standard
 geom/part/g_part_apm.c		optional geom_part_apm
 geom/part/g_part_bsd.c		optional geom_part_bsd
 geom/part/g_part_bsd64.c	optional geom_part_bsd64
 geom/part/g_part_ebr.c		optional geom_part_ebr
 geom/part/g_part_gpt.c		optional geom_part_gpt
 geom/part/g_part_ldm.c		optional geom_part_ldm
 geom/part/g_part_mbr.c		optional geom_part_mbr
 geom/part/g_part_pc98.c		optional geom_part_pc98
 geom/part/g_part_vtoc8.c	optional geom_part_vtoc8
 geom/raid/g_raid.c		optional geom_raid
 geom/raid/g_raid_ctl.c		optional geom_raid
 geom/raid/g_raid_md_if.m	optional geom_raid
 geom/raid/g_raid_tr_if.m	optional geom_raid
 geom/raid/md_ddf.c		optional geom_raid
 geom/raid/md_intel.c		optional geom_raid
 geom/raid/md_jmicron.c		optional geom_raid
 geom/raid/md_nvidia.c		optional geom_raid
 geom/raid/md_promise.c		optional geom_raid
 geom/raid/md_sii.c		optional geom_raid
 geom/raid/tr_concat.c		optional geom_raid
 geom/raid/tr_raid0.c		optional geom_raid
 geom/raid/tr_raid1.c		optional geom_raid
 geom/raid/tr_raid1e.c		optional geom_raid
 geom/raid/tr_raid5.c		optional geom_raid
 geom/raid3/g_raid3.c		optional geom_raid3
 geom/raid3/g_raid3_ctl.c	optional geom_raid3
 geom/shsec/g_shsec.c		optional geom_shsec
 geom/stripe/g_stripe.c		optional geom_stripe
 geom/uncompress/g_uncompress.c	optional geom_uncompress
 contrib/xz-embedded/freebsd/xz_malloc.c	\
 	optional xz_embedded | geom_uncompress \
 	compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
 contrib/xz-embedded/linux/lib/xz/xz_crc32.c \
 	optional xz_embedded | geom_uncompress \
 	compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
 contrib/xz-embedded/linux/lib/xz/xz_dec_bcj.c \
 	optional xz_embedded | geom_uncompress \
 	compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
 contrib/xz-embedded/linux/lib/xz/xz_dec_lzma2.c \
 	optional xz_embedded | geom_uncompress \
 	compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
 contrib/xz-embedded/linux/lib/xz/xz_dec_stream.c \
 	optional xz_embedded | geom_uncompress \
 	compile-with "${NORMAL_C} -I$S/contrib/xz-embedded/freebsd/ -I$S/contrib/xz-embedded/linux/lib/xz/ -I$S/contrib/xz-embedded/linux/include/linux/"
 geom/uzip/g_uzip.c		optional geom_uzip
 geom/vinum/geom_vinum.c		optional geom_vinum
 geom/vinum/geom_vinum_create.c	optional geom_vinum
 geom/vinum/geom_vinum_drive.c	optional geom_vinum
 geom/vinum/geom_vinum_plex.c	optional geom_vinum
 geom/vinum/geom_vinum_volume.c	optional geom_vinum
 geom/vinum/geom_vinum_subr.c	optional geom_vinum
 geom/vinum/geom_vinum_raid5.c	optional geom_vinum
 geom/vinum/geom_vinum_share.c	optional geom_vinum
 geom/vinum/geom_vinum_list.c	optional geom_vinum
 geom/vinum/geom_vinum_rm.c	optional geom_vinum
 geom/vinum/geom_vinum_init.c	optional geom_vinum
 geom/vinum/geom_vinum_state.c	optional geom_vinum
 geom/vinum/geom_vinum_rename.c	optional geom_vinum
 geom/vinum/geom_vinum_move.c	optional geom_vinum
 geom/vinum/geom_vinum_events.c	optional geom_vinum
 geom/virstor/binstream.c	optional geom_virstor
 geom/virstor/g_virstor.c	optional geom_virstor
 geom/virstor/g_virstor_md.c	optional geom_virstor
 geom/zero/g_zero.c		optional geom_zero
 fs/ext2fs/ext2_alloc.c		optional ext2fs
 fs/ext2fs/ext2_balloc.c		optional ext2fs
 fs/ext2fs/ext2_bmap.c		optional ext2fs
 fs/ext2fs/ext2_extents.c	optional ext2fs
 fs/ext2fs/ext2_inode.c		optional ext2fs
 fs/ext2fs/ext2_inode_cnv.c	optional ext2fs
 fs/ext2fs/ext2_hash.c		optional ext2fs
 fs/ext2fs/ext2_htree.c		optional ext2fs
 fs/ext2fs/ext2_lookup.c		optional ext2fs
 fs/ext2fs/ext2_subr.c		optional ext2fs
 fs/ext2fs/ext2_vfsops.c		optional ext2fs
 fs/ext2fs/ext2_vnops.c		optional ext2fs
 gnu/fs/reiserfs/reiserfs_hashes.c	optional reiserfs \
 	warning "kernel contains GPL contaminated ReiserFS filesystem"
 gnu/fs/reiserfs/reiserfs_inode.c	optional reiserfs
 gnu/fs/reiserfs/reiserfs_item_ops.c	optional reiserfs
 gnu/fs/reiserfs/reiserfs_namei.c	optional reiserfs
 gnu/fs/reiserfs/reiserfs_prints.c	optional reiserfs
 gnu/fs/reiserfs/reiserfs_stree.c	optional reiserfs
 gnu/fs/reiserfs/reiserfs_vfsops.c	optional reiserfs
 gnu/fs/reiserfs/reiserfs_vnops.c	optional reiserfs
 #
 isa/isa_if.m			standard
 isa/isa_common.c		optional isa
 isa/isahint.c			optional isa
 isa/pnp.c			optional isa isapnp
 isa/pnpparse.c			optional isa isapnp
 fs/cd9660/cd9660_bmap.c	optional cd9660
 fs/cd9660/cd9660_lookup.c	optional cd9660
 fs/cd9660/cd9660_node.c	optional cd9660
 fs/cd9660/cd9660_rrip.c	optional cd9660
 fs/cd9660/cd9660_util.c	optional cd9660
 fs/cd9660/cd9660_vfsops.c	optional cd9660
 fs/cd9660/cd9660_vnops.c	optional cd9660
 fs/cd9660/cd9660_iconv.c	optional cd9660_iconv
 kern/bus_if.m			standard
 kern/clock_if.m			standard
 kern/cpufreq_if.m		standard
 kern/device_if.m		standard
 kern/imgact_binmisc.c		optional	imagact_binmisc
 kern/imgact_elf.c		standard
 kern/imgact_elf32.c		optional compat_freebsd32
 kern/imgact_shell.c		standard
 kern/inflate.c			optional gzip
 kern/init_main.c		standard
 kern/init_sysent.c		standard
 kern/ksched.c			optional _kposix_priority_scheduling
 kern/kern_acct.c		standard
 kern/kern_alq.c			optional alq
 kern/kern_clock.c		standard
 kern/kern_condvar.c		standard
 kern/kern_conf.c		standard
 kern/kern_cons.c		standard
 kern/kern_cpu.c			standard
 kern/kern_cpuset.c		standard
 kern/kern_context.c		standard
 kern/kern_descrip.c		standard
 kern/kern_dtrace.c		optional kdtrace_hooks
 kern/kern_environment.c		standard
 kern/kern_et.c			standard
 kern/kern_event.c		standard
 kern/kern_exec.c		standard
 kern/kern_exit.c		standard
 kern/kern_fail.c		standard
 kern/kern_ffclock.c		standard
 kern/kern_fork.c		standard
 kern/kern_gzio.c		optional gzio
 kern/kern_hhook.c		standard
 kern/kern_idle.c		standard
 kern/kern_intr.c		standard
 kern/kern_jail.c		standard
 kern/kern_khelp.c		standard
 kern/kern_kthread.c		standard
 kern/kern_ktr.c			optional ktr
 kern/kern_ktrace.c		standard
 kern/kern_linker.c		standard
 kern/kern_lock.c		standard
 kern/kern_lockf.c		standard
 kern/kern_lockstat.c		optional kdtrace_hooks
 kern/kern_loginclass.c		standard
 kern/kern_malloc.c		standard
 kern/kern_mbuf.c		standard
 kern/kern_mib.c			standard
 kern/kern_module.c		standard
 kern/kern_mtxpool.c		standard
 kern/kern_mutex.c		standard
 kern/kern_ntptime.c		standard
 kern/kern_osd.c			standard
 kern/kern_physio.c		standard
 kern/kern_pmc.c			standard
 kern/kern_poll.c		optional device_polling
 kern/kern_priv.c		standard
 kern/kern_proc.c		standard
 kern/kern_procctl.c		standard
 kern/kern_prot.c		standard
 kern/kern_racct.c		standard
 kern/kern_rangelock.c		standard
 kern/kern_rctl.c		standard
 kern/kern_resource.c		standard
 kern/kern_rmlock.c		standard
 kern/kern_rwlock.c		standard
 kern/kern_sdt.c			optional kdtrace_hooks
 kern/kern_sema.c		standard
 kern/kern_sharedpage.c		standard
 kern/kern_shutdown.c		standard
 kern/kern_sig.c			standard
 kern/kern_switch.c		standard
 kern/kern_sx.c			standard
 kern/kern_synch.c		standard
 kern/kern_syscalls.c		standard
 kern/kern_sysctl.c		standard
 kern/kern_tc.c			standard
 kern/kern_thr.c			standard
 kern/kern_thread.c		standard
 kern/kern_time.c		standard
 kern/kern_timeout.c		standard
 kern/kern_umtx.c		standard
 kern/kern_uuid.c		standard
 kern/kern_xxx.c			standard
 kern/link_elf.c			standard
 kern/linker_if.m		standard
 kern/md4c.c			optional netsmb
 kern/md5c.c			standard
 kern/p1003_1b.c			standard
 kern/posix4_mib.c		standard
 kern/sched_4bsd.c		optional sched_4bsd
 kern/sched_ule.c		optional sched_ule
 kern/serdev_if.m		standard
 kern/stack_protector.c		standard \
 	compile-with "${NORMAL_C:N-fstack-protector*}"
 kern/subr_acl_nfs4.c		optional ufs_acl | zfs
 kern/subr_acl_posix1e.c		optional ufs_acl
 kern/subr_autoconf.c		standard
 kern/subr_blist.c		standard
 kern/subr_bus.c			standard
 kern/subr_bus_dma.c		standard
 kern/subr_bufring.c		standard
 kern/subr_capability.c		standard
 kern/subr_clock.c		standard
 kern/subr_counter.c		standard
 kern/subr_devstat.c		standard
 kern/subr_disk.c		standard
 kern/subr_eventhandler.c	standard
 kern/subr_fattime.c		standard
 kern/subr_firmware.c		optional firmware
 kern/subr_hash.c		standard
 kern/subr_hints.c		standard
 kern/subr_kdb.c			standard
 kern/subr_kobj.c		standard
 kern/subr_lock.c		standard
 kern/subr_log.c			standard
 kern/subr_mbpool.c		optional libmbpool
 kern/subr_mchain.c		optional libmchain
 kern/subr_module.c		standard
 kern/subr_msgbuf.c		standard
 kern/subr_param.c		standard
 kern/subr_pcpu.c		standard
 kern/subr_pctrie.c		standard
 kern/subr_power.c		standard
 kern/subr_prf.c			standard
 kern/subr_prof.c		standard
 kern/subr_rman.c		standard
 kern/subr_rtc.c			standard
 kern/subr_sbuf.c		standard
 kern/subr_scanf.c		standard
 kern/subr_sglist.c		standard
 kern/subr_sleepqueue.c		standard
 kern/subr_smp.c			standard
 kern/subr_stack.c		optional ddb | stack | ktr
 kern/subr_taskqueue.c		standard
 kern/subr_terminal.c		optional vt
 kern/subr_trap.c		standard
 kern/subr_turnstile.c		standard
 kern/subr_uio.c			standard
 kern/subr_unit.c		standard
 kern/subr_vmem.c		standard
 kern/subr_witness.c		optional witness
 kern/sys_capability.c		standard
 kern/sys_generic.c		standard
 kern/sys_pipe.c			standard
 kern/sys_procdesc.c		standard
 kern/sys_process.c		standard
 kern/sys_socket.c		standard
 kern/syscalls.c			standard
 kern/sysv_ipc.c			standard
 kern/sysv_msg.c			optional sysvmsg
 kern/sysv_sem.c			optional sysvsem
 kern/sysv_shm.c			optional sysvshm
 kern/tty.c			standard
 kern/tty_compat.c		optional compat_43tty
 kern/tty_info.c			standard
 kern/tty_inq.c			standard
 kern/tty_outq.c			standard
 kern/tty_pts.c			standard
 kern/tty_tty.c			standard
 kern/tty_ttydisc.c		standard
 kern/uipc_accf.c		standard
 kern/uipc_debug.c		optional ddb
 kern/uipc_domain.c		standard
 kern/uipc_mbuf.c		standard
 kern/uipc_mbuf2.c		standard
 kern/uipc_mqueue.c		optional p1003_1b_mqueue
 kern/uipc_sem.c			optional p1003_1b_semaphores
 kern/uipc_shm.c			standard
 kern/uipc_sockbuf.c		standard
 kern/uipc_socket.c		standard
 kern/uipc_syscalls.c		standard
 kern/uipc_usrreq.c		standard
 kern/vfs_acl.c			standard
 kern/vfs_aio.c			optional vfs_aio
 kern/vfs_bio.c			standard
 kern/vfs_cache.c		standard
 kern/vfs_cluster.c		standard
 kern/vfs_default.c		standard
 kern/vfs_export.c		standard
 kern/vfs_extattr.c		standard
 kern/vfs_hash.c			standard
 kern/vfs_init.c			standard
 kern/vfs_lookup.c		standard
 kern/vfs_mount.c		standard
 kern/vfs_mountroot.c		standard
 kern/vfs_subr.c			standard
 kern/vfs_syscalls.c		standard
 kern/vfs_vnops.c		standard
 #
 # Kernel GSS-API
 #
 gssd.h				optional kgssapi			\
 	dependency		"$S/kgssapi/gssd.x"			\
 	compile-with		"RPCGEN_CPP='${CPP}' rpcgen -hM $S/kgssapi/gssd.x | grep -v pthread.h > gssd.h" \
 	no-obj no-implicit-rule before-depend local			\
 	clean			"gssd.h"
 gssd_xdr.c			optional kgssapi			\
 	dependency		"$S/kgssapi/gssd.x gssd.h"		\
 	compile-with		"RPCGEN_CPP='${CPP}' rpcgen -c $S/kgssapi/gssd.x -o gssd_xdr.c" \
 	no-implicit-rule before-depend local				\
 	clean			"gssd_xdr.c"
 gssd_clnt.c			optional kgssapi			\
 	dependency		"$S/kgssapi/gssd.x gssd.h"		\
 	compile-with		"RPCGEN_CPP='${CPP}' rpcgen -lM $S/kgssapi/gssd.x | grep -v string.h > gssd_clnt.c" \
 	no-implicit-rule before-depend local				\
 	clean			"gssd_clnt.c"
 kgssapi/gss_accept_sec_context.c optional kgssapi
 kgssapi/gss_add_oid_set_member.c optional kgssapi
 kgssapi/gss_acquire_cred.c	optional kgssapi
 kgssapi/gss_canonicalize_name.c	optional kgssapi
 kgssapi/gss_create_empty_oid_set.c optional kgssapi
 kgssapi/gss_delete_sec_context.c optional kgssapi
 kgssapi/gss_display_status.c	optional kgssapi
 kgssapi/gss_export_name.c	optional kgssapi
 kgssapi/gss_get_mic.c		optional kgssapi
 kgssapi/gss_init_sec_context.c	optional kgssapi
 kgssapi/gss_impl.c		optional kgssapi
 kgssapi/gss_import_name.c	optional kgssapi
 kgssapi/gss_names.c		optional kgssapi
 kgssapi/gss_pname_to_uid.c	optional kgssapi
 kgssapi/gss_release_buffer.c	optional kgssapi
 kgssapi/gss_release_cred.c	optional kgssapi
 kgssapi/gss_release_name.c	optional kgssapi
 kgssapi/gss_release_oid_set.c	optional kgssapi
 kgssapi/gss_set_cred_option.c	optional kgssapi
 kgssapi/gss_test_oid_set_member.c optional kgssapi
 kgssapi/gss_unwrap.c		optional kgssapi
 kgssapi/gss_verify_mic.c	optional kgssapi
 kgssapi/gss_wrap.c		optional kgssapi
 kgssapi/gss_wrap_size_limit.c	optional kgssapi
 kgssapi/gssd_prot.c		optional kgssapi
 kgssapi/krb5/krb5_mech.c	optional kgssapi
 kgssapi/krb5/kcrypto.c		optional kgssapi
 kgssapi/krb5/kcrypto_aes.c	optional kgssapi
 kgssapi/krb5/kcrypto_arcfour.c	optional kgssapi
 kgssapi/krb5/kcrypto_des.c	optional kgssapi
 kgssapi/krb5/kcrypto_des3.c	optional kgssapi
 kgssapi/kgss_if.m		optional kgssapi
 kgssapi/gsstest.c		optional kgssapi_debug
 # These files in libkern/ are those needed by all architectures.  Some
 # of the files in libkern/ are only needed on some architectures, e.g.,
 # libkern/divdi3.c is needed by i386 but not alpha.  Also, some of these
 # routines may be optimized for a particular platform.  In either case,
 # the file should be moved to conf/files. from here.
 #
 libkern/arc4random.c		standard
 libkern/bcd.c			standard
 libkern/bsearch.c		standard
 libkern/crc32.c			standard
 libkern/explicit_bzero.c	standard
 libkern/fnmatch.c		standard
 libkern/iconv.c			optional libiconv
 libkern/iconv_converter_if.m	optional libiconv
 libkern/iconv_ucs.c		optional libiconv
 libkern/iconv_xlat.c		optional libiconv
 libkern/iconv_xlat16.c		optional libiconv
 libkern/inet_aton.c		standard
 libkern/inet_ntoa.c		standard
 libkern/inet_ntop.c		standard
 libkern/inet_pton.c		standard
 libkern/jenkins_hash.c		standard
 libkern/murmur3_32.c		standard
 libkern/mcount.c		optional profiling-routine
 libkern/memcchr.c		standard
 libkern/memchr.c		optional fdt | gdb
 libkern/memcmp.c		standard
 libkern/memmem.c		optional gdb
 libkern/qsort.c			standard
 libkern/qsort_r.c		standard
 libkern/random.c		standard
 libkern/scanc.c			standard
 libkern/strcasecmp.c		standard
 libkern/strcat.c		standard
 libkern/strchr.c		standard
 libkern/strcmp.c		standard
 libkern/strcpy.c		standard
 libkern/strcspn.c		standard
 libkern/strdup.c		standard
 libkern/strndup.c		standard
 libkern/strlcat.c		standard
 libkern/strlcpy.c		standard
 libkern/strlen.c		standard
 libkern/strncmp.c		standard
 libkern/strncpy.c		standard
 libkern/strnlen.c		standard
 libkern/strrchr.c		standard
 libkern/strsep.c		standard
 libkern/strspn.c		standard
 libkern/strstr.c		standard
 libkern/strtol.c		standard
 libkern/strtoq.c		standard
 libkern/strtoul.c		standard
 libkern/strtouq.c		standard
 libkern/strvalid.c		standard
 libkern/timingsafe_bcmp.c	standard
 net/bpf.c			standard
 net/bpf_buffer.c		optional bpf
 net/bpf_jitter.c		optional bpf_jitter
 net/bpf_filter.c		optional bpf | netgraph_bpf
 net/bpf_zerocopy.c		optional bpf
 net/bridgestp.c			optional bridge | if_bridge
 net/flowtable.c			optional flowtable inet | flowtable inet6
 net/ieee8023ad_lacp.c		optional lagg
 net/if.c			standard
 net/if_arcsubr.c		optional arcnet
 net/if_atmsubr.c		optional atm
 net/if_bridge.c			optional bridge inet | if_bridge inet
 net/if_clone.c			standard
 net/if_dead.c			standard
 net/if_debug.c			optional ddb
 net/if_disc.c			optional disc
 net/if_edsc.c			optional edsc
 net/if_enc.c			optional enc ipsec inet | enc ipsec inet6
 net/if_epair.c			optional epair
 net/if_ethersubr.c		optional ether
 net/if_fddisubr.c		optional fddi
 net/if_fwsubr.c			optional fwip
 net/if_gif.c			optional gif inet | gif inet6 | \
 					 netgraph_gif inet | netgraph_gif inet6
 net/if_gre.c			optional gre inet | gre inet6
 net/if_iso88025subr.c		optional token
 net/if_lagg.c			optional lagg
 net/if_loop.c			optional loop
 net/if_llatbl.c			standard
 net/if_me.c			optional me inet
 net/if_media.c			standard
 net/if_mib.c			standard
 net/if_spppfr.c			optional sppp | netgraph_sppp
 net/if_spppsubr.c		optional sppp | netgraph_sppp
 net/if_stf.c			optional stf inet inet6
 net/if_tun.c			optional tun
 net/if_tap.c			optional tap
 net/if_vlan.c			optional vlan
 net/if_vxlan.c			optional vxlan inet | vxlan inet6
 net/mppcc.c			optional netgraph_mppc_compression
 net/mppcd.c			optional netgraph_mppc_compression
 net/netisr.c			standard
 net/pfil.c			optional ether | inet
 net/radix.c			standard
 net/radix_mpath.c		standard
 net/raw_cb.c			standard
 net/raw_usrreq.c		standard
 net/route.c			standard
 net/rtsock.c			standard
 net/slcompress.c		optional netgraph_vjc | sppp | \
 					 netgraph_sppp
 net/vnet.c			optional vimage
 net/zlib.c			optional crypto | geom_uzip | ipsec | \
 					 mxge | netgraph_deflate | \
 					 ddb_ctf | gzio | geom_uncompress
 net80211/ieee80211.c		optional wlan
 net80211/ieee80211_acl.c	optional wlan wlan_acl
 net80211/ieee80211_action.c	optional wlan
 net80211/ieee80211_ageq.c	optional wlan
 net80211/ieee80211_adhoc.c	optional wlan \
 	compile-with "${NORMAL_C} -Wno-unused-function"
 net80211/ieee80211_ageq.c	optional wlan
 net80211/ieee80211_amrr.c	optional wlan | wlan_amrr
 net80211/ieee80211_crypto.c	optional wlan \
 	compile-with "${NORMAL_C} -Wno-unused-function"
 net80211/ieee80211_crypto_ccmp.c optional wlan wlan_ccmp
 net80211/ieee80211_crypto_none.c optional wlan
 net80211/ieee80211_crypto_tkip.c optional wlan wlan_tkip
 net80211/ieee80211_crypto_wep.c	optional wlan wlan_wep
 net80211/ieee80211_ddb.c	optional wlan ddb
 net80211/ieee80211_dfs.c	optional wlan
 net80211/ieee80211_freebsd.c	optional wlan
 net80211/ieee80211_hostap.c	optional wlan \
 	compile-with "${NORMAL_C} -Wno-unused-function"
 net80211/ieee80211_ht.c		optional wlan
 net80211/ieee80211_hwmp.c	optional wlan ieee80211_support_mesh
 net80211/ieee80211_input.c	optional wlan
 net80211/ieee80211_ioctl.c	optional wlan
 net80211/ieee80211_mesh.c	optional wlan ieee80211_support_mesh \
 	compile-with "${NORMAL_C} -Wno-unused-function"
 net80211/ieee80211_monitor.c	optional wlan
 net80211/ieee80211_node.c	optional wlan
 net80211/ieee80211_output.c	optional wlan
 net80211/ieee80211_phy.c	optional wlan
 net80211/ieee80211_power.c	optional wlan
 net80211/ieee80211_proto.c	optional wlan
 net80211/ieee80211_radiotap.c	optional wlan
 net80211/ieee80211_ratectl.c	optional wlan
 net80211/ieee80211_ratectl_none.c optional wlan
 net80211/ieee80211_regdomain.c	optional wlan
 net80211/ieee80211_rssadapt.c	optional wlan wlan_rssadapt
 net80211/ieee80211_scan.c	optional wlan
 net80211/ieee80211_scan_sta.c	optional wlan
 net80211/ieee80211_sta.c	optional wlan \
 	compile-with "${NORMAL_C} -Wno-unused-function"
 net80211/ieee80211_superg.c	optional wlan ieee80211_support_superg
 net80211/ieee80211_tdma.c	optional wlan ieee80211_support_tdma
 net80211/ieee80211_wds.c	optional wlan
 net80211/ieee80211_xauth.c	optional wlan wlan_xauth
 net80211/ieee80211_alq.c	optional wlan ieee80211_alq
 netgraph/atm/ccatm/ng_ccatm.c	optional ngatm_ccatm \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 netgraph/atm/ng_atm.c		optional ngatm_atm
 netgraph/atm/ngatmbase.c	optional ngatm_atmbase \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 netgraph/atm/sscfu/ng_sscfu.c	optional ngatm_sscfu \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 netgraph/atm/sscop/ng_sscop.c optional ngatm_sscop \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 netgraph/atm/uni/ng_uni.c	optional ngatm_uni \
 	compile-with "${NORMAL_C} -I$S/contrib/ngatm"
 netgraph/bluetooth/common/ng_bluetooth.c optional netgraph_bluetooth
 netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c optional netgraph_bluetooth_bt3c
 netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4
 netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb
 netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c optional netgraph_bluetooth_ubtbcmfw usb
 netgraph/bluetooth/hci/ng_hci_cmds.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/hci/ng_hci_evnt.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/hci/ng_hci_main.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/hci/ng_hci_misc.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/hci/ng_hci_ulpi.c optional netgraph_bluetooth_hci
 netgraph/bluetooth/l2cap/ng_l2cap_cmds.c optional netgraph_bluetooth_l2cap
 netgraph/bluetooth/l2cap/ng_l2cap_evnt.c optional netgraph_bluetooth_l2cap
 netgraph/bluetooth/l2cap/ng_l2cap_llpi.c optional netgraph_bluetooth_l2cap
 netgraph/bluetooth/l2cap/ng_l2cap_main.c optional netgraph_bluetooth_l2cap
 netgraph/bluetooth/l2cap/ng_l2cap_misc.c optional netgraph_bluetooth_l2cap
 netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c optional netgraph_bluetooth_l2cap
 netgraph/bluetooth/socket/ng_btsocket.c optional netgraph_bluetooth_socket
 netgraph/bluetooth/socket/ng_btsocket_hci_raw.c	optional netgraph_bluetooth_socket
 netgraph/bluetooth/socket/ng_btsocket_l2cap.c optional netgraph_bluetooth_socket
 netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c optional netgraph_bluetooth_socket
 netgraph/bluetooth/socket/ng_btsocket_rfcomm.c optional netgraph_bluetooth_socket
 netgraph/bluetooth/socket/ng_btsocket_sco.c optional netgraph_bluetooth_socket
 netgraph/netflow/netflow.c	optional netgraph_netflow
 netgraph/netflow/netflow_v9.c	optional netgraph_netflow
 netgraph/netflow/ng_netflow.c	optional netgraph_netflow
 netgraph/ng_UI.c		optional netgraph_UI
 netgraph/ng_async.c		optional netgraph_async
 netgraph/ng_atmllc.c		optional netgraph_atmllc
 netgraph/ng_base.c		optional netgraph
 netgraph/ng_bpf.c		optional netgraph_bpf
 netgraph/ng_bridge.c		optional netgraph_bridge
 netgraph/ng_car.c		optional netgraph_car
 netgraph/ng_cisco.c		optional netgraph_cisco
 netgraph/ng_deflate.c		optional netgraph_deflate
 netgraph/ng_device.c		optional netgraph_device
 netgraph/ng_echo.c		optional netgraph_echo
 netgraph/ng_eiface.c		optional netgraph_eiface
 netgraph/ng_ether.c		optional netgraph_ether
 netgraph/ng_ether_echo.c	optional netgraph_ether_echo
 netgraph/ng_frame_relay.c	optional netgraph_frame_relay
 netgraph/ng_gif.c		optional netgraph_gif inet6 | netgraph_gif inet
 netgraph/ng_gif_demux.c		optional netgraph_gif_demux
 netgraph/ng_hole.c		optional netgraph_hole
 netgraph/ng_iface.c		optional netgraph_iface
 netgraph/ng_ip_input.c		optional netgraph_ip_input
 netgraph/ng_ipfw.c		optional netgraph_ipfw inet ipfirewall
 netgraph/ng_ksocket.c		optional netgraph_ksocket
 netgraph/ng_l2tp.c		optional netgraph_l2tp
 netgraph/ng_lmi.c		optional netgraph_lmi
 netgraph/ng_mppc.c		optional netgraph_mppc_compression | \
 					 netgraph_mppc_encryption
 netgraph/ng_nat.c		optional netgraph_nat inet libalias
 netgraph/ng_one2many.c		optional netgraph_one2many
 netgraph/ng_parse.c		optional netgraph
 netgraph/ng_patch.c		optional netgraph_patch
 netgraph/ng_pipe.c		optional netgraph_pipe
 netgraph/ng_ppp.c		optional netgraph_ppp
 netgraph/ng_pppoe.c		optional netgraph_pppoe
 netgraph/ng_pptpgre.c		optional netgraph_pptpgre
 netgraph/ng_pred1.c		optional netgraph_pred1
 netgraph/ng_rfc1490.c		optional netgraph_rfc1490
 netgraph/ng_socket.c		optional netgraph_socket
 netgraph/ng_split.c		optional netgraph_split
 netgraph/ng_sppp.c		optional netgraph_sppp
 netgraph/ng_tag.c		optional netgraph_tag
 netgraph/ng_tcpmss.c		optional netgraph_tcpmss
 netgraph/ng_tee.c		optional netgraph_tee
 netgraph/ng_tty.c		optional netgraph_tty
 netgraph/ng_vjc.c		optional netgraph_vjc
 netgraph/ng_vlan.c		optional netgraph_vlan
 netinet/accf_data.c		optional accept_filter_data inet
 netinet/accf_dns.c		optional accept_filter_dns inet
 netinet/accf_http.c		optional accept_filter_http inet
 netinet/if_atm.c		optional atm
 netinet/if_ether.c		optional inet ether
 netinet/igmp.c			optional inet
 netinet/in.c			optional inet
 netinet/in_debug.c		optional inet ddb
 netinet/in_kdtrace.c		optional inet | inet6
 netinet/ip_carp.c		optional inet carp | inet6 carp
 netinet/in_gif.c		optional gif inet | netgraph_gif inet
 netinet/ip_gre.c		optional gre inet
 netinet/ip_id.c			optional inet
 netinet/in_mcast.c		optional inet
 netinet/in_pcb.c		optional inet | inet6
 netinet/in_pcbgroup.c		optional inet pcbgroup | inet6 pcbgroup
 netinet/in_proto.c		optional inet | inet6
 netinet/in_rmx.c		optional inet
 netinet/in_rss.c		optional inet rss | inet6 rss
 netinet/ip_divert.c		optional inet ipdivert ipfirewall
 netinet/ip_ecn.c		optional inet | inet6
 netinet/ip_encap.c		optional inet | inet6
 netinet/ip_fastfwd.c		optional inet
 netinet/ip_icmp.c		optional inet | inet6
 netinet/ip_input.c		optional inet
 netinet/ip_ipsec.c		optional inet ipsec
 netinet/ip_mroute.c		optional mrouting inet
 netinet/ip_options.c		optional inet
 netinet/ip_output.c		optional inet
 netinet/raw_ip.c		optional inet | inet6
 netinet/cc/cc.c			optional inet | inet6
 netinet/cc/cc_newreno.c		optional inet | inet6
 netinet/sctp_asconf.c		optional inet sctp | inet6 sctp
 netinet/sctp_auth.c		optional inet sctp | inet6 sctp
 netinet/sctp_bsd_addr.c		optional inet sctp | inet6 sctp
 netinet/sctp_cc_functions.c	optional inet sctp | inet6 sctp
 netinet/sctp_crc32.c		optional inet sctp | inet6 sctp
 netinet/sctp_indata.c		optional inet sctp | inet6 sctp
 netinet/sctp_input.c		optional inet sctp | inet6 sctp
 netinet/sctp_output.c		optional inet sctp | inet6 sctp
 netinet/sctp_pcb.c		optional inet sctp | inet6 sctp
 netinet/sctp_peeloff.c		optional inet sctp | inet6 sctp
 netinet/sctp_ss_functions.c	optional inet sctp | inet6 sctp
 netinet/sctp_syscalls.c		optional inet sctp | inet6 sctp
 netinet/sctp_sysctl.c		optional inet sctp | inet6 sctp
 netinet/sctp_timer.c		optional inet sctp | inet6 sctp
 netinet/sctp_usrreq.c		optional inet sctp | inet6 sctp
 netinet/sctputil.c		optional inet sctp | inet6 sctp
 netinet/tcp_debug.c		optional tcpdebug
 netinet/tcp_hostcache.c		optional inet | inet6
 netinet/tcp_input.c		optional inet | inet6
 netinet/tcp_lro.c		optional inet | inet6
 netinet/tcp_output.c		optional inet | inet6
 netinet/tcp_offload.c		optional tcp_offload inet | tcp_offload inet6
 netinet/tcp_reass.c		optional inet | inet6
 netinet/tcp_sack.c		optional inet | inet6
 netinet/tcp_subr.c		optional inet | inet6
 netinet/tcp_syncache.c		optional inet | inet6
 netinet/tcp_timer.c		optional inet | inet6
 netinet/tcp_timewait.c		optional inet | inet6
 netinet/tcp_usrreq.c		optional inet | inet6
 netinet/toeplitz.c		optional inet rss | inet6 rss
 netinet/udp_usrreq.c		optional inet | inet6
 netinet/libalias/alias.c	optional libalias inet | netgraph_nat inet
 netinet/libalias/alias_db.c	optional libalias inet | netgraph_nat inet
 netinet/libalias/alias_mod.c	optional libalias | netgraph_nat
 netinet/libalias/alias_proxy.c	optional libalias inet | netgraph_nat inet
 netinet/libalias/alias_util.c	optional libalias inet | netgraph_nat inet
 netinet/libalias/alias_sctp.c	optional libalias inet | netgraph_nat inet
 netinet6/dest6.c		optional inet6
 netinet6/frag6.c		optional inet6
 netinet6/icmp6.c		optional inet6
 netinet6/in6.c			optional inet6
 netinet6/in6_cksum.c		optional inet6
 netinet6/in6_gif.c		optional gif inet6 | netgraph_gif inet6
 netinet6/in6_ifattach.c		optional inet6
 netinet6/in6_mcast.c		optional inet6
 netinet6/in6_pcb.c		optional inet6
 netinet6/in6_pcbgroup.c		optional inet6 pcbgroup
 netinet6/in6_proto.c		optional inet6
 netinet6/in6_rmx.c		optional inet6
 netinet6/in6_src.c		optional inet6
 netinet6/ip6_forward.c		optional inet6
 netinet6/ip6_gre.c		optional gre inet6
 netinet6/ip6_id.c		optional inet6
 netinet6/ip6_input.c		optional inet6
 netinet6/ip6_mroute.c		optional mrouting inet6
 netinet6/ip6_output.c		optional inet6
 netinet6/ip6_ipsec.c		optional inet6 ipsec
 netinet6/mld6.c			optional inet6
 netinet6/nd6.c			optional inet6
 netinet6/nd6_nbr.c		optional inet6
 netinet6/nd6_rtr.c		optional inet6
 netinet6/raw_ip6.c		optional inet6
 netinet6/route6.c		optional inet6
 netinet6/scope6.c		optional inet6
 netinet6/sctp6_usrreq.c		optional inet6 sctp
 netinet6/udp6_usrreq.c		optional inet6
 netipsec/ipsec.c		optional ipsec inet | ipsec inet6
 netipsec/ipsec_input.c		optional ipsec inet | ipsec inet6
 netipsec/ipsec_mbuf.c		optional ipsec inet | ipsec inet6
 netipsec/ipsec_output.c		optional ipsec inet | ipsec inet6
 netipsec/key.c			optional ipsec inet | ipsec inet6
 netipsec/key_debug.c		optional ipsec inet | ipsec inet6
 netipsec/keysock.c		optional ipsec inet | ipsec inet6
 netipsec/xform_ah.c		optional ipsec inet | ipsec inet6
 netipsec/xform_esp.c		optional ipsec inet | ipsec inet6
 netipsec/xform_ipcomp.c		optional ipsec inet | ipsec inet6
 netipsec/xform_ipip.c		optional ipsec inet | ipsec inet6
 netipsec/xform_tcp.c		optional ipsec inet tcp_signature | \
 					 ipsec inet6 tcp_signature
 netnatm/natm.c			optional natm
 netnatm/natm_pcb.c		optional natm
 netnatm/natm_proto.c		optional natm
 netpfil/ipfw/dn_heap.c		optional inet dummynet
 netpfil/ipfw/dn_sched_fifo.c	optional inet dummynet
 netpfil/ipfw/dn_sched_prio.c	optional inet dummynet
 netpfil/ipfw/dn_sched_qfq.c	optional inet dummynet
 netpfil/ipfw/dn_sched_rr.c	optional inet dummynet
 netpfil/ipfw/dn_sched_wf2q.c	optional inet dummynet
 netpfil/ipfw/ip_dummynet.c	optional inet dummynet
 netpfil/ipfw/ip_dn_io.c		optional inet dummynet
 netpfil/ipfw/ip_dn_glue.c	optional inet dummynet
 netpfil/ipfw/ip_fw2.c		optional inet ipfirewall
 netpfil/ipfw/ip_fw_dynamic.c	optional inet ipfirewall
 netpfil/ipfw/ip_fw_log.c	optional inet ipfirewall
 netpfil/ipfw/ip_fw_pfil.c	optional inet ipfirewall
 netpfil/ipfw/ip_fw_sockopt.c	optional inet ipfirewall
 netpfil/ipfw/ip_fw_table.c	optional inet ipfirewall
 netpfil/ipfw/ip_fw_table_algo.c	optional inet ipfirewall
 netpfil/ipfw/ip_fw_table_value.c	optional inet ipfirewall
 netpfil/ipfw/ip_fw_iface.c	optional inet ipfirewall
 netpfil/ipfw/ip_fw_nat.c	optional inet ipfirewall_nat
 netpfil/pf/if_pflog.c		optional pflog pf inet
 netpfil/pf/if_pfsync.c		optional pfsync pf inet
 netpfil/pf/pf.c			optional pf inet
 netpfil/pf/pf_if.c		optional pf inet
 netpfil/pf/pf_ioctl.c		optional pf inet
 netpfil/pf/pf_lb.c		optional pf inet
 netpfil/pf/pf_norm.c		optional pf inet
 netpfil/pf/pf_osfp.c		optional pf inet
 netpfil/pf/pf_ruleset.c		optional pf inet
 netpfil/pf/pf_table.c		optional pf inet
 netpfil/pf/in4_cksum.c		optional pf inet
 netsmb/smb_conn.c		optional netsmb
 netsmb/smb_crypt.c		optional netsmb
 netsmb/smb_dev.c		optional netsmb
 netsmb/smb_iod.c		optional netsmb
 netsmb/smb_rq.c			optional netsmb
 netsmb/smb_smb.c		optional netsmb
 netsmb/smb_subr.c		optional netsmb
 netsmb/smb_trantcp.c		optional netsmb
 netsmb/smb_usr.c		optional netsmb
 nfs/bootp_subr.c		optional bootp nfscl
 nfs/krpc_subr.c			optional bootp nfscl
 nfs/nfs_diskless.c		optional nfscl nfs_root
 nfs/nfs_fha.c			optional nfsd
 nfs/nfs_lock.c			optional nfscl | nfslockd | nfsd
 nfs/nfs_nfssvc.c		optional nfscl | nfsd
 nlm/nlm_advlock.c		optional nfslockd | nfsd
 nlm/nlm_prot_clnt.c		optional nfslockd | nfsd
 nlm/nlm_prot_impl.c		optional nfslockd | nfsd
 nlm/nlm_prot_server.c		optional nfslockd | nfsd
 nlm/nlm_prot_svc.c		optional nfslockd | nfsd
 nlm/nlm_prot_xdr.c		optional nfslockd | nfsd
 nlm/sm_inter_xdr.c		optional nfslockd | nfsd
 
 # OpenFabrics Enterprise Distribution (Infiniband)
 ofed/include/linux/linux_compat.c		optional ofed		\
 	no-depend compile-with "${OFED_C}"
 ofed/include/linux/linux_idr.c			optional ofed		\
 	no-depend compile-with "${OFED_C}"
 ofed/include/linux/linux_radix.c		optional ofed		\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/core/addr.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/agent.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/cache.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 # XXX Mad.c must be ordered before cm.c for sysinit sets to occur in
 # the correct order.
 ofed/drivers/infiniband/core/mad.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/cm.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/ -Wno-unused-function"
 ofed/drivers/infiniband/core/cma.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/device.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/fmr_pool.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/iwcm.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/local_sa.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/mad_rmpp.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/multicast.c	optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/notice.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/packer.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/sa_query.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/smi.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/sysfs.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/ucm.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/ucma.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/ud_header.c	optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/umem.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/user_mad.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/uverbs_cmd.c	optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/uverbs_main.c	optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/uverbs_marshall.c	optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 ofed/drivers/infiniband/core/verbs.c		optional ofed		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/core/"
 
 ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c	optional ipoib		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
 #ofed/drivers/infiniband/ulp/ipoib/ipoib_fs.c	optional ipoib		\
 #	no-depend							\
 #	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
 ofed/drivers/infiniband/ulp/ipoib/ipoib_ib.c	optional ipoib		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
 ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c	optional ipoib		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
 ofed/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	optional ipoib	\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
 ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c	optional ipoib		\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
 #ofed/drivers/infiniband/ulp/ipoib/ipoib_vlan.c	optional ipoib		\
 #	no-depend							\
 #	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/"
 
 ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c	optional sdp inet	\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
 ofed/drivers/infiniband/ulp/sdp/sdp_main.c	optional sdp inet 	\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
 ofed/drivers/infiniband/ulp/sdp/sdp_rx.c	optional sdp inet 	\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
 ofed/drivers/infiniband/ulp/sdp/sdp_cma.c	optional sdp inet 	\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
 ofed/drivers/infiniband/ulp/sdp/sdp_tx.c	optional sdp inet 	\
 	no-depend							\
 	compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/"
 
 ofed/drivers/infiniband/hw/mlx4/alias_GUID.c    optional mlx4ib         \
         no-depend obj-prefix "mlx4ib_"                                  \
         compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/mcg.c           optional mlx4ib         \
         no-depend obj-prefix "mlx4ib_"                                  \
         compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/sysfs.c         optional mlx4ib         \
         no-depend obj-prefix "mlx4ib_"                                  \
         compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/cm.c            optional mlx4ib         \
         no-depend obj-prefix "mlx4ib_"                                  \
         compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/ah.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/cq.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/doorbell.c	optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/mad.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/main.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/mr.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/qp.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/srq.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 ofed/drivers/infiniband/hw/mlx4/wc.c		optional mlx4ib		\
 	no-depend obj-prefix "mlx4ib_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/"
 
 ofed/drivers/net/mlx4/alloc.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/catas.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/cmd.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/cq.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/eq.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/fw.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/icm.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/intf.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/main.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/mcg.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/ -Wno-unused"
 ofed/drivers/net/mlx4/mr.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/pd.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/port.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/profile.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/qp.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/reset.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/sense.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/srq.c			optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/resource_tracker.c        optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/sys_tune.c		optional mlx4ib | mlxen	\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 
 ofed/drivers/net/mlx4/en_cq.c			optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/utils.c			optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/en_main.c			optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/en_netdev.c		optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/en_port.c			optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/en_resources.c		optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/en_rx.c			optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 ofed/drivers/net/mlx4/en_tx.c			optional mlxen		\
 	no-depend obj-prefix "mlx4_"					\
 	compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/"
 
 ofed/drivers/infiniband/hw/mthca/mthca_allocator.c	optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_av.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_catas.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_cmd.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_cq.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_eq.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_mad.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_main.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_mcg.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_memfree.c	optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_mr.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_pd.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_profile.c	optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_provider.c	optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_qp.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_reset.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_srq.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 ofed/drivers/infiniband/hw/mthca/mthca_uar.c		optional mthca	\
 	no-depend compile-with "${OFED_C}"
 
 # crypto support
 opencrypto/cast.c		optional crypto | ipsec
 opencrypto/criov.c		optional crypto
 opencrypto/crypto.c		optional crypto
 opencrypto/cryptodev.c		optional cryptodev
 opencrypto/cryptodev_if.m	optional crypto
 opencrypto/cryptosoft.c		optional crypto
 opencrypto/cryptodeflate.c	optional crypto
 opencrypto/gmac.c		optional crypto
 opencrypto/gfmult.c		optional crypto
 opencrypto/rmd160.c		optional crypto | ipsec
 opencrypto/skipjack.c		optional crypto
 opencrypto/xform.c		optional crypto
 rpc/auth_none.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/auth_unix.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/authunix_prot.c		optional krpc | nfslockd | nfscl | nfsd
 rpc/clnt_bck.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/clnt_dg.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/clnt_rc.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/clnt_vc.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/getnetconfig.c		optional krpc | nfslockd | nfscl | nfsd
 rpc/replay.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/rpc_callmsg.c		optional krpc | nfslockd | nfscl | nfsd
 rpc/rpc_generic.c		optional krpc | nfslockd | nfscl | nfsd
 rpc/rpc_prot.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/rpcb_clnt.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/rpcb_prot.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/svc.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/svc_auth.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/svc_auth_unix.c		optional krpc | nfslockd | nfscl | nfsd
 rpc/svc_dg.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/svc_generic.c		optional krpc | nfslockd | nfscl | nfsd
 rpc/svc_vc.c			optional krpc | nfslockd | nfscl | nfsd
 rpc/rpcsec_gss/rpcsec_gss.c	optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
 rpc/rpcsec_gss/rpcsec_gss_conf.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
 rpc/rpcsec_gss/rpcsec_gss_misc.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
 rpc/rpcsec_gss/rpcsec_gss_prot.c optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
 rpc/rpcsec_gss/svc_rpcsec_gss.c	optional krpc kgssapi | nfslockd kgssapi | nfscl kgssapi | nfsd kgssapi
 security/audit/audit.c		optional audit
 security/audit/audit_arg.c	optional audit
 security/audit/audit_bsm.c	optional audit
 security/audit/audit_bsm_klib.c	optional audit
 security/audit/audit_pipe.c	optional audit
 security/audit/audit_syscalls.c	standard
 security/audit/audit_trigger.c	optional audit
 security/audit/audit_worker.c	optional audit
 security/audit/bsm_domain.c	optional audit
 security/audit/bsm_errno.c	optional audit
 security/audit/bsm_fcntl.c	optional audit
 security/audit/bsm_socket_type.c	optional audit
 security/audit/bsm_token.c	optional audit
 security/mac/mac_audit.c	optional mac audit
 security/mac/mac_cred.c		optional mac
 security/mac/mac_framework.c	optional mac
 security/mac/mac_inet.c		optional mac inet | mac inet6
 security/mac/mac_inet6.c	optional mac inet6
 security/mac/mac_label.c	optional mac
 security/mac/mac_net.c		optional mac
 security/mac/mac_pipe.c		optional mac
 security/mac/mac_posix_sem.c	optional mac
 security/mac/mac_posix_shm.c	optional mac
 security/mac/mac_priv.c		optional mac
 security/mac/mac_process.c	optional mac
 security/mac/mac_socket.c	optional mac
 security/mac/mac_syscalls.c	standard
 security/mac/mac_system.c	optional mac
 security/mac/mac_sysv_msg.c	optional mac
 security/mac/mac_sysv_sem.c	optional mac
 security/mac/mac_sysv_shm.c	optional mac
 security/mac/mac_vfs.c		optional mac
 security/mac_biba/mac_biba.c	optional mac_biba
 security/mac_bsdextended/mac_bsdextended.c	optional mac_bsdextended
 security/mac_bsdextended/ugidfw_system.c	optional mac_bsdextended
 security/mac_bsdextended/ugidfw_vnode.c		optional mac_bsdextended
 security/mac_ifoff/mac_ifoff.c	optional mac_ifoff
 security/mac_lomac/mac_lomac.c	optional mac_lomac
 security/mac_mls/mac_mls.c	optional mac_mls
 security/mac_none/mac_none.c	optional mac_none
 security/mac_partition/mac_partition.c optional mac_partition
 security/mac_portacl/mac_portacl.c optional mac_portacl
 security/mac_seeotheruids/mac_seeotheruids.c optional mac_seeotheruids
 security/mac_stub/mac_stub.c	optional mac_stub
 security/mac_test/mac_test.c	optional mac_test
 teken/teken.c			optional sc | vt
 ufs/ffs/ffs_alloc.c		optional ffs
 ufs/ffs/ffs_balloc.c		optional ffs
 ufs/ffs/ffs_inode.c		optional ffs
 ufs/ffs/ffs_snapshot.c		optional ffs
 ufs/ffs/ffs_softdep.c		optional ffs
 ufs/ffs/ffs_subr.c		optional ffs
 ufs/ffs/ffs_tables.c		optional ffs
 ufs/ffs/ffs_vfsops.c		optional ffs
 ufs/ffs/ffs_vnops.c		optional ffs
 ufs/ffs/ffs_rawread.c		optional ffs directio
 ufs/ffs/ffs_suspend.c		optional ffs
 ufs/ufs/ufs_acl.c		optional ffs
 ufs/ufs/ufs_bmap.c		optional ffs
 ufs/ufs/ufs_dirhash.c		optional ffs
 ufs/ufs/ufs_extattr.c		optional ffs
 ufs/ufs/ufs_gjournal.c		optional ffs UFS_GJOURNAL
 ufs/ufs/ufs_inode.c		optional ffs
 ufs/ufs/ufs_lookup.c		optional ffs
 ufs/ufs/ufs_quota.c		optional ffs
 ufs/ufs/ufs_vfsops.c		optional ffs
 ufs/ufs/ufs_vnops.c		optional ffs
 vm/default_pager.c		standard
 vm/device_pager.c		standard
 vm/phys_pager.c			standard
 vm/redzone.c			optional DEBUG_REDZONE
 vm/sg_pager.c			standard
 vm/swap_pager.c			standard
 vm/uma_core.c			standard
 vm/uma_dbg.c			standard
 vm/memguard.c			optional DEBUG_MEMGUARD
 vm/vm_fault.c			standard
 vm/vm_glue.c			standard
 vm/vm_init.c			standard
 vm/vm_kern.c			standard
 vm/vm_map.c			standard
 vm/vm_meter.c			standard
 vm/vm_mmap.c			standard
 vm/vm_object.c			standard
 vm/vm_page.c			standard
 vm/vm_pageout.c			standard
 vm/vm_pager.c			standard
 vm/vm_phys.c			standard
 vm/vm_radix.c			standard
 vm/vm_reserv.c			standard
 vm/vm_unix.c			standard
 vm/vm_zeroidle.c		standard
 vm/vnode_pager.c		standard
 xen/features.c			optional xen | xenhvm
 xen/xenbus/xenbus_if.m		optional xen | xenhvm
 xen/xenbus/xenbus.c		optional xen | xenhvm
 xen/xenbus/xenbusb_if.m		optional xen | xenhvm
 xen/xenbus/xenbusb.c		optional xen | xenhvm
 xen/xenbus/xenbusb_front.c	optional xen | xenhvm
 xen/xenbus/xenbusb_back.c	optional xen | xenhvm
 xdr/xdr.c			optional krpc | nfslockd | nfscl | nfsd
 xdr/xdr_array.c			optional krpc | nfslockd | nfscl | nfsd
 xdr/xdr_mbuf.c			optional krpc | nfslockd | nfscl | nfsd
 xdr/xdr_mem.c			optional krpc | nfslockd | nfscl | nfsd
 xdr/xdr_reference.c		optional krpc | nfslockd | nfscl | nfsd
 xdr/xdr_sizeof.c		optional krpc | nfslockd | nfscl | nfsd
Index: projects/arm_intrng/sys/conf
===================================================================
--- projects/arm_intrng/sys/conf	(revision 276247)
+++ projects/arm_intrng/sys/conf	(revision 276248)

Property changes on: projects/arm_intrng/sys/conf
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head/sys/conf:r276183-276247
Index: projects/arm_intrng/sys/dev/ieee488/tnt4882.c
===================================================================
--- projects/arm_intrng/sys/dev/ieee488/tnt4882.c	(revision 276247)
+++ projects/arm_intrng/sys/dev/ieee488/tnt4882.c	(nonexistent)
@@ -1,320 +0,0 @@
-/*-
- * Copyright (c) 2005 Poul-Henning Kamp
- * Copyright (c) 2010 Joerg Wunsch
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-/* vtophys */
-#include 
-#include 
-#include 
-
-#define UPD7210_HW_DRIVER 1
-#include 
-#include 
-
-struct tnt_softc {
-	int foo;
-	struct upd7210		upd7210;
-
-	struct resource		*res[3];
-	void			*intr_handler;
-};
-
-static struct resource_spec tnt_res_spec[] = {
-	{ SYS_RES_MEMORY,	PCIR_BAR(0),	RF_ACTIVE},
-	{ SYS_RES_MEMORY,	PCIR_BAR(1),	RF_ACTIVE},
-	{ SYS_RES_IRQ,		0,		RF_ACTIVE | RF_SHAREABLE},
-	{ -1, 0 }
-};
-
-struct tst {
-	enum {RD, WT, xDELAY, END}
-				action;
-	enum tnt4882reg 	reg;
-	uint8_t			val;
-};
-
-/*
- * From NI Application note 095:
- *   Writing Functional Self-Tests for the TNT4882 GPIB Interface Chip
- * XXX: fill in the rest ?
- */
-static struct tst tst_reset[] = {
-	{WT, tauxcr, 0x80},	/* chip reset if in 9914 mode */
-	{WT, auxmr, 0x80},	/* swrst if swapped */ 
-	{WT, tauxcr, 0x99},	/* switch to 7210 mode */
-	{WT, auxmr, 0x99},	/* switch to 7210 mode if swapped */ 
-	{WT, auxmr, 0x02},	/* execute chip reset */
-	{WT, keyreg, 0x00},	/* important! clear the swap bit */
-	{WT, eosr, 0x00},	/* clear EOS register */
-	{WT, cdor, 0x00},	/* clear data lines */
-	{WT, imr1, 0x00},	/* disable all interrupts */
-	{WT, imr2, 0x00},
-	{WT, imr0, 0x80},
-	{WT, adr, 0x80},
-	{WT, adr, 0x00},
-	{WT, admr, 0x00},	/* clear addressing modes */
-	{WT, auxmr, 0x00},	/* release from idle state with pon */
-	{WT, auxmr, 0x60},	/* reset ppr */
-	{WT, bcr, 0x00},	/* reset bcr */
-	{WT, misc, 0x04},	/* set wrap plug bit */
-	{WT, cmdr, 0xB2},	/* issue soft reset */
-	{WT, hssel, 0x00},	/* select two-chip mode */
-	{END, 0, 0}
-};
-
-static struct tst tst_read_reg[] = {
-	{RD, isr1, 0x00},	/* Verify mask registers are clear */
-	{RD, isr2, 0x00},
-	{RD, adsr, 0x40},	/* Verify ATN is not asserted */
-	{RD, adr0, 0x00},	/* Verify Primary address not set */
-	{RD, adr1, 0x00},	/* Verify Secondary address not set */
-	{RD, sts1, 0x8B},	/* Verify DONE, STOP, HALT, and GSYNC set */
-	{RD, isr3, 0x19},	/* Verify STOP, Not Full FIFO, & DONE set */
-	{RD, sts2, 0x9A},	/* Verify FIFO A/B is empty */
-	{RD, sasr, 0x00},	/* Verify clear */
-	{RD, isr0, 0x01},	/* Verify SYNC bit is set */
-	{END, 0, 0}
-};
-
-static struct tst tst_bsr_dcr[] = {
-	{WT, bcr, 0x55},	/* Set DAV, NRFD, SRQ, and REN */
-	{WT, dcr, 0xAA},	/* Write pattern to GPIB data lines */
-	{RD, bsr, 0x55},	/* Verify DAV, NRFD, SRQ, and REN are set */
-	{RD, dsr, 0xAA},	/* Verify data pattern written previously */
-	{WT, bcr, 0xAA},	/* Set ATN, NDAC, EOI, & IFC */
-	{WT, dcr, 0x55},	/* Write pattern to GPIB data lines */
-	{RD, bsr, 0xAA},	/* Verify ATN, NDAC, EOI, & IFC are set */
-	{RD, dsr, 0x55},	/* Verify data pattern written previously */
-	{WT, bcr, 0x00},	/* Clear control lines */
-	{WT, dcr, 0x00},	/* Clear data lines */
-	{RD, bsr, 0x00},	/* Verify control lines are clear */
-	{RD, dsr, 0x00},	/* Verify data lines are clear */
-	{END, 0, 0}
-};
-
-static struct tst tst_adr0_1[] = {
-	{WT, adr, 0x55},	/* Set Primary talk address */
-	{WT, adr, 0xAA},	/* Set Secondary listen address */
-	{RD, adr0, 0x55},	/* Read Primary address */
-	{RD, adr1, 0x2A},	/* Read Secondary address */
-	{WT, adr, 0x2A},	/* Set Primay listen address */
-	{WT, adr, 0xD5},	/* Set Secondary talk address */
-	{RD, adr0, 0x2A},	/* Read Primary address */
-	{RD, adr1, 0x55},	/* Read Secondary address */
-	{END, 0, 0}
-};
-
-static struct tst tst_cdor_dir[] = {
-	{WT, admr, 0xF0},	/* program AT-GPIB as talker only and
-				 * listener only */
-	{RD, isr1, 0x02},	/* check DO bit set */
-	{RD, adsr, 0x46},	/* check AT-GPIB is both talker active
-				 * and listener active */
-	{WT, cdor, 0xAA},	/* write out data byte */
-	{xDELAY, 0, 1},		/* One ISA I/O Cycle (500-ns) */
-	{RD, isr1, 0x03},	/* check DO and DI bits set */
-	{RD, dir, 0xAA},	/* verify data received */
-	{WT, cdor, 0x55},	/* write out data byte */
-	{xDELAY, 0, 1},		/* One ISA I/O Cycle (500-ns) */
-	{RD, dir, 0x55},	/* verify data received */
-	{END, 0, 0}
-};
-
-static struct tst tst_spmr_spsr[] = {
-	{WT, spsr, 0x00},	/* Write pattern to SPSR register */
-	{RD, spmr, 0x00},	/* Read back previously written pattern */
-	{WT, spsr, 0xBF},	/* Write pattern to SPSR register */
-	{RD, spmr, 0xBF},	/* Read back previously written pattern */
-	{END, 0, 0}
-};
-
-static struct tst tst_count0_1[] = {
-	{WT, cnt0, 0x55}, 	/* Verify every other bit can be set */
-	{WT, cnt1, 0xAA},
-	{RD, cnt0, 0x55}, 	/* Read back previously written pattern */
-	{RD, cnt1, 0xAA},
-	{WT, cnt0, 0xAA}, 	/* Verify every other bit can be set */
-	{WT, cnt1, 0x55},
-	{RD, cnt0, 0xAA}, 	/* Read back previously written pattern */
-	{RD, cnt1, 0x55},
-	{END, 0, 0}
-};
-
-static int
-tst_exec(struct tnt_softc *sc, struct tst *tp, const char *name)
-{
-	uint8_t u;
-	int step;
-
-	for (step = 0; tp->action != END; tp++, step++) {
-		switch (tp->action) {
-		case WT:
-			bus_write_1(sc->res[1], tp->reg, tp->val);
-			break;
-		case RD:
-			u = bus_read_1(sc->res[1], tp->reg);
-			if (u != tp->val) {
-				printf(
-				    "Test %s, step %d: reg(%02x) = %02x",
-				    name, step, tp->reg, u);
-				printf( "should have been %02x\n", tp->val);
-				return (1);
-			}
-			break;
-		case xDELAY:
-			DELAY(tp->val);
-			break;
-		default:
-			printf("Unknown action in test %s, step %d: %d\n",
-			name, step, tp->action);
-			return (1);
-		}
-	}
-	if (bootverbose)
-		printf("Test %s passed\n", name);
-	return (0);
-}
-
-static int
-tnt_probe(device_t dev)
-{
-
-	if (pci_get_vendor(dev) == 0x1093 && pci_get_device(dev) == 0xc801) {
-		device_set_desc(dev, "NI PCI-GPIB");
-		return (BUS_PROBE_DEFAULT);
-	}
-	return (ENXIO);
-}
-
-static int
-tnt_attach(device_t dev)
-{
-	struct tnt_softc *sc;
-	int error, i;
-	uint8_t version;
-
-	sc = device_get_softc(dev);
-
-	error = bus_alloc_resources(dev, tnt_res_spec, sc->res);
-	if (error)
-		return (error);
-
-	error = bus_setup_intr(dev, sc->res[2], INTR_TYPE_MISC | INTR_MPSAFE,
-	    NULL, upd7210intr, &sc->upd7210, &sc->intr_handler);
-
-	/* IO Device Window Base Size Register (IODWBSR) */
-	bus_write_4(sc->res[0], 0xc0, rman_get_start(sc->res[1]) | 0x80);
-
-	tst_exec(sc, tst_reset, "Reset");
-	tst_exec(sc, tst_read_reg, "Read registers");
-	tst_exec(sc, tst_bsr_dcr, "BSR & DCR");
-	tst_exec(sc, tst_adr0_1, "ADR0,1");
-	tst_exec(sc, tst_cdor_dir, "CDOR/DIR");
-	tst_exec(sc, tst_spmr_spsr, "CPMR/SPSR");
-	tst_exec(sc, tst_count0_1, "COUNT0:1");
-	tst_exec(sc, tst_reset, "Reset");
-
-	version = bus_read_1(sc->res[1], csr);
-	version = (version >> 4) & 0x0f;
-	device_printf(dev, "Chip version 0x%02x (TNT%s)\n",
-		      version,
-		      version >= 4? "5004 or above": "4882");
-	if (version >= 4) {
-		device_printf(dev, "Forcing FIFO mode\n");
-		sc->upd7210.use_fifo = 1;
-	} else {
-		sc->upd7210.use_fifo = 0;
-	}
-
-	/* pass 7210 interrupts through */
-	bus_write_1(sc->res[1], imr3, 0x02);
-
-	for (i = 0; i < 8; i++) {
-		sc->upd7210.reg_res[i] = sc->res[1];
-		sc->upd7210.reg_offset[i] = i * 2;
-	}
-
-	/* No DMA help */
-	sc->upd7210.dmachan = -1;
-
-	/* No "special interrupt handling" needed here. */
-	sc->upd7210.irq_clear_res = NULL;
-
-	upd7210attach(&sc->upd7210);
-	device_printf(dev, "attached gpib%d\n", sc->upd7210.unit);
-
-	if (sc->upd7210.use_fifo)
-		bus_write_1(sc->res[0], hssel, 0x01); /* one-chip mode */
-
-
-	return (0);
-}
-
-static int
-tnt_detach(device_t dev)
-{
-	struct tnt_softc *sc;
-
-	sc = device_get_softc(dev);
-	bus_teardown_intr(dev, sc->res[2], sc->intr_handler);
-	upd7210detach(&sc->upd7210);
-
-	bus_release_resources(dev, tnt_res_spec, sc->res);
-
-	return (0);
-}
-
-static device_method_t	tnt4882_methods[] = {
-	DEVMETHOD(device_probe,		tnt_probe),
-	DEVMETHOD(device_attach,	tnt_attach),
-	DEVMETHOD(device_detach,	tnt_detach),
-	{ 0, 0 }
-};
-
-static driver_t pci_gpib_driver = {
-	"tnt4882",
-	tnt4882_methods,
-	sizeof(struct tnt_softc)
-};
-
-static devclass_t pci_gpib_devclass;
-
-DRIVER_MODULE(pci_gpib, pci, pci_gpib_driver, pci_gpib_devclass, 0, 0);

Property changes on: projects/arm_intrng/sys/dev/ieee488/tnt4882.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/sys/dev/ieee488/upd7210.c
===================================================================
--- projects/arm_intrng/sys/dev/ieee488/upd7210.c	(revision 276247)
+++ projects/arm_intrng/sys/dev/ieee488/upd7210.c	(nonexistent)
@@ -1,369 +0,0 @@
-/*-
- * Copyright (c) 2005 Poul-Henning Kamp 
- * Copyright (c) 2010 Joerg Wunsch 
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * High-level driver for µPD7210 based GPIB cards.
- *
- */
-
-#include 
-__FBSDID("$FreeBSD$");
-
-#  define	GPIB_DEBUG
-#  undef	GPIB_DEBUG
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define UPD7210_HW_DRIVER
-#define UPD7210_SW_DRIVER
-#include 
-#include 
-
-static MALLOC_DEFINE(M_GPIB, "GPIB", "GPIB");
-
-/* upd7210 generic stuff */
-
-void
-upd7210_print_isr(u_int isr1, u_int isr2)
-{
-	printf("isr1=0x%b isr2=0x%b",
-	    isr1, "\20\10CPT\7APT\6DET\5ENDRX\4DEC\3ERR\2DO\1DI",
-	    isr2, "\20\10INT\7SRQI\6LOK\5REM\4CO\3LOKC\2REMC\1ADSC");
-}
-
-u_int
-upd7210_rd(struct upd7210 *u, enum upd7210_rreg reg)
-{
-	u_int r;
-
-	r = bus_read_1(u->reg_res[reg], u->reg_offset[reg]);
-	u->rreg[reg] = r;
-	return (r);
-}
-
-void
-upd7210_wr(struct upd7210 *u, enum upd7210_wreg reg, u_int val)
-{
-
-	bus_write_1(u->reg_res[reg], u->reg_offset[reg], val);
-	u->wreg[reg] = val;
-	if (reg == AUXMR)
-		u->wreg[8 + (val >> 5)] = val & 0x1f;
-}
-
-void
-upd7210intr(void *arg)
-{
-	u_int isr_1, isr_2, isr_3;
-	struct upd7210 *u;
-
-	u = arg;
-	mtx_lock(&u->mutex);
-	isr_1 = upd7210_rd(u, ISR1);
-	isr_2 = upd7210_rd(u, ISR2);
-	if (u->use_fifo) {
-		isr_3 = bus_read_1(u->reg_res[0], isr3);
-	} else {
-		isr_3 = 0;
-	}
-	if (isr_1 != 0 || isr_2 != 0 || isr_3 != 0) {
-		if (u->busy == 0 || u->irq == NULL || !u->irq(u, isr_3)) {
-#if 0
-			printf("upd7210intr [%02x %02x %02x",
-			       upd7210_rd(u, DIR), isr1, isr2);
-			printf(" %02x %02x %02x %02x %02x] ",
-			       upd7210_rd(u, SPSR),
-			       upd7210_rd(u, ADSR),
-			       upd7210_rd(u, CPTR),
-			       upd7210_rd(u, ADR0),
-		    upd7210_rd(u, ADR1));
-			upd7210_print_isr(isr1, isr2);
-			printf("\n");
-#endif
-		}
-		/*
-		 * "special interrupt handling"
-		 *
-		 * In order to implement shared IRQs, the original
-		 * PCIIa uses IO locations 0x2f0 + (IRQ#) as an output
-		 * location.  If an ISR for a particular card has
-		 * detected this card triggered the IRQ, it must reset
-		 * the card's IRQ by writing (anything) to that IO
-		 * location.
-		 *
-		 * Some clones apparently don't implement this
-		 * feature, but National Instrument cards do.
-		 */
-		if (u->irq_clear_res != NULL)
-			bus_write_1(u->irq_clear_res, 0, 42);
-	}
-	mtx_unlock(&u->mutex);
-}
-
-int
-upd7210_take_ctrl_async(struct upd7210 *u)
-{
-	int i;
-
-	upd7210_wr(u, AUXMR, AUXMR_TCA);
-
-	if (!(upd7210_rd(u, ADSR) & ADSR_ATN))
-		return (0);
-	for (i = 0; i < 20; i++) {
-		DELAY(1);
-		if (!(upd7210_rd(u, ADSR) & ADSR_ATN))
-			return (0);
-	}
-	return (1);
-}
-
-int
-upd7210_goto_standby(struct upd7210 *u)
-{
-	int i;
-
-	upd7210_wr(u, AUXMR, AUXMR_GTS);
-
-	if (upd7210_rd(u, ADSR) & ADSR_ATN)
-		return (0);
-	for (i = 0; i < 20; i++) {
-		DELAY(1);
-		if (upd7210_rd(u, ADSR) & ADSR_ATN)
-			return (0);
-	}
-	return (1);
-}
-
-/* Unaddressed Listen Only mode */
-
-static int
-gpib_l_irq(struct upd7210 *u, int isr_3)
-{
-	int i;
-	int have_data = 0;
-
-	if (u->use_fifo) {
-		/* TNT5004 or TNT4882 in FIFO mode */
-		if (isr_3 & 0x04) {
-			/* FIFO not empty */
-			i = bus_read_1(u->reg_res[0], fifob);
-			have_data = 1;
-			bus_write_1(u->reg_res[0], cnt0, -1);
-			bus_write_1(u->reg_res[0], cnt1, (-1) >> 8);
-			bus_write_1(u->reg_res[0], cnt2, (-1) >> 16);
-			bus_write_1(u->reg_res[0], cnt3, (-1) >> 24);
-			bus_write_1(u->reg_res[0], cmdr, 0x04); /* GO */
-		}
-	} else if (u->rreg[ISR1] & 1) {
-		i = upd7210_rd(u, DIR);
-		have_data = 1;
-	}
-
-	if (have_data) {
-		u->buf[u->buf_wp++] = i;
-		u->buf_wp &= (u->bufsize - 1);
-		i = (u->buf_rp + u->bufsize - u->buf_wp) & (u->bufsize - 1);
-		if (i < 8) {
-			if (u->use_fifo)
-				bus_write_1(u->reg_res[0], imr3, 0x00);
-			else
-				upd7210_wr(u, IMR1, 0);
-		}
-		wakeup(u->buf);
-		return (1);
-	}
-	return (0);
-}
-
-static int
-gpib_l_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
-{
-	struct upd7210 *u;
-
-	u = dev->si_drv1;
-
-	mtx_lock(&u->mutex);
-	if (u->busy) {
-		mtx_unlock(&u->mutex);
-		return (EBUSY);
-	}
-	u->busy = 1;
-	u->irq = gpib_l_irq;
-	mtx_unlock(&u->mutex);
-
-	u->buf = malloc(PAGE_SIZE, M_GPIB, M_WAITOK);
-	u->bufsize = PAGE_SIZE;
-	u->buf_wp = 0;
-	u->buf_rp = 0;
-
-	upd7210_wr(u, AUXMR, AUXMR_CRST); /* chip reset */
-	DELAY(10000);
-	upd7210_wr(u, AUXMR, C_ICR | 8); /* 8 MHz clock */
-	DELAY(1000);
-	upd7210_wr(u, ADR, 0x60); /* ADR0: disable listener and talker 0 */
-	upd7210_wr(u, ADR, 0xe0); /* ADR1: disable listener and talker 1 */
-	upd7210_wr(u, ADMR, 0x70); /* listen-only (lon) */
-	upd7210_wr(u, AUXMR, AUXMR_PON); /* immediate execute power-on (pon) */
-	if (u->use_fifo) {
-		/* TNT5004 or TNT4882 in FIFO mode */
-		bus_write_1(u->reg_res[0], cmdr, 0x10); /* reset FIFO */
-		bus_write_1(u->reg_res[0], cfg, 0x20); /* xfer IN, 8-bit FIFO */
-		bus_write_1(u->reg_res[0], cnt0, -1);
-		bus_write_1(u->reg_res[0], cnt1, (-1) >> 8);
-		bus_write_1(u->reg_res[0], cnt2, (-1) >> 16);
-		bus_write_1(u->reg_res[0], cnt3, (-1) >> 24);
-		bus_write_1(u->reg_res[0], cmdr, 0x04); /* GO */
-		bus_write_1(u->reg_res[0], imr3, 0x04); /* NEF IE */
-	} else {
-		/* µPD7210/NAT7210, or TNT4882 in non-FIFO mode */
-		upd7210_wr(u, IMR1, 0x01); /* data in interrupt enable */
-	}
-	return (0);
-}
-
-static int
-gpib_l_close(struct cdev *dev, int oflags, int devtype, struct thread *td)
-{
-	struct upd7210 *u;
-
-	u = dev->si_drv1;
-
-	mtx_lock(&u->mutex);
-	u->busy = 0;
-	if (u->use_fifo) {
-		/* TNT5004 or TNT4882 in FIFO mode */
-		bus_write_1(u->reg_res[0], cmdr, 0x22); /* soft RESET */
-		bus_write_1(u->reg_res[0], imr3, 0x00);
-	}
-	upd7210_wr(u, AUXMR, AUXMR_CRST);
-	DELAY(10000);
-	upd7210_wr(u, IMR1, 0x00);
-	upd7210_wr(u, IMR2, 0x00);
-	free(u->buf, M_GPIB);
-	u->buf = NULL;
-	mtx_unlock(&u->mutex);
-	return (0);
-}
-
-static int
-gpib_l_read(struct cdev *dev, struct uio *uio, int ioflag)
-{
-	struct upd7210 *u;
-	int error;
-	size_t z;
-
-	u = dev->si_drv1;
-	error = 0;
-
-	mtx_lock(&u->mutex);
-	while (u->buf_wp == u->buf_rp) {
-		error = msleep(u->buf, &u->mutex, PZERO | PCATCH,
-		    "gpibrd", hz);
-		if (error && error != EWOULDBLOCK) {
-			mtx_unlock(&u->mutex);
-			return (error);
-		}
-	}
-	while (uio->uio_resid > 0 && u->buf_wp != u->buf_rp) {
-		if (u->buf_wp < u->buf_rp)
-			z = u->bufsize - u->buf_rp;
-		else
-			z = u->buf_wp - u->buf_rp;
-		if (z > uio->uio_resid)
-			z = uio->uio_resid;
-		mtx_unlock(&u->mutex);
-		error = uiomove(u->buf + u->buf_rp, z, uio);
-		mtx_lock(&u->mutex);
-		if (error)
-			break;
-		u->buf_rp += z;
-		u->buf_rp &= (u->bufsize - 1);
-	}
-	if (u->use_fifo) {
-		bus_write_1(u->reg_res[0], imr3, 0x04); /* NFF IE */
-	} else {
-		if (u->wreg[IMR1] == 0)
-			upd7210_wr(u, IMR1, 0x01);
-	}
-	mtx_unlock(&u->mutex);
-	return (error);
-}
-
-static struct cdevsw gpib_l_cdevsw = {
-	.d_version =	D_VERSION,
-	.d_name =	"gpib_l",
-	.d_open	=	gpib_l_open,
-	.d_close =	gpib_l_close,
-	.d_read =	gpib_l_read,
-};
-
-/* Housekeeping */
-
-static struct unrhdr *units;
-
-void
-upd7210attach(struct upd7210 *u)
-{
-	struct cdev *dev;
-
-	if (units == NULL)
-		units = new_unrhdr(0, INT_MAX, NULL);
-	u->unit = alloc_unr(units);
-	mtx_init(&u->mutex, "gpib", NULL, MTX_DEF);
-	u->cdev = make_dev(&gpib_l_cdevsw, u->unit,
-	    UID_ROOT, GID_WHEEL, 0444,
-	    "gpib%ul", u->unit);
-	u->cdev->si_drv1 = u;
-
-	dev = make_dev(&gpib_ib_cdevsw, u->unit,
-	    UID_ROOT, GID_WHEEL, 0444,
-	    "gpib%uib", u->unit);
-	dev->si_drv1 = u;
-	dev_depends(u->cdev, dev);
-}
-
-void
-upd7210detach(struct upd7210 *u)
-{
-
-	destroy_dev(u->cdev);
-	mtx_destroy(&u->mutex);
-	free_unr(units, u->unit);
-}

Property changes on: projects/arm_intrng/sys/dev/ieee488/upd7210.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/sys/dev/ieee488/pcii.c
===================================================================
--- projects/arm_intrng/sys/dev/ieee488/pcii.c	(revision 276247)
+++ projects/arm_intrng/sys/dev/ieee488/pcii.c	(nonexistent)
@@ -1,255 +0,0 @@
-/*-
- * Copyright (c) 2005 Poul-Henning Kamp 
- * Copyright (c) 2010 Joerg Wunsch 
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * Driver for GPIB cards based on NEC µPD7210 and compatibles.
- *
- * This driver just hooks up to the hardware and leaves all the interesting
- * stuff to upd7210.c.
- *
- * Supported hardware:
- *    PCIIA compatible cards.
- *
- *    Tested and known working:
- *	"B&C Microsystems PC488A-0"
- *	"National Instruments GPIB-PCII/PCIIA" (in PCIIa mode)
- *	"Axiom AX5488"
- *
- */
-
-#include 
-__FBSDID("$FreeBSD$");
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#define UPD7210_HW_DRIVER
-#include 
-
-struct pcii_softc {
-	int foo;
-	struct resource	*res[11];
-	void *intr_handler;
-	struct upd7210	upd7210;
-};
-
-static devclass_t pcii_devclass;
-
-static int	pcii_probe(device_t dev);
-static int	pcii_attach(device_t dev);
-
-static device_method_t pcii_methods[] = {
-	DEVMETHOD(device_probe,		pcii_probe),
-	DEVMETHOD(device_attach,	pcii_attach),
-	DEVMETHOD(device_suspend,	bus_generic_suspend),
-	DEVMETHOD(device_resume,	bus_generic_resume),
-
-	{ 0, 0 }
-};
-
-static struct resource_spec pcii_res_spec[] = {
-	{ SYS_RES_IRQ,		0, RF_ACTIVE | RF_SHAREABLE},
-	{ SYS_RES_DRQ,		0, RF_ACTIVE | RF_SHAREABLE | RF_OPTIONAL},
-	{ SYS_RES_IOPORT,	0, RF_ACTIVE},
-	{ SYS_RES_IOPORT,	1, RF_ACTIVE},
-	{ SYS_RES_IOPORT,	2, RF_ACTIVE},
-	{ SYS_RES_IOPORT,	3, RF_ACTIVE},
-	{ SYS_RES_IOPORT,	4, RF_ACTIVE},
-	{ SYS_RES_IOPORT,	5, RF_ACTIVE},
-	{ SYS_RES_IOPORT,	6, RF_ACTIVE},
-	{ SYS_RES_IOPORT,	7, RF_ACTIVE},
-	{ SYS_RES_IOPORT,	8, RF_ACTIVE | RF_SHAREABLE},
-	{ -1, 0, 0 }
-};
-
-static driver_t pcii_driver = {
-	"pcii",
-	pcii_methods,
-	sizeof(struct pcii_softc),
-};
-
-static int
-pcii_probe(device_t dev)
-{
-	int rid, i, j;
-	u_long start, count, addr;
-	int error = 0;
-	struct pcii_softc *sc;
-
-	device_set_desc(dev, "PCII IEEE-4888 controller");
-	sc = device_get_softc(dev);
-
-	rid = 0;
-	if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count) != 0)
-		return ENXIO;
-	/*
-	 * The PCIIA decodes a fixed pattern of 0x2e1 for the lower 10
-	 * address bits A0 ... A9.  Bits A10 through A12 are used by
-	 * the µPD7210 register select lines.  This makes the
-	 * individual 7210 register being 0x400 bytes apart in the ISA
-	 * bus address space.  Address bits A13 and A14 are compared
-	 * to a DIP switch setting on the card, allowing for up to 4
-	 * different cards being installed (at base addresses 0x2e1,
-	 * 0x22e1, 0x42e1, and 0x62e1, respectively).  A15 has been
-	 * used to select an optional on-board time-of-day clock chip
-	 * (MM58167A) on the original PCIIA rather than the µPD7210
-	 * (which is not implemented on later boards).  The
-	 * documentation states the respective addresses for that chip
-	 * should be handled as reserved addresses, which we don't do
-	 * (right now).  Finally, the IO addresses 0x2f0 ... 0x2f7 for
-	 * a "special interrupt handling feature" (re-enable
-	 * interrupts so the IRQ can be shared).
-	 *
-	 * Usually, the user will only set the base address in the
-	 * device hints, so we handle the rest here.
-	 *
-	 * (Source: GPIB-PCIIA Technical Reference Manual, September
-	 * 1989 Edition, National Instruments.)
-	 */
-	if ((start & 0x3ff) != 0x2e1) {
-		if (bootverbose)
-			printf("pcii_probe: PCIIA base address 0x%lx not "
-			       "0x2e1/0x22e1/0x42e1/0x62e1\n",
-			       start);
-		return (ENXIO);
-	}
-
-	for (rid = 0, addr = start; rid < 8; rid++, addr += 0x400) {
-		if (bus_set_resource(dev, SYS_RES_IOPORT, rid, addr, 1) != 0) {
-			printf("pcii_probe: could not set IO port 0x%lx\n",
-			       addr);
-			return (ENXIO);
-		}
-	}
-	if (bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &count) != 0) {
-		printf("pcii_probe: cannot obtain IRQ level\n");
-		return ENXIO;
-	}
-	if (start > 7) {
-		printf("pcii_probe: IRQ level %lu too high\n", start);
-		return ENXIO;
-	}
-
-	if (bus_set_resource(dev, SYS_RES_IOPORT, 8, 0x2f0 + start, 1) != 0) {
-		printf("pcii_probe: could not set IO port 0x%3lx\n",
-		       0x2f0 + start);
-		return (ENXIO);
-	}
-
-	error = bus_alloc_resources(dev, pcii_res_spec, sc->res);
-	if (error) {
-		printf("pcii_probe: Could not allocate resources\n");
-		return (error);
-	}
-	error = ENXIO;
-	/*
-	 * Perform some basic tests on the µPD7210 registers.  At
-	 * least *some* register must read different from 0x00 or
-	 * 0xff.
-	 */
-	for (i = 0; i < 8; i++) {
-		j = bus_read_1(sc->res[2 + i], 0);
-		if (j != 0x00 && j != 0xff)
-			error = 0;
-	}
-	/* SPSR/SPMR read/write test */
-	if (!error) {
-		bus_write_1(sc->res[2 + 3], 0, 0x55);
-		if (bus_read_1(sc->res[2 + 3], 0) != 0x55)
-			error = ENXIO;
-	}
-	if (!error) {
-		bus_write_1(sc->res[2 + 3], 0, 0xaa);
-		if (bus_read_1(sc->res[2 + 3], 0) != 0xaa)
-			error = ENXIO;
-	}
-	if (error)
-		printf("pcii_probe: probe failure\n");
-
-	bus_release_resources(dev, pcii_res_spec, sc->res);
-	return (error);
-}
-
-static int
-pcii_attach(device_t dev)
-{
-	struct pcii_softc *sc;
-	u_long		start, count;
-	int		unit;
-	int		rid;
-	int		error = 0;
-
-	unit = device_get_unit(dev);
-	sc = device_get_softc(dev);
-	memset(sc, 0, sizeof *sc);
-
-	device_set_desc(dev, "PCII IEEE-4888 controller");
-
-	if (bus_get_resource(dev, SYS_RES_IRQ, 0, &start, &count) != 0) {
-		printf("pcii_attach: cannot obtain IRQ number\n");
-		return ENXIO;
-	}
-
-	error = bus_alloc_resources(dev, pcii_res_spec, sc->res);
-	if (error)
-		return (error);
-
-	error = bus_setup_intr(dev, sc->res[0],
-	    INTR_TYPE_MISC | INTR_MPSAFE, NULL,
-	    upd7210intr, &sc->upd7210, &sc->intr_handler);
-	if (error) {
-		bus_release_resources(dev, pcii_res_spec, sc->res);
-		return (error);
-	}
-
-	for (rid = 0; rid < 8; rid++) {
-		sc->upd7210.reg_res[rid] = sc->res[2 + rid];
-		sc->upd7210.reg_offset[rid] = 0;
-	}
-	sc->upd7210.irq_clear_res = sc->res[10];
-	sc->upd7210.use_fifo = 0;
-
-	if (sc->res[1] == NULL)
-		sc->upd7210.dmachan = -1;
-	else
-		sc->upd7210.dmachan = rman_get_start(sc->res[1]);
-
-	upd7210attach(&sc->upd7210);
-	device_printf(dev, "attached gpib%d\n", sc->upd7210.unit);
-
-	return (0);
-}
-
-DRIVER_MODULE(pcii, isa, pcii_driver, pcii_devclass, 0, 0);
-DRIVER_MODULE(pcii, acpi, pcii_driver, pcii_devclass, 0, 0);

Property changes on: projects/arm_intrng/sys/dev/ieee488/pcii.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/sys/dev/ieee488/ugpib.h
===================================================================
--- projects/arm_intrng/sys/dev/ieee488/ugpib.h	(revision 276247)
+++ projects/arm_intrng/sys/dev/ieee488/ugpib.h	(nonexistent)
@@ -1,155 +0,0 @@
-/*-
- * Copyright (c) 2005 Poul-Henning Kamp 
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- *
- */
-
-#ifndef _DEV_IEEE488_UGPIB_H_
-#define _DEV_IEEE488_UGPIB_H_
-
-/* ibfoo() return values */
-#define EDVR	0		/* System error				*/
-#define ECIC	1		/* Not Active Controller		*/
-#define ENOL	2		/* Nobody listening			*/
-#define EADR	3		/* Controller not addressed		*/
-#define EARG	4		/* Invalid argument			*/
-#define ESAC	5		/* Not System Controller		*/
-#define EABO	6		/* I/O Aborted/Time out			*/
-#define ENEB	7		/* No such controller			*/
-#define EOIP	10		/* Async I/O in progress		*/
-#define ECAP	11		/* No such capability			*/
-#define EFSO	12		/* File system error			*/
-#define EBUS	14		/* Command byte xfer error		*/
-#define ESTB	15		/* Serial poll status byte lost		*/
-#define ESRQ	16		/* SRQ line stuck			*/
-#define ETAB	20		/* Table problem			*/
-
-/* ibsta bits */
-#define ERR	(1<<15)		/* Error				*/
-#define TIMO	(1<<14)		/* Timeout				*/
-#define END	(1<<13)		/* EOI/EOS				*/
-#define SRQI	(1<<12)		/* SRQ					*/
-#define RQS	(1<<11)		/* Device requests service		*/
-#define SPOLL	(1<<10)		/* Serial Poll				*/
-#define EVENT	(1<<9)		/* Event occured			*/
-#define CMPL	(1<<8)		/* I/O complete				*/
-#define LOK	(1<<7)		/* Lockout				*/
-#define REM	(1<<6)		/* Remote				*/
-#define CIC	(1<<5)		/* CIC					*/
-#define ATN	(1<<4)		/* ATN					*/
-#define TACS	(1<<3)		/* Talker				*/
-#define LACS	(1<<2)		/* Listener				*/
-#define DTAS	(1<<1)		/* Device trigger status		*/
-#define DCAS	(1<<0)		/* Device clear state			*/
-
-/* Timeouts */
-#define TNONE	0
-#define T10us	1
-#define T30us	2
-#define T100us	3
-#define T300us	4
-#define T1ms	5
-#define T3ms	6
-#define T10ms	7
-#define T30ms	8
-#define T100ms	9
-#define T300ms	10
-#define T1s	11
-#define T3s	12
-#define T10s	13
-#define T30s	14
-#define T100s	15
-#define T300s	16
-#define T1000s	17
-
-/* EOS bits */
-#define REOS	(1 << 10)
-#define XEOS	(1 << 11)
-#define BIN	(1 << 12)
-
-/* Bus commands */
-#define GTL	0x01		/* Go To Local				*/
-#define SDC	0x04		/* Selected Device Clear		*/
-#define GET	0x08		/* Group Execute Trigger		*/
-#define LAD	0x20		/* Listen address			*/
-#define UNL	0x3F		/* Unlisten				*/
-#define TAD	0x40		/* Talk address				*/
-#define UNT	0x5F		/* Untalk				*/
-
-#ifndef _KERNEL
-
-extern int ibcnt, iberr, ibsta;
-
-int ibask(int handle, int option, int *retval);
-int ibbna(int handle, char *bdname);
-int ibcac(int handle, int v);
-int ibclr(int handle);
-int ibcmd(int handle, void *buffer, long cnt);
-int ibcmda(int handle, void *buffer, long cnt);
-int ibconfig(int handle, int option, int value);
-int ibdev(int boardID, int pad, int sad, int tmo, int eot, int eos);
-int ibdiag(int handle, void *buffer, long cnt);
-int ibdma(int handle, int v);
-int ibeos(int handle, int eos);
-int ibeot(int handle, int eot);
-int ibevent(int handle, short *event);
-int ibfind(char *bdname);
-int ibgts(int handle, int v);
-int ibist(int handle, int v);
-int iblines(int handle, short *lines);
-int ibllo(int handle);
-int ibln(int handle, int padval, int sadval, short *listenflag);
-int ibloc(int handle);
-int ibonl(int handle, int v);
-int ibpad(int handle, int pad);
-int ibpct(int handle);
-int ibpoke(int handle, int option, int value);
-int ibppc(int handle, int v);
-int ibrd(int handle, void *buffer, long cnt);
-int ibrda(int handle, void *buffer, long cnt);
-int ibrdf(int handle, char *flname);
-int ibrdkey(int handle, void *buffer, int cnt);
-int ibrpp(int handle, char *ppr);
-int ibrsc(int handle, int v);
-int ibrsp(int handle, char *spr);
-int ibrsv(int handle, int v);
-int ibsad(int handle, int sad);
-int ibsgnl(int handle, int v);
-int ibsic(int handle);
-int ibsre(int handle, int v);
-int ibsrq(void (*func)(void));
-int ibstop(int handle);
-int ibtmo(int handle, int tmo);
-int ibtrap(int  mask, int mode);
-int ibtrg(int handle);
-int ibwait(int handle, int mask);
-int ibwrt(int handle, const void *buffer, long cnt);
-int ibwrta(int handle, const void *buffer, long cnt);
-int ibwrtf(int handle, const char *flname);
-int ibwrtkey(int handle, const void *buffer, int cnt);
-int ibxtrc(int handle, void *buffer, long cnt);
-#endif /* _KERNEL */
-#endif /* _DEV_IEEE488_UGPIB_H_ */

Property changes on: projects/arm_intrng/sys/dev/ieee488/ugpib.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/sys/dev/ieee488/tnt4882.h
===================================================================
--- projects/arm_intrng/sys/dev/ieee488/tnt4882.h	(revision 276247)
+++ projects/arm_intrng/sys/dev/ieee488/tnt4882.h	(nonexistent)
@@ -1,77 +0,0 @@
-/*-
- * Copyright (c) 2010 Joerg Wunsch
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-enum tnt4882reg {
-	dir = 0x00,
-	cdor = 0x00,
-	isr1 = 0x02,
-	imr1 = 0x02,
-	isr2 = 0x04,
-	imr2 = 0x04,
-	accwr = 0x05,
-	spsr = 0x06,
-	spmr = 0x06,
-	intr = 0x07,
-	adsr = 0x08,
-	admr = 0x08,
-	cnt2 = 0x09,
-	cptr = 0x0a,
-	auxmr = 0x0a,
-	tauxcr = 0x0a,	/* 9914 mode register */
-	cnt3 = 0x0b,
-	adr0 = 0x0c,
-	adr = 0x0c,
-	hssel = 0x0d,
-	adr1 = 0x0e,
-	eosr = 0x0e,
-	sts1 = 0x10,
-	cfg = 0x10,
-	dsr = 0x11,
-	sh_cnt = 0x11,
-	imr3 = 0x12,
-	hier = 0x13,
-	cnt0 = 0x14,
-	misc = 0x15,
-	cnt1 = 0x16,
-	csr = 0x17,
-	keyreg = 0x17,
-	fifob = 0x18,
-	fifoa = 0x19,
-	isr3 = 0x1a,
-	ccr = 0x1a,
-	sasr = 0x1b,
-	dcr = 0x1b,
-	sts2 = 0x1c,
-	cmdr = 0x1c,
-	isr0 = 0x1d,
-	imr0 = 0x1d,
-	timer = 0x1e,
-	bsr = 0x1f,
-	bcr = 0x1f
-};
-

Property changes on: projects/arm_intrng/sys/dev/ieee488/tnt4882.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/sys/dev/ieee488/ibfoo_int.h
===================================================================
--- projects/arm_intrng/sys/dev/ieee488/ibfoo_int.h	(revision 276247)
+++ projects/arm_intrng/sys/dev/ieee488/ibfoo_int.h	(nonexistent)
@@ -1,147 +0,0 @@
-/*-
- * Copyright (c) 2005 Poul-Henning Kamp
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * This file defines the ABI between the userland gpib library and the
- * kernel.  This file should not be used anywhere else.
- *
- * $FreeBSD$
- */
-
-#include 
-
-typedef void ibsrq_t(void);
-enum ibfoo_id {
-	__ID_INVALID = 0,
-	__ID_IBASK,
-	__ID_IBBNA,
-	__ID_IBCAC,
-	__ID_IBCLR,
-	__ID_IBCMD,
-	__ID_IBCMDA,
-	__ID_IBCONFIG,
-	__ID_IBDEV,
-	__ID_IBDIAG,
-	__ID_IBDMA,
-	__ID_IBEOS,
-	__ID_IBEOT,
-	__ID_IBEVENT,
-	__ID_IBFIND,
-	__ID_IBGTS,
-	__ID_IBIST,
-	__ID_IBLINES,
-	__ID_IBLLO,
-	__ID_IBLN,
-	__ID_IBLOC,
-	__ID_IBONL,
-	__ID_IBPAD,
-	__ID_IBPCT,
-	__ID_IBPOKE,
-	__ID_IBPPC,
-	__ID_IBRD,
-	__ID_IBRDA,
-	__ID_IBRDF,
-	__ID_IBRDKEY,
-	__ID_IBRPP,
-	__ID_IBRSC,
-	__ID_IBRSP,
-	__ID_IBRSV,
-	__ID_IBSAD,
-	__ID_IBSGNL,
-	__ID_IBSIC,
-	__ID_IBSRE,
-	__ID_IBSRQ,
-	__ID_IBSTOP,
-	__ID_IBTMO,
-	__ID_IBTRAP,
-	__ID_IBTRG,
-	__ID_IBWAIT,
-	__ID_IBWRT,
-	__ID_IBWRTA,
-	__ID_IBWRTF,
-	__ID_IBWRTKEY,
-	__ID_IBXTRC
-};
-
-#define __F_HANDLE              (1 << 0)
-#define __F_SPR                 (1 << 1)
-#define __F_BUFFER              (1 << 2)
-#define __F_RETVAL              (1 << 3)
-#define __F_BDNAME              (1 << 4)
-#define __F_MASK                (1 << 5)
-#define __F_PADVAL              (1 << 6)
-#define __F_SADVAL              (1 << 7)
-#define __F_CNT                 (1 << 8)
-#define __F_TMO                 (1 << 9)
-#define __F_EOS                 (1 << 10)
-#define __F_PPR                 (1 << 11)
-#define __F_EOT                 (1 << 12)
-#define __F_V                   (1 << 13)
-#define __F_VALUE               (1 << 14)
-#define __F_SAD                 (1 << 15)
-#define __F_BOARDID             (1 << 16)
-#define __F_OPTION              (1 << 17)
-#define __F_FLNAME              (1 << 18)
-#define __F_FUNC                (1 << 19)
-#define __F_LINES               (1 << 20)
-#define __F_PAD                 (1 << 21)
-#define __F_MODE                (1 << 22)
-#define __F_LISTENFLAG          (1 << 23)
-#define __F_EVENT               (1 << 24)
-
-struct ibarg {
-	enum ibfoo_id       __ident;
-	unsigned int        __field;
-	int		    __retval;
-	int		    __ibsta;
-	int		    __iberr;
-	int		    __ibcnt;
-	int                 handle;
-	char *              spr;
-	void *              buffer;
-	int *               retval;
-	char *              bdname;
-	int                 mask;
-	int                 padval;
-	int                 sadval;
-	long                cnt;
-	int                 tmo;
-	int                 eos;
-	char *              ppr;
-	int                 eot;
-	int                 v;
-	int                 value;
-	int                 sad;
-	int                 boardID;
-	int                 option;
-	char *              flname;
-	ibsrq_t *           func;
-	short *             lines;
-	int                 pad;
-	int                 mode;
-	short *             listenflag;
-	short *             event;
-};
-
-#define GPIB_IBFOO	_IOWR(4, 0, struct ibarg)

Property changes on: projects/arm_intrng/sys/dev/ieee488/ibfoo_int.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/sys/dev/ieee488/upd7210.h
===================================================================
--- projects/arm_intrng/sys/dev/ieee488/upd7210.h	(revision 276247)
+++ projects/arm_intrng/sys/dev/ieee488/upd7210.h	(nonexistent)
@@ -1,237 +0,0 @@
-/*-
- * Copyright (c) 2005 Poul-Henning Kamp 
- * Copyright (c) 2010 Joerg Wunsch 
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- *
- * Locating an actual µPD7210 data book has proven quite impossible for me.
- * There are a fair number of newer chips which are supersets of the µPD7210
- * but they are particular eager to comprehensively mark what the extensions
- * are and what is in the base set.  Some even give the registers and their
- * bits new names.
- *
- * The following information is based on a description of the µPD7210 found
- * in an old manual for a VME board which used the chip.
- */
-
-#ifndef _DEV_IEEE488_UPD7210_H_
-#define _DEV_IEEE488_UPD7210_H_
-#ifdef _KERNEL
-
-struct upd7210;
-struct ibfoo;
-
-/* upd7210 interface definitions for HW drivers */
-
-typedef int upd7210_irq_t(struct upd7210 *, int);
-
-struct upd7210 {
-	struct resource		*reg_res[8];
-	struct resource		*irq_clear_res;
-	u_int			reg_offset[8];
-	int			dmachan;
-	int			unit;
-	int			use_fifo;
-
-	/* private stuff */
-	struct mtx		mutex;
-	uint8_t			rreg[8];
-	uint8_t			wreg[8 + 8];
-
-	upd7210_irq_t		*irq;
-
-	int			busy;
-	u_char			*buf;
-	size_t			bufsize;
-	u_int			buf_wp;
-	u_int			buf_rp;
-	struct cdev		*cdev;
-
-	struct ibfoo		*ibfoo;
-};
-
-#ifdef UPD7210_HW_DRIVER
-void upd7210intr(void *);
-void upd7210attach(struct upd7210 *);
-void upd7210detach(struct upd7210 *);
-#endif
-
-#ifdef UPD7210_SW_DRIVER
-
-/* upd7210 hardware definitions. */
-
-/* Write registers */
-enum upd7210_wreg {
-	CDOR	= 0,			/* Command/Data Out Register	*/
-	IMR1	= 1,			/* Interrupt Mask Register 1	*/
-	IMR2	= 2,			/* Interrupt Mask Register 2	*/
-	SPMR	= 3,			/* Serial Poll Mode Register	*/
-	ADMR	= 4,			/* ADdress Mode Register	*/
-	AUXMR	= 5,			/* AUXilliary Mode Register	*/
-	ICR	= 5,			/* Internal Counter Register	*/
-	PPR	= 5,			/* Parallel Poll Register	*/
-	AUXRA	= 5,			/* AUXilliary Register A	*/
-	AUXRB	= 5,			/* AUXilliary Register B	*/
-	AUXRE	= 5,			/* AUXilliary Register E	*/
-	ADR	= 6,			/* ADdress Register		*/
-	EOSR	= 7,			/* End-Of-String Register	*/
-};
-
-/* Read registers */
-enum upd7210_rreg {
-	DIR	= 0,			/* Data In Register		*/
-	ISR1	= 1,			/* Interrupt Status Register 1	*/
-	ISR2	= 2,			/* Interrupt Status Register 2	*/
-	SPSR	= 3,			/* Serial Poll Status Register	*/
-	ADSR	= 4,			/* ADdress Status Register	*/
-	CPTR	= 5,			/* Command Pass Though Register	*/
-	ADR0	= 6,			/* ADdress Register 0		*/
-	ADR1	= 7,			/* ADdress Register 1		*/
-};
-
-/* Bits for ISR1 and IMR1 */
-#define IXR1_DI		(1 << 0)	/* Data In			*/
-#define IXR1_DO		(1 << 1)	/* Data Out			*/
-#define IXR1_ERR	(1 << 2)	/* Error			*/
-#define IXR1_DEC	(1 << 3)	/* Device Clear			*/
-#define IXR1_ENDRX	(1 << 4)	/* End Received			*/
-#define IXR1_DET	(1 << 5)	/* Device Execute Trigger	*/
-#define IXR1_APT	(1 << 6)	/* Address Pass-Through		*/
-#define IXR1_CPT	(1 << 7)	/* Command Pass-Through		*/
-
-/* Bits for ISR2 and IMR2 */
-#define IXR2_ADSC	(1 << 0)	/* Addressed Status Change	*/
-#define IXR2_REMC	(1 << 1)	/* Remote Change		*/
-#define IXR2_LOKC	(1 << 2)	/* Lockout Change		*/
-#define IXR2_CO		(1 << 3)	/* Command Out			*/
-#define ISR2_REM	(1 << 4)	/* Remove			*/
-#define IMR2_DMAI	(1 << 4)	/* DMA In Enable		*/
-#define ISR2_LOK	(1 << 5)	/* Lockout			*/
-#define IMR2_DMAO	(1 << 5)	/* DMA Out Enable		*/
-#define IXR2_SRQI	(1 << 6)	/* Service Request Input	*/
-#define ISR2_INT	(1 << 7)	/* Interrupt			*/
-
-#define SPSR_PEND	(1 << 6)	/* Pending			*/
-#define SPMR_RSV	(1 << 6)	/* Request SerVice		*/
-
-#define ADSR_MJMN	(1 << 0)	/* MaJor MiNor			*/
-#define ADSR_TA		(1 << 1)	/* Talker Active		*/
-#define ADSR_LA		(1 << 2)	/* Listener Active		*/
-#define ADSR_TPAS	(1 << 3)	/* Talker Primary Addr. State	*/
-#define ADSR_LPAS	(1 << 4)	/* Listener Primary Addr. State	*/
-#define ADSR_SPMS	(1 << 5)	/* Serial Poll Mode State	*/
-#define ADSR_ATN	(1 << 6)	/* Attention			*/
-#define ADSR_CIC	(1 << 7)	/* Controller In Charge		*/
-
-#define ADMR_ADM0	(1 << 0)	/* Address Mode 0		*/
-#define ADMR_ADM1	(1 << 1)	/* Address Mode 1		*/
-#define ADMR_TRM0	(1 << 4)	/* Transmit/Receive Mode 0	*/
-#define ADMR_TRM1	(1 << 5)	/* Transmit/Receive Mode 1	*/
-#define ADMR_LON	(1 << 6)	/* Listen Only			*/
-#define ADMR_TON	(1 << 7)	/* Talk Only			*/
-
-/* Constant part of overloaded write registers */
-#define	C_ICR		0x20
-#define	C_PPR		0x60
-#define	C_AUXA		0x80
-#define	C_AUXB		0xa0
-#define	C_AUXE		0xc0
-
-#define AUXMR_PON	0x00		/* Immediate Execute pon	*/
-#define AUXMR_CPP	0x01		/* Clear Parallel Poll		*/
-#define AUXMR_CRST	0x02		/* Chip Reset			*/
-#define AUXMR_RFD	0x03		/* Finish Handshake		*/
-#define AUXMR_TRIG	0x04		/* Trigger			*/
-#define AUXMR_RTL	0x05		/* Return to local		*/
-#define AUXMR_SEOI	0x06		/* Send EOI			*/
-#define AUXMR_NVSA	0x07		/* Non-Valid Secondary cmd/addr	*/
-					/* 0x08 undefined/unknown	*/
-#define AUXMR_SPP	0x09		/* Set Parallel Poll		*/
-					/* 0x0a undefined/unknown	*/
-					/* 0x0b undefined/unknown	*/
-					/* 0x0c undefined/unknown	*/
-					/* 0x0d undefined/unknown	*/
-					/* 0x0e undefined/unknown	*/
-#define AUXMR_VSA	0x0f		/* Valid Secondary cmd/addr	*/
-#define AUXMR_GTS	0x10		/* Go to Standby		*/
-#define AUXMR_TCA	0x11		/* Take Control Async (pulsed)	*/
-#define AUXMR_TCS	0x12		/* Take Control Synchronously	*/
-#define AUXMR_LISTEN	0x13		/* Listen			*/
-#define AUXMR_DSC	0x14		/* Disable System Control	*/
-					/* 0x15 undefined/unknown	*/
-#define AUXMR_SIFC	0x16		/* Set IFC			*/
-#define AUXMR_CREN	0x17		/* Clear REN			*/
-					/* 0x18 undefined/unknown	*/
-					/* 0x19 undefined/unknown	*/
-#define AUXMR_TCSE	0x1a		/* Take Control Sync on End	*/
-#define AUXMR_LCM	0x1b		/* Listen Continuously Mode	*/
-#define AUXMR_LUNL	0x1c		/* Local Unlisten		*/
-#define AUXMR_EPP	0x1d		/* Execute Parallel Poll	*/
-#define AUXMR_CIFC	0x1e		/* Clear IFC			*/
-#define AUXMR_SREN	0x1f		/* Set REN			*/
-
-#define PPR_U		(1 << 4)	/* Unconfigure			*/
-#define PPR_S		(1 << 3)	/* Status Polarity		*/
-
-#define AUXA_HLDA	(1 << 0)	/* Holdoff on All		*/
-#define AUXA_HLDE	(1 << 1)	/* Holdoff on END		*/
-#define AUXA_REOS	(1 << 2)	/* End on EOS received		*/
-#define AUXA_XEOS	(1 << 3)	/* Transmit END with EOS	*/
-#define AUXA_BIN	(1 << 4)	/* Binary			*/
-
-#define AUXB_CPTE	(1 << 0)	/* Cmd Pass Through Enable	*/
-#define AUXB_SPEOI	(1 << 1)	/* Send Serial Poll EOI		*/
-#define AUXB_TRI	(1 << 2)	/* Three-State Timing		*/
-#define AUXB_INV	(1 << 3)	/* Invert			*/
-#define AUXB_ISS	(1 << 4)	/* Individual Status Select	*/
-
-#define AUXE_DHDT	(1 << 0)	/* DAC Holdoff on DTAS		*/
-#define AUXE_DHDC	(1 << 1)	/* DAC Holdoff on DCAS		*/
-
-#define ADR0_DL0	(1 << 5)	/* Disable Listener 0		*/
-#define ADR0_DT0	(1 << 6)	/* Disable Talker 0		*/
-
-#define ADR_DL		(1 << 5)	/* Disable Listener		*/
-#define ADR_DT		(1 << 6)	/* Disable Talker		*/
-#define ADR_ARS		(1 << 7)	/* Address Register Select	*/
-
-#define ADR1_DL1	(1 << 5)	/* Disable Listener 1		*/
-#define ADR1_DT1	(1 << 6)	/* Disable Talker 1		*/
-#define ADR1_EOI	(1 << 7)	/* End or Identify		*/
-
-/* Stuff from software drivers */
-extern struct cdevsw gpib_ib_cdevsw;
-
-/* Stuff from upd7210.c */
-void upd7210_print_isr(u_int isr1, u_int isr2);
-u_int upd7210_rd(struct upd7210 *u, enum upd7210_rreg reg);
-void upd7210_wr(struct upd7210 *u, enum upd7210_wreg reg, u_int val);
-int upd7210_take_ctrl_async(struct upd7210 *u);
-int upd7210_goto_standby(struct upd7210 *u);
-
-#endif /* UPD7210_SW_DRIVER */
-
-#endif /* _KERNEL */
-#endif /* _DEV_IEEE488_UPD7210_H_ */

Property changes on: projects/arm_intrng/sys/dev/ieee488/upd7210.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/sys/dev/ieee488/ibfoo.c
===================================================================
--- projects/arm_intrng/sys/dev/ieee488/ibfoo.c	(revision 276247)
+++ projects/arm_intrng/sys/dev/ieee488/ibfoo.c	(nonexistent)
@@ -1,1127 +0,0 @@
-/*-
- * Copyright (c) 2005 Poul-Henning Kamp 
- * Copyright (c) 2010 Joerg Wunsch 
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * High-level driver for µPD7210 based GPIB cards.
- *
- */
-
-#include 
-__FBSDID("$FreeBSD$");
-
-#  define	IBDEBUG
-#  undef	IBDEBUG
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#define UPD7210_SW_DRIVER
-#include 
-#include 
-
-static MALLOC_DEFINE(M_IBFOO, "IBFOO", "IBFOO");
-
-
-/* ibfoo API */
-
-#include 
-
-/* XXX: This is really a bitmap */
-enum h_kind {
-	H_DEV = 1,
-	H_BOARD = 2,
-	H_EITHER = 3
-};
-
-struct handle {
-	LIST_ENTRY(handle)	list;
-	int			handle;
-	enum h_kind		kind;
-	int			pad;
-	int			sad;
-	struct timeval		timeout;
-	int			eot;
-	int			eos;
-	int			dma;
-};
-
-struct ibfoo {
-	struct upd7210		*u;
-	LIST_HEAD(,handle)	handles;
-	struct unrhdr		*unrhdr;
-	struct callout		callout;
-	struct handle		*h;
-	struct ibarg		*ap;
-
-	enum {
-		IDLE,
-		BUSY,
-		PIO_IDATA,
-		PIO_ODATA,
-		PIO_CMD,
-		DMA_IDATA,
-		FIFO_IDATA,
-		FIFO_ODATA,
-		FIFO_CMD
-	}			mode;
-
-	struct timeval		deadline;
-
-	struct handle		*rdh;		/* addressed for read */
-	struct handle		*wrh;		/* addressed for write */
-
-	int		 	doeoi;
-
-	u_char			*buf;
-	u_int			buflen;
-};
-
-typedef int ibhandler_t(struct ibfoo *ib);
-
-static struct timeval timeouts[] = {
-	[TNONE] =	{    0,      0},
-	[T10us] =	{    0,     10},
-	[T30us] =	{    0,     30},
-	[T100us] =	{    0,    100},
-	[T300us] =	{    0,    300},
-	[T1ms] =	{    0,   1000},
-	[T3ms] =	{    0,   3000},
-	[T10ms] =	{    0,  10000},
-	[T30ms] =	{    0,  30000},
-	[T100ms] =	{    0, 100000},
-	[T300ms] =	{    0, 300000},
-	[T1s] =		{    1,      0},
-	[T3s] =		{    3,      0},
-	[T10s] =	{   10,      0},
-	[T30s] =	{   30,      0},
-	[T100s] =	{  100,      0},
-	[T300s] =	{  300,      0},
-	[T1000s] =	{ 1000,      0}
-};
-
-static const u_int max_timeouts = sizeof timeouts / sizeof timeouts[0];
-
-static int ibdebug;
-
-static int
-ib_set_error(struct ibarg *ap, int error)
-{
-
-	if (ap->__iberr == 0)
-		ap->__iberr = error;
-	ap->__ibsta |= ERR;
-	ap->__retval = ap->__ibsta;
-	return (0);
-}
-
-static int
-ib_had_timeout(struct ibarg *ap)
-{
-
-	ib_set_error(ap, EABO);
-	ap->__ibsta |= TIMO;
-	ap->__retval = ap->__ibsta;
-	return (0);
-}
-
-static int
-ib_set_errno(struct ibarg *ap, int errno)
-{
-
-	if (ap->__iberr == 0) {
-		ap->__iberr = EDVR;
-		ap->__ibcnt = errno;
-	}
-	ap->__ibsta |= ERR;
-	ap->__retval = ap->__ibsta;
-	return (0);
-}
-
-static int
-gpib_ib_irq(struct upd7210 *u, int isr_3)
-{
-	struct ibfoo *ib;
-
-	ib = u->ibfoo;
-
-	mtx_assert(&u->mutex, MA_OWNED);
-	switch (ib->mode) {
-	case PIO_CMD:
-		if (!(u->rreg[ISR2] & IXR2_CO))
-			return (0);
-		if (ib->buflen == 0)
-			break;
-		upd7210_wr(u, CDOR, *ib->buf);
-		ib->buf++;
-		ib->buflen--;
-		return (1);
-	case PIO_IDATA:
-		if (!(u->rreg[ISR1] & IXR1_DI))
-			return (0);
-		*ib->buf = upd7210_rd(u, DIR);
-		ib->buf++;
-		ib->buflen--;
-		if (ib->buflen == 0 || (u->rreg[ISR1] & IXR1_ENDRX))
-			break;
-		return (1);
-	case PIO_ODATA:
-		if (!(u->rreg[ISR1] & IXR1_DO))
-			return (0);
-		if (ib->buflen == 0)
-			break;
-		if (ib->buflen == 1 && ib->doeoi)
-			upd7210_wr(u, AUXMR, AUXMR_SEOI);
-		upd7210_wr(u, CDOR, *ib->buf);
-		ib->buf++;
-		ib->buflen--;
-		return (1);
-	case DMA_IDATA:
-		if (!(u->rreg[ISR1] & IXR1_ENDRX))
-			return (0);
-		break;
-	case FIFO_IDATA:
-		if (!(isr_3 & 0x15))
-			return (0);
-		while (ib->buflen != 0 && (isr_3 & 0x04 /* NEF */) != 0) {
-			*ib->buf = bus_read_1(u->reg_res[0], fifob);
-			ib->buf++;
-			ib->buflen--;
-			isr_3 = bus_read_1(u->reg_res[0], isr3);
-		}
-		if ((isr_3 & 0x01) != 0 /* xfr done */ ||
-		    (u->rreg[ISR1] & IXR1_ENDRX) != 0 ||
-		    ib->buflen == 0)
-			break;
-		if (isr_3 & 0x10)
-			/* xfr stopped */
-			bus_write_1(u->reg_res[0], cmdr, 0x04); /* GO */
-		upd7210_wr(u, AUXMR, AUXMR_RFD);
-		return (1);
-	case FIFO_CMD:
-	case FIFO_ODATA:
-		if (!(isr_3 & 0x19))
-			return (0);
-		if (ib->buflen == 0)
-			/* xfr DONE */
-			break;
-		while (ib->buflen != 0 && (isr_3 & 0x08 /* NFF */) != 0) {
-			bus_write_1(u->reg_res[0], fifob, *ib->buf);
-			ib->buf++;
-			ib->buflen--;
-			isr_3 = bus_read_1(u->reg_res[0], isr3);
-		}
-		if (isr_3 & 0x10)
-			/* xfr stopped */
-			bus_write_1(u->reg_res[0], cmdr, 0x04); /* GO */
-		if (ib->buflen == 0)
-			/* no more NFF interrupts wanted */
-			bus_write_1(u->reg_res[0], imr3, 0x11); /* STOP IE, DONE IE */
-		return (1);
-	default:
-		return (0);
-	}
-	upd7210_wr(u, IMR1, 0);
-	upd7210_wr(u, IMR2, 0);
-	if (u->use_fifo) {
-		bus_write_1(u->reg_res[0], imr3, 0x00);
-		bus_write_1(u->reg_res[0], cmdr, 0x22); /* soft RESET */
-	}
-	ib->mode = BUSY;
-	wakeup(&ib->buflen);
-	return (1);
-}
-
-static void
-gpib_ib_timeout(void *arg)
-{
-	struct upd7210 *u;
-	struct ibfoo *ib;
-	struct timeval tv;
-	u_int isr_3;
-
-	u = arg;
-	ib = u->ibfoo;
-	mtx_lock(&u->mutex);
-	if (ib->mode == DMA_IDATA && isa_dmatc(u->dmachan)) {
-		KASSERT(u->dmachan >= 0, ("Bogus dmachan = %d", u->dmachan));
-		upd7210_wr(u, IMR1, 0);
-		upd7210_wr(u, IMR2, 0);
-		ib->mode = BUSY;
-		wakeup(&ib->buflen);
-	}
-	if (ib->mode > BUSY) {
-		upd7210_rd(u, ISR1);
-		upd7210_rd(u, ISR2);
-		if (u->use_fifo)
-			isr_3 = bus_read_1(u->reg_res[0], isr3);
-		else
-			isr_3 = 0;
-		gpib_ib_irq(u, isr_3);
-	}
-	if (ib->mode != IDLE && timevalisset(&ib->deadline)) {
-		getmicrouptime(&tv);
-		if (timevalcmp(&ib->deadline, &tv, <)) {
-			ib_had_timeout(ib->ap);
-			upd7210_wr(u, IMR1, 0);
-			upd7210_wr(u, IMR2, 0);
-			if (u->use_fifo) {
-				bus_write_1(u->reg_res[0], imr3, 0x00);
-				bus_write_1(u->reg_res[0], cmdr, 0x22); /* soft RESET */
-			}
-			ib->mode = BUSY;
-			wakeup(&ib->buflen);
-		}
-	}
-	if (ib->mode != IDLE)
-		callout_reset(&ib->callout, hz / 5, gpib_ib_timeout, arg);
-	mtx_unlock(&u->mutex);
-}
-
-static void
-gpib_ib_wait_xfer(struct upd7210 *u, struct ibfoo *ib)
-{
-	int i;
-
-	mtx_assert(&u->mutex, MA_OWNED);
-	while (ib->mode > BUSY) {
-		i = msleep(&ib->buflen, &u->mutex,
-		    PZERO | PCATCH, "ibwxfr", 0);
-		if (i == EINTR) {
-			ib_set_errno(ib->ap, i);
-			break;
-		}
-		if (u->rreg[ISR1] & IXR1_ERR) {
-			ib_set_error(ib->ap, EABO);	/* XXX ? */
-			break;
-		}
-	}
-	if ((u->rreg[ISR1] & IXR1_ENDRX) != 0) {
-		ib->ap->__retval |= END;
-		ib->ap->__ibsta |= END;
-	}
-	if ((u->rreg[ISR2] & IXR2_SRQI) != 0) {
-		ib->ap->__retval |= SRQI;
-		ib->ap->__ibsta |= SRQI;
-	}
-	ib->mode = BUSY;
-	ib->buf = NULL;
-	upd7210_wr(u, IMR1, 0);
-	upd7210_wr(u, IMR2, 0);
-	if (u->use_fifo)
-		bus_write_1(u->reg_res[0], imr3, 0x00);
-}
-
-static void
-config_eos(struct upd7210 *u, struct handle *h)
-{
-	int i;
-
-	i = 0;
-	if (h->eos & REOS) {
-		upd7210_wr(u, EOSR, h->eos & 0xff);
-		i |= AUXA_REOS;
-	}
-	if (h->eos & XEOS) {
-		upd7210_wr(u, EOSR, h->eos & 0xff);
-		i |= AUXA_XEOS;
-	}
-	if (h->eos & BIN)
-		i |= AUXA_BIN;
-	upd7210_wr(u, AUXRA, C_AUXA | i);
-}
-
-/*
- * Look up the handle, and set the deadline if the handle has a timeout.
- */
-static int
-gethandle(struct upd7210 *u, struct ibarg *ap, struct handle **hp)
-{
-	struct ibfoo *ib;
-	struct handle *h;
-
-	KASSERT(ap->__field & __F_HANDLE, ("gethandle without __F_HANDLE"));
-	ib = u->ibfoo;
-	LIST_FOREACH(h, &ib->handles, list) {
-		if (h->handle == ap->handle) {
-			*hp = h;
-			return (0);
-		}
-	}
-	ib_set_error(ap, EARG);
-	return (1);
-}
-
-static int
-pio_cmd(struct upd7210 *u, u_char *cmd, int len)
-{
-	struct ibfoo *ib;
-
-	ib = u->ibfoo;
-
-	if (ib->rdh != NULL || ib->wrh != NULL) {
-		upd7210_take_ctrl_async(u);
-		ib->rdh = NULL;
-		ib->wrh = NULL;
-	}
-	mtx_lock(&u->mutex);
-	ib->buf = cmd;
-	ib->buflen = len;
-	if (u->use_fifo) {
-		/* TNT5004 or TNT4882 in FIFO mode */
-		ib->mode = FIFO_CMD;
-		upd7210_wr(u, AUXMR, 0x51);		/* holdoff immediately */
-		bus_write_1(u->reg_res[0], cmdr, 0x10); /* reset FIFO */
-		bus_write_1(u->reg_res[0], cfg, 0x80); /* CMD, xfer OUT, 8-bit FIFO */
-		bus_write_1(u->reg_res[0], imr3, 0x19); /* STOP IE, NFF IE, DONE IE */
-		bus_write_1(u->reg_res[0], cnt0, -len);
-		bus_write_1(u->reg_res[0], cnt1, (-len) >> 8);
-		bus_write_1(u->reg_res[0], cnt2, (-len) >> 16);
-		bus_write_1(u->reg_res[0], cnt3, (-len) >> 24);
-		bus_write_1(u->reg_res[0], cmdr, 0x04); /* GO */
-	} else {
-		ib->mode = PIO_CMD;
-		upd7210_wr(u, IMR2, IXR2_CO);
-		gpib_ib_irq(u, 0);
-	}
-
-	gpib_ib_wait_xfer(u, ib);
-
-	if (u->use_fifo)
-		bus_write_1(u->reg_res[0], cmdr, 0x08); /* STOP */
-
-	mtx_unlock(&u->mutex);
-	return (len - ib->buflen);
-}
-
-static int
-pio_odata(struct upd7210 *u, u_char *data, int len)
-{
-	struct ibfoo *ib;
-
-	ib = u->ibfoo;
-
-	if (len == 0)
-		return (0);
-	mtx_lock(&u->mutex);
-	ib->buf = data;
-	ib->buflen = len;
-	if (u->use_fifo) {
-		/* TNT5004 or TNT4882 in FIFO mode */
-		ib->mode = FIFO_ODATA;
-		bus_write_1(u->reg_res[0], cmdr, 0x10); /* reset FIFO */
-		if (ib->doeoi)
-			bus_write_1(u->reg_res[0], cfg, 0x08); /* CCEN */
-		else
-			bus_write_1(u->reg_res[0], cfg, 0x00); /* xfer OUT, 8-bit FIFO */
-		bus_write_1(u->reg_res[0], imr3, 0x19); /* STOP IE, NFF IE, DONE IE */
-		bus_write_1(u->reg_res[0], cnt0, -len);
-		bus_write_1(u->reg_res[0], cnt1, (-len) >> 8);
-		bus_write_1(u->reg_res[0], cnt2, (-len) >> 16);
-		bus_write_1(u->reg_res[0], cnt3, (-len) >> 24);
-		bus_write_1(u->reg_res[0], cmdr, 0x04); /* GO */
-	} else {
-		ib->mode = PIO_ODATA;
-		upd7210_wr(u, IMR1, IXR1_DO);
-	}
-
-	gpib_ib_wait_xfer(u, ib);
-
-	if (u->use_fifo)
-		bus_write_1(u->reg_res[0], cmdr, 0x08); /* STOP */
-
-	mtx_unlock(&u->mutex);
-	return (len - ib->buflen);
-}
-
-static int
-pio_idata(struct upd7210 *u, u_char *data, int len)
-{
-	struct ibfoo *ib;
-
-	ib = u->ibfoo;
-
-	mtx_lock(&u->mutex);
-	ib->buf = data;
-	ib->buflen = len;
-	if (u->use_fifo) {
-		/* TNT5004 or TNT4882 in FIFO mode */
-		ib->mode = FIFO_IDATA;
-		bus_write_1(u->reg_res[0], cmdr, 0x10); /* reset FIFO */
-		bus_write_1(u->reg_res[0], cfg, 0x20); /* xfer IN, 8-bit FIFO */
-		bus_write_1(u->reg_res[0], cnt0, -len);
-		bus_write_1(u->reg_res[0], cnt1, (-len) >> 8);
-		bus_write_1(u->reg_res[0], cnt2, (-len) >> 16);
-		bus_write_1(u->reg_res[0], cnt3, (-len) >> 24);
-		bus_write_1(u->reg_res[0], cmdr, 0x04); /* GO */
-		upd7210_wr(u, AUXMR, AUXMR_RFD);
-		bus_write_1(u->reg_res[0], imr3, 0x15); /* STOP IE, NEF IE, DONE IE */
-	} else {
-		ib->mode = PIO_IDATA;
-		upd7210_wr(u, IMR1, IXR1_DI);
-	}
-
-	gpib_ib_wait_xfer(u, ib);
-
-	if (u->use_fifo)
-		bus_write_1(u->reg_res[0], cmdr, 0x08); /* STOP */
-
-	mtx_unlock(&u->mutex);
-	return (len - ib->buflen);
-}
-
-static int
-dma_idata(struct upd7210 *u, u_char *data, int len)
-{
-	int j;
-	struct ibfoo *ib;
-
-	KASSERT(u->dmachan >= 0, ("Bogus dmachan %d", u->dmachan));
-	ib = u->ibfoo;
-	ib->mode = DMA_IDATA;
-	isa_dmastart(ISADMA_READ, data, len, u->dmachan);
-	mtx_lock(&u->mutex);
-	upd7210_wr(u, IMR1, IXR1_ENDRX);
-	upd7210_wr(u, IMR2, IMR2_DMAI);
-	gpib_ib_wait_xfer(u, ib);
-	mtx_unlock(&u->mutex);
-	j = isa_dmastatus(u->dmachan);
-	isa_dmadone(ISADMA_READ, data, len, u->dmachan);
-	return (len - j);
-}
-
-static int
-ib_send_msg(struct ibfoo *ib, int msg)
-{
-	u_char buf[10];
-	int i, j;
-
-	i = 0;
-	buf[i++] = UNT;
-	buf[i++] = UNL;
-	buf[i++] = LAD | ib->h->pad;
-	if (ib->h->sad)
-		buf[i++] = LAD | TAD | ib->h->sad;
-	buf[i++] = TAD | 0;
-	buf[i++] = msg;
-	j = pio_cmd(ib->u, buf, i);
-	if (i != j)
-		ib_set_error(ib->ap, EABO); /* XXX ? */
-	return (0);
-}
-
-static int
-ibask(struct ibfoo *ib)
-{	/* XXX */
-
-	ibdebug = ib->ap->option;
-	return (0);
-}
-
-#define ibbna NULL
-#define ibcac NULL
-
-static int
-ibclr(struct ibfoo *ib)
-{
-
-	return (ib_send_msg(ib, SDC));
-}
-
-#define ibcmd NULL
-#define ibcmda NULL
-#define ibconfig NULL
-
-static int
-ibdev(struct ibfoo *ib)
-{	/* TBD */
-	struct handle *h;
-
-	h = malloc(sizeof *h, M_IBFOO, M_ZERO | M_WAITOK);
-	h->handle = alloc_unr(ib->unrhdr);
-	h->kind = H_DEV;
-	h->pad = ib->ap->pad;
-	h->sad = ib->ap->sad;
-	h->timeout = timeouts[ib->ap->tmo];
-	h->eot = ib->ap->eot;
-	h->eos = ib->ap->eos;
-	mtx_lock(&ib->u->mutex);
-	LIST_INSERT_HEAD(&ib->handles, h, list);
-	mtx_unlock(&ib->u->mutex);
-	ib->ap->__retval = h->handle;
-	return (0);
-}
-
-#define ibdiag NULL
-
-static int
-ibdma(struct ibfoo *ib)
-{
-
-	if (ib->u->dmachan < 0 && ib->ap->v)
-		return (ib_set_error(ib->ap, EARG));
-	ib->h->dma = ib->ap->v;
-	return (0);
-}
-
-static int
-ibeos(struct ibfoo *ib)
-{
-
-	ib->ap->__iberr = ib->h->eos;
-	ib->h->eos = ib->ap->eos;
-	if (ib->rdh == ib->h)
-		config_eos(ib->u, ib->h);
-	return (0);
-}
-
-static int
-ibeot(struct ibfoo *ib)
-{
-
-	ib->h->eot = ib->ap->eot;
-	return (0);
-}
-
-#define ibevent NULL
-#define ibfind NULL
-#define ibgts NULL
-#define ibist NULL
-#define iblines NULL
-#define ibllo NULL
-#define ibln NULL
-
-static int
-ibloc(struct ibfoo *ib)
-{	/* XXX */
-
-	if (ib->h->kind == H_BOARD)
-		return (EOPNOTSUPP); /* XXX */
-	return (ib_send_msg(ib, GTL));
-}
-
-static int
-ibonl(struct ibfoo *ib)
-{	/* XXX */
-
-	if (ib->ap->v)
-		return (EOPNOTSUPP);	/* XXX */
-	mtx_lock(&ib->u->mutex);
-	LIST_REMOVE(ib->h, list);
-	mtx_unlock(&ib->u->mutex);
-	free(ib->h, M_IBFOO);
-	ib->h = NULL;
-	return (0);
-}
-
-static int
-ibpad(struct ibfoo *ib)
-{
-
-	ib->h->pad = ib->ap->pad;
-	return (0);
-}
-
-#define ibpct NULL
-#define ibpoke NULL
-#define ibppc NULL
-
-static int
-ibrd(struct ibfoo *ib)
-{	/* TBD */
-	u_char buf[10], *bp;
-	int i, j, error, bl, bc;
-	u_char *dp;
-
-	if (ib->h->kind == H_BOARD)
-		return (EOPNOTSUPP); /* XXX */
-	bl = ib->ap->cnt;
-	if (bl > PAGE_SIZE)
-		bl = PAGE_SIZE;
-	bp = malloc(bl, M_IBFOO, M_WAITOK);
-
-	if (ib->rdh != ib->h) {
-		i = 0;
-		buf[i++] = UNT;
-		buf[i++] = UNL;
-		buf[i++] = LAD | 0;
-		buf[i++] = TAD | ib->h->pad;
-		if (ib->h->sad)
-			buf[i++] = ib->h->sad;
-		i = pio_cmd(ib->u, buf, i);
-		config_eos(ib->u, ib->h);
-		ib->rdh = ib->h;
-		ib->wrh = NULL;
-	}
-	upd7210_goto_standby(ib->u);
-	dp = ib->ap->buffer;
-	bc = ib->ap->cnt;
-	error = 0;
-	while (bc > 0 && ib->ap->__iberr == 0) {
-		j = imin(bc, PAGE_SIZE);
-		if (ib->h->dma)
-			i = dma_idata(ib->u, bp, j);
-		else
-			i = pio_idata(ib->u, bp, j);
-		error = copyout(bp, dp , i);
-		if (error)
-			break;
-		ib->ap->__ibcnt += i;
-		if (i != j)
-			break;
-		bc -= i;
-		dp += i;
-	}
-	upd7210_take_ctrl_async(ib->u);
-	free(bp, M_IBFOO);
-	return (error);
-}
-
-#define ibrda NULL
-#define ibrdf NULL
-#define ibrdkey NULL
-#define ibrpp NULL
-#define ibrsc NULL
-#define ibrsp NULL
-#define ibrsv NULL
-
-static int
-ibsad(struct ibfoo *ib)
-{
-
-	ib->h->sad = ib->ap->sad;
-	return (0);
-}
-
-#define ibsgnl NULL
-
-static int
-ibsic(struct ibfoo *ib)
-{	/* TBD */
-
-	upd7210_wr(ib->u, AUXMR, AUXMR_SIFC);
-	DELAY(100);
-	upd7210_wr(ib->u, AUXMR, AUXMR_CIFC);
-	return (0);
-}
-
-#define ibsre NULL
-#define ibsrq NULL
-#define ibstop NULL
-
-static int
-ibtmo(struct ibfoo *ib)
-{
-
-	ib->h->timeout = timeouts[ib->ap->tmo];
-	return (0);
-}
-
-#define ibtrap NULL
-
-static int
-ibtrg(struct ibfoo *ib)
-{
-
-	return (ib_send_msg(ib, GET));
-}
-
-#define ibwait NULL
-
-static int
-ibwrt(struct ibfoo *ib)
-{	/* XXX */
-	u_char buf[10], *bp;
-	int i;
-
-	if (ib->h->kind == H_BOARD)
-		return (EOPNOTSUPP);
-	bp = malloc(ib->ap->cnt, M_IBFOO, M_WAITOK);
-	/* XXX: bigger than PAGE_SIZE handling */
-	i = copyin(ib->ap->buffer, bp, ib->ap->cnt);
-	if (i) {
-		free(bp, M_IBFOO);
-		return (i);
-	}
-	if (ib->wrh != ib->h) {
-		i = 0;
-		buf[i++] = UNT;
-		buf[i++] = UNL;
-		buf[i++] = LAD | ib->h->pad;
-		if (ib->h->sad)
-			buf[i++] = LAD | TAD | ib->h->sad;
-		buf[i++] = TAD | 0;
-		i = pio_cmd(ib->u, buf, i);
-		ib->rdh = NULL;
-		ib->wrh = ib->h;
-		config_eos(ib->u, ib->h);
-	}
-	upd7210_goto_standby(ib->u);
-	ib->doeoi = ib->h->eot;
-	i = pio_odata(ib->u, bp, ib->ap->cnt);
-	upd7210_take_ctrl_async(ib->u);
-	ib->ap->__ibcnt = i;
-	free(bp, M_IBFOO);
-	return (0);
-}
-
-#define ibwrta NULL
-#define ibwrtf NULL
-#define ibwrtkey NULL
-#define ibxtrc NULL
-
-static struct ibhandler {
-	const char 	*name;
-	enum h_kind	kind;
-	ibhandler_t	*func;
-	u_int		args;
-} ibhandlers[] = {
-	[__ID_IBASK] =		{ "ibask",	H_EITHER,	ibask,		__F_HANDLE | __F_OPTION | __F_RETVAL },
-	[__ID_IBBNA] =		{ "ibbna",	H_DEV,		ibbna,		__F_HANDLE | __F_BDNAME },
-	[__ID_IBCAC] =		{ "ibcac",	H_BOARD,	ibcac,		__F_HANDLE | __F_V },
-	[__ID_IBCLR] =		{ "ibclr",	H_DEV,		ibclr,		__F_HANDLE },
-	[__ID_IBCMD] =		{ "ibcmd",	H_BOARD,	ibcmd,		__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBCMDA] =		{ "ibcmda",	H_BOARD,	ibcmda,		__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBCONFIG] =	{ "ibconfig",	H_EITHER,	ibconfig,	__F_HANDLE | __F_OPTION | __F_VALUE },
-	[__ID_IBDEV] =		{ "ibdev",	0,		ibdev,		__F_BOARDID | __F_PAD | __F_SAD | __F_TMO | __F_EOT | __F_EOS },
-	[__ID_IBDIAG] =		{ "ibdiag",	H_EITHER,	ibdiag,		__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBDMA] =		{ "ibdma",	H_EITHER,	ibdma,		__F_HANDLE | __F_V },
-	[__ID_IBEOS] =		{ "ibeos",	H_EITHER,	ibeos,		__F_HANDLE | __F_EOS },
-	[__ID_IBEOT] =		{ "ibeot",	H_EITHER,	ibeot,		__F_HANDLE | __F_EOT },
-	[__ID_IBEVENT] =	{ "ibevent",	H_BOARD,	ibevent,	__F_HANDLE | __F_EVENT },
-	[__ID_IBFIND] =		{ "ibfind",	0,		ibfind,		__F_BDNAME },
-	[__ID_IBGTS] =		{ "ibgts",	H_BOARD,	ibgts,		__F_HANDLE | __F_V },
-	[__ID_IBIST] =		{ "ibist",	H_BOARD,	ibist,		__F_HANDLE | __F_V },
-	[__ID_IBLINES] =	{ "iblines",	H_BOARD,	iblines,	__F_HANDLE | __F_LINES },
-	[__ID_IBLLO] =		{ "ibllo",	H_EITHER,	ibllo,		__F_HANDLE },
-	[__ID_IBLN] =		{ "ibln",	H_BOARD,	ibln,		__F_HANDLE | __F_PADVAL | __F_SADVAL | __F_LISTENFLAG },
-	[__ID_IBLOC] =		{ "ibloc",	H_EITHER,	ibloc,		__F_HANDLE },
-	[__ID_IBONL] =		{ "ibonl",	H_EITHER,	ibonl,		__F_HANDLE | __F_V },
-	[__ID_IBPAD] =		{ "ibpad",	H_EITHER,	ibpad,		__F_HANDLE | __F_PAD },
-	[__ID_IBPCT] =		{ "ibpct",	H_DEV,		ibpct,		__F_HANDLE },
-	[__ID_IBPOKE] =		{ "ibpoke",	H_EITHER,	ibpoke,		__F_HANDLE | __F_OPTION | __F_VALUE },
-	[__ID_IBPPC] =		{ "ibppc",	H_EITHER,	ibppc,		__F_HANDLE | __F_V },
-	[__ID_IBRD] =		{ "ibrd",	H_EITHER,	ibrd,		__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBRDA] =		{ "ibrda",	H_EITHER,	ibrda,		__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBRDF] =		{ "ibrdf",	H_EITHER,	ibrdf,		__F_HANDLE | __F_FLNAME },
-	[__ID_IBRDKEY] =	{ "ibrdkey",	H_EITHER,	ibrdkey,	__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBRPP] =		{ "ibrpp",	H_EITHER,	ibrpp,		__F_HANDLE | __F_PPR },
-	[__ID_IBRSC] =		{ "ibrsc",	H_BOARD,	ibrsc,		__F_HANDLE | __F_V },
-	[__ID_IBRSP] =		{ "ibrsp",	H_DEV,		ibrsp,		__F_HANDLE | __F_SPR },
-	[__ID_IBRSV] =		{ "ibrsv",	H_EITHER,	ibrsv,		__F_HANDLE | __F_V },
-	[__ID_IBSAD] =		{ "ibsad",	H_EITHER,	ibsad,		__F_HANDLE | __F_SAD },
-	[__ID_IBSGNL] =		{ "ibsgnl",	H_EITHER,	ibsgnl,		__F_HANDLE | __F_V },
-	[__ID_IBSIC] =		{ "ibsic",	H_BOARD,	ibsic,		__F_HANDLE },
-	[__ID_IBSRE] =		{ "ibsre",	H_BOARD,	ibsre,		__F_HANDLE | __F_V },
-	[__ID_IBSRQ] =		{ "ibsrq",	H_EITHER,	ibsrq,		__F_FUNC },
-	[__ID_IBSTOP] =		{ "ibstop",	H_EITHER,	ibstop,		__F_HANDLE },
-	[__ID_IBTMO] =		{ "ibtmo",	H_EITHER,	ibtmo,		__F_HANDLE | __F_TMO },
-	[__ID_IBTRAP] =		{ "ibtrap",	H_EITHER,	ibtrap,		__F_MASK | __F_MODE },
-	[__ID_IBTRG] =		{ "ibtrg",	H_DEV,		ibtrg,		__F_HANDLE },
-	[__ID_IBWAIT] =		{ "ibwait",	H_EITHER,	ibwait,		__F_HANDLE | __F_MASK },
-	[__ID_IBWRT] =		{ "ibwrt",	H_EITHER,	ibwrt,		__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBWRTA] =		{ "ibwrta",	H_EITHER,	ibwrta,		__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBWRTF] =		{ "ibwrtf",	H_EITHER,	ibwrtf,		__F_HANDLE | __F_FLNAME },
-	[__ID_IBWRTKEY] =	{ "ibwrtkey",	H_EITHER,	ibwrtkey,	__F_HANDLE | __F_BUFFER | __F_CNT },
-	[__ID_IBXTRC] =		{ "ibxtrc",	H_EITHER,	ibxtrc,		__F_HANDLE | __F_BUFFER | __F_CNT },
-};
-
-static const u_int max_ibhandler = sizeof ibhandlers / sizeof ibhandlers[0];
-
-static void
-ib_dump_args(struct ibhandler *ih, struct ibarg *ap)
-{
-
-	if (ih->name != NULL)
-		printf("%s(", ih->name);
-	else
-		printf("ibinvalid(");
-	printf("[0x%x]", ap->__field);
-	if (ap->__field & __F_HANDLE)	printf(" handle=%d", ap->handle);
-	if (ap->__field & __F_EOS)	printf(" eos=0x%x", ap->eos);
-	if (ap->__field & __F_EOT)	printf(" eot=%d", ap->eot);
-	if (ap->__field & __F_TMO)	printf(" tmo=%d", ap->tmo);
-	if (ap->__field & __F_PAD)	printf(" pad=0x%x", ap->pad);
-	if (ap->__field & __F_SAD)	printf(" sad=0x%x", ap->sad);
-	if (ap->__field & __F_BUFFER)	printf(" buffer=%p", ap->buffer);
-	if (ap->__field & __F_CNT)	printf(" cnt=%ld", ap->cnt);
-	if (ap->__field & __F_V)	printf(" v=%d/0x%x", ap->v, ap->v);
-	/* XXX more ... */
-	printf(")\n");
-}
-
-static int
-gpib_ib_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
-{
-	struct upd7210 *u;
-	struct ibfoo *ib;
-	int error = 0;
-
-	u = dev->si_drv1;
-
-	mtx_lock(&u->mutex);
-	if (u->busy) {
-		mtx_unlock(&u->mutex);
-		return (EBUSY);
-	}
-	u->busy = 1;
-	mtx_unlock(&u->mutex);
-
-	if (u->dmachan >= 0) {
-		error = isa_dma_acquire(u->dmachan);
-		if (!error) {
-			error = isa_dma_init(u->dmachan, PAGE_SIZE, M_WAITOK);
-			if (error)
-				isa_dma_release(u->dmachan);
-		}
-	}
-
-	if (error) {
-		mtx_lock(&u->mutex);
-		u->busy = 0;
-		mtx_unlock(&u->mutex);
-		return (error);
-	}
-
-	ib = malloc(sizeof *ib, M_IBFOO, M_WAITOK | M_ZERO);
-	LIST_INIT(&ib->handles);
-	callout_init(&ib->callout, CALLOUT_MPSAFE);
-	ib->unrhdr = new_unrhdr(0, INT_MAX, NULL);
-	dev->si_drv2 = ib;
-	ib->u = u;
-	u->ibfoo = ib;
-	u->irq = gpib_ib_irq;
-
-	upd7210_wr(u, AUXMR, AUXMR_CRST);
-	DELAY(10000);
-	DELAY(1000);
-	upd7210_wr(u, IMR1, 0x00);
-	upd7210_wr(u, IMR2, 0x00);
-	upd7210_wr(u, SPMR, 0x00);
-	upd7210_wr(u, ADR, 0x00);
-	upd7210_wr(u, ADR, ADR_ARS | ADR_DL | ADR_DT);
-	upd7210_wr(u, ADMR, ADMR_ADM0 | ADMR_TRM0 | ADMR_TRM1);
-	upd7210_wr(u, EOSR, 0x00);
-	upd7210_wr(u, AUXMR, C_ICR | 8);
-	upd7210_wr(u, AUXMR, C_PPR | PPR_U);
-	upd7210_wr(u, AUXMR, C_AUXA);
-	upd7210_wr(u, AUXMR, C_AUXB + 3);
-	upd7210_wr(u, AUXMR, C_AUXE + 0);
-	upd7210_wr(u, AUXMR, AUXMR_PON);
-	if (u->use_fifo) {
-		bus_write_1(u->reg_res[0], imr3, 0x00);
-		bus_write_1(u->reg_res[0], cmdr, 0x22); /* soft reset */
-		bus_write_1(u->reg_res[0], cmdr, 0x03); /* set system
-							 * controller bit */
-	}
-	upd7210_wr(u, AUXMR, AUXMR_CIFC);
-	DELAY(100);
-	upd7210_wr(u, AUXMR, AUXMR_SIFC);
-	upd7210_wr(u, AUXMR, AUXMR_SREN);
-	return (0);
-}
-
-static int
-gpib_ib_close(struct cdev *dev, int oflags, int devtype, struct thread *td)
-{
-	struct upd7210 *u;
-	struct ibfoo *ib;
-
-	u = dev->si_drv1;
-	ib = dev->si_drv2;
-	/* XXX: assert pointer consistency */
-
-	u->ibfoo = NULL;
-	/* XXX: free handles */
-	dev->si_drv2 = NULL;
-	free(ib, M_IBFOO);
-
-	if (u->dmachan >= 0) {
-		isa_dma_release(u->dmachan);
-	}
-	mtx_lock(&u->mutex);
-	u->busy = 0;
-	ibdebug = 0;
-	upd7210_wr(u, IMR1, 0x00);
-	upd7210_wr(u, IMR2, 0x00);
-	if (u->use_fifo) {
-		bus_write_1(u->reg_res[0], imr3, 0x00);
-		bus_write_1(u->reg_res[0], cmdr, 0x02); /* clear system
-							 * controller bit */
-	}
-	upd7210_wr(u, AUXMR, AUXMR_CRST);
-	DELAY(10000);
-	mtx_unlock(&u->mutex);
-	return (0);
-}
-
-static int
-gpib_ib_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
-{
-	struct ibarg *ap;
-	struct ibhandler *ih;
-	struct handle *h;
-	struct upd7210 *u;
-	struct ibfoo *ib;
-	int error;
-	struct timeval deadline, tv;
-
-	u = dev->si_drv1;
-	ib = u->ibfoo;
-
-	/* We only support a single ioctl, everything else is a mistake */
-	if (cmd != GPIB_IBFOO)
-		return (ENOIOCTL);
-
-	/* Check the identifier and field-bitmap in the arguments.  */
-	ap = (void *)data;
-	if (ap->__ident < 0 || ap->__ident >= max_ibhandler)
-		return (EINVAL);
-	ih = &ibhandlers[ap->__ident];
-	if (ap->__field != ih->args)
-		return (EINVAL);
-
-	if (ibdebug)
-		ib_dump_args(ih, ap);
-
-	if (ih->func == NULL)
-		return (EOPNOTSUPP);
-
-	ap->__iberr = 0;
-	ap->__ibsta = 0;
-	ap->__ibcnt = 0;
-	ap->__retval = 0;
-
-	if (ap->__field & __F_TMO) {
-		if (ap->tmo < 0 || ap->tmo >= max_timeouts)
-			return (ib_set_error(ap, EARG));
-	}
-
-	if (ap->__field & __F_EOS) {
-		if ((ap->eos & ~(REOS | XEOS | BIN | 0xff)) ||
-		    ((ap->eos & (BIN | 0x80)) == 0x80))
-			return (ib_set_error(ap, EARG));
-	}
-	if (ap->__field & __F_PAD) {
-		if (ap->pad < 0 || ap->pad > 30)
-			return (ib_set_error(ap, EARG));
-	}
-	if (ap->__field & __F_SAD) {
-		if (ap->sad != 0 && (ap->sad < 0x60 || ap->sad > 126))
-			return (ib_set_error(ap, EARG));
-	}
-	
-
-	mtx_lock(&u->mutex);
-
-	
-	/* Find the handle, if any */
-	h = NULL;
-	if ((ap->__field & __F_HANDLE) && gethandle(u, ap, &h)) {
-		mtx_unlock(&u->mutex);
-		return (0);
-	}
-
-	/* Check that the handle is the right kind */
-	if (h != NULL && !(h->kind & ih->kind)) {
-		mtx_unlock(&u->mutex);
-		return (ib_set_error(ap, EARG));
-	}
-
-	/* Set up handle and deadline */
-	if (h != NULL && timevalisset(&h->timeout)) {
-		getmicrouptime(&deadline);
-		timevaladd(&deadline, &h->timeout);
-	} else {
-		timevalclear(&deadline);
-	}
-
-	/* Wait for the card to be(come) available, respect deadline */
-	while(u->busy != 1) {
-		error = msleep(ib, &u->mutex,
-		    PZERO | PCATCH, "gpib_ibioctl", hz / 10);
-		if (error == 0)
-			continue;
-		mtx_unlock(&u->mutex);
-		if (error == EINTR)
-			return(ib_set_error(ap, EABO));
-		if (error == EWOULDBLOCK && timevalisset(&deadline)) {
-			getmicrouptime(&tv);
-			if (timevalcmp(&deadline, &tv, <))
-				return(ib_had_timeout(ap));
-		}
-		mtx_lock(&u->mutex);
-	}
-	u->busy = 2;
-	mtx_unlock(&u->mutex);
-
-	/* Hand over deadline handling to the callout routine */
-	ib->ap = ap;
-	ib->h = h;
-	ib->mode = BUSY;
-	ib->deadline = deadline;
-	callout_reset(&ib->callout, hz / 5, gpib_ib_timeout, u);
-
-	error = ih->func(ib);
-
-	/* Release card */
-	ib->mode = IDLE;
-	ib->ap = NULL;
-	ib->h = NULL;
-	timevalclear(&deadline);
-	callout_stop(&ib->callout);
-
-	mtx_lock(&u->mutex);
-	u->busy = 1;
-	wakeup(ib);
-	mtx_unlock(&u->mutex);
-
-	if (error) 
-		return(ib_set_errno(ap, error));
-	return (0);
-}
-
-struct cdevsw gpib_ib_cdevsw = {
-	.d_version =	D_VERSION,
-	.d_name =	"gpib_ib",
-	.d_open	=	gpib_ib_open,
-	.d_ioctl =	gpib_ib_ioctl,
-	.d_close =	gpib_ib_close,
-};

Property changes on: projects/arm_intrng/sys/dev/ieee488/ibfoo.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/sys/dev/usb/quirk/usb_quirk.c
===================================================================
--- projects/arm_intrng/sys/dev/usb/quirk/usb_quirk.c	(revision 276247)
+++ projects/arm_intrng/sys/dev/usb/quirk/usb_quirk.c	(revision 276248)
@@ -1,870 +1,871 @@
 /* $FreeBSD$ */
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved.
  * Copyright (c) 1998 Lennart Augustsson. All rights reserved.
  * Copyright (c) 2008 Hans Petter Selasky. 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 AUTHOR 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 AUTHOR 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.
  */
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include "usbdevs.h"
 
 #define	USB_DEBUG_VAR usb_debug
 #include 
 #include 
 
 #include 
 
 MODULE_DEPEND(usb_quirk, usb, 1, 1, 1);
 MODULE_VERSION(usb_quirk, 1);
 
 #define	USB_DEV_QUIRKS_MAX 384
 #define	USB_SUB_QUIRKS_MAX 8
 
 struct usb_quirk_entry {
 	uint16_t vid;
 	uint16_t pid;
 	uint16_t lo_rev;
 	uint16_t hi_rev;
 	uint16_t quirks[USB_SUB_QUIRKS_MAX];
 };
 
 static struct mtx usb_quirk_mtx;
 
 #define	USB_QUIRK_VP(v,p,l,h,...) \
   { .vid = (v), .pid = (p), .lo_rev = (l), .hi_rev = (h), \
     .quirks = { __VA_ARGS__ } }
 #define	USB_QUIRK(v,p,l,h,...) \
   USB_QUIRK_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, l, h, __VA_ARGS__)
 
 static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = {
 	USB_QUIRK(ASUS, LCM, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(INSIDEOUT, EDGEPORT4, 0x094, 0x094, UQ_SWAP_UNICODE),
 	USB_QUIRK(DALLAS, J6502, 0x0a2, 0x0a2, UQ_BAD_ADC),
 	USB_QUIRK(DALLAS, J6502, 0x0a2, 0x0a2, UQ_AU_NO_XU),
 	USB_QUIRK(ALTEC, ADA70, 0x103, 0x103, UQ_BAD_ADC),
 	USB_QUIRK(ALTEC, ASC495, 0x000, 0x000, UQ_BAD_AUDIO),
 	USB_QUIRK(QTRONIX, 980N, 0x110, 0x110, UQ_SPUR_BUT_UP),
 	USB_QUIRK(ALCOR2, KBD_HUB, 0x001, 0x001, UQ_SPUR_BUT_UP),
 	USB_QUIRK(MCT, HUB0100, 0x102, 0x102, UQ_BUS_POWERED),
 	USB_QUIRK(MCT, USB232, 0x102, 0x102, UQ_BUS_POWERED),
 	USB_QUIRK(TI, UTUSB41, 0x110, 0x110, UQ_POWER_CLAIM),
 	USB_QUIRK(TELEX, MIC1, 0x009, 0x009, UQ_AU_NO_FRAC),
 	USB_QUIRK(SILICONPORTALS, YAPPHONE, 0x100, 0x100, UQ_AU_INP_ASYNC),
 	USB_QUIRK(LOGITECH, UN53B, 0x0000, 0xffff, UQ_NO_STRINGS),
 	USB_QUIRK(REALTEK, RTL8196EU, 0x0000, 0xffff, UQ_CFG_INDEX_1),
 	USB_QUIRK(ELSA, MODEM1, 0x0000, 0xffff, UQ_CFG_INDEX_1),
 	USB_QUIRK(PLANEX2, MZKUE150N, 0x0000, 0xffff, UQ_CFG_INDEX_1),
 	/* Quirks for printer devices */
 	USB_QUIRK(HP, 895C, 0x0000, 0xffff, UQ_BROKEN_BIDIR),
 	USB_QUIRK(HP, 880C, 0x0000, 0xffff, UQ_BROKEN_BIDIR),
 	USB_QUIRK(HP, 815C, 0x0000, 0xffff, UQ_BROKEN_BIDIR),
 	USB_QUIRK(HP, 810C, 0x0000, 0xffff, UQ_BROKEN_BIDIR),
 	USB_QUIRK(HP, 830C, 0x0000, 0xffff, UQ_BROKEN_BIDIR),
 	USB_QUIRK(HP, 1220C, 0x0000, 0xffff, UQ_BROKEN_BIDIR),
 	USB_QUIRK(XEROX, WCM15, 0x0000, 0xffff, UQ_BROKEN_BIDIR),
 	/* Devices which should be ignored by uhid */
 	USB_QUIRK(APC, UPS, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(BELKIN, F6C550AVR, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(CYBERPOWER, 1500CAVRLCD, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(CYPRESS, SILVERSHIELD, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(DELORME, EARTHMATE, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(DREAMLINK, DL100B, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(ITUNERNET, USBLCD2X20, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(ITUNERNET, USBLCD4X20, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(LIEBERT, POWERSURE_PXT, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(LIEBERT2, PSI1000, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(MGE, UPS1, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(MGE, UPS2, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(APPLE, IPHONE, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(APPLE, IPHONE_3G, 0x0000, 0xffff, UQ_HID_IGNORE),
 	USB_QUIRK(MEGATEC, UPS, 0x0000, 0xffff, UQ_HID_IGNORE),
 	/* Devices which should be ignored by both ukbd and uhid */
 	USB_QUIRK(CYPRESS, WISPY1A, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE),
 	USB_QUIRK(METAGEEK, WISPY1B, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE),
 	USB_QUIRK(METAGEEK, WISPY24X, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE),
 	USB_QUIRK(METAGEEK2, WISPYDBX, 0x0000, 0xffff, UQ_KBD_IGNORE, UQ_HID_IGNORE),
 	USB_QUIRK(TENX, UAUDIO0, 0x0101, 0x0101, UQ_AUDIO_SWAP_LR),
 	/* MS keyboards do weird things */
 	USB_QUIRK(MICROSOFT, NATURAL4000, 0x0000, 0xFFFF, UQ_KBD_BOOTPROTO),
 	USB_QUIRK(MICROSOFT, WLINTELLIMOUSE, 0x0000, 0xffff, UQ_MS_LEADING_BYTE),
 	/* Quirk for Corsair Vengeance K60 keyboard */
 	USB_QUIRK(CORSAIR, K60, 0x0000, 0xffff, UQ_KBD_BOOTPROTO),
 	/* Quirk for Corsair Vengeance K70 keyboard */
 	USB_QUIRK(CORSAIR, K70, 0x0000, 0xffff, UQ_KBD_BOOTPROTO),
 	/* umodem(4) device quirks */
 	USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(MOTOROLA2, T720C, 0x001, 0x001, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(EICON, DIVA852, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(SIEMENS2, ES75, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(QUALCOMM, CDMA_MSM, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(QUALCOMM2, CDMA_MSM, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(CURITEL, UM150, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(CURITEL, UM175, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA),
 	USB_QUIRK(VERTEX, VW110L, 0x0000, 0xffff, UQ_ASSUME_CM_OVER_DATA),
 
 	/* USB Mass Storage Class Quirks */
 	USB_QUIRK_VP(USB_VENDOR_ASAHIOPTICAL, 0, UQ_MSC_NO_RS_CLEAR_UA,
 	    UQ_MATCH_VENDOR_ONLY),
 	USB_QUIRK(ADDON, ATTACHE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(ADDON, A256MB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(ADDON, DISKPRO512, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(ADDONICS2, CABLE_205, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(AIPTEK, POCKETCAM3M, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(ALCOR, UMCR_9361, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(ALCOR, TRANSCEND, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
 	    UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY),
 	USB_QUIRK(APACER, HT202, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(ASAHIOPTICAL, OPTIO230, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(ASAHIOPTICAL, OPTIO330, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(ATP, EUSB, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(BELKIN, USB2SCSI, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(CASIO, QV_DIGICAM, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(CCYU, ED1064, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(CENTURY, EX35QUAT, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(CYPRESS, XX6830XX, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(DESKNOTE, UCR_61S2B, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(DMI, CFSM_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(EMTEC, RUF2PS, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(EPSON, STYLUS_875DC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(EPSON, STYLUS_895, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(FEIYA, 5IN1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(FEIYA, ELANGO, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(FREECOM, DVD, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(FUJIPHOTO, MASS0100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(GENESYS, GL641USB2IDE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(GENESYS, GL641USB2IDE_2, 0x0000, 0xffff,
 	    UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_START_STOP,
 	    UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(GENESYS, GL641USB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(GENESYS, GL641USB_2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_WRONG_CSWSIG),
 	USB_QUIRK(HAGIWARA, FG, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(HAGIWARA, FGSM, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(HITACHI, DVDCAM_DZ_MV100A, 0x0000, 0xffff,
 	    UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(HITACHI, DVDCAM_USB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(HP, CDW4E, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_ATAPI),
 	USB_QUIRK(HP, CDW8200, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_TEST_UNIT_READY,
 	    UQ_MSC_NO_START_STOP),
 	USB_QUIRK(IMAGINATION, DBX1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_WRONG_CSWSIG),
 	USB_QUIRK(INSYSTEM, USBCABLE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_TEST_UNIT_READY,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_ALT_IFACE_1),
 	USB_QUIRK(INSYSTEM, ATAPI, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC),
 	USB_QUIRK(INSYSTEM, STORAGE_V2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC),
 	USB_QUIRK(IODATA, IU_CD2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(IODATA, DVR_UEH8, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(IOMEGA, ZIP100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_TEST_UNIT_READY), /* XXX ZIP drives can also use ATAPI */
 	USB_QUIRK(JMICRON, JM20337, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(KINGSTON, HYPERX3_0, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(KYOCERA, FINECAM_L3, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(KYOCERA, FINECAM_S3X, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(KYOCERA, FINECAM_S4, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(KYOCERA, FINECAM_S5, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(LACIE, HD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC),
 	USB_QUIRK(LEXAR, CF_READER, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(LEXAR, JUMPSHOT, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(LEXAR, JUMPDRIVE, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(LOGITEC, LDR_H443SU2, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(LOGITEC, LDR_H443U2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI,),
 	USB_QUIRK(MELCO, DUBPXXG, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(MICROTECH, DPCM, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY,
 	    UQ_MSC_NO_START_STOP),
 	USB_QUIRK(MICRON, REALSSD, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(MICROTECH, SCSIDB25, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(MICROTECH, SCSIHD50, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(MINOLTA, E223, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(MINOLTA, F300, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(MITSUMI, CDRRW, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI |
 	    UQ_MSC_FORCE_PROTO_ATAPI),
 	USB_QUIRK(MOTOROLA2, E398, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
 	    UQ_MSC_NO_INQUIRY_EVPD, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK_VP(USB_VENDOR_MPMAN, 0, UQ_MSC_NO_SYNC_CACHE,
 	    UQ_MATCH_VENDOR_ONLY),
 	USB_QUIRK(MSYSTEMS, DISKONKEY, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_GETMAXLUN,
 	    UQ_MSC_NO_RS_CLEAR_UA),
 	USB_QUIRK(MSYSTEMS, DISKONKEY2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_ATAPI),
 	USB_QUIRK(MYSON, HEDEN, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(NEODIO, ND3260, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ),
 	USB_QUIRK(NETAC, CF_CARD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(NETAC, ONLYDISK, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(NETCHIP, CLIK_40, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_ATAPI,
 	    UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(NETCHIP, POCKETBOOK, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(NIKON, D300, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(OLYMPUS, C1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_WRONG_CSWSIG),
 	USB_QUIRK(OLYMPUS, C700, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(ONSPEC, SDS_HOTFIND_D, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(ONSPEC, CFMS_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(ONSPEC, CFSM_COMBO, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(ONSPEC, CFSM_READER, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(ONSPEC, CFSM_READER2, 0x0000, 0xffff,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(ONSPEC, MDCFE_B_CF_READER, 0x0000, 0xffff,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(ONSPEC, MDSM_B_READER, 0x0000, 0xffff,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(ONSPEC, READER, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(ONSPEC, UCF100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(ONSPEC2, IMAGEMATE_SDDR55, 0x0000, 0xffff,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(PANASONIC, KXL840AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(PANASONIC, KXLCB20AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(PANASONIC, KXLCB35AN, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(PANASONIC, LS120CAM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_UFI),
 	USB_QUIRK(PLEXTOR, 40_12_40U, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_TEST_UNIT_READY),
 	USB_QUIRK(PNY, ATTACHE2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE,
 	    UQ_MSC_NO_START_STOP),
 	USB_QUIRK(PROLIFIC, PL2506, 0x0000, 0xffff,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN,
 	    USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(SANDISK, SDDR05A, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1,
 	    UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SANDISK, SDDR09, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_READ_CAP_OFFBY1, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SANDISK, SDDR12, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1,
 	    UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SANDISK, SDCZ2_128, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(SANDISK, SDCZ2_256, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(SANDISK, SDCZ4_128, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(SANDISK, SDCZ4_256, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(SANDISK, SDDR31, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1),
 	USB_QUIRK(SANDISK, IMAGEMATE_SDDR289, 0x0000, 0xffff,
 	    UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SCANLOGIC, SL11R, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(SHUTTLE, EUSB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_NO_TEST_UNIT_READY,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_SHUTTLE_INIT),
 	USB_QUIRK(SHUTTLE, CDRW, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_ATAPI),
 	USB_QUIRK(SHUTTLE, CF, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_ATAPI),
 	USB_QUIRK(SHUTTLE, EUSBATAPI, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_ATAPI),
 	USB_QUIRK(SHUTTLE, EUSBCFSM, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(SHUTTLE, EUSCSI, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(SHUTTLE, HIFD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SHUTTLE, SDDR09, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI,
 	    UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SHUTTLE, ZIOMMC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SIGMATEL, I_BEAD100, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_SHUTTLE_INIT),
 	USB_QUIRK(SIIG, WINTERREADER, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(SKANHEX, MD_7425, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(SKANHEX, SX_520Z, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(SONY, HANDYCAM, 0x0500, 0x0500, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC, UQ_MSC_RBC_PAD_TO_12),
 	USB_QUIRK(SONY, CLIE_40_MS, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(SONY, DSC, 0x0500, 0x0500, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC, UQ_MSC_RBC_PAD_TO_12),
 	USB_QUIRK(SONY, DSC, 0x0600, 0x0600, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC, UQ_MSC_RBC_PAD_TO_12),
 	USB_QUIRK(SONY, DSC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC),
 	USB_QUIRK(SONY, HANDYCAM, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC),
 	USB_QUIRK(SONY, MSC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_RBC),
 	USB_QUIRK(SONY, MS_MSC_U03, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_UFI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SONY, MS_NW_MS7, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SONY, MS_PEG_N760C, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(SONY, MSACUS1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(SONY, PORTABLE_HDD_V2, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(STMICRO, ST72682, 0x0000, 0xffff, UQ_MSC_NO_PREVENT_ALLOW),
 	USB_QUIRK(SUPERTOP, IDE, 0x0000, 0xffff, UQ_MSC_IGNORE_RESIDUE,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(SUPERTOP, FLASHDRIVE, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(TAUGA, CAMERAMATE, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(TEAC, FD05PUB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_UFI),
 	USB_QUIRK(TECLAST, TLC300, 0x0000, 0xffff, UQ_MSC_NO_TEST_UNIT_READY,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(TREK, MEMKEY, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(TREK, THUMBDRIVE_8MB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(TRUMPION, C3310, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_UFI),
 	USB_QUIRK(TRUMPION, MP3, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_RBC),
 	USB_QUIRK(TRUMPION, T33520, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(TWINMOS, MDIV, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI),
 	USB_QUIRK(VIA, USB2IDEBRIDGE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(VIVITAR, 35XX, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(WESTERN, COMBO, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(WESTERN, EXTHDD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(WESTERN, MYBOOK, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY_EVPD,
 	    UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_00, 0x0000, 0xffff, UQ_MSC_FORCE_SHORT_INQ),
 	USB_QUIRK(WESTERN, MYPASSPORT_01, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_02, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_03, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_04, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_05, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_06, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_07, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_08, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_09, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORT_10, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
+	USB_QUIRK(WESTERN, MYPASSPORT_11, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_00, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_01, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_02, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_03, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_04, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_05, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_06, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_07, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_08, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WESTERN, MYPASSPORTES_09, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(WINMAXGROUP, FLASH64MC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY),
 	USB_QUIRK(YANO, FW800HD, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ,
 	    UQ_MSC_NO_START_STOP, UQ_MSC_IGNORE_RESIDUE),
 	USB_QUIRK(YANO, U640MO, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI_I,
 	    UQ_MSC_FORCE_PROTO_ATAPI, UQ_MSC_FORCE_SHORT_INQ),
 	USB_QUIRK(YEDATA, FLASHBUSTERU, 0x0000, 0x007F, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_UFI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED,
 	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(YEDATA, FLASHBUSTERU, 0x0080, 0x0080, UQ_MSC_FORCE_WIRE_CBI_I,
 	    UQ_MSC_FORCE_PROTO_UFI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED,
 	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(YEDATA, FLASHBUSTERU, 0x0081, 0xFFFF, UQ_MSC_FORCE_WIRE_CBI_I,
 	    UQ_MSC_FORCE_PROTO_UFI, UQ_MSC_NO_RS_CLEAR_UA, UQ_MSC_FLOPPY_SPEED,
 	    UQ_MSC_NO_GETMAXLUN),
 	USB_QUIRK(ZORAN, EX20DSC, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI,
 	    UQ_MSC_FORCE_PROTO_ATAPI),
 	USB_QUIRK(MEIZU, M6_SL, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(TOSHIBA, TRANSMEMORY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE,
 	    UQ_MSC_NO_PREVENT_ALLOW),
 	USB_QUIRK(VIALABS, USB30SATABRIDGE, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE),
 
 	/* Non-standard USB MIDI devices */
 	USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, SC8850, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, SD90, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, UM880N, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, UA100, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, UM4, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, U8, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, UM2, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, SC8820, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, PC300, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, SK500, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, SCD70, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, UM550, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, SD20, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, SD80, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(ROLAND, UA700, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(EGO, M4U, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI),
 	USB_QUIRK(LOGILINK, U2M, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI),
 	USB_QUIRK(MEDELI, DD305, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI, UQ_MATCH_VENDOR_ONLY),
 	USB_QUIRK(REDOCTANE, GHMIDI, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI),
 	USB_QUIRK(TEXTECH, U2M_1, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI),
 	USB_QUIRK(TEXTECH, U2M_2, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI),
 	USB_QUIRK(WCH2, U2M, 0x0000, 0xffff, UQ_SINGLE_CMD_MIDI),
 
 	/* Non-standard USB AUDIO devices */
 	USB_QUIRK(MAUDIO, FASTTRACKULTRA, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 	USB_QUIRK(MAUDIO, FASTTRACKULTRA8R, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS),
 
 	/*
 	 * Quirks for manufacturers which USB devices does not respond
 	 * after issuing non-supported commands:
 	 */
 	USB_QUIRK(ALCOR, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY, UQ_MATCH_VENDOR_ONLY),
 	USB_QUIRK(APPLE, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY),
 	USB_QUIRK(FEIYA, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY),
 	USB_QUIRK(REALTEK, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY),
 	USB_QUIRK(INITIO, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY),
 };
 #undef USB_QUIRK_VP
 #undef USB_QUIRK
 
 static const char *usb_quirk_str[USB_QUIRK_MAX] = {
 	[UQ_NONE]		= "UQ_NONE",
 	[UQ_MATCH_VENDOR_ONLY]	= "UQ_MATCH_VENDOR_ONLY",
 	[UQ_AUDIO_SWAP_LR]	= "UQ_AUDIO_SWAP_LR",
 	[UQ_AU_INP_ASYNC]	= "UQ_AU_INP_ASYNC",
 	[UQ_AU_NO_FRAC]		= "UQ_AU_NO_FRAC",
 	[UQ_AU_NO_XU]		= "UQ_AU_NO_XU",
 	[UQ_BAD_ADC]		= "UQ_BAD_ADC",
 	[UQ_BAD_AUDIO]		= "UQ_BAD_AUDIO",
 	[UQ_BROKEN_BIDIR]	= "UQ_BROKEN_BIDIR",
 	[UQ_BUS_POWERED]	= "UQ_BUS_POWERED",
 	[UQ_HID_IGNORE]		= "UQ_HID_IGNORE",
 	[UQ_KBD_IGNORE]		= "UQ_KBD_IGNORE",
 	[UQ_KBD_BOOTPROTO]	= "UQ_KBD_BOOTPROTO",
 	[UQ_UMS_IGNORE]		= "UQ_UMS_IGNORE",
 	[UQ_MS_BAD_CLASS]	= "UQ_MS_BAD_CLASS",
 	[UQ_MS_LEADING_BYTE]	= "UQ_MS_LEADING_BYTE",
 	[UQ_MS_REVZ]		= "UQ_MS_REVZ",
 	[UQ_NO_STRINGS]		= "UQ_NO_STRINGS",
 	[UQ_POWER_CLAIM]	= "UQ_POWER_CLAIM",
 	[UQ_SPUR_BUT_UP]	= "UQ_SPUR_BUT_UP",
 	[UQ_SWAP_UNICODE]	= "UQ_SWAP_UNICODE",
 	[UQ_CFG_INDEX_1]	= "UQ_CFG_INDEX_1",
 	[UQ_CFG_INDEX_2]	= "UQ_CFG_INDEX_2",
 	[UQ_CFG_INDEX_3]	= "UQ_CFG_INDEX_3",
 	[UQ_CFG_INDEX_4]	= "UQ_CFG_INDEX_4",
 	[UQ_CFG_INDEX_0]	= "UQ_CFG_INDEX_0",
 	[UQ_ASSUME_CM_OVER_DATA]	= "UQ_ASSUME_CM_OVER_DATA",
 	[UQ_MSC_NO_TEST_UNIT_READY]	= "UQ_MSC_NO_TEST_UNIT_READY",
 	[UQ_MSC_NO_RS_CLEAR_UA]		= "UQ_MSC_NO_RS_CLEAR_UA",
 	[UQ_MSC_NO_START_STOP]		= "UQ_MSC_NO_START_STOP",
 	[UQ_MSC_NO_GETMAXLUN]		= "UQ_MSC_NO_GETMAXLUN",
 	[UQ_MSC_NO_INQUIRY]		= "UQ_MSC_NO_INQUIRY",
 	[UQ_MSC_NO_INQUIRY_EVPD]	= "UQ_MSC_NO_INQUIRY_EVPD",
 	[UQ_MSC_NO_PREVENT_ALLOW]	= "UQ_MSC_NO_PREVENT_ALLOW",
 	[UQ_MSC_NO_SYNC_CACHE]		= "UQ_MSC_NO_SYNC_CACHE",
 	[UQ_MSC_SHUTTLE_INIT]		= "UQ_MSC_SHUTTLE_INIT",
 	[UQ_MSC_ALT_IFACE_1]		= "UQ_MSC_ALT_IFACE_1",
 	[UQ_MSC_FLOPPY_SPEED]		= "UQ_MSC_FLOPPY_SPEED",
 	[UQ_MSC_IGNORE_RESIDUE]		= "UQ_MSC_IGNORE_RESIDUE",
 	[UQ_MSC_WRONG_CSWSIG]		= "UQ_MSC_WRONG_CSWSIG",
 	[UQ_MSC_RBC_PAD_TO_12]		= "UQ_MSC_RBC_PAD_TO_12",
 	[UQ_MSC_READ_CAP_OFFBY1]	= "UQ_MSC_READ_CAP_OFFBY1",
 	[UQ_MSC_FORCE_SHORT_INQ]	= "UQ_MSC_FORCE_SHORT_INQ",
 	[UQ_MSC_FORCE_WIRE_BBB]		= "UQ_MSC_FORCE_WIRE_BBB",
 	[UQ_MSC_FORCE_WIRE_CBI]		= "UQ_MSC_FORCE_WIRE_CBI",
 	[UQ_MSC_FORCE_WIRE_CBI_I]	= "UQ_MSC_FORCE_WIRE_CBI_I",
 	[UQ_MSC_FORCE_PROTO_SCSI]	= "UQ_MSC_FORCE_PROTO_SCSI",
 	[UQ_MSC_FORCE_PROTO_ATAPI]	= "UQ_MSC_FORCE_PROTO_ATAPI",
 	[UQ_MSC_FORCE_PROTO_UFI]	= "UQ_MSC_FORCE_PROTO_UFI",
 	[UQ_MSC_FORCE_PROTO_RBC]	= "UQ_MSC_FORCE_PROTO_RBC",
 	[UQ_MSC_EJECT_HUAWEI]		= "UQ_MSC_EJECT_HUAWEI",
 	[UQ_MSC_EJECT_SIERRA]		= "UQ_MSC_EJECT_SIERRA",
 	[UQ_MSC_EJECT_SCSIEJECT]	= "UQ_MSC_EJECT_SCSIEJECT",
 	[UQ_MSC_EJECT_REZERO]		= "UQ_MSC_EJECT_REZERO",
 	[UQ_MSC_EJECT_ZTESTOR]		= "UQ_MSC_EJECT_ZTESTOR",
 	[UQ_MSC_EJECT_CMOTECH]		= "UQ_MSC_EJECT_CMOTECH",
 	[UQ_MSC_EJECT_WAIT]		= "UQ_MSC_EJECT_WAIT",
 	[UQ_MSC_EJECT_SAEL_M460]	= "UQ_MSC_EJECT_SAEL_M460",
 	[UQ_MSC_EJECT_HUAWEISCSI]	= "UQ_MSC_EJECT_HUAWEISCSI",
 	[UQ_MSC_EJECT_HUAWEISCSI2]	= "UQ_MSC_EJECT_HUAWEISCSI2",
 	[UQ_MSC_EJECT_TCT]		= "UQ_MSC_EJECT_TCT",
 	[UQ_BAD_MIDI]			= "UQ_BAD_MIDI",
 	[UQ_AU_VENDOR_CLASS]		= "UQ_AU_VENDOR_CLASS",
 	[UQ_SINGLE_CMD_MIDI]		= "UQ_SINGLE_CMD_MIDI",
 };
 
 /*------------------------------------------------------------------------*
  *	usb_quirkstr
  *
  * This function converts an USB quirk code into a string.
  *------------------------------------------------------------------------*/
 static const char *
 usb_quirkstr(uint16_t quirk)
 {
 	return ((quirk < USB_QUIRK_MAX) ?
 	    usb_quirk_str[quirk] : "USB_QUIRK_UNKNOWN");
 }
 
 /*------------------------------------------------------------------------*
  *	usb_test_quirk_by_info
  *
  * Returns:
  * 0: Quirk not found
  * Else: Quirk found
  *------------------------------------------------------------------------*/
 static uint8_t
 usb_test_quirk_by_info(const struct usbd_lookup_info *info, uint16_t quirk)
 {
 	uint16_t x;
 	uint16_t y;
 
 	if (quirk == UQ_NONE)
 		goto done;
 
 	mtx_lock(&usb_quirk_mtx);
 
 	for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) {
 		/* see if quirk information does not match */
 		if ((usb_quirks[x].vid != info->idVendor) ||
 		    (usb_quirks[x].lo_rev > info->bcdDevice) ||
 		    (usb_quirks[x].hi_rev < info->bcdDevice)) {
 			continue;
 		}
 		/* see if quirk only should match vendor ID */
 		if (usb_quirks[x].pid != info->idProduct) {
 			if (usb_quirks[x].pid != 0)
 				continue;
 
 			for (y = 0; y != USB_SUB_QUIRKS_MAX; y++) {
 				if (usb_quirks[x].quirks[y] == UQ_MATCH_VENDOR_ONLY)
 					break;
 			}
 			if (y == USB_SUB_QUIRKS_MAX)
 				continue;
 		}
 		/* lookup quirk */
 		for (y = 0; y != USB_SUB_QUIRKS_MAX; y++) {
 			if (usb_quirks[x].quirks[y] == quirk) {
 				mtx_unlock(&usb_quirk_mtx);
 				DPRINTF("Found quirk '%s'.\n", usb_quirkstr(quirk));
 				return (1);
 			}
 		}
 		/* no quirk found */
 		break;
 	}
 	mtx_unlock(&usb_quirk_mtx);
 done:
 	return (0);			/* no quirk match */
 }
 
 static struct usb_quirk_entry *
 usb_quirk_get_entry(uint16_t vid, uint16_t pid,
     uint16_t lo_rev, uint16_t hi_rev, uint8_t do_alloc)
 {
 	uint16_t x;
 
 	mtx_assert(&usb_quirk_mtx, MA_OWNED);
 
 	if ((vid | pid | lo_rev | hi_rev) == 0) {
 		/* all zero - special case */
 		return (usb_quirks + USB_DEV_QUIRKS_MAX - 1);
 	}
 	/* search for an existing entry */
 	for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) {
 		/* see if quirk information does not match */
 		if ((usb_quirks[x].vid != vid) ||
 		    (usb_quirks[x].pid != pid) ||
 		    (usb_quirks[x].lo_rev != lo_rev) ||
 		    (usb_quirks[x].hi_rev != hi_rev)) {
 			continue;
 		}
 		return (usb_quirks + x);
 	}
 
 	if (do_alloc == 0) {
 		/* no match */
 		return (NULL);
 	}
 	/* search for a free entry */
 	for (x = 0; x != USB_DEV_QUIRKS_MAX; x++) {
 		/* see if quirk information does not match */
 		if ((usb_quirks[x].vid |
 		    usb_quirks[x].pid |
 		    usb_quirks[x].lo_rev |
 		    usb_quirks[x].hi_rev) != 0) {
 			continue;
 		}
 		usb_quirks[x].vid = vid;
 		usb_quirks[x].pid = pid;
 		usb_quirks[x].lo_rev = lo_rev;
 		usb_quirks[x].hi_rev = hi_rev;
 
 		return (usb_quirks + x);
 	}
 
 	/* no entry found */
 	return (NULL);
 }
 
 /*------------------------------------------------------------------------*
  *	usb_quirk_ioctl - handle quirk IOCTLs
  *
  * Returns:
  * 0: Success
  * Else: Failure
  *------------------------------------------------------------------------*/
 static int
 usb_quirk_ioctl(unsigned long cmd, caddr_t data,
     int fflag, struct thread *td)
 {
 	struct usb_gen_quirk *pgq;
 	struct usb_quirk_entry *pqe;
 	uint32_t x;
 	uint32_t y;
 	int err;
 
 	switch (cmd) {
 	case USB_DEV_QUIRK_GET:
 		pgq = (void *)data;
 		x = pgq->index % USB_SUB_QUIRKS_MAX;
 		y = pgq->index / USB_SUB_QUIRKS_MAX;
 		if (y >= USB_DEV_QUIRKS_MAX) {
 			return (EINVAL);
 		}
 		mtx_lock(&usb_quirk_mtx);
 		/* copy out data */
 		pgq->vid = usb_quirks[y].vid;
 		pgq->pid = usb_quirks[y].pid;
 		pgq->bcdDeviceLow = usb_quirks[y].lo_rev;
 		pgq->bcdDeviceHigh = usb_quirks[y].hi_rev;
 		strlcpy(pgq->quirkname,
 		    usb_quirkstr(usb_quirks[y].quirks[x]),
 		    sizeof(pgq->quirkname));
 		mtx_unlock(&usb_quirk_mtx);
 		return (0);		/* success */
 
 	case USB_QUIRK_NAME_GET:
 		pgq = (void *)data;
 		x = pgq->index;
 		if (x >= USB_QUIRK_MAX) {
 			return (EINVAL);
 		}
 		strlcpy(pgq->quirkname,
 		    usb_quirkstr(x), sizeof(pgq->quirkname));
 		return (0);		/* success */
 
 	case USB_DEV_QUIRK_ADD:
 		pgq = (void *)data;
 
 		/* check privileges */
 		err = priv_check(curthread, PRIV_DRIVER);
 		if (err) {
 			return (err);
 		}
 		/* convert quirk string into numerical */
 		for (y = 0; y != USB_DEV_QUIRKS_MAX; y++) {
 			if (strcmp(pgq->quirkname, usb_quirkstr(y)) == 0) {
 				break;
 			}
 		}
 		if (y == USB_DEV_QUIRKS_MAX) {
 			return (EINVAL);
 		}
 		if (y == UQ_NONE) {
 			return (EINVAL);
 		}
 		mtx_lock(&usb_quirk_mtx);
 		pqe = usb_quirk_get_entry(pgq->vid, pgq->pid,
 		    pgq->bcdDeviceLow, pgq->bcdDeviceHigh, 1);
 		if (pqe == NULL) {
 			mtx_unlock(&usb_quirk_mtx);
 			return (EINVAL);
 		}
 		for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) {
 			if (pqe->quirks[x] == UQ_NONE) {
 				pqe->quirks[x] = y;
 				break;
 			}
 		}
 		mtx_unlock(&usb_quirk_mtx);
 		if (x == USB_SUB_QUIRKS_MAX) {
 			return (ENOMEM);
 		}
 		return (0);		/* success */
 
 	case USB_DEV_QUIRK_REMOVE:
 		pgq = (void *)data;
 		/* check privileges */
 		err = priv_check(curthread, PRIV_DRIVER);
 		if (err) {
 			return (err);
 		}
 		/* convert quirk string into numerical */
 		for (y = 0; y != USB_DEV_QUIRKS_MAX; y++) {
 			if (strcmp(pgq->quirkname, usb_quirkstr(y)) == 0) {
 				break;
 			}
 		}
 		if (y == USB_DEV_QUIRKS_MAX) {
 			return (EINVAL);
 		}
 		if (y == UQ_NONE) {
 			return (EINVAL);
 		}
 		mtx_lock(&usb_quirk_mtx);
 		pqe = usb_quirk_get_entry(pgq->vid, pgq->pid,
 		    pgq->bcdDeviceLow, pgq->bcdDeviceHigh, 0);
 		if (pqe == NULL) {
 			mtx_unlock(&usb_quirk_mtx);
 			return (EINVAL);
 		}
 		for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) {
 			if (pqe->quirks[x] == y) {
 				pqe->quirks[x] = UQ_NONE;
 				break;
 			}
 		}
 		if (x == USB_SUB_QUIRKS_MAX) {
 			mtx_unlock(&usb_quirk_mtx);
 			return (ENOMEM);
 		}
 		for (x = 0; x != USB_SUB_QUIRKS_MAX; x++) {
 			if (pqe->quirks[x] != UQ_NONE) {
 				break;
 			}
 		}
 		if (x == USB_SUB_QUIRKS_MAX) {
 			/* all quirk entries are unused - release */
 			memset(pqe, 0, sizeof(*pqe));
 		}
 		mtx_unlock(&usb_quirk_mtx);
 		return (0);		/* success */
 
 	default:
 		break;
 	}
 	return (ENOIOCTL);
 }
 
 static void
 usb_quirk_init(void *arg)
 {
 	/* initialize mutex */
 	mtx_init(&usb_quirk_mtx, "USB quirk", NULL, MTX_DEF);
 
 	/* register our function */
 	usb_test_quirk_p = &usb_test_quirk_by_info;
 	usb_quirk_ioctl_p = &usb_quirk_ioctl;
 }
 
 static void
 usb_quirk_uninit(void *arg)
 {
 	usb_quirk_unload(arg);
 
 	/* destroy mutex */
 	mtx_destroy(&usb_quirk_mtx);
 }
 
 SYSINIT(usb_quirk_init, SI_SUB_LOCK, SI_ORDER_FIRST, usb_quirk_init, NULL);
 SYSUNINIT(usb_quirk_uninit, SI_SUB_LOCK, SI_ORDER_ANY, usb_quirk_uninit, NULL);
Index: projects/arm_intrng/sys/dev/usb/usbdevs
===================================================================
--- projects/arm_intrng/sys/dev/usb/usbdevs	(revision 276247)
+++ projects/arm_intrng/sys/dev/usb/usbdevs	(revision 276248)
@@ -1,4615 +1,4618 @@
 $FreeBSD$
 /* $NetBSD: usbdevs,v 1.392 2004/12/29 08:38:44 imp Exp $ */
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Lennart Augustsson (lennart@augustsson.net) at
  * Carlstedt Research & Technology.
  *
  * 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.
  */
 
 /*
  * List of known USB vendors
  *
  * USB.org publishes a VID list of USB-IF member companies at
  * http://www.usb.org/developers/tools
  * Note that it does not show companies that have obtained a Vendor ID
  * without becoming full members.
  *
  * Please note that these IDs do not do anything. Adding an ID here and
  * regenerating the usbdevs.h and usbdevs_data.h only makes a symbolic name
  * available to the source code and does not change any functionality, nor
  * does it make your device available to a specific driver.
  * It will however make the descriptive string available if a device does not
  * provide the string itself.
  *
  * After adding a vendor ID VNDR and a product ID PRDCT you will have the
  * following extra defines:
  * #define USB_VENDOR_VNDR              0x????
  * #define USB_PRODUCT_VNDR_PRDCT       0x????
  *
  * You may have to add these defines to the respective probe routines to
  * make the device recognised by the appropriate device driver.
  */
 
 vendor UNKNOWN1		0x0053	Unknown vendor
 vendor UNKNOWN2		0x0105	Unknown vendor
 vendor EGALAX2		0x0123	eGalax, Inc.
 vendor CHIPSBANK	0x0204	Chipsbank Microelectronics Co.
 vendor HUMAX		0x02ad	HUMAX
 vendor LTS		0x0386	LTS
 vendor BWCT		0x03da	Bernd Walter Computer Technology
 vendor AOX		0x03e8	AOX
 vendor THESYS		0x03e9	Thesys
 vendor DATABROADCAST	0x03ea	Data Broadcasting
 vendor ATMEL		0x03eb	Atmel
 vendor IWATSU		0x03ec	Iwatsu America
 vendor MITSUMI		0x03ee	Mitsumi
 vendor HP		0x03f0	Hewlett Packard
 vendor GENOA		0x03f1	Genoa
 vendor OAK		0x03f2	Oak
 vendor ADAPTEC		0x03f3	Adaptec
 vendor DIEBOLD		0x03f4	Diebold
 vendor SIEMENSELECTRO	0x03f5	Siemens Electromechanical
 vendor EPSONIMAGING	0x03f8	Epson Imaging
 vendor KEYTRONIC	0x03f9	KeyTronic
 vendor OPTI		0x03fb	OPTi
 vendor ELITEGROUP	0x03fc	Elitegroup
 vendor XILINX		0x03fd	Xilinx
 vendor FARALLON		0x03fe	Farallon Communications
 vendor NATIONAL		0x0400	National Semiconductor
 vendor NATIONALREG	0x0401	National Registry
 vendor ACERLABS		0x0402	Acer Labs
 vendor FTDI		0x0403	Future Technology Devices
 vendor NCR		0x0404	NCR
 vendor SYNOPSYS2	0x0405	Synopsys
 vendor FUJITSUICL	0x0406	Fujitsu-ICL
 vendor FUJITSU2		0x0407	Fujitsu Personal Systems
 vendor QUANTA		0x0408	Quanta
 vendor NEC		0x0409	NEC
 vendor KODAK		0x040a	Eastman Kodak
 vendor WELTREND		0x040b	Weltrend
 vendor VIA		0x040d	VIA
 vendor MCCI		0x040e	MCCI
 vendor MELCO		0x0411	Melco
 vendor LEADTEK		0x0413	Leadtek
 vendor WINBOND		0x0416	Winbond
 vendor PHOENIX		0x041a	Phoenix
 vendor CREATIVE		0x041e	Creative Labs
 vendor NOKIA		0x0421	Nokia
 vendor ADI		0x0422	ADI Systems
 vendor CATC		0x0423	Computer Access Technology
 vendor SMC2		0x0424	Standard Microsystems
 vendor MOTOROLA_HK	0x0425	Motorola HK
 vendor GRAVIS		0x0428	Advanced Gravis Computer
 vendor CIRRUSLOGIC	0x0429	Cirrus Logic
 vendor INNOVATIVE	0x042c	Innovative Semiconductors
 vendor MOLEX		0x042f	Molex
 vendor SUN		0x0430	Sun Microsystems
 vendor UNISYS		0x0432	Unisys
 vendor TAUGA		0x0436	Taugagreining HF
 vendor AMD		0x0438	Advanced Micro Devices
 vendor LEXMARK		0x043d	Lexmark International
 vendor LG		0x043e	LG Electronics
 vendor NANAO		0x0440	NANAO
 vendor GATEWAY		0x0443	Gateway 2000
 vendor NMB		0x0446	NMB
 vendor ALPS		0x044e	Alps Electric
 vendor THRUST		0x044f	Thrustmaster
 vendor TI		0x0451	Texas Instruments
 vendor ANALOGDEVICES	0x0456	Analog Devices
 vendor SIS		0x0457	Silicon Integrated Systems Corp.
 vendor KYE		0x0458	KYE Systems
 vendor DIAMOND2		0x045a	Diamond (Supra)
 vendor RENESAS		0x045b	Renesas
 vendor MICROSOFT	0x045e	Microsoft
 vendor PRIMAX		0x0461	Primax Electronics
 vendor MGE		0x0463	MGE UPS Systems
 vendor AMP		0x0464	AMP
 vendor CHERRY		0x046a	Cherry Mikroschalter
 vendor MEGATRENDS	0x046b	American Megatrends
 vendor LOGITECH		0x046d	Logitech
 vendor BTC		0x046e	Behavior Tech. Computer
 vendor PHILIPS		0x0471	Philips
 vendor SUN2		0x0472	Sun Microsystems (offical)
 vendor SANYO		0x0474	Sanyo Electric
 vendor SEAGATE		0x0477	Seagate
 vendor CONNECTIX	0x0478	Connectix
 vendor SEMTECH		0x047a	Semtech
 vendor KENSINGTON	0x047d	Kensington
 vendor LUCENT		0x047e	Lucent
 vendor PLANTRONICS	0x047f	Plantronics
 vendor KYOCERA		0x0482	Kyocera Wireless Corp.
 vendor STMICRO		0x0483	STMicroelectronics
 vendor FOXCONN		0x0489	Foxconn
 vendor MEIZU		0x0492	Meizu Electronics
 vendor YAMAHA		0x0499	YAMAHA
 vendor COMPAQ		0x049f	Compaq
 vendor HITACHI		0x04a4	Hitachi
 vendor ACERP		0x04a5	Acer Peripherals
 vendor DAVICOM		0x04a6	Davicom
 vendor VISIONEER	0x04a7	Visioneer
 vendor CANON		0x04a9	Canon
 vendor NIKON		0x04b0	Nikon
 vendor PAN		0x04b1	Pan International
 vendor IBM		0x04b3	IBM
 vendor CYPRESS		0x04b4	Cypress Semiconductor
 vendor ROHM		0x04b5	ROHM
 vendor COMPAL		0x04b7	Compal
 vendor EPSON		0x04b8	Seiko Epson
 vendor RAINBOW		0x04b9	Rainbow Technologies
 vendor IODATA		0x04bb	I-O Data
 vendor TDK		0x04bf	TDK
 vendor 3COMUSR		0x04c1	U.S. Robotics
 vendor METHODE		0x04c2	Methode Electronics Far East
 vendor MAXISWITCH	0x04c3	Maxi Switch
 vendor LOCKHEEDMER	0x04c4	Lockheed Martin Energy Research
 vendor FUJITSU		0x04c5	Fujitsu
 vendor TOSHIBAAM	0x04c6	Toshiba America
 vendor MICROMACRO	0x04c7	Micro Macro Technologies
 vendor KONICA		0x04c8	Konica
 vendor LITEON		0x04ca	Lite-On Technology
 vendor FUJIPHOTO	0x04cb	Fuji Photo Film
 vendor PHILIPSSEMI	0x04cc	Philips Semiconductors
 vendor TATUNG		0x04cd	Tatung Co. Of America
 vendor SCANLOGIC	0x04ce	ScanLogic
 vendor MYSON		0x04cf	Myson Technology
 vendor DIGI2		0x04d0	Digi
 vendor ITTCANON		0x04d1	ITT Canon
 vendor ALTEC		0x04d2	Altec Lansing
 vendor LSI		0x04d4	LSI
 vendor MENTORGRAPHICS	0x04d6	Mentor Graphics
 vendor ITUNERNET	0x04d8	I-Tuner Networks
 vendor HOLTEK		0x04d9	Holtek Semiconductor, Inc.
 vendor PANASONIC	0x04da	Panasonic (Matsushita)
 vendor HUANHSIN		0x04dc	Huan Hsin
 vendor SHARP		0x04dd	Sharp
 vendor IIYAMA		0x04e1	Iiyama
 vendor SHUTTLE		0x04e6	Shuttle Technology
 vendor ELO		0x04e7	Elo TouchSystems
 vendor SAMSUNG		0x04e8	Samsung Electronics
 vendor NORTHSTAR	0x04eb	Northstar
 vendor TOKYOELECTRON	0x04ec	Tokyo Electron
 vendor ANNABOOKS	0x04ed	Annabooks
 vendor JVC		0x04f1	JVC
 vendor CHICONY		0x04f2	Chicony Electronics
 vendor ELAN		0x04f3	Elan
 vendor NEWNEX		0x04f7	Newnex
 vendor BROTHER		0x04f9	Brother Industries
 vendor DALLAS		0x04fa	Dallas Semiconductor
 vendor AIPTEK2		0x04fc	AIPTEK International
 vendor PFU		0x04fe	PFU
 vendor FUJIKURA		0x0501	Fujikura/DDK
 vendor ACER		0x0502	Acer
 vendor 3COM		0x0506	3Com
 vendor HOSIDEN		0x0507	Hosiden Corporation
 vendor AZTECH		0x0509	Aztech Systems
 vendor BELKIN		0x050d	Belkin Components
 vendor KAWATSU		0x050f	Kawatsu Semiconductor
 vendor FCI		0x0514	FCI
 vendor LONGWELL		0x0516	Longwell
 vendor COMPOSITE	0x0518	Composite
 vendor STAR		0x0519	Star Micronics
 vendor APC		0x051d	American Power Conversion
 vendor SCIATLANTA	0x051e	Scientific Atlanta
 vendor TSM		0x0520	TSM
 vendor CONNECTEK	0x0522	Advanced Connectek USA
 vendor NETCHIP		0x0525	NetChip Technology
 vendor ALTRA		0x0527	ALTRA
 vendor ATI		0x0528	ATI Technologies
 vendor AKS		0x0529	Aladdin Knowledge Systems
 vendor TEKOM		0x052b	Tekom
 vendor CANONDEV		0x052c	Canon
 vendor WACOMTECH	0x0531	Wacom
 vendor INVENTEC		0x0537	Inventec
 vendor SHYHSHIUN	0x0539	Shyh Shiun Terminals
 vendor PREHWERKE	0x053a	Preh Werke Gmbh & Co. KG
 vendor SYNOPSYS		0x053f	Synopsys
 vendor UNIACCESS	0x0540	Universal Access
 vendor VIEWSONIC	0x0543	ViewSonic
 vendor XIRLINK		0x0545	Xirlink
 vendor ANCHOR		0x0547	Anchor Chips
 vendor SONY		0x054c	Sony
 vendor FUJIXEROX	0x0550	Fuji Xerox
 vendor VISION		0x0553	VLSI Vision
 vendor ASAHIKASEI	0x0556	Asahi Kasei Microsystems
 vendor ATEN		0x0557	ATEN International
 vendor SAMSUNG2		0x055d	Samsung Electronics
 vendor MUSTEK		0x055f	Mustek Systems
 vendor TELEX		0x0562	Telex Communications
 vendor CHINON		0x0564	Chinon
 vendor PERACOM		0x0565	Peracom Networks
 vendor ALCOR2		0x0566	Alcor Micro
 vendor XYRATEX		0x0567	Xyratex
 vendor WACOM		0x056a	WACOM
 vendor ETEK		0x056c	e-TEK Labs
 vendor EIZO		0x056d	EIZO
 vendor ELECOM		0x056e	Elecom
 vendor CONEXANT		0x0572	Conexant
 vendor HAUPPAUGE	0x0573	Hauppauge Computer Works
 vendor BAFO		0x0576	BAFO/Quality Computer Accessories
 vendor YEDATA		0x057b	Y-E Data
 vendor AVM		0x057c	AVM
 vendor QUICKSHOT	0x057f	Quickshot
 vendor ROLAND		0x0582	Roland
 vendor ROCKFIRE		0x0583	Rockfire
 vendor RATOC		0x0584	RATOC Systems
 vendor ZYXEL		0x0586	ZyXEL Communication
 vendor INFINEON		0x058b	Infineon
 vendor MICREL		0x058d	Micrel
 vendor ALCOR		0x058f	Alcor Micro
 vendor OMRON		0x0590	OMRON
 vendor ZORAN		0x0595	Zoran Microelectronics
 vendor NIIGATA		0x0598	Niigata
 vendor IOMEGA		0x059b	Iomega
 vendor ATREND		0x059c	A-Trend Technology
 vendor AID		0x059d	Advanced Input Devices
 vendor LACIE		0x059f	LaCie
 vendor FUJIFILM		0x05a2	Fuji Film
 vendor ARC		0x05a3	ARC
 vendor ORTEK		0x05a4	Ortek
 vendor CISCOLINKSYS3	0x05a6	Cisco-Linksys
 vendor BOSE		0x05a7	Bose
 vendor OMNIVISION	0x05a9	OmniVision
 vendor INSYSTEM		0x05ab	In-System Design
 vendor APPLE		0x05ac	Apple Computer
 vendor YCCABLE		0x05ad	Y.C. Cable
 vendor DIGITALPERSONA	0x05ba	DigitalPersona
 vendor 3G		0x05bc	3G Green Green Globe
 vendor RAFI		0x05bd	RAFI
 vendor TYCO		0x05be	Tyco
 vendor KAWASAKI		0x05c1	Kawasaki
 vendor DIGI		0x05c5	Digi International
 vendor QUALCOMM2	0x05c6	Qualcomm
 vendor QTRONIX		0x05c7	Qtronix
 vendor FOXLINK		0x05c8	Foxlink
 vendor RICOH		0x05ca	Ricoh
 vendor ELSA		0x05cc	ELSA
 vendor SCIWORX		0x05ce	sci-worx
 vendor BRAINBOXES	0x05d1	Brainboxes Limited
 vendor ULTIMA		0x05d8	Ultima
 vendor AXIOHM		0x05d9	Axiohm Transaction Solutions
 vendor MICROTEK		0x05da	Microtek
 vendor SUNTAC		0x05db	SUN Corporation
 vendor LEXAR		0x05dc	Lexar Media
 vendor ADDTRON		0x05dd	Addtron
 vendor SYMBOL		0x05e0	Symbol Technologies
 vendor SYNTEK		0x05e1	Syntek
 vendor GENESYS		0x05e3	Genesys Logic
 vendor FUJI		0x05e5	Fuji Electric
 vendor KEITHLEY		0x05e6	Keithley Instruments
 vendor EIZONANAO	0x05e7	EIZO Nanao
 vendor KLSI		0x05e9	Kawasaki LSI
 vendor FFC		0x05eb	FFC
 vendor ANKO		0x05ef	Anko Electronic
 vendor PIENGINEERING	0x05f3	P.I. Engineering
 vendor AOC		0x05f6	AOC International
 vendor CHIC		0x05fe	Chic Technology
 vendor BARCO		0x0600	Barco Display Systems
 vendor BRIDGE		0x0607	Bridge Information
 vendor SOLIDYEAR	0x060b	Solid Year
 vendor BIORAD		0x0614	Bio-Rad Laboratories
 vendor MACALLY		0x0618	Macally
 vendor ACTLABS		0x061c	Act Labs
 vendor ALARIS		0x0620	Alaris
 vendor APEX		0x0624	Apex
 vendor CREATIVE3	0x062a	Creative Labs
 vendor MICRON		0x0634	Micron Technology
 vendor VIVITAR		0x0636	Vivitar
 vendor GUNZE		0x0637	Gunze Electronics USA
 vendor AVISION		0x0638	Avision
 vendor TEAC		0x0644	TEAC
 vendor ACTON		0x0647	Acton Research Corp.
 vendor OPTO		0x065a	Optoelectronics Co., Ltd
 vendor SGI		0x065e	Silicon Graphics
 vendor SANWASUPPLY	0x0663	Sanwa Supply
 vendor MEGATEC		0x0665	Megatec
 vendor LINKSYS		0x066b	Linksys
 vendor ACERSA		0x066e	Acer Semiconductor America
 vendor SIGMATEL		0x066f	Sigmatel
 vendor DRAYTEK		0x0675	DrayTek
 vendor AIWA		0x0677	Aiwa
 vendor ACARD		0x0678	ACARD Technology
 vendor PROLIFIC		0x067b	Prolific Technology
 vendor SIEMENS		0x067c	Siemens
 vendor AVANCELOGIC	0x0680	Avance Logic
 vendor SIEMENS2		0x0681	Siemens
 vendor MINOLTA		0x0686	Minolta
 vendor CHPRODUCTS	0x068e	CH Products
 vendor HAGIWARA		0x0693	Hagiwara Sys-Com
 vendor CTX		0x0698	Chuntex
 vendor ASKEY		0x069a	Askey Computer
 vendor SAITEK		0x06a3	Saitek
 vendor ALCATELT		0x06b9	Alcatel Telecom
 vendor AGFA		0x06bd	AGFA-Gevaert
 vendor ASIAMD		0x06be	Asia Microelectronic Development
 vendor BIZLINK		0x06c4	Bizlink International
 vendor KEYSPAN		0x06cd	Keyspan / InnoSys Inc.
 vendor CONTEC		0x06ce	Contec products
 vendor AASHIMA		0x06d6	Aashima Technology
 vendor LIEBERT		0x06da	Liebert
 vendor MULTITECH	0x06e0	MultiTech
 vendor ADS		0x06e1	ADS Technologies
 vendor ALCATELM		0x06e4	Alcatel Microelectronics
 vendor SIRIUS		0x06ea	Sirius Technologies
 vendor GUILLEMOT	0x06f8	Guillemot
 vendor BOSTON		0x06fd	Boston Acoustics
 vendor SMC		0x0707	Standard Microsystems
 vendor PUTERCOM		0x0708	Putercom
 vendor MCT		0x0711	MCT
 vendor IMATION		0x0718	Imation
 vendor TECLAST		0x071b	Teclast
 vendor SONYERICSSON	0x0731	Sony Ericsson
 vendor EICON		0x0734	Eicon Networks
 vendor SYNTECH		0x0745	Syntech Information
 vendor DIGITALSTREAM	0x074e	Digital Stream
 vendor AUREAL		0x0755	Aureal Semiconductor
 vendor MAUDIO		0x0763	M-Audio
 vendor CYBERPOWER	0x0764	Cyber Power Systems, Inc.
 vendor SURECOM		0x0769	Surecom Technology
 vendor HIDGLOBAL	0x076b	HID Global
 vendor LINKSYS2		0x077b	Linksys
 vendor GRIFFIN		0x077d	Griffin Technology
 vendor SANDISK		0x0781	SanDisk
 vendor JENOPTIK		0x0784	Jenoptik
 vendor LOGITEC		0x0789	Logitec
 vendor NOKIA2		0x078b	Nokia
 vendor BRIMAX		0x078e	Brimax
 vendor AXIS		0x0792	Axis Communications
 vendor ABL		0x0794	ABL Electronics
 vendor SAGEM		0x079b	Sagem
 vendor SUNCOMM		0x079c	Sun Communications, Inc.
 vendor ALFADATA		0x079d	Alfadata Computer
 vendor NATIONALTECH	0x07a2	National Technical Systems
 vendor ONNTO		0x07a3	Onnto
 vendor BE		0x07a4	Be
 vendor ADMTEK		0x07a6	ADMtek
 vendor COREGA		0x07aa	Corega
 vendor FREECOM		0x07ab	Freecom
 vendor MICROTECH	0x07af	Microtech
 vendor GENERALINSTMNTS	0x07b2	General Instruments (Motorola)
 vendor OLYMPUS		0x07b4	Olympus
 vendor ABOCOM		0x07b8	AboCom Systems
 vendor KEISOKUGIKEN	0x07c1	Keisokugiken
 vendor ONSPEC		0x07c4	OnSpec
 vendor APG		0x07c5	APG Cash Drawer
 vendor BUG		0x07c8	B.U.G.
 vendor ALLIEDTELESYN	0x07c9	Allied Telesyn International
 vendor AVERMEDIA	0x07ca	AVerMedia Technologies
 vendor SIIG		0x07cc	SIIG
 vendor CASIO		0x07cf	CASIO
 vendor DLINK2		0x07d1	D-Link
 vendor APTIO		0x07d2	Aptio Products
 vendor ARASAN		0x07da	Arasan Chip Systems
 vendor ALLIEDCABLE	0x07e6	Allied Cable
 vendor STSN		0x07ef	STSN
 vendor CENTURY		0x07f7	Century Corp
 vendor NEWLINK		0x07ff	NEWlink
 vendor MAGTEK		0x0801	Mag-Tek
 vendor ZOOM		0x0803	Zoom Telephonics
 vendor PCS		0x0810	Personal Communication Systems
 vendor ALPHASMART	0x081e	AlphaSmart, Inc.
 vendor BROADLOGIC	0x0827	BroadLogic
 vendor HANDSPRING	0x082d	Handspring
 vendor PALM		0x0830	Palm Computing
 vendor SOURCENEXT	0x0833	SOURCENEXT
 vendor ACTIONSTAR	0x0835	Action Star Enterprise
 vendor SAMSUNG_TECHWIN	0x0839	Samsung Techwin
 vendor ACCTON		0x083a	Accton Technology
 vendor DIAMOND		0x0841	Diamond
 vendor NETGEAR		0x0846	BayNETGEAR
 vendor TOPRE		0x0853	Topre Corporation
 vendor ACTIVEWIRE	0x0854	ActiveWire
 vendor BBELECTRONICS	0x0856	B&B Electronics
 vendor PORTGEAR		0x085a	PortGear
 vendor NETGEAR2		0x0864	Netgear
 vendor SYSTEMTALKS	0x086e	System Talks
 vendor METRICOM		0x0870	Metricom
 vendor ADESSOKBTEK	0x087c	ADESSO/Kbtek America
 vendor JATON		0x087d	Jaton
 vendor APT		0x0880	APT Technologies
 vendor BOCARESEARCH	0x0885	Boca Research
 vendor ANDREA		0x08a8	Andrea Electronics
 vendor BURRBROWN	0x08bb	Burr-Brown Japan
 vendor 2WIRE		0x08c8	2Wire
 vendor AIPTEK		0x08ca	AIPTEK International
 vendor SMARTBRIDGES	0x08d1	SmartBridges
 vendor FUJITSUSIEMENS	0x08d4	Fujitsu-Siemens
 vendor BILLIONTON	0x08dd	Billionton Systems
 vendor GEMALTO		0x08e6	Gemalto SA
 vendor EXTENDED		0x08e9	Extended Systems
 vendor MSYSTEMS		0x08ec	M-Systems
 vendor DIGIANSWER	0x08fd	Digianswer
 vendor AUTHENTEC	0x08ff	AuthenTec
 vendor AUDIOTECHNICA	0x0909	Audio-Technica
 vendor TRUMPION		0x090a	Trumpion Microelectronics
 vendor FEIYA		0x090c	Feiya
 vendor ALATION		0x0910	Alation Systems
 vendor GLOBESPAN	0x0915	Globespan
 vendor CONCORDCAMERA	0x0919	Concord Camera
 vendor GARMIN		0x091e	Garmin International
 vendor GOHUBS		0x0921	GoHubs
 vendor XEROX		0x0924	Xerox
 vendor BIOMETRIC	0x0929	American Biometric Company
 vendor TOSHIBA		0x0930	Toshiba
 vendor PLEXTOR		0x093b	Plextor
 vendor INTREPIDCS	0x093c	Intrepid
 vendor YANO		0x094f	Yano
 vendor KINGSTON		0x0951	Kingston Technology
 vendor BLUEWATER	0x0956	BlueWater Systems
 vendor AGILENT		0x0957	Agilent Technologies
 vendor GUDE		0x0959	Gude ADS
 vendor PORTSMITH	0x095a	Portsmith
 vendor ACERW		0x0967	Acer
 vendor ADIRONDACK	0x0976	Adirondack Wire & Cable
 vendor BECKHOFF		0x0978	Beckhoff
 vendor MINDSATWORK	0x097a	Minds At Work
 vendor POINTCHIPS	0x09a6	PointChips
 vendor INTERSIL		0x09aa	Intersil
 vendor ALTIUS		0x09b3	Altius Solutions
 vendor ARRIS		0x09c1	Arris Interactive
 vendor ACTIVCARD	0x09c3	ACTIVCARD
 vendor ACTISYS		0x09c4	ACTiSYS
 vendor NOVATEL2		0x09d7	Novatel Wireless
 vendor AFOURTECH	0x09da	A-FOUR TECH
 vendor AIMEX		0x09dc	AIMEX
 vendor ADDONICS		0x09df	Addonics Technologies
 vendor AKAI		0x09e8	AKAI professional M.I.
 vendor ARESCOM		0x09f5	ARESCOM
 vendor BAY		0x09f9	Bay Associates
 vendor ALTERA		0x09fb	Altera
 vendor CSR		0x0a12	Cambridge Silicon Radio
 vendor TREK		0x0a16	Trek Technology
 vendor ASAHIOPTICAL	0x0a17	Asahi Optical
 vendor BOCASYSTEMS	0x0a43	Boca Systems
 vendor SHANTOU		0x0a46	ShanTou
 vendor MEDIAGEAR	0x0a48	MediaGear
 vendor BROADCOM		0x0a5c	Broadcom
 vendor GREENHOUSE	0x0a6b	GREENHOUSE
 vendor MEDELI		0x0a67	Medeli
 vendor GEOCAST		0x0a79	Geocast Network Systems
 vendor EGO		0x0a92	EGO systems
 vendor IDQUANTIQUE	0x0aba	ID Quantique
 vendor IDTECH		0x0acd	ID TECH
 vendor ZYDAS		0x0ace	Zydas Technology Corporation
 vendor NEODIO		0x0aec	Neodio
 vendor OPTION		0x0af0	Option N.V.
 vendor ASUS		0x0b05	ASUSTeK Computer
 vendor TODOS		0x0b0c	Todos Data System
 vendor SIIG2		0x0b39	SIIG
 vendor TEKRAM		0x0b3b	Tekram Technology
 vendor HAL		0x0b41	HAL Corporation
 vendor EMS		0x0b43	EMS Production
 vendor NEC2		0x0b62	NEC
 vendor ADLINK		0x0b63	ADLINK Technoligy, Inc.
 vendor ATI2		0x0b6f	ATI
 vendor ZEEVO		0x0b7a	Zeevo, Inc.
 vendor KURUSUGAWA	0x0b7e	Kurusugawa Electronics, Inc.
 vendor SMART		0x0b8c	Smart Technologies
 vendor ASIX		0x0b95	ASIX Electronics
 vendor O2MICRO		0x0b97	O2 Micro, Inc.
 vendor USR		0x0baf	U.S. Robotics
 vendor AMBIT		0x0bb2	Ambit Microsystems
 vendor HTC		0x0bb4	HTC
 vendor REALTEK		0x0bda	Realtek
 vendor ERICSSON2	0x0bdb	Ericsson
 vendor MEI		0x0bed	MEI
 vendor ADDONICS2	0x0bf6	Addonics Technology
 vendor FSC		0x0bf8	Fujitsu Siemens Computers
 vendor AGATE		0x0c08	Agate Technologies
 vendor DMI		0x0c0b	DMI
 vendor CANYON		0x0c10	Canyon
 vendor ICOM		0x0c26	Icom Inc.
 vendor GNOTOMETRICS	0x0c33	GN Otometrics
 vendor CHICONY2		0x0c45	Chicony
 vendor REINERSCT	0x0c4b	Reiner-SCT
 vendor SEALEVEL		0x0c52	Sealevel System
 vendor JETI		0x0c6c	Jeti
 vendor LUWEN		0x0c76	Luwen
 vendor ELEKTOR		0x0c7d	ELEKTOR Electronics
 vendor KYOCERA2		0x0c88	Kyocera Wireless Corp.
 vendor ZCOM		0x0cde	Z-Com
 vendor ATHEROS2		0x0cf3	Atheros Communications
 vendor POSIFLEX		0x0d3a	POSIFLEX
 vendor TANGTOP		0x0d3d	Tangtop
 vendor KOBIL		0x0d46	KOBIL
 vendor SMC3		0x0d5c	Standard Microsystems
 vendor ADDON		0x0d7d	Add-on Technology
 vendor ACDC		0x0d7e	American Computer & Digital Components
 vendor CMEDIA		0x0d8c	CMEDIA
 vendor CONCEPTRONIC	0x0d8e	Conceptronic
 vendor SKANHEX		0x0d96	Skanhex Technology, Inc.
 vendor MSI		0x0db0	Micro Star International
 vendor ELCON		0x0db7	ELCON Systemtechnik
 vendor UNKNOWN4		0x0dcd	Unknown vendor
 vendor NETAC		0x0dd8	Netac
 vendor SITECOMEU	0x0df6	Sitecom Europe
 vendor MOBILEACTION	0x0df7	Mobile Action
 vendor AMIGO		0x0e0b	Amigo Technology
 vendor SPEEDDRAGON	0x0e55	Speed Dragon Multimedia
 vendor HAWKING		0x0e66	Hawking
 vendor FOSSIL		0x0e67	Fossil, Inc
 vendor GMATE		0x0e7e	G.Mate, Inc
 vendor MEDIATEK		0x0e8d	MediaTek, Inc.
 vendor OTI		0x0ea0	Ours Technology
 vendor YISO		0x0eab	Yiso Wireless Co.
 vendor PILOTECH		0x0eaf	Pilotech
 vendor NOVATECH		0x0eb0	NovaTech
 vendor ITEGNO		0x0eba	iTegno
 vendor WINMAXGROUP	0x0ed1	WinMaxGroup
 vendor TOD		0x0ede	TOD
 vendor EGALAX		0x0eef	eGalax, Inc.
 vendor AIRPRIME		0x0f3d	AirPrime, Inc.
 vendor MICROTUNE	0x0f4d	Microtune
 vendor VTECH		0x0f88	VTech
 vendor FALCOM		0x0f94	Falcom Wireless Communications GmbH
 vendor RIM		0x0fca	Research In Motion
 vendor DYNASTREAM	0x0fcf	Dynastream Innovations
 vendor LARSENBRUSGAARD	0x0fd8	Larsen and Brusgaard
 vendor OWL		0x0fde	OWL
 vendor KONTRON		0x0fe6	Kontron AG
 vendor QUALCOMM		0x1004	Qualcomm
 vendor APACER		0x1005	Apacer
 vendor MOTOROLA4	0x100d	Motorola
 vendor HP3		0x103c	Hewlett Packard
 vendor AIRPLUS		0x1011  Airplus
 vendor DESKNOTE		0x1019	Desknote
 vendor NEC3		0x1033	NEC
 vendor TTI		0x103e	Thurlby Thandar Instruments
 vendor GIGABYTE		0x1044	GIGABYTE
 vendor WESTERN		0x1058	Western Digital
 vendor MOTOROLA		0x1063	Motorola
 vendor CCYU		0x1065	CCYU Technology
 vendor CURITEL		0x106c	Curitel Communications Inc
 vendor SILABS2		0x10a6	SILABS2
 vendor USI		0x10ab	USI
 vendor LIEBERT2		0x10af	Liebert
 vendor PLX		0x10b5	PLX
 vendor ASANTE		0x10bd	Asante
 vendor SILABS		0x10c4	Silicon Labs
 vendor SILABS3		0x10c5	Silicon Labs
 vendor SILABS4		0x10ce	Silicon Labs
 vendor ACTIONS		0x10d6  Actions
 vendor ANALOG		0x1110	Analog Devices
 vendor TENX		0x1130	Ten X Technology, Inc.
 vendor ISSC		0x1131	Integrated System Solution Corp.
 vendor JRC		0x1145	Japan Radio Company
 vendor SPHAIRON		0x114b	Sphairon Access Systems GmbH
 vendor DELORME		0x1163	DeLorme
 vendor SERVERWORKS	0x1166	ServerWorks
 vendor DLINK3		0x1186	Dlink
 vendor ACERCM		0x1189	Acer Communications & Multimedia
 vendor SIERRA		0x1199	Sierra Wireless
 vendor SANWA		0x11ad	Sanwa Electric Instrument Co., Ltd.
 vendor TOPFIELD		0x11db	Topfield Co., Ltd
 vendor SIEMENS3		0x11f5	Siemens
 vendor NETINDEX		0x11f6	NetIndex
 vendor ALCATEL		0x11f7	Alcatel
 vendor INTERBIOMETRICS	0x1209	Interbiometrics
 vendor UNKNOWN3		0x1233	Unknown vendor
 vendor TSUNAMI		0x1241	Tsunami
 vendor PHEENET		0x124a	Pheenet
 vendor TARGUS		0x1267	Targus
 vendor TWINMOS		0x126f	TwinMOS
 vendor TENDA		0x1286	Tenda
 vendor TESTO		0x128d	Testo products
 vendor CREATIVE2	0x1292	Creative Labs
 vendor BELKIN2		0x1293	Belkin Components
 vendor CYBERTAN		0x129b	CyberTAN Technology
 vendor HUAWEI		0x12d1	Huawei Technologies
 vendor ARANEUS		0x12d8	Araneus Information Systems
 vendor TAPWAVE		0x12ef	Tapwave
 vendor AINCOMM		0x12fd	Aincomm
 vendor MOBILITY		0x1342	Mobility
 vendor DICKSMITH	0x1371	Dick Smith Electronics
 vendor NETGEAR3		0x1385	Netgear
 vendor BALTECH		0x13ad	Baltech
 vendor CISCOLINKSYS	0x13b1	Cisco-Linksys
 vendor SHARK		0x13d2	Shark
 vendor AZUREWAVE	0x13d3	AsureWave
 vendor INITIO		0x13fd	Initio Corporation
 vendor EMTEC		0x13fe	Emtec
 vendor NOVATEL		0x1410	Novatel Wireless
 vendor MERLIN		0x1416	Merlin
 vendor REDOCTANE	0x1430	RedOctane
 vendor WISTRONNEWEB	0x1435	Wistron NeWeb
 vendor RADIOSHACK	0x1453	Radio Shack
 vendor FIC		0x1457	FIC / OpenMoko
 vendor HUAWEI3COM	0x1472	Huawei-3Com
 vendor ABOCOM2		0x1482	AboCom Systems
 vendor SILICOM		0x1485	Silicom
 vendor RALINK		0x148f	Ralink Technology
 vendor IMAGINATION	0x149a	Imagination Technologies
 vendor ATP		0x14af	ATP Electronics
 vendor CONCEPTRONIC2	0x14b2	Conceptronic
 vendor SUPERTOP		0x14cd	Super Top
 vendor PLANEX3		0x14ea	Planex Communications
 vendor SILICONPORTALS	0x1527	Silicon Portals
 vendor UBIQUAM		0x1529	UBIQUAM Co., Ltd.
 vendor JMICRON		0x152d	JMicron
 vendor UBLOX		0x1546	U-blox
 vendor PNY		0x154b	PNY
 vendor OWEN		0x1555	Owen
 vendor OQO		0x1557	OQO
 vendor UMEDIA		0x157e	U-MEDIA Communications
 vendor FIBERLINE	0x1582	Fiberline
 vendor FREESCALE	0x15a2  Freescale Semiconductor, Inc.
 vendor AFATECH		0x15a4	Afatech Technologies, Inc.
 vendor SPARKLAN		0x15a9	SparkLAN
 vendor OLIMEX		0x15ba	Olimex
 vendor SOUNDGRAPH 	0x15c2	Soundgraph, Inc.
 vendor AMIT2		0x15c5	AMIT
 vendor TEXTECH		0x15ca	Textech International Ltd.
 vendor SOHOWARE		0x15e8	SOHOware
 vendor UMAX		0x1606	UMAX Data Systems
 vendor INSIDEOUT	0x1608	Inside Out Networks
 vendor AMOI		0x1614	Amoi Electronics
 vendor GOODWAY		0x1631	Good Way Technology
 vendor ENTREGA		0x1645	Entrega
 vendor ACTIONTEC	0x1668	Actiontec Electronics
 vendor CLIPSAL		0x166a	Clipsal
 vendor CISCOLINKSYS2	0x167b  Cisco-Linksys
 vendor ATHEROS		0x168c	Atheros Communications
 vendor GIGASET		0x1690	Gigaset
 vendor GLOBALSUN	0x16ab	Global Sun Technology
 vendor ANYDATA		0x16d5	AnyDATA Corporation
 vendor JABLOTRON	0x16d6	Jablotron
 vendor CMOTECH		0x16d8	C-motech
 vendor WIENERPLEINBAUS	0x16dc	WIENER Plein & Baus GmbH.
 vendor AXESSTEL		0x1726  Axesstel Co., Ltd.
 vendor LINKSYS4		0x1737	Linksys
 vendor SENAO		0x1740	Senao
 vendor ASUS2		0x1761	ASUS
 vendor SWEEX2		0x177f	Sweex
 vendor METAGEEK		0x1781	MetaGeek
 vendor KAMSTRUP		0x17a8	Kamstrup A/S
 vendor LENOVO		0x17ef	Lenovo
 vendor WAVESENSE	0x17f4	WaveSense
 vendor VAISALA		0x1843	Vaisala
 vendor AMIT		0x18c5	AMIT
 vendor GOOGLE		0x18d1	Google
 vendor QCOM		0x18e8	Qcom
 vendor ELV		0x18ef	ELV
 vendor LINKSYS3		0x1915	Linksys
 vendor QUALCOMMINC	0x19d2	Qualcomm, Incorporated
 vendor QUALCOMM3	0x19f5	Qualcomm, Inc.
 vendor BAYER		0x1a79	Bayer
 vendor WCH2		0x1a86	QinHeng Electronics
 vendor STELERA		0x1a8d	Stelera Wireless
 vendor SEL		0x1adb	Schweitzer Engineering Laboratories
 vendor CORSAIR		0x1b1c	Corsair
 vendor MATRIXORBITAL	0x1b3d	Matrix Orbital
 vendor OVISLINK		0x1b75	OvisLink
 vendor TML		0x1b91	The Mobility Lab
 vendor TCTMOBILE	0x1bbb  TCT Mobile
 vendor ALTI2		0x1bc9	Alti-2 products
 vendor SUNPLUS		0x1bcf	Sunplus Innovation Technology Inc.
 vendor WAGO		0x1be3  WAGO Kontakttechnik GmbH.
 vendor TELIT		0x1bc7  Telit
 vendor IONICS		0x1c0c	Ionics PlugComputer
 vendor LONGCHEER	0x1c9e	Longcheer Holdings, Ltd.
 vendor MPMAN		0x1cae	MpMan
 vendor DRESDENELEKTRONIK 0x1cf1 dresden elektronik
 vendor NEOTEL		0x1d09	Neotel
 vendor DREAMLINK	0x1d34	Dream Link
 vendor PEGATRON		0x1d4d	Pegatron
 vendor QISDA		0x1da5  Qisda
 vendor METAGEEK2	0x1dd5	MetaGeek
 vendor ALINK		0x1e0e  Alink
 vendor AIRTIES		0x1eda	AirTies
 vendor FESTO		0x1e29	Festo
 vendor LAKESHORE	0x1fb9	Lake Shore Cryotronics, Inc.
 vendor VERTEX		0x1fe7  Vertex Wireless Co., Ltd.
 vendor DLINK		0x2001	D-Link
 vendor PLANEX2		0x2019	Planex Communications
 vendor HAUPPAUGE2	0x2040	Hauppauge Computer Works
 vendor TLAYTECH		0x20b9	Tlay Tech
 vendor ENCORE		0x203d	Encore
 vendor QIHARDWARE	0x20b7	QI-hardware
 vendor PARA		0x20b8	PARA Industrial
 vendor SIMTEC		0x20df	Simtec Electronics
 vendor TRENDNET		0x20f4  TRENDnet
 vendor RTSYSTEMS	0x2100	RTSYSTEMS
 vendor VIALABS		0x2109	VIA Labs
 vendor ERICSSON		0x2282	Ericsson
 vendor MOTOROLA2	0x22b8	Motorola
 vendor WETELECOM	0x22de	WeTelecom
 vendor WESTMOUNTAIN	0x2405	West Mountain Radio
 vendor TRIPPLITE	0x2478	Tripp-Lite
 vendor HIROSE		0x2631	Hirose Electric
 vendor NHJ		0x2770	NHJ
 vendor PLANEX		0x2c02	Planex Communications
 vendor VIDZMEDIA	0x3275	VidzMedia Pte Ltd
 vendor LINKINSTRUMENTS	0x3195	Link Instruments Inc.
 vendor AEI		0x3334	AEI
 vendor HANK		0x3353	Hank Connection
 vendor PQI		0x3538	PQI
 vendor DAISY		0x3579	Daisy Technology
 vendor NI		0x3923	National Instruments
 vendor MICRONET		0x3980	Micronet Communications
 vendor IODATA2		0x40bb	I-O Data
 vendor IRIVER		0x4102	iRiver
 vendor DELL		0x413c	Dell
 vendor WCH		0x4348	QinHeng Electronics
 vendor ACEECA		0x4766	Aceeca
 vendor FEIXUN		0x4855	FeiXun Communication
 vendor PAPOUCH		0x5050	Papouch products
 vendor AVERATEC		0x50c2	Averatec
 vendor SWEEX		0x5173	Sweex
 vendor PROLIFIC2	0x5372	Prolific Technologies
 vendor ONSPEC2		0x55aa	OnSpec Electronic Inc.
 vendor ZINWELL		0x5a57	Zinwell
 vendor SITECOM		0x6189	Sitecom
 vendor ARKMICRO		0x6547	Arkmicro Technologies Inc.
 vendor 3COM2		0x6891	3Com
 vendor EDIMAX		0x7392	Edimax
 vendor INTEL		0x8086	Intel
 vendor INTEL2		0x8087	Intel
 vendor ALLWIN		0x8516	ALLWIN Tech
 vendor SITECOM2		0x9016	Sitecom
 vendor MOSCHIP		0x9710	MosChip Semiconductor
 vendor NETGEAR4		0x9846  Netgear
 vendor MARVELL		0x9e88	Marvell Technology Group Ltd.
 vendor 3COM3		0xa727	3Com
 vendor EVOLUTION	0xdeee	Evolution Robotics products
 vendor DATAAPEX		0xdaae	DataApex
 vendor HP2		0xf003	Hewlett Packard
 vendor LOGILINK		0xfc08	LogiLink
 vendor USRP		0xfffe	GNU Radio USRP
 
 /*
  * List of known products.  Grouped by vendor.
  */
 
 /* 3Com products */
 product 3COM HOMECONN		0x009d	HomeConnect Camera
 product 3COM 3CREB96		0x00a0	Bluetooth USB Adapter
 product 3COM 3C19250		0x03e8	3C19250 Ethernet Adapter
 product 3COM 3CRSHEW696		0x0a01	3CRSHEW696 Wireless Adapter
 product 3COM 3C460		0x11f8	HomeConnect 3C460
 product 3COM USR56K		0x3021	U.S.Robotics 56000 Voice FaxModem Pro
 product 3COM 3C460B		0x4601	HomeConnect 3C460B
 product 3COM2 3CRUSB10075	0xa727	3CRUSB10075
 product 3COM3 AR5523_1		0x6893	AR5523
 product 3COM3 AR5523_2		0x6895	AR5523
 product 3COM3 AR5523_3		0x6897	AR5523
 
 product 3COMUSR OFFICECONN	0x0082	3Com OfficeConnect Analog Modem
 product 3COMUSR USRISDN		0x008f	3Com U.S. Robotics Pro ISDN TA
 product 3COMUSR HOMECONN	0x009d	3Com HomeConnect Camera
 product 3COMUSR USR56K		0x3021	U.S. Robotics 56000 Voice FaxModem Pro
 
 /* AboCom products */
 product ABOCOM XX1		0x110c	XX1
 product ABOCOM XX2		0x200c	XX2
 product ABOCOM RT2770		0x2770	RT2770
 product ABOCOM RT2870		0x2870	RT2870
 product ABOCOM RT3070		0x3070	RT3070
 product ABOCOM RT3071		0x3071	RT3071
 product ABOCOM RT3072		0x3072	RT3072
 product ABOCOM2 RT2870_1	0x3c09	RT2870
 product ABOCOM URE450		0x4000	URE450 Ethernet Adapter
 product ABOCOM UFE1000		0x4002	UFE1000 Fast Ethernet Adapter
 product ABOCOM DSB650TX_PNA	0x4003	1/10/100 Ethernet Adapter
 product ABOCOM XX4		0x4004	XX4
 product ABOCOM XX5		0x4007	XX5
 product ABOCOM XX6		0x400b	XX6
 product ABOCOM XX7		0x400c	XX7
 product ABOCOM RTL8151		0x401a	RTL8151
 product ABOCOM XX8		0x4102	XX8
 product ABOCOM XX9		0x4104	XX9
 product ABOCOM UF200		0x420a	UF200 Ethernet
 product ABOCOM WL54		0x6001	WL54
 product ABOCOM XX10		0xabc1	XX10
 product ABOCOM BWU613		0xb000	BWU613
 product ABOCOM HWU54DM		0xb21b	HWU54DM
 product ABOCOM RT2573_2		0xb21c	RT2573
 product ABOCOM RT2573_3		0xb21d	RT2573
 product ABOCOM RT2573_4		0xb21e	RT2573
 product ABOCOM RTL8188CU_1	0x8188  RTL8188CU
 product ABOCOM RTL8188CU_2	0x8189  RTL8188CU
 product ABOCOM RTL8192CU	0x8178  RTL8192CU
 product ABOCOM WUG2700		0xb21f	WUG2700
 
 /* Acton Research Corp. */
 product ACTON SPECTRAPRO	0x0100	FTDI compatible adapter
 
 /* Accton products */
 product ACCTON USB320_EC	0x1046	USB320-EC Ethernet Adapter
 product ACCTON 2664W		0x3501	2664W
 product ACCTON 111		0x3503	T-Sinus 111 Wireless Adapter
 product ACCTON SMCWUSBG_NF	0x4505	SMCWUSB-G (no firmware)
 product ACCTON SMCWUSBG		0x4506	SMCWUSB-G
 product ACCTON SMCWUSBTG2_NF	0x4507	SMCWUSBT-G2 (no firmware)
 product ACCTON SMCWUSBTG2	0x4508	SMCWUSBT-G2
 product ACCTON PRISM_GT		0x4521	PrismGT USB 2.0 WLAN
 product ACCTON SS1001		0x5046	SpeedStream Ethernet Adapter
 product ACCTON RT2870_2		0x6618	RT2870
 product ACCTON RT3070		0x7511	RT3070
 product ACCTON RT2770		0x7512	RT2770
 product ACCTON RT2870_3		0x7522	RT2870
 product ACCTON RT2870_5		0x8522	RT2870
 product ACCTON RT3070_4		0xa512	RT3070
 product ACCTON RT2870_4		0xa618	RT2870
 product	ACCTON RT3070_1		0xa701	RT3070
 product	ACCTON RT3070_2		0xa702	RT3070
 product ACCTON RT2870_1		0xb522	RT2870
 product	ACCTON RT3070_3		0xc522	RT3070
 product	ACCTON RT3070_5		0xd522	RT3070
 product ACCTON RTL8192SU        0xc512  RTL8192SU
 product ACCTON ZD1211B		0xe501	ZD1211B
 
 /* Aceeca products */
 product ACEECA MEZ1000		0x0001	MEZ1000 RDA
 
 /* Acer Communications & Multimedia (oemd by Surecom) */
 product ACERCM EP1427X2		0x0893	EP-1427X-2 Ethernet Adapter
 
 /* Acer Labs products */
 product ACERLABS M5632		0x5632	USB 2.0 Data Link
 
 /* Acer Peripherals, Inc. products */
 product ACERP ACERSCAN_C310U	0x12a6	Acerscan C310U
 product ACERP ACERSCAN_320U	0x2022	Acerscan 320U
 product ACERP ACERSCAN_640U	0x2040	Acerscan 640U
 product ACERP ACERSCAN_620U	0x2060	Acerscan 620U
 product ACERP ACERSCAN_4300U	0x20b0	Benq 3300U/4300U
 product ACERP ACERSCAN_640BT	0x20be	Acerscan 640BT
 product ACERP ACERSCAN_1240U	0x20c0	Acerscan 1240U
 product ACERP S81		0x4027	BenQ S81 phone
 product ACERP H10		0x4068	AWL400 Wireless Adapter
 product ACERP ATAPI		0x6003	ATA/ATAPI Adapter
 product ACERP AWL300		0x9000	AWL300 Wireless Adapter
 product ACERP AWL400		0x9001	AWL400 Wireless Adapter
 
 /* Acer Warp products */
 product ACERW WARPLINK		0x0204	Warplink
 
 /* Actions products */
 product ACTIONS MP4		0x1101  Actions MP4 Player
 
 /* Actiontec, Inc. products */
 product ACTIONTEC PRISM_25	0x0408	Prism2.5 Wireless Adapter
 product ACTIONTEC PRISM_25A	0x0421	Prism2.5 Wireless Adapter A
 product ACTIONTEC FREELAN	0x6106	ROPEX FreeLan 802.11b
 product ACTIONTEC UAT1		0x7605	UAT1 Wireless Ethernet Adapter
 
 /* ACTiSYS products */
 product ACTISYS IR2000U		0x0011	ACT-IR2000U FIR
 
 /* ActiveWire, Inc. products */
 product ACTIVEWIRE IOBOARD	0x0100	I/O Board
 product ACTIVEWIRE IOBOARD_FW1	0x0101	I/O Board, rev. 1 firmware
 
 /* Adaptec products */
 product ADAPTEC AWN8020		0x0020	AWN-8020 WLAN
 
 /* Addtron products */
 product ADDTRON AWU120		0xff31	AWU-120
 
 /* ADLINK Texhnology products */
 product ADLINK ND6530		0x6530	ND-6530 USB-Serial
 
 /* ADMtek products */
 product ADMTEK PEGASUSII_4	0x07c2	AN986A Ethernet
 product ADMTEK PEGASUS		0x0986	AN986 Ethernet
 product ADMTEK PEGASUSII	0x8511	AN8511 Ethernet
 product ADMTEK PEGASUSII_2	0x8513	AN8513 Ethernet
 product ADMTEK PEGASUSII_3	0x8515	AN8515 Ethernet
 
 /* ADDON products */
 /* PNY OEMs these */
 product ADDON ATTACHE		0x1300	USB 2.0 Flash Drive
 product ADDON ATTACHE		0x1300	USB 2.0 Flash Drive
 product ADDON A256MB		0x1400	Attache 256MB USB 2.0 Flash Drive
 product ADDON DISKPRO512	0x1420	USB 2.0 Flash Drive (DANE-ELEC zMate 512MB USB flash drive)
 
 /* Addonics products */
 product ADDONICS2 CABLE_205	0xa001	Cable 205
 
 /* ADS products */
 product ADS UBS10BT		0x0008	UBS-10BT Ethernet
 product ADS UBS10BTX		0x0009	UBS-10BT Ethernet
 
 /* AEI products */
 product AEI FASTETHERNET	0x1701	Fast Ethernet
 
 /* Afatech Technologies, Inc. */
 product AFATECH AFATECH1336	0x1336	Flash Card Reader
 
 /* Agate Technologies products */
 product AGATE QDRIVE		0x0378	Q-Drive
 
 /* AGFA products */
 product AGFA SNAPSCAN1212U	0x0001	SnapScan 1212U
 product AGFA SNAPSCAN1236U	0x0002	SnapScan 1236U
 product AGFA SNAPSCANTOUCH	0x0100	SnapScan Touch
 product AGFA SNAPSCAN1212U2	0x2061	SnapScan 1212U
 product AGFA SNAPSCANE40	0x208d	SnapScan e40
 product AGFA SNAPSCANE50	0x208f	SnapScan e50
 product AGFA SNAPSCANE20	0x2091	SnapScan e20
 product AGFA SNAPSCANE25	0x2095	SnapScan e25
 product AGFA SNAPSCANE26	0x2097	SnapScan e26
 product AGFA SNAPSCANE52	0x20fd	SnapScan e52
 
 /* Ain Communication Technology products */
 product AINCOMM AWU2000B	0x1001	AWU2000B Wireless Adapter
 
 /* AIPTEK products */
 product AIPTEK POCKETCAM3M	0x2011	PocketCAM 3Mega
 product AIPTEK2 PENCAM_MEGA_1_3 0x504a	PenCam Mega 1.3
 product AIPTEK2 SUNPLUS_TECH	0x0c15	Sunplus Technology Inc.
 
 /* AirPlis products */
 product AIRPLUS MCD650		0x3198	MCD650 modem
 
 /* AirPrime products */
 product AIRPRIME PC5220		0x0112	CDMA Wireless PC Card
 product AIRPRIME USB308		0x68A3	USB308 HSPA+ USB Modem
 product AIRPRIME AC313U		0x68aa	Sierra Wireless AirCard 313U
 
 /* AirTies products */
 product AIRTIES RT3070		0x2310	RT3070
 
 /* AKS products */
 product AKS USBHASP		0x0001	USB-HASP 0.06
 
 /* Alcatel products */
 product ALCATEL OT535		0x02df	One Touch 535/735
 
 /* Alcor Micro, Inc. products */
 product ALCOR2 KBD_HUB		0x2802	Kbd Hub
 
 product ALCOR DUMMY		0x0000	Dummy product
 product ALCOR SDCR_6335		0x6335	SD/MMC Card Reader
 product ALCOR SDCR_6362		0x6362	SD/MMC Card Reader
 product ALCOR SDCR_6366		0x6366	SD/MMC Card Reader
 product ALCOR TRANSCEND		0x6387	Transcend JetFlash Drive
 product ALCOR MA_KBD_HUB	0x9213	MacAlly Kbd Hub
 product ALCOR AU9814		0x9215	AU9814 Hub
 product ALCOR UMCR_9361		0x9361	USB Multimedia Card Reader
 product ALCOR SM_KBD		0x9410	MicroConnectors/StrongMan Keyboard
 product ALCOR NEC_KBD_HUB	0x9472	NEC Kbd Hub
 product ALCOR AU9720 		0x9720	USB2 - RS-232
 product ALCOR AU6390	0x6390	AU6390 USB-IDE converter
 
 /* Alink products */
 product ALINK DWM652U5		0xce16	DWM-652
 product ALINK 3G		0x9000	3G modem
 product ALINK 3GU		0x9200	3G modem
 
 /* Altec Lansing products */
 product ALTEC ADA70		0x0070	ADA70 Speakers
 product ALTEC ASC495		0xff05	ASC495 Speakers
 
 /* Alti-2 products */
 product ALTI2 N3		0x6001	FTDI compatible adapter
 
 /* Allied Telesyn International products */
 product ALLIEDTELESYN ATUSB100	0xb100	AT-USB100
 
 /* ALLWIN Tech products */
 product ALLWIN RT2070		0x2070	RT2070
 product ALLWIN RT2770		0x2770	RT2770
 product ALLWIN RT2870		0x2870	RT2870
 product ALLWIN RT3070		0x3070	RT3070
 product ALLWIN RT3071		0x3071	RT3071
 product ALLWIN RT3072		0x3072	RT3072
 product ALLWIN RT3572		0x3572	RT3572
 
 /* AlphaSmart, Inc. products */
 product ALPHASMART DANA_KB	0xdbac	AlphaSmart Dana Keyboard
 product ALPHASMART DANA_SYNC	0xdf00	AlphaSmart Dana HotSync
 
 /* Amoi products */
 product AMOI H01		0x0800	H01 3G modem
 product AMOI H01A		0x7002	H01A 3G modem
 product AMOI H02		0x0802	H02 3G modem
 
 /* American Power Conversion products */
 product APC UPS			0x0002	Uninterruptible Power Supply
 
 /* Ambit Microsystems products */
 product AMBIT WLAN		0x0302	WLAN
 product AMBIT NTL_250		0x6098	NTL 250 cable modem
 
 /* Apacer products */
 product APACER HT202		0xb113	USB 2.0 Flash Drive
 
 /* American Power Conversion products */
 product APC UPS			0x0002	Uninterruptible Power Supply
 
 /* Amigo Technology products */
 product AMIGO RT2870_1		0x9031	RT2870
 product AMIGO RT2870_2		0x9041	RT2870
 
 /* AMIT products */
 product AMIT CGWLUSB2GO		0x0002	CG-WLUSB2GO
 product AMIT CGWLUSB2GNR	0x0008	CG-WLUSB2GNR
 product AMIT RT2870_1		0x0012	RT2870
 
 /* AMIT(2) products */
 product AMIT2 RT2870		0x0008	RT2870
 
 /* Analog Devices products */
 product ANALOGDEVICES GNICE	0xf000	FTDI compatible adapter
 product ANALOGDEVICES GNICEPLUS	0xf001	FTDI compatible adapter
 
 /* Anchor products */
 product ANCHOR SERIAL		0x2008	Serial
 product ANCHOR EZUSB		0x2131	EZUSB
 product ANCHOR EZLINK		0x2720	EZLINK
 
 /* AnyData products */
 product ANYDATA ADU_620UW	0x6202	CDMA 2000 EV-DO USB Modem
 product ANYDATA ADU_E100X	0x6501	CDMA 2000 1xRTT/EV-DO USB Modem
 product ANYDATA ADU_500A	0x6502	CDMA 2000 EV-DO USB Modem
 
 /* AOX, Inc. products */
 product AOX USB101		0x0008	Ethernet
 
 /* American Power Conversion products */
 product APC UPS			0x0002	Uninterruptible Power Supply
 
 /* Apple Computer products */
 product APPLE DUMMY		0x0000	Dummy product
 product APPLE IMAC_KBD		0x0201	USB iMac Keyboard
 product APPLE KBD		0x0202	USB Keyboard M2452
 product APPLE EXT_KBD		0x020c	Apple Extended USB Keyboard
 /* MacbookAir, aka wellspring */
 product APPLE WELLSPRING_ANSI	0x0223	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING_ISO	0x0224	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING_JIS	0x0225	Apple Internal Keyboard/Trackpad
 /* MacbookProPenryn, aka wellspring2 */
 product APPLE WELLSPRING2_ANSI	0x0230	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING2_ISO	0x0231	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING2_JIS	0x0232	Apple Internal Keyboard/Trackpad
 /* Macbook5,1 (unibody), aka wellspring3 */
 product APPLE WELLSPRING3_ANSI	0x0236	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING3_ISO	0x0237	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING3_JIS	0x0238	Apple Internal Keyboard/Trackpad
 /* MacbookAir3,2 (unibody), aka wellspring4 */
 product APPLE WELLSPRING4_ANSI	0x023f	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING4_ISO	0x0240	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING4_JIS	0x0241	Apple Internal Keyboard/Trackpad
 /* MacbookAir3,1 (unibody), aka wellspring4 */
 product APPLE WELLSPRING4A_ANSI	0x0242	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING4A_ISO	0x0243	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING4A_JIS	0x0244	Apple Internal Keyboard/Trackpad
 /* Macbook8 (unibody, March 2011) */
 product APPLE WELLSPRING5_ANSI	0x0245	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING5_ISO	0x0246	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING5_JIS	0x0247	Apple Internal Keyboard/Trackpad
 /* MacbookAir4,1 (unibody, July 2011) */
 product APPLE WELLSPRING6A_ANSI	0x0249	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING6A_ISO	0x024a	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING6A_JIS	0x024b	Apple Internal Keyboard/Trackpad
 /* MacbookAir4,2 (unibody, July 2011) */
 product APPLE WELLSPRING6_ANSI	0x024c	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING6_ISO	0x024d	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING6_JIS	0x024e	Apple Internal Keyboard/Trackpad
 /* Macbook8,2 (unibody) */
 product APPLE WELLSPRING5A_ANSI	0x0252	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING5A_ISO	0x0253	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING5A_JIS	0x0254	Apple Internal Keyboard/Trackpad
 /* MacbookPro10,1 (unibody, June 2012) */
 product APPLE WELLSPRING7_ANSI	0x0262	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING7_ISO	0x0263	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING7_JIS	0x0264	Apple Internal Keyboard/Trackpad
 /* MacbookPro10,2 (unibody, October 2012) */
 product APPLE WELLSPRING7A_ANSI	0x0259	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING7A_ISO	0x025a	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING7A_JIS	0x025b	Apple Internal Keyboard/Trackpad
 /* MacbookAir6,2 (unibody, June 2013) */
 product APPLE WELLSPRING8_ANSI	0x0290	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING8_ISO	0x0291	Apple Internal Keyboard/Trackpad
 product APPLE WELLSPRING8_JIS	0x0292	Apple Internal Keyboard/Trackpad
 product APPLE MOUSE		0x0301	Mouse M4848
 product APPLE OPTMOUSE		0x0302	Optical mouse
 product APPLE MIGHTYMOUSE	0x0304	Mighty Mouse
 product APPLE KBD_HUB		0x1001	Hub in Apple USB Keyboard
 product APPLE EXT_KBD_HUB	0x1003	Hub in Apple Extended USB Keyboard
 product APPLE SPEAKERS		0x1101	Speakers
 product APPLE IPOD		0x1201	iPod
 product APPLE IPOD2G		0x1202	iPod 2G
 product APPLE IPOD3G		0x1203	iPod 3G
 product APPLE IPOD_04		0x1204	iPod '04'
 product APPLE IPODMINI		0x1205	iPod Mini
 product APPLE IPOD_06		0x1206	iPod '06'
 product APPLE IPOD_07		0x1207	iPod '07'
 product APPLE IPOD_08		0x1208	iPod '08'
 product APPLE IPODVIDEO		0x1209	iPod Video
 product APPLE IPODNANO		0x120a	iPod Nano
 product APPLE IPHONE		0x1290	iPhone
 product APPLE IPOD_TOUCH	0x1291	iPod Touch
 product APPLE IPHONE_3G		0x1292	iPhone 3G
 product APPLE IPHONE_3GS	0x1294	iPhone 3GS
 product APPLE IPHONE_4		0x1297	iPhone 4
 product APPLE IPHONE_4S		0x12a0	iPhone 4S
 product APPLE IPHONE_5		0x12a8  iPhone 5
 product APPLE IPAD		0x129a	iPad
 product APPLE ETHERNET		0x1402	Ethernet A1277
 
 /* Arkmicro Technologies */
 product ARKMICRO ARK3116	0x0232	ARK3116 Serial
 
 /* Asahi Optical products */
 product ASAHIOPTICAL OPTIO230	0x0004	Digital camera
 product ASAHIOPTICAL OPTIO330	0x0006	Digital camera
 
 /* Asante products */
 product ASANTE EA		0x1427	Ethernet
 
 /* ASIX Electronics products */
 product ASIX AX88172		0x1720	10/100 Ethernet
 product ASIX AX88178		0x1780	AX88178
 product ASIX AX88178A		0x178a	AX88178A USB 2.0 10/100/1000 Ethernet
 product ASIX AX88179		0x1790	AX88179 USB 3.0 10/100/1000 Ethernet
 product ASIX AX88772		0x7720	AX88772
 product ASIX AX88772A		0x772a	AX88772A USB 2.0 10/100 Ethernet
 product ASIX AX88772B		0x772b	AX88772B USB 2.0 10/100 Ethernet
 product ASIX AX88772B_1		0x7e2b	AX88772B USB 2.0 10/100 Ethernet
 
 /* ASUS products */
 product ASUS2 USBN11		0x0b05	USB-N11
 product ASUS RT2570		0x1706	RT2500USB Wireless Adapter
 product ASUS WL167G		0x1707	WL-167g Wireless Adapter
 product ASUS WL159G		0x170c	WL-159g
 product ASUS A9T_WIFI		0x171b	A9T wireless
 product ASUS P5B_WIFI		0x171d	P5B wireless
 product ASUS RT2573_1		0x1723	RT2573
 product ASUS RT2573_2		0x1724	RT2573
 product ASUS LCM		0x1726	LCM display
 product ASUS RT2870_1		0x1731	RT2870
 product ASUS RT2870_2		0x1732	RT2870
 product ASUS RT2870_3		0x1742	RT2870
 product ASUS RT2870_4		0x1760	RT2870
 product ASUS RT2870_5		0x1761	RT2870
 product	ASUS USBN13		0x1784	USB-N13
 product ASUS USBN10		0x1786	USB-N10
 product ASUS RT3070_1		0x1790	RT3070
 product ASUS RTL8192SU		0x1791  RTL8192SU
 product ASUS USB_N53		0x179d	ASUS Black Diamond Dual Band USB-N53
 product ASUS RTL8192CU		0x17ab	RTL8192CU
 product ASUS USBN66		0x17ad	USB-N66
 product ASUS USBN10NANO		0x17ba	USB-N10 Nano
 product ASUS USBAC51		0x17d1	USB-AC51
 product ASUS A730W		0x4202	ASUS MyPal A730W
 product ASUS P535		0x420f	ASUS P535 PDA
 product ASUS GMSC		0x422f	ASUS Generic Mass Storage
 
 /* ATen products */
 product ATEN UC1284		0x2001	Parallel printer
 product ATEN UC10T		0x2002	10Mbps Ethernet
 product ATEN UC110T		0x2007	UC-110T Ethernet
 product ATEN UC232A		0x2008	Serial
 product ATEN UC210T		0x2009	UC-210T Ethernet
 product ATEN DSB650C		0x4000	DSB-650C
 
 /* ATP Electronics products */
 product ATP EUSB		0xaf01	ATP IG eUSB SSD
 
 /* Atheros Communications products */
 product ATHEROS AR5523		0x0001	AR5523
 product ATHEROS AR5523_NF	0x0002	AR5523 (no firmware)
 product ATHEROS2 AR5523_1	0x0001	AR5523
 product ATHEROS2 AR5523_1_NF	0x0002	AR5523 (no firmware)
 product ATHEROS2 AR5523_2	0x0003	AR5523
 product ATHEROS2 AR5523_2_NF	0x0004	AR5523 (no firmware)
 product ATHEROS2 AR5523_3	0x0005	AR5523
 product ATHEROS2 AR5523_3_NF	0x0006	AR5523 (no firmware)
 
 /* Atmel Comp. products */
 product ATMEL STK541		0x2109	Zigbee Controller
 product ATMEL UHB124		0x3301	UHB124 hub
 product ATMEL DWL120		0x7603	DWL-120 Wireless Adapter
 product ATMEL BW002		0x7605	BW002 Wireless Adapter
 product ATMEL WL1130USB		0x7613	WL-1130 USB
 product ATMEL AT76C505A		0x7614	AT76c505a Wireless Adapter
 
 /* AuthenTec products */
 product AUTHENTEC AES1610	0x1600	AES1610 Fingerprint Sensor
 
 /* Avision products */
 product AVISION 1200U		0x0268	1200U scanner
 
 /* Axesstel products */
 product AXESSTEL DATAMODEM	0x1000  Data Modem
 
 /* AsureWave products */
 product AZUREWAVE RT2870_1	0x3247	RT2870
 product AZUREWAVE RT2870_2	0x3262	RT2870
 product AZUREWAVE RT3070_1	0x3273	RT3070
 product	AZUREWAVE RT3070_2	0x3284	RT3070
 product	AZUREWAVE RT3070_3	0x3305	RT3070
 product AZUREWAVE RTL8188CU	0x3357	RTL8188CU
 product AZUREWAVE RTL8188CE_1	0x3358  RTL8188CE
 product AZUREWAVE RTL8188CE_2	0x3359  RTL8188CE
 product AZUREWAVE RTL8192SU_1	0x3306	RTL8192SU
 product AZUREWAVE RTL8192SU_2	0x3309	RTL8192SU
 product AZUREWAVE RTL8192SU_3	0x3310	RTL8192SU
 product AZUREWAVE RTL8192SU_4	0x3311	RTL8192SU
 product AZUREWAVE RTL8192SU_5	0x3325	RTL8192SU
 
 /* Baltech products */
 product BALTECH CARDREADER	0x9999	Card reader
 
 /* Bayer products */
 product BAYER CONTOUR_CABLE	0x6001	FTDI compatible adapter
 
 /* B&B Electronics products */
 product BBELECTRONICS USOTL4	0xAC01	RS-422/485
 product BBELECTRONICS 232USB9M		0xac27	FTDI compatible adapter
 product BBELECTRONICS 485USB9F_2W	0xac25	FTDI compatible adapter
 product BBELECTRONICS 485USB9F_4W	0xac26	FTDI compatible adapter
 product BBELECTRONICS 485USBTB_2W	0xac33	FTDI compatible adapter
 product BBELECTRONICS 485USBTB_4W	0xac34	FTDI compatible adapter
 product BBELECTRONICS TTL3USB9M		0xac50	FTDI compatible adapter
 product BBELECTRONICS TTL5USB9M		0xac49	FTDI compatible adapter
 product BBELECTRONICS USO9ML2		0xac03	FTDI compatible adapter
 product BBELECTRONICS USO9ML2DR		0xac17	FTDI compatible adapter
 product BBELECTRONICS USO9ML2DR_2	0xac16	FTDI compatible adapter
 product BBELECTRONICS USOPTL4		0xac11	FTDI compatible adapter
 product BBELECTRONICS USOPTL4DR		0xac19	FTDI compatible adapter
 product BBELECTRONICS USOPTL4DR2	0xac18	FTDI compatible adapter
 product BBELECTRONICS USPTL4		0xac12	FTDI compatible adapter
 product BBELECTRONICS USTL4		0xac02	FTDI compatible adapter
 product BBELECTRONICS ZZ_PROG1_USB	0xba02	FTDI compatible adapter
 
 /* Belkin products */
 /*product BELKIN F5U111		0x????	F5U111 Ethernet*/
 product BELKIN F5D6050		0x0050	F5D6050 802.11b Wireless Adapter
 product BELKIN FBT001V		0x0081	FBT001v2 Bluetooth
 product BELKIN FBT003V		0x0084	FBT003v2 Bluetooth
 product BELKIN F5U103		0x0103	F5U103 Serial
 product BELKIN F5U109		0x0109	F5U109 Serial
 product BELKIN USB2SCSI		0x0115	USB to SCSI
 product BELKIN F8T012		0x0121	F8T012xx1 Bluetooth USB Adapter
 product BELKIN USB2LAN		0x0121	USB to LAN
 product BELKIN F5U208		0x0208	F5U208 VideoBus II
 product BELKIN F5U237		0x0237	F5U237 USB 2.0 7-Port Hub
 product BELKIN F5U257		0x0257	F5U257 Serial
 product BELKIN F5U409		0x0409	F5U409 Serial
 product BELKIN F6C550AVR	0x0551	F6C550-AVR UPS
 product BELKIN F5U120		0x1203	F5U120-PC Hub
 product BELKIN RTL8188CU	0x1102  RTL8188CU Wireless Adapter
 product BELKIN F9L1103		0x1103	F9L1103 Wireless Adapter
 product BELKIN RTL8192CU	0x2102	RTL8192CU Wireless Adapter
 product BELKIN F7D2102		0x2103  F7D2102 Wireless Adapter
 product BELKIN ZD1211B		0x4050	ZD1211B
 product BELKIN F5D5055		0x5055	F5D5055
 product BELKIN F5D7050		0x7050	F5D7050 Wireless Adapter
 product BELKIN F5D7051		0x7051	F5D7051 54g USB Network Adapter
 product BELKIN F5D7050A		0x705a	F5D7050A Wireless Adapter
 /* Also sold as 'Ativa 802.11g wireless card' */
 product BELKIN F5D7050_V4000	0x705c	F5D7050 v4000 Wireless Adapter
 product BELKIN F5D7050E		0x705e	F5D7050E Wireless Adapter
 product BELKIN RT2870_1		0x8053	RT2870
 product BELKIN RT2870_2		0x805c	RT2870
 product BELKIN F5D8053V3	0x815c	F5D8053 v3
 product BELKIN RTL8192SU_1	0x815f	RTL8192SU
 product BELKIN RTL8192SU_2	0x845a	RTL8192SU
 product BELKIN RTL8192SU_3	0x945a	RTL8192SU
 product BELKIN F5D8055		0x825a	F5D8055
 product BELKIN F5D8055V2	0x825b	F5D8055 v2
 product BELKIN F5D9050V3	0x905b	F5D9050 ver 3 Wireless Adapter
 product BELKIN2 F5U002		0x0002	F5U002 Parallel printer
 product BELKIN F6D4050V1	0x935a	F6D4050 v1
 product BELKIN F6D4050V2	0x935b	F6D4050 v2
 
 /* Billionton products */
 product BILLIONTON USB100	0x0986	USB100N 10/100 FastEthernet
 product BILLIONTON USBLP100	0x0987	USB100LP
 product BILLIONTON USBEL100	0x0988	USB100EL
 product BILLIONTON USBE100	0x8511	USBE100
 product BILLIONTON USB2AR	0x90ff	USB2AR Ethernet
 
 /* Broadcom products */
 product BROADCOM BCM2033	0x2033	BCM2033 Bluetooth USB dongle
 
 /* Brother Industries products */
 product BROTHER HL1050		0x0002	HL-1050 laser printer
 product BROTHER MFC8600_9650	0x0100	MFC8600/9650 multifunction device
 
 /* Behavior Technology Computer products */
 product BTC BTC6100		0x5550	6100C Keyboard
 product BTC BTC7932		0x6782	Keyboard with mouse port
 
 /* Canon, Inc. products */
 product CANON N656U		0x2206	CanoScan N656U
 product CANON N1220U		0x2207	CanoScan N1220U
 product CANON D660U		0x2208	CanoScan D660U
 product CANON N676U		0x220d	CanoScan N676U
 product CANON N1240U		0x220e	CanoScan N1240U
 product CANON LIDE25		0x2220	CanoScan LIDE 25
 product CANON S10		0x3041	PowerShot S10
 product CANON S100		0x3045	PowerShot S100
 product CANON S200		0x3065	PowerShot S200
 product CANON REBELXT		0x30ef	Digital Rebel XT
 
 /* CATC products */
 product CATC NETMATE		0x000a	Netmate Ethernet
 product CATC NETMATE2		0x000c	Netmate2 Ethernet
 product CATC CHIEF		0x000d	USB Chief Bus & Protocol Analyzer
 product CATC ANDROMEDA		0x1237	Andromeda hub
 
 /* CASIO products */
 product CASIO QV_DIGICAM	0x1001	QV DigiCam
 product CASIO EXS880		0x1105	Exilim EX-S880
 product CASIO BE300		0x2002	BE-300 PDA
 product CASIO NAMELAND		0x4001	CASIO Nameland EZ-USB
 
 /* CCYU products */
 product CCYU ED1064		0x2136	EasyDisk ED1064
 
 /* Century products */
 product CENTURY EX35QUAT	0x011e	Century USB Disk Enclosure
 product CENTURY EX35SW4_SB4	0x011f	Century USB Disk Enclosure
 
 /* Cherry products */
 product CHERRY MY3000KBD	0x0001	My3000 keyboard
 product CHERRY MY3000HUB	0x0003	My3000 hub
 product CHERRY CYBOARD		0x0004	CyBoard Keyboard
 
 /* Chic Technology products */
 product CHIC MOUSE1		0x0001	mouse
 product CHIC CYPRESS		0x0003	Cypress USB Mouse
 
 /* Chicony products */
 product CHICONY KB8933		0x0001	KB-8933 keyboard
 product CHICONY KU0325		0x0116	KU-0325 keyboard
 product CHICONY CNF7129		0xb071	Notebook Web Camera
 product CHICONY HDUVCCAM	0xb40a	HD UVC WebCam
 product	CHICONY RTL8188CUS_1	0xaff7	RTL8188CUS
 product	CHICONY RTL8188CUS_2	0xaff8	RTL8188CUS
 product	CHICONY RTL8188CUS_3	0xaff9	RTL8188CUS
 product	CHICONY RTL8188CUS_4	0xaffa	RTL8188CUS
 product	CHICONY RTL8188CUS_5	0xaffa	RTL8188CUS
 product CHICONY2 TWINKLECAM	0x600d	TwinkleCam USB camera
 
 /* CH Products */
 product CHPRODUCTS PROTHROTTLE	0x00f1	Pro Throttle
 product CHPRODUCTS PROPEDALS	0x00f2	Pro Pedals
 product CHPRODUCTS FIGHTERSTICK 0x00f3	Fighterstick
 product CHPRODUCTS FLIGHTYOKE	0x00ff	Flight Sim Yoke
 
 /* Cisco-Linksys products */
 product CISCOLINKSYS WUSB54AG	0x000c	WUSB54AG Wireless Adapter
 product CISCOLINKSYS WUSB54G	0x000d	WUSB54G Wireless Adapter
 product CISCOLINKSYS WUSB54GP	0x0011	WUSB54GP Wireless Adapter
 product CISCOLINKSYS USB200MV2	0x0018	USB200M v2
 product CISCOLINKSYS HU200TS	0x001a	HU200TS Wireless Adapter
 product CISCOLINKSYS WUSB54GC	0x0020	WUSB54GC
 product CISCOLINKSYS WUSB54GR	0x0023	WUSB54GR
 product CISCOLINKSYS WUSBF54G	0x0024	WUSBF54G
 product CISCOLINKSYS AE1000	0x002f	AE1000
 product CISCOLINKSYS2 RT3070	0x4001	RT3070
 product CISCOLINKSYS3 RT3070	0x0101	RT3070
 
 /* Clipsal products */
 product CLIPSAL 560884		0x0101	560884 C-Bus Audio Matrix Switch
 product CLIPSAL 5500PACA	0x0201	5500PACA C-Bus Pascal Automation Controller
 product CLIPSAL 5800PC		0x0301	5800PC C-Bus Wireless Interface
 product CLIPSAL 5500PCU		0x0303	5500PCU C-Bus Interface
 product CLIPSAL 5000CT2		0x0304	5000CT2 C-Bus Touch Screen
 product CLIPSAL C5000CT2	0x0305	C5000CT2 C-Bus Touch Screen
 product CLIPSAL L51xx		0x0401	L51xx C-Bus Dimmer
 
 /* CMOTECH products */
 product CMOTECH CNU510		0x5141	CDMA Technologies USB modem
 product CMOTECH CNU550		0x5543	CDMA 2000 1xRTT/1xEVDO USB modem
 product CMOTECH CGU628		0x6006	CGU-628
 product CMOTECH CDMA_MODEM1	0x6280	CDMA Technologies USB modem
 product CMOTECH DISK		0xf000	disk mode
 
 /* Compaq products */
 product COMPAQ IPAQPOCKETPC	0x0003	iPAQ PocketPC
 product COMPAQ PJB100		0x504a	Personal Jukebox PJB100
 product COMPAQ IPAQLINUX	0x505a	iPAQ Linux
 
 /* Composite Corp products looks the same as "TANGTOP" */
 product COMPOSITE USBPS2	0x0001	USB to PS2 Adaptor
 
 /* Conceptronic products */
 product CONCEPTRONIC PRISM_GT	0x3762	PrismGT USB 2.0 WLAN
 product CONCEPTRONIC C11U	0x7100	C11U
 product CONCEPTRONIC WL210	0x7110	WL-210
 product CONCEPTRONIC AR5523_1	0x7801	AR5523
 product CONCEPTRONIC AR5523_1_NF	0x7802	AR5523 (no firmware)
 product CONCEPTRONIC AR5523_2	0x7811	AR5523
 product CONCEPTRONIC AR5523_2_NF	0x7812	AR5523 (no firmware)
 product CONCEPTRONIC2 RTL8192SU_1	0x3300	RTL8192SU
 product CONCEPTRONIC2 RTL8192SU_2	0x3301	RTL8192SU
 product CONCEPTRONIC2 RTL8192SU_3	0x3302	RTL8192SU
 product CONCEPTRONIC2 C54RU	0x3c02	C54RU WLAN
 product CONCEPTRONIC2 C54RU2	0x3c22	C54RU
 product CONCEPTRONIC2 RT3070_1	0x3c08	RT3070
 product CONCEPTRONIC2 RT3070_2	0x3c11	RT3070
 product CONCEPTRONIC2 VIGORN61	0x3c25	VIGORN61
 product CONCEPTRONIC2 RT2870_1	0x3c06	RT2870
 product CONCEPTRONIC2 RT2870_2	0x3c07	RT2870
 product CONCEPTRONIC2 RT2870_7	0x3c09	RT2870
 product CONCEPTRONIC2 RT2870_8	0x3c12	RT2870
 product CONCEPTRONIC2 RT2870_3	0x3c23	RT2870
 product CONCEPTRONIC2 RT2870_4	0x3c25	RT2870
 product CONCEPTRONIC2 RT2870_5	0x3c27	RT2870
 product CONCEPTRONIC2 RT2870_6	0x3c28	RT2870
 
 /* Connectix products */
 product CONNECTIX QUICKCAM	0x0001	QuickCam
 
 /* Conect products */
 product CONTEC COM1USBH		0x8311	FTDI compatible adapter
 
 /* Corega products */
 product COREGA ETHER_USB_T	0x0001	Ether USB-T
 product COREGA FETHER_USB_TX	0x0004	FEther USB-TX
 product COREGA WLAN_USB_USB_11	0x000c	WirelessLAN USB-11
 product COREGA FETHER_USB_TXS	0x000d	FEther USB-TXS
 product COREGA WLANUSB		0x0012	Wireless LAN Stick-11
 product COREGA FETHER_USB2_TX	0x0017	FEther USB2-TX
 product COREGA WLUSB_11_KEY	0x001a	ULUSB-11 Key
 product COREGA CGUSBRS232R	0x002a	CG-USBRS232R
 product COREGA CGWLUSB2GL	0x002d	CG-WLUSB2GL
 product COREGA CGWLUSB2GPX	0x002e	CG-WLUSB2GPX
 product COREGA RT2870_1		0x002f	RT2870
 product COREGA RT2870_2		0x003c	RT2870
 product COREGA RT2870_3		0x003f	RT2870
 product COREGA RT3070		0x0041	RT3070
 product COREGA CGWLUSB300GNM	0x0042	CG-WLUSB300GNM
 product COREGA RTL8192SU        0x0047  RTL8192SU
 product COREGA RTL8192CU	0x0056  RTL8192CU
 
 product COREGA WLUSB_11_STICK	0x7613	WLAN USB Stick 11
 product COREGA FETHER_USB_TXC	0x9601	FEther USB-TXC
 
 /* Corsair products */
 product CORSAIR K60		0x0a60	Corsair Vengeance K60 keyboard
 product CORSAIR K70		0x1b09	Corsair Vengeance K70 keyboard
 
 /* Creative products */
 product CREATIVE NOMAD_II	0x1002	Nomad II MP3 player
 product CREATIVE NOMAD_IIMG	0x4004	Nomad II MG
 product CREATIVE NOMAD		0x4106	Nomad
 product CREATIVE2 VOIP_BLASTER	0x0258	Voip Blaster
 product CREATIVE3 OPTICAL_MOUSE	0x0001	Notebook Optical Mouse
 
 /* Cambridge Silicon Radio Ltd. products */
 product CSR BT_DONGLE		0x0001	Bluetooth USB dongle
 product CSR CSRDFU		0xffff	USB Bluetooth Device in DFU State
 
 /* Chipsbank Microelectronics Co., Ltd */
 product CHIPSBANK USBMEMSTICK	0x6025	CBM2080 Flash drive controller
 product CHIPSBANK USBMEMSTICK1	0x6026	CBM1180 Flash drive controller
 
 /* CTX products */
 product CTX EX1300		0x9999	Ex1300 hub
 
 /* Curitel products */
 product CURITEL HX550C		0x1101	CDMA 2000 1xRTT USB modem (HX-550C)
 product CURITEL HX57XB		0x2101	CDMA 2000 1xRTT USB modem (HX-570/575B/PR-600)
 product CURITEL PC5740		0x3701	Broadband Wireless modem
 product CURITEL UM150		0x3711	EVDO modem
 product CURITEL UM175		0x3714	EVDO modem
 
 /* CyberPower products */
 product CYBERPOWER 1500CAVRLCD	0x0501	1500CAVRLCD
 
 /* CyberTAN Technology products */
 product CYBERTAN TG54USB	0x1666	TG54USB
 product CYBERTAN RT2870		0x1828	RT2870
 
 /* Cypress Semiconductor products */
 product CYPRESS MOUSE		0x0001	mouse
 product CYPRESS THERMO		0x0002	thermometer
 product CYPRESS WISPY1A		0x0bad	MetaGeek Wi-Spy
 product CYPRESS KBDHUB		0x0101	Keyboard/Hub
 product CYPRESS FMRADIO		0x1002	FM Radio
 product CYPRESS IKARILASER	0x121f	Ikari Laser SteelSeries ApS
 
 product CYPRESS USBRS232	0x5500	USB-RS232 Interface
 product CYPRESS SLIM_HUB	0x6560	Slim Hub
 product CYPRESS XX6830XX	0x6830	PATA Storage Device
 product CYPRESS SILVERSHIELD	0xfd13	Gembird Silver Shield PM
 
 /* Daisy Technology products */
 product DAISY DMC		0x6901	USB MultiMedia Reader
 
 /* Dallas Semiconductor products */
 product DALLAS J6502		0x4201	J-6502 speakers
 
 /* DataApex products */
 product DATAAPEX MULTICOM	0xead6	MultiCom
 
 /* Dell products */
 product DELL PORT		0x0058	Port Replicator
 product DELL AIO926		0x5115	Photo AIO Printer 926
 product DELL BC02		0x8000	BC02 Bluetooth USB Adapter
 product DELL PRISM_GT_1		0x8102	PrismGT USB 2.0 WLAN
 product DELL TM350		0x8103	TrueMobile 350 Bluetooth USB Adapter
 product DELL PRISM_GT_2		0x8104	PrismGT USB 2.0 WLAN
 product DELL U5700		0x8114	Dell 5700 3G
 product DELL U5500		0x8115	Dell 5500 3G
 product DELL U5505		0x8116	Dell 5505 3G
 product DELL U5700_2		0x8117	Dell 5700 3G
 product DELL U5510		0x8118	Dell 5510 3G
 product DELL U5700_3		0x8128	Dell 5700 3G
 product DELL U5700_4		0x8129	Dell 5700 3G
 product DELL U5720		0x8133	Dell 5720 3G
 product DELL U5720_2		0x8134	Dell 5720 3G
 product DELL U740		0x8135	Dell U740 CDMA
 product DELL U5520		0x8136	Dell 5520 3G
 product DELL U5520_2		0x8137	Dell 5520 3G
 product DELL U5520_3		0x8138	Dell 5520 3G
 product DELL U5730		0x8180	Dell 5730 3G
 product DELL U5730_2		0x8181	Dell 5730 3G
 product DELL U5730_3		0x8182	Dell 5730 3G
 product DELL DW700		0x9500	Dell DW700 GPS
 
 /* Delorme Paublishing products */
 product DELORME EARTHMATE	0x0100	Earthmate GPS
 
 /* Desknote products */
 product DESKNOTE UCR_61S2B	0x0c55	UCR-61S2B
 
 /* Diamond products */
 product DIAMOND RIO500USB	0x0001	Rio 500 USB
 
 /* Dick Smith Electronics (really C-Net) products */
 product DICKSMITH RT2573	0x9022	RT2573
 product DICKSMITH CWD854F	0x9032	C-Net CWD-854 rev F
 
 /* Digi International products */
 product DIGI ACCELEPORT2	0x0002	AccelePort USB 2
 product DIGI ACCELEPORT4	0x0004	AccelePort USB 4
 product DIGI ACCELEPORT8	0x0008	AccelePort USB 8
 
 /* Digianswer A/S products */
 product DIGIANSWER ZIGBEE802154	0x000a	ZigBee/802.15.4 MAC
 
 /* D-Link products */
 /*product DLINK DSBS25		0x0100	DSB-S25 serial*/
 product DLINK DUBE100		0x1a00	10/100 Ethernet
 product DLINK DUBE100C1		0x1a02	DUB-E100 rev C1
 product DLINK DSB650TX4		0x200c	10/100 Ethernet
 product DLINK DWL120E		0x3200	DWL-120 rev E
 product DLINK DWA125D1		0x330f	DWA-125 rev D1
 product DLINK DWA123D1		0x3310	DWA-123 rev D1
 product DLINK DWL122		0x3700	DWL-122
 product DLINK DWLG120		0x3701	DWL-G120
 product DLINK DWL120F		0x3702	DWL-120 rev F
 product DLINK DWLAG132		0x3a00	DWL-AG132
 product DLINK DWLAG132_NF	0x3a01	DWL-AG132 (no firmware)
 product DLINK DWLG132		0x3a02	DWL-G132
 product DLINK DWLG132_NF	0x3a03	DWL-G132 (no firmware)
 product DLINK DWLAG122		0x3a04	DWL-AG122
 product DLINK DWLAG122_NF	0x3a05	DWL-AG122 (no firmware)
 product DLINK DWLG122		0x3c00	DWL-G122 b1 Wireless Adapter
 product DLINK DUBE100B1		0x3c05	DUB-E100 rev B1
 product DLINK RT2870		0x3c09	RT2870
 product DLINK RT3072		0x3c0a	RT3072
 product DLINK DWA140B3		0x3c15	DWA-140 rev B3
 product DLINK DWA160B2		0x3c1a	DWA-160 rev B2
 product DLINK DWA127		0x3c1b	DWA-127 Wireless Adapter
 product DLINK DWA162		0x3c1f	DWA-162 Wireless Adapter
 product DLINK DWA140D1		0x3c20	DWA-140 rev D1
 product DLINK DSB650C		0x4000	10Mbps Ethernet
 product DLINK DSB650TX1		0x4001	10/100 Ethernet
 product DLINK DSB650TX		0x4002	10/100 Ethernet
 product DLINK DSB650TX_PNA	0x4003	1/10/100 Ethernet
 product DLINK DSB650TX3		0x400b	10/100 Ethernet
 product DLINK DSB650TX2		0x4102	10/100 Ethernet
 product DLINK DUB1312		0x4a00	10/100/1000 Ethernet
 product DLINK DSB650		0xabc1	10/100 Ethernet
 product DLINK DUBH7		0xf103	DUB-H7 USB 2.0 7-Port Hub
 product DLINK DWR510_CD		0xa805	DWR-510 CD-ROM Mode
 product DLINK DWR510		0x7e12	DWR-510
 product DLINK RTL8188CU		0x3308	RTL8188CU
 product	DLINK RTL8192CU_1	0x3307	RTL8192CU
 product	DLINK RTL8192CU_2	0x3309	RTL8192CU
 product	DLINK RTL8192CU_3	0x330a	RTL8192CU
 product	DLINK DWA131B		0x330d	DWA-131 rev B
 product DLINK2 RTL8192SU_1	0x3300	RTL8192SU
 product DLINK2 RTL8192SU_2	0x3302	RTL8192SU
 product DLINK2 DWA131A1		0x3303	DWA-131 A1
 product DLINK2 DWA120		0x3a0c	DWA-120
 product DLINK2 DWA120_NF	0x3a0d	DWA-120 (no firmware)
 product DLINK2 DWLG122C1	0x3c03	DWL-G122 c1
 product DLINK2 WUA1340		0x3c04	WUA-1340
 product DLINK2 DWA111		0x3c06	DWA-111
 product DLINK2 RT2870_1		0x3c09	RT2870
 product DLINK2 DWA110		0x3c07	DWA-110
 product DLINK2 RT3072		0x3c0a	RT3072
 product DLINK2 RT3072_1		0x3c0b	RT3072
 product DLINK2 RT3070_1		0x3c0d	RT3070
 product DLINK2 RT3070_2		0x3c0e	RT3070
 product DLINK2 RT3070_3		0x3c0f	RT3070
 product DLINK2 RT2870_2		0x3c11	RT2870
 product DLINK2 DWA130		0x3c13	DWA-130
 product DLINK2 RT3070_4		0x3c15	RT3070
 product DLINK2 RT3070_5		0x3c16	RT3070
 product DLINK3 DWM652		0x3e04	DWM-652
 
 /* DMI products */
 product DMI CFSM_RW		0xa109	CF/SM Reader/Writer
 product DMI DISK		0x2bcf	Generic Disk
 
 /* DrayTek products */
 product DRAYTEK VIGOR550	0x0550	Vigor550
 
 /* Dream Link products */
 product DREAMLINK DL100B	0x0004	USB Webmail Notifier
 
 /* dresden elektronik products */
 product DRESDENELEKTRONIK SENSORTERMINALBOARD  0x0001 SensorTerminalBoard
 product DRESDENELEKTRONIK WIRELESSHANDHELDTERMINAL  0x0004 Wireless Handheld Terminal
 product DRESDENELEKTRONIK DE_RFNODE                 0x001c deRFnode
 product DRESDENELEKTRONIK LEVELSHIFTERSTICKLOWCOST  0x0022 Levelshifter Stick Low Cost
 
 /* Dynastream Innovations */
 product DYNASTREAM ANTDEVBOARD	0x1003	ANT dev board
 product DYNASTREAM ANT2USB	0x1004	ANT2USB
 product DYNASTREAM ANTDEVBOARD2	0x1006	ANT dev board
 
 /* Edimax products */
 product EDIMAX EW7318USG	0x7318	USB Wireless dongle
 product EDIMAX RTL8192SU_1	0x7611	RTL8192SU
 product EDIMAX RTL8192SU_2	0x7612	RTL8192SU
 product EDIMAX EW7622UMN	0x7622	EW-7622UMn
 product EDIMAX RT2870_1		0x7711	RT2870
 product EDIMAX EW7717		0x7717	EW-7717
 product EDIMAX EW7718		0x7718	EW-7718
 product EDIMAX EW7733UND	0x7733	EW-7733UnD
 product EDIMAX EW7811UN		0x7811	EW-7811Un
 product	EDIMAX RTL8192CU	0x7822	RTL8192CU
 
 /* eGalax Products */
 product EGALAX TPANEL		0x0001	Touch Panel
 product EGALAX TPANEL2		0x0002	Touch Panel
 product EGALAX2 TPANEL		0x0001	Touch Panel
 
 /* EGO Products */
 product EGO DUMMY		0x0000	Dummy Product
 product EGO M4U			0x1020	ESI M4U
 
 /* Eicon Networks */
 product EICON DIVA852		0x4905	Diva 852 ISDN TA
 
 /* EIZO products */
 product EIZO HUB		0x0000	hub
 product EIZO MONITOR		0x0001	monitor
 
 /* ELCON Systemtechnik products */
 product ELCON PLAN		0x0002	Goldpfeil P-LAN
 
 /* Elecom products */
 product ELECOM MOUSE29UO	0x0002	mouse 29UO
 product ELECOM LDUSBTX0		0x200c	LD-USB/TX
 product ELECOM LDUSBTX1		0x4002	LD-USB/TX
 product ELECOM LDUSBLTX		0x4005	LD-USBL/TX
 product ELECOM WDC150SU2M	0x4008	WDC-150SU2M
 product ELECOM LDUSBTX2		0x400b	LD-USB/TX
 product ELECOM LDUSB20		0x4010	LD-USB20
 product ELECOM UCSGT		0x5003	UC-SGT
 product ELECOM UCSGT0		0x5004	UC-SGT
 product ELECOM LDUSBTX3		0xabc1	LD-USB/TX
 
 /* Elektor products */
 product ELEKTOR FT323R		0x0005	FTDI compatible adapter
 
 /* Elsa products */
 product ELSA MODEM1		0x2265	ELSA Modem Board
 product ELSA USB2ETHERNET	0x3000	Microlink USB2Ethernet
 
 /* ELV products */
 product ELV USBI2C		0xe00f	USB-I2C interface
 
 /* EMS products */
 product EMS DUAL_SHOOTER	0x0003	PSX gun controller converter
 
 /* Emtec products */
 product EMTEC RUF2PS 		0x2240 Flash Drive
 
 /* Encore products */
 product ENCORE RT3070_1		0x1480	RT3070
 product ENCORE RT3070_2		0x14a1	RT3070
 product ENCORE RT3070_3		0x14a9	RT3070
 
 /* Entrega products */
 product ENTREGA 1S		0x0001	1S serial
 product ENTREGA 2S		0x0002	2S serial
 product ENTREGA 1S25		0x0003	1S25 serial
 product ENTREGA 4S		0x0004	4S serial
 product ENTREGA E45		0x0005	E45 Ethernet
 product ENTREGA CENTRONICS	0x0006	Parallel Port
 product ENTREGA XX1		0x0008	Ethernet
 product ENTREGA 1S9		0x0093	1S9 serial
 product ENTREGA EZUSB		0x8000	EZ-USB
 /*product ENTREGA SERIAL	0x8001	DB25 Serial*/
 product ENTREGA 2U4S		0x8004	2U4S serial/usb hub
 product ENTREGA XX2		0x8005	Ethernet
 /*product ENTREGA SERIAL_DB9	0x8093	DB9 Serial*/
 
 /* Epson products */
 product EPSON PRINTER1		0x0001	USB Printer
 product EPSON PRINTER2		0x0002	ISD USB Smart Cable for Mac
 product EPSON PRINTER3		0x0003	ISD USB Smart Cable
 product EPSON PRINTER5		0x0005	USB Printer
 product EPSON 636		0x0101	Perfection 636U / 636Photo scanner
 product EPSON 610		0x0103	Perfection 610 scanner
 product EPSON 1200		0x0104	Perfection 1200U / 1200Photo scanner
 product EPSON 1600		0x0107	Expression 1600 scanner
 product EPSON 1640		0x010a	Perfection 1640SU scanner
 product EPSON 1240		0x010b	Perfection 1240U / 1240Photo scanner
 product EPSON 640U		0x010c	Perfection 640U scanner
 product EPSON 1250		0x010f	Perfection 1250U / 1250Photo scanner
 product EPSON 1650		0x0110	Perfection 1650 scanner
 product EPSON GT9700F		0x0112	GT-9700F scanner
 product EPSON GT9300UF		0x011b	GT-9300UF scanner
 product EPSON 3200		0x011c	Perfection 3200 scanner
 product EPSON 1260		0x011d	Perfection 1260 scanner
 product EPSON 1660		0x011e	Perfection 1660 scanner
 product EPSON 1670		0x011f	Perfection 1670 scanner
 product EPSON 1270		0x0120	Perfection 1270 scanner
 product EPSON 2480		0x0121	Perfection 2480 scanner
 product EPSON 3590		0x0122	Perfection 3590 scanner
 product EPSON 4990		0x012a	Perfection 4990 Photo scanner
 product EPSON CRESSI_EDY	0x0521	Cressi Edy diving computer
 product EPSON N2ITION3		0x0522	Zeagle N2iTion3 diving computer
 product EPSON STYLUS_875DC	0x0601	Stylus Photo 875DC Card Reader
 product EPSON STYLUS_895	0x0602	Stylus Photo 895 Card Reader
 product EPSON CX5400		0x0808	CX5400 scanner
 product EPSON 3500		0x080e	CX-3500/3600/3650 MFP
 product EPSON RX425		0x080f	Stylus Photo RX425 scanner
 product EPSON DX3800		0x0818	CX3700/CX3800/DX38x0 MFP scanner
 product EPSON 4800		0x0819	CX4700/CX4800/DX48x0 MFP scanner
 product EPSON 4200		0x0820	CX4100/CX4200/DX4200 MFP scanner
 product EPSON 5000		0x082b  CX4900/CX5000/DX50x0 MFP scanner
 product EPSON 6000		0x082e  CX5900/CX6000/DX60x0 MFP scanner
 product EPSON DX4000		0x082f  DX4000 MFP scanner
 product EPSON DX7400		0x0838	CX7300/CX7400/DX7400 MFP scanner
 product EPSON DX8400		0x0839	CX8300/CX8400/DX8400 MFP scanner
 product EPSON SX100		0x0841	SX100/NX100 MFP scanner
 product EPSON NX300		0x0848	NX300 MFP scanner
 product EPSON SX200		0x0849	SX200/SX205 MFP scanner
 product EPSON SX400		0x084a	SX400/NX400/TX400 MFP scanner
 
 /* e-TEK Labs products */
 product ETEK 1COM		0x8007	Serial
 
 /* Evolution products */
 product EVOLUTION ER1		0x0300	FTDI compatible adapter
 product EVOLUTION HYBRID	0x0302	FTDI compatible adapter
 product EVOLUTION RCM4		0x0303	FTDI compatible adapter
 
 /* Extended Systems products */
 product EXTENDED XTNDACCESS	0x0100	XTNDAccess IrDA
 
 /* Falcom products */
 product FALCOM TWIST		0x0001	USB GSM/GPRS Modem
 product FALCOM SAMBA		0x0005	FTDI compatible adapter
 
 /* FEIYA products */
 product FEIYA DUMMY		0x0000	Dummy product
 product FEIYA 5IN1		0x1132	5-in-1 Card Reader
 product FEIYA ELANGO		0x6200	MicroSDHC Card Reader
 product FEIYA AC110		0x6300	AC-110 Card Reader
 
 /* FeiXun Communication products */
 product FEIXUN RTL8188CU	0x0090	RTL8188CU
 product FEIXUN RTL8192CU	0x0091	RTL8192CU
 
 /* Festo */
 product FESTO CPX_USB		0x0102	CPX-USB
 product FESTO CMSP		0x0501	CMSP
 
 /* Fiberline */
 product FIBERLINE WL430U	0x6003	WL-430U
 
 /* FIC / OpenMoko */
 product FIC NEO1973_DEBUG	0x5118	FTDI compatible adapter
 
 /* Fossil, Inc products */
 product FOSSIL WRISTPDA		0x0002	Wrist PDA
 
 /* Foxconn products */
 product FOXCONN TCOM_TC_300	0xe000	T-Com TC 300
 product FOXCONN PIRELLI_DP_L10	0xe003	Pirelli DP-L10
 
 /* Freecom products */
 product FREECOM DVD		0xfc01	DVD drive
 product FREECOM HDD		0xfc05	Classic SL Hard Drive
 
 /* Fujitsu Siemens Computers products */
 product FSC E5400		0x1009	PrismGT USB 2.0 WLAN
 
 /* Future Technology Devices products */
 product FTDI SERIAL_8U100AX	0x8372	8U100AX Serial
 product FTDI SERIAL_8U232AM	0x6001	8U232AM Serial
 product FTDI SERIAL_8U232AM4	0x6004	8U232AM Serial
 product FTDI SERIAL_232RL	0x6006	FT232RL Serial
 product FTDI SERIAL_2232C	0x6010	FT2232C Dual port Serial
 product FTDI 232H		0x6014	FTDI compatible adapter
 product FTDI 232EX		0x6015	FTDI compatible adapter
 product FTDI SERIAL_2232D	0x9e90	FT2232D Dual port Serial
 product FTDI SERIAL_4232H	0x6011	FT4232H Quad port Serial
 product FTDI XDS100V2		0xa6d0	TI XDS100V1/V2 and early Beaglebones
 product FTDI XDS100V3		0xa6d1	TI XDS100V3
 product FTDI KTLINK		0xbbe2	KT-LINK Embedded Hackers Multitool
 product FTDI TURTELIZER2	0xbdc8	egnite Turtelizer 2 JTAG/RS232 Adapter
 /* Gude Analog- und Digitalsysteme products also uses FTDI's id: */
 product FTDI TACTRIX_OPENPORT_13M 0xcc48 OpenPort 1.3 Mitsubishi
 product FTDI TACTRIX_OPENPORT_13S 0xcc49 OpenPort 1.3 Subaru
 product FTDI TACTRIX_OPENPORT_13U 0xcc4a OpenPort 1.3 Universal
 product FTDI GAMMASCOUT		0xd678	Gamma-Scout
 product FTDI KBS		0xe6c8	Pyramid KBS USB LCD
 product FTDI EISCOU		0xe888	Expert ISDN Control USB
 product FTDI UOPTBR		0xe889	USB-RS232 OptoBridge
 product FTDI EMCU2D		0xe88a	Expert mouseCLOCK USB II
 product FTDI PCMSFU		0xe88b	Precision Clock MSF USB
 product FTDI EMCU2H		0xe88c	Expert mouseCLOCK USB II HBG
 product FTDI MAXSTREAM		0xee18	Maxstream PKG-U
 product FTDI USB_UIRT		0xf850	USB-UIRT
 product FTDI USBSERIAL		0xfa00	Matrix Orbital USB Serial
 product FTDI MX2_3		0xfa01	Matrix Orbital MX2 or MX3
 product FTDI MX4_5		0xfa02	Matrix Orbital MX4 or MX5
 product FTDI LK202		0xfa03	Matrix Orbital VK/LK202 Family
 product FTDI LK204		0xfa04	Matrix Orbital VK/LK204 Family
 product FTDI CFA_632		0xfc08	Crystalfontz CFA-632 USB LCD
 product FTDI CFA_634		0xfc09	Crystalfontz CFA-634 USB LCD
 product FTDI CFA_633		0xfc0b	Crystalfontz CFA-633 USB LCD
 product FTDI CFA_631		0xfc0c	Crystalfontz CFA-631 USB LCD
 product FTDI CFA_635		0xfc0d	Crystalfontz CFA-635 USB LCD
 product FTDI SEMC_DSS20		0xfc82	SEMC DSS-20 SyncStation
 /* Commerzielle und Technische Informationssysteme GmbH products */
 product FTDI CTI_USB_NANO_485	0xf60b	CTI USB-Nano 485
 product FTDI CTI_USB_MINI_485	0xf608	CTI USB-Mini 485
 /* Other products */
 product FTDI 232RL		0xfbfa	FTDI compatible adapter
 product FTDI 4N_GALAXY_DE_1	0xf3c0	FTDI compatible adapter
 product FTDI 4N_GALAXY_DE_2	0xf3c1	FTDI compatible adapter
 product FTDI 4N_GALAXY_DE_3	0xf3c2	FTDI compatible adapter
 product FTDI 8U232AM_ALT	0x6006	FTDI compatible adapter
 product FTDI ACCESSO		0xfad0	FTDI compatible adapter
 product FTDI ACG_HFDUAL		0xdd20	FTDI compatible adapter
 product FTDI ACTIVE_ROBOTS	0xe548	FTDI compatible adapter
 product FTDI ACTZWAVE		0xf2d0	FTDI compatible adapter
 product FTDI AMC232		0xff00	FTDI compatible adapter
 product FTDI ARTEMIS		0xdf28	FTDI compatible adapter
 product FTDI ASK_RDR400		0xc991	FTDI compatible adapter
 product FTDI ATIK_ATK16		0xdf30	FTDI compatible adapter
 product FTDI ATIK_ATK16C	0xdf32	FTDI compatible adapter
 product FTDI ATIK_ATK16HR	0xdf31	FTDI compatible adapter
 product FTDI ATIK_ATK16HRC	0xdf33	FTDI compatible adapter
 product FTDI ATIK_ATK16IC	0xdf35	FTDI compatible adapter
 product FTDI BCS_SE923		0xfb99	FTDI compatible adapter
 product FTDI CANDAPTER		0x9f80	FTDI compatible adapter
 product FTDI CANUSB		0xffa8	FTDI compatible adapter
 product FTDI CCSICDU20_0	0xf9d0	FTDI compatible adapter
 product FTDI CCSICDU40_1	0xf9d1	FTDI compatible adapter
 product FTDI CCSICDU64_4	0xf9d4	FTDI compatible adapter
 product FTDI CCSLOAD_N_GO_3	0xf9d3	FTDI compatible adapter
 product FTDI CCSMACHX_2		0xf9d2	FTDI compatible adapter
 product FTDI CCSPRIME8_5	0xf9d5	FTDI compatible adapter
 product FTDI CHAMSYS_24_MASTER_WING	0xdaf8	FTDI compatible adapter
 product FTDI CHAMSYS_MAXI_WING	0xdafd	FTDI compatible adapter
 product FTDI CHAMSYS_MEDIA_WING	0xdafe	FTDI compatible adapter
 product FTDI CHAMSYS_MIDI_TIMECODE	0xdafb	FTDI compatible adapter
 product FTDI CHAMSYS_MINI_WING	0xdafc	FTDI compatible adapter
 product FTDI CHAMSYS_PC_WING	0xdaf9	FTDI compatible adapter
 product FTDI CHAMSYS_USB_DMX	0xdafa	FTDI compatible adapter
 product FTDI CHAMSYS_WING	0xdaff	FTDI compatible adapter
 product FTDI COM4SM		0xd578	FTDI compatible adapter
 product FTDI CONVERTER_0	0xd388	FTDI compatible adapter
 product FTDI CONVERTER_1	0xd389	FTDI compatible adapter
 product FTDI CONVERTER_2	0xd38a	FTDI compatible adapter
 product FTDI CONVERTER_3	0xd38b	FTDI compatible adapter
 product FTDI CONVERTER_4	0xd38c	FTDI compatible adapter
 product FTDI CONVERTER_5	0xd38d	FTDI compatible adapter
 product FTDI CONVERTER_6	0xd38e	FTDI compatible adapter
 product FTDI CONVERTER_7	0xd38f	FTDI compatible adapter
 product FTDI DMX4ALL		0xc850	FTDI compatible adapter
 product FTDI DOMINTELL_DGQG	0xef50	FTDI compatible adapter
 product FTDI DOMINTELL_DUSB	0xef51	FTDI compatible adapter
 product FTDI DOTEC		0x9868	FTDI compatible adapter
 product FTDI ECLO_COM_1WIRE	0xea90	FTDI compatible adapter
 product FTDI ECO_PRO_CDS	0xe520	FTDI compatible adapter
 product FTDI ELSTER_UNICOM	0xe700	FTDI compatible adapter
 product FTDI ELV_ALC8500	0xf06e	FTDI compatible adapter
 product FTDI ELV_CLI7000	0xfb59	FTDI compatible adapter
 product FTDI ELV_CSI8		0xe0f0	FTDI compatible adapter
 product FTDI ELV_EC3000		0xe006	FTDI compatible adapter
 product FTDI ELV_EM1000DL	0xe0f1	FTDI compatible adapter
 product FTDI ELV_EM1010PC	0xe0ef	FTDI compatible adapter
 product FTDI ELV_FEM		0xe00a	FTDI compatible adapter
 product FTDI ELV_FHZ1000PC	0xf06f	FTDI compatible adapter
 product FTDI ELV_FHZ1300PC	0xe0e8	FTDI compatible adapter
 product FTDI ELV_FM3RX		0xe0ed	FTDI compatible adapter
 product FTDI ELV_FS20SIG	0xe0f4	FTDI compatible adapter
 product FTDI ELV_HS485		0xe0ea	FTDI compatible adapter
 product FTDI ELV_KL100		0xe002	FTDI compatible adapter
 product FTDI ELV_MSM1		0xe001	FTDI compatible adapter
 product FTDI ELV_PCD200		0xf06c	FTDI compatible adapter
 product FTDI ELV_PCK100		0xe0f2	FTDI compatible adapter
 product FTDI ELV_PPS7330	0xfb5c	FTDI compatible adapter
 product FTDI ELV_RFP500		0xe0f3	FTDI compatible adapter
 product FTDI ELV_T1100		0xf06b	FTDI compatible adapter
 product FTDI ELV_TFD128		0xe0ec	FTDI compatible adapter
 product FTDI ELV_TFM100		0xfb5d	FTDI compatible adapter
 product FTDI ELV_TWS550		0xe009	FTDI compatible adapter
 product FTDI ELV_UAD8		0xf068	FTDI compatible adapter
 product FTDI ELV_UDA7		0xf069	FTDI compatible adapter
 product FTDI ELV_UDF77		0xfb5e	FTDI compatible adapter
 product FTDI ELV_UIO88		0xfb5f	FTDI compatible adapter
 product FTDI ELV_ULA200		0xf06d	FTDI compatible adapter
 product FTDI ELV_UM100		0xfb5a	FTDI compatible adapter
 product FTDI ELV_UMS100		0xe0eb	FTDI compatible adapter
 product FTDI ELV_UO100		0xfb5b	FTDI compatible adapter
 product FTDI ELV_UR100		0xfb58	FTDI compatible adapter
 product FTDI ELV_USI2		0xf06a	FTDI compatible adapter
 product FTDI ELV_USR		0xe000	FTDI compatible adapter
 product FTDI ELV_UTP8		0xe0f5	FTDI compatible adapter
 product FTDI ELV_WS300PC	0xe0f6	FTDI compatible adapter
 product FTDI ELV_WS444PC	0xe0f7	FTDI compatible adapter
 product FTDI ELV_WS500		0xe0e9	FTDI compatible adapter
 product FTDI ELV_WS550		0xe004	FTDI compatible adapter
 product FTDI ELV_WS777		0xe0ee	FTDI compatible adapter
 product FTDI ELV_WS888		0xe008	FTDI compatible adapter
 product FTDI FUTURE_0		0xf44a	FTDI compatible adapter
 product FTDI FUTURE_1		0xf44b	FTDI compatible adapter
 product FTDI FUTURE_2		0xf44c	FTDI compatible adapter
 product FTDI GENERIC		0x9378	FTDI compatible adapter
 product FTDI GUDEADS_E808	0xe808	FTDI compatible adapter
 product FTDI GUDEADS_E809	0xe809	FTDI compatible adapter
 product FTDI GUDEADS_E80A	0xe80a	FTDI compatible adapter
 product FTDI GUDEADS_E80B	0xe80b	FTDI compatible adapter
 product FTDI GUDEADS_E80C	0xe80c	FTDI compatible adapter
 product FTDI GUDEADS_E80D	0xe80d	FTDI compatible adapter
 product FTDI GUDEADS_E80E	0xe80e	FTDI compatible adapter
 product FTDI GUDEADS_E80F	0xe80f	FTDI compatible adapter
 product FTDI GUDEADS_E88D	0xe88d	FTDI compatible adapter
 product FTDI GUDEADS_E88E	0xe88e	FTDI compatible adapter
 product FTDI GUDEADS_E88F	0xe88f	FTDI compatible adapter
 product FTDI HD_RADIO		0x937c	FTDI compatible adapter
 product FTDI HO720		0xed72	FTDI compatible adapter
 product FTDI HO730		0xed73	FTDI compatible adapter
 product FTDI HO820		0xed74	FTDI compatible adapter
 product FTDI HO870		0xed71	FTDI compatible adapter
 product FTDI IBS_APP70		0xff3d	FTDI compatible adapter
 product FTDI IBS_PCMCIA		0xff3a	FTDI compatible adapter
 product FTDI IBS_PEDO		0xff3e	FTDI compatible adapter
 product FTDI IBS_PICPRO		0xff39	FTDI compatible adapter
 product FTDI IBS_PK1		0xff3b	FTDI compatible adapter
 product FTDI IBS_PROD		0xff3f	FTDI compatible adapter
 product FTDI IBS_RS232MON	0xff3c	FTDI compatible adapter
 product FTDI IBS_US485		0xff38	FTDI compatible adapter
 product FTDI IPLUS		0xd070	FTDI compatible adapter
 product FTDI IPLUS2		0xd071	FTDI compatible adapter
 product FTDI IRTRANS		0xfc60	FTDI compatible adapter
 product FTDI LENZ_LIUSB		0xd780	FTDI compatible adapter
 product FTDI LM3S_DEVEL_BOARD	0xbcd8	FTDI compatible adapter
 product FTDI LM3S_EVAL_BOARD	0xbcd9	FTDI compatible adapter
 product FTDI LM3S_ICDI_B_BOARD	0xbcda	FTDI compatible adapter
 product FTDI MASTERDEVEL2	0xf449	FTDI compatible adapter
 product FTDI MHAM_DB9		0xeeed	FTDI compatible adapter
 product FTDI MHAM_IC		0xeeec	FTDI compatible adapter
 product FTDI MHAM_KW		0xeee8	FTDI compatible adapter
 product FTDI MHAM_RS232		0xeeee	FTDI compatible adapter
 product FTDI MHAM_Y6		0xeeea	FTDI compatible adapter
 product FTDI MHAM_Y8		0xeeeb	FTDI compatible adapter
 product FTDI MHAM_Y9		0xeeef	FTDI compatible adapter
 product FTDI MHAM_YS		0xeee9	FTDI compatible adapter
 product FTDI MICRO_CHAMELEON	0xcaa0	FTDI compatible adapter
 product FTDI MTXORB_5		0xfa05	FTDI compatible adapter
 product FTDI MTXORB_6		0xfa06	FTDI compatible adapter
 product FTDI NXTCAM		0xabb8	FTDI compatible adapter
 product FTDI OCEANIC		0xf460	FTDI compatible adapter
 product FTDI OOCDLINK		0xbaf8	FTDI compatible adapter
 product FTDI OPENDCC		0xbfd8	FTDI compatible adapter
 product FTDI OPENDCC_GATEWAY	0xbfdb	FTDI compatible adapter
 product FTDI OPENDCC_GBM	0xbfdc	FTDI compatible adapter
 product FTDI OPENDCC_SNIFFER	0xbfd9	FTDI compatible adapter
 product FTDI OPENDCC_THROTTLE	0xbfda	FTDI compatible adapter
 product FTDI PCDJ_DAC2		0xfa88	FTDI compatible adapter
 product FTDI PERLE_ULTRAPORT	0xf0c0	FTDI compatible adapter
 product FTDI PHI_FISCO		0xe40b	FTDI compatible adapter
 product FTDI PIEGROUP		0xf208	FTDI compatible adapter
 product FTDI PROPOX_JTAGCABLEII	0xd738	FTDI compatible adapter
 product FTDI R2000KU_TRUE_RNG	0xfb80	FTDI compatible adapter
 product FTDI R2X0		0xfc71	FTDI compatible adapter
 product FTDI RELAIS		0xfa10	FTDI compatible adapter
 product FTDI REU_TINY		0xed22	FTDI compatible adapter
 product FTDI RMP200		0xe729	FTDI compatible adapter
 product FTDI RM_CANVIEW		0xfd60	FTDI compatible adapter
 product FTDI RRCIRKITS_LOCOBUFFER	0xc7d0	FTDI compatible adapter
 product FTDI SCIENCESCOPE_HS_LOGBOOK	0xff1d	FTDI compatible adapter
 product FTDI SCIENCESCOPE_LOGBOOKML	0xff18	FTDI compatible adapter
 product FTDI SCIENCESCOPE_LS_LOGBOOK	0xff1c	FTDI compatible adapter
 product FTDI SCS_DEVICE_0	0xd010	FTDI compatible adapter
 product FTDI SCS_DEVICE_1	0xd011	FTDI compatible adapter
 product FTDI SCS_DEVICE_2	0xd012	FTDI compatible adapter
 product FTDI SCS_DEVICE_3	0xd013	FTDI compatible adapter
 product FTDI SCS_DEVICE_4	0xd014	FTDI compatible adapter
 product FTDI SCS_DEVICE_5	0xd015	FTDI compatible adapter
 product FTDI SCS_DEVICE_6	0xd016	FTDI compatible adapter
 product FTDI SCS_DEVICE_7	0xd017	FTDI compatible adapter
 product FTDI SDMUSBQSS		0xf448	FTDI compatible adapter
 product FTDI SIGNALYZER_SH2	0xbca2	FTDI compatible adapter
 product FTDI SIGNALYZER_SH4	0xbca4	FTDI compatible adapter
 product FTDI SIGNALYZER_SLITE	0xbca1	FTDI compatible adapter
 product FTDI SIGNALYZER_ST	0xbca0	FTDI compatible adapter
 product FTDI SPECIAL_1		0xfc70	FTDI compatible adapter
 product FTDI SPECIAL_3		0xfc72	FTDI compatible adapter
 product FTDI SPECIAL_4		0xfc73	FTDI compatible adapter
 product FTDI SPROG_II		0xf0c8	FTDI compatible adapter
 product FTDI SR_RADIO		0x9379	FTDI compatible adapter
 product FTDI SUUNTO_SPORTS	0xf680	FTDI compatible adapter
 product FTDI TAVIR_STK500	0xfa33	FTDI compatible adapter
 product FTDI TERATRONIK_D2XX	0xec89	FTDI compatible adapter
 product FTDI TERATRONIK_VCP	0xec88	FTDI compatible adapter
 product FTDI THORLABS		0xfaf0	FTDI compatible adapter
 product FTDI TNC_X		0xebe0	FTDI compatible adapter
 product FTDI TTUSB		0xff20	FTDI compatible adapter
 product FTDI USBX_707		0xf857	FTDI compatible adapter
 product FTDI USINT_CAT		0xb810	FTDI compatible adapter
 product FTDI USINT_RS232	0xb812	FTDI compatible adapter
 product FTDI USINT_WKEY		0xb811	FTDI compatible adapter
 product FTDI VARDAAN		0xf070	FTDI compatible adapter
 product FTDI VNHCPCUSB_D	0xfe38	FTDI compatible adapter
 product FTDI WESTREX_MODEL_777		0xdc00	FTDI compatible adapter
 product FTDI WESTREX_MODEL_8900F	0xdc01	FTDI compatible adapter
 product FTDI XF_547		0xfc0a	FTDI compatible adapter
 product FTDI XF_640		0xfc0e	FTDI compatible adapter
 product FTDI XF_642		0xfc0f	FTDI compatible adapter
 product FTDI XM_RADIO		0x937a	FTDI compatible adapter
 product FTDI YEI_SERVOCENTER31	0xe050	FTDI compatible adapter
 
 /* Fuji photo products */
 product FUJIPHOTO MASS0100	0x0100	Mass Storage
 
 /* Fujitsu protducts */
 product FUJITSU AH_F401U	0x105b	AH-F401U Air H device
 
 /* Fujitsu-Siemens protducts */
 product FUJITSUSIEMENS SCR	0x0009	Fujitsu-Siemens SCR USB Reader
 
 /* Garmin products */
 product GARMIN IQUE_3600	0x0004	iQue 3600
 
 /* Gemalto products */
 product GEMALTO PROXPU		0x5501	Prox-PU/CU RFID Card Reader
 
 /* General Instruments (Motorola) products */
 product GENERALINSTMNTS SB5100	0x5100	SURFboard SB5100 Cable modem
 
 /* Genesys Logic products */
 product GENESYS GL620USB	0x0501	GL620USB Host-Host interface
 product GENESYS GL650		0x0604	GL650 HUB
 product GENESYS GL606		0x0606	USB 2.0 HUB
 product GENESYS GL641USB	0x0700	GL641USB CompactFlash Card Reader
 product GENESYS GL641USB2IDE_2	0x0701	GL641USB USB-IDE Bridge No 2
 product GENESYS GL641USB2IDE	0x0702	GL641USB USB-IDE Bridge
 product GENESYS GL641USB_2	0x0760	GL641USB 6-in-1 Card Reader
 
 /* GIGABYTE products */
 product GIGABYTE GN54G		0x8001	GN-54G
 product GIGABYTE GNBR402W	0x8002	GN-BR402W
 product GIGABYTE GNWLBM101	0x8003	GN-WLBM101
 product GIGABYTE GNWBKG		0x8007	GN-WBKG
 product GIGABYTE GNWB01GS	0x8008	GN-WB01GS
 product GIGABYTE GNWI05GS	0x800a	GN-WI05GS
 
 /* Gigaset products */
 product GIGASET WLAN		0x0701	WLAN
 product GIGASET SMCWUSBTG	0x0710	SMCWUSBT-G
 product GIGASET SMCWUSBTG_NF	0x0711	SMCWUSBT-G (no firmware)
 product GIGASET AR5523		0x0712	AR5523
 product GIGASET AR5523_NF	0x0713	AR5523 (no firmware)
 product GIGASET RT2573		0x0722	RT2573
 product GIGASET RT3070_1	0x0740	RT3070
 product GIGASET RT3070_2	0x0744	RT3070
 product GIGABYTE RT2870_1	0x800b	RT2870
 product GIGABYTE GNWB31N	0x800c	GN-WB31N
 product GIGABYTE GNWB32L	0x800d	GN-WB32L
 
 /* Global Sun Technology product */
 product GLOBALSUN AR5523_1	0x7801	AR5523
 product GLOBALSUN AR5523_1_NF	0x7802	AR5523 (no firmware)
 product GLOBALSUN AR5523_2	0x7811	AR5523
 product GLOBALSUN AR5523_2_NF	0x7812	AR5523 (no firmware)
 
 /* Globespan products */
 product GLOBESPAN PRISM_GT_1	0x2000	PrismGT USB 2.0 WLAN
 product GLOBESPAN PRISM_GT_2	0x2002	PrismGT USB 2.0 WLAN
 
 /* G.Mate, Inc products */
 product GMATE YP3X00		0x1001	YP3X00 PDA
 
 /* GN Otometrics */
 product GNOTOMETRICS USB	0x0010	FTDI compatible adapter
 
 /* GoHubs products */
 product GOHUBS GOCOM232		0x1001	GoCOM232 Serial
 
 /* Good Way Technology products */
 product GOODWAY GWUSB2E		0x6200	GWUSB2E
 product GOODWAY RT2573		0xc019	RT2573
 
 /* Google products */
 product GOOGLE NEXUSONE		0x4e11	Nexus One
 
 /* Gravis products */
 product GRAVIS GAMEPADPRO	0x4001	GamePad Pro
 
 /* GREENHOUSE products */
 product GREENHOUSE KANA21	0x0001	CF-writer with MP3
 
 /* Griffin Technology */
 product GRIFFIN IMATE		0x0405	iMate, ADB Adapter
 
 /* Guillemot Corporation */
 product GUILLEMOT DALEADER	0xa300	DA Leader
 product GUILLEMOT HWGUSB254	0xe000	HWGUSB2-54 WLAN
 product GUILLEMOT HWGUSB254LB	0xe010	HWGUSB2-54-LB
 product GUILLEMOT HWGUSB254V2AP	0xe020	HWGUSB2-54V2-AP
 product GUILLEMOT HWNU300	0xe030	HWNU-300
 product GUILLEMOT HWNUM300	0xe031	HWNUm-300
 product GUILLEMOT HWGUN54	0xe032	HWGUn-54
 product GUILLEMOT HWNUP150	0xe033	HWNUP-150
 
 /* Hagiwara products */
 product HAGIWARA FGSM		0x0002	FlashGate SmartMedia Card Reader
 product HAGIWARA FGCF		0x0003	FlashGate CompactFlash Card Reader
 product HAGIWARA FG		0x0005	FlashGate
 
 /* HAL Corporation products */
 product HAL IMR001		0x0011	Crossam2+USB IR commander
 
 /* Handspring, Inc. */
 product HANDSPRING VISOR	0x0100	Handspring Visor
 product HANDSPRING TREO		0x0200	Handspring Treo
 product HANDSPRING TREO600	0x0300	Handspring Treo 600
 
 /* Hauppauge Computer Works */
 product HAUPPAUGE WINTV_USB_FM	0x4d12	WinTV USB FM
 product HAUPPAUGE2 NOVAT500	0x9580	NovaT 500Stick
 
 /* Hawking Technologies products */
 product HAWKING RT2870_1	0x0001	RT2870
 product HAWKING RT2870_2	0x0003	RT2870
 product HAWKING HWUN2		0x0009	HWUN2
 product HAWKING RT3070		0x000b	RT3070
 product HAWKING RTL8192CU	0x0019  RTL8192CU
 product HAWKING UF100		0x400c	10/100 USB Ethernet
 product HAWKING RTL8192SU_1	0x0015	RTL8192SU
 product HAWKING RTL8192SU_2	0x0016	RTL8192SU
 
 /* HID Global GmbH products */
 product HIDGLOBAL CM2020	0x0596	Omnikey Cardman 2020
 product HIDGLOBAL CM6020	0x1784	Omnikey Cardman 6020
 
 /* Hitachi, Ltd. products */
 product HITACHI DVDCAM_DZ_MV100A	0x0004	DVD-CAM DZ-MV100A Camcorder
 product HITACHI DVDCAM_USB	0x001e	DVDCAM USB HS Interface
 
 /* HP products */
 product HP 895C			0x0004	DeskJet 895C
 product HP 4100C		0x0101	Scanjet 4100C
 product HP S20			0x0102	Photosmart S20
 product HP 880C			0x0104	DeskJet 880C
 product HP 4200C		0x0105	ScanJet 4200C
 product HP CDWRITERPLUS		0x0107	CD-Writer Plus
 product HP KBDHUB		0x010c	Multimedia Keyboard Hub
 product HP G55XI		0x0111	OfficeJet G55xi
 product HP HN210W		0x011c	HN210W 802.11b WLAN
 product HP 49GPLUS		0x0121	49g+ graphing calculator
 product HP 6200C		0x0201	ScanJet 6200C
 product HP S20b			0x0202	PhotoSmart S20
 product HP 815C			0x0204	DeskJet 815C
 product HP 3300C		0x0205	ScanJet 3300C
 product HP CDW8200		0x0207	CD-Writer Plus 8200e
 product HP MMKEYB		0x020c	Multimedia keyboard
 product HP 1220C		0x0212	DeskJet 1220C
 product HP UN2420_QDL		0x241d	UN2420 QDL Firmware Loader
 product HP UN2420		0x251d	UN2420 WWAN/GPS Module
 product HP 810C			0x0304	DeskJet 810C/812C
 product HP 4300C		0x0305	Scanjet 4300C
 product HP CDW4E		0x0307	CD-Writer+ CD-4e
 product HP G85XI		0x0311	OfficeJet G85xi
 product HP 1200			0x0317	LaserJet 1200
 product HP 5200C		0x0401	Scanjet 5200C
 product HP 830C			0x0404	DeskJet 830C
 product HP 3400CSE		0x0405	ScanJet 3400cse
 product HP 6300C		0x0601	Scanjet 6300C
 product HP 840C			0x0604	DeskJet 840c
 product HP 2200C		0x0605	ScanJet 2200C
 product HP 5300C		0x0701	Scanjet 5300C
 product HP 4400C		0x0705	Scanjet 4400C
 product	HP 4470C		0x0805	Scanjet 4470C
 product HP 82x0C		0x0b01	Scanjet 82x0C
 product HP 2300D 		0x0b17	Laserjet 2300d
 product HP 970CSE		0x1004	Deskjet 970Cse
 product HP 5400C		0x1005	Scanjet 5400C
 product HP 2215			0x1016	iPAQ 22xx/Jornada 548
 product HP 568J			0x1116	Jornada 568
 product HP 930C			0x1204	DeskJet 930c
 product HP3 RTL8188CU		0x1629	RTL8188CU
 product HP P2000U		0x1801	Inkjet P-2000U
 product HP HS2300		0x1e1d  HS2300 HSDPA (aka MC8775)
 product HP 640C			0x2004	DeskJet 640c
 product HP 4670V		0x3005	ScanJet 4670v
 product HP P1100		0x3102	Photosmart P1100
 product HP LD220		0x3524	LD220 POS Display
 product HP OJ4215		0x3d11	OfficeJet 4215
 product HP HN210E		0x811c	Ethernet HN210E
 product HP2 C500		0x6002	PhotoSmart C500
 product HP EV2200		0x1b1d  ev2200 HSDPA (aka MC5720)
 product HP HS2300		0x1e1d  hs2300 HSDPA (aka MC8775)
 
 /* HTC products */
 product HTC WINMOBILE		0x00ce	HTC USB Sync
 product HTC PPC6700MODEM	0x00cf	PPC6700 Modem
 product HTC SMARTPHONE		0x0a51	SmartPhone USB Sync
 product HTC WIZARD		0x0bce	HTC Wizard USB Sync
 product HTC LEGENDSYNC		0x0c97	HTC Legend USB Sync
 product HTC LEGEND		0x0ff9	HTC Legend
 product HTC LEGENDINTERNET	0x0ffe	HTC Legend Internet Sharing
 
 /* HUAWEI products */
 product HUAWEI MOBILE		0x1001	Huawei Mobile
 product HUAWEI E220		0x1003	HSDPA modem
 product HUAWEI E220BIS		0x1004	HSDPA modem
 product HUAWEI E1401		0x1401	3G modem
 product HUAWEI E1402		0x1402	3G modem
 product HUAWEI E1403		0x1403	3G modem
 product HUAWEI E1404		0x1404	3G modem
 product HUAWEI E1405		0x1405	3G modem
 product HUAWEI E1406		0x1406	3G modem
 product HUAWEI E1407		0x1407	3G modem
 product HUAWEI E1408		0x1408	3G modem
 product HUAWEI E1409		0x1409	3G modem
 product HUAWEI E140A		0x140a	3G modem
 product HUAWEI E140B		0x140b	3G modem
 product HUAWEI E180V		0x140c	E180V
 product HUAWEI E140D		0x140d	3G modem
 product HUAWEI E140E		0x140e	3G modem
 product HUAWEI E140F		0x140f	3G modem
 product HUAWEI E1410		0x1410	3G modem
 product HUAWEI E1411		0x1411	3G modem
 product HUAWEI E1412		0x1412	3G modem
 product HUAWEI E1413		0x1413	3G modem
 product HUAWEI E1414		0x1414	3G modem
 product HUAWEI E1415		0x1415	3G modem
 product HUAWEI E1416		0x1416	3G modem
 product HUAWEI E1417		0x1417	3G modem
 product HUAWEI E1418		0x1418	3G modem
 product HUAWEI E1419		0x1419	3G modem
 product HUAWEI E141A		0x141a	3G modem
 product HUAWEI E141B		0x141b	3G modem
 product HUAWEI E141C		0x141c	3G modem
 product HUAWEI E141D		0x141d	3G modem
 product HUAWEI E141E		0x141e	3G modem
 product HUAWEI E141F		0x141f	3G modem
 product HUAWEI E1420		0x1420	3G modem
 product HUAWEI E1421		0x1421	3G modem
 product HUAWEI E1422		0x1422	3G modem
 product HUAWEI E1423		0x1423	3G modem
 product HUAWEI E1424		0x1424	3G modem
 product HUAWEI E1425		0x1425	3G modem
 product HUAWEI E1426		0x1426	3G modem
 product HUAWEI E1427		0x1427	3G modem
 product HUAWEI E1428		0x1428	3G modem
 product HUAWEI E1429		0x1429	3G modem
 product HUAWEI E142A		0x142a	3G modem
 product HUAWEI E142B		0x142b	3G modem
 product HUAWEI E142C		0x142c	3G modem
 product HUAWEI E142D		0x142d	3G modem
 product HUAWEI E142E		0x142e	3G modem
 product HUAWEI E142F		0x142f	3G modem
 product HUAWEI E1430		0x1430	3G modem
 product HUAWEI E1431		0x1431	3G modem
 product HUAWEI E1432		0x1432	3G modem
 product HUAWEI E1433		0x1433	3G modem
 product HUAWEI E1434		0x1434	3G modem
 product HUAWEI E1435		0x1435	3G modem
 product HUAWEI E1436		0x1436	3G modem
 product HUAWEI E1437		0x1437	3G modem
 product HUAWEI E1438		0x1438	3G modem
 product HUAWEI E1439		0x1439	3G modem
 product HUAWEI E143A		0x143a	3G modem
 product HUAWEI E143B		0x143b	3G modem
 product HUAWEI E143C		0x143c	3G modem
 product HUAWEI E143D		0x143d	3G modem
 product HUAWEI E143E		0x143e	3G modem
 product HUAWEI E143F		0x143f	3G modem
 product HUAWEI E1752		0x1446	3G modem
 product HUAWEI K4505		0x1464	3G modem
 product HUAWEI K3765		0x1465	3G modem
 product HUAWEI E1820		0x14ac	E1820 HSPA+ USB Slider
 product HUAWEI K3770		0x14c9  3G modem
 product HUAWEI K3772		0x14cf	K3772
 product HUAWEI K3770_INIT	0x14d1  K3770 Initial
 product HUAWEI E3131_INIT	0x14fe	3G modem initial
 product HUAWEI E392		0x1505	LTE modem
 product HUAWEI E3131		0x1506	3G modem
 product HUAWEI K3765_INIT	0x1520	K3765 Initial
 product HUAWEI K4505_INIT	0x1521	K4505 Initial
 product HUAWEI K3772_INIT	0x1526	K3772 Initial
 product HUAWEI E3272_INIT	0x155b	LTE modem initial
 product HUAWEI R215_INIT	0x1582	LTE modem initial
 product HUAWEI R215		0x1588	LTE modem
 product HUAWEI ETS2055		0x1803	CDMA modem
 product HUAWEI E173		0x1c05	3G modem
 product HUAWEI E173_INIT	0x1c0b	3G modem initial
 product HUAWEI E3272		0x1c1e	LTE modem
 
 /* HUAWEI 3com products */
 product HUAWEI3COM WUB320G	0x0009	Aolynk WUB320g
 
 /* IBM Corporation */
 product IBM USBCDROMDRIVE	0x4427	USB CD-ROM Drive
 
 /* Icom products */
 product ICOM SP1		0x0004	FTDI compatible adapter
 product ICOM OPC_U_UC		0x0018	FTDI compatible adapter
 product ICOM RP2C1		0x0009	FTDI compatible adapter
 product ICOM RP2C2		0x000a	FTDI compatible adapter
 product ICOM RP2D		0x000b	FTDI compatible adapter
 product ICOM RP2KVR		0x0013	FTDI compatible adapter
 product ICOM RP2KVT		0x0012	FTDI compatible adapter
 product ICOM RP2VR		0x000d	FTDI compatible adapter
 product ICOM RP2VT		0x000c	FTDI compatible adapter
 product ICOM RP4KVR		0x0011	FTDI compatible adapter
 product ICOM RP4KVT		0x0010	FTDI compatible adapter
 
 /* ID-tech products */
 product IDTECH IDT1221U		0x0300	FTDI compatible adapter
 
 /* Imagination Technologies products */
 product IMAGINATION DBX1	0x2107	DBX1 DSP core
 
 /* Initio Corporation products */
 product INITIO DUMMY		0x0000	Dummy product
 product INITIO INIC_1610P	0x1e40	USB to SATA Bridge
 
 /* Inside Out Networks products */
 product INSIDEOUT EDGEPORT4	0x0001	EdgePort/4 serial ports
 
 /* In-System products */
 product INSYSTEM F5U002		0x0002	Parallel printer
 product INSYSTEM ATAPI		0x0031	ATAPI Adapter
 product INSYSTEM ISD110		0x0200	IDE Adapter ISD110
 product INSYSTEM ISD105		0x0202	IDE Adapter ISD105
 product INSYSTEM USBCABLE	0x081a	USB cable
 product INSYSTEM STORAGE_V2	0x5701	USB Storage Adapter V2
 
 /* Intel products */
 product INTEL EASYPC_CAMERA	0x0110	Easy PC Camera
 product INTEL TESTBOARD		0x9890	82930 test board
 product INTEL2 IRMH        	0x0020	Integrated Rate Matching Hub
 product INTEL2 IRMH2        	0x0024	Integrated Rate Matching Hub
+product INTEL2 IRMH3        	0x8000	Integrated Rate Matching Hub
+product INTEL2 IRMH4        	0x8008	Integrated Rate Matching Hub
 
 /* Interbiometric products */
 product INTERBIOMETRICS IOBOARD		0x1002	FTDI compatible adapter
 product INTERBIOMETRICS MINI_IOBOARD		0x1006	FTDI compatible adapter
 
 /* Intersil products */
 product INTERSIL PRISM_GT	0x1000	PrismGT USB 2.0 WLAN
 product INTERSIL PRISM_2X	0x3642	Prism2.x or Atmel WLAN
 
 /* Interpid Control Systems products */
 product INTREPIDCS VALUECAN	0x0601	ValueCAN CAN bus interface
 product INTREPIDCS NEOVI	0x0701	NeoVI Blue vehicle bus interface
 
 /* I/O DATA products */
 product IODATA IU_CD2		0x0204	DVD Multi-plus unit iU-CD2
 product IODATA DVR_UEH8		0x0206	DVD Multi-plus unit DVR-UEH8
 product IODATA USBSSMRW		0x0314	USB-SSMRW SD-card
 product IODATA USBSDRW		0x031e	USB-SDRW SD-card
 product IODATA USBETT		0x0901	USB ETT
 product IODATA USBETTX		0x0904	USB ETTX
 product IODATA USBETTXS		0x0913	USB ETTX
 product IODATA USBWNB11A	0x0919	USB WN-B11
 product IODATA USBWNB11		0x0922	USB Airport WN-B11
 product IODATA ETGUS2		0x0930	ETG-US2
 product IODATA RT3072_1		0x0944	RT3072
 product IODATA RT3072_2		0x0945	RT3072
 product IODATA RT3072_3		0x0947	RT3072
 product IODATA RT3072_4		0x0948	RT3072
 product IODATA USBRSAQ		0x0a03	Serial USB-RSAQ1
 product IODATA USBRSAQ5		0x0a0e  Serial USB-RSAQ5
 product IODATA2 USB2SC		0x0a09	USB2.0-SCSI Bridge USB2-SC
 
 /* Iomega products */
 product IOMEGA ZIP100		0x0001	Zip 100
 product IOMEGA ZIP250		0x0030	Zip 250
 
 /* Ionic products */
 product IONICS PLUGCOMPUTER		0x0102	FTDI compatible adapter
 
 /* Integrated System Solution Corp. products */
 product ISSC ISSCBTA		0x1001	Bluetooth USB Adapter
 
 /* iTegno products */
 product ITEGNO WM1080A		0x1080	WM1080A GSM/GPRS modem
 product ITEGNO WM2080A		0x2080	WM2080A CDMA modem
 
 /* Ituner networks products */
 product ITUNERNET USBLCD2X20	0x0002	USB-LCD 2x20
 product ITUNERNET USBLCD4X20	0xc001	USB-LCD 4x20
 
 /* Jablotron products */
 product JABLOTRON PC60B		0x0001	PC-60B
 
 /* Jaton products */
 product JATON EDA		0x5704	Ethernet
 
 /* Jeti products */
 product JETI SPC1201		0x04b2	FTDI compatible adapter
 
 /* JMicron products */
 product JMICRON JM20336		0x2336	USB to SATA Bridge
 product JMICRON JM20337		0x2338	USB to ATA/ATAPI Bridge
 
 /* JVC products */
 product JVC GR_DX95		0x000a	GR-DX95
 product JVC MP_PRX1		0x3008	MP-PRX1 Ethernet
 
 /* JRC products */
 product JRC AH_J3001V_J3002V	0x0001	AirH PHONE AH-J3001V/J3002V
 
 /* Kamstrrup products */
 product KAMSTRUP OPTICALEYE	0x0001	Optical Eye/3-wire
 product KAMSTRUP MBUS_250D	0x0005	M-Bus Master MultiPort 250D
 
 /* Kawatsu products */
 product KAWATSU MH4000P		0x0003	MiniHub 4000P
 
 /* Keisokugiken Corp. products */
 product KEISOKUGIKEN USBDAQ	0x0068	HKS-0200 USBDAQ
 
 /* Kensington products */
 product KENSINGTON ORBIT	0x1003	Orbit USB/PS2 trackball
 product KENSINGTON TURBOBALL	0x1005	TurboBall
 
 /* Keyspan products */
 product KEYSPAN USA28_NF	0x0101	USA-28 serial Adapter (no firmware)
 product KEYSPAN USA28X_NF	0x0102	USA-28X serial Adapter (no firmware)
 product KEYSPAN USA19_NF	0x0103	USA-19 serial Adapter (no firmware)
 product KEYSPAN USA18_NF	0x0104	USA-18 serial Adapter (no firmware)
 product KEYSPAN USA18X_NF	0x0105	USA-18X serial Adapter (no firmware)
 product KEYSPAN USA19W_NF	0x0106	USA-19W serial Adapter (no firmware)
 product KEYSPAN USA19		0x0107	USA-19 serial Adapter
 product KEYSPAN USA19W		0x0108	USA-19W serial Adapter
 product KEYSPAN USA49W_NF	0x0109	USA-49W serial Adapter (no firmware)
 product KEYSPAN USA49W		0x010a	USA-49W serial Adapter
 product KEYSPAN USA19QI_NF	0x010b	USA-19QI serial Adapter (no firmware)
 product KEYSPAN USA19QI		0x010c	USA-19QI serial Adapter
 product KEYSPAN USA19Q_NF	0x010d	USA-19Q serial Adapter (no firmware)
 product KEYSPAN USA19Q		0x010e	USA-19Q serial Adapter
 product KEYSPAN USA28		0x010f	USA-28 serial Adapter
 product KEYSPAN USA28XXB	0x0110	USA-28X/XB serial Adapter
 product KEYSPAN USA18		0x0111	USA-18 serial Adapter
 product KEYSPAN USA18X		0x0112	USA-18X serial Adapter
 product KEYSPAN USA28XB_NF	0x0113	USA-28XB serial Adapter (no firmware)
 product KEYSPAN USA28XA_NF	0x0114	USA-28XB serial Adapter (no firmware)
 product KEYSPAN USA28XA		0x0115	USA-28XA serial Adapter
 product KEYSPAN USA18XA_NF	0x0116	USA-18XA serial Adapter (no firmware)
 product KEYSPAN USA18XA		0x0117	USA-18XA serial Adapter
 product KEYSPAN USA19QW_NF	0x0118	USA-19WQ serial Adapter (no firmware)
 product KEYSPAN USA19QW		0x0119	USA-19WQ serial Adapter
 product KEYSPAN USA19HA		0x0121	USA-19HS serial Adapter
 product KEYSPAN UIA10		0x0201	UIA-10 remote control
 product KEYSPAN UIA11		0x0202	UIA-11 remote control
 
 /* Kingston products */
 product KINGSTON XX1		0x0008	Ethernet
 product KINGSTON KNU101TX	0x000a	KNU101TX USB Ethernet
 product KINGSTON HYPERX3_0	0x162b	DT HyperX 3.0
 
 /* Kawasaki products */
 product KLSI DUH3E10BT		0x0008	USB Ethernet
 product KLSI DUH3E10BTN		0x0009	USB Ethernet
 
 /* Kobil products */
 product KOBIL CONV_B1		0x2020	FTDI compatible adapter
 product KOBIL CONV_KAAN		0x2021	FTDI compatible adapter
 
 /* Kodak products */
 product KODAK DC220		0x0100	Digital Science DC220
 product KODAK DC260		0x0110	Digital Science DC260
 product KODAK DC265		0x0111	Digital Science DC265
 product KODAK DC290		0x0112	Digital Science DC290
 product KODAK DC240		0x0120	Digital Science DC240
 product KODAK DC280		0x0130	Digital Science DC280
 
 /* Kontron AG products */
 product KONTRON DM9601		0x8101	USB Ethernet
 product KONTRON JP1082		0x9700	USB Ethernet
 
 /* Konica Corp. Products */
 product KONICA CAMERA		0x0720	Digital Color Camera
 
 /* KYE products */
 product KYE NICHE		0x0001	Niche mouse
 product KYE NETSCROLL		0x0003	Genius NetScroll mouse
 product KYE FLIGHT2000		0x1004	Flight 2000 joystick
 product KYE VIVIDPRO		0x2001	ColorPage Vivid-Pro scanner
 
 /* Kyocera products */
 product KYOCERA FINECAM_S3X	0x0100	Finecam S3x
 product KYOCERA FINECAM_S4	0x0101	Finecam S4
 product KYOCERA FINECAM_S5	0x0103	Finecam S5
 product KYOCERA FINECAM_L3	0x0105	Finecam L3
 product KYOCERA AHK3001V	0x0203	AH-K3001V
 product KYOCERA2 CDMA_MSM_K	0x17da	Qualcomm Kyocera CDMA Technologies MSM
 product KYOCERA2 KPC680		0x180a	Qualcomm Kyocera CDMA Technologies MSM
 
 /* LaCie products */
 product LACIE HD		0xa601	Hard Disk
 product LACIE CDRW		0xa602	CD R/W
 
 /* Lake Shore Cryotronics products */
 product LAKESHORE 121		0x0100	121 Current Source
 product LAKESHORE 218A		0x0200	218A Temperature Monitor
 product LAKESHORE 219		0x0201	219 Temperature Monitor
 product LAKESHORE 233		0x0202	233 Temperature Transmitter
 product LAKESHORE 235		0x0203	235 Temperature Transmitter
 product LAKESHORE 335		0x0300	335 Temperature Controller
 product LAKESHORE 336		0x0301	336 Temperature Controller
 product LAKESHORE 350		0x0302	350 Temperature Controller
 product LAKESHORE 371		0x0303	371 AC Bridge
 product LAKESHORE 411		0x0400	411 Handheld Gaussmeter
 product LAKESHORE 425		0x0401	425 Gaussmeter
 product LAKESHORE 455A		0x0402	455A DSP Gaussmeter
 product LAKESHORE 475A		0x0403	475A DSP Gaussmeter
 product LAKESHORE 465		0x0404	465 Gaussmeter
 product LAKESHORE 625A		0x0600	625A Magnet PSU
 product LAKESHORE 642A		0x0601	642A Magnet PSU
 product LAKESHORE 648		0x0602	648 Magnet PSU
 product LAKESHORE 737		0x0700	737 VSM Controller
 product LAKESHORE 776		0x0701	776 Matrix Switch
 
 /* Larsen and Brusgaard products */
 product LARSENBRUSGAARD ALTITRACK	0x0001	FTDI compatible adapter
 
 /* Leadtek products */
 product LEADTEK 9531		0x2101	9531 GPS
 
 /* Lenovo products */
 product LENOVO ETHERNET		0x7203	USB 2.0 Ethernet
 
 /* Lexar products */
 product LEXAR JUMPSHOT		0x0001	jumpSHOT CompactFlash Reader
 product LEXAR CF_READER		0xb002	USB CF Reader
 product LEXAR JUMPDRIVE		0xa833	USB Jumpdrive Flash Drive
 
 /* Lexmark products */
 product LEXMARK S2450		0x0009	Optra S 2450
 
 /* Liebert products */
 product LIEBERT POWERSURE_PXT	0xffff	PowerSure Personal XT
 product LIEBERT2 PSI1000	0x0004	UPS PSI 1000 FW:08
 
 /* Link Instruments Inc. products */
 product	LINKINSTRUMENTS MSO19	0xf190	Link Instruments MSO-19
 product	LINKINSTRUMENTS MSO28	0xf280	Link Instruments MSO-28
 product	LINKINSTRUMENTS MSO28_2	0xf281	Link Instruments MSO-28
 
 /* Linksys products */
 product LINKSYS MAUSB2		0x0105	Camedia MAUSB-2
 product LINKSYS USB10TX1	0x200c	USB10TX
 product LINKSYS USB10T		0x2202	USB10T Ethernet
 product LINKSYS USB100TX	0x2203	USB100TX Ethernet
 product LINKSYS USB100H1	0x2204	USB100H1 Ethernet/HPNA
 product LINKSYS USB10TA		0x2206	USB10TA Ethernet
 product LINKSYS USB10TX2	0x400b	USB10TX
 product LINKSYS2 WUSB11		0x2219	WUSB11 Wireless Adapter
 product LINKSYS2 USB200M	0x2226	USB 2.0 10/100 Ethernet
 product LINKSYS3 WUSB11v28	0x2233	WUSB11 v2.8 Wireless Adapter
 product LINKSYS4 USB1000	0x0039	USB1000
 product LINKSYS4 WUSB100	0x0070	WUSB100
 product LINKSYS4 WUSB600N	0x0071	WUSB600N
 product LINKSYS4 WUSB54GCV2	0x0073	WUSB54GC v2
 product LINKSYS4 WUSB54GCV3	0x0077	WUSB54GC v3
 product LINKSYS4 RT3070		0x0078	RT3070
 product LINKSYS4 WUSB600NV2	0x0079	WUSB600N v2
 
 /* Logilink products */
 product LOGILINK DUMMY		0x0000	Dummy product
 product LOGILINK U2M		0x0101	LogiLink USB MIDI Cable
 
 /* Logitech products */
 product LOGITECH M2452		0x0203	M2452 keyboard
 product LOGITECH M4848		0x0301	M4848 mouse
 product LOGITECH PAGESCAN	0x040f	PageScan
 product LOGITECH QUICKCAMWEB	0x0801	QuickCam Web
 product LOGITECH QUICKCAMPRO	0x0810	QuickCam Pro
 product LOGITECH WEBCAMC100	0X0817	Webcam C100
 product LOGITECH QUICKCAMEXP	0x0840	QuickCam Express
 product LOGITECH QUICKCAM	0x0850	QuickCam
 product LOGITECH QUICKCAMPRO3	0x0990	QuickCam Pro 9000
 product LOGITECH N43		0xc000	N43
 product LOGITECH N48		0xc001	N48 mouse
 product LOGITECH MBA47		0xc002	M-BA47 mouse
 product LOGITECH WMMOUSE	0xc004	WingMan Gaming Mouse
 product LOGITECH BD58		0xc00c	BD58 mouse
 product LOGITECH UN58A		0xc030	iFeel Mouse
 product LOGITECH UN53B		0xc032	iFeel MouseMan
 product LOGITECH WMPAD		0xc208	WingMan GamePad Extreme
 product LOGITECH WMRPAD		0xc20a	WingMan RumblePad
 product LOGITECH WMJOY		0xc281	WingMan Force joystick
 product LOGITECH BB13		0xc401	USB-PS/2 Trackball
 product LOGITECH RK53		0xc501	Cordless mouse
 product LOGITECH RB6		0xc503	Cordless keyboard
 product LOGITECH MX700		0xc506	Cordless optical mouse
 product LOGITECH QUICKCAMPRO2	0xd001	QuickCam Pro
 
 /* Logitec Corp. products */
 product LOGITEC LDR_H443SU2	0x0033	DVD Multi-plus unit LDR-H443SU2
 product LOGITEC LDR_H443U2	0x00b3	DVD Multi-plus unit LDR-H443U2
 product LOGITEC LAN_GTJU2A	0x0160	LAN-GTJ/U2A Ethernet
 product LOGITEC RT2870_1	0x0162	RT2870
 product LOGITEC RT2870_2	0x0163	RT2870
 product LOGITEC RT2870_3	0x0164	RT2870
 product LOGITEC LANW300NU2	0x0166  LAN-W300N/U2
 product LOGITEC LANW150NU2	0x0168  LAN-W150N/U2
 product LOGITEC LANW300NU2S	0x0169	LAN-W300N/U2S
 
 /* Longcheer Holdings, Ltd. products */
 product LONGCHEER WM66		0x6061	Longcheer WM66 HSDPA
 product LONGCHEER W14		0x9603	Mobilcom W14
 product LONGCHEER DISK		0xf000	Driver disk
 product LONGCHEER XSSTICK	0x9605	4G Systems XSStick P14
 
 
 /* Lucent products */
 product LUCENT EVALKIT		0x1001	USS-720 evaluation kit
 
 /* Luwen products */
 product LUWEN EASYDISK		0x0005	EasyDisc
 
 /* Macally products */
 product MACALLY MOUSE1		0x0101	mouse
 
 /* Mag-Tek products */
 product MAGTEK USBSWIPE		0x0002	USB Mag Stripe Swipe Reader
 
 /* Marvell Technology Group, Ltd. products */
 product MARVELL SHEEVAPLUG	0x9e8f	SheevaPlug serial interface
 
 /* Matrix Orbital products */
 product MATRIXORBITAL FTDI_RANGE_0100		0x0100	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0101		0x0101	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0102		0x0102	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0103		0x0103	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0104		0x0104	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0105		0x0105	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0106		0x0106	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0107		0x0107	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0108		0x0108	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0109		0x0109	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_010A		0x010a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_010B		0x010b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_010C		0x010c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_010D		0x010d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_010E		0x010e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_010F		0x010f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0110		0x0110	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0111		0x0111	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0112		0x0112	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0113		0x0113	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0114		0x0114	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0115		0x0115	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0116		0x0116	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0117		0x0117	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0118		0x0118	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0119		0x0119	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_011A		0x011a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_011B		0x011b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_011C		0x011c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_011D		0x011d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_011E		0x011e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_011F		0x011f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0120		0x0120	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0121		0x0121	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0122		0x0122	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0123		0x0123	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0124		0x0124	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0125		0x0125	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0126		0x0126	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0128		0x0128	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0129		0x0129	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_012A		0x012a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_012B		0x012b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_012D		0x012d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_012E		0x012e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_012F		0x012f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0130		0x0130	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0131		0x0131	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0132		0x0132	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0133		0x0133	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0134		0x0134	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0135		0x0135	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0136		0x0136	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0137		0x0137	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0138		0x0138	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0139		0x0139	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_013A		0x013a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_013B		0x013b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_013C		0x013c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_013D		0x013d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_013E		0x013e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_013F		0x013f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0140		0x0140	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0141		0x0141	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0142		0x0142	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0143		0x0143	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0144		0x0144	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0145		0x0145	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0146		0x0146	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0147		0x0147	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0148		0x0148	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0149		0x0149	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_014A		0x014a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_014B		0x014b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_014C		0x014c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_014D		0x014d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_014E		0x014e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_014F		0x014f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0150		0x0150	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0151		0x0151	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0152		0x0152	FTDI compatible adapter
 product MATRIXORBITAL MOUA	0x0153	Martrix Orbital MOU-Axxxx LCD displays
 product MATRIXORBITAL FTDI_RANGE_0159		0x0159	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_015A		0x015a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_015B		0x015b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_015C		0x015c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_015D		0x015d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_015E		0x015e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_015F		0x015f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0160		0x0160	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0161		0x0161	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0162		0x0162	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0163		0x0163	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0164		0x0164	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0165		0x0165	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0166		0x0166	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0167		0x0167	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0168		0x0168	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0169		0x0169	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_016A		0x016a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_016B		0x016b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_016C		0x016c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_016D		0x016d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_016E		0x016e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_016F		0x016f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0170		0x0170	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0171		0x0171	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0172		0x0172	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0173		0x0173	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0174		0x0174	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0175		0x0175	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0176		0x0176	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0177		0x0177	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0178		0x0178	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0179		0x0179	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_017A		0x017a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_017B		0x017b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_017C		0x017c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_017D		0x017d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_017E		0x017e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_017F		0x017f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0180		0x0180	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0181		0x0181	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0182		0x0182	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0183		0x0183	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0184		0x0184	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0185		0x0185	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0186		0x0186	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0187		0x0187	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0188		0x0188	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0189		0x0189	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_018A		0x018a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_018B		0x018b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_018C		0x018c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_018D		0x018d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_018E		0x018e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_018F		0x018f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0190		0x0190	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0191		0x0191	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0192		0x0192	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0193		0x0193	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0194		0x0194	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0195		0x0195	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0196		0x0196	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0197		0x0197	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0198		0x0198	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_0199		0x0199	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_019A		0x019a	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_019B		0x019b	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_019C		0x019c	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_019D		0x019d	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_019E		0x019e	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_019F		0x019f	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A0		0x01a0	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A1		0x01a1	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A2		0x01a2	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A3		0x01a3	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A4		0x01a4	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A5		0x01a5	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A6		0x01a6	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A7		0x01a7	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A8		0x01a8	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01A9		0x01a9	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01AA		0x01aa	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01AB		0x01ab	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01AC		0x01ac	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01AD		0x01ad	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01AE		0x01ae	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01AF		0x01af	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B0		0x01b0	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B1		0x01b1	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B2		0x01b2	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B3		0x01b3	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B4		0x01b4	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B5		0x01b5	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B6		0x01b6	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B7		0x01b7	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B8		0x01b8	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01B9		0x01b9	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01BA		0x01ba	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01BB		0x01bb	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01BC		0x01bc	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01BD		0x01bd	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01BE		0x01be	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01BF		0x01bf	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C0		0x01c0	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C1		0x01c1	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C2		0x01c2	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C3		0x01c3	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C4		0x01c4	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C5		0x01c5	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C6		0x01c6	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C7		0x01c7	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C8		0x01c8	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01C9		0x01c9	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01CA		0x01ca	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01CB		0x01cb	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01CC		0x01cc	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01CD		0x01cd	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01CE		0x01ce	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01CF		0x01cf	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D0		0x01d0	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D1		0x01d1	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D2		0x01d2	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D3		0x01d3	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D4		0x01d4	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D5		0x01d5	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D6		0x01d6	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D7		0x01d7	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D8		0x01d8	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01D9		0x01d9	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01DA		0x01da	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01DB		0x01db	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01DC		0x01dc	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01DD		0x01dd	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01DE		0x01de	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01DF		0x01df	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E0		0x01e0	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E1		0x01e1	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E2		0x01e2	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E3		0x01e3	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E4		0x01e4	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E5		0x01e5	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E6		0x01e6	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E7		0x01e7	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E8		0x01e8	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01E9		0x01e9	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01EA		0x01ea	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01EB		0x01eb	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01EC		0x01ec	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01ED		0x01ed	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01EE		0x01ee	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01EF		0x01ef	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F0		0x01f0	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F1		0x01f1	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F2		0x01f2	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F3		0x01f3	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F4		0x01f4	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F5		0x01f5	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F6		0x01f6	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F7		0x01f7	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F8		0x01f8	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01F9		0x01f9	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01FA		0x01fa	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01FB		0x01fb	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01FC		0x01fc	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01FD		0x01fd	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01FE		0x01fe	FTDI compatible adapter
 product MATRIXORBITAL FTDI_RANGE_01FF		0x01ff	FTDI compatible adapter
 
 /* MCT Corp. */
 product MCT HUB0100		0x0100	Hub
 product MCT DU_H3SP_USB232	0x0200	D-Link DU-H3SP USB BAY Hub
 product MCT USB232		0x0210	USB-232 Interface
 product MCT SITECOM_USB232	0x0230	Sitecom USB-232 Products
 
 /* Medeli */
 product MEDELI DD305		0x5011	DD305 Digital Drum Set
 
 /* MediaTek, Inc. */
 product MEDIATEK MTK3329	0x3329	MTK II GPS Receiver
 
 /* Meizu Electronics */
 product MEIZU M6_SL		0x0140	MiniPlayer M6 (SL)
 
 /* Melco, Inc products */
 product MELCO LUATX1		0x0001	LUA-TX Ethernet
 product MELCO LUATX5		0x0005	LUA-TX Ethernet
 product MELCO LUA2TX5		0x0009	LUA2-TX Ethernet
 product MELCO LUAKTX		0x0012	LUA-KTX Ethernet
 product MELCO DUBPXXG		0x001c	DUB-PxxG
 product MELCO LUAU2KTX		0x003d	LUA-U2-KTX Ethernet
 product MELCO KG54YB		0x005e	WLI-U2-KG54-YB WLAN
 product MELCO KG54		0x0066	WLI-U2-KG54 WLAN
 product MELCO KG54AI		0x0067	WLI-U2-KG54-AI WLAN
 product MELCO LUA3U2AGT		0x006e	LUA3-U2-AGT
 product MELCO NINWIFI		0x008b	Nintendo Wi-Fi
 product MELCO PCOPRS1		0x00b3	PC-OP-RS1 RemoteStation
 product MELCO SG54HP		0x00d8	WLI-U2-SG54HP
 product MELCO G54HP		0x00d9	WLI-U2-G54HP
 product MELCO KG54L		0x00da	WLI-U2-KG54L
 product MELCO WLIUCG300N	0x00e8	WLI-UC-G300N
 product MELCO SG54HG		0x00f4	WLI-U2-SG54HG
 product MELCO WLRUCG		0x0116	WLR-UC-G
 product MELCO WLRUCGAOSS	0x0119	WLR-UC-G-AOSS
 product MELCO WLIUCAG300N	0x012e	WLI-UC-AG300N
 product MELCO WLIUCG		0x0137	WLI-UC-G
 product MELCO RT2870_1		0x0148	RT2870
 product MELCO RT2870_2		0x0150	RT2870
 product MELCO WLIUCGN		0x015d	WLI-UC-GN
 product MELCO WLIUCG301N	0x016f	WLI-UC-G301N
 product MELCO WLIUCGNM		0x01a2	WLI-UC-GNM
 product MELCO WLIUCGNM2		0x01ee	WLI-UC-GNM2
 
 /* Merlin products */
 product MERLIN V620             0x1110  Merlin V620
 
 /* MetaGeek products */
 product METAGEEK TELLSTICK	0x0c30	FTDI compatible adapter
 product METAGEEK WISPY1B	0x083e	MetaGeek Wi-Spy
 product METAGEEK WISPY24X	0x083f	MetaGeek Wi-Spy 2.4x
 product METAGEEK2 WISPYDBX	0x5000	MetaGeek Wi-Spy DBx
 
 /* Metricom products */
 product METRICOM RICOCHET_GS	0x0001	Ricochet GS
 
 /* MGE UPS Systems */
 product MGE UPS1		0x0001	MGE UPS SYSTEMS PROTECTIONCENTER 1
 product MGE UPS2		0xffff	MGE UPS SYSTEMS PROTECTIONCENTER 2
 
 /* MEI products */
 product MEI CASHFLOW_SC		0x1100	Cashflow-SC Cash Acceptor
 product MEI S2000		0x1101	Series 2000 Combo Acceptor
 
 /* Micro Star International products */
 product MSI BT_DONGLE		0x1967	Bluetooth USB dongle
 product MSI RT3070_1		0x3820	RT3070
 product MSI RT3070_2		0x3821	RT3070
 product MSI RT3070_8		0x3822	RT3070
 product MSI RT3070_3		0x3870	RT3070
 product MSI RT3070_9		0x3871	RT3070
 product MSI UB11B		0x6823	UB11B
 product MSI RT2570		0x6861	RT2570
 product MSI RT2570_2		0x6865	RT2570
 product MSI RT2570_3		0x6869	RT2570
 product MSI RT2573_1		0x6874	RT2573
 product MSI RT2573_2		0x6877	RT2573
 product MSI RT3070_4		0x6899	RT3070
 product MSI RT3070_5		0x821a	RT3070
 product MSI RT3070_10		0x822a	RT3070
 product MSI RT3070_6		0x870a	RT3070
 product MSI RT3070_11		0x871a	RT3070
 product MSI RT3070_7		0x899a	RT3070
 product MSI RT2573_3		0xa861	RT2573
 product MSI RT2573_4		0xa874	RT2573
 
 /* Micron products */
 product MICRON REALSSD		0x0655	Real SSD eUSB
 
 /* Microsoft products */
 product MICROSOFT SIDEPREC	0x0008	SideWinder Precision Pro
 product MICROSOFT INTELLIMOUSE	0x0009	IntelliMouse
 product MICROSOFT NATURALKBD	0x000b	Natural Keyboard Elite
 product MICROSOFT DDS80		0x0014	Digital Sound System 80
 product MICROSOFT SIDEWINDER	0x001a	Sidewinder Precision Racing Wheel
 product MICROSOFT INETPRO	0x001c	Internet Keyboard Pro
 product MICROSOFT TBEXPLORER	0x0024	Trackball Explorer
 product MICROSOFT INTELLIEYE	0x0025	IntelliEye mouse
 product MICROSOFT INETPRO2	0x002b	Internet Keyboard Pro
 product MICROSOFT INTELLIMOUSE5	0x0039	IntelliMouse 1.1 5-Button Mouse
 product MICROSOFT WHEELMOUSE	0x0040	Wheel Mouse Optical
 product MICROSOFT MN510		0x006e	MN510 Wireless
 product MICROSOFT 700WX		0x0079	Palm 700WX
 product MICROSOFT MN110		0x007a	10/100 USB NIC
 product MICROSOFT WLINTELLIMOUSE 0x008c	Wireless Optical IntelliMouse
 product MICROSOFT WLNOTEBOOK	0x00b9	Wireless Optical Mouse (Model 1023)
 product MICROSOFT COMFORT3000	0x00d1	Comfort Optical Mouse 3000 (Model 1043)
 product MICROSOFT WLNOTEBOOK3	0x00d2	Wireless Optical Mouse 3000 (Model 1049)
 product MICROSOFT NATURAL4000	0x00db	Natural Ergonomic Keyboard 4000
 product MICROSOFT WLNOTEBOOK2	0x00e1	Wireless Optical Mouse 3000 (Model 1056)
 product MICROSOFT XBOX360	0x0292	XBOX 360 WLAN
 
 /* Microtech products */
 product MICROTECH SCSIDB25	0x0004	USB-SCSI-DB25
 product MICROTECH SCSIHD50	0x0005	USB-SCSI-HD50
 product MICROTECH DPCM		0x0006	USB CameraMate
 product MICROTECH FREECOM	0xfc01	Freecom USB-IDE
 
 /* Microtek products */
 product MICROTEK 336CX		0x0094	Phantom 336CX - C3 scanner
 product MICROTEK X6U		0x0099	ScanMaker X6 - X6U
 product MICROTEK C6		0x009a	Phantom C6 scanner
 product MICROTEK 336CX2		0x00a0	Phantom 336CX - C3 scanner
 product MICROTEK V6USL		0x00a3	ScanMaker V6USL
 product MICROTEK V6USL2		0x80a3	ScanMaker V6USL
 product MICROTEK V6UL		0x80ac	ScanMaker V6UL
 
 /* Microtune, Inc. products */
 product MICROTUNE BT_DONGLE	0x1000	Bluetooth USB dongle
 
 /* Midiman products */
 product MAUDIO MIDISPORT2X2	0x1001	Midisport 2x2
 product MAUDIO FASTTRACKULTRA	0x2080	Fast Track Ultra
 product MAUDIO FASTTRACKULTRA8R	0x2081	Fast Track Ultra 8R
 
 /* MindsAtWork products */
 product MINDSATWORK WALLET	0x0001	Digital Wallet
 
 /* Minolta Co., Ltd. */
 product MINOLTA 2300		0x4001	Dimage 2300
 product MINOLTA S304		0x4007	Dimage S304
 product MINOLTA X		0x4009	Dimage X
 product MINOLTA 5400		0x400e	Dimage 5400
 product MINOLTA F300		0x4011	Dimage F300
 product MINOLTA E223		0x4017	Dimage E223
 
 /* Mitsumi products */
 product MITSUMI CDRRW		0x0000	CD-R/RW Drive
 product MITSUMI BT_DONGLE	0x641f	Bluetooth USB dongle
 product MITSUMI FDD		0x6901	USB FDD
 
 /* Mobile Action products */
 product MOBILEACTION MA620	0x0620	MA-620 Infrared Adapter
 
 /* Mobility products */
 product MOBILITY USB_SERIAL	0x0202	FTDI compatible adapter
 product MOBILITY EA		0x0204	Ethernet
 product MOBILITY EASIDOCK	0x0304	EasiDock Ethernet
 
 /* MosChip products */
 product MOSCHIP MCS7703		0x7703	MCS7703 Serial Port Adapter
 product MOSCHIP MCS7730		0x7730  MCS7730 Ethernet
 product MOSCHIP MCS7820		0x7820	MCS7820 Serial Port Adapter
 product MOSCHIP MCS7830		0x7830	MCS7830 Ethernet
 product MOSCHIP MCS7832		0x7832	MCS7832 Ethernet
 product MOSCHIP MCS7840		0x7840	MCS7840 Serial Port Adapter
 
 /* Motorola products */
 product MOTOROLA MC141555	0x1555	MC141555 hub controller
 product MOTOROLA SB4100		0x4100	SB4100 USB Cable Modem
 product MOTOROLA2 T720C		0x2822	T720c
 product MOTOROLA2 A41XV32X	0x2a22	A41x/V32x Mobile Phones
 product MOTOROLA2 E398		0x4810	E398 Mobile Phone
 product MOTOROLA2 USBLAN	0x600c	USBLAN
 product MOTOROLA2 USBLAN2	0x6027	USBLAN
 product MOTOROLA2 MB886		0x710f	MB886 Mobile Phone (Atria HD)
 product MOTOROLA4 RT2770	0x9031	RT2770
 product MOTOROLA4 RT3070	0x9032	RT3070
 
 /* MpMan products */
 product MPMAN MPF400_2		0x25a8	MPF400 Music Player 2Go
 product MPMAN MPF400_1		0x36d0	MPF400 Music Player 1Go
 
 /* MultiTech products */
 product MULTITECH ATLAS		0xf101	MT5634ZBA-USB modem
 
 /* Mustek products */
 product MUSTEK 1200CU		0x0001	1200 CU scanner
 product MUSTEK 600CU		0x0002	600 CU scanner
 product MUSTEK 1200USB		0x0003	1200 USB scanner
 product MUSTEK 1200UB		0x0006	1200 UB scanner
 product MUSTEK 1200USBPLUS	0x0007	1200 USB Plus scanner
 product MUSTEK 1200CUPLUS	0x0008	1200 CU Plus scanner
 product MUSTEK BEARPAW1200F	0x0010	BearPaw 1200F scanner
 product MUSTEK BEARPAW2400TA	0x0218	BearPaw 2400TA scanner
 product MUSTEK BEARPAW1200TA	0x021e	BearPaw 1200TA scanner
 product MUSTEK 600USB		0x0873	600 USB scanner
 product MUSTEK MDC800		0xa800	MDC-800 digital camera
 
 /* M-Systems products */
 product MSYSTEMS DISKONKEY	0x0010	DiskOnKey
 product MSYSTEMS DISKONKEY2	0x0011	DiskOnKey
 
 /* Myson products */
 product MYSON HEDEN_8813	0x8813	USB-IDE
 product MYSON HEDEN		0x8818	USB-IDE
 product MYSON HUBREADER		0x8819	COMBO Card reader with USB HUB
 product MYSON STARREADER	0x9920	USB flash card adapter
 
 /* National Semiconductor */
 product NATIONAL BEARPAW1200	0x1000	BearPaw 1200
 product NATIONAL BEARPAW2400	0x1001	BearPaw 2400
 
 /* NEC products */
 product NEC HUB_0050		0x0050	USB 2.0 7-Port Hub
 product NEC HUB_005A		0x005a	USB 2.0 4-Port Hub
 product NEC HUB			0x55aa	hub
 product NEC HUB_B		0x55ab	hub
 
 /* NEODIO products */
 product NEODIO ND3260		0x3260	8-in-1 Multi-format Flash Controller
 product NEODIO ND5010		0x5010	Multi-format Flash Controller
 
 /* Neotel products */
 product NEOTEL PRIME		0x4000	Prime USB modem
 
 /* Netac products */
 product NETAC CF_CARD		0x1060	USB-CF-Card
 product NETAC ONLYDISK		0x0003	OnlyDisk
 
 /* NetChip Technology Products */
 product NETCHIP TURBOCONNECT	0x1080	Turbo-Connect
 product NETCHIP CLIK_40		0xa140	USB Clik! 40
 product NETCHIP GADGETZERO	0xa4a0	Linux Gadget Zero
 product NETCHIP ETHERNETGADGET	0xa4a2	Linux Ethernet/RNDIS gadget on pxa210/25x/26x
 product NETCHIP POCKETBOOK	0xa4a5	PocketBook
 
 /* Netgear products */
 product NETGEAR EA101		0x1001	Ethernet
 product NETGEAR EA101X		0x1002	Ethernet
 product NETGEAR FA101		0x1020	Ethernet 10/100, USB1.1
 product NETGEAR FA120		0x1040	USB 2.0 Ethernet
 product NETGEAR M4100		0x1100	M4100/M5300/M7100 series switch
 product NETGEAR WG111V1_2	0x4240	PrismGT USB 2.0 WLAN
 product NETGEAR WG111V3		0x4260	WG111v3
 product NETGEAR WG111U		0x4300	WG111U
 product NETGEAR WG111U_NF	0x4301	WG111U (no firmware)
 product NETGEAR WG111V2		0x6a00	WG111V2
 product NETGEAR RTL8192CU	0x9021	RTL8192CU
 product NETGEAR WNA1000M	0x9041	WNA1000M
 product NETGEAR2 MA101		0x4100	MA101
 product NETGEAR2 MA101B		0x4102	MA101 Rev B
 product NETGEAR3 WG111T		0x4250	WG111T
 product NETGEAR3 WG111T_NF	0x4251	WG111T (no firmware)
 product NETGEAR3 WPN111		0x5f00	WPN111
 product NETGEAR3 WPN111_NF	0x5f01	WPN111 (no firmware)
 product NETGEAR3 WPN111_2	0x5f02	WPN111
 product NETGEAR4 RTL8188CU	0x9041	RTL8188CU
 
 /* NetIndex products */
 product NETINDEX WS002IN	0x2001	Willcom WS002IN
 
 /* NEWlink */
 product NEWLINK USB2IDEBRIDGE	0x00ff	USB 2.0 Hard Drive Enclosure
 
 /* Nikon products */
 product NIKON E990		0x0102	Digital Camera E990
 product NIKON LS40		0x4000	CoolScan LS40 ED
 product NIKON D300		0x041a  Digital Camera D300
 
 /* NovaTech Products */
 product NOVATECH NV902		0x9020	NovaTech NV-902W
 product NOVATECH RT2573		0x9021	RT2573
 product NOVATECH RTL8188CU	0x9071	RTL8188CU
 
 /* Nokia products */
 product NOKIA N958GB		0x0070	Nokia N95 8GBc
 product NOKIA2 CA42		0x1234	CA-42 cable
 
 /* Novatel Wireless products */
 product NOVATEL V640		0x1100	Merlin V620
 product NOVATEL CDMA_MODEM	0x1110	Novatel Wireless Merlin CDMA
 product NOVATEL V620		0x1110	Merlin V620
 product NOVATEL V740		0x1120	Merlin V740
 product NOVATEL V720		0x1130	Merlin V720
 product NOVATEL U740		0x1400	Merlin U740
 product NOVATEL U740_2		0x1410	Merlin U740
 product NOVATEL U870		0x1420	Merlin U870
 product NOVATEL XU870		0x1430	Merlin XU870
 product NOVATEL X950D		0x1450	Merlin X950D
 product NOVATEL ES620		0x2100	Expedite ES620
 product NOVATEL E725		0x2120	Expedite E725
 product NOVATEL ES620_2		0x2130	Expedite ES620
 product NOVATEL ES620		0x2100	ES620 CDMA
 product NOVATEL U720		0x2110	Merlin U720
 product NOVATEL EU730		0x2400	Expedite EU730
 product NOVATEL EU740		0x2410	Expedite EU740
 product NOVATEL EU870D		0x2420	Expedite EU870D
 product NOVATEL U727		0x4100	Merlin U727 CDMA
 product NOVATEL MC950D		0x4400	Novatel MC950D HSUPA
 product NOVATEL MC990D		0x7001	Novatel MC990D
 product NOVATEL ZEROCD		0x5010	Novatel ZeroCD
 product NOVATEL MIFI2200V	0x5020	Novatel MiFi 2200 CDMA Virgin Mobile
 product NOVATEL ZEROCD2		0x5030	Novatel ZeroCD
 product NOVATEL MIFI2200	0x5041	Novatel MiFi 2200 CDMA
 product NOVATEL U727_2		0x5100	Merlin U727 CDMA
 product NOVATEL U760		0x6000	Novatel U760
 product NOVATEL MC760		0x6002	Novatel MC760
 product NOVATEL MC547		0x7042	Novatel MC547
 product NOVATEL MC679		0x7031	Novatel MC679
 product NOVATEL2 FLEXPACKGPS	0x0100	NovAtel FlexPack GPS receiver
 
 /* Merlin products */
 product	MERLIN V620		0x1110	Merlin V620
 
 /* O2Micro products */
 product O2MICRO OZ776_HUB	0x7761	OZ776 hub
 product O2MICRO OZ776_CCID_SC	0x7772	OZ776 CCID SC Reader
 
 /* Olimex products */
 product OLIMEX ARM_USB_OCD		0x0003	FTDI compatible adapter
 product OLIMEX ARM_USB_OCD_H		0x002b	FTDI compatible adapter
 
 /* Olympus products */
 product OLYMPUS C1		0x0102	C-1 Digital Camera
 product OLYMPUS C700		0x0105	C-700 Ultra Zoom
 
 /* OmniVision Technologies, Inc. products */
 product OMNIVISION OV511	0x0511	OV511 Camera
 product OMNIVISION OV511PLUS	0xa511	OV511+ Camera
 
 /* OnSpec Electronic, Inc. */
 product ONSPEC SDS_HOTFIND_D	0x0400	SDS-infrared.com Hotfind-D Infrared Camera
 product ONSPEC MDCFE_B_CF_READER	0xa000	MDCFE-B USB CF Reader
 product ONSPEC CFMS_RW		0xa001	SIIG/Datafab Memory Stick+CF Reader/Writer
 product ONSPEC READER		0xa003	Datafab-based Reader
 product ONSPEC CFSM_READER	0xa005	PNY/Datafab CF+SM Reader
 product ONSPEC CFSM_READER2	0xa006	Simple Tech/Datafab CF+SM Reader
 product ONSPEC MDSM_B_READER	0xa103	MDSM-B reader
 product ONSPEC CFSM_COMBO	0xa109	USB to CF + SM Combo (LC1)
 product ONSPEC UCF100		0xa400	FlashLink UCF-100 CompactFlash Reader
 product ONSPEC2 IMAGEMATE_SDDR55	0xa103	ImageMate SDDR55
 
 /* Option products */
 product OPTION VODAFONEMC3G	0x5000	Vodafone Mobile Connect 3G datacard
 product OPTION GT3G		0x6000	GlobeTrotter 3G datacard
 product OPTION GT3GQUAD		0x6300	GlobeTrotter 3G QUAD datacard
 product OPTION GT3GPLUS		0x6600	GlobeTrotter 3G+ datacard
 product OPTION GTICON322	0xd033	GlobeTrotter Icon322 storage
 product OPTION GTMAX36		0x6701	GlobeTrotter Max 3.6 Modem
 product OPTION GTMAX72		0x6711	GlobeTrotter Max 7.2 HSDPA
 product OPTION GTHSDPA		0x6971	GlobeTrotter HSDPA
 product OPTION GTMAXHSUPA	0x7001	GlobeTrotter HSUPA
 product OPTION GTMAXHSUPAE	0x6901	GlobeTrotter HSUPA PCIe
 product OPTION GTMAX380HSUPAE	0x7211	GlobeTrotter 380HSUPA PCIe
 product OPTION GT3G_1		0x6050	3G modem
 product OPTION GT3G_2		0x6100	3G modem
 product OPTION GT3G_3		0x6150	3G modem
 product OPTION GT3G_4		0x6200	3G modem
 product OPTION GT3G_5		0x6250	3G modem
 product OPTION GT3G_6		0x6350	3G modem
 product OPTION E6500		0x6500	3G modem
 product OPTION E6501		0x6501	3G modem
 product OPTION E6601		0x6601	3G modem
 product OPTION E6721		0x6721	3G modem
 product OPTION E6741		0x6741	3G modem
 product OPTION E6761		0x6761	3G modem
 product OPTION E6800		0x6800	3G modem
 product OPTION E7021		0x7021	3G modem
 product OPTION E7041		0x7041	3G modem
 product OPTION E7061		0x7061	3G modem
 product OPTION E7100		0x7100	3G modem
 product OPTION GTM380		0x7201	3G modem
 product OPTION GE40X		0x7601	Globetrotter HSUPA
 product OPTION GSICON72		0x6911	GlobeSurfer iCON
 product OPTION GSICONHSUPA	0x7251	Globetrotter HSUPA
 product OPTION ICON401		0x7401	GlobeSurfer iCON 401
 product OPTION GTHSUPA		0x7011	Globetrotter HSUPA
 product OPTION GMT382		0x7501	Globetrotter HSUPA
 product OPTION GE40X_1		0x7301	Globetrotter HSUPA
 product OPTION GE40X_2		0x7361	Globetrotter HSUPA
 product OPTION GE40X_3		0x7381	Globetrotter HSUPA
 product OPTION GTM661W		0x9000  GTM661W
 product OPTION ICONEDGE		0xc031	GlobeSurfer iCON EDGE
 product OPTION MODHSXPA		0xd013	Globetrotter HSUPA
 product OPTION ICON321		0xd031	Globetrotter HSUPA
 product OPTION ICON505		0xd055	Globetrotter iCON 505
 product OPTION ICON452		0x7901	Globetrotter iCON 452
 
 /* Optoelectronics Co., Ltd */
 product OPTO BARCODE		0x0001	Barcode Reader
 product OPTO OPTICONCODE	0x0009	Opticon Code Reader
 product OPTO BARCODE_1		0xa002	Barcode Reader
 product OPTO CRD7734		0xc000	USB Cradle CRD-7734-RU
 product OPTO CRD7734_1		0xc001	USB Cradle CRD-7734-RU
 
 /* OvisLink product */
 product OVISLINK RT3072		0x3072	RT3072
 
 /* OQO */
 product OQO WIFI01		0x0002	model 01 WiFi interface
 product OQO BT01		0x0003	model 01 Bluetooth interface
 product OQO ETHER01PLUS		0x7720	model 01+ Ethernet
 product OQO ETHER01		0x8150	model 01 Ethernet interface
 
 /* Ours Technology Inc. */
 product OTI DKU5		0x6858	DKU-5 Serial
 
 /* Owen.ru products */
 product OWEN AC4		0x0004	AC4 USB-RS485 converter
 
 /* OWL producs */
 product OWL CM_160		0xca05	OWL CM-160 power monitor
 
 /* Palm Computing, Inc. product */
 product PALM SERIAL		0x0080	USB Serial
 product PALM M500		0x0001	Palm m500
 product PALM M505		0x0002	Palm m505
 product PALM M515		0x0003	Palm m515
 product PALM I705		0x0020	Palm i705
 product PALM TUNGSTEN_Z		0x0031	Palm Tungsten Z
 product PALM M125		0x0040	Palm m125
 product PALM M130		0x0050	Palm m130
 product PALM TUNGSTEN_T		0x0060	Palm Tungsten T
 product PALM ZIRE31		0x0061	Palm Zire 31
 product PALM ZIRE		0x0070	Palm Zire
 
 /* Panasonic products */
 product PANASONIC LS120CAM	0x0901	LS-120 Camera
 product PANASONIC KXL840AN	0x0d01	CD-R Drive KXL-840AN
 product PANASONIC KXLRW32AN	0x0d09	CD-R Drive KXL-RW32AN
 product PANASONIC KXLCB20AN	0x0d0a	CD-R Drive KXL-CB20AN
 product PANASONIC KXLCB35AN	0x0d0e	DVD-ROM & CD-R/RW
 product PANASONIC SDCAAE	0x1b00	MultiMediaCard
 product PANASONIC TYTP50P6S	0x3900	TY-TP50P6-S 50in Touch Panel
 
 /* Papouch products */
 product PAPOUCH AD4USB		0x8003	FTDI compatible adapter
 product PAPOUCH AP485		0x0101	FTDI compatible adapter
 product PAPOUCH AP485_2		0x0104	FTDI compatible adapter
 product PAPOUCH DRAK5		0x0700	FTDI compatible adapter
 product PAPOUCH DRAK6		0x1000	FTDI compatible adapter
 product PAPOUCH GMSR		0x8005	FTDI compatible adapter
 product PAPOUCH GMUX		0x8004	FTDI compatible adapter
 product PAPOUCH IRAMP		0x0500	FTDI compatible adapter
 product PAPOUCH LEC		0x0300	FTDI compatible adapter
 product PAPOUCH MU		0x8001	FTDI compatible adapter
 product PAPOUCH QUIDO10X1		0x0b00	FTDI compatible adapter
 product PAPOUCH QUIDO2X16		0x0e00	FTDI compatible adapter
 product PAPOUCH QUIDO2X2		0x0a00	FTDI compatible adapter
 product PAPOUCH QUIDO30X3		0x0c00	FTDI compatible adapter
 product PAPOUCH QUIDO3X32		0x0f00	FTDI compatible adapter
 product PAPOUCH QUIDO4X4		0x0900	FTDI compatible adapter
 product PAPOUCH QUIDO60X3		0x0d00	FTDI compatible adapter
 product PAPOUCH QUIDO8X8		0x0800	FTDI compatible adapter
 product PAPOUCH SB232		0x0301	FTDI compatible adapter
 product PAPOUCH SB422		0x0102	FTDI compatible adapter
 product PAPOUCH SB422_2		0x0105	FTDI compatible adapter
 product PAPOUCH SB485		0x0100	FTDI compatible adapter
 product PAPOUCH SB485C		0x0107	FTDI compatible adapter
 product PAPOUCH SB485S		0x0106	FTDI compatible adapter
 product PAPOUCH SB485_2		0x0103	FTDI compatible adapter
 product PAPOUCH SIMUKEY		0x8002	FTDI compatible adapter
 product PAPOUCH TMU		0x0400	FTDI compatible adapter
 product PAPOUCH UPSUSB		0x8000	FTDI compatible adapter
 
 /* PARA Industrial products */
 product PARA RT3070		0x8888	RT3070
 
 /* Simtec Electronics products */
 product SIMTEC ENTROPYKEY	0x0001	Entropy Key
 
 /* Pegatron products */
 product PEGATRON RT2870		0x0002	RT2870
 product PEGATRON RT3070		0x000c	RT3070
 product PEGATRON RT3070_2	0x000e	RT3070
 product PEGATRON RT3070_3	0x0010	RT3070
 
 /* Peracom products */
 product PERACOM SERIAL1		0x0001	Serial
 product PERACOM ENET		0x0002	Ethernet
 product PERACOM ENET3		0x0003	At Home Ethernet
 product PERACOM ENET2		0x0005	Ethernet
 
 /* Philips products */
 product PHILIPS DSS350		0x0101	DSS 350 Digital Speaker System
 product PHILIPS DSS		0x0104	DSS XXX Digital Speaker System
 product PHILIPS HUB		0x0201	hub
 product PHILIPS PCA646VC	0x0303	PCA646VC PC Camera
 product PHILIPS PCVC680K	0x0308	PCVC680K Vesta Pro PC Camera
 product PHILIPS DSS150		0x0471	DSS 150 Digital Speaker System
 product PHILIPS ACE1001		0x066a	AKTAKOM ACE-1001 cable
 product PHILIPS SPE3030CC	0x083a	USB 2.0 External Disk
 product PHILIPS SNU5600		0x1236	SNU5600
 product PHILIPS UM10016		0x1552	ISP 1581 Hi-Speed USB MPEG2 Encoder Reference Kit
 product PHILIPS DIVAUSB		0x1801	DIVA USB mp3 player
 product PHILIPS RT2870		0x200f	RT2870
 
 /* Philips Semiconductor products */
 product PHILIPSSEMI HUB1122	0x1122	HUB
 
 /* Megatec */
 product MEGATEC UPS		0x5161	Phoenixtec protocol based UPS
 
 /* P.I. Engineering products */
 product PIENGINEERING PS2USB	0x020b	PS2 to Mac USB Adapter
 
 /* Planex Communications products */
 product PLANEX GW_US11H		0x14ea	GW-US11H WLAN
 product PLANEX2 RTL8188CUS	0x1201	RTL8188CUS
 product PLANEX2 GW_US11S	0x3220	GW-US11S WLAN
 product PLANEX2 GW_US54GXS	0x5303	GW-US54GXS WLAN
 product PLANEX2 RTL8188CU_1	0xab2a	RTL8188CU
 product PLANEX2 RTL8188CU_2	0xed17	RTL8188CU
 product PLANEX2 RTL8188CU_3	0x4902	RTL8188CU
 product PLANEX2 RTL8188CU_4	0xab2e	RTL8188CU
 product PLANEX2 RTL8192CU	0xab2b	RTL8192CU
 product PLANEX2 GWUS54HP	0xab01	GW-US54HP
 product PLANEX2 GWUS300MINIS	0xab24	GW-US300MiniS
 product PLANEX2	RT3070		0xab25	RT3070
 product PLANEX2 MZKUE150N	0xab2f	MZK-UE150N
 product PLANEX2 GWUS54MINI2	0xab50	GW-US54Mini2
 product PLANEX2 GWUS54SG	0xc002	GW-US54SG
 product PLANEX2 GWUS54GZL	0xc007	GW-US54GZL
 product PLANEX2 GWUS54GD	0xed01	GW-US54GD
 product PLANEX2 GWUSMM		0xed02	GW-USMM
 product PLANEX2 RT2870		0xed06	RT2870
 product PLANEX2 GWUSMICRON	0xed14	GW-USMicroN
 product PLANEX2 GWUSVALUEEZ	0xed17	GW-USValue-EZ
 product PLANEX3 GWUS54GZ	0xab10	GW-US54GZ
 product PLANEX3 GU1000T		0xab11	GU-1000T
 product PLANEX3 GWUS54MINI	0xab13	GW-US54Mini
 product PLANEX2 GWUSNANO	0xab28	GW-USNano
 
 /* Plextor Corp. */
 product PLEXTOR 40_12_40U	0x0011	PlexWriter 40/12/40U
 
 /* PLX products */
 product PLX TESTBOARD		0x9060	test board
 product PLX CA42		0xac70	CA-42
 
 /* PNY products */
 product PNY ATTACHE2		0x0010	USB 2.0 Flash Drive
 
 /* PortGear products */
 product PORTGEAR EA8		0x0008	Ethernet
 product PORTGEAR EA9		0x0009	Ethernet
 
 /* Portsmith products */
 product PORTSMITH EEA		0x3003	Express Ethernet
 
 /* Posiflex products */
 product POSIFLEX PP7000		0x0300	FTDI compatible adapter
 
 /* Primax products */
 product PRIMAX G2X300		0x0300	G2-200 scanner
 product PRIMAX G2E300		0x0301	G2E-300 scanner
 product PRIMAX G2300		0x0302	G2-300 scanner
 product PRIMAX G2E3002		0x0303	G2E-300 scanner
 product PRIMAX 9600		0x0340	Colorado USB 9600 scanner
 product PRIMAX 600U		0x0341	Colorado 600u scanner
 product PRIMAX 6200		0x0345	Visioneer 6200 scanner
 product PRIMAX 19200		0x0360	Colorado USB 19200 scanner
 product PRIMAX 1200U		0x0361	Colorado 1200u scanner
 product PRIMAX G600		0x0380	G2-600 scanner
 product PRIMAX 636I		0x0381	ReadyScan 636i
 product PRIMAX G2600		0x0382	G2-600 scanner
 product PRIMAX G2E600		0x0383	G2E-600 scanner
 product PRIMAX COMFORT		0x4d01	Comfort
 product PRIMAX MOUSEINABOX	0x4d02	Mouse-in-a-Box
 product PRIMAX PCGAUMS1		0x4d04	Sony PCGA-UMS1
 product PRIMAX HP_RH304AA	0x4d17	HP RH304AA mouse
 
 /* Prolific products */
 product PROLIFIC PL2301		0x0000	PL2301 Host-Host interface
 product PROLIFIC PL2302		0x0001	PL2302 Host-Host interface
 product PROLIFIC MOTOROLA	0x0307	Motorola Cable
 product PROLIFIC RSAQ2		0x04bb	PL2303 Serial (IODATA USB-RSAQ2)
 product PROLIFIC ALLTRONIX_GPRS	0x0609	Alltronix ACM003U00 modem
 product PROLIFIC ALDIGA_AL11U	0x0611	AlDiga AL-11U modem
 product PROLIFIC MICROMAX_610U	0x0612	Micromax 610U
 product PROLIFIC DCU11		0x1234	DCU-11 Phone Cable
 product PROLIFIC UIC_MSR206	0x206a	UIC MSR206 Card Reader
 product PROLIFIC PL2303		0x2303	PL2303 Serial (ATEN/IOGEAR UC232A)
 product PROLIFIC PL2305		0x2305	Parallel printer
 product PROLIFIC ATAPI4		0x2307	ATAPI-4 Controller
 product PROLIFIC PL2501		0x2501	PL2501 Host-Host interface
 product PROLIFIC PL2506		0x2506	PL2506 USB to IDE Bridge
 product PROLIFIC HCR331		0x331a	HCR331 Hybrid Card Reader
 product PROLIFIC PHAROS		0xaaa0	Prolific Pharos
 product PROLIFIC RSAQ3		0xaaa2	PL2303 Serial Adapter (IODATA USB-RSAQ3)
 product PROLIFIC2 PL2303	0x2303	PL2303 Serial Adapter
 
 /* Putercom products */
 product PUTERCOM UPA100		0x047e	USB-1284 BRIDGE
 
 /* Qcom products */
 product QCOM RT2573		0x6196	RT2573
 product QCOM RT2573_2		0x6229	RT2573
 product QCOM RT2573_3		0x6238	RT2573
 product QCOM RT2870		0x6259	RT2870
 
 /* QI-hardware */
 product QIHARDWARE JTAGSERIAL		0x0713	FTDI compatible adapter
 
 /* Qisda products */
 product QISDA H21_1		0x4512	3G modem
 product QISDA H21_2		0x4523	3G modem
 product QISDA H20_1		0x4515	3G modem
 product QISDA H20_2		0x4519	3G modem
 
 /* Qualcomm products */
 product QUALCOMM CDMA_MSM	0x6000	CDMA Technologies MSM phone
 product QUALCOMM NTT_L02C_MODEM	0x618f	NTT DOCOMO L-02C
 product QUALCOMM NTT_L02C_STORAGE	0x61dd	NTT DOCOMO L-02C
 product QUALCOMM2 MF330		0x6613	MF330
 product QUALCOMM2 RWT_FCT	0x3100	RWT FCT-CDMA 2000 1xRTT modem
 product QUALCOMM2 CDMA_MSM	0x3196	CDMA Technologies MSM modem
 product QUALCOMM2 AC8700	0x6000	AC8700
 product QUALCOMM2 VW110L	0x1000	Vertex Wireless 110L modem
 product QUALCOMM2 SIM5218	0x9000	SIM5218
 product QUALCOMM2 GOBI2000_QDL	0x9204	Qualcomm Gobi 2000 QDL
 product QUALCOMM2 GOBI2000	0x9205	Qualcomm Gobi 2000 modem
 product QUALCOMM2 VT80N		0x6500	Venus VT80N
 product QUALCOMM3 VFAST2	0x9909	Venus Fast2 modem
 product QUALCOMMINC CDMA_MSM	0x0001	CDMA Technologies MSM modem
 product QUALCOMMINC E0002	0x0002	3G modem
 product QUALCOMMINC E0003	0x0003	3G modem
 product QUALCOMMINC E0004	0x0004	3G modem
 product QUALCOMMINC E0005	0x0005	3G modem
 product QUALCOMMINC E0006	0x0006	3G modem
 product QUALCOMMINC E0007	0x0007	3G modem
 product QUALCOMMINC E0008	0x0008	3G modem
 product QUALCOMMINC E0009	0x0009	3G modem
 product QUALCOMMINC E000A	0x000a	3G modem
 product QUALCOMMINC E000B	0x000b	3G modem
 product QUALCOMMINC E000C	0x000c	3G modem
 product QUALCOMMINC E000D	0x000d	3G modem
 product QUALCOMMINC E000E	0x000e	3G modem
 product QUALCOMMINC E000F	0x000f	3G modem
 product QUALCOMMINC E0010	0x0010	3G modem
 product QUALCOMMINC E0011	0x0011	3G modem
 product QUALCOMMINC E0012	0x0012	3G modem
 product QUALCOMMINC E0013	0x0013	3G modem
 product QUALCOMMINC E0014	0x0014	3G modem
 product QUALCOMMINC MF628	0x0015	3G modem
 product QUALCOMMINC MF633R	0x0016	ZTE WCDMA modem
 product QUALCOMMINC E0017	0x0017	3G modem
 product QUALCOMMINC E0018	0x0018	3G modem
 product QUALCOMMINC E0019	0x0019	3G modem
 product QUALCOMMINC E0020	0x0020	3G modem
 product QUALCOMMINC E0021	0x0021	3G modem
 product QUALCOMMINC E0022	0x0022	3G modem
 product QUALCOMMINC E0023	0x0023	3G modem
 product QUALCOMMINC E0024	0x0024	3G modem
 product QUALCOMMINC E0025	0x0025	3G modem
 product QUALCOMMINC E0026	0x0026	3G modem
 product QUALCOMMINC E0027	0x0027	3G modem
 product QUALCOMMINC E0028	0x0028	3G modem
 product QUALCOMMINC E0029	0x0029	3G modem
 product QUALCOMMINC E0030	0x0030	3G modem
 product QUALCOMMINC MF626	0x0031	3G modem
 product QUALCOMMINC E0032	0x0032	3G modem
 product QUALCOMMINC E0033	0x0033	3G modem
 product QUALCOMMINC E0037	0x0037	3G modem
 product QUALCOMMINC E0039	0x0039	3G modem
 product QUALCOMMINC E0042	0x0042	3G modem
 product QUALCOMMINC E0043	0x0043	3G modem
 product QUALCOMMINC E0048	0x0048	3G modem
 product QUALCOMMINC E0049	0x0049	3G modem
 product QUALCOMMINC E0051	0x0051	3G modem
 product QUALCOMMINC E0052	0x0052	3G modem
 product QUALCOMMINC ZTE_STOR2	0x0053	USB ZTE Storage
 product QUALCOMMINC E0054	0x0054	3G modem
 product QUALCOMMINC E0055	0x0055	3G modem
 product QUALCOMMINC E0057	0x0057	3G modem
 product QUALCOMMINC E0058	0x0058	3G modem
 product QUALCOMMINC E0059	0x0059	3G modem
 product QUALCOMMINC E0060	0x0060	3G modem
 product QUALCOMMINC E0061	0x0061	3G modem
 product QUALCOMMINC E0062	0x0062	3G modem
 product QUALCOMMINC E0063	0x0063	3G modem
 product QUALCOMMINC E0064	0x0064	3G modem
 product QUALCOMMINC E0066	0x0066	3G modem
 product QUALCOMMINC E0069	0x0069	3G modem
 product QUALCOMMINC E0070	0x0070	3G modem
 product QUALCOMMINC E0073	0x0073	3G modem
 product QUALCOMMINC E0076	0x0076	3G modem
 product QUALCOMMINC E0078	0x0078	3G modem
 product QUALCOMMINC E0082	0x0082	3G modem
 product QUALCOMMINC E0086	0x0086	3G modem
 product QUALCOMMINC SURFSTICK	0x0117	1&1 Surf Stick
 product QUALCOMMINC K3772_Z_INIT	0x1179	K3772-Z Initial
 product QUALCOMMINC K3772_Z	0x1181	K3772-Z
 product QUALCOMMINC MF195E_INIT	0x1514	MF195E initial
 product QUALCOMMINC MF195E	0x1516	MF195E
 product QUALCOMMINC ZTE_STOR	0x2000	USB ZTE Storage
 product QUALCOMMINC E2002	0x2002	3G modem
 product QUALCOMMINC E2003	0x2003	3G modem
 product QUALCOMMINC AC682	0xffdd	CDMA 1xEVDO USB modem
 product QUALCOMMINC AC682_INIT	0xffde	CDMA 1xEVDO USB modem (initial)
 product QUALCOMMINC AC8710	0xfff1	3G modem
 product QUALCOMMINC AC2726	0xfff5	3G modem
 product QUALCOMMINC AC8700	0xfffe	CDMA 1xEVDO USB modem
 
 /* Quanta products */
 product QUANTA RW6815_1		0x00ce	HP iPAQ rw6815
 product QUANTA RT3070		0x0304	RT3070
 product QUANTA Q101_STOR	0x1000	USB Q101 Storage
 product QUANTA Q101		0xea02	HSDPA modem
 product QUANTA Q111		0xea03	HSDPA modem
 product QUANTA GLX		0xea04	HSDPA modem
 product QUANTA GKE		0xea05	HSDPA modem
 product QUANTA GLE		0xea06	HSDPA modem
 product QUANTA RW6815R		0xf003	HP iPAQ rw6815 RNDIS
 
 /* Qtronix products */
 product QTRONIX 980N		0x2011	Scorpion-980N keyboard
 
 /* Quickshot products */
 product QUICKSHOT STRIKEPAD	0x6238	USB StrikePad
 
 /* Radio Shack */
 product RADIOSHACK USBCABLE	0x4026	USB to Serial Cable
 
 /* Rainbow Technologies products */
 product RAINBOW IKEY2000	0x1200	i-Key 2000
 
 /* Ralink Technology products */
 product RALINK RT2570		0x1706	RT2500USB Wireless Adapter
 product RALINK RT2070		0x2070	RT2070
 product RALINK RT2570_2		0x2570	RT2500USB Wireless Adapter
 product RALINK RT2573		0x2573	RT2501USB Wireless Adapter
 product RALINK RT2671		0x2671	RT2601USB Wireless Adapter
 product RALINK RT2770		0x2770	RT2770
 product RALINK RT2870		0x2870	RT2870
 product RALINK RT_STOR		0x2878	USB Storage
 product RALINK RT3070		0x3070	RT3070
 product RALINK RT3071		0x3071	RT3071
 product RALINK RT3072		0x3072	RT3072
 product RALINK RT3370		0x3370	RT3370
 product RALINK RT3572		0x3572	RT3572
 product RALINK RT3573		0x3573	RT3573
 product RALINK RT5370		0x5370	RT5370
 product RALINK RT5572		0x5572	RT5572
 product RALINK RT8070		0x8070	RT8070
 product RALINK RT2570_3		0x9020	RT2500USB Wireless Adapter
 product RALINK RT2573_2		0x9021	RT2501USB Wireless Adapter
 
 /* RATOC Systems products */
 product RATOC REXUSB60		0xb000	USB serial adapter REX-USB60
 product RATOC REXUSB60F		0xb020	USB serial adapter REX-USB60F
 
 /* Realtek products */
 /* Green House and CompUSA OEM this part */
 product REALTEK DUMMY		0x0000	Dummy product
 product REALTEK USB20CRW	0x0158	USB20CRW Card Reader
 product REALTEK RTL8188ETV	0x0179	RTL8188ETV
 product REALTEK RTL8188CTV      0x018a  RTL8188CTV
 product REALTEK USBKR100	0x8150	USBKR100 USB Ethernet
 product REALTEK RTL8188CE_0     0x8170  RTL8188CE
 product REALTEK RTL8171		0x8171	RTL8171
 product REALTEK RTL8172		0x8172	RTL8172
 product REALTEK RTL8173		0x8173	RTL8173
 product REALTEK RTL8174		0x8174	RTL8174
 product REALTEK RTL8188CU_0	0x8176	RTL8188CU
 product REALTEK RTL8188EU	0x8179	RTL8188EU
 product REALTEK RTL8188CE_1	0x817e	RTL8188CE
 product REALTEK RTL8188CU_1	0x817a	RTL8188CU
 product REALTEK RTL8188CU_2	0x817b	RTL8188CU
 product REALTEK RTL8187		0x8187	RTL8187 Wireless Adapter
 product REALTEK RTL8187B_0	0x8189	RTL8187B Wireless Adapter
 product REALTEK RTL8196EU	0x8196	RTL8196EU
 product REALTEK RTL8187B_1	0x8197	RTL8187B Wireless Adapter
 product REALTEK RTL8187B_2	0x8198	RTL8187B Wireless Adapter
 product REALTEK RTL8188CUS	0x818a	RTL8188CUS
 product REALTEK RTL8188CU_COMBO	0x8754	RTL8188CU
 product REALTEK RTL8191CU	0x8177	RTL8191CU
 product REALTEK RTL8192CU	0x8178	RTL8192CU
 product REALTEK RTL8192CE	0x817c	RTL8192CE
 product REALTEK RTL8188RU_1	0x817d	RTL8188RU
 product REALTEK RTL8188RU_3	0x817f	RTL8188RU
 product REALTEK RTL8712		0x8712	RTL8712
 product REALTEK RTL8713		0x8712	RTL8713
 product REALTEK RTL8188RU_2	0x317f	RTL8188RU
 product REALTEK RTL8192SU	0xc512	RTL8192SU
 
 /* RedOctane products */
 product REDOCTANE DUMMY		0x0000	Dummy product
 product REDOCTANE GHMIDI	0x474b	GH MIDI INTERFACE
 
 /* Renesas products */
 product RENESAS RX610		0x0053	RX610 RX-Stick
 
 /* Ricoh products */
 product RICOH VGPVCC2		0x1830	VGP-VCC2 Camera
 product RICOH VGPVCC3		0x1832	VGP-VCC3 Camera
 product RICOH VGPVCC2_2		0x1833	VGP-VCC2 Camera
 product RICOH VGPVCC2_3		0x1834	VGP-VCC2 Camera
 product RICOH VGPVCC7		0x183a	VGP-VCC7 Camera
 product RICOH VGPVCC8		0x183b	VGP-VCC8 Camera
 
 /* Reiner-SCT products */
 product REINERSCT CYBERJACK_ECOM	0x0100	e-com cyberJack
 
 /* Roland products */
 product ROLAND UA100		0x0000	UA-100 Audio I/F
 product ROLAND UM4		0x0002	UM-4 MIDI I/F
 product ROLAND SC8850		0x0003	SC-8850 MIDI Synth
 product ROLAND U8		0x0004	U-8 Audio I/F
 product ROLAND UM2		0x0005	UM-2 MIDI I/F
 product ROLAND SC8820		0x0007	SC-8820 MIDI Synth
 product ROLAND PC300		0x0008	PC-300 MIDI Keyboard
 product ROLAND UM1		0x0009	UM-1 MIDI I/F
 product ROLAND SK500		0x000b	SK-500 MIDI Keyboard
 product ROLAND SCD70		0x000c	SC-D70 MIDI Synth
 product ROLAND UM880N		0x0014	EDIROL UM-880 MIDI I/F (native)
 product ROLAND UM880G		0x0015	EDIROL UM-880 MIDI I/F (generic)
 product ROLAND SD90		0x0016	SD-90 MIDI Synth
 product ROLAND UM550		0x0023	UM-550 MIDI I/F
 product ROLAND SD20		0x0027	SD-20 MIDI Synth
 product ROLAND SD80		0x0029	SD-80 MIDI Synth
 product ROLAND UA700		0x002b	UA-700 Audio I/F
 
 /* Rockfire products */
 product ROCKFIRE GAMEPAD	0x2033	gamepad 203USB
 
 /* RATOC Systems products */
 product RATOC REXUSB60		0xb000	REX-USB60
 product RATOC REXUSB60F		0xb020	REX-USB60F
 
 /* RT system products */
 product RTSYSTEMS CT29B		0x9e54	FTDI compatible adapter
 product RTSYSTEMS SERIAL_VX7		0x9e52	FTDI compatible adapter
 
 /* Sagem products */
 product SAGEM USBSERIAL		0x0027	USB-Serial Controller
 product SAGEM XG760A		0x004a	XG-760A
 product SAGEM XG76NA		0x0062	XG-76NA
 
 /* Samsung products */
 product SAMSUNG WIS09ABGN	0x2018	WIS09ABGN Wireless LAN adapter
 product SAMSUNG ML6060		0x3008	ML-6060 laser printer
 product SAMSUNG YP_U2		0x5050	YP-U2 MP3 Player
 product SAMSUNG YP_U4		0x5092	YP-U4 MP3 Player
 product SAMSUNG I500		0x6601	I500 Palm USB Phone
 product SAMSUNG I330		0x8001	I330 phone cradle
 product SAMSUNG2 RT2870_1	0x2018	RT2870
 
 /* Samsung Techwin products */
 product SAMSUNG_TECHWIN DIGIMAX_410	0x000a	Digimax 410
 
 /* SanDisk products */
 product SANDISK SDDR05A		0x0001	ImageMate SDDR-05a
 product SANDISK SDDR31		0x0002	ImageMate SDDR-31
 product SANDISK SDDR05		0x0005	ImageMate SDDR-05
 product SANDISK SDDR12		0x0100	ImageMate SDDR-12
 product SANDISK SDDR09		0x0200	ImageMate SDDR-09
 product SANDISK SDDR75		0x0810	ImageMate SDDR-75
 product SANDISK SDCZ2_128	0x7100	Cruzer Mini 128MB
 product SANDISK SDCZ2_256	0x7104	Cruzer Mini 256MB
 product SANDISK SDCZ4_128	0x7112	Cruzer Micro 128MB
 product SANDISK SDCZ4_256	0x7113	Cruzer Micro 256MB
 product SANDISK IMAGEMATE_SDDR289	0xb6ba	ImageMate SDDR-289
 
 /* Sanwa Electric Instrument Co., Ltd. products */
 product SANWA KB_USB2 		0x0701	KB-USB2 multimeter cable
 
 /* Sanyo Electric products */
 product SANYO SCP4900 		0x0701	Sanyo SCP-4900 USB Phone
 
 /* ScanLogic products */
 product SCANLOGIC SL11R		0x0002	SL11R IDE Adapter
 product SCANLOGIC 336CX		0x0300	Phantom 336CX - C3 scanner
 
 /* Schweitzer Engineering Laboratories products */
 product SEL C662		0x0001	C662 Cable
 
 /* Sealevel products */
 product SEALEVEL 2101		0x2101	FTDI compatible adapter
 product SEALEVEL 2102		0x2102	FTDI compatible adapter
 product SEALEVEL 2103		0x2103	FTDI compatible adapter
 product SEALEVEL 2104		0x2104	FTDI compatible adapter
 product SEALEVEL 2106		0x9020	FTDI compatible adapter
 product SEALEVEL 2201_1		0x2211	FTDI compatible adapter
 product SEALEVEL 2201_2		0x2221	FTDI compatible adapter
 product SEALEVEL 2202_1		0x2212	FTDI compatible adapter
 product SEALEVEL 2202_2		0x2222	FTDI compatible adapter
 product SEALEVEL 2203_1		0x2213	FTDI compatible adapter
 product SEALEVEL 2203_2		0x2223	FTDI compatible adapter
 product SEALEVEL 2401_1		0x2411	FTDI compatible adapter
 product SEALEVEL 2401_2		0x2421	FTDI compatible adapter
 product SEALEVEL 2401_3		0x2431	FTDI compatible adapter
 product SEALEVEL 2401_4		0x2441	FTDI compatible adapter
 product SEALEVEL 2402_1		0x2412	FTDI compatible adapter
 product SEALEVEL 2402_2		0x2422	FTDI compatible adapter
 product SEALEVEL 2402_3		0x2432	FTDI compatible adapter
 product SEALEVEL 2402_4		0x2442	FTDI compatible adapter
 product SEALEVEL 2403_1		0x2413	FTDI compatible adapter
 product SEALEVEL 2403_2		0x2423	FTDI compatible adapter
 product SEALEVEL 2403_3		0x2433	FTDI compatible adapter
 product SEALEVEL 2403_4		0x2443	FTDI compatible adapter
 product SEALEVEL 2801_1		0x2811	FTDI compatible adapter
 product SEALEVEL 2801_2		0x2821	FTDI compatible adapter
 product SEALEVEL 2801_3		0x2831	FTDI compatible adapter
 product SEALEVEL 2801_4		0x2841	FTDI compatible adapter
 product SEALEVEL 2801_5		0x2851	FTDI compatible adapter
 product SEALEVEL 2801_6		0x2861	FTDI compatible adapter
 product SEALEVEL 2801_7		0x2871	FTDI compatible adapter
 product SEALEVEL 2801_8		0x2881	FTDI compatible adapter
 product SEALEVEL 2802_1		0x2812	FTDI compatible adapter
 product SEALEVEL 2802_2		0x2822	FTDI compatible adapter
 product SEALEVEL 2802_3		0x2832	FTDI compatible adapter
 product SEALEVEL 2802_4		0x2842	FTDI compatible adapter
 product SEALEVEL 2802_5		0x2852	FTDI compatible adapter
 product SEALEVEL 2802_6		0x2862	FTDI compatible adapter
 product SEALEVEL 2802_7		0x2872	FTDI compatible adapter
 product SEALEVEL 2802_8		0x2882	FTDI compatible adapter
 product SEALEVEL 2803_1		0x2813	FTDI compatible adapter
 product SEALEVEL 2803_2		0x2823	FTDI compatible adapter
 product SEALEVEL 2803_3		0x2833	FTDI compatible adapter
 product SEALEVEL 2803_4		0x2843	FTDI compatible adapter
 product SEALEVEL 2803_5		0x2853	FTDI compatible adapter
 product SEALEVEL 2803_6		0x2863	FTDI compatible adapter
 product SEALEVEL 2803_7		0x2873	FTDI compatible adapter
 product SEALEVEL 2803_8		0x2883	FTDI compatible adapter
 
 /* Senao products */
 product SENAO RT2870_3		0x0605	RT2870
 product SENAO RT2870_4		0x0615	RT2870
 product SENAO NUB8301		0x2000	NUB-8301
 product SENAO RT2870_1		0x9701	RT2870
 product SENAO RT2870_2		0x9702	RT2870
 product SENAO RT3070		0x9703	RT3070
 product SENAO RT3071		0x9705	RT3071
 product SENAO RT3072_1		0x9706	RT3072
 product SENAO RT3072_2		0x9707	RT3072
 product SENAO RT3072_3		0x9708	RT3072
 product SENAO RT3072_4		0x9709	RT3072
 product SENAO RT3072_5		0x9801	RT3072
 product SENAO RTL8192SU_1	0x9603	RTL8192SU
 product SENAO RTL8192SU_2	0x9605	RTL8192SU
 
 /* ShanTou products */
 product SHANTOU ST268		0x0268	ST268
 product SHANTOU DM9601		0x9601	DM 9601
 product SHANTOU ADM8515		0x8515	ADM8515
 
 /* Shark products */
 product SHARK PA		0x0400	Pocket Adapter
 
 /* Sharp products */
 product SHARP SL5500		0x8004	Zaurus SL-5500 PDA
 product SHARP SLA300		0x8005	Zaurus SL-A300 PDA
 product SHARP SL5600		0x8006	Zaurus SL-5600 PDA
 product SHARP SLC700		0x8007	Zaurus SL-C700 PDA
 product SHARP SLC750		0x9031	Zaurus SL-C750 PDA
 product SHARP WZERO3ES		0x9123	W-ZERO3 ES Smartphone
 product SHARP WZERO3ADES	0x91ac	Advanced W-ZERO3 ES Smartphone
 product SHARP WILLCOM03		0x9242	WILLCOM03
 
 /* Shuttle Technology products */
 product SHUTTLE EUSB		0x0001	E-USB Bridge
 product SHUTTLE EUSCSI		0x0002	eUSCSI Bridge
 product SHUTTLE SDDR09		0x0003	ImageMate SDDR09
 product SHUTTLE EUSBCFSM	0x0005	eUSB SmartMedia / CompactFlash Adapter
 product SHUTTLE ZIOMMC		0x0006	eUSB MultiMediaCard Adapter
 product SHUTTLE HIFD		0x0007	Sony Hifd
 product SHUTTLE EUSBATAPI	0x0009	eUSB ATA/ATAPI Adapter
 product SHUTTLE CF		0x000a	eUSB CompactFlash Adapter
 product SHUTTLE EUSCSI_B	0x000b	eUSCSI Bridge
 product SHUTTLE EUSCSI_C	0x000c	eUSCSI Bridge
 product SHUTTLE CDRW		0x0101	CD-RW Device
 product SHUTTLE EUSBORCA	0x0325	eUSB ORCA Quad Reader
 
 /* Siemens products */
 product SIEMENS SPEEDSTREAM	0x1001	SpeedStream
 product SIEMENS SPEEDSTREAM22	0x1022	SpeedStream 1022
 product SIEMENS2 WLL013		0x001b	WLL013
 product SIEMENS2 ES75		0x0034  GSM module MC35
 product SIEMENS2 WL54G		0x3c06	54g USB Network Adapter
 product SIEMENS3 SX1		0x0001	SX1
 product SIEMENS3 X65		0x0003	X65
 product SIEMENS3 X75		0x0004	X75
 product SIEMENS3 EF81 		0x0005	EF81
 
 /* Sierra Wireless products */
 product SIERRA EM5625		0x0017	EM5625
 product SIERRA MC5720_2		0x0018	MC5720
 product SIERRA MC5725		0x0020	MC5725
 product SIERRA AIRCARD580	0x0112	Sierra Wireless AirCard 580
 product SIERRA AIRCARD595	0x0019	Sierra Wireless AirCard 595
 product SIERRA AC595U		0x0120	Sierra Wireless AirCard 595U
 product SIERRA AC597E		0x0021	Sierra Wireless AirCard 597E
 product SIERRA EM5725		0x0022	EM5725
 product SIERRA C597		0x0023	Sierra Wireless Compass 597
 product SIERRA MC5727		0x0024	MC5727
 product SIERRA T598		0x0025	T598
 product SIERRA T11		0x0026	T11
 product SIERRA AC402		0x0027	AC402
 product SIERRA MC5728		0x0028	MC5728
 product SIERRA E0029		0x0029	E0029
 product SIERRA AIRCARD580	0x0112	Sierra Wireless AirCard 580
 product SIERRA AC595U		0x0120	Sierra Wireless AirCard 595U
 product SIERRA MC5720		0x0218	MC5720 Wireless Modem
 product SIERRA MINI5725		0x0220	Sierra Wireless miniPCI 5275
 product SIERRA MC5727_2		0x0224	MC5727
 product SIERRA MC8755_2		0x6802	MC8755
 product SIERRA MC8765		0x6803	MC8765
 product SIERRA MC8755		0x6804	MC8755
 product SIERRA MC8765_2		0x6805	MC8765
 product SIERRA MC8755_4		0x6808	MC8755
 product SIERRA MC8765_3		0x6809	MC8765
 product SIERRA AC875U		0x6812	AC875U HSDPA USB Modem
 product SIERRA MC8755_3		0x6813	MC8755 HSDPA
 product SIERRA MC8775_2		0x6815	MC8775
 product SIERRA MC8775		0x6816	MC8775
 product SIERRA AC875		0x6820	Sierra Wireless AirCard 875
 product SIERRA AC875U_2		0x6821	AC875U
 product SIERRA AC875E		0x6822	AC875E
 product SIERRA MC8780		0x6832	MC8780
 product SIERRA MC8781		0x6833	MC8781
 product SIERRA MC8780_2		0x6834	MC8780
 product SIERRA MC8781_2		0x6835	MC8781
 product SIERRA MC8780_3		0x6838	MC8780
 product SIERRA MC8781_3		0x6839	MC8781
 product SIERRA MC8785		0x683A	MC8785
 product SIERRA MC8785_2		0x683B	MC8785
 product SIERRA MC8790		0x683C	MC8790
 product SIERRA MC8791		0x683D	MC8791
 product SIERRA MC8792		0x683E	MC8792
 product SIERRA AC880		0x6850	Sierra Wireless AirCard 880
 product SIERRA AC881		0x6851	Sierra Wireless AirCard 881
 product SIERRA AC880E		0x6852	Sierra Wireless AirCard 880E
 product SIERRA AC881E		0x6853	Sierra Wireless AirCard 881E
 product SIERRA AC880U		0x6855	Sierra Wireless AirCard 880U
 product SIERRA AC881U		0x6856	Sierra Wireless AirCard 881U
 product SIERRA AC885E		0x6859	AC885E
 product SIERRA AC885E_2		0x685A	AC885E
 product SIERRA AC885U		0x6880	Sierra Wireless AirCard 885U
 product SIERRA C888		0x6890	C888
 product SIERRA C22		0x6891	C22
 product SIERRA E6892		0x6892	E6892
 product SIERRA E6893		0x6893	E6893
 product SIERRA MC8700		0x68A3	MC8700
 product SIERRA AIRCARD875	0x6820	Aircard 875 HSDPA
 product SIERRA AC313U		0x68aa	Sierra Wireless AirCard 313U
 product SIERRA TRUINSTALL	0x0fff	Aircard Tru Installer
 
 /* Sigmatel products */
 product SIGMATEL WBT_3052	0x4200	WBT-3052 IrDA/USB Bridge
 product SIGMATEL I_BEAD100	0x8008	i-Bead 100 MP3 Player
 
 /* SIIG products */
 /* Also: Omnidirectional Control Technology products */
 product SIIG DIGIFILMREADER	0x0004	DigiFilm-Combo Reader
 product SIIG WINTERREADER	0x0330	WINTERREADER Reader
 product SIIG2 DK201		0x0103	FTDI compatible adapter
 product SIIG2 USBTOETHER	0x0109	USB TO Ethernet
 product SIIG2 US2308		0x0421	Serial
 
 /* Silicom products */
 product SILICOM U2E		0x0001	U2E
 product SILICOM GPE		0x0002	Psion Gold Port Ethernet
 
 /* SI Labs */
 product SILABS	VSTABI		0x0f91	VStabi Controller
 product SILABS	ARKHAM_DS101_M	0x1101	Arkham DS101 Monitor
 product SILABS	ARKHAM_DS101_A	0x1601	Arkham DS101 Adapter
 product SILABS	BSM7DUSB	0x800a	SPORTident BSM7-D USB
 product SILABS	POLOLU		0x803b	Pololu Serial
 product SILABS	CYGNAL_DEBUG	0x8044	Cygnal Debug Adapter
 product SILABS	SB_PARAMOUNT_ME	0x8043	Software Bisque Paramount ME
 product SILABS	SAEL		0x8053	SA-EL USB
 product SILABS	GSM2228		0x8054	Enfora GSM2228 USB
 product SILABS	ARGUSISP	0x8066	Argussoft ISP
 product SILABS	IMS_USB_RS422	0x806f	IMS USB-RS422
 product SILABS	CRUMB128	0x807a	Crumb128 board
 product SILABS	OPTRIS_MSPRO	0x80c4	Optris MSpro LT Thermometer
 product SILABS	DEGREE		0x80ca	Degree Controls Inc
 product SILABS	TRACIENT	0x80dd	Tracient RFID
 product SILABS	TRAQMATE	0x80ed	Track Systems Traqmate
 product SILABS	SUUNTO		0x80f6	Suunto Sports Instrument
 product SILABS	ARYGON_MIFARE	0x8115	Arygon Mifare RFID reader
 product SILABS	BURNSIDE	0x813d	Burnside Telecon Deskmobile
 product SILABS	TAMSMASTER	0x813f	Tams Master Easy Control
 product SILABS	WMRBATT		0x814a	WMR RIGblaster Plug&Play
 product SILABS	WMRRIGBLASTER	0x814a	WMR RIGblaster Plug&Play
 product SILABS	WMRRIGTALK	0x814b	WMR RIGtalk RT1
 product SILABS	B_G_H3000	0x8156	B&G H3000 Data Cable
 product SILABS	HELICOM		0x815e	Helicomm IP-Link 1220-DVM
 product SILABS	HAMLINKUSB	0x815f	Timewave HamLinkUSB
 product SILABS	AVIT_USB_TTL	0x818b	AVIT Research USB-TTL
 product SILABS	MJS_TOSLINK	0x819f	MJS USB-TOSLINK
 product SILABS	WAVIT		0x81a6	ThinkOptics WavIt
 product SILABS	MULTIPLEX_RC	0x81a9	Multiplex RC adapter
 product SILABS	MSD_DASHHAWK	0x81ac	MSD DashHawk
 product SILABS	INSYS_MODEM	0x81ad	INSYS Modem
 product SILABS	LIPOWSKY_JTAG	0x81c8	Lipowsky Baby-JTAG
 product SILABS	LIPOWSKY_LIN	0x81e2	Lipowsky Baby-LIN
 product SILABS	AEROCOMM	0x81e7	Aerocomm Radio
 product SILABS	ZEPHYR_BIO	0x81e8	Zephyr Bioharness
 product SILABS	EMS_C1007	0x81f2	EMS C1007 HF RFID controller
 product SILABS	LIPOWSKY_HARP	0x8218	Lipowsky HARP-1
 product SILABS	C2_EDGE_MODEM	0x822b	Commander 2 EDGE(GSM) Modem
 product SILABS	CYGNAL_GPS	0x826b	Cygnal Fasttrax GPS
 product SILABS	TELEGESIS_ETRX2	0x8293	Telegesis ETRX2USB
 product SILABS	PROCYON_AVS	0x82f9	Procyon AVS
 product SILABS	MC35PU		0x8341	MC35pu
 product SILABS	CYGNAL		0x8382	Cygnal
 product SILABS	AMBER_AMB2560	0x83a8	Amber Wireless AMB2560
 product SILABS	DEKTEK_DTAPLUS	0x83d8	DekTec DTA Plus VHF/UHF Booster
 product SILABS	KYOCERA_GPS	0x8411	Kyocera GPS
 product SILABS	IRZ_SG10	0x8418	IRZ SG-10 GSM/GPRS Modem
 product SILABS	BEI_VCP		0x846e	BEI USB Sensor (VCP)
 product SILABS	BALLUFF_RFID	0x8477	Balluff RFID reader
 product SILABS	AC_SERV_IBUS	0x85ea	AC-Services IBUS Interface
 product SILABS	AC_SERV_CIS	0x85eb	AC-Services CIS-IBUS
 product SILABS	V_PREON32	0x85f8	Virtenio Preon32
 product SILABS	AC_SERV_CAN	0x8664	AC-Services CAN Interface
 product SILABS	AC_SERV_OBD	0x8665	AC-Services OBD Interface
 product SILABS	MMB_ZIGBEE	0x88a4	MMB Networks ZigBee
 product SILABS	INGENI_ZIGBEE	0x88a5	Planet Innovation Ingeni ZigBee
 product SILABS	CP2102		0xea60	SILABS USB UART
 product SILABS	CP210X_2	0xea61	CP210x Serial
 product SILABS	CP210X_3	0xea70	CP210x Serial
 product SILABS	CP210X_4	0xea80	CP210x Serial
 product SILABS	INFINITY_MIC	0xea71	Infinity GPS-MIC-1 Radio Monophone
 product SILABS	USBSCOPE50	0xf001	USBscope50
 product SILABS	USBWAVE12	0xf002	USBwave12
 product SILABS	USBPULSE100	0xf003	USBpulse100
 product SILABS	USBCOUNT50	0xf004	USBcount50
 product SILABS2 DCU11CLONE	0xaa26	DCU-11 clone
 product SILABS3 GPRS_MODEM	0xea61	GPRS Modem
 product SILABS4 100EU_MODEM	0xea61	GPRS Modem 100EU
 
 /* Silicon Portals Inc. */
 product SILICONPORTALS YAPPH_NF	0x0200	YAP Phone (no firmware)
 product SILICONPORTALS YAPPHONE	0x0201	YAP Phone
 
 /* Sirius Technologies products */
 product SIRIUS ROADSTER		0x0001	NetComm Roadster II 56 USB
 
 /* Sitecom products */
 product SITECOM LN029		0x182d	USB 2.0 Ethernet
 product SITECOM SERIAL		0x2068	USB to serial cable (v2)
 product SITECOM2 WL022		0x182d	WL-022
 
 /* Sitecom Europe products */
 product SITECOMEU RT2870_1	0x0017	RT2870
 product SITECOMEU WL168V1	0x000d	WL-168 v1
 product SITECOMEU LN030  	0x0021	MCS7830
 product SITECOMEU WL168V4	0x0028	WL-168 v4
 product SITECOMEU RT2870_2	0x002b	RT2870
 product SITECOMEU RT2870_3	0x002c	RT2870
 product SITECOMEU RT2870_4	0x002d	RT2870
 product SITECOMEU RT2770	0x0039	RT2770
 product SITECOMEU RT3070_2	0x003b	RT3070
 product SITECOMEU RT3070_3	0x003c	RT3070
 product SITECOMEU RT3070_4	0x003d	RT3070
 product SITECOMEU RT3070	0x003e	RT3070
 product SITECOMEU WL608		0x003f	WL-608
 product SITECOMEU RT3071	0x0040	RT3071
 product SITECOMEU RT3072_1	0x0041	RT3072
 product SITECOMEU RT3072_2	0x0042	RT3072
 product SITECOMEU WL353		0x0045	WL-353
 product SITECOMEU RT3072_3	0x0047	RT3072
 product SITECOMEU RT3072_4	0x0048	RT3072
 product SITECOMEU RT3072_5	0x004a	RT3072
 product SITECOMEU WL349V1	0x004b	WL-349 v1
 product SITECOMEU RT3072_6	0x004d	RT3072
 product SITECOMEU RTL8188CU_1	0x0052	RTL8188CU
 product SITECOMEU RTL8188CU_2	0x005c	RTL8188CU
 product SITECOMEU RTL8192CU	0x0061	RTL8192CU
 product SITECOMEU LN032		0x0072	LN-032
 product SITECOMEU LN028		0x061c	LN-028
 product SITECOMEU WL113		0x9071	WL-113
 product SITECOMEU ZD1211B	0x9075	ZD1211B
 product SITECOMEU WL172		0x90ac	WL-172
 product SITECOMEU WL113R2	0x9712	WL-113 rev 2
 
 /* Skanhex Technology products */
 product SKANHEX MD_7425		0x410a	MD 7425 Camera
 product SKANHEX SX_520Z		0x5200	SX 520z Camera
 
 /* Smart Technologies products */
 product SMART PL2303		0x2303	Serial adapter
 
 /* SmartBridges products */
 product SMARTBRIDGES SMARTLINK	0x0001	SmartLink USB Ethernet
 product SMARTBRIDGES SMARTNIC	0x0003	smartNIC 2 PnP Ethernet
 
 /* SMC products */
 product SMC 2102USB		0x0100	10Mbps Ethernet
 product SMC 2202USB		0x0200	10/100 Ethernet
 product SMC 2206USB		0x0201	EZ Connect USB Ethernet
 product SMC 2862WG		0xee13	EZ Connect Wireless Adapter
 product SMC2 2020HUB		0x2020	USB Hub
 product SMC2 2514HUB		0x2514	USB Hub
 product SMC3 2662WUSB		0xa002	2662W-AR Wireless
 product SMC2 LAN9500_ETH	0x9500	USB/Ethernet
 product SMC2 LAN9505_ETH	0x9505	USB/Ethernet
 product SMC2 LAN9530_ETH	0x9530	USB/Ethernet
 product SMC2 LAN9730_ETH	0x9730	USB/Ethernet
 product SMC2 LAN9500_SAL10	0x9900	USB/Ethernet
 product SMC2 LAN9505_SAL10	0x9901	USB/Ethernet
 product SMC2 LAN9500A_SAL10	0x9902	USB/Ethernet
 product SMC2 LAN9505A_SAL10	0x9903	USB/Ethernet
 product SMC2 LAN9514_SAL10	0x9904	USB/Ethernet
 product SMC2 LAN9500A_HAL	0x9905	USB/Ethernet
 product SMC2 LAN9505A_HAL	0x9906	USB/Ethernet
 product SMC2 LAN9500_ETH_2	0x9907	USB/Ethernet
 product SMC2 LAN9500A_ETH_2	0x9908	USB/Ethernet
 product SMC2 LAN9514_ETH_2	0x9909	USB/Ethernet
 product SMC2 LAN9500A_ETH	0x9e00	USB/Ethernet
 product SMC2 LAN9505A_ETH	0x9e01	USB/Ethernet
 product SMC2 LAN89530_ETH	0x9e08	USB/Ethernet
 product SMC2 LAN9514_ETH	0xec00	USB/Ethernet
 
 /* SOHOware products */
 product SOHOWARE NUB100		0x9100	10/100 USB Ethernet
 product SOHOWARE NUB110		0x9110	10/100 USB Ethernet
 
 /* SOLID YEAR products */
 product SOLIDYEAR KEYBOARD	0x2101	Solid Year USB keyboard
 
 /* SONY products */
 product SONY DSC		0x0010	DSC cameras
 product SONY MS_NW_MS7		0x0025	Memorystick NW-MS7
 product SONY PORTABLE_HDD_V2	0x002b	Portable USB Harddrive V2
 product SONY MSACUS1		0x002d	Memorystick MSAC-US1
 product SONY HANDYCAM		0x002e	Handycam
 product SONY MSC		0x0032	MSC memory stick slot
 product SONY CLIE_35		0x0038	Sony Clie v3.5
 product SONY MS_PEG_N760C	0x0058	PEG N760c Memorystick
 product SONY CLIE_40		0x0066	Sony Clie v4.0
 product SONY MS_MSC_U03		0x0069	Memorystick MSC-U03
 product SONY CLIE_40_MS		0x006d	Sony Clie v4.0 Memory Stick slot
 product SONY CLIE_S360		0x0095	Sony Clie s360
 product SONY CLIE_41_MS		0x0099	Sony Clie v4.1 Memory Stick slot
 product SONY CLIE_41		0x009a	Sony Clie v4.1
 product SONY CLIE_NX60		0x00da	Sony Clie nx60
 product SONY CLIE_TH55		0x0144	Sony Clie th55
 product SONY CLIE_TJ37		0x0169	Sony Clie tj37
 product SONY RF_RECEIVER	0x01db	Sony RF mouse/kbd Receiver VGP-WRC1
 product SONY QN3		0x0437	Sony QN3 CMD-Jxx phone cable
 
 /* Sony Ericsson products */
 product SONYERICSSON DCU10	0x0528	DCU-10 Phone Data Cable
 product SONYERICSSON DATAPILOT	0x2003	Datapilot Phone Cable
 
 /* SOURCENEXT products */
 product SOURCENEXT KEIKAI8	0x039f	KeikaiDenwa 8
 product SOURCENEXT KEIKAI8_CHG	0x012e	KeikaiDenwa 8 with charger
 
 /* SparkLAN products */
 product SPARKLAN RT2573		0x0004	RT2573
 product SPARKLAN RT2870_1	0x0006	RT2870
 product SPARKLAN RT3070		0x0010	RT3070
 
 /* Soundgraph products */
 product SOUNDGRAPH IMON_VFD	0x0044	Antec Veris Elite VFD Panel, Knob, and Remote
 product SOUNDGRAPH SSTONE_LC16	0xffdc	Silverstone LC16 VFD Panel, Knob, and Remote
 
 /* Speed Dragon Multimedia products */
 product SPEEDDRAGON MS3303H	0x110b	MS3303H Serial
 
 /* Sphairon Access Systems GmbH products */
 product SPHAIRON UB801R		0x0110	UB801R
 
 /* Stelera Wireless products */
 product STELERA ZEROCD		0x1000	Zerocd Installer
 product STELERA C105		0x1002	Stelera/Bandrish C105 USB
 product STELERA E1003		0x1003	3G modem
 product STELERA E1004		0x1004	3G modem
 product STELERA E1005		0x1005	3G modem
 product STELERA E1006		0x1006	3G modem
 product STELERA E1007		0x1007	3G modem
 product STELERA E1008		0x1008	3G modem
 product STELERA E1009		0x1009	3G modem
 product STELERA E100A		0x100a	3G modem
 product STELERA E100B		0x100b	3G modem
 product STELERA E100C		0x100c	3G modem
 product STELERA E100D		0x100d	3G modem
 product STELERA E100E		0x100e	3G modem
 product STELERA E100F		0x100f	3G modem
 product STELERA E1010		0x1010	3G modem
 product STELERA E1011		0x1011	3G modem
 product STELERA E1012		0x1012	3G modem
 
 /* STMicroelectronics products */
 product STMICRO BIOCPU		0x2016	Biometric Coprocessor
 product STMICRO COMMUNICATOR	0x7554	USB Communicator
 product STMICRO ST72682		0xfada  USB 2.0 Flash drive controller
 
 /* STSN products */
 product STSN STSN0001		0x0001	Internet Access Device
 
 /* SUN Corporation products */
 product SUNTAC DS96L		0x0003	SUNTAC U-Cable type D2
 product SUNTAC PS64P1		0x0005	SUNTAC U-Cable type P1
 product SUNTAC VS10U		0x0009	SUNTAC Slipper U
 product SUNTAC IS96U		0x000a	SUNTAC Ir-Trinity
 product SUNTAC AS64LX		0x000b	SUNTAC U-Cable type A3
 product SUNTAC AS144L4		0x0011	SUNTAC U-Cable type A4
 
 /* Sun Microsystems products */
 product SUN KEYBOARD_TYPE_6	0x0005	Type 6 USB keyboard
 product SUN KEYBOARD_TYPE_7	0x00a2	Type 7 USB keyboard
 /* XXX The above is a North American PC style keyboard possibly */
 product SUN MOUSE		0x0100	Type 6 USB mouse
 product SUN KBD_HUB		0x100e	Kbd Hub
 
 /* Sunplus Innovation Technology Inc. products */
 product SUNPLUS USBMOUSE	0x0007	USB Optical Mouse
 
 /* Super Top products */
 product	SUPERTOP IDE		0x6600	USB-IDE
 product	SUPERTOP FLASHDRIVE	0x121c	extrememory Snippy
 
 /* Syntech products */
 product SYNTECH CPT8001C	0x0001	CPT-8001C Barcode scanner
 product	SYNTECH CYPHERLAB100	0x1000	CipherLab USB Barcode Scanner
 
 /* Teclast products */
 product TECLAST TLC300		0x3203	USB Media Player
 
 /* Testo products */
 product TESTO USB_INTERFACE	0x0001	FTDI compatible adapter
 
 /* TexTech products */
 product TEXTECH DUMMY		0x0000	Dummy product
 product TEXTECH U2M_1		0x0101	Textech USB MIDI cable
 product TEXTECH U2M_2		0x1806	Textech USB MIDI cable
 
 /* The Mobility Lab products */
 product TML USB_SERIAL		0x0064	FTDI compatible adapter
 
 /* Thurlby Thandar Instrument products */
 product TTI QL355P		0x03e8	FTDI compatible adapter
 
 /* Supra products */
 product DIAMOND2 SUPRAEXPRESS56K 0x07da	Supra Express 56K modem
 product DIAMOND2 SUPRA2890	0x0b4a	SupraMax 2890 56K Modem
 product DIAMOND2 RIO600USB	0x5001	Rio 600 USB
 product DIAMOND2 RIO800USB	0x5002	Rio 800 USB
 
 /* Surecom Technology products */
 product SURECOM EP9001G2A	0x11f2	EP-9001-G rev 2A
 product SURECOM RT2570		0x11f3	RT2570
 product SURECOM RT2573		0x31f3	RT2573
 
 /* Sweex products */
 product SWEEX ZD1211		0x1809	ZD1211
 product SWEEX2 LW153		0x0153	LW153
 product SWEEX2 LW154		0x0154	LW154
 product SWEEX2 LW303		0x0302	LW303
 product SWEEX2 LW313		0x0313	LW313
 
 /* System TALKS, Inc. */
 product SYSTEMTALKS SGCX2UL	0x1920	SGC-X2UL
 
 /* Tapwave products */
 product TAPWAVE ZODIAC		0x0100	Zodiac
 
 /* Taugagreining products */
 product TAUGA CAMERAMATE	0x0005	CameraMate (DPCM_USB)
 
 /* TCTMobile products */
 product TCTMOBILE X060S		0x0000	X060S 3G modem
 product TCTMOBILE X080S		0xf000	X080S 3G modem
 
 /* TDK products */
 product TDK UPA9664		0x0115	USB-PDC Adapter UPA9664
 product TDK UCA1464		0x0116	USB-cdmaOne Adapter UCA1464
 product TDK UHA6400		0x0117	USB-PHS Adapter UHA6400
 product TDK UPA6400		0x0118	USB-PHS Adapter UPA6400
 product TDK BT_DONGLE		0x0309	Bluetooth USB dongle
 
 /* TEAC products */
 product TEAC FD05PUB		0x0000	FD-05PUB floppy
 
 /* Tekram Technology products */
 product TEKRAM QUICKWLAN	0x1630	QuickWLAN
 product TEKRAM ZD1211_1		0x5630	ZD1211
 product TEKRAM ZD1211_2		0x6630	ZD1211
 
 /* Telex Communications products */
 product TELEX MIC1		0x0001	Enhanced USB Microphone
 
 /* Telit products */
 product TELIT UC864E		0x1003	UC864E 3G modem
 product TELIT UC864G		0x1004	UC864G 3G modem
 
 /* Ten X Technology, Inc. */
 product TENX UAUDIO0		0xf211	USB audio headset
 
 /* Texas Intel products */
 product TI UTUSB41		0x1446	UT-USB41 hub
 product TI TUSB2046		0x2046	TUSB2046 hub
 
 /* Thrustmaster products */
 product THRUST FUSION_PAD	0xa0a3	Fusion Digital Gamepad
 
 /* TLayTech products */
 product TLAYTECH TEU800		0x1682	TEU800 3G modem
 
 /* Topre Corporation products */
 product TOPRE HHKB		0x0100	HHKB Professional
 
 /* Toshiba Corporation products */
 product TOSHIBA POCKETPC_E740	0x0706	PocketPC e740
 product TOSHIBA RT3070		0x0a07	RT3070
 product TOSHIBA G450		0x0d45	G450 modem
 product TOSHIBA HSDPA		0x1302	G450 modem
 product TOSHIBA TRANSMEMORY	0x6545	USB ThumbDrive
 
 /* Trek Technology products */
 product TREK THUMBDRIVE		0x1111	ThumbDrive
 product TREK MEMKEY		0x8888	IBM USB Memory Key
 product TREK THUMBDRIVE_8MB	0x9988	ThumbDrive_8MB
 
 /* TRENDnet products */
 product TRENDNET RTL8192CU	0x624d	RTL8192CU
 product TRENDNET TEW646UBH	0x646b	TEW-646UBH
 product TRENDNET RTL8188CU	0x648b	RTL8188CU
 
 /* Tripp-Lite products */
 product TRIPPLITE U209		0x2008	Serial
 
 /* Trumpion products */
 product TRUMPION T33520		0x1001	T33520 USB Flash Card Controller
 product TRUMPION C3310		0x1100	Comotron C3310 MP3 player
 product TRUMPION MP3		0x1200	MP3 player
 
 /* TwinMOS */
 product TWINMOS G240		0xa006	G240
 product TWINMOS MDIV		0x1325	Memory Disk IV
 
 /* Ubiquam products */
 product UBIQUAM UALL		0x3100	CDMA 1xRTT USB Modem (U-100/105/200/300/520)
 
 /* Ultima products */
 product ULTIMA 1200UBPLUS	0x4002	1200 UB Plus scanner
 
 /* UMAX products */
 product UMAX ASTRA1236U		0x0002	Astra 1236U Scanner
 product UMAX ASTRA1220U		0x0010	Astra 1220U Scanner
 product UMAX ASTRA2000U		0x0030	Astra 2000U Scanner
 product UMAX ASTRA2100U		0x0130	Astra 2100U Scanner
 product UMAX ASTRA2200U		0x0230	Astra 2200U Scanner
 product UMAX ASTRA3400		0x0060	Astra 3400 Scanner
 
 /* U-MEDIA Communications products */
 product UMEDIA TEW444UBEU	0x3006	TEW-444UB EU
 product UMEDIA TEW444UBEU_NF	0x3007	TEW-444UB EU (no firmware)
 product UMEDIA TEW429UB_A	0x300a	TEW-429UB_A
 product UMEDIA TEW429UB		0x300b	TEW-429UB
 product UMEDIA TEW429UBC1	0x300d	TEW-429UB C1
 product UMEDIA RT2870_1		0x300e	RT2870
 product UMEDIA ALL0298V2	0x3204	ALL0298 v2
 product UMEDIA AR5523_2		0x3205	AR5523
 product UMEDIA AR5523_2_NF	0x3206	AR5523 (no firmware)
 
 /* Universal Access products */
 product UNIACCESS PANACHE	0x0101	Panache Surf USB ISDN Adapter
 
 /* Unknown products */
 product UNKNOWN4 NF_RIC		0x0001	FTDI compatible adapter
 
 /* USI products */
 product USI MC60		0x10c5	MC60 Serial
 
 /* U.S. Robotics products */
 product USR USR5422		0x0118	USR5422 WLAN
 product USR USR5423		0x0121	USR5423 WLAN
 
 /* VIA Technologies products */
 product VIA USB2IDEBRIDGE	0x6204	USB 2.0 IDE Bridge
 
 /* VIA Labs */
 product VIALABS USB30SATABRIDGE	0x0700	USB 3.0 SATA Bridge
 
 /* Vaisala products */
 product VAISALA CABLE		0x0200	USB Interface cable
 
 /* Vertex products */
 product VERTEX VW110L		0x0100	Vertex VW110L modem
 
 /* VidzMedia products */
 product VIDZMEDIA MONSTERTV	0x4fb1	MonsterTV P2H
 
 /* Vision products */
 product VISION VC6452V002	0x0002	CPiA Camera
 
 /* Visioneer products */
 product VISIONEER 7600		0x0211	OneTouch 7600
 product VISIONEER 5300		0x0221	OneTouch 5300
 product VISIONEER 3000		0x0224	Scanport 3000
 product VISIONEER 6100		0x0231	OneTouch 6100
 product VISIONEER 6200		0x0311	OneTouch 6200
 product VISIONEER 8100		0x0321	OneTouch 8100
 product VISIONEER 8600		0x0331	OneTouch 8600
 
 /* Vivitar products */
 product VIVITAR 35XX		0x0003	Vivicam 35Xx
 
 /* VTech products */
 product VTECH RT2570		0x3012	RT2570
 product VTECH ZD1211B		0x3014	ZD1211B
 
 /* Wacom products */
 product WACOM CT0405U		0x0000	CT-0405-U Tablet
 product WACOM GRAPHIRE		0x0010	Graphire
 product WACOM GRAPHIRE3_4X5	0x0013	Graphire 3 4x5
 product WACOM INTUOSA5		0x0021	Intuos A5
 product WACOM GD0912U		0x0022	Intuos 9x12 Graphics Tablet
 
 /* WAGO Kontakttechnik GmbH products */
 product WAGO SERVICECABLE	0x07a6	USB Service Cable 750-923
 
 /* WaveSense products */
 product WAVESENSE JAZZ		0xaaaa	Jazz blood glucose meter
 
 /* WCH products */
 product WCH CH341SER		0x5523	CH341/CH340 USB-Serial Bridge
 product WCH2 DUMMY		0x0000	Dummy product
 product WCH2 CH341SER_2		0x5523	CH341/CH340 USB-Serial Bridge
 product WCH2 CH341SER		0x7523	CH341/CH340 USB-Serial Bridge
 product WCH2 U2M		0X752d	CH345 USB2.0-MIDI
 
 /* West Mountain Radio products */
 product WESTMOUNTAIN RIGBLASTER_ADVANTAGE	0x0003	RIGblaster Advantage
 
 /* Western Digital products */
 product WESTERN COMBO		0x0200	Firewire USB Combo
 product WESTERN EXTHDD		0x0400	External HDD
 product WESTERN HUB		0x0500	USB HUB
 product WESTERN MYBOOK		0x0901	MyBook External HDD
 product WESTERN MYPASSPORT_00	0x0704	MyPassport External HDD
+product WESTERN MYPASSPORT_11	0x0741	MyPassport External HDD
 product WESTERN MYPASSPORT_01	0x0746	MyPassport External HDD
 product WESTERN MYPASSPORT_02	0x0748	MyPassport External HDD
 product WESTERN MYPASSPORT_03	0x074A	MyPassport External HDD
 product WESTERN MYPASSPORT_04	0x074C	MyPassport External HDD
 product WESTERN MYPASSPORT_05	0x074E	MyPassport External HDD
 product WESTERN MYPASSPORT_06	0x07A6	MyPassport External HDD
 product WESTERN MYPASSPORT_07	0x07A8	MyPassport External HDD
 product WESTERN MYPASSPORT_08	0x07AA	MyPassport External HDD
 product WESTERN MYPASSPORT_09	0x07AC	MyPassport External HDD
 product WESTERN MYPASSPORT_10	0x07AE	MyPassport External HDD
 product WESTERN MYPASSPORTES_00	0x070A	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_01	0x071A	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_02	0x0730	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_03	0x0732	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_04	0x0740	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_05	0x0742	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_06	0x0750	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_07	0x0752	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_08	0x07A0	MyPassport Essential External HDD
 product WESTERN MYPASSPORTES_09	0x07A2	MyPassport Essential External HDD
 
 /* WeTelecom products */
 product WETELECOM WM_D200	0x6801	WM-D200
 
 /* WIENER Plein & Baus GmbH products */
 product WIENERPLEINBAUS PL512	0x0010	PL512 PSU
 product WIENERPLEINBAUS RCM	0x0011	RCM Remote Control
 product WIENERPLEINBAUS MPOD	0x0012	MPOD PSU
 product WIENERPLEINBAUS CML	0x0015	CML Data Logger
 
 /* Windbond Electronics */
 product WINBOND UH104		0x5518	4-port USB Hub
 
 /* WinMaxGroup products */
 product WINMAXGROUP FLASH64MC	0x6660	USB Flash Disk 64M-C
 
 /* Wistron NeWeb products */
 product WISTRONNEWEB UR045G	0x0427	PrismGT USB 2.0 WLAN
 product WISTRONNEWEB UR055G	0x0711	UR055G
 product WISTRONNEWEB AR5523_1	0x0826	AR5523
 product WISTRONNEWEB AR5523_1_NF	0x0827	AR5523 (no firmware)
 product WISTRONNEWEB AR5523_2	0x082a	AR5523
 product WISTRONNEWEB AR5523_2_NF	0x0829	AR5523 (no firmware)
 
 /* Xerox products */
 product XEROX WCM15		0xffef	WorkCenter M15
 
 /* Xirlink products */
 product XIRLINK PCCAM		0x8080	IBM PC Camera
 
 /* Xyratex products */
 product XYRATEX PRISM_GT_1	0x2000	PrismGT USB 2.0 WLAN
 product XYRATEX PRISM_GT_2	0x2002	PrismGT USB 2.0 WLAN
 
 /* Yamaha products */
 product YAMAHA UX256		0x1000	UX256 MIDI I/F
 product YAMAHA UX96		0x1008	UX96 MIDI I/F
 product YAMAHA RPU200		0x3104	RP-U200
 product YAMAHA RTA54I		0x4000	NetVolante RTA54i Broadband&ISDN Router
 product YAMAHA RTW65B		0x4001	NetVolante RTW65b Broadband Wireless Router
 product YAMAHA RTW65I		0x4002	NetVolante RTW65i Broadband&ISDN Wireless Router
 product YAMAHA RTA55I		0x4004	NetVolante RTA55i Broadband VoIP Router
 
 /* Yano products */
 product YANO U640MO		0x0101	U640MO-03
 product YANO FW800HD		0x05fc	METALWEAR-HDD
 
 /* Y.C. Cable products */
 product YCCABLE PL2303		0x0fba	PL2303 Serial
 
 /* Y-E Data products */
 product YEDATA FLASHBUSTERU	0x0000	Flashbuster-U
 
 /* Yiso Wireless Co. products */
 product	YISO C893		0xc893	CDMA 2000 1xEVDO PC Card
 
 /* Z-Com products */
 product ZCOM M4Y750		0x0001	M4Y-750
 product ZCOM XI725		0x0002	XI-725/726
 product ZCOM XI735		0x0005	XI-735
 product ZCOM XG703A		0x0008	PrismGT USB 2.0 WLAN
 product ZCOM ZD1211		0x0011	ZD1211
 product ZCOM AR5523		0x0012	AR5523
 product ZCOM AR5523_NF		0x0013	AR5523 driver (no firmware)
 product ZCOM XM142		0x0015	XM-142
 product ZCOM ZD1211B		0x001a	ZD1211B
 product ZCOM RT2870_1		0x0022	RT2870
 product ZCOM RT2870_2		0x0025	RT2870
 
 /* Zinwell products */
 product ZINWELL RT2570		0x0260	RT2570
 product ZINWELL RT2870_1	0x0280	RT2870
 product ZINWELL RT2870_2	0x0282	RT2870
 product ZINWELL RT3072_1	0x0283	RT3072
 product ZINWELL RT3072_2	0x0284	RT3072
 product ZINWELL RT3070		0x5257	RT3070
 
 /* Zoom Telephonics, Inc. products */
 product ZOOM 2986L		0x9700	2986L Fax modem
 
 /* Zoran Microelectronics products */
 product ZORAN EX20DSC		0x4343	Digital Camera EX-20 DSC
 
 /* Zydas Technology Corporation products */
 product ZYDAS ZD1211		0x1211	ZD1211 WLAN abg
 product ZYDAS ZD1211B		0x1215	ZD1211B
 
 /* ZyXEL Communication Co. products */
 product ZYXEL OMNI56K		0x1500	Omni 56K Plus
 product ZYXEL 980N		0x2011	Scorpion-980N keyboard
 product ZYXEL ZYAIRG220		0x3401	ZyAIR G-220
 product ZYXEL G200V2		0x3407	G-200 v2
 product ZYXEL AG225H		0x3409	AG-225H
 product ZYXEL M202		0x340a	M-202
 product ZYXEL G220V2		0x340f	G-220 v2
 product ZYXEL G202		0x3410	G-202
 product ZYXEL RT2870_1		0x3416	RT2870
 product ZYXEL RT2870_2		0x341a	RT2870
 product ZYXEL RT3070		0x341e	NWD2105
 product ZYXEL RTL8192CU		0x341f	RTL8192CU
 product ZYXEL NWD2705		0x3421	NWD2705
Index: projects/arm_intrng/sys/fs/nfsclient/nfs_clvnops.c
===================================================================
--- projects/arm_intrng/sys/fs/nfsclient/nfs_clvnops.c	(revision 276247)
+++ projects/arm_intrng/sys/fs/nfsclient/nfs_clvnops.c	(revision 276248)
@@ -1,3537 +1,3523 @@
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * Rick Macklem at The University of Guelph.
  *
  * 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.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  *	from nfs_vnops.c	8.16 (Berkeley) 5/27/95
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 /*
  * vnode op calls for Sun NFS version 2, 3 and 4
  */
 
 #include "opt_inet.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 
 #include 
 
 #ifdef KDTRACE_HOOKS
 #include 
 
 dtrace_nfsclient_accesscache_flush_probe_func_t
 		dtrace_nfscl_accesscache_flush_done_probe;
 uint32_t	nfscl_accesscache_flush_done_id;
 
 dtrace_nfsclient_accesscache_get_probe_func_t
 		dtrace_nfscl_accesscache_get_hit_probe,
 		dtrace_nfscl_accesscache_get_miss_probe;
 uint32_t	nfscl_accesscache_get_hit_id;
 uint32_t	nfscl_accesscache_get_miss_id;
 
 dtrace_nfsclient_accesscache_load_probe_func_t
 		dtrace_nfscl_accesscache_load_done_probe;
 uint32_t	nfscl_accesscache_load_done_id;
 #endif /* !KDTRACE_HOOKS */
 
 /* Defs */
 #define	TRUE	1
 #define	FALSE	0
 
 extern struct nfsstats newnfsstats;
 extern int nfsrv_useacl;
 extern int nfscl_debuglevel;
 MALLOC_DECLARE(M_NEWNFSREQ);
 
 /*
  * Ifdef for FreeBSD-current merged buffer cache. It is unfortunate that these
  * calls are not in getblk() and brelse() so that they would not be necessary
  * here.
  */
 #ifndef B_VMIO
 #define	vfs_busy_pages(bp, f)
 #endif
 
 static vop_read_t	nfsfifo_read;
 static vop_write_t	nfsfifo_write;
 static vop_close_t	nfsfifo_close;
 static int	nfs_setattrrpc(struct vnode *, struct vattr *, struct ucred *,
 		    struct thread *);
 static vop_lookup_t	nfs_lookup;
 static vop_create_t	nfs_create;
 static vop_mknod_t	nfs_mknod;
 static vop_open_t	nfs_open;
 static vop_pathconf_t	nfs_pathconf;
 static vop_close_t	nfs_close;
 static vop_access_t	nfs_access;
 static vop_getattr_t	nfs_getattr;
 static vop_setattr_t	nfs_setattr;
 static vop_read_t	nfs_read;
 static vop_fsync_t	nfs_fsync;
 static vop_remove_t	nfs_remove;
 static vop_link_t	nfs_link;
 static vop_rename_t	nfs_rename;
 static vop_mkdir_t	nfs_mkdir;
 static vop_rmdir_t	nfs_rmdir;
 static vop_symlink_t	nfs_symlink;
 static vop_readdir_t	nfs_readdir;
 static vop_strategy_t	nfs_strategy;
 static vop_lock1_t	nfs_lock1;
 static	int	nfs_lookitup(struct vnode *, char *, int,
 		    struct ucred *, struct thread *, struct nfsnode **);
 static	int	nfs_sillyrename(struct vnode *, struct vnode *,
 		    struct componentname *);
 static vop_access_t	nfsspec_access;
 static vop_readlink_t	nfs_readlink;
 static vop_print_t	nfs_print;
 static vop_advlock_t	nfs_advlock;
 static vop_advlockasync_t nfs_advlockasync;
 static vop_getacl_t nfs_getacl;
 static vop_setacl_t nfs_setacl;
 
 /*
  * Global vfs data structures for nfs
  */
 struct vop_vector newnfs_vnodeops = {
 	.vop_default =		&default_vnodeops,
 	.vop_access =		nfs_access,
 	.vop_advlock =		nfs_advlock,
 	.vop_advlockasync =	nfs_advlockasync,
 	.vop_close =		nfs_close,
 	.vop_create =		nfs_create,
 	.vop_fsync =		nfs_fsync,
 	.vop_getattr =		nfs_getattr,
 	.vop_getpages =		ncl_getpages,
 	.vop_putpages =		ncl_putpages,
 	.vop_inactive =		ncl_inactive,
 	.vop_link =		nfs_link,
 	.vop_lock1 = 		nfs_lock1,
 	.vop_lookup =		nfs_lookup,
 	.vop_mkdir =		nfs_mkdir,
 	.vop_mknod =		nfs_mknod,
 	.vop_open =		nfs_open,
 	.vop_pathconf =		nfs_pathconf,
 	.vop_print =		nfs_print,
 	.vop_read =		nfs_read,
 	.vop_readdir =		nfs_readdir,
 	.vop_readlink =		nfs_readlink,
 	.vop_reclaim =		ncl_reclaim,
 	.vop_remove =		nfs_remove,
 	.vop_rename =		nfs_rename,
 	.vop_rmdir =		nfs_rmdir,
 	.vop_setattr =		nfs_setattr,
 	.vop_strategy =		nfs_strategy,
 	.vop_symlink =		nfs_symlink,
 	.vop_write =		ncl_write,
 	.vop_getacl =		nfs_getacl,
 	.vop_setacl =		nfs_setacl,
 };
 
 struct vop_vector newnfs_fifoops = {
 	.vop_default =		&fifo_specops,
 	.vop_access =		nfsspec_access,
 	.vop_close =		nfsfifo_close,
 	.vop_fsync =		nfs_fsync,
 	.vop_getattr =		nfs_getattr,
 	.vop_inactive =		ncl_inactive,
 	.vop_print =		nfs_print,
 	.vop_read =		nfsfifo_read,
 	.vop_reclaim =		ncl_reclaim,
 	.vop_setattr =		nfs_setattr,
 	.vop_write =		nfsfifo_write,
 };
 
 static int nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp,
     struct componentname *cnp, struct vattr *vap);
 static int nfs_removerpc(struct vnode *dvp, struct vnode *vp, char *name,
     int namelen, struct ucred *cred, struct thread *td);
 static int nfs_renamerpc(struct vnode *fdvp, struct vnode *fvp,
     char *fnameptr, int fnamelen, struct vnode *tdvp, struct vnode *tvp,
     char *tnameptr, int tnamelen, struct ucred *cred, struct thread *td);
 static int nfs_renameit(struct vnode *sdvp, struct vnode *svp,
     struct componentname *scnp, struct sillyrename *sp);
 
 /*
  * Global variables
  */
 #define	DIRHDSIZ	(sizeof (struct dirent) - (MAXNAMLEN + 1))
 
 SYSCTL_DECL(_vfs_nfs);
 
 static int	nfsaccess_cache_timeout = NFS_MAXATTRTIMO;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_timeout, CTLFLAG_RW,
 	   &nfsaccess_cache_timeout, 0, "NFS ACCESS cache timeout");
 
 static int	nfs_prime_access_cache = 0;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, prime_access_cache, CTLFLAG_RW,
 	   &nfs_prime_access_cache, 0,
 	   "Prime NFS ACCESS cache when fetching attributes");
 
 static int	newnfs_commit_on_close = 0;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, commit_on_close, CTLFLAG_RW,
     &newnfs_commit_on_close, 0, "write+commit on close, else only write");
 
 static int	nfs_clean_pages_on_close = 1;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, clean_pages_on_close, CTLFLAG_RW,
 	   &nfs_clean_pages_on_close, 0, "NFS clean dirty pages on close");
 
 int newnfs_directio_enable = 0;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_enable, CTLFLAG_RW,
 	   &newnfs_directio_enable, 0, "Enable NFS directio");
 
 int nfs_keep_dirty_on_error;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_keep_dirty_on_error, CTLFLAG_RW,
     &nfs_keep_dirty_on_error, 0, "Retry pageout if error returned");
 
 /*
  * This sysctl allows other processes to mmap a file that has been opened
  * O_DIRECT by a process.  In general, having processes mmap the file while
  * Direct IO is in progress can lead to Data Inconsistencies.  But, we allow
  * this by default to prevent DoS attacks - to prevent a malicious user from
  * opening up files O_DIRECT preventing other users from mmap'ing these
  * files.  "Protected" environments where stricter consistency guarantees are
  * required can disable this knob.  The process that opened the file O_DIRECT
  * cannot mmap() the file, because mmap'ed IO on an O_DIRECT open() is not
  * meaningful.
  */
 int newnfs_directio_allow_mmap = 1;
 SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap, CTLFLAG_RW,
 	   &newnfs_directio_allow_mmap, 0, "Enable mmaped IO on file with O_DIRECT opens");
 
 #if 0
 SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_hits, CTLFLAG_RD,
 	   &newnfsstats.accesscache_hits, 0, "NFS ACCESS cache hit count");
 
 SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_misses, CTLFLAG_RD,
 	   &newnfsstats.accesscache_misses, 0, "NFS ACCESS cache miss count");
 #endif
 
 #define	NFSACCESS_ALL (NFSACCESS_READ | NFSACCESS_MODIFY		\
 			 | NFSACCESS_EXTEND | NFSACCESS_EXECUTE	\
 			 | NFSACCESS_DELETE | NFSACCESS_LOOKUP)
 
 /*
  * SMP Locking Note :
  * The list of locks after the description of the lock is the ordering
  * of other locks acquired with the lock held.
  * np->n_mtx : Protects the fields in the nfsnode.
        VM Object Lock
        VI_MTX (acquired indirectly)
  * nmp->nm_mtx : Protects the fields in the nfsmount.
        rep->r_mtx
  * ncl_iod_mutex : Global lock, protects shared nfsiod state.
  * nfs_reqq_mtx : Global lock, protects the nfs_reqq list.
        nmp->nm_mtx
        rep->r_mtx
  * rep->r_mtx : Protects the fields in an nfsreq.
  */
 
 static int
 nfs34_access_otw(struct vnode *vp, int wmode, struct thread *td,
     struct ucred *cred, u_int32_t *retmode)
 {
 	int error = 0, attrflag, i, lrupos;
 	u_int32_t rmode;
 	struct nfsnode *np = VTONFS(vp);
 	struct nfsvattr nfsva;
 
 	error = nfsrpc_accessrpc(vp, wmode, cred, td, &nfsva, &attrflag,
 	    &rmode, NULL);
 	if (attrflag)
 		(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
 	if (!error) {
 		lrupos = 0;
 		mtx_lock(&np->n_mtx);
 		for (i = 0; i < NFS_ACCESSCACHESIZE; i++) {
 			if (np->n_accesscache[i].uid == cred->cr_uid) {
 				np->n_accesscache[i].mode = rmode;
 				np->n_accesscache[i].stamp = time_second;
 				break;
 			}
 			if (i > 0 && np->n_accesscache[i].stamp <
 			    np->n_accesscache[lrupos].stamp)
 				lrupos = i;
 		}
 		if (i == NFS_ACCESSCACHESIZE) {
 			np->n_accesscache[lrupos].uid = cred->cr_uid;
 			np->n_accesscache[lrupos].mode = rmode;
 			np->n_accesscache[lrupos].stamp = time_second;
 		}
 		mtx_unlock(&np->n_mtx);
 		if (retmode != NULL)
 			*retmode = rmode;
 		KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, cred->cr_uid, rmode, 0);
 	} else if (NFS_ISV4(vp)) {
 		error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
 	}
 #ifdef KDTRACE_HOOKS
 	if (error != 0)
 		KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, cred->cr_uid, 0,
 		    error);
 #endif
 	return (error);
 }
 
 /*
  * nfs access vnode op.
  * For nfs version 2, just return ok. File accesses may fail later.
  * For nfs version 3, use the access rpc to check accessibility. If file modes
  * are changed on the server, accesses might still fail later.
  */
 static int
 nfs_access(struct vop_access_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	int error = 0, i, gotahit;
 	u_int32_t mode, wmode, rmode;
 	int v34 = NFS_ISV34(vp);
 	struct nfsnode *np = VTONFS(vp);
 
 	/*
 	 * Disallow write attempts on filesystems mounted read-only;
 	 * unless the file is a socket, fifo, or a block or character
 	 * device resident on the filesystem.
 	 */
 	if ((ap->a_accmode & (VWRITE | VAPPEND | VWRITE_NAMED_ATTRS |
 	    VDELETE_CHILD | VWRITE_ATTRIBUTES | VDELETE | VWRITE_ACL |
 	    VWRITE_OWNER)) != 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0) {
 		switch (vp->v_type) {
 		case VREG:
 		case VDIR:
 		case VLNK:
 			return (EROFS);
 		default:
 			break;
 		}
 	}
 	/*
 	 * For nfs v3 or v4, check to see if we have done this recently, and if
 	 * so return our cached result instead of making an ACCESS call.
 	 * If not, do an access rpc, otherwise you are stuck emulating
 	 * ufs_access() locally using the vattr. This may not be correct,
 	 * since the server may apply other access criteria such as
 	 * client uid-->server uid mapping that we do not know about.
 	 */
 	if (v34) {
 		if (ap->a_accmode & VREAD)
 			mode = NFSACCESS_READ;
 		else
 			mode = 0;
 		if (vp->v_type != VDIR) {
 			if (ap->a_accmode & VWRITE)
 				mode |= (NFSACCESS_MODIFY | NFSACCESS_EXTEND);
 			if (ap->a_accmode & VAPPEND)
 				mode |= NFSACCESS_EXTEND;
 			if (ap->a_accmode & VEXEC)
 				mode |= NFSACCESS_EXECUTE;
 			if (ap->a_accmode & VDELETE)
 				mode |= NFSACCESS_DELETE;
 		} else {
 			if (ap->a_accmode & VWRITE)
 				mode |= (NFSACCESS_MODIFY | NFSACCESS_EXTEND);
 			if (ap->a_accmode & VAPPEND)
 				mode |= NFSACCESS_EXTEND;
 			if (ap->a_accmode & VEXEC)
 				mode |= NFSACCESS_LOOKUP;
 			if (ap->a_accmode & VDELETE)
 				mode |= NFSACCESS_DELETE;
 			if (ap->a_accmode & VDELETE_CHILD)
 				mode |= NFSACCESS_MODIFY;
 		}
 		/* XXX safety belt, only make blanket request if caching */
 		if (nfsaccess_cache_timeout > 0) {
 			wmode = NFSACCESS_READ | NFSACCESS_MODIFY |
 				NFSACCESS_EXTEND | NFSACCESS_EXECUTE |
 				NFSACCESS_DELETE | NFSACCESS_LOOKUP;
 		} else {
 			wmode = mode;
 		}
 
 		/*
 		 * Does our cached result allow us to give a definite yes to
 		 * this request?
 		 */
 		gotahit = 0;
 		mtx_lock(&np->n_mtx);
 		for (i = 0; i < NFS_ACCESSCACHESIZE; i++) {
 			if (ap->a_cred->cr_uid == np->n_accesscache[i].uid) {
 			    if (time_second < (np->n_accesscache[i].stamp
 				+ nfsaccess_cache_timeout) &&
 				(np->n_accesscache[i].mode & mode) == mode) {
 				NFSINCRGLOBAL(newnfsstats.accesscache_hits);
 				gotahit = 1;
 			    }
 			    break;
 			}
 		}
 		mtx_unlock(&np->n_mtx);
 #ifdef KDTRACE_HOOKS
 		if (gotahit != 0)
 			KDTRACE_NFS_ACCESSCACHE_GET_HIT(vp,
 			    ap->a_cred->cr_uid, mode);
 		else
 			KDTRACE_NFS_ACCESSCACHE_GET_MISS(vp,
 			    ap->a_cred->cr_uid, mode);
 #endif
 		if (gotahit == 0) {
 			/*
 			 * Either a no, or a don't know.  Go to the wire.
 			 */
 			NFSINCRGLOBAL(newnfsstats.accesscache_misses);
 		        error = nfs34_access_otw(vp, wmode, ap->a_td,
 			    ap->a_cred, &rmode);
 			if (!error &&
 			    (rmode & mode) != mode)
 				error = EACCES;
 		}
 		return (error);
 	} else {
 		if ((error = nfsspec_access(ap)) != 0) {
 			return (error);
 		}
 		/*
 		 * Attempt to prevent a mapped root from accessing a file
 		 * which it shouldn't.  We try to read a byte from the file
 		 * if the user is root and the file is not zero length.
 		 * After calling nfsspec_access, we should have the correct
 		 * file size cached.
 		 */
 		mtx_lock(&np->n_mtx);
 		if (ap->a_cred->cr_uid == 0 && (ap->a_accmode & VREAD)
 		    && VTONFS(vp)->n_size > 0) {
 			struct iovec aiov;
 			struct uio auio;
 			char buf[1];
 
 			mtx_unlock(&np->n_mtx);
 			aiov.iov_base = buf;
 			aiov.iov_len = 1;
 			auio.uio_iov = &aiov;
 			auio.uio_iovcnt = 1;
 			auio.uio_offset = 0;
 			auio.uio_resid = 1;
 			auio.uio_segflg = UIO_SYSSPACE;
 			auio.uio_rw = UIO_READ;
 			auio.uio_td = ap->a_td;
 
 			if (vp->v_type == VREG)
 				error = ncl_readrpc(vp, &auio, ap->a_cred);
 			else if (vp->v_type == VDIR) {
 				char* bp;
 				bp = malloc(NFS_DIRBLKSIZ, M_TEMP, M_WAITOK);
 				aiov.iov_base = bp;
 				aiov.iov_len = auio.uio_resid = NFS_DIRBLKSIZ;
 				error = ncl_readdirrpc(vp, &auio, ap->a_cred,
 				    ap->a_td);
 				free(bp, M_TEMP);
 			} else if (vp->v_type == VLNK)
 				error = ncl_readlinkrpc(vp, &auio, ap->a_cred);
 			else
 				error = EACCES;
 		} else
 			mtx_unlock(&np->n_mtx);
 		return (error);
 	}
 }
 
 
 /*
  * nfs open vnode op
  * Check to see if the type is ok
  * and that deletion is not in progress.
  * For paged in text files, you will need to flush the page cache
  * if consistency is lost.
  */
 /* ARGSUSED */
 static int
 nfs_open(struct vop_open_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct nfsnode *np = VTONFS(vp);
 	struct vattr vattr;
 	int error;
 	int fmode = ap->a_mode;
 	struct ucred *cred;
 
 	if (vp->v_type != VREG && vp->v_type != VDIR && vp->v_type != VLNK)
 		return (EOPNOTSUPP);
 
 	/*
 	 * For NFSv4, we need to do the Open Op before cache validation,
 	 * so that we conform to RFC3530 Sec. 9.3.1.
 	 */
 	if (NFS_ISV4(vp)) {
 		error = nfsrpc_open(vp, fmode, ap->a_cred, ap->a_td);
 		if (error) {
 			error = nfscl_maperr(ap->a_td, error, (uid_t)0,
 			    (gid_t)0);
 			return (error);
 		}
 	}
 
 	/*
 	 * Now, if this Open will be doing reading, re-validate/flush the
 	 * cache, so that Close/Open coherency is maintained.
 	 */
 	mtx_lock(&np->n_mtx);
 	if (np->n_flag & NMODIFIED) {
 		mtx_unlock(&np->n_mtx);
 		error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
 		if (error == EINTR || error == EIO) {
 			if (NFS_ISV4(vp))
 				(void) nfsrpc_close(vp, 0, ap->a_td);
 			return (error);
 		}
 		mtx_lock(&np->n_mtx);
 		np->n_attrstamp = 0;
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
 		if (vp->v_type == VDIR)
 			np->n_direofoffset = 0;
 		mtx_unlock(&np->n_mtx);
 		error = VOP_GETATTR(vp, &vattr, ap->a_cred);
 		if (error) {
 			if (NFS_ISV4(vp))
 				(void) nfsrpc_close(vp, 0, ap->a_td);
 			return (error);
 		}
 		mtx_lock(&np->n_mtx);
 		np->n_mtime = vattr.va_mtime;
 		if (NFS_ISV4(vp))
 			np->n_change = vattr.va_filerev;
 	} else {
 		mtx_unlock(&np->n_mtx);
 		error = VOP_GETATTR(vp, &vattr, ap->a_cred);
 		if (error) {
 			if (NFS_ISV4(vp))
 				(void) nfsrpc_close(vp, 0, ap->a_td);
 			return (error);
 		}
 		mtx_lock(&np->n_mtx);
 		if ((NFS_ISV4(vp) && np->n_change != vattr.va_filerev) ||
 		    NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) {
 			if (vp->v_type == VDIR)
 				np->n_direofoffset = 0;
 			mtx_unlock(&np->n_mtx);
 			error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
 			if (error == EINTR || error == EIO) {
 				if (NFS_ISV4(vp))
 					(void) nfsrpc_close(vp, 0, ap->a_td);
 				return (error);
 			}
 			mtx_lock(&np->n_mtx);
 			np->n_mtime = vattr.va_mtime;
 			if (NFS_ISV4(vp))
 				np->n_change = vattr.va_filerev;
 		}
 	}
 
 	/*
 	 * If the object has >= 1 O_DIRECT active opens, we disable caching.
 	 */
 	if (newnfs_directio_enable && (fmode & O_DIRECT) &&
 	    (vp->v_type == VREG)) {
 		if (np->n_directio_opens == 0) {
 			mtx_unlock(&np->n_mtx);
 			error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
 			if (error) {
 				if (NFS_ISV4(vp))
 					(void) nfsrpc_close(vp, 0, ap->a_td);
 				return (error);
 			}
 			mtx_lock(&np->n_mtx);
 			np->n_flag |= NNONCACHE;
 		}
 		np->n_directio_opens++;
 	}
 
 	/* If opened for writing via NFSv4.1 or later, mark that for pNFS. */
 	if (NFSHASPNFS(VFSTONFS(vp->v_mount)) && (fmode & FWRITE) != 0)
 		np->n_flag |= NWRITEOPENED;
 
 	/*
 	 * If this is an open for writing, capture a reference to the
 	 * credentials, so they can be used by ncl_putpages(). Using
 	 * these write credentials is preferable to the credentials of
 	 * whatever thread happens to be doing the VOP_PUTPAGES() since
 	 * the write RPCs are less likely to fail with EACCES.
 	 */
 	if ((fmode & FWRITE) != 0) {
 		cred = np->n_writecred;
 		np->n_writecred = crhold(ap->a_cred);
 	} else
 		cred = NULL;
 	mtx_unlock(&np->n_mtx);
 
 	if (cred != NULL)
 		crfree(cred);
 	vnode_create_vobject(vp, vattr.va_size, ap->a_td);
 	return (0);
 }
 
 /*
  * nfs close vnode op
  * What an NFS client should do upon close after writing is a debatable issue.
  * Most NFS clients push delayed writes to the server upon close, basically for
  * two reasons:
  * 1 - So that any write errors may be reported back to the client process
  *     doing the close system call. By far the two most likely errors are
  *     NFSERR_NOSPC and NFSERR_DQUOT to indicate space allocation failure.
  * 2 - To put a worst case upper bound on cache inconsistency between
  *     multiple clients for the file.
  * There is also a consistency problem for Version 2 of the protocol w.r.t.
  * not being able to tell if other clients are writing a file concurrently,
  * since there is no way of knowing if the changed modify time in the reply
  * is only due to the write for this client.
  * (NFS Version 3 provides weak cache consistency data in the reply that
  *  should be sufficient to detect and handle this case.)
  *
  * The current code does the following:
  * for NFS Version 2 - play it safe and flush/invalidate all dirty buffers
  * for NFS Version 3 - flush dirty buffers to the server but don't invalidate
  *                     or commit them (this satisfies 1 and 2 except for the
  *                     case where the server crashes after this close but
  *                     before the commit RPC, which is felt to be "good
  *                     enough". Changing the last argument to ncl_flush() to
  *                     a 1 would force a commit operation, if it is felt a
  *                     commit is necessary now.
  * for NFS Version 4 - flush the dirty buffers and commit them, if
  *		       nfscl_mustflush() says this is necessary.
  *                     It is necessary if there is no write delegation held,
  *                     in order to satisfy open/close coherency.
  *                     If the file isn't cached on local stable storage,
  *                     it may be necessary in order to detect "out of space"
  *                     errors from the server, if the write delegation
  *                     issued by the server doesn't allow the file to grow.
  */
 /* ARGSUSED */
 static int
 nfs_close(struct vop_close_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct nfsnode *np = VTONFS(vp);
 	struct nfsvattr nfsva;
 	struct ucred *cred;
 	int error = 0, ret, localcred = 0;
 	int fmode = ap->a_fflag;
 
 	if ((vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF))
 		return (0);
 	/*
 	 * During shutdown, a_cred isn't valid, so just use root.
 	 */
 	if (ap->a_cred == NOCRED) {
 		cred = newnfs_getcred();
 		localcred = 1;
 	} else {
 		cred = ap->a_cred;
 	}
 	if (vp->v_type == VREG) {
 	    /*
 	     * Examine and clean dirty pages, regardless of NMODIFIED.
 	     * This closes a major hole in close-to-open consistency.
 	     * We want to push out all dirty pages (and buffers) on
 	     * close, regardless of whether they were dirtied by
 	     * mmap'ed writes or via write().
 	     */
 	    if (nfs_clean_pages_on_close && vp->v_object) {
 		VM_OBJECT_WLOCK(vp->v_object);
 		vm_object_page_clean(vp->v_object, 0, 0, 0);
 		VM_OBJECT_WUNLOCK(vp->v_object);
 	    }
 	    mtx_lock(&np->n_mtx);
 	    if (np->n_flag & NMODIFIED) {
 		mtx_unlock(&np->n_mtx);
 		if (NFS_ISV3(vp)) {
 		    /*
 		     * Under NFSv3 we have dirty buffers to dispose of.  We
 		     * must flush them to the NFS server.  We have the option
 		     * of waiting all the way through the commit rpc or just
 		     * waiting for the initial write.  The default is to only
 		     * wait through the initial write so the data is in the
 		     * server's cache, which is roughly similar to the state
 		     * a standard disk subsystem leaves the file in on close().
 		     *
 		     * We cannot clear the NMODIFIED bit in np->n_flag due to
 		     * potential races with other processes, and certainly
 		     * cannot clear it if we don't commit.
 		     * These races occur when there is no longer the old
 		     * traditional vnode locking implemented for Vnode Ops.
 		     */
 		    int cm = newnfs_commit_on_close ? 1 : 0;
 		    error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td, cm, 0);
 		    /* np->n_flag &= ~NMODIFIED; */
 		} else if (NFS_ISV4(vp)) { 
 			if (nfscl_mustflush(vp) != 0) {
 				int cm = newnfs_commit_on_close ? 1 : 0;
 				error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td,
 				    cm, 0);
 				/*
 				 * as above w.r.t races when clearing
 				 * NMODIFIED.
 				 * np->n_flag &= ~NMODIFIED;
 				 */
 			}
 		} else
 		    error = ncl_vinvalbuf(vp, V_SAVE, ap->a_td, 1);
 		mtx_lock(&np->n_mtx);
 	    }
  	    /* 
  	     * Invalidate the attribute cache in all cases.
  	     * An open is going to fetch fresh attrs any way, other procs
  	     * on this node that have file open will be forced to do an 
  	     * otw attr fetch, but this is safe.
 	     * --> A user found that their RPC count dropped by 20% when
 	     *     this was commented out and I can't see any requirement
 	     *     for it, so I've disabled it when negative lookups are
 	     *     enabled. (What does this have to do with negative lookup
 	     *     caching? Well nothing, except it was reported by the
 	     *     same user that needed negative lookup caching and I wanted
 	     *     there to be a way to disable it to see if it
 	     *     is the cause of some caching/coherency issue that might
 	     *     crop up.)
  	     */
 	    if (VFSTONFS(vp->v_mount)->nm_negnametimeo == 0) {
 		    np->n_attrstamp = 0;
 		    KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
 	    }
 	    if (np->n_flag & NWRITEERR) {
 		np->n_flag &= ~NWRITEERR;
 		error = np->n_error;
 	    }
 	    mtx_unlock(&np->n_mtx);
 	}
 
 	if (NFS_ISV4(vp)) {
 		/*
 		 * Get attributes so "change" is up to date.
 		 */
 		if (error == 0 && nfscl_mustflush(vp) != 0 &&
 		    vp->v_type == VREG &&
 		    (VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOCTO) == 0) {
 			ret = nfsrpc_getattr(vp, cred, ap->a_td, &nfsva,
 			    NULL);
 			if (!ret) {
 				np->n_change = nfsva.na_filerev;
 				(void) nfscl_loadattrcache(&vp, &nfsva, NULL,
 				    NULL, 0, 0);
 			}
 		}
 
 		/*
 		 * and do the close.
 		 */
 		ret = nfsrpc_close(vp, 0, ap->a_td);
 		if (!error && ret)
 			error = ret;
 		if (error)
 			error = nfscl_maperr(ap->a_td, error, (uid_t)0,
 			    (gid_t)0);
 	}
 	if (newnfs_directio_enable)
 		KASSERT((np->n_directio_asyncwr == 0),
 			("nfs_close: dirty unflushed (%d) directio buffers\n",
 			 np->n_directio_asyncwr));
 	if (newnfs_directio_enable && (fmode & O_DIRECT) && (vp->v_type == VREG)) {
 		mtx_lock(&np->n_mtx);
 		KASSERT((np->n_directio_opens > 0), 
 			("nfs_close: unexpectedly value (0) of n_directio_opens\n"));
 		np->n_directio_opens--;
 		if (np->n_directio_opens == 0)
 			np->n_flag &= ~NNONCACHE;
 		mtx_unlock(&np->n_mtx);
 	}
 	if (localcred)
 		NFSFREECRED(cred);
 	return (error);
 }
 
 /*
  * nfs getattr call from vfs.
  */
 static int
 nfs_getattr(struct vop_getattr_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct thread *td = curthread;	/* XXX */
 	struct nfsnode *np = VTONFS(vp);
 	int error = 0;
 	struct nfsvattr nfsva;
 	struct vattr *vap = ap->a_vap;
 	struct vattr vattr;
 
 	/*
 	 * Update local times for special files.
 	 */
 	mtx_lock(&np->n_mtx);
 	if (np->n_flag & (NACC | NUPD))
 		np->n_flag |= NCHG;
 	mtx_unlock(&np->n_mtx);
 	/*
 	 * First look in the cache.
 	 */
 	if (ncl_getattrcache(vp, &vattr) == 0) {
 		vap->va_type = vattr.va_type;
 		vap->va_mode = vattr.va_mode;
 		vap->va_nlink = vattr.va_nlink;
 		vap->va_uid = vattr.va_uid;
 		vap->va_gid = vattr.va_gid;
 		vap->va_fsid = vattr.va_fsid;
 		vap->va_fileid = vattr.va_fileid;
 		vap->va_size = vattr.va_size;
 		vap->va_blocksize = vattr.va_blocksize;
 		vap->va_atime = vattr.va_atime;
 		vap->va_mtime = vattr.va_mtime;
 		vap->va_ctime = vattr.va_ctime;
 		vap->va_gen = vattr.va_gen;
 		vap->va_flags = vattr.va_flags;
 		vap->va_rdev = vattr.va_rdev;
 		vap->va_bytes = vattr.va_bytes;
 		vap->va_filerev = vattr.va_filerev;
 		/*
 		 * Get the local modify time for the case of a write
 		 * delegation.
 		 */
 		nfscl_deleggetmodtime(vp, &vap->va_mtime);
 		return (0);
 	}
 
 	if (NFS_ISV34(vp) && nfs_prime_access_cache &&
 	    nfsaccess_cache_timeout > 0) {
 		NFSINCRGLOBAL(newnfsstats.accesscache_misses);
 		nfs34_access_otw(vp, NFSACCESS_ALL, td, ap->a_cred, NULL);
 		if (ncl_getattrcache(vp, ap->a_vap) == 0) {
 			nfscl_deleggetmodtime(vp, &ap->a_vap->va_mtime);
 			return (0);
 		}
 	}
 	error = nfsrpc_getattr(vp, ap->a_cred, td, &nfsva, NULL);
 	if (!error)
 		error = nfscl_loadattrcache(&vp, &nfsva, vap, NULL, 0, 0);
 	if (!error) {
 		/*
 		 * Get the local modify time for the case of a write
 		 * delegation.
 		 */
 		nfscl_deleggetmodtime(vp, &vap->va_mtime);
 	} else if (NFS_ISV4(vp)) {
 		error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
 	}
 	return (error);
 }
 
 /*
  * nfs setattr call.
  */
 static int
 nfs_setattr(struct vop_setattr_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct nfsnode *np = VTONFS(vp);
 	struct thread *td = curthread;	/* XXX */
 	struct vattr *vap = ap->a_vap;
 	int error = 0;
 	u_quad_t tsize;
 
 #ifndef nolint
 	tsize = (u_quad_t)0;
 #endif
 
 	/*
 	 * Setting of flags and marking of atimes are not supported.
 	 */
 	if (vap->va_flags != VNOVAL)
 		return (EOPNOTSUPP);
 
 	/*
 	 * Disallow write attempts if the filesystem is mounted read-only.
 	 */
   	if ((vap->va_flags != VNOVAL || vap->va_uid != (uid_t)VNOVAL ||
 	    vap->va_gid != (gid_t)VNOVAL || vap->va_atime.tv_sec != VNOVAL ||
 	    vap->va_mtime.tv_sec != VNOVAL || vap->va_mode != (mode_t)VNOVAL) &&
 	    (vp->v_mount->mnt_flag & MNT_RDONLY))
 		return (EROFS);
 	if (vap->va_size != VNOVAL) {
  		switch (vp->v_type) {
  		case VDIR:
  			return (EISDIR);
  		case VCHR:
  		case VBLK:
  		case VSOCK:
  		case VFIFO:
 			if (vap->va_mtime.tv_sec == VNOVAL &&
 			    vap->va_atime.tv_sec == VNOVAL &&
 			    vap->va_mode == (mode_t)VNOVAL &&
 			    vap->va_uid == (uid_t)VNOVAL &&
 			    vap->va_gid == (gid_t)VNOVAL)
 				return (0);		
  			vap->va_size = VNOVAL;
  			break;
  		default:
 			/*
 			 * Disallow write attempts if the filesystem is
 			 * mounted read-only.
 			 */
 			if (vp->v_mount->mnt_flag & MNT_RDONLY)
 				return (EROFS);
 			/*
 			 *  We run vnode_pager_setsize() early (why?),
 			 * we must set np->n_size now to avoid vinvalbuf
 			 * V_SAVE races that might setsize a lower
 			 * value.
 			 */
 			mtx_lock(&np->n_mtx);
 			tsize = np->n_size;
 			mtx_unlock(&np->n_mtx);
 			error = ncl_meta_setsize(vp, ap->a_cred, td,
 			    vap->va_size);
 			mtx_lock(&np->n_mtx);
  			if (np->n_flag & NMODIFIED) {
 			    tsize = np->n_size;
 			    mtx_unlock(&np->n_mtx);
  			    if (vap->va_size == 0)
  				error = ncl_vinvalbuf(vp, 0, td, 1);
  			    else
  				error = ncl_vinvalbuf(vp, V_SAVE, td, 1);
  			    if (error) {
 				vnode_pager_setsize(vp, tsize);
 				return (error);
 			    }
 			    /*
 			     * Call nfscl_delegmodtime() to set the modify time
 			     * locally, as required.
 			     */
 			    nfscl_delegmodtime(vp);
  			} else
 			    mtx_unlock(&np->n_mtx);
 			/*
 			 * np->n_size has already been set to vap->va_size
 			 * in ncl_meta_setsize(). We must set it again since
 			 * nfs_loadattrcache() could be called through
 			 * ncl_meta_setsize() and could modify np->n_size.
 			 */
 			mtx_lock(&np->n_mtx);
  			np->n_vattr.na_size = np->n_size = vap->va_size;
 			mtx_unlock(&np->n_mtx);
   		};
   	} else {
 		mtx_lock(&np->n_mtx);
 		if ((vap->va_mtime.tv_sec != VNOVAL || vap->va_atime.tv_sec != VNOVAL) && 
 		    (np->n_flag & NMODIFIED) && vp->v_type == VREG) {
 			mtx_unlock(&np->n_mtx);
 			if ((error = ncl_vinvalbuf(vp, V_SAVE, td, 1)) != 0 &&
 			    (error == EINTR || error == EIO))
 				return (error);
 		} else
 			mtx_unlock(&np->n_mtx);
 	}
 	error = nfs_setattrrpc(vp, vap, ap->a_cred, td);
 	if (error && vap->va_size != VNOVAL) {
 		mtx_lock(&np->n_mtx);
 		np->n_size = np->n_vattr.na_size = tsize;
 		vnode_pager_setsize(vp, tsize);
 		mtx_unlock(&np->n_mtx);
 	}
 	return (error);
 }
 
 /*
  * Do an nfs setattr rpc.
  */
 static int
 nfs_setattrrpc(struct vnode *vp, struct vattr *vap, struct ucred *cred,
     struct thread *td)
 {
 	struct nfsnode *np = VTONFS(vp);
 	int error, ret, attrflag, i;
 	struct nfsvattr nfsva;
 
 	if (NFS_ISV34(vp)) {
 		mtx_lock(&np->n_mtx);
 		for (i = 0; i < NFS_ACCESSCACHESIZE; i++)
 			np->n_accesscache[i].stamp = 0;
 		np->n_flag |= NDELEGMOD;
 		mtx_unlock(&np->n_mtx);
 		KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp);
 	}
 	error = nfsrpc_setattr(vp, vap, NULL, cred, td, &nfsva, &attrflag,
 	    NULL);
 	if (attrflag) {
 		ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
 		if (ret && !error)
 			error = ret;
 	}
 	if (error && NFS_ISV4(vp))
 		error = nfscl_maperr(td, error, vap->va_uid, vap->va_gid);
 	return (error);
 }
 
 /*
  * nfs lookup call, one step at a time...
  * First look in cache
  * If not found, unlock the directory nfsnode and do the rpc
  */
 static int
 nfs_lookup(struct vop_lookup_args *ap)
 {
 	struct componentname *cnp = ap->a_cnp;
 	struct vnode *dvp = ap->a_dvp;
 	struct vnode **vpp = ap->a_vpp;
 	struct mount *mp = dvp->v_mount;
 	int flags = cnp->cn_flags;
 	struct vnode *newvp;
 	struct nfsmount *nmp;
 	struct nfsnode *np, *newnp;
 	int error = 0, attrflag, dattrflag, ltype, ncticks;
 	struct thread *td = cnp->cn_thread;
 	struct nfsfh *nfhp;
 	struct nfsvattr dnfsva, nfsva;
 	struct vattr vattr;
 	struct timespec nctime;
 	
 	*vpp = NULLVP;
 	if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) &&
 	    (cnp->cn_nameiop == DELETE || cnp->cn_nameiop == RENAME))
 		return (EROFS);
 	if (dvp->v_type != VDIR)
 		return (ENOTDIR);
 	nmp = VFSTONFS(mp);
 	np = VTONFS(dvp);
 
 	/* For NFSv4, wait until any remove is done. */
 	mtx_lock(&np->n_mtx);
 	while (NFSHASNFSV4(nmp) && (np->n_flag & NREMOVEINPROG)) {
 		np->n_flag |= NREMOVEWANT;
 		(void) msleep((caddr_t)np, &np->n_mtx, PZERO, "nfslkup", 0);
 	}
 	mtx_unlock(&np->n_mtx);
 
 	if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0)
 		return (error);
 	error = cache_lookup(dvp, vpp, cnp, &nctime, &ncticks);
 	if (error > 0 && error != ENOENT)
 		return (error);
 	if (error == -1) {
 		/*
 		 * Lookups of "." are special and always return the
 		 * current directory.  cache_lookup() already handles
 		 * associated locking bookkeeping, etc.
 		 */
 		if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') {
 			/* XXX: Is this really correct? */
 			if (cnp->cn_nameiop != LOOKUP &&
 			    (flags & ISLASTCN))
 				cnp->cn_flags |= SAVENAME;
 			return (0);
 		}
 
 		/*
 		 * We only accept a positive hit in the cache if the
 		 * change time of the file matches our cached copy.
 		 * Otherwise, we discard the cache entry and fallback
 		 * to doing a lookup RPC.  We also only trust cache
 		 * entries for less than nm_nametimeo seconds.
 		 *
 		 * To better handle stale file handles and attributes,
 		 * clear the attribute cache of this node if it is a
 		 * leaf component, part of an open() call, and not
 		 * locally modified before fetching the attributes.
 		 * This should allow stale file handles to be detected
 		 * here where we can fall back to a LOOKUP RPC to
 		 * recover rather than having nfs_open() detect the
 		 * stale file handle and failing open(2) with ESTALE.
 		 */
 		newvp = *vpp;
 		newnp = VTONFS(newvp);
 		if (!(nmp->nm_flag & NFSMNT_NOCTO) &&
 		    (flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) &&
 		    !(newnp->n_flag & NMODIFIED)) {
 			mtx_lock(&newnp->n_mtx);
 			newnp->n_attrstamp = 0;
 			KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp);
 			mtx_unlock(&newnp->n_mtx);
 		}
 		if (nfscl_nodeleg(newvp, 0) == 0 ||
 		    ((u_int)(ticks - ncticks) < (nmp->nm_nametimeo * hz) &&
 		    VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 &&
 		    timespeccmp(&vattr.va_ctime, &nctime, ==))) {
 			NFSINCRGLOBAL(newnfsstats.lookupcache_hits);
 			if (cnp->cn_nameiop != LOOKUP &&
 			    (flags & ISLASTCN))
 				cnp->cn_flags |= SAVENAME;
 			return (0);
 		}
 		cache_purge(newvp);
 		if (dvp != newvp)
 			vput(newvp);
 		else 
 			vrele(newvp);
 		*vpp = NULLVP;
 	} else if (error == ENOENT) {
 		if (dvp->v_iflag & VI_DOOMED)
 			return (ENOENT);
 		/*
 		 * We only accept a negative hit in the cache if the
 		 * modification time of the parent directory matches
 		 * the cached copy in the name cache entry.
 		 * Otherwise, we discard all of the negative cache
 		 * entries for this directory.  We also only trust
 		 * negative cache entries for up to nm_negnametimeo
 		 * seconds.
 		 */
 		if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) &&
 		    VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 &&
 		    timespeccmp(&vattr.va_mtime, &nctime, ==)) {
 			NFSINCRGLOBAL(newnfsstats.lookupcache_hits);
 			return (ENOENT);
 		}
 		cache_purge_negative(dvp);
 	}
 
 	error = 0;
 	newvp = NULLVP;
 	NFSINCRGLOBAL(newnfsstats.lookupcache_misses);
 	error = nfsrpc_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 	    cnp->cn_cred, td, &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag,
 	    NULL);
 	if (dattrflag)
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
 	if (error) {
 		if (newvp != NULLVP) {
 			vput(newvp);
 			*vpp = NULLVP;
 		}
 
 		if (error != ENOENT) {
 			if (NFS_ISV4(dvp))
 				error = nfscl_maperr(td, error, (uid_t)0,
 				    (gid_t)0);
 			return (error);
 		}
 
 		/* The requested file was not found. */
 		if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
 		    (flags & ISLASTCN)) {
 			/*
 			 * XXX: UFS does a full VOP_ACCESS(dvp,
 			 * VWRITE) here instead of just checking
 			 * MNT_RDONLY.
 			 */
 			if (mp->mnt_flag & MNT_RDONLY)
 				return (EROFS);
 			cnp->cn_flags |= SAVENAME;
 			return (EJUSTRETURN);
 		}
 
 		if ((cnp->cn_flags & MAKEENTRY) != 0 && dattrflag) {
 			/*
 			 * Cache the modification time of the parent
 			 * directory from the post-op attributes in
 			 * the name cache entry.  The negative cache
 			 * entry will be ignored once the directory
 			 * has changed.  Don't bother adding the entry
 			 * if the directory has already changed.
 			 */
 			mtx_lock(&np->n_mtx);
 			if (timespeccmp(&np->n_vattr.na_mtime,
 			    &dnfsva.na_mtime, ==)) {
 				mtx_unlock(&np->n_mtx);
 				cache_enter_time(dvp, NULL, cnp,
 				    &dnfsva.na_mtime, NULL);
 			} else
 				mtx_unlock(&np->n_mtx);
 		}
 		return (ENOENT);
 	}
 
 	/*
 	 * Handle RENAME case...
 	 */
 	if (cnp->cn_nameiop == RENAME && (flags & ISLASTCN)) {
 		if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) {
 			FREE((caddr_t)nfhp, M_NFSFH);
 			return (EISDIR);
 		}
 		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
 		    LK_EXCLUSIVE);
 		if (error)
 			return (error);
 		newvp = NFSTOV(np);
 		if (attrflag)
 			(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 		*vpp = newvp;
 		cnp->cn_flags |= SAVENAME;
 		return (0);
 	}
 
 	if (flags & ISDOTDOT) {
 		ltype = NFSVOPISLOCKED(dvp);
 		error = vfs_busy(mp, MBF_NOWAIT);
 		if (error != 0) {
 			vfs_ref(mp);
 			NFSVOPUNLOCK(dvp, 0);
 			error = vfs_busy(mp, 0);
 			NFSVOPLOCK(dvp, ltype | LK_RETRY);
 			vfs_rel(mp);
 			if (error == 0 && (dvp->v_iflag & VI_DOOMED)) {
 				vfs_unbusy(mp);
 				error = ENOENT;
 			}
 			if (error != 0)
 				return (error);
 		}
 		NFSVOPUNLOCK(dvp, 0);
 		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
 		    cnp->cn_lkflags);
 		if (error == 0)
 			newvp = NFSTOV(np);
 		vfs_unbusy(mp);
 		if (newvp != dvp)
 			NFSVOPLOCK(dvp, ltype | LK_RETRY);
 		if (dvp->v_iflag & VI_DOOMED) {
 			if (error == 0) {
 				if (newvp == dvp)
 					vrele(newvp);
 				else
 					vput(newvp);
 			}
 			error = ENOENT;
 		}
 		if (error != 0)
 			return (error);
 		if (attrflag)
 			(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 	} else if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) {
 		FREE((caddr_t)nfhp, M_NFSFH);
 		VREF(dvp);
 		newvp = dvp;
 		if (attrflag)
 			(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 	} else {
 		error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
 		    cnp->cn_lkflags);
 		if (error)
 			return (error);
 		newvp = NFSTOV(np);
 		if (attrflag)
 			(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 		else if ((flags & (ISLASTCN | ISOPEN)) == (ISLASTCN | ISOPEN) &&
 		    !(np->n_flag & NMODIFIED)) {			
 			/*
 			 * Flush the attribute cache when opening a
 			 * leaf node to ensure that fresh attributes
 			 * are fetched in nfs_open() since we did not
 			 * fetch attributes from the LOOKUP reply.
 			 */
 			mtx_lock(&np->n_mtx);
 			np->n_attrstamp = 0;
 			KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp);
 			mtx_unlock(&np->n_mtx);
 		}
 	}
 	if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))
 		cnp->cn_flags |= SAVENAME;
 	if ((cnp->cn_flags & MAKEENTRY) &&
 	    (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) &&
 	    attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0))
 		cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime,
 		    newvp->v_type != VDIR ? NULL : &dnfsva.na_ctime);
 	*vpp = newvp;
 	return (0);
 }
 
 /*
  * nfs read call.
  * Just call ncl_bioread() to do the work.
  */
 static int
 nfs_read(struct vop_read_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 
 	switch (vp->v_type) {
 	case VREG:
 		return (ncl_bioread(vp, ap->a_uio, ap->a_ioflag, ap->a_cred));
 	case VDIR:
 		return (EISDIR);
 	default:
 		return (EOPNOTSUPP);
 	}
 }
 
 /*
  * nfs readlink call
  */
 static int
 nfs_readlink(struct vop_readlink_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 
 	if (vp->v_type != VLNK)
 		return (EINVAL);
 	return (ncl_bioread(vp, ap->a_uio, 0, ap->a_cred));
 }
 
 /*
  * Do a readlink rpc.
  * Called by ncl_doio() from below the buffer cache.
  */
 int
 ncl_readlinkrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
 {
 	int error, ret, attrflag;
 	struct nfsvattr nfsva;
 
 	error = nfsrpc_readlink(vp, uiop, cred, uiop->uio_td, &nfsva,
 	    &attrflag, NULL);
 	if (attrflag) {
 		ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
 		if (ret && !error)
 			error = ret;
 	}
 	if (error && NFS_ISV4(vp))
 		error = nfscl_maperr(uiop->uio_td, error, (uid_t)0, (gid_t)0);
 	return (error);
 }
 
 /*
  * nfs read rpc call
  * Ditto above
  */
 int
 ncl_readrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred)
 {
 	int error, ret, attrflag;
 	struct nfsvattr nfsva;
 	struct nfsmount *nmp;
 
 	nmp = VFSTONFS(vnode_mount(vp));
 	error = EIO;
 	attrflag = 0;
 	if (NFSHASPNFS(nmp))
 		error = nfscl_doiods(vp, uiop, NULL, NULL,
 		    NFSV4OPEN_ACCESSREAD, cred, uiop->uio_td);
 	NFSCL_DEBUG(4, "readrpc: aft doiods=%d\n", error);
 	if (error != 0)
 		error = nfsrpc_read(vp, uiop, cred, uiop->uio_td, &nfsva,
 		    &attrflag, NULL);
 	if (attrflag) {
 		ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
 		if (ret && !error)
 			error = ret;
 	}
 	if (error && NFS_ISV4(vp))
 		error = nfscl_maperr(uiop->uio_td, error, (uid_t)0, (gid_t)0);
 	return (error);
 }
 
 /*
  * nfs write call
  */
 int
 ncl_writerpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
     int *iomode, int *must_commit, int called_from_strategy)
 {
 	struct nfsvattr nfsva;
 	int error, attrflag, ret;
 	struct nfsmount *nmp;
 
 	nmp = VFSTONFS(vnode_mount(vp));
 	error = EIO;
 	attrflag = 0;
 	if (NFSHASPNFS(nmp))
 		error = nfscl_doiods(vp, uiop, iomode, must_commit,
 		    NFSV4OPEN_ACCESSWRITE, cred, uiop->uio_td);
 	NFSCL_DEBUG(4, "writerpc: aft doiods=%d\n", error);
 	if (error != 0)
 		error = nfsrpc_write(vp, uiop, iomode, must_commit, cred,
 		    uiop->uio_td, &nfsva, &attrflag, NULL,
 		    called_from_strategy);
 	if (attrflag) {
 		if (VTONFS(vp)->n_flag & ND_NFSV4)
 			ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 1,
 			    1);
 		else
 			ret = nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0,
 			    1);
 		if (ret && !error)
 			error = ret;
 	}
 	if (DOINGASYNC(vp))
 		*iomode = NFSWRITE_FILESYNC;
 	if (error && NFS_ISV4(vp))
 		error = nfscl_maperr(uiop->uio_td, error, (uid_t)0, (gid_t)0);
 	return (error);
 }
 
 /*
  * nfs mknod rpc
  * For NFS v2 this is a kludge. Use a create rpc but with the IFMT bits of the
  * mode set to specify the file type and the size field for rdev.
  */
 static int
 nfs_mknodrpc(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
     struct vattr *vap)
 {
 	struct nfsvattr nfsva, dnfsva;
 	struct vnode *newvp = NULL;
 	struct nfsnode *np = NULL, *dnp;
 	struct nfsfh *nfhp;
 	struct vattr vattr;
 	int error = 0, attrflag, dattrflag;
 	u_int32_t rdev;
 
 	if (vap->va_type == VCHR || vap->va_type == VBLK)
 		rdev = vap->va_rdev;
 	else if (vap->va_type == VFIFO || vap->va_type == VSOCK)
 		rdev = 0xffffffff;
 	else
 		return (EOPNOTSUPP);
 	if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
 		return (error);
 	error = nfsrpc_mknod(dvp, cnp->cn_nameptr, cnp->cn_namelen, vap,
 	    rdev, vap->va_type, cnp->cn_cred, cnp->cn_thread, &dnfsva,
 	    &nfsva, &nfhp, &attrflag, &dattrflag, NULL);
 	if (!error) {
 		if (!nfhp)
 			(void) nfsrpc_lookup(dvp, cnp->cn_nameptr,
 			    cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread,
 			    &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag,
 			    NULL);
 		if (nfhp)
 			error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
 			    cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
 	}
 	if (dattrflag)
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
 	if (!error) {
 		newvp = NFSTOV(np);
 		if (attrflag != 0) {
 			error = nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 			if (error != 0)
 				vput(newvp);
 		}
 	}
 	if (!error) {
 		*vpp = newvp;
 	} else if (NFS_ISV4(dvp)) {
 		error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid,
 		    vap->va_gid);
 	}
 	dnp = VTONFS(dvp);
 	mtx_lock(&dnp->n_mtx);
 	dnp->n_flag |= NMODIFIED;
 	if (!dattrflag) {
 		dnp->n_attrstamp = 0;
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
 	}
 	mtx_unlock(&dnp->n_mtx);
 	return (error);
 }
 
 /*
  * nfs mknod vop
  * just call nfs_mknodrpc() to do the work.
  */
 /* ARGSUSED */
 static int
 nfs_mknod(struct vop_mknod_args *ap)
 {
 	return (nfs_mknodrpc(ap->a_dvp, ap->a_vpp, ap->a_cnp, ap->a_vap));
 }
 
 static struct mtx nfs_cverf_mtx;
 MTX_SYSINIT(nfs_cverf_mtx, &nfs_cverf_mtx, "NFS create verifier mutex",
     MTX_DEF);
 
 static nfsquad_t
 nfs_get_cverf(void)
 {
 	static nfsquad_t cverf;
 	nfsquad_t ret;
 	static int cverf_initialized = 0;
 
 	mtx_lock(&nfs_cverf_mtx);
 	if (cverf_initialized == 0) {
 		cverf.lval[0] = arc4random();
 		cverf.lval[1] = arc4random();
 		cverf_initialized = 1;
 	} else
 		cverf.qval++;
 	ret = cverf;
 	mtx_unlock(&nfs_cverf_mtx);
 
 	return (ret);
 }
 
 /*
  * nfs file create call
  */
 static int
 nfs_create(struct vop_create_args *ap)
 {
 	struct vnode *dvp = ap->a_dvp;
 	struct vattr *vap = ap->a_vap;
 	struct componentname *cnp = ap->a_cnp;
 	struct nfsnode *np = NULL, *dnp;
 	struct vnode *newvp = NULL;
 	struct nfsmount *nmp;
 	struct nfsvattr dnfsva, nfsva;
 	struct nfsfh *nfhp;
 	nfsquad_t cverf;
 	int error = 0, attrflag, dattrflag, fmode = 0;
 	struct vattr vattr;
 
 	/*
 	 * Oops, not for me..
 	 */
 	if (vap->va_type == VSOCK)
 		return (nfs_mknodrpc(dvp, ap->a_vpp, cnp, vap));
 
 	if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)))
 		return (error);
 	if (vap->va_vaflags & VA_EXCLUSIVE)
 		fmode |= O_EXCL;
 	dnp = VTONFS(dvp);
 	nmp = VFSTONFS(vnode_mount(dvp));
 again:
 	/* For NFSv4, wait until any remove is done. */
 	mtx_lock(&dnp->n_mtx);
 	while (NFSHASNFSV4(nmp) && (dnp->n_flag & NREMOVEINPROG)) {
 		dnp->n_flag |= NREMOVEWANT;
 		(void) msleep((caddr_t)dnp, &dnp->n_mtx, PZERO, "nfscrt", 0);
 	}
 	mtx_unlock(&dnp->n_mtx);
 
 	cverf = nfs_get_cverf();
 	error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 	    vap, cverf, fmode, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva,
 	    &nfhp, &attrflag, &dattrflag, NULL);
 	if (!error) {
 		if (nfhp == NULL)
 			(void) nfsrpc_lookup(dvp, cnp->cn_nameptr,
 			    cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread,
 			    &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag,
 			    NULL);
 		if (nfhp != NULL)
 			error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
 			    cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
 	}
 	if (dattrflag)
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
 	if (!error) {
 		newvp = NFSTOV(np);
 		if (attrflag == 0)
 			error = nfsrpc_getattr(newvp, cnp->cn_cred,
 			    cnp->cn_thread, &nfsva, NULL);
 		if (error == 0)
 			error = nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 	}
 	if (error) {
 		if (newvp != NULL) {
 			vput(newvp);
 			newvp = NULL;
 		}
 		if (NFS_ISV34(dvp) && (fmode & O_EXCL) &&
 		    error == NFSERR_NOTSUPP) {
 			fmode &= ~O_EXCL;
 			goto again;
 		}
 	} else if (NFS_ISV34(dvp) && (fmode & O_EXCL)) {
 		if (nfscl_checksattr(vap, &nfsva)) {
-			/*
-			 * We are normally called with only a partially
-			 * initialized VAP. Since the NFSv3 spec says that
-			 * the server may use the file attributes to
-			 * store the verifier, the spec requires us to do a
-			 * SETATTR RPC. FreeBSD servers store the verifier in
-			 * atime, but we can't really assume that all servers
-			 * will so we ensure that our SETATTR sets both atime
-			 * and mtime.
-			 */
-			if (vap->va_mtime.tv_sec == VNOVAL)
-				vfs_timestamp(&vap->va_mtime);
-			if (vap->va_atime.tv_sec == VNOVAL)
-				vap->va_atime = vap->va_mtime;
 			error = nfsrpc_setattr(newvp, vap, NULL, cnp->cn_cred,
 			    cnp->cn_thread, &nfsva, &attrflag, NULL);
 			if (error && (vap->va_uid != (uid_t)VNOVAL ||
 			    vap->va_gid != (gid_t)VNOVAL)) {
 				/* try again without setting uid/gid */
 				vap->va_uid = (uid_t)VNOVAL;
 				vap->va_gid = (uid_t)VNOVAL;
 				error = nfsrpc_setattr(newvp, vap, NULL, 
 				    cnp->cn_cred, cnp->cn_thread, &nfsva,
 				    &attrflag, NULL);
 			}
 			if (attrflag)
 				(void) nfscl_loadattrcache(&newvp, &nfsva, NULL,
 				    NULL, 0, 1);
 			if (error != 0)
 				vput(newvp);
 		}
 	}
 	if (!error) {
 		if ((cnp->cn_flags & MAKEENTRY) && attrflag)
 			cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime,
 			    NULL);
 		*ap->a_vpp = newvp;
 	} else if (NFS_ISV4(dvp)) {
 		error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid,
 		    vap->va_gid);
 	}
 	mtx_lock(&dnp->n_mtx);
 	dnp->n_flag |= NMODIFIED;
 	if (!dattrflag) {
 		dnp->n_attrstamp = 0;
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
 	}
 	mtx_unlock(&dnp->n_mtx);
 	return (error);
 }
 
 /*
  * nfs file remove call
  * To try and make nfs semantics closer to ufs semantics, a file that has
  * other processes using the vnode is renamed instead of removed and then
  * removed later on the last close.
  * - If v_usecount > 1
  *	  If a rename is not already in the works
  *	     call nfs_sillyrename() to set it up
  *     else
  *	  do the remove rpc
  */
 static int
 nfs_remove(struct vop_remove_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct vnode *dvp = ap->a_dvp;
 	struct componentname *cnp = ap->a_cnp;
 	struct nfsnode *np = VTONFS(vp);
 	int error = 0;
 	struct vattr vattr;
 
 	KASSERT((cnp->cn_flags & HASBUF) != 0, ("nfs_remove: no name"));
 	KASSERT(vrefcnt(vp) > 0, ("nfs_remove: bad v_usecount"));
 	if (vp->v_type == VDIR)
 		error = EPERM;
 	else if (vrefcnt(vp) == 1 || (np->n_sillyrename &&
 	    VOP_GETATTR(vp, &vattr, cnp->cn_cred) == 0 &&
 	    vattr.va_nlink > 1)) {
 		/*
 		 * Purge the name cache so that the chance of a lookup for
 		 * the name succeeding while the remove is in progress is
 		 * minimized. Without node locking it can still happen, such
 		 * that an I/O op returns ESTALE, but since you get this if
 		 * another host removes the file..
 		 */
 		cache_purge(vp);
 		/*
 		 * throw away biocache buffers, mainly to avoid
 		 * unnecessary delayed writes later.
 		 */
 		error = ncl_vinvalbuf(vp, 0, cnp->cn_thread, 1);
 		/* Do the rpc */
 		if (error != EINTR && error != EIO)
 			error = nfs_removerpc(dvp, vp, cnp->cn_nameptr,
 			    cnp->cn_namelen, cnp->cn_cred, cnp->cn_thread);
 		/*
 		 * Kludge City: If the first reply to the remove rpc is lost..
 		 *   the reply to the retransmitted request will be ENOENT
 		 *   since the file was in fact removed
 		 *   Therefore, we cheat and return success.
 		 */
 		if (error == ENOENT)
 			error = 0;
 	} else if (!np->n_sillyrename)
 		error = nfs_sillyrename(dvp, vp, cnp);
 	mtx_lock(&np->n_mtx);
 	np->n_attrstamp = 0;
 	mtx_unlock(&np->n_mtx);
 	KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
 	return (error);
 }
 
 /*
  * nfs file remove rpc called from nfs_inactive
  */
 int
 ncl_removeit(struct sillyrename *sp, struct vnode *vp)
 {
 	/*
 	 * Make sure that the directory vnode is still valid.
 	 * XXX we should lock sp->s_dvp here.
 	 */
 	if (sp->s_dvp->v_type == VBAD)
 		return (0);
 	return (nfs_removerpc(sp->s_dvp, vp, sp->s_name, sp->s_namlen,
 	    sp->s_cred, NULL));
 }
 
 /*
  * Nfs remove rpc, called from nfs_remove() and ncl_removeit().
  */
 static int
 nfs_removerpc(struct vnode *dvp, struct vnode *vp, char *name,
     int namelen, struct ucred *cred, struct thread *td)
 {
 	struct nfsvattr dnfsva;
 	struct nfsnode *dnp = VTONFS(dvp);
 	int error = 0, dattrflag;
 
 	mtx_lock(&dnp->n_mtx);
 	dnp->n_flag |= NREMOVEINPROG;
 	mtx_unlock(&dnp->n_mtx);
 	error = nfsrpc_remove(dvp, name, namelen, vp, cred, td, &dnfsva,
 	    &dattrflag, NULL);
 	mtx_lock(&dnp->n_mtx);
 	if ((dnp->n_flag & NREMOVEWANT)) {
 		dnp->n_flag &= ~(NREMOVEWANT | NREMOVEINPROG);
 		mtx_unlock(&dnp->n_mtx);
 		wakeup((caddr_t)dnp);
 	} else {
 		dnp->n_flag &= ~NREMOVEINPROG;
 		mtx_unlock(&dnp->n_mtx);
 	}
 	if (dattrflag)
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
 	mtx_lock(&dnp->n_mtx);
 	dnp->n_flag |= NMODIFIED;
 	if (!dattrflag) {
 		dnp->n_attrstamp = 0;
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
 	}
 	mtx_unlock(&dnp->n_mtx);
 	if (error && NFS_ISV4(dvp))
 		error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
 	return (error);
 }
 
 /*
  * nfs file rename call
  */
 static int
 nfs_rename(struct vop_rename_args *ap)
 {
 	struct vnode *fvp = ap->a_fvp;
 	struct vnode *tvp = ap->a_tvp;
 	struct vnode *fdvp = ap->a_fdvp;
 	struct vnode *tdvp = ap->a_tdvp;
 	struct componentname *tcnp = ap->a_tcnp;
 	struct componentname *fcnp = ap->a_fcnp;
 	struct nfsnode *fnp = VTONFS(ap->a_fvp);
 	struct nfsnode *tdnp = VTONFS(ap->a_tdvp);
 	struct nfsv4node *newv4 = NULL;
 	int error;
 
 	KASSERT((tcnp->cn_flags & HASBUF) != 0 &&
 	    (fcnp->cn_flags & HASBUF) != 0, ("nfs_rename: no name"));
 	/* Check for cross-device rename */
 	if ((fvp->v_mount != tdvp->v_mount) ||
 	    (tvp && (fvp->v_mount != tvp->v_mount))) {
 		error = EXDEV;
 		goto out;
 	}
 
 	if (fvp == tvp) {
 		ncl_printf("nfs_rename: fvp == tvp (can't happen)\n");
 		error = 0;
 		goto out;
 	}
 	if ((error = NFSVOPLOCK(fvp, LK_EXCLUSIVE)) != 0)
 		goto out;
 
 	/*
 	 * We have to flush B_DELWRI data prior to renaming
 	 * the file.  If we don't, the delayed-write buffers
 	 * can be flushed out later after the file has gone stale
 	 * under NFSV3.  NFSV2 does not have this problem because
 	 * ( as far as I can tell ) it flushes dirty buffers more
 	 * often.
 	 * 
 	 * Skip the rename operation if the fsync fails, this can happen
 	 * due to the server's volume being full, when we pushed out data
 	 * that was written back to our cache earlier. Not checking for
 	 * this condition can result in potential (silent) data loss.
 	 */
 	error = VOP_FSYNC(fvp, MNT_WAIT, fcnp->cn_thread);
 	NFSVOPUNLOCK(fvp, 0);
 	if (!error && tvp)
 		error = VOP_FSYNC(tvp, MNT_WAIT, tcnp->cn_thread);
 	if (error)
 		goto out;
 
 	/*
 	 * If the tvp exists and is in use, sillyrename it before doing the
 	 * rename of the new file over it.
 	 * XXX Can't sillyrename a directory.
 	 */
 	if (tvp && vrefcnt(tvp) > 1 && !VTONFS(tvp)->n_sillyrename &&
 		tvp->v_type != VDIR && !nfs_sillyrename(tdvp, tvp, tcnp)) {
 		vput(tvp);
 		tvp = NULL;
 	}
 
 	error = nfs_renamerpc(fdvp, fvp, fcnp->cn_nameptr, fcnp->cn_namelen,
 	    tdvp, tvp, tcnp->cn_nameptr, tcnp->cn_namelen, tcnp->cn_cred,
 	    tcnp->cn_thread);
 
 	if (error == 0 && NFS_ISV4(tdvp)) {
 		/*
 		 * For NFSv4, check to see if it is the same name and
 		 * replace the name, if it is different.
 		 */
 		MALLOC(newv4, struct nfsv4node *,
 		    sizeof (struct nfsv4node) +
 		    tdnp->n_fhp->nfh_len + tcnp->cn_namelen - 1,
 		    M_NFSV4NODE, M_WAITOK);
 		mtx_lock(&tdnp->n_mtx);
 		mtx_lock(&fnp->n_mtx);
 		if (fnp->n_v4 != NULL && fvp->v_type == VREG &&
 		    (fnp->n_v4->n4_namelen != tcnp->cn_namelen ||
 		      NFSBCMP(tcnp->cn_nameptr, NFS4NODENAME(fnp->n_v4),
 		      tcnp->cn_namelen) ||
 		      tdnp->n_fhp->nfh_len != fnp->n_v4->n4_fhlen ||
 		      NFSBCMP(tdnp->n_fhp->nfh_fh, fnp->n_v4->n4_data,
 			tdnp->n_fhp->nfh_len))) {
 #ifdef notdef
 { char nnn[100]; int nnnl;
 nnnl = (tcnp->cn_namelen < 100) ? tcnp->cn_namelen : 99;
 bcopy(tcnp->cn_nameptr, nnn, nnnl);
 nnn[nnnl] = '\0';
 printf("ren replace=%s\n",nnn);
 }
 #endif
 			FREE((caddr_t)fnp->n_v4, M_NFSV4NODE);
 			fnp->n_v4 = newv4;
 			newv4 = NULL;
 			fnp->n_v4->n4_fhlen = tdnp->n_fhp->nfh_len;
 			fnp->n_v4->n4_namelen = tcnp->cn_namelen;
 			NFSBCOPY(tdnp->n_fhp->nfh_fh, fnp->n_v4->n4_data,
 			    tdnp->n_fhp->nfh_len);
 			NFSBCOPY(tcnp->cn_nameptr,
 			    NFS4NODENAME(fnp->n_v4), tcnp->cn_namelen);
 		}
 		mtx_unlock(&tdnp->n_mtx);
 		mtx_unlock(&fnp->n_mtx);
 		if (newv4 != NULL)
 			FREE((caddr_t)newv4, M_NFSV4NODE);
 	}
 
 	if (fvp->v_type == VDIR) {
 		if (tvp != NULL && tvp->v_type == VDIR)
 			cache_purge(tdvp);
 		cache_purge(fdvp);
 	}
 
 out:
 	if (tdvp == tvp)
 		vrele(tdvp);
 	else
 		vput(tdvp);
 	if (tvp)
 		vput(tvp);
 	vrele(fdvp);
 	vrele(fvp);
 	/*
 	 * Kludge: Map ENOENT => 0 assuming that it is a reply to a retry.
 	 */
 	if (error == ENOENT)
 		error = 0;
 	return (error);
 }
 
 /*
  * nfs file rename rpc called from nfs_remove() above
  */
 static int
 nfs_renameit(struct vnode *sdvp, struct vnode *svp, struct componentname *scnp,
     struct sillyrename *sp)
 {
 
 	return (nfs_renamerpc(sdvp, svp, scnp->cn_nameptr, scnp->cn_namelen,
 	    sdvp, NULL, sp->s_name, sp->s_namlen, scnp->cn_cred,
 	    scnp->cn_thread));
 }
 
 /*
  * Do an nfs rename rpc. Called from nfs_rename() and nfs_renameit().
  */
 static int
 nfs_renamerpc(struct vnode *fdvp, struct vnode *fvp, char *fnameptr,
     int fnamelen, struct vnode *tdvp, struct vnode *tvp, char *tnameptr,
     int tnamelen, struct ucred *cred, struct thread *td)
 {
 	struct nfsvattr fnfsva, tnfsva;
 	struct nfsnode *fdnp = VTONFS(fdvp);
 	struct nfsnode *tdnp = VTONFS(tdvp);
 	int error = 0, fattrflag, tattrflag;
 
 	error = nfsrpc_rename(fdvp, fvp, fnameptr, fnamelen, tdvp, tvp,
 	    tnameptr, tnamelen, cred, td, &fnfsva, &tnfsva, &fattrflag,
 	    &tattrflag, NULL, NULL);
 	mtx_lock(&fdnp->n_mtx);
 	fdnp->n_flag |= NMODIFIED;
 	if (fattrflag != 0) {
 		mtx_unlock(&fdnp->n_mtx);
 		(void) nfscl_loadattrcache(&fdvp, &fnfsva, NULL, NULL, 0, 1);
 	} else {
 		fdnp->n_attrstamp = 0;
 		mtx_unlock(&fdnp->n_mtx);
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(fdvp);
 	}
 	mtx_lock(&tdnp->n_mtx);
 	tdnp->n_flag |= NMODIFIED;
 	if (tattrflag != 0) {
 		mtx_unlock(&tdnp->n_mtx);
 		(void) nfscl_loadattrcache(&tdvp, &tnfsva, NULL, NULL, 0, 1);
 	} else {
 		tdnp->n_attrstamp = 0;
 		mtx_unlock(&tdnp->n_mtx);
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(tdvp);
 	}
 	if (error && NFS_ISV4(fdvp))
 		error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
 	return (error);
 }
 
 /*
  * nfs hard link create call
  */
 static int
 nfs_link(struct vop_link_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct vnode *tdvp = ap->a_tdvp;
 	struct componentname *cnp = ap->a_cnp;
 	struct nfsnode *np, *tdnp;
 	struct nfsvattr nfsva, dnfsva;
 	int error = 0, attrflag, dattrflag;
 
 	/*
 	 * Push all writes to the server, so that the attribute cache
 	 * doesn't get "out of sync" with the server.
 	 * XXX There should be a better way!
 	 */
 	VOP_FSYNC(vp, MNT_WAIT, cnp->cn_thread);
 
 	error = nfsrpc_link(tdvp, vp, cnp->cn_nameptr, cnp->cn_namelen,
 	    cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva, &attrflag,
 	    &dattrflag, NULL);
 	tdnp = VTONFS(tdvp);
 	mtx_lock(&tdnp->n_mtx);
 	tdnp->n_flag |= NMODIFIED;
 	if (dattrflag != 0) {
 		mtx_unlock(&tdnp->n_mtx);
 		(void) nfscl_loadattrcache(&tdvp, &dnfsva, NULL, NULL, 0, 1);
 	} else {
 		tdnp->n_attrstamp = 0;
 		mtx_unlock(&tdnp->n_mtx);
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(tdvp);
 	}
 	if (attrflag)
 		(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
 	else {
 		np = VTONFS(vp);
 		mtx_lock(&np->n_mtx);
 		np->n_attrstamp = 0;
 		mtx_unlock(&np->n_mtx);
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
 	}
 	/*
 	 * If negative lookup caching is enabled, I might as well
 	 * add an entry for this node. Not necessary for correctness,
 	 * but if negative caching is enabled, then the system
 	 * must care about lookup caching hit rate, so...
 	 */
 	if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 &&
 	    (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) {
 		cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL);
 	}
 	if (error && NFS_ISV4(vp))
 		error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0,
 		    (gid_t)0);
 	return (error);
 }
 
 /*
  * nfs symbolic link create call
  */
 static int
 nfs_symlink(struct vop_symlink_args *ap)
 {
 	struct vnode *dvp = ap->a_dvp;
 	struct vattr *vap = ap->a_vap;
 	struct componentname *cnp = ap->a_cnp;
 	struct nfsvattr nfsva, dnfsva;
 	struct nfsfh *nfhp;
 	struct nfsnode *np = NULL, *dnp;
 	struct vnode *newvp = NULL;
 	int error = 0, attrflag, dattrflag, ret;
 
 	vap->va_type = VLNK;
 	error = nfsrpc_symlink(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 	    ap->a_target, vap, cnp->cn_cred, cnp->cn_thread, &dnfsva,
 	    &nfsva, &nfhp, &attrflag, &dattrflag, NULL);
 	if (nfhp) {
 		ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
 		    &np, NULL, LK_EXCLUSIVE);
 		if (!ret)
 			newvp = NFSTOV(np);
 		else if (!error)
 			error = ret;
 	}
 	if (newvp != NULL) {
 		if (attrflag)
 			(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 	} else if (!error) {
 		/*
 		 * If we do not have an error and we could not extract the
 		 * newvp from the response due to the request being NFSv2, we
 		 * have to do a lookup in order to obtain a newvp to return.
 		 */
 		error = nfs_lookitup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 		    cnp->cn_cred, cnp->cn_thread, &np);
 		if (!error)
 			newvp = NFSTOV(np);
 	}
 	if (error) {
 		if (newvp)
 			vput(newvp);
 		if (NFS_ISV4(dvp))
 			error = nfscl_maperr(cnp->cn_thread, error,
 			    vap->va_uid, vap->va_gid);
 	} else {
 		*ap->a_vpp = newvp;
 	}
 
 	dnp = VTONFS(dvp);
 	mtx_lock(&dnp->n_mtx);
 	dnp->n_flag |= NMODIFIED;
 	if (dattrflag != 0) {
 		mtx_unlock(&dnp->n_mtx);
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
 	} else {
 		dnp->n_attrstamp = 0;
 		mtx_unlock(&dnp->n_mtx);
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
 	}
 	/*
 	 * If negative lookup caching is enabled, I might as well
 	 * add an entry for this node. Not necessary for correctness,
 	 * but if negative caching is enabled, then the system
 	 * must care about lookup caching hit rate, so...
 	 */
 	if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 &&
 	    (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) {
 		cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, NULL);
 	}
 	return (error);
 }
 
 /*
  * nfs make dir call
  */
 static int
 nfs_mkdir(struct vop_mkdir_args *ap)
 {
 	struct vnode *dvp = ap->a_dvp;
 	struct vattr *vap = ap->a_vap;
 	struct componentname *cnp = ap->a_cnp;
 	struct nfsnode *np = NULL, *dnp;
 	struct vnode *newvp = NULL;
 	struct vattr vattr;
 	struct nfsfh *nfhp;
 	struct nfsvattr nfsva, dnfsva;
 	int error = 0, attrflag, dattrflag, ret;
 
 	if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred)) != 0)
 		return (error);
 	vap->va_type = VDIR;
 	error = nfsrpc_mkdir(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 	    vap, cnp->cn_cred, cnp->cn_thread, &dnfsva, &nfsva, &nfhp,
 	    &attrflag, &dattrflag, NULL);
 	dnp = VTONFS(dvp);
 	mtx_lock(&dnp->n_mtx);
 	dnp->n_flag |= NMODIFIED;
 	if (dattrflag != 0) {
 		mtx_unlock(&dnp->n_mtx);
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
 	} else {
 		dnp->n_attrstamp = 0;
 		mtx_unlock(&dnp->n_mtx);
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
 	}
 	if (nfhp) {
 		ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
 		    &np, NULL, LK_EXCLUSIVE);
 		if (!ret) {
 			newvp = NFSTOV(np);
 			if (attrflag)
 			   (void) nfscl_loadattrcache(&newvp, &nfsva, NULL,
 				NULL, 0, 1);
 		} else if (!error)
 			error = ret;
 	}
 	if (!error && newvp == NULL) {
 		error = nfs_lookitup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 		    cnp->cn_cred, cnp->cn_thread, &np);
 		if (!error) {
 			newvp = NFSTOV(np);
 			if (newvp->v_type != VDIR)
 				error = EEXIST;
 		}
 	}
 	if (error) {
 		if (newvp)
 			vput(newvp);
 		if (NFS_ISV4(dvp))
 			error = nfscl_maperr(cnp->cn_thread, error,
 			    vap->va_uid, vap->va_gid);
 	} else {
 		/*
 		 * If negative lookup caching is enabled, I might as well
 		 * add an entry for this node. Not necessary for correctness,
 		 * but if negative caching is enabled, then the system
 		 * must care about lookup caching hit rate, so...
 		 */
 		if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 &&
 		    (cnp->cn_flags & MAKEENTRY) &&
 		    attrflag != 0 && dattrflag != 0)
 			cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime,
 			    &dnfsva.na_ctime);
 		*ap->a_vpp = newvp;
 	}
 	return (error);
 }
 
 /*
  * nfs remove directory call
  */
 static int
 nfs_rmdir(struct vop_rmdir_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct vnode *dvp = ap->a_dvp;
 	struct componentname *cnp = ap->a_cnp;
 	struct nfsnode *dnp;
 	struct nfsvattr dnfsva;
 	int error, dattrflag;
 
 	if (dvp == vp)
 		return (EINVAL);
 	error = nfsrpc_rmdir(dvp, cnp->cn_nameptr, cnp->cn_namelen,
 	    cnp->cn_cred, cnp->cn_thread, &dnfsva, &dattrflag, NULL);
 	dnp = VTONFS(dvp);
 	mtx_lock(&dnp->n_mtx);
 	dnp->n_flag |= NMODIFIED;
 	if (dattrflag != 0) {
 		mtx_unlock(&dnp->n_mtx);
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
 	} else {
 		dnp->n_attrstamp = 0;
 		mtx_unlock(&dnp->n_mtx);
 		KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(dvp);
 	}
 
 	cache_purge(dvp);
 	cache_purge(vp);
 	if (error && NFS_ISV4(dvp))
 		error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0,
 		    (gid_t)0);
 	/*
 	 * Kludge: Map ENOENT => 0 assuming that you have a reply to a retry.
 	 */
 	if (error == ENOENT)
 		error = 0;
 	return (error);
 }
 
 /*
  * nfs readdir call
  */
 static int
 nfs_readdir(struct vop_readdir_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct nfsnode *np = VTONFS(vp);
 	struct uio *uio = ap->a_uio;
 	ssize_t tresid;
 	int error = 0;
 	struct vattr vattr;
 	
 	if (ap->a_eofflag != NULL)
 		*ap->a_eofflag = 0;
 	if (vp->v_type != VDIR) 
 		return(EPERM);
 
 	/*
 	 * First, check for hit on the EOF offset cache
 	 */
 	if (np->n_direofoffset > 0 && uio->uio_offset >= np->n_direofoffset &&
 	    (np->n_flag & NMODIFIED) == 0) {
 		if (VOP_GETATTR(vp, &vattr, ap->a_cred) == 0) {
 			mtx_lock(&np->n_mtx);
 			if ((NFS_ISV4(vp) && np->n_change == vattr.va_filerev) ||
 			    !NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) {
 				mtx_unlock(&np->n_mtx);
 				NFSINCRGLOBAL(newnfsstats.direofcache_hits);
 				if (ap->a_eofflag != NULL)
 					*ap->a_eofflag = 1;
 				return (0);
 			} else
 				mtx_unlock(&np->n_mtx);
 		}
 	}
 
 	/*
 	 * Call ncl_bioread() to do the real work.
 	 */
 	tresid = uio->uio_resid;
 	error = ncl_bioread(vp, uio, 0, ap->a_cred);
 
 	if (!error && uio->uio_resid == tresid) {
 		NFSINCRGLOBAL(newnfsstats.direofcache_misses);
 		if (ap->a_eofflag != NULL)
 			*ap->a_eofflag = 1;
 	}
 	return (error);
 }
 
 /*
  * Readdir rpc call.
  * Called from below the buffer cache by ncl_doio().
  */
 int
 ncl_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
     struct thread *td)
 {
 	struct nfsvattr nfsva;
 	nfsuint64 *cookiep, cookie;
 	struct nfsnode *dnp = VTONFS(vp);
 	struct nfsmount *nmp = VFSTONFS(vp->v_mount);
 	int error = 0, eof, attrflag;
 
 	KASSERT(uiop->uio_iovcnt == 1 &&
 	    (uiop->uio_offset & (DIRBLKSIZ - 1)) == 0 &&
 	    (uiop->uio_resid & (DIRBLKSIZ - 1)) == 0,
 	    ("nfs readdirrpc bad uio"));
 
 	/*
 	 * If there is no cookie, assume directory was stale.
 	 */
 	ncl_dircookie_lock(dnp);
 	cookiep = ncl_getcookie(dnp, uiop->uio_offset, 0);
 	if (cookiep) {
 		cookie = *cookiep;
 		ncl_dircookie_unlock(dnp);
 	} else {
 		ncl_dircookie_unlock(dnp);		
 		return (NFSERR_BAD_COOKIE);
 	}
 
 	if (NFSHASNFSV3(nmp) && !NFSHASGOTFSINFO(nmp))
 		(void)ncl_fsinfo(nmp, vp, cred, td);
 
 	error = nfsrpc_readdir(vp, uiop, &cookie, cred, td, &nfsva,
 	    &attrflag, &eof, NULL);
 	if (attrflag)
 		(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
 
 	if (!error) {
 		/*
 		 * We are now either at the end of the directory or have filled
 		 * the block.
 		 */
 		if (eof)
 			dnp->n_direofoffset = uiop->uio_offset;
 		else {
 			if (uiop->uio_resid > 0)
 				ncl_printf("EEK! readdirrpc resid > 0\n");
 			ncl_dircookie_lock(dnp);
 			cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1);
 			*cookiep = cookie;
 			ncl_dircookie_unlock(dnp);
 		}
 	} else if (NFS_ISV4(vp)) {
 		error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
 	}
 	return (error);
 }
 
 /*
  * NFS V3 readdir plus RPC. Used in place of ncl_readdirrpc().
  */
 int
 ncl_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
     struct thread *td)
 {
 	struct nfsvattr nfsva;
 	nfsuint64 *cookiep, cookie;
 	struct nfsnode *dnp = VTONFS(vp);
 	struct nfsmount *nmp = VFSTONFS(vp->v_mount);
 	int error = 0, attrflag, eof;
 
 	KASSERT(uiop->uio_iovcnt == 1 &&
 	    (uiop->uio_offset & (DIRBLKSIZ - 1)) == 0 &&
 	    (uiop->uio_resid & (DIRBLKSIZ - 1)) == 0,
 	    ("nfs readdirplusrpc bad uio"));
 
 	/*
 	 * If there is no cookie, assume directory was stale.
 	 */
 	ncl_dircookie_lock(dnp);
 	cookiep = ncl_getcookie(dnp, uiop->uio_offset, 0);
 	if (cookiep) {
 		cookie = *cookiep;
 		ncl_dircookie_unlock(dnp);
 	} else {
 		ncl_dircookie_unlock(dnp);
 		return (NFSERR_BAD_COOKIE);
 	}
 
 	if (NFSHASNFSV3(nmp) && !NFSHASGOTFSINFO(nmp))
 		(void)ncl_fsinfo(nmp, vp, cred, td);
 	error = nfsrpc_readdirplus(vp, uiop, &cookie, cred, td, &nfsva,
 	    &attrflag, &eof, NULL);
 	if (attrflag)
 		(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0, 1);
 
 	if (!error) {
 		/*
 		 * We are now either at end of the directory or have filled the
 		 * the block.
 		 */
 		if (eof)
 			dnp->n_direofoffset = uiop->uio_offset;
 		else {
 			if (uiop->uio_resid > 0)
 				ncl_printf("EEK! readdirplusrpc resid > 0\n");
 			ncl_dircookie_lock(dnp);
 			cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1);
 			*cookiep = cookie;
 			ncl_dircookie_unlock(dnp);
 		}
 	} else if (NFS_ISV4(vp)) {
 		error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
 	}
 	return (error);
 }
 
 /*
  * Silly rename. To make the NFS filesystem that is stateless look a little
  * more like the "ufs" a remove of an active vnode is translated to a rename
  * to a funny looking filename that is removed by nfs_inactive on the
  * nfsnode. There is the potential for another process on a different client
  * to create the same funny name between the nfs_lookitup() fails and the
  * nfs_rename() completes, but...
  */
 static int
 nfs_sillyrename(struct vnode *dvp, struct vnode *vp, struct componentname *cnp)
 {
 	struct sillyrename *sp;
 	struct nfsnode *np;
 	int error;
 	short pid;
 	unsigned int lticks;
 
 	cache_purge(dvp);
 	np = VTONFS(vp);
 	KASSERT(vp->v_type != VDIR, ("nfs: sillyrename dir"));
 	MALLOC(sp, struct sillyrename *, sizeof (struct sillyrename),
 	    M_NEWNFSREQ, M_WAITOK);
 	sp->s_cred = crhold(cnp->cn_cred);
 	sp->s_dvp = dvp;
 	VREF(dvp);
 
 	/* 
 	 * Fudge together a funny name.
 	 * Changing the format of the funny name to accomodate more 
 	 * sillynames per directory.
 	 * The name is now changed to .nfs...4, where ticks is 
 	 * CPU ticks since boot.
 	 */
 	pid = cnp->cn_thread->td_proc->p_pid;
 	lticks = (unsigned int)ticks;
 	for ( ; ; ) {
 		sp->s_namlen = sprintf(sp->s_name, 
 				       ".nfs.%08x.%04x4.4", lticks, 
 				       pid);
 		if (nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
 				 cnp->cn_thread, NULL))
 			break;
 		lticks++;
 	}
 	error = nfs_renameit(dvp, vp, cnp, sp);
 	if (error)
 		goto bad;
 	error = nfs_lookitup(dvp, sp->s_name, sp->s_namlen, sp->s_cred,
 		cnp->cn_thread, &np);
 	np->n_sillyrename = sp;
 	return (0);
 bad:
 	vrele(sp->s_dvp);
 	crfree(sp->s_cred);
 	free((caddr_t)sp, M_NEWNFSREQ);
 	return (error);
 }
 
 /*
  * Look up a file name and optionally either update the file handle or
  * allocate an nfsnode, depending on the value of npp.
  * npp == NULL	--> just do the lookup
  * *npp == NULL --> allocate a new nfsnode and make sure attributes are
  *			handled too
  * *npp != NULL --> update the file handle in the vnode
  */
 static int
 nfs_lookitup(struct vnode *dvp, char *name, int len, struct ucred *cred,
     struct thread *td, struct nfsnode **npp)
 {
 	struct vnode *newvp = NULL, *vp;
 	struct nfsnode *np, *dnp = VTONFS(dvp);
 	struct nfsfh *nfhp, *onfhp;
 	struct nfsvattr nfsva, dnfsva;
 	struct componentname cn;
 	int error = 0, attrflag, dattrflag;
 	u_int hash;
 
 	error = nfsrpc_lookup(dvp, name, len, cred, td, &dnfsva, &nfsva,
 	    &nfhp, &attrflag, &dattrflag, NULL);
 	if (dattrflag)
 		(void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
 	if (npp && !error) {
 		if (*npp != NULL) {
 		    np = *npp;
 		    vp = NFSTOV(np);
 		    /*
 		     * For NFSv4, check to see if it is the same name and
 		     * replace the name, if it is different.
 		     */
 		    if (np->n_v4 != NULL && nfsva.na_type == VREG &&
 			(np->n_v4->n4_namelen != len ||
 			 NFSBCMP(name, NFS4NODENAME(np->n_v4), len) ||
 			 dnp->n_fhp->nfh_len != np->n_v4->n4_fhlen ||
 			 NFSBCMP(dnp->n_fhp->nfh_fh, np->n_v4->n4_data,
 			 dnp->n_fhp->nfh_len))) {
 #ifdef notdef
 { char nnn[100]; int nnnl;
 nnnl = (len < 100) ? len : 99;
 bcopy(name, nnn, nnnl);
 nnn[nnnl] = '\0';
 printf("replace=%s\n",nnn);
 }
 #endif
 			    FREE((caddr_t)np->n_v4, M_NFSV4NODE);
 			    MALLOC(np->n_v4, struct nfsv4node *,
 				sizeof (struct nfsv4node) +
 				dnp->n_fhp->nfh_len + len - 1,
 				M_NFSV4NODE, M_WAITOK);
 			    np->n_v4->n4_fhlen = dnp->n_fhp->nfh_len;
 			    np->n_v4->n4_namelen = len;
 			    NFSBCOPY(dnp->n_fhp->nfh_fh, np->n_v4->n4_data,
 				dnp->n_fhp->nfh_len);
 			    NFSBCOPY(name, NFS4NODENAME(np->n_v4), len);
 		    }
 		    hash = fnv_32_buf(nfhp->nfh_fh, nfhp->nfh_len,
 			FNV1_32_INIT);
 		    onfhp = np->n_fhp;
 		    /*
 		     * Rehash node for new file handle.
 		     */
 		    vfs_hash_rehash(vp, hash);
 		    np->n_fhp = nfhp;
 		    if (onfhp != NULL)
 			FREE((caddr_t)onfhp, M_NFSFH);
 		    newvp = NFSTOV(np);
 		} else if (NFS_CMPFH(dnp, nfhp->nfh_fh, nfhp->nfh_len)) {
 		    FREE((caddr_t)nfhp, M_NFSFH);
 		    VREF(dvp);
 		    newvp = dvp;
 		} else {
 		    cn.cn_nameptr = name;
 		    cn.cn_namelen = len;
 		    error = nfscl_nget(dvp->v_mount, dvp, nfhp, &cn, td,
 			&np, NULL, LK_EXCLUSIVE);
 		    if (error)
 			return (error);
 		    newvp = NFSTOV(np);
 		}
 		if (!attrflag && *npp == NULL) {
 			if (newvp == dvp)
 				vrele(newvp);
 			else
 				vput(newvp);
 			return (ENOENT);
 		}
 		if (attrflag)
 			(void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
 			    0, 1);
 	}
 	if (npp && *npp == NULL) {
 		if (error) {
 			if (newvp) {
 				if (newvp == dvp)
 					vrele(newvp);
 				else
 					vput(newvp);
 			}
 		} else
 			*npp = np;
 	}
 	if (error && NFS_ISV4(dvp))
 		error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
 	return (error);
 }
 
 /*
  * Nfs Version 3 and 4 commit rpc
  */
 int
 ncl_commit(struct vnode *vp, u_quad_t offset, int cnt, struct ucred *cred,
    struct thread *td)
 {
 	struct nfsvattr nfsva;
 	struct nfsmount *nmp = VFSTONFS(vp->v_mount);
 	int error, attrflag;
 
 	mtx_lock(&nmp->nm_mtx);
 	if ((nmp->nm_state & NFSSTA_HASWRITEVERF) == 0) {
 		mtx_unlock(&nmp->nm_mtx);
 		return (0);
 	}
 	mtx_unlock(&nmp->nm_mtx);
 	error = nfsrpc_commit(vp, offset, cnt, cred, td, &nfsva,
 	    &attrflag, NULL);
 	if (attrflag != 0)
 		(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL,
 		    0, 1);
 	if (error != 0 && NFS_ISV4(vp))
 		error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
 	return (error);
 }
 
 /*
  * Strategy routine.
  * For async requests when nfsiod(s) are running, queue the request by
  * calling ncl_asyncio(), otherwise just all ncl_doio() to do the
  * request.
  */
 static int
 nfs_strategy(struct vop_strategy_args *ap)
 {
 	struct buf *bp = ap->a_bp;
 	struct ucred *cr;
 
 	KASSERT(!(bp->b_flags & B_DONE),
 	    ("nfs_strategy: buffer %p unexpectedly marked B_DONE", bp));
 	BUF_ASSERT_HELD(bp);
 
 	if (bp->b_iocmd == BIO_READ)
 		cr = bp->b_rcred;
 	else
 		cr = bp->b_wcred;
 
 	/*
 	 * If the op is asynchronous and an i/o daemon is waiting
 	 * queue the request, wake it up and wait for completion
 	 * otherwise just do it ourselves.
 	 */
 	if ((bp->b_flags & B_ASYNC) == 0 ||
 	    ncl_asyncio(VFSTONFS(ap->a_vp->v_mount), bp, NOCRED, curthread))
 		(void) ncl_doio(ap->a_vp, bp, cr, curthread, 1);
 	return (0);
 }
 
 /*
  * fsync vnode op. Just call ncl_flush() with commit == 1.
  */
 /* ARGSUSED */
 static int
 nfs_fsync(struct vop_fsync_args *ap)
 {
 
 	if (ap->a_vp->v_type != VREG) {
 		/*
 		 * For NFS, metadata is changed synchronously on the server,
 		 * so there is nothing to flush. Also, ncl_flush() clears
 		 * the NMODIFIED flag and that shouldn't be done here for
 		 * directories.
 		 */
 		return (0);
 	}
 	return (ncl_flush(ap->a_vp, ap->a_waitfor, NULL, ap->a_td, 1, 0));
 }
 
 /*
  * Flush all the blocks associated with a vnode.
  * 	Walk through the buffer pool and push any dirty pages
  *	associated with the vnode.
  * If the called_from_renewthread argument is TRUE, it has been called
  * from the NFSv4 renew thread and, as such, cannot block indefinitely
  * waiting for a buffer write to complete.
  */
 int
 ncl_flush(struct vnode *vp, int waitfor, struct ucred *cred, struct thread *td,
     int commit, int called_from_renewthread)
 {
 	struct nfsnode *np = VTONFS(vp);
 	struct buf *bp;
 	int i;
 	struct buf *nbp;
 	struct nfsmount *nmp = VFSTONFS(vp->v_mount);
 	int error = 0, slptimeo = 0, slpflag = 0, retv, bvecpos;
 	int passone = 1, trycnt = 0;
 	u_quad_t off, endoff, toff;
 	struct ucred* wcred = NULL;
 	struct buf **bvec = NULL;
 	struct bufobj *bo;
 #ifndef NFS_COMMITBVECSIZ
 #define	NFS_COMMITBVECSIZ	20
 #endif
 	struct buf *bvec_on_stack[NFS_COMMITBVECSIZ];
 	int bvecsize = 0, bveccount;
 
 	if (called_from_renewthread != 0)
 		slptimeo = hz;
 	if (nmp->nm_flag & NFSMNT_INT)
 		slpflag = PCATCH;
 	if (!commit)
 		passone = 0;
 	bo = &vp->v_bufobj;
 	/*
 	 * A b_flags == (B_DELWRI | B_NEEDCOMMIT) block has been written to the
 	 * server, but has not been committed to stable storage on the server
 	 * yet. On the first pass, the byte range is worked out and the commit
 	 * rpc is done. On the second pass, ncl_writebp() is called to do the
 	 * job.
 	 */
 again:
 	off = (u_quad_t)-1;
 	endoff = 0;
 	bvecpos = 0;
 	if (NFS_ISV34(vp) && commit) {
 		if (bvec != NULL && bvec != bvec_on_stack)
 			free(bvec, M_TEMP);
 		/*
 		 * Count up how many buffers waiting for a commit.
 		 */
 		bveccount = 0;
 		BO_LOCK(bo);
 		TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) {
 			if (!BUF_ISLOCKED(bp) &&
 			    (bp->b_flags & (B_DELWRI | B_NEEDCOMMIT))
 				== (B_DELWRI | B_NEEDCOMMIT))
 				bveccount++;
 		}
 		/*
 		 * Allocate space to remember the list of bufs to commit.  It is
 		 * important to use M_NOWAIT here to avoid a race with nfs_write.
 		 * If we can't get memory (for whatever reason), we will end up
 		 * committing the buffers one-by-one in the loop below.
 		 */
 		if (bveccount > NFS_COMMITBVECSIZ) {
 			/*
 			 * Release the vnode interlock to avoid a lock
 			 * order reversal.
 			 */
 			BO_UNLOCK(bo);
 			bvec = (struct buf **)
 				malloc(bveccount * sizeof(struct buf *),
 				       M_TEMP, M_NOWAIT);
 			BO_LOCK(bo);
 			if (bvec == NULL) {
 				bvec = bvec_on_stack;
 				bvecsize = NFS_COMMITBVECSIZ;
 			} else
 				bvecsize = bveccount;
 		} else {
 			bvec = bvec_on_stack;
 			bvecsize = NFS_COMMITBVECSIZ;
 		}
 		TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) {
 			if (bvecpos >= bvecsize)
 				break;
 			if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) {
 				nbp = TAILQ_NEXT(bp, b_bobufs);
 				continue;
 			}
 			if ((bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) !=
 			    (B_DELWRI | B_NEEDCOMMIT)) {
 				BUF_UNLOCK(bp);
 				nbp = TAILQ_NEXT(bp, b_bobufs);
 				continue;
 			}
 			BO_UNLOCK(bo);
 			bremfree(bp);
 			/*
 			 * Work out if all buffers are using the same cred
 			 * so we can deal with them all with one commit.
 			 *
 			 * NOTE: we are not clearing B_DONE here, so we have
 			 * to do it later on in this routine if we intend to
 			 * initiate I/O on the bp.
 			 *
 			 * Note: to avoid loopback deadlocks, we do not
 			 * assign b_runningbufspace.
 			 */
 			if (wcred == NULL)
 				wcred = bp->b_wcred;
 			else if (wcred != bp->b_wcred)
 				wcred = NOCRED;
 			vfs_busy_pages(bp, 1);
 
 			BO_LOCK(bo);
 			/*
 			 * bp is protected by being locked, but nbp is not
 			 * and vfs_busy_pages() may sleep.  We have to
 			 * recalculate nbp.
 			 */
 			nbp = TAILQ_NEXT(bp, b_bobufs);
 
 			/*
 			 * A list of these buffers is kept so that the
 			 * second loop knows which buffers have actually
 			 * been committed. This is necessary, since there
 			 * may be a race between the commit rpc and new
 			 * uncommitted writes on the file.
 			 */
 			bvec[bvecpos++] = bp;
 			toff = ((u_quad_t)bp->b_blkno) * DEV_BSIZE +
 				bp->b_dirtyoff;
 			if (toff < off)
 				off = toff;
 			toff += (u_quad_t)(bp->b_dirtyend - bp->b_dirtyoff);
 			if (toff > endoff)
 				endoff = toff;
 		}
 		BO_UNLOCK(bo);
 	}
 	if (bvecpos > 0) {
 		/*
 		 * Commit data on the server, as required.
 		 * If all bufs are using the same wcred, then use that with
 		 * one call for all of them, otherwise commit each one
 		 * separately.
 		 */
 		if (wcred != NOCRED)
 			retv = ncl_commit(vp, off, (int)(endoff - off),
 					  wcred, td);
 		else {
 			retv = 0;
 			for (i = 0; i < bvecpos; i++) {
 				off_t off, size;
 				bp = bvec[i];
 				off = ((u_quad_t)bp->b_blkno) * DEV_BSIZE +
 					bp->b_dirtyoff;
 				size = (u_quad_t)(bp->b_dirtyend
 						  - bp->b_dirtyoff);
 				retv = ncl_commit(vp, off, (int)size,
 						  bp->b_wcred, td);
 				if (retv) break;
 			}
 		}
 
 		if (retv == NFSERR_STALEWRITEVERF)
 			ncl_clearcommit(vp->v_mount);
 
 		/*
 		 * Now, either mark the blocks I/O done or mark the
 		 * blocks dirty, depending on whether the commit
 		 * succeeded.
 		 */
 		for (i = 0; i < bvecpos; i++) {
 			bp = bvec[i];
 			bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK);
 			if (retv) {
 				/*
 				 * Error, leave B_DELWRI intact
 				 */
 				vfs_unbusy_pages(bp);
 				brelse(bp);
 			} else {
 				/*
 				 * Success, remove B_DELWRI ( bundirty() ).
 				 *
 				 * b_dirtyoff/b_dirtyend seem to be NFS
 				 * specific.  We should probably move that
 				 * into bundirty(). XXX
 				 */
 				bufobj_wref(bo);
 				bp->b_flags |= B_ASYNC;
 				bundirty(bp);
 				bp->b_flags &= ~B_DONE;
 				bp->b_ioflags &= ~BIO_ERROR;
 				bp->b_dirtyoff = bp->b_dirtyend = 0;
 				bufdone(bp);
 			}
 		}
 	}
 
 	/*
 	 * Start/do any write(s) that are required.
 	 */
 loop:
 	BO_LOCK(bo);
 	TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) {
 		if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) {
 			if (waitfor != MNT_WAIT || passone)
 				continue;
 
 			error = BUF_TIMELOCK(bp,
 			    LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
 			    BO_LOCKPTR(bo), "nfsfsync", slpflag, slptimeo);
 			if (error == 0) {
 				BUF_UNLOCK(bp);
 				goto loop;
 			}
 			if (error == ENOLCK) {
 				error = 0;
 				goto loop;
 			}
 			if (called_from_renewthread != 0) {
 				/*
 				 * Return EIO so the flush will be retried
 				 * later.
 				 */
 				error = EIO;
 				goto done;
 			}
 			if (newnfs_sigintr(nmp, td)) {
 				error = EINTR;
 				goto done;
 			}
 			if (slpflag == PCATCH) {
 				slpflag = 0;
 				slptimeo = 2 * hz;
 			}
 			goto loop;
 		}
 		if ((bp->b_flags & B_DELWRI) == 0)
 			panic("nfs_fsync: not dirty");
 		if ((passone || !commit) && (bp->b_flags & B_NEEDCOMMIT)) {
 			BUF_UNLOCK(bp);
 			continue;
 		}
 		BO_UNLOCK(bo);
 		bremfree(bp);
 		if (passone || !commit)
 		    bp->b_flags |= B_ASYNC;
 		else
 		    bp->b_flags |= B_ASYNC;
 		bwrite(bp);
 		if (newnfs_sigintr(nmp, td)) {
 			error = EINTR;
 			goto done;
 		}
 		goto loop;
 	}
 	if (passone) {
 		passone = 0;
 		BO_UNLOCK(bo);
 		goto again;
 	}
 	if (waitfor == MNT_WAIT) {
 		while (bo->bo_numoutput) {
 			error = bufobj_wwait(bo, slpflag, slptimeo);
 			if (error) {
 			    BO_UNLOCK(bo);
 			    if (called_from_renewthread != 0) {
 				/*
 				 * Return EIO so that the flush will be
 				 * retried later.
 				 */
 				error = EIO;
 				goto done;
 			    }
 			    error = newnfs_sigintr(nmp, td);
 			    if (error)
 				goto done;
 			    if (slpflag == PCATCH) {
 				slpflag = 0;
 				slptimeo = 2 * hz;
 			    }
 			    BO_LOCK(bo);
 			}
 		}
 		if (bo->bo_dirty.bv_cnt != 0 && commit) {
 			BO_UNLOCK(bo);
 			goto loop;
 		}
 		/*
 		 * Wait for all the async IO requests to drain
 		 */
 		BO_UNLOCK(bo);
 		mtx_lock(&np->n_mtx);
 		while (np->n_directio_asyncwr > 0) {
 			np->n_flag |= NFSYNCWAIT;
 			error = newnfs_msleep(td, &np->n_directio_asyncwr,
 			    &np->n_mtx, slpflag | (PRIBIO + 1), 
 			    "nfsfsync", 0);
 			if (error) {
 				if (newnfs_sigintr(nmp, td)) {
 					mtx_unlock(&np->n_mtx);
 					error = EINTR;	
 					goto done;
 				}
 			}
 		}
 		mtx_unlock(&np->n_mtx);
 	} else
 		BO_UNLOCK(bo);
 	if (NFSHASPNFS(nmp)) {
 		nfscl_layoutcommit(vp, td);
 		/*
 		 * Invalidate the attribute cache, since writes to a DS
 		 * won't update the size attribute.
 		 */
 		mtx_lock(&np->n_mtx);
 		np->n_attrstamp = 0;
 	} else
 		mtx_lock(&np->n_mtx);
 	if (np->n_flag & NWRITEERR) {
 		error = np->n_error;
 		np->n_flag &= ~NWRITEERR;
 	}
   	if (commit && bo->bo_dirty.bv_cnt == 0 &&
 	    bo->bo_numoutput == 0 && np->n_directio_asyncwr == 0)
   		np->n_flag &= ~NMODIFIED;
 	mtx_unlock(&np->n_mtx);
 done:
 	if (bvec != NULL && bvec != bvec_on_stack)
 		free(bvec, M_TEMP);
 	if (error == 0 && commit != 0 && waitfor == MNT_WAIT &&
 	    (bo->bo_dirty.bv_cnt != 0 || bo->bo_numoutput != 0 ||
 	     np->n_directio_asyncwr != 0) && trycnt++ < 5) {
 		/* try, try again... */
 		passone = 1;
 		wcred = NULL;
 		bvec = NULL;
 		bvecsize = 0;
 printf("try%d\n", trycnt);
 		goto again;
 	}
 	return (error);
 }
 
 /*
  * NFS advisory byte-level locks.
  */
 static int
 nfs_advlock(struct vop_advlock_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct ucred *cred;
 	struct nfsnode *np = VTONFS(ap->a_vp);
 	struct proc *p = (struct proc *)ap->a_id;
 	struct thread *td = curthread;	/* XXX */
 	struct vattr va;
 	int ret, error = EOPNOTSUPP;
 	u_quad_t size;
 	
 	if (NFS_ISV4(vp) && (ap->a_flags & (F_POSIX | F_FLOCK)) != 0) {
 		if (vp->v_type != VREG)
 			return (EINVAL);
 		if ((ap->a_flags & F_POSIX) != 0)
 			cred = p->p_ucred;
 		else
 			cred = td->td_ucred;
 		NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
 		if (vp->v_iflag & VI_DOOMED) {
 			NFSVOPUNLOCK(vp, 0);
 			return (EBADF);
 		}
 
 		/*
 		 * If this is unlocking a write locked region, flush and
 		 * commit them before unlocking. This is required by
 		 * RFC3530 Sec. 9.3.2.
 		 */
 		if (ap->a_op == F_UNLCK &&
 		    nfscl_checkwritelocked(vp, ap->a_fl, cred, td, ap->a_id,
 		    ap->a_flags))
 			(void) ncl_flush(vp, MNT_WAIT, cred, td, 1, 0);
 
 		/*
 		 * Loop around doing the lock op, while a blocking lock
 		 * must wait for the lock op to succeed.
 		 */
 		do {
 			ret = nfsrpc_advlock(vp, np->n_size, ap->a_op,
 			    ap->a_fl, 0, cred, td, ap->a_id, ap->a_flags);
 			if (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
 			    ap->a_op == F_SETLK) {
 				NFSVOPUNLOCK(vp, 0);
 				error = nfs_catnap(PZERO | PCATCH, ret,
 				    "ncladvl");
 				if (error)
 					return (EINTR);
 				NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
 				if (vp->v_iflag & VI_DOOMED) {
 					NFSVOPUNLOCK(vp, 0);
 					return (EBADF);
 				}
 			}
 		} while (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
 		     ap->a_op == F_SETLK);
 		if (ret == NFSERR_DENIED) {
 			NFSVOPUNLOCK(vp, 0);
 			return (EAGAIN);
 		} else if (ret == EINVAL || ret == EBADF || ret == EINTR) {
 			NFSVOPUNLOCK(vp, 0);
 			return (ret);
 		} else if (ret != 0) {
 			NFSVOPUNLOCK(vp, 0);
 			return (EACCES);
 		}
 
 		/*
 		 * Now, if we just got a lock, invalidate data in the buffer
 		 * cache, as required, so that the coherency conforms with
 		 * RFC3530 Sec. 9.3.2.
 		 */
 		if (ap->a_op == F_SETLK) {
 			if ((np->n_flag & NMODIFIED) == 0) {
 				np->n_attrstamp = 0;
 				KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
 				ret = VOP_GETATTR(vp, &va, cred);
 			}
 			if ((np->n_flag & NMODIFIED) || ret ||
 			    np->n_change != va.va_filerev) {
 				(void) ncl_vinvalbuf(vp, V_SAVE, td, 1);
 				np->n_attrstamp = 0;
 				KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp);
 				ret = VOP_GETATTR(vp, &va, cred);
 				if (!ret) {
 					np->n_mtime = va.va_mtime;
 					np->n_change = va.va_filerev;
 				}
 			}
 			/* Mark that a file lock has been acquired. */
 			mtx_lock(&np->n_mtx);
 			np->n_flag |= NHASBEENLOCKED;
 			mtx_unlock(&np->n_mtx);
 		}
 		NFSVOPUNLOCK(vp, 0);
 		return (0);
 	} else if (!NFS_ISV4(vp)) {
 		error = NFSVOPLOCK(vp, LK_SHARED);
 		if (error)
 			return (error);
 		if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) {
 			size = VTONFS(vp)->n_size;
 			NFSVOPUNLOCK(vp, 0);
 			error = lf_advlock(ap, &(vp->v_lockf), size);
 		} else {
 			if (nfs_advlock_p != NULL)
 				error = nfs_advlock_p(ap);
 			else {
 				NFSVOPUNLOCK(vp, 0);
 				error = ENOLCK;
 			}
 		}
 		if (error == 0 && ap->a_op == F_SETLK) {
 			/* Mark that a file lock has been acquired. */
 			mtx_lock(&np->n_mtx);
 			np->n_flag |= NHASBEENLOCKED;
 			mtx_unlock(&np->n_mtx);
 		}
 	}
 	return (error);
 }
 
 /*
  * NFS advisory byte-level locks.
  */
 static int
 nfs_advlockasync(struct vop_advlockasync_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	u_quad_t size;
 	int error;
 	
 	if (NFS_ISV4(vp))
 		return (EOPNOTSUPP);
 	error = NFSVOPLOCK(vp, LK_SHARED);
 	if (error)
 		return (error);
 	if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) {
 		size = VTONFS(vp)->n_size;
 		NFSVOPUNLOCK(vp, 0);
 		error = lf_advlockasync(ap, &(vp->v_lockf), size);
 	} else {
 		NFSVOPUNLOCK(vp, 0);
 		error = EOPNOTSUPP;
 	}
 	return (error);
 }
 
 /*
  * Print out the contents of an nfsnode.
  */
 static int
 nfs_print(struct vop_print_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct nfsnode *np = VTONFS(vp);
 
 	ncl_printf("\tfileid %ld fsid 0x%x",
 	   np->n_vattr.na_fileid, np->n_vattr.na_fsid);
 	if (vp->v_type == VFIFO)
 		fifo_printinfo(vp);
 	printf("\n");
 	return (0);
 }
 
 /*
  * This is the "real" nfs::bwrite(struct buf*).
  * We set B_CACHE if this is a VMIO buffer.
  */
 int
 ncl_writebp(struct buf *bp, int force __unused, struct thread *td)
 {
 	int s;
 	int oldflags = bp->b_flags;
 #if 0
 	int retv = 1;
 	off_t off;
 #endif
 
 	BUF_ASSERT_HELD(bp);
 
 	if (bp->b_flags & B_INVAL) {
 		brelse(bp);
 		return(0);
 	}
 
 	bp->b_flags |= B_CACHE;
 
 	/*
 	 * Undirty the bp.  We will redirty it later if the I/O fails.
 	 */
 
 	s = splbio();
 	bundirty(bp);
 	bp->b_flags &= ~B_DONE;
 	bp->b_ioflags &= ~BIO_ERROR;
 	bp->b_iocmd = BIO_WRITE;
 
 	bufobj_wref(bp->b_bufobj);
 	curthread->td_ru.ru_oublock++;
 	splx(s);
 
 	/*
 	 * Note: to avoid loopback deadlocks, we do not
 	 * assign b_runningbufspace.
 	 */
 	vfs_busy_pages(bp, 1);
 
 	BUF_KERNPROC(bp);
 	bp->b_iooffset = dbtob(bp->b_blkno);
 	bstrategy(bp);
 
 	if( (oldflags & B_ASYNC) == 0) {
 		int rtval = bufwait(bp);
 
 		if (oldflags & B_DELWRI) {
 			s = splbio();
 			reassignbuf(bp);
 			splx(s);
 		}
 		brelse(bp);
 		return (rtval);
 	}
 
 	return (0);
 }
 
 /*
  * nfs special file access vnode op.
  * Essentially just get vattr and then imitate iaccess() since the device is
  * local to the client.
  */
 static int
 nfsspec_access(struct vop_access_args *ap)
 {
 	struct vattr *vap;
 	struct ucred *cred = ap->a_cred;
 	struct vnode *vp = ap->a_vp;
 	accmode_t accmode = ap->a_accmode;
 	struct vattr vattr;
 	int error;
 
 	/*
 	 * Disallow write attempts on filesystems mounted read-only;
 	 * unless the file is a socket, fifo, or a block or character
 	 * device resident on the filesystem.
 	 */
 	if ((accmode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY)) {
 		switch (vp->v_type) {
 		case VREG:
 		case VDIR:
 		case VLNK:
 			return (EROFS);
 		default:
 			break;
 		}
 	}
 	vap = &vattr;
 	error = VOP_GETATTR(vp, vap, cred);
 	if (error)
 		goto out;
 	error  = vaccess(vp->v_type, vap->va_mode, vap->va_uid, vap->va_gid,
 	    accmode, cred, NULL);
 out:
 	return error;
 }
 
 /*
  * Read wrapper for fifos.
  */
 static int
 nfsfifo_read(struct vop_read_args *ap)
 {
 	struct nfsnode *np = VTONFS(ap->a_vp);
 	int error;
 
 	/*
 	 * Set access flag.
 	 */
 	mtx_lock(&np->n_mtx);
 	np->n_flag |= NACC;
 	vfs_timestamp(&np->n_atim);
 	mtx_unlock(&np->n_mtx);
 	error = fifo_specops.vop_read(ap);
 	return error;	
 }
 
 /*
  * Write wrapper for fifos.
  */
 static int
 nfsfifo_write(struct vop_write_args *ap)
 {
 	struct nfsnode *np = VTONFS(ap->a_vp);
 
 	/*
 	 * Set update flag.
 	 */
 	mtx_lock(&np->n_mtx);
 	np->n_flag |= NUPD;
 	vfs_timestamp(&np->n_mtim);
 	mtx_unlock(&np->n_mtx);
 	return(fifo_specops.vop_write(ap));
 }
 
 /*
  * Close wrapper for fifos.
  *
  * Update the times on the nfsnode then do fifo close.
  */
 static int
 nfsfifo_close(struct vop_close_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct nfsnode *np = VTONFS(vp);
 	struct vattr vattr;
 	struct timespec ts;
 
 	mtx_lock(&np->n_mtx);
 	if (np->n_flag & (NACC | NUPD)) {
 		vfs_timestamp(&ts);
 		if (np->n_flag & NACC)
 			np->n_atim = ts;
 		if (np->n_flag & NUPD)
 			np->n_mtim = ts;
 		np->n_flag |= NCHG;
 		if (vrefcnt(vp) == 1 &&
 		    (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
 			VATTR_NULL(&vattr);
 			if (np->n_flag & NACC)
 				vattr.va_atime = np->n_atim;
 			if (np->n_flag & NUPD)
 				vattr.va_mtime = np->n_mtim;
 			mtx_unlock(&np->n_mtx);
 			(void)VOP_SETATTR(vp, &vattr, ap->a_cred);
 			goto out;
 		}
 	}
 	mtx_unlock(&np->n_mtx);
 out:
 	return (fifo_specops.vop_close(ap));
 }
 
 /*
  * Just call ncl_writebp() with the force argument set to 1.
  *
  * NOTE: B_DONE may or may not be set in a_bp on call.
  */
 static int
 nfs_bwrite(struct buf *bp)
 {
 
 	return (ncl_writebp(bp, 1, curthread));
 }
 
 struct buf_ops buf_ops_newnfs = {
 	.bop_name	=	"buf_ops_nfs",
 	.bop_write	=	nfs_bwrite,
 	.bop_strategy	=	bufstrategy,
 	.bop_sync	=	bufsync,
 	.bop_bdflush	=	bufbdflush,
 };
 
 /*
  * Cloned from vop_stdlock(), and then the ugly hack added.
  */
 static int
 nfs_lock1(struct vop_lock1_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	int error = 0;
 
 	/*
 	 * Since vfs_hash_get() calls vget() and it will no longer work
 	 * for FreeBSD8 with flags == 0, I can only think of this horrible
 	 * hack to work around it. I call vfs_hash_get() with LK_EXCLOTHER
 	 * and then handle it here. All I want for this case is a v_usecount
 	 * on the vnode to use for recovery, while another thread might
 	 * hold a lock on the vnode. I have the other threads blocked, so
 	 * there isn't any race problem.
 	 */
 	if ((ap->a_flags & LK_TYPE_MASK) == LK_EXCLOTHER) {
 		if ((ap->a_flags & LK_INTERLOCK) == 0)
 			panic("ncllock1");
 		if ((vp->v_iflag & VI_DOOMED))
 			error = ENOENT;
 		VI_UNLOCK(vp);
 		return (error);
 	}
 	return (_lockmgr_args(vp->v_vnlock, ap->a_flags, VI_MTX(vp),
 	    LK_WMESG_DEFAULT, LK_PRIO_DEFAULT, LK_TIMO_DEFAULT, ap->a_file,
 	    ap->a_line));
 }
 
 static int
 nfs_getacl(struct vop_getacl_args *ap)
 {
 	int error;
 
 	if (ap->a_type != ACL_TYPE_NFS4)
 		return (EOPNOTSUPP);
 	error = nfsrpc_getacl(ap->a_vp, ap->a_cred, ap->a_td, ap->a_aclp,
 	    NULL);
 	if (error > NFSERR_STALE) {
 		(void) nfscl_maperr(ap->a_td, error, (uid_t)0, (gid_t)0);
 		error = EPERM;
 	}
 	return (error);
 }
 
 static int
 nfs_setacl(struct vop_setacl_args *ap)
 {
 	int error;
 
 	if (ap->a_type != ACL_TYPE_NFS4)
 		return (EOPNOTSUPP);
 	error = nfsrpc_setacl(ap->a_vp, ap->a_cred, ap->a_td, ap->a_aclp,
 	    NULL);
 	if (error > NFSERR_STALE) {
 		(void) nfscl_maperr(ap->a_td, error, (uid_t)0, (gid_t)0);
 		error = EPERM;
 	}
 	return (error);
 }
 
 /*
  * Return POSIX pathconf information applicable to nfs filesystems.
  */
 static int
 nfs_pathconf(struct vop_pathconf_args *ap)
 {
 	struct nfsv3_pathconf pc;
 	struct nfsvattr nfsva;
 	struct vnode *vp = ap->a_vp;
 	struct thread *td = curthread;
 	int attrflag, error;
 
 	if ((NFS_ISV34(vp) && (ap->a_name == _PC_LINK_MAX ||
 	    ap->a_name == _PC_NAME_MAX || ap->a_name == _PC_CHOWN_RESTRICTED ||
 	    ap->a_name == _PC_NO_TRUNC)) ||
 	    (NFS_ISV4(vp) && ap->a_name == _PC_ACL_NFS4)) {
 		/*
 		 * Since only the above 4 a_names are returned by the NFSv3
 		 * Pathconf RPC, there is no point in doing it for others.
 		 * For NFSv4, the Pathconf RPC (actually a Getattr Op.) can
 		 * be used for _PC_NFS4_ACL as well.
 		 */
 		error = nfsrpc_pathconf(vp, &pc, td->td_ucred, td, &nfsva,
 		    &attrflag, NULL);
 		if (attrflag != 0)
 			(void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL, 0,
 			    1);
 		if (error != 0)
 			return (error);
 	} else {
 		/*
 		 * For NFSv2 (or NFSv3 when not one of the above 4 a_names),
 		 * just fake them.
 		 */
 		pc.pc_linkmax = LINK_MAX;
 		pc.pc_namemax = NFS_MAXNAMLEN;
 		pc.pc_notrunc = 1;
 		pc.pc_chownrestricted = 1;
 		pc.pc_caseinsensitive = 0;
 		pc.pc_casepreserving = 1;
 		error = 0;
 	}
 	switch (ap->a_name) {
 	case _PC_LINK_MAX:
 		*ap->a_retval = pc.pc_linkmax;
 		break;
 	case _PC_NAME_MAX:
 		*ap->a_retval = pc.pc_namemax;
 		break;
 	case _PC_PATH_MAX:
 		*ap->a_retval = PATH_MAX;
 		break;
 	case _PC_PIPE_BUF:
 		*ap->a_retval = PIPE_BUF;
 		break;
 	case _PC_CHOWN_RESTRICTED:
 		*ap->a_retval = pc.pc_chownrestricted;
 		break;
 	case _PC_NO_TRUNC:
 		*ap->a_retval = pc.pc_notrunc;
 		break;
 	case _PC_ACL_EXTENDED:
 		*ap->a_retval = 0;
 		break;
 	case _PC_ACL_NFS4:
 		if (NFS_ISV4(vp) && nfsrv_useacl != 0 && attrflag != 0 &&
 		    NFSISSET_ATTRBIT(&nfsva.na_suppattr, NFSATTRBIT_ACL))
 			*ap->a_retval = 1;
 		else
 			*ap->a_retval = 0;
 		break;
 	case _PC_ACL_PATH_MAX:
 		if (NFS_ISV4(vp))
 			*ap->a_retval = ACL_MAX_ENTRIES;
 		else
 			*ap->a_retval = 3;
 		break;
 	case _PC_MAC_PRESENT:
 		*ap->a_retval = 0;
 		break;
 	case _PC_ASYNC_IO:
 		/* _PC_ASYNC_IO should have been handled by upper layers. */
 		KASSERT(0, ("_PC_ASYNC_IO should not get here"));
 		error = EINVAL;
 		break;
 	case _PC_PRIO_IO:
 		*ap->a_retval = 0;
 		break;
 	case _PC_SYNC_IO:
 		*ap->a_retval = 0;
 		break;
 	case _PC_ALLOC_SIZE_MIN:
 		*ap->a_retval = vp->v_mount->mnt_stat.f_bsize;
 		break;
 	case _PC_FILESIZEBITS:
 		if (NFS_ISV34(vp))
 			*ap->a_retval = 64;
 		else
 			*ap->a_retval = 32;
 		break;
 	case _PC_REC_INCR_XFER_SIZE:
 		*ap->a_retval = vp->v_mount->mnt_stat.f_iosize;
 		break;
 	case _PC_REC_MAX_XFER_SIZE:
 		*ap->a_retval = -1; /* means ``unlimited'' */
 		break;
 	case _PC_REC_MIN_XFER_SIZE:
 		*ap->a_retval = vp->v_mount->mnt_stat.f_iosize;
 		break;
 	case _PC_REC_XFER_ALIGN:
 		*ap->a_retval = PAGE_SIZE;
 		break;
 	case _PC_SYMLINK_MAX:
 		*ap->a_retval = NFS_MAXPATHLEN;
 		break;
 
 	default:
 		error = EINVAL;
 		break;
 	}
 	return (error);
 }
 
Index: projects/arm_intrng/sys/fs/nfsserver/nfs_nfsdport.c
===================================================================
--- projects/arm_intrng/sys/fs/nfsserver/nfs_nfsdport.c	(revision 276247)
+++ projects/arm_intrng/sys/fs/nfsserver/nfs_nfsdport.c	(revision 276248)
@@ -1,3415 +1,3408 @@
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
  * Rick Macklem at The University of Guelph.
  *
  * 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.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 
 /*
  * Functions that perform the vfs operations required by the routines in
  * nfsd_serv.c. It is hoped that this change will make the server more
  * portable.
  */
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 FEATURE(nfsd, "NFSv4 server");
 
 extern u_int32_t newnfs_true, newnfs_false, newnfs_xdrneg1;
 extern int nfsrv_useacl;
 extern int newnfs_numnfsd;
 extern struct mount nfsv4root_mnt;
 extern struct nfsrv_stablefirst nfsrv_stablefirst;
 extern void (*nfsd_call_servertimer)(void);
 extern SVCPOOL	*nfsrvd_pool;
 extern struct nfsv4lock nfsd_suspend_lock;
 extern struct nfssessionhash nfssessionhash[NFSSESSIONHASHSIZE];
 struct vfsoptlist nfsv4root_opt, nfsv4root_newopt;
 NFSDLOCKMUTEX;
 struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE];
 struct nfsrchash_bucket nfsrcahash_table[NFSRVCACHE_HASHSIZE];
 struct mtx nfsrc_udpmtx;
 struct mtx nfs_v4root_mutex;
 struct nfsrvfh nfs_rootfh, nfs_pubfh;
 int nfs_pubfhset = 0, nfs_rootfhset = 0;
 struct proc *nfsd_master_proc = NULL;
 int nfsd_debuglevel = 0;
 static pid_t nfsd_master_pid = (pid_t)-1;
 static char nfsd_master_comm[MAXCOMLEN + 1];
 static struct timeval nfsd_master_start;
 static uint32_t nfsv4_sysid = 0;
 
 static int nfssvc_srvcall(struct thread *, struct nfssvc_args *,
     struct ucred *);
 
 int nfsrv_enable_crossmntpt = 1;
 static int nfs_commit_blks;
 static int nfs_commit_miss;
 extern int nfsrv_issuedelegs;
 extern int nfsrv_dolocallocks;
 extern int nfsd_enable_stringtouid;
 
 SYSCTL_NODE(_vfs, OID_AUTO, nfsd, CTLFLAG_RW, 0, "New NFS server");
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, mirrormnt, CTLFLAG_RW,
     &nfsrv_enable_crossmntpt, 0, "Enable nfsd to cross mount points");
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, commit_blks, CTLFLAG_RW, &nfs_commit_blks,
     0, "");
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, commit_miss, CTLFLAG_RW, &nfs_commit_miss,
     0, "");
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_delegations, CTLFLAG_RW,
     &nfsrv_issuedelegs, 0, "Enable nfsd to issue delegations");
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW,
     &nfsrv_dolocallocks, 0, "Enable nfsd to acquire local locks on files");
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, debuglevel, CTLFLAG_RW, &nfsd_debuglevel,
     0, "Debug level for new nfs server");
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_stringtouid, CTLFLAG_RW,
     &nfsd_enable_stringtouid, 0, "Enable nfsd to accept numeric owner_names");
 
 #define	MAX_REORDERED_RPC	16
 #define	NUM_HEURISTIC		1031
 #define	NHUSE_INIT		64
 #define	NHUSE_INC		16
 #define	NHUSE_MAX		2048
 
 static struct nfsheur {
 	struct vnode *nh_vp;	/* vp to match (unreferenced pointer) */
 	off_t nh_nextoff;	/* next offset for sequential detection */
 	int nh_use;		/* use count for selection */
 	int nh_seqcount;	/* heuristic */
 } nfsheur[NUM_HEURISTIC];
 
 
 /*
  * Heuristic to detect sequential operation.
  */
 static struct nfsheur *
 nfsrv_sequential_heuristic(struct uio *uio, struct vnode *vp)
 {
 	struct nfsheur *nh;
 	int hi, try;
 
 	/* Locate best candidate. */
 	try = 32;
 	hi = ((int)(vm_offset_t)vp / sizeof(struct vnode)) % NUM_HEURISTIC;
 	nh = &nfsheur[hi];
 	while (try--) {
 		if (nfsheur[hi].nh_vp == vp) {
 			nh = &nfsheur[hi];
 			break;
 		}
 		if (nfsheur[hi].nh_use > 0)
 			--nfsheur[hi].nh_use;
 		hi = (hi + 1) % NUM_HEURISTIC;
 		if (nfsheur[hi].nh_use < nh->nh_use)
 			nh = &nfsheur[hi];
 	}
 
 	/* Initialize hint if this is a new file. */
 	if (nh->nh_vp != vp) {
 		nh->nh_vp = vp;
 		nh->nh_nextoff = uio->uio_offset;
 		nh->nh_use = NHUSE_INIT;
 		if (uio->uio_offset == 0)
 			nh->nh_seqcount = 4;
 		else
 			nh->nh_seqcount = 1;
 	}
 
 	/* Calculate heuristic. */
 	if ((uio->uio_offset == 0 && nh->nh_seqcount > 0) ||
 	    uio->uio_offset == nh->nh_nextoff) {
 		/* See comments in vfs_vnops.c:sequential_heuristic(). */
 		nh->nh_seqcount += howmany(uio->uio_resid, 16384);
 		if (nh->nh_seqcount > IO_SEQMAX)
 			nh->nh_seqcount = IO_SEQMAX;
 	} else if (qabs(uio->uio_offset - nh->nh_nextoff) <= MAX_REORDERED_RPC *
 	    imax(vp->v_mount->mnt_stat.f_iosize, uio->uio_resid)) {
 		/* Probably a reordered RPC, leave seqcount alone. */
 	} else if (nh->nh_seqcount > 1) {
 		nh->nh_seqcount /= 2;
 	} else {
 		nh->nh_seqcount = 0;
 	}
 	nh->nh_use += NHUSE_INC;
 	if (nh->nh_use > NHUSE_MAX)
 		nh->nh_use = NHUSE_MAX;
 	return (nh);
 }
 
 /*
  * Get attributes into nfsvattr structure.
  */
 int
 nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap, struct ucred *cred,
     struct thread *p, int vpislocked)
 {
 	int error, lockedit = 0;
 
 	if (vpislocked == 0) {
 		/*
 		 * When vpislocked == 0, the vnode is either exclusively
 		 * locked by this thread or not locked by this thread.
 		 * As such, shared lock it, if not exclusively locked.
 		 */
 		if (NFSVOPISLOCKED(vp) != LK_EXCLUSIVE) {
 			lockedit = 1;
 			NFSVOPLOCK(vp, LK_SHARED | LK_RETRY);
 		}
 	}
 	error = VOP_GETATTR(vp, &nvap->na_vattr, cred);
 	if (lockedit != 0)
 		NFSVOPUNLOCK(vp, 0);
 
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Get a file handle for a vnode.
  */
 int
 nfsvno_getfh(struct vnode *vp, fhandle_t *fhp, struct thread *p)
 {
 	int error;
 
 	NFSBZERO((caddr_t)fhp, sizeof(fhandle_t));
 	fhp->fh_fsid = vp->v_mount->mnt_stat.f_fsid;
 	error = VOP_VPTOFH(vp, &fhp->fh_fid);
 
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Perform access checking for vnodes obtained from file handles that would
  * refer to files already opened by a Unix client. You cannot just use
  * vn_writechk() and VOP_ACCESSX() for two reasons.
  * 1 - You must check for exported rdonly as well as MNT_RDONLY for the write
  *     case.
  * 2 - The owner is to be given access irrespective of mode bits for some
  *     operations, so that processes that chmod after opening a file don't
  *     break.
  */
 int
 nfsvno_accchk(struct vnode *vp, accmode_t accmode, struct ucred *cred,
     struct nfsexstuff *exp, struct thread *p, int override, int vpislocked,
     u_int32_t *supportedtypep)
 {
 	struct vattr vattr;
 	int error = 0, getret = 0;
 
 	if (vpislocked == 0) {
 		if (NFSVOPLOCK(vp, LK_SHARED) != 0) {
 			error = EPERM;
 			goto out;
 		}
 	}
 	if (accmode & VWRITE) {
 		/* Just vn_writechk() changed to check rdonly */
 		/*
 		 * Disallow write attempts on read-only file systems;
 		 * unless the file is a socket or a block or character
 		 * device resident on the file system.
 		 */
 		if (NFSVNO_EXRDONLY(exp) ||
 		    (vp->v_mount->mnt_flag & MNT_RDONLY)) {
 			switch (vp->v_type) {
 			case VREG:
 			case VDIR:
 			case VLNK:
 				error = EROFS;
 			default:
 				break;
 			}
 		}
 		/*
 		 * If there's shared text associated with
 		 * the inode, try to free it up once.  If
 		 * we fail, we can't allow writing.
 		 */
 		if (VOP_IS_TEXT(vp) && error == 0)
 			error = ETXTBSY;
 	}
 	if (error != 0) {
 		if (vpislocked == 0)
 			NFSVOPUNLOCK(vp, 0);
 		goto out;
 	}
 
 	/*
 	 * Should the override still be applied when ACLs are enabled?
 	 */
 	error = VOP_ACCESSX(vp, accmode, cred, p);
 	if (error != 0 && (accmode & (VDELETE | VDELETE_CHILD))) {
 		/*
 		 * Try again with VEXPLICIT_DENY, to see if the test for
 		 * deletion is supported.
 		 */
 		error = VOP_ACCESSX(vp, accmode | VEXPLICIT_DENY, cred, p);
 		if (error == 0) {
 			if (vp->v_type == VDIR) {
 				accmode &= ~(VDELETE | VDELETE_CHILD);
 				accmode |= VWRITE;
 				error = VOP_ACCESSX(vp, accmode, cred, p);
 			} else if (supportedtypep != NULL) {
 				*supportedtypep &= ~NFSACCESS_DELETE;
 			}
 		}
 	}
 
 	/*
 	 * Allow certain operations for the owner (reads and writes
 	 * on files that are already open).
 	 */
 	if (override != NFSACCCHK_NOOVERRIDE &&
 	    (error == EPERM || error == EACCES)) {
 		if (cred->cr_uid == 0 && (override & NFSACCCHK_ALLOWROOT))
 			error = 0;
 		else if (override & NFSACCCHK_ALLOWOWNER) {
 			getret = VOP_GETATTR(vp, &vattr, cred);
 			if (getret == 0 && cred->cr_uid == vattr.va_uid)
 				error = 0;
 		}
 	}
 	if (vpislocked == 0)
 		NFSVOPUNLOCK(vp, 0);
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Set attribute(s) vnop.
  */
 int
 nfsvno_setattr(struct vnode *vp, struct nfsvattr *nvap, struct ucred *cred,
     struct thread *p, struct nfsexstuff *exp)
 {
 	int error;
 
 	error = VOP_SETATTR(vp, &nvap->na_vattr, cred);
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Set up nameidata for a lookup() call and do it.
  */
 int
 nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp,
     struct vnode *dp, int islocked, struct nfsexstuff *exp, struct thread *p,
     struct vnode **retdirp)
 {
 	struct componentname *cnp = &ndp->ni_cnd;
 	int i;
 	struct iovec aiov;
 	struct uio auio;
 	int lockleaf = (cnp->cn_flags & LOCKLEAF) != 0, linklen;
 	int error = 0, crossmnt;
 	char *cp;
 
 	*retdirp = NULL;
 	cnp->cn_nameptr = cnp->cn_pnbuf;
 	ndp->ni_strictrelative = 0;
 	/*
 	 * Extract and set starting directory.
 	 */
 	if (dp->v_type != VDIR) {
 		if (islocked)
 			vput(dp);
 		else
 			vrele(dp);
 		nfsvno_relpathbuf(ndp);
 		error = ENOTDIR;
 		goto out1;
 	}
 	if (islocked)
 		NFSVOPUNLOCK(dp, 0);
 	VREF(dp);
 	*retdirp = dp;
 	if (NFSVNO_EXRDONLY(exp))
 		cnp->cn_flags |= RDONLY;
 	ndp->ni_segflg = UIO_SYSSPACE;
 	crossmnt = 1;
 
 	if (nd->nd_flag & ND_PUBLOOKUP) {
 		ndp->ni_loopcnt = 0;
 		if (cnp->cn_pnbuf[0] == '/') {
 			vrele(dp);
 			/*
 			 * Check for degenerate pathnames here, since lookup()
 			 * panics on them.
 			 */
 			for (i = 1; i < ndp->ni_pathlen; i++)
 				if (cnp->cn_pnbuf[i] != '/')
 					break;
 			if (i == ndp->ni_pathlen) {
 				error = NFSERR_ACCES;
 				goto out;
 			}
 			dp = rootvnode;
 			VREF(dp);
 		}
 	} else if ((nfsrv_enable_crossmntpt == 0 && NFSVNO_EXPORTED(exp)) ||
 	    (nd->nd_flag & ND_NFSV4) == 0) {
 		/*
 		 * Only cross mount points for NFSv4 when doing a
 		 * mount while traversing the file system above
 		 * the mount point, unless nfsrv_enable_crossmntpt is set.
 		 */
 		cnp->cn_flags |= NOCROSSMOUNT;
 		crossmnt = 0;
 	}
 
 	/*
 	 * Initialize for scan, set ni_startdir and bump ref on dp again
 	 * because lookup() will dereference ni_startdir.
 	 */
 
 	cnp->cn_thread = p;
 	ndp->ni_startdir = dp;
 	ndp->ni_rootdir = rootvnode;
 	ndp->ni_topdir = NULL;
 
 	if (!lockleaf)
 		cnp->cn_flags |= LOCKLEAF;
 	for (;;) {
 		cnp->cn_nameptr = cnp->cn_pnbuf;
 		/*
 		 * Call lookup() to do the real work.  If an error occurs,
 		 * ndp->ni_vp and ni_dvp are left uninitialized or NULL and
 		 * we do not have to dereference anything before returning.
 		 * In either case ni_startdir will be dereferenced and NULLed
 		 * out.
 		 */
 		error = lookup(ndp);
 		if (error)
 			break;
 
 		/*
 		 * Check for encountering a symbolic link.  Trivial
 		 * termination occurs if no symlink encountered.
 		 */
 		if ((cnp->cn_flags & ISSYMLINK) == 0) {
 			if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0)
 				nfsvno_relpathbuf(ndp);
 			if (ndp->ni_vp && !lockleaf)
 				NFSVOPUNLOCK(ndp->ni_vp, 0);
 			break;
 		}
 
 		/*
 		 * Validate symlink
 		 */
 		if ((cnp->cn_flags & LOCKPARENT) && ndp->ni_pathlen == 1)
 			NFSVOPUNLOCK(ndp->ni_dvp, 0);
 		if (!(nd->nd_flag & ND_PUBLOOKUP)) {
 			error = EINVAL;
 			goto badlink2;
 		}
 
 		if (ndp->ni_loopcnt++ >= MAXSYMLINKS) {
 			error = ELOOP;
 			goto badlink2;
 		}
 		if (ndp->ni_pathlen > 1)
 			cp = uma_zalloc(namei_zone, M_WAITOK);
 		else
 			cp = cnp->cn_pnbuf;
 		aiov.iov_base = cp;
 		aiov.iov_len = MAXPATHLEN;
 		auio.uio_iov = &aiov;
 		auio.uio_iovcnt = 1;
 		auio.uio_offset = 0;
 		auio.uio_rw = UIO_READ;
 		auio.uio_segflg = UIO_SYSSPACE;
 		auio.uio_td = NULL;
 		auio.uio_resid = MAXPATHLEN;
 		error = VOP_READLINK(ndp->ni_vp, &auio, cnp->cn_cred);
 		if (error) {
 		badlink1:
 			if (ndp->ni_pathlen > 1)
 				uma_zfree(namei_zone, cp);
 		badlink2:
 			vrele(ndp->ni_dvp);
 			vput(ndp->ni_vp);
 			break;
 		}
 		linklen = MAXPATHLEN - auio.uio_resid;
 		if (linklen == 0) {
 			error = ENOENT;
 			goto badlink1;
 		}
 		if (linklen + ndp->ni_pathlen >= MAXPATHLEN) {
 			error = ENAMETOOLONG;
 			goto badlink1;
 		}
 
 		/*
 		 * Adjust or replace path
 		 */
 		if (ndp->ni_pathlen > 1) {
 			NFSBCOPY(ndp->ni_next, cp + linklen, ndp->ni_pathlen);
 			uma_zfree(namei_zone, cnp->cn_pnbuf);
 			cnp->cn_pnbuf = cp;
 		} else
 			cnp->cn_pnbuf[linklen] = '\0';
 		ndp->ni_pathlen += linklen;
 
 		/*
 		 * Cleanup refs for next loop and check if root directory
 		 * should replace current directory.  Normally ni_dvp
 		 * becomes the new base directory and is cleaned up when
 		 * we loop.  Explicitly null pointers after invalidation
 		 * to clarify operation.
 		 */
 		vput(ndp->ni_vp);
 		ndp->ni_vp = NULL;
 
 		if (cnp->cn_pnbuf[0] == '/') {
 			vrele(ndp->ni_dvp);
 			ndp->ni_dvp = ndp->ni_rootdir;
 			VREF(ndp->ni_dvp);
 		}
 		ndp->ni_startdir = ndp->ni_dvp;
 		ndp->ni_dvp = NULL;
 	}
 	if (!lockleaf)
 		cnp->cn_flags &= ~LOCKLEAF;
 
 out:
 	if (error) {
 		nfsvno_relpathbuf(ndp);
 		ndp->ni_vp = NULL;
 		ndp->ni_dvp = NULL;
 		ndp->ni_startdir = NULL;
 	} else if ((ndp->ni_cnd.cn_flags & (WANTPARENT|LOCKPARENT)) == 0) {
 		ndp->ni_dvp = NULL;
 	}
 
 out1:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Set up a pathname buffer and return a pointer to it and, optionally
  * set a hash pointer.
  */
 void
 nfsvno_setpathbuf(struct nameidata *ndp, char **bufpp, u_long **hashpp)
 {
 	struct componentname *cnp = &ndp->ni_cnd;
 
 	cnp->cn_flags |= (NOMACCHECK | HASBUF);
 	cnp->cn_pnbuf = uma_zalloc(namei_zone, M_WAITOK);
 	if (hashpp != NULL)
 		*hashpp = NULL;
 	*bufpp = cnp->cn_pnbuf;
 }
 
 /*
  * Release the above path buffer, if not released by nfsvno_namei().
  */
 void
 nfsvno_relpathbuf(struct nameidata *ndp)
 {
 
 	if ((ndp->ni_cnd.cn_flags & HASBUF) == 0)
 		panic("nfsrelpath");
 	uma_zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
 	ndp->ni_cnd.cn_flags &= ~HASBUF;
 }
 
 /*
  * Readlink vnode op into an mbuf list.
  */
 int
 nfsvno_readlink(struct vnode *vp, struct ucred *cred, struct thread *p,
     struct mbuf **mpp, struct mbuf **mpendp, int *lenp)
 {
 	struct iovec iv[(NFS_MAXPATHLEN+MLEN-1)/MLEN];
 	struct iovec *ivp = iv;
 	struct uio io, *uiop = &io;
 	struct mbuf *mp, *mp2 = NULL, *mp3 = NULL;
 	int i, len, tlen, error = 0;
 
 	len = 0;
 	i = 0;
 	while (len < NFS_MAXPATHLEN) {
 		NFSMGET(mp);
 		MCLGET(mp, M_WAITOK);
 		mp->m_len = NFSMSIZ(mp);
 		if (len == 0) {
 			mp3 = mp2 = mp;
 		} else {
 			mp2->m_next = mp;
 			mp2 = mp;
 		}
 		if ((len + mp->m_len) > NFS_MAXPATHLEN) {
 			mp->m_len = NFS_MAXPATHLEN - len;
 			len = NFS_MAXPATHLEN;
 		} else {
 			len += mp->m_len;
 		}
 		ivp->iov_base = mtod(mp, caddr_t);
 		ivp->iov_len = mp->m_len;
 		i++;
 		ivp++;
 	}
 	uiop->uio_iov = iv;
 	uiop->uio_iovcnt = i;
 	uiop->uio_offset = 0;
 	uiop->uio_resid = len;
 	uiop->uio_rw = UIO_READ;
 	uiop->uio_segflg = UIO_SYSSPACE;
 	uiop->uio_td = NULL;
 	error = VOP_READLINK(vp, uiop, cred);
 	if (error) {
 		m_freem(mp3);
 		*lenp = 0;
 		goto out;
 	}
 	if (uiop->uio_resid > 0) {
 		len -= uiop->uio_resid;
 		tlen = NFSM_RNDUP(len);
 		nfsrv_adj(mp3, NFS_MAXPATHLEN - tlen, tlen - len);
 	}
 	*lenp = len;
 	*mpp = mp3;
 	*mpendp = mp;
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Read vnode op call into mbuf list.
  */
 int
 nfsvno_read(struct vnode *vp, off_t off, int cnt, struct ucred *cred,
     struct thread *p, struct mbuf **mpp, struct mbuf **mpendp)
 {
 	struct mbuf *m;
 	int i;
 	struct iovec *iv;
 	struct iovec *iv2;
 	int error = 0, len, left, siz, tlen, ioflag = 0;
 	struct mbuf *m2 = NULL, *m3;
 	struct uio io, *uiop = &io;
 	struct nfsheur *nh;
 
 	len = left = NFSM_RNDUP(cnt);
 	m3 = NULL;
 	/*
 	 * Generate the mbuf list with the uio_iov ref. to it.
 	 */
 	i = 0;
 	while (left > 0) {
 		NFSMGET(m);
 		MCLGET(m, M_WAITOK);
 		m->m_len = 0;
 		siz = min(M_TRAILINGSPACE(m), left);
 		left -= siz;
 		i++;
 		if (m3)
 			m2->m_next = m;
 		else
 			m3 = m;
 		m2 = m;
 	}
 	MALLOC(iv, struct iovec *, i * sizeof (struct iovec),
 	    M_TEMP, M_WAITOK);
 	uiop->uio_iov = iv2 = iv;
 	m = m3;
 	left = len;
 	i = 0;
 	while (left > 0) {
 		if (m == NULL)
 			panic("nfsvno_read iov");
 		siz = min(M_TRAILINGSPACE(m), left);
 		if (siz > 0) {
 			iv->iov_base = mtod(m, caddr_t) + m->m_len;
 			iv->iov_len = siz;
 			m->m_len += siz;
 			left -= siz;
 			iv++;
 			i++;
 		}
 		m = m->m_next;
 	}
 	uiop->uio_iovcnt = i;
 	uiop->uio_offset = off;
 	uiop->uio_resid = len;
 	uiop->uio_rw = UIO_READ;
 	uiop->uio_segflg = UIO_SYSSPACE;
 	uiop->uio_td = NULL;
 	nh = nfsrv_sequential_heuristic(uiop, vp);
 	ioflag |= nh->nh_seqcount << IO_SEQSHIFT;
 	error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred);
 	FREE((caddr_t)iv2, M_TEMP);
 	if (error) {
 		m_freem(m3);
 		*mpp = NULL;
 		goto out;
 	}
 	nh->nh_nextoff = uiop->uio_offset;
 	tlen = len - uiop->uio_resid;
 	cnt = cnt < tlen ? cnt : tlen;
 	tlen = NFSM_RNDUP(cnt);
 	if (tlen == 0) {
 		m_freem(m3);
 		m3 = NULL;
 	} else if (len != tlen || tlen != cnt)
 		nfsrv_adj(m3, len - tlen, tlen - cnt);
 	*mpp = m3;
 	*mpendp = m2;
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Write vnode op from an mbuf list.
  */
 int
 nfsvno_write(struct vnode *vp, off_t off, int retlen, int cnt, int stable,
     struct mbuf *mp, char *cp, struct ucred *cred, struct thread *p)
 {
 	struct iovec *ivp;
 	int i, len;
 	struct iovec *iv;
 	int ioflags, error;
 	struct uio io, *uiop = &io;
 	struct nfsheur *nh;
 
 	MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP,
 	    M_WAITOK);
 	uiop->uio_iov = iv = ivp;
 	uiop->uio_iovcnt = cnt;
 	i = mtod(mp, caddr_t) + mp->m_len - cp;
 	len = retlen;
 	while (len > 0) {
 		if (mp == NULL)
 			panic("nfsvno_write");
 		if (i > 0) {
 			i = min(i, len);
 			ivp->iov_base = cp;
 			ivp->iov_len = i;
 			ivp++;
 			len -= i;
 		}
 		mp = mp->m_next;
 		if (mp) {
 			i = mp->m_len;
 			cp = mtod(mp, caddr_t);
 		}
 	}
 
 	if (stable == NFSWRITE_UNSTABLE)
 		ioflags = IO_NODELOCKED;
 	else
 		ioflags = (IO_SYNC | IO_NODELOCKED);
 	uiop->uio_resid = retlen;
 	uiop->uio_rw = UIO_WRITE;
 	uiop->uio_segflg = UIO_SYSSPACE;
 	NFSUIOPROC(uiop, p);
 	uiop->uio_offset = off;
 	nh = nfsrv_sequential_heuristic(uiop, vp);
 	ioflags |= nh->nh_seqcount << IO_SEQSHIFT;
 	error = VOP_WRITE(vp, uiop, ioflags, cred);
 	if (error == 0)
 		nh->nh_nextoff = uiop->uio_offset;
 	FREE((caddr_t)iv, M_TEMP);
 
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Common code for creating a regular file (plus special files for V2).
  */
 int
 nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp,
     struct vnode **vpp, struct nfsvattr *nvap, int *exclusive_flagp,
     int32_t *cverf, NFSDEV_T rdev, struct thread *p, struct nfsexstuff *exp)
 {
 	u_quad_t tempsize;
 	int error;
 
 	error = nd->nd_repstat;
 	if (!error && ndp->ni_vp == NULL) {
 		if (nvap->na_type == VREG || nvap->na_type == VSOCK) {
 			vrele(ndp->ni_startdir);
 			error = VOP_CREATE(ndp->ni_dvp,
 			    &ndp->ni_vp, &ndp->ni_cnd, &nvap->na_vattr);
 			vput(ndp->ni_dvp);
 			nfsvno_relpathbuf(ndp);
 			if (!error) {
 				if (*exclusive_flagp) {
 					*exclusive_flagp = 0;
 					NFSVNO_ATTRINIT(nvap);
 					nvap->na_atime.tv_sec = cverf[0];
 					nvap->na_atime.tv_nsec = cverf[1];
 					error = VOP_SETATTR(ndp->ni_vp,
 					    &nvap->na_vattr, nd->nd_cred);
 				}
 			}
 		/*
 		 * NFS V2 Only. nfsrvd_mknod() does this for V3.
 		 * (This implies, just get out on an error.)
 		 */
 		} else if (nvap->na_type == VCHR || nvap->na_type == VBLK ||
 			nvap->na_type == VFIFO) {
 			if (nvap->na_type == VCHR && rdev == 0xffffffff)
 				nvap->na_type = VFIFO;
                         if (nvap->na_type != VFIFO &&
 			    (error = priv_check_cred(nd->nd_cred,
 			     PRIV_VFS_MKNOD_DEV, 0))) {
 				vrele(ndp->ni_startdir);
 				nfsvno_relpathbuf(ndp);
 				vput(ndp->ni_dvp);
 				goto out;
 			}
 			nvap->na_rdev = rdev;
 			error = VOP_MKNOD(ndp->ni_dvp, &ndp->ni_vp,
 			    &ndp->ni_cnd, &nvap->na_vattr);
 			vput(ndp->ni_dvp);
 			nfsvno_relpathbuf(ndp);
 			vrele(ndp->ni_startdir);
 			if (error)
 				goto out;
 		} else {
 			vrele(ndp->ni_startdir);
 			nfsvno_relpathbuf(ndp);
 			vput(ndp->ni_dvp);
 			error = ENXIO;
 			goto out;
 		}
 		*vpp = ndp->ni_vp;
 	} else {
 		/*
 		 * Handle cases where error is already set and/or
 		 * the file exists.
 		 * 1 - clean up the lookup
 		 * 2 - iff !error and na_size set, truncate it
 		 */
 		vrele(ndp->ni_startdir);
 		nfsvno_relpathbuf(ndp);
 		*vpp = ndp->ni_vp;
 		if (ndp->ni_dvp == *vpp)
 			vrele(ndp->ni_dvp);
 		else
 			vput(ndp->ni_dvp);
 		if (!error && nvap->na_size != VNOVAL) {
 			error = nfsvno_accchk(*vpp, VWRITE,
 			    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
 			    NFSACCCHK_VPISLOCKED, NULL);
 			if (!error) {
 				tempsize = nvap->na_size;
 				NFSVNO_ATTRINIT(nvap);
 				nvap->na_size = tempsize;
 				error = VOP_SETATTR(*vpp,
 				    &nvap->na_vattr, nd->nd_cred);
 			}
 		}
 		if (error)
 			vput(*vpp);
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Do a mknod vnode op.
  */
 int
 nfsvno_mknod(struct nameidata *ndp, struct nfsvattr *nvap, struct ucred *cred,
     struct thread *p)
 {
 	int error = 0;
 	enum vtype vtyp;
 
 	vtyp = nvap->na_type;
 	/*
 	 * Iff doesn't exist, create it.
 	 */
 	if (ndp->ni_vp) {
 		vrele(ndp->ni_startdir);
 		nfsvno_relpathbuf(ndp);
 		vput(ndp->ni_dvp);
 		vrele(ndp->ni_vp);
 		error = EEXIST;
 		goto out;
 	}
 	if (vtyp != VCHR && vtyp != VBLK && vtyp != VSOCK && vtyp != VFIFO) {
 		vrele(ndp->ni_startdir);
 		nfsvno_relpathbuf(ndp);
 		vput(ndp->ni_dvp);
 		error = NFSERR_BADTYPE;
 		goto out;
 	}
 	if (vtyp == VSOCK) {
 		vrele(ndp->ni_startdir);
 		error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp,
 		    &ndp->ni_cnd, &nvap->na_vattr);
 		vput(ndp->ni_dvp);
 		nfsvno_relpathbuf(ndp);
 	} else {
 		if (nvap->na_type != VFIFO &&
 		    (error = priv_check_cred(cred, PRIV_VFS_MKNOD_DEV, 0))) {
 			vrele(ndp->ni_startdir);
 			nfsvno_relpathbuf(ndp);
 			vput(ndp->ni_dvp);
 			goto out;
 		}
 		error = VOP_MKNOD(ndp->ni_dvp, &ndp->ni_vp,
 		    &ndp->ni_cnd, &nvap->na_vattr);
 		vput(ndp->ni_dvp);
 		nfsvno_relpathbuf(ndp);
 		vrele(ndp->ni_startdir);
 		/*
 		 * Since VOP_MKNOD returns the ni_vp, I can't
 		 * see any reason to do the lookup.
 		 */
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Mkdir vnode op.
  */
 int
 nfsvno_mkdir(struct nameidata *ndp, struct nfsvattr *nvap, uid_t saved_uid,
     struct ucred *cred, struct thread *p, struct nfsexstuff *exp)
 {
 	int error = 0;
 
 	if (ndp->ni_vp != NULL) {
 		if (ndp->ni_dvp == ndp->ni_vp)
 			vrele(ndp->ni_dvp);
 		else
 			vput(ndp->ni_dvp);
 		vrele(ndp->ni_vp);
 		nfsvno_relpathbuf(ndp);
 		error = EEXIST;
 		goto out;
 	}
 	error = VOP_MKDIR(ndp->ni_dvp, &ndp->ni_vp, &ndp->ni_cnd,
 	    &nvap->na_vattr);
 	vput(ndp->ni_dvp);
 	nfsvno_relpathbuf(ndp);
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * symlink vnode op.
  */
 int
 nfsvno_symlink(struct nameidata *ndp, struct nfsvattr *nvap, char *pathcp,
     int pathlen, int not_v2, uid_t saved_uid, struct ucred *cred, struct thread *p,
     struct nfsexstuff *exp)
 {
 	int error = 0;
 
 	if (ndp->ni_vp) {
 		vrele(ndp->ni_startdir);
 		nfsvno_relpathbuf(ndp);
 		if (ndp->ni_dvp == ndp->ni_vp)
 			vrele(ndp->ni_dvp);
 		else
 			vput(ndp->ni_dvp);
 		vrele(ndp->ni_vp);
 		error = EEXIST;
 		goto out;
 	}
 
 	error = VOP_SYMLINK(ndp->ni_dvp, &ndp->ni_vp, &ndp->ni_cnd,
 	    &nvap->na_vattr, pathcp);
 	vput(ndp->ni_dvp);
 	vrele(ndp->ni_startdir);
 	nfsvno_relpathbuf(ndp);
 	/*
 	 * Although FreeBSD still had the lookup code in
 	 * it for 7/current, there doesn't seem to be any
 	 * point, since VOP_SYMLINK() returns the ni_vp.
 	 * Just vput it for v2.
 	 */
 	if (!not_v2 && !error)
 		vput(ndp->ni_vp);
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Parse symbolic link arguments.
  * This function has an ugly side effect. It will MALLOC() an area for
  * the symlink and set iov_base to point to it, only if it succeeds.
  * So, if it returns with uiop->uio_iov->iov_base != NULL, that must
  * be FREE'd later.
  */
 int
 nfsvno_getsymlink(struct nfsrv_descript *nd, struct nfsvattr *nvap,
     struct thread *p, char **pathcpp, int *lenp)
 {
 	u_int32_t *tl;
 	char *pathcp = NULL;
 	int error = 0, len;
 	struct nfsv2_sattr *sp;
 
 	*pathcpp = NULL;
 	*lenp = 0;
 	if ((nd->nd_flag & ND_NFSV3) &&
 	    (error = nfsrv_sattr(nd, NULL, nvap, NULL, NULL, p)))
 		goto nfsmout;
 	NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 	len = fxdr_unsigned(int, *tl);
 	if (len > NFS_MAXPATHLEN || len <= 0) {
 		error = EBADRPC;
 		goto nfsmout;
 	}
 	MALLOC(pathcp, caddr_t, len + 1, M_TEMP, M_WAITOK);
 	error = nfsrv_mtostr(nd, pathcp, len);
 	if (error)
 		goto nfsmout;
 	if (nd->nd_flag & ND_NFSV2) {
 		NFSM_DISSECT(sp, struct nfsv2_sattr *, NFSX_V2SATTR);
 		nvap->na_mode = fxdr_unsigned(u_int16_t, sp->sa_mode);
 	}
 	*pathcpp = pathcp;
 	*lenp = len;
 	NFSEXITCODE2(0, nd);
 	return (0);
 nfsmout:
 	if (pathcp)
 		free(pathcp, M_TEMP);
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Remove a non-directory object.
  */
 int
 nfsvno_removesub(struct nameidata *ndp, int is_v4, struct ucred *cred,
     struct thread *p, struct nfsexstuff *exp)
 {
 	struct vnode *vp;
 	int error = 0;
 
 	vp = ndp->ni_vp;
 	if (vp->v_type == VDIR)
 		error = NFSERR_ISDIR;
 	else if (is_v4)
 		error = nfsrv_checkremove(vp, 1, p);
 	if (!error)
 		error = VOP_REMOVE(ndp->ni_dvp, vp, &ndp->ni_cnd);
 	if (ndp->ni_dvp == vp)
 		vrele(ndp->ni_dvp);
 	else
 		vput(ndp->ni_dvp);
 	vput(vp);
 	if ((ndp->ni_cnd.cn_flags & SAVENAME) != 0)
 		nfsvno_relpathbuf(ndp);
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Remove a directory.
  */
 int
 nfsvno_rmdirsub(struct nameidata *ndp, int is_v4, struct ucred *cred,
     struct thread *p, struct nfsexstuff *exp)
 {
 	struct vnode *vp;
 	int error = 0;
 
 	vp = ndp->ni_vp;
 	if (vp->v_type != VDIR) {
 		error = ENOTDIR;
 		goto out;
 	}
 	/*
 	 * No rmdir "." please.
 	 */
 	if (ndp->ni_dvp == vp) {
 		error = EINVAL;
 		goto out;
 	}
 	/*
 	 * The root of a mounted filesystem cannot be deleted.
 	 */
 	if (vp->v_vflag & VV_ROOT)
 		error = EBUSY;
 out:
 	if (!error)
 		error = VOP_RMDIR(ndp->ni_dvp, vp, &ndp->ni_cnd);
 	if (ndp->ni_dvp == vp)
 		vrele(ndp->ni_dvp);
 	else
 		vput(ndp->ni_dvp);
 	vput(vp);
 	if ((ndp->ni_cnd.cn_flags & SAVENAME) != 0)
 		nfsvno_relpathbuf(ndp);
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Rename vnode op.
  */
 int
 nfsvno_rename(struct nameidata *fromndp, struct nameidata *tondp,
     u_int32_t ndstat, u_int32_t ndflag, struct ucred *cred, struct thread *p)
 {
 	struct vnode *fvp, *tvp, *tdvp;
 	int error = 0;
 
 	fvp = fromndp->ni_vp;
 	if (ndstat) {
 		vrele(fromndp->ni_dvp);
 		vrele(fvp);
 		error = ndstat;
 		goto out1;
 	}
 	tdvp = tondp->ni_dvp;
 	tvp = tondp->ni_vp;
 	if (tvp != NULL) {
 		if (fvp->v_type == VDIR && tvp->v_type != VDIR) {
 			error = (ndflag & ND_NFSV2) ? EISDIR : EEXIST;
 			goto out;
 		} else if (fvp->v_type != VDIR && tvp->v_type == VDIR) {
 			error = (ndflag & ND_NFSV2) ? ENOTDIR : EEXIST;
 			goto out;
 		}
 		if (tvp->v_type == VDIR && tvp->v_mountedhere) {
 			error = (ndflag & ND_NFSV2) ? ENOTEMPTY : EXDEV;
 			goto out;
 		}
 
 		/*
 		 * A rename to '.' or '..' results in a prematurely
 		 * unlocked vnode on FreeBSD5, so I'm just going to fail that
 		 * here.
 		 */
 		if ((tondp->ni_cnd.cn_namelen == 1 &&
 		     tondp->ni_cnd.cn_nameptr[0] == '.') ||
 		    (tondp->ni_cnd.cn_namelen == 2 &&
 		     tondp->ni_cnd.cn_nameptr[0] == '.' &&
 		     tondp->ni_cnd.cn_nameptr[1] == '.')) {
 			error = EINVAL;
 			goto out;
 		}
 	}
 	if (fvp->v_type == VDIR && fvp->v_mountedhere) {
 		error = (ndflag & ND_NFSV2) ? ENOTEMPTY : EXDEV;
 		goto out;
 	}
 	if (fvp->v_mount != tdvp->v_mount) {
 		error = (ndflag & ND_NFSV2) ? ENOTEMPTY : EXDEV;
 		goto out;
 	}
 	if (fvp == tdvp) {
 		error = (ndflag & ND_NFSV2) ? ENOTEMPTY : EINVAL;
 		goto out;
 	}
 	if (fvp == tvp) {
 		/*
 		 * If source and destination are the same, there is nothing to
 		 * do. Set error to -1 to indicate this.
 		 */
 		error = -1;
 		goto out;
 	}
 	if (ndflag & ND_NFSV4) {
 		if (NFSVOPLOCK(fvp, LK_EXCLUSIVE) == 0) {
 			error = nfsrv_checkremove(fvp, 0, p);
 			NFSVOPUNLOCK(fvp, 0);
 		} else
 			error = EPERM;
 		if (tvp && !error)
 			error = nfsrv_checkremove(tvp, 1, p);
 	} else {
 		/*
 		 * For NFSv2 and NFSv3, try to get rid of the delegation, so
 		 * that the NFSv4 client won't be confused by the rename.
 		 * Since nfsd_recalldelegation() can only be called on an
 		 * unlocked vnode at this point and fvp is the file that will
 		 * still exist after the rename, just do fvp.
 		 */
 		nfsd_recalldelegation(fvp, p);
 	}
 out:
 	if (!error) {
 		error = VOP_RENAME(fromndp->ni_dvp, fromndp->ni_vp,
 		    &fromndp->ni_cnd, tondp->ni_dvp, tondp->ni_vp,
 		    &tondp->ni_cnd);
 	} else {
 		if (tdvp == tvp)
 			vrele(tdvp);
 		else
 			vput(tdvp);
 		if (tvp)
 			vput(tvp);
 		vrele(fromndp->ni_dvp);
 		vrele(fvp);
 		if (error == -1)
 			error = 0;
 	}
 	vrele(tondp->ni_startdir);
 	nfsvno_relpathbuf(tondp);
 out1:
 	vrele(fromndp->ni_startdir);
 	nfsvno_relpathbuf(fromndp);
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Link vnode op.
  */
 int
 nfsvno_link(struct nameidata *ndp, struct vnode *vp, struct ucred *cred,
     struct thread *p, struct nfsexstuff *exp)
 {
 	struct vnode *xp;
 	int error = 0;
 
 	xp = ndp->ni_vp;
 	if (xp != NULL) {
 		error = EEXIST;
 	} else {
 		xp = ndp->ni_dvp;
 		if (vp->v_mount != xp->v_mount)
 			error = EXDEV;
 	}
 	if (!error) {
 		NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
 		if ((vp->v_iflag & VI_DOOMED) == 0)
 			error = VOP_LINK(ndp->ni_dvp, vp, &ndp->ni_cnd);
 		else
 			error = EPERM;
 		if (ndp->ni_dvp == vp)
 			vrele(ndp->ni_dvp);
 		else
 			vput(ndp->ni_dvp);
 		NFSVOPUNLOCK(vp, 0);
 	} else {
 		if (ndp->ni_dvp == ndp->ni_vp)
 			vrele(ndp->ni_dvp);
 		else
 			vput(ndp->ni_dvp);
 		if (ndp->ni_vp)
 			vrele(ndp->ni_vp);
 	}
 	nfsvno_relpathbuf(ndp);
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Do the fsync() appropriate for the commit.
  */
 int
 nfsvno_fsync(struct vnode *vp, u_int64_t off, int cnt, struct ucred *cred,
     struct thread *td)
 {
 	int error = 0;
 
 	/*
 	 * RFC 1813 3.3.21: if count is 0, a flush from offset to the end of
 	 * file is done.  At this time VOP_FSYNC does not accept offset and
 	 * byte count parameters so call VOP_FSYNC the whole file for now.
 	 * The same is true for NFSv4: RFC 3530 Sec. 14.2.3.
 	 */
 	if (cnt == 0 || cnt > MAX_COMMIT_COUNT) {
 		/*
 		 * Give up and do the whole thing
 		 */
 		if (vp->v_object &&
 		   (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) {
 			VM_OBJECT_WLOCK(vp->v_object);
 			vm_object_page_clean(vp->v_object, 0, 0, OBJPC_SYNC);
 			VM_OBJECT_WUNLOCK(vp->v_object);
 		}
 		error = VOP_FSYNC(vp, MNT_WAIT, td);
 	} else {
 		/*
 		 * Locate and synchronously write any buffers that fall
 		 * into the requested range.  Note:  we are assuming that
 		 * f_iosize is a power of 2.
 		 */
 		int iosize = vp->v_mount->mnt_stat.f_iosize;
 		int iomask = iosize - 1;
 		struct bufobj *bo;
 		daddr_t lblkno;
 
 		/*
 		 * Align to iosize boundry, super-align to page boundry.
 		 */
 		if (off & iomask) {
 			cnt += off & iomask;
 			off &= ~(u_quad_t)iomask;
 		}
 		if (off & PAGE_MASK) {
 			cnt += off & PAGE_MASK;
 			off &= ~(u_quad_t)PAGE_MASK;
 		}
 		lblkno = off / iosize;
 
 		if (vp->v_object &&
 		   (vp->v_object->flags & OBJ_MIGHTBEDIRTY)) {
 			VM_OBJECT_WLOCK(vp->v_object);
 			vm_object_page_clean(vp->v_object, off, off + cnt,
 			    OBJPC_SYNC);
 			VM_OBJECT_WUNLOCK(vp->v_object);
 		}
 
 		bo = &vp->v_bufobj;
 		BO_LOCK(bo);
 		while (cnt > 0) {
 			struct buf *bp;
 
 			/*
 			 * If we have a buffer and it is marked B_DELWRI we
 			 * have to lock and write it.  Otherwise the prior
 			 * write is assumed to have already been committed.
 			 *
 			 * gbincore() can return invalid buffers now so we
 			 * have to check that bit as well (though B_DELWRI
 			 * should not be set if B_INVAL is set there could be
 			 * a race here since we haven't locked the buffer).
 			 */
 			if ((bp = gbincore(&vp->v_bufobj, lblkno)) != NULL) {
 				if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL |
 				    LK_INTERLOCK, BO_LOCKPTR(bo)) == ENOLCK) {
 					BO_LOCK(bo);
 					continue; /* retry */
 				}
 			    	if ((bp->b_flags & (B_DELWRI|B_INVAL)) ==
 				    B_DELWRI) {
 					bremfree(bp);
 					bp->b_flags &= ~B_ASYNC;
 					bwrite(bp);
 					++nfs_commit_miss;
 				} else
 					BUF_UNLOCK(bp);
 				BO_LOCK(bo);
 			}
 			++nfs_commit_blks;
 			if (cnt < iosize)
 				break;
 			cnt -= iosize;
 			++lblkno;
 		}
 		BO_UNLOCK(bo);
 	}
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Statfs vnode op.
  */
 int
 nfsvno_statfs(struct vnode *vp, struct statfs *sf)
 {
 	int error;
 
 	error = VFS_STATFS(vp->v_mount, sf);
 	if (error == 0) {
 		/*
 		 * Since NFS handles these values as unsigned on the
 		 * wire, there is no way to represent negative values,
 		 * so set them to 0. Without this, they will appear
 		 * to be very large positive values for clients like
 		 * Solaris10.
 		 */
 		if (sf->f_bavail < 0)
 			sf->f_bavail = 0;
 		if (sf->f_ffree < 0)
 			sf->f_ffree = 0;
 	}
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Do the vnode op stuff for Open. Similar to nfsvno_createsub(), but
  * must handle nfsrv_opencheck() calls after any other access checks.
  */
 void
 nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp,
     nfsquad_t clientid, nfsv4stateid_t *stateidp, struct nfsstate *stp,
     int *exclusive_flagp, struct nfsvattr *nvap, int32_t *cverf, int create,
     NFSACL_T *aclp, nfsattrbit_t *attrbitp, struct ucred *cred, struct thread *p,
     struct nfsexstuff *exp, struct vnode **vpp)
 {
 	struct vnode *vp = NULL;
 	u_quad_t tempsize;
 	struct nfsexstuff nes;
 
 	if (ndp->ni_vp == NULL)
 		nd->nd_repstat = nfsrv_opencheck(clientid,
 		    stateidp, stp, NULL, nd, p, nd->nd_repstat);
 	if (!nd->nd_repstat) {
 		if (ndp->ni_vp == NULL) {
 			vrele(ndp->ni_startdir);
 			nd->nd_repstat = VOP_CREATE(ndp->ni_dvp,
 			    &ndp->ni_vp, &ndp->ni_cnd, &nvap->na_vattr);
 			vput(ndp->ni_dvp);
 			nfsvno_relpathbuf(ndp);
 			if (!nd->nd_repstat) {
 				if (*exclusive_flagp) {
 					*exclusive_flagp = 0;
 					NFSVNO_ATTRINIT(nvap);
 					nvap->na_atime.tv_sec = cverf[0];
 					nvap->na_atime.tv_nsec = cverf[1];
 					nd->nd_repstat = VOP_SETATTR(ndp->ni_vp,
 					    &nvap->na_vattr, cred);
 				} else {
 					nfsrv_fixattr(nd, ndp->ni_vp, nvap,
 					    aclp, p, attrbitp, exp);
 				}
 			}
 			vp = ndp->ni_vp;
 		} else {
 			if (ndp->ni_startdir)
 				vrele(ndp->ni_startdir);
 			nfsvno_relpathbuf(ndp);
 			vp = ndp->ni_vp;
 			if (create == NFSV4OPEN_CREATE) {
 				if (ndp->ni_dvp == vp)
 					vrele(ndp->ni_dvp);
 				else
 					vput(ndp->ni_dvp);
 			}
 			if (NFSVNO_ISSETSIZE(nvap) && vp->v_type == VREG) {
 				if (ndp->ni_cnd.cn_flags & RDONLY)
 					NFSVNO_SETEXRDONLY(&nes);
 				else
 					NFSVNO_EXINIT(&nes);
 				nd->nd_repstat = nfsvno_accchk(vp, 
 				    VWRITE, cred, &nes, p,
 				    NFSACCCHK_NOOVERRIDE,
 				    NFSACCCHK_VPISLOCKED, NULL);
 				nd->nd_repstat = nfsrv_opencheck(clientid,
 				    stateidp, stp, vp, nd, p, nd->nd_repstat);
 				if (!nd->nd_repstat) {
 					tempsize = nvap->na_size;
 					NFSVNO_ATTRINIT(nvap);
 					nvap->na_size = tempsize;
 					nd->nd_repstat = VOP_SETATTR(vp,
 					    &nvap->na_vattr, cred);
 				}
 			} else if (vp->v_type == VREG) {
 				nd->nd_repstat = nfsrv_opencheck(clientid,
 				    stateidp, stp, vp, nd, p, nd->nd_repstat);
 			}
 		}
 	} else {
 		if (ndp->ni_cnd.cn_flags & HASBUF)
 			nfsvno_relpathbuf(ndp);
 		if (ndp->ni_startdir && create == NFSV4OPEN_CREATE) {
 			vrele(ndp->ni_startdir);
 			if (ndp->ni_dvp == ndp->ni_vp)
 				vrele(ndp->ni_dvp);
 			else
 				vput(ndp->ni_dvp);
 			if (ndp->ni_vp)
 				vput(ndp->ni_vp);
 		}
 	}
 	*vpp = vp;
 
 	NFSEXITCODE2(0, nd);
 }
 
 /*
  * Updates the file rev and sets the mtime and ctime
  * to the current clock time, returning the va_filerev and va_Xtime
  * values.
  * Return ESTALE to indicate the vnode is VI_DOOMED.
  */
 int
 nfsvno_updfilerev(struct vnode *vp, struct nfsvattr *nvap,
     struct ucred *cred, struct thread *p)
 {
 	struct vattr va;
 
 	VATTR_NULL(&va);
 	vfs_timestamp(&va.va_mtime);
 	if (NFSVOPISLOCKED(vp) != LK_EXCLUSIVE) {
 		NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
 		if ((vp->v_iflag & VI_DOOMED) != 0)
 			return (ESTALE);
 	}
 	(void) VOP_SETATTR(vp, &va, cred);
 	(void) nfsvno_getattr(vp, nvap, cred, p, 1);
 	return (0);
 }
 
 /*
  * Glue routine to nfsv4_fillattr().
  */
 int
 nfsvno_fillattr(struct nfsrv_descript *nd, struct mount *mp, struct vnode *vp,
     struct nfsvattr *nvap, fhandle_t *fhp, int rderror, nfsattrbit_t *attrbitp,
     struct ucred *cred, struct thread *p, int isdgram, int reterr,
     int supports_nfsv4acls, int at_root, uint64_t mounted_on_fileno)
 {
 	int error;
 
 	error = nfsv4_fillattr(nd, mp, vp, NULL, &nvap->na_vattr, fhp, rderror,
 	    attrbitp, cred, p, isdgram, reterr, supports_nfsv4acls, at_root,
 	    mounted_on_fileno);
 	NFSEXITCODE2(0, nd);
 	return (error);
 }
 
 /* Since the Readdir vnode ops vary, put the entire functions in here. */
 /*
  * nfs readdir service
  * - mallocs what it thinks is enough to read
  *	count rounded up to a multiple of DIRBLKSIZ <= NFS_MAXREADDIR
  * - calls VOP_READDIR()
  * - loops around building the reply
  *	if the output generated exceeds count break out of loop
  *	The NFSM_CLGET macro is used here so that the reply will be packed
  *	tightly in mbuf clusters.
  * - it trims out records with d_fileno == 0
  *	this doesn't matter for Unix clients, but they might confuse clients
  *	for other os'.
  * - it trims out records with d_type == DT_WHT
  *	these cannot be seen through NFS (unless we extend the protocol)
  *     The alternate call nfsrvd_readdirplus() does lookups as well.
  * PS: The NFS protocol spec. does not clarify what the "count" byte
  *	argument is a count of.. just name strings and file id's or the
  *	entire reply rpc or ...
  *	I tried just file name and id sizes and it confused the Sun client,
  *	so I am using the full rpc size now. The "paranoia.." comment refers
  *	to including the status longwords that are not a part of the dir.
  *	"entry" structures, but are in the rpc.
  */
 int
 nfsrvd_readdir(struct nfsrv_descript *nd, int isdgram,
     struct vnode *vp, struct thread *p, struct nfsexstuff *exp)
 {
 	struct dirent *dp;
 	u_int32_t *tl;
 	int dirlen;
 	char *cpos, *cend, *rbuf;
 	struct nfsvattr at;
 	int nlen, error = 0, getret = 1;
 	int siz, cnt, fullsiz, eofflag, ncookies;
 	u_int64_t off, toff, verf;
 	u_long *cookies = NULL, *cookiep;
 	struct uio io;
 	struct iovec iv;
 	int is_ufs;
 
 	if (nd->nd_repstat) {
 		nfsrv_postopattr(nd, getret, &at);
 		goto out;
 	}
 	if (nd->nd_flag & ND_NFSV2) {
 		NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 		off = fxdr_unsigned(u_quad_t, *tl++);
 	} else {
 		NFSM_DISSECT(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
 		off = fxdr_hyper(tl);
 		tl += 2;
 		verf = fxdr_hyper(tl);
 		tl += 2;
 	}
 	toff = off;
 	cnt = fxdr_unsigned(int, *tl);
 	if (cnt > NFS_SRVMAXDATA(nd) || cnt < 0)
 		cnt = NFS_SRVMAXDATA(nd);
 	siz = ((cnt + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
 	fullsiz = siz;
 	if (nd->nd_flag & ND_NFSV3) {
 		nd->nd_repstat = getret = nfsvno_getattr(vp, &at, nd->nd_cred,
 		    p, 1);
 #if 0
 		/*
 		 * va_filerev is not sufficient as a cookie verifier,
 		 * since it is not supposed to change when entries are
 		 * removed/added unless that offset cookies returned to
 		 * the client are no longer valid.
 		 */
 		if (!nd->nd_repstat && toff && verf != at.na_filerev)
 			nd->nd_repstat = NFSERR_BAD_COOKIE;
 #endif
 	}
 	if (!nd->nd_repstat && vp->v_type != VDIR)
 		nd->nd_repstat = NFSERR_NOTDIR;
 	if (nd->nd_repstat == 0 && cnt == 0) {
 		if (nd->nd_flag & ND_NFSV2)
 			/* NFSv2 does not have NFSERR_TOOSMALL */
 			nd->nd_repstat = EPERM;
 		else
 			nd->nd_repstat = NFSERR_TOOSMALL;
 	}
 	if (!nd->nd_repstat)
 		nd->nd_repstat = nfsvno_accchk(vp, VEXEC,
 		    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
 		    NFSACCCHK_VPISLOCKED, NULL);
 	if (nd->nd_repstat) {
 		vput(vp);
 		if (nd->nd_flag & ND_NFSV3)
 			nfsrv_postopattr(nd, getret, &at);
 		goto out;
 	}
 	is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0;
 	MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK);
 again:
 	eofflag = 0;
 	if (cookies) {
 		free((caddr_t)cookies, M_TEMP);
 		cookies = NULL;
 	}
 
 	iv.iov_base = rbuf;
 	iv.iov_len = siz;
 	io.uio_iov = &iv;
 	io.uio_iovcnt = 1;
 	io.uio_offset = (off_t)off;
 	io.uio_resid = siz;
 	io.uio_segflg = UIO_SYSSPACE;
 	io.uio_rw = UIO_READ;
 	io.uio_td = NULL;
 	nd->nd_repstat = VOP_READDIR(vp, &io, nd->nd_cred, &eofflag, &ncookies,
 	    &cookies);
 	off = (u_int64_t)io.uio_offset;
 	if (io.uio_resid)
 		siz -= io.uio_resid;
 
 	if (!cookies && !nd->nd_repstat)
 		nd->nd_repstat = NFSERR_PERM;
 	if (nd->nd_flag & ND_NFSV3) {
 		getret = nfsvno_getattr(vp, &at, nd->nd_cred, p, 1);
 		if (!nd->nd_repstat)
 			nd->nd_repstat = getret;
 	}
 
 	/*
 	 * Handles the failed cases. nd->nd_repstat == 0 past here.
 	 */
 	if (nd->nd_repstat) {
 		vput(vp);
 		free((caddr_t)rbuf, M_TEMP);
 		if (cookies)
 			free((caddr_t)cookies, M_TEMP);
 		if (nd->nd_flag & ND_NFSV3)
 			nfsrv_postopattr(nd, getret, &at);
 		goto out;
 	}
 	/*
 	 * If nothing read, return eof
 	 * rpc reply
 	 */
 	if (siz == 0) {
 		vput(vp);
 		if (nd->nd_flag & ND_NFSV2) {
 			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 		} else {
 			nfsrv_postopattr(nd, getret, &at);
 			NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
 			txdr_hyper(at.na_filerev, tl);
 			tl += 2;
 		}
 		*tl++ = newnfs_false;
 		*tl = newnfs_true;
 		FREE((caddr_t)rbuf, M_TEMP);
 		FREE((caddr_t)cookies, M_TEMP);
 		goto out;
 	}
 
 	/*
 	 * Check for degenerate cases of nothing useful read.
 	 * If so go try again
 	 */
 	cpos = rbuf;
 	cend = rbuf + siz;
 	dp = (struct dirent *)cpos;
 	cookiep = cookies;
 
 	/*
 	 * For some reason FreeBSD's ufs_readdir() chooses to back the
 	 * directory offset up to a block boundary, so it is necessary to
 	 * skip over the records that precede the requested offset. This
 	 * requires the assumption that file offset cookies monotonically
 	 * increase.
 	 */
 	while (cpos < cend && ncookies > 0 &&
 	    (dp->d_fileno == 0 || dp->d_type == DT_WHT ||
 	     (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff))) {
 		cpos += dp->d_reclen;
 		dp = (struct dirent *)cpos;
 		cookiep++;
 		ncookies--;
 	}
 	if (cpos >= cend || ncookies == 0) {
 		siz = fullsiz;
 		toff = off;
 		goto again;
 	}
 	vput(vp);
 
 	/*
 	 * dirlen is the size of the reply, including all XDR and must
 	 * not exceed cnt. For NFSv2, RFC1094 didn't clearly indicate
 	 * if the XDR should be included in "count", but to be safe, we do.
 	 * (Include the two booleans at the end of the reply in dirlen now.)
 	 */
 	if (nd->nd_flag & ND_NFSV3) {
 		nfsrv_postopattr(nd, getret, &at);
 		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 		txdr_hyper(at.na_filerev, tl);
 		dirlen = NFSX_V3POSTOPATTR + NFSX_VERF + 2 * NFSX_UNSIGNED;
 	} else {
 		dirlen = 2 * NFSX_UNSIGNED;
 	}
 
 	/* Loop through the records and build reply */
 	while (cpos < cend && ncookies > 0) {
 		nlen = dp->d_namlen;
 		if (dp->d_fileno != 0 && dp->d_type != DT_WHT &&
 			nlen <= NFS_MAXNAMLEN) {
 			if (nd->nd_flag & ND_NFSV3)
 				dirlen += (6*NFSX_UNSIGNED + NFSM_RNDUP(nlen));
 			else
 				dirlen += (4*NFSX_UNSIGNED + NFSM_RNDUP(nlen));
 			if (dirlen > cnt) {
 				eofflag = 0;
 				break;
 			}
 
 			/*
 			 * Build the directory record xdr from
 			 * the dirent entry.
 			 */
 			if (nd->nd_flag & ND_NFSV3) {
 				NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
 				*tl++ = newnfs_true;
 				*tl++ = 0;
 			} else {
 				NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 				*tl++ = newnfs_true;
 			}
 			*tl = txdr_unsigned(dp->d_fileno);
 			(void) nfsm_strtom(nd, dp->d_name, nlen);
 			if (nd->nd_flag & ND_NFSV3) {
 				NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 				*tl++ = 0;
 			} else
 				NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
 			*tl = txdr_unsigned(*cookiep);
 		}
 		cpos += dp->d_reclen;
 		dp = (struct dirent *)cpos;
 		cookiep++;
 		ncookies--;
 	}
 	if (cpos < cend)
 		eofflag = 0;
 	NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 	*tl++ = newnfs_false;
 	if (eofflag)
 		*tl = newnfs_true;
 	else
 		*tl = newnfs_false;
 	FREE((caddr_t)rbuf, M_TEMP);
 	FREE((caddr_t)cookies, M_TEMP);
 
 out:
 	NFSEXITCODE2(0, nd);
 	return (0);
 nfsmout:
 	vput(vp);
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Readdirplus for V3 and Readdir for V4.
  */
 int
 nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
     struct vnode *vp, struct thread *p, struct nfsexstuff *exp)
 {
 	struct dirent *dp;
 	u_int32_t *tl;
 	int dirlen;
 	char *cpos, *cend, *rbuf;
 	struct vnode *nvp;
 	fhandle_t nfh;
 	struct nfsvattr nva, at, *nvap = &nva;
 	struct mbuf *mb0, *mb1;
 	struct nfsreferral *refp;
 	int nlen, r, error = 0, getret = 1, usevget = 1;
 	int siz, cnt, fullsiz, eofflag, ncookies, entrycnt;
 	caddr_t bpos0, bpos1;
 	u_int64_t off, toff, verf;
 	u_long *cookies = NULL, *cookiep;
 	nfsattrbit_t attrbits, rderrbits, savbits;
 	struct uio io;
 	struct iovec iv;
 	struct componentname cn;
 	int at_root, is_ufs, is_zfs, needs_unbusy, supports_nfsv4acls;
 	struct mount *mp, *new_mp;
 	uint64_t mounted_on_fileno;
 
 	if (nd->nd_repstat) {
 		nfsrv_postopattr(nd, getret, &at);
 		goto out;
 	}
 	NFSM_DISSECT(tl, u_int32_t *, 6 * NFSX_UNSIGNED);
 	off = fxdr_hyper(tl);
 	toff = off;
 	tl += 2;
 	verf = fxdr_hyper(tl);
 	tl += 2;
 	siz = fxdr_unsigned(int, *tl++);
 	cnt = fxdr_unsigned(int, *tl);
 
 	/*
 	 * Use the server's maximum data transfer size as the upper bound
 	 * on reply datalen.
 	 */
 	if (cnt > NFS_SRVMAXDATA(nd) || cnt < 0)
 		cnt = NFS_SRVMAXDATA(nd);
 
 	/*
 	 * siz is a "hint" of how much directory information (name, fileid,
 	 * cookie) should be in the reply. At least one client "hints" 0,
 	 * so I set it to cnt for that case. I also round it up to the
 	 * next multiple of DIRBLKSIZ.
 	 */
 	if (siz <= 0)
 		siz = cnt;
 	siz = ((siz + DIRBLKSIZ - 1) & ~(DIRBLKSIZ - 1));
 
 	if (nd->nd_flag & ND_NFSV4) {
 		error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL);
 		if (error)
 			goto nfsmout;
 		NFSSET_ATTRBIT(&savbits, &attrbits);
 		NFSCLRNOTFILLABLE_ATTRBIT(&attrbits);
 		NFSZERO_ATTRBIT(&rderrbits);
 		NFSSETBIT_ATTRBIT(&rderrbits, NFSATTRBIT_RDATTRERROR);
 	} else {
 		NFSZERO_ATTRBIT(&attrbits);
 	}
 	fullsiz = siz;
 	nd->nd_repstat = getret = nfsvno_getattr(vp, &at, nd->nd_cred, p, 1);
 	if (!nd->nd_repstat) {
 	    if (off && verf != at.na_filerev) {
 		/*
 		 * va_filerev is not sufficient as a cookie verifier,
 		 * since it is not supposed to change when entries are
 		 * removed/added unless that offset cookies returned to
 		 * the client are no longer valid.
 		 */
 #if 0
 		if (nd->nd_flag & ND_NFSV4) {
 			nd->nd_repstat = NFSERR_NOTSAME;
 		} else {
 			nd->nd_repstat = NFSERR_BAD_COOKIE;
 		}
 #endif
 	    } else if ((nd->nd_flag & ND_NFSV4) && off == 0 && verf != 0) {
 		nd->nd_repstat = NFSERR_BAD_COOKIE;
 	    }
 	}
 	if (!nd->nd_repstat && vp->v_type != VDIR)
 		nd->nd_repstat = NFSERR_NOTDIR;
 	if (!nd->nd_repstat && cnt == 0)
 		nd->nd_repstat = NFSERR_TOOSMALL;
 	if (!nd->nd_repstat)
 		nd->nd_repstat = nfsvno_accchk(vp, VEXEC,
 		    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
 		    NFSACCCHK_VPISLOCKED, NULL);
 	if (nd->nd_repstat) {
 		vput(vp);
 		if (nd->nd_flag & ND_NFSV3)
 			nfsrv_postopattr(nd, getret, &at);
 		goto out;
 	}
 	is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0;
 	is_zfs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "zfs") == 0;
 
 	MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK);
 again:
 	eofflag = 0;
 	if (cookies) {
 		free((caddr_t)cookies, M_TEMP);
 		cookies = NULL;
 	}
 
 	iv.iov_base = rbuf;
 	iv.iov_len = siz;
 	io.uio_iov = &iv;
 	io.uio_iovcnt = 1;
 	io.uio_offset = (off_t)off;
 	io.uio_resid = siz;
 	io.uio_segflg = UIO_SYSSPACE;
 	io.uio_rw = UIO_READ;
 	io.uio_td = NULL;
 	nd->nd_repstat = VOP_READDIR(vp, &io, nd->nd_cred, &eofflag, &ncookies,
 	    &cookies);
 	off = (u_int64_t)io.uio_offset;
 	if (io.uio_resid)
 		siz -= io.uio_resid;
 
 	getret = nfsvno_getattr(vp, &at, nd->nd_cred, p, 1);
 
 	if (!cookies && !nd->nd_repstat)
 		nd->nd_repstat = NFSERR_PERM;
 	if (!nd->nd_repstat)
 		nd->nd_repstat = getret;
 	if (nd->nd_repstat) {
 		vput(vp);
 		if (cookies)
 			free((caddr_t)cookies, M_TEMP);
 		free((caddr_t)rbuf, M_TEMP);
 		if (nd->nd_flag & ND_NFSV3)
 			nfsrv_postopattr(nd, getret, &at);
 		goto out;
 	}
 	/*
 	 * If nothing read, return eof
 	 * rpc reply
 	 */
 	if (siz == 0) {
 		vput(vp);
 		if (nd->nd_flag & ND_NFSV3)
 			nfsrv_postopattr(nd, getret, &at);
 		NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
 		txdr_hyper(at.na_filerev, tl);
 		tl += 2;
 		*tl++ = newnfs_false;
 		*tl = newnfs_true;
 		free((caddr_t)cookies, M_TEMP);
 		free((caddr_t)rbuf, M_TEMP);
 		goto out;
 	}
 
 	/*
 	 * Check for degenerate cases of nothing useful read.
 	 * If so go try again
 	 */
 	cpos = rbuf;
 	cend = rbuf + siz;
 	dp = (struct dirent *)cpos;
 	cookiep = cookies;
 
 	/*
 	 * For some reason FreeBSD's ufs_readdir() chooses to back the
 	 * directory offset up to a block boundary, so it is necessary to
 	 * skip over the records that precede the requested offset. This
 	 * requires the assumption that file offset cookies monotonically
 	 * increase.
 	 */
 	while (cpos < cend && ncookies > 0 &&
 	  (dp->d_fileno == 0 || dp->d_type == DT_WHT ||
 	   (is_ufs == 1 && ((u_quad_t)(*cookiep)) <= toff) ||
 	   ((nd->nd_flag & ND_NFSV4) &&
 	    ((dp->d_namlen == 1 && dp->d_name[0] == '.') ||
 	     (dp->d_namlen==2 && dp->d_name[0]=='.' && dp->d_name[1]=='.'))))) {
 		cpos += dp->d_reclen;
 		dp = (struct dirent *)cpos;
 		cookiep++;
 		ncookies--;
 	}
 	if (cpos >= cend || ncookies == 0) {
 		siz = fullsiz;
 		toff = off;
 		goto again;
 	}
 
 	/*
 	 * Busy the file system so that the mount point won't go away
 	 * and, as such, VFS_VGET() can be used safely.
 	 */
 	mp = vp->v_mount;
 	vfs_ref(mp);
 	NFSVOPUNLOCK(vp, 0);
 	nd->nd_repstat = vfs_busy(mp, 0);
 	vfs_rel(mp);
 	if (nd->nd_repstat != 0) {
 		vrele(vp);
 		free(cookies, M_TEMP);
 		free(rbuf, M_TEMP);
 		if (nd->nd_flag & ND_NFSV3)
 			nfsrv_postopattr(nd, getret, &at);
 		goto out;
 	}
 
 	/*
 	 * Check to see if entries in this directory can be safely acquired
 	 * via VFS_VGET() or if a switch to VOP_LOOKUP() is required.
 	 * ZFS snapshot directories need VOP_LOOKUP(), so that any
 	 * automount of the snapshot directory that is required will
 	 * be done.
 	 * This needs to be done here for NFSv4, since NFSv4 never does
 	 * a VFS_VGET() for "." or "..".
 	 */
 	if (is_zfs == 1) {
 		r = VFS_VGET(mp, at.na_fileid, LK_SHARED, &nvp);
 		if (r == EOPNOTSUPP) {
 			usevget = 0;
 			cn.cn_nameiop = LOOKUP;
 			cn.cn_lkflags = LK_SHARED | LK_RETRY;
 			cn.cn_cred = nd->nd_cred;
 			cn.cn_thread = p;
 		} else if (r == 0)
 			vput(nvp);
 	}
 
 	/*
 	 * Save this position, in case there is an error before one entry
 	 * is created.
 	 */
 	mb0 = nd->nd_mb;
 	bpos0 = nd->nd_bpos;
 
 	/*
 	 * Fill in the first part of the reply.
 	 * dirlen is the reply length in bytes and cannot exceed cnt.
 	 * (Include the two booleans at the end of the reply in dirlen now,
 	 *  so we recognize when we have exceeded cnt.)
 	 */
 	if (nd->nd_flag & ND_NFSV3) {
 		dirlen = NFSX_V3POSTOPATTR + NFSX_VERF + 2 * NFSX_UNSIGNED;
 		nfsrv_postopattr(nd, getret, &at);
 	} else {
 		dirlen = NFSX_VERF + 2 * NFSX_UNSIGNED;
 	}
 	NFSM_BUILD(tl, u_int32_t *, NFSX_VERF);
 	txdr_hyper(at.na_filerev, tl);
 
 	/*
 	 * Save this position, in case there is an empty reply needed.
 	 */
 	mb1 = nd->nd_mb;
 	bpos1 = nd->nd_bpos;
 
 	/* Loop through the records and build reply */
 	entrycnt = 0;
 	while (cpos < cend && ncookies > 0 && dirlen < cnt) {
 		nlen = dp->d_namlen;
 		if (dp->d_fileno != 0 && dp->d_type != DT_WHT &&
 		    nlen <= NFS_MAXNAMLEN &&
 		    ((nd->nd_flag & ND_NFSV3) || nlen > 2 ||
 		     (nlen==2 && (dp->d_name[0]!='.' || dp->d_name[1]!='.'))
 		      || (nlen == 1 && dp->d_name[0] != '.'))) {
 			/*
 			 * Save the current position in the reply, in case
 			 * this entry exceeds cnt.
 			 */
 			mb1 = nd->nd_mb;
 			bpos1 = nd->nd_bpos;
 	
 			/*
 			 * For readdir_and_lookup get the vnode using
 			 * the file number.
 			 */
 			nvp = NULL;
 			refp = NULL;
 			r = 0;
 			at_root = 0;
 			needs_unbusy = 0;
 			new_mp = mp;
 			mounted_on_fileno = (uint64_t)dp->d_fileno;
 			if ((nd->nd_flag & ND_NFSV3) ||
 			    NFSNONZERO_ATTRBIT(&savbits)) {
 				if (nd->nd_flag & ND_NFSV4)
 					refp = nfsv4root_getreferral(NULL,
 					    vp, dp->d_fileno);
 				if (refp == NULL) {
 					if (usevget)
 						r = VFS_VGET(mp, dp->d_fileno,
 						    LK_SHARED, &nvp);
 					else
 						r = EOPNOTSUPP;
 					if (r == EOPNOTSUPP) {
 						if (usevget) {
 							usevget = 0;
 							cn.cn_nameiop = LOOKUP;
 							cn.cn_lkflags =
 							    LK_SHARED |
 							    LK_RETRY;
 							cn.cn_cred =
 							    nd->nd_cred;
 							cn.cn_thread = p;
 						}
 						cn.cn_nameptr = dp->d_name;
 						cn.cn_namelen = nlen;
 						cn.cn_flags = ISLASTCN |
 						    NOFOLLOW | LOCKLEAF;
 						if (nlen == 2 &&
 						    dp->d_name[0] == '.' &&
 						    dp->d_name[1] == '.')
 							cn.cn_flags |=
 							    ISDOTDOT;
 						if (NFSVOPLOCK(vp, LK_SHARED)
 						    != 0) {
 							nd->nd_repstat = EPERM;
 							break;
 						}
 						if ((vp->v_vflag & VV_ROOT) != 0
 						    && (cn.cn_flags & ISDOTDOT)
 						    != 0) {
 							vref(vp);
 							nvp = vp;
 							r = 0;
 						} else {
 							r = VOP_LOOKUP(vp, &nvp,
 							    &cn);
 							if (vp != nvp)
 								NFSVOPUNLOCK(vp,
 								    0);
 						}
 					}
 
 					/*
 					 * For NFSv4, check to see if nvp is
 					 * a mount point and get the mount
 					 * point vnode, as required.
 					 */
 					if (r == 0 &&
 					    nfsrv_enable_crossmntpt != 0 &&
 					    (nd->nd_flag & ND_NFSV4) != 0 &&
 					    nvp->v_type == VDIR &&
 					    nvp->v_mountedhere != NULL) {
 						new_mp = nvp->v_mountedhere;
 						r = vfs_busy(new_mp, 0);
 						vput(nvp);
 						nvp = NULL;
 						if (r == 0) {
 							r = VFS_ROOT(new_mp,
 							    LK_SHARED, &nvp);
 							needs_unbusy = 1;
 							if (r == 0)
 								at_root = 1;
 						}
 					}
 				}
 				if (!r) {
 				    if (refp == NULL &&
 					((nd->nd_flag & ND_NFSV3) ||
 					 NFSNONZERO_ATTRBIT(&attrbits))) {
 					r = nfsvno_getfh(nvp, &nfh, p);
 					if (!r)
 					    r = nfsvno_getattr(nvp, nvap,
 						nd->nd_cred, p, 1);
 					if (r == 0 && is_zfs == 1 &&
 					    nfsrv_enable_crossmntpt != 0 &&
 					    (nd->nd_flag & ND_NFSV4) != 0 &&
 					    nvp->v_type == VDIR &&
 					    vp->v_mount != nvp->v_mount) {
 					    /*
 					     * For a ZFS snapshot, there is a
 					     * pseudo mount that does not set
 					     * v_mountedhere, so it needs to
 					     * be detected via a different
 					     * mount structure.
 					     */
 					    at_root = 1;
 					    if (new_mp == mp)
 						new_mp = nvp->v_mount;
 					}
 				    }
 				} else {
 				    nvp = NULL;
 				}
 				if (r) {
 					if (!NFSISSET_ATTRBIT(&attrbits,
 					    NFSATTRBIT_RDATTRERROR)) {
 						if (nvp != NULL)
 							vput(nvp);
 						if (needs_unbusy != 0)
 							vfs_unbusy(new_mp);
 						nd->nd_repstat = r;
 						break;
 					}
 				}
 			}
 
 			/*
 			 * Build the directory record xdr
 			 */
 			if (nd->nd_flag & ND_NFSV3) {
 				NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
 				*tl++ = newnfs_true;
 				*tl++ = 0;
 				*tl = txdr_unsigned(dp->d_fileno);
 				dirlen += nfsm_strtom(nd, dp->d_name, nlen);
 				NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 				*tl++ = 0;
 				*tl = txdr_unsigned(*cookiep);
 				nfsrv_postopattr(nd, 0, nvap);
 				dirlen += nfsm_fhtom(nd,(u_int8_t *)&nfh,0,1);
 				dirlen += (5*NFSX_UNSIGNED+NFSX_V3POSTOPATTR);
 				if (nvp != NULL)
 					vput(nvp);
 			} else {
 				NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
 				*tl++ = newnfs_true;
 				*tl++ = 0;
 				*tl = txdr_unsigned(*cookiep);
 				dirlen += nfsm_strtom(nd, dp->d_name, nlen);
 				if (nvp != NULL) {
 					supports_nfsv4acls =
 					    nfs_supportsnfsv4acls(nvp);
 					NFSVOPUNLOCK(nvp, 0);
 				} else
 					supports_nfsv4acls = 0;
 				if (refp != NULL) {
 					dirlen += nfsrv_putreferralattr(nd,
 					    &savbits, refp, 0,
 					    &nd->nd_repstat);
 					if (nd->nd_repstat) {
 						if (nvp != NULL)
 							vrele(nvp);
 						if (needs_unbusy != 0)
 							vfs_unbusy(new_mp);
 						break;
 					}
 				} else if (r) {
 					dirlen += nfsvno_fillattr(nd, new_mp,
 					    nvp, nvap, &nfh, r, &rderrbits,
 					    nd->nd_cred, p, isdgram, 0,
 					    supports_nfsv4acls, at_root,
 					    mounted_on_fileno);
 				} else {
 					dirlen += nfsvno_fillattr(nd, new_mp,
 					    nvp, nvap, &nfh, r, &attrbits,
 					    nd->nd_cred, p, isdgram, 0,
 					    supports_nfsv4acls, at_root,
 					    mounted_on_fileno);
 				}
 				if (nvp != NULL)
 					vrele(nvp);
 				dirlen += (3 * NFSX_UNSIGNED);
 			}
 			if (needs_unbusy != 0)
 				vfs_unbusy(new_mp);
 			if (dirlen <= cnt)
 				entrycnt++;
 		}
 		cpos += dp->d_reclen;
 		dp = (struct dirent *)cpos;
 		cookiep++;
 		ncookies--;
 	}
 	vrele(vp);
 	vfs_unbusy(mp);
 
 	/*
 	 * If dirlen > cnt, we must strip off the last entry. If that
 	 * results in an empty reply, report NFSERR_TOOSMALL.
 	 */
 	if (dirlen > cnt || nd->nd_repstat) {
 		if (!nd->nd_repstat && entrycnt == 0)
 			nd->nd_repstat = NFSERR_TOOSMALL;
 		if (nd->nd_repstat) {
 			newnfs_trimtrailing(nd, mb0, bpos0);
 			if (nd->nd_flag & ND_NFSV3)
 				nfsrv_postopattr(nd, getret, &at);
 		} else
 			newnfs_trimtrailing(nd, mb1, bpos1);
 		eofflag = 0;
 	} else if (cpos < cend)
 		eofflag = 0;
 	if (!nd->nd_repstat) {
 		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 		*tl++ = newnfs_false;
 		if (eofflag)
 			*tl = newnfs_true;
 		else
 			*tl = newnfs_false;
 	}
 	FREE((caddr_t)cookies, M_TEMP);
 	FREE((caddr_t)rbuf, M_TEMP);
 
 out:
 	NFSEXITCODE2(0, nd);
 	return (0);
 nfsmout:
 	vput(vp);
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Get the settable attributes out of the mbuf list.
  * (Return 0 or EBADRPC)
  */
 int
 nfsrv_sattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap,
     nfsattrbit_t *attrbitp, NFSACL_T *aclp, struct thread *p)
 {
 	u_int32_t *tl;
 	struct nfsv2_sattr *sp;
 	int error = 0, toclient = 0;
 
 	switch (nd->nd_flag & (ND_NFSV2 | ND_NFSV3 | ND_NFSV4)) {
 	case ND_NFSV2:
 		NFSM_DISSECT(sp, struct nfsv2_sattr *, NFSX_V2SATTR);
 		/*
 		 * Some old clients didn't fill in the high order 16bits.
 		 * --> check the low order 2 bytes for 0xffff
 		 */
 		if ((fxdr_unsigned(int, sp->sa_mode) & 0xffff) != 0xffff)
 			nvap->na_mode = nfstov_mode(sp->sa_mode);
 		if (sp->sa_uid != newnfs_xdrneg1)
 			nvap->na_uid = fxdr_unsigned(uid_t, sp->sa_uid);
 		if (sp->sa_gid != newnfs_xdrneg1)
 			nvap->na_gid = fxdr_unsigned(gid_t, sp->sa_gid);
 		if (sp->sa_size != newnfs_xdrneg1)
 			nvap->na_size = fxdr_unsigned(u_quad_t, sp->sa_size);
 		if (sp->sa_atime.nfsv2_sec != newnfs_xdrneg1) {
 #ifdef notyet
 			fxdr_nfsv2time(&sp->sa_atime, &nvap->na_atime);
 #else
 			nvap->na_atime.tv_sec =
 				fxdr_unsigned(u_int32_t,sp->sa_atime.nfsv2_sec);
 			nvap->na_atime.tv_nsec = 0;
 #endif
 		}
 		if (sp->sa_mtime.nfsv2_sec != newnfs_xdrneg1)
 			fxdr_nfsv2time(&sp->sa_mtime, &nvap->na_mtime);
 		break;
 	case ND_NFSV3:
 		NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 		if (*tl == newnfs_true) {
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			nvap->na_mode = nfstov_mode(*tl);
 		}
 		NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 		if (*tl == newnfs_true) {
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			nvap->na_uid = fxdr_unsigned(uid_t, *tl);
 		}
 		NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 		if (*tl == newnfs_true) {
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			nvap->na_gid = fxdr_unsigned(gid_t, *tl);
 		}
 		NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 		if (*tl == newnfs_true) {
 			NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 			nvap->na_size = fxdr_hyper(tl);
 		}
 		NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 		switch (fxdr_unsigned(int, *tl)) {
 		case NFSV3SATTRTIME_TOCLIENT:
 			NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 			fxdr_nfsv3time(tl, &nvap->na_atime);
 			toclient = 1;
 			break;
 		case NFSV3SATTRTIME_TOSERVER:
 			vfs_timestamp(&nvap->na_atime);
 			nvap->na_vaflags |= VA_UTIMES_NULL;
 			break;
 		};
 		NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 		switch (fxdr_unsigned(int, *tl)) {
 		case NFSV3SATTRTIME_TOCLIENT:
 			NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
 			fxdr_nfsv3time(tl, &nvap->na_mtime);
 			nvap->na_vaflags &= ~VA_UTIMES_NULL;
 			break;
 		case NFSV3SATTRTIME_TOSERVER:
 			vfs_timestamp(&nvap->na_mtime);
 			if (!toclient)
 				nvap->na_vaflags |= VA_UTIMES_NULL;
 			break;
 		};
 		break;
 	case ND_NFSV4:
 		error = nfsv4_sattr(nd, vp, nvap, attrbitp, aclp, p);
 	};
 nfsmout:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Handle the setable attributes for V4.
  * Returns NFSERR_BADXDR if it can't be parsed, 0 otherwise.
  */
 int
 nfsv4_sattr(struct nfsrv_descript *nd, vnode_t vp, struct nfsvattr *nvap,
     nfsattrbit_t *attrbitp, NFSACL_T *aclp, struct thread *p)
 {
 	u_int32_t *tl;
 	int attrsum = 0;
 	int i, j;
 	int error, attrsize, bitpos, aclsize, aceerr, retnotsup = 0;
 	int toclient = 0;
 	u_char *cp, namestr[NFSV4_SMALLSTR + 1];
 	uid_t uid;
 	gid_t gid;
 
 	error = nfsrv_getattrbits(nd, attrbitp, NULL, &retnotsup);
 	if (error)
 		goto nfsmout;
 	NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 	attrsize = fxdr_unsigned(int, *tl);
 
 	/*
 	 * Loop around getting the setable attributes. If an unsupported
 	 * one is found, set nd_repstat == NFSERR_ATTRNOTSUPP and return.
 	 */
 	if (retnotsup) {
 		nd->nd_repstat = NFSERR_ATTRNOTSUPP;
 		bitpos = NFSATTRBIT_MAX;
 	} else {
 		bitpos = 0;
 	}
 	for (; bitpos < NFSATTRBIT_MAX; bitpos++) {
 	    if (attrsum > attrsize) {
 		error = NFSERR_BADXDR;
 		goto nfsmout;
 	    }
 	    if (NFSISSET_ATTRBIT(attrbitp, bitpos))
 		switch (bitpos) {
 		case NFSATTRBIT_SIZE:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_HYPER);
                      if (vp != NULL && vp->v_type != VREG) {
                             error = (vp->v_type == VDIR) ? NFSERR_ISDIR :
                                 NFSERR_INVAL;
                             goto nfsmout;
 			}
 			nvap->na_size = fxdr_hyper(tl);
 			attrsum += NFSX_HYPER;
 			break;
 		case NFSATTRBIT_ACL:
 			error = nfsrv_dissectacl(nd, aclp, &aceerr, &aclsize,
 			    p);
 			if (error)
 				goto nfsmout;
 			if (aceerr && !nd->nd_repstat)
 				nd->nd_repstat = aceerr;
 			attrsum += aclsize;
 			break;
 		case NFSATTRBIT_ARCHIVE:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			if (!nd->nd_repstat)
 				nd->nd_repstat = NFSERR_ATTRNOTSUPP;
 			attrsum += NFSX_UNSIGNED;
 			break;
 		case NFSATTRBIT_HIDDEN:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			if (!nd->nd_repstat)
 				nd->nd_repstat = NFSERR_ATTRNOTSUPP;
 			attrsum += NFSX_UNSIGNED;
 			break;
 		case NFSATTRBIT_MIMETYPE:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			i = fxdr_unsigned(int, *tl);
 			error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
 			if (error)
 				goto nfsmout;
 			if (!nd->nd_repstat)
 				nd->nd_repstat = NFSERR_ATTRNOTSUPP;
 			attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(i));
 			break;
 		case NFSATTRBIT_MODE:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			nvap->na_mode = nfstov_mode(*tl);
 			attrsum += NFSX_UNSIGNED;
 			break;
 		case NFSATTRBIT_OWNER:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			j = fxdr_unsigned(int, *tl);
 			if (j < 0) {
 				error = NFSERR_BADXDR;
 				goto nfsmout;
 			}
 			if (j > NFSV4_SMALLSTR)
 				cp = malloc(j + 1, M_NFSSTRING, M_WAITOK);
 			else
 				cp = namestr;
 			error = nfsrv_mtostr(nd, cp, j);
 			if (error) {
 				if (j > NFSV4_SMALLSTR)
 					free(cp, M_NFSSTRING);
 				goto nfsmout;
 			}
 			if (!nd->nd_repstat) {
 				nd->nd_repstat = nfsv4_strtouid(nd, cp, j, &uid,
 				    p);
 				if (!nd->nd_repstat)
 					nvap->na_uid = uid;
 			}
 			if (j > NFSV4_SMALLSTR)
 				free(cp, M_NFSSTRING);
 			attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(j));
 			break;
 		case NFSATTRBIT_OWNERGROUP:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			j = fxdr_unsigned(int, *tl);
 			if (j < 0) {
 				error = NFSERR_BADXDR;
 				goto nfsmout;
 			}
 			if (j > NFSV4_SMALLSTR)
 				cp = malloc(j + 1, M_NFSSTRING, M_WAITOK);
 			else
 				cp = namestr;
 			error = nfsrv_mtostr(nd, cp, j);
 			if (error) {
 				if (j > NFSV4_SMALLSTR)
 					free(cp, M_NFSSTRING);
 				goto nfsmout;
 			}
 			if (!nd->nd_repstat) {
 				nd->nd_repstat = nfsv4_strtogid(nd, cp, j, &gid,
 				    p);
 				if (!nd->nd_repstat)
 					nvap->na_gid = gid;
 			}
 			if (j > NFSV4_SMALLSTR)
 				free(cp, M_NFSSTRING);
 			attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(j));
 			break;
 		case NFSATTRBIT_SYSTEM:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			if (!nd->nd_repstat)
 				nd->nd_repstat = NFSERR_ATTRNOTSUPP;
 			attrsum += NFSX_UNSIGNED;
 			break;
 		case NFSATTRBIT_TIMEACCESSSET:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			attrsum += NFSX_UNSIGNED;
 			if (fxdr_unsigned(int, *tl)==NFSV4SATTRTIME_TOCLIENT) {
 			    NFSM_DISSECT(tl, u_int32_t *, NFSX_V4TIME);
 			    fxdr_nfsv4time(tl, &nvap->na_atime);
 			    toclient = 1;
 			    attrsum += NFSX_V4TIME;
 			} else {
 			    vfs_timestamp(&nvap->na_atime);
 			    nvap->na_vaflags |= VA_UTIMES_NULL;
 			}
 			break;
 		case NFSATTRBIT_TIMEBACKUP:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_V4TIME);
 			if (!nd->nd_repstat)
 				nd->nd_repstat = NFSERR_ATTRNOTSUPP;
 			attrsum += NFSX_V4TIME;
 			break;
 		case NFSATTRBIT_TIMECREATE:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_V4TIME);
 			if (!nd->nd_repstat)
 				nd->nd_repstat = NFSERR_ATTRNOTSUPP;
 			attrsum += NFSX_V4TIME;
 			break;
 		case NFSATTRBIT_TIMEMODIFYSET:
 			NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 			attrsum += NFSX_UNSIGNED;
 			if (fxdr_unsigned(int, *tl)==NFSV4SATTRTIME_TOCLIENT) {
 			    NFSM_DISSECT(tl, u_int32_t *, NFSX_V4TIME);
 			    fxdr_nfsv4time(tl, &nvap->na_mtime);
 			    nvap->na_vaflags &= ~VA_UTIMES_NULL;
 			    attrsum += NFSX_V4TIME;
 			} else {
 			    vfs_timestamp(&nvap->na_mtime);
 			    if (!toclient)
 				nvap->na_vaflags |= VA_UTIMES_NULL;
 			}
 			break;
 		default:
 			nd->nd_repstat = NFSERR_ATTRNOTSUPP;
 			/*
 			 * set bitpos so we drop out of the loop.
 			 */
 			bitpos = NFSATTRBIT_MAX;
 			break;
 		};
 	}
 
 	/*
 	 * some clients pad the attrlist, so we need to skip over the
 	 * padding.
 	 */
 	if (attrsum > attrsize) {
 		error = NFSERR_BADXDR;
 	} else {
 		attrsize = NFSM_RNDUP(attrsize);
 		if (attrsum < attrsize)
 			error = nfsm_advance(nd, attrsize - attrsum, -1);
 	}
 nfsmout:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Check/setup export credentials.
  */
 int
 nfsd_excred(struct nfsrv_descript *nd, struct nfsexstuff *exp,
     struct ucred *credanon)
 {
 	int error = 0;
 
 	/*
 	 * Check/setup credentials.
 	 */
 	if (nd->nd_flag & ND_GSS)
 		exp->nes_exflag &= ~MNT_EXPORTANON;
 
 	/*
 	 * Check to see if the operation is allowed for this security flavor.
 	 * RFC2623 suggests that the NFSv3 Fsinfo RPC be allowed to
 	 * AUTH_NONE or AUTH_SYS for file systems requiring RPCSEC_GSS.
 	 * Also, allow Secinfo, so that it can acquire the correct flavor(s).
 	 */
 	if (nfsvno_testexp(nd, exp) &&
 	    nd->nd_procnum != NFSV4OP_SECINFO &&
 	    nd->nd_procnum != NFSPROC_FSINFO) {
 		if (nd->nd_flag & ND_NFSV4)
 			error = NFSERR_WRONGSEC;
 		else
 			error = (NFSERR_AUTHERR | AUTH_TOOWEAK);
 		goto out;
 	}
 
 	/*
 	 * Check to see if the file system is exported V4 only.
 	 */
 	if (NFSVNO_EXV4ONLY(exp) && !(nd->nd_flag & ND_NFSV4)) {
 		error = NFSERR_PROGNOTV4;
 		goto out;
 	}
 
 	/*
 	 * Now, map the user credentials.
 	 * (Note that ND_AUTHNONE will only be set for an NFSv3
 	 *  Fsinfo RPC. If set for anything else, this code might need
 	 *  to change.)
 	 */
 	if (NFSVNO_EXPORTED(exp) &&
 	    ((!(nd->nd_flag & ND_GSS) && nd->nd_cred->cr_uid == 0) ||
 	     NFSVNO_EXPORTANON(exp) ||
 	     (nd->nd_flag & ND_AUTHNONE))) {
 		nd->nd_cred->cr_uid = credanon->cr_uid;
 		nd->nd_cred->cr_gid = credanon->cr_gid;
 		crsetgroups(nd->nd_cred, credanon->cr_ngroups,
 		    credanon->cr_groups);
 	}
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Check exports.
  */
 int
 nfsvno_checkexp(struct mount *mp, struct sockaddr *nam, struct nfsexstuff *exp,
     struct ucred **credp)
 {
 	int i, error, *secflavors;
 
 	error = VFS_CHECKEXP(mp, nam, &exp->nes_exflag, credp,
 	    &exp->nes_numsecflavor, &secflavors);
 	if (error) {
 		if (nfs_rootfhset) {
 			exp->nes_exflag = 0;
 			exp->nes_numsecflavor = 0;
 			error = 0;
 		}
 	} else {
 		/* Copy the security flavors. */
 		for (i = 0; i < exp->nes_numsecflavor; i++)
 			exp->nes_secflavors[i] = secflavors[i];
 	}
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Get a vnode for a file handle and export stuff.
  */
 int
 nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct sockaddr *nam,
     int lktype, struct vnode **vpp, struct nfsexstuff *exp,
     struct ucred **credp)
 {
 	int i, error, *secflavors;
 
 	*credp = NULL;
 	exp->nes_numsecflavor = 0;
 	error = VFS_FHTOVP(mp, &fhp->fh_fid, lktype, vpp);
 	if (error != 0)
 		/* Make sure the server replies ESTALE to the client. */
 		error = ESTALE;
 	if (nam && !error) {
 		error = VFS_CHECKEXP(mp, nam, &exp->nes_exflag, credp,
 		    &exp->nes_numsecflavor, &secflavors);
 		if (error) {
 			if (nfs_rootfhset) {
 				exp->nes_exflag = 0;
 				exp->nes_numsecflavor = 0;
 				error = 0;
 			} else {
 				vput(*vpp);
 			}
 		} else {
 			/* Copy the security flavors. */
 			for (i = 0; i < exp->nes_numsecflavor; i++)
 				exp->nes_secflavors[i] = secflavors[i];
 		}
 	}
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * nfsd_fhtovp() - convert a fh to a vnode ptr
  * 	- look up fsid in mount list (if not found ret error)
  *	- get vp and export rights by calling nfsvno_fhtovp()
  *	- if cred->cr_uid == 0 or MNT_EXPORTANON set it to credanon
  *	  for AUTH_SYS
  *	- if mpp != NULL, return the mount point so that it can
  *	  be used for vn_finished_write() by the caller
  */
 void
 nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype,
     struct vnode **vpp, struct nfsexstuff *exp,
     struct mount **mpp, int startwrite, struct thread *p)
 {
 	struct mount *mp;
 	struct ucred *credanon;
 	fhandle_t *fhp;
 
 	fhp = (fhandle_t *)nfp->nfsrvfh_data;
 	/*
 	 * Check for the special case of the nfsv4root_fh.
 	 */
 	mp = vfs_busyfs(&fhp->fh_fsid);
 	if (mpp != NULL)
 		*mpp = mp;
 	if (mp == NULL) {
 		*vpp = NULL;
 		nd->nd_repstat = ESTALE;
 		goto out;
 	}
 
 	if (startwrite) {
 		vn_start_write(NULL, mpp, V_WAIT);
 		if (lktype == LK_SHARED && !(MNT_SHARED_WRITES(mp)))
 			lktype = LK_EXCLUSIVE;
 	}
 	nd->nd_repstat = nfsvno_fhtovp(mp, fhp, nd->nd_nam, lktype, vpp, exp,
 	    &credanon);
 	vfs_unbusy(mp);
 
 	/*
 	 * For NFSv4 without a pseudo root fs, unexported file handles
 	 * can be returned, so that Lookup works everywhere.
 	 */
 	if (!nd->nd_repstat && exp->nes_exflag == 0 &&
 	    !(nd->nd_flag & ND_NFSV4)) {
 		vput(*vpp);
 		nd->nd_repstat = EACCES;
 	}
 
 	/*
 	 * Personally, I've never seen any point in requiring a
 	 * reserved port#, since only in the rare case where the
 	 * clients are all boxes with secure system priviledges,
 	 * does it provide any enhanced security, but... some people
 	 * believe it to be useful and keep putting this code back in.
 	 * (There is also some "security checker" out there that
 	 *  complains if the nfs server doesn't enforce this.)
 	 * However, note the following:
 	 * RFC3530 (NFSv4) specifies that a reserved port# not be
 	 *	required.
 	 * RFC2623 recommends that, if a reserved port# is checked for,
 	 *	that there be a way to turn that off--> ifdef'd.
 	 */
 #ifdef NFS_REQRSVPORT
 	if (!nd->nd_repstat) {
 		struct sockaddr_in *saddr;
 		struct sockaddr_in6 *saddr6;
 
 		saddr = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in *);
 		saddr6 = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in6 *);
 		if (!(nd->nd_flag & ND_NFSV4) &&
 		    ((saddr->sin_family == AF_INET &&
 		      ntohs(saddr->sin_port) >= IPPORT_RESERVED) ||
 		     (saddr6->sin6_family == AF_INET6 &&
 		      ntohs(saddr6->sin6_port) >= IPPORT_RESERVED))) {
 			vput(*vpp);
 			nd->nd_repstat = (NFSERR_AUTHERR | AUTH_TOOWEAK);
 		}
 	}
 #endif	/* NFS_REQRSVPORT */
 
 	/*
 	 * Check/setup credentials.
 	 */
 	if (!nd->nd_repstat) {
 		nd->nd_saveduid = nd->nd_cred->cr_uid;
 		nd->nd_repstat = nfsd_excred(nd, exp, credanon);
 		if (nd->nd_repstat)
 			vput(*vpp);
 	}
 	if (credanon != NULL)
 		crfree(credanon);
 	if (nd->nd_repstat) {
 		if (startwrite)
 			vn_finished_write(mp);
 		*vpp = NULL;
 		if (mpp != NULL)
 			*mpp = NULL;
 	}
 
 out:
 	NFSEXITCODE2(0, nd);
 }
 
 /*
  * glue for fp.
  */
 static int
 fp_getfvp(struct thread *p, int fd, struct file **fpp, struct vnode **vpp)
 {
 	struct filedesc *fdp;
 	struct file *fp;
 	int error = 0;
 
 	fdp = p->td_proc->p_fd;
 	if (fd < 0 || fd >= fdp->fd_nfiles ||
 	    (fp = fdp->fd_ofiles[fd].fde_file) == NULL) {
 		error = EBADF;
 		goto out;
 	}
 	*fpp = fp;
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Called from nfssvc() to update the exports list. Just call
  * vfs_export(). This has to be done, since the v4 root fake fs isn't
  * in the mount list.
  */
 int
 nfsrv_v4rootexport(void *argp, struct ucred *cred, struct thread *p)
 {
 	struct nfsex_args *nfsexargp = (struct nfsex_args *)argp;
 	int error = 0;
 	struct nameidata nd;
 	fhandle_t fh;
 
 	error = vfs_export(&nfsv4root_mnt, &nfsexargp->export);
 	if ((nfsexargp->export.ex_flags & MNT_DELEXPORT) != 0)
 		nfs_rootfhset = 0;
 	else if (error == 0) {
 		if (nfsexargp->fspec == NULL) {
 			error = EPERM;
 			goto out;
 		}
 		/*
 		 * If fspec != NULL, this is the v4root path.
 		 */
 		NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE,
 		    nfsexargp->fspec, p);
 		if ((error = namei(&nd)) != 0)
 			goto out;
 		error = nfsvno_getfh(nd.ni_vp, &fh, p);
 		vrele(nd.ni_vp);
 		if (!error) {
 			nfs_rootfh.nfsrvfh_len = NFSX_MYFH;
 			NFSBCOPY((caddr_t)&fh,
 			    nfs_rootfh.nfsrvfh_data,
 			    sizeof (fhandle_t));
 			nfs_rootfhset = 1;
 		}
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * This function needs to test to see if the system is near its limit
  * for memory allocation via malloc() or mget() and return True iff
  * either of these resources are near their limit.
  * XXX (For now, this is just a stub.)
  */
 int nfsrv_testmalloclimit = 0;
 int
 nfsrv_mallocmget_limit(void)
 {
 	static int printmesg = 0;
 	static int testval = 1;
 
 	if (nfsrv_testmalloclimit && (testval++ % 1000) == 0) {
 		if ((printmesg++ % 100) == 0)
 			printf("nfsd: malloc/mget near limit\n");
 		return (1);
 	}
 	return (0);
 }
 
 /*
  * BSD specific initialization of a mount point.
  */
 void
 nfsd_mntinit(void)
 {
 	static int inited = 0;
 
 	if (inited)
 		return;
 	inited = 1;
 	nfsv4root_mnt.mnt_flag = (MNT_RDONLY | MNT_EXPORTED);
 	TAILQ_INIT(&nfsv4root_mnt.mnt_nvnodelist);
 	TAILQ_INIT(&nfsv4root_mnt.mnt_activevnodelist);
 	nfsv4root_mnt.mnt_export = NULL;
 	TAILQ_INIT(&nfsv4root_opt);
 	TAILQ_INIT(&nfsv4root_newopt);
 	nfsv4root_mnt.mnt_opt = &nfsv4root_opt;
 	nfsv4root_mnt.mnt_optnew = &nfsv4root_newopt;
 	nfsv4root_mnt.mnt_nvnodelistsize = 0;
 	nfsv4root_mnt.mnt_activevnodelistsize = 0;
 }
 
 /*
  * Get a vnode for a file handle, without checking exports, etc.
  */
 struct vnode *
 nfsvno_getvp(fhandle_t *fhp)
 {
 	struct mount *mp;
 	struct vnode *vp;
 	int error;
 
 	mp = vfs_busyfs(&fhp->fh_fsid);
 	if (mp == NULL)
 		return (NULL);
 	error = VFS_FHTOVP(mp, &fhp->fh_fid, LK_EXCLUSIVE, &vp);
 	vfs_unbusy(mp);
 	if (error)
 		return (NULL);
 	return (vp);
 }
 
 /*
  * Do a local VOP_ADVLOCK().
  */
 int
 nfsvno_advlock(struct vnode *vp, int ftype, u_int64_t first,
     u_int64_t end, struct thread *td)
 {
 	int error = 0;
 	struct flock fl;
 	u_int64_t tlen;
 
 	if (nfsrv_dolocallocks == 0)
 		goto out;
+	ASSERT_VOP_UNLOCKED(vp, "nfsvno_advlock: vp locked");
 
-	/* Check for VI_DOOMED here, so that VOP_ADVLOCK() isn't performed. */
-	if ((vp->v_iflag & VI_DOOMED) != 0) {
-		error = EPERM;
-		goto out;
-	}
-
 	fl.l_whence = SEEK_SET;
 	fl.l_type = ftype;
 	fl.l_start = (off_t)first;
 	if (end == NFS64BITSSET) {
 		fl.l_len = 0;
 	} else {
 		tlen = end - first;
 		fl.l_len = (off_t)tlen;
 	}
 	/*
 	 * For FreeBSD8, the l_pid and l_sysid must be set to the same
 	 * values for all calls, so that all locks will be held by the
 	 * nfsd server. (The nfsd server handles conflicts between the
 	 * various clients.)
 	 * Since an NFSv4 lockowner is a ClientID plus an array of up to 1024
 	 * bytes, so it can't be put in l_sysid.
 	 */
 	if (nfsv4_sysid == 0)
 		nfsv4_sysid = nlm_acquire_next_sysid();
 	fl.l_pid = (pid_t)0;
 	fl.l_sysid = (int)nfsv4_sysid;
 
-	NFSVOPUNLOCK(vp, 0);
 	if (ftype == F_UNLCK)
 		error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_UNLCK, &fl,
 		    (F_POSIX | F_REMOTE));
 	else
 		error = VOP_ADVLOCK(vp, (caddr_t)td->td_proc, F_SETLK, &fl,
 		    (F_POSIX | F_REMOTE));
-	NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Check the nfsv4 root exports.
  */
 int
 nfsvno_v4rootexport(struct nfsrv_descript *nd)
 {
 	struct ucred *credanon;
 	int exflags, error = 0, numsecflavor, *secflavors, i;
 
 	error = vfs_stdcheckexp(&nfsv4root_mnt, nd->nd_nam, &exflags,
 	    &credanon, &numsecflavor, &secflavors);
 	if (error) {
 		error = NFSERR_PROGUNAVAIL;
 		goto out;
 	}
 	if (credanon != NULL)
 		crfree(credanon);
 	for (i = 0; i < numsecflavor; i++) {
 		if (secflavors[i] == AUTH_SYS)
 			nd->nd_flag |= ND_EXAUTHSYS;
 		else if (secflavors[i] == RPCSEC_GSS_KRB5)
 			nd->nd_flag |= ND_EXGSS;
 		else if (secflavors[i] == RPCSEC_GSS_KRB5I)
 			nd->nd_flag |= ND_EXGSSINTEGRITY;
 		else if (secflavors[i] == RPCSEC_GSS_KRB5P)
 			nd->nd_flag |= ND_EXGSSPRIVACY;
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Nfs server psuedo system call for the nfsd's
  */
 /*
  * MPSAFE
  */
 static int
 nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap)
 {
 	struct file *fp;
 	struct nfsd_addsock_args sockarg;
 	struct nfsd_nfsd_args nfsdarg;
 	cap_rights_t rights;
 	int error;
 
 	if (uap->flag & NFSSVC_NFSDADDSOCK) {
 		error = copyin(uap->argp, (caddr_t)&sockarg, sizeof (sockarg));
 		if (error)
 			goto out;
 		/*
 		 * Since we don't know what rights might be required,
 		 * pretend that we need them all. It is better to be too
 		 * careful than too reckless.
 		 */
 		error = fget(td, sockarg.sock,
 		    cap_rights_init(&rights, CAP_SOCK_SERVER), &fp);
 		if (error != 0)
 			goto out;
 		if (fp->f_type != DTYPE_SOCKET) {
 			fdrop(fp, td);
 			error = EPERM;
 			goto out;
 		}
 		error = nfsrvd_addsock(fp);
 		fdrop(fp, td);
 	} else if (uap->flag & NFSSVC_NFSDNFSD) {
 		if (uap->argp == NULL) {
 			error = EINVAL;
 			goto out;
 		}
 		error = copyin(uap->argp, (caddr_t)&nfsdarg,
 		    sizeof (nfsdarg));
 		if (error)
 			goto out;
 		error = nfsrvd_nfsd(td, &nfsdarg);
 	} else {
 		error = nfssvc_srvcall(td, uap, td->td_ucred);
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 static int
 nfssvc_srvcall(struct thread *p, struct nfssvc_args *uap, struct ucred *cred)
 {
 	struct nfsex_args export;
 	struct file *fp = NULL;
 	int stablefd, len;
 	struct nfsd_clid adminrevoke;
 	struct nfsd_dumplist dumplist;
 	struct nfsd_dumpclients *dumpclients;
 	struct nfsd_dumplocklist dumplocklist;
 	struct nfsd_dumplocks *dumplocks;
 	struct nameidata nd;
 	vnode_t vp;
 	int error = EINVAL, igotlock;
 	struct proc *procp;
 	static int suspend_nfsd = 0;
 
 	if (uap->flag & NFSSVC_PUBLICFH) {
 		NFSBZERO((caddr_t)&nfs_pubfh.nfsrvfh_data,
 		    sizeof (fhandle_t));
 		error = copyin(uap->argp,
 		    &nfs_pubfh.nfsrvfh_data, sizeof (fhandle_t));
 		if (!error)
 			nfs_pubfhset = 1;
 	} else if (uap->flag & NFSSVC_V4ROOTEXPORT) {
 		error = copyin(uap->argp,(caddr_t)&export,
 		    sizeof (struct nfsex_args));
 		if (!error)
 			error = nfsrv_v4rootexport(&export, cred, p);
 	} else if (uap->flag & NFSSVC_NOPUBLICFH) {
 		nfs_pubfhset = 0;
 		error = 0;
 	} else if (uap->flag & NFSSVC_STABLERESTART) {
 		error = copyin(uap->argp, (caddr_t)&stablefd,
 		    sizeof (int));
 		if (!error)
 			error = fp_getfvp(p, stablefd, &fp, &vp);
 		if (!error && (NFSFPFLAG(fp) & (FREAD | FWRITE)) != (FREAD | FWRITE))
 			error = EBADF;
 		if (!error && newnfs_numnfsd != 0)
 			error = EPERM;
 		if (!error) {
 			nfsrv_stablefirst.nsf_fp = fp;
 			nfsrv_setupstable(p);
 		}
 	} else if (uap->flag & NFSSVC_ADMINREVOKE) {
 		error = copyin(uap->argp, (caddr_t)&adminrevoke,
 		    sizeof (struct nfsd_clid));
 		if (!error)
 			error = nfsrv_adminrevoke(&adminrevoke, p);
 	} else if (uap->flag & NFSSVC_DUMPCLIENTS) {
 		error = copyin(uap->argp, (caddr_t)&dumplist,
 		    sizeof (struct nfsd_dumplist));
 		if (!error && (dumplist.ndl_size < 1 ||
 			dumplist.ndl_size > NFSRV_MAXDUMPLIST))
 			error = EPERM;
 		if (!error) {
 		    len = sizeof (struct nfsd_dumpclients) * dumplist.ndl_size;
 		    dumpclients = (struct nfsd_dumpclients *)malloc(len,
 			M_TEMP, M_WAITOK);
 		    nfsrv_dumpclients(dumpclients, dumplist.ndl_size);
 		    error = copyout(dumpclients,
 			CAST_USER_ADDR_T(dumplist.ndl_list), len);
 		    free((caddr_t)dumpclients, M_TEMP);
 		}
 	} else if (uap->flag & NFSSVC_DUMPLOCKS) {
 		error = copyin(uap->argp, (caddr_t)&dumplocklist,
 		    sizeof (struct nfsd_dumplocklist));
 		if (!error && (dumplocklist.ndllck_size < 1 ||
 			dumplocklist.ndllck_size > NFSRV_MAXDUMPLIST))
 			error = EPERM;
 		if (!error)
 			error = nfsrv_lookupfilename(&nd,
 				dumplocklist.ndllck_fname, p);
 		if (!error) {
 			len = sizeof (struct nfsd_dumplocks) *
 				dumplocklist.ndllck_size;
 			dumplocks = (struct nfsd_dumplocks *)malloc(len,
 				M_TEMP, M_WAITOK);
 			nfsrv_dumplocks(nd.ni_vp, dumplocks,
 			    dumplocklist.ndllck_size, p);
 			vput(nd.ni_vp);
 			error = copyout(dumplocks,
 			    CAST_USER_ADDR_T(dumplocklist.ndllck_list), len);
 			free((caddr_t)dumplocks, M_TEMP);
 		}
 	} else if (uap->flag & NFSSVC_BACKUPSTABLE) {
 		procp = p->td_proc;
 		PROC_LOCK(procp);
 		nfsd_master_pid = procp->p_pid;
 		bcopy(procp->p_comm, nfsd_master_comm, MAXCOMLEN + 1);
 		nfsd_master_start = procp->p_stats->p_start;
 		nfsd_master_proc = procp;
 		PROC_UNLOCK(procp);
 	} else if ((uap->flag & NFSSVC_SUSPENDNFSD) != 0) {
 		NFSLOCKV4ROOTMUTEX();
 		if (suspend_nfsd == 0) {
 			/* Lock out all nfsd threads */
 			do {
 				igotlock = nfsv4_lock(&nfsd_suspend_lock, 1,
 				    NULL, NFSV4ROOTLOCKMUTEXPTR, NULL);
 			} while (igotlock == 0 && suspend_nfsd == 0);
 			suspend_nfsd = 1;
 		}
 		NFSUNLOCKV4ROOTMUTEX();
 		error = 0;
 	} else if ((uap->flag & NFSSVC_RESUMENFSD) != 0) {
 		NFSLOCKV4ROOTMUTEX();
 		if (suspend_nfsd != 0) {
 			nfsv4_unlock(&nfsd_suspend_lock, 0);
 			suspend_nfsd = 0;
 		}
 		NFSUNLOCKV4ROOTMUTEX();
 		error = 0;
 	}
 
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Check exports.
  * Returns 0 if ok, 1 otherwise.
  */
 int
 nfsvno_testexp(struct nfsrv_descript *nd, struct nfsexstuff *exp)
 {
 	int i;
 
 	/*
 	 * This seems odd, but allow the case where the security flavor
 	 * list is empty. This happens when NFSv4 is traversing non-exported
 	 * file systems. Exported file systems should always have a non-empty
 	 * security flavor list.
 	 */
 	if (exp->nes_numsecflavor == 0)
 		return (0);
 
 	for (i = 0; i < exp->nes_numsecflavor; i++) {
 		/*
 		 * The tests for privacy and integrity must be first,
 		 * since ND_GSS is set for everything but AUTH_SYS.
 		 */
 		if (exp->nes_secflavors[i] == RPCSEC_GSS_KRB5P &&
 		    (nd->nd_flag & ND_GSSPRIVACY))
 			return (0);
 		if (exp->nes_secflavors[i] == RPCSEC_GSS_KRB5I &&
 		    (nd->nd_flag & ND_GSSINTEGRITY))
 			return (0);
 		if (exp->nes_secflavors[i] == RPCSEC_GSS_KRB5 &&
 		    (nd->nd_flag & ND_GSS))
 			return (0);
 		if (exp->nes_secflavors[i] == AUTH_SYS &&
 		    (nd->nd_flag & ND_GSS) == 0)
 			return (0);
 	}
 	return (1);
 }
 
 /*
  * Calculate a hash value for the fid in a file handle.
  */
 uint32_t
 nfsrv_hashfh(fhandle_t *fhp)
 {
 	uint32_t hashval;
 
 	hashval = hash32_buf(&fhp->fh_fid, sizeof(struct fid), 0);
 	return (hashval);
 }
 
 /*
  * Calculate a hash value for the sessionid.
  */
 uint32_t
 nfsrv_hashsessionid(uint8_t *sessionid)
 {
 	uint32_t hashval;
 
 	hashval = hash32_buf(sessionid, NFSX_V4SESSIONID, 0);
 	return (hashval);
 }
 
 /*
  * Signal the userland master nfsd to backup the stable restart file.
  */
 void
 nfsrv_backupstable(void)
 {
 	struct proc *procp;
 
 	if (nfsd_master_proc != NULL) {
 		procp = pfind(nfsd_master_pid);
 		/* Try to make sure it is the correct process. */
 		if (procp == nfsd_master_proc &&
 		    procp->p_stats->p_start.tv_sec ==
 		    nfsd_master_start.tv_sec &&
 		    procp->p_stats->p_start.tv_usec ==
 		    nfsd_master_start.tv_usec &&
 		    strcmp(procp->p_comm, nfsd_master_comm) == 0)
 			kern_psignal(procp, SIGUSR2);
 		else
 			nfsd_master_proc = NULL;
 
 		if (procp != NULL)
 			PROC_UNLOCK(procp);
 	}
 }
 
 extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *);
 
 /*
  * Called once to initialize data structures...
  */
 static int
 nfsd_modevent(module_t mod, int type, void *data)
 {
 	int error = 0, i;
 	static int loaded = 0;
 
 	switch (type) {
 	case MOD_LOAD:
 		if (loaded)
 			goto out;
 		newnfs_portinit();
 		for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) {
 			mtx_init(&nfsrchash_table[i].mtx, "nfsrtc", NULL,
 			    MTX_DEF);
 			mtx_init(&nfsrcahash_table[i].mtx, "nfsrtca", NULL,
 			    MTX_DEF);
 		}
 		mtx_init(&nfsrc_udpmtx, "nfsuc", NULL, MTX_DEF);
 		mtx_init(&nfs_v4root_mutex, "nfs4rt", NULL, MTX_DEF);
 		mtx_init(&nfsv4root_mnt.mnt_mtx, "nfs4mnt", NULL, MTX_DEF);
 		for (i = 0; i < NFSSESSIONHASHSIZE; i++)
 			mtx_init(&nfssessionhash[i].mtx, "nfssm",
 			    NULL, MTX_DEF);
 		lockinit(&nfsv4root_mnt.mnt_explock, PVFS, "explock", 0, 0);
 		nfsrvd_initcache();
 		nfsd_init();
 		NFSD_LOCK();
 		nfsrvd_init(0);
 		NFSD_UNLOCK();
 		nfsd_mntinit();
 #ifdef VV_DISABLEDELEG
 		vn_deleg_ops.vndeleg_recall = nfsd_recalldelegation;
 		vn_deleg_ops.vndeleg_disable = nfsd_disabledelegation;
 #endif
 		nfsd_call_servertimer = nfsrv_servertimer;
 		nfsd_call_nfsd = nfssvc_nfsd;
 		loaded = 1;
 		break;
 
 	case MOD_UNLOAD:
 		if (newnfs_numnfsd != 0) {
 			error = EBUSY;
 			break;
 		}
 
 #ifdef VV_DISABLEDELEG
 		vn_deleg_ops.vndeleg_recall = NULL;
 		vn_deleg_ops.vndeleg_disable = NULL;
 #endif
 		nfsd_call_servertimer = NULL;
 		nfsd_call_nfsd = NULL;
 
 		/* Clean out all NFSv4 state. */
 		nfsrv_throwawayallstate(curthread);
 
 		/* Clean the NFS server reply cache */
 		nfsrvd_cleancache();
 
 		/* Free up the krpc server pool. */
 		if (nfsrvd_pool != NULL)
 			svcpool_destroy(nfsrvd_pool);
 
 		/* and get rid of the locks */
 		for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) {
 			mtx_destroy(&nfsrchash_table[i].mtx);
 			mtx_destroy(&nfsrcahash_table[i].mtx);
 		}
 		mtx_destroy(&nfsrc_udpmtx);
 		mtx_destroy(&nfs_v4root_mutex);
 		mtx_destroy(&nfsv4root_mnt.mnt_mtx);
 		for (i = 0; i < NFSSESSIONHASHSIZE; i++)
 			mtx_destroy(&nfssessionhash[i].mtx);
 		lockdestroy(&nfsv4root_mnt.mnt_explock);
 		loaded = 0;
 		break;
 	default:
 		error = EOPNOTSUPP;
 		break;
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 static moduledata_t nfsd_mod = {
 	"nfsd",
 	nfsd_modevent,
 	NULL,
 };
 DECLARE_MODULE(nfsd, nfsd_mod, SI_SUB_VFS, SI_ORDER_ANY);
 
 /* So that loader and kldload(2) can find us, wherever we are.. */
 MODULE_VERSION(nfsd, 1);
 MODULE_DEPEND(nfsd, nfscommon, 1, 1, 1);
 MODULE_DEPEND(nfsd, nfslock, 1, 1, 1);
 MODULE_DEPEND(nfsd, nfslockd, 1, 1, 1);
 MODULE_DEPEND(nfsd, krpc, 1, 1, 1);
 MODULE_DEPEND(nfsd, nfssvc, 1, 1, 1);
 
Index: projects/arm_intrng/sys/fs/nfsserver/nfs_nfsdstate.c
===================================================================
--- projects/arm_intrng/sys/fs/nfsserver/nfs_nfsdstate.c	(revision 276247)
+++ projects/arm_intrng/sys/fs/nfsserver/nfs_nfsdstate.c	(revision 276248)
@@ -1,5947 +1,6022 @@
 /*-
  * Copyright (c) 2009 Rick Macklem, University of Guelph
  * 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 AUTHOR 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 AUTHOR 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.
  *
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #ifndef APPLEKEXT
 #include 
 
 struct nfsrv_stablefirst nfsrv_stablefirst;
 int nfsrv_issuedelegs = 0;
 int nfsrv_dolocallocks = 0;
 struct nfsv4lock nfsv4rootfs_lock;
 
 extern int newnfs_numnfsd;
 extern struct nfsstats newnfsstats;
 extern int nfsrv_lease;
 extern struct timeval nfsboottime;
 extern u_int32_t newnfs_true, newnfs_false;
 NFSV4ROOTLOCKMUTEX;
 NFSSTATESPINLOCK;
 
 /*
  * Hash lists for nfs V4.
  * (Some would put them in the .h file, but I don't like declaring storage
  *  in a .h)
  */
 struct nfsclienthashhead nfsclienthash[NFSCLIENTHASHSIZE];
 struct nfslockhashhead nfslockhash[NFSLOCKHASHSIZE];
 struct nfssessionhash nfssessionhash[NFSSESSIONHASHSIZE];
 #endif	/* !APPLEKEXT */
 
 static u_int32_t nfsrv_openpluslock = 0, nfsrv_delegatecnt = 0;
 static time_t nfsrvboottime;
 static int nfsrv_writedelegifpos = 1;
 static int nfsrv_returnoldstateid = 0, nfsrv_clients = 0;
 static int nfsrv_clienthighwater = NFSRV_CLIENTHIGHWATER;
 static int nfsrv_nogsscallback = 0;
 
 /* local functions */
 static void nfsrv_dumpaclient(struct nfsclient *clp,
     struct nfsd_dumpclients *dumpp);
 static void nfsrv_freeopenowner(struct nfsstate *stp, int cansleep,
     NFSPROC_T *p);
 static int nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep,
     NFSPROC_T *p);
 static void nfsrv_freelockowner(struct nfsstate *stp, vnode_t vp, int cansleep,
     NFSPROC_T *p);
 static void nfsrv_freeallnfslocks(struct nfsstate *stp, vnode_t vp,
     int cansleep, NFSPROC_T *p);
 static void nfsrv_freenfslock(struct nfslock *lop);
 static void nfsrv_freenfslockfile(struct nfslockfile *lfp);
 static void nfsrv_freedeleg(struct nfsstate *);
 static int nfsrv_getstate(struct nfsclient *clp, nfsv4stateid_t *stateidp, 
     u_int32_t flags, struct nfsstate **stpp);
 static void nfsrv_getowner(struct nfsstatehead *hp, struct nfsstate *new_stp,
     struct nfsstate **stpp);
 static int nfsrv_getlockfh(vnode_t vp, u_short flags,
     struct nfslockfile *new_lfp, fhandle_t *nfhp, NFSPROC_T *p);
 static int nfsrv_getlockfile(u_short flags, struct nfslockfile **new_lfpp,
     struct nfslockfile **lfpp, fhandle_t *nfhp, int lockit);
 static void nfsrv_insertlock(struct nfslock *new_lop,
     struct nfslock *insert_lop, struct nfsstate *stp, struct nfslockfile *lfp);
 static void nfsrv_updatelock(struct nfsstate *stp, struct nfslock **new_lopp,
     struct nfslock **other_lopp, struct nfslockfile *lfp);
 static int nfsrv_getipnumber(u_char *cp);
 static int nfsrv_checkrestart(nfsquad_t clientid, u_int32_t flags,
     nfsv4stateid_t *stateidp, int specialid);
 static int nfsrv_checkgrace(struct nfsrv_descript *nd, struct nfsclient *clp,
     u_int32_t flags);
 static int nfsrv_docallback(struct nfsclient *clp, int procnum,
     nfsv4stateid_t *stateidp, int trunc, fhandle_t *fhp,
     struct nfsvattr *nap, nfsattrbit_t *attrbitp, NFSPROC_T *p);
 static int nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp,
     uint32_t callback, int op, const char *optag, struct nfsdsession **sepp);
 static u_int32_t nfsrv_nextclientindex(void);
 static u_int32_t nfsrv_nextstateindex(struct nfsclient *clp);
 static void nfsrv_markstable(struct nfsclient *clp);
 static int nfsrv_checkstable(struct nfsclient *clp);
 static int nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, struct 
     vnode *vp, NFSPROC_T *p);
 static int nfsrv_delegconflict(struct nfsstate *stp, int *haslockp,
     NFSPROC_T *p, vnode_t vp);
 static int nfsrv_cleandeleg(vnode_t vp, struct nfslockfile *lfp,
     struct nfsclient *clp, int *haslockp, NFSPROC_T *p);
 static int nfsrv_notsamecredname(struct nfsrv_descript *nd,
     struct nfsclient *clp);
 static time_t nfsrv_leaseexpiry(void);
 static void nfsrv_delaydelegtimeout(struct nfsstate *stp);
 static int nfsrv_checkseqid(struct nfsrv_descript *nd, u_int32_t seqid,
     struct nfsstate *stp, struct nfsrvcache *op);
 static int nfsrv_nootherstate(struct nfsstate *stp);
 static int nfsrv_locallock(vnode_t vp, struct nfslockfile *lfp, int flags,
     uint64_t first, uint64_t end, struct nfslockconflict *cfp, NFSPROC_T *p);
 static void nfsrv_localunlock(vnode_t vp, struct nfslockfile *lfp,
     uint64_t init_first, uint64_t init_end, NFSPROC_T *p);
 static int nfsrv_dolocal(vnode_t vp, struct nfslockfile *lfp, int flags,
     int oldflags, uint64_t first, uint64_t end, struct nfslockconflict *cfp,
     NFSPROC_T *p);
 static void nfsrv_locallock_rollback(vnode_t vp, struct nfslockfile *lfp,
     NFSPROC_T *p);
 static void nfsrv_locallock_commit(struct nfslockfile *lfp, int flags,
     uint64_t first, uint64_t end);
 static void nfsrv_locklf(struct nfslockfile *lfp);
 static void nfsrv_unlocklf(struct nfslockfile *lfp);
 static struct nfsdsession *nfsrv_findsession(uint8_t *sessionid);
 static int nfsrv_freesession(struct nfsdsession *sep, uint8_t *sessionid);
 static int nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp,
     int dont_replycache, struct nfsdsession **sepp);
 static int nfsv4_getcbsession(struct nfsclient *clp, struct nfsdsession **sepp);
 
 /*
  * Scan the client list for a match and either return the current one,
  * create a new entry or return an error.
  * If returning a non-error, the clp structure must either be linked into
  * the client list or free'd.
  */
 APPLESTATIC int
 nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp,
     nfsquad_t *clientidp, nfsquad_t *confirmp, NFSPROC_T *p)
 {
 	struct nfsclient *clp = NULL, *new_clp = *new_clpp;
 	int i, error = 0;
 	struct nfsstate *stp, *tstp;
 	struct sockaddr_in *sad, *rad;
 	int zapit = 0, gotit, hasstate = 0, igotlock;
 	static u_int64_t confirm_index = 0;
 
 	/*
 	 * Check for state resource limit exceeded.
 	 */
 	if (nfsrv_openpluslock > NFSRV_V4STATELIMIT) {
 		error = NFSERR_RESOURCE;
 		goto out;
 	}
 
 	if (nfsrv_issuedelegs == 0 ||
 	    ((nd->nd_flag & ND_GSS) != 0 && nfsrv_nogsscallback != 0))
 		/*
 		 * Don't do callbacks when delegations are disabled or
 		 * for AUTH_GSS unless enabled via nfsrv_nogsscallback.
 		 * If establishing a callback connection is attempted
 		 * when a firewall is blocking the callback path, the
 		 * server may wait too long for the connect attempt to
 		 * succeed during the Open. Some clients, such as Linux,
 		 * may timeout and give up on the Open before the server
 		 * replies. Also, since AUTH_GSS callbacks are not
 		 * yet interoperability tested, they might cause the
 		 * server to crap out, if they get past the Init call to
 		 * the client.
 		 */
 		new_clp->lc_program = 0;
 
 	/* Lock out other nfsd threads */
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_relref(&nfsv4rootfs_lock);
 	do {
 		igotlock = nfsv4_lock(&nfsv4rootfs_lock, 1, NULL,
 		    NFSV4ROOTLOCKMUTEXPTR, NULL);
 	} while (!igotlock);
 	NFSUNLOCKV4ROOTMUTEX();
 
 	/*
 	 * Search for a match in the client list.
 	 */
 	gotit = i = 0;
 	while (i < NFSCLIENTHASHSIZE && !gotit) {
 	    LIST_FOREACH(clp, &nfsclienthash[i], lc_hash) {
 		if (new_clp->lc_idlen == clp->lc_idlen &&
 		    !NFSBCMP(new_clp->lc_id, clp->lc_id, clp->lc_idlen)) {
 			gotit = 1;
 			break;
 		}
 	    }
 	    i++;
 	}
 	if (!gotit ||
 	    (clp->lc_flags & (LCL_NEEDSCONFIRM | LCL_ADMINREVOKED))) {
 		if ((nd->nd_flag & ND_NFSV41) != 0 && confirmp->lval[1] != 0) {
 			/*
 			 * For NFSv4.1, if confirmp->lval[1] is non-zero, the
 			 * client is trying to update a confirmed clientid.
 			 */
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 			confirmp->lval[1] = 0;
 			error = NFSERR_NOENT;
 			goto out;
 		}
 		/*
 		 * Get rid of the old one.
 		 */
 		if (i != NFSCLIENTHASHSIZE) {
 			LIST_REMOVE(clp, lc_hash);
 			nfsrv_cleanclient(clp, p);
 			nfsrv_freedeleglist(&clp->lc_deleg);
 			nfsrv_freedeleglist(&clp->lc_olddeleg);
 			zapit = 1;
 		}
 		/*
 		 * Add it after assigning a client id to it.
 		 */
 		new_clp->lc_flags |= LCL_NEEDSCONFIRM;
 		if ((nd->nd_flag & ND_NFSV41) != 0)
 			new_clp->lc_confirm.lval[0] = confirmp->lval[0] =
 			    ++confirm_index;
 		else
 			confirmp->qval = new_clp->lc_confirm.qval =
 			    ++confirm_index;
 		clientidp->lval[0] = new_clp->lc_clientid.lval[0] =
 		    (u_int32_t)nfsrvboottime;
 		clientidp->lval[1] = new_clp->lc_clientid.lval[1] =
 		    nfsrv_nextclientindex();
 		new_clp->lc_stateindex = 0;
 		new_clp->lc_statemaxindex = 0;
 		new_clp->lc_cbref = 0;
 		new_clp->lc_expiry = nfsrv_leaseexpiry();
 		LIST_INIT(&new_clp->lc_open);
 		LIST_INIT(&new_clp->lc_deleg);
 		LIST_INIT(&new_clp->lc_olddeleg);
 		LIST_INIT(&new_clp->lc_session);
 		for (i = 0; i < NFSSTATEHASHSIZE; i++)
 			LIST_INIT(&new_clp->lc_stateid[i]);
 		LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
 		    lc_hash);
 		newnfsstats.srvclients++;
 		nfsrv_openpluslock++;
 		nfsrv_clients++;
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 		if (zapit)
 			nfsrv_zapclient(clp, p);
 		*new_clpp = NULL;
 		goto out;
 	}
 
 	/*
 	 * Now, handle the cases where the id is already issued.
 	 */
 	if (nfsrv_notsamecredname(nd, clp)) {
 	    /*
 	     * Check to see if there is expired state that should go away.
 	     */
 	    if (clp->lc_expiry < NFSD_MONOSEC &&
 	        (!LIST_EMPTY(&clp->lc_open) || !LIST_EMPTY(&clp->lc_deleg))) {
 		nfsrv_cleanclient(clp, p);
 		nfsrv_freedeleglist(&clp->lc_deleg);
 	    }
 
 	    /*
 	     * If there is outstanding state, then reply NFSERR_CLIDINUSE per
 	     * RFC3530 Sec. 8.1.2 last para.
 	     */
 	    if (!LIST_EMPTY(&clp->lc_deleg)) {
 		hasstate = 1;
 	    } else if (LIST_EMPTY(&clp->lc_open)) {
 		hasstate = 0;
 	    } else {
 		hasstate = 0;
 		/* Look for an Open on the OpenOwner */
 		LIST_FOREACH(stp, &clp->lc_open, ls_list) {
 		    if (!LIST_EMPTY(&stp->ls_open)) {
 			hasstate = 1;
 			break;
 		    }
 		}
 	    }
 	    if (hasstate) {
 		/*
 		 * If the uid doesn't match, return NFSERR_CLIDINUSE after
 		 * filling out the correct ipaddr and portnum.
 		 */
 		sad = NFSSOCKADDR(new_clp->lc_req.nr_nam, struct sockaddr_in *);
 		rad = NFSSOCKADDR(clp->lc_req.nr_nam, struct sockaddr_in *);
 		sad->sin_addr.s_addr = rad->sin_addr.s_addr;
 		sad->sin_port = rad->sin_port;
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 		error = NFSERR_CLIDINUSE;
 		goto out;
 	    }
 	}
 
 	if (NFSBCMP(new_clp->lc_verf, clp->lc_verf, NFSX_VERF)) {
 		/*
 		 * If the verifier has changed, the client has rebooted
 		 * and a new client id is issued. The old state info
 		 * can be thrown away once the SETCLIENTID_CONFIRM occurs.
 		 */
 		LIST_REMOVE(clp, lc_hash);
 		new_clp->lc_flags |= LCL_NEEDSCONFIRM;
 		if ((nd->nd_flag & ND_NFSV41) != 0)
 			new_clp->lc_confirm.lval[0] = confirmp->lval[0] =
 			    ++confirm_index;
 		else
 			confirmp->qval = new_clp->lc_confirm.qval =
 			    ++confirm_index;
 		clientidp->lval[0] = new_clp->lc_clientid.lval[0] =
 		    nfsrvboottime;
 		clientidp->lval[1] = new_clp->lc_clientid.lval[1] =
 		    nfsrv_nextclientindex();
 		new_clp->lc_stateindex = 0;
 		new_clp->lc_statemaxindex = 0;
 		new_clp->lc_cbref = 0;
 		new_clp->lc_expiry = nfsrv_leaseexpiry();
 
 		/*
 		 * Save the state until confirmed.
 		 */
 		LIST_NEWHEAD(&new_clp->lc_open, &clp->lc_open, ls_list);
 		LIST_FOREACH(tstp, &new_clp->lc_open, ls_list)
 			tstp->ls_clp = new_clp;
 		LIST_NEWHEAD(&new_clp->lc_deleg, &clp->lc_deleg, ls_list);
 		LIST_FOREACH(tstp, &new_clp->lc_deleg, ls_list)
 			tstp->ls_clp = new_clp;
 		LIST_NEWHEAD(&new_clp->lc_olddeleg, &clp->lc_olddeleg,
 		    ls_list);
 		LIST_FOREACH(tstp, &new_clp->lc_olddeleg, ls_list)
 			tstp->ls_clp = new_clp;
 		for (i = 0; i < NFSSTATEHASHSIZE; i++) {
 			LIST_NEWHEAD(&new_clp->lc_stateid[i],
 			    &clp->lc_stateid[i], ls_hash);
 			LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_hash)
 				tstp->ls_clp = new_clp;
 		}
 		LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
 		    lc_hash);
 		newnfsstats.srvclients++;
 		nfsrv_openpluslock++;
 		nfsrv_clients++;
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 
 		/*
 		 * Must wait until any outstanding callback on the old clp
 		 * completes.
 		 */
 		NFSLOCKSTATE();
 		while (clp->lc_cbref) {
 			clp->lc_flags |= LCL_WAKEUPWANTED;
 			(void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1,
 			    "nfsd clp", 10 * hz);
 		}
 		NFSUNLOCKSTATE();
 		nfsrv_zapclient(clp, p);
 		*new_clpp = NULL;
 		goto out;
 	}
 
 	/* For NFSv4.1, mark that we found a confirmed clientid. */
 	if ((nd->nd_flag & ND_NFSV41) != 0)
 		confirmp->lval[1] = 1;
 	else {
 		/*
 		 * id and verifier match, so update the net address info
 		 * and get rid of any existing callback authentication
 		 * handle, so a new one will be acquired.
 		 */
 		LIST_REMOVE(clp, lc_hash);
 		new_clp->lc_flags |= (LCL_NEEDSCONFIRM | LCL_DONTCLEAN);
 		new_clp->lc_expiry = nfsrv_leaseexpiry();
 		confirmp->qval = new_clp->lc_confirm.qval = ++confirm_index;
 		clientidp->lval[0] = new_clp->lc_clientid.lval[0] =
 		    clp->lc_clientid.lval[0];
 		clientidp->lval[1] = new_clp->lc_clientid.lval[1] =
 		    clp->lc_clientid.lval[1];
 		new_clp->lc_delegtime = clp->lc_delegtime;
 		new_clp->lc_stateindex = clp->lc_stateindex;
 		new_clp->lc_statemaxindex = clp->lc_statemaxindex;
 		new_clp->lc_cbref = 0;
 		LIST_NEWHEAD(&new_clp->lc_open, &clp->lc_open, ls_list);
 		LIST_FOREACH(tstp, &new_clp->lc_open, ls_list)
 			tstp->ls_clp = new_clp;
 		LIST_NEWHEAD(&new_clp->lc_deleg, &clp->lc_deleg, ls_list);
 		LIST_FOREACH(tstp, &new_clp->lc_deleg, ls_list)
 			tstp->ls_clp = new_clp;
 		LIST_NEWHEAD(&new_clp->lc_olddeleg, &clp->lc_olddeleg, ls_list);
 		LIST_FOREACH(tstp, &new_clp->lc_olddeleg, ls_list)
 			tstp->ls_clp = new_clp;
 		for (i = 0; i < NFSSTATEHASHSIZE; i++) {
 			LIST_NEWHEAD(&new_clp->lc_stateid[i],
 			    &clp->lc_stateid[i], ls_hash);
 			LIST_FOREACH(tstp, &new_clp->lc_stateid[i], ls_hash)
 				tstp->ls_clp = new_clp;
 		}
 		LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
 		    lc_hash);
 		newnfsstats.srvclients++;
 		nfsrv_openpluslock++;
 		nfsrv_clients++;
 	}
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_unlock(&nfsv4rootfs_lock, 1);
 	NFSUNLOCKV4ROOTMUTEX();
 
 	if ((nd->nd_flag & ND_NFSV41) == 0) {
 		/*
 		 * Must wait until any outstanding callback on the old clp
 		 * completes.
 		 */
 		NFSLOCKSTATE();
 		while (clp->lc_cbref) {
 			clp->lc_flags |= LCL_WAKEUPWANTED;
 			(void)mtx_sleep(clp, NFSSTATEMUTEXPTR, PZERO - 1,
 			    "nfsdclp", 10 * hz);
 		}
 		NFSUNLOCKSTATE();
 		nfsrv_zapclient(clp, p);
 		*new_clpp = NULL;
 	}
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Check to see if the client id exists and optionally confirm it.
  */
 APPLESTATIC int
 nfsrv_getclient(nfsquad_t clientid, int opflags, struct nfsclient **clpp,
     struct nfsdsession *nsep, nfsquad_t confirm, uint32_t cbprogram,
     struct nfsrv_descript *nd, NFSPROC_T *p)
 {
 	struct nfsclient *clp;
 	struct nfsstate *stp;
 	int i;
 	struct nfsclienthashhead *hp;
 	int error = 0, igotlock, doneok;
 	struct nfssessionhash *shp;
 	struct nfsdsession *sep;
 	uint64_t sessid[2];
 	static uint64_t next_sess = 0;
 
 	if (clpp)
 		*clpp = NULL;
 	if ((nd == NULL || (nd->nd_flag & ND_NFSV41) == 0 ||
 	    opflags != CLOPS_RENEW) && nfsrvboottime != clientid.lval[0]) {
 		error = NFSERR_STALECLIENTID;
 		goto out;
 	}
 
 	/*
 	 * If called with opflags == CLOPS_RENEW, the State Lock is
 	 * already held. Otherwise, we need to get either that or,
 	 * for the case of Confirm, lock out the nfsd threads.
 	 */
 	if (opflags & CLOPS_CONFIRM) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_relref(&nfsv4rootfs_lock);
 		do {
 			igotlock = nfsv4_lock(&nfsv4rootfs_lock, 1, NULL,
 			    NFSV4ROOTLOCKMUTEXPTR, NULL);
 		} while (!igotlock);
 		/*
 		 * Create a new sessionid here, since we need to do it where
 		 * there is a mutex held to serialize update of next_sess.
 		 */
 		if ((nd->nd_flag & ND_NFSV41) != 0) {
 			sessid[0] = ++next_sess;
 			sessid[1] = clientid.qval;
 		}
 		NFSUNLOCKV4ROOTMUTEX();
 	} else if (opflags != CLOPS_RENEW) {
 		NFSLOCKSTATE();
 	}
 
 	/* For NFSv4.1, the clp is acquired from the associated session. */
 	if (nd != NULL && (nd->nd_flag & ND_NFSV41) != 0 &&
 	    opflags == CLOPS_RENEW) {
 		clp = NULL;
 		if ((nd->nd_flag & ND_HASSEQUENCE) != 0) {
 			shp = NFSSESSIONHASH(nd->nd_sessionid);
 			NFSLOCKSESSION(shp);
 			sep = nfsrv_findsession(nd->nd_sessionid);
 			if (sep != NULL)
 				clp = sep->sess_clp;
 			NFSUNLOCKSESSION(shp);
 		}
 	} else {
 		hp = NFSCLIENTHASH(clientid);
 		LIST_FOREACH(clp, hp, lc_hash) {
 			if (clp->lc_clientid.lval[1] == clientid.lval[1])
 				break;
 		}
 	}
 	if (clp == NULL) {
 		if (opflags & CLOPS_CONFIRM)
 			error = NFSERR_STALECLIENTID;
 		else
 			error = NFSERR_EXPIRED;
 	} else if (clp->lc_flags & LCL_ADMINREVOKED) {
 		/*
 		 * If marked admin revoked, just return the error.
 		 */
 		error = NFSERR_ADMINREVOKED;
 	}
 	if (error) {
 		if (opflags & CLOPS_CONFIRM) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		} else if (opflags != CLOPS_RENEW) {
 			NFSUNLOCKSTATE();
 		}
 		goto out;
 	}
 
 	/*
 	 * Perform any operations specified by the opflags.
 	 */
 	if (opflags & CLOPS_CONFIRM) {
 		if (((nd->nd_flag & ND_NFSV41) != 0 &&
 		     clp->lc_confirm.lval[0] != confirm.lval[0]) ||
 		    ((nd->nd_flag & ND_NFSV41) == 0 &&
 		     clp->lc_confirm.qval != confirm.qval))
 			error = NFSERR_STALECLIENTID;
 		else if (nfsrv_notsamecredname(nd, clp))
 			error = NFSERR_CLIDINUSE;
 
 		if (!error) {
 		    if ((clp->lc_flags & (LCL_NEEDSCONFIRM | LCL_DONTCLEAN)) ==
 			LCL_NEEDSCONFIRM) {
 			/*
 			 * Hang onto the delegations (as old delegations)
 			 * for an Open with CLAIM_DELEGATE_PREV unless in
 			 * grace, but get rid of the rest of the state.
 			 */
 			nfsrv_cleanclient(clp, p);
 			nfsrv_freedeleglist(&clp->lc_olddeleg);
 			if (nfsrv_checkgrace(nd, clp, 0)) {
 			    /* In grace, so just delete delegations */
 			    nfsrv_freedeleglist(&clp->lc_deleg);
 			} else {
 			    LIST_FOREACH(stp, &clp->lc_deleg, ls_list)
 				stp->ls_flags |= NFSLCK_OLDDELEG;
 			    clp->lc_delegtime = NFSD_MONOSEC +
 				nfsrv_lease + NFSRV_LEASEDELTA;
 			    LIST_NEWHEAD(&clp->lc_olddeleg, &clp->lc_deleg,
 				ls_list);
 			}
 			if ((nd->nd_flag & ND_NFSV41) != 0)
 			    clp->lc_program = cbprogram;
 		    }
 		    clp->lc_flags &= ~(LCL_NEEDSCONFIRM | LCL_DONTCLEAN);
 		    if (clp->lc_program)
 			clp->lc_flags |= LCL_NEEDSCBNULL;
 		    /* For NFSv4.1, link the session onto the client. */
 		    if (nsep != NULL) {
 			/* Hold a reference on the xprt for a backchannel. */
 			if ((nsep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN)
 			    != 0 && clp->lc_req.nr_client == NULL) {
 			    clp->lc_req.nr_client = (struct __rpc_client *)
 				clnt_bck_create(nd->nd_xprt->xp_socket,
 				cbprogram, NFSV4_CBVERS);
 			    if (clp->lc_req.nr_client != NULL) {
 				SVC_ACQUIRE(nd->nd_xprt);
 				nd->nd_xprt->xp_p2 =
 				    clp->lc_req.nr_client->cl_private;
 				/* Disable idle timeout. */
 				nd->nd_xprt->xp_idletimeout = 0;
 				nsep->sess_cbsess.nfsess_xprt = nd->nd_xprt;
 			    } else
 				nsep->sess_crflags &= ~NFSV4CRSESS_CONNBACKCHAN;
 			}
 			NFSBCOPY(sessid, nsep->sess_sessionid,
 			    NFSX_V4SESSIONID);
 			NFSBCOPY(sessid, nsep->sess_cbsess.nfsess_sessionid,
 			    NFSX_V4SESSIONID);
 			shp = NFSSESSIONHASH(nsep->sess_sessionid);
 			NFSLOCKSESSION(shp);
 			LIST_INSERT_HEAD(&shp->list, nsep, sess_hash);
 			NFSLOCKSTATE();
 			LIST_INSERT_HEAD(&clp->lc_session, nsep, sess_list);
 			nsep->sess_clp = clp;
 			NFSUNLOCKSTATE();
 			NFSUNLOCKSESSION(shp);
 		    }
 		}
 	} else if (clp->lc_flags & LCL_NEEDSCONFIRM) {
 		error = NFSERR_EXPIRED;
 	}
 
 	/*
 	 * If called by the Renew Op, we must check the principal.
 	 */
 	if (!error && (opflags & CLOPS_RENEWOP)) {
 	    if (nfsrv_notsamecredname(nd, clp)) {
 		doneok = 0;
 		for (i = 0; i < NFSSTATEHASHSIZE && doneok == 0; i++) {
 		    LIST_FOREACH(stp, &clp->lc_stateid[i], ls_hash) {
 			if ((stp->ls_flags & NFSLCK_OPEN) &&
 			    stp->ls_uid == nd->nd_cred->cr_uid) {
 				doneok = 1;
 				break;
 			}
 		    }
 		}
 		if (!doneok)
 			error = NFSERR_ACCES;
 	    }
 	    if (!error && (clp->lc_flags & LCL_CBDOWN))
 		error = NFSERR_CBPATHDOWN;
 	}
 	if ((!error || error == NFSERR_CBPATHDOWN) &&
 	     (opflags & CLOPS_RENEW)) {
 		clp->lc_expiry = nfsrv_leaseexpiry();
 	}
 	if (opflags & CLOPS_CONFIRM) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 	} else if (opflags != CLOPS_RENEW) {
 		NFSUNLOCKSTATE();
 	}
 	if (clpp)
 		*clpp = clp;
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Perform the NFSv4.1 destroy clientid.
  */
 int
 nfsrv_destroyclient(nfsquad_t clientid, NFSPROC_T *p)
 {
 	struct nfsclient *clp;
 	struct nfsclienthashhead *hp;
 	int error = 0, i, igotlock;
 
 	if (nfsrvboottime != clientid.lval[0]) {
 		error = NFSERR_STALECLIENTID;
 		goto out;
 	}
 
 	/* Lock out other nfsd threads */
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_relref(&nfsv4rootfs_lock);
 	do {
 		igotlock = nfsv4_lock(&nfsv4rootfs_lock, 1, NULL,
 		    NFSV4ROOTLOCKMUTEXPTR, NULL);
 	} while (igotlock == 0);
 	NFSUNLOCKV4ROOTMUTEX();
 
 	hp = NFSCLIENTHASH(clientid);
 	LIST_FOREACH(clp, hp, lc_hash) {
 		if (clp->lc_clientid.lval[1] == clientid.lval[1])
 			break;
 	}
 	if (clp == NULL) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 		/* Just return ok, since it is gone. */
 		goto out;
 	}
 
 	/* Scan for state on the clientid. */
 	for (i = 0; i < NFSSTATEHASHSIZE; i++)
 		if (!LIST_EMPTY(&clp->lc_stateid[i])) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 			error = NFSERR_CLIENTIDBUSY;
 			goto out;
 		}
 	if (!LIST_EMPTY(&clp->lc_session) || !LIST_EMPTY(&clp->lc_deleg)) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 		error = NFSERR_CLIENTIDBUSY;
 		goto out;
 	}
 
 	/* Destroy the clientid and return ok. */
 	nfsrv_cleanclient(clp, p);
 	nfsrv_freedeleglist(&clp->lc_deleg);
 	nfsrv_freedeleglist(&clp->lc_olddeleg);
 	LIST_REMOVE(clp, lc_hash);
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_unlock(&nfsv4rootfs_lock, 1);
 	NFSUNLOCKV4ROOTMUTEX();
 	nfsrv_zapclient(clp, p);
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Called from the new nfssvc syscall to admin revoke a clientid.
  * Returns 0 for success, error otherwise.
  */
 APPLESTATIC int
 nfsrv_adminrevoke(struct nfsd_clid *revokep, NFSPROC_T *p)
 {
 	struct nfsclient *clp = NULL;
 	int i, error = 0;
 	int gotit, igotlock;
 
 	/*
 	 * First, lock out the nfsd so that state won't change while the
 	 * revocation record is being written to the stable storage restart
 	 * file.
 	 */
 	NFSLOCKV4ROOTMUTEX();
 	do {
 		igotlock = nfsv4_lock(&nfsv4rootfs_lock, 1, NULL,
 		    NFSV4ROOTLOCKMUTEXPTR, NULL);
 	} while (!igotlock);
 	NFSUNLOCKV4ROOTMUTEX();
 
 	/*
 	 * Search for a match in the client list.
 	 */
 	gotit = i = 0;
 	while (i < NFSCLIENTHASHSIZE && !gotit) {
 	    LIST_FOREACH(clp, &nfsclienthash[i], lc_hash) {
 		if (revokep->nclid_idlen == clp->lc_idlen &&
 		    !NFSBCMP(revokep->nclid_id, clp->lc_id, clp->lc_idlen)) {
 			gotit = 1;
 			break;
 		}
 	    }
 	    i++;
 	}
 	if (!gotit) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 0);
 		NFSUNLOCKV4ROOTMUTEX();
 		error = EPERM;
 		goto out;
 	}
 
 	/*
 	 * Now, write out the revocation record
 	 */
 	nfsrv_writestable(clp->lc_id, clp->lc_idlen, NFSNST_REVOKE, p);
 	nfsrv_backupstable();
 
 	/*
 	 * and clear out the state, marking the clientid revoked.
 	 */
 	clp->lc_flags &= ~LCL_CALLBACKSON;
 	clp->lc_flags |= LCL_ADMINREVOKED;
 	nfsrv_cleanclient(clp, p);
 	nfsrv_freedeleglist(&clp->lc_deleg);
 	nfsrv_freedeleglist(&clp->lc_olddeleg);
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_unlock(&nfsv4rootfs_lock, 0);
 	NFSUNLOCKV4ROOTMUTEX();
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Dump out stats for all clients. Called from nfssvc(2), that is used
  * newnfsstats.
  */
 APPLESTATIC void
 nfsrv_dumpclients(struct nfsd_dumpclients *dumpp, int maxcnt)
 {
 	struct nfsclient *clp;
 	int i = 0, cnt = 0;
 
 	/*
 	 * First, get a reference on the nfsv4rootfs_lock so that an
 	 * exclusive lock cannot be acquired while dumping the clients.
 	 */
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_getref(&nfsv4rootfs_lock, NULL, NFSV4ROOTLOCKMUTEXPTR, NULL);
 	NFSUNLOCKV4ROOTMUTEX();
 	NFSLOCKSTATE();
 	/*
 	 * Rattle through the client lists until done.
 	 */
 	while (i < NFSCLIENTHASHSIZE && cnt < maxcnt) {
 	    clp = LIST_FIRST(&nfsclienthash[i]);
 	    while (clp != LIST_END(&nfsclienthash[i]) && cnt < maxcnt) {
 		nfsrv_dumpaclient(clp, &dumpp[cnt]);
 		cnt++;
 		clp = LIST_NEXT(clp, lc_hash);
 	    }
 	    i++;
 	}
 	if (cnt < maxcnt)
 	    dumpp[cnt].ndcl_clid.nclid_idlen = 0;
 	NFSUNLOCKSTATE();
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_relref(&nfsv4rootfs_lock);
 	NFSUNLOCKV4ROOTMUTEX();
 }
 
 /*
  * Dump stats for a client. Must be called with the NFSSTATELOCK and spl'd.
  */
 static void
 nfsrv_dumpaclient(struct nfsclient *clp, struct nfsd_dumpclients *dumpp)
 {
 	struct nfsstate *stp, *openstp, *lckownstp;
 	struct nfslock *lop;
 	struct sockaddr *sad;
 	struct sockaddr_in *rad;
 	struct sockaddr_in6 *rad6;
 
 	dumpp->ndcl_nopenowners = dumpp->ndcl_nlockowners = 0;
 	dumpp->ndcl_nopens = dumpp->ndcl_nlocks = 0;
 	dumpp->ndcl_ndelegs = dumpp->ndcl_nolddelegs = 0;
 	dumpp->ndcl_flags = clp->lc_flags;
 	dumpp->ndcl_clid.nclid_idlen = clp->lc_idlen;
 	NFSBCOPY(clp->lc_id, dumpp->ndcl_clid.nclid_id, clp->lc_idlen);
 	sad = NFSSOCKADDR(clp->lc_req.nr_nam, struct sockaddr *);
 	dumpp->ndcl_addrfam = sad->sa_family;
 	if (sad->sa_family == AF_INET) {
 		rad = (struct sockaddr_in *)sad;
 		dumpp->ndcl_cbaddr.sin_addr = rad->sin_addr;
 	} else {
 		rad6 = (struct sockaddr_in6 *)sad;
 		dumpp->ndcl_cbaddr.sin6_addr = rad6->sin6_addr;
 	}
 
 	/*
 	 * Now, scan the state lists and total up the opens and locks.
 	 */
 	LIST_FOREACH(stp, &clp->lc_open, ls_list) {
 	    dumpp->ndcl_nopenowners++;
 	    LIST_FOREACH(openstp, &stp->ls_open, ls_list) {
 		dumpp->ndcl_nopens++;
 		LIST_FOREACH(lckownstp, &openstp->ls_open, ls_list) {
 		    dumpp->ndcl_nlockowners++;
 		    LIST_FOREACH(lop, &lckownstp->ls_lock, lo_lckowner) {
 			dumpp->ndcl_nlocks++;
 		    }
 		}
 	    }
 	}
 
 	/*
 	 * and the delegation lists.
 	 */
 	LIST_FOREACH(stp, &clp->lc_deleg, ls_list) {
 	    dumpp->ndcl_ndelegs++;
 	}
 	LIST_FOREACH(stp, &clp->lc_olddeleg, ls_list) {
 	    dumpp->ndcl_nolddelegs++;
 	}
 }
 
 /*
  * Dump out lock stats for a file.
  */
 APPLESTATIC void
 nfsrv_dumplocks(vnode_t vp, struct nfsd_dumplocks *ldumpp, int maxcnt,
     NFSPROC_T *p)
 {
 	struct nfsstate *stp;
 	struct nfslock *lop;
 	int cnt = 0;
 	struct nfslockfile *lfp;
 	struct sockaddr *sad;
 	struct sockaddr_in *rad;
 	struct sockaddr_in6 *rad6;
 	int ret;
 	fhandle_t nfh;
 
 	ret = nfsrv_getlockfh(vp, 0, NULL, &nfh, p);
 	/*
 	 * First, get a reference on the nfsv4rootfs_lock so that an
 	 * exclusive lock on it cannot be acquired while dumping the locks.
 	 */
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_getref(&nfsv4rootfs_lock, NULL, NFSV4ROOTLOCKMUTEXPTR, NULL);
 	NFSUNLOCKV4ROOTMUTEX();
 	NFSLOCKSTATE();
 	if (!ret)
 		ret = nfsrv_getlockfile(0, NULL, &lfp, &nfh, 0);
 	if (ret) {
 		ldumpp[0].ndlck_clid.nclid_idlen = 0;
 		NFSUNLOCKSTATE();
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_relref(&nfsv4rootfs_lock);
 		NFSUNLOCKV4ROOTMUTEX();
 		return;
 	}
 
 	/*
 	 * For each open share on file, dump it out.
 	 */
 	stp = LIST_FIRST(&lfp->lf_open);
 	while (stp != LIST_END(&lfp->lf_open) && cnt < maxcnt) {
 		ldumpp[cnt].ndlck_flags = stp->ls_flags;
 		ldumpp[cnt].ndlck_stateid.seqid = stp->ls_stateid.seqid;
 		ldumpp[cnt].ndlck_stateid.other[0] = stp->ls_stateid.other[0];
 		ldumpp[cnt].ndlck_stateid.other[1] = stp->ls_stateid.other[1];
 		ldumpp[cnt].ndlck_stateid.other[2] = stp->ls_stateid.other[2];
 		ldumpp[cnt].ndlck_owner.nclid_idlen =
 		    stp->ls_openowner->ls_ownerlen;
 		NFSBCOPY(stp->ls_openowner->ls_owner,
 		    ldumpp[cnt].ndlck_owner.nclid_id,
 		    stp->ls_openowner->ls_ownerlen);
 		ldumpp[cnt].ndlck_clid.nclid_idlen = stp->ls_clp->lc_idlen;
 		NFSBCOPY(stp->ls_clp->lc_id, ldumpp[cnt].ndlck_clid.nclid_id,
 		    stp->ls_clp->lc_idlen);
 		sad=NFSSOCKADDR(stp->ls_clp->lc_req.nr_nam, struct sockaddr *);
 		ldumpp[cnt].ndlck_addrfam = sad->sa_family;
 		if (sad->sa_family == AF_INET) {
 			rad = (struct sockaddr_in *)sad;
 			ldumpp[cnt].ndlck_cbaddr.sin_addr = rad->sin_addr;
 		} else {
 			rad6 = (struct sockaddr_in6 *)sad;
 			ldumpp[cnt].ndlck_cbaddr.sin6_addr = rad6->sin6_addr;
 		}
 		stp = LIST_NEXT(stp, ls_file);
 		cnt++;
 	}
 
 	/*
 	 * and all locks.
 	 */
 	lop = LIST_FIRST(&lfp->lf_lock);
 	while (lop != LIST_END(&lfp->lf_lock) && cnt < maxcnt) {
 		stp = lop->lo_stp;
 		ldumpp[cnt].ndlck_flags = lop->lo_flags;
 		ldumpp[cnt].ndlck_first = lop->lo_first;
 		ldumpp[cnt].ndlck_end = lop->lo_end;
 		ldumpp[cnt].ndlck_stateid.seqid = stp->ls_stateid.seqid;
 		ldumpp[cnt].ndlck_stateid.other[0] = stp->ls_stateid.other[0];
 		ldumpp[cnt].ndlck_stateid.other[1] = stp->ls_stateid.other[1];
 		ldumpp[cnt].ndlck_stateid.other[2] = stp->ls_stateid.other[2];
 		ldumpp[cnt].ndlck_owner.nclid_idlen = stp->ls_ownerlen;
 		NFSBCOPY(stp->ls_owner, ldumpp[cnt].ndlck_owner.nclid_id,
 		    stp->ls_ownerlen);
 		ldumpp[cnt].ndlck_clid.nclid_idlen = stp->ls_clp->lc_idlen;
 		NFSBCOPY(stp->ls_clp->lc_id, ldumpp[cnt].ndlck_clid.nclid_id,
 		    stp->ls_clp->lc_idlen);
 		sad=NFSSOCKADDR(stp->ls_clp->lc_req.nr_nam, struct sockaddr *);
 		ldumpp[cnt].ndlck_addrfam = sad->sa_family;
 		if (sad->sa_family == AF_INET) {
 			rad = (struct sockaddr_in *)sad;
 			ldumpp[cnt].ndlck_cbaddr.sin_addr = rad->sin_addr;
 		} else {
 			rad6 = (struct sockaddr_in6 *)sad;
 			ldumpp[cnt].ndlck_cbaddr.sin6_addr = rad6->sin6_addr;
 		}
 		lop = LIST_NEXT(lop, lo_lckfile);
 		cnt++;
 	}
 
 	/*
 	 * and the delegations.
 	 */
 	stp = LIST_FIRST(&lfp->lf_deleg);
 	while (stp != LIST_END(&lfp->lf_deleg) && cnt < maxcnt) {
 		ldumpp[cnt].ndlck_flags = stp->ls_flags;
 		ldumpp[cnt].ndlck_stateid.seqid = stp->ls_stateid.seqid;
 		ldumpp[cnt].ndlck_stateid.other[0] = stp->ls_stateid.other[0];
 		ldumpp[cnt].ndlck_stateid.other[1] = stp->ls_stateid.other[1];
 		ldumpp[cnt].ndlck_stateid.other[2] = stp->ls_stateid.other[2];
 		ldumpp[cnt].ndlck_owner.nclid_idlen = 0;
 		ldumpp[cnt].ndlck_clid.nclid_idlen = stp->ls_clp->lc_idlen;
 		NFSBCOPY(stp->ls_clp->lc_id, ldumpp[cnt].ndlck_clid.nclid_id,
 		    stp->ls_clp->lc_idlen);
 		sad=NFSSOCKADDR(stp->ls_clp->lc_req.nr_nam, struct sockaddr *);
 		ldumpp[cnt].ndlck_addrfam = sad->sa_family;
 		if (sad->sa_family == AF_INET) {
 			rad = (struct sockaddr_in *)sad;
 			ldumpp[cnt].ndlck_cbaddr.sin_addr = rad->sin_addr;
 		} else {
 			rad6 = (struct sockaddr_in6 *)sad;
 			ldumpp[cnt].ndlck_cbaddr.sin6_addr = rad6->sin6_addr;
 		}
 		stp = LIST_NEXT(stp, ls_file);
 		cnt++;
 	}
 
 	/*
 	 * If list isn't full, mark end of list by setting the client name
 	 * to zero length.
 	 */
 	if (cnt < maxcnt)
 		ldumpp[cnt].ndlck_clid.nclid_idlen = 0;
 	NFSUNLOCKSTATE();
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_relref(&nfsv4rootfs_lock);
 	NFSUNLOCKV4ROOTMUTEX();
 }
 
 /*
  * Server timer routine. It can scan any linked list, so long
  * as it holds the spin/mutex lock and there is no exclusive lock on
  * nfsv4rootfs_lock.
  * (For OpenBSD, a kthread is ok. For FreeBSD, I think it is ok
  *  to do this from a callout, since the spin locks work. For
  *  Darwin, I'm not sure what will work correctly yet.)
  * Should be called once per second.
  */
 APPLESTATIC void
 nfsrv_servertimer(void)
 {
 	struct nfsclient *clp, *nclp;
 	struct nfsstate *stp, *nstp;
 	int got_ref, i;
 
 	/*
 	 * Make sure nfsboottime is set. This is used by V3 as well
 	 * as V4. Note that nfsboottime is not nfsrvboottime, which is
 	 * only used by the V4 server for leases.
 	 */
 	if (nfsboottime.tv_sec == 0)
 		NFSSETBOOTTIME(nfsboottime);
 
 	/*
 	 * If server hasn't started yet, just return.
 	 */
 	NFSLOCKSTATE();
 	if (nfsrv_stablefirst.nsf_eograce == 0) {
 		NFSUNLOCKSTATE();
 		return;
 	}
 	if (!(nfsrv_stablefirst.nsf_flags & NFSNSF_UPDATEDONE)) {
 		if (!(nfsrv_stablefirst.nsf_flags & NFSNSF_GRACEOVER) &&
 		    NFSD_MONOSEC > nfsrv_stablefirst.nsf_eograce)
 			nfsrv_stablefirst.nsf_flags |=
 			    (NFSNSF_GRACEOVER | NFSNSF_NEEDLOCK);
 		NFSUNLOCKSTATE();
 		return;
 	}
 
 	/*
 	 * Try and get a reference count on the nfsv4rootfs_lock so that
 	 * no nfsd thread can acquire an exclusive lock on it before this
 	 * call is done. If it is already exclusively locked, just return.
 	 */
 	NFSLOCKV4ROOTMUTEX();
 	got_ref = nfsv4_getref_nonblock(&nfsv4rootfs_lock);
 	NFSUNLOCKV4ROOTMUTEX();
 	if (got_ref == 0) {
 		NFSUNLOCKSTATE();
 		return;
 	}
 
 	/*
 	 * For each client...
 	 */
 	for (i = 0; i < NFSCLIENTHASHSIZE; i++) {
 	    clp = LIST_FIRST(&nfsclienthash[i]);
 	    while (clp != LIST_END(&nfsclienthash[i])) {
 		nclp = LIST_NEXT(clp, lc_hash);
 		if (!(clp->lc_flags & LCL_EXPIREIT)) {
 		    if (((clp->lc_expiry + NFSRV_STALELEASE) < NFSD_MONOSEC
 			 && ((LIST_EMPTY(&clp->lc_deleg)
 			      && LIST_EMPTY(&clp->lc_open)) ||
 			     nfsrv_clients > nfsrv_clienthighwater)) ||
 			(clp->lc_expiry + NFSRV_MOULDYLEASE) < NFSD_MONOSEC ||
 			(clp->lc_expiry < NFSD_MONOSEC &&
 			 (nfsrv_openpluslock * 10 / 9) > NFSRV_V4STATELIMIT)) {
 			/*
 			 * Lease has expired several nfsrv_lease times ago:
 			 * PLUS
 			 *    - no state is associated with it
 			 *    OR
 			 *    - above high water mark for number of clients
 			 *      (nfsrv_clienthighwater should be large enough
 			 *       that this only occurs when clients fail to
 			 *       use the same nfs_client_id4.id. Maybe somewhat
 			 *       higher that the maximum number of clients that
 			 *       will mount this server?)
 			 * OR
 			 * Lease has expired a very long time ago
 			 * OR
 			 * Lease has expired PLUS the number of opens + locks
 			 * has exceeded 90% of capacity
 			 *
 			 * --> Mark for expiry. The actual expiry will be done
 			 *     by an nfsd sometime soon.
 			 */
 			clp->lc_flags |= LCL_EXPIREIT;
 			nfsrv_stablefirst.nsf_flags |=
 			    (NFSNSF_NEEDLOCK | NFSNSF_EXPIREDCLIENT);
 		    } else {
 			/*
 			 * If there are no opens, increment no open tick cnt
 			 * If time exceeds NFSNOOPEN, mark it to be thrown away
 			 * otherwise, if there is an open, reset no open time
 			 * Hopefully, this will avoid excessive re-creation
 			 * of open owners and subsequent open confirms.
 			 */
 			stp = LIST_FIRST(&clp->lc_open);
 			while (stp != LIST_END(&clp->lc_open)) {
 				nstp = LIST_NEXT(stp, ls_list);
 				if (LIST_EMPTY(&stp->ls_open)) {
 					stp->ls_noopens++;
 					if (stp->ls_noopens > NFSNOOPEN ||
 					    (nfsrv_openpluslock * 2) >
 					    NFSRV_V4STATELIMIT)
 						nfsrv_stablefirst.nsf_flags |=
 							NFSNSF_NOOPENS;
 				} else {
 					stp->ls_noopens = 0;
 				}
 				stp = nstp;
 			}
 		    }
 		}
 		clp = nclp;
 	    }
 	}
 	NFSUNLOCKSTATE();
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_relref(&nfsv4rootfs_lock);
 	NFSUNLOCKV4ROOTMUTEX();
 }
 
 /*
  * The following set of functions free up the various data structures.
  */
 /*
  * Clear out all open/lock state related to this nfsclient.
  * Caller must hold an exclusive lock on nfsv4rootfs_lock, so that
  * there are no other active nfsd threads.
  */
 APPLESTATIC void
 nfsrv_cleanclient(struct nfsclient *clp, NFSPROC_T *p)
 {
 	struct nfsstate *stp, *nstp;
 	struct nfsdsession *sep, *nsep;
 
 	LIST_FOREACH_SAFE(stp, &clp->lc_open, ls_list, nstp)
 		nfsrv_freeopenowner(stp, 1, p);
 	if ((clp->lc_flags & LCL_ADMINREVOKED) == 0)
 		LIST_FOREACH_SAFE(sep, &clp->lc_session, sess_list, nsep)
 			(void)nfsrv_freesession(sep, NULL);
 }
 
 /*
  * Free a client that has been cleaned. It should also already have been
  * removed from the lists.
  * (Just to be safe w.r.t. newnfs_disconnect(), call this function when
  *  softclock interrupts are enabled.)
  */
 APPLESTATIC void
 nfsrv_zapclient(struct nfsclient *clp, NFSPROC_T *p)
 {
 
 #ifdef notyet
 	if ((clp->lc_flags & (LCL_GSS | LCL_CALLBACKSON)) ==
 	     (LCL_GSS | LCL_CALLBACKSON) &&
 	    (clp->lc_hand.nfsh_flag & NFSG_COMPLETE) &&
 	    clp->lc_handlelen > 0) {
 		clp->lc_hand.nfsh_flag &= ~NFSG_COMPLETE;
 		clp->lc_hand.nfsh_flag |= NFSG_DESTROYED;
 		(void) nfsrv_docallback(clp, NFSV4PROC_CBNULL,
 			NULL, 0, NULL, NULL, NULL, p);
 	}
 #endif
 	newnfs_disconnect(&clp->lc_req);
 	NFSSOCKADDRFREE(clp->lc_req.nr_nam);
 	NFSFREEMUTEX(&clp->lc_req.nr_mtx);
 	free((caddr_t)clp, M_NFSDCLIENT);
 	NFSLOCKSTATE();
 	newnfsstats.srvclients--;
 	nfsrv_openpluslock--;
 	nfsrv_clients--;
 	NFSUNLOCKSTATE();
 }
 
 /*
  * Free a list of delegation state structures.
  * (This function will also free all nfslockfile structures that no
  *  longer have associated state.)
  */
 APPLESTATIC void
 nfsrv_freedeleglist(struct nfsstatehead *sthp)
 {
 	struct nfsstate *stp, *nstp;
 
 	LIST_FOREACH_SAFE(stp, sthp, ls_list, nstp) {
 		nfsrv_freedeleg(stp);
 	}
 	LIST_INIT(sthp);
 }
 
 /*
  * Free up a delegation.
  */
 static void
 nfsrv_freedeleg(struct nfsstate *stp)
 {
 	struct nfslockfile *lfp;
 
 	LIST_REMOVE(stp, ls_hash);
 	LIST_REMOVE(stp, ls_list);
 	LIST_REMOVE(stp, ls_file);
 	lfp = stp->ls_lfp;
 	if (LIST_EMPTY(&lfp->lf_open) &&
 	    LIST_EMPTY(&lfp->lf_lock) && LIST_EMPTY(&lfp->lf_deleg) &&
 	    LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) &&
 	    lfp->lf_usecount == 0 &&
 	    nfsv4_testlock(&lfp->lf_locallock_lck) == 0)
 		nfsrv_freenfslockfile(lfp);
 	FREE((caddr_t)stp, M_NFSDSTATE);
 	newnfsstats.srvdelegates--;
 	nfsrv_openpluslock--;
 	nfsrv_delegatecnt--;
 }
 
 /*
  * This function frees an open owner and all associated opens.
  */
 static void
 nfsrv_freeopenowner(struct nfsstate *stp, int cansleep, NFSPROC_T *p)
 {
 	struct nfsstate *nstp, *tstp;
 
 	LIST_REMOVE(stp, ls_list);
 	/*
 	 * Now, free all associated opens.
 	 */
 	nstp = LIST_FIRST(&stp->ls_open);
 	while (nstp != LIST_END(&stp->ls_open)) {
 		tstp = nstp;
 		nstp = LIST_NEXT(nstp, ls_list);
 		(void) nfsrv_freeopen(tstp, NULL, cansleep, p);
 	}
 	if (stp->ls_op)
 		nfsrvd_derefcache(stp->ls_op);
 	FREE((caddr_t)stp, M_NFSDSTATE);
 	newnfsstats.srvopenowners--;
 	nfsrv_openpluslock--;
 }
 
 /*
  * This function frees an open (nfsstate open structure) with all associated
  * lock_owners and locks. It also frees the nfslockfile structure iff there
  * are no other opens on the file.
  * Returns 1 if it free'd the nfslockfile, 0 otherwise.
  */
 static int
 nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep, NFSPROC_T *p)
 {
 	struct nfsstate *nstp, *tstp;
 	struct nfslockfile *lfp;
 	int ret;
 
 	LIST_REMOVE(stp, ls_hash);
 	LIST_REMOVE(stp, ls_list);
 	LIST_REMOVE(stp, ls_file);
 
 	lfp = stp->ls_lfp;
 	/*
 	 * Now, free all lockowners associated with this open.
 	 */
 	LIST_FOREACH_SAFE(tstp, &stp->ls_open, ls_list, nstp)
 		nfsrv_freelockowner(tstp, vp, cansleep, p);
 
 	/*
 	 * The nfslockfile is freed here if there are no locks
 	 * associated with the open.
 	 * If there are locks associated with the open, the
 	 * nfslockfile structure can be freed via nfsrv_freelockowner().
 	 * Acquire the state mutex to avoid races with calls to
 	 * nfsrv_getlockfile().
 	 */
 	if (cansleep != 0)
 		NFSLOCKSTATE();
 	if (lfp != NULL && LIST_EMPTY(&lfp->lf_open) &&
 	    LIST_EMPTY(&lfp->lf_deleg) && LIST_EMPTY(&lfp->lf_lock) &&
 	    LIST_EMPTY(&lfp->lf_locallock) && LIST_EMPTY(&lfp->lf_rollback) &&
 	    lfp->lf_usecount == 0 &&
 	    (cansleep != 0 || nfsv4_testlock(&lfp->lf_locallock_lck) == 0)) {
 		nfsrv_freenfslockfile(lfp);
 		ret = 1;
 	} else
 		ret = 0;
 	if (cansleep != 0)
 		NFSUNLOCKSTATE();
 	FREE((caddr_t)stp, M_NFSDSTATE);
 	newnfsstats.srvopens--;
 	nfsrv_openpluslock--;
 	return (ret);
 }
 
 /*
  * Frees a lockowner and all associated locks.
  */
 static void
 nfsrv_freelockowner(struct nfsstate *stp, vnode_t vp, int cansleep,
     NFSPROC_T *p)
 {
 
 	LIST_REMOVE(stp, ls_hash);
 	LIST_REMOVE(stp, ls_list);
 	nfsrv_freeallnfslocks(stp, vp, cansleep, p);
 	if (stp->ls_op)
 		nfsrvd_derefcache(stp->ls_op);
 	FREE((caddr_t)stp, M_NFSDSTATE);
 	newnfsstats.srvlockowners--;
 	nfsrv_openpluslock--;
 }
 
 /*
  * Free all the nfs locks on a lockowner.
  */
 static void
 nfsrv_freeallnfslocks(struct nfsstate *stp, vnode_t vp, int cansleep,
     NFSPROC_T *p)
 {
 	struct nfslock *lop, *nlop;
 	struct nfsrollback *rlp, *nrlp;
 	struct nfslockfile *lfp = NULL;
 	int gottvp = 0;
 	vnode_t tvp = NULL;
 	uint64_t first, end;
 
+	if (vp != NULL)
+		ASSERT_VOP_UNLOCKED(vp, "nfsrv_freeallnfslocks: vnode locked");
 	lop = LIST_FIRST(&stp->ls_lock);
 	while (lop != LIST_END(&stp->ls_lock)) {
 		nlop = LIST_NEXT(lop, lo_lckowner);
 		/*
 		 * Since all locks should be for the same file, lfp should
 		 * not change.
 		 */
 		if (lfp == NULL)
 			lfp = lop->lo_lfp;
 		else if (lfp != lop->lo_lfp)
 			panic("allnfslocks");
 		/*
 		 * If vp is NULL and cansleep != 0, a vnode must be acquired
 		 * from the file handle. This only occurs when called from
 		 * nfsrv_cleanclient().
 		 */
 		if (gottvp == 0) {
 			if (nfsrv_dolocallocks == 0)
 				tvp = NULL;
-			else if (vp == NULL && cansleep != 0)
+			else if (vp == NULL && cansleep != 0) {
 				tvp = nfsvno_getvp(&lfp->lf_fh);
-			else
+				NFSVOPUNLOCK(tvp, 0);
+			} else
 				tvp = vp;
 			gottvp = 1;
 		}
 
 		if (tvp != NULL) {
 			if (cansleep == 0)
 				panic("allnfs2");
 			first = lop->lo_first;
 			end = lop->lo_end;
 			nfsrv_freenfslock(lop);
 			nfsrv_localunlock(tvp, lfp, first, end, p);
 			LIST_FOREACH_SAFE(rlp, &lfp->lf_rollback, rlck_list,
 			    nrlp)
 				free(rlp, M_NFSDROLLBACK);
 			LIST_INIT(&lfp->lf_rollback);
 		} else
 			nfsrv_freenfslock(lop);
 		lop = nlop;
 	}
 	if (vp == NULL && tvp != NULL)
-		vput(tvp);
+		vrele(tvp);
 }
 
 /*
  * Free an nfslock structure.
  */
 static void
 nfsrv_freenfslock(struct nfslock *lop)
 {
 
 	if (lop->lo_lckfile.le_prev != NULL) {
 		LIST_REMOVE(lop, lo_lckfile);
 		newnfsstats.srvlocks--;
 		nfsrv_openpluslock--;
 	}
 	LIST_REMOVE(lop, lo_lckowner);
 	FREE((caddr_t)lop, M_NFSDLOCK);
 }
 
 /*
  * This function frees an nfslockfile structure.
  */
 static void
 nfsrv_freenfslockfile(struct nfslockfile *lfp)
 {
 
 	LIST_REMOVE(lfp, lf_hash);
 	FREE((caddr_t)lfp, M_NFSDLOCKFILE);
 }
 
 /*
  * This function looks up an nfsstate structure via stateid.
  */
 static int
 nfsrv_getstate(struct nfsclient *clp, nfsv4stateid_t *stateidp, __unused u_int32_t flags,
     struct nfsstate **stpp)
 {
 	struct nfsstate *stp;
 	struct nfsstatehead *hp;
 	int error = 0;
 
 	*stpp = NULL;
 	hp = NFSSTATEHASH(clp, *stateidp);
 	LIST_FOREACH(stp, hp, ls_hash) {
 		if (!NFSBCMP(stp->ls_stateid.other, stateidp->other,
 			NFSX_STATEIDOTHER))
 			break;
 	}
 
 	/*
 	 * If no state id in list, return NFSERR_BADSTATEID.
 	 */
 	if (stp == LIST_END(hp)) {
 		error = NFSERR_BADSTATEID;
 		goto out;
 	}
 	*stpp = stp;
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * This function gets an nfsstate structure via owner string.
  */
 static void
 nfsrv_getowner(struct nfsstatehead *hp, struct nfsstate *new_stp,
     struct nfsstate **stpp)
 {
 	struct nfsstate *stp;
 
 	*stpp = NULL;
 	LIST_FOREACH(stp, hp, ls_list) {
 		if (new_stp->ls_ownerlen == stp->ls_ownerlen &&
 		  !NFSBCMP(new_stp->ls_owner,stp->ls_owner,stp->ls_ownerlen)) {
 			*stpp = stp;
 			return;
 		}
 	}
 }
 
 /*
  * Lock control function called to update lock status.
  * Returns 0 upon success, -1 if there is no lock and the flags indicate
  * that one isn't to be created and an NFSERR_xxx for other errors.
  * The structures new_stp and new_lop are passed in as pointers that should
  * be set to NULL if the structure is used and shouldn't be free'd.
  * For the NFSLCK_TEST and NFSLCK_CHECK cases, the structures are
  * never used and can safely be allocated on the stack. For all other
  * cases, *new_stpp and *new_lopp should be malloc'd before the call,
  * in case they are used.
  */
 APPLESTATIC int
 nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp,
     struct nfslock **new_lopp, struct nfslockconflict *cfp,
     nfsquad_t clientid, nfsv4stateid_t *stateidp,
     __unused struct nfsexstuff *exp,
     struct nfsrv_descript *nd, NFSPROC_T *p)
 {
 	struct nfslock *lop;
 	struct nfsstate *new_stp = *new_stpp;
 	struct nfslock *new_lop = *new_lopp;
 	struct nfsstate *tstp, *mystp, *nstp;
 	int specialid = 0;
 	struct nfslockfile *lfp;
 	struct nfslock *other_lop = NULL;
 	struct nfsstate *stp, *lckstp = NULL;
 	struct nfsclient *clp = NULL;
 	u_int32_t bits;
 	int error = 0, haslock = 0, ret, reterr;
-	int getlckret, delegation = 0, filestruct_locked;
+	int getlckret, delegation = 0, filestruct_locked, vnode_unlocked = 0;
 	fhandle_t nfh;
 	uint64_t first, end;
 	uint32_t lock_flags;
 
 	if (new_stp->ls_flags & (NFSLCK_CHECK | NFSLCK_SETATTR)) {
 		/*
 		 * Note the special cases of "all 1s" or "all 0s" stateids and
 		 * let reads with all 1s go ahead.
 		 */
 		if (new_stp->ls_stateid.seqid == 0x0 &&
 		    new_stp->ls_stateid.other[0] == 0x0 &&
 		    new_stp->ls_stateid.other[1] == 0x0 &&
 		    new_stp->ls_stateid.other[2] == 0x0)
 			specialid = 1;
 		else if (new_stp->ls_stateid.seqid == 0xffffffff &&
 		    new_stp->ls_stateid.other[0] == 0xffffffff &&
 		    new_stp->ls_stateid.other[1] == 0xffffffff &&
 		    new_stp->ls_stateid.other[2] == 0xffffffff)
 			specialid = 2;
 	}
 
 	/*
 	 * Check for restart conditions (client and server).
 	 */
 	error = nfsrv_checkrestart(clientid, new_stp->ls_flags,
 	    &new_stp->ls_stateid, specialid);
 	if (error)
 		goto out;
 
 	/*
 	 * Check for state resource limit exceeded.
 	 */
 	if ((new_stp->ls_flags & NFSLCK_LOCK) &&
 	    nfsrv_openpluslock > NFSRV_V4STATELIMIT) {
 		error = NFSERR_RESOURCE;
 		goto out;
 	}
 
 	/*
 	 * For the lock case, get another nfslock structure,
 	 * just in case we need it.
 	 * Malloc now, before we start sifting through the linked lists,
 	 * in case we have to wait for memory.
 	 */
 tryagain:
 	if (new_stp->ls_flags & NFSLCK_LOCK)
 		MALLOC(other_lop, struct nfslock *, sizeof (struct nfslock),
 		    M_NFSDLOCK, M_WAITOK);
 	filestruct_locked = 0;
 	reterr = 0;
 	lfp = NULL;
 
 	/*
 	 * Get the lockfile structure for CFH now, so we can do a sanity
 	 * check against the stateid, before incrementing the seqid#, since
 	 * we want to return NFSERR_BADSTATEID on failure and the seqid#
 	 * shouldn't be incremented for this case.
 	 * If nfsrv_getlockfile() returns -1, it means "not found", which
 	 * will be handled later.
 	 * If we are doing Lock/LockU and local locking is enabled, sleep
 	 * lock the nfslockfile structure.
 	 */
 	getlckret = nfsrv_getlockfh(vp, new_stp->ls_flags, NULL, &nfh, p);
 	NFSLOCKSTATE();
 	if (getlckret == 0) {
 		if ((new_stp->ls_flags & (NFSLCK_LOCK | NFSLCK_UNLOCK)) != 0 &&
 		    nfsrv_dolocallocks != 0 && nd->nd_repstat == 0) {
 			getlckret = nfsrv_getlockfile(new_stp->ls_flags, NULL,
 			    &lfp, &nfh, 1);
 			if (getlckret == 0)
 				filestruct_locked = 1;
 		} else
 			getlckret = nfsrv_getlockfile(new_stp->ls_flags, NULL,
 			    &lfp, &nfh, 0);
 	}
 	if (getlckret != 0 && getlckret != -1)
 		reterr = getlckret;
 
 	if (filestruct_locked != 0) {
 		LIST_INIT(&lfp->lf_rollback);
 		if ((new_stp->ls_flags & NFSLCK_LOCK)) {
 			/*
 			 * For local locking, do the advisory locking now, so
 			 * that any conflict can be detected. A failure later
 			 * can be rolled back locally. If an error is returned,
 			 * struct nfslockfile has been unlocked and any local
 			 * locking rolled back.
 			 */
 			NFSUNLOCKSTATE();
+			if (vnode_unlocked == 0) {
+				ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl1");
+				vnode_unlocked = 1;
+				NFSVOPUNLOCK(vp, 0);
+			}
 			reterr = nfsrv_locallock(vp, lfp,
 			    (new_lop->lo_flags & (NFSLCK_READ | NFSLCK_WRITE)),
 			    new_lop->lo_first, new_lop->lo_end, cfp, p);
 			NFSLOCKSTATE();
 		}
 	}
 
 	if (specialid == 0) {
 	    if (new_stp->ls_flags & NFSLCK_TEST) {
 		/*
 		 * RFC 3530 does not list LockT as an op that renews a
 		 * lease, but the concensus seems to be that it is ok
 		 * for a server to do so.
 		 */
 		error = nfsrv_getclient(clientid, CLOPS_RENEW, &clp, NULL,
 		    (nfsquad_t)((u_quad_t)0), 0, nd, p);
 
 		/*
 		 * Since NFSERR_EXPIRED, NFSERR_ADMINREVOKED are not valid
 		 * error returns for LockT, just go ahead and test for a lock,
 		 * since there are no locks for this client, but other locks
 		 * can conflict. (ie. same client will always be false)
 		 */
 		if (error == NFSERR_EXPIRED || error == NFSERR_ADMINREVOKED)
 		    error = 0;
 		lckstp = new_stp;
 	    } else {
 	      error = nfsrv_getclient(clientid, CLOPS_RENEW, &clp, NULL,
 		(nfsquad_t)((u_quad_t)0), 0, nd, p);
 	      if (error == 0)
 		/*
 		 * Look up the stateid
 		 */
 		error = nfsrv_getstate(clp, &new_stp->ls_stateid,
 		  new_stp->ls_flags, &stp);
 	      /*
 	       * do some sanity checks for an unconfirmed open or a
 	       * stateid that refers to the wrong file, for an open stateid
 	       */
 	      if (error == 0 && (stp->ls_flags & NFSLCK_OPEN) &&
 		  ((stp->ls_openowner->ls_flags & NFSLCK_NEEDSCONFIRM) ||
 		   (getlckret == 0 && stp->ls_lfp != lfp))){
 		      /*
 		       * NFSLCK_SETATTR should return OK rather than NFSERR_BADSTATEID
 		       * The only exception is using SETATTR with SIZE.
 		       * */
                     if ((new_stp->ls_flags &
                          (NFSLCK_SETATTR | NFSLCK_CHECK)) != NFSLCK_SETATTR)
 			     error = NFSERR_BADSTATEID;
 	      }
 	      
 		if (error == 0 &&
 		  (stp->ls_flags & (NFSLCK_DELEGREAD | NFSLCK_DELEGWRITE)) &&
 		  getlckret == 0 && stp->ls_lfp != lfp)
 			error = NFSERR_BADSTATEID;
 
 	      /*
 	       * If the lockowner stateid doesn't refer to the same file,
 	       * I believe that is considered ok, since some clients will
 	       * only create a single lockowner and use that for all locks
 	       * on all files.
 	       * For now, log it as a diagnostic, instead of considering it
 	       * a BadStateid.
 	       */
 	      if (error == 0 && (stp->ls_flags &
 		  (NFSLCK_OPEN | NFSLCK_DELEGREAD | NFSLCK_DELEGWRITE)) == 0 &&
 		  getlckret == 0 && stp->ls_lfp != lfp) {
 #ifdef DIAGNOSTIC
 		  printf("Got a lock statid for different file open\n");
 #endif
 		  /*
 		  error = NFSERR_BADSTATEID;
 		  */
 	      }
 
 	      if (error == 0) {
 		    if (new_stp->ls_flags & NFSLCK_OPENTOLOCK) {
 			/*
 			 * If haslock set, we've already checked the seqid.
 			 */
 			if (!haslock) {
 			    if (stp->ls_flags & NFSLCK_OPEN)
 				error = nfsrv_checkseqid(nd, new_stp->ls_seq,
 				    stp->ls_openowner, new_stp->ls_op);
 			    else
 				error = NFSERR_BADSTATEID;
 			}
 			if (!error)
 			    nfsrv_getowner(&stp->ls_open, new_stp, &lckstp);
 			if (lckstp)
 			    /*
 			     * I believe this should be an error, but it
 			     * isn't obvious what NFSERR_xxx would be
 			     * appropriate, so I'll use NFSERR_INVAL for now.
 			     */
 			    error = NFSERR_INVAL;
 			else
 			    lckstp = new_stp;
 		    } else if (new_stp->ls_flags&(NFSLCK_LOCK|NFSLCK_UNLOCK)) {
 			/*
 			 * If haslock set, ditto above.
 			 */
 			if (!haslock) {
 			    if (stp->ls_flags & NFSLCK_OPEN)
 				error = NFSERR_BADSTATEID;
 			    else
 				error = nfsrv_checkseqid(nd, new_stp->ls_seq,
 				    stp, new_stp->ls_op);
 			}
 			lckstp = stp;
 		    } else {
 			lckstp = stp;
 		    }
 	      }
 	      /*
 	       * If the seqid part of the stateid isn't the same, return
 	       * NFSERR_OLDSTATEID for cases other than I/O Ops.
 	       * For I/O Ops, only return NFSERR_OLDSTATEID if
 	       * nfsrv_returnoldstateid is set. (The concensus on the email
 	       * list was that most clients would prefer to not receive
 	       * NFSERR_OLDSTATEID for I/O Ops, but the RFC suggests that that
 	       * is what will happen, so I use the nfsrv_returnoldstateid to
 	       * allow for either server configuration.)
 	       */
 	      if (!error && stp->ls_stateid.seqid!=new_stp->ls_stateid.seqid &&
 		  (((nd->nd_flag & ND_NFSV41) == 0 &&
 		   (!(new_stp->ls_flags & NFSLCK_CHECK) ||
 		    nfsrv_returnoldstateid)) ||
 		   ((nd->nd_flag & ND_NFSV41) != 0 &&
 		    new_stp->ls_stateid.seqid != 0)))
 		    error = NFSERR_OLDSTATEID;
 	    }
 	}
 
 	/*
 	 * Now we can check for grace.
 	 */
 	if (!error)
 		error = nfsrv_checkgrace(nd, clp, new_stp->ls_flags);
 	if ((new_stp->ls_flags & NFSLCK_RECLAIM) && !error &&
 		nfsrv_checkstable(clp))
 		error = NFSERR_NOGRACE;
 	/*
 	 * If we successfully Reclaimed state, note that.
 	 */
 	if ((new_stp->ls_flags & NFSLCK_RECLAIM) && !error)
 		nfsrv_markstable(clp);
 
 	/*
 	 * At this point, either error == NFSERR_BADSTATEID or the
 	 * seqid# has been updated, so we can return any error.
 	 * If error == 0, there may be an error in:
 	 *    nd_repstat - Set by the calling function.
 	 *    reterr - Set above, if getting the nfslockfile structure
 	 *       or acquiring the local lock failed.
 	 *    (If both of these are set, nd_repstat should probably be
 	 *     returned, since that error was detected before this
 	 *     function call.)
 	 */
 	if (error != 0 || nd->nd_repstat != 0 || reterr != 0) {
 		if (error == 0) {
 			if (nd->nd_repstat != 0)
 				error = nd->nd_repstat;
 			else
 				error = reterr;
 		}
 		if (filestruct_locked != 0) {
 			/* Roll back local locks. */
 			NFSUNLOCKSTATE();
+			if (vnode_unlocked == 0) {
+				ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl2");
+				vnode_unlocked = 1;
+				NFSVOPUNLOCK(vp, 0);
+			}
 			nfsrv_locallock_rollback(vp, lfp, p);
 			NFSLOCKSTATE();
 			nfsrv_unlocklf(lfp);
 		}
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 
 	/*
 	 * Check the nfsrv_getlockfile return.
 	 * Returned -1 if no structure found.
 	 */
 	if (getlckret == -1) {
 		error = NFSERR_EXPIRED;
 		/*
 		 * Called from lockt, so no lock is OK.
 		 */
 		if (new_stp->ls_flags & NFSLCK_TEST) {
 			error = 0;
 		} else if (new_stp->ls_flags &
 		    (NFSLCK_CHECK | NFSLCK_SETATTR)) {
 			/*
 			 * Called to check for a lock, OK if the stateid is all
 			 * 1s or all 0s, but there should be an nfsstate
 			 * otherwise.
 			 * (ie. If there is no open, I'll assume no share
 			 *  deny bits.)
 			 */
 			if (specialid)
 				error = 0;
 			else
 				error = NFSERR_BADSTATEID;
 		}
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 
 	/*
 	 * For NFSLCK_CHECK and NFSLCK_LOCK, test for a share conflict.
 	 * For NFSLCK_CHECK, allow a read if write access is granted,
 	 * but check for a deny. For NFSLCK_LOCK, require correct access,
 	 * which implies a conflicting deny can't exist.
 	 */
 	if (new_stp->ls_flags & (NFSLCK_CHECK | NFSLCK_LOCK)) {
 	    /*
 	     * Four kinds of state id:
 	     * - specialid (all 0s or all 1s), only for NFSLCK_CHECK
 	     * - stateid for an open
 	     * - stateid for a delegation
 	     * - stateid for a lock owner
 	     */
 	    if (!specialid) {
 		if (stp->ls_flags & (NFSLCK_DELEGREAD | NFSLCK_DELEGWRITE)) {
 		    delegation = 1;
 		    mystp = stp;
 		    nfsrv_delaydelegtimeout(stp);
 	        } else if (stp->ls_flags & NFSLCK_OPEN) {
 		    mystp = stp;
 		} else {
 		    mystp = stp->ls_openstp;
 		}
 		/*
 		 * If locking or checking, require correct access
 		 * bit set.
 		 */
 		if (((new_stp->ls_flags & NFSLCK_LOCK) &&
 		     !((new_lop->lo_flags >> NFSLCK_LOCKSHIFT) &
 		       mystp->ls_flags & NFSLCK_ACCESSBITS)) ||
 		    ((new_stp->ls_flags & (NFSLCK_CHECK|NFSLCK_READACCESS)) ==
 		      (NFSLCK_CHECK | NFSLCK_READACCESS) &&
 		     !(mystp->ls_flags & NFSLCK_READACCESS)) ||
 		    ((new_stp->ls_flags & (NFSLCK_CHECK|NFSLCK_WRITEACCESS)) ==
 		      (NFSLCK_CHECK | NFSLCK_WRITEACCESS) &&
 		     !(mystp->ls_flags & NFSLCK_WRITEACCESS))) {
 			if (filestruct_locked != 0) {
 				/* Roll back local locks. */
 				NFSUNLOCKSTATE();
+				if (vnode_unlocked == 0) {
+					ASSERT_VOP_ELOCKED(vp,
+					    "nfsrv_lockctrl3");
+					vnode_unlocked = 1;
+					NFSVOPUNLOCK(vp, 0);
+				}
 				nfsrv_locallock_rollback(vp, lfp, p);
 				NFSLOCKSTATE();
 				nfsrv_unlocklf(lfp);
 			}
 			NFSUNLOCKSTATE();
 			error = NFSERR_OPENMODE;
 			goto out;
 		}
 	    } else
 		mystp = NULL;
 	    if ((new_stp->ls_flags & NFSLCK_CHECK) && !delegation) {
 		/*
 		 * Check for a conflicting deny bit.
 		 */
 		LIST_FOREACH(tstp, &lfp->lf_open, ls_file) {
 		    if (tstp != mystp) {
 			bits = tstp->ls_flags;
 			bits >>= NFSLCK_SHIFT;
 			if (new_stp->ls_flags & bits & NFSLCK_ACCESSBITS) {
+			    KASSERT(vnode_unlocked == 0,
+				("nfsrv_lockctrl: vnode unlocked1"));
 			    ret = nfsrv_clientconflict(tstp->ls_clp, &haslock,
 				vp, p);
 			    if (ret == 1) {
 				/*
 				* nfsrv_clientconflict unlocks state
 				 * when it returns non-zero.
 				 */
 				lckstp = NULL;
 				goto tryagain;
 			    }
 			    if (ret == 0)
 				NFSUNLOCKSTATE();
 			    if (ret == 2)
 				error = NFSERR_PERM;
 			    else
 				error = NFSERR_OPENMODE;
 			    goto out;
 			}
 		    }
 		}
 
 		/* We're outta here */
 		NFSUNLOCKSTATE();
 		goto out;
 	    }
 	}
 
 	/*
 	 * For setattr, just get rid of all the Delegations for other clients.
 	 */
 	if (new_stp->ls_flags & NFSLCK_SETATTR) {
+		KASSERT(vnode_unlocked == 0,
+		    ("nfsrv_lockctrl: vnode unlocked2"));
 		ret = nfsrv_cleandeleg(vp, lfp, clp, &haslock, p);
 		if (ret) {
 			/*
 			 * nfsrv_cleandeleg() unlocks state when it
 			 * returns non-zero.
 			 */
 			if (ret == -1) {
 				lckstp = NULL;
 				goto tryagain;
 			}
 			error = ret;
 			goto out;
 		}
 		if (!(new_stp->ls_flags & NFSLCK_CHECK) ||
 		    (LIST_EMPTY(&lfp->lf_open) && LIST_EMPTY(&lfp->lf_lock) &&
 		     LIST_EMPTY(&lfp->lf_deleg))) {
 			NFSUNLOCKSTATE();
 			goto out;
 		}
 	}
 
 	/*
 	 * Check for a conflicting delegation. If one is found, call
 	 * nfsrv_delegconflict() to handle it. If the v4root lock hasn't
 	 * been set yet, it will get the lock. Otherwise, it will recall
 	 * the delegation. Then, we try try again...
 	 * I currently believe the conflict algorithm to be:
 	 * For Lock Ops (Lock/LockT/LockU)
 	 * - there is a conflict iff a different client has a write delegation
 	 * For Reading (Read Op)
 	 * - there is a conflict iff a different client has a write delegation
 	 *   (the specialids are always a different client)
 	 * For Writing (Write/Setattr of size)
 	 * - there is a conflict if a different client has any delegation
 	 * - there is a conflict if the same client has a read delegation
 	 *   (I don't understand why this isn't allowed, but that seems to be
 	 *    the current concensus?)
 	 */
 	tstp = LIST_FIRST(&lfp->lf_deleg);
 	while (tstp != LIST_END(&lfp->lf_deleg)) {
 	    nstp = LIST_NEXT(tstp, ls_file);
 	    if ((((new_stp->ls_flags&(NFSLCK_LOCK|NFSLCK_UNLOCK|NFSLCK_TEST))||
 		 ((new_stp->ls_flags & NFSLCK_CHECK) &&
 		  (new_lop->lo_flags & NFSLCK_READ))) &&
 		  clp != tstp->ls_clp &&
 		 (tstp->ls_flags & NFSLCK_DELEGWRITE)) ||
 		 ((new_stp->ls_flags & NFSLCK_CHECK) &&
 		   (new_lop->lo_flags & NFSLCK_WRITE) &&
 		  (clp != tstp->ls_clp ||
 		   (tstp->ls_flags & NFSLCK_DELEGREAD)))) {
+		ret = 0;
 		if (filestruct_locked != 0) {
 			/* Roll back local locks. */
 			NFSUNLOCKSTATE();
+			if (vnode_unlocked == 0) {
+				ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl4");
+				NFSVOPUNLOCK(vp, 0);
+			}
 			nfsrv_locallock_rollback(vp, lfp, p);
 			NFSLOCKSTATE();
 			nfsrv_unlocklf(lfp);
+			NFSUNLOCKSTATE();
+			NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
+			vnode_unlocked = 0;
+			if ((vp->v_iflag & VI_DOOMED) != 0)
+				ret = NFSERR_SERVERFAULT;
+			NFSLOCKSTATE();
 		}
-		ret = nfsrv_delegconflict(tstp, &haslock, p, vp);
+		if (ret == 0)
+			ret = nfsrv_delegconflict(tstp, &haslock, p, vp);
 		if (ret) {
 		    /*
 		     * nfsrv_delegconflict unlocks state when it
 		     * returns non-zero, which it always does.
 		     */
 		    if (other_lop) {
 			FREE((caddr_t)other_lop, M_NFSDLOCK);
 			other_lop = NULL;
 		    }
 		    if (ret == -1) {
 			lckstp = NULL;
 			goto tryagain;
 		    }
 		    error = ret;
 		    goto out;
 		}
 		/* Never gets here. */
 	    }
 	    tstp = nstp;
 	}
 
 	/*
 	 * Handle the unlock case by calling nfsrv_updatelock().
 	 * (Should I have done some access checking above for unlock? For now,
 	 *  just let it happen.)
 	 */
 	if (new_stp->ls_flags & NFSLCK_UNLOCK) {
 		first = new_lop->lo_first;
 		end = new_lop->lo_end;
 		nfsrv_updatelock(stp, new_lopp, &other_lop, lfp);
 		stateidp->seqid = ++(stp->ls_stateid.seqid);
 		if ((nd->nd_flag & ND_NFSV41) != 0 && stateidp->seqid == 0)
 			stateidp->seqid = stp->ls_stateid.seqid = 1;
 		stateidp->other[0] = stp->ls_stateid.other[0];
 		stateidp->other[1] = stp->ls_stateid.other[1];
 		stateidp->other[2] = stp->ls_stateid.other[2];
 		if (filestruct_locked != 0) {
 			NFSUNLOCKSTATE();
+			if (vnode_unlocked == 0) {
+				ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl5");
+				vnode_unlocked = 1;
+				NFSVOPUNLOCK(vp, 0);
+			}
 			/* Update the local locks. */
 			nfsrv_localunlock(vp, lfp, first, end, p);
 			NFSLOCKSTATE();
 			nfsrv_unlocklf(lfp);
 		}
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 
 	/*
 	 * Search for a conflicting lock. A lock conflicts if:
 	 * - the lock range overlaps and
 	 * - at least one lock is a write lock and
 	 * - it is not owned by the same lock owner
 	 */
 	if (!delegation) {
 	  LIST_FOREACH(lop, &lfp->lf_lock, lo_lckfile) {
 	    if (new_lop->lo_end > lop->lo_first &&
 		new_lop->lo_first < lop->lo_end &&
 		(new_lop->lo_flags == NFSLCK_WRITE ||
 		 lop->lo_flags == NFSLCK_WRITE) &&
 		lckstp != lop->lo_stp &&
 		(clp != lop->lo_stp->ls_clp ||
 		 lckstp->ls_ownerlen != lop->lo_stp->ls_ownerlen ||
 		 NFSBCMP(lckstp->ls_owner, lop->lo_stp->ls_owner,
 		    lckstp->ls_ownerlen))) {
 		if (other_lop) {
 		    FREE((caddr_t)other_lop, M_NFSDLOCK);
 		    other_lop = NULL;
 		}
-		ret = nfsrv_clientconflict(lop->lo_stp->ls_clp,&haslock,vp,p);
+		if (vnode_unlocked != 0)
+		    ret = nfsrv_clientconflict(lop->lo_stp->ls_clp, &haslock,
+			NULL, p);
+		else
+		    ret = nfsrv_clientconflict(lop->lo_stp->ls_clp, &haslock,
+			vp, p);
 		if (ret == 1) {
 		    if (filestruct_locked != 0) {
+			if (vnode_unlocked == 0) {
+				ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl6");
+				NFSVOPUNLOCK(vp, 0);
+			}
 			/* Roll back local locks. */
 			nfsrv_locallock_rollback(vp, lfp, p);
 			NFSLOCKSTATE();
 			nfsrv_unlocklf(lfp);
 			NFSUNLOCKSTATE();
+			NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
+			vnode_unlocked = 0;
+			if ((vp->v_iflag & VI_DOOMED) != 0) {
+				error = NFSERR_SERVERFAULT;
+				goto out;
+			}
 		    }
 		    /*
 		     * nfsrv_clientconflict() unlocks state when it
 		     * returns non-zero.
 		     */
 		    lckstp = NULL;
 		    goto tryagain;
 		}
 		/*
 		 * Found a conflicting lock, so record the conflict and
 		 * return the error.
 		 */
 		if (cfp != NULL && ret == 0) {
 		    cfp->cl_clientid.lval[0]=lop->lo_stp->ls_stateid.other[0];
 		    cfp->cl_clientid.lval[1]=lop->lo_stp->ls_stateid.other[1];
 		    cfp->cl_first = lop->lo_first;
 		    cfp->cl_end = lop->lo_end;
 		    cfp->cl_flags = lop->lo_flags;
 		    cfp->cl_ownerlen = lop->lo_stp->ls_ownerlen;
 		    NFSBCOPY(lop->lo_stp->ls_owner, cfp->cl_owner,
 			cfp->cl_ownerlen);
 		}
 		if (ret == 2)
 		    error = NFSERR_PERM;
 		else if (new_stp->ls_flags & NFSLCK_RECLAIM)
 		    error = NFSERR_RECLAIMCONFLICT;
 		else if (new_stp->ls_flags & NFSLCK_CHECK)
 		    error = NFSERR_LOCKED;
 		else
 		    error = NFSERR_DENIED;
 		if (filestruct_locked != 0 && ret == 0) {
 			/* Roll back local locks. */
 			NFSUNLOCKSTATE();
+			if (vnode_unlocked == 0) {
+				ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl7");
+				vnode_unlocked = 1;
+				NFSVOPUNLOCK(vp, 0);
+			}
 			nfsrv_locallock_rollback(vp, lfp, p);
 			NFSLOCKSTATE();
 			nfsrv_unlocklf(lfp);
 		}
 		if (ret == 0)
 			NFSUNLOCKSTATE();
 		goto out;
 	    }
 	  }
 	}
 
 	/*
 	 * We only get here if there was no lock that conflicted.
 	 */
 	if (new_stp->ls_flags & (NFSLCK_TEST | NFSLCK_CHECK)) {
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 
 	/*
 	 * We only get here when we are creating or modifying a lock.
 	 * There are two variants:
 	 * - exist_lock_owner where lock_owner exists
 	 * - open_to_lock_owner with new lock_owner
 	 */
 	first = new_lop->lo_first;
 	end = new_lop->lo_end;
 	lock_flags = new_lop->lo_flags;
 	if (!(new_stp->ls_flags & NFSLCK_OPENTOLOCK)) {
 		nfsrv_updatelock(lckstp, new_lopp, &other_lop, lfp);
 		stateidp->seqid = ++(lckstp->ls_stateid.seqid);
 		if ((nd->nd_flag & ND_NFSV41) != 0 && stateidp->seqid == 0)
 			stateidp->seqid = lckstp->ls_stateid.seqid = 1;
 		stateidp->other[0] = lckstp->ls_stateid.other[0];
 		stateidp->other[1] = lckstp->ls_stateid.other[1];
 		stateidp->other[2] = lckstp->ls_stateid.other[2];
 	} else {
 		/*
 		 * The new open_to_lock_owner case.
 		 * Link the new nfsstate into the lists.
 		 */
 		new_stp->ls_seq = new_stp->ls_opentolockseq;
 		nfsrvd_refcache(new_stp->ls_op);
 		stateidp->seqid = new_stp->ls_stateid.seqid = 1;
 		stateidp->other[0] = new_stp->ls_stateid.other[0] =
 		    clp->lc_clientid.lval[0];
 		stateidp->other[1] = new_stp->ls_stateid.other[1] =
 		    clp->lc_clientid.lval[1];
 		stateidp->other[2] = new_stp->ls_stateid.other[2] =
 		    nfsrv_nextstateindex(clp);
 		new_stp->ls_clp = clp;
 		LIST_INIT(&new_stp->ls_lock);
 		new_stp->ls_openstp = stp;
 		new_stp->ls_lfp = lfp;
 		nfsrv_insertlock(new_lop, (struct nfslock *)new_stp, new_stp,
 		    lfp);
 		LIST_INSERT_HEAD(NFSSTATEHASH(clp, new_stp->ls_stateid),
 		    new_stp, ls_hash);
 		LIST_INSERT_HEAD(&stp->ls_open, new_stp, ls_list);
 		*new_lopp = NULL;
 		*new_stpp = NULL;
 		newnfsstats.srvlockowners++;
 		nfsrv_openpluslock++;
 	}
 	if (filestruct_locked != 0) {
 		NFSUNLOCKSTATE();
 		nfsrv_locallock_commit(lfp, lock_flags, first, end);
 		NFSLOCKSTATE();
 		nfsrv_unlocklf(lfp);
 	}
 	NFSUNLOCKSTATE();
 
 out:
 	if (haslock) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 	}
+	if (vnode_unlocked != 0) {
+		NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
+		if (error == 0 && (vp->v_iflag & VI_DOOMED) != 0)
+			error = NFSERR_SERVERFAULT;
+	}
 	if (other_lop)
 		FREE((caddr_t)other_lop, M_NFSDLOCK);
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Check for state errors for Open.
  * repstat is passed back out as an error if more critical errors
  * are not detected.
  */
 APPLESTATIC int
 nfsrv_opencheck(nfsquad_t clientid, nfsv4stateid_t *stateidp,
     struct nfsstate *new_stp, vnode_t vp, struct nfsrv_descript *nd,
     NFSPROC_T *p, int repstat)
 {
 	struct nfsstate *stp, *nstp;
 	struct nfsclient *clp;
 	struct nfsstate *ownerstp;
 	struct nfslockfile *lfp, *new_lfp;
 	int error = 0, haslock = 0, ret, readonly = 0, getfhret = 0;
 
 	if ((new_stp->ls_flags & NFSLCK_SHAREBITS) == NFSLCK_READACCESS)
 		readonly = 1;
 	/*
 	 * Check for restart conditions (client and server).
 	 */
 	error = nfsrv_checkrestart(clientid, new_stp->ls_flags,
 		&new_stp->ls_stateid, 0);
 	if (error)
 		goto out;
 
 	/*
 	 * Check for state resource limit exceeded.
 	 * Technically this should be SMP protected, but the worst
 	 * case error is "out by one or two" on the count when it
 	 * returns NFSERR_RESOURCE and the limit is just a rather
 	 * arbitrary high water mark, so no harm is done.
 	 */
 	if (nfsrv_openpluslock > NFSRV_V4STATELIMIT) {
 		error = NFSERR_RESOURCE;
 		goto out;
 	}
 
 tryagain:
 	MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile),
 	    M_NFSDLOCKFILE, M_WAITOK);
 	if (vp)
 		getfhret = nfsrv_getlockfh(vp, new_stp->ls_flags, new_lfp,
 		    NULL, p);
 	NFSLOCKSTATE();
 	/*
 	 * Get the nfsclient structure.
 	 */
 	error = nfsrv_getclient(clientid, CLOPS_RENEW, &clp, NULL,
 	    (nfsquad_t)((u_quad_t)0), 0, nd, p);
 
 	/*
 	 * Look up the open owner. See if it needs confirmation and
 	 * check the seq#, as required.
 	 */
 	if (!error)
 		nfsrv_getowner(&clp->lc_open, new_stp, &ownerstp);
 
 	if (!error && ownerstp) {
 		error = nfsrv_checkseqid(nd, new_stp->ls_seq, ownerstp,
 		    new_stp->ls_op);
 		/*
 		 * If the OpenOwner hasn't been confirmed, assume the
 		 * old one was a replay and this one is ok.
 		 * See: RFC3530 Sec. 14.2.18.
 		 */
 		if (error == NFSERR_BADSEQID &&
 		    (ownerstp->ls_flags & NFSLCK_NEEDSCONFIRM))
 			error = 0;
 	}
 
 	/*
 	 * Check for grace.
 	 */
 	if (!error)
 		error = nfsrv_checkgrace(nd, clp, new_stp->ls_flags);
 	if ((new_stp->ls_flags & NFSLCK_RECLAIM) && !error &&
 		nfsrv_checkstable(clp))
 		error = NFSERR_NOGRACE;
 
 	/*
 	 * If none of the above errors occurred, let repstat be
 	 * returned.
 	 */
 	if (repstat && !error)
 		error = repstat;
 	if (error) {
 		NFSUNLOCKSTATE();
 		if (haslock) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		free((caddr_t)new_lfp, M_NFSDLOCKFILE);
 		goto out;
 	}
 
 	/*
 	 * If vp == NULL, the file doesn't exist yet, so return ok.
 	 * (This always happens on the first pass, so haslock must be 0.)
 	 */
 	if (vp == NULL) {
 		NFSUNLOCKSTATE();
 		FREE((caddr_t)new_lfp, M_NFSDLOCKFILE);
 		goto out;
 	}
 
 	/*
 	 * Get the structure for the underlying file.
 	 */
 	if (getfhret)
 		error = getfhret;
 	else
 		error = nfsrv_getlockfile(new_stp->ls_flags, &new_lfp, &lfp,
 		    NULL, 0);
 	if (new_lfp)
 		FREE((caddr_t)new_lfp, M_NFSDLOCKFILE);
 	if (error) {
 		NFSUNLOCKSTATE();
 		if (haslock) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		goto out;
 	}
 
 	/*
 	 * Search for a conflicting open/share.
 	 */
 	if (new_stp->ls_flags & NFSLCK_DELEGCUR) {
 	    /*
 	     * For Delegate_Cur, search for the matching Delegation,
 	     * which indicates no conflict.
 	     * An old delegation should have been recovered by the
 	     * client doing a Claim_DELEGATE_Prev, so I won't let
 	     * it match and return NFSERR_EXPIRED. Should I let it
 	     * match?
 	     */
 	    LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
 		if (!(stp->ls_flags & NFSLCK_OLDDELEG) &&
 		    (((nd->nd_flag & ND_NFSV41) != 0 &&
 		    stateidp->seqid == 0) ||
 		    stateidp->seqid == stp->ls_stateid.seqid) &&
 		    !NFSBCMP(stateidp->other, stp->ls_stateid.other,
 			  NFSX_STATEIDOTHER))
 			break;
 	    }
 	    if (stp == LIST_END(&lfp->lf_deleg) ||
 		((new_stp->ls_flags & NFSLCK_WRITEACCESS) &&
 		 (stp->ls_flags & NFSLCK_DELEGREAD))) {
 		NFSUNLOCKSTATE();
 		if (haslock) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		error = NFSERR_EXPIRED;
 		goto out;
 	    }
 	}
 
 	/*
 	 * Check for access/deny bit conflicts. I check for the same
 	 * owner as well, in case the client didn't bother.
 	 */
 	LIST_FOREACH(stp, &lfp->lf_open, ls_file) {
 		if (!(new_stp->ls_flags & NFSLCK_DELEGCUR) &&
 		    (((new_stp->ls_flags & NFSLCK_ACCESSBITS) &
 		      ((stp->ls_flags>>NFSLCK_SHIFT) & NFSLCK_ACCESSBITS))||
 		     ((stp->ls_flags & NFSLCK_ACCESSBITS) &
 		      ((new_stp->ls_flags>>NFSLCK_SHIFT)&NFSLCK_ACCESSBITS)))){
 			ret = nfsrv_clientconflict(stp->ls_clp,&haslock,vp,p);
 			if (ret == 1) {
 				/*
 				 * nfsrv_clientconflict() unlocks
 				 * state when it returns non-zero.
 				 */
 				goto tryagain;
 			}
 			if (ret == 2)
 				error = NFSERR_PERM;
 			else if (new_stp->ls_flags & NFSLCK_RECLAIM)
 				error = NFSERR_RECLAIMCONFLICT;
 			else
 				error = NFSERR_SHAREDENIED;
 			if (ret == 0)
 				NFSUNLOCKSTATE();
 			if (haslock) {
 				NFSLOCKV4ROOTMUTEX();
 				nfsv4_unlock(&nfsv4rootfs_lock, 1);
 				NFSUNLOCKV4ROOTMUTEX();
 			}
 			goto out;
 		}
 	}
 
 	/*
 	 * Check for a conflicting delegation. If one is found, call
 	 * nfsrv_delegconflict() to handle it. If the v4root lock hasn't
 	 * been set yet, it will get the lock. Otherwise, it will recall
 	 * the delegation. Then, we try try again...
 	 * (If NFSLCK_DELEGCUR is set, it has a delegation, so there
 	 *  isn't a conflict.)
 	 * I currently believe the conflict algorithm to be:
 	 * For Open with Read Access and Deny None
 	 * - there is a conflict iff a different client has a write delegation
 	 * For Open with other Write Access or any Deny except None
 	 * - there is a conflict if a different client has any delegation
 	 * - there is a conflict if the same client has a read delegation
 	 *   (The current concensus is that this last case should be
 	 *    considered a conflict since the client with a read delegation
 	 *    could have done an Open with ReadAccess and WriteDeny
 	 *    locally and then not have checked for the WriteDeny.)
 	 * Don't check for a Reclaim, since that will be dealt with
 	 * by nfsrv_openctrl().
 	 */
 	if (!(new_stp->ls_flags &
 		(NFSLCK_DELEGPREV | NFSLCK_DELEGCUR | NFSLCK_RECLAIM))) {
 	    stp = LIST_FIRST(&lfp->lf_deleg);
 	    while (stp != LIST_END(&lfp->lf_deleg)) {
 		nstp = LIST_NEXT(stp, ls_file);
 		if ((readonly && stp->ls_clp != clp &&
 		       (stp->ls_flags & NFSLCK_DELEGWRITE)) ||
 		    (!readonly && (stp->ls_clp != clp ||
 		         (stp->ls_flags & NFSLCK_DELEGREAD)))) {
 			ret = nfsrv_delegconflict(stp, &haslock, p, vp);
 			if (ret) {
 			    /*
 			     * nfsrv_delegconflict() unlocks state
 			     * when it returns non-zero.
 			     */
 			    if (ret == -1)
 				goto tryagain;
 			    error = ret;
 			    goto out;
 			}
 		}
 		stp = nstp;
 	    }
 	}
 	NFSUNLOCKSTATE();
 	if (haslock) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 	}
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Open control function to create/update open state for an open.
  */
 APPLESTATIC int
 nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp,
     struct nfsstate **new_stpp, nfsquad_t clientid, nfsv4stateid_t *stateidp,
     nfsv4stateid_t *delegstateidp, u_int32_t *rflagsp, struct nfsexstuff *exp,
     NFSPROC_T *p, u_quad_t filerev)
 {
 	struct nfsstate *new_stp = *new_stpp;
 	struct nfsstate *stp, *nstp;
 	struct nfsstate *openstp = NULL, *new_open, *ownerstp, *new_deleg;
 	struct nfslockfile *lfp, *new_lfp;
 	struct nfsclient *clp;
 	int error = 0, haslock = 0, ret, delegate = 1, writedeleg = 1;
 	int readonly = 0, cbret = 1, getfhret = 0;
 
 	if ((new_stp->ls_flags & NFSLCK_SHAREBITS) == NFSLCK_READACCESS)
 		readonly = 1;
 	/*
 	 * Check for restart conditions (client and server).
 	 * (Paranoia, should have been detected by nfsrv_opencheck().)
 	 * If an error does show up, return NFSERR_EXPIRED, since the
 	 * the seqid# has already been incremented.
 	 */
 	error = nfsrv_checkrestart(clientid, new_stp->ls_flags,
 	    &new_stp->ls_stateid, 0);
 	if (error) {
 		printf("Nfsd: openctrl unexpected restart err=%d\n",
 		    error);
 		error = NFSERR_EXPIRED;
 		goto out;
 	}
 
 tryagain:
 	MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile),
 	    M_NFSDLOCKFILE, M_WAITOK);
 	MALLOC(new_open, struct nfsstate *, sizeof (struct nfsstate),
 	    M_NFSDSTATE, M_WAITOK);
 	MALLOC(new_deleg, struct nfsstate *, sizeof (struct nfsstate),
 	    M_NFSDSTATE, M_WAITOK);
 	getfhret = nfsrv_getlockfh(vp, new_stp->ls_flags, new_lfp,
 	    NULL, p);
 	NFSLOCKSTATE();
 	/*
 	 * Get the client structure. Since the linked lists could be changed
 	 * by other nfsd processes if this process does a tsleep(), one of
 	 * two things must be done.
 	 * 1 - don't tsleep()
 	 * or
 	 * 2 - get the nfsv4_lock() { indicated by haslock == 1 }
 	 *     before using the lists, since this lock stops the other
 	 *     nfsd. This should only be used for rare cases, since it
 	 *     essentially single threads the nfsd.
 	 *     At this time, it is only done for cases where the stable
 	 *     storage file must be written prior to completion of state
 	 *     expiration.
 	 */
 	error = nfsrv_getclient(clientid, CLOPS_RENEW, &clp, NULL,
 	    (nfsquad_t)((u_quad_t)0), 0, nd, p);
 	if (!error && (clp->lc_flags & LCL_NEEDSCBNULL) &&
 	    clp->lc_program) {
 		/*
 		 * This happens on the first open for a client
 		 * that supports callbacks.
 		 */
 		NFSUNLOCKSTATE();
 		/*
 		 * Although nfsrv_docallback() will sleep, clp won't
 		 * go away, since they are only removed when the
 		 * nfsv4_lock() has blocked the nfsd threads. The
 		 * fields in clp can change, but having multiple
 		 * threads do this Null callback RPC should be
 		 * harmless.
 		 */
 		cbret = nfsrv_docallback(clp, NFSV4PROC_CBNULL,
 		    NULL, 0, NULL, NULL, NULL, p);
 		NFSLOCKSTATE();
 		clp->lc_flags &= ~LCL_NEEDSCBNULL;
 		if (!cbret)
 			clp->lc_flags |= LCL_CALLBACKSON;
 	}
 
 	/*
 	 * Look up the open owner. See if it needs confirmation and
 	 * check the seq#, as required.
 	 */
 	if (!error)
 		nfsrv_getowner(&clp->lc_open, new_stp, &ownerstp);
 
 	if (error) {
 		NFSUNLOCKSTATE();
 		printf("Nfsd: openctrl unexpected state err=%d\n",
 			error);
 		free((caddr_t)new_lfp, M_NFSDLOCKFILE);
 		free((caddr_t)new_open, M_NFSDSTATE);
 		free((caddr_t)new_deleg, M_NFSDSTATE);
 		if (haslock) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		error = NFSERR_EXPIRED;
 		goto out;
 	}
 
 	if (new_stp->ls_flags & NFSLCK_RECLAIM)
 		nfsrv_markstable(clp);
 
 	/*
 	 * Get the structure for the underlying file.
 	 */
 	if (getfhret)
 		error = getfhret;
 	else
 		error = nfsrv_getlockfile(new_stp->ls_flags, &new_lfp, &lfp,
 		    NULL, 0);
 	if (new_lfp)
 		FREE((caddr_t)new_lfp, M_NFSDLOCKFILE);
 	if (error) {
 		NFSUNLOCKSTATE();
 		printf("Nfsd openctrl unexpected getlockfile err=%d\n",
 		    error);
 		free((caddr_t)new_open, M_NFSDSTATE);
 		free((caddr_t)new_deleg, M_NFSDSTATE);
 		if (haslock) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		goto out;
 	}
 
 	/*
 	 * Search for a conflicting open/share.
 	 */
 	if (new_stp->ls_flags & NFSLCK_DELEGCUR) {
 	    /*
 	     * For Delegate_Cur, search for the matching Delegation,
 	     * which indicates no conflict.
 	     * An old delegation should have been recovered by the
 	     * client doing a Claim_DELEGATE_Prev, so I won't let
 	     * it match and return NFSERR_EXPIRED. Should I let it
 	     * match?
 	     */
 	    LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
 		if (!(stp->ls_flags & NFSLCK_OLDDELEG) &&
 		    (((nd->nd_flag & ND_NFSV41) != 0 &&
 		    stateidp->seqid == 0) ||
 		    stateidp->seqid == stp->ls_stateid.seqid) &&
 		    !NFSBCMP(stateidp->other, stp->ls_stateid.other,
 			NFSX_STATEIDOTHER))
 			break;
 	    }
 	    if (stp == LIST_END(&lfp->lf_deleg) ||
 		((new_stp->ls_flags & NFSLCK_WRITEACCESS) &&
 		 (stp->ls_flags & NFSLCK_DELEGREAD))) {
 		NFSUNLOCKSTATE();
 		printf("Nfsd openctrl unexpected expiry\n");
 		free((caddr_t)new_open, M_NFSDSTATE);
 		free((caddr_t)new_deleg, M_NFSDSTATE);
 		if (haslock) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		error = NFSERR_EXPIRED;
 		goto out;
 	    }
 
 	    /*
 	     * Don't issue a Delegation, since one already exists and
 	     * delay delegation timeout, as required.
 	     */
 	    delegate = 0;
 	    nfsrv_delaydelegtimeout(stp);
 	}
 
 	/*
 	 * Check for access/deny bit conflicts. I also check for the
 	 * same owner, since the client might not have bothered to check.
 	 * Also, note an open for the same file and owner, if found,
 	 * which is all we do here for Delegate_Cur, since conflict
 	 * checking is already done.
 	 */
 	LIST_FOREACH(stp, &lfp->lf_open, ls_file) {
 		if (ownerstp && stp->ls_openowner == ownerstp)
 			openstp = stp;
 		if (!(new_stp->ls_flags & NFSLCK_DELEGCUR)) {
 		    /*
 		     * If another client has the file open, the only
 		     * delegation that can be issued is a Read delegation
 		     * and only if it is a Read open with Deny none.
 		     */
 		    if (clp != stp->ls_clp) {
 			if ((stp->ls_flags & NFSLCK_SHAREBITS) ==
 			    NFSLCK_READACCESS)
 			    writedeleg = 0;
 			else
 			    delegate = 0;
 		    }
 		    if(((new_stp->ls_flags & NFSLCK_ACCESSBITS) &
 		        ((stp->ls_flags>>NFSLCK_SHIFT) & NFSLCK_ACCESSBITS))||
 		       ((stp->ls_flags & NFSLCK_ACCESSBITS) &
 		        ((new_stp->ls_flags>>NFSLCK_SHIFT)&NFSLCK_ACCESSBITS))){
 			ret = nfsrv_clientconflict(stp->ls_clp,&haslock,vp,p);
 			if (ret == 1) {
 				/*
 				 * nfsrv_clientconflict() unlocks state
 				 * when it returns non-zero.
 				 */
 				free((caddr_t)new_open, M_NFSDSTATE);
 				free((caddr_t)new_deleg, M_NFSDSTATE);
 				openstp = NULL;
 				goto tryagain;
 			}
 			if (ret == 2)
 				error = NFSERR_PERM;
 			else if (new_stp->ls_flags & NFSLCK_RECLAIM)
 				error = NFSERR_RECLAIMCONFLICT;
 			else
 				error = NFSERR_SHAREDENIED;
 			if (ret == 0)
 				NFSUNLOCKSTATE();
 			if (haslock) {
 				NFSLOCKV4ROOTMUTEX();
 				nfsv4_unlock(&nfsv4rootfs_lock, 1);
 				NFSUNLOCKV4ROOTMUTEX();
 			}
 			free((caddr_t)new_open, M_NFSDSTATE);
 			free((caddr_t)new_deleg, M_NFSDSTATE);
 			printf("nfsd openctrl unexpected client cnfl\n");
 			goto out;
 		    }
 		}
 	}
 
 	/*
 	 * Check for a conflicting delegation. If one is found, call
 	 * nfsrv_delegconflict() to handle it. If the v4root lock hasn't
 	 * been set yet, it will get the lock. Otherwise, it will recall
 	 * the delegation. Then, we try try again...
 	 * (If NFSLCK_DELEGCUR is set, it has a delegation, so there
 	 *  isn't a conflict.)
 	 * I currently believe the conflict algorithm to be:
 	 * For Open with Read Access and Deny None
 	 * - there is a conflict iff a different client has a write delegation
 	 * For Open with other Write Access or any Deny except None
 	 * - there is a conflict if a different client has any delegation
 	 * - there is a conflict if the same client has a read delegation
 	 *   (The current concensus is that this last case should be
 	 *    considered a conflict since the client with a read delegation
 	 *    could have done an Open with ReadAccess and WriteDeny
 	 *    locally and then not have checked for the WriteDeny.)
 	 */
 	if (!(new_stp->ls_flags & (NFSLCK_DELEGPREV | NFSLCK_DELEGCUR))) {
 	    stp = LIST_FIRST(&lfp->lf_deleg);
 	    while (stp != LIST_END(&lfp->lf_deleg)) {
 		nstp = LIST_NEXT(stp, ls_file);
 		if (stp->ls_clp != clp && (stp->ls_flags & NFSLCK_DELEGREAD))
 			writedeleg = 0;
 		else
 			delegate = 0;
 		if ((readonly && stp->ls_clp != clp &&
 		       (stp->ls_flags & NFSLCK_DELEGWRITE)) ||
 		    (!readonly && (stp->ls_clp != clp ||
 		         (stp->ls_flags & NFSLCK_DELEGREAD)))) {
 		    if (new_stp->ls_flags & NFSLCK_RECLAIM) {
 			delegate = 2;
 		    } else {
 			ret = nfsrv_delegconflict(stp, &haslock, p, vp);
 			if (ret) {
 			    /*
 			     * nfsrv_delegconflict() unlocks state
 			     * when it returns non-zero.
 			     */
 			    printf("Nfsd openctrl unexpected deleg cnfl\n");
 			    free((caddr_t)new_open, M_NFSDSTATE);
 			    free((caddr_t)new_deleg, M_NFSDSTATE);
 			    if (ret == -1) {
 				openstp = NULL;
 				goto tryagain;
 			    }
 			    error = ret;
 			    goto out;
 			}
 		    }
 		}
 		stp = nstp;
 	    }
 	}
 
 	/*
 	 * We only get here if there was no open that conflicted.
 	 * If an open for the owner exists, or in the access/deny bits.
 	 * Otherwise it is a new open. If the open_owner hasn't been
 	 * confirmed, replace the open with the new one needing confirmation,
 	 * otherwise add the open.
 	 */
 	if (new_stp->ls_flags & NFSLCK_DELEGPREV) {
 	    /*
 	     * Handle NFSLCK_DELEGPREV by searching the old delegations for
 	     * a match. If found, just move the old delegation to the current
 	     * delegation list and issue open. If not found, return
 	     * NFSERR_EXPIRED.
 	     */
 	    LIST_FOREACH(stp, &clp->lc_olddeleg, ls_list) {
 		if (stp->ls_lfp == lfp) {
 		    /* Found it */
 		    if (stp->ls_clp != clp)
 			panic("olddeleg clp");
 		    LIST_REMOVE(stp, ls_list);
 		    LIST_REMOVE(stp, ls_hash);
 		    stp->ls_flags &= ~NFSLCK_OLDDELEG;
 		    stp->ls_stateid.seqid = delegstateidp->seqid = 1;
 		    stp->ls_stateid.other[0] = delegstateidp->other[0] =
 			clp->lc_clientid.lval[0];
 		    stp->ls_stateid.other[1] = delegstateidp->other[1] =
 			clp->lc_clientid.lval[1];
 		    stp->ls_stateid.other[2] = delegstateidp->other[2] =
 			nfsrv_nextstateindex(clp);
 		    stp->ls_compref = nd->nd_compref;
 		    LIST_INSERT_HEAD(&clp->lc_deleg, stp, ls_list);
 		    LIST_INSERT_HEAD(NFSSTATEHASH(clp,
 			stp->ls_stateid), stp, ls_hash);
 		    if (stp->ls_flags & NFSLCK_DELEGWRITE)
 			*rflagsp |= NFSV4OPEN_WRITEDELEGATE;
 		    else
 			*rflagsp |= NFSV4OPEN_READDELEGATE;
 		    clp->lc_delegtime = NFSD_MONOSEC +
 			nfsrv_lease + NFSRV_LEASEDELTA;
 
 		    /*
 		     * Now, do the associated open.
 		     */
 		    new_open->ls_stateid.seqid = 1;
 		    new_open->ls_stateid.other[0] = clp->lc_clientid.lval[0];
 		    new_open->ls_stateid.other[1] = clp->lc_clientid.lval[1];
 		    new_open->ls_stateid.other[2] = nfsrv_nextstateindex(clp);
 		    new_open->ls_flags = (new_stp->ls_flags&NFSLCK_DENYBITS)|
 			NFSLCK_OPEN;
 		    if (stp->ls_flags & NFSLCK_DELEGWRITE)
 			new_open->ls_flags |= (NFSLCK_READACCESS |
 			    NFSLCK_WRITEACCESS);
 		    else
 			new_open->ls_flags |= NFSLCK_READACCESS;
 		    new_open->ls_uid = new_stp->ls_uid;
 		    new_open->ls_lfp = lfp;
 		    new_open->ls_clp = clp;
 		    LIST_INIT(&new_open->ls_open);
 		    LIST_INSERT_HEAD(&lfp->lf_open, new_open, ls_file);
 		    LIST_INSERT_HEAD(NFSSTATEHASH(clp, new_open->ls_stateid),
 			new_open, ls_hash);
 		    /*
 		     * and handle the open owner
 		     */
 		    if (ownerstp) {
 			new_open->ls_openowner = ownerstp;
 			LIST_INSERT_HEAD(&ownerstp->ls_open,new_open,ls_list);
 		    } else {
 			new_open->ls_openowner = new_stp;
 			new_stp->ls_flags = 0;
 			nfsrvd_refcache(new_stp->ls_op);
 			new_stp->ls_noopens = 0;
 			LIST_INIT(&new_stp->ls_open);
 			LIST_INSERT_HEAD(&new_stp->ls_open, new_open, ls_list);
 			LIST_INSERT_HEAD(&clp->lc_open, new_stp, ls_list);
 			*new_stpp = NULL;
 			newnfsstats.srvopenowners++;
 			nfsrv_openpluslock++;
 		    }
 		    openstp = new_open;
 		    new_open = NULL;
 		    newnfsstats.srvopens++;
 		    nfsrv_openpluslock++;
 		    break;
 		}
 	    }
 	    if (stp == LIST_END(&clp->lc_olddeleg))
 		error = NFSERR_EXPIRED;
 	} else if (new_stp->ls_flags & (NFSLCK_DELEGREAD | NFSLCK_DELEGWRITE)) {
 	    /*
 	     * Scan to see that no delegation for this client and file
 	     * doesn't already exist.
 	     * There also shouldn't yet be an Open for this file and
 	     * openowner.
 	     */
 	    LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
 		if (stp->ls_clp == clp)
 		    break;
 	    }
 	    if (stp == LIST_END(&lfp->lf_deleg) && openstp == NULL) {
 		/*
 		 * This is the Claim_Previous case with a delegation
 		 * type != Delegate_None.
 		 */
 		/*
 		 * First, add the delegation. (Although we must issue the
 		 * delegation, we can also ask for an immediate return.)
 		 */
 		new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1;
 		new_deleg->ls_stateid.other[0] = delegstateidp->other[0] =
 		    clp->lc_clientid.lval[0];
 		new_deleg->ls_stateid.other[1] = delegstateidp->other[1] =
 		    clp->lc_clientid.lval[1];
 		new_deleg->ls_stateid.other[2] = delegstateidp->other[2] =
 		    nfsrv_nextstateindex(clp);
 		if (new_stp->ls_flags & NFSLCK_DELEGWRITE) {
 		    new_deleg->ls_flags = (NFSLCK_DELEGWRITE |
 			NFSLCK_READACCESS | NFSLCK_WRITEACCESS);
 		    *rflagsp |= NFSV4OPEN_WRITEDELEGATE;
 		} else {
 		    new_deleg->ls_flags = (NFSLCK_DELEGREAD |
 			NFSLCK_READACCESS);
 		    *rflagsp |= NFSV4OPEN_READDELEGATE;
 		}
 		new_deleg->ls_uid = new_stp->ls_uid;
 		new_deleg->ls_lfp = lfp;
 		new_deleg->ls_clp = clp;
 		new_deleg->ls_filerev = filerev;
 		new_deleg->ls_compref = nd->nd_compref;
 		LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file);
 		LIST_INSERT_HEAD(NFSSTATEHASH(clp,
 		    new_deleg->ls_stateid), new_deleg, ls_hash);
 		LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg, ls_list);
 		new_deleg = NULL;
 		if (delegate == 2 || nfsrv_issuedelegs == 0 ||
 		    (clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) !=
 		     LCL_CALLBACKSON ||
 		    NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt) ||
 		    !NFSVNO_DELEGOK(vp))
 		    *rflagsp |= NFSV4OPEN_RECALL;
 		newnfsstats.srvdelegates++;
 		nfsrv_openpluslock++;
 		nfsrv_delegatecnt++;
 
 		/*
 		 * Now, do the associated open.
 		 */
 		new_open->ls_stateid.seqid = 1;
 		new_open->ls_stateid.other[0] = clp->lc_clientid.lval[0];
 		new_open->ls_stateid.other[1] = clp->lc_clientid.lval[1];
 		new_open->ls_stateid.other[2] = nfsrv_nextstateindex(clp);
 		new_open->ls_flags = (new_stp->ls_flags & NFSLCK_DENYBITS) |
 		    NFSLCK_OPEN;
 		if (new_stp->ls_flags & NFSLCK_DELEGWRITE)
 			new_open->ls_flags |= (NFSLCK_READACCESS |
 			    NFSLCK_WRITEACCESS);
 		else
 			new_open->ls_flags |= NFSLCK_READACCESS;
 		new_open->ls_uid = new_stp->ls_uid;
 		new_open->ls_lfp = lfp;
 		new_open->ls_clp = clp;
 		LIST_INIT(&new_open->ls_open);
 		LIST_INSERT_HEAD(&lfp->lf_open, new_open, ls_file);
 		LIST_INSERT_HEAD(NFSSTATEHASH(clp, new_open->ls_stateid),
 		   new_open, ls_hash);
 		/*
 		 * and handle the open owner
 		 */
 		if (ownerstp) {
 		    new_open->ls_openowner = ownerstp;
 		    LIST_INSERT_HEAD(&ownerstp->ls_open, new_open, ls_list);
 		} else {
 		    new_open->ls_openowner = new_stp;
 		    new_stp->ls_flags = 0;
 		    nfsrvd_refcache(new_stp->ls_op);
 		    new_stp->ls_noopens = 0;
 		    LIST_INIT(&new_stp->ls_open);
 		    LIST_INSERT_HEAD(&new_stp->ls_open, new_open, ls_list);
 		    LIST_INSERT_HEAD(&clp->lc_open, new_stp, ls_list);
 		    *new_stpp = NULL;
 		    newnfsstats.srvopenowners++;
 		    nfsrv_openpluslock++;
 		}
 		openstp = new_open;
 		new_open = NULL;
 		newnfsstats.srvopens++;
 		nfsrv_openpluslock++;
 	    } else {
 		error = NFSERR_RECLAIMCONFLICT;
 	    }
 	} else if (ownerstp) {
 		if (ownerstp->ls_flags & NFSLCK_NEEDSCONFIRM) {
 		    /* Replace the open */
 		    if (ownerstp->ls_op)
 			nfsrvd_derefcache(ownerstp->ls_op);
 		    ownerstp->ls_op = new_stp->ls_op;
 		    nfsrvd_refcache(ownerstp->ls_op);
 		    ownerstp->ls_seq = new_stp->ls_seq;
 		    *rflagsp |= NFSV4OPEN_RESULTCONFIRM;
 		    stp = LIST_FIRST(&ownerstp->ls_open);
 		    stp->ls_flags = (new_stp->ls_flags & NFSLCK_SHAREBITS) |
 			NFSLCK_OPEN;
 		    stp->ls_stateid.seqid = 1;
 		    stp->ls_uid = new_stp->ls_uid;
 		    if (lfp != stp->ls_lfp) {
 			LIST_REMOVE(stp, ls_file);
 			LIST_INSERT_HEAD(&lfp->lf_open, stp, ls_file);
 			stp->ls_lfp = lfp;
 		    }
 		    openstp = stp;
 		} else if (openstp) {
 		    openstp->ls_flags |= (new_stp->ls_flags & NFSLCK_SHAREBITS);
 		    openstp->ls_stateid.seqid++;
 		    if ((nd->nd_flag & ND_NFSV41) != 0 &&
 			openstp->ls_stateid.seqid == 0)
 			openstp->ls_stateid.seqid = 1;
 
 		    /*
 		     * This is where we can choose to issue a delegation.
 		     */
 		    if (delegate == 0 || writedeleg == 0 ||
 			NFSVNO_EXRDONLY(exp) || (readonly != 0 &&
 			nfsrv_writedelegifpos == 0) ||
 			!NFSVNO_DELEGOK(vp) ||
 			(new_stp->ls_flags & NFSLCK_WANTRDELEG) != 0 ||
 			(clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) !=
 			 LCL_CALLBACKSON)
 			*rflagsp |= NFSV4OPEN_WDCONTENTION;
 		    else if (nfsrv_issuedelegs == 0 ||
 			NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt))
 			*rflagsp |= NFSV4OPEN_WDRESOURCE;
 		    else if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0)
 			*rflagsp |= NFSV4OPEN_WDNOTWANTED;
 		    else {
 			new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1;
 			new_deleg->ls_stateid.other[0] = delegstateidp->other[0]
 			    = clp->lc_clientid.lval[0];
 			new_deleg->ls_stateid.other[1] = delegstateidp->other[1]
 			    = clp->lc_clientid.lval[1];
 			new_deleg->ls_stateid.other[2] = delegstateidp->other[2]
 			    = nfsrv_nextstateindex(clp);
 			new_deleg->ls_flags = (NFSLCK_DELEGWRITE |
 			    NFSLCK_READACCESS | NFSLCK_WRITEACCESS);
 			*rflagsp |= NFSV4OPEN_WRITEDELEGATE;
 			new_deleg->ls_uid = new_stp->ls_uid;
 			new_deleg->ls_lfp = lfp;
 			new_deleg->ls_clp = clp;
 			new_deleg->ls_filerev = filerev;
 			new_deleg->ls_compref = nd->nd_compref;
 			LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file);
 			LIST_INSERT_HEAD(NFSSTATEHASH(clp,
 			    new_deleg->ls_stateid), new_deleg, ls_hash);
 			LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg, ls_list);
 			new_deleg = NULL;
 			newnfsstats.srvdelegates++;
 			nfsrv_openpluslock++;
 			nfsrv_delegatecnt++;
 		    }
 		} else {
 		    new_open->ls_stateid.seqid = 1;
 		    new_open->ls_stateid.other[0] = clp->lc_clientid.lval[0];
 		    new_open->ls_stateid.other[1] = clp->lc_clientid.lval[1];
 		    new_open->ls_stateid.other[2] = nfsrv_nextstateindex(clp);
 		    new_open->ls_flags = (new_stp->ls_flags & NFSLCK_SHAREBITS)|
 			NFSLCK_OPEN;
 		    new_open->ls_uid = new_stp->ls_uid;
 		    new_open->ls_openowner = ownerstp;
 		    new_open->ls_lfp = lfp;
 		    new_open->ls_clp = clp;
 		    LIST_INIT(&new_open->ls_open);
 		    LIST_INSERT_HEAD(&lfp->lf_open, new_open, ls_file);
 		    LIST_INSERT_HEAD(&ownerstp->ls_open, new_open, ls_list);
 		    LIST_INSERT_HEAD(NFSSTATEHASH(clp, new_open->ls_stateid),
 			new_open, ls_hash);
 		    openstp = new_open;
 		    new_open = NULL;
 		    newnfsstats.srvopens++;
 		    nfsrv_openpluslock++;
 
 		    /*
 		     * This is where we can choose to issue a delegation.
 		     */
 		    if (delegate == 0 || (writedeleg == 0 && readonly == 0) ||
 			!NFSVNO_DELEGOK(vp) ||
 			(clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) !=
 			 LCL_CALLBACKSON)
 			*rflagsp |= NFSV4OPEN_WDCONTENTION;
 		    else if (nfsrv_issuedelegs == 0 ||
 			NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt))
 			*rflagsp |= NFSV4OPEN_WDRESOURCE;
 		    else if ((new_stp->ls_flags & NFSLCK_WANTNODELEG) != 0)
 			*rflagsp |= NFSV4OPEN_WDNOTWANTED;
 		    else {
 			new_deleg->ls_stateid.seqid = delegstateidp->seqid = 1;
 			new_deleg->ls_stateid.other[0] = delegstateidp->other[0]
 			    = clp->lc_clientid.lval[0];
 			new_deleg->ls_stateid.other[1] = delegstateidp->other[1]
 			    = clp->lc_clientid.lval[1];
 			new_deleg->ls_stateid.other[2] = delegstateidp->other[2]
 			    = nfsrv_nextstateindex(clp);
 			if (writedeleg && !NFSVNO_EXRDONLY(exp) &&
 			    (nfsrv_writedelegifpos || !readonly) &&
 			    (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0) {
 			    new_deleg->ls_flags = (NFSLCK_DELEGWRITE |
 				NFSLCK_READACCESS | NFSLCK_WRITEACCESS);
 			    *rflagsp |= NFSV4OPEN_WRITEDELEGATE;
 			} else {
 			    new_deleg->ls_flags = (NFSLCK_DELEGREAD |
 				NFSLCK_READACCESS);
 			    *rflagsp |= NFSV4OPEN_READDELEGATE;
 			}
 			new_deleg->ls_uid = new_stp->ls_uid;
 			new_deleg->ls_lfp = lfp;
 			new_deleg->ls_clp = clp;
 			new_deleg->ls_filerev = filerev;
 			new_deleg->ls_compref = nd->nd_compref;
 			LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file);
 			LIST_INSERT_HEAD(NFSSTATEHASH(clp,
 			    new_deleg->ls_stateid), new_deleg, ls_hash);
 			LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg, ls_list);
 			new_deleg = NULL;
 			newnfsstats.srvdelegates++;
 			nfsrv_openpluslock++;
 			nfsrv_delegatecnt++;
 		    }
 		}
 	} else {
 		/*
 		 * New owner case. Start the open_owner sequence with a
 		 * Needs confirmation (unless a reclaim) and hang the
 		 * new open off it.
 		 */
 		new_open->ls_stateid.seqid = 1;
 		new_open->ls_stateid.other[0] = clp->lc_clientid.lval[0];
 		new_open->ls_stateid.other[1] = clp->lc_clientid.lval[1];
 		new_open->ls_stateid.other[2] = nfsrv_nextstateindex(clp);
 		new_open->ls_flags = (new_stp->ls_flags & NFSLCK_SHAREBITS) |
 		    NFSLCK_OPEN;
 		new_open->ls_uid = new_stp->ls_uid;
 		LIST_INIT(&new_open->ls_open);
 		new_open->ls_openowner = new_stp;
 		new_open->ls_lfp = lfp;
 		new_open->ls_clp = clp;
 		LIST_INSERT_HEAD(&lfp->lf_open, new_open, ls_file);
 		if (new_stp->ls_flags & NFSLCK_RECLAIM) {
 			new_stp->ls_flags = 0;
 		} else if ((nd->nd_flag & ND_NFSV41) != 0) {
 			/* NFSv4.1 never needs confirmation. */
 			new_stp->ls_flags = 0;
 
 			/*
 			 * This is where we can choose to issue a delegation.
 			 */
 			if (delegate && nfsrv_issuedelegs &&
 			    (writedeleg || readonly) &&
 			    (clp->lc_flags & (LCL_CALLBACKSON | LCL_CBDOWN)) ==
 			     LCL_CALLBACKSON &&
 			    !NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt) &&
 			    NFSVNO_DELEGOK(vp) &&
 			    ((nd->nd_flag & ND_NFSV41) == 0 ||
 			     (new_stp->ls_flags & NFSLCK_WANTNODELEG) == 0)) {
 				new_deleg->ls_stateid.seqid =
 				    delegstateidp->seqid = 1;
 				new_deleg->ls_stateid.other[0] =
 				    delegstateidp->other[0]
 				    = clp->lc_clientid.lval[0];
 				new_deleg->ls_stateid.other[1] =
 				    delegstateidp->other[1]
 				    = clp->lc_clientid.lval[1];
 				new_deleg->ls_stateid.other[2] =
 				    delegstateidp->other[2]
 				    = nfsrv_nextstateindex(clp);
 				if (writedeleg && !NFSVNO_EXRDONLY(exp) &&
 				    (nfsrv_writedelegifpos || !readonly) &&
 				    ((nd->nd_flag & ND_NFSV41) == 0 ||
 				     (new_stp->ls_flags & NFSLCK_WANTRDELEG) ==
 				     0)) {
 					new_deleg->ls_flags =
 					    (NFSLCK_DELEGWRITE |
 					     NFSLCK_READACCESS |
 					     NFSLCK_WRITEACCESS);
 					*rflagsp |= NFSV4OPEN_WRITEDELEGATE;
 				} else {
 					new_deleg->ls_flags =
 					    (NFSLCK_DELEGREAD |
 					     NFSLCK_READACCESS);
 					*rflagsp |= NFSV4OPEN_READDELEGATE;
 				}
 				new_deleg->ls_uid = new_stp->ls_uid;
 				new_deleg->ls_lfp = lfp;
 				new_deleg->ls_clp = clp;
 				new_deleg->ls_filerev = filerev;
 				new_deleg->ls_compref = nd->nd_compref;
 				LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg,
 				    ls_file);
 				LIST_INSERT_HEAD(NFSSTATEHASH(clp,
 				    new_deleg->ls_stateid), new_deleg, ls_hash);
 				LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg,
 				    ls_list);
 				new_deleg = NULL;
 				newnfsstats.srvdelegates++;
 				nfsrv_openpluslock++;
 				nfsrv_delegatecnt++;
 			}
 		} else {
 			*rflagsp |= NFSV4OPEN_RESULTCONFIRM;
 			new_stp->ls_flags = NFSLCK_NEEDSCONFIRM;
 		}
 		nfsrvd_refcache(new_stp->ls_op);
 		new_stp->ls_noopens = 0;
 		LIST_INIT(&new_stp->ls_open);
 		LIST_INSERT_HEAD(&new_stp->ls_open, new_open, ls_list);
 		LIST_INSERT_HEAD(&clp->lc_open, new_stp, ls_list);
 		LIST_INSERT_HEAD(NFSSTATEHASH(clp, new_open->ls_stateid),
 		    new_open, ls_hash);
 		openstp = new_open;
 		new_open = NULL;
 		*new_stpp = NULL;
 		newnfsstats.srvopens++;
 		nfsrv_openpluslock++;
 		newnfsstats.srvopenowners++;
 		nfsrv_openpluslock++;
 	}
 	if (!error) {
 		stateidp->seqid = openstp->ls_stateid.seqid;
 		stateidp->other[0] = openstp->ls_stateid.other[0];
 		stateidp->other[1] = openstp->ls_stateid.other[1];
 		stateidp->other[2] = openstp->ls_stateid.other[2];
 	}
 	NFSUNLOCKSTATE();
 	if (haslock) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 	}
 	if (new_open)
 		FREE((caddr_t)new_open, M_NFSDSTATE);
 	if (new_deleg)
 		FREE((caddr_t)new_deleg, M_NFSDSTATE);
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Open update. Does the confirm, downgrade and close.
  */
 APPLESTATIC int
 nfsrv_openupdate(vnode_t vp, struct nfsstate *new_stp, nfsquad_t clientid,
     nfsv4stateid_t *stateidp, struct nfsrv_descript *nd, NFSPROC_T *p)
 {
 	struct nfsstate *stp, *ownerstp;
 	struct nfsclient *clp;
 	struct nfslockfile *lfp;
 	u_int32_t bits;
 	int error = 0, gotstate = 0, len = 0;
 	u_char client[NFSV4_OPAQUELIMIT];
 
 	/*
 	 * Check for restart conditions (client and server).
 	 */
 	error = nfsrv_checkrestart(clientid, new_stp->ls_flags,
 	    &new_stp->ls_stateid, 0);
 	if (error)
 		goto out;
 
 	NFSLOCKSTATE();
 	/*
 	 * Get the open structure via clientid and stateid.
 	 */
 	error = nfsrv_getclient(clientid, CLOPS_RENEW, &clp, NULL,
 	    (nfsquad_t)((u_quad_t)0), 0, nd, p);
 	if (!error)
 		error = nfsrv_getstate(clp, &new_stp->ls_stateid,
 		    new_stp->ls_flags, &stp);
 
 	/*
 	 * Sanity check the open.
 	 */
 	if (!error && (!(stp->ls_flags & NFSLCK_OPEN) ||
 		(!(new_stp->ls_flags & NFSLCK_CONFIRM) &&
 		 (stp->ls_openowner->ls_flags & NFSLCK_NEEDSCONFIRM)) ||
 		((new_stp->ls_flags & NFSLCK_CONFIRM) &&
 		 (!(stp->ls_openowner->ls_flags & NFSLCK_NEEDSCONFIRM)))))
 		error = NFSERR_BADSTATEID;
 
 	if (!error)
 		error = nfsrv_checkseqid(nd, new_stp->ls_seq,
 		    stp->ls_openowner, new_stp->ls_op);
 	if (!error && stp->ls_stateid.seqid != new_stp->ls_stateid.seqid &&
 	    (((nd->nd_flag & ND_NFSV41) == 0 &&
 	      !(new_stp->ls_flags & NFSLCK_CONFIRM)) ||
 	     ((nd->nd_flag & ND_NFSV41) != 0 &&
 	      new_stp->ls_stateid.seqid != 0)))
 		error = NFSERR_OLDSTATEID;
 	if (!error && vnode_vtype(vp) != VREG) {
 		if (vnode_vtype(vp) == VDIR)
 			error = NFSERR_ISDIR;
 		else
 			error = NFSERR_INVAL;
 	}
 
 	if (error) {
 		/*
 		 * If a client tries to confirm an Open with a bad
 		 * seqid# and there are no byte range locks or other Opens
 		 * on the openowner, just throw it away, so the next use of the
 		 * openowner will start a fresh seq#.
 		 */
 		if (error == NFSERR_BADSEQID &&
 		    (new_stp->ls_flags & NFSLCK_CONFIRM) &&
 		    nfsrv_nootherstate(stp))
 			nfsrv_freeopenowner(stp->ls_openowner, 0, p);
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 
 	/*
 	 * Set the return stateid.
 	 */
 	stateidp->seqid = stp->ls_stateid.seqid + 1;
 	if ((nd->nd_flag & ND_NFSV41) != 0 && stateidp->seqid == 0)
 		stateidp->seqid = 1;
 	stateidp->other[0] = stp->ls_stateid.other[0];
 	stateidp->other[1] = stp->ls_stateid.other[1];
 	stateidp->other[2] = stp->ls_stateid.other[2];
 	/*
 	 * Now, handle the three cases.
 	 */
 	if (new_stp->ls_flags & NFSLCK_CONFIRM) {
 		/*
 		 * If the open doesn't need confirmation, it seems to me that
 		 * there is a client error, but I'll just log it and keep going?
 		 */
 		if (!(stp->ls_openowner->ls_flags & NFSLCK_NEEDSCONFIRM))
 			printf("Nfsv4d: stray open confirm\n");
 		stp->ls_openowner->ls_flags = 0;
 		stp->ls_stateid.seqid++;
 		if ((nd->nd_flag & ND_NFSV41) != 0 &&
 		    stp->ls_stateid.seqid == 0)
 			stp->ls_stateid.seqid = 1;
 		if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) {
 			clp->lc_flags |= LCL_STAMPEDSTABLE;
 			len = clp->lc_idlen;
 			NFSBCOPY(clp->lc_id, client, len);
 			gotstate = 1;
 		}
 		NFSUNLOCKSTATE();
 	} else if (new_stp->ls_flags & NFSLCK_CLOSE) {
 		ownerstp = stp->ls_openowner;
 		lfp = stp->ls_lfp;
 		if (nfsrv_dolocallocks != 0 && !LIST_EMPTY(&stp->ls_open)) {
 			/* Get the lf lock */
 			nfsrv_locklf(lfp);
 			NFSUNLOCKSTATE();
+			ASSERT_VOP_ELOCKED(vp, "nfsrv_openupdate");
+			NFSVOPUNLOCK(vp, 0);
 			if (nfsrv_freeopen(stp, vp, 1, p) == 0) {
 				NFSLOCKSTATE();
 				nfsrv_unlocklf(lfp);
 				NFSUNLOCKSTATE();
 			}
+			NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
 		} else {
 			(void) nfsrv_freeopen(stp, NULL, 0, p);
 			NFSUNLOCKSTATE();
 		}
 	} else {
 		/*
 		 * Update the share bits, making sure that the new set are a
 		 * subset of the old ones.
 		 */
 		bits = (new_stp->ls_flags & NFSLCK_SHAREBITS);
 		if (~(stp->ls_flags) & bits) {
 			NFSUNLOCKSTATE();
 			error = NFSERR_INVAL;
 			goto out;
 		}
 		stp->ls_flags = (bits | NFSLCK_OPEN);
 		stp->ls_stateid.seqid++;
 		if ((nd->nd_flag & ND_NFSV41) != 0 &&
 		    stp->ls_stateid.seqid == 0)
 			stp->ls_stateid.seqid = 1;
 		NFSUNLOCKSTATE();
 	}
 
 	/*
 	 * If the client just confirmed its first open, write a timestamp
 	 * to the stable storage file.
 	 */
 	if (gotstate != 0) {
 		nfsrv_writestable(client, len, NFSNST_NEWSTATE, p);
 		nfsrv_backupstable();
 	}
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Delegation update. Does the purge and return.
  */
 APPLESTATIC int
 nfsrv_delegupdate(struct nfsrv_descript *nd, nfsquad_t clientid,
     nfsv4stateid_t *stateidp, vnode_t vp, int op, struct ucred *cred,
     NFSPROC_T *p)
 {
 	struct nfsstate *stp;
 	struct nfsclient *clp;
 	int error = 0;
 	fhandle_t fh;
 
 	/*
 	 * Do a sanity check against the file handle for DelegReturn.
 	 */
 	if (vp) {
 		error = nfsvno_getfh(vp, &fh, p);
 		if (error)
 			goto out;
 	}
 	/*
 	 * Check for restart conditions (client and server).
 	 */
 	if (op == NFSV4OP_DELEGRETURN)
 		error = nfsrv_checkrestart(clientid, NFSLCK_DELEGRETURN,
 			stateidp, 0);
 	else
 		error = nfsrv_checkrestart(clientid, NFSLCK_DELEGPURGE,
 			stateidp, 0);
 
 	NFSLOCKSTATE();
 	/*
 	 * Get the open structure via clientid and stateid.
 	 */
 	if (!error)
 	    error = nfsrv_getclient(clientid, CLOPS_RENEW, &clp, NULL,
 		(nfsquad_t)((u_quad_t)0), 0, nd, p);
 	if (error) {
 		if (error == NFSERR_CBPATHDOWN)
 			error = 0;
 		if (error == NFSERR_STALECLIENTID && op == NFSV4OP_DELEGRETURN)
 			error = NFSERR_STALESTATEID;
 	}
 	if (!error && op == NFSV4OP_DELEGRETURN) {
 	    error = nfsrv_getstate(clp, stateidp, NFSLCK_DELEGRETURN, &stp);
 	    if (!error && stp->ls_stateid.seqid != stateidp->seqid &&
 		((nd->nd_flag & ND_NFSV41) == 0 || stateidp->seqid != 0))
 		error = NFSERR_OLDSTATEID;
 	}
 	/*
 	 * NFSERR_EXPIRED means that the state has gone away,
 	 * so Delegations have been purged. Just return ok.
 	 */
 	if (error == NFSERR_EXPIRED && op == NFSV4OP_DELEGPURGE) {
 		NFSUNLOCKSTATE();
 		error = 0;
 		goto out;
 	}
 	if (error) {
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 
 	if (op == NFSV4OP_DELEGRETURN) {
 		if (NFSBCMP((caddr_t)&fh, (caddr_t)&stp->ls_lfp->lf_fh,
 		    sizeof (fhandle_t))) {
 			NFSUNLOCKSTATE();
 			error = NFSERR_BADSTATEID;
 			goto out;
 		}
 		nfsrv_freedeleg(stp);
 	} else {
 		nfsrv_freedeleglist(&clp->lc_olddeleg);
 	}
 	NFSUNLOCKSTATE();
 	error = 0;
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Release lock owner.
  */
 APPLESTATIC int
 nfsrv_releaselckown(struct nfsstate *new_stp, nfsquad_t clientid,
     NFSPROC_T *p)
 {
 	struct nfsstate *stp, *nstp, *openstp, *ownstp;
 	struct nfsclient *clp;
 	int error = 0;
 
 	/*
 	 * Check for restart conditions (client and server).
 	 */
 	error = nfsrv_checkrestart(clientid, new_stp->ls_flags,
 	    &new_stp->ls_stateid, 0);
 	if (error)
 		goto out;
 
 	NFSLOCKSTATE();
 	/*
 	 * Get the lock owner by name.
 	 */
 	error = nfsrv_getclient(clientid, CLOPS_RENEW, &clp, NULL,
 	    (nfsquad_t)((u_quad_t)0), 0, NULL, p);
 	if (error) {
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 	LIST_FOREACH(ownstp, &clp->lc_open, ls_list) {
 	    LIST_FOREACH(openstp, &ownstp->ls_open, ls_list) {
 		stp = LIST_FIRST(&openstp->ls_open);
 		while (stp != LIST_END(&openstp->ls_open)) {
 		    nstp = LIST_NEXT(stp, ls_list);
 		    /*
 		     * If the owner matches, check for locks and
 		     * then free or return an error.
 		     */
 		    if (stp->ls_ownerlen == new_stp->ls_ownerlen &&
 			!NFSBCMP(stp->ls_owner, new_stp->ls_owner,
 			 stp->ls_ownerlen)){
 			if (LIST_EMPTY(&stp->ls_lock)) {
 			    nfsrv_freelockowner(stp, NULL, 0, p);
 			} else {
 			    NFSUNLOCKSTATE();
 			    error = NFSERR_LOCKSHELD;
 			    goto out;
 			}
 		    }
 		    stp = nstp;
 		}
 	    }
 	}
 	NFSUNLOCKSTATE();
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Get the file handle for a lock structure.
  */
 static int
 nfsrv_getlockfh(vnode_t vp, u_short flags, struct nfslockfile *new_lfp,
     fhandle_t *nfhp, NFSPROC_T *p)
 {
 	fhandle_t *fhp = NULL;
 	int error;
 
 	/*
 	 * For lock, use the new nfslock structure, otherwise just
 	 * a fhandle_t on the stack.
 	 */
 	if (flags & NFSLCK_OPEN) {
 		KASSERT(new_lfp != NULL, ("nfsrv_getlockfh: new_lfp NULL"));
 		fhp = &new_lfp->lf_fh;
 	} else if (nfhp) {
 		fhp = nfhp;
 	} else {
 		panic("nfsrv_getlockfh");
 	}
 	error = nfsvno_getfh(vp, fhp, p);
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Get an nfs lock structure. Allocate one, as required, and return a
  * pointer to it.
  * Returns an NFSERR_xxx upon failure or -1 to indicate no current lock.
  */
 static int
 nfsrv_getlockfile(u_short flags, struct nfslockfile **new_lfpp,
     struct nfslockfile **lfpp, fhandle_t *nfhp, int lockit)
 {
 	struct nfslockfile *lfp;
 	fhandle_t *fhp = NULL, *tfhp;
 	struct nfslockhashhead *hp;
 	struct nfslockfile *new_lfp = NULL;
 
 	/*
 	 * For lock, use the new nfslock structure, otherwise just
 	 * a fhandle_t on the stack.
 	 */
 	if (flags & NFSLCK_OPEN) {
 		new_lfp = *new_lfpp;
 		fhp = &new_lfp->lf_fh;
 	} else if (nfhp) {
 		fhp = nfhp;
 	} else {
 		panic("nfsrv_getlockfile");
 	}
 
 	hp = NFSLOCKHASH(fhp);
 	LIST_FOREACH(lfp, hp, lf_hash) {
 		tfhp = &lfp->lf_fh;
 		if (NFSVNO_CMPFH(fhp, tfhp)) {
 			if (lockit)
 				nfsrv_locklf(lfp);
 			*lfpp = lfp;
 			return (0);
 		}
 	}
 	if (!(flags & NFSLCK_OPEN))
 		return (-1);
 
 	/*
 	 * No match, so chain the new one into the list.
 	 */
 	LIST_INIT(&new_lfp->lf_open);
 	LIST_INIT(&new_lfp->lf_lock);
 	LIST_INIT(&new_lfp->lf_deleg);
 	LIST_INIT(&new_lfp->lf_locallock);
 	LIST_INIT(&new_lfp->lf_rollback);
 	new_lfp->lf_locallock_lck.nfslock_usecnt = 0;
 	new_lfp->lf_locallock_lck.nfslock_lock = 0;
 	new_lfp->lf_usecount = 0;
 	LIST_INSERT_HEAD(hp, new_lfp, lf_hash);
 	*lfpp = new_lfp;
 	*new_lfpp = NULL;
 	return (0);
 }
 
 /*
  * This function adds a nfslock lock structure to the list for the associated
  * nfsstate and nfslockfile structures. It will be inserted after the
  * entry pointed at by insert_lop.
  */
 static void
 nfsrv_insertlock(struct nfslock *new_lop, struct nfslock *insert_lop,
     struct nfsstate *stp, struct nfslockfile *lfp)
 {
 	struct nfslock *lop, *nlop;
 
 	new_lop->lo_stp = stp;
 	new_lop->lo_lfp = lfp;
 
 	if (stp != NULL) {
 		/* Insert in increasing lo_first order */
 		lop = LIST_FIRST(&lfp->lf_lock);
 		if (lop == LIST_END(&lfp->lf_lock) ||
 		    new_lop->lo_first <= lop->lo_first) {
 			LIST_INSERT_HEAD(&lfp->lf_lock, new_lop, lo_lckfile);
 		} else {
 			nlop = LIST_NEXT(lop, lo_lckfile);
 			while (nlop != LIST_END(&lfp->lf_lock) &&
 			       nlop->lo_first < new_lop->lo_first) {
 				lop = nlop;
 				nlop = LIST_NEXT(lop, lo_lckfile);
 			}
 			LIST_INSERT_AFTER(lop, new_lop, lo_lckfile);
 		}
 	} else {
 		new_lop->lo_lckfile.le_prev = NULL;	/* list not used */
 	}
 
 	/*
 	 * Insert after insert_lop, which is overloaded as stp or lfp for
 	 * an empty list.
 	 */
 	if (stp == NULL && (struct nfslockfile *)insert_lop == lfp)
 		LIST_INSERT_HEAD(&lfp->lf_locallock, new_lop, lo_lckowner);
 	else if ((struct nfsstate *)insert_lop == stp)
 		LIST_INSERT_HEAD(&stp->ls_lock, new_lop, lo_lckowner);
 	else
 		LIST_INSERT_AFTER(insert_lop, new_lop, lo_lckowner);
 	if (stp != NULL) {
 		newnfsstats.srvlocks++;
 		nfsrv_openpluslock++;
 	}
 }
 
 /*
  * This function updates the locking for a lock owner and given file. It
  * maintains a list of lock ranges ordered on increasing file offset that
  * are NFSLCK_READ or NFSLCK_WRITE and non-overlapping (aka POSIX style).
  * It always adds new_lop to the list and sometimes uses the one pointed
  * at by other_lopp.
  */
 static void
 nfsrv_updatelock(struct nfsstate *stp, struct nfslock **new_lopp,
     struct nfslock **other_lopp, struct nfslockfile *lfp)
 {
 	struct nfslock *new_lop = *new_lopp;
 	struct nfslock *lop, *tlop, *ilop;
 	struct nfslock *other_lop = *other_lopp;
 	int unlock = 0, myfile = 0;
 	u_int64_t tmp;
 
 	/*
 	 * Work down the list until the lock is merged.
 	 */
 	if (new_lop->lo_flags & NFSLCK_UNLOCK)
 		unlock = 1;
 	if (stp != NULL) {
 		ilop = (struct nfslock *)stp;
 		lop = LIST_FIRST(&stp->ls_lock);
 	} else {
 		ilop = (struct nfslock *)lfp;
 		lop = LIST_FIRST(&lfp->lf_locallock);
 	}
 	while (lop != NULL) {
 	    /*
 	     * Only check locks for this file that aren't before the start of
 	     * new lock's range.
 	     */
 	    if (lop->lo_lfp == lfp) {
 	      myfile = 1;
 	      if (lop->lo_end >= new_lop->lo_first) {
 		if (new_lop->lo_end < lop->lo_first) {
 			/*
 			 * If the new lock ends before the start of the
 			 * current lock's range, no merge, just insert
 			 * the new lock.
 			 */
 			break;
 		}
 		if (new_lop->lo_flags == lop->lo_flags ||
 		    (new_lop->lo_first <= lop->lo_first &&
 		     new_lop->lo_end >= lop->lo_end)) {
 			/*
 			 * This lock can be absorbed by the new lock/unlock.
 			 * This happens when it covers the entire range
 			 * of the old lock or is contiguous
 			 * with the old lock and is of the same type or an
 			 * unlock.
 			 */
 			if (lop->lo_first < new_lop->lo_first)
 				new_lop->lo_first = lop->lo_first;
 			if (lop->lo_end > new_lop->lo_end)
 				new_lop->lo_end = lop->lo_end;
 			tlop = lop;
 			lop = LIST_NEXT(lop, lo_lckowner);
 			nfsrv_freenfslock(tlop);
 			continue;
 		}
 
 		/*
 		 * All these cases are for contiguous locks that are not the
 		 * same type, so they can't be merged.
 		 */
 		if (new_lop->lo_first <= lop->lo_first) {
 			/*
 			 * This case is where the new lock overlaps with the
 			 * first part of the old lock. Move the start of the
 			 * old lock to just past the end of the new lock. The
 			 * new lock will be inserted in front of the old, since
 			 * ilop hasn't been updated. (We are done now.)
 			 */
 			lop->lo_first = new_lop->lo_end;
 			break;
 		}
 		if (new_lop->lo_end >= lop->lo_end) {
 			/*
 			 * This case is where the new lock overlaps with the
 			 * end of the old lock's range. Move the old lock's
 			 * end to just before the new lock's first and insert
 			 * the new lock after the old lock.
 			 * Might not be done yet, since the new lock could
 			 * overlap further locks with higher ranges.
 			 */
 			lop->lo_end = new_lop->lo_first;
 			ilop = lop;
 			lop = LIST_NEXT(lop, lo_lckowner);
 			continue;
 		}
 		/*
 		 * The final case is where the new lock's range is in the
 		 * middle of the current lock's and splits the current lock
 		 * up. Use *other_lopp to handle the second part of the
 		 * split old lock range. (We are done now.)
 		 * For unlock, we use new_lop as other_lop and tmp, since
 		 * other_lop and new_lop are the same for this case.
 		 * We noted the unlock case above, so we don't need
 		 * new_lop->lo_flags any longer.
 		 */
 		tmp = new_lop->lo_first;
 		if (other_lop == NULL) {
 			if (!unlock)
 				panic("nfsd srv update unlock");
 			other_lop = new_lop;
 			*new_lopp = NULL;
 		}
 		other_lop->lo_first = new_lop->lo_end;
 		other_lop->lo_end = lop->lo_end;
 		other_lop->lo_flags = lop->lo_flags;
 		other_lop->lo_stp = stp;
 		other_lop->lo_lfp = lfp;
 		lop->lo_end = tmp;
 		nfsrv_insertlock(other_lop, lop, stp, lfp);
 		*other_lopp = NULL;
 		ilop = lop;
 		break;
 	      }
 	    }
 	    ilop = lop;
 	    lop = LIST_NEXT(lop, lo_lckowner);
 	    if (myfile && (lop == NULL || lop->lo_lfp != lfp))
 		break;
 	}
 
 	/*
 	 * Insert the new lock in the list at the appropriate place.
 	 */
 	if (!unlock) {
 		nfsrv_insertlock(new_lop, ilop, stp, lfp);
 		*new_lopp = NULL;
 	}
 }
 
 /*
  * This function handles sequencing of locks, etc.
  * It returns an error that indicates what the caller should do.
  */
 static int
 nfsrv_checkseqid(struct nfsrv_descript *nd, u_int32_t seqid,
     struct nfsstate *stp, struct nfsrvcache *op)
 {
 	int error = 0;
 
 	if ((nd->nd_flag & ND_NFSV41) != 0)
 		/* NFSv4.1 ignores the open_seqid and lock_seqid. */
 		goto out;
 	if (op != nd->nd_rp)
 		panic("nfsrvstate checkseqid");
 	if (!(op->rc_flag & RC_INPROG))
 		panic("nfsrvstate not inprog");
 	if (stp->ls_op && stp->ls_op->rc_refcnt <= 0) {
 		printf("refcnt=%d\n", stp->ls_op->rc_refcnt);
 		panic("nfsrvstate op refcnt");
 	}
 	if ((stp->ls_seq + 1) == seqid) {
 		if (stp->ls_op)
 			nfsrvd_derefcache(stp->ls_op);
 		stp->ls_op = op;
 		nfsrvd_refcache(op);
 		stp->ls_seq = seqid;
 		goto out;
 	} else if (stp->ls_seq == seqid && stp->ls_op &&
 		op->rc_xid == stp->ls_op->rc_xid &&
 		op->rc_refcnt == 0 &&
 		op->rc_reqlen == stp->ls_op->rc_reqlen &&
 		op->rc_cksum == stp->ls_op->rc_cksum) {
 		if (stp->ls_op->rc_flag & RC_INPROG) {
 			error = NFSERR_DONTREPLY;
 			goto out;
 		}
 		nd->nd_rp = stp->ls_op;
 		nd->nd_rp->rc_flag |= RC_INPROG;
 		nfsrvd_delcache(op);
 		error = NFSERR_REPLYFROMCACHE;
 		goto out;
 	}
 	error = NFSERR_BADSEQID;
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Get the client ip address for callbacks. If the strings can't be parsed,
  * just set lc_program to 0 to indicate no callbacks are possible.
  * (For cases where the address can't be parsed or is 0.0.0.0.0.0, set
  *  the address to the client's transport address. This won't be used
  *  for callbacks, but can be printed out by newnfsstats for info.)
  * Return error if the xdr can't be parsed, 0 otherwise.
  */
 APPLESTATIC int
 nfsrv_getclientipaddr(struct nfsrv_descript *nd, struct nfsclient *clp)
 {
 	u_int32_t *tl;
 	u_char *cp, *cp2;
 	int i, j;
 	struct sockaddr_in *rad, *sad;
 	u_char protocol[5], addr[24];
 	int error = 0, cantparse = 0;
 	union {
 		u_long ival;
 		u_char cval[4];
 	} ip;
 	union {
 		u_short sval;
 		u_char cval[2];
 	} port;
 
 	rad = NFSSOCKADDR(clp->lc_req.nr_nam, struct sockaddr_in *);
 	rad->sin_family = AF_INET;
 	rad->sin_len = sizeof (struct sockaddr_in);
 	rad->sin_addr.s_addr = 0;
 	rad->sin_port = 0;
 	clp->lc_req.nr_client = NULL;
 	clp->lc_req.nr_lock = 0;
 	NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 	i = fxdr_unsigned(int, *tl);
 	if (i >= 3 && i <= 4) {
 		error = nfsrv_mtostr(nd, protocol, i);
 		if (error)
 			goto nfsmout;
 		if (!strcmp(protocol, "tcp")) {
 			clp->lc_flags |= LCL_TCPCALLBACK;
 			clp->lc_req.nr_sotype = SOCK_STREAM;
 			clp->lc_req.nr_soproto = IPPROTO_TCP;
 		} else if (!strcmp(protocol, "udp")) {
 			clp->lc_req.nr_sotype = SOCK_DGRAM;
 			clp->lc_req.nr_soproto = IPPROTO_UDP;
 		} else {
 			cantparse = 1;
 		}
 	} else {
 		cantparse = 1;
 		if (i > 0) {
 			error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
 			if (error)
 				goto nfsmout;
 		}
 	}
 	NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
 	i = fxdr_unsigned(int, *tl);
 	if (i < 0) {
 		error = NFSERR_BADXDR;
 		goto nfsmout;
 	} else if (i == 0) {
 		cantparse = 1;
 	} else if (!cantparse && i <= 23 && i >= 11) {
 		error = nfsrv_mtostr(nd, addr, i);
 		if (error)
 			goto nfsmout;
 
 		/*
 		 * Parse out the address fields. We expect 6 decimal numbers
 		 * separated by '.'s.
 		 */
 		cp = addr;
 		i = 0;
 		while (*cp && i < 6) {
 			cp2 = cp;
 			while (*cp2 && *cp2 != '.')
 				cp2++;
 			if (*cp2)
 				*cp2++ = '\0';
 			else if (i != 5) {
 				cantparse = 1;
 				break;
 			}
 			j = nfsrv_getipnumber(cp);
 			if (j >= 0) {
 				if (i < 4)
 					ip.cval[3 - i] = j;
 				else
 					port.cval[5 - i] = j;
 			} else {
 				cantparse = 1;
 				break;
 			}
 			cp = cp2;
 			i++;
 		}
 		if (!cantparse) {
 			if (ip.ival != 0x0) {
 				rad->sin_addr.s_addr = htonl(ip.ival);
 				rad->sin_port = htons(port.sval);
 			} else {
 				cantparse = 1;
 			}
 		}
 	} else {
 		cantparse = 1;
 		if (i > 0) {
 			error = nfsm_advance(nd, NFSM_RNDUP(i), -1);
 			if (error)
 				goto nfsmout;
 		}
 	}
 	if (cantparse) {
 		sad = NFSSOCKADDR(nd->nd_nam, struct sockaddr_in *);
 		rad->sin_addr.s_addr = sad->sin_addr.s_addr;
 		rad->sin_port = 0x0;
 		clp->lc_program = 0;
 	}
 nfsmout:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Turn a string of up to three decimal digits into a number. Return -1 upon
  * error.
  */
 static int
 nfsrv_getipnumber(u_char *cp)
 {
 	int i = 0, j = 0;
 
 	while (*cp) {
 		if (j > 2 || *cp < '0' || *cp > '9')
 			return (-1);
 		i *= 10;
 		i += (*cp - '0');
 		cp++;
 		j++;
 	}
 	if (i < 256)
 		return (i);
 	return (-1);
 }
 
 /*
  * This function checks for restart conditions.
  */
 static int
 nfsrv_checkrestart(nfsquad_t clientid, u_int32_t flags,
     nfsv4stateid_t *stateidp, int specialid)
 {
 	int ret = 0;
 
 	/*
 	 * First check for a server restart. Open, LockT, ReleaseLockOwner
 	 * and DelegPurge have a clientid, the rest a stateid.
 	 */
 	if (flags &
 	    (NFSLCK_OPEN | NFSLCK_TEST | NFSLCK_RELEASE | NFSLCK_DELEGPURGE)) {
 		if (clientid.lval[0] != nfsrvboottime) {
 			ret = NFSERR_STALECLIENTID;
 			goto out;
 		}
 	} else if (stateidp->other[0] != nfsrvboottime &&
 		specialid == 0) {
 		ret = NFSERR_STALESTATEID;
 		goto out;
 	}
 
 	/*
 	 * Read, Write, Setattr and LockT can return NFSERR_GRACE and do
 	 * not use a lock/open owner seqid#, so the check can be done now.
 	 * (The others will be checked, as required, later.)
 	 */
 	if (!(flags & (NFSLCK_CHECK | NFSLCK_TEST)))
 		goto out;
 
 	NFSLOCKSTATE();
 	ret = nfsrv_checkgrace(NULL, NULL, flags);
 	NFSUNLOCKSTATE();
 
 out:
 	NFSEXITCODE(ret);
 	return (ret);
 }
 
 /*
  * Check for grace.
  */
 static int
 nfsrv_checkgrace(struct nfsrv_descript *nd, struct nfsclient *clp,
     u_int32_t flags)
 {
 	int error = 0;
 
 	if ((nfsrv_stablefirst.nsf_flags & NFSNSF_GRACEOVER) != 0) {
 		if (flags & NFSLCK_RECLAIM) {
 			error = NFSERR_NOGRACE;
 			goto out;
 		}
 	} else {
 		if (!(flags & NFSLCK_RECLAIM)) {
 			error = NFSERR_GRACE;
 			goto out;
 		}
 		if (nd != NULL && clp != NULL &&
 		    (nd->nd_flag & ND_NFSV41) != 0 &&
 		    (clp->lc_flags & LCL_RECLAIMCOMPLETE) != 0) {
 			error = NFSERR_NOGRACE;
 			goto out;
 		}
 
 		/*
 		 * If grace is almost over and we are still getting Reclaims,
 		 * extend grace a bit.
 		 */
 		if ((NFSD_MONOSEC + NFSRV_LEASEDELTA) >
 		    nfsrv_stablefirst.nsf_eograce)
 			nfsrv_stablefirst.nsf_eograce = NFSD_MONOSEC +
 				NFSRV_LEASEDELTA;
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Do a server callback.
  */
 static int
 nfsrv_docallback(struct nfsclient *clp, int procnum,
     nfsv4stateid_t *stateidp, int trunc, fhandle_t *fhp,
     struct nfsvattr *nap, nfsattrbit_t *attrbitp, NFSPROC_T *p)
 {
 	mbuf_t m;
 	u_int32_t *tl;
 	struct nfsrv_descript nfsd, *nd = &nfsd;
 	struct ucred *cred;
 	int error = 0;
 	u_int32_t callback;
 	struct nfsdsession *sep = NULL;
 
 	cred = newnfs_getcred();
 	NFSLOCKSTATE();	/* mostly for lc_cbref++ */
 	if (clp->lc_flags & LCL_NEEDSCONFIRM) {
 		NFSUNLOCKSTATE();
 		panic("docallb");
 	}
 	clp->lc_cbref++;
 
 	/*
 	 * Fill the callback program# and version into the request
 	 * structure for newnfs_connect() to use.
 	 */
 	clp->lc_req.nr_prog = clp->lc_program;
 #ifdef notnow
 	if ((clp->lc_flags & LCL_NFSV41) != 0)
 		clp->lc_req.nr_vers = NFSV41_CBVERS;
 	else
 #endif
 		clp->lc_req.nr_vers = NFSV4_CBVERS;
 
 	/*
 	 * First, fill in some of the fields of nd and cr.
 	 */
 	nd->nd_flag = ND_NFSV4;
 	if (clp->lc_flags & LCL_GSS)
 		nd->nd_flag |= ND_KERBV;
 	if ((clp->lc_flags & LCL_NFSV41) != 0)
 		nd->nd_flag |= ND_NFSV41;
 	nd->nd_repstat = 0;
 	cred->cr_uid = clp->lc_uid;
 	cred->cr_gid = clp->lc_gid;
 	callback = clp->lc_callback;
 	NFSUNLOCKSTATE();
 	cred->cr_ngroups = 1;
 
 	/*
 	 * Get the first mbuf for the request.
 	 */
 	MGET(m, M_WAITOK, MT_DATA);
 	mbuf_setlen(m, 0);
 	nd->nd_mreq = nd->nd_mb = m;
 	nd->nd_bpos = NFSMTOD(m, caddr_t);
 	
 	/*
 	 * and build the callback request.
 	 */
 	if (procnum == NFSV4OP_CBGETATTR) {
 		nd->nd_procnum = NFSV4PROC_CBCOMPOUND;
 		error = nfsrv_cbcallargs(nd, clp, callback, NFSV4OP_CBGETATTR,
 		    "CB Getattr", &sep);
 		if (error != 0) {
 			mbuf_freem(nd->nd_mreq);
 			goto errout;
 		}
 		(void)nfsm_fhtom(nd, (u_int8_t *)fhp, NFSX_MYFH, 0);
 		(void)nfsrv_putattrbit(nd, attrbitp);
 	} else if (procnum == NFSV4OP_CBRECALL) {
 		nd->nd_procnum = NFSV4PROC_CBCOMPOUND;
 		error = nfsrv_cbcallargs(nd, clp, callback, NFSV4OP_CBRECALL,
 		    "CB Recall", &sep);
 		if (error != 0) {
 			mbuf_freem(nd->nd_mreq);
 			goto errout;
 		}
 		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
 		*tl++ = txdr_unsigned(stateidp->seqid);
 		NFSBCOPY((caddr_t)stateidp->other, (caddr_t)tl,
 		    NFSX_STATEIDOTHER);
 		tl += (NFSX_STATEIDOTHER / NFSX_UNSIGNED);
 		if (trunc)
 			*tl = newnfs_true;
 		else
 			*tl = newnfs_false;
 		(void)nfsm_fhtom(nd, (u_int8_t *)fhp, NFSX_MYFH, 0);
 	} else if (procnum == NFSV4PROC_CBNULL) {
 		nd->nd_procnum = NFSV4PROC_CBNULL;
 		if ((clp->lc_flags & LCL_NFSV41) != 0) {
 			error = nfsv4_getcbsession(clp, &sep);
 			if (error != 0) {
 				mbuf_freem(nd->nd_mreq);
 				goto errout;
 			}
 		}
 	} else {
 		error = NFSERR_SERVERFAULT;
 		mbuf_freem(nd->nd_mreq);
 		goto errout;
 	}
 
 	/*
 	 * Call newnfs_connect(), as required, and then newnfs_request().
 	 */
 	(void) newnfs_sndlock(&clp->lc_req.nr_lock);
 	if (clp->lc_req.nr_client == NULL) {
 		if ((clp->lc_flags & LCL_NFSV41) != 0)
 			error = ECONNREFUSED;
 		else if (nd->nd_procnum == NFSV4PROC_CBNULL)
 			error = newnfs_connect(NULL, &clp->lc_req, cred,
 			    NULL, 1);
 		else
 			error = newnfs_connect(NULL, &clp->lc_req, cred,
 			    NULL, 3);
 	}
 	newnfs_sndunlock(&clp->lc_req.nr_lock);
 	if (!error) {
 		if ((nd->nd_flag & ND_NFSV41) != 0) {
 			KASSERT(sep != NULL, ("sep NULL"));
 			error = newnfs_request(nd, NULL, clp, &clp->lc_req,
 			    NULL, NULL, cred, clp->lc_program,
 			    clp->lc_req.nr_vers, NULL, 1, NULL,
 			    &sep->sess_cbsess);
 			nfsrv_freesession(sep, NULL);
 		} else
 			error = newnfs_request(nd, NULL, clp, &clp->lc_req,
 			    NULL, NULL, cred, clp->lc_program,
 			    clp->lc_req.nr_vers, NULL, 1, NULL, NULL);
 	}
 errout:
 	NFSFREECRED(cred);
 
 	/*
 	 * If error is set here, the Callback path isn't working
 	 * properly, so twiddle the appropriate LCL_ flags.
 	 * (nd_repstat != 0 indicates the Callback path is working,
 	 *  but the callback failed on the client.)
 	 */
 	if (error) {
 		/*
 		 * Mark the callback pathway down, which disabled issuing
 		 * of delegations and gets Renew to return NFSERR_CBPATHDOWN.
 		 */
 		NFSLOCKSTATE();
 		clp->lc_flags |= LCL_CBDOWN;
 		NFSUNLOCKSTATE();
 	} else {
 		/*
 		 * Callback worked. If the callback path was down, disable
 		 * callbacks, so no more delegations will be issued. (This
 		 * is done on the assumption that the callback pathway is
 		 * flakey.)
 		 */
 		NFSLOCKSTATE();
 		if (clp->lc_flags & LCL_CBDOWN)
 			clp->lc_flags &= ~(LCL_CBDOWN | LCL_CALLBACKSON);
 		NFSUNLOCKSTATE();
 		if (nd->nd_repstat)
 			error = nd->nd_repstat;
 		else if (error == 0 && procnum == NFSV4OP_CBGETATTR)
 			error = nfsv4_loadattr(nd, NULL, nap, NULL, NULL, 0,
 			    NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL,
 			    p, NULL);
 		mbuf_freem(nd->nd_mrep);
 	}
 	NFSLOCKSTATE();
 	clp->lc_cbref--;
 	if ((clp->lc_flags & LCL_WAKEUPWANTED) && clp->lc_cbref == 0) {
 		clp->lc_flags &= ~LCL_WAKEUPWANTED;
 		wakeup(clp);
 	}
 	NFSUNLOCKSTATE();
 
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Set up the compound RPC for the callback.
  */
 static int
 nfsrv_cbcallargs(struct nfsrv_descript *nd, struct nfsclient *clp,
     uint32_t callback, int op, const char *optag, struct nfsdsession **sepp)
 {
 	uint32_t *tl;
 	int error, len;
 
 	len = strlen(optag);
 	(void)nfsm_strtom(nd, optag, len);
 	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
 	if ((nd->nd_flag & ND_NFSV41) != 0) {
 		*tl++ = txdr_unsigned(NFSV41_MINORVERSION);
 		*tl++ = txdr_unsigned(callback);
 		*tl++ = txdr_unsigned(2);
 		*tl = txdr_unsigned(NFSV4OP_CBSEQUENCE);
 		error = nfsv4_setcbsequence(nd, clp, 1, sepp);
 		if (error != 0)
 			return (error);
 		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
 		*tl = txdr_unsigned(op);
 	} else {
 		*tl++ = txdr_unsigned(NFSV4_MINORVERSION);
 		*tl++ = txdr_unsigned(callback);
 		*tl++ = txdr_unsigned(1);
 		*tl = txdr_unsigned(op);
 	}
 	return (0);
 }
 
 /*
  * Return the next index# for a clientid. Mostly just increment and return
  * the next one, but... if the 32bit unsigned does actually wrap around,
  * it should be rebooted.
  * At an average rate of one new client per second, it will wrap around in
  * approximately 136 years. (I think the server will have been shut
  * down or rebooted before then.)
  */
 static u_int32_t
 nfsrv_nextclientindex(void)
 {
 	static u_int32_t client_index = 0;
 
 	client_index++;
 	if (client_index != 0)
 		return (client_index);
 
 	printf("%s: out of clientids\n", __func__);
 	return (client_index);
 }
 
 /*
  * Return the next index# for a stateid. Mostly just increment and return
  * the next one, but... if the 32bit unsigned does actually wrap around
  * (will a BSD server stay up that long?), find
  * new start and end values.
  */
 static u_int32_t
 nfsrv_nextstateindex(struct nfsclient *clp)
 {
 	struct nfsstate *stp;
 	int i;
 	u_int32_t canuse, min_index, max_index;
 
 	if (!(clp->lc_flags & LCL_INDEXNOTOK)) {
 		clp->lc_stateindex++;
 		if (clp->lc_stateindex != clp->lc_statemaxindex)
 			return (clp->lc_stateindex);
 	}
 
 	/*
 	 * Yuck, we've hit the end.
 	 * Look for a new min and max.
 	 */
 	min_index = 0;
 	max_index = 0xffffffff;
 	for (i = 0; i < NFSSTATEHASHSIZE; i++) {
 	    LIST_FOREACH(stp, &clp->lc_stateid[i], ls_hash) {
 		if (stp->ls_stateid.other[2] > 0x80000000) {
 		    if (stp->ls_stateid.other[2] < max_index)
 			max_index = stp->ls_stateid.other[2];
 		} else {
 		    if (stp->ls_stateid.other[2] > min_index)
 			min_index = stp->ls_stateid.other[2];
 		}
 	    }
 	}
 
 	/*
 	 * Yikes, highly unlikely, but I'll handle it anyhow.
 	 */
 	if (min_index == 0x80000000 && max_index == 0x80000001) {
 	    canuse = 0;
 	    /*
 	     * Loop around until we find an unused entry. Return that
 	     * and set LCL_INDEXNOTOK, so the search will continue next time.
 	     * (This is one of those rare cases where a goto is the
 	     *  cleanest way to code the loop.)
 	     */
 tryagain:
 	    for (i = 0; i < NFSSTATEHASHSIZE; i++) {
 		LIST_FOREACH(stp, &clp->lc_stateid[i], ls_hash) {
 		    if (stp->ls_stateid.other[2] == canuse) {
 			canuse++;
 			goto tryagain;
 		    }
 		}
 	    }
 	    clp->lc_flags |= LCL_INDEXNOTOK;
 	    return (canuse);
 	}
 
 	/*
 	 * Ok to start again from min + 1.
 	 */
 	clp->lc_stateindex = min_index + 1;
 	clp->lc_statemaxindex = max_index;
 	clp->lc_flags &= ~LCL_INDEXNOTOK;
 	return (clp->lc_stateindex);
 }
 
 /*
  * The following functions handle the stable storage file that deals with
  * the edge conditions described in RFC3530 Sec. 8.6.3.
  * The file is as follows:
  * - a single record at the beginning that has the lease time of the
  *   previous server instance (before the last reboot) and the nfsrvboottime
  *   values for the previous server boots.
  *   These previous boot times are used to ensure that the current
  *   nfsrvboottime does not, somehow, get set to a previous one.
  *   (This is important so that Stale ClientIDs and StateIDs can
  *    be recognized.)
  *   The number of previous nfsvrboottime values preceeds the list.
  * - followed by some number of appended records with:
  *   - client id string
  *   - flag that indicates it is a record revoking state via lease
  *     expiration or similar
  *     OR has successfully acquired state.
  * These structures vary in length, with the client string at the end, up
  * to NFSV4_OPAQUELIMIT in size.
  *
  * At the end of the grace period, the file is truncated, the first
  * record is rewritten with updated information and any acquired state
  * records for successful reclaims of state are written.
  *
  * Subsequent records are appended when the first state is issued to
  * a client and when state is revoked for a client.
  *
  * When reading the file in, state issued records that come later in
  * the file override older ones, since the append log is in cronological order.
  * If, for some reason, the file can't be read, the grace period is
  * immediately terminated and all reclaims get NFSERR_NOGRACE.
  */
 
 /*
  * Read in the stable storage file. Called by nfssvc() before the nfsd
  * processes start servicing requests.
  */
 APPLESTATIC void
 nfsrv_setupstable(NFSPROC_T *p)
 {
 	struct nfsrv_stablefirst *sf = &nfsrv_stablefirst;
 	struct nfsrv_stable *sp, *nsp;
 	struct nfst_rec *tsp;
 	int error, i, tryagain;
 	off_t off = 0;
 	ssize_t aresid, len;
 
 	/*
 	 * If NFSNSF_UPDATEDONE is set, this is a restart of the nfsds without
 	 * a reboot, so state has not been lost.
 	 */
 	if (sf->nsf_flags & NFSNSF_UPDATEDONE)
 		return;
 	/*
 	 * Set Grace over just until the file reads successfully.
 	 */
 	nfsrvboottime = time_second;
 	LIST_INIT(&sf->nsf_head);
 	sf->nsf_flags = (NFSNSF_GRACEOVER | NFSNSF_NEEDLOCK);
 	sf->nsf_eograce = NFSD_MONOSEC + NFSRV_LEASEDELTA;
 	if (sf->nsf_fp == NULL)
 		return;
 	error = NFSD_RDWR(UIO_READ, NFSFPVNODE(sf->nsf_fp),
 	    (caddr_t)&sf->nsf_rec, sizeof (struct nfsf_rec), off, UIO_SYSSPACE,
 	    0, NFSFPCRED(sf->nsf_fp), &aresid, p);
 	if (error || aresid || sf->nsf_numboots == 0 ||
 		sf->nsf_numboots > NFSNSF_MAXNUMBOOTS)
 		return;
 
 	/*
 	 * Now, read in the boottimes.
 	 */
 	sf->nsf_bootvals = (time_t *)malloc((sf->nsf_numboots + 1) *
 		sizeof (time_t), M_TEMP, M_WAITOK);
 	off = sizeof (struct nfsf_rec);
 	error = NFSD_RDWR(UIO_READ, NFSFPVNODE(sf->nsf_fp),
 	    (caddr_t)sf->nsf_bootvals, sf->nsf_numboots * sizeof (time_t), off,
 	    UIO_SYSSPACE, 0, NFSFPCRED(sf->nsf_fp), &aresid, p);
 	if (error || aresid) {
 		free((caddr_t)sf->nsf_bootvals, M_TEMP);
 		sf->nsf_bootvals = NULL;
 		return;
 	}
 
 	/*
 	 * Make sure this nfsrvboottime is different from all recorded
 	 * previous ones.
 	 */
 	do {
 		tryagain = 0;
 		for (i = 0; i < sf->nsf_numboots; i++) {
 			if (nfsrvboottime == sf->nsf_bootvals[i]) {
 				nfsrvboottime++;
 				tryagain = 1;
 				break;
 			}
 		}
 	} while (tryagain);
 
 	sf->nsf_flags |= NFSNSF_OK;
 	off += (sf->nsf_numboots * sizeof (time_t));
 
 	/*
 	 * Read through the file, building a list of records for grace
 	 * checking.
 	 * Each record is between sizeof (struct nfst_rec) and
 	 * sizeof (struct nfst_rec) + NFSV4_OPAQUELIMIT - 1
 	 * and is actually sizeof (struct nfst_rec) + nst_len - 1.
 	 */
 	tsp = (struct nfst_rec *)malloc(sizeof (struct nfst_rec) +
 		NFSV4_OPAQUELIMIT - 1, M_TEMP, M_WAITOK);
 	do {
 	    error = NFSD_RDWR(UIO_READ, NFSFPVNODE(sf->nsf_fp),
 	        (caddr_t)tsp, sizeof (struct nfst_rec) + NFSV4_OPAQUELIMIT - 1,
 	        off, UIO_SYSSPACE, 0, NFSFPCRED(sf->nsf_fp), &aresid, p);
 	    len = (sizeof (struct nfst_rec) + NFSV4_OPAQUELIMIT - 1) - aresid;
 	    if (error || (len > 0 && (len < sizeof (struct nfst_rec) ||
 		len < (sizeof (struct nfst_rec) + tsp->len - 1)))) {
 		/*
 		 * Yuck, the file has been corrupted, so just return
 		 * after clearing out any restart state, so the grace period
 		 * is over.
 		 */
 		LIST_FOREACH_SAFE(sp, &sf->nsf_head, nst_list, nsp) {
 			LIST_REMOVE(sp, nst_list);
 			free((caddr_t)sp, M_TEMP);
 		}
 		free((caddr_t)tsp, M_TEMP);
 		sf->nsf_flags &= ~NFSNSF_OK;
 		free((caddr_t)sf->nsf_bootvals, M_TEMP);
 		sf->nsf_bootvals = NULL;
 		return;
 	    }
 	    if (len > 0) {
 		off += sizeof (struct nfst_rec) + tsp->len - 1;
 		/*
 		 * Search the list for a matching client.
 		 */
 		LIST_FOREACH(sp, &sf->nsf_head, nst_list) {
 			if (tsp->len == sp->nst_len &&
 			    !NFSBCMP(tsp->client, sp->nst_client, tsp->len))
 				break;
 		}
 		if (sp == LIST_END(&sf->nsf_head)) {
 			sp = (struct nfsrv_stable *)malloc(tsp->len +
 				sizeof (struct nfsrv_stable) - 1, M_TEMP,
 				M_WAITOK);
 			NFSBCOPY((caddr_t)tsp, (caddr_t)&sp->nst_rec,
 				sizeof (struct nfst_rec) + tsp->len - 1);
 			LIST_INSERT_HEAD(&sf->nsf_head, sp, nst_list);
 		} else {
 			if (tsp->flag == NFSNST_REVOKE)
 				sp->nst_flag |= NFSNST_REVOKE;
 			else
 				/*
 				 * A subsequent timestamp indicates the client
 				 * did a setclientid/confirm and any previous
 				 * revoke is no longer relevant.
 				 */
 				sp->nst_flag &= ~NFSNST_REVOKE;
 		}
 	    }
 	} while (len > 0);
 	free((caddr_t)tsp, M_TEMP);
 	sf->nsf_flags = NFSNSF_OK;
 	sf->nsf_eograce = NFSD_MONOSEC + sf->nsf_lease +
 		NFSRV_LEASEDELTA;
 }
 
 /*
  * Update the stable storage file, now that the grace period is over.
  */
 APPLESTATIC void
 nfsrv_updatestable(NFSPROC_T *p)
 {
 	struct nfsrv_stablefirst *sf = &nfsrv_stablefirst;
 	struct nfsrv_stable *sp, *nsp;
 	int i;
 	struct nfsvattr nva;
 	vnode_t vp;
 #if defined(__FreeBSD_version) && (__FreeBSD_version >= 500000)
 	mount_t mp = NULL;
 #endif
 	int error;
 
 	if (sf->nsf_fp == NULL || (sf->nsf_flags & NFSNSF_UPDATEDONE))
 		return;
 	sf->nsf_flags |= NFSNSF_UPDATEDONE;
 	/*
 	 * Ok, we need to rewrite the stable storage file.
 	 * - truncate to 0 length
 	 * - write the new first structure
 	 * - loop through the data structures, writing out any that
 	 *   have timestamps older than the old boot
 	 */
 	if (sf->nsf_bootvals) {
 		sf->nsf_numboots++;
 		for (i = sf->nsf_numboots - 2; i >= 0; i--)
 			sf->nsf_bootvals[i + 1] = sf->nsf_bootvals[i];
 	} else {
 		sf->nsf_numboots = 1;
 		sf->nsf_bootvals = (time_t *)malloc(sizeof (time_t),
 			M_TEMP, M_WAITOK);
 	}
 	sf->nsf_bootvals[0] = nfsrvboottime;
 	sf->nsf_lease = nfsrv_lease;
 	NFSVNO_ATTRINIT(&nva);
 	NFSVNO_SETATTRVAL(&nva, size, 0);
 	vp = NFSFPVNODE(sf->nsf_fp);
 	vn_start_write(vp, &mp, V_WAIT);
 	if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) {
 		error = nfsvno_setattr(vp, &nva, NFSFPCRED(sf->nsf_fp), p,
 		    NULL);
 		NFSVOPUNLOCK(vp, 0);
 	} else
 		error = EPERM;
 	vn_finished_write(mp);
 	if (!error)
 	    error = NFSD_RDWR(UIO_WRITE, vp,
 		(caddr_t)&sf->nsf_rec, sizeof (struct nfsf_rec), (off_t)0,
 		UIO_SYSSPACE, IO_SYNC, NFSFPCRED(sf->nsf_fp), NULL, p);
 	if (!error)
 	    error = NFSD_RDWR(UIO_WRITE, vp,
 		(caddr_t)sf->nsf_bootvals,
 		sf->nsf_numboots * sizeof (time_t),
 		(off_t)(sizeof (struct nfsf_rec)),
 		UIO_SYSSPACE, IO_SYNC, NFSFPCRED(sf->nsf_fp), NULL, p);
 	free((caddr_t)sf->nsf_bootvals, M_TEMP);
 	sf->nsf_bootvals = NULL;
 	if (error) {
 		sf->nsf_flags &= ~NFSNSF_OK;
 		printf("EEK! Can't write NfsV4 stable storage file\n");
 		return;
 	}
 	sf->nsf_flags |= NFSNSF_OK;
 
 	/*
 	 * Loop through the list and write out timestamp records for
 	 * any clients that successfully reclaimed state.
 	 */
 	LIST_FOREACH_SAFE(sp, &sf->nsf_head, nst_list, nsp) {
 		if (sp->nst_flag & NFSNST_GOTSTATE) {
 			nfsrv_writestable(sp->nst_client, sp->nst_len,
 				NFSNST_NEWSTATE, p);
 			sp->nst_clp->lc_flags |= LCL_STAMPEDSTABLE;
 		}
 		LIST_REMOVE(sp, nst_list);
 		free((caddr_t)sp, M_TEMP);
 	}
 	nfsrv_backupstable();
 }
 
 /*
  * Append a record to the stable storage file.
  */
 APPLESTATIC void
 nfsrv_writestable(u_char *client, int len, int flag, NFSPROC_T *p)
 {
 	struct nfsrv_stablefirst *sf = &nfsrv_stablefirst;
 	struct nfst_rec *sp;
 	int error;
 
 	if (!(sf->nsf_flags & NFSNSF_OK) || sf->nsf_fp == NULL)
 		return;
 	sp = (struct nfst_rec *)malloc(sizeof (struct nfst_rec) +
 		len - 1, M_TEMP, M_WAITOK);
 	sp->len = len;
 	NFSBCOPY(client, sp->client, len);
 	sp->flag = flag;
 	error = NFSD_RDWR(UIO_WRITE, NFSFPVNODE(sf->nsf_fp),
 	    (caddr_t)sp, sizeof (struct nfst_rec) + len - 1, (off_t)0,
 	    UIO_SYSSPACE, (IO_SYNC | IO_APPEND), NFSFPCRED(sf->nsf_fp), NULL, p);
 	free((caddr_t)sp, M_TEMP);
 	if (error) {
 		sf->nsf_flags &= ~NFSNSF_OK;
 		printf("EEK! Can't write NfsV4 stable storage file\n");
 	}
 }
 
 /*
  * This function is called during the grace period to mark a client
  * that successfully reclaimed state.
  */
 static void
 nfsrv_markstable(struct nfsclient *clp)
 {
 	struct nfsrv_stable *sp;
 
 	/*
 	 * First find the client structure.
 	 */
 	LIST_FOREACH(sp, &nfsrv_stablefirst.nsf_head, nst_list) {
 		if (sp->nst_len == clp->lc_idlen &&
 		    !NFSBCMP(sp->nst_client, clp->lc_id, sp->nst_len))
 			break;
 	}
 	if (sp == LIST_END(&nfsrv_stablefirst.nsf_head))
 		return;
 
 	/*
 	 * Now, just mark it and set the nfsclient back pointer.
 	 */
 	sp->nst_flag |= NFSNST_GOTSTATE;
 	sp->nst_clp = clp;
 }
 
 /*
  * This function is called for a reclaim, to see if it gets grace.
  * It returns 0 if a reclaim is allowed, 1 otherwise.
  */
 static int
 nfsrv_checkstable(struct nfsclient *clp)
 {
 	struct nfsrv_stable *sp;
 
 	/*
 	 * First, find the entry for the client.
 	 */
 	LIST_FOREACH(sp, &nfsrv_stablefirst.nsf_head, nst_list) {
 		if (sp->nst_len == clp->lc_idlen &&
 		    !NFSBCMP(sp->nst_client, clp->lc_id, sp->nst_len))
 			break;
 	}
 
 	/*
 	 * If not in the list, state was revoked or no state was issued
 	 * since the previous reboot, a reclaim is denied.
 	 */
 	if (sp == LIST_END(&nfsrv_stablefirst.nsf_head) ||
 	    (sp->nst_flag & NFSNST_REVOKE) ||
 	    !(nfsrv_stablefirst.nsf_flags & NFSNSF_OK))
 		return (1);
 	return (0);
 }
 
 /*
  * Test for and try to clear out a conflicting client. This is called by
  * nfsrv_lockctrl() and nfsrv_openctrl() when conflicts with other clients
  * a found.
  * The trick here is that it can't revoke a conflicting client with an
  * expired lease unless it holds the v4root lock, so...
  * If no v4root lock, get the lock and return 1 to indicate "try again".
  * Return 0 to indicate the conflict can't be revoked and 1 to indicate
  * the revocation worked and the conflicting client is "bye, bye", so it
  * can be tried again.
  * Return 2 to indicate that the vnode is VI_DOOMED after NFSVOPLOCK().
  * Unlocks State before a non-zero value is returned.
  */
 static int
 nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, vnode_t vp,
     NFSPROC_T *p)
 {
-	int gotlock, lktype;
+	int gotlock, lktype = 0;
 
 	/*
 	 * If lease hasn't expired, we can't fix it.
 	 */
 	if (clp->lc_expiry >= NFSD_MONOSEC ||
 	    !(nfsrv_stablefirst.nsf_flags & NFSNSF_UPDATEDONE))
 		return (0);
 	if (*haslockp == 0) {
 		NFSUNLOCKSTATE();
-		lktype = NFSVOPISLOCKED(vp);
-		NFSVOPUNLOCK(vp, 0);
+		if (vp != NULL) {
+			lktype = NFSVOPISLOCKED(vp);
+			NFSVOPUNLOCK(vp, 0);
+		}
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_relref(&nfsv4rootfs_lock);
 		do {
 			gotlock = nfsv4_lock(&nfsv4rootfs_lock, 1, NULL,
 			    NFSV4ROOTLOCKMUTEXPTR, NULL);
 		} while (!gotlock);
 		NFSUNLOCKV4ROOTMUTEX();
 		*haslockp = 1;
-		NFSVOPLOCK(vp, lktype | LK_RETRY);
-		if ((vp->v_iflag & VI_DOOMED) != 0)
-			return (2);
-		else
-			return (1);
+		if (vp != NULL) {
+			NFSVOPLOCK(vp, lktype | LK_RETRY);
+			if ((vp->v_iflag & VI_DOOMED) != 0)
+				return (2);
+		}
+		return (1);
 	}
 	NFSUNLOCKSTATE();
 
 	/*
 	 * Ok, we can expire the conflicting client.
 	 */
 	nfsrv_writestable(clp->lc_id, clp->lc_idlen, NFSNST_REVOKE, p);
 	nfsrv_backupstable();
 	nfsrv_cleanclient(clp, p);
 	nfsrv_freedeleglist(&clp->lc_deleg);
 	nfsrv_freedeleglist(&clp->lc_olddeleg);
 	LIST_REMOVE(clp, lc_hash);
 	nfsrv_zapclient(clp, p);
 	return (1);
 }
 
 /*
  * Resolve a delegation conflict.
  * Returns 0 to indicate the conflict was resolved without sleeping.
  * Return -1 to indicate that the caller should check for conflicts again.
  * Return > 0 for an error that should be returned, normally NFSERR_DELAY.
  *
  * Also, manipulate the nfsv4root_lock, as required. It isn't changed
  * for a return of 0, since there was no sleep and it could be required
  * later. It is released for a return of NFSERR_DELAY, since the caller
  * will return that error. It is released when a sleep was done waiting
  * for the delegation to be returned or expire (so that other nfsds can
  * handle ops). Then, it must be acquired for the write to stable storage.
  * (This function is somewhat similar to nfsrv_clientconflict(), but
  *  the semantics differ in a couple of subtle ways. The return of 0
  *  indicates the conflict was resolved without sleeping here, not
  *  that the conflict can't be resolved and the handling of nfsv4root_lock
  *  differs, as noted above.)
  * Unlocks State before returning a non-zero value.
  */
 static int
 nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p,
     vnode_t vp)
 {
 	struct nfsclient *clp = stp->ls_clp;
-	int gotlock, error, lktype, retrycnt, zapped_clp;
+	int gotlock, error, lktype = 0, retrycnt, zapped_clp;
 	nfsv4stateid_t tstateid;
 	fhandle_t tfh;
 
 	/*
 	 * If the conflict is with an old delegation...
 	 */
 	if (stp->ls_flags & NFSLCK_OLDDELEG) {
 		/*
 		 * You can delete it, if it has expired.
 		 */
 		if (clp->lc_delegtime < NFSD_MONOSEC) {
 			nfsrv_freedeleg(stp);
 			NFSUNLOCKSTATE();
 			error = -1;
 			goto out;
 		}
 		NFSUNLOCKSTATE();
 		/*
 		 * During this delay, the old delegation could expire or it
 		 * could be recovered by the client via an Open with
 		 * CLAIM_DELEGATE_PREV.
 		 * Release the nfsv4root_lock, if held.
 		 */
 		if (*haslockp) {
 			*haslockp = 0;
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		error = NFSERR_DELAY;
 		goto out;
 	}
 
 	/*
 	 * It's a current delegation, so:
 	 * - check to see if the delegation has expired
 	 *   - if so, get the v4root lock and then expire it
 	 */
 	if (!(stp->ls_flags & NFSLCK_DELEGRECALL)) {
 		/*
 		 * - do a recall callback, since not yet done
 		 * For now, never allow truncate to be set. To use
 		 * truncate safely, it must be guaranteed that the
 		 * Remove, Rename or Setattr with size of 0 will
 		 * succeed and that would require major changes to
 		 * the VFS/Vnode OPs.
 		 * Set the expiry time large enough so that it won't expire
 		 * until after the callback, then set it correctly, once
 		 * the callback is done. (The delegation will now time
 		 * out whether or not the Recall worked ok. The timeout
 		 * will be extended when ops are done on the delegation
 		 * stateid, up to the timelimit.)
 		 */
 		stp->ls_delegtime = NFSD_MONOSEC + (2 * nfsrv_lease) +
 		    NFSRV_LEASEDELTA;
 		stp->ls_delegtimelimit = NFSD_MONOSEC + (6 * nfsrv_lease) +
 		    NFSRV_LEASEDELTA;
 		stp->ls_flags |= NFSLCK_DELEGRECALL;
 
 		/*
 		 * Loop NFSRV_CBRETRYCNT times while the CBRecall replies
 		 * NFSERR_BADSTATEID or NFSERR_BADHANDLE. This is done
 		 * in order to try and avoid a race that could happen
 		 * when a CBRecall request passed the Open reply with
 		 * the delegation in it when transitting the network.
 		 * Since nfsrv_docallback will sleep, don't use stp after
 		 * the call.
 		 */
 		NFSBCOPY((caddr_t)&stp->ls_stateid, (caddr_t)&tstateid,
 		    sizeof (tstateid));
 		NFSBCOPY((caddr_t)&stp->ls_lfp->lf_fh, (caddr_t)&tfh,
 		    sizeof (tfh));
 		NFSUNLOCKSTATE();
 		if (*haslockp) {
 			*haslockp = 0;
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		retrycnt = 0;
 		do {
 		    error = nfsrv_docallback(clp, NFSV4OP_CBRECALL,
 			&tstateid, 0, &tfh, NULL, NULL, p);
 		    retrycnt++;
 		} while ((error == NFSERR_BADSTATEID ||
 		    error == NFSERR_BADHANDLE) && retrycnt < NFSV4_CBRETRYCNT);
 		error = NFSERR_DELAY;
 		goto out;
 	}
 
 	if (clp->lc_expiry >= NFSD_MONOSEC &&
 	    stp->ls_delegtime >= NFSD_MONOSEC) {
 		NFSUNLOCKSTATE();
 		/*
 		 * A recall has been done, but it has not yet expired.
 		 * So, RETURN_DELAY.
 		 */
 		if (*haslockp) {
 			*haslockp = 0;
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		error = NFSERR_DELAY;
 		goto out;
 	}
 
 	/*
 	 * If we don't yet have the lock, just get it and then return,
 	 * since we need that before deleting expired state, such as
 	 * this delegation.
 	 * When getting the lock, unlock the vnode, so other nfsds that
 	 * are in progress, won't get stuck waiting for the vnode lock.
 	 */
 	if (*haslockp == 0) {
 		NFSUNLOCKSTATE();
-		lktype = NFSVOPISLOCKED(vp);
-		NFSVOPUNLOCK(vp, 0);
+		if (vp != NULL) {
+			lktype = NFSVOPISLOCKED(vp);
+			NFSVOPUNLOCK(vp, 0);
+		}
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_relref(&nfsv4rootfs_lock);
 		do {
 			gotlock = nfsv4_lock(&nfsv4rootfs_lock, 1, NULL,
 			    NFSV4ROOTLOCKMUTEXPTR, NULL);
 		} while (!gotlock);
 		NFSUNLOCKV4ROOTMUTEX();
 		*haslockp = 1;
-		NFSVOPLOCK(vp, lktype | LK_RETRY);
-		if ((vp->v_iflag & VI_DOOMED) != 0) {
-			*haslockp = 0;
-			NFSLOCKV4ROOTMUTEX();
-			nfsv4_unlock(&nfsv4rootfs_lock, 1);
-			NFSUNLOCKV4ROOTMUTEX();
-			error = NFSERR_PERM;
-			goto out;
+		if (vp != NULL) {
+			NFSVOPLOCK(vp, lktype | LK_RETRY);
+			if ((vp->v_iflag & VI_DOOMED) != 0) {
+				*haslockp = 0;
+				NFSLOCKV4ROOTMUTEX();
+				nfsv4_unlock(&nfsv4rootfs_lock, 1);
+				NFSUNLOCKV4ROOTMUTEX();
+				error = NFSERR_PERM;
+				goto out;
+			}
 		}
 		error = -1;
 		goto out;
 	}
 
 	NFSUNLOCKSTATE();
 	/*
 	 * Ok, we can delete the expired delegation.
 	 * First, write the Revoke record to stable storage and then
 	 * clear out the conflict.
 	 * Since all other nfsd threads are now blocked, we can safely
 	 * sleep without the state changing.
 	 */
 	nfsrv_writestable(clp->lc_id, clp->lc_idlen, NFSNST_REVOKE, p);
 	nfsrv_backupstable();
 	if (clp->lc_expiry < NFSD_MONOSEC) {
 		nfsrv_cleanclient(clp, p);
 		nfsrv_freedeleglist(&clp->lc_deleg);
 		nfsrv_freedeleglist(&clp->lc_olddeleg);
 		LIST_REMOVE(clp, lc_hash);
 		zapped_clp = 1;
 	} else {
 		nfsrv_freedeleg(stp);
 		zapped_clp = 0;
 	}
 	if (zapped_clp)
 		nfsrv_zapclient(clp, p);
 	error = -1;
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Check for a remove allowed, if remove is set to 1 and get rid of
  * delegations.
  */
 APPLESTATIC int
 nfsrv_checkremove(vnode_t vp, int remove, NFSPROC_T *p)
 {
 	struct nfsstate *stp;
 	struct nfslockfile *lfp;
 	int error, haslock = 0;
 	fhandle_t nfh;
 
 	/*
 	 * First, get the lock file structure.
 	 * (A return of -1 means no associated state, so remove ok.)
 	 */
 	error = nfsrv_getlockfh(vp, NFSLCK_CHECK, NULL, &nfh, p);
 tryagain:
 	NFSLOCKSTATE();
 	if (!error)
 		error = nfsrv_getlockfile(NFSLCK_CHECK, NULL, &lfp, &nfh, 0);
 	if (error) {
 		NFSUNLOCKSTATE();
 		if (haslock) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		if (error == -1)
 			error = 0;
 		goto out;
 	}
 
 	/*
 	 * Now, we must Recall any delegations.
 	 */
 	error = nfsrv_cleandeleg(vp, lfp, NULL, &haslock, p);
 	if (error) {
 		/*
 		 * nfsrv_cleandeleg() unlocks state for non-zero
 		 * return.
 		 */
 		if (error == -1)
 			goto tryagain;
 		if (haslock) {
 			NFSLOCKV4ROOTMUTEX();
 			nfsv4_unlock(&nfsv4rootfs_lock, 1);
 			NFSUNLOCKV4ROOTMUTEX();
 		}
 		goto out;
 	}
 
 	/*
 	 * Now, look for a conflicting open share.
 	 */
 	if (remove) {
 		/*
 		 * If the entry in the directory was the last reference to the
 		 * corresponding filesystem object, the object can be destroyed
 		 * */
 		if(lfp->lf_usecount>1)
 			LIST_FOREACH(stp, &lfp->lf_open, ls_file) {
 				if (stp->ls_flags & NFSLCK_WRITEDENY) {
 					error = NFSERR_FILEOPEN;
 					break;
 				}
 			}
 	}
 
 	NFSUNLOCKSTATE();
 	if (haslock) {
 		NFSLOCKV4ROOTMUTEX();
 		nfsv4_unlock(&nfsv4rootfs_lock, 1);
 		NFSUNLOCKV4ROOTMUTEX();
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Clear out all delegations for the file referred to by lfp.
  * May return NFSERR_DELAY, if there will be a delay waiting for
  * delegations to expire.
  * Returns -1 to indicate it slept while recalling a delegation.
  * This function has the side effect of deleting the nfslockfile structure,
  * if it no longer has associated state and didn't have to sleep.
  * Unlocks State before a non-zero value is returned.
  */
 static int
 nfsrv_cleandeleg(vnode_t vp, struct nfslockfile *lfp,
     struct nfsclient *clp, int *haslockp, NFSPROC_T *p)
 {
 	struct nfsstate *stp, *nstp;
 	int ret = 0;
 
 	stp = LIST_FIRST(&lfp->lf_deleg);
 	while (stp != LIST_END(&lfp->lf_deleg)) {
 		nstp = LIST_NEXT(stp, ls_file);
 		if (stp->ls_clp != clp) {
 			ret = nfsrv_delegconflict(stp, haslockp, p, vp);
 			if (ret) {
 				/*
 				 * nfsrv_delegconflict() unlocks state
 				 * when it returns non-zero.
 				 */
 				goto out;
 			}
 		}
 		stp = nstp;
 	}
 out:
 	NFSEXITCODE(ret);
 	return (ret);
 }
 
 /*
  * There are certain operations that, when being done outside of NFSv4,
  * require that any NFSv4 delegation for the file be recalled.
  * This function is to be called for those cases:
  * VOP_RENAME() - When a delegation is being recalled for any reason,
  *	the client may have to do Opens against the server, using the file's
  *	final component name. If the file has been renamed on the server,
  *	that component name will be incorrect and the Open will fail.
  * VOP_REMOVE() - Theoretically, a client could Open a file after it has
  *	been removed on the server, if there is a delegation issued to
  *	that client for the file. I say "theoretically" since clients
  *	normally do an Access Op before the Open and that Access Op will
  *	fail with ESTALE. Note that NFSv2 and 3 don't even do Opens, so
  *	they will detect the file's removal in the same manner. (There is
  *	one case where RFC3530 allows a client to do an Open without first
  *	doing an Access Op, which is passage of a check against the ACE
  *	returned with a Write delegation, but current practice is to ignore
  *	the ACE and always do an Access Op.)
  *	Since the functions can only be called with an unlocked vnode, this
  *	can't be done at this time.
  * VOP_ADVLOCK() - When a client holds a delegation, it can issue byte range
  *	locks locally in the client, which are not visible to the server. To
  *	deal with this, issuing of delegations for a vnode must be disabled
  *	and all delegations for the vnode recalled. This is done via the
  *	second function, using the VV_DISABLEDELEG vflag on the vnode.
  */
 APPLESTATIC void
 nfsd_recalldelegation(vnode_t vp, NFSPROC_T *p)
 {
 	time_t starttime;
 	int error;
 
 	/*
 	 * First, check to see if the server is currently running and it has
 	 * been called for a regular file when issuing delegations.
 	 */
 	if (newnfs_numnfsd == 0 || vp->v_type != VREG ||
 	    nfsrv_issuedelegs == 0)
 		return;
 
 	KASSERT((NFSVOPISLOCKED(vp) != LK_EXCLUSIVE), ("vp %p is locked", vp));
 	/*
 	 * First, get a reference on the nfsv4rootfs_lock so that an
 	 * exclusive lock cannot be acquired by another thread.
 	 */
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_getref(&nfsv4rootfs_lock, NULL, NFSV4ROOTLOCKMUTEXPTR, NULL);
 	NFSUNLOCKV4ROOTMUTEX();
 
 	/*
 	 * Now, call nfsrv_checkremove() in a loop while it returns
 	 * NFSERR_DELAY. Return upon any other error or when timed out.
 	 */
 	starttime = NFSD_MONOSEC;
 	do {
 		if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) {
 			error = nfsrv_checkremove(vp, 0, p);
 			NFSVOPUNLOCK(vp, 0);
 		} else
 			error = EPERM;
 		if (error == NFSERR_DELAY) {
 			if (NFSD_MONOSEC - starttime > NFS_REMOVETIMEO)
 				break;
 			/* Sleep for a short period of time */
 			(void) nfs_catnap(PZERO, 0, "nfsremove");
 		}
 	} while (error == NFSERR_DELAY);
 	NFSLOCKV4ROOTMUTEX();
 	nfsv4_relref(&nfsv4rootfs_lock);
 	NFSUNLOCKV4ROOTMUTEX();
 }
 
 APPLESTATIC void
 nfsd_disabledelegation(vnode_t vp, NFSPROC_T *p)
 {
 
 #ifdef VV_DISABLEDELEG
 	/*
 	 * First, flag issuance of delegations disabled.
 	 */
 	atomic_set_long(&vp->v_vflag, VV_DISABLEDELEG);
 #endif
 
 	/*
 	 * Then call nfsd_recalldelegation() to get rid of all extant
 	 * delegations.
 	 */
 	nfsd_recalldelegation(vp, p);
 }
 
 /*
  * Check for conflicting locks, etc. and then get rid of delegations.
  * (At one point I thought that I should get rid of delegations for any
  *  Setattr, since it could potentially disallow the I/O op (read or write)
  *  allowed by the delegation. However, Setattr Ops that aren't changing
  *  the size get a stateid of all 0s, so you can't tell if it is a delegation
  *  for the same client or a different one, so I decided to only get rid
  *  of delegations for other clients when the size is being changed.)
  * In general, a Setattr can disable NFS I/O Ops that are outstanding, such
  * as Write backs, even if there is no delegation, so it really isn't any
  * different?)
  */
 APPLESTATIC int
 nfsrv_checksetattr(vnode_t vp, struct nfsrv_descript *nd,
     nfsv4stateid_t *stateidp, struct nfsvattr *nvap, nfsattrbit_t *attrbitp,
     struct nfsexstuff *exp, NFSPROC_T *p)
 {
 	struct nfsstate st, *stp = &st;
 	struct nfslock lo, *lop = &lo;
 	int error = 0;
 	nfsquad_t clientid;
 
 	if (NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_SIZE)) {
 		stp->ls_flags = (NFSLCK_CHECK | NFSLCK_WRITEACCESS);
 		lop->lo_first = nvap->na_size;
 	} else {
 		stp->ls_flags = 0;
 		lop->lo_first = 0;
 	}
 	if (NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_OWNER) ||
 	    NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_OWNERGROUP) ||
 	    NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_MODE) ||
 	    NFSISSET_ATTRBIT(attrbitp, NFSATTRBIT_ACL))
 		stp->ls_flags |= NFSLCK_SETATTR;
 	if (stp->ls_flags == 0)
 		goto out;
 	lop->lo_end = NFS64BITSSET;
 	lop->lo_flags = NFSLCK_WRITE;
 	stp->ls_ownerlen = 0;
 	stp->ls_op = NULL;
 	stp->ls_uid = nd->nd_cred->cr_uid;
 	stp->ls_stateid.seqid = stateidp->seqid;
 	clientid.lval[0] = stp->ls_stateid.other[0] = stateidp->other[0];
 	clientid.lval[1] = stp->ls_stateid.other[1] = stateidp->other[1];
 	stp->ls_stateid.other[2] = stateidp->other[2];
 	error = nfsrv_lockctrl(vp, &stp, &lop, NULL, clientid,
 	    stateidp, exp, nd, p);
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * Check for a write delegation and do a CBGETATTR if there is one, updating
  * the attributes, as required.
  * Should I return an error if I can't get the attributes? (For now, I'll
  * just return ok.
  */
 APPLESTATIC int
 nfsrv_checkgetattr(struct nfsrv_descript *nd, vnode_t vp,
     struct nfsvattr *nvap, nfsattrbit_t *attrbitp, struct ucred *cred,
     NFSPROC_T *p)
 {
 	struct nfsstate *stp;
 	struct nfslockfile *lfp;
 	struct nfsclient *clp;
 	struct nfsvattr nva;
 	fhandle_t nfh;
 	int error = 0;
 	nfsattrbit_t cbbits;
 	u_quad_t delegfilerev;
 
 	NFSCBGETATTR_ATTRBIT(attrbitp, &cbbits);
 	if (!NFSNONZERO_ATTRBIT(&cbbits))
 		goto out;
 
 	/*
 	 * Get the lock file structure.
 	 * (A return of -1 means no associated state, so return ok.)
 	 */
 	error = nfsrv_getlockfh(vp, NFSLCK_CHECK, NULL, &nfh, p);
 	NFSLOCKSTATE();
 	if (!error)
 		error = nfsrv_getlockfile(NFSLCK_CHECK, NULL, &lfp, &nfh, 0);
 	if (error) {
 		NFSUNLOCKSTATE();
 		if (error == -1)
 			error = 0;
 		goto out;
 	}
 
 	/*
 	 * Now, look for a write delegation.
 	 */
 	LIST_FOREACH(stp, &lfp->lf_deleg, ls_file) {
 		if (stp->ls_flags & NFSLCK_DELEGWRITE)
 			break;
 	}
 	if (stp == LIST_END(&lfp->lf_deleg)) {
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 	clp = stp->ls_clp;
 	delegfilerev = stp->ls_filerev;
 
 	/*
 	 * If the Write delegation was issued as a part of this Compound RPC
 	 * or if we have an Implied Clientid (used in a previous Op in this
 	 * compound) and it is the client the delegation was issued to,
 	 * just return ok.
 	 * I also assume that it is from the same client iff the network
 	 * host IP address is the same as the callback address. (Not
 	 * exactly correct by the RFC, but avoids a lot of Getattr
 	 * callbacks.)
 	 */
 	if (nd->nd_compref == stp->ls_compref ||
 	    ((nd->nd_flag & ND_IMPLIEDCLID) &&
 	     clp->lc_clientid.qval == nd->nd_clientid.qval) ||
 	     nfsaddr2_match(clp->lc_req.nr_nam, nd->nd_nam)) {
 		NFSUNLOCKSTATE();
 		goto out;
 	}
 
 	/*
 	 * We are now done with the delegation state structure,
 	 * so the statelock can be released and we can now tsleep().
 	 */
 
 	/*
 	 * Now, we must do the CB Getattr callback, to see if Change or Size
 	 * has changed.
 	 */
 	if (clp->lc_expiry >= NFSD_MONOSEC) {
 		NFSUNLOCKSTATE();
 		NFSVNO_ATTRINIT(&nva);
 		nva.na_filerev = NFS64BITSSET;
 		error = nfsrv_docallback(clp, NFSV4OP_CBGETATTR, NULL,
 		    0, &nfh, &nva, &cbbits, p);
 		if (!error) {
 			if ((nva.na_filerev != NFS64BITSSET &&
 			    nva.na_filerev > delegfilerev) ||
 			    (NFSVNO_ISSETSIZE(&nva) &&
 			     nva.na_size != nvap->na_size)) {
 				error = nfsvno_updfilerev(vp, nvap, cred, p);
 				if (NFSVNO_ISSETSIZE(&nva))
 					nvap->na_size = nva.na_size;
 			}
 		} else
 			error = 0;	/* Ignore callback errors for now. */
 	} else {
 		NFSUNLOCKSTATE();
 	}
 
 out:
 	NFSEXITCODE2(error, nd);
 	return (error);
 }
 
 /*
  * This function looks for openowners that haven't had any opens for
  * a while and throws them away. Called by an nfsd when NFSNSF_NOOPENS
  * is set.
  */
 APPLESTATIC void
 nfsrv_throwawayopens(NFSPROC_T *p)
 {
 	struct nfsclient *clp, *nclp;
 	struct nfsstate *stp, *nstp;
 	int i;
 
 	NFSLOCKSTATE();
 	nfsrv_stablefirst.nsf_flags &= ~NFSNSF_NOOPENS;
 	/*
 	 * For each client...
 	 */
 	for (i = 0; i < NFSCLIENTHASHSIZE; i++) {
 	    LIST_FOREACH_SAFE(clp, &nfsclienthash[i], lc_hash, nclp) {
 		LIST_FOREACH_SAFE(stp, &clp->lc_open, ls_list, nstp) {
 			if (LIST_EMPTY(&stp->ls_open) &&
 			    (stp->ls_noopens > NFSNOOPEN ||
 			     (nfsrv_openpluslock * 2) >
 			     NFSRV_V4STATELIMIT))
 				nfsrv_freeopenowner(stp, 0, p);
 		}
 	    }
 	}
 	NFSUNLOCKSTATE();
 }
 
 /*
  * This function checks to see if the credentials are the same.
  * Returns 1 for not same, 0 otherwise.
  */
 static int
 nfsrv_notsamecredname(struct nfsrv_descript *nd, struct nfsclient *clp)
 {
 
 	if (nd->nd_flag & ND_GSS) {
 		if (!(clp->lc_flags & LCL_GSS))
 			return (1);
 		if (clp->lc_flags & LCL_NAME) {
 			if (nd->nd_princlen != clp->lc_namelen ||
 			    NFSBCMP(nd->nd_principal, clp->lc_name,
 				clp->lc_namelen))
 				return (1);
 			else
 				return (0);
 		}
 		if (nd->nd_cred->cr_uid == clp->lc_uid)
 			return (0);
 		else
 			return (1);
 	} else if (clp->lc_flags & LCL_GSS)
 		return (1);
 	/*
 	 * For AUTH_SYS, allow the same uid or root. (This is underspecified
 	 * in RFC3530, which talks about principals, but doesn't say anything
 	 * about uids for AUTH_SYS.)
 	 */
 	if (nd->nd_cred->cr_uid == clp->lc_uid || nd->nd_cred->cr_uid == 0)
 		return (0);
 	else
 		return (1);
 }
 
 /*
  * Calculate the lease expiry time.
  */
 static time_t
 nfsrv_leaseexpiry(void)
 {
 
 	if (nfsrv_stablefirst.nsf_eograce > NFSD_MONOSEC)
 		return (NFSD_MONOSEC + 2 * (nfsrv_lease + NFSRV_LEASEDELTA));
 	return (NFSD_MONOSEC + nfsrv_lease + NFSRV_LEASEDELTA);
 }
 
 /*
  * Delay the delegation timeout as far as ls_delegtimelimit, as required.
  */
 static void
 nfsrv_delaydelegtimeout(struct nfsstate *stp)
 {
 
 	if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0)
 		return;
 
 	if ((stp->ls_delegtime + 15) > NFSD_MONOSEC &&
 	    stp->ls_delegtime < stp->ls_delegtimelimit) {
 		stp->ls_delegtime += nfsrv_lease;
 		if (stp->ls_delegtime > stp->ls_delegtimelimit)
 			stp->ls_delegtime = stp->ls_delegtimelimit;
 	}
 }
 
 /*
  * This function checks to see if there is any other state associated
  * with the openowner for this Open.
  * It returns 1 if there is no other state, 0 otherwise.
  */
 static int
 nfsrv_nootherstate(struct nfsstate *stp)
 {
 	struct nfsstate *tstp;
 
 	LIST_FOREACH(tstp, &stp->ls_openowner->ls_open, ls_list) {
 		if (tstp != stp || !LIST_EMPTY(&tstp->ls_lock))
 			return (0);
 	}
 	return (1);
 }
 
 /*
  * Create a list of lock deltas (changes to local byte range locking
  * that can be rolled back using the list) and apply the changes via
  * nfsvno_advlock(). Optionally, lock the list. It is expected that either
  * the rollback or update function will be called after this.
  * It returns an error (and rolls back, as required), if any nfsvno_advlock()
  * call fails. If it returns an error, it will unlock the list.
  */
 static int
 nfsrv_locallock(vnode_t vp, struct nfslockfile *lfp, int flags,
     uint64_t first, uint64_t end, struct nfslockconflict *cfp, NFSPROC_T *p)
 {
 	struct nfslock *lop, *nlop;
 	int error = 0;
 
 	/* Loop through the list of locks. */
 	lop = LIST_FIRST(&lfp->lf_locallock);
 	while (first < end && lop != NULL) {
 		nlop = LIST_NEXT(lop, lo_lckowner);
 		if (first >= lop->lo_end) {
 			/* not there yet */
 			lop = nlop;
 		} else if (first < lop->lo_first) {
 			/* new one starts before entry in list */
 			if (end <= lop->lo_first) {
 				/* no overlap between old and new */
 				error = nfsrv_dolocal(vp, lfp, flags,
 				    NFSLCK_UNLOCK, first, end, cfp, p);
 				if (error != 0)
 					break;
 				first = end;
 			} else {
 				/* handle fragment overlapped with new one */
 				error = nfsrv_dolocal(vp, lfp, flags,
 				    NFSLCK_UNLOCK, first, lop->lo_first, cfp,
 				    p);
 				if (error != 0)
 					break;
 				first = lop->lo_first;
 			}
 		} else {
 			/* new one overlaps this entry in list */
 			if (end <= lop->lo_end) {
 				/* overlaps all of new one */
 				error = nfsrv_dolocal(vp, lfp, flags,
 				    lop->lo_flags, first, end, cfp, p);
 				if (error != 0)
 					break;
 				first = end;
 			} else {
 				/* handle fragment overlapped with new one */
 				error = nfsrv_dolocal(vp, lfp, flags,
 				    lop->lo_flags, first, lop->lo_end, cfp, p);
 				if (error != 0)
 					break;
 				first = lop->lo_end;
 				lop = nlop;
 			}
 		}
 	}
 	if (first < end && error == 0)
 		/* handle fragment past end of list */
 		error = nfsrv_dolocal(vp, lfp, flags, NFSLCK_UNLOCK, first,
 		    end, cfp, p);
 
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Local lock unlock. Unlock all byte ranges that are no longer locked
  * by NFSv4. To do this, unlock any subranges of first-->end that
  * do not overlap with the byte ranges of any lock in the lfp->lf_lock
  * list. This list has all locks for the file held by other
  *  tuples. The list is ordered by increasing
  * lo_first value, but may have entries that overlap each other, for
  * the case of read locks.
  */
 static void
 nfsrv_localunlock(vnode_t vp, struct nfslockfile *lfp, uint64_t init_first,
     uint64_t init_end, NFSPROC_T *p)
 {
 	struct nfslock *lop;
 	uint64_t first, end, prevfirst;
 
 	first = init_first;
 	end = init_end;
 	while (first < init_end) {
 		/* Loop through all nfs locks, adjusting first and end */
 		prevfirst = 0;
 		LIST_FOREACH(lop, &lfp->lf_lock, lo_lckfile) {
 			KASSERT(prevfirst <= lop->lo_first,
 			    ("nfsv4 locks out of order"));
 			KASSERT(lop->lo_first < lop->lo_end,
 			    ("nfsv4 bogus lock"));
 			prevfirst = lop->lo_first;
 			if (first >= lop->lo_first &&
 			    first < lop->lo_end)
 				/*
 				 * Overlaps with initial part, so trim
 				 * off that initial part by moving first past
 				 * it.
 				 */
 				first = lop->lo_end;
 			else if (end > lop->lo_first &&
 			    lop->lo_first > first) {
 				/*
 				 * This lock defines the end of the
 				 * segment to unlock, so set end to the
 				 * start of it and break out of the loop.
 				 */
 				end = lop->lo_first;
 				break;
 			}
 			if (first >= end)
 				/*
 				 * There is no segment left to do, so
 				 * break out of this loop and then exit
 				 * the outer while() since first will be set
 				 * to end, which must equal init_end here.
 				 */
 				break;
 		}
 		if (first < end) {
 			/* Unlock this segment */
 			(void) nfsrv_dolocal(vp, lfp, NFSLCK_UNLOCK,
 			    NFSLCK_READ, first, end, NULL, p);
 			nfsrv_locallock_commit(lfp, NFSLCK_UNLOCK,
 			    first, end);
 		}
 		/*
 		 * Now move past this segment and look for any further
 		 * segment in the range, if there is one.
 		 */
 		first = end;
 		end = init_end;
 	}
 }
 
 /*
  * Do the local lock operation and update the rollback list, as required.
  * Perform the rollback and return the error if nfsvno_advlock() fails.
  */
 static int
 nfsrv_dolocal(vnode_t vp, struct nfslockfile *lfp, int flags, int oldflags,
     uint64_t first, uint64_t end, struct nfslockconflict *cfp, NFSPROC_T *p)
 {
 	struct nfsrollback *rlp;
 	int error = 0, ltype, oldltype;
 
 	if (flags & NFSLCK_WRITE)
 		ltype = F_WRLCK;
 	else if (flags & NFSLCK_READ)
 		ltype = F_RDLCK;
 	else
 		ltype = F_UNLCK;
 	if (oldflags & NFSLCK_WRITE)
 		oldltype = F_WRLCK;
 	else if (oldflags & NFSLCK_READ)
 		oldltype = F_RDLCK;
 	else
 		oldltype = F_UNLCK;
 	if (ltype == oldltype || (oldltype == F_WRLCK && ltype == F_RDLCK))
 		/* nothing to do */
 		goto out;
 	error = nfsvno_advlock(vp, ltype, first, end, p);
 	if (error != 0) {
 		if (cfp != NULL) {
 			cfp->cl_clientid.lval[0] = 0;
 			cfp->cl_clientid.lval[1] = 0;
 			cfp->cl_first = 0;
 			cfp->cl_end = NFS64BITSSET;
 			cfp->cl_flags = NFSLCK_WRITE;
 			cfp->cl_ownerlen = 5;
 			NFSBCOPY("LOCAL", cfp->cl_owner, 5);
 		}
 		nfsrv_locallock_rollback(vp, lfp, p);
 	} else if (ltype != F_UNLCK) {
 		rlp = malloc(sizeof (struct nfsrollback), M_NFSDROLLBACK,
 		    M_WAITOK);
 		rlp->rlck_first = first;
 		rlp->rlck_end = end;
 		rlp->rlck_type = oldltype;
 		LIST_INSERT_HEAD(&lfp->lf_rollback, rlp, rlck_list);
 	}
 
 out:
 	NFSEXITCODE(error);
 	return (error);
 }
 
 /*
  * Roll back local lock changes and free up the rollback list.
  */
 static void
 nfsrv_locallock_rollback(vnode_t vp, struct nfslockfile *lfp, NFSPROC_T *p)
 {
 	struct nfsrollback *rlp, *nrlp;
 
 	LIST_FOREACH_SAFE(rlp, &lfp->lf_rollback, rlck_list, nrlp) {
 		(void) nfsvno_advlock(vp, rlp->rlck_type, rlp->rlck_first,
 		    rlp->rlck_end, p);
 		free(rlp, M_NFSDROLLBACK);
 	}
 	LIST_INIT(&lfp->lf_rollback);
 }
 
 /*
  * Update local lock list and delete rollback list (ie now committed to the
  * local locks). Most of the work is done by the internal function.
  */
 static void
 nfsrv_locallock_commit(struct nfslockfile *lfp, int flags, uint64_t first,
     uint64_t end)
 {
 	struct nfsrollback *rlp, *nrlp;
 	struct nfslock *new_lop, *other_lop;
 
 	new_lop = malloc(sizeof (struct nfslock), M_NFSDLOCK, M_WAITOK);
 	if (flags & (NFSLCK_READ | NFSLCK_WRITE))
 		other_lop = malloc(sizeof (struct nfslock), M_NFSDLOCK,
 		    M_WAITOK);
 	else
 		other_lop = NULL;
 	new_lop->lo_flags = flags;
 	new_lop->lo_first = first;
 	new_lop->lo_end = end;
 	nfsrv_updatelock(NULL, &new_lop, &other_lop, lfp);
 	if (new_lop != NULL)
 		free(new_lop, M_NFSDLOCK);
 	if (other_lop != NULL)
 		free(other_lop, M_NFSDLOCK);
 
 	/* and get rid of the rollback list */
 	LIST_FOREACH_SAFE(rlp, &lfp->lf_rollback, rlck_list, nrlp)
 		free(rlp, M_NFSDROLLBACK);
 	LIST_INIT(&lfp->lf_rollback);
 }
 
 /*
  * Lock the struct nfslockfile for local lock updating.
  */
 static void
 nfsrv_locklf(struct nfslockfile *lfp)
 {
 	int gotlock;
 
 	/* lf_usecount ensures *lfp won't be free'd */
 	lfp->lf_usecount++;
 	do {
 		gotlock = nfsv4_lock(&lfp->lf_locallock_lck, 1, NULL,
 		    NFSSTATEMUTEXPTR, NULL);
 	} while (gotlock == 0);
 	lfp->lf_usecount--;
 }
 
 /*
  * Unlock the struct nfslockfile after local lock updating.
  */
 static void
 nfsrv_unlocklf(struct nfslockfile *lfp)
 {
 
 	nfsv4_unlock(&lfp->lf_locallock_lck, 0);
 }
 
 /*
  * Clear out all state for the NFSv4 server.
  * Must be called by a thread that can sleep when no nfsds are running.
  */
 void
 nfsrv_throwawayallstate(NFSPROC_T *p)
 {
 	struct nfsclient *clp, *nclp;
 	struct nfslockfile *lfp, *nlfp;
 	int i;
 
 	/*
 	 * For each client, clean out the state and then free the structure.
 	 */
 	for (i = 0; i < NFSCLIENTHASHSIZE; i++) {
 		LIST_FOREACH_SAFE(clp, &nfsclienthash[i], lc_hash, nclp) {
 			nfsrv_cleanclient(clp, p);
 			nfsrv_freedeleglist(&clp->lc_deleg);
 			nfsrv_freedeleglist(&clp->lc_olddeleg);
 			free(clp, M_NFSDCLIENT);
 		}
 	}
 
 	/*
 	 * Also, free up any remaining lock file structures.
 	 */
 	for (i = 0; i < NFSLOCKHASHSIZE; i++) {
 		LIST_FOREACH_SAFE(lfp, &nfslockhash[i], lf_hash, nlfp) {
 			printf("nfsd unload: fnd a lock file struct\n");
 			nfsrv_freenfslockfile(lfp);
 		}
 	}
 }
 
 /*
  * Check the sequence# for the session and slot provided as an argument.
  * Also, renew the lease if the session will return NFS_OK.
  */
 int
 nfsrv_checksequence(struct nfsrv_descript *nd, uint32_t sequenceid,
     uint32_t *highest_slotidp, uint32_t *target_highest_slotidp, int cache_this,
     uint32_t *sflagsp, NFSPROC_T *p)
 {
 	struct nfsdsession *sep;
 	struct nfssessionhash *shp;
 	int error;
 	SVCXPRT *savxprt;
 
 	shp = NFSSESSIONHASH(nd->nd_sessionid);
 	NFSLOCKSESSION(shp);
 	sep = nfsrv_findsession(nd->nd_sessionid);
 	if (sep == NULL) {
 		NFSUNLOCKSESSION(shp);
 		return (NFSERR_BADSESSION);
 	}
 	error = nfsv4_seqsession(sequenceid, nd->nd_slotid, *highest_slotidp,
 	    sep->sess_slots, NULL, NFSV4_SLOTS - 1);
 	if (error != 0) {
 		NFSUNLOCKSESSION(shp);
 		return (error);
 	}
 	if (cache_this != 0)
 		nd->nd_flag |= ND_SAVEREPLY;
 	/* Renew the lease. */
 	sep->sess_clp->lc_expiry = nfsrv_leaseexpiry();
 	nd->nd_clientid.qval = sep->sess_clp->lc_clientid.qval;
 	nd->nd_flag |= ND_IMPLIEDCLID;
 
 	/*
 	 * If this session handles the backchannel, save the nd_xprt for this
 	 * RPC, since this is the one being used.
 	 */
 	if (sep->sess_cbsess.nfsess_xprt != NULL &&
 	    (sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0) {
 		savxprt = sep->sess_cbsess.nfsess_xprt;
 		SVC_ACQUIRE(nd->nd_xprt);
 		nd->nd_xprt->xp_p2 = savxprt->xp_p2;
 		nd->nd_xprt->xp_idletimeout = 0;	/* Disable timeout. */
 		sep->sess_cbsess.nfsess_xprt = nd->nd_xprt;
 		SVC_RELEASE(savxprt);
 	}
 
 	*sflagsp = 0;
 	if (sep->sess_clp->lc_req.nr_client == NULL)
 		*sflagsp |= NFSV4SEQ_CBPATHDOWN;
 	NFSUNLOCKSESSION(shp);
 	if (error == NFSERR_EXPIRED) {
 		*sflagsp |= NFSV4SEQ_EXPIREDALLSTATEREVOKED;
 		error = 0;
 	} else if (error == NFSERR_ADMINREVOKED) {
 		*sflagsp |= NFSV4SEQ_ADMINSTATEREVOKED;
 		error = 0;
 	}
 	*highest_slotidp = *target_highest_slotidp = NFSV4_SLOTS - 1;
 	return (0);
 }
 
 /*
  * Check/set reclaim complete for this session/clientid.
  */
 int
 nfsrv_checkreclaimcomplete(struct nfsrv_descript *nd)
 {
 	struct nfsdsession *sep;
 	struct nfssessionhash *shp;
 	int error = 0;
 
 	shp = NFSSESSIONHASH(nd->nd_sessionid);
 	NFSLOCKSTATE();
 	NFSLOCKSESSION(shp);
 	sep = nfsrv_findsession(nd->nd_sessionid);
 	if (sep == NULL) {
 		NFSUNLOCKSESSION(shp);
 		NFSUNLOCKSTATE();
 		return (NFSERR_BADSESSION);
 	}
 
 	/* Check to see if reclaim complete has already happened. */
 	if ((sep->sess_clp->lc_flags & LCL_RECLAIMCOMPLETE) != 0)
 		error = NFSERR_COMPLETEALREADY;
 	else
 		sep->sess_clp->lc_flags |= LCL_RECLAIMCOMPLETE;
 	NFSUNLOCKSESSION(shp);
 	NFSUNLOCKSTATE();
 	return (error);
 }
 
 /*
  * Cache the reply in a session slot.
  */
 void
 nfsrv_cache_session(uint8_t *sessionid, uint32_t slotid, int repstat,
    struct mbuf **m)
 {
 	struct nfsdsession *sep;
 	struct nfssessionhash *shp;
 
 	shp = NFSSESSIONHASH(sessionid);
 	NFSLOCKSESSION(shp);
 	sep = nfsrv_findsession(sessionid);
 	if (sep == NULL) {
 		NFSUNLOCKSESSION(shp);
 		printf("nfsrv_cache_session: no session\n");
 		m_freem(*m);
 		return;
 	}
 	nfsv4_seqsess_cacherep(slotid, sep->sess_slots, repstat, m);
 	NFSUNLOCKSESSION(shp);
 }
 
 /*
  * Search for a session that matches the sessionid.
  */
 static struct nfsdsession *
 nfsrv_findsession(uint8_t *sessionid)
 {
 	struct nfsdsession *sep;
 	struct nfssessionhash *shp;
 
 	shp = NFSSESSIONHASH(sessionid);
 	LIST_FOREACH(sep, &shp->list, sess_hash) {
 		if (!NFSBCMP(sessionid, sep->sess_sessionid, NFSX_V4SESSIONID))
 			break;
 	}
 	return (sep);
 }
 
 /*
  * Destroy a session.
  */
 int
 nfsrv_destroysession(struct nfsrv_descript *nd, uint8_t *sessionid)
 {
 	int error, samesess;
 
 	samesess = 0;
 	if (!NFSBCMP(sessionid, nd->nd_sessionid, NFSX_V4SESSIONID)) {
 		samesess = 1;
 		if ((nd->nd_flag & ND_LASTOP) == 0)
 			return (NFSERR_BADSESSION);
 	}
 	error = nfsrv_freesession(NULL, sessionid);
 	if (error == 0 && samesess != 0)
 		nd->nd_flag &= ~ND_HASSEQUENCE;
 	return (error);
 }
 
 /*
  * Free up a session structure.
  */
 static int
 nfsrv_freesession(struct nfsdsession *sep, uint8_t *sessionid)
 {
 	struct nfssessionhash *shp;
 	int i;
 
 	if (sep == NULL) {
 		shp = NFSSESSIONHASH(sessionid);
 		NFSLOCKSESSION(shp);
 		sep = nfsrv_findsession(sessionid);
 	} else {
 		shp = NFSSESSIONHASH(sep->sess_sessionid);
 		NFSLOCKSESSION(shp);
 	}
 	if (sep != NULL) {
 		NFSLOCKSTATE();
 		sep->sess_refcnt--;
 		if (sep->sess_refcnt > 0) {
 			NFSUNLOCKSTATE();
 			NFSUNLOCKSESSION(shp);
 			return (0);
 		}
 		LIST_REMOVE(sep, sess_hash);
 		LIST_REMOVE(sep, sess_list);
 		NFSUNLOCKSTATE();
 	}
 	NFSUNLOCKSESSION(shp);
 	if (sep == NULL)
 		return (NFSERR_BADSESSION);
 	for (i = 0; i < NFSV4_SLOTS; i++)
 		if (sep->sess_slots[i].nfssl_reply != NULL)
 			m_freem(sep->sess_slots[i].nfssl_reply);
 	if (sep->sess_cbsess.nfsess_xprt != NULL)
 		SVC_RELEASE(sep->sess_cbsess.nfsess_xprt);
 	free(sep, M_NFSDSESSION);
 	return (0);
 }
 
 /*
  * Free a stateid.
  * RFC5661 says that it should fail when there are associated opens, locks
  * or delegations. Since stateids represent opens, I don't see how you can
  * free an open stateid (it will be free'd when closed), so this function
  * only works for lock stateids (freeing the lock_owner) or delegations.
  */
 int
 nfsrv_freestateid(struct nfsrv_descript *nd, nfsv4stateid_t *stateidp,
     NFSPROC_T *p)
 {
 	struct nfsclient *clp;
 	struct nfsstate *stp;
 	int error;
 
 	NFSLOCKSTATE();
 	/*
 	 * Look up the stateid
 	 */
 	error = nfsrv_getclient((nfsquad_t)((u_quad_t)0), CLOPS_RENEW, &clp,
 	    NULL, (nfsquad_t)((u_quad_t)0), 0, nd, p);
 	if (error == 0) {
 		/* First, check for a delegation. */
 		LIST_FOREACH(stp, &clp->lc_deleg, ls_list) {
 			if (!NFSBCMP(stp->ls_stateid.other, stateidp->other,
 			    NFSX_STATEIDOTHER))
 				break;
 		}
 		if (stp != NULL) {
 			nfsrv_freedeleg(stp);
 			NFSUNLOCKSTATE();
 			return (error);
 		}
 	}
 	/* Not a delegation, try for a lock_owner. */
 	if (error == 0)
 		error = nfsrv_getstate(clp, stateidp, 0, &stp);
 	if (error == 0 && ((stp->ls_flags & (NFSLCK_OPEN | NFSLCK_DELEGREAD |
 	    NFSLCK_DELEGWRITE)) != 0 || (stp->ls_flags & NFSLCK_LOCK) == 0))
 		/* Not a lock_owner stateid. */
 		error = NFSERR_LOCKSHELD;
 	if (error == 0 && !LIST_EMPTY(&stp->ls_lock))
 		error = NFSERR_LOCKSHELD;
 	if (error == 0)
 		nfsrv_freelockowner(stp, NULL, 0, p);
 	NFSUNLOCKSTATE();
 	return (error);
 }
 
 /*
  * Generate the xdr for an NFSv4.1 CBSequence Operation.
  */
 static int
 nfsv4_setcbsequence(struct nfsrv_descript *nd, struct nfsclient *clp,
     int dont_replycache, struct nfsdsession **sepp)
 {
 	struct nfsdsession *sep;
 	uint32_t *tl, slotseq = 0;
 	int maxslot, slotpos;
 	uint8_t sessionid[NFSX_V4SESSIONID];
 	int error;
 
 	error = nfsv4_getcbsession(clp, sepp);
 	if (error != 0)
 		return (error);
 	sep = *sepp;
 	(void)nfsv4_sequencelookup(NULL, &sep->sess_cbsess, &slotpos, &maxslot,
 	    &slotseq, sessionid);
 	KASSERT(maxslot >= 0, ("nfsv4_setcbsequence neg maxslot"));
 
 	/* Build the Sequence arguments. */
 	NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 5 * NFSX_UNSIGNED);
 	bcopy(sessionid, tl, NFSX_V4SESSIONID);
 	tl += NFSX_V4SESSIONID / NFSX_UNSIGNED;
 	nd->nd_slotseq = tl;
 	*tl++ = txdr_unsigned(slotseq);
 	*tl++ = txdr_unsigned(slotpos);
 	*tl++ = txdr_unsigned(maxslot);
 	if (dont_replycache == 0)
 		*tl++ = newnfs_true;
 	else
 		*tl++ = newnfs_false;
 	*tl = 0;			/* No referring call list, for now. */
 	nd->nd_flag |= ND_HASSEQUENCE;
 	return (0);
 }
 
 /*
  * Get a session for the callback.
  */
 static int
 nfsv4_getcbsession(struct nfsclient *clp, struct nfsdsession **sepp)
 {
 	struct nfsdsession *sep;
 
 	NFSLOCKSTATE();
 	LIST_FOREACH(sep, &clp->lc_session, sess_list) {
 		if ((sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0)
 			break;
 	}
 	if (sep == NULL) {
 		NFSUNLOCKSTATE();
 		return (NFSERR_BADSESSION);
 	}
 	sep->sess_refcnt++;
 	*sepp = sep;
 	NFSUNLOCKSTATE();
 	return (0);
 }
 
Index: projects/arm_intrng/sys/kern/vfs_default.c
===================================================================
--- projects/arm_intrng/sys/kern/vfs_default.c	(revision 276247)
+++ projects/arm_intrng/sys/kern/vfs_default.c	(revision 276248)
@@ -1,1279 +1,1288 @@
 /*-
  * Copyright (c) 1989, 1993
  *	The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed
  * to Berkeley by John Heidemann of the UCLA Ficus project.
  *
  * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project
  *
  * 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.
  * 4. Neither the name of the University nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 static int	vop_nolookup(struct vop_lookup_args *);
 static int	vop_norename(struct vop_rename_args *);
 static int	vop_nostrategy(struct vop_strategy_args *);
 static int	get_next_dirent(struct vnode *vp, struct dirent **dpp,
 				char *dirbuf, int dirbuflen, off_t *off,
 				char **cpos, int *len, int *eofflag,
 				struct thread *td);
 static int	dirent_exists(struct vnode *vp, const char *dirname,
 			      struct thread *td);
 
 #define DIRENT_MINSIZE (sizeof(struct dirent) - (MAXNAMLEN+1) + 4)
 
 static int vop_stdis_text(struct vop_is_text_args *ap);
 static int vop_stdset_text(struct vop_set_text_args *ap);
 static int vop_stdunset_text(struct vop_unset_text_args *ap);
 static int vop_stdget_writecount(struct vop_get_writecount_args *ap);
 static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
 static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
 
 /*
  * This vnode table stores what we want to do if the filesystem doesn't
  * implement a particular VOP.
  *
  * If there is no specific entry here, we will return EOPNOTSUPP.
  *
  * Note that every filesystem has to implement either vop_access
  * or vop_accessx; failing to do so will result in immediate crash
  * due to stack overflow, as vop_stdaccess() calls vop_stdaccessx(),
  * which calls vop_stdaccess() etc.
  */
 
 struct vop_vector default_vnodeops = {
 	.vop_default =		NULL,
 	.vop_bypass =		VOP_EOPNOTSUPP,
 
 	.vop_access =		vop_stdaccess,
 	.vop_accessx =		vop_stdaccessx,
 	.vop_advise =		vop_stdadvise,
 	.vop_advlock =		vop_stdadvlock,
 	.vop_advlockasync =	vop_stdadvlockasync,
 	.vop_advlockpurge =	vop_stdadvlockpurge,
 	.vop_allocate =		vop_stdallocate,
 	.vop_bmap =		vop_stdbmap,
 	.vop_close =		VOP_NULL,
 	.vop_fsync =		VOP_NULL,
 	.vop_getpages =		vop_stdgetpages,
 	.vop_getpages_async =	vop_stdgetpages_async,
 	.vop_getwritemount = 	vop_stdgetwritemount,
 	.vop_inactive =		VOP_NULL,
 	.vop_ioctl =		VOP_ENOTTY,
 	.vop_kqfilter =		vop_stdkqfilter,
 	.vop_islocked =		vop_stdislocked,
 	.vop_lock1 =		vop_stdlock,
 	.vop_lookup =		vop_nolookup,
 	.vop_open =		VOP_NULL,
 	.vop_pathconf =		VOP_EINVAL,
 	.vop_poll =		vop_nopoll,
 	.vop_putpages =		vop_stdputpages,
 	.vop_readlink =		VOP_EINVAL,
 	.vop_rename =		vop_norename,
 	.vop_revoke =		VOP_PANIC,
 	.vop_strategy =		vop_nostrategy,
 	.vop_unlock =		vop_stdunlock,
 	.vop_vptocnp =		vop_stdvptocnp,
 	.vop_vptofh =		vop_stdvptofh,
 	.vop_unp_bind =		vop_stdunp_bind,
 	.vop_unp_connect =	vop_stdunp_connect,
 	.vop_unp_detach =	vop_stdunp_detach,
 	.vop_is_text =		vop_stdis_text,
 	.vop_set_text =		vop_stdset_text,
 	.vop_unset_text =	vop_stdunset_text,
 	.vop_get_writecount =	vop_stdget_writecount,
 	.vop_add_writecount =	vop_stdadd_writecount,
 };
 
 /*
  * Series of placeholder functions for various error returns for
  * VOPs.
  */
 
 int
 vop_eopnotsupp(struct vop_generic_args *ap)
 {
 	/*
 	printf("vop_notsupp[%s]\n", ap->a_desc->vdesc_name);
 	*/
 
 	return (EOPNOTSUPP);
 }
 
 int
 vop_ebadf(struct vop_generic_args *ap)
 {
 
 	return (EBADF);
 }
 
 int
 vop_enotty(struct vop_generic_args *ap)
 {
 
 	return (ENOTTY);
 }
 
 int
 vop_einval(struct vop_generic_args *ap)
 {
 
 	return (EINVAL);
 }
 
 int
 vop_enoent(struct vop_generic_args *ap)
 {
 
 	return (ENOENT);
 }
 
 int
 vop_null(struct vop_generic_args *ap)
 {
 
 	return (0);
 }
 
 /*
  * Helper function to panic on some bad VOPs in some filesystems.
  */
 int
 vop_panic(struct vop_generic_args *ap)
 {
 
 	panic("filesystem goof: vop_panic[%s]", ap->a_desc->vdesc_name);
 }
 
 /*
  * vop_std and vop_no are default functions for use by
  * filesystems that need the "default reasonable" implementation for a
  * particular operation.
  *
  * The documentation for the operations they implement exists (if it exists)
  * in the VOP_(9) manpage (all uppercase).
  */
 
 /*
  * Default vop for filesystems that do not support name lookup
  */
 static int
 vop_nolookup(ap)
 	struct vop_lookup_args /* {
 		struct vnode *a_dvp;
 		struct vnode **a_vpp;
 		struct componentname *a_cnp;
 	} */ *ap;
 {
 
 	*ap->a_vpp = NULL;
 	return (ENOTDIR);
 }
 
 /*
  * vop_norename:
  *
  * Handle unlock and reference counting for arguments of vop_rename
  * for filesystems that do not implement rename operation.
  */
 static int
 vop_norename(struct vop_rename_args *ap)
 {
 
 	vop_rename_fail(ap);
 	return (EOPNOTSUPP);
 }
 
 /*
  *	vop_nostrategy:
  *
  *	Strategy routine for VFS devices that have none.
  *
  *	BIO_ERROR and B_INVAL must be cleared prior to calling any strategy
  *	routine.  Typically this is done for a BIO_READ strategy call.
  *	Typically B_INVAL is assumed to already be clear prior to a write
  *	and should not be cleared manually unless you just made the buffer
  *	invalid.  BIO_ERROR should be cleared either way.
  */
 
 static int
 vop_nostrategy (struct vop_strategy_args *ap)
 {
 	printf("No strategy for buffer at %p\n", ap->a_bp);
 	vprint("vnode", ap->a_vp);
 	ap->a_bp->b_ioflags |= BIO_ERROR;
 	ap->a_bp->b_error = EOPNOTSUPP;
 	bufdone(ap->a_bp);
 	return (EOPNOTSUPP);
 }
 
 static int
 get_next_dirent(struct vnode *vp, struct dirent **dpp, char *dirbuf,
 		int dirbuflen, off_t *off, char **cpos, int *len,
 		int *eofflag, struct thread *td)
 {
 	int error, reclen;
 	struct uio uio;
 	struct iovec iov;
 	struct dirent *dp;
 
 	KASSERT(VOP_ISLOCKED(vp), ("vp %p is not locked", vp));
 	KASSERT(vp->v_type == VDIR, ("vp %p is not a directory", vp));
 
 	if (*len == 0) {
 		iov.iov_base = dirbuf;
 		iov.iov_len = dirbuflen;
 
 		uio.uio_iov = &iov;
 		uio.uio_iovcnt = 1;
 		uio.uio_offset = *off;
 		uio.uio_resid = dirbuflen;
 		uio.uio_segflg = UIO_SYSSPACE;
 		uio.uio_rw = UIO_READ;
 		uio.uio_td = td;
 
 		*eofflag = 0;
 
 #ifdef MAC
 		error = mac_vnode_check_readdir(td->td_ucred, vp);
 		if (error == 0)
 #endif
 			error = VOP_READDIR(vp, &uio, td->td_ucred, eofflag,
 		    		NULL, NULL);
 		if (error)
 			return (error);
 
 		*off = uio.uio_offset;
 
 		*cpos = dirbuf;
 		*len = (dirbuflen - uio.uio_resid);
 
 		if (*len == 0)
 			return (ENOENT);
 	}
 
 	dp = (struct dirent *)(*cpos);
 	reclen = dp->d_reclen;
 	*dpp = dp;
 
 	/* check for malformed directory.. */
 	if (reclen < DIRENT_MINSIZE)
 		return (EINVAL);
 
 	*cpos += reclen;
 	*len -= reclen;
 
 	return (0);
 }
 
 /*
  * Check if a named file exists in a given directory vnode.
  */
 static int
 dirent_exists(struct vnode *vp, const char *dirname, struct thread *td)
 {
 	char *dirbuf, *cpos;
 	int error, eofflag, dirbuflen, len, found;
 	off_t off;
 	struct dirent *dp;
 	struct vattr va;
 
 	KASSERT(VOP_ISLOCKED(vp), ("vp %p is not locked", vp));
 	KASSERT(vp->v_type == VDIR, ("vp %p is not a directory", vp));
 
 	found = 0;
 
 	error = VOP_GETATTR(vp, &va, td->td_ucred);
 	if (error)
 		return (found);
 
 	dirbuflen = DEV_BSIZE;
 	if (dirbuflen < va.va_blocksize)
 		dirbuflen = va.va_blocksize;
 	dirbuf = (char *)malloc(dirbuflen, M_TEMP, M_WAITOK);
 
 	off = 0;
 	len = 0;
 	do {
 		error = get_next_dirent(vp, &dp, dirbuf, dirbuflen, &off,
 					&cpos, &len, &eofflag, td);
 		if (error)
 			goto out;
 
 		if (dp->d_type != DT_WHT && dp->d_fileno != 0 &&
 		    strcmp(dp->d_name, dirname) == 0) {
 			found = 1;
 			goto out;
 		}
 	} while (len > 0 || !eofflag);
 
 out:
 	free(dirbuf, M_TEMP);
 	return (found);
 }
 
 int
 vop_stdaccess(struct vop_access_args *ap)
 {
 
 	KASSERT((ap->a_accmode & ~(VEXEC | VWRITE | VREAD | VADMIN |
 	    VAPPEND)) == 0, ("invalid bit in accmode"));
 
 	return (VOP_ACCESSX(ap->a_vp, ap->a_accmode, ap->a_cred, ap->a_td));
 }
 
 int
 vop_stdaccessx(struct vop_accessx_args *ap)
 {
 	int error;
 	accmode_t accmode = ap->a_accmode;
 
 	error = vfs_unixify_accmode(&accmode);
 	if (error != 0)
 		return (error);
 
 	if (accmode == 0)
 		return (0);
 
 	return (VOP_ACCESS(ap->a_vp, accmode, ap->a_cred, ap->a_td));
 }
 
 /*
  * Advisory record locking support
  */
 int
 vop_stdadvlock(struct vop_advlock_args *ap)
 {
 	struct vnode *vp;
-	struct ucred *cred;
 	struct vattr vattr;
 	int error;
 
 	vp = ap->a_vp;
-	cred = curthread->td_ucred;
-	vn_lock(vp, LK_SHARED | LK_RETRY);
-	error = VOP_GETATTR(vp, &vattr, cred);
-	VOP_UNLOCK(vp, 0);
-	if (error)
-		return (error);
+	if (ap->a_fl->l_whence == SEEK_END) {
+		/*
+		 * The NFSv4 server must avoid doing a vn_lock() here, since it
+		 * can deadlock the nfsd threads, due to a LOR.  Fortunately
+		 * the NFSv4 server always uses SEEK_SET and this code is
+		 * only required for the SEEK_END case.
+		 */
+		vn_lock(vp, LK_SHARED | LK_RETRY);
+		error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
+		VOP_UNLOCK(vp, 0);
+		if (error)
+			return (error);
+	} else
+		vattr.va_size = 0;
 
 	return (lf_advlock(ap, &(vp->v_lockf), vattr.va_size));
 }
 
 int
 vop_stdadvlockasync(struct vop_advlockasync_args *ap)
 {
 	struct vnode *vp;
-	struct ucred *cred;
 	struct vattr vattr;
 	int error;
 
 	vp = ap->a_vp;
-	cred = curthread->td_ucred;
-	vn_lock(vp, LK_SHARED | LK_RETRY);
-	error = VOP_GETATTR(vp, &vattr, cred);
-	VOP_UNLOCK(vp, 0);
-	if (error)
-		return (error);
+	if (ap->a_fl->l_whence == SEEK_END) {
+		/* The size argument is only needed for SEEK_END. */
+		vn_lock(vp, LK_SHARED | LK_RETRY);
+		error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
+		VOP_UNLOCK(vp, 0);
+		if (error)
+			return (error);
+	} else
+		vattr.va_size = 0;
 
 	return (lf_advlockasync(ap, &(vp->v_lockf), vattr.va_size));
 }
 
 int
 vop_stdadvlockpurge(struct vop_advlockpurge_args *ap)
 {
 	struct vnode *vp;
 
 	vp = ap->a_vp;
 	lf_purgelocks(vp, &vp->v_lockf);
 	return (0);
 }
 
 /*
  * vop_stdpathconf:
  *
  * Standard implementation of POSIX pathconf, to get information about limits
  * for a filesystem.
  * Override per filesystem for the case where the filesystem has smaller
  * limits.
  */
 int
 vop_stdpathconf(ap)
 	struct vop_pathconf_args /* {
 	struct vnode *a_vp;
 	int a_name;
 	int *a_retval;
 	} */ *ap;
 {
 
 	switch (ap->a_name) {
 		case _PC_NAME_MAX:
 			*ap->a_retval = NAME_MAX;
 			return (0);
 		case _PC_PATH_MAX:
 			*ap->a_retval = PATH_MAX;
 			return (0);
 		case _PC_LINK_MAX:
 			*ap->a_retval = LINK_MAX;
 			return (0);
 		case _PC_MAX_CANON:
 			*ap->a_retval = MAX_CANON;
 			return (0);
 		case _PC_MAX_INPUT:
 			*ap->a_retval = MAX_INPUT;
 			return (0);
 		case _PC_PIPE_BUF:
 			*ap->a_retval = PIPE_BUF;
 			return (0);
 		case _PC_CHOWN_RESTRICTED:
 			*ap->a_retval = 1;
 			return (0);
 		case _PC_VDISABLE:
 			*ap->a_retval = _POSIX_VDISABLE;
 			return (0);
 		default:
 			return (EINVAL);
 	}
 	/* NOTREACHED */
 }
 
 /*
  * Standard lock, unlock and islocked functions.
  */
 int
 vop_stdlock(ap)
 	struct vop_lock1_args /* {
 		struct vnode *a_vp;
 		int a_flags;
 		char *file;
 		int line;
 	} */ *ap;
 {
 	struct vnode *vp = ap->a_vp;
 
 	return (_lockmgr_args(vp->v_vnlock, ap->a_flags, VI_MTX(vp),
 	    LK_WMESG_DEFAULT, LK_PRIO_DEFAULT, LK_TIMO_DEFAULT, ap->a_file,
 	    ap->a_line));
 }
 
 /* See above. */
 int
 vop_stdunlock(ap)
 	struct vop_unlock_args /* {
 		struct vnode *a_vp;
 		int a_flags;
 	} */ *ap;
 {
 	struct vnode *vp = ap->a_vp;
 
 	return (lockmgr(vp->v_vnlock, ap->a_flags | LK_RELEASE, VI_MTX(vp)));
 }
 
 /* See above. */
 int
 vop_stdislocked(ap)
 	struct vop_islocked_args /* {
 		struct vnode *a_vp;
 	} */ *ap;
 {
 
 	return (lockstatus(ap->a_vp->v_vnlock));
 }
 
 /*
  * Return true for select/poll.
  */
 int
 vop_nopoll(ap)
 	struct vop_poll_args /* {
 		struct vnode *a_vp;
 		int  a_events;
 		struct ucred *a_cred;
 		struct thread *a_td;
 	} */ *ap;
 {
 
 	return (poll_no_poll(ap->a_events));
 }
 
 /*
  * Implement poll for local filesystems that support it.
  */
 int
 vop_stdpoll(ap)
 	struct vop_poll_args /* {
 		struct vnode *a_vp;
 		int  a_events;
 		struct ucred *a_cred;
 		struct thread *a_td;
 	} */ *ap;
 {
 	if (ap->a_events & ~POLLSTANDARD)
 		return (vn_pollrecord(ap->a_vp, ap->a_td, ap->a_events));
 	return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
 }
 
 /*
  * Return our mount point, as we will take charge of the writes.
  */
 int
 vop_stdgetwritemount(ap)
 	struct vop_getwritemount_args /* {
 		struct vnode *a_vp;
 		struct mount **a_mpp;
 	} */ *ap;
 {
 	struct mount *mp;
 
 	/*
 	 * XXX Since this is called unlocked we may be recycled while
 	 * attempting to ref the mount.  If this is the case or mountpoint
 	 * will be set to NULL.  We only have to prevent this call from
 	 * returning with a ref to an incorrect mountpoint.  It is not
 	 * harmful to return with a ref to our previous mountpoint.
 	 */
 	mp = ap->a_vp->v_mount;
 	if (mp != NULL) {
 		vfs_ref(mp);
 		if (mp != ap->a_vp->v_mount) {
 			vfs_rel(mp);
 			mp = NULL;
 		}
 	}
 	*(ap->a_mpp) = mp;
 	return (0);
 }
 
 /* XXX Needs good comment and VOP_BMAP(9) manpage */
 int
 vop_stdbmap(ap)
 	struct vop_bmap_args /* {
 		struct vnode *a_vp;
 		daddr_t  a_bn;
 		struct bufobj **a_bop;
 		daddr_t *a_bnp;
 		int *a_runp;
 		int *a_runb;
 	} */ *ap;
 {
 
 	if (ap->a_bop != NULL)
 		*ap->a_bop = &ap->a_vp->v_bufobj;
 	if (ap->a_bnp != NULL)
 		*ap->a_bnp = ap->a_bn * btodb(ap->a_vp->v_mount->mnt_stat.f_iosize);
 	if (ap->a_runp != NULL)
 		*ap->a_runp = 0;
 	if (ap->a_runb != NULL)
 		*ap->a_runb = 0;
 	return (0);
 }
 
 int
 vop_stdfsync(ap)
 	struct vop_fsync_args /* {
 		struct vnode *a_vp;
 		struct ucred *a_cred;
 		int a_waitfor;
 		struct thread *a_td;
 	} */ *ap;
 {
 	struct vnode *vp = ap->a_vp;
 	struct buf *bp;
 	struct bufobj *bo;
 	struct buf *nbp;
 	int error = 0;
 	int maxretry = 1000;     /* large, arbitrarily chosen */
 
 	bo = &vp->v_bufobj;
 	BO_LOCK(bo);
 loop1:
 	/*
 	 * MARK/SCAN initialization to avoid infinite loops.
 	 */
         TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs) {
                 bp->b_vflags &= ~BV_SCANNED;
 		bp->b_error = 0;
 	}
 
 	/*
 	 * Flush all dirty buffers associated with a vnode.
 	 */
 loop2:
 	TAILQ_FOREACH_SAFE(bp, &bo->bo_dirty.bv_hd, b_bobufs, nbp) {
 		if ((bp->b_vflags & BV_SCANNED) != 0)
 			continue;
 		bp->b_vflags |= BV_SCANNED;
 		if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) {
 			if (ap->a_waitfor != MNT_WAIT)
 				continue;
 			if (BUF_LOCK(bp,
 			    LK_EXCLUSIVE | LK_INTERLOCK | LK_SLEEPFAIL,
 			    BO_LOCKPTR(bo)) != 0) {
 				BO_LOCK(bo);
 				goto loop1;
 			}
 			BO_LOCK(bo);
 		}
 		BO_UNLOCK(bo);
 		KASSERT(bp->b_bufobj == bo,
 		    ("bp %p wrong b_bufobj %p should be %p",
 		    bp, bp->b_bufobj, bo));
 		if ((bp->b_flags & B_DELWRI) == 0)
 			panic("fsync: not dirty");
 		if ((vp->v_object != NULL) && (bp->b_flags & B_CLUSTEROK)) {
 			vfs_bio_awrite(bp);
 		} else {
 			bremfree(bp);
 			bawrite(bp);
 		}
 		BO_LOCK(bo);
 		goto loop2;
 	}
 
 	/*
 	 * If synchronous the caller expects us to completely resolve all
 	 * dirty buffers in the system.  Wait for in-progress I/O to
 	 * complete (which could include background bitmap writes), then
 	 * retry if dirty blocks still exist.
 	 */
 	if (ap->a_waitfor == MNT_WAIT) {
 		bufobj_wwait(bo, 0, 0);
 		if (bo->bo_dirty.bv_cnt > 0) {
 			/*
 			 * If we are unable to write any of these buffers
 			 * then we fail now rather than trying endlessly
 			 * to write them out.
 			 */
 			TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs)
 				if ((error = bp->b_error) == 0)
 					continue;
 			if (error == 0 && --maxretry >= 0)
 				goto loop1;
 			error = EAGAIN;
 		}
 	}
 	BO_UNLOCK(bo);
 	if (error == EAGAIN)
 		vprint("fsync: giving up on dirty", vp);
 
 	return (error);
 }
 
 /* XXX Needs good comment and more info in the manpage (VOP_GETPAGES(9)). */
 int
 vop_stdgetpages(ap)
 	struct vop_getpages_args /* {
 		struct vnode *a_vp;
 		vm_page_t *a_m;
 		int a_count;
 		int a_reqpage;
 	} */ *ap;
 {
 
 	return vnode_pager_generic_getpages(ap->a_vp, ap->a_m,
 	    ap->a_count, ap->a_reqpage, NULL, NULL);
 }
 
 static int
 vop_stdgetpages_async(struct vop_getpages_async_args *ap)
 {
 	int error;
 
 	error = VOP_GETPAGES(ap->a_vp, ap->a_m, ap->a_count, ap->a_reqpage);
 	ap->a_iodone(ap->a_arg, ap->a_m, ap->a_reqpage, error);
 	return (error);
 }
 
 int
 vop_stdkqfilter(struct vop_kqfilter_args *ap)
 {
 	return vfs_kqfilter(ap);
 }
 
 /* XXX Needs good comment and more info in the manpage (VOP_PUTPAGES(9)). */
 int
 vop_stdputpages(ap)
 	struct vop_putpages_args /* {
 		struct vnode *a_vp;
 		vm_page_t *a_m;
 		int a_count;
 		int a_sync;
 		int *a_rtvals;
 	} */ *ap;
 {
 
 	return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count,
 	     ap->a_sync, ap->a_rtvals);
 }
 
 int
 vop_stdvptofh(struct vop_vptofh_args *ap)
 {
 	return (EOPNOTSUPP);
 }
 
 int
 vop_stdvptocnp(struct vop_vptocnp_args *ap)
 {
 	struct vnode *vp = ap->a_vp;
 	struct vnode **dvp = ap->a_vpp;
 	struct ucred *cred = ap->a_cred;
 	char *buf = ap->a_buf;
 	int *buflen = ap->a_buflen;
 	char *dirbuf, *cpos;
 	int i, error, eofflag, dirbuflen, flags, locked, len, covered;
 	off_t off;
 	ino_t fileno;
 	struct vattr va;
 	struct nameidata nd;
 	struct thread *td;
 	struct dirent *dp;
 	struct vnode *mvp;
 
 	i = *buflen;
 	error = 0;
 	covered = 0;
 	td = curthread;
 
 	if (vp->v_type != VDIR)
 		return (ENOENT);
 
 	error = VOP_GETATTR(vp, &va, cred);
 	if (error)
 		return (error);
 
 	VREF(vp);
 	locked = VOP_ISLOCKED(vp);
 	VOP_UNLOCK(vp, 0);
 	NDINIT_ATVP(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE,
 	    "..", vp, td);
 	flags = FREAD;
 	error = vn_open_cred(&nd, &flags, 0, VN_OPEN_NOAUDIT, cred, NULL);
 	if (error) {
 		vn_lock(vp, locked | LK_RETRY);
 		return (error);
 	}
 	NDFREE(&nd, NDF_ONLY_PNBUF);
 
 	mvp = *dvp = nd.ni_vp;
 
 	if (vp->v_mount != (*dvp)->v_mount &&
 	    ((*dvp)->v_vflag & VV_ROOT) &&
 	    ((*dvp)->v_mount->mnt_flag & MNT_UNION)) {
 		*dvp = (*dvp)->v_mount->mnt_vnodecovered;
 		VREF(mvp);
 		VOP_UNLOCK(mvp, 0);
 		vn_close(mvp, FREAD, cred, td);
 		VREF(*dvp);
 		vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY);
 		covered = 1;
 	}
 
 	fileno = va.va_fileid;
 
 	dirbuflen = DEV_BSIZE;
 	if (dirbuflen < va.va_blocksize)
 		dirbuflen = va.va_blocksize;
 	dirbuf = (char *)malloc(dirbuflen, M_TEMP, M_WAITOK);
 
 	if ((*dvp)->v_type != VDIR) {
 		error = ENOENT;
 		goto out;
 	}
 
 	off = 0;
 	len = 0;
 	do {
 		/* call VOP_READDIR of parent */
 		error = get_next_dirent(*dvp, &dp, dirbuf, dirbuflen, &off,
 					&cpos, &len, &eofflag, td);
 		if (error)
 			goto out;
 
 		if ((dp->d_type != DT_WHT) &&
 		    (dp->d_fileno == fileno)) {
 			if (covered) {
 				VOP_UNLOCK(*dvp, 0);
 				vn_lock(mvp, LK_EXCLUSIVE | LK_RETRY);
 				if (dirent_exists(mvp, dp->d_name, td)) {
 					error = ENOENT;
 					VOP_UNLOCK(mvp, 0);
 					vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY);
 					goto out;
 				}
 				VOP_UNLOCK(mvp, 0);
 				vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY);
 			}
 			i -= dp->d_namlen;
 
 			if (i < 0) {
 				error = ENOMEM;
 				goto out;
 			}
 			if (dp->d_namlen == 1 && dp->d_name[0] == '.') {
 				error = ENOENT;
 			} else {
 				bcopy(dp->d_name, buf + i, dp->d_namlen);
 				error = 0;
 			}
 			goto out;
 		}
 	} while (len > 0 || !eofflag);
 	error = ENOENT;
 
 out:
 	free(dirbuf, M_TEMP);
 	if (!error) {
 		*buflen = i;
 		vref(*dvp);
 	}
 	if (covered) {
 		vput(*dvp);
 		vrele(mvp);
 	} else {
 		VOP_UNLOCK(mvp, 0);
 		vn_close(mvp, FREAD, cred, td);
 	}
 	vn_lock(vp, locked | LK_RETRY);
 	return (error);
 }
 
 int
 vop_stdallocate(struct vop_allocate_args *ap)
 {
 #ifdef __notyet__
 	struct statfs sfs;
 #endif
 	struct iovec aiov;
 	struct vattr vattr, *vap;
 	struct uio auio;
 	off_t fsize, len, cur, offset;
 	uint8_t *buf;
 	struct thread *td;
 	struct vnode *vp;
 	size_t iosize;
 	int error;
 
 	buf = NULL;
 	error = 0;
 	td = curthread;
 	vap = &vattr;
 	vp = ap->a_vp;
 	len = *ap->a_len;
 	offset = *ap->a_offset;
 
 	error = VOP_GETATTR(vp, vap, td->td_ucred);
 	if (error != 0)
 		goto out;
 	fsize = vap->va_size;
 	iosize = vap->va_blocksize;
 	if (iosize == 0)
 		iosize = BLKDEV_IOSIZE;
 	if (iosize > MAXPHYS)
 		iosize = MAXPHYS;
 	buf = malloc(iosize, M_TEMP, M_WAITOK);
 
 #ifdef __notyet__
 	/*
 	 * Check if the filesystem sets f_maxfilesize; if not use
 	 * VOP_SETATTR to perform the check.
 	 */
 	error = VFS_STATFS(vp->v_mount, &sfs, td);
 	if (error != 0)
 		goto out;
 	if (sfs.f_maxfilesize) {
 		if (offset > sfs.f_maxfilesize || len > sfs.f_maxfilesize ||
 		    offset + len > sfs.f_maxfilesize) {
 			error = EFBIG;
 			goto out;
 		}
 	} else
 #endif
 	if (offset + len > vap->va_size) {
 		/*
 		 * Test offset + len against the filesystem's maxfilesize.
 		 */
 		VATTR_NULL(vap);
 		vap->va_size = offset + len;
 		error = VOP_SETATTR(vp, vap, td->td_ucred);
 		if (error != 0)
 			goto out;
 		VATTR_NULL(vap);
 		vap->va_size = fsize;
 		error = VOP_SETATTR(vp, vap, td->td_ucred);
 		if (error != 0)
 			goto out;
 	}
 
 	for (;;) {
 		/*
 		 * Read and write back anything below the nominal file
 		 * size.  There's currently no way outside the filesystem
 		 * to know whether this area is sparse or not.
 		 */
 		cur = iosize;
 		if ((offset % iosize) != 0)
 			cur -= (offset % iosize);
 		if (cur > len)
 			cur = len;
 		if (offset < fsize) {
 			aiov.iov_base = buf;
 			aiov.iov_len = cur;
 			auio.uio_iov = &aiov;
 			auio.uio_iovcnt = 1;
 			auio.uio_offset = offset;
 			auio.uio_resid = cur;
 			auio.uio_segflg = UIO_SYSSPACE;
 			auio.uio_rw = UIO_READ;
 			auio.uio_td = td;
 			error = VOP_READ(vp, &auio, 0, td->td_ucred);
 			if (error != 0)
 				break;
 			if (auio.uio_resid > 0) {
 				bzero(buf + cur - auio.uio_resid,
 				    auio.uio_resid);
 			}
 		} else {
 			bzero(buf, cur);
 		}
 
 		aiov.iov_base = buf;
 		aiov.iov_len = cur;
 		auio.uio_iov = &aiov;
 		auio.uio_iovcnt = 1;
 		auio.uio_offset = offset;
 		auio.uio_resid = cur;
 		auio.uio_segflg = UIO_SYSSPACE;
 		auio.uio_rw = UIO_WRITE;
 		auio.uio_td = td;
 
 		error = VOP_WRITE(vp, &auio, 0, td->td_ucred);
 		if (error != 0)
 			break;
 
 		len -= cur;
 		offset += cur;
 		if (len == 0)
 			break;
 		if (should_yield())
 			break;
 	}
 
  out:
 	*ap->a_len = len;
 	*ap->a_offset = offset;
 	free(buf, M_TEMP);
 	return (error);
 }
 
 int
 vop_stdadvise(struct vop_advise_args *ap)
 {
 	struct vnode *vp;
 	off_t start, end;
 	int error;
 
 	vp = ap->a_vp;
 	switch (ap->a_advice) {
 	case POSIX_FADV_WILLNEED:
 		/*
 		 * Do nothing for now.  Filesystems should provide a
 		 * custom method which starts an asynchronous read of
 		 * the requested region.
 		 */
 		error = 0;
 		break;
 	case POSIX_FADV_DONTNEED:
 		/*
 		 * Flush any open FS buffers and then remove pages
 		 * from the backing VM object.  Using vinvalbuf() here
 		 * is a bit heavy-handed as it flushes all buffers for
 		 * the given vnode, not just the buffers covering the
 		 * requested range.
 		 */
 		error = 0;
 		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 		if (vp->v_iflag & VI_DOOMED) {
 			VOP_UNLOCK(vp, 0);
 			break;
 		}
 		vinvalbuf(vp, V_CLEANONLY, 0, 0);
 		if (vp->v_object != NULL) {
 			start = trunc_page(ap->a_start);
 			end = round_page(ap->a_end);
 			VM_OBJECT_WLOCK(vp->v_object);
 			vm_object_page_cache(vp->v_object, OFF_TO_IDX(start),
 			    OFF_TO_IDX(end));
 			VM_OBJECT_WUNLOCK(vp->v_object);
 		}
 		VOP_UNLOCK(vp, 0);
 		break;
 	default:
 		error = EINVAL;
 		break;
 	}
 	return (error);
 }
 
 int
 vop_stdunp_bind(struct vop_unp_bind_args *ap)
 {
 
 	ap->a_vp->v_socket = ap->a_socket;
 	return (0);
 }
 
 int
 vop_stdunp_connect(struct vop_unp_connect_args *ap)
 {
 
 	*ap->a_socket = ap->a_vp->v_socket;
 	return (0);
 }
 
 int
 vop_stdunp_detach(struct vop_unp_detach_args *ap)
 {
 
 	ap->a_vp->v_socket = NULL;
 	return (0);
 }
 
 static int
 vop_stdis_text(struct vop_is_text_args *ap)
 {
 
 	return ((ap->a_vp->v_vflag & VV_TEXT) != 0);
 }
 
 static int
 vop_stdset_text(struct vop_set_text_args *ap)
 {
 
 	ap->a_vp->v_vflag |= VV_TEXT;
 	return (0);
 }
 
 static int
 vop_stdunset_text(struct vop_unset_text_args *ap)
 {
 
 	ap->a_vp->v_vflag &= ~VV_TEXT;
 	return (0);
 }
 
 static int
 vop_stdget_writecount(struct vop_get_writecount_args *ap)
 {
 
 	*ap->a_writecount = ap->a_vp->v_writecount;
 	return (0);
 }
 
 static int
 vop_stdadd_writecount(struct vop_add_writecount_args *ap)
 {
 
 	ap->a_vp->v_writecount += ap->a_inc;
 	return (0);
 }
 
 /*
  * vfs default ops
  * used to fill the vfs function table to get reasonable default return values.
  */
 int
 vfs_stdroot (mp, flags, vpp)
 	struct mount *mp;
 	int flags;
 	struct vnode **vpp;
 {
 
 	return (EOPNOTSUPP);
 }
 
 int
 vfs_stdstatfs (mp, sbp)
 	struct mount *mp;
 	struct statfs *sbp;
 {
 
 	return (EOPNOTSUPP);
 }
 
 int
 vfs_stdquotactl (mp, cmds, uid, arg)
 	struct mount *mp;
 	int cmds;
 	uid_t uid;
 	void *arg;
 {
 
 	return (EOPNOTSUPP);
 }
 
 int
 vfs_stdsync(mp, waitfor)
 	struct mount *mp;
 	int waitfor;
 {
 	struct vnode *vp, *mvp;
 	struct thread *td;
 	int error, lockreq, allerror = 0;
 
 	td = curthread;
 	lockreq = LK_EXCLUSIVE | LK_INTERLOCK;
 	if (waitfor != MNT_WAIT)
 		lockreq |= LK_NOWAIT;
 	/*
 	 * Force stale buffer cache information to be flushed.
 	 */
 loop:
 	MNT_VNODE_FOREACH_ALL(vp, mp, mvp) {
 		if (vp->v_bufobj.bo_dirty.bv_cnt == 0) {
 			VI_UNLOCK(vp);
 			continue;
 		}
 		if ((error = vget(vp, lockreq, td)) != 0) {
 			if (error == ENOENT) {
 				MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
 				goto loop;
 			}
 			continue;
 		}
 		error = VOP_FSYNC(vp, waitfor, td);
 		if (error)
 			allerror = error;
 		vput(vp);
 	}
 	return (allerror);
 }
 
 int
 vfs_stdnosync (mp, waitfor)
 	struct mount *mp;
 	int waitfor;
 {
 
 	return (0);
 }
 
 int
 vfs_stdvget (mp, ino, flags, vpp)
 	struct mount *mp;
 	ino_t ino;
 	int flags;
 	struct vnode **vpp;
 {
 
 	return (EOPNOTSUPP);
 }
 
 int
 vfs_stdfhtovp (mp, fhp, flags, vpp)
 	struct mount *mp;
 	struct fid *fhp;
 	int flags;
 	struct vnode **vpp;
 {
 
 	return (EOPNOTSUPP);
 }
 
 int
 vfs_stdinit (vfsp)
 	struct vfsconf *vfsp;
 {
 
 	return (0);
 }
 
 int
 vfs_stduninit (vfsp)
 	struct vfsconf *vfsp;
 {
 
 	return(0);
 }
 
 int
 vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname)
 	struct mount *mp;
 	int cmd;
 	struct vnode *filename_vp;
 	int attrnamespace;
 	const char *attrname;
 {
 
 	if (filename_vp != NULL)
 		VOP_UNLOCK(filename_vp, 0);
 	return (EOPNOTSUPP);
 }
 
 int
 vfs_stdsysctl(mp, op, req)
 	struct mount *mp;
 	fsctlop_t op;
 	struct sysctl_req *req;
 {
 
 	return (EOPNOTSUPP);
 }
 
 /* end of vfs default ops */
Index: projects/arm_intrng/sys/modules/if_gif/Makefile
===================================================================
--- projects/arm_intrng/sys/modules/if_gif/Makefile	(revision 276247)
+++ projects/arm_intrng/sys/modules/if_gif/Makefile	(revision 276248)
@@ -1,15 +1,19 @@
 # $FreeBSD$
 
 SYSDIR?=${.CURDIR}/../..
 .include "${SYSDIR}/conf/kern.opts.mk"
 
 .PATH: ${SYSDIR}/net ${SYSDIR}/netinet ${SYSDIR}/netinet6
 
 KMOD=	if_gif
-SRCS=	if_gif.c in_gif.c opt_inet.h opt_inet6.h
+SRCS=	if_gif.c opt_inet.h opt_inet6.h
+
+.if ${MK_INET_SUPPORT} != "no"
+SRCS+=	in_gif.c
+.endif
 
 .if ${MK_INET6_SUPPORT} != "no"
 SRCS+=	in6_gif.c
 .endif
 
 .include 
Index: projects/arm_intrng/sys/net/if_gif.c
===================================================================
--- projects/arm_intrng/sys/net/if_gif.c	(revision 276247)
+++ projects/arm_intrng/sys/net/if_gif.c	(revision 276248)
@@ -1,1099 +1,1089 @@
 /*-
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
  *
  *	$KAME: if_gif.c,v 1.87 2001/10/19 08:50:27 itojun Exp $
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #ifdef	INET
 #include 
 #include 
 #endif	/* INET */
 
 #ifdef INET6
 #ifndef INET
 #include 
 #endif
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #endif /* INET6 */
 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 
 static const char gifname[] = "gif";
 
 /*
  * gif_mtx protects a per-vnet gif_softc_list.
  */
 static VNET_DEFINE(struct mtx, gif_mtx);
 #define	V_gif_mtx		VNET(gif_mtx)
 static MALLOC_DEFINE(M_GIF, "gif", "Generic Tunnel Interface");
 static VNET_DEFINE(LIST_HEAD(, gif_softc), gif_softc_list);
 #define	V_gif_softc_list	VNET(gif_softc_list)
 static struct sx gif_ioctl_sx;
 SX_SYSINIT(gif_ioctl_sx, &gif_ioctl_sx, "gif_ioctl");
 
 #define	GIF_LIST_LOCK_INIT(x)		mtx_init(&V_gif_mtx, "gif_mtx", \
 					    NULL, MTX_DEF)
 #define	GIF_LIST_LOCK_DESTROY(x)	mtx_destroy(&V_gif_mtx)
 #define	GIF_LIST_LOCK(x)		mtx_lock(&V_gif_mtx)
 #define	GIF_LIST_UNLOCK(x)		mtx_unlock(&V_gif_mtx)
 
 void	(*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp, int af);
 void	(*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af);
 void	(*ng_gif_attach_p)(struct ifnet *ifp);
 void	(*ng_gif_detach_p)(struct ifnet *ifp);
 
-#ifdef INET
-extern int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
-extern int in_gif_encapcheck(const struct mbuf *, int, int, void *);
-extern int in_gif_attach(struct gif_softc *);
-#endif
-#ifdef INET6
-extern int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
-extern int in6_gif_encapcheck(const struct mbuf *, int, int, void *);
-extern int in6_gif_attach(struct gif_softc *);
-#endif
 static int	gif_set_tunnel(struct ifnet *, struct sockaddr *,
     struct sockaddr *);
 static void	gif_delete_tunnel(struct ifnet *);
 static int	gif_ioctl(struct ifnet *, u_long, caddr_t);
 static int	gif_transmit(struct ifnet *, struct mbuf *);
 static void	gif_qflush(struct ifnet *);
 static int	gif_clone_create(struct if_clone *, int, caddr_t);
 static void	gif_clone_destroy(struct ifnet *);
 static VNET_DEFINE(struct if_clone *, gif_cloner);
 #define	V_gif_cloner	VNET(gif_cloner)
 
 static int gifmodevent(module_t, int, void *);
 
 SYSCTL_DECL(_net_link);
 static SYSCTL_NODE(_net_link, IFT_GIF, gif, CTLFLAG_RW, 0,
     "Generic Tunnel Interface");
 #ifndef MAX_GIF_NEST
 /*
  * This macro controls the default upper limitation on nesting of gif tunnels.
  * Since, setting a large value to this macro with a careless configuration
  * may introduce system crash, we don't allow any nestings by default.
  * If you need to configure nested gif tunnels, you can define this macro
  * in your kernel configuration file.  However, if you do so, please be
  * careful to configure the tunnels so that it won't make a loop.
  */
 #define MAX_GIF_NEST 1
 #endif
 static VNET_DEFINE(int, max_gif_nesting) = MAX_GIF_NEST;
 #define	V_max_gif_nesting	VNET(max_gif_nesting)
 SYSCTL_INT(_net_link_gif, OID_AUTO, max_nesting, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(max_gif_nesting), 0, "Max nested tunnels");
 
 /*
  * By default, we disallow creation of multiple tunnels between the same
  * pair of addresses.  Some applications require this functionality so
  * we allow control over this check here.
  */
 #ifdef XBONEHACK
 static VNET_DEFINE(int, parallel_tunnels) = 1;
 #else
 static VNET_DEFINE(int, parallel_tunnels) = 0;
 #endif
 #define	V_parallel_tunnels	VNET(parallel_tunnels)
 SYSCTL_INT(_net_link_gif, OID_AUTO, parallel_tunnels,
     CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(parallel_tunnels), 0,
     "Allow parallel tunnels?");
 
 /* copy from src/sys/net/if_ethersubr.c */
 static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] =
 			{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 #ifndef ETHER_IS_BROADCAST
 #define ETHER_IS_BROADCAST(addr) \
 	(bcmp(etherbroadcastaddr, (addr), ETHER_ADDR_LEN) == 0)
 #endif
 
 static int
 gif_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
 	struct gif_softc *sc;
 
 	sc = malloc(sizeof(struct gif_softc), M_GIF, M_WAITOK | M_ZERO);
 	sc->gif_fibnum = curthread->td_proc->p_fibnum;
 	GIF2IFP(sc) = if_alloc(IFT_GIF);
 	GIF_LOCK_INIT(sc);
 	GIF2IFP(sc)->if_softc = sc;
 	if_initname(GIF2IFP(sc), gifname, unit);
 
 	GIF2IFP(sc)->if_addrlen = 0;
 	GIF2IFP(sc)->if_mtu    = GIF_MTU;
 	GIF2IFP(sc)->if_flags  = IFF_POINTOPOINT | IFF_MULTICAST;
 #if 0
 	/* turn off ingress filter */
 	GIF2IFP(sc)->if_flags  |= IFF_LINK2;
 #endif
 	GIF2IFP(sc)->if_ioctl  = gif_ioctl;
 	GIF2IFP(sc)->if_transmit  = gif_transmit;
 	GIF2IFP(sc)->if_qflush  = gif_qflush;
 	GIF2IFP(sc)->if_output = gif_output;
 	if_attach(GIF2IFP(sc));
 	bpfattach(GIF2IFP(sc), DLT_NULL, sizeof(u_int32_t));
 	if (ng_gif_attach_p != NULL)
 		(*ng_gif_attach_p)(GIF2IFP(sc));
 
 	GIF_LIST_LOCK();
 	LIST_INSERT_HEAD(&V_gif_softc_list, sc, gif_list);
 	GIF_LIST_UNLOCK();
 	return (0);
 }
 
 static void
 gif_clone_destroy(struct ifnet *ifp)
 {
 	struct gif_softc *sc;
 
 	sx_xlock(&gif_ioctl_sx);
 	sc = ifp->if_softc;
 	gif_delete_tunnel(ifp);
 	GIF_LIST_LOCK();
 	LIST_REMOVE(sc, gif_list);
 	GIF_LIST_UNLOCK();
 	if (ng_gif_detach_p != NULL)
 		(*ng_gif_detach_p)(ifp);
 	bpfdetach(ifp);
 	if_detach(ifp);
 	ifp->if_softc = NULL;
 	sx_xunlock(&gif_ioctl_sx);
 
 	if_free(ifp);
 	GIF_LOCK_DESTROY(sc);
 	free(sc, M_GIF);
 }
 
 static void
 vnet_gif_init(const void *unused __unused)
 {
 
 	LIST_INIT(&V_gif_softc_list);
 	GIF_LIST_LOCK_INIT();
 	V_gif_cloner = if_clone_simple(gifname, gif_clone_create,
 	    gif_clone_destroy, 0);
 }
 VNET_SYSINIT(vnet_gif_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
     vnet_gif_init, NULL);
 
 static void
 vnet_gif_uninit(const void *unused __unused)
 {
 
 	if_clone_detach(V_gif_cloner);
 	GIF_LIST_LOCK_DESTROY();
 }
 VNET_SYSUNINIT(vnet_gif_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
     vnet_gif_uninit, NULL);
 
 static int
 gifmodevent(module_t mod, int type, void *data)
 {
 
 	switch (type) {
 	case MOD_LOAD:
 	case MOD_UNLOAD:
 		break;
 	default:
 		return (EOPNOTSUPP);
 	}
 	return (0);
 }
 
 static moduledata_t gif_mod = {
 	"if_gif",
 	gifmodevent,
 	0
 };
 
 DECLARE_MODULE(if_gif, gif_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
 MODULE_VERSION(if_gif, 1);
 
 int
 gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
 {
 	GIF_RLOCK_TRACKER;
 	struct gif_softc *sc;
 	int ret;
 	uint8_t ver;
 
 	sc = (struct gif_softc *)arg;
 	if (sc == NULL || (GIF2IFP(sc)->if_flags & IFF_UP) == 0)
 		return (0);
 
 	ret = 0;
 	GIF_RLOCK(sc);
 
 	/* no physical address */
 	if (sc->gif_family == 0)
 		goto done;
 
 	switch (proto) {
 #ifdef INET
 	case IPPROTO_IPV4:
 #endif
 #ifdef INET6
 	case IPPROTO_IPV6:
 #endif
 	case IPPROTO_ETHERIP:
 		break;
 	default:
 		goto done;
 	}
 
 	/* Bail on short packets */
 	if (m->m_pkthdr.len < sizeof(struct ip))
 		goto done;
 
 	m_copydata(m, 0, 1, &ver);
 	switch (ver >> 4) {
 #ifdef INET
 	case 4:
 		if (sc->gif_family != AF_INET)
 			goto done;
 		ret = in_gif_encapcheck(m, off, proto, arg);
 		break;
 #endif
 #ifdef INET6
 	case 6:
 		if (m->m_pkthdr.len < sizeof(struct ip6_hdr))
 			goto done;
 		if (sc->gif_family != AF_INET6)
 			goto done;
 		ret = in6_gif_encapcheck(m, off, proto, arg);
 		break;
 #endif
 	}
 done:
 	GIF_RUNLOCK(sc);
 	return (ret);
 }
 
 static int
 gif_transmit(struct ifnet *ifp, struct mbuf *m)
 {
 	struct gif_softc *sc;
 	struct etherip_header *eth;
 #ifdef INET
 	struct ip *ip;
 #endif
 #ifdef INET6
 	struct ip6_hdr *ip6;
 	uint32_t t;
 #endif
 	uint32_t af;
 	uint8_t proto, ecn;
 	int error;
 
 	error = ENETDOWN;
 	sc = ifp->if_softc;
 	if (sc->gif_family == 0) {
 		m_freem(m);
 		goto err;
 	}
 	/* Now pull back the af that we stashed in the csum_data. */
 	af = m->m_pkthdr.csum_data;
 	BPF_MTAP2(ifp, &af, sizeof(af), m);
 	if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 	if_inc_counter(ifp, IFCOUNTER_OBYTES, m->m_pkthdr.len);
 	M_SETFIB(m, sc->gif_fibnum);
 	/* inner AF-specific encapsulation */
 	ecn = 0;
 	switch (af) {
 #ifdef INET
 	case AF_INET:
 		proto = IPPROTO_IPV4;
 		if (m->m_len < sizeof(struct ip))
 			m = m_pullup(m, sizeof(struct ip));
 		if (m == NULL) {
 			error = ENOBUFS;
 			goto err;
 		}
 		ip = mtod(m, struct ip *);
 		ip_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED:
 		    ECN_NOCARE, &ecn, &ip->ip_tos);
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		proto = IPPROTO_IPV6;
 		if (m->m_len < sizeof(struct ip6_hdr))
 			m = m_pullup(m, sizeof(struct ip6_hdr));
 		if (m == NULL) {
 			error = ENOBUFS;
 			goto err;
 		}
 		t = 0;
 		ip6 = mtod(m, struct ip6_hdr *);
 		ip6_ecn_ingress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED:
 		    ECN_NOCARE, &t, &ip6->ip6_flow);
 		ecn = (ntohl(t) >> 20) & 0xff;
 		break;
 #endif
 	case AF_LINK:
 		proto = IPPROTO_ETHERIP;
 		M_PREPEND(m, sizeof(struct etherip_header), M_NOWAIT);
 		if (m == NULL) {
 			error = ENOBUFS;
 			goto err;
 		}
 		eth = mtod(m, struct etherip_header *);
 		eth->eip_resvh = 0;
 		if ((sc->gif_options & GIF_SEND_REVETHIP) != 0) {
 			eth->eip_ver = 0;
 			eth->eip_resvl = ETHERIP_VERSION;
 		} else {
 			eth->eip_ver = ETHERIP_VERSION;
 			eth->eip_resvl = 0;
 		}
 		break;
 	default:
 		error = EAFNOSUPPORT;
 		m_freem(m);
 		goto err;
 	}
 	/* XXX should we check if our outer source is legal? */
 	/* dispatch to output logic based on outer AF */
 	switch (sc->gif_family) {
 #ifdef INET
 	case AF_INET:
 		error = in_gif_output(ifp, m, proto, ecn);
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		error = in6_gif_output(ifp, m, proto, ecn);
 		break;
 #endif
 	default:
 		m_freem(m);
 	}
 err:
 	if (error)
 		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	return (error);
 }
 
 static void
 gif_qflush(struct ifnet *ifp __unused)
 {
 
 }
 
 int
 gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
 	struct route *ro)
 {
 	struct m_tag *mtag;
 	uint32_t af;
 	int gif_called;
 	int error = 0;
 #ifdef MAC
 	error = mac_ifnet_check_transmit(ifp, m);
 	if (error)
 		goto err;
 #endif
 	if ((ifp->if_flags & IFF_MONITOR) != 0 ||
 	    (ifp->if_flags & IFF_UP) == 0) {
 		error = ENETDOWN;
 		goto err;
 	}
 
 	/*
 	 * gif may cause infinite recursion calls when misconfigured.
 	 * We'll prevent this by detecting loops.
 	 *
 	 * High nesting level may cause stack exhaustion.
 	 * We'll prevent this by introducing upper limit.
 	 */
 	gif_called = 1;
 	mtag = m_tag_locate(m, MTAG_GIF, MTAG_GIF_CALLED, NULL);
 	while (mtag != NULL) {
 		if (*(struct ifnet **)(mtag + 1) == ifp) {
 			log(LOG_NOTICE,
 			    "gif_output: loop detected on %s\n",
 			    (*(struct ifnet **)(mtag + 1))->if_xname);
 			error = EIO;	/* is there better errno? */
 			goto err;
 		}
 		mtag = m_tag_locate(m, MTAG_GIF, MTAG_GIF_CALLED, mtag);
 		gif_called++;
 	}
 	if (gif_called > V_max_gif_nesting) {
 		log(LOG_NOTICE,
 		    "gif_output: recursively called too many times(%d)\n",
 		    gif_called);
 		error = EIO;	/* is there better errno? */
 		goto err;
 	}
 	mtag = m_tag_alloc(MTAG_GIF, MTAG_GIF_CALLED, sizeof(struct ifnet *),
 	    M_NOWAIT);
 	if (mtag == NULL) {
 		error = ENOMEM;
 		goto err;
 	}
 	*(struct ifnet **)(mtag + 1) = ifp;
 	m_tag_prepend(m, mtag);
 
 	m->m_flags &= ~(M_BCAST|M_MCAST);
 	if (dst->sa_family == AF_UNSPEC)
 		bcopy(dst->sa_data, &af, sizeof(af));
 	else
 		af = dst->sa_family;
 	if (ifp->if_bridge)
 		af = AF_LINK;
 	/*
 	 * Now save the af in the inbound pkt csum data, this is a cheat since
 	 * we are using the inbound csum_data field to carry the af over to
 	 * the gif_transmit() routine, avoiding using yet another mtag.
 	 */
 	m->m_pkthdr.csum_data = af;
 	return (ifp->if_transmit(ifp, m));
 err:
 	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	m_freem(m);
 	return (error);
 }
 
 void
 gif_input(struct mbuf *m, struct ifnet *ifp, int proto, uint8_t ecn)
 {
 	struct etherip_header *eip;
 #ifdef INET
 	struct ip *ip;
 #endif
 #ifdef INET6
 	struct ip6_hdr *ip6;
 	uint32_t t;
 #endif
 	struct gif_softc *sc;
 	struct ether_header *eh;
 	struct ifnet *oldifp;
 	uint32_t gif_options;
 	int isr, n, af;
 
 	if (ifp == NULL) {
 		/* just in case */
 		m_freem(m);
 		return;
 	}
 	sc = ifp->if_softc;
 	gif_options = sc->gif_options;
 	m->m_pkthdr.rcvif = ifp;
 	m_clrprotoflags(m);
 	switch (proto) {
 #ifdef INET
 	case IPPROTO_IPV4:
 		af = AF_INET;
 		if (m->m_len < sizeof(struct ip))
 			m = m_pullup(m, sizeof(struct ip));
 		if (m == NULL)
 			goto drop;
 		ip = mtod(m, struct ip *);
 		if (ip_ecn_egress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED:
 		    ECN_NOCARE, &ecn, &ip->ip_tos) == 0) {
 			m_freem(m);
 			goto drop;
 		}
 		break;
 #endif
 #ifdef INET6
 	case IPPROTO_IPV6:
 		af = AF_INET6;
 		if (m->m_len < sizeof(struct ip6_hdr))
 			m = m_pullup(m, sizeof(struct ip6_hdr));
 		if (m == NULL)
 			goto drop;
 		t = htonl((uint32_t)ecn << 20);
 		ip6 = mtod(m, struct ip6_hdr *);
 		if (ip6_ecn_egress((ifp->if_flags & IFF_LINK1) ? ECN_ALLOWED:
 		    ECN_NOCARE, &t, &ip6->ip6_flow) == 0) {
 			m_freem(m);
 			goto drop;
 		}
 		break;
 #endif
 	case IPPROTO_ETHERIP:
 		af = AF_LINK;
 		break;
 	default:
 		m_freem(m);
 		goto drop;
 	}
 
 #ifdef MAC
 	mac_ifnet_create_mbuf(ifp, m);
 #endif
 
 	if (bpf_peers_present(ifp->if_bpf)) {
 		uint32_t af1 = af;
 		bpf_mtap2(ifp->if_bpf, &af1, sizeof(af1), m);
 	}
 
 	if ((ifp->if_flags & IFF_MONITOR) != 0) {
 		if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 		if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
 		m_freem(m);
 		return;
 	}
 
 	if (ng_gif_input_p != NULL) {
 		(*ng_gif_input_p)(ifp, &m, af);
 		if (m == NULL)
 			goto drop;
 	}
 
 	/*
 	 * Put the packet to the network layer input queue according to the
 	 * specified address family.
 	 * Note: older versions of gif_input directly called network layer
 	 * input functions, e.g. ip6_input, here.  We changed the policy to
 	 * prevent too many recursive calls of such input functions, which
 	 * might cause kernel panic.  But the change may introduce another
 	 * problem; if the input queue is full, packets are discarded.
 	 * The kernel stack overflow really happened, and we believed
 	 * queue-full rarely occurs, so we changed the policy.
 	 */
 	switch (af) {
 #ifdef INET
 	case AF_INET:
 		isr = NETISR_IP;
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		isr = NETISR_IPV6;
 		break;
 #endif
 	case AF_LINK:
 		n = sizeof(struct etherip_header) + sizeof(struct ether_header);
 		if (n > m->m_len)
 			m = m_pullup(m, n);
 		if (m == NULL)
 			goto drop;
 		eip = mtod(m, struct etherip_header *);
 		/*
 		 * GIF_ACCEPT_REVETHIP (enabled by default) intentionally
 		 * accepts an EtherIP packet with revered version field in
 		 * the header.  This is a knob for backward compatibility
 		 * with FreeBSD 7.2R or prior.
 		 */
 		if (eip->eip_ver != ETHERIP_VERSION) {
 			if ((gif_options & GIF_ACCEPT_REVETHIP) == 0 ||
 			    eip->eip_resvl != ETHERIP_VERSION) {
 				/* discard unknown versions */
 				m_freem(m);
 				goto drop;
 			}
 		}
 		m_adj(m, sizeof(struct etherip_header));
 
 		m->m_flags &= ~(M_BCAST|M_MCAST);
 		m->m_pkthdr.rcvif = ifp;
 
 		if (ifp->if_bridge) {
 			oldifp = ifp;
 			eh = mtod(m, struct ether_header *);
 			if (ETHER_IS_MULTICAST(eh->ether_dhost)) {
 				if (ETHER_IS_BROADCAST(eh->ether_dhost))
 					m->m_flags |= M_BCAST;
 				else
 					m->m_flags |= M_MCAST;
 				if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
 			}
 			BRIDGE_INPUT(ifp, m);
 
 			if (m != NULL && ifp != oldifp) {
 				/*
 				 * The bridge gave us back itself or one of the
 				 * members for which the frame is addressed.
 				 */
 				ether_demux(ifp, m);
 				return;
 			}
 		}
 		if (m != NULL)
 			m_freem(m);
 		return;
 
 	default:
 		if (ng_gif_input_orphan_p != NULL)
 			(*ng_gif_input_orphan_p)(ifp, m, af);
 		else
 			m_freem(m);
 		return;
 	}
 
 	if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 	if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
 	M_SETFIB(m, ifp->if_fib);
 	netisr_dispatch(isr, m);
 	return;
 drop:
 	if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 }
 
 /* XXX how should we handle IPv6 scope on SIOC[GS]IFPHYADDR? */
 int
 gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
 	GIF_RLOCK_TRACKER;
 	struct ifreq *ifr = (struct ifreq*)data;
 	struct sockaddr *dst, *src;
 	struct gif_softc *sc;
 #ifdef INET
 	struct sockaddr_in *sin = NULL;
 #endif
 #ifdef INET6
 	struct sockaddr_in6 *sin6 = NULL;
 #endif
 	u_int options;
 	int error;
 
 	switch (cmd) {
 	case SIOCSIFADDR:
 		ifp->if_flags |= IFF_UP;
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 	case SIOCGIFMTU:
 	case SIOCSIFFLAGS:
 		return (0);
 	case SIOCSIFMTU:
 		if (ifr->ifr_mtu < GIF_MTU_MIN ||
 		    ifr->ifr_mtu > GIF_MTU_MAX)
 			return (EINVAL);
 		else
 			ifp->if_mtu = ifr->ifr_mtu;
 		return (0);
 	}
 	sx_xlock(&gif_ioctl_sx);
 	sc = ifp->if_softc;
 	if (sc == NULL) {
 		error = ENXIO;
 		goto bad;
 	}
 	error = 0;
 	switch (cmd) {
 	case SIOCSIFPHYADDR:
 #ifdef INET6
 	case SIOCSIFPHYADDR_IN6:
 #endif
 		error = EINVAL;
 		switch (cmd) {
 #ifdef INET
 		case SIOCSIFPHYADDR:
 			src = (struct sockaddr *)
 				&(((struct in_aliasreq *)data)->ifra_addr);
 			dst = (struct sockaddr *)
 				&(((struct in_aliasreq *)data)->ifra_dstaddr);
 			break;
 #endif
 #ifdef INET6
 		case SIOCSIFPHYADDR_IN6:
 			src = (struct sockaddr *)
 				&(((struct in6_aliasreq *)data)->ifra_addr);
 			dst = (struct sockaddr *)
 				&(((struct in6_aliasreq *)data)->ifra_dstaddr);
 			break;
 #endif
 		default:
 			goto bad;
 		}
 		/* sa_family must be equal */
 		if (src->sa_family != dst->sa_family ||
 		    src->sa_len != dst->sa_len)
 			goto bad;
 
 		/* validate sa_len */
 		switch (src->sa_family) {
 #ifdef INET
 		case AF_INET:
 			if (src->sa_len != sizeof(struct sockaddr_in))
 				goto bad;
 			break;
 #endif
 #ifdef INET6
 		case AF_INET6:
 			if (src->sa_len != sizeof(struct sockaddr_in6))
 				goto bad;
 			break;
 #endif
 		default:
 			error = EAFNOSUPPORT;
 			goto bad;
 		}
 		/* check sa_family looks sane for the cmd */
 		error = EAFNOSUPPORT;
 		switch (cmd) {
 #ifdef INET
 		case SIOCSIFPHYADDR:
 			if (src->sa_family == AF_INET)
 				break;
 			goto bad;
 #endif
 #ifdef INET6
 		case SIOCSIFPHYADDR_IN6:
 			if (src->sa_family == AF_INET6)
 				break;
 			goto bad;
 #endif
 		}
 		error = EADDRNOTAVAIL;
 		switch (src->sa_family) {
 #ifdef INET
 		case AF_INET:
 			if (satosin(src)->sin_addr.s_addr == INADDR_ANY ||
 			    satosin(dst)->sin_addr.s_addr == INADDR_ANY)
 				goto bad;
 			break;
 #endif
 #ifdef INET6
 		case AF_INET6:
 			if (IN6_IS_ADDR_UNSPECIFIED(&satosin6(src)->sin6_addr)
 			    ||
 			    IN6_IS_ADDR_UNSPECIFIED(&satosin6(dst)->sin6_addr))
 				goto bad;
 			/*
 			 * Check validity of the scope zone ID of the
 			 * addresses, and convert it into the kernel
 			 * internal form if necessary.
 			 */
 			error = sa6_embedscope(satosin6(src), 0);
 			if (error != 0)
 				goto bad;
 			error = sa6_embedscope(satosin6(dst), 0);
 			if (error != 0)
 				goto bad;
 #endif
 		};
 		error = gif_set_tunnel(ifp, src, dst);
 		break;
 	case SIOCDIFPHYADDR:
 		gif_delete_tunnel(ifp);
 		break;
 	case SIOCGIFPSRCADDR:
 	case SIOCGIFPDSTADDR:
 #ifdef INET6
 	case SIOCGIFPSRCADDR_IN6:
 	case SIOCGIFPDSTADDR_IN6:
 #endif
 		if (sc->gif_family == 0) {
 			error = EADDRNOTAVAIL;
 			break;
 		}
 		GIF_RLOCK(sc);
 		switch (cmd) {
 #ifdef INET
 		case SIOCGIFPSRCADDR:
 		case SIOCGIFPDSTADDR:
 			if (sc->gif_family != AF_INET) {
 				error = EADDRNOTAVAIL;
 				break;
 			}
 			sin = (struct sockaddr_in *)&ifr->ifr_addr;
 			memset(sin, 0, sizeof(*sin));
 			sin->sin_family = AF_INET;
 			sin->sin_len = sizeof(*sin);
 			break;
 #endif
 #ifdef INET6
 		case SIOCGIFPSRCADDR_IN6:
 		case SIOCGIFPDSTADDR_IN6:
 			if (sc->gif_family != AF_INET6) {
 				error = EADDRNOTAVAIL;
 				break;
 			}
 			sin6 = (struct sockaddr_in6 *)
 				&(((struct in6_ifreq *)data)->ifr_addr);
 			memset(sin6, 0, sizeof(*sin6));
 			sin6->sin6_family = AF_INET6;
 			sin6->sin6_len = sizeof(*sin6);
 			break;
 #endif
 		default:
 			error = EAFNOSUPPORT;
 		}
 		if (error == 0) {
 			switch (cmd) {
 #ifdef INET
 			case SIOCGIFPSRCADDR:
 				sin->sin_addr = sc->gif_iphdr->ip_src;
 				break;
 			case SIOCGIFPDSTADDR:
 				sin->sin_addr = sc->gif_iphdr->ip_dst;
 				break;
 #endif
 #ifdef INET6
 			case SIOCGIFPSRCADDR_IN6:
 				sin6->sin6_addr = sc->gif_ip6hdr->ip6_src;
 				break;
 			case SIOCGIFPDSTADDR_IN6:
 				sin6->sin6_addr = sc->gif_ip6hdr->ip6_dst;
 				break;
 #endif
 			}
 		}
 		GIF_RUNLOCK(sc);
 		if (error != 0)
 			break;
 		switch (cmd) {
 #ifdef INET
 		case SIOCGIFPSRCADDR:
 		case SIOCGIFPDSTADDR:
 			error = prison_if(curthread->td_ucred,
 			    (struct sockaddr *)sin);
 			if (error != 0)
 				memset(sin, 0, sizeof(*sin));
 			break;
 #endif
 #ifdef INET6
 		case SIOCGIFPSRCADDR_IN6:
 		case SIOCGIFPDSTADDR_IN6:
 			error = prison_if(curthread->td_ucred,
 			    (struct sockaddr *)sin6);
 			if (error == 0)
 				error = sa6_recoverscope(sin6);
 			if (error != 0)
 				memset(sin6, 0, sizeof(*sin6));
 #endif
 		}
 		break;
 	case GIFGOPTS:
 		options = sc->gif_options;
 		error = copyout(&options, ifr->ifr_data, sizeof(options));
 		break;
 	case GIFSOPTS:
 		if ((error = priv_check(curthread, PRIV_NET_GIF)) != 0)
 			break;
 		error = copyin(ifr->ifr_data, &options, sizeof(options));
 		if (error)
 			break;
 		if (options & ~GIF_OPTMASK)
 			error = EINVAL;
 		else
 			sc->gif_options = options;
 		break;
 
 	default:
 		error = EINVAL;
 		break;
 	}
 bad:
 	sx_xunlock(&gif_ioctl_sx);
 	return (error);
 }
 
 static void
 gif_detach(struct gif_softc *sc)
 {
 
 	sx_assert(&gif_ioctl_sx, SA_XLOCKED);
 	if (sc->gif_ecookie != NULL)
 		encap_detach(sc->gif_ecookie);
 	sc->gif_ecookie = NULL;
 }
 
 static int
 gif_attach(struct gif_softc *sc, int af)
 {
 
 	sx_assert(&gif_ioctl_sx, SA_XLOCKED);
 	switch (af) {
 #ifdef INET
 	case AF_INET:
 		return (in_gif_attach(sc));
 #endif
 #ifdef INET6
 	case AF_INET6:
 		return (in6_gif_attach(sc));
 #endif
 	}
 	return (EAFNOSUPPORT);
 }
 
 static int
 gif_set_tunnel(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst)
 {
 	struct gif_softc *sc = ifp->if_softc;
 	struct gif_softc *tsc;
 #ifdef INET
 	struct ip *ip;
 #endif
 #ifdef INET6
 	struct ip6_hdr *ip6;
 #endif
 	void *hdr;
 	int error = 0;
 
 	if (sc == NULL)
 		return (ENXIO);
 	/* Disallow parallel tunnels unless instructed otherwise. */
 	if (V_parallel_tunnels == 0) {
 		GIF_LIST_LOCK();
 		LIST_FOREACH(tsc, &V_gif_softc_list, gif_list) {
 			if (tsc == sc || tsc->gif_family != src->sa_family)
 				continue;
 #ifdef INET
 			if (tsc->gif_family == AF_INET &&
 			    tsc->gif_iphdr->ip_src.s_addr ==
 			    satosin(src)->sin_addr.s_addr &&
 			    tsc->gif_iphdr->ip_dst.s_addr ==
 			    satosin(dst)->sin_addr.s_addr) {
 				error = EADDRNOTAVAIL;
 				GIF_LIST_UNLOCK();
 				goto bad;
 			}
 #endif
 #ifdef INET6
 			if (tsc->gif_family == AF_INET6 &&
 			    IN6_ARE_ADDR_EQUAL(&tsc->gif_ip6hdr->ip6_src,
 			    &satosin6(src)->sin6_addr) &&
 			    IN6_ARE_ADDR_EQUAL(&tsc->gif_ip6hdr->ip6_dst,
 			    &satosin6(dst)->sin6_addr)) {
 				error = EADDRNOTAVAIL;
 				GIF_LIST_UNLOCK();
 				goto bad;
 			}
 #endif
 		}
 		GIF_LIST_UNLOCK();
 	}
 	switch (src->sa_family) {
 #ifdef INET
 	case AF_INET:
 		hdr = ip = malloc(sizeof(struct ip), M_GIF,
 		    M_WAITOK | M_ZERO);
 		ip->ip_src.s_addr = satosin(src)->sin_addr.s_addr;
 		ip->ip_dst.s_addr = satosin(dst)->sin_addr.s_addr;
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		hdr = ip6 = malloc(sizeof(struct ip6_hdr), M_GIF,
 		    M_WAITOK | M_ZERO);
 		ip6->ip6_src = satosin6(src)->sin6_addr;
 		ip6->ip6_dst = satosin6(dst)->sin6_addr;
 		ip6->ip6_vfc = IPV6_VERSION;
 		break;
 #endif
 	default:
 		return (EAFNOSUPPORT);
 	};
 
 	if (sc->gif_family != src->sa_family)
 		gif_detach(sc);
 	if (sc->gif_family == 0 ||
 	    sc->gif_family != src->sa_family)
 		error = gif_attach(sc, src->sa_family);
 
 	GIF_WLOCK(sc);
 	if (sc->gif_family != 0)
 		free(sc->gif_hdr, M_GIF);
 	sc->gif_family = src->sa_family;
 	sc->gif_hdr = hdr;
 	GIF_WUNLOCK(sc);
 #if defined(INET) || defined(INET6)
 bad:
 #endif
 	if (error == 0 && sc->gif_family != 0)
 		ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	else
 		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	return (error);
 }
 
 static void
 gif_delete_tunnel(struct ifnet *ifp)
 {
 	struct gif_softc *sc = ifp->if_softc;
 	int family;
 
 	if (sc == NULL)
 		return;
 
 	GIF_WLOCK(sc);
 	family = sc->gif_family;
 	sc->gif_family = 0;
 	GIF_WUNLOCK(sc);
 	if (family != 0) {
 		gif_detach(sc);
 		free(sc->gif_hdr, M_GIF);
 	}
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 }
Index: projects/arm_intrng/sys/net/if_gif.h
===================================================================
--- projects/arm_intrng/sys/net/if_gif.h	(revision 276247)
+++ projects/arm_intrng/sys/net/if_gif.h	(revision 276248)
@@ -1,126 +1,136 @@
 /*	$FreeBSD$	*/
 /*	$KAME: if_gif.h,v 1.17 2000/09/11 11:36:41 sumikawa Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
 
 #ifndef _NET_IF_GIF_H_
 #define _NET_IF_GIF_H_
 
 #ifdef _KERNEL
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include 
 
 struct ip;
 struct ip6_hdr;
 struct encaptab;
 
 extern	void (*ng_gif_input_p)(struct ifnet *ifp, struct mbuf **mp,
 		int af);
 extern	void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m,
 		int af);
 extern	int  (*ng_gif_output_p)(struct ifnet *ifp, struct mbuf **mp);
 extern	void (*ng_gif_attach_p)(struct ifnet *ifp);
 extern	void (*ng_gif_detach_p)(struct ifnet *ifp);
 
 struct gif_softc {
 	struct ifnet		*gif_ifp;
 	struct rmlock		gif_lock;
 	const struct encaptab	*gif_ecookie;
 	int			gif_family;
 	int			gif_flags;
 	u_int			gif_fibnum;
 	u_int			gif_options;
 	void			*gif_netgraph;	/* netgraph node info */
 	union {
 		void		*hdr;
 		struct ip	*iphdr;
 #ifdef INET6
 		struct ip6_hdr	*ip6hdr;
 #endif
 	} gif_uhdr;
 	LIST_ENTRY(gif_softc)	gif_list; /* all gif's are linked */
 };
 #define	GIF2IFP(sc)	((sc)->gif_ifp)
 #define	GIF_LOCK_INIT(sc)	rm_init(&(sc)->gif_lock, "gif softc")
 #define	GIF_LOCK_DESTROY(sc)	rm_destroy(&(sc)->gif_lock)
 #define	GIF_RLOCK_TRACKER	struct rm_priotracker gif_tracker
 #define	GIF_RLOCK(sc)		rm_rlock(&(sc)->gif_lock, &gif_tracker)
 #define	GIF_RUNLOCK(sc)		rm_runlock(&(sc)->gif_lock, &gif_tracker)
 #define	GIF_RLOCK_ASSERT(sc)	rm_assert(&(sc)->gif_lock, RA_RLOCKED)
 #define	GIF_WLOCK(sc)		rm_wlock(&(sc)->gif_lock)
 #define	GIF_WUNLOCK(sc)		rm_wunlock(&(sc)->gif_lock)
 #define	GIF_WLOCK_ASSERT(sc)	rm_assert(&(sc)->gif_lock, RA_WLOCKED)
 
 #define	gif_iphdr	gif_uhdr.iphdr
 #define	gif_hdr		gif_uhdr.hdr
 #ifdef INET6
 #define	gif_ip6hdr	gif_uhdr.ip6hdr
 #endif
 
 #define GIF_MTU		(1280)	/* Default MTU */
 #define	GIF_MTU_MIN	(1280)	/* Minimum MTU */
 #define	GIF_MTU_MAX	(8192)	/* Maximum MTU */
 
 #define	MTAG_GIF	1080679712
 #define	MTAG_GIF_CALLED	0
 
 struct etherip_header {
 #if BYTE_ORDER == LITTLE_ENDIAN
 	u_int	eip_resvl:4,	/* reserved */
 		eip_ver:4;	/* version */
 #endif
 #if BYTE_ORDER == BIG_ENDIAN
 	u_int	eip_ver:4,	/* version */
 		eip_resvl:4;	/* reserved */
 #endif
 	u_int8_t eip_resvh;	/* reserved */
 } __packed;
 
 #define ETHERIP_VERSION			0x3
 /* mbuf adjust factor to force 32-bit alignment of IP header */
 #define	ETHERIP_ALIGN		2
 
 /* Prototypes */
 void gif_input(struct mbuf *, struct ifnet *, int, uint8_t);
 int gif_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
 	       struct route *);
 int gif_encapcheck(const struct mbuf *, int, int, void *);
+#ifdef INET
+int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
+int in_gif_encapcheck(const struct mbuf *, int, int, void *);
+int in_gif_attach(struct gif_softc *);
+#endif
+#ifdef INET6
+int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
+int in6_gif_encapcheck(const struct mbuf *, int, int, void *);
+int in6_gif_attach(struct gif_softc *);
+#endif
 #endif /* _KERNEL */
 
 #define GIFGOPTS	_IOWR('i', 150, struct ifreq)
 #define GIFSOPTS	_IOW('i', 151, struct ifreq)
 
 #define	GIF_ACCEPT_REVETHIP	0x0001
 #define	GIF_SEND_REVETHIP	0x0010
 #define	GIF_OPTMASK		(GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP)
 
 #endif /* _NET_IF_GIF_H_ */
Index: projects/arm_intrng/sys/net/if_gre.c
===================================================================
--- projects/arm_intrng/sys/net/if_gre.c	(revision 276247)
+++ projects/arm_intrng/sys/net/if_gre.c	(revision 276248)
@@ -1,971 +1,961 @@
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
  * Copyright (c) 2014 Andrey V. Elsukov 
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Heiko W.Rupp 
  *
  * IPv6-over-GRE contributed by Gert Doering 
  *
  * 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.
  *
  * $NetBSD: if_gre.c,v 1.49 2003/12/11 00:22:29 itojun Exp $
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #ifdef INET
 #include 
 #include 
 #include 
 #include 
 #endif
 
 #ifdef INET6
 #include 
 #include 
 #include 
 #include 
 #endif
 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 
 #define	GREMTU			1500
 static const char grename[] = "gre";
 static MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation");
 static VNET_DEFINE(struct mtx, gre_mtx);
 #define	V_gre_mtx	VNET(gre_mtx)
 #define	GRE_LIST_LOCK_INIT(x)		mtx_init(&V_gre_mtx, "gre_mtx", NULL, \
 					    MTX_DEF)
 #define	GRE_LIST_LOCK_DESTROY(x)	mtx_destroy(&V_gre_mtx)
 #define	GRE_LIST_LOCK(x)		mtx_lock(&V_gre_mtx)
 #define	GRE_LIST_UNLOCK(x)		mtx_unlock(&V_gre_mtx)
 
 static VNET_DEFINE(LIST_HEAD(, gre_softc), gre_softc_list);
 #define	V_gre_softc_list	VNET(gre_softc_list)
 static struct sx gre_ioctl_sx;
 SX_SYSINIT(gre_ioctl_sx, &gre_ioctl_sx, "gre_ioctl");
 
 static int	gre_clone_create(struct if_clone *, int, caddr_t);
 static void	gre_clone_destroy(struct ifnet *);
 static VNET_DEFINE(struct if_clone *, gre_cloner);
 #define	V_gre_cloner	VNET(gre_cloner)
 
 static void	gre_qflush(struct ifnet *);
 static int	gre_transmit(struct ifnet *, struct mbuf *);
 static int	gre_ioctl(struct ifnet *, u_long, caddr_t);
 static int	gre_output(struct ifnet *, struct mbuf *,
 		    const struct sockaddr *, struct route *);
 
 static void	gre_updatehdr(struct gre_softc *);
 static int	gre_set_tunnel(struct ifnet *, struct sockaddr *,
     struct sockaddr *);
 static void	gre_delete_tunnel(struct ifnet *);
 
-int		gre_input(struct mbuf **, int *, int);
-#ifdef INET
-extern int	in_gre_attach(struct gre_softc *);
-extern int	in_gre_output(struct mbuf *, int, int);
-#endif
-#ifdef INET6
-extern int	in6_gre_attach(struct gre_softc *);
-extern int	in6_gre_output(struct mbuf *, int, int);
-#endif
-
 SYSCTL_DECL(_net_link);
 static SYSCTL_NODE(_net_link, IFT_TUNNEL, gre, CTLFLAG_RW, 0,
     "Generic Routing Encapsulation");
 #ifndef MAX_GRE_NEST
 /*
  * This macro controls the default upper limitation on nesting of gre tunnels.
  * Since, setting a large value to this macro with a careless configuration
  * may introduce system crash, we don't allow any nestings by default.
  * If you need to configure nested gre tunnels, you can define this macro
  * in your kernel configuration file.  However, if you do so, please be
  * careful to configure the tunnels so that it won't make a loop.
  */
 #define MAX_GRE_NEST 1
 #endif
 
 static VNET_DEFINE(int, max_gre_nesting) = MAX_GRE_NEST;
 #define	V_max_gre_nesting	VNET(max_gre_nesting)
 SYSCTL_INT(_net_link_gre, OID_AUTO, max_nesting, CTLFLAG_RW | CTLFLAG_VNET,
     &VNET_NAME(max_gre_nesting), 0, "Max nested tunnels");
 
 static void
 vnet_gre_init(const void *unused __unused)
 {
 	LIST_INIT(&V_gre_softc_list);
 	GRE_LIST_LOCK_INIT();
 	V_gre_cloner = if_clone_simple(grename, gre_clone_create,
 	    gre_clone_destroy, 0);
 }
 VNET_SYSINIT(vnet_gre_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
     vnet_gre_init, NULL);
 
 static void
 vnet_gre_uninit(const void *unused __unused)
 {
 
 	if_clone_detach(V_gre_cloner);
 	GRE_LIST_LOCK_DESTROY();
 }
 VNET_SYSUNINIT(vnet_gre_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
     vnet_gre_uninit, NULL);
 
 static int
 gre_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
 	struct gre_softc *sc;
 
 	sc = malloc(sizeof(struct gre_softc), M_GRE, M_WAITOK | M_ZERO);
 	sc->gre_fibnum = curthread->td_proc->p_fibnum;
 	GRE2IFP(sc) = if_alloc(IFT_TUNNEL);
 	GRE_LOCK_INIT(sc);
 	GRE2IFP(sc)->if_softc = sc;
 	if_initname(GRE2IFP(sc), grename, unit);
 
 	GRE2IFP(sc)->if_mtu = sc->gre_mtu = GREMTU;
 	GRE2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
 	GRE2IFP(sc)->if_output = gre_output;
 	GRE2IFP(sc)->if_ioctl = gre_ioctl;
 	GRE2IFP(sc)->if_transmit = gre_transmit;
 	GRE2IFP(sc)->if_qflush = gre_qflush;
 	if_attach(GRE2IFP(sc));
 	bpfattach(GRE2IFP(sc), DLT_NULL, sizeof(u_int32_t));
 	GRE_LIST_LOCK();
 	LIST_INSERT_HEAD(&V_gre_softc_list, sc, gre_list);
 	GRE_LIST_UNLOCK();
 	return (0);
 }
 
 static void
 gre_clone_destroy(struct ifnet *ifp)
 {
 	struct gre_softc *sc;
 
 	sx_xlock(&gre_ioctl_sx);
 	sc = ifp->if_softc;
 	gre_delete_tunnel(ifp);
 	GRE_LIST_LOCK();
 	LIST_REMOVE(sc, gre_list);
 	GRE_LIST_UNLOCK();
 	bpfdetach(ifp);
 	if_detach(ifp);
 	ifp->if_softc = NULL;
 	sx_xunlock(&gre_ioctl_sx);
 
 	if_free(ifp);
 	GRE_LOCK_DESTROY(sc);
 	free(sc, M_GRE);
 }
 
 static int
 gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
 	GRE_RLOCK_TRACKER;
 	struct ifreq *ifr = (struct ifreq *)data;
 	struct sockaddr *src, *dst;
 	struct gre_softc *sc;
 #ifdef INET
 	struct sockaddr_in *sin = NULL;
 #endif
 #ifdef INET6
 	struct sockaddr_in6 *sin6 = NULL;
 #endif
 	uint32_t opt;
 	int error;
 
 	switch (cmd) {
 	case SIOCSIFMTU:
 		 /* XXX: */
 		if (ifr->ifr_mtu < 576)
 			return (EINVAL);
 		break;
 	case SIOCSIFADDR:
 		ifp->if_flags |= IFF_UP;
 	case SIOCSIFFLAGS:
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		return (0);
 	case GRESADDRS:
 	case GRESADDRD:
 	case GREGADDRS:
 	case GREGADDRD:
 	case GRESPROTO:
 	case GREGPROTO:
 		return (EOPNOTSUPP);
 	}
 	src = dst = NULL;
 	sx_xlock(&gre_ioctl_sx);
 	sc = ifp->if_softc;
 	if (sc == NULL) {
 		error = ENXIO;
 		goto end;
 	}
 	error = 0;
 	switch (cmd) {
 	case SIOCSIFMTU:
 		GRE_WLOCK(sc);
 		sc->gre_mtu = ifr->ifr_mtu;
 		gre_updatehdr(sc);
 		GRE_WUNLOCK(sc);
 		goto end;
 	case SIOCSIFPHYADDR:
 #ifdef INET6
 	case SIOCSIFPHYADDR_IN6:
 #endif
 		error = EINVAL;
 		switch (cmd) {
 #ifdef INET
 		case SIOCSIFPHYADDR:
 			src = (struct sockaddr *)
 				&(((struct in_aliasreq *)data)->ifra_addr);
 			dst = (struct sockaddr *)
 				&(((struct in_aliasreq *)data)->ifra_dstaddr);
 			break;
 #endif
 #ifdef INET6
 		case SIOCSIFPHYADDR_IN6:
 			src = (struct sockaddr *)
 				&(((struct in6_aliasreq *)data)->ifra_addr);
 			dst = (struct sockaddr *)
 				&(((struct in6_aliasreq *)data)->ifra_dstaddr);
 			break;
 #endif
 		default:
 			error = EAFNOSUPPORT;
 			goto end;
 		}
 		/* sa_family must be equal */
 		if (src->sa_family != dst->sa_family ||
 		    src->sa_len != dst->sa_len)
 			goto end;
 
 		/* validate sa_len */
 		switch (src->sa_family) {
 #ifdef INET
 		case AF_INET:
 			if (src->sa_len != sizeof(struct sockaddr_in))
 				goto end;
 			break;
 #endif
 #ifdef INET6
 		case AF_INET6:
 			if (src->sa_len != sizeof(struct sockaddr_in6))
 				goto end;
 			break;
 #endif
 		default:
 			error = EAFNOSUPPORT;
 			goto end;
 		}
 		/* check sa_family looks sane for the cmd */
 		error = EAFNOSUPPORT;
 		switch (cmd) {
 #ifdef INET
 		case SIOCSIFPHYADDR:
 			if (src->sa_family == AF_INET)
 				break;
 			goto end;
 #endif
 #ifdef INET6
 		case SIOCSIFPHYADDR_IN6:
 			if (src->sa_family == AF_INET6)
 				break;
 			goto end;
 #endif
 		}
 		error = EADDRNOTAVAIL;
 		switch (src->sa_family) {
 #ifdef INET
 		case AF_INET:
 			if (satosin(src)->sin_addr.s_addr == INADDR_ANY ||
 			    satosin(dst)->sin_addr.s_addr == INADDR_ANY)
 				goto end;
 			break;
 #endif
 #ifdef INET6
 		case AF_INET6:
 			if (IN6_IS_ADDR_UNSPECIFIED(&satosin6(src)->sin6_addr)
 			    ||
 			    IN6_IS_ADDR_UNSPECIFIED(&satosin6(dst)->sin6_addr))
 				goto end;
 			/*
 			 * Check validity of the scope zone ID of the
 			 * addresses, and convert it into the kernel
 			 * internal form if necessary.
 			 */
 			error = sa6_embedscope(satosin6(src), 0);
 			if (error != 0)
 				goto end;
 			error = sa6_embedscope(satosin6(dst), 0);
 			if (error != 0)
 				goto end;
 #endif
 		};
 		error = gre_set_tunnel(ifp, src, dst);
 		break;
 	case SIOCDIFPHYADDR:
 		gre_delete_tunnel(ifp);
 		break;
 	case SIOCGIFPSRCADDR:
 	case SIOCGIFPDSTADDR:
 #ifdef INET6
 	case SIOCGIFPSRCADDR_IN6:
 	case SIOCGIFPDSTADDR_IN6:
 #endif
 		if (sc->gre_family == 0) {
 			error = EADDRNOTAVAIL;
 			break;
 		}
 		GRE_RLOCK(sc);
 		switch (cmd) {
 #ifdef INET
 		case SIOCGIFPSRCADDR:
 		case SIOCGIFPDSTADDR:
 			if (sc->gre_family != AF_INET) {
 				error = EADDRNOTAVAIL;
 				break;
 			}
 			sin = (struct sockaddr_in *)&ifr->ifr_addr;
 			memset(sin, 0, sizeof(*sin));
 			sin->sin_family = AF_INET;
 			sin->sin_len = sizeof(*sin);
 			break;
 #endif
 #ifdef INET6
 		case SIOCGIFPSRCADDR_IN6:
 		case SIOCGIFPDSTADDR_IN6:
 			if (sc->gre_family != AF_INET6) {
 				error = EADDRNOTAVAIL;
 				break;
 			}
 			sin6 = (struct sockaddr_in6 *)
 				&(((struct in6_ifreq *)data)->ifr_addr);
 			memset(sin6, 0, sizeof(*sin6));
 			sin6->sin6_family = AF_INET6;
 			sin6->sin6_len = sizeof(*sin6);
 			break;
 #endif
 		}
 		if (error == 0) {
 			switch (cmd) {
 #ifdef INET
 			case SIOCGIFPSRCADDR:
 				sin->sin_addr = sc->gre_oip.ip_src;
 				break;
 			case SIOCGIFPDSTADDR:
 				sin->sin_addr = sc->gre_oip.ip_dst;
 				break;
 #endif
 #ifdef INET6
 			case SIOCGIFPSRCADDR_IN6:
 				sin6->sin6_addr = sc->gre_oip6.ip6_src;
 				break;
 			case SIOCGIFPDSTADDR_IN6:
 				sin6->sin6_addr = sc->gre_oip6.ip6_dst;
 				break;
 #endif
 			}
 		}
 		GRE_RUNLOCK(sc);
 		if (error != 0)
 			break;
 		switch (cmd) {
 #ifdef INET
 		case SIOCGIFPSRCADDR:
 		case SIOCGIFPDSTADDR:
 			error = prison_if(curthread->td_ucred,
 			    (struct sockaddr *)sin);
 			if (error != 0)
 				memset(sin, 0, sizeof(*sin));
 			break;
 #endif
 #ifdef INET6
 		case SIOCGIFPSRCADDR_IN6:
 		case SIOCGIFPDSTADDR_IN6:
 			error = prison_if(curthread->td_ucred,
 			    (struct sockaddr *)sin6);
 			if (error == 0)
 				error = sa6_recoverscope(sin6);
 			if (error != 0)
 				memset(sin6, 0, sizeof(*sin6));
 #endif
 		}
 		break;
 	case GRESKEY:
 		if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0)
 			break;
 		if ((error = copyin(ifr->ifr_data, &opt, sizeof(opt))) != 0)
 			break;
 		if (sc->gre_key != opt) {
 			GRE_WLOCK(sc);
 			sc->gre_key = opt;
 			gre_updatehdr(sc);
 			GRE_WUNLOCK(sc);
 		}
 		break;
 	case GREGKEY:
 		error = copyout(&sc->gre_key, ifr->ifr_data, sizeof(sc->gre_key));
 		break;
 	case GRESOPTS:
 		if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0)
 			break;
 		if ((error = copyin(ifr->ifr_data, &opt, sizeof(opt))) != 0)
 			break;
 		if (opt & ~GRE_OPTMASK)
 			error = EINVAL;
 		else {
 			if (sc->gre_options != opt) {
 				GRE_WLOCK(sc);
 				sc->gre_options = opt;
 				gre_updatehdr(sc);
 				GRE_WUNLOCK(sc);
 			}
 		}
 		break;
 
 	case GREGOPTS:
 		error = copyout(&sc->gre_options, ifr->ifr_data,
 		    sizeof(sc->gre_options));
 		break;
 	default:
 		error = EINVAL;
 		break;
 	}
 end:
 	sx_xunlock(&gre_ioctl_sx);
 	return (error);
 }
 
 static void
 gre_updatehdr(struct gre_softc *sc)
 {
 	struct grehdr *gh = NULL;
 	uint32_t *opts;
 	uint16_t flags;
 
 	GRE_WLOCK_ASSERT(sc);
 	switch (sc->gre_family) {
 #ifdef INET
 	case AF_INET:
 		sc->gre_hlen = sizeof(struct greip);
 		sc->gre_oip.ip_v = IPPROTO_IPV4;
 		sc->gre_oip.ip_hl = sizeof(struct ip) >> 2;
 		sc->gre_oip.ip_p = IPPROTO_GRE;
 		gh = &sc->gre_gihdr->gi_gre;
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		sc->gre_hlen = sizeof(struct greip6);
 		sc->gre_oip6.ip6_vfc = IPV6_VERSION;
 		sc->gre_oip6.ip6_nxt = IPPROTO_GRE;
 		gh = &sc->gre_gi6hdr->gi6_gre;
 		break;
 #endif
 	default:
 		return;
 	}
 	flags = 0;
 	opts = gh->gre_opts;
 	if (sc->gre_options & GRE_ENABLE_CSUM) {
 		flags |= GRE_FLAGS_CP;
 		sc->gre_hlen += 2 * sizeof(uint16_t);
 		*opts++ = 0;
 	}
 	if (sc->gre_key != 0) {
 		flags |= GRE_FLAGS_KP;
 		sc->gre_hlen += sizeof(uint32_t);
 		*opts++ = htonl(sc->gre_key);
 	}
 	if (sc->gre_options & GRE_ENABLE_SEQ) {
 		flags |= GRE_FLAGS_SP;
 		sc->gre_hlen += sizeof(uint32_t);
 		*opts++ = 0;
 	} else
 		sc->gre_oseq = 0;
 	gh->gre_flags = htons(flags);
 	GRE2IFP(sc)->if_mtu = sc->gre_mtu - sc->gre_hlen;
 }
 
 static void
 gre_detach(struct gre_softc *sc)
 {
 
 	sx_assert(&gre_ioctl_sx, SA_XLOCKED);
 	if (sc->gre_ecookie != NULL)
 		encap_detach(sc->gre_ecookie);
 	sc->gre_ecookie = NULL;
 }
 
 static int
 gre_set_tunnel(struct ifnet *ifp, struct sockaddr *src,
     struct sockaddr *dst)
 {
 	struct gre_softc *sc, *tsc;
 #ifdef INET6
 	struct ip6_hdr *ip6;
 #endif
 #ifdef INET
 	struct ip *ip;
 #endif
 	void *hdr;
 	int error;
 
 	sx_assert(&gre_ioctl_sx, SA_XLOCKED);
 	GRE_LIST_LOCK();
 	sc = ifp->if_softc;
 	LIST_FOREACH(tsc, &V_gre_softc_list, gre_list) {
 		if (tsc == sc || tsc->gre_family != src->sa_family)
 			continue;
 #ifdef INET
 		if (tsc->gre_family == AF_INET &&
 		    tsc->gre_oip.ip_src.s_addr ==
 		    satosin(src)->sin_addr.s_addr &&
 		    tsc->gre_oip.ip_dst.s_addr ==
 		    satosin(dst)->sin_addr.s_addr) {
 			GRE_LIST_UNLOCK();
 			return (EADDRNOTAVAIL);
 		}
 #endif
 #ifdef INET6
 		if (tsc->gre_family == AF_INET6 &&
 		    IN6_ARE_ADDR_EQUAL(&tsc->gre_oip6.ip6_src,
 		    &satosin6(src)->sin6_addr) &&
 		    IN6_ARE_ADDR_EQUAL(&tsc->gre_oip6.ip6_dst,
 			&satosin6(dst)->sin6_addr)) {
 			GRE_LIST_UNLOCK();
 			return (EADDRNOTAVAIL);
 		}
 #endif
 	}
 	GRE_LIST_UNLOCK();
 
 	switch (src->sa_family) {
 #ifdef INET
 	case AF_INET:
 		hdr = ip = malloc(sizeof(struct greip) +
 		    3 * sizeof(uint32_t), M_GRE, M_WAITOK | M_ZERO);
 		ip->ip_src = satosin(src)->sin_addr;
 		ip->ip_dst = satosin(dst)->sin_addr;
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		hdr = ip6 = malloc(sizeof(struct greip6) +
 		    3 * sizeof(uint32_t), M_GRE, M_WAITOK | M_ZERO);
 		ip6->ip6_src = satosin6(src)->sin6_addr;
 		ip6->ip6_dst = satosin6(dst)->sin6_addr;
 		break;
 #endif
 	default:
 		return (EAFNOSUPPORT);
 	}
 	if (sc->gre_family != src->sa_family)
 		gre_detach(sc);
 	GRE_WLOCK(sc);
 	if (sc->gre_family != 0)
 		free(sc->gre_hdr, M_GRE);
 	sc->gre_family = src->sa_family;
 	sc->gre_hdr = hdr;
 	sc->gre_oseq = 0;
 	sc->gre_iseq = UINT32_MAX;
 	gre_updatehdr(sc);
 	GRE_WUNLOCK(sc);
 
 	error = 0;
 	switch (src->sa_family) {
 #ifdef INET
 	case AF_INET:
 		error = in_gre_attach(sc);
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		error = in6_gre_attach(sc);
 		break;
 #endif
 	}
 	if (error == 0)
 		ifp->if_drv_flags |= IFF_DRV_RUNNING;
 	return (error);
 }
 
 static void
 gre_delete_tunnel(struct ifnet *ifp)
 {
 	struct gre_softc *sc = ifp->if_softc;
 	int family;
 
 	GRE_WLOCK(sc);
 	family = sc->gre_family;
 	sc->gre_family = 0;
 	GRE_WUNLOCK(sc);
 	if (family != 0) {
 		gre_detach(sc);
 		free(sc->gre_hdr, M_GRE);
 	}
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 }
 
 int
 gre_input(struct mbuf **mp, int *offp, int proto)
 {
 	struct gre_softc *sc;
 	struct grehdr *gh;
 	struct ifnet *ifp;
 	struct mbuf *m;
 	uint32_t *opts, key;
 	uint16_t flags;
 	int hlen, isr, af;
 
 	m = *mp;
 	sc = encap_getarg(m);
 	KASSERT(sc != NULL, ("encap_getarg returned NULL"));
 
 	ifp = GRE2IFP(sc);
 	gh = (struct grehdr *)mtodo(m, *offp);
 	flags = ntohs(gh->gre_flags);
 	if (flags & ~GRE_FLAGS_MASK)
 		goto drop;
 	opts = gh->gre_opts;
 	hlen = 2 * sizeof(uint16_t);
 	if (flags & GRE_FLAGS_CP) {
 		/* reserved1 field must be zero */
 		if (((uint16_t *)opts)[1] != 0)
 			goto drop;
 		if (in_cksum_skip(m, m->m_pkthdr.len, *offp) != 0)
 			goto drop;
 		hlen += 2 * sizeof(uint16_t);
 		opts++;
 	}
 	if (flags & GRE_FLAGS_KP) {
 		key = ntohl(*opts);
 		hlen += sizeof(uint32_t);
 		opts++;
 	} else
 		key = 0;
 	/*
 	if (sc->gre_key != 0 && (key != sc->gre_key || key != 0))
 		goto drop;
 	*/
 	if (flags & GRE_FLAGS_SP) {
 		/* seq = ntohl(*opts); */
 		hlen += sizeof(uint32_t);
 	}
 	switch (ntohs(gh->gre_proto)) {
 	case ETHERTYPE_WCCP:
 		/*
 		 * For WCCP skip an additional 4 bytes if after GRE header
 		 * doesn't follow an IP header.
 		 */
 		if (flags == 0 && (*(uint8_t *)gh->gre_opts & 0xF0) != 0x40)
 			hlen += sizeof(uint32_t);
 		/* FALLTHROUGH */
 	case ETHERTYPE_IP:
 		isr = NETISR_IP;
 		af = AF_INET;
 		break;
 	case ETHERTYPE_IPV6:
 		isr = NETISR_IPV6;
 		af = AF_INET6;
 		break;
 	default:
 		goto drop;
 	}
 	m_adj(m, *offp + hlen);
 	m_clrprotoflags(m);
 	m->m_pkthdr.rcvif = ifp;
 	M_SETFIB(m, sc->gre_fibnum);
 #ifdef MAC
 	mac_ifnet_create_mbuf(ifp, m);
 #endif
 	BPF_MTAP2(ifp, &af, sizeof(af), m);
 	if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
 	if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
 	if ((ifp->if_flags & IFF_MONITOR) != 0)
 		m_freem(m);
 	else
 		netisr_dispatch(isr, m);
 	return (IPPROTO_DONE);
 drop:
 	if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
 	m_freem(m);
 	return (IPPROTO_DONE);
 }
 
 #define	MTAG_GRE	1307983903
 static int
 gre_check_nesting(struct ifnet *ifp, struct mbuf *m)
 {
 	struct m_tag *mtag;
 	int count;
 
 	count = 1;
 	mtag = NULL;
 	while ((mtag = m_tag_locate(m, MTAG_GRE, 0, NULL)) != NULL) {
 		if (*(struct ifnet **)(mtag + 1) == ifp) {
 			log(LOG_NOTICE, "%s: loop detected\n", ifp->if_xname);
 			return (EIO);
 		}
 		count++;
 	}
 	if (count > V_max_gre_nesting) {
 		log(LOG_NOTICE,
 		    "%s: if_output recursively called too many times(%d)\n",
 		    ifp->if_xname, count);
 		return (EIO);
 	}
 	mtag = m_tag_alloc(MTAG_GRE, 0, sizeof(struct ifnet *), M_NOWAIT);
 	if (mtag == NULL)
 		return (ENOMEM);
 	*(struct ifnet **)(mtag + 1) = ifp;
 	m_tag_prepend(m, mtag);
 	return (0);
 }
 
 static int
 gre_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
    struct route *ro)
 {
 	uint32_t af;
 	int error;
 
 #ifdef MAC
 	error = mac_ifnet_check_transmit(ifp, m);
 	if (error != 0)
 		goto drop;
 #endif
 	if ((ifp->if_flags & IFF_MONITOR) != 0 ||
 	    (ifp->if_flags & IFF_UP) == 0) {
 		error = ENETDOWN;
 		goto drop;
 	}
 
 	error = gre_check_nesting(ifp, m);
 	if (error != 0)
 		goto drop;
 
 	m->m_flags &= ~(M_BCAST|M_MCAST);
 	if (dst->sa_family == AF_UNSPEC)
 		bcopy(dst->sa_data, &af, sizeof(af));
 	else
 		af = dst->sa_family;
 	BPF_MTAP2(ifp, &af, sizeof(af), m);
 	m->m_pkthdr.csum_data = af;	/* save af for if_transmit */
 	return (ifp->if_transmit(ifp, m));
 drop:
 	m_freem(m);
 	if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	return (error);
 }
 
 static void
 gre_setseqn(struct grehdr *gh, uint32_t seq)
 {
 	uint32_t *opts;
 	uint16_t flags;
 
 	opts = gh->gre_opts;
 	flags = ntohs(gh->gre_flags);
 	KASSERT((flags & GRE_FLAGS_SP) != 0,
 	    ("gre_setseqn called, but GRE_FLAGS_SP isn't set "));
 	if (flags & GRE_FLAGS_CP)
 		opts++;
 	if (flags & GRE_FLAGS_KP)
 		opts++;
 	*opts = htonl(seq);
 }
 
 static int
 gre_transmit(struct ifnet *ifp, struct mbuf *m)
 {
 	GRE_RLOCK_TRACKER;
 	struct gre_softc *sc;
 	struct grehdr *gh;
 	uint32_t iaf, oaf, oseq;
 	int error, hlen, olen, plen;
 	int want_seq, want_csum;
 
 	plen = 0;
 	sc = ifp->if_softc;
 	if (sc == NULL) {
 		error = ENETDOWN;
 		m_freem(m);
 		goto drop;
 	}
 	GRE_RLOCK(sc);
 	if (sc->gre_family == 0) {
 		GRE_RUNLOCK(sc);
 		error = ENETDOWN;
 		m_freem(m);
 		goto drop;
 	}
 	iaf = m->m_pkthdr.csum_data;
 	oaf = sc->gre_family;
 	hlen = sc->gre_hlen;
 	want_seq = (sc->gre_options & GRE_ENABLE_SEQ) != 0;
 	if (want_seq)
 		oseq = sc->gre_oseq++; /* XXX */
 	else
 		oseq = 0;		/* Make compiler happy. */
 	want_csum = (sc->gre_options & GRE_ENABLE_CSUM) != 0;
 	M_SETFIB(m, sc->gre_fibnum);
 	M_PREPEND(m, hlen, M_NOWAIT);
 	if (m == NULL) {
 		GRE_RUNLOCK(sc);
 		error = ENOBUFS;
 		goto drop;
 	}
 	bcopy(sc->gre_hdr, mtod(m, void *), hlen);
 	GRE_RUNLOCK(sc);
 	switch (oaf) {
 #ifdef INET
 	case AF_INET:
 		olen = sizeof(struct ip);
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		olen = sizeof(struct ip6_hdr);
 		break;
 #endif
 	default:
 		error = ENETDOWN;
 		goto drop;
 	}
 	gh = (struct grehdr *)mtodo(m, olen);
 	switch (iaf) {
 #ifdef INET
 	case AF_INET:
 		gh->gre_proto = htons(ETHERTYPE_IP);
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		gh->gre_proto = htons(ETHERTYPE_IPV6);
 		break;
 #endif
 	default:
 		error = ENETDOWN;
 		goto drop;
 	}
 	if (want_seq)
 		gre_setseqn(gh, oseq);
 	if (want_csum) {
 		*(uint16_t *)gh->gre_opts = in_cksum_skip(m,
 		    m->m_pkthdr.len, olen);
 	}
 	plen = m->m_pkthdr.len - hlen;
 	switch (oaf) {
 #ifdef INET
 	case AF_INET:
 		error = in_gre_output(m, iaf, hlen);
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		error = in6_gre_output(m, iaf, hlen);
 		break;
 #endif
 	default:
 		m_freem(m);
 		error = ENETDOWN;
 	};
 drop:
 	if (error)
 		if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
 	else {
 		if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1);
 		if_inc_counter(ifp, IFCOUNTER_OBYTES, plen);
 	}
 	return (error);
 }
 
 static void
 gre_qflush(struct ifnet *ifp __unused)
 {
 
 }
 
 static int
 gremodevent(module_t mod, int type, void *data)
 {
 
 	switch (type) {
 	case MOD_LOAD:
 	case MOD_UNLOAD:
 		break;
 	default:
 		return (EOPNOTSUPP);
 	}
 	return (0);
 }
 
 static moduledata_t gre_mod = {
 	"if_gre",
 	gremodevent,
 	0
 };
 
 DECLARE_MODULE(if_gre, gre_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
 MODULE_VERSION(if_gre, 1);
Index: projects/arm_intrng/sys/net/if_gre.h
===================================================================
--- projects/arm_intrng/sys/net/if_gre.h	(revision 276247)
+++ projects/arm_intrng/sys/net/if_gre.h	(revision 276248)
@@ -1,127 +1,136 @@
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
  * Copyright (c) 2014 Andrey V. Elsukov 
  * All rights reserved
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Heiko W.Rupp 
  *
  * 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.
  *
  * $NetBSD: if_gre.h,v 1.13 2003/11/10 08:51:52 wiz Exp $
  * $FreeBSD$
  */
 
 #ifndef _NET_IF_GRE_H_
 #define _NET_IF_GRE_H_
 
 #ifdef _KERNEL
 /* GRE header according to RFC 2784 and RFC 2890 */
 struct grehdr {
 	uint16_t	gre_flags;	/* GRE flags */
 #define	GRE_FLAGS_CP	0x8000		/* checksum present */
 #define	GRE_FLAGS_KP	0x2000		/* key present */
 #define	GRE_FLAGS_SP	0x1000		/* sequence present */
 #define	GRE_FLAGS_MASK	(GRE_FLAGS_CP|GRE_FLAGS_KP|GRE_FLAGS_SP)
 	uint16_t	gre_proto;	/* protocol type */
 	uint32_t	gre_opts[0];	/* optional fields */
 } __packed;
 
 #ifdef INET
 struct greip {
 	struct ip	gi_ip;
 	struct grehdr	gi_gre;
 } __packed;
 #endif
 
 #ifdef INET6
 struct greip6 {
 	struct ip6_hdr	gi6_ip6;
 	struct grehdr	gi6_gre;
 } __packed;
 #endif
 
 struct gre_softc {
 	struct ifnet		*gre_ifp;
 	LIST_ENTRY(gre_softc)	gre_list;
 	struct rmlock		gre_lock;
 	int			gre_family;	/* AF of delivery header */
 	uint32_t		gre_iseq;
 	uint32_t		gre_oseq;
 	uint32_t		gre_key;
 	uint32_t		gre_options;
 	uint32_t		gre_mtu;
 	u_int			gre_fibnum;
 	u_int			gre_hlen;	/* header size */
 	union {
 		void		*hdr;
 #ifdef INET
 		struct greip	*gihdr;
 #endif
 #ifdef INET6
 		struct greip6	*gi6hdr;
 #endif
 	} gre_uhdr;
 	const struct encaptab	*gre_ecookie;
 };
 #define	GRE2IFP(sc)		((sc)->gre_ifp)
 #define	GRE_LOCK_INIT(sc)	rm_init(&(sc)->gre_lock, "gre softc")
 #define	GRE_LOCK_DESTROY(sc)	rm_destroy(&(sc)->gre_lock)
 #define	GRE_RLOCK_TRACKER	struct rm_priotracker gre_tracker
 #define	GRE_RLOCK(sc)		rm_rlock(&(sc)->gre_lock, &gre_tracker)
 #define	GRE_RUNLOCK(sc)		rm_runlock(&(sc)->gre_lock, &gre_tracker)
 #define	GRE_RLOCK_ASSERT(sc)	rm_assert(&(sc)->gre_lock, RA_RLOCKED)
 #define	GRE_WLOCK(sc)		rm_wlock(&(sc)->gre_lock)
 #define	GRE_WUNLOCK(sc)		rm_wunlock(&(sc)->gre_lock)
 #define	GRE_WLOCK_ASSERT(sc)	rm_assert(&(sc)->gre_lock, RA_WLOCKED)
 
 #define	gre_hdr			gre_uhdr.hdr
 #define	gre_gihdr		gre_uhdr.gihdr
 #define	gre_gi6hdr		gre_uhdr.gi6hdr
 #define	gre_oip			gre_gihdr->gi_ip
 #define	gre_oip6		gre_gi6hdr->gi6_ip6
 
+int	gre_input(struct mbuf **, int *, int);
+#ifdef INET
+int	in_gre_attach(struct gre_softc *);
+int	in_gre_output(struct mbuf *, int, int);
+#endif
+#ifdef INET6
+int	in6_gre_attach(struct gre_softc *);
+int	in6_gre_output(struct mbuf *, int, int);
+#endif
 /*
  * CISCO uses special type for GRE tunnel created as part of WCCP
  * connection, while in fact those packets are just IPv4 encapsulated
  * into GRE.
  */
 #define ETHERTYPE_WCCP		0x883E
 #endif /* _KERNEL */
 
 #define GRESADDRS	_IOW('i', 101, struct ifreq)
 #define GRESADDRD	_IOW('i', 102, struct ifreq)
 #define GREGADDRS	_IOWR('i', 103, struct ifreq)
 #define GREGADDRD	_IOWR('i', 104, struct ifreq)
 #define GRESPROTO	_IOW('i' , 105, struct ifreq)
 #define GREGPROTO	_IOWR('i', 106, struct ifreq)
 
 #define	GREGKEY		_IOWR('i', 107, struct ifreq)
 #define	GRESKEY		_IOW('i', 108, struct ifreq)
 #define	GREGOPTS	_IOWR('i', 109, struct ifreq)
 #define	GRESOPTS	_IOW('i', 110, struct ifreq)
 
 #define	GRE_ENABLE_CSUM		0x0001
 #define	GRE_ENABLE_SEQ		0x0002
 #define	GRE_OPTMASK		(GRE_ENABLE_CSUM|GRE_ENABLE_SEQ)
 
 #endif /* _NET_IF_GRE_H_ */
Index: projects/arm_intrng/sys/netinet/in_gif.c
===================================================================
--- projects/arm_intrng/sys/netinet/in_gif.c	(revision 276247)
+++ projects/arm_intrng/sys/netinet/in_gif.c	(revision 276248)
@@ -1,245 +1,241 @@
 /*-
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
  *
  *	$KAME: in_gif.c,v 1.54 2001/05/14 14:02:16 itojun Exp $
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #ifdef INET6
 #include 
 #endif
 
 #include 
 
-int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
-int in_gif_encapcheck(const struct mbuf *, int, int, void *);
-int in_gif_attach(struct gif_softc *);
-
 static int gif_validate4(const struct ip *, struct gif_softc *,
 	struct ifnet *);
 static int in_gif_input(struct mbuf **, int *, int);
 
 extern  struct domain inetdomain;
 static struct protosw in_gif_protosw = {
 	.pr_type =		SOCK_RAW,
 	.pr_domain =		&inetdomain,
 	.pr_protocol =		0/* IPPROTO_IPV[46] */,
 	.pr_flags =		PR_ATOMIC|PR_ADDR,
 	.pr_input =		in_gif_input,
 	.pr_output =		rip_output,
 	.pr_ctloutput =		rip_ctloutput,
 	.pr_usrreqs =		&rip_usrreqs
 };
 
 #define GIF_TTL		30
 static VNET_DEFINE(int, ip_gif_ttl) = GIF_TTL;
 #define	V_ip_gif_ttl		VNET(ip_gif_ttl)
 SYSCTL_INT(_net_inet_ip, IPCTL_GIF_TTL, gifttl, CTLFLAG_VNET | CTLFLAG_RW,
 	&VNET_NAME(ip_gif_ttl), 0, "");
 
 int
 in_gif_output(struct ifnet *ifp, struct mbuf *m, int proto, uint8_t ecn)
 {
 	GIF_RLOCK_TRACKER;
 	struct gif_softc *sc = ifp->if_softc;
 	struct ip *ip;
 	int len;
 
 	/* prepend new IP header */
 	len = sizeof(struct ip);
 #ifndef __NO_STRICT_ALIGNMENT
 	if (proto == IPPROTO_ETHERIP)
 		len += ETHERIP_ALIGN;
 #endif
 	M_PREPEND(m, len, M_NOWAIT);
 	if (m == NULL)
 		return (ENOBUFS);
 #ifndef __NO_STRICT_ALIGNMENT
 	if (proto == IPPROTO_ETHERIP) {
 		len = mtod(m, vm_offset_t) & 3;
 		KASSERT(len == 0 || len == ETHERIP_ALIGN,
 		    ("in_gif_output: unexpected misalignment"));
 		m->m_data += len;
 		m->m_len -= ETHERIP_ALIGN;
 	}
 #endif
 	ip = mtod(m, struct ip *);
 	GIF_RLOCK(sc);
 	if (sc->gif_family != AF_INET) {
 		m_freem(m);
 		GIF_RUNLOCK(sc);
 		return (ENETDOWN);
 	}
 	bcopy(sc->gif_iphdr, ip, sizeof(struct ip));
 	GIF_RUNLOCK(sc);
 
 	ip->ip_p = proto;
 	/* version will be set in ip_output() */
 	ip->ip_ttl = V_ip_gif_ttl;
 	ip->ip_len = htons(m->m_pkthdr.len);
 	ip->ip_tos = ecn;
 
 	return (ip_output(m, NULL, NULL, 0, NULL, NULL));
 }
 
 static int
 in_gif_input(struct mbuf **mp, int *offp, int proto)
 {
 	struct mbuf *m = *mp;
 	struct gif_softc *sc;
 	struct ifnet *gifp;
 	struct ip *ip;
 	uint8_t ecn;
 
 	sc = encap_getarg(m);
 	if (sc == NULL) {
 		m_freem(m);
 		KMOD_IPSTAT_INC(ips_nogif);
 		return (IPPROTO_DONE);
 	}
 	gifp = GIF2IFP(sc);
 	if ((gifp->if_flags & IFF_UP) != 0) {
 		ip = mtod(m, struct ip *);
 		ecn = ip->ip_tos;
 		m_adj(m, *offp);
 		gif_input(m, gifp, proto, ecn);
 	} else {
 		m_freem(m);
 		KMOD_IPSTAT_INC(ips_nogif);
 	}
 	return (IPPROTO_DONE);
 }
 
 /*
  * validate outer address.
  */
 static int
 gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp)
 {
 
 	GIF_RLOCK_ASSERT(sc);
 
 	/* check for address match */
 	if (sc->gif_iphdr->ip_src.s_addr != ip->ip_dst.s_addr ||
 	    sc->gif_iphdr->ip_dst.s_addr != ip->ip_src.s_addr)
 		return (0);
 
 	/* martian filters on outer source - NOT done in ip_input! */
 	if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)))
 		return (0);
 	switch ((ntohl(ip->ip_src.s_addr) & 0xff000000) >> 24) {
 	case 0:
 	case 127:
 	case 255:
 		return (0);
 	}
 
 	/* ingress filters on outer source */
 	if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) {
 		struct sockaddr_in sin;
 		struct rtentry *rt;
 
 		bzero(&sin, sizeof(sin));
 		sin.sin_family = AF_INET;
 		sin.sin_len = sizeof(struct sockaddr_in);
 		sin.sin_addr = ip->ip_src;
 		/* XXX MRT  check for the interface we would use on output */
 		rt = in_rtalloc1((struct sockaddr *)&sin, 0,
 		    0UL, sc->gif_fibnum);
 		if (!rt || rt->rt_ifp != ifp) {
 			if (rt)
 				RTFREE_LOCKED(rt);
 			return (0);
 		}
 		RTFREE_LOCKED(rt);
 	}
 	return (32 * 2);
 }
 
 /*
  * we know that we are in IFF_UP, outer address available, and outer family
  * matched the physical addr family.  see gif_encapcheck().
  */
 int
 in_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
 {
 	struct ip ip;
 	struct gif_softc *sc;
 	struct ifnet *ifp;
 
 	/* sanity check done in caller */
 	sc = (struct gif_softc *)arg;
 	GIF_RLOCK_ASSERT(sc);
 
 	m_copydata(m, 0, sizeof(ip), (caddr_t)&ip);
 	ifp = ((m->m_flags & M_PKTHDR) != 0) ? m->m_pkthdr.rcvif : NULL;
 	return (gif_validate4(&ip, sc, ifp));
 }
 
 int
 in_gif_attach(struct gif_softc *sc)
 {
 
 	KASSERT(sc->gif_ecookie == NULL, ("gif_ecookie isn't NULL"));
 	sc->gif_ecookie = encap_attach_func(AF_INET, -1, gif_encapcheck,
 	    &in_gif_protosw, sc);
 	if (sc->gif_ecookie == NULL)
 		return (EEXIST);
 	return (0);
 }
Index: projects/arm_intrng/sys/netinet/ip_gre.c
===================================================================
--- projects/arm_intrng/sys/netinet/ip_gre.c	(revision 276247)
+++ projects/arm_intrng/sys/netinet/ip_gre.c	(revision 276248)
@@ -1,172 +1,167 @@
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
  * Copyright (c) 2014 Andrey V. Elsukov 
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Heiko W.Rupp 
  *
  * IPv6-over-GRE contributed by Gert Doering 
  *
  * 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.
  *
  * $NetBSD: ip_gre.c,v 1.29 2003/09/05 23:02:43 itojun Exp $
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #ifdef INET6
 #include 
 #endif
 
 #include 
 
 extern struct domain inetdomain;
-extern int gre_input(struct mbuf **, int *, int);
-
-int in_gre_attach(struct gre_softc *);
-int in_gre_output(struct mbuf *, int, int);
-
 static const struct protosw in_gre_protosw = {
 	.pr_type =		SOCK_RAW,
 	.pr_domain =		&inetdomain,
 	.pr_protocol =		IPPROTO_GRE,
 	.pr_flags =		PR_ATOMIC|PR_ADDR,
 	.pr_input =		gre_input,
 	.pr_output =		rip_output,
 	.pr_ctlinput =		rip_ctlinput,
 	.pr_ctloutput =		rip_ctloutput,
 	.pr_usrreqs =		&rip_usrreqs
 };
 
 #define	GRE_TTL			30
 VNET_DEFINE(int, ip_gre_ttl) = GRE_TTL;
 #define	V_ip_gre_ttl		VNET(ip_gre_ttl)
 SYSCTL_INT(_net_inet_ip, OID_AUTO, grettl, CTLFLAG_VNET | CTLFLAG_RW,
 	&VNET_NAME(ip_gre_ttl), 0, "");
 
 static int
 in_gre_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
 {
 	GRE_RLOCK_TRACKER;
 	struct gre_softc *sc;
 	struct ip *ip;
 
 	sc = (struct gre_softc *)arg;
 	if ((GRE2IFP(sc)->if_flags & IFF_UP) == 0)
 		return (0);
 
 	M_ASSERTPKTHDR(m);
 	/*
 	 * We expect that payload contains at least IPv4
 	 * or IPv6 packet.
 	 */
 	if (m->m_pkthdr.len < sizeof(struct greip) + sizeof(struct ip))
 		return (0);
 
 	GRE_RLOCK(sc);
 	if (sc->gre_family == 0)
 		goto bad;
 
 	KASSERT(sc->gre_family == AF_INET,
 	    ("wrong gre_family: %d", sc->gre_family));
 
 	ip = mtod(m, struct ip *);
 	if (sc->gre_oip.ip_src.s_addr != ip->ip_dst.s_addr ||
 	    sc->gre_oip.ip_dst.s_addr != ip->ip_src.s_addr)
 		goto bad;
 
 	GRE_RUNLOCK(sc);
 	return (32 * 2);
 bad:
 	GRE_RUNLOCK(sc);
 	return (0);
 }
 
 int
 in_gre_output(struct mbuf *m, int af, int hlen)
 {
 	struct greip *gi;
 
 	gi = mtod(m, struct greip *);
 	switch (af) {
 	case AF_INET:
 		/*
 		 * gre_transmit() has used M_PREPEND() that doesn't guarantee
 		 * m_data is contiguous more than hlen bytes. Use m_copydata()
 		 * here to avoid m_pullup().
 		 */
 		m_copydata(m, hlen + offsetof(struct ip, ip_tos),
 		    sizeof(u_char), &gi->gi_ip.ip_tos);
 		m_copydata(m, hlen + offsetof(struct ip, ip_id),
 		    sizeof(u_short), (caddr_t)&gi->gi_ip.ip_id);
 		break;
 #ifdef INET6
 	case AF_INET6:
 		gi->gi_ip.ip_tos = 0; /* XXX */
 		gi->gi_ip.ip_id = ip_newid();
 		break;
 #endif
 	}
 	gi->gi_ip.ip_ttl = V_ip_gre_ttl;
 	gi->gi_ip.ip_len = htons(m->m_pkthdr.len);
 	return (ip_output(m, NULL, NULL, IP_FORWARDING, NULL, NULL));
 }
 
 int
 in_gre_attach(struct gre_softc *sc)
 {
 
 	KASSERT(sc->gre_ecookie == NULL, ("gre_ecookie isn't NULL"));
 	sc->gre_ecookie = encap_attach_func(AF_INET, IPPROTO_GRE,
 	    in_gre_encapcheck, &in_gre_protosw, sc);
 	if (sc->gre_ecookie == NULL)
 		return (EEXIST);
 	return (0);
 }
Index: projects/arm_intrng/sys/netinet6/in6_gif.c
===================================================================
--- projects/arm_intrng/sys/netinet6/in6_gif.c	(revision 276247)
+++ projects/arm_intrng/sys/netinet6/in6_gif.c	(revision 276248)
@@ -1,254 +1,250 @@
 /*-
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
  *
  *	$KAME: in6_gif.c,v 1.49 2001/05/14 14:02:17 itojun Exp $
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #ifdef INET
 #include 
 #endif
 #include 
 #ifdef INET6
 #include 
 #include 
 #include 
 #endif
 #include 
 #ifdef INET6
 #include 
 #endif
 
 #include 
 
 #define GIF_HLIM	30
 static VNET_DEFINE(int, ip6_gif_hlim) = GIF_HLIM;
 #define	V_ip6_gif_hlim			VNET(ip6_gif_hlim)
 
 SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM, gifhlim, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(ip6_gif_hlim), 0, "");
 
-int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
-int in6_gif_encapcheck(const struct mbuf *, int, int, void *);
-int in6_gif_attach(struct gif_softc *);
-
 static int gif_validate6(const struct ip6_hdr *, struct gif_softc *,
 			 struct ifnet *);
 static int in6_gif_input(struct mbuf **, int *, int);
 
 extern  struct domain inet6domain;
 static struct protosw in6_gif_protosw = {
 	.pr_type =	SOCK_RAW,
 	.pr_domain =	&inet6domain,
 	.pr_protocol =	0,			/* IPPROTO_IPV[46] */
 	.pr_flags =	PR_ATOMIC|PR_ADDR,
 	.pr_input =	in6_gif_input,
 	.pr_output =	rip6_output,
 	.pr_ctloutput =	rip6_ctloutput,
 	.pr_usrreqs =	&rip6_usrreqs
 };
 
 int
 in6_gif_output(struct ifnet *ifp, struct mbuf *m, int proto, uint8_t ecn)
 {
 	GIF_RLOCK_TRACKER;
 	struct gif_softc *sc = ifp->if_softc;
 	struct ip6_hdr *ip6;
 	int len;
 
 	/* prepend new IP header */
 	len = sizeof(struct ip6_hdr);
 #ifndef __NO_STRICT_ALIGNMENT
 	if (proto == IPPROTO_ETHERIP)
 		len += ETHERIP_ALIGN;
 #endif
 	M_PREPEND(m, len, M_NOWAIT);
 	if (m == NULL)
 		return (ENOBUFS);
 #ifndef __NO_STRICT_ALIGNMENT
 	if (proto == IPPROTO_ETHERIP) {
 		len = mtod(m, vm_offset_t) & 3;
 		KASSERT(len == 0 || len == ETHERIP_ALIGN,
 		    ("in6_gif_output: unexpected misalignment"));
 		m->m_data += len;
 		m->m_len -= ETHERIP_ALIGN;
 	}
 #endif
 
 	ip6 = mtod(m, struct ip6_hdr *);
 	GIF_RLOCK(sc);
 	if (sc->gif_family != AF_INET6) {
 		m_freem(m);
 		GIF_RUNLOCK(sc);
 		return (ENETDOWN);
 	}
 	bcopy(sc->gif_ip6hdr, ip6, sizeof(struct ip6_hdr));
 	GIF_RUNLOCK(sc);
 
 	ip6->ip6_flow  |= htonl((uint32_t)ecn << 20);
 	ip6->ip6_nxt	= proto;
 	ip6->ip6_hlim	= V_ip6_gif_hlim;
 	/*
 	 * force fragmentation to minimum MTU, to avoid path MTU discovery.
 	 * it is too painful to ask for resend of inner packet, to achieve
 	 * path MTU discovery for encapsulated packets.
 	 */
 	return (ip6_output(m, 0, NULL, IPV6_MINMTU, 0, NULL, NULL));
 }
 
 static int
 in6_gif_input(struct mbuf **mp, int *offp, int proto)
 {
 	struct mbuf *m = *mp;
 	struct ifnet *gifp;
 	struct gif_softc *sc;
 	struct ip6_hdr *ip6;
 	uint8_t ecn;
 
 	sc = encap_getarg(m);
 	if (sc == NULL) {
 		m_freem(m);
 		IP6STAT_INC(ip6s_nogif);
 		return (IPPROTO_DONE);
 	}
 	gifp = GIF2IFP(sc);
 	if ((gifp->if_flags & IFF_UP) != 0) {
 		ip6 = mtod(m, struct ip6_hdr *);
 		ecn = (ntohl(ip6->ip6_flow) >> 20) & 0xff;
 		m_adj(m, *offp);
 		gif_input(m, gifp, proto, ecn);
 	} else {
 		m_freem(m);
 		IP6STAT_INC(ip6s_nogif);
 	}
 	return (IPPROTO_DONE);
 }
 
 /*
  * validate outer address.
  */
 static int
 gif_validate6(const struct ip6_hdr *ip6, struct gif_softc *sc,
     struct ifnet *ifp)
 {
 
 	GIF_RLOCK_ASSERT(sc);
 	/*
 	 * Check for address match.  Note that the check is for an incoming
 	 * packet.  We should compare the *source* address in our configuration
 	 * and the *destination* address of the packet, and vice versa.
 	 */
 	if (!IN6_ARE_ADDR_EQUAL(&sc->gif_ip6hdr->ip6_src, &ip6->ip6_dst) ||
 	    !IN6_ARE_ADDR_EQUAL(&sc->gif_ip6hdr->ip6_dst, &ip6->ip6_src))
 		return (0);
 
 	/* martian filters on outer source - done in ip6_input */
 
 	/* ingress filters on outer source */
 	if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) {
 		struct sockaddr_in6 sin6;
 		struct rtentry *rt;
 
 		bzero(&sin6, sizeof(sin6));
 		sin6.sin6_family = AF_INET6;
 		sin6.sin6_len = sizeof(struct sockaddr_in6);
 		sin6.sin6_addr = ip6->ip6_src;
 		sin6.sin6_scope_id = 0; /* XXX */
 
 		rt = in6_rtalloc1((struct sockaddr *)&sin6, 0, 0UL,
 		    sc->gif_fibnum);
 		if (!rt || rt->rt_ifp != ifp) {
 			if (rt)
 				RTFREE_LOCKED(rt);
 			return (0);
 		}
 		RTFREE_LOCKED(rt);
 	}
 
 	return (128 * 2);
 }
 
 /*
  * we know that we are in IFF_UP, outer address available, and outer family
  * matched the physical addr family.  see gif_encapcheck().
  */
 int
 in6_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
 {
 	struct ip6_hdr ip6;
 	struct gif_softc *sc;
 	struct ifnet *ifp;
 
 	/* sanity check done in caller */
 	sc = (struct gif_softc *)arg;
 	GIF_RLOCK_ASSERT(sc);
 
 	m_copydata(m, 0, sizeof(ip6), (caddr_t)&ip6);
 	ifp = ((m->m_flags & M_PKTHDR) != 0) ? m->m_pkthdr.rcvif : NULL;
 	return (gif_validate6(&ip6, sc, ifp));
 }
 
 int
 in6_gif_attach(struct gif_softc *sc)
 {
 
 	KASSERT(sc->gif_ecookie == NULL, ("gif_ecookie isn't NULL"));
 	sc->gif_ecookie = encap_attach_func(AF_INET6, -1, gif_encapcheck,
 	    (void *)&in6_gif_protosw, sc);
 	if (sc->gif_ecookie == NULL)
 		return (EEXIST);
 	return (0);
 }
Index: projects/arm_intrng/sys/netinet6/ip6_gre.c
===================================================================
--- projects/arm_intrng/sys/netinet6/ip6_gre.c	(revision 276247)
+++ projects/arm_intrng/sys/netinet6/ip6_gre.c	(revision 276248)
@@ -1,151 +1,146 @@
 /*-
  * Copyright (c) 2014 Andrey V. Elsukov 
  * 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 AUTHOR ``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 AUTHOR 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.
  */
 
 #include 
 __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #ifdef INET
 #include 
 #include 
 #endif
 #include 
 #include 
 #include 
 #include 
 #include 
 
 extern  struct domain inet6domain;
-extern int gre_input(struct mbuf **, int *, int);
-
-int in6_gre_attach(struct gre_softc *);
-int in6_gre_output(struct mbuf *, int, int);
-
 struct protosw in6_gre_protosw = {
 	.pr_type =	SOCK_RAW,
 	.pr_domain =	&inet6domain,
 	.pr_protocol =	IPPROTO_GRE,
 	.pr_flags =	PR_ATOMIC|PR_ADDR,
 	.pr_input =	gre_input,
 	.pr_output =	rip6_output,
 	.pr_ctloutput =	rip6_ctloutput,
 	.pr_usrreqs =	&rip6_usrreqs
 };
 
 VNET_DEFINE(int, ip6_gre_hlim) = IPV6_DEFHLIM;
 #define	V_ip6_gre_hlim		VNET(ip6_gre_hlim)
 
 SYSCTL_DECL(_net_inet6_ip6);
 SYSCTL_INT(_net_inet6_ip6, OID_AUTO, grehlim, CTLFLAG_VNET | CTLFLAG_RW,
     &VNET_NAME(ip6_gre_hlim), 0, "Default hop limit for encapsulated packets");
 
 static int
 in6_gre_encapcheck(const struct mbuf *m, int off, int proto, void *arg)
 {
 	GRE_RLOCK_TRACKER;
 	struct gre_softc *sc;
 	struct ip6_hdr *ip6;
 
 	sc = (struct gre_softc *)arg;
 	if ((GRE2IFP(sc)->if_flags & IFF_UP) == 0)
 		return (0);
 
 	M_ASSERTPKTHDR(m);
 	/*
 	 * We expect that payload contains at least IPv4
 	 * or IPv6 packet.
 	 */
 	if (m->m_pkthdr.len < sizeof(struct greip6) +
 #ifdef INET
 	    sizeof(struct ip))
 #else
 	    sizeof(struct ip6_hdr))
 #endif
 		return (0);
 
 	GRE_RLOCK(sc);
 	if (sc->gre_family == 0)
 		goto bad;
 
 	KASSERT(sc->gre_family == AF_INET6,
 	    ("wrong gre_family: %d", sc->gre_family));
 
 	ip6 = mtod(m, struct ip6_hdr *);
 	if (!IN6_ARE_ADDR_EQUAL(&sc->gre_oip6.ip6_src, &ip6->ip6_dst) ||
 	    !IN6_ARE_ADDR_EQUAL(&sc->gre_oip6.ip6_dst, &ip6->ip6_src))
 		goto bad;
 
 	GRE_RUNLOCK(sc);
 	return (128 * 2);
 bad:
 	GRE_RUNLOCK(sc);
 	return (0);
 }
 
 int
 in6_gre_output(struct mbuf *m, int af, int hlen)
 {
 	struct greip6 *gi6;
 
 	gi6 = mtod(m, struct greip6 *);
 	gi6->gi6_ip6.ip6_hlim = V_ip6_gre_hlim;
 	return (ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, NULL, NULL));
 }
 
 int
 in6_gre_attach(struct gre_softc *sc)
 {
 
 	KASSERT(sc->gre_ecookie == NULL, ("gre_ecookie isn't NULL"));
 	sc->gre_ecookie = encap_attach_func(AF_INET6, IPPROTO_GRE,
 	    in6_gre_encapcheck, &in6_gre_protosw, sc);
 	if (sc->gre_ecookie == NULL)
 		return (EEXIST);
 	return (0);
 }
Index: projects/arm_intrng/sys/netipsec/ipsec.c
===================================================================
--- projects/arm_intrng/sys/netipsec/ipsec.c	(revision 276247)
+++ projects/arm_intrng/sys/netipsec/ipsec.c	(revision 276248)
@@ -1,1735 +1,1730 @@
 /*	$FreeBSD$	*/
 /*	$KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
  */
 
 /*
  * IPsec controller part.
  */
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #ifdef INET6
 #include 
 #endif
 #include 
 #ifdef INET6
 #include 
 #endif
 
 #include 
 #include 
 #ifdef INET6
 #include 
 #endif
 #include 
 #include 
 #include 		/*XXX*/
 #include 
 
 #include 
 #include 
 #include 
 
 #include 
 
 #include 
 
 #include 
 
 #ifdef IPSEC_DEBUG
 VNET_DEFINE(int, ipsec_debug) = 1;
 #else
 VNET_DEFINE(int, ipsec_debug) = 0;
 #endif
 
 /* NB: name changed so netstat doesn't use it. */
 VNET_PCPUSTAT_DEFINE(struct ipsecstat, ipsec4stat);
 VNET_PCPUSTAT_SYSINIT(ipsec4stat);
 
 #ifdef VIMAGE
 VNET_PCPUSTAT_SYSUNINIT(ipsec4stat);
 #endif /* VIMAGE */
 
 VNET_DEFINE(int, ip4_ah_offsetmask) = 0;	/* maybe IP_DF? */
 /* DF bit on encap. 0: clear 1: set 2: copy */
 VNET_DEFINE(int, ip4_ipsec_dfbit) = 0;
 VNET_DEFINE(int, ip4_esp_trans_deflev) = IPSEC_LEVEL_USE;
 VNET_DEFINE(int, ip4_esp_net_deflev) = IPSEC_LEVEL_USE;
 VNET_DEFINE(int, ip4_ah_trans_deflev) = IPSEC_LEVEL_USE;
 VNET_DEFINE(int, ip4_ah_net_deflev) = IPSEC_LEVEL_USE;
-VNET_DEFINE(struct secpolicy, ip4_def_policy);
 /* ECN ignore(-1)/forbidden(0)/allowed(1) */
 VNET_DEFINE(int, ip4_ipsec_ecn) = 0;
 VNET_DEFINE(int, ip4_esp_randpad) = -1;
 
+static VNET_DEFINE(struct secpolicy, def_policy);
+#define	V_def_policy	VNET(def_policy)
 /*
  * Crypto support requirements:
  *
  *  1	require hardware support
  * -1	require software support
  *  0	take anything
  */
 VNET_DEFINE(int, crypto_support) = CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE;
 
 FEATURE(ipsec, "Internet Protocol Security (IPsec)");
 #ifdef IPSEC_NAT_T
 FEATURE(ipsec_natt, "UDP Encapsulation of IPsec ESP Packets ('NAT-T')");
 #endif
 
 SYSCTL_DECL(_net_inet_ipsec);
 
 /* net.inet.ipsec */
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DEF_POLICY, def_policy,
-	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_def_policy).policy, 0,
+	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(def_policy).policy, 0,
 	"IPsec default policy.");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DEF_ESP_TRANSLEV, esp_trans_deflev,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_esp_trans_deflev), 0,
 	"Default ESP transport mode level");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DEF_ESP_NETLEV, esp_net_deflev,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_esp_net_deflev), 0,
 	"Default ESP tunnel mode level.");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DEF_AH_TRANSLEV, ah_trans_deflev,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_ah_trans_deflev), 0,
 	"AH transfer mode default level.");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DEF_AH_NETLEV, ah_net_deflev,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_ah_net_deflev), 0,
 	"AH tunnel mode default level.");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_AH_CLEARTOS, ah_cleartos,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ah_cleartos), 0,
 	"If set clear type-of-service field when doing AH computation.");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_AH_OFFSETMASK, ah_offsetmask,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_ah_offsetmask), 0,
 	"If not set clear offset field mask when doing AH computation.");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DFBIT, dfbit,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_ipsec_dfbit), 0,
 	"Do not fragment bit on encap.");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_ECN, ecn,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_ipsec_ecn), 0,
 	"Explicit Congestion Notification handling.");
 SYSCTL_INT(_net_inet_ipsec, IPSECCTL_DEBUG, debug,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsec_debug), 0,
 	"Enable IPsec debugging output when set.");
 SYSCTL_INT(_net_inet_ipsec, OID_AUTO, crypto_support,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(crypto_support), 0,
 	"Crypto driver selection.");
 SYSCTL_VNET_PCPUSTAT(_net_inet_ipsec, OID_AUTO, ipsecstats, struct ipsecstat,
     ipsec4stat, "IPsec IPv4 statistics.");
 
 #ifdef REGRESSION
 /*
  * When set to 1, IPsec will send packets with the same sequence number.
  * This allows to verify if the other side has proper replay attacks detection.
  */
 VNET_DEFINE(int, ipsec_replay) = 0;
 SYSCTL_INT(_net_inet_ipsec, OID_AUTO, test_replay,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsec_replay), 0,
 	"Emulate replay attack");
 /*
  * When set 1, IPsec will send packets with corrupted HMAC.
  * This allows to verify if the other side properly detects modified packets.
  */
 VNET_DEFINE(int, ipsec_integrity) = 0;
 SYSCTL_INT(_net_inet_ipsec, OID_AUTO, test_integrity,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsec_integrity), 0,
 	"Emulate man-in-the-middle attack");
 #endif
 
 #ifdef INET6 
 VNET_PCPUSTAT_DEFINE(struct ipsecstat, ipsec6stat);
 VNET_PCPUSTAT_SYSINIT(ipsec6stat);
 
 #ifdef VIMAGE
 VNET_PCPUSTAT_SYSUNINIT(ipsec6stat);
 #endif /* VIMAGE */
 
 VNET_DEFINE(int, ip6_esp_trans_deflev) = IPSEC_LEVEL_USE;
 VNET_DEFINE(int, ip6_esp_net_deflev) = IPSEC_LEVEL_USE;
 VNET_DEFINE(int, ip6_ah_trans_deflev) = IPSEC_LEVEL_USE;
 VNET_DEFINE(int, ip6_ah_net_deflev) = IPSEC_LEVEL_USE;
 VNET_DEFINE(int, ip6_ipsec_ecn) = 0;	/* ECN ignore(-1)/forbidden(0)/allowed(1) */
 
 SYSCTL_DECL(_net_inet6_ipsec6);
 
 /* net.inet6.ipsec6 */
 SYSCTL_INT(_net_inet6_ipsec6, IPSECCTL_DEF_POLICY, def_policy,
-	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip4_def_policy).policy, 0,
+	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(def_policy).policy, 0,
 	"IPsec default policy.");
 SYSCTL_INT(_net_inet6_ipsec6, IPSECCTL_DEF_ESP_TRANSLEV, esp_trans_deflev,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_esp_trans_deflev), 0,
 	"Default ESP transport mode level.");
 SYSCTL_INT(_net_inet6_ipsec6, IPSECCTL_DEF_ESP_NETLEV, esp_net_deflev,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_esp_net_deflev), 0,
 	"Default ESP tunnel mode level.");
 SYSCTL_INT(_net_inet6_ipsec6, IPSECCTL_DEF_AH_TRANSLEV, ah_trans_deflev,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_ah_trans_deflev), 0,
 	"AH transfer mode default level.");
 SYSCTL_INT(_net_inet6_ipsec6, IPSECCTL_DEF_AH_NETLEV, ah_net_deflev,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_ah_net_deflev), 0,
 	"AH tunnel mode default level.");
 SYSCTL_INT(_net_inet6_ipsec6, IPSECCTL_ECN, ecn,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_ipsec_ecn), 0,
 	"Explicit Congestion Notification handling.");
 SYSCTL_INT(_net_inet6_ipsec6, IPSECCTL_DEBUG, debug,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsec_debug), 0,
 	"Enable IPsec debugging output when set.");
 SYSCTL_VNET_PCPUSTAT(_net_inet6_ipsec6, IPSECCTL_STATS, ipsecstats,
     struct ipsecstat, ipsec6stat, "IPsec IPv6 statistics.");
 #endif /* INET6 */
 
 static int ipsec_setspidx_inpcb(struct mbuf *, struct inpcb *);
 static int ipsec_setspidx(struct mbuf *, struct secpolicyindex *, int);
 static void ipsec4_get_ulp(struct mbuf *m, struct secpolicyindex *, int);
 static int ipsec4_setspidx_ipaddr(struct mbuf *, struct secpolicyindex *);
 #ifdef INET6
 static void ipsec6_get_ulp(struct mbuf *m, struct secpolicyindex *, int);
 static int ipsec6_setspidx_ipaddr(struct mbuf *, struct secpolicyindex *);
 #endif
 static void ipsec_delpcbpolicy(struct inpcbpolicy *);
 static struct secpolicy *ipsec_deepcopy_policy(struct secpolicy *src);
 static void vshiftl(unsigned char *, int, int);
 
 MALLOC_DEFINE(M_IPSEC_INPCB, "inpcbpolicy", "inpcb-resident ipsec policy");
 
 /*
  * Return a held reference to the default SP.
  */
 static struct secpolicy *
 key_allocsp_default(const char* where, int tag)
 {
 	struct secpolicy *sp;
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP key_allocsp_default from %s:%u\n", where, tag));
 
-	sp = &V_ip4_def_policy;
+	sp = &V_def_policy;
 	if (sp->policy != IPSEC_POLICY_DISCARD &&
 	    sp->policy != IPSEC_POLICY_NONE) {
 		ipseclog((LOG_INFO, "fixed system default policy: %d->%d\n",
 		    sp->policy, IPSEC_POLICY_NONE));
 		sp->policy = IPSEC_POLICY_NONE;
 	}
 	key_addref(sp);
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP key_allocsp_default returns SP:%p (%u)\n",
 			sp, sp->refcnt));
 	return (sp);
 }
 #define	KEY_ALLOCSP_DEFAULT() \
 	key_allocsp_default(__FILE__, __LINE__)
 
 /*
  * For OUTBOUND packet having a socket. Searching SPD for packet,
  * and return a pointer to SP.
  * OUT:	NULL:	no apropreate SP found, the following value is set to error.
  *		0	: bypass
  *		EACCES	: discard packet.
  *		ENOENT	: ipsec_acquire() in progress, maybe.
  *		others	: error occured.
  *	others:	a pointer to SP
  *
  * NOTE: IPv6 mapped adddress concern is implemented here.
  */
 struct secpolicy *
 ipsec_getpolicy(struct tdb_ident *tdbi, u_int dir)
 {
 	struct secpolicy *sp;
 
 	IPSEC_ASSERT(tdbi != NULL, ("null tdbi"));
 	IPSEC_ASSERT(dir == IPSEC_DIR_INBOUND || dir == IPSEC_DIR_OUTBOUND,
 		("invalid direction %u", dir));
 
 	sp = KEY_ALLOCSP2(tdbi->spi, &tdbi->dst, tdbi->proto, dir);
 	if (sp == NULL)			/*XXX????*/
 		sp = KEY_ALLOCSP_DEFAULT();
 	IPSEC_ASSERT(sp != NULL, ("null SP"));
 	return (sp);
 }
 
 /*
  * For OUTBOUND packet having a socket. Searching SPD for packet,
  * and return a pointer to SP.
  * OUT:	NULL:	no apropreate SP found, the following value is set to error.
  *		0	: bypass
  *		EACCES	: discard packet.
  *		ENOENT	: ipsec_acquire() in progress, maybe.
  *		others	: error occured.
  *	others:	a pointer to SP
  *
  * NOTE: IPv6 mapped adddress concern is implemented here.
  */
 static struct secpolicy *
 ipsec_getpolicybysock(struct mbuf *m, u_int dir, struct inpcb *inp, int *error)
 {
 	struct inpcbpolicy *pcbsp;
 	struct secpolicy *currsp = NULL;	/* Policy on socket. */
 	struct secpolicy *sp;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(inp != NULL, ("null inpcb"));
 	IPSEC_ASSERT(error != NULL, ("null error"));
 	IPSEC_ASSERT(dir == IPSEC_DIR_INBOUND || dir == IPSEC_DIR_OUTBOUND,
 		("invalid direction %u", dir));
 
 	/* Set spidx in pcb. */
 	*error = ipsec_setspidx_inpcb(m, inp);
 	if (*error)
 		return (NULL);
 
 	pcbsp = inp->inp_sp;
 	IPSEC_ASSERT(pcbsp != NULL, ("null pcbsp"));
 	switch (dir) {
 	case IPSEC_DIR_INBOUND:
 		currsp = pcbsp->sp_in;
 		break;
 	case IPSEC_DIR_OUTBOUND:
 		currsp = pcbsp->sp_out;
 		break;
 	}
 	IPSEC_ASSERT(currsp != NULL, ("null currsp"));
 
 	if (pcbsp->priv) {			/* When privilieged socket. */
 		switch (currsp->policy) {
 		case IPSEC_POLICY_BYPASS:
 		case IPSEC_POLICY_IPSEC:
 			key_addref(currsp);
 			sp = currsp;
 			break;
 
 		case IPSEC_POLICY_ENTRUST:
 			/* Look for a policy in SPD. */
 			sp = KEY_ALLOCSP(&currsp->spidx, dir);
 			if (sp == NULL)		/* No SP found. */
 				sp = KEY_ALLOCSP_DEFAULT();
 			break;
 
 		default:
 			ipseclog((LOG_ERR, "%s: Invalid policy for PCB %d\n",
 				__func__, currsp->policy));
 			*error = EINVAL;
 			return (NULL);
 		}
 	} else {				/* Unpriv, SPD has policy. */
 		sp = KEY_ALLOCSP(&currsp->spidx, dir);
 		if (sp == NULL) {		/* No SP found. */
 			switch (currsp->policy) {
 			case IPSEC_POLICY_BYPASS:
 				ipseclog((LOG_ERR, "%s: Illegal policy for "
 					"non-priviliged defined %d\n",
 					__func__, currsp->policy));
 				*error = EINVAL;
 				return (NULL);
 
 			case IPSEC_POLICY_ENTRUST:
 				sp = KEY_ALLOCSP_DEFAULT();
 				break;
 
 			case IPSEC_POLICY_IPSEC:
 				key_addref(currsp);
 				sp = currsp;
 				break;
 
 			default:
 				ipseclog((LOG_ERR, "%s: Invalid policy for "
 					"PCB %d\n", __func__, currsp->policy));
 				*error = EINVAL;
 				return (NULL);
 			}
 		}
 	}
 	IPSEC_ASSERT(sp != NULL,
 		("null SP (priv %u policy %u", pcbsp->priv, currsp->policy));
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s (priv %u policy %u) allocate SP:%p (refcnt %u)\n",
 			__func__, pcbsp->priv, currsp->policy, sp, sp->refcnt));
 	return (sp);
 }
 
 /*
  * For FORWADING packet or OUTBOUND without a socket. Searching SPD for packet,
  * and return a pointer to SP.
  * OUT:	positive: a pointer to the entry for security policy leaf matched.
  *	NULL:	no apropreate SP found, the following value is set to error.
  *		0	: bypass
  *		EACCES	: discard packet.
  *		ENOENT	: ipsec_acquire() in progress, maybe.
  *		others	: error occured.
  */
 struct secpolicy *
 ipsec_getpolicybyaddr(struct mbuf *m, u_int dir, int *error)
 {
 	struct secpolicyindex spidx;
 	struct secpolicy *sp;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(error != NULL, ("null error"));
 	IPSEC_ASSERT(dir == IPSEC_DIR_INBOUND || dir == IPSEC_DIR_OUTBOUND,
 		("invalid direction %u", dir));
 
 	sp = NULL;
 	*error = 0;
 	if (key_havesp(dir)) {
 		/* Make an index to look for a policy. */
 		*error = ipsec_setspidx(m, &spidx, 0);
 		if (*error != 0) {
 			DPRINTF(("%s: setpidx failed, dir %u\n",
 				__func__, dir));
 			return (NULL);
 		}
 		spidx.dir = dir;
 		sp = KEY_ALLOCSP(&spidx, dir);
 	}
 	if (sp == NULL)			/* No SP found, use system default. */
 		sp = KEY_ALLOCSP_DEFAULT();
 	IPSEC_ASSERT(sp != NULL, ("null SP"));
 	return (sp);
 }
 
 struct secpolicy *
 ipsec4_checkpolicy(struct mbuf *m, u_int dir, int *error, struct inpcb *inp)
 {
 	struct secpolicy *sp;
 
 	*error = 0;
 	if (inp == NULL)
 		sp = ipsec_getpolicybyaddr(m, dir, error);
 	else
 		sp = ipsec_getpolicybysock(m, dir, inp, error);
 	if (sp == NULL) {
 		IPSEC_ASSERT(*error != 0, ("getpolicy failed w/o error"));
 		IPSECSTAT_INC(ips_out_inval);
 		return (NULL);
 	}
 	IPSEC_ASSERT(*error == 0, ("sp w/ error set to %u", *error));
 	switch (sp->policy) {
 	case IPSEC_POLICY_ENTRUST:
 	default:
 		printf("%s: invalid policy %u\n", __func__, sp->policy);
 		/* FALLTHROUGH */
 	case IPSEC_POLICY_DISCARD:
 		IPSECSTAT_INC(ips_out_polvio);
 		*error = -EINVAL;	/* Packet is discarded by caller. */
 		break;
 	case IPSEC_POLICY_BYPASS:
 	case IPSEC_POLICY_NONE:
 		KEY_FREESP(&sp);
 		sp = NULL;		/* NB: force NULL result. */
 		break;
 	case IPSEC_POLICY_IPSEC:
 		if (sp->req == NULL)	/* Acquire a SA. */
 			*error = key_spdacquire(sp);
 		break;
 	}
 	if (*error != 0) {
 		KEY_FREESP(&sp);
 		sp = NULL;
 	}
 	return (sp);
 }
 
 static int
 ipsec_setspidx_inpcb(struct mbuf *m, struct inpcb *inp)
 {
 	int error;
 
 	IPSEC_ASSERT(inp != NULL, ("null inp"));
 	IPSEC_ASSERT(inp->inp_sp != NULL, ("null inp_sp"));
 	IPSEC_ASSERT(inp->inp_sp->sp_out != NULL && inp->inp_sp->sp_in != NULL,
 		("null sp_in || sp_out"));
 
 	error = ipsec_setspidx(m, &inp->inp_sp->sp_in->spidx, 1);
 	if (error == 0) {
 		inp->inp_sp->sp_in->spidx.dir = IPSEC_DIR_INBOUND;
 		inp->inp_sp->sp_out->spidx = inp->inp_sp->sp_in->spidx;
 		inp->inp_sp->sp_out->spidx.dir = IPSEC_DIR_OUTBOUND;
 	} else {
 		bzero(&inp->inp_sp->sp_in->spidx,
 			sizeof (inp->inp_sp->sp_in->spidx));
 		bzero(&inp->inp_sp->sp_out->spidx,
 			sizeof (inp->inp_sp->sp_in->spidx));
 	}
 	return (error);
 }
 
 /*
  * Configure security policy index (src/dst/proto/sport/dport)
  * by looking at the content of mbuf.
  * The caller is responsible for error recovery (like clearing up spidx).
  */
 static int
 ipsec_setspidx(struct mbuf *m, struct secpolicyindex *spidx, int needport)
 {
 	struct ip *ip = NULL;
 	struct ip ipbuf;
 	u_int v;
 	struct mbuf *n;
 	int len;
 	int error;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 
 	/*
 	 * Validate m->m_pkthdr.len.  We see incorrect length if we
 	 * mistakenly call this function with inconsistent mbuf chain
 	 * (like 4.4BSD tcp/udp processing).  XXX Should we panic here?
 	 */
 	len = 0;
 	for (n = m; n; n = n->m_next)
 		len += n->m_len;
 	if (m->m_pkthdr.len != len) {
 		KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 			printf("%s: pkthdr len(%d) mismatch (%d), ignored.\n",
 				__func__, len, m->m_pkthdr.len));
 		return (EINVAL);
 	}
 
 	if (m->m_pkthdr.len < sizeof(struct ip)) {
 		KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 			printf("%s: pkthdr len(%d) too small (v4), ignored.\n",
 			    __func__, m->m_pkthdr.len));
 		return (EINVAL);
 	}
 
 	if (m->m_len >= sizeof(*ip))
 		ip = mtod(m, struct ip *);
 	else {
 		m_copydata(m, 0, sizeof(ipbuf), (caddr_t)&ipbuf);
 		ip = &ipbuf;
 	}
 	v = ip->ip_v;
 	switch (v) {
 	case 4:
 		error = ipsec4_setspidx_ipaddr(m, spidx);
 		if (error)
 			return (error);
 		ipsec4_get_ulp(m, spidx, needport);
 		return (0);
 #ifdef INET6
 	case 6:
 		if (m->m_pkthdr.len < sizeof(struct ip6_hdr)) {
 			KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 				printf("%s: pkthdr len(%d) too small (v6), "
 				"ignored\n", __func__, m->m_pkthdr.len));
 			return (EINVAL);
 		}
 		error = ipsec6_setspidx_ipaddr(m, spidx);
 		if (error)
 			return (error);
 		ipsec6_get_ulp(m, spidx, needport);
 		return (0);
 #endif
 	default:
 		KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 			printf("%s: " "unknown IP version %u, ignored.\n",
 				__func__, v));
 		return (EINVAL);
 	}
 }
 
 static void
 ipsec4_get_ulp(struct mbuf *m, struct secpolicyindex *spidx, int needport)
 {
 	u_int8_t nxt;
 	int off;
 
 	/* Sanity check. */
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(m->m_pkthdr.len >= sizeof(struct ip),("packet too short"));
 
 	if (m->m_len >= sizeof (struct ip)) {
 		struct ip *ip = mtod(m, struct ip *);
 		if (ip->ip_off & htons(IP_MF | IP_OFFMASK))
 			goto done;
 		off = ip->ip_hl << 2;
 		nxt = ip->ip_p;
 	} else {
 		struct ip ih;
 
 		m_copydata(m, 0, sizeof (struct ip), (caddr_t) &ih);
 		if (ih.ip_off & htons(IP_MF | IP_OFFMASK))
 			goto done;
 		off = ih.ip_hl << 2;
 		nxt = ih.ip_p;
 	}
 
 	while (off < m->m_pkthdr.len) {
 		struct ip6_ext ip6e;
 		struct tcphdr th;
 		struct udphdr uh;
 
 		switch (nxt) {
 		case IPPROTO_TCP:
 			spidx->ul_proto = nxt;
 			if (!needport)
 				goto done_proto;
 			if (off + sizeof(struct tcphdr) > m->m_pkthdr.len)
 				goto done;
 			m_copydata(m, off, sizeof (th), (caddr_t) &th);
 			spidx->src.sin.sin_port = th.th_sport;
 			spidx->dst.sin.sin_port = th.th_dport;
 			return;
 		case IPPROTO_UDP:
 			spidx->ul_proto = nxt;
 			if (!needport)
 				goto done_proto;
 			if (off + sizeof(struct udphdr) > m->m_pkthdr.len)
 				goto done;
 			m_copydata(m, off, sizeof (uh), (caddr_t) &uh);
 			spidx->src.sin.sin_port = uh.uh_sport;
 			spidx->dst.sin.sin_port = uh.uh_dport;
 			return;
 		case IPPROTO_AH:
 			if (off + sizeof(ip6e) > m->m_pkthdr.len)
 				goto done;
 			/* XXX Sigh, this works but is totally bogus. */
 			m_copydata(m, off, sizeof(ip6e), (caddr_t) &ip6e);
 			off += (ip6e.ip6e_len + 2) << 2;
 			nxt = ip6e.ip6e_nxt;
 			break;
 		case IPPROTO_ICMP:
 		default:
 			/* XXX Intermediate headers??? */
 			spidx->ul_proto = nxt;
 			goto done_proto;
 		}
 	}
 done:
 	spidx->ul_proto = IPSEC_ULPROTO_ANY;
 done_proto:
 	spidx->src.sin.sin_port = IPSEC_PORT_ANY;
 	spidx->dst.sin.sin_port = IPSEC_PORT_ANY;
 }
 
 /* Assumes that m is sane. */
 static int
 ipsec4_setspidx_ipaddr(struct mbuf *m, struct secpolicyindex *spidx)
 {
 	static const struct sockaddr_in template = {
 		sizeof (struct sockaddr_in),
 		AF_INET,
 		0, { 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }
 	};
 
 	spidx->src.sin = template;
 	spidx->dst.sin = template;
 
 	if (m->m_len < sizeof (struct ip)) {
 		m_copydata(m, offsetof(struct ip, ip_src),
 			   sizeof (struct  in_addr),
 			   (caddr_t) &spidx->src.sin.sin_addr);
 		m_copydata(m, offsetof(struct ip, ip_dst),
 			   sizeof (struct  in_addr),
 			   (caddr_t) &spidx->dst.sin.sin_addr);
 	} else {
 		struct ip *ip = mtod(m, struct ip *);
 		spidx->src.sin.sin_addr = ip->ip_src;
 		spidx->dst.sin.sin_addr = ip->ip_dst;
 	}
 
 	spidx->prefs = sizeof(struct in_addr) << 3;
 	spidx->prefd = sizeof(struct in_addr) << 3;
 
 	return (0);
 }
 
 #ifdef INET6
 static void
 ipsec6_get_ulp(struct mbuf *m, struct secpolicyindex *spidx, int needport)
 {
 	int off, nxt;
 	struct tcphdr th;
 	struct udphdr uh;
 	struct icmp6_hdr ih;
 
 	/* Sanity check. */
 	if (m == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 		printf("%s:\n", __func__); kdebug_mbuf(m));
 
 	/* Set default. */
 	spidx->ul_proto = IPSEC_ULPROTO_ANY;
 	((struct sockaddr_in6 *)&spidx->src)->sin6_port = IPSEC_PORT_ANY;
 	((struct sockaddr_in6 *)&spidx->dst)->sin6_port = IPSEC_PORT_ANY;
 
 	nxt = -1;
 	off = ip6_lasthdr(m, 0, IPPROTO_IPV6, &nxt);
 	if (off < 0 || m->m_pkthdr.len < off)
 		return;
 
 	switch (nxt) {
 	case IPPROTO_TCP:
 		spidx->ul_proto = nxt;
 		if (!needport)
 			break;
 		if (off + sizeof(struct tcphdr) > m->m_pkthdr.len)
 			break;
 		m_copydata(m, off, sizeof(th), (caddr_t)&th);
 		((struct sockaddr_in6 *)&spidx->src)->sin6_port = th.th_sport;
 		((struct sockaddr_in6 *)&spidx->dst)->sin6_port = th.th_dport;
 		break;
 	case IPPROTO_UDP:
 		spidx->ul_proto = nxt;
 		if (!needport)
 			break;
 		if (off + sizeof(struct udphdr) > m->m_pkthdr.len)
 			break;
 		m_copydata(m, off, sizeof(uh), (caddr_t)&uh);
 		((struct sockaddr_in6 *)&spidx->src)->sin6_port = uh.uh_sport;
 		((struct sockaddr_in6 *)&spidx->dst)->sin6_port = uh.uh_dport;
 		break;
 	case IPPROTO_ICMPV6:
 		spidx->ul_proto = nxt;
 		if (off + sizeof(struct icmp6_hdr) > m->m_pkthdr.len)
 			break;
 		m_copydata(m, off, sizeof(ih), (caddr_t)&ih);
 		((struct sockaddr_in6 *)&spidx->src)->sin6_port =
 		    htons((uint16_t)ih.icmp6_type);
 		((struct sockaddr_in6 *)&spidx->dst)->sin6_port =
 		    htons((uint16_t)ih.icmp6_code);
 		break;
 	default:
 		/* XXX Intermediate headers??? */
 		spidx->ul_proto = nxt;
 		break;
 	}
 }
 
 /* Assumes that m is sane. */
 static int
 ipsec6_setspidx_ipaddr(struct mbuf *m, struct secpolicyindex *spidx)
 {
 	struct ip6_hdr *ip6 = NULL;
 	struct ip6_hdr ip6buf;
 	struct sockaddr_in6 *sin6;
 
 	if (m->m_len >= sizeof(*ip6))
 		ip6 = mtod(m, struct ip6_hdr *);
 	else {
 		m_copydata(m, 0, sizeof(ip6buf), (caddr_t)&ip6buf);
 		ip6 = &ip6buf;
 	}
 
 	sin6 = (struct sockaddr_in6 *)&spidx->src;
 	bzero(sin6, sizeof(*sin6));
 	sin6->sin6_family = AF_INET6;
 	sin6->sin6_len = sizeof(struct sockaddr_in6);
 	bcopy(&ip6->ip6_src, &sin6->sin6_addr, sizeof(ip6->ip6_src));
 	if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src)) {
 		sin6->sin6_addr.s6_addr16[1] = 0;
 		sin6->sin6_scope_id = ntohs(ip6->ip6_src.s6_addr16[1]);
 	}
 	spidx->prefs = sizeof(struct in6_addr) << 3;
 
 	sin6 = (struct sockaddr_in6 *)&spidx->dst;
 	bzero(sin6, sizeof(*sin6));
 	sin6->sin6_family = AF_INET6;
 	sin6->sin6_len = sizeof(struct sockaddr_in6);
 	bcopy(&ip6->ip6_dst, &sin6->sin6_addr, sizeof(ip6->ip6_dst));
 	if (IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_dst)) {
 		sin6->sin6_addr.s6_addr16[1] = 0;
 		sin6->sin6_scope_id = ntohs(ip6->ip6_dst.s6_addr16[1]);
 	}
 	spidx->prefd = sizeof(struct in6_addr) << 3;
 
 	return (0);
 }
 #endif
 
 static void
 ipsec_delpcbpolicy(struct inpcbpolicy *p)
 {
 
 	free(p, M_IPSEC_INPCB);
 }
 
 /* Initialize policy in PCB. */
 int
 ipsec_init_policy(struct socket *so, struct inpcbpolicy **pcb_sp)
 {
 	struct inpcbpolicy *new;
 
 	/* Sanity check. */
 	if (so == NULL || pcb_sp == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	new = (struct inpcbpolicy *) malloc(sizeof(struct inpcbpolicy),
 					    M_IPSEC_INPCB, M_NOWAIT|M_ZERO);
 	if (new == NULL) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return (ENOBUFS);
 	}
 
 	new->priv = IPSEC_IS_PRIVILEGED_SO(so);
 
 	if ((new->sp_in = KEY_NEWSP()) == NULL) {
 		ipsec_delpcbpolicy(new);
 		return (ENOBUFS);
 	}
-	new->sp_in->state = IPSEC_SPSTATE_ALIVE;
 	new->sp_in->policy = IPSEC_POLICY_ENTRUST;
-
 	if ((new->sp_out = KEY_NEWSP()) == NULL) {
 		KEY_FREESP(&new->sp_in);
 		ipsec_delpcbpolicy(new);
 		return (ENOBUFS);
 	}
-	new->sp_out->state = IPSEC_SPSTATE_ALIVE;
 	new->sp_out->policy = IPSEC_POLICY_ENTRUST;
-
 	*pcb_sp = new;
 
 	return (0);
 }
 
 /* Copy old IPsec policy into new. */
 int
 ipsec_copy_policy(struct inpcbpolicy *old, struct inpcbpolicy *new)
 {
 	struct secpolicy *sp;
 
 	sp = ipsec_deepcopy_policy(old->sp_in);
 	if (sp) {
 		KEY_FREESP(&new->sp_in);
 		new->sp_in = sp;
 	} else
 		return (ENOBUFS);
 
 	sp = ipsec_deepcopy_policy(old->sp_out);
 	if (sp) {
 		KEY_FREESP(&new->sp_out);
 		new->sp_out = sp;
 	} else
 		return (ENOBUFS);
 
 	new->priv = old->priv;
 
 	return (0);
 }
 
 struct ipsecrequest *
 ipsec_newisr(void)
 {
 	struct ipsecrequest *p;
 
 	p = malloc(sizeof(struct ipsecrequest), M_IPSEC_SR, M_NOWAIT|M_ZERO);
 	if (p != NULL)
 		IPSECREQUEST_LOCK_INIT(p);
 	return (p);
 }
 
 void
 ipsec_delisr(struct ipsecrequest *p)
 {
 
 	IPSECREQUEST_LOCK_DESTROY(p);
 	free(p, M_IPSEC_SR);
 }
 
 /* Deep-copy a policy in PCB. */
 static struct secpolicy *
 ipsec_deepcopy_policy(struct secpolicy *src)
 {
 	struct ipsecrequest *newchain = NULL;
 	struct ipsecrequest *p;
 	struct ipsecrequest **q;
 	struct ipsecrequest *r;
 	struct secpolicy *dst;
 
 	if (src == NULL)
 		return (NULL);
 	dst = KEY_NEWSP();
 	if (dst == NULL)
 		return (NULL);
 
 	/*
 	 * Deep-copy IPsec request chain.  This is required since struct
 	 * ipsecrequest is not reference counted.
 	 */
 	q = &newchain;
 	for (p = src->req; p; p = p->next) {
 		*q = ipsec_newisr();
 		if (*q == NULL)
 			goto fail;
 		(*q)->saidx.proto = p->saidx.proto;
 		(*q)->saidx.mode = p->saidx.mode;
 		(*q)->level = p->level;
 		(*q)->saidx.reqid = p->saidx.reqid;
 
 		bcopy(&p->saidx.src, &(*q)->saidx.src, sizeof((*q)->saidx.src));
 		bcopy(&p->saidx.dst, &(*q)->saidx.dst, sizeof((*q)->saidx.dst));
 
 		(*q)->sp = dst;
 
 		q = &((*q)->next);
 	}
 
 	dst->req = newchain;
-	dst->state = src->state;
 	dst->policy = src->policy;
 	/* Do not touch the refcnt fields. */
 
 	return (dst);
 
 fail:
 	for (p = newchain; p; p = r) {
 		r = p->next;
 		ipsec_delisr(p);
 		p = NULL;
 	}
 	return (NULL);
 }
 
 /* Set policy and IPsec request if present. */
 static int
 ipsec_set_policy_internal(struct secpolicy **pcb_sp, int optname,
     caddr_t request, size_t len, struct ucred *cred)
 {
 	struct sadb_x_policy *xpl;
 	struct secpolicy *newsp = NULL;
 	int error;
 
 	/* Sanity check. */
 	if (pcb_sp == NULL || *pcb_sp == NULL || request == NULL)
 		return (EINVAL);
 	if (len < sizeof(*xpl))
 		return (EINVAL);
 	xpl = (struct sadb_x_policy *)request;
 
 	KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 		printf("%s: passed policy\n", __func__);
 		kdebug_sadb_x_policy((struct sadb_ext *)xpl));
 
 	/* Check policy type. */
 	/* ipsec_set_policy_internal() accepts IPSEC, ENTRUST and BYPASS. */
 	if (xpl->sadb_x_policy_type == IPSEC_POLICY_DISCARD
 	 || xpl->sadb_x_policy_type == IPSEC_POLICY_NONE)
 		return (EINVAL);
 
 	/* Check privileged socket. */
 	if (cred != NULL && xpl->sadb_x_policy_type == IPSEC_POLICY_BYPASS) {
 		error = priv_check_cred(cred, PRIV_NETINET_IPSEC, 0);
 		if (error)
 			return (EACCES);
 	}
 
 	/* Allocating new SP entry. */
 	if ((newsp = key_msg2sp(xpl, len, &error)) == NULL)
 		return (error);
 
-	newsp->state = IPSEC_SPSTATE_ALIVE;
-
 	/* Clear old SP and set new SP. */
 	KEY_FREESP(pcb_sp);
 	*pcb_sp = newsp;
 	KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 		printf("%s: new policy\n", __func__);
 		kdebug_secpolicy(newsp));
 
 	return (0);
 }
 
 int
 ipsec_set_policy(struct inpcb *inp, int optname, caddr_t request,
     size_t len, struct ucred *cred)
 {
 	struct sadb_x_policy *xpl;
 	struct secpolicy **pcb_sp;
 
 	/* Sanity check. */
 	if (inp == NULL || request == NULL)
 		return (EINVAL);
 	if (len < sizeof(*xpl))
 		return (EINVAL);
 	xpl = (struct sadb_x_policy *)request;
 
 	/* Select direction. */
 	switch (xpl->sadb_x_policy_dir) {
 	case IPSEC_DIR_INBOUND:
 		pcb_sp = &inp->inp_sp->sp_in;
 		break;
 	case IPSEC_DIR_OUTBOUND:
 		pcb_sp = &inp->inp_sp->sp_out;
 		break;
 	default:
 		ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__,
 			xpl->sadb_x_policy_dir));
 		return (EINVAL);
 	}
 
 	return (ipsec_set_policy_internal(pcb_sp, optname, request, len, cred));
 }
 
 int
 ipsec_get_policy(struct inpcb *inp, caddr_t request, size_t len,
     struct mbuf **mp)
 {
 	struct sadb_x_policy *xpl;
 	struct secpolicy *pcb_sp;
 
 	/* Sanity check. */
 	if (inp == NULL || request == NULL || mp == NULL)
 		return (EINVAL);
 	IPSEC_ASSERT(inp->inp_sp != NULL, ("null inp_sp"));
 	if (len < sizeof(*xpl))
 		return (EINVAL);
 	xpl = (struct sadb_x_policy *)request;
 
 	/* Select direction. */
 	switch (xpl->sadb_x_policy_dir) {
 	case IPSEC_DIR_INBOUND:
 		pcb_sp = inp->inp_sp->sp_in;
 		break;
 	case IPSEC_DIR_OUTBOUND:
 		pcb_sp = inp->inp_sp->sp_out;
 		break;
 	default:
 		ipseclog((LOG_ERR, "%s: invalid direction=%u\n", __func__,
 			xpl->sadb_x_policy_dir));
 		return (EINVAL);
 	}
 
 	/* Sanity check. Should be an IPSEC_ASSERT. */
 	if (pcb_sp == NULL)
 		return (EINVAL);
 
 	*mp = key_sp2msg(pcb_sp);
 	if (!*mp) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return (ENOBUFS);
 	}
 
 	(*mp)->m_type = MT_DATA;
 	KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 		printf("%s:\n", __func__); kdebug_mbuf(*mp));
 
 	return (0);
 }
 
 /* Delete policy in PCB. */
 int
 ipsec_delete_pcbpolicy(struct inpcb *inp)
 {
 	IPSEC_ASSERT(inp != NULL, ("null inp"));
 
 	if (inp->inp_sp == NULL)
 		return (0);
 
 	if (inp->inp_sp->sp_in != NULL)
 		KEY_FREESP(&inp->inp_sp->sp_in);
 
 	if (inp->inp_sp->sp_out != NULL)
 		KEY_FREESP(&inp->inp_sp->sp_out);
 
 	ipsec_delpcbpolicy(inp->inp_sp);
 	inp->inp_sp = NULL;
 
 	return (0);
 }
 
 /*
  * Return current level.
  * Either IPSEC_LEVEL_USE or IPSEC_LEVEL_REQUIRE are always returned.
  */
 u_int
 ipsec_get_reqlevel(struct ipsecrequest *isr)
 {
 	u_int level = 0;
 	u_int esp_trans_deflev, esp_net_deflev;
 	u_int ah_trans_deflev, ah_net_deflev;
 
 	IPSEC_ASSERT(isr != NULL && isr->sp != NULL, ("null argument"));
 	IPSEC_ASSERT(isr->sp->spidx.src.sa.sa_family == isr->sp->spidx.dst.sa.sa_family,
 		("af family mismatch, src %u, dst %u",
 		 isr->sp->spidx.src.sa.sa_family,
 		 isr->sp->spidx.dst.sa.sa_family));
 
 /* XXX Note that we have ipseclog() expanded here - code sync issue. */
 #define IPSEC_CHECK_DEFAULT(lev) \
 	(((lev) != IPSEC_LEVEL_USE && (lev) != IPSEC_LEVEL_REQUIRE	      \
 			&& (lev) != IPSEC_LEVEL_UNIQUE)			      \
 		? (V_ipsec_debug						      \
 			? log(LOG_INFO, "fixed system default level " #lev ":%d->%d\n",\
 				(lev), IPSEC_LEVEL_REQUIRE)		      \
 			: 0),						      \
 			(lev) = IPSEC_LEVEL_REQUIRE,			      \
 			(lev)						      \
 		: (lev))
 
 	/* Set default level. */
 	switch (((struct sockaddr *)&isr->sp->spidx.src)->sa_family) {
 #ifdef INET
 	case AF_INET:
 		esp_trans_deflev = IPSEC_CHECK_DEFAULT(V_ip4_esp_trans_deflev);
 		esp_net_deflev = IPSEC_CHECK_DEFAULT(V_ip4_esp_net_deflev);
 		ah_trans_deflev = IPSEC_CHECK_DEFAULT(V_ip4_ah_trans_deflev);
 		ah_net_deflev = IPSEC_CHECK_DEFAULT(V_ip4_ah_net_deflev);
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		esp_trans_deflev = IPSEC_CHECK_DEFAULT(V_ip6_esp_trans_deflev);
 		esp_net_deflev = IPSEC_CHECK_DEFAULT(V_ip6_esp_net_deflev);
 		ah_trans_deflev = IPSEC_CHECK_DEFAULT(V_ip6_ah_trans_deflev);
 		ah_net_deflev = IPSEC_CHECK_DEFAULT(V_ip6_ah_net_deflev);
 		break;
 #endif /* INET6 */
 	default:
 		panic("%s: unknown af %u",
 			__func__, isr->sp->spidx.src.sa.sa_family);
 	}
 
 #undef IPSEC_CHECK_DEFAULT
 
 	/* Set level. */
 	switch (isr->level) {
 	case IPSEC_LEVEL_DEFAULT:
 		switch (isr->saidx.proto) {
 		case IPPROTO_ESP:
 			if (isr->saidx.mode == IPSEC_MODE_TUNNEL)
 				level = esp_net_deflev;
 			else
 				level = esp_trans_deflev;
 			break;
 		case IPPROTO_AH:
 			if (isr->saidx.mode == IPSEC_MODE_TUNNEL)
 				level = ah_net_deflev;
 			else
 				level = ah_trans_deflev;
 			break;
 		case IPPROTO_IPCOMP:
 			/*
 			 * We don't really care, as IPcomp document says that
 			 * we shouldn't compress small packets.
 			 */
 			level = IPSEC_LEVEL_USE;
 			break;
 		default:
 			panic("%s: Illegal protocol defined %u\n", __func__,
 				isr->saidx.proto);
 		}
 		break;
 
 	case IPSEC_LEVEL_USE:
 	case IPSEC_LEVEL_REQUIRE:
 		level = isr->level;
 		break;
 	case IPSEC_LEVEL_UNIQUE:
 		level = IPSEC_LEVEL_REQUIRE;
 		break;
 
 	default:
 		panic("%s: Illegal IPsec level %u\n", __func__, isr->level);
 	}
 
 	return (level);
 }
 
 /*
  * Check security policy requirements against the actual
  * packet contents.  Return one if the packet should be
  * reject as "invalid"; otherwiser return zero to have the
  * packet treated as "valid".
  *
  * OUT:
  *	0: valid
  *	1: invalid
  */
 int
 ipsec_in_reject(struct secpolicy *sp, struct mbuf *m)
 {
 	struct ipsecrequest *isr;
 	int need_auth;
 
 	KEYDEBUG(KEYDEBUG_IPSEC_DATA,
 		printf("%s: using SP\n", __func__); kdebug_secpolicy(sp));
 
 	/* Check policy. */
 	switch (sp->policy) {
 	case IPSEC_POLICY_DISCARD:
 		return (1);
 	case IPSEC_POLICY_BYPASS:
 	case IPSEC_POLICY_NONE:
 		return (0);
 	}
 
 	IPSEC_ASSERT(sp->policy == IPSEC_POLICY_IPSEC,
 		("invalid policy %u", sp->policy));
 
 	/* XXX Should compare policy against IPsec header history. */
 
 	need_auth = 0;
 	for (isr = sp->req; isr != NULL; isr = isr->next) {
 		if (ipsec_get_reqlevel(isr) != IPSEC_LEVEL_REQUIRE)
 			continue;
 		switch (isr->saidx.proto) {
 		case IPPROTO_ESP:
 			if ((m->m_flags & M_DECRYPTED) == 0) {
 				KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 				    printf("%s: ESP m_flags:%x\n", __func__,
 					    m->m_flags));
 				return (1);
 			}
 
 			if (!need_auth &&
 			    isr->sav != NULL &&
 			    isr->sav->tdb_authalgxform != NULL &&
 			    (m->m_flags & M_AUTHIPDGM) == 0) {
 				KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 				    printf("%s: ESP/AH m_flags:%x\n", __func__,
 					    m->m_flags));
 				return (1);
 			}
 			break;
 		case IPPROTO_AH:
 			need_auth = 1;
 			if ((m->m_flags & M_AUTHIPHDR) == 0) {
 				KEYDEBUG(KEYDEBUG_IPSEC_DUMP,
 				    printf("%s: AH m_flags:%x\n", __func__,
 					    m->m_flags));
 				return (1);
 			}
 			break;
 		case IPPROTO_IPCOMP:
 			/*
 			 * We don't really care, as IPcomp document
 			 * says that we shouldn't compress small
 			 * packets.  IPComp policy should always be
 			 * treated as being in "use" level.
 			 */
 			break;
 		}
 	}
 	return (0);		/* Valid. */
 }
 
 /*
  * Non zero return value means security policy DISCARD or policy violation.
  */
 static int
 ipsec46_in_reject(struct mbuf *m, struct inpcb *inp)
 {
 	struct secpolicy *sp;
 	int error;
 	int result;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 
 	/* Get SP for this packet. */
 	if (inp == NULL)
 		sp = ipsec_getpolicybyaddr(m, IPSEC_DIR_INBOUND, &error);
 	else
 		sp = ipsec_getpolicybysock(m, IPSEC_DIR_INBOUND, inp, &error);
 
 	if (sp != NULL) {
 		result = ipsec_in_reject(sp, m);
 		KEY_FREESP(&sp);
 	} else {
 		result = 1;	/* treat errors as policy violation */
 	}
 	return (result);
 }
 
 /*
  * Check AH/ESP integrity.
  * This function is called from tcp_input(), udp_input(),
  * and {ah,esp}4_input for tunnel mode.
  */
 int
 ipsec4_in_reject(struct mbuf *m, struct inpcb *inp)
 {
 	int result;
 
 	result = ipsec46_in_reject(m, inp);
 	if (result)
 		IPSECSTAT_INC(ips_in_polvio);
 
 	return (result);
 }
 
 #ifdef INET6
 /*
  * Check AH/ESP integrity.
  * This function is called from tcp6_input(), udp6_input(),
  * and {ah,esp}6_input for tunnel mode.
  */
 int
 ipsec6_in_reject(struct mbuf *m, struct inpcb *inp)
 {
 	int result;
 
 	result = ipsec46_in_reject(m, inp);
 	if (result)
 		IPSEC6STAT_INC(ips_in_polvio);
 
 	return (result);
 }
 #endif
 
 /*
  * Compute the byte size to be occupied by IPsec header.
  * In case it is tunnelled, it includes the size of outer IP header.
  * NOTE: SP passed is freed in this function.
  */
 static size_t
 ipsec_hdrsiz_internal(struct secpolicy *sp)
 {
 	struct ipsecrequest *isr;
 	size_t size;
 
 	KEYDEBUG(KEYDEBUG_IPSEC_DATA,
 		printf("%s: using SP\n", __func__); kdebug_secpolicy(sp));
 
 	switch (sp->policy) {
 	case IPSEC_POLICY_DISCARD:
 	case IPSEC_POLICY_BYPASS:
 	case IPSEC_POLICY_NONE:
 		return (0);
 	}
 
 	IPSEC_ASSERT(sp->policy == IPSEC_POLICY_IPSEC,
 		("invalid policy %u", sp->policy));
 
 	size = 0;
 	for (isr = sp->req; isr != NULL; isr = isr->next) {
 		size_t clen = 0;
 
 		switch (isr->saidx.proto) {
 		case IPPROTO_ESP:
 			clen = esp_hdrsiz(isr->sav);
 			break;
 		case IPPROTO_AH:
 			clen = ah_hdrsiz(isr->sav);
 			break;
 		case IPPROTO_IPCOMP:
 			clen = sizeof(struct ipcomp);
 			break;
 		}
 
 		if (isr->saidx.mode == IPSEC_MODE_TUNNEL) {
 			switch (isr->saidx.dst.sa.sa_family) {
 			case AF_INET:
 				clen += sizeof(struct ip);
 				break;
 #ifdef INET6
 			case AF_INET6:
 				clen += sizeof(struct ip6_hdr);
 				break;
 #endif
 			default:
 				ipseclog((LOG_ERR, "%s: unknown AF %d in "
 				    "IPsec tunnel SA\n", __func__,
 				    ((struct sockaddr *)&isr->saidx.dst)->sa_family));
 				break;
 			}
 		}
 		size += clen;
 	}
 
 	return (size);
 }
 
 /* 
  * This function is called from ipsec_hdrsiz_tcp(), ip_ipsec_mtu(),
  * disabled ip6_ipsec_mtu() and ip6_forward().
  */
 size_t
 ipsec_hdrsiz(struct mbuf *m, u_int dir, struct inpcb *inp)
 {
 	struct secpolicy *sp;
 	int error;
 	size_t size;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 
 	/* Get SP for this packet. */
 	if (inp == NULL)
 		sp = ipsec_getpolicybyaddr(m, dir, &error);
 	else
 		sp = ipsec_getpolicybysock(m, dir, inp, &error);
 
 	if (sp != NULL) {
 		size = ipsec_hdrsiz_internal(sp);
 		KEYDEBUG(KEYDEBUG_IPSEC_DATA,
 			printf("%s: size:%lu.\n", __func__,
 				(unsigned long)size));
 
 		KEY_FREESP(&sp);
 	} else {
 		size = 0;	/* XXX Should be panic?
 				 * -> No, we are called w/o knowing if
 				 *    IPsec processing is needed. */
 	}
 	return (size);
 }
 
 /*
  * Check the variable replay window.
  * ipsec_chkreplay() performs replay check before ICV verification.
  * ipsec_updatereplay() updates replay bitmap.  This must be called after
  * ICV verification (it also performs replay check, which is usually done
  * beforehand).
  * 0 (zero) is returned if packet disallowed, 1 if packet permitted.
  *
  * Based on RFC 2401.
  */
 int
 ipsec_chkreplay(u_int32_t seq, struct secasvar *sav)
 {
 	const struct secreplay *replay;
 	u_int32_t diff;
 	int fr;
 	u_int32_t wsizeb;	/* Constant: bits of window size. */
 	int frlast;		/* Constant: last frame. */
 
 	IPSEC_ASSERT(sav != NULL, ("Null SA"));
 	IPSEC_ASSERT(sav->replay != NULL, ("Null replay state"));
 
 	replay = sav->replay;
 
 	if (replay->wsize == 0)
 		return (1);	/* No need to check replay. */
 
 	/* Constant. */
 	frlast = replay->wsize - 1;
 	wsizeb = replay->wsize << 3;
 
 	/* Sequence number of 0 is invalid. */
 	if (seq == 0)
 		return (0);
 
 	/* First time is always okay. */
 	if (replay->count == 0)
 		return (1);
 
 	if (seq > replay->lastseq) {
 		/* Larger sequences are okay. */
 		return (1);
 	} else {
 		/* seq is equal or less than lastseq. */
 		diff = replay->lastseq - seq;
 
 		/* Over range to check, i.e. too old or wrapped. */
 		if (diff >= wsizeb)
 			return (0);
 
 		fr = frlast - diff / 8;
 
 		/* This packet already seen? */
 		if ((replay->bitmap)[fr] & (1 << (diff % 8)))
 			return (0);
 
 		/* Out of order but good. */
 		return (1);
 	}
 }
 
 /*
  * Check replay counter whether to update or not.
  * OUT:	0:	OK
  *	1:	NG
  */
 int
 ipsec_updatereplay(u_int32_t seq, struct secasvar *sav)
 {
 	struct secreplay *replay;
 	u_int32_t diff;
 	int fr;
 	u_int32_t wsizeb;	/* Constant: bits of window size. */
 	int frlast;		/* Constant: last frame. */
 
 	IPSEC_ASSERT(sav != NULL, ("Null SA"));
 	IPSEC_ASSERT(sav->replay != NULL, ("Null replay state"));
 
 	replay = sav->replay;
 
 	if (replay->wsize == 0)
 		goto ok;	/* No need to check replay. */
 
 	/* Constant. */
 	frlast = replay->wsize - 1;
 	wsizeb = replay->wsize << 3;
 
 	/* Sequence number of 0 is invalid. */
 	if (seq == 0)
 		return (1);
 
 	/* First time. */
 	if (replay->count == 0) {
 		replay->lastseq = seq;
 		bzero(replay->bitmap, replay->wsize);
 		(replay->bitmap)[frlast] = 1;
 		goto ok;
 	}
 
 	if (seq > replay->lastseq) {
 		/* seq is larger than lastseq. */
 		diff = seq - replay->lastseq;
 
 		/* New larger sequence number. */
 		if (diff < wsizeb) {
 			/* In window. */
 			/* Set bit for this packet. */
 			vshiftl(replay->bitmap, diff, replay->wsize);
 			(replay->bitmap)[frlast] |= 1;
 		} else {
 			/* This packet has a "way larger". */
 			bzero(replay->bitmap, replay->wsize);
 			(replay->bitmap)[frlast] = 1;
 		}
 		replay->lastseq = seq;
 
 		/* Larger is good. */
 	} else {
 		/* seq is equal or less than lastseq. */
 		diff = replay->lastseq - seq;
 
 		/* Over range to check, i.e. too old or wrapped. */
 		if (diff >= wsizeb)
 			return (1);
 
 		fr = frlast - diff / 8;
 
 		/* This packet already seen? */
 		if ((replay->bitmap)[fr] & (1 << (diff % 8)))
 			return (1);
 
 		/* Mark as seen. */
 		(replay->bitmap)[fr] |= (1 << (diff % 8));
 
 		/* Out of order but good. */
 	}
 
 ok:
 	if (replay->count == ~0) {
 
 		/* Set overflow flag. */
 		replay->overflow++;
 
 		/* Don't increment, no more packets accepted. */
 		if ((sav->flags & SADB_X_EXT_CYCSEQ) == 0)
 			return (1);
 
 		ipseclog((LOG_WARNING, "%s: replay counter made %d cycle. %s\n",
 		    __func__, replay->overflow, ipsec_logsastr(sav)));
 	}
 
 	replay->count++;
 
 	return (0);
 }
 
 /*
  * Shift variable length buffer to left.
  * IN:	bitmap: pointer to the buffer
  * 	nbit:	the number of to shift.
  *	wsize:	buffer size (bytes).
  */
 static void
 vshiftl(unsigned char *bitmap, int nbit, int wsize)
 {
 	int s, j, i;
 	unsigned char over;
 
 	for (j = 0; j < nbit; j += 8) {
 		s = (nbit - j < 8) ? (nbit - j): 8;
 		bitmap[0] <<= s;
 		for (i = 1; i < wsize; i++) {
 			over = (bitmap[i] >> (8 - s));
 			bitmap[i] <<= s;
 			bitmap[i-1] |= over;
 		}
 	}
 }
 
 #ifdef INET
 /* Return a printable string for the IPv4 address. */
 static char *
 inet_ntoa4(struct in_addr ina)
 {
 	static char buf[4][4 * sizeof "123" + 4];
 	unsigned char *ucp = (unsigned char *) &ina;
 	static int i = 3;
 
 	/* XXX-BZ Returns static buffer. */
 	i = (i + 1) % 4;
 	sprintf(buf[i], "%d.%d.%d.%d", ucp[0] & 0xff, ucp[1] & 0xff,
 	    ucp[2] & 0xff, ucp[3] & 0xff);
 	return (buf[i]);
 }
 #endif
 
 /* Return a printable string for the address. */
 char *
 ipsec_address(union sockaddr_union* sa)
 {
 #ifdef INET6
 	char ip6buf[INET6_ADDRSTRLEN];
 #endif
 
 	switch (sa->sa.sa_family) {
 #ifdef INET
 	case AF_INET:
 		return (inet_ntoa4(sa->sin.sin_addr));
 #endif /* INET */
 #ifdef INET6
 	case AF_INET6:
 		return (ip6_sprintf(ip6buf, &sa->sin6.sin6_addr));
 #endif /* INET6 */
 	default:
 		return ("(unknown address family)");
 	}
 }
 
 const char *
 ipsec_logsastr(struct secasvar *sav)
 {
 	static char buf[256];
 	char *p;
 	struct secasindex *saidx = &sav->sah->saidx;
 
 	IPSEC_ASSERT(saidx->src.sa.sa_family == saidx->dst.sa.sa_family,
 		("address family mismatch"));
 
 	p = buf;
 	snprintf(buf, sizeof(buf), "SA(SPI=%u ", (u_int32_t)ntohl(sav->spi));
 	while (p && *p)
 		p++;
 	/* NB: only use ipsec_address on one address at a time. */
 	snprintf(p, sizeof (buf) - (p - buf), "src=%s ",
 		ipsec_address(&saidx->src));
 	while (p && *p)
 		p++;
 	snprintf(p, sizeof (buf) - (p - buf), "dst=%s)",
 		ipsec_address(&saidx->dst));
 
 	return (buf);
 }
 
 void
 ipsec_dumpmbuf(struct mbuf *m)
 {
 	int totlen;
 	int i;
 	u_char *p;
 
 	totlen = 0;
 	printf("---\n");
 	while (m) {
 		p = mtod(m, u_char *);
 		for (i = 0; i < m->m_len; i++) {
 			printf("%02x ", p[i]);
 			totlen++;
 			if (totlen % 16 == 0)
 				printf("\n");
 		}
 		m = m->m_next;
 	}
 	if (totlen % 16 != 0)
 		printf("\n");
 	printf("---\n");
 }
 
 static void
-ipsec_init(const void *unused __unused)
+def_policy_init(const void *unused __unused)
 {
 
-	SECPOLICY_LOCK_INIT(&V_ip4_def_policy);
-	V_ip4_def_policy.refcnt = 1;			/* NB: disallow free. */
+	bzero(&V_def_policy, sizeof(struct secpolicy));
+	V_def_policy.policy = IPSEC_POLICY_NONE;
+	V_def_policy.refcnt = 1;
 }
-VNET_SYSINIT(ipsec_init, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, ipsec_init,
-    NULL);
+VNET_SYSINIT(def_policy_init, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY,
+    def_policy_init, NULL);
 
 
 /* XXX This stuff doesn't belong here... */
 
 static	struct xformsw* xforms = NULL;
 
 /*
  * Register a transform; typically at system startup.
  */
 void
 xform_register(struct xformsw* xsp)
 {
 
 	xsp->xf_next = xforms;
 	xforms = xsp;
 }
 
 /*
  * Initialize transform support in an sav.
  */
 int
 xform_init(struct secasvar *sav, int xftype)
 {
 	struct xformsw *xsp;
 
 	if (sav->tdb_xform != NULL)	/* Previously initialized. */
 		return (0);
 	for (xsp = xforms; xsp; xsp = xsp->xf_next)
 		if (xsp->xf_type == xftype)
 			return ((*xsp->xf_init)(sav, xsp));
 	return (EINVAL);
 }
Index: projects/arm_intrng/sys/netipsec/ipsec.h
===================================================================
--- projects/arm_intrng/sys/netipsec/ipsec.h	(revision 276247)
+++ projects/arm_intrng/sys/netipsec/ipsec.h	(revision 276248)
@@ -1,385 +1,370 @@
 /*	$FreeBSD$	*/
 /*	$KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
  */
 
 /*
  * IPsec controller part.
  */
 
 #ifndef _NETIPSEC_IPSEC_H_
 #define _NETIPSEC_IPSEC_H_
 
 #if defined(_KERNEL) && !defined(_LKM) && !defined(KLD_MODULE)
 #include "opt_inet.h"
 #include "opt_ipsec.h"
 #endif
 
 #include 
 #include 
 
 #ifdef _KERNEL
 
 #include 
 #include 
 #include 
 
 #define	IPSEC_ASSERT(_c,_m) KASSERT(_c, _m)
 
 #define	IPSEC_IS_PRIVILEGED_SO(_so) \
 	((_so)->so_cred != NULL && \
 	 priv_check_cred((_so)->so_cred, PRIV_NETINET_IPSEC, 0) \
 	 == 0)
 
 /*
  * Security Policy Index
  * Ensure that both address families in the "src" and "dst" are same.
  * When the value of the ul_proto is ICMPv6, the port field in "src"
  * specifies ICMPv6 type, and the port field in "dst" specifies ICMPv6 code.
  */
 struct secpolicyindex {
 	u_int8_t dir;			/* direction of packet flow, see below */
 	union sockaddr_union src;	/* IP src address for SP */
 	union sockaddr_union dst;	/* IP dst address for SP */
 	u_int8_t prefs;			/* prefix length in bits for src */
 	u_int8_t prefd;			/* prefix length in bits for dst */
 	u_int16_t ul_proto;		/* upper layer Protocol */
 #ifdef notyet
 	uid_t uids;
 	uid_t uidd;
 	gid_t gids;
 	gid_t gidd;
 #endif
 };
 
 /* Security Policy Data Base */
 struct secpolicy {
-	LIST_ENTRY(secpolicy) chain;
-	struct mtx lock;
+	TAILQ_ENTRY(secpolicy) chain;
 
-	u_int refcnt;			/* reference count */
 	struct secpolicyindex spidx;	/* selector */
-	u_int32_t id;			/* It's unique number on the system. */
-	u_int state;			/* 0: dead, others: alive */
-#define IPSEC_SPSTATE_DEAD	0
-#define IPSEC_SPSTATE_ALIVE	1
-	u_int policy;			/* policy_type per pfkeyv2.h */
-	u_int16_t scangen;		/* scan generation # */
 	struct ipsecrequest *req;
 				/* pointer to the ipsec request tree, */
 				/* if policy == IPSEC else this value == NULL.*/
-
+	u_int refcnt;			/* reference count */
+	u_int policy;			/* policy_type per pfkeyv2.h */
+	u_int32_t id;			/* It's unique number on the system. */
 	/*
 	 * lifetime handler.
 	 * the policy can be used without limitiation if both lifetime and
 	 * validtime are zero.
 	 * "lifetime" is passed by sadb_lifetime.sadb_lifetime_addtime.
 	 * "validtime" is passed by sadb_lifetime.sadb_lifetime_usetime.
 	 */
 	time_t created;		/* time created the policy */
 	time_t lastused;	/* updated every when kernel sends a packet */
 	long lifetime;		/* duration of the lifetime of this policy */
 	long validtime;		/* duration this policy is valid without use */
 };
 
-#define	SECPOLICY_LOCK_INIT(_sp) \
-	mtx_init(&(_sp)->lock, "ipsec policy", NULL, MTX_DEF)
-#define	SECPOLICY_LOCK(_sp)		mtx_lock(&(_sp)->lock)
-#define	SECPOLICY_UNLOCK(_sp)		mtx_unlock(&(_sp)->lock)
-#define	SECPOLICY_LOCK_DESTROY(_sp)	mtx_destroy(&(_sp)->lock)
-#define	SECPOLICY_LOCK_ASSERT(_sp)	mtx_assert(&(_sp)->lock, MA_OWNED)
-
 /* Request for IPsec */
 struct ipsecrequest {
 	struct ipsecrequest *next;
 				/* pointer to next structure */
 				/* If NULL, it means the end of chain. */
 	struct secasindex saidx;/* hint for search proper SA */
 				/* if __ss_len == 0 then no address specified.*/
 	u_int level;		/* IPsec level defined below. */
 
 	struct secasvar *sav;	/* place holder of SA for use */
 	struct secpolicy *sp;	/* back pointer to SP */
 	struct rwlock lock;	/* to interlock updates */
 };
 
 /*
  * Need recursion for when crypto callbacks happen directly,
  * as in the case of software crypto.  Need to look at how
  * hard it is to remove this...
  */
 #define	IPSECREQUEST_LOCK_INIT(_isr) \
 	rw_init_flags(&(_isr)->lock, "ipsec request", RW_RECURSE)
 #define	IPSECREQUEST_LOCK(_isr)		rw_rlock(&(_isr)->lock)
 #define	IPSECREQUEST_UNLOCK(_isr)	rw_runlock(&(_isr)->lock)
 #define	IPSECREQUEST_WLOCK(_isr)	rw_wlock(&(_isr)->lock)
 #define	IPSECREQUEST_WUNLOCK(_isr)	rw_wunlock(&(_isr)->lock)
 #define	IPSECREQUEST_UPGRADE(_isr)	rw_try_upgrade(&(_isr)->lock)
 #define	IPSECREQUEST_DOWNGRADE(_isr)	rw_downgrade(&(_isr)->lock)
 #define	IPSECREQUEST_LOCK_DESTROY(_isr)	rw_destroy(&(_isr)->lock)
 #define	IPSECREQUEST_LOCK_ASSERT(_isr)	rw_assert(&(_isr)->lock, RA_LOCKED)
 
 /* security policy in PCB */
 struct inpcbpolicy {
 	struct secpolicy *sp_in;
 	struct secpolicy *sp_out;
 	int priv;			/* privileged socket ? */
 };
 
 /* SP acquiring list table. */
 struct secspacq {
 	LIST_ENTRY(secspacq) chain;
 
 	struct secpolicyindex spidx;
 
 	time_t created;		/* for lifetime */
 	int count;		/* for lifetime */
 	/* XXX: here is mbuf place holder to be sent ? */
 };
 #endif /* _KERNEL */
 
 /* according to IANA assignment, port 0x0000 and proto 0xff are reserved. */
 #define IPSEC_PORT_ANY		0
 #define IPSEC_ULPROTO_ANY	255
 #define IPSEC_PROTO_ANY		255
 
 /* mode of security protocol */
 /* NOTE: DON'T use IPSEC_MODE_ANY at SPD.  It's only use in SAD */
 #define	IPSEC_MODE_ANY		0	/* i.e. wildcard. */
 #define	IPSEC_MODE_TRANSPORT	1
 #define	IPSEC_MODE_TUNNEL	2
 #define	IPSEC_MODE_TCPMD5	3	/* TCP MD5 mode */
 
 /*
  * Direction of security policy.
  * NOTE: Since INVALID is used just as flag.
  * The other are used for loop counter too.
  */
 #define IPSEC_DIR_ANY		0
 #define IPSEC_DIR_INBOUND	1
 #define IPSEC_DIR_OUTBOUND	2
 #define IPSEC_DIR_MAX		3
 #define IPSEC_DIR_INVALID	4
 
 /* Policy level */
 /*
  * IPSEC, ENTRUST and BYPASS are allowed for setsockopt() in PCB,
  * DISCARD, IPSEC and NONE are allowed for setkey() in SPD.
  * DISCARD and NONE are allowed for system default.
  */
 #define IPSEC_POLICY_DISCARD	0	/* discarding packet */
 #define IPSEC_POLICY_NONE	1	/* through IPsec engine */
 #define IPSEC_POLICY_IPSEC	2	/* do IPsec */
 #define IPSEC_POLICY_ENTRUST	3	/* consulting SPD if present. */
 #define IPSEC_POLICY_BYPASS	4	/* only for privileged socket. */
 
 /* Security protocol level */
 #define	IPSEC_LEVEL_DEFAULT	0	/* reference to system default */
 #define	IPSEC_LEVEL_USE		1	/* use SA if present. */
 #define	IPSEC_LEVEL_REQUIRE	2	/* require SA. */
 #define	IPSEC_LEVEL_UNIQUE	3	/* unique SA. */
 
 #define IPSEC_MANUAL_REQID_MAX	0x3fff
 				/*
 				 * if security policy level == unique, this id
 				 * indicate to a relative SA for use, else is
 				 * zero.
 				 * 1 - 0x3fff are reserved for manual keying.
 				 * 0 are reserved for above reason.  Others is
 				 * for kernel use.
 				 * Note that this id doesn't identify SA
 				 * by only itself.
 				 */
 #define IPSEC_REPLAYWSIZE  32
 
 /* statistics for ipsec processing */
 struct ipsecstat {
 	uint64_t ips_in_polvio;		/* input: sec policy violation */
 	uint64_t ips_in_nomem;		/* input: no memory available */
 	uint64_t ips_in_inval;		/* input: generic error */
 
 	uint64_t ips_out_polvio;	/* output: sec policy violation */
 	uint64_t ips_out_nosa;		/* output: SA unavailable  */
 	uint64_t ips_out_nomem;		/* output: no memory available */
 	uint64_t ips_out_noroute;	/* output: no route available */
 	uint64_t ips_out_inval;		/* output: generic error */
 	uint64_t ips_out_bundlesa;	/* output: bundled SA processed */
 
 	uint64_t ips_mbcoalesced;	/* mbufs coalesced during clone */
 	uint64_t ips_clcoalesced;	/* clusters coalesced during clone */
 	uint64_t ips_clcopied;		/* clusters copied during clone */
 	uint64_t ips_mbinserted;	/* mbufs inserted during makespace */
 	/* 
 	 * Temporary statistics for performance analysis.
 	 */
 	/* See where ESP/AH/IPCOMP header land in mbuf on input */
 	uint64_t ips_input_front;
 	uint64_t ips_input_middle;
 	uint64_t ips_input_end;
 };
 
 /*
  * Definitions for IPsec & Key sysctl operations.
  */
 #define IPSECCTL_STATS			1	/* stats */
 #define IPSECCTL_DEF_POLICY		2
 #define IPSECCTL_DEF_ESP_TRANSLEV	3	/* int; ESP transport mode */
 #define IPSECCTL_DEF_ESP_NETLEV		4	/* int; ESP tunnel mode */
 #define IPSECCTL_DEF_AH_TRANSLEV	5	/* int; AH transport mode */
 #define IPSECCTL_DEF_AH_NETLEV		6	/* int; AH tunnel mode */
 #if 0	/* obsolete, do not reuse */
 #define IPSECCTL_INBOUND_CALL_IKE	7
 #endif
 #define	IPSECCTL_AH_CLEARTOS		8
 #define	IPSECCTL_AH_OFFSETMASK		9
 #define	IPSECCTL_DFBIT			10
 #define	IPSECCTL_ECN			11
 #define	IPSECCTL_DEBUG			12
 #define	IPSECCTL_ESP_RANDPAD		13
 
 #ifdef _KERNEL
 #include 
 
 VNET_DECLARE(int, ipsec_debug);
 #define	V_ipsec_debug		VNET(ipsec_debug)
 
 #ifdef REGRESSION
 VNET_DECLARE(int, ipsec_replay);
 VNET_DECLARE(int, ipsec_integrity);
 
 #define	V_ipsec_replay		VNET(ipsec_replay)
 #define	V_ipsec_integrity	VNET(ipsec_integrity)
 #endif
 
 VNET_PCPUSTAT_DECLARE(struct ipsecstat, ipsec4stat);
-VNET_DECLARE(struct secpolicy, ip4_def_policy);
 VNET_DECLARE(int, ip4_esp_trans_deflev);
 VNET_DECLARE(int, ip4_esp_net_deflev);
 VNET_DECLARE(int, ip4_ah_trans_deflev);
 VNET_DECLARE(int, ip4_ah_net_deflev);
 VNET_DECLARE(int, ip4_ah_offsetmask);
 VNET_DECLARE(int, ip4_ipsec_dfbit);
 VNET_DECLARE(int, ip4_ipsec_ecn);
 VNET_DECLARE(int, ip4_esp_randpad);
 VNET_DECLARE(int, crypto_support);
 
 #define	IPSECSTAT_INC(name)	\
     VNET_PCPUSTAT_ADD(struct ipsecstat, ipsec4stat, name, 1)
-#define	V_ip4_def_policy	VNET(ip4_def_policy)
 #define	V_ip4_esp_trans_deflev	VNET(ip4_esp_trans_deflev)
 #define	V_ip4_esp_net_deflev	VNET(ip4_esp_net_deflev)
 #define	V_ip4_ah_trans_deflev	VNET(ip4_ah_trans_deflev)
 #define	V_ip4_ah_net_deflev	VNET(ip4_ah_net_deflev)
 #define	V_ip4_ah_offsetmask	VNET(ip4_ah_offsetmask)
 #define	V_ip4_ipsec_dfbit	VNET(ip4_ipsec_dfbit)
 #define	V_ip4_ipsec_ecn		VNET(ip4_ipsec_ecn)
 #define	V_ip4_esp_randpad	VNET(ip4_esp_randpad)
 #define	V_crypto_support	VNET(crypto_support)
 
 #define ipseclog(x)	do { if (V_ipsec_debug) log x; } while (0)
 /* for openbsd compatibility */
 #define	DPRINTF(x)	do { if (V_ipsec_debug) printf x; } while (0)
 
 extern	struct ipsecrequest *ipsec_newisr(void);
 extern	void ipsec_delisr(struct ipsecrequest *);
 
 struct tdb_ident;
 extern struct secpolicy *ipsec_getpolicy(struct tdb_ident*, u_int);
 struct inpcb;
 extern struct secpolicy *ipsec4_checkpolicy(struct mbuf *, u_int,
 	int *, struct inpcb *);
 extern struct secpolicy * ipsec_getpolicybyaddr(struct mbuf *, u_int, int *);
 
 struct inpcb;
 extern int ipsec_init_policy(struct socket *so, struct inpcbpolicy **);
 extern int ipsec_copy_policy(struct inpcbpolicy *, struct inpcbpolicy *);
 extern u_int ipsec_get_reqlevel(struct ipsecrequest *);
 extern int ipsec_in_reject(struct secpolicy *, struct mbuf *);
 
 extern int ipsec_set_policy(struct inpcb *inp, int optname,
 	caddr_t request, size_t len, struct ucred *cred);
 extern int ipsec_get_policy(struct inpcb *inpcb, caddr_t request,
 	size_t len, struct mbuf **mp);
 extern int ipsec_delete_pcbpolicy(struct inpcb *);
 extern int ipsec4_in_reject(struct mbuf *, struct inpcb *);
 
 struct secas;
 struct tcpcb;
 extern int ipsec_chkreplay(u_int32_t, struct secasvar *);
 extern int ipsec_updatereplay(u_int32_t, struct secasvar *);
 
 extern size_t ipsec_hdrsiz(struct mbuf *, u_int, struct inpcb *);
 extern size_t ipsec_hdrsiz_tcp(struct tcpcb *);
 
 union sockaddr_union;
 extern char * ipsec_address(union sockaddr_union* sa);
 extern const char *ipsec_logsastr(struct secasvar *);
 
 extern void ipsec_dumpmbuf(struct mbuf *);
 
 struct m_tag;
 extern int ah4_input(struct mbuf **mp, int *offp, int proto);
 extern void ah4_ctlinput(int cmd, struct sockaddr *sa, void *);
 extern int esp4_input(struct mbuf **mp, int *offp, int proto);
 extern void esp4_ctlinput(int cmd, struct sockaddr *sa, void *);
 extern int ipcomp4_input(struct mbuf **mp, int *offp, int proto);
 extern int ipsec4_common_input(struct mbuf *m, ...);
 extern int ipsec4_common_input_cb(struct mbuf *m, struct secasvar *sav,
 			int skip, int protoff);
 extern int ipsec4_process_packet(struct mbuf *, struct ipsecrequest *);
 extern int ipsec_process_done(struct mbuf *, struct ipsecrequest *);
 
 extern struct mbuf *ipsec_copypkt(struct mbuf *);
 
 extern	void m_checkalignment(const char* where, struct mbuf *m0,
 		int off, int len);
 extern	struct mbuf *m_makespace(struct mbuf *m0, int skip, int hlen, int *off);
 extern	caddr_t m_pad(struct mbuf *m, int n);
 extern	int m_striphdr(struct mbuf *m, int skip, int hlen);
 
 #ifdef DEV_ENC
 #define	ENC_BEFORE	0x0001
 #define	ENC_AFTER	0x0002
 #define	ENC_IN		0x0100
 #define	ENC_OUT		0x0200
 extern	int ipsec_filter(struct mbuf **, int, int);
 extern	void ipsec_bpf(struct mbuf *, struct secasvar *, int, int);
 #endif
 #endif /* _KERNEL */
 
 #ifndef _KERNEL
 extern caddr_t ipsec_set_policy(char *, int);
 extern int ipsec_get_policylen(caddr_t);
 extern char *ipsec_dump_policy(caddr_t, char *);
 extern const char *ipsec_strerror(void);
 
 #endif /* ! KERNEL */
 
 #endif /* _NETIPSEC_IPSEC_H_ */
Index: projects/arm_intrng/sys/netipsec/key.c
===================================================================
--- projects/arm_intrng/sys/netipsec/key.c	(revision 276247)
+++ projects/arm_intrng/sys/netipsec/key.c	(revision 276248)
@@ -1,7877 +1,7828 @@
 /*	$FreeBSD$	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
  */
 
 /*
  * This code is referd to RFC 2367
  */
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 
 #ifdef INET6
 #include 
 #include 
 #include 
 #endif /* INET6 */
 
 #if defined(INET) || defined(INET6)
 #include 
 #endif
 #ifdef INET6
 #include 
 #endif /* INET6 */
 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include 
 #ifdef INET6
 #include 
 #endif
 
 #include 
 
 #include 
 
 /* randomness */
 #include 
 
 #define FULLMASK	0xff
 #define	_BITS(bytes)	((bytes) << 3)
 
 /*
  * Note on SA reference counting:
  * - SAs that are not in DEAD state will have (total external reference + 1)
  *   following value in reference count field.  they cannot be freed and are
  *   referenced from SA header.
  * - SAs that are in DEAD state will have (total external reference)
  *   in reference count field.  they are ready to be freed.  reference from
  *   SA header will be removed in key_delsav(), when the reference count
  *   field hits 0 (= no external reference other than from SA header.
  */
 
 VNET_DEFINE(u_int32_t, key_debug_level) = 0;
 static VNET_DEFINE(u_int, key_spi_trycnt) = 1000;
 static VNET_DEFINE(u_int32_t, key_spi_minval) = 0x100;
 static VNET_DEFINE(u_int32_t, key_spi_maxval) = 0x0fffffff;	/* XXX */
 static VNET_DEFINE(u_int32_t, policy_id) = 0;
 /*interval to initialize randseed,1(m)*/
 static VNET_DEFINE(u_int, key_int_random) = 60;
 /* interval to expire acquiring, 30(s)*/
 static VNET_DEFINE(u_int, key_larval_lifetime) = 30;
 /* counter for blocking SADB_ACQUIRE.*/
 static VNET_DEFINE(int, key_blockacq_count) = 10;
 /* lifetime for blocking SADB_ACQUIRE.*/
 static VNET_DEFINE(int, key_blockacq_lifetime) = 20;
 /* preferred old sa rather than new sa.*/
 static VNET_DEFINE(int, key_preferred_oldsa) = 1;
 #define	V_key_spi_trycnt	VNET(key_spi_trycnt)
 #define	V_key_spi_minval	VNET(key_spi_minval)
 #define	V_key_spi_maxval	VNET(key_spi_maxval)
 #define	V_policy_id		VNET(policy_id)
 #define	V_key_int_random	VNET(key_int_random)
 #define	V_key_larval_lifetime	VNET(key_larval_lifetime)
 #define	V_key_blockacq_count	VNET(key_blockacq_count)
 #define	V_key_blockacq_lifetime	VNET(key_blockacq_lifetime)
 #define	V_key_preferred_oldsa	VNET(key_preferred_oldsa)
 
 static VNET_DEFINE(u_int32_t, acq_seq) = 0;
 #define	V_acq_seq		VNET(acq_seq)
 
 								/* SPD */
-static VNET_DEFINE(LIST_HEAD(_sptree, secpolicy), sptree[IPSEC_DIR_MAX]);
+static VNET_DEFINE(TAILQ_HEAD(_sptree, secpolicy), sptree[IPSEC_DIR_MAX]);
+static struct rmlock sptree_lock;
 #define	V_sptree		VNET(sptree)
-static struct mtx sptree_lock;
-#define	SPTREE_LOCK_INIT() \
-	mtx_init(&sptree_lock, "sptree", \
-		"fast ipsec security policy database", MTX_DEF)
-#define	SPTREE_LOCK_DESTROY()	mtx_destroy(&sptree_lock)
-#define	SPTREE_LOCK()		mtx_lock(&sptree_lock)
-#define	SPTREE_UNLOCK()	mtx_unlock(&sptree_lock)
-#define	SPTREE_LOCK_ASSERT()	mtx_assert(&sptree_lock, MA_OWNED)
+#define	SPTREE_LOCK_INIT()      rm_init(&sptree_lock, "sptree")
+#define	SPTREE_LOCK_DESTROY()   rm_destroy(&sptree_lock)
+#define	SPTREE_RLOCK_TRACKER    struct rm_priotracker sptree_tracker
+#define	SPTREE_RLOCK()          rm_rlock(&sptree_lock, &sptree_tracker)
+#define	SPTREE_RUNLOCK()        rm_runlock(&sptree_lock, &sptree_tracker)
+#define	SPTREE_RLOCK_ASSERT()   rm_assert(&sptree_lock, RA_RLOCKED)
+#define	SPTREE_WLOCK()          rm_wlock(&sptree_lock)
+#define	SPTREE_WUNLOCK()        rm_wunlock(&sptree_lock)
+#define	SPTREE_WLOCK_ASSERT()   rm_assert(&sptree_lock, RA_WLOCKED)
+#define	SPTREE_UNLOCK_ASSERT()  rm_assert(&sptree_lock, RA_UNLOCKED)
 
 static VNET_DEFINE(LIST_HEAD(_sahtree, secashead), sahtree);	/* SAD */
 #define	V_sahtree		VNET(sahtree)
 static struct mtx sahtree_lock;
 #define	SAHTREE_LOCK_INIT() \
 	mtx_init(&sahtree_lock, "sahtree", \
 		"fast ipsec security association database", MTX_DEF)
 #define	SAHTREE_LOCK_DESTROY()	mtx_destroy(&sahtree_lock)
 #define	SAHTREE_LOCK()		mtx_lock(&sahtree_lock)
 #define	SAHTREE_UNLOCK()	mtx_unlock(&sahtree_lock)
 #define	SAHTREE_LOCK_ASSERT()	mtx_assert(&sahtree_lock, MA_OWNED)
 
 							/* registed list */
 static VNET_DEFINE(LIST_HEAD(_regtree, secreg), regtree[SADB_SATYPE_MAX + 1]);
 #define	V_regtree		VNET(regtree)
 static struct mtx regtree_lock;
 #define	REGTREE_LOCK_INIT() \
 	mtx_init(®tree_lock, "regtree", "fast ipsec regtree", MTX_DEF)
 #define	REGTREE_LOCK_DESTROY()	mtx_destroy(®tree_lock)
 #define	REGTREE_LOCK()		mtx_lock(®tree_lock)
 #define	REGTREE_UNLOCK()	mtx_unlock(®tree_lock)
 #define	REGTREE_LOCK_ASSERT()	mtx_assert(®tree_lock, MA_OWNED)
 
 static VNET_DEFINE(LIST_HEAD(_acqtree, secacq), acqtree); /* acquiring list */
 #define	V_acqtree		VNET(acqtree)
 static struct mtx acq_lock;
 #define	ACQ_LOCK_INIT() \
 	mtx_init(&acq_lock, "acqtree", "fast ipsec acquire list", MTX_DEF)
 #define	ACQ_LOCK_DESTROY()	mtx_destroy(&acq_lock)
 #define	ACQ_LOCK()		mtx_lock(&acq_lock)
 #define	ACQ_UNLOCK()		mtx_unlock(&acq_lock)
 #define	ACQ_LOCK_ASSERT()	mtx_assert(&acq_lock, MA_OWNED)
 
 							/* SP acquiring list */
 static VNET_DEFINE(LIST_HEAD(_spacqtree, secspacq), spacqtree);
 #define	V_spacqtree		VNET(spacqtree)
 static struct mtx spacq_lock;
 #define	SPACQ_LOCK_INIT() \
 	mtx_init(&spacq_lock, "spacqtree", \
 		"fast ipsec security policy acquire list", MTX_DEF)
 #define	SPACQ_LOCK_DESTROY()	mtx_destroy(&spacq_lock)
 #define	SPACQ_LOCK()		mtx_lock(&spacq_lock)
 #define	SPACQ_UNLOCK()		mtx_unlock(&spacq_lock)
 #define	SPACQ_LOCK_ASSERT()	mtx_assert(&spacq_lock, MA_OWNED)
 
 /* search order for SAs */
 static const u_int saorder_state_valid_prefer_old[] = {
 	SADB_SASTATE_DYING, SADB_SASTATE_MATURE,
 };
 static const u_int saorder_state_valid_prefer_new[] = {
 	SADB_SASTATE_MATURE, SADB_SASTATE_DYING,
 };
 static const u_int saorder_state_alive[] = {
 	/* except DEAD */
 	SADB_SASTATE_MATURE, SADB_SASTATE_DYING, SADB_SASTATE_LARVAL
 };
 static const u_int saorder_state_any[] = {
 	SADB_SASTATE_MATURE, SADB_SASTATE_DYING,
 	SADB_SASTATE_LARVAL, SADB_SASTATE_DEAD
 };
 
 static const int minsize[] = {
 	sizeof(struct sadb_msg),	/* SADB_EXT_RESERVED */
 	sizeof(struct sadb_sa),		/* SADB_EXT_SA */
 	sizeof(struct sadb_lifetime),	/* SADB_EXT_LIFETIME_CURRENT */
 	sizeof(struct sadb_lifetime),	/* SADB_EXT_LIFETIME_HARD */
 	sizeof(struct sadb_lifetime),	/* SADB_EXT_LIFETIME_SOFT */
 	sizeof(struct sadb_address),	/* SADB_EXT_ADDRESS_SRC */
 	sizeof(struct sadb_address),	/* SADB_EXT_ADDRESS_DST */
 	sizeof(struct sadb_address),	/* SADB_EXT_ADDRESS_PROXY */
 	sizeof(struct sadb_key),	/* SADB_EXT_KEY_AUTH */
 	sizeof(struct sadb_key),	/* SADB_EXT_KEY_ENCRYPT */
 	sizeof(struct sadb_ident),	/* SADB_EXT_IDENTITY_SRC */
 	sizeof(struct sadb_ident),	/* SADB_EXT_IDENTITY_DST */
 	sizeof(struct sadb_sens),	/* SADB_EXT_SENSITIVITY */
 	sizeof(struct sadb_prop),	/* SADB_EXT_PROPOSAL */
 	sizeof(struct sadb_supported),	/* SADB_EXT_SUPPORTED_AUTH */
 	sizeof(struct sadb_supported),	/* SADB_EXT_SUPPORTED_ENCRYPT */
 	sizeof(struct sadb_spirange),	/* SADB_EXT_SPIRANGE */
 	0,				/* SADB_X_EXT_KMPRIVATE */
 	sizeof(struct sadb_x_policy),	/* SADB_X_EXT_POLICY */
 	sizeof(struct sadb_x_sa2),	/* SADB_X_SA2 */
 	sizeof(struct sadb_x_nat_t_type),/* SADB_X_EXT_NAT_T_TYPE */
 	sizeof(struct sadb_x_nat_t_port),/* SADB_X_EXT_NAT_T_SPORT */
 	sizeof(struct sadb_x_nat_t_port),/* SADB_X_EXT_NAT_T_DPORT */
 	sizeof(struct sadb_address),	/* SADB_X_EXT_NAT_T_OAI */
 	sizeof(struct sadb_address),	/* SADB_X_EXT_NAT_T_OAR */
 	sizeof(struct sadb_x_nat_t_frag),/* SADB_X_EXT_NAT_T_FRAG */
 };
 static const int maxsize[] = {
 	sizeof(struct sadb_msg),	/* SADB_EXT_RESERVED */
 	sizeof(struct sadb_sa),		/* SADB_EXT_SA */
 	sizeof(struct sadb_lifetime),	/* SADB_EXT_LIFETIME_CURRENT */
 	sizeof(struct sadb_lifetime),	/* SADB_EXT_LIFETIME_HARD */
 	sizeof(struct sadb_lifetime),	/* SADB_EXT_LIFETIME_SOFT */
 	0,				/* SADB_EXT_ADDRESS_SRC */
 	0,				/* SADB_EXT_ADDRESS_DST */
 	0,				/* SADB_EXT_ADDRESS_PROXY */
 	0,				/* SADB_EXT_KEY_AUTH */
 	0,				/* SADB_EXT_KEY_ENCRYPT */
 	0,				/* SADB_EXT_IDENTITY_SRC */
 	0,				/* SADB_EXT_IDENTITY_DST */
 	0,				/* SADB_EXT_SENSITIVITY */
 	0,				/* SADB_EXT_PROPOSAL */
 	0,				/* SADB_EXT_SUPPORTED_AUTH */
 	0,				/* SADB_EXT_SUPPORTED_ENCRYPT */
 	sizeof(struct sadb_spirange),	/* SADB_EXT_SPIRANGE */
 	0,				/* SADB_X_EXT_KMPRIVATE */
 	0,				/* SADB_X_EXT_POLICY */
 	sizeof(struct sadb_x_sa2),	/* SADB_X_SA2 */
 	sizeof(struct sadb_x_nat_t_type),/* SADB_X_EXT_NAT_T_TYPE */
 	sizeof(struct sadb_x_nat_t_port),/* SADB_X_EXT_NAT_T_SPORT */
 	sizeof(struct sadb_x_nat_t_port),/* SADB_X_EXT_NAT_T_DPORT */
 	0,				/* SADB_X_EXT_NAT_T_OAI */
 	0,				/* SADB_X_EXT_NAT_T_OAR */
 	sizeof(struct sadb_x_nat_t_frag),/* SADB_X_EXT_NAT_T_FRAG */
 };
 
 static VNET_DEFINE(int, ipsec_esp_keymin) = 256;
 static VNET_DEFINE(int, ipsec_esp_auth) = 0;
 static VNET_DEFINE(int, ipsec_ah_keymin) = 128;
 
 #define	V_ipsec_esp_keymin	VNET(ipsec_esp_keymin)
 #define	V_ipsec_esp_auth	VNET(ipsec_esp_auth)
 #define	V_ipsec_ah_keymin	VNET(ipsec_ah_keymin)
 
 #ifdef SYSCTL_DECL
 SYSCTL_DECL(_net_key);
 #endif
 
 SYSCTL_INT(_net_key, KEYCTL_DEBUG_LEVEL,	debug,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_debug_level), 0, "");
 
 /* max count of trial for the decision of spi value */
 SYSCTL_INT(_net_key, KEYCTL_SPI_TRY, spi_trycnt,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_spi_trycnt), 0, "");
 
 /* minimum spi value to allocate automatically. */
 SYSCTL_INT(_net_key, KEYCTL_SPI_MIN_VALUE, spi_minval,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_spi_minval), 0, "");
 
 /* maximun spi value to allocate automatically. */
 SYSCTL_INT(_net_key, KEYCTL_SPI_MAX_VALUE, spi_maxval,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_spi_maxval), 0, "");
 
 /* interval to initialize randseed */
 SYSCTL_INT(_net_key, KEYCTL_RANDOM_INT, int_random,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_int_random), 0, "");
 
 /* lifetime for larval SA */
 SYSCTL_INT(_net_key, KEYCTL_LARVAL_LIFETIME, larval_lifetime,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_larval_lifetime), 0, "");
 
 /* counter for blocking to send SADB_ACQUIRE to IKEd */
 SYSCTL_INT(_net_key, KEYCTL_BLOCKACQ_COUNT, blockacq_count,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_blockacq_count), 0, "");
 
 /* lifetime for blocking to send SADB_ACQUIRE to IKEd */
 SYSCTL_INT(_net_key, KEYCTL_BLOCKACQ_LIFETIME, blockacq_lifetime,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_blockacq_lifetime), 0, "");
 
 /* ESP auth */
 SYSCTL_INT(_net_key, KEYCTL_ESP_AUTH, esp_auth,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsec_esp_auth), 0, "");
 
 /* minimum ESP key length */
 SYSCTL_INT(_net_key, KEYCTL_ESP_KEYMIN, esp_keymin,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsec_esp_keymin), 0, "");
 
 /* minimum AH key length */
 SYSCTL_INT(_net_key, KEYCTL_AH_KEYMIN, ah_keymin,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ipsec_ah_keymin), 0, "");
 
 /* perfered old SA rather than new SA */
 SYSCTL_INT(_net_key, KEYCTL_PREFERED_OLDSA, preferred_oldsa,
 	CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(key_preferred_oldsa), 0, "");
 
 #define __LIST_CHAINED(elm) \
 	(!((elm)->chain.le_next == NULL && (elm)->chain.le_prev == NULL))
 #define LIST_INSERT_TAIL(head, elm, type, field) \
 do {\
 	struct type *curelm = LIST_FIRST(head); \
 	if (curelm == NULL) {\
 		LIST_INSERT_HEAD(head, elm, field); \
 	} else { \
 		while (LIST_NEXT(curelm, field)) \
 			curelm = LIST_NEXT(curelm, field);\
 		LIST_INSERT_AFTER(curelm, elm, field);\
 	}\
 } while (0)
 
 #define KEY_CHKSASTATE(head, sav, name) \
 do { \
 	if ((head) != (sav)) {						\
 		ipseclog((LOG_DEBUG, "%s: state mismatched (TREE=%d SA=%d)\n", \
 			(name), (head), (sav)));			\
 		continue;						\
 	}								\
 } while (0)
 
 #define KEY_CHKSPDIR(head, sp, name) \
 do { \
 	if ((head) != (sp)) {						\
 		ipseclog((LOG_DEBUG, "%s: direction mismatched (TREE=%d SP=%d), " \
 			"anyway continue.\n",				\
 			(name), (head), (sp)));				\
 	}								\
 } while (0)
 
 MALLOC_DEFINE(M_IPSEC_SA, "secasvar", "ipsec security association");
 MALLOC_DEFINE(M_IPSEC_SAH, "sahead", "ipsec sa head");
 MALLOC_DEFINE(M_IPSEC_SP, "ipsecpolicy", "ipsec security policy");
 MALLOC_DEFINE(M_IPSEC_SR, "ipsecrequest", "ipsec security request");
 MALLOC_DEFINE(M_IPSEC_MISC, "ipsec-misc", "ipsec miscellaneous");
 MALLOC_DEFINE(M_IPSEC_SAQ, "ipsec-saq", "ipsec sa acquire");
 MALLOC_DEFINE(M_IPSEC_SAR, "ipsec-reg", "ipsec sa acquire");
 
 /*
  * set parameters into secpolicyindex buffer.
  * Must allocate secpolicyindex buffer passed to this function.
  */
 #define KEY_SETSECSPIDX(_dir, s, d, ps, pd, ulp, idx) \
 do { \
 	bzero((idx), sizeof(struct secpolicyindex));                         \
 	(idx)->dir = (_dir);                                                 \
 	(idx)->prefs = (ps);                                                 \
 	(idx)->prefd = (pd);                                                 \
 	(idx)->ul_proto = (ulp);                                             \
 	bcopy((s), &(idx)->src, ((const struct sockaddr *)(s))->sa_len);     \
 	bcopy((d), &(idx)->dst, ((const struct sockaddr *)(d))->sa_len);     \
 } while (0)
 
 /*
  * set parameters into secasindex buffer.
  * Must allocate secasindex buffer before calling this function.
  */
 #define KEY_SETSECASIDX(p, m, r, s, d, idx) \
 do { \
 	bzero((idx), sizeof(struct secasindex));                             \
 	(idx)->proto = (p);                                                  \
 	(idx)->mode = (m);                                                   \
 	(idx)->reqid = (r);                                                  \
 	bcopy((s), &(idx)->src, ((const struct sockaddr *)(s))->sa_len);     \
 	bcopy((d), &(idx)->dst, ((const struct sockaddr *)(d))->sa_len);     \
 } while (0)
 
 /* key statistics */
 struct _keystat {
 	u_long getspi_count; /* the avarage of count to try to get new SPI */
 } keystat;
 
 struct sadb_msghdr {
 	struct sadb_msg *msg;
 	struct sadb_ext *ext[SADB_EXT_MAX + 1];
 	int extoff[SADB_EXT_MAX + 1];
 	int extlen[SADB_EXT_MAX + 1];
 };
 
 #ifndef IPSEC_DEBUG2
 static struct callout key_timer;
 #endif
 
 static struct secasvar *key_allocsa_policy(const struct secasindex *);
 static void key_freesp_so(struct secpolicy **);
 static struct secasvar *key_do_allocsa_policy(struct secashead *, u_int);
-static void key_delsp(struct secpolicy *);
+static void key_unlink(struct secpolicy *);
 static struct secpolicy *key_getsp(struct secpolicyindex *);
-static void _key_delsp(struct secpolicy *sp);
 static struct secpolicy *key_getspbyid(u_int32_t);
 static u_int32_t key_newreqid(void);
 static struct mbuf *key_gather_mbuf(struct mbuf *,
 	const struct sadb_msghdr *, int, int, ...);
 static int key_spdadd(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static u_int32_t key_getnewspid(void);
 static int key_spddelete(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_spddelete2(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_spdget(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_spdflush(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_spddump(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static struct mbuf *key_setdumpsp(struct secpolicy *,
 	u_int8_t, u_int32_t, u_int32_t);
 static u_int key_getspreqmsglen(struct secpolicy *);
 static int key_spdexpire(struct secpolicy *);
 static struct secashead *key_newsah(struct secasindex *);
 static void key_delsah(struct secashead *);
 static struct secasvar *key_newsav(struct mbuf *,
 	const struct sadb_msghdr *, struct secashead *, int *,
 	const char*, int);
 #define	KEY_NEWSAV(m, sadb, sah, e)				\
 	key_newsav(m, sadb, sah, e, __FILE__, __LINE__)
 static void key_delsav(struct secasvar *);
 static struct secashead *key_getsah(struct secasindex *);
 static struct secasvar *key_checkspidup(struct secasindex *, u_int32_t);
 static struct secasvar *key_getsavbyspi(struct secashead *, u_int32_t);
 static int key_setsaval(struct secasvar *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_mature(struct secasvar *);
 static struct mbuf *key_setdumpsa(struct secasvar *, u_int8_t,
 	u_int8_t, u_int32_t, u_int32_t);
 static struct mbuf *key_setsadbmsg(u_int8_t, u_int16_t, u_int8_t,
 	u_int32_t, pid_t, u_int16_t);
 static struct mbuf *key_setsadbsa(struct secasvar *);
 static struct mbuf *key_setsadbaddr(u_int16_t,
 	const struct sockaddr *, u_int8_t, u_int16_t);
 #ifdef IPSEC_NAT_T
 static struct mbuf *key_setsadbxport(u_int16_t, u_int16_t);
 static struct mbuf *key_setsadbxtype(u_int16_t);
 #endif
 static void key_porttosaddr(struct sockaddr *, u_int16_t);
 #define	KEY_PORTTOSADDR(saddr, port)				\
 	key_porttosaddr((struct sockaddr *)(saddr), (port))
 static struct mbuf *key_setsadbxsa2(u_int8_t, u_int32_t, u_int32_t);
 static struct mbuf *key_setsadbxpolicy(u_int16_t, u_int8_t,
 	u_int32_t);
 static struct seckey *key_dup_keymsg(const struct sadb_key *, u_int, 
 				     struct malloc_type *);
 static struct seclifetime *key_dup_lifemsg(const struct sadb_lifetime *src,
 					    struct malloc_type *type);
 #ifdef INET6
 static int key_ismyaddr6(struct sockaddr_in6 *);
 #endif
 
 /* flags for key_cmpsaidx() */
 #define CMP_HEAD	1	/* protocol, addresses. */
 #define CMP_MODE_REQID	2	/* additionally HEAD, reqid, mode. */
 #define CMP_REQID	3	/* additionally HEAD, reaid. */
 #define CMP_EXACTLY	4	/* all elements. */
 static int key_cmpsaidx(const struct secasindex *,
     const struct secasindex *, int);
 static int key_cmpspidx_exactly(struct secpolicyindex *,
     struct secpolicyindex *);
 static int key_cmpspidx_withmask(struct secpolicyindex *,
     struct secpolicyindex *);
 static int key_sockaddrcmp(const struct sockaddr *,
     const struct sockaddr *, int);
 static int key_bbcmp(const void *, const void *, u_int);
 static u_int16_t key_satype2proto(u_int8_t);
 static u_int8_t key_proto2satype(u_int16_t);
 
 static int key_getspi(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static u_int32_t key_do_getnewspi(struct sadb_spirange *,
 					struct secasindex *);
 static int key_update(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 #ifdef IPSEC_DOSEQCHECK
 static struct secasvar *key_getsavbyseq(struct secashead *, u_int32_t);
 #endif
 static int key_add(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_setident(struct secashead *, struct mbuf *,
 	const struct sadb_msghdr *);
 static struct mbuf *key_getmsgbuf_x1(struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_delete(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_delete_all(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *, u_int16_t);
 static int key_get(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 
 static void key_getcomb_setlifetime(struct sadb_comb *);
 static struct mbuf *key_getcomb_esp(void);
 static struct mbuf *key_getcomb_ah(void);
 static struct mbuf *key_getcomb_ipcomp(void);
 static struct mbuf *key_getprop(const struct secasindex *);
 
 static int key_acquire(const struct secasindex *, struct secpolicy *);
 static struct secacq *key_newacq(const struct secasindex *);
 static struct secacq *key_getacq(const struct secasindex *);
 static struct secacq *key_getacqbyseq(u_int32_t);
 static struct secspacq *key_newspacq(struct secpolicyindex *);
 static struct secspacq *key_getspacq(struct secpolicyindex *);
 static int key_acquire2(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_register(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_expire(struct secasvar *);
 static int key_flush(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_dump(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_promisc(struct socket *, struct mbuf *,
 	const struct sadb_msghdr *);
 static int key_senderror(struct socket *, struct mbuf *, int);
 static int key_validate_ext(const struct sadb_ext *, int);
 static int key_align(struct mbuf *, struct sadb_msghdr *);
 static struct mbuf *key_setlifetime(struct seclifetime *src, 
 				     u_int16_t exttype);
 static struct mbuf *key_setkey(struct seckey *src, u_int16_t exttype);
 
 #if 0
 static const char *key_getfqdn(void);
 static const char *key_getuserfqdn(void);
 #endif
 static void key_sa_chgstate(struct secasvar *, u_int8_t);
 
 static __inline void
 sa_initref(struct secasvar *sav)
 {
 
 	refcount_init(&sav->refcnt, 1);
 }
 static __inline void
 sa_addref(struct secasvar *sav)
 {
 
 	refcount_acquire(&sav->refcnt);
 	IPSEC_ASSERT(sav->refcnt != 0, ("SA refcnt overflow"));
 }
 static __inline int
 sa_delref(struct secasvar *sav)
 {
 
 	IPSEC_ASSERT(sav->refcnt > 0, ("SA refcnt underflow"));
 	return (refcount_release(&sav->refcnt));
 }
 
-#define	SP_ADDREF(p) do {						\
-	(p)->refcnt++;							\
-	IPSEC_ASSERT((p)->refcnt != 0, ("SP refcnt overflow"));		\
-} while (0)
-#define	SP_DELREF(p) do {						\
-	IPSEC_ASSERT((p)->refcnt > 0, ("SP refcnt underflow"));		\
-	(p)->refcnt--;							\
-} while (0)
- 
+#define	SP_ADDREF(p)	refcount_acquire(&(p)->refcnt)
+#define	SP_DELREF(p)	refcount_release(&(p)->refcnt)
 
 /*
  * Update the refcnt while holding the SPTREE lock.
  */
 void
 key_addref(struct secpolicy *sp)
 {
-	SPTREE_LOCK();
+
 	SP_ADDREF(sp);
-	SPTREE_UNLOCK();
 }
 
 /*
  * Return 0 when there are known to be no SP's for the specified
  * direction.  Otherwise return 1.  This is used by IPsec code
  * to optimize performance.
  */
 int
 key_havesp(u_int dir)
 {
 
 	return (dir == IPSEC_DIR_INBOUND || dir == IPSEC_DIR_OUTBOUND ?
-		LIST_FIRST(&V_sptree[dir]) != NULL : 1);
+		TAILQ_FIRST(&V_sptree[dir]) != NULL : 1);
 }
 
 /* %%% IPsec policy management */
 /*
  * allocating a SP for OUTBOUND or INBOUND packet.
  * Must call key_freesp() later.
  * OUT:	NULL:	not found
  *	others:	found and return the pointer.
  */
 struct secpolicy *
 key_allocsp(struct secpolicyindex *spidx, u_int dir, const char* where,
     int tag)
 {
+	SPTREE_RLOCK_TRACKER;
 	struct secpolicy *sp;
 
 	IPSEC_ASSERT(spidx != NULL, ("null spidx"));
 	IPSEC_ASSERT(dir == IPSEC_DIR_INBOUND || dir == IPSEC_DIR_OUTBOUND,
 		("invalid direction %u", dir));
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s from %s:%u\n", __func__, where, tag));
 
 	/* get a SP entry */
 	KEYDEBUG(KEYDEBUG_IPSEC_DATA,
 		printf("*** objects\n");
 		kdebug_secpolicyindex(spidx));
 
-	SPTREE_LOCK();
-	LIST_FOREACH(sp, &V_sptree[dir], chain) {
+	SPTREE_RLOCK();
+	TAILQ_FOREACH(sp, &V_sptree[dir], chain) {
 		KEYDEBUG(KEYDEBUG_IPSEC_DATA,
 			printf("*** in SPD\n");
 			kdebug_secpolicyindex(&sp->spidx));
-
-		if (sp->state == IPSEC_SPSTATE_DEAD)
-			continue;
 		if (key_cmpspidx_withmask(&sp->spidx, spidx))
 			goto found;
 	}
 	sp = NULL;
 found:
 	if (sp) {
 		/* sanity check */
 		KEY_CHKSPDIR(sp->spidx.dir, dir, __func__);
 
 		/* found a SPD entry */
 		sp->lastused = time_second;
 		SP_ADDREF(sp);
 	}
-	SPTREE_UNLOCK();
+	SPTREE_RUNLOCK();
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s return SP:%p (ID=%u) refcnt %u\n", __func__,
 			sp, sp ? sp->id : 0, sp ? sp->refcnt : 0));
 	return sp;
 }
 
 /*
  * allocating a SP for OUTBOUND or INBOUND packet.
  * Must call key_freesp() later.
  * OUT:	NULL:	not found
  *	others:	found and return the pointer.
  */
 struct secpolicy *
 key_allocsp2(u_int32_t spi, union sockaddr_union *dst, u_int8_t proto,
     u_int dir, const char* where, int tag)
 {
+	SPTREE_RLOCK_TRACKER;
 	struct secpolicy *sp;
 
 	IPSEC_ASSERT(dst != NULL, ("null dst"));
 	IPSEC_ASSERT(dir == IPSEC_DIR_INBOUND || dir == IPSEC_DIR_OUTBOUND,
 		("invalid direction %u", dir));
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s from %s:%u\n", __func__, where, tag));
 
 	/* get a SP entry */
 	KEYDEBUG(KEYDEBUG_IPSEC_DATA,
 		printf("*** objects\n");
 		printf("spi %u proto %u dir %u\n", spi, proto, dir);
 		kdebug_sockaddr(&dst->sa));
 
-	SPTREE_LOCK();
-	LIST_FOREACH(sp, &V_sptree[dir], chain) {
+	SPTREE_RLOCK();
+	TAILQ_FOREACH(sp, &V_sptree[dir], chain) {
 		KEYDEBUG(KEYDEBUG_IPSEC_DATA,
 			printf("*** in SPD\n");
 			kdebug_secpolicyindex(&sp->spidx));
-
-		if (sp->state == IPSEC_SPSTATE_DEAD)
-			continue;
 		/* compare simple values, then dst address */
 		if (sp->spidx.ul_proto != proto)
 			continue;
 		/* NB: spi's must exist and match */
 		if (!sp->req || !sp->req->sav || sp->req->sav->spi != spi)
 			continue;
 		if (key_sockaddrcmp(&sp->spidx.dst.sa, &dst->sa, 1) == 0)
 			goto found;
 	}
 	sp = NULL;
 found:
 	if (sp) {
 		/* sanity check */
 		KEY_CHKSPDIR(sp->spidx.dir, dir, __func__);
 
 		/* found a SPD entry */
 		sp->lastused = time_second;
 		SP_ADDREF(sp);
 	}
-	SPTREE_UNLOCK();
+	SPTREE_RUNLOCK();
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s return SP:%p (ID=%u) refcnt %u\n", __func__,
 			sp, sp ? sp->id : 0, sp ? sp->refcnt : 0));
 	return sp;
 }
 
 #if 0
 /*
  * return a policy that matches this particular inbound packet.
  * XXX slow
  */
 struct secpolicy *
 key_gettunnel(const struct sockaddr *osrc,
 	      const struct sockaddr *odst,
 	      const struct sockaddr *isrc,
 	      const struct sockaddr *idst,
 	      const char* where, int tag)
 {
 	struct secpolicy *sp;
 	const int dir = IPSEC_DIR_INBOUND;
 	struct ipsecrequest *r1, *r2, *p;
 	struct secpolicyindex spidx;
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s from %s:%u\n", __func__, where, tag));
 
 	if (isrc->sa_family != idst->sa_family) {
 		ipseclog((LOG_ERR, "%s: protocol family mismatched %d != %d\n.",
 			__func__, isrc->sa_family, idst->sa_family));
 		sp = NULL;
 		goto done;
 	}
 
 	SPTREE_LOCK();
 	LIST_FOREACH(sp, &V_sptree[dir], chain) {
 		if (sp->state == IPSEC_SPSTATE_DEAD)
 			continue;
 
 		r1 = r2 = NULL;
 		for (p = sp->req; p; p = p->next) {
 			if (p->saidx.mode != IPSEC_MODE_TUNNEL)
 				continue;
 
 			r1 = r2;
 			r2 = p;
 
 			if (!r1) {
 				/* here we look at address matches only */
 				spidx = sp->spidx;
 				if (isrc->sa_len > sizeof(spidx.src) ||
 				    idst->sa_len > sizeof(spidx.dst))
 					continue;
 				bcopy(isrc, &spidx.src, isrc->sa_len);
 				bcopy(idst, &spidx.dst, idst->sa_len);
 				if (!key_cmpspidx_withmask(&sp->spidx, &spidx))
 					continue;
 			} else {
 				if (key_sockaddrcmp(&r1->saidx.src.sa, isrc, 0) ||
 				    key_sockaddrcmp(&r1->saidx.dst.sa, idst, 0))
 					continue;
 			}
 
 			if (key_sockaddrcmp(&r2->saidx.src.sa, osrc, 0) ||
 			    key_sockaddrcmp(&r2->saidx.dst.sa, odst, 0))
 				continue;
 
 			goto found;
 		}
 	}
 	sp = NULL;
 found:
 	if (sp) {
 		sp->lastused = time_second;
 		SP_ADDREF(sp);
 	}
 	SPTREE_UNLOCK();
 done:
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s return SP:%p (ID=%u) refcnt %u\n", __func__,
 			sp, sp ? sp->id : 0, sp ? sp->refcnt : 0));
 	return sp;
 }
 #endif
 
 /*
  * allocating an SA entry for an *OUTBOUND* packet.
  * checking each request entries in SP, and acquire an SA if need.
  * OUT:	0: there are valid requests.
  *	ENOENT: policy may be valid, but SA with REQUIRE is on acquiring.
  */
 int
 key_checkrequest(struct ipsecrequest *isr, const struct secasindex *saidx)
 {
 	u_int level;
 	int error;
 	struct secasvar *sav;
 
 	IPSEC_ASSERT(isr != NULL, ("null isr"));
 	IPSEC_ASSERT(saidx != NULL, ("null saidx"));
 	IPSEC_ASSERT(saidx->mode == IPSEC_MODE_TRANSPORT ||
 		saidx->mode == IPSEC_MODE_TUNNEL,
 		("unexpected policy %u", saidx->mode));
 
 	/*
 	 * XXX guard against protocol callbacks from the crypto
 	 * thread as they reference ipsecrequest.sav which we
 	 * temporarily null out below.  Need to rethink how we
 	 * handle bundled SA's in the callback thread.
 	 */
 	IPSECREQUEST_LOCK_ASSERT(isr);
 
 	/* get current level */
 	level = ipsec_get_reqlevel(isr);
 
 	/*
 	 * We check new SA in the IPsec request because a different
 	 * SA may be involved each time this request is checked, either
 	 * because new SAs are being configured, or this request is
 	 * associated with an unconnected datagram socket, or this request
 	 * is associated with a system default policy.
 	 *
 	 * key_allocsa_policy should allocate the oldest SA available.
 	 * See key_do_allocsa_policy(), and draft-jenkins-ipsec-rekeying-03.txt.
 	 */
 	sav = key_allocsa_policy(saidx);
 	if (sav != isr->sav) {
 		/* SA need to be updated. */
 		if (!IPSECREQUEST_UPGRADE(isr)) {
 			/* Kick everyone off. */
 			IPSECREQUEST_UNLOCK(isr);
 			IPSECREQUEST_WLOCK(isr);
 		}
 		if (isr->sav != NULL)
 			KEY_FREESAV(&isr->sav);
 		isr->sav = sav;
 		IPSECREQUEST_DOWNGRADE(isr);
 	} else if (sav != NULL)
 		KEY_FREESAV(&sav);
 
 	/* When there is SA. */
 	if (isr->sav != NULL) {
 		if (isr->sav->state != SADB_SASTATE_MATURE &&
 		    isr->sav->state != SADB_SASTATE_DYING)
 			return EINVAL;
 		return 0;
 	}
 
 	/* there is no SA */
 	error = key_acquire(saidx, isr->sp);
 	if (error != 0) {
 		/* XXX What should I do ? */
 		ipseclog((LOG_DEBUG, "%s: error %d returned from key_acquire\n",
 			__func__, error));
 		return error;
 	}
 
 	if (level != IPSEC_LEVEL_REQUIRE) {
 		/* XXX sigh, the interface to this routine is botched */
 		IPSEC_ASSERT(isr->sav == NULL, ("unexpected SA"));
 		return 0;
 	} else {
 		return ENOENT;
 	}
 }
 
 /*
  * allocating a SA for policy entry from SAD.
  * NOTE: searching SAD of aliving state.
  * OUT:	NULL:	not found.
  *	others:	found and return the pointer.
  */
 static struct secasvar *
 key_allocsa_policy(const struct secasindex *saidx)
 {
 #define	N(a)	_ARRAYLEN(a)
 	struct secashead *sah;
 	struct secasvar *sav;
 	u_int stateidx, arraysize;
 	const u_int *state_valid;
 
 	state_valid = NULL;	/* silence gcc */
 	arraysize = 0;		/* silence gcc */
 
 	SAHTREE_LOCK();
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (sah->state == SADB_SASTATE_DEAD)
 			continue;
 		if (key_cmpsaidx(&sah->saidx, saidx, CMP_MODE_REQID)) {
 			if (V_key_preferred_oldsa) {
 				state_valid = saorder_state_valid_prefer_old;
 				arraysize = N(saorder_state_valid_prefer_old);
 			} else {
 				state_valid = saorder_state_valid_prefer_new;
 				arraysize = N(saorder_state_valid_prefer_new);
 			}
 			break;
 		}
 	}
 	SAHTREE_UNLOCK();
 	if (sah == NULL)
 		return NULL;
 
 	/* search valid state */
 	for (stateidx = 0; stateidx < arraysize; stateidx++) {
 		sav = key_do_allocsa_policy(sah, state_valid[stateidx]);
 		if (sav != NULL)
 			return sav;
 	}
 
 	return NULL;
 #undef N
 }
 
 /*
  * searching SAD with direction, protocol, mode and state.
  * called by key_allocsa_policy().
  * OUT:
  *	NULL	: not found
  *	others	: found, pointer to a SA.
  */
 static struct secasvar *
 key_do_allocsa_policy(struct secashead *sah, u_int state)
 {
 	struct secasvar *sav, *nextsav, *candidate, *d;
 
 	/* initilize */
 	candidate = NULL;
 
 	SAHTREE_LOCK();
 	for (sav = LIST_FIRST(&sah->savtree[state]);
 	     sav != NULL;
 	     sav = nextsav) {
 
 		nextsav = LIST_NEXT(sav, chain);
 
 		/* sanity check */
 		KEY_CHKSASTATE(sav->state, state, __func__);
 
 		/* initialize */
 		if (candidate == NULL) {
 			candidate = sav;
 			continue;
 		}
 
 		/* Which SA is the better ? */
 
 		IPSEC_ASSERT(candidate->lft_c != NULL,
 			("null candidate lifetime"));
 		IPSEC_ASSERT(sav->lft_c != NULL, ("null sav lifetime"));
 
 		/* What the best method is to compare ? */
 		if (V_key_preferred_oldsa) {
 			if (candidate->lft_c->addtime >
 					sav->lft_c->addtime) {
 				candidate = sav;
 			}
 			continue;
 			/*NOTREACHED*/
 		}
 
 		/* preferred new sa rather than old sa */
 		if (candidate->lft_c->addtime <
 				sav->lft_c->addtime) {
 			d = candidate;
 			candidate = sav;
 		} else
 			d = sav;
 
 		/*
 		 * prepared to delete the SA when there is more
 		 * suitable candidate and the lifetime of the SA is not
 		 * permanent.
 		 */
 		if (d->lft_h->addtime != 0) {
 			struct mbuf *m, *result;
 			u_int8_t satype;
 
 			key_sa_chgstate(d, SADB_SASTATE_DEAD);
 
 			IPSEC_ASSERT(d->refcnt > 0, ("bogus ref count"));
 
 			satype = key_proto2satype(d->sah->saidx.proto);
 			if (satype == 0)
 				goto msgfail;
 
 			m = key_setsadbmsg(SADB_DELETE, 0,
 			    satype, 0, 0, d->refcnt - 1);
 			if (!m)
 				goto msgfail;
 			result = m;
 
 			/* set sadb_address for saidx's. */
 			m = key_setsadbaddr(SADB_EXT_ADDRESS_SRC,
 				&d->sah->saidx.src.sa,
 				d->sah->saidx.src.sa.sa_len << 3,
 				IPSEC_ULPROTO_ANY);
 			if (!m)
 				goto msgfail;
 			m_cat(result, m);
 
 			/* set sadb_address for saidx's. */
 			m = key_setsadbaddr(SADB_EXT_ADDRESS_DST,
 				&d->sah->saidx.dst.sa,
 				d->sah->saidx.dst.sa.sa_len << 3,
 				IPSEC_ULPROTO_ANY);
 			if (!m)
 				goto msgfail;
 			m_cat(result, m);
 
 			/* create SA extension */
 			m = key_setsadbsa(d);
 			if (!m)
 				goto msgfail;
 			m_cat(result, m);
 
 			if (result->m_len < sizeof(struct sadb_msg)) {
 				result = m_pullup(result,
 						sizeof(struct sadb_msg));
 				if (result == NULL)
 					goto msgfail;
 			}
 
 			result->m_pkthdr.len = 0;
 			for (m = result; m; m = m->m_next)
 				result->m_pkthdr.len += m->m_len;
 			mtod(result, struct sadb_msg *)->sadb_msg_len =
 				PFKEY_UNIT64(result->m_pkthdr.len);
 
 			if (key_sendup_mbuf(NULL, result,
 					KEY_SENDUP_REGISTERED))
 				goto msgfail;
 		 msgfail:
 			KEY_FREESAV(&d);
 		}
 	}
 	if (candidate) {
 		sa_addref(candidate);
 		KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 			printf("DP %s cause refcnt++:%d SA:%p\n",
 				__func__, candidate->refcnt, candidate));
 	}
 	SAHTREE_UNLOCK();
 
 	return candidate;
 }
 
 /*
  * allocating a usable SA entry for a *INBOUND* packet.
  * Must call key_freesav() later.
  * OUT: positive:	pointer to a usable sav (i.e. MATURE or DYING state).
  *	NULL:		not found, or error occured.
  *
  * In the comparison, no source address is used--for RFC2401 conformance.
  * To quote, from section 4.1:
  *	A security association is uniquely identified by a triple consisting
  *	of a Security Parameter Index (SPI), an IP Destination Address, and a
  *	security protocol (AH or ESP) identifier.
  * Note that, however, we do need to keep source address in IPsec SA.
  * IKE specification and PF_KEY specification do assume that we
  * keep source address in IPsec SA.  We see a tricky situation here.
  */
 struct secasvar *
 key_allocsa(union sockaddr_union *dst, u_int proto, u_int32_t spi,
     const char* where, int tag)
 {
 	struct secashead *sah;
 	struct secasvar *sav;
 	u_int stateidx, arraysize, state;
 	const u_int *saorder_state_valid;
 #ifdef IPSEC_NAT_T
 	int natt_chkport;
 #endif
 
 	IPSEC_ASSERT(dst != NULL, ("null dst address"));
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s from %s:%u\n", __func__, where, tag));
 
 #ifdef IPSEC_NAT_T
         natt_chkport = (dst->sa.sa_family == AF_INET &&
 	    dst->sa.sa_len == sizeof(struct sockaddr_in) &&
 	    dst->sin.sin_port != 0);
 #endif
 
 	/*
 	 * searching SAD.
 	 * XXX: to be checked internal IP header somewhere.  Also when
 	 * IPsec tunnel packet is received.  But ESP tunnel mode is
 	 * encrypted so we can't check internal IP header.
 	 */
 	SAHTREE_LOCK();
 	if (V_key_preferred_oldsa) {
 		saorder_state_valid = saorder_state_valid_prefer_old;
 		arraysize = _ARRAYLEN(saorder_state_valid_prefer_old);
 	} else {
 		saorder_state_valid = saorder_state_valid_prefer_new;
 		arraysize = _ARRAYLEN(saorder_state_valid_prefer_new);
 	}
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		int checkport;
 
 		/* search valid state */
 		for (stateidx = 0; stateidx < arraysize; stateidx++) {
 			state = saorder_state_valid[stateidx];
 			LIST_FOREACH(sav, &sah->savtree[state], chain) {
 				/* sanity check */
 				KEY_CHKSASTATE(sav->state, state, __func__);
 				/* do not return entries w/ unusable state */
 				if (sav->state != SADB_SASTATE_MATURE &&
 				    sav->state != SADB_SASTATE_DYING)
 					continue;
 				if (proto != sav->sah->saidx.proto)
 					continue;
 				if (spi != sav->spi)
 					continue;
 				checkport = 0;
 #ifdef IPSEC_NAT_T
 				/*
 				 * Really only check ports when this is a NAT-T
 				 * SA.  Otherwise other lookups providing ports
 				 * might suffer.
 				 */
 				if (sav->natt_type && natt_chkport)
 					checkport = 1;
 #endif
 #if 0	/* don't check src */
 				/* check src address */
 				if (key_sockaddrcmp(&src->sa,	
 				    &sav->sah->saidx.src.sa, checkport) != 0)
 					continue;
 #endif
 				/* check dst address */
 				if (key_sockaddrcmp(&dst->sa,
 				    &sav->sah->saidx.dst.sa, checkport) != 0)
 					continue;
 				sa_addref(sav);
 				goto done;
 			}
 		}
 	}
 	sav = NULL;
 done:
 	SAHTREE_UNLOCK();
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s return SA:%p; refcnt %u\n", __func__,
 			sav, sav ? sav->refcnt : 0));
 	return sav;
 }
 
 /*
  * Must be called after calling key_allocsp().
  * For both the packet without socket and key_freeso().
  */
 void
 _key_freesp(struct secpolicy **spp, const char* where, int tag)
 {
+	struct ipsecrequest *isr, *nextisr;
 	struct secpolicy *sp = *spp;
 
 	IPSEC_ASSERT(sp != NULL, ("null sp"));
-
-	SPTREE_LOCK();
-	SP_DELREF(sp);
-
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s SP:%p (ID=%u) from %s:%u; refcnt now %u\n",
 			__func__, sp, sp->id, where, tag, sp->refcnt));
 
-	if (sp->refcnt == 0) {
-		*spp = NULL;
-		key_delsp(sp);
+	if (SP_DELREF(sp) == 0)
+		return;
+	*spp = NULL;
+	for (isr = sp->req; isr != NULL; isr = nextisr) {
+		if (isr->sav != NULL) {
+			KEY_FREESAV(&isr->sav);
+			isr->sav = NULL;
+		}
+		nextisr = isr->next;
+		ipsec_delisr(isr);
 	}
-	SPTREE_UNLOCK();
+	free(sp, M_IPSEC_SP);
 }
 
+static void
+key_unlink(struct secpolicy *sp)
+{
+
+	IPSEC_ASSERT(sp != NULL, ("null sp"));
+	IPSEC_ASSERT(sp->spidx.dir == IPSEC_DIR_INBOUND ||
+	    sp->spidx.dir == IPSEC_DIR_OUTBOUND,
+	    ("invalid direction %u", sp->spidx.dir));
+	SPTREE_UNLOCK_ASSERT();
+
+	SPTREE_WLOCK();
+	TAILQ_REMOVE(&V_sptree[sp->spidx.dir], sp, chain);
+	SPTREE_WUNLOCK();
+}
+
 /*
  * Must be called after calling key_allocsp().
  * For the packet with socket.
  */
 void
 key_freeso(struct socket *so)
 {
 	IPSEC_ASSERT(so != NULL, ("null so"));
 
 	switch (so->so_proto->pr_domain->dom_family) {
 #if defined(INET) || defined(INET6)
 #ifdef INET
 	case PF_INET:
 #endif
 #ifdef INET6
 	case PF_INET6:
 #endif
 	    {
 		struct inpcb *pcb = sotoinpcb(so);
 
 		/* Does it have a PCB ? */
 		if (pcb == NULL)
 			return;
 		key_freesp_so(&pcb->inp_sp->sp_in);
 		key_freesp_so(&pcb->inp_sp->sp_out);
 	    }
 		break;
 #endif /* INET || INET6 */
 	default:
 		ipseclog((LOG_DEBUG, "%s: unknown address family=%d.\n",
 		    __func__, so->so_proto->pr_domain->dom_family));
 		return;
 	}
 }
 
 static void
 key_freesp_so(struct secpolicy **sp)
 {
 	IPSEC_ASSERT(sp != NULL && *sp != NULL, ("null sp"));
 
 	if ((*sp)->policy == IPSEC_POLICY_ENTRUST ||
 	    (*sp)->policy == IPSEC_POLICY_BYPASS)
 		return;
 
 	IPSEC_ASSERT((*sp)->policy == IPSEC_POLICY_IPSEC,
 		("invalid policy %u", (*sp)->policy));
 	KEY_FREESP(sp);
 }
 
 void
 key_addrefsa(struct secasvar *sav, const char* where, int tag)
 {
 
 	IPSEC_ASSERT(sav != NULL, ("null sav"));
 	IPSEC_ASSERT(sav->refcnt > 0, ("refcount must exist"));
 
 	sa_addref(sav);
 }
 
 /*
  * Must be called after calling key_allocsa().
  * This function is called by key_freesp() to free some SA allocated
  * for a policy.
  */
 void
 key_freesav(struct secasvar **psav, const char* where, int tag)
 {
 	struct secasvar *sav = *psav;
 
 	IPSEC_ASSERT(sav != NULL, ("null sav"));
 
 	if (sa_delref(sav)) {
 		KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 			printf("DP %s SA:%p (SPI %u) from %s:%u; refcnt now %u\n",
 				__func__, sav, ntohl(sav->spi), where, tag, sav->refcnt));
 		*psav = NULL;
 		key_delsav(sav);
 	} else {
 		KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 			printf("DP %s SA:%p (SPI %u) from %s:%u; refcnt now %u\n",
 				__func__, sav, ntohl(sav->spi), where, tag, sav->refcnt));
 	}
 }
 
 /* %%% SPD management */
 /*
- * free security policy entry.
- */
-static void
-key_delsp(struct secpolicy *sp)
-{
-	struct ipsecrequest *isr, *nextisr;
-
-	IPSEC_ASSERT(sp != NULL, ("null sp"));
-	SPTREE_LOCK_ASSERT();
-
-	sp->state = IPSEC_SPSTATE_DEAD;
-
-	IPSEC_ASSERT(sp->refcnt == 0,
-		("SP with references deleted (refcnt %u)", sp->refcnt));
-
-	/* remove from SP index */
-	if (__LIST_CHAINED(sp))
-		LIST_REMOVE(sp, chain);
-
-	for (isr = sp->req; isr != NULL; isr = nextisr) {
-		if (isr->sav != NULL) {
-			KEY_FREESAV(&isr->sav);
-			isr->sav = NULL;
-		}
-
-		nextisr = isr->next;
-		ipsec_delisr(isr);
-	}
-	_key_delsp(sp);
-}
-
-/*
  * search SPD
  * OUT:	NULL	: not found
  *	others	: found, pointer to a SP.
  */
 static struct secpolicy *
 key_getsp(struct secpolicyindex *spidx)
 {
+	SPTREE_RLOCK_TRACKER;
 	struct secpolicy *sp;
 
 	IPSEC_ASSERT(spidx != NULL, ("null spidx"));
 
-	SPTREE_LOCK();
-	LIST_FOREACH(sp, &V_sptree[spidx->dir], chain) {
-		if (sp->state == IPSEC_SPSTATE_DEAD)
-			continue;
+	SPTREE_RLOCK();
+	TAILQ_FOREACH(sp, &V_sptree[spidx->dir], chain) {
 		if (key_cmpspidx_exactly(spidx, &sp->spidx)) {
 			SP_ADDREF(sp);
 			break;
 		}
 	}
-	SPTREE_UNLOCK();
+	SPTREE_RUNLOCK();
 
 	return sp;
 }
 
 /*
  * get SP by index.
  * OUT:	NULL	: not found
  *	others	: found, pointer to a SP.
  */
 static struct secpolicy *
 key_getspbyid(u_int32_t id)
 {
+	SPTREE_RLOCK_TRACKER;
 	struct secpolicy *sp;
 
-	SPTREE_LOCK();
-	LIST_FOREACH(sp, &V_sptree[IPSEC_DIR_INBOUND], chain) {
-		if (sp->state == IPSEC_SPSTATE_DEAD)
-			continue;
+	SPTREE_RLOCK();
+	TAILQ_FOREACH(sp, &V_sptree[IPSEC_DIR_INBOUND], chain) {
 		if (sp->id == id) {
 			SP_ADDREF(sp);
 			goto done;
 		}
 	}
 
-	LIST_FOREACH(sp, &V_sptree[IPSEC_DIR_OUTBOUND], chain) {
-		if (sp->state == IPSEC_SPSTATE_DEAD)
-			continue;
+	TAILQ_FOREACH(sp, &V_sptree[IPSEC_DIR_OUTBOUND], chain) {
 		if (sp->id == id) {
 			SP_ADDREF(sp);
 			goto done;
 		}
 	}
 done:
-	SPTREE_UNLOCK();
+	SPTREE_RUNLOCK();
 
 	return sp;
 }
 
 struct secpolicy *
 key_newsp(const char* where, int tag)
 {
 	struct secpolicy *newsp = NULL;
 
 	newsp = (struct secpolicy *)
 		malloc(sizeof(struct secpolicy), M_IPSEC_SP, M_NOWAIT|M_ZERO);
-	if (newsp) {
-		SECPOLICY_LOCK_INIT(newsp);
-		newsp->refcnt = 1;
-		newsp->req = NULL;
-	}
+	if (newsp)
+		refcount_init(&newsp->refcnt, 1);
 
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s from %s:%u return SP:%p\n", __func__,
 			where, tag, newsp));
 	return newsp;
 }
 
-static void
-_key_delsp(struct secpolicy *sp)
-{
-	SECPOLICY_LOCK_DESTROY(sp);
-	free(sp, M_IPSEC_SP);
-}
-
 /*
  * create secpolicy structure from sadb_x_policy structure.
  * NOTE: `state', `secpolicyindex' in secpolicy structure are not set,
  * so must be set properly later.
  */
 struct secpolicy *
 key_msg2sp(struct sadb_x_policy *xpl0, size_t len, int *error)
 {
 	struct secpolicy *newsp;
 
 	IPSEC_ASSERT(xpl0 != NULL, ("null xpl0"));
 	IPSEC_ASSERT(len >= sizeof(*xpl0), ("policy too short: %zu", len));
 
 	if (len != PFKEY_EXTLEN(xpl0)) {
 		ipseclog((LOG_DEBUG, "%s: Invalid msg length.\n", __func__));
 		*error = EINVAL;
 		return NULL;
 	}
 
 	if ((newsp = KEY_NEWSP()) == NULL) {
 		*error = ENOBUFS;
 		return NULL;
 	}
 
 	newsp->spidx.dir = xpl0->sadb_x_policy_dir;
 	newsp->policy = xpl0->sadb_x_policy_type;
 
 	/* check policy */
 	switch (xpl0->sadb_x_policy_type) {
 	case IPSEC_POLICY_DISCARD:
 	case IPSEC_POLICY_NONE:
 	case IPSEC_POLICY_ENTRUST:
 	case IPSEC_POLICY_BYPASS:
 		newsp->req = NULL;
 		break;
 
 	case IPSEC_POLICY_IPSEC:
 	    {
 		int tlen;
 		struct sadb_x_ipsecrequest *xisr;
 		struct ipsecrequest **p_isr = &newsp->req;
 
 		/* validity check */
 		if (PFKEY_EXTLEN(xpl0) < sizeof(*xpl0)) {
 			ipseclog((LOG_DEBUG, "%s: Invalid msg length.\n",
 				__func__));
 			KEY_FREESP(&newsp);
 			*error = EINVAL;
 			return NULL;
 		}
 
 		tlen = PFKEY_EXTLEN(xpl0) - sizeof(*xpl0);
 		xisr = (struct sadb_x_ipsecrequest *)(xpl0 + 1);
 
 		while (tlen > 0) {
 			/* length check */
 			if (xisr->sadb_x_ipsecrequest_len < sizeof(*xisr)) {
 				ipseclog((LOG_DEBUG, "%s: invalid ipsecrequest "
 					"length.\n", __func__));
 				KEY_FREESP(&newsp);
 				*error = EINVAL;
 				return NULL;
 			}
 
 			/* allocate request buffer */
 			/* NB: data structure is zero'd */
 			*p_isr = ipsec_newisr();
 			if ((*p_isr) == NULL) {
 				ipseclog((LOG_DEBUG,
 				    "%s: No more memory.\n", __func__));
 				KEY_FREESP(&newsp);
 				*error = ENOBUFS;
 				return NULL;
 			}
 
 			/* set values */
 			switch (xisr->sadb_x_ipsecrequest_proto) {
 			case IPPROTO_ESP:
 			case IPPROTO_AH:
 			case IPPROTO_IPCOMP:
 				break;
 			default:
 				ipseclog((LOG_DEBUG,
 				    "%s: invalid proto type=%u\n", __func__,
 				    xisr->sadb_x_ipsecrequest_proto));
 				KEY_FREESP(&newsp);
 				*error = EPROTONOSUPPORT;
 				return NULL;
 			}
 			(*p_isr)->saidx.proto = xisr->sadb_x_ipsecrequest_proto;
 
 			switch (xisr->sadb_x_ipsecrequest_mode) {
 			case IPSEC_MODE_TRANSPORT:
 			case IPSEC_MODE_TUNNEL:
 				break;
 			case IPSEC_MODE_ANY:
 			default:
 				ipseclog((LOG_DEBUG,
 				    "%s: invalid mode=%u\n", __func__,
 				    xisr->sadb_x_ipsecrequest_mode));
 				KEY_FREESP(&newsp);
 				*error = EINVAL;
 				return NULL;
 			}
 			(*p_isr)->saidx.mode = xisr->sadb_x_ipsecrequest_mode;
 
 			switch (xisr->sadb_x_ipsecrequest_level) {
 			case IPSEC_LEVEL_DEFAULT:
 			case IPSEC_LEVEL_USE:
 			case IPSEC_LEVEL_REQUIRE:
 				break;
 			case IPSEC_LEVEL_UNIQUE:
 				/* validity check */
 				/*
 				 * If range violation of reqid, kernel will
 				 * update it, don't refuse it.
 				 */
 				if (xisr->sadb_x_ipsecrequest_reqid
 						> IPSEC_MANUAL_REQID_MAX) {
 					ipseclog((LOG_DEBUG,
 					    "%s: reqid=%d range "
 					    "violation, updated by kernel.\n",
 					    __func__,
 					    xisr->sadb_x_ipsecrequest_reqid));
 					xisr->sadb_x_ipsecrequest_reqid = 0;
 				}
 
 				/* allocate new reqid id if reqid is zero. */
 				if (xisr->sadb_x_ipsecrequest_reqid == 0) {
 					u_int32_t reqid;
 					if ((reqid = key_newreqid()) == 0) {
 						KEY_FREESP(&newsp);
 						*error = ENOBUFS;
 						return NULL;
 					}
 					(*p_isr)->saidx.reqid = reqid;
 					xisr->sadb_x_ipsecrequest_reqid = reqid;
 				} else {
 				/* set it for manual keying. */
 					(*p_isr)->saidx.reqid =
 						xisr->sadb_x_ipsecrequest_reqid;
 				}
 				break;
 
 			default:
 				ipseclog((LOG_DEBUG, "%s: invalid level=%u\n",
 					__func__,
 					xisr->sadb_x_ipsecrequest_level));
 				KEY_FREESP(&newsp);
 				*error = EINVAL;
 				return NULL;
 			}
 			(*p_isr)->level = xisr->sadb_x_ipsecrequest_level;
 
 			/* set IP addresses if there */
 			if (xisr->sadb_x_ipsecrequest_len > sizeof(*xisr)) {
 				struct sockaddr *paddr;
 
 				paddr = (struct sockaddr *)(xisr + 1);
 
 				/* validity check */
 				if (paddr->sa_len
 				    > sizeof((*p_isr)->saidx.src)) {
 					ipseclog((LOG_DEBUG, "%s: invalid "
 						"request address length.\n",
 						__func__));
 					KEY_FREESP(&newsp);
 					*error = EINVAL;
 					return NULL;
 				}
 				bcopy(paddr, &(*p_isr)->saidx.src,
 					paddr->sa_len);
 
 				paddr = (struct sockaddr *)((caddr_t)paddr
 							+ paddr->sa_len);
 
 				/* validity check */
 				if (paddr->sa_len
 				    > sizeof((*p_isr)->saidx.dst)) {
 					ipseclog((LOG_DEBUG, "%s: invalid "
 						"request address length.\n",
 						__func__));
 					KEY_FREESP(&newsp);
 					*error = EINVAL;
 					return NULL;
 				}
 				bcopy(paddr, &(*p_isr)->saidx.dst,
 					paddr->sa_len);
 			}
 
 			(*p_isr)->sp = newsp;
 
 			/* initialization for the next. */
 			p_isr = &(*p_isr)->next;
 			tlen -= xisr->sadb_x_ipsecrequest_len;
 
 			/* validity check */
 			if (tlen < 0) {
 				ipseclog((LOG_DEBUG, "%s: becoming tlen < 0.\n",
 					__func__));
 				KEY_FREESP(&newsp);
 				*error = EINVAL;
 				return NULL;
 			}
 
 			xisr = (struct sadb_x_ipsecrequest *)((caddr_t)xisr
 			                 + xisr->sadb_x_ipsecrequest_len);
 		}
 	    }
 		break;
 	default:
 		ipseclog((LOG_DEBUG, "%s: invalid policy type.\n", __func__));
 		KEY_FREESP(&newsp);
 		*error = EINVAL;
 		return NULL;
 	}
 
 	*error = 0;
 	return newsp;
 }
 
 static u_int32_t
 key_newreqid()
 {
 	static u_int32_t auto_reqid = IPSEC_MANUAL_REQID_MAX + 1;
 
 	auto_reqid = (auto_reqid == ~0
 			? IPSEC_MANUAL_REQID_MAX + 1 : auto_reqid + 1);
 
 	/* XXX should be unique check */
 
 	return auto_reqid;
 }
 
 /*
  * copy secpolicy struct to sadb_x_policy structure indicated.
  */
 struct mbuf *
 key_sp2msg(struct secpolicy *sp)
 {
 	struct sadb_x_policy *xpl;
 	int tlen;
 	caddr_t p;
 	struct mbuf *m;
 
 	IPSEC_ASSERT(sp != NULL, ("null policy"));
 
 	tlen = key_getspreqmsglen(sp);
 
 	m = m_get2(tlen, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return (NULL);
 	m_align(m, tlen);
 	m->m_len = tlen;
 	xpl = mtod(m, struct sadb_x_policy *);
 	bzero(xpl, tlen);
 
 	xpl->sadb_x_policy_len = PFKEY_UNIT64(tlen);
 	xpl->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
 	xpl->sadb_x_policy_type = sp->policy;
 	xpl->sadb_x_policy_dir = sp->spidx.dir;
 	xpl->sadb_x_policy_id = sp->id;
 	p = (caddr_t)xpl + sizeof(*xpl);
 
 	/* if is the policy for ipsec ? */
 	if (sp->policy == IPSEC_POLICY_IPSEC) {
 		struct sadb_x_ipsecrequest *xisr;
 		struct ipsecrequest *isr;
 
 		for (isr = sp->req; isr != NULL; isr = isr->next) {
 
 			xisr = (struct sadb_x_ipsecrequest *)p;
 
 			xisr->sadb_x_ipsecrequest_proto = isr->saidx.proto;
 			xisr->sadb_x_ipsecrequest_mode = isr->saidx.mode;
 			xisr->sadb_x_ipsecrequest_level = isr->level;
 			xisr->sadb_x_ipsecrequest_reqid = isr->saidx.reqid;
 
 			p += sizeof(*xisr);
 			bcopy(&isr->saidx.src, p, isr->saidx.src.sa.sa_len);
 			p += isr->saidx.src.sa.sa_len;
 			bcopy(&isr->saidx.dst, p, isr->saidx.dst.sa.sa_len);
 			p += isr->saidx.src.sa.sa_len;
 
 			xisr->sadb_x_ipsecrequest_len =
 				PFKEY_ALIGN8(sizeof(*xisr)
 					+ isr->saidx.src.sa.sa_len
 					+ isr->saidx.dst.sa.sa_len);
 		}
 	}
 
 	return m;
 }
 
 /* m will not be freed nor modified */
 static struct mbuf *
 key_gather_mbuf(struct mbuf *m, const struct sadb_msghdr *mhp,
     int ndeep, int nitem, ...)
 {
 	va_list ap;
 	int idx;
 	int i;
 	struct mbuf *result = NULL, *n;
 	int len;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 
 	va_start(ap, nitem);
 	for (i = 0; i < nitem; i++) {
 		idx = va_arg(ap, int);
 		if (idx < 0 || idx > SADB_EXT_MAX)
 			goto fail;
 		/* don't attempt to pull empty extension */
 		if (idx == SADB_EXT_RESERVED && mhp->msg == NULL)
 			continue;
 		if (idx != SADB_EXT_RESERVED  &&
 		    (mhp->ext[idx] == NULL || mhp->extlen[idx] == 0))
 			continue;
 
 		if (idx == SADB_EXT_RESERVED) {
 			len = PFKEY_ALIGN8(sizeof(struct sadb_msg));
 
 			IPSEC_ASSERT(len <= MHLEN, ("header too big %u", len));
 
 			MGETHDR(n, M_NOWAIT, MT_DATA);
 			if (!n)
 				goto fail;
 			n->m_len = len;
 			n->m_next = NULL;
 			m_copydata(m, 0, sizeof(struct sadb_msg),
 			    mtod(n, caddr_t));
 		} else if (i < ndeep) {
 			len = mhp->extlen[idx];
 			n = m_get2(len, M_NOWAIT, MT_DATA, 0);
 			if (n == NULL)
 				goto fail;
 			m_align(n, len);
 			n->m_len = len;
 			m_copydata(m, mhp->extoff[idx], mhp->extlen[idx],
 			    mtod(n, caddr_t));
 		} else {
 			n = m_copym(m, mhp->extoff[idx], mhp->extlen[idx],
 			    M_NOWAIT);
 		}
 		if (n == NULL)
 			goto fail;
 
 		if (result)
 			m_cat(result, n);
 		else
 			result = n;
 	}
 	va_end(ap);
 
 	if ((result->m_flags & M_PKTHDR) != 0) {
 		result->m_pkthdr.len = 0;
 		for (n = result; n; n = n->m_next)
 			result->m_pkthdr.len += n->m_len;
 	}
 
 	return result;
 
 fail:
 	m_freem(result);
 	va_end(ap);
 	return NULL;
 }
 
 /*
  * SADB_X_SPDADD, SADB_X_SPDSETIDX or SADB_X_SPDUPDATE processing
  * add an entry to SP database, when received
  *   
  * from the user(?).
  * Adding to SP database,
  * and send
  *   
  * to the socket which was send.
  *
  * SPDADD set a unique policy entry.
  * SPDSETIDX like SPDADD without a part of policy requests.
  * SPDUPDATE replace a unique policy entry.
  *
  * m will always be freed.
  */
 static int
 key_spdadd(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct sadb_address *src0, *dst0;
 	struct sadb_x_policy *xpl0, *xpl;
 	struct sadb_lifetime *lft = NULL;
 	struct secpolicyindex spidx;
 	struct secpolicy *newsp;
 	int error;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	if (mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_DST] == NULL ||
 	    mhp->ext[SADB_X_EXT_POLICY] == NULL) {
 		ipseclog((LOG_DEBUG, "key_spdadd: invalid message is passed.\n"));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->ext[SADB_EXT_LIFETIME_HARD] != NULL) {
 		if (mhp->extlen[SADB_EXT_LIFETIME_HARD]
 			< sizeof(struct sadb_lifetime)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 				__func__));
 			return key_senderror(so, m, EINVAL);
 		}
 		lft = (struct sadb_lifetime *)mhp->ext[SADB_EXT_LIFETIME_HARD];
 	}
 
 	src0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_SRC];
 	dst0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_DST];
 	xpl0 = (struct sadb_x_policy *)mhp->ext[SADB_X_EXT_POLICY];
 
 	/* 
 	 * Note: do not parse SADB_X_EXT_NAT_T_* here:
 	 * we are processing traffic endpoints.
 	 */
 
 	/* make secindex */
 	/* XXX boundary check against sa_len */
 	KEY_SETSECSPIDX(xpl0->sadb_x_policy_dir,
 	                src0 + 1,
 	                dst0 + 1,
 	                src0->sadb_address_prefixlen,
 	                dst0->sadb_address_prefixlen,
 	                src0->sadb_address_proto,
 	                &spidx);
 
 	/* checking the direciton. */
 	switch (xpl0->sadb_x_policy_dir) {
 	case IPSEC_DIR_INBOUND:
 	case IPSEC_DIR_OUTBOUND:
 		break;
 	default:
 		ipseclog((LOG_DEBUG, "%s: Invalid SP direction.\n", __func__));
 		mhp->msg->sadb_msg_errno = EINVAL;
 		return 0;
 	}
 
 	/* check policy */
 	/* key_spdadd() accepts DISCARD, NONE and IPSEC. */
 	if (xpl0->sadb_x_policy_type == IPSEC_POLICY_ENTRUST
 	 || xpl0->sadb_x_policy_type == IPSEC_POLICY_BYPASS) {
 		ipseclog((LOG_DEBUG, "%s: Invalid policy type.\n", __func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/* policy requests are mandatory when action is ipsec. */
         if (mhp->msg->sadb_msg_type != SADB_X_SPDSETIDX
 	 && xpl0->sadb_x_policy_type == IPSEC_POLICY_IPSEC
 	 && mhp->extlen[SADB_X_EXT_POLICY] <= sizeof(*xpl0)) {
 		ipseclog((LOG_DEBUG, "%s: some policy requests part required\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/*
 	 * checking there is SP already or not.
 	 * SPDUPDATE doesn't depend on whether there is a SP or not.
 	 * If the type is either SPDADD or SPDSETIDX AND a SP is found,
 	 * then error.
 	 */
 	newsp = key_getsp(&spidx);
 	if (mhp->msg->sadb_msg_type == SADB_X_SPDUPDATE) {
 		if (newsp) {
-			SPTREE_LOCK();
-			newsp->state = IPSEC_SPSTATE_DEAD;
-			SPTREE_UNLOCK();
+			key_unlink(newsp);
 			KEY_FREESP(&newsp);
 		}
 	} else {
 		if (newsp != NULL) {
 			KEY_FREESP(&newsp);
 			ipseclog((LOG_DEBUG, "%s: a SP entry exists already.\n",
 				__func__));
 			return key_senderror(so, m, EEXIST);
 		}
 	}
 
+	/* XXX: there is race between key_getsp and key_msg2sp. */
+
 	/* allocation new SP entry */
 	if ((newsp = key_msg2sp(xpl0, PFKEY_EXTLEN(xpl0), &error)) == NULL) {
 		return key_senderror(so, m, error);
 	}
 
 	if ((newsp->id = key_getnewspid()) == 0) {
-		_key_delsp(newsp);
+		KEY_FREESP(&newsp);
 		return key_senderror(so, m, ENOBUFS);
 	}
 
 	/* XXX boundary check against sa_len */
 	KEY_SETSECSPIDX(xpl0->sadb_x_policy_dir,
 	                src0 + 1,
 	                dst0 + 1,
 	                src0->sadb_address_prefixlen,
 	                dst0->sadb_address_prefixlen,
 	                src0->sadb_address_proto,
 	                &newsp->spidx);
 
 	/* sanity check on addr pair */
 	if (((struct sockaddr *)(src0 + 1))->sa_family !=
 			((struct sockaddr *)(dst0+ 1))->sa_family) {
-		_key_delsp(newsp);
+		KEY_FREESP(&newsp);
 		return key_senderror(so, m, EINVAL);
 	}
 	if (((struct sockaddr *)(src0 + 1))->sa_len !=
 			((struct sockaddr *)(dst0+ 1))->sa_len) {
-		_key_delsp(newsp);
+		KEY_FREESP(&newsp);
 		return key_senderror(so, m, EINVAL);
 	}
 #if 1
-	if (newsp->req && newsp->req->saidx.src.sa.sa_family && newsp->req->saidx.dst.sa.sa_family) {
-		if (newsp->req->saidx.src.sa.sa_family != newsp->req->saidx.dst.sa.sa_family) {
-			_key_delsp(newsp);
+	if (newsp->req && newsp->req->saidx.src.sa.sa_family &&
+	    newsp->req->saidx.dst.sa.sa_family) {
+		if (newsp->req->saidx.src.sa.sa_family !=
+		    newsp->req->saidx.dst.sa.sa_family) {
+			KEY_FREESP(&newsp);
 			return key_senderror(so, m, EINVAL);
 		}
 	}
 #endif
 
 	newsp->created = time_second;
 	newsp->lastused = newsp->created;
 	newsp->lifetime = lft ? lft->sadb_lifetime_addtime : 0;
 	newsp->validtime = lft ? lft->sadb_lifetime_usetime : 0;
 
-	newsp->refcnt = 1;	/* do not reclaim until I say I do */
-	newsp->state = IPSEC_SPSTATE_ALIVE;
-	LIST_INSERT_TAIL(&V_sptree[newsp->spidx.dir], newsp, secpolicy, chain);
+	SPTREE_WLOCK();
+	TAILQ_INSERT_TAIL(&V_sptree[newsp->spidx.dir], newsp, chain);
+	SPTREE_WUNLOCK();
 
 	/* delete the entry in spacqtree */
 	if (mhp->msg->sadb_msg_type == SADB_X_SPDUPDATE) {
 		struct secspacq *spacq = key_getspacq(&spidx);
 		if (spacq != NULL) {
 			/* reset counter in order to deletion by timehandler. */
 			spacq->created = time_second;
 			spacq->count = 0;
 			SPACQ_UNLOCK();
 		}
     	}
 
     {
 	struct mbuf *n, *mpolicy;
 	struct sadb_msg *newmsg;
 	int off;
 
 	/*
 	 * Note: do not send SADB_X_EXT_NAT_T_* here:
 	 * we are sending traffic endpoints.
 	 */
 
 	/* create new sadb_msg to reply. */
 	if (lft) {
 		n = key_gather_mbuf(m, mhp, 2, 5, SADB_EXT_RESERVED,
 		    SADB_X_EXT_POLICY, SADB_EXT_LIFETIME_HARD,
 		    SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST);
 	} else {
 		n = key_gather_mbuf(m, mhp, 2, 4, SADB_EXT_RESERVED,
 		    SADB_X_EXT_POLICY,
 		    SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST);
 	}
 	if (!n)
 		return key_senderror(so, m, ENOBUFS);
 
 	if (n->m_len < sizeof(*newmsg)) {
 		n = m_pullup(n, sizeof(*newmsg));
 		if (!n)
 			return key_senderror(so, m, ENOBUFS);
 	}
 	newmsg = mtod(n, struct sadb_msg *);
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len);
 
 	off = 0;
 	mpolicy = m_pulldown(n, PFKEY_ALIGN8(sizeof(struct sadb_msg)),
 	    sizeof(*xpl), &off);
 	if (mpolicy == NULL) {
 		/* n is already freed */
 		return key_senderror(so, m, ENOBUFS);
 	}
 	xpl = (struct sadb_x_policy *)(mtod(mpolicy, caddr_t) + off);
 	if (xpl->sadb_x_policy_exttype != SADB_X_EXT_POLICY) {
 		m_freem(n);
 		return key_senderror(so, m, EINVAL);
 	}
 	xpl->sadb_x_policy_id = newsp->id;
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);
     }
 }
 
 /*
  * get new policy id.
  * OUT:
  *	0:	failure.
  *	others: success.
  */
 static u_int32_t
 key_getnewspid()
 {
 	u_int32_t newid = 0;
 	int count = V_key_spi_trycnt;	/* XXX */
 	struct secpolicy *sp;
 
 	/* when requesting to allocate spi ranged */
 	while (count--) {
 		newid = (V_policy_id = (V_policy_id == ~0 ? 1 : V_policy_id + 1));
 
 		if ((sp = key_getspbyid(newid)) == NULL)
 			break;
 
 		KEY_FREESP(&sp);
 	}
 
 	if (count == 0 || newid == 0) {
 		ipseclog((LOG_DEBUG, "%s: to allocate policy id is failed.\n",
 			__func__));
 		return 0;
 	}
 
 	return newid;
 }
 
 /*
  * SADB_SPDDELETE processing
  * receive
  *   
  * from the user(?), and set SADB_SASTATE_DEAD,
  * and send,
  *   
  * to the ikmpd.
  * policy(*) including direction of policy.
  *
  * m will always be freed.
  */
 static int
 key_spddelete(struct socket *so, struct mbuf *m,
     const struct sadb_msghdr *mhp)
 {
 	struct sadb_address *src0, *dst0;
 	struct sadb_x_policy *xpl0;
 	struct secpolicyindex spidx;
 	struct secpolicy *sp;
 
 	IPSEC_ASSERT(so != NULL, ("null so"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	if (mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_DST] == NULL ||
 	    mhp->ext[SADB_X_EXT_POLICY] == NULL) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	src0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_SRC];
 	dst0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_DST];
 	xpl0 = (struct sadb_x_policy *)mhp->ext[SADB_X_EXT_POLICY];
 
 	/*
 	 * Note: do not parse SADB_X_EXT_NAT_T_* here:
 	 * we are processing traffic endpoints.
 	 */
 
 	/* make secindex */
 	/* XXX boundary check against sa_len */
 	KEY_SETSECSPIDX(xpl0->sadb_x_policy_dir,
 	                src0 + 1,
 	                dst0 + 1,
 	                src0->sadb_address_prefixlen,
 	                dst0->sadb_address_prefixlen,
 	                src0->sadb_address_proto,
 	                &spidx);
 
 	/* checking the direciton. */
 	switch (xpl0->sadb_x_policy_dir) {
 	case IPSEC_DIR_INBOUND:
 	case IPSEC_DIR_OUTBOUND:
 		break;
 	default:
 		ipseclog((LOG_DEBUG, "%s: Invalid SP direction.\n", __func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/* Is there SP in SPD ? */
 	if ((sp = key_getsp(&spidx)) == NULL) {
 		ipseclog((LOG_DEBUG, "%s: no SP found.\n", __func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/* save policy id to buffer to be returned. */
 	xpl0->sadb_x_policy_id = sp->id;
 
-	SPTREE_LOCK();
-	sp->state = IPSEC_SPSTATE_DEAD;
-	SPTREE_UNLOCK();
+	key_unlink(sp);
 	KEY_FREESP(&sp);
 
     {
 	struct mbuf *n;
 	struct sadb_msg *newmsg;
 
 	/*
 	 * Note: do not send SADB_X_EXT_NAT_T_* here:
 	 * we are sending traffic endpoints.
 	 */
 
 	/* create new sadb_msg to reply. */
 	n = key_gather_mbuf(m, mhp, 1, 4, SADB_EXT_RESERVED,
 	    SADB_X_EXT_POLICY, SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST);
 	if (!n)
 		return key_senderror(so, m, ENOBUFS);
 
 	newmsg = mtod(n, struct sadb_msg *);
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len);
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);
     }
 }
 
 /*
  * SADB_SPDDELETE2 processing
  * receive
  *   
  * from the user(?), and set SADB_SASTATE_DEAD,
  * and send,
  *   
  * to the ikmpd.
  * policy(*) including direction of policy.
  *
  * m will always be freed.
  */
 static int
 key_spddelete2(struct socket *so, struct mbuf *m,
     const struct sadb_msghdr *mhp)
 {
 	u_int32_t id;
 	struct secpolicy *sp;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	if (mhp->ext[SADB_X_EXT_POLICY] == NULL ||
 	    mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n", __func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	id = ((struct sadb_x_policy *)mhp->ext[SADB_X_EXT_POLICY])->sadb_x_policy_id;
 
 	/* Is there SP in SPD ? */
 	if ((sp = key_getspbyid(id)) == NULL) {
 		ipseclog((LOG_DEBUG, "%s: no SP found id:%u.\n", __func__, id));
 		return key_senderror(so, m, EINVAL);
 	}
 
-	SPTREE_LOCK();
-	sp->state = IPSEC_SPSTATE_DEAD;
-	SPTREE_UNLOCK();
+	key_unlink(sp);
 	KEY_FREESP(&sp);
 
     {
 	struct mbuf *n, *nn;
 	struct sadb_msg *newmsg;
 	int off, len;
 
 	/* create new sadb_msg to reply. */
 	len = PFKEY_ALIGN8(sizeof(struct sadb_msg));
 
 	MGETHDR(n, M_NOWAIT, MT_DATA);
 	if (n && len > MHLEN) {
 		MCLGET(n, M_NOWAIT);
 		if ((n->m_flags & M_EXT) == 0) {
 			m_freem(n);
 			n = NULL;
 		}
 	}
 	if (!n)
 		return key_senderror(so, m, ENOBUFS);
 
 	n->m_len = len;
 	n->m_next = NULL;
 	off = 0;
 
 	m_copydata(m, 0, sizeof(struct sadb_msg), mtod(n, caddr_t) + off);
 	off += PFKEY_ALIGN8(sizeof(struct sadb_msg));
 
 	IPSEC_ASSERT(off == len, ("length inconsistency (off %u len %u)",
 		off, len));
 
 	n->m_next = m_copym(m, mhp->extoff[SADB_X_EXT_POLICY],
 	    mhp->extlen[SADB_X_EXT_POLICY], M_NOWAIT);
 	if (!n->m_next) {
 		m_freem(n);
 		return key_senderror(so, m, ENOBUFS);
 	}
 
 	n->m_pkthdr.len = 0;
 	for (nn = n; nn; nn = nn->m_next)
 		n->m_pkthdr.len += nn->m_len;
 
 	newmsg = mtod(n, struct sadb_msg *);
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len);
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);
     }
 }
 
 /*
  * SADB_X_GET processing
  * receive
  *   
  * from the user(?),
  * and send,
  *   
  * to the ikmpd.
  * policy(*) including direction of policy.
  *
  * m will always be freed.
  */
 static int
 key_spdget(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	u_int32_t id;
 	struct secpolicy *sp;
 	struct mbuf *n;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	if (mhp->ext[SADB_X_EXT_POLICY] == NULL ||
 	    mhp->extlen[SADB_X_EXT_POLICY] < sizeof(struct sadb_x_policy)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	id = ((struct sadb_x_policy *)mhp->ext[SADB_X_EXT_POLICY])->sadb_x_policy_id;
 
 	/* Is there SP in SPD ? */
 	if ((sp = key_getspbyid(id)) == NULL) {
 		ipseclog((LOG_DEBUG, "%s: no SP found id:%u.\n", __func__, id));
 		return key_senderror(so, m, ENOENT);
 	}
 
 	n = key_setdumpsp(sp, SADB_X_SPDGET, 0, mhp->msg->sadb_msg_pid);
 	KEY_FREESP(&sp);
 	if (n != NULL) {
 		m_freem(m);
 		return key_sendup_mbuf(so, n, KEY_SENDUP_ONE);
 	} else
 		return key_senderror(so, m, ENOBUFS);
 }
 
 /*
  * SADB_X_SPDACQUIRE processing.
  * Acquire policy and SA(s) for a *OUTBOUND* packet.
  * send
  *   
  * to KMD, and expect to receive
  *    with SADB_X_SPDACQUIRE if error occured,
  * or
  *   
  * with SADB_X_SPDUPDATE from KMD by PF_KEY.
  * policy(*) is without policy requests.
  *
  *    0     : succeed
  *    others: error number
  */
 int
 key_spdacquire(struct secpolicy *sp)
 {
 	struct mbuf *result = NULL, *m;
 	struct secspacq *newspacq;
 
 	IPSEC_ASSERT(sp != NULL, ("null secpolicy"));
 	IPSEC_ASSERT(sp->req == NULL, ("policy exists"));
 	IPSEC_ASSERT(sp->policy == IPSEC_POLICY_IPSEC,
 		("policy not IPSEC %u", sp->policy));
 
 	/* Get an entry to check whether sent message or not. */
 	newspacq = key_getspacq(&sp->spidx);
 	if (newspacq != NULL) {
 		if (V_key_blockacq_count < newspacq->count) {
 			/* reset counter and do send message. */
 			newspacq->count = 0;
 		} else {
 			/* increment counter and do nothing. */
 			newspacq->count++;
 			SPACQ_UNLOCK();
 			return (0);
 		}
 		SPACQ_UNLOCK();
 	} else {
 		/* make new entry for blocking to send SADB_ACQUIRE. */
 		newspacq = key_newspacq(&sp->spidx);
 		if (newspacq == NULL)
 			return ENOBUFS;
 	}
 
 	/* create new sadb_msg to reply. */
 	m = key_setsadbmsg(SADB_X_SPDACQUIRE, 0, 0, 0, 0, 0);
 	if (!m)
 		return ENOBUFS;
 
 	result = m;
 
 	result->m_pkthdr.len = 0;
 	for (m = result; m; m = m->m_next)
 		result->m_pkthdr.len += m->m_len;
 
 	mtod(result, struct sadb_msg *)->sadb_msg_len =
 	    PFKEY_UNIT64(result->m_pkthdr.len);
 
 	return key_sendup_mbuf(NULL, m, KEY_SENDUP_REGISTERED);
 }
 
 /*
  * SADB_SPDFLUSH processing
  * receive
  *   
  * from the user, and free all entries in secpctree.
  * and send,
  *   
  * to the user.
  * NOTE: what to do is only marking SADB_SASTATE_DEAD.
  *
  * m will always be freed.
  */
 static int
 key_spdflush(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
+	TAILQ_HEAD(, secpolicy) drainq;
 	struct sadb_msg *newmsg;
-	struct secpolicy *sp;
+	struct secpolicy *sp, *nextsp;
 	u_int dir;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	if (m->m_len != PFKEY_ALIGN8(sizeof(struct sadb_msg)))
 		return key_senderror(so, m, EINVAL);
 
+	TAILQ_INIT(&drainq);
+	SPTREE_WLOCK();
 	for (dir = 0; dir < IPSEC_DIR_MAX; dir++) {
-		SPTREE_LOCK();
-		LIST_FOREACH(sp, &V_sptree[dir], chain)
-			sp->state = IPSEC_SPSTATE_DEAD;
-		SPTREE_UNLOCK();
+		TAILQ_CONCAT(&drainq, &V_sptree[dir], chain);
 	}
+	SPTREE_WUNLOCK();
+	sp = TAILQ_FIRST(&drainq);
+	while (sp != NULL) {
+		nextsp = TAILQ_NEXT(sp, chain);
+		KEY_FREESP(&sp);
+		sp = nextsp;
+	}
 
 	if (sizeof(struct sadb_msg) > m->m_len + M_TRAILINGSPACE(m)) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return key_senderror(so, m, ENOBUFS);
 	}
 
 	if (m->m_next)
 		m_freem(m->m_next);
 	m->m_next = NULL;
 	m->m_pkthdr.len = m->m_len = PFKEY_ALIGN8(sizeof(struct sadb_msg));
 	newmsg = mtod(m, struct sadb_msg *);
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(m->m_pkthdr.len);
 
 	return key_sendup_mbuf(so, m, KEY_SENDUP_ALL);
 }
 
 /*
  * SADB_SPDDUMP processing
  * receive
  *   
  * from the user, and dump all SP leaves
  * and send,
  *    .....
  * to the ikmpd.
  *
  * m will always be freed.
  */
 static int
 key_spddump(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
+	SPTREE_RLOCK_TRACKER;
 	struct secpolicy *sp;
 	int cnt;
 	u_int dir;
 	struct mbuf *n;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* search SPD entry and get buffer size. */
 	cnt = 0;
-	SPTREE_LOCK();
+	SPTREE_RLOCK();
 	for (dir = 0; dir < IPSEC_DIR_MAX; dir++) {
-		LIST_FOREACH(sp, &V_sptree[dir], chain) {
+		TAILQ_FOREACH(sp, &V_sptree[dir], chain) {
 			cnt++;
 		}
 	}
 
 	if (cnt == 0) {
-		SPTREE_UNLOCK();
+		SPTREE_RUNLOCK();
 		return key_senderror(so, m, ENOENT);
 	}
 
 	for (dir = 0; dir < IPSEC_DIR_MAX; dir++) {
-		LIST_FOREACH(sp, &V_sptree[dir], chain) {
+		TAILQ_FOREACH(sp, &V_sptree[dir], chain) {
 			--cnt;
 			n = key_setdumpsp(sp, SADB_X_SPDDUMP, cnt,
 			    mhp->msg->sadb_msg_pid);
 
 			if (n)
 				key_sendup_mbuf(so, n, KEY_SENDUP_ONE);
 		}
 	}
 
-	SPTREE_UNLOCK();
+	SPTREE_RUNLOCK();
 	m_freem(m);
 	return 0;
 }
 
 static struct mbuf *
 key_setdumpsp(struct secpolicy *sp, u_int8_t type, u_int32_t seq,
     u_int32_t pid)
 {
 	struct mbuf *result = NULL, *m;
 	struct seclifetime lt;
 
+	SPTREE_RLOCK_ASSERT();
+
 	m = key_setsadbmsg(type, 0, SADB_SATYPE_UNSPEC, seq, pid, sp->refcnt);
 	if (!m)
 		goto fail;
 	result = m;
 
 	/*
 	 * Note: do not send SADB_X_EXT_NAT_T_* here:
 	 * we are sending traffic endpoints.
 	 */
 	m = key_setsadbaddr(SADB_EXT_ADDRESS_SRC,
 	    &sp->spidx.src.sa, sp->spidx.prefs,
 	    sp->spidx.ul_proto);
 	if (!m)
 		goto fail;
 	m_cat(result, m);
 
 	m = key_setsadbaddr(SADB_EXT_ADDRESS_DST,
 	    &sp->spidx.dst.sa, sp->spidx.prefd,
 	    sp->spidx.ul_proto);
 	if (!m)
 		goto fail;
 	m_cat(result, m);
 
 	m = key_sp2msg(sp);
 	if (!m)
 		goto fail;
 	m_cat(result, m);
 
 	if(sp->lifetime){
 		lt.addtime=sp->created;
 		lt.usetime= sp->lastused;
 		m = key_setlifetime(<, SADB_EXT_LIFETIME_CURRENT);
 		if (!m)
 			goto fail;
 		m_cat(result, m);
 		
 		lt.addtime=sp->lifetime;
 		lt.usetime= sp->validtime;
 		m = key_setlifetime(<, SADB_EXT_LIFETIME_HARD);
 		if (!m)
 			goto fail;
 		m_cat(result, m);
 	}
 
 	if ((result->m_flags & M_PKTHDR) == 0)
 		goto fail;
 
 	if (result->m_len < sizeof(struct sadb_msg)) {
 		result = m_pullup(result, sizeof(struct sadb_msg));
 		if (result == NULL)
 			goto fail;
 	}
 
 	result->m_pkthdr.len = 0;
 	for (m = result; m; m = m->m_next)
 		result->m_pkthdr.len += m->m_len;
 
 	mtod(result, struct sadb_msg *)->sadb_msg_len =
 	    PFKEY_UNIT64(result->m_pkthdr.len);
 
 	return result;
 
 fail:
 	m_freem(result);
 	return NULL;
 }
 
 /*
  * get PFKEY message length for security policy and request.
  */
 static u_int
 key_getspreqmsglen(struct secpolicy *sp)
 {
 	u_int tlen;
 
 	tlen = sizeof(struct sadb_x_policy);
 
 	/* if is the policy for ipsec ? */
 	if (sp->policy != IPSEC_POLICY_IPSEC)
 		return tlen;
 
 	/* get length of ipsec requests */
     {
 	struct ipsecrequest *isr;
 	int len;
 
 	for (isr = sp->req; isr != NULL; isr = isr->next) {
 		len = sizeof(struct sadb_x_ipsecrequest)
 			+ isr->saidx.src.sa.sa_len
 			+ isr->saidx.dst.sa.sa_len;
 
 		tlen += PFKEY_ALIGN8(len);
 	}
     }
 
 	return tlen;
 }
 
 /*
  * SADB_SPDEXPIRE processing
  * send
  *   
  * to KMD by PF_KEY.
  *
  * OUT:	0	: succeed
  *	others	: error number
  */
 static int
 key_spdexpire(struct secpolicy *sp)
 {
 	struct mbuf *result = NULL, *m;
 	int len;
 	int error = -1;
 	struct sadb_lifetime *lt;
 
 	/* XXX: Why do we lock ? */
 
 	IPSEC_ASSERT(sp != NULL, ("null secpolicy"));
 
 	/* set msg header */
 	m = key_setsadbmsg(SADB_X_SPDEXPIRE, 0, 0, 0, 0, 0);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	result = m;
 
 	/* create lifetime extension (current and hard) */
 	len = PFKEY_ALIGN8(sizeof(*lt)) * 2;
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_align(m, len);
 	m->m_len = len;
 	bzero(mtod(m, caddr_t), len);
 	lt = mtod(m, struct sadb_lifetime *);
 	lt->sadb_lifetime_len = PFKEY_UNIT64(sizeof(struct sadb_lifetime));
 	lt->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT;
 	lt->sadb_lifetime_allocations = 0;
 	lt->sadb_lifetime_bytes = 0;
 	lt->sadb_lifetime_addtime = sp->created;
 	lt->sadb_lifetime_usetime = sp->lastused;
 	lt = (struct sadb_lifetime *)(mtod(m, caddr_t) + len / 2);
 	lt->sadb_lifetime_len = PFKEY_UNIT64(sizeof(struct sadb_lifetime));
 	lt->sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD;
 	lt->sadb_lifetime_allocations = 0;
 	lt->sadb_lifetime_bytes = 0;
 	lt->sadb_lifetime_addtime = sp->lifetime;
 	lt->sadb_lifetime_usetime = sp->validtime;
 	m_cat(result, m);
 
 	/*
 	 * Note: do not send SADB_X_EXT_NAT_T_* here:
 	 * we are sending traffic endpoints.
 	 */
 
 	/* set sadb_address for source */
 	m = key_setsadbaddr(SADB_EXT_ADDRESS_SRC,
 	    &sp->spidx.src.sa,
 	    sp->spidx.prefs, sp->spidx.ul_proto);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	/* set sadb_address for destination */
 	m = key_setsadbaddr(SADB_EXT_ADDRESS_DST,
 	    &sp->spidx.dst.sa,
 	    sp->spidx.prefd, sp->spidx.ul_proto);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	/* set secpolicy */
 	m = key_sp2msg(sp);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	if ((result->m_flags & M_PKTHDR) == 0) {
 		error = EINVAL;
 		goto fail;
 	}
 
 	if (result->m_len < sizeof(struct sadb_msg)) {
 		result = m_pullup(result, sizeof(struct sadb_msg));
 		if (result == NULL) {
 			error = ENOBUFS;
 			goto fail;
 		}
 	}
 
 	result->m_pkthdr.len = 0;
 	for (m = result; m; m = m->m_next)
 		result->m_pkthdr.len += m->m_len;
 
 	mtod(result, struct sadb_msg *)->sadb_msg_len =
 	    PFKEY_UNIT64(result->m_pkthdr.len);
 
 	return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED);
 
  fail:
 	if (result)
 		m_freem(result);
 	return error;
 }
 
 /* %%% SAD management */
 /*
  * allocating a memory for new SA head, and copy from the values of mhp.
  * OUT:	NULL	: failure due to the lack of memory.
  *	others	: pointer to new SA head.
  */
 static struct secashead *
 key_newsah(struct secasindex *saidx)
 {
 	struct secashead *newsah;
 
 	IPSEC_ASSERT(saidx != NULL, ("null saidx"));
 
 	newsah = malloc(sizeof(struct secashead), M_IPSEC_SAH, M_NOWAIT|M_ZERO);
 	if (newsah != NULL) {
 		int i;
 		for (i = 0; i < sizeof(newsah->savtree)/sizeof(newsah->savtree[0]); i++)
 			LIST_INIT(&newsah->savtree[i]);
 		newsah->saidx = *saidx;
 
 		/* add to saidxtree */
 		newsah->state = SADB_SASTATE_MATURE;
 
 		SAHTREE_LOCK();
 		LIST_INSERT_HEAD(&V_sahtree, newsah, chain);
 		SAHTREE_UNLOCK();
 	}
 	return(newsah);
 }
 
 /*
  * delete SA index and all SA registerd.
  */
 static void
 key_delsah(struct secashead *sah)
 {
 	struct secasvar *sav, *nextsav;
 	u_int stateidx;
 	int zombie = 0;
 
 	IPSEC_ASSERT(sah != NULL, ("NULL sah"));
 	SAHTREE_LOCK_ASSERT();
 
 	/* searching all SA registerd in the secindex. */
 	for (stateidx = 0;
 	     stateidx < _ARRAYLEN(saorder_state_any);
 	     stateidx++) {
 		u_int state = saorder_state_any[stateidx];
 		LIST_FOREACH_SAFE(sav, &sah->savtree[state], chain, nextsav) {
 			if (sav->refcnt == 0) {
 				/* sanity check */
 				KEY_CHKSASTATE(state, sav->state, __func__);
 				/* 
 				 * do NOT call KEY_FREESAV here:
 				 * it will only delete the sav if refcnt == 1,
 				 * where we already know that refcnt == 0
 				 */
 				key_delsav(sav);
 			} else {
 				/* give up to delete this sa */
 				zombie++;
 			}
 		}
 	}
 	if (!zombie) {		/* delete only if there are savs */
 		/* remove from tree of SA index */
 		if (__LIST_CHAINED(sah))
 			LIST_REMOVE(sah, chain);
 		free(sah, M_IPSEC_SAH);
 	}
 }
 
 /*
  * allocating a new SA with LARVAL state.  key_add() and key_getspi() call,
  * and copy the values of mhp into new buffer.
  * When SAD message type is GETSPI:
  *	to set sequence number from acq_seq++,
  *	to set zero to SPI.
  *	not to call key_setsava().
  * OUT:	NULL	: fail
  *	others	: pointer to new secasvar.
  *
  * does not modify mbuf.  does not free mbuf on error.
  */
 static struct secasvar *
 key_newsav(struct mbuf *m, const struct sadb_msghdr *mhp,
     struct secashead *sah, int *errp, const char *where, int tag)
 {
 	struct secasvar *newsav;
 	const struct sadb_sa *xsa;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 	IPSEC_ASSERT(sah != NULL, ("null secashead"));
 
 	newsav = malloc(sizeof(struct secasvar), M_IPSEC_SA, M_NOWAIT|M_ZERO);
 	if (newsav == NULL) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		*errp = ENOBUFS;
 		goto done;
 	}
 
 	switch (mhp->msg->sadb_msg_type) {
 	case SADB_GETSPI:
 		newsav->spi = 0;
 
 #ifdef IPSEC_DOSEQCHECK
 		/* sync sequence number */
 		if (mhp->msg->sadb_msg_seq == 0)
 			newsav->seq =
 				(V_acq_seq = (V_acq_seq == ~0 ? 1 : ++V_acq_seq));
 		else
 #endif
 			newsav->seq = mhp->msg->sadb_msg_seq;
 		break;
 
 	case SADB_ADD:
 		/* sanity check */
 		if (mhp->ext[SADB_EXT_SA] == NULL) {
 			free(newsav, M_IPSEC_SA);
 			newsav = NULL;
 			ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 				__func__));
 			*errp = EINVAL;
 			goto done;
 		}
 		xsa = (const struct sadb_sa *)mhp->ext[SADB_EXT_SA];
 		newsav->spi = xsa->sadb_sa_spi;
 		newsav->seq = mhp->msg->sadb_msg_seq;
 		break;
 	default:
 		free(newsav, M_IPSEC_SA);
 		newsav = NULL;
 		*errp = EINVAL;
 		goto done;
 	}
 
 
 	/* copy sav values */
 	if (mhp->msg->sadb_msg_type != SADB_GETSPI) {
 		*errp = key_setsaval(newsav, m, mhp);
 		if (*errp) {
 			free(newsav, M_IPSEC_SA);
 			newsav = NULL;
 			goto done;
 		}
 	}
 
 	SECASVAR_LOCK_INIT(newsav);
 
 	/* reset created */
 	newsav->created = time_second;
 	newsav->pid = mhp->msg->sadb_msg_pid;
 
 	/* add to satree */
 	newsav->sah = sah;
 	sa_initref(newsav);
 	newsav->state = SADB_SASTATE_LARVAL;
 
 	SAHTREE_LOCK();
 	LIST_INSERT_TAIL(&sah->savtree[SADB_SASTATE_LARVAL], newsav,
 			secasvar, chain);
 	SAHTREE_UNLOCK();
 done:
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s from %s:%u return SP:%p\n", __func__,
 			where, tag, newsav));
 
 	return newsav;
 }
 
 /*
  * free() SA variable entry.
  */
 static void
 key_cleansav(struct secasvar *sav)
 {
 	/*
 	 * Cleanup xform state.  Note that zeroize'ing causes the
 	 * keys to be cleared; otherwise we must do it ourself.
 	 */
 	if (sav->tdb_xform != NULL) {
 		sav->tdb_xform->xf_zeroize(sav);
 		sav->tdb_xform = NULL;
 	} else {
 		KASSERT(sav->iv == NULL, ("iv but no xform"));
 		if (sav->key_auth != NULL)
 			bzero(sav->key_auth->key_data, _KEYLEN(sav->key_auth));
 		if (sav->key_enc != NULL)
 			bzero(sav->key_enc->key_data, _KEYLEN(sav->key_enc));
 	}
 	if (sav->key_auth != NULL) {
 		if (sav->key_auth->key_data != NULL)
 			free(sav->key_auth->key_data, M_IPSEC_MISC);
 		free(sav->key_auth, M_IPSEC_MISC);
 		sav->key_auth = NULL;
 	}
 	if (sav->key_enc != NULL) {
 		if (sav->key_enc->key_data != NULL)
 			free(sav->key_enc->key_data, M_IPSEC_MISC);
 		free(sav->key_enc, M_IPSEC_MISC);
 		sav->key_enc = NULL;
 	}
 	if (sav->sched) {
 		bzero(sav->sched, sav->schedlen);
 		free(sav->sched, M_IPSEC_MISC);
 		sav->sched = NULL;
 	}
 	if (sav->replay != NULL) {
 		free(sav->replay, M_IPSEC_MISC);
 		sav->replay = NULL;
 	}
 	if (sav->lft_c != NULL) {
 		free(sav->lft_c, M_IPSEC_MISC);
 		sav->lft_c = NULL;
 	}
 	if (sav->lft_h != NULL) {
 		free(sav->lft_h, M_IPSEC_MISC);
 		sav->lft_h = NULL;
 	}
 	if (sav->lft_s != NULL) {
 		free(sav->lft_s, M_IPSEC_MISC);
 		sav->lft_s = NULL;
 	}
 }
 
 /*
  * free() SA variable entry.
  */
 static void
 key_delsav(struct secasvar *sav)
 {
 	IPSEC_ASSERT(sav != NULL, ("null sav"));
 	IPSEC_ASSERT(sav->refcnt == 0, ("reference count %u > 0", sav->refcnt));
 
 	/* remove from SA header */
 	if (__LIST_CHAINED(sav))
 		LIST_REMOVE(sav, chain);
 	key_cleansav(sav);
 	SECASVAR_LOCK_DESTROY(sav);
 	free(sav, M_IPSEC_SA);
 }
 
 /*
  * search SAD.
  * OUT:
  *	NULL	: not found
  *	others	: found, pointer to a SA.
  */
 static struct secashead *
 key_getsah(struct secasindex *saidx)
 {
 	struct secashead *sah;
 
 	SAHTREE_LOCK();
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (sah->state == SADB_SASTATE_DEAD)
 			continue;
 		if (key_cmpsaidx(&sah->saidx, saidx, CMP_REQID))
 			break;
 	}
 	SAHTREE_UNLOCK();
 
 	return sah;
 }
 
 /*
  * check not to be duplicated SPI.
  * NOTE: this function is too slow due to searching all SAD.
  * OUT:
  *	NULL	: not found
  *	others	: found, pointer to a SA.
  */
 static struct secasvar *
 key_checkspidup(struct secasindex *saidx, u_int32_t spi)
 {
 	struct secashead *sah;
 	struct secasvar *sav;
 
 	/* check address family */
 	if (saidx->src.sa.sa_family != saidx->dst.sa.sa_family) {
 		ipseclog((LOG_DEBUG, "%s: address family mismatched.\n",
 			__func__));
 		return NULL;
 	}
 
 	sav = NULL;
 	/* check all SAD */
 	SAHTREE_LOCK();
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (!key_ismyaddr((struct sockaddr *)&sah->saidx.dst))
 			continue;
 		sav = key_getsavbyspi(sah, spi);
 		if (sav != NULL)
 			break;
 	}
 	SAHTREE_UNLOCK();
 
 	return sav;
 }
 
 /*
  * search SAD litmited alive SA, protocol, SPI.
  * OUT:
  *	NULL	: not found
  *	others	: found, pointer to a SA.
  */
 static struct secasvar *
 key_getsavbyspi(struct secashead *sah, u_int32_t spi)
 {
 	struct secasvar *sav;
 	u_int stateidx, state;
 
 	sav = NULL;
 	SAHTREE_LOCK_ASSERT();
 	/* search all status */
 	for (stateidx = 0;
 	     stateidx < _ARRAYLEN(saorder_state_alive);
 	     stateidx++) {
 
 		state = saorder_state_alive[stateidx];
 		LIST_FOREACH(sav, &sah->savtree[state], chain) {
 
 			/* sanity check */
 			if (sav->state != state) {
 				ipseclog((LOG_DEBUG, "%s: "
 				    "invalid sav->state (queue: %d SA: %d)\n",
 				    __func__, state, sav->state));
 				continue;
 			}
 
 			if (sav->spi == spi)
 				return sav;
 		}
 	}
 
 	return NULL;
 }
 
 /*
  * copy SA values from PF_KEY message except *SPI, SEQ, PID, STATE and TYPE*.
  * You must update these if need.
  * OUT:	0:	success.
  *	!0:	failure.
  *
  * does not modify mbuf.  does not free mbuf on error.
  */
 static int
 key_setsaval(struct secasvar *sav, struct mbuf *m,
     const struct sadb_msghdr *mhp)
 {
 	int error = 0;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* initialization */
 	sav->replay = NULL;
 	sav->key_auth = NULL;
 	sav->key_enc = NULL;
 	sav->sched = NULL;
 	sav->schedlen = 0;
 	sav->iv = NULL;
 	sav->lft_c = NULL;
 	sav->lft_h = NULL;
 	sav->lft_s = NULL;
 	sav->tdb_xform = NULL;		/* transform */
 	sav->tdb_encalgxform = NULL;	/* encoding algorithm */
 	sav->tdb_authalgxform = NULL;	/* authentication algorithm */
 	sav->tdb_compalgxform = NULL;	/* compression algorithm */
 	/*  Initialize even if NAT-T not compiled in: */
 	sav->natt_type = 0;
 	sav->natt_esp_frag_len = 0;
 
 	/* SA */
 	if (mhp->ext[SADB_EXT_SA] != NULL) {
 		const struct sadb_sa *sa0;
 
 		sa0 = (const struct sadb_sa *)mhp->ext[SADB_EXT_SA];
 		if (mhp->extlen[SADB_EXT_SA] < sizeof(*sa0)) {
 			error = EINVAL;
 			goto fail;
 		}
 
 		sav->alg_auth = sa0->sadb_sa_auth;
 		sav->alg_enc = sa0->sadb_sa_encrypt;
 		sav->flags = sa0->sadb_sa_flags;
 
 		/* replay window */
 		if ((sa0->sadb_sa_flags & SADB_X_EXT_OLD) == 0) {
 			sav->replay = (struct secreplay *)
 				malloc(sizeof(struct secreplay)+sa0->sadb_sa_replay, M_IPSEC_MISC, M_NOWAIT|M_ZERO);
 			if (sav->replay == NULL) {
 				ipseclog((LOG_DEBUG, "%s: No more memory.\n",
 					__func__));
 				error = ENOBUFS;
 				goto fail;
 			}
 			if (sa0->sadb_sa_replay != 0)
 				sav->replay->bitmap = (caddr_t)(sav->replay+1);
 			sav->replay->wsize = sa0->sadb_sa_replay;
 		}
 	}
 
 	/* Authentication keys */
 	if (mhp->ext[SADB_EXT_KEY_AUTH] != NULL) {
 		const struct sadb_key *key0;
 		int len;
 
 		key0 = (const struct sadb_key *)mhp->ext[SADB_EXT_KEY_AUTH];
 		len = mhp->extlen[SADB_EXT_KEY_AUTH];
 
 		error = 0;
 		if (len < sizeof(*key0)) {
 			error = EINVAL;
 			goto fail;
 		}
 		switch (mhp->msg->sadb_msg_satype) {
 		case SADB_SATYPE_AH:
 		case SADB_SATYPE_ESP:
 		case SADB_X_SATYPE_TCPSIGNATURE:
 			if (len == PFKEY_ALIGN8(sizeof(struct sadb_key)) &&
 			    sav->alg_auth != SADB_X_AALG_NULL)
 				error = EINVAL;
 			break;
 		case SADB_X_SATYPE_IPCOMP:
 		default:
 			error = EINVAL;
 			break;
 		}
 		if (error) {
 			ipseclog((LOG_DEBUG, "%s: invalid key_auth values.\n",
 				__func__));
 			goto fail;
 		}
 
 		sav->key_auth = (struct seckey *)key_dup_keymsg(key0, len,
 								M_IPSEC_MISC);
 		if (sav->key_auth == NULL ) {
 			ipseclog((LOG_DEBUG, "%s: No more memory.\n",
 				  __func__));
 			error = ENOBUFS;
 			goto fail;
 		}
 	}
 
 	/* Encryption key */
 	if (mhp->ext[SADB_EXT_KEY_ENCRYPT] != NULL) {
 		const struct sadb_key *key0;
 		int len;
 
 		key0 = (const struct sadb_key *)mhp->ext[SADB_EXT_KEY_ENCRYPT];
 		len = mhp->extlen[SADB_EXT_KEY_ENCRYPT];
 
 		error = 0;
 		if (len < sizeof(*key0)) {
 			error = EINVAL;
 			goto fail;
 		}
 		switch (mhp->msg->sadb_msg_satype) {
 		case SADB_SATYPE_ESP:
 			if (len == PFKEY_ALIGN8(sizeof(struct sadb_key)) &&
 			    sav->alg_enc != SADB_EALG_NULL) {
 				error = EINVAL;
 				break;
 			}
 			sav->key_enc = (struct seckey *)key_dup_keymsg(key0,
 								       len,
 								       M_IPSEC_MISC);
 			if (sav->key_enc == NULL) {
 				ipseclog((LOG_DEBUG, "%s: No more memory.\n",
 					__func__));
 				error = ENOBUFS;
 				goto fail;
 			}
 			break;
 		case SADB_X_SATYPE_IPCOMP:
 			if (len != PFKEY_ALIGN8(sizeof(struct sadb_key)))
 				error = EINVAL;
 			sav->key_enc = NULL;	/*just in case*/
 			break;
 		case SADB_SATYPE_AH:
 		case SADB_X_SATYPE_TCPSIGNATURE:
 		default:
 			error = EINVAL;
 			break;
 		}
 		if (error) {
 			ipseclog((LOG_DEBUG, "%s: invalid key_enc value.\n",
 				__func__));
 			goto fail;
 		}
 	}
 
 	/* set iv */
 	sav->ivlen = 0;
 
 	switch (mhp->msg->sadb_msg_satype) {
 	case SADB_SATYPE_AH:
 		error = xform_init(sav, XF_AH);
 		break;
 	case SADB_SATYPE_ESP:
 		error = xform_init(sav, XF_ESP);
 		break;
 	case SADB_X_SATYPE_IPCOMP:
 		error = xform_init(sav, XF_IPCOMP);
 		break;
 	case SADB_X_SATYPE_TCPSIGNATURE:
 		error = xform_init(sav, XF_TCPSIGNATURE);
 		break;
 	}
 	if (error) {
 		ipseclog((LOG_DEBUG, "%s: unable to initialize SA type %u.\n",
 		        __func__, mhp->msg->sadb_msg_satype));
 		goto fail;
 	}
 
 	/* reset created */
 	sav->created = time_second;
 
 	/* make lifetime for CURRENT */
 	sav->lft_c = malloc(sizeof(struct seclifetime), M_IPSEC_MISC, M_NOWAIT);
 	if (sav->lft_c == NULL) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		error = ENOBUFS;
 		goto fail;
 	}
 
 	sav->lft_c->allocations = 0;
 	sav->lft_c->bytes = 0;
 	sav->lft_c->addtime = time_second;
 	sav->lft_c->usetime = 0;
 
 	/* lifetimes for HARD and SOFT */
     {
 	const struct sadb_lifetime *lft0;
 
 	lft0 = (struct sadb_lifetime *)mhp->ext[SADB_EXT_LIFETIME_HARD];
 	if (lft0 != NULL) {
 		if (mhp->extlen[SADB_EXT_LIFETIME_HARD] < sizeof(*lft0)) {
 			error = EINVAL;
 			goto fail;
 		}
 		sav->lft_h = key_dup_lifemsg(lft0, M_IPSEC_MISC);
 		if (sav->lft_h == NULL) {
 			ipseclog((LOG_DEBUG, "%s: No more memory.\n",__func__));
 			error = ENOBUFS;
 			goto fail;
 		}
 		/* to be initialize ? */
 	}
 
 	lft0 = (struct sadb_lifetime *)mhp->ext[SADB_EXT_LIFETIME_SOFT];
 	if (lft0 != NULL) {
 		if (mhp->extlen[SADB_EXT_LIFETIME_SOFT] < sizeof(*lft0)) {
 			error = EINVAL;
 			goto fail;
 		}
 		sav->lft_s = key_dup_lifemsg(lft0, M_IPSEC_MISC);
 		if (sav->lft_s == NULL) {
 			ipseclog((LOG_DEBUG, "%s: No more memory.\n",__func__));
 			error = ENOBUFS;
 			goto fail;
 		}
 		/* to be initialize ? */
 	}
     }
 
 	return 0;
 
  fail:
 	/* initialization */
 	key_cleansav(sav);
 
 	return error;
 }
 
 /*
  * validation with a secasvar entry, and set SADB_SATYPE_MATURE.
  * OUT:	0:	valid
  *	other:	errno
  */
 static int
 key_mature(struct secasvar *sav)
 {
 	int error;
 
 	/* check SPI value */
 	switch (sav->sah->saidx.proto) {
 	case IPPROTO_ESP:
 	case IPPROTO_AH:
 		/*
 		 * RFC 4302, 2.4. Security Parameters Index (SPI), SPI values
 		 * 1-255 reserved by IANA for future use,
 		 * 0 for implementation specific, local use.
 		 */
 		if (ntohl(sav->spi) <= 255) {
 			ipseclog((LOG_DEBUG, "%s: illegal range of SPI %u.\n",
 			    __func__, (u_int32_t)ntohl(sav->spi)));
 			return EINVAL;
 		}
 		break;
 	}
 
 	/* check satype */
 	switch (sav->sah->saidx.proto) {
 	case IPPROTO_ESP:
 		/* check flags */
 		if ((sav->flags & (SADB_X_EXT_OLD|SADB_X_EXT_DERIV)) ==
 		    (SADB_X_EXT_OLD|SADB_X_EXT_DERIV)) {
 			ipseclog((LOG_DEBUG, "%s: invalid flag (derived) "
 				"given to old-esp.\n", __func__));
 			return EINVAL;
 		}
 		error = xform_init(sav, XF_ESP);
 		break;
 	case IPPROTO_AH:
 		/* check flags */
 		if (sav->flags & SADB_X_EXT_DERIV) {
 			ipseclog((LOG_DEBUG, "%s: invalid flag (derived) "
 				"given to AH SA.\n", __func__));
 			return EINVAL;
 		}
 		if (sav->alg_enc != SADB_EALG_NONE) {
 			ipseclog((LOG_DEBUG, "%s: protocol and algorithm "
 				"mismated.\n", __func__));
 			return(EINVAL);
 		}
 		error = xform_init(sav, XF_AH);
 		break;
 	case IPPROTO_IPCOMP:
 		if (sav->alg_auth != SADB_AALG_NONE) {
 			ipseclog((LOG_DEBUG, "%s: protocol and algorithm "
 				"mismated.\n", __func__));
 			return(EINVAL);
 		}
 		if ((sav->flags & SADB_X_EXT_RAWCPI) == 0
 		 && ntohl(sav->spi) >= 0x10000) {
 			ipseclog((LOG_DEBUG, "%s: invalid cpi for IPComp.\n",
 				__func__));
 			return(EINVAL);
 		}
 		error = xform_init(sav, XF_IPCOMP);
 		break;
 	case IPPROTO_TCP:
 		if (sav->alg_enc != SADB_EALG_NONE) {
 			ipseclog((LOG_DEBUG, "%s: protocol and algorithm "
 				"mismated.\n", __func__));
 			return(EINVAL);
 		}
 		error = xform_init(sav, XF_TCPSIGNATURE);
 		break;
 	default:
 		ipseclog((LOG_DEBUG, "%s: Invalid satype.\n", __func__));
 		error = EPROTONOSUPPORT;
 		break;
 	}
 	if (error == 0) {
 		SAHTREE_LOCK();
 		key_sa_chgstate(sav, SADB_SASTATE_MATURE);
 		SAHTREE_UNLOCK();
 	}
 	return (error);
 }
 
 /*
  * subroutine for SADB_GET and SADB_DUMP.
  */
 static struct mbuf *
 key_setdumpsa(struct secasvar *sav, u_int8_t type, u_int8_t satype,
     u_int32_t seq, u_int32_t pid)
 {
 	struct mbuf *result = NULL, *tres = NULL, *m;
 	int i;
 	int dumporder[] = {
 		SADB_EXT_SA, SADB_X_EXT_SA2,
 		SADB_EXT_LIFETIME_HARD, SADB_EXT_LIFETIME_SOFT,
 		SADB_EXT_LIFETIME_CURRENT, SADB_EXT_ADDRESS_SRC,
 		SADB_EXT_ADDRESS_DST, SADB_EXT_ADDRESS_PROXY, SADB_EXT_KEY_AUTH,
 		SADB_EXT_KEY_ENCRYPT, SADB_EXT_IDENTITY_SRC,
 		SADB_EXT_IDENTITY_DST, SADB_EXT_SENSITIVITY,
 #ifdef IPSEC_NAT_T
 		SADB_X_EXT_NAT_T_TYPE,
 		SADB_X_EXT_NAT_T_SPORT, SADB_X_EXT_NAT_T_DPORT,
 		SADB_X_EXT_NAT_T_OAI, SADB_X_EXT_NAT_T_OAR,
 		SADB_X_EXT_NAT_T_FRAG,
 #endif
 	};
 
 	m = key_setsadbmsg(type, 0, satype, seq, pid, sav->refcnt);
 	if (m == NULL)
 		goto fail;
 	result = m;
 
 	for (i = sizeof(dumporder)/sizeof(dumporder[0]) - 1; i >= 0; i--) {
 		m = NULL;
 		switch (dumporder[i]) {
 		case SADB_EXT_SA:
 			m = key_setsadbsa(sav);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_X_EXT_SA2:
 			m = key_setsadbxsa2(sav->sah->saidx.mode,
 					sav->replay ? sav->replay->count : 0,
 					sav->sah->saidx.reqid);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_EXT_ADDRESS_SRC:
 			m = key_setsadbaddr(SADB_EXT_ADDRESS_SRC,
 			    &sav->sah->saidx.src.sa,
 			    FULLMASK, IPSEC_ULPROTO_ANY);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_EXT_ADDRESS_DST:
 			m = key_setsadbaddr(SADB_EXT_ADDRESS_DST,
 			    &sav->sah->saidx.dst.sa,
 			    FULLMASK, IPSEC_ULPROTO_ANY);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_EXT_KEY_AUTH:
 			if (!sav->key_auth)
 				continue;
 			m = key_setkey(sav->key_auth, SADB_EXT_KEY_AUTH);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_EXT_KEY_ENCRYPT:
 			if (!sav->key_enc)
 				continue;
 			m = key_setkey(sav->key_enc, SADB_EXT_KEY_ENCRYPT);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_EXT_LIFETIME_CURRENT:
 			if (!sav->lft_c)
 				continue;
 			m = key_setlifetime(sav->lft_c, 
 					    SADB_EXT_LIFETIME_CURRENT);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_EXT_LIFETIME_HARD:
 			if (!sav->lft_h)
 				continue;
 			m = key_setlifetime(sav->lft_h, 
 					    SADB_EXT_LIFETIME_HARD);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_EXT_LIFETIME_SOFT:
 			if (!sav->lft_s)
 				continue;
 			m = key_setlifetime(sav->lft_s, 
 					    SADB_EXT_LIFETIME_SOFT);
 
 			if (!m)
 				goto fail;
 			break;
 
 #ifdef IPSEC_NAT_T
 		case SADB_X_EXT_NAT_T_TYPE:
 			m = key_setsadbxtype(sav->natt_type);
 			if (!m)
 				goto fail;
 			break;
 		
 		case SADB_X_EXT_NAT_T_DPORT:
 			m = key_setsadbxport(
 			    KEY_PORTFROMSADDR(&sav->sah->saidx.dst),
 			    SADB_X_EXT_NAT_T_DPORT);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_X_EXT_NAT_T_SPORT:
 			m = key_setsadbxport(
 			    KEY_PORTFROMSADDR(&sav->sah->saidx.src),
 			    SADB_X_EXT_NAT_T_SPORT);
 			if (!m)
 				goto fail;
 			break;
 
 		case SADB_X_EXT_NAT_T_OAI:
 		case SADB_X_EXT_NAT_T_OAR:
 		case SADB_X_EXT_NAT_T_FRAG:
 			/* We do not (yet) support those. */
 			continue;
 #endif
 
 		case SADB_EXT_ADDRESS_PROXY:
 		case SADB_EXT_IDENTITY_SRC:
 		case SADB_EXT_IDENTITY_DST:
 			/* XXX: should we brought from SPD ? */
 		case SADB_EXT_SENSITIVITY:
 		default:
 			continue;
 		}
 
 		if (!m)
 			goto fail;
 		if (tres)
 			m_cat(m, tres);
 		tres = m;
 		  
 	}
 
 	m_cat(result, tres);
 	if (result->m_len < sizeof(struct sadb_msg)) {
 		result = m_pullup(result, sizeof(struct sadb_msg));
 		if (result == NULL)
 			goto fail;
 	}
 
 	result->m_pkthdr.len = 0;
 	for (m = result; m; m = m->m_next)
 		result->m_pkthdr.len += m->m_len;
 
 	mtod(result, struct sadb_msg *)->sadb_msg_len =
 	    PFKEY_UNIT64(result->m_pkthdr.len);
 
 	return result;
 
 fail:
 	m_freem(result);
 	m_freem(tres);
 	return NULL;
 }
 
 /*
  * set data into sadb_msg.
  */
 static struct mbuf *
 key_setsadbmsg(u_int8_t type, u_int16_t tlen, u_int8_t satype, u_int32_t seq,
     pid_t pid, u_int16_t reserved)
 {
 	struct mbuf *m;
 	struct sadb_msg *p;
 	int len;
 
 	len = PFKEY_ALIGN8(sizeof(struct sadb_msg));
 	if (len > MCLBYTES)
 		return NULL;
 	MGETHDR(m, M_NOWAIT, MT_DATA);
 	if (m && len > MHLEN) {
 		MCLGET(m, M_NOWAIT);
 		if ((m->m_flags & M_EXT) == 0) {
 			m_freem(m);
 			m = NULL;
 		}
 	}
 	if (!m)
 		return NULL;
 	m->m_pkthdr.len = m->m_len = len;
 	m->m_next = NULL;
 
 	p = mtod(m, struct sadb_msg *);
 
 	bzero(p, len);
 	p->sadb_msg_version = PF_KEY_V2;
 	p->sadb_msg_type = type;
 	p->sadb_msg_errno = 0;
 	p->sadb_msg_satype = satype;
 	p->sadb_msg_len = PFKEY_UNIT64(tlen);
 	p->sadb_msg_reserved = reserved;
 	p->sadb_msg_seq = seq;
 	p->sadb_msg_pid = (u_int32_t)pid;
 
 	return m;
 }
 
 /*
  * copy secasvar data into sadb_address.
  */
 static struct mbuf *
 key_setsadbsa(struct secasvar *sav)
 {
 	struct mbuf *m;
 	struct sadb_sa *p;
 	int len;
 
 	len = PFKEY_ALIGN8(sizeof(struct sadb_sa));
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return (NULL);
 	m_align(m, len);
 	m->m_len = len;
 	p = mtod(m, struct sadb_sa *);
 	bzero(p, len);
 	p->sadb_sa_len = PFKEY_UNIT64(len);
 	p->sadb_sa_exttype = SADB_EXT_SA;
 	p->sadb_sa_spi = sav->spi;
 	p->sadb_sa_replay = (sav->replay != NULL ? sav->replay->wsize : 0);
 	p->sadb_sa_state = sav->state;
 	p->sadb_sa_auth = sav->alg_auth;
 	p->sadb_sa_encrypt = sav->alg_enc;
 	p->sadb_sa_flags = sav->flags;
 
 	return m;
 }
 
 /*
  * set data into sadb_address.
  */
 static struct mbuf *
 key_setsadbaddr(u_int16_t exttype, const struct sockaddr *saddr,
     u_int8_t prefixlen, u_int16_t ul_proto)
 {
 	struct mbuf *m;
 	struct sadb_address *p;
 	size_t len;
 
 	len = PFKEY_ALIGN8(sizeof(struct sadb_address)) +
 	    PFKEY_ALIGN8(saddr->sa_len);
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return (NULL);
 	m_align(m, len);
 	m->m_len = len;
 	p = mtod(m, struct sadb_address *);
 
 	bzero(p, len);
 	p->sadb_address_len = PFKEY_UNIT64(len);
 	p->sadb_address_exttype = exttype;
 	p->sadb_address_proto = ul_proto;
 	if (prefixlen == FULLMASK) {
 		switch (saddr->sa_family) {
 		case AF_INET:
 			prefixlen = sizeof(struct in_addr) << 3;
 			break;
 		case AF_INET6:
 			prefixlen = sizeof(struct in6_addr) << 3;
 			break;
 		default:
 			; /*XXX*/
 		}
 	}
 	p->sadb_address_prefixlen = prefixlen;
 	p->sadb_address_reserved = 0;
 
 	bcopy(saddr,
 	    mtod(m, caddr_t) + PFKEY_ALIGN8(sizeof(struct sadb_address)),
 	    saddr->sa_len);
 
 	return m;
 }
 
 /*
  * set data into sadb_x_sa2.
  */
 static struct mbuf *
 key_setsadbxsa2(u_int8_t mode, u_int32_t seq, u_int32_t reqid)
 {
 	struct mbuf *m;
 	struct sadb_x_sa2 *p;
 	size_t len;
 
 	len = PFKEY_ALIGN8(sizeof(struct sadb_x_sa2));
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return (NULL);
 	m_align(m, len);
 	m->m_len = len;
 	p = mtod(m, struct sadb_x_sa2 *);
 
 	bzero(p, len);
 	p->sadb_x_sa2_len = PFKEY_UNIT64(len);
 	p->sadb_x_sa2_exttype = SADB_X_EXT_SA2;
 	p->sadb_x_sa2_mode = mode;
 	p->sadb_x_sa2_reserved1 = 0;
 	p->sadb_x_sa2_reserved2 = 0;
 	p->sadb_x_sa2_sequence = seq;
 	p->sadb_x_sa2_reqid = reqid;
 
 	return m;
 }
 
 #ifdef IPSEC_NAT_T
 /*
  * Set a type in sadb_x_nat_t_type.
  */
 static struct mbuf *
 key_setsadbxtype(u_int16_t type)
 {
 	struct mbuf *m;
 	size_t len;
 	struct sadb_x_nat_t_type *p;
 
 	len = PFKEY_ALIGN8(sizeof(struct sadb_x_nat_t_type));
 
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return (NULL);
 	m_align(m, len);
 	m->m_len = len;
 	p = mtod(m, struct sadb_x_nat_t_type *);
 
 	bzero(p, len);
 	p->sadb_x_nat_t_type_len = PFKEY_UNIT64(len);
 	p->sadb_x_nat_t_type_exttype = SADB_X_EXT_NAT_T_TYPE;
 	p->sadb_x_nat_t_type_type = type;
 
 	return (m);
 }
 /*
  * Set a port in sadb_x_nat_t_port.
  * In contrast to default RFC 2367 behaviour, port is in network byte order.
  */
 static struct mbuf *
 key_setsadbxport(u_int16_t port, u_int16_t type)
 {
 	struct mbuf *m;
 	size_t len;
 	struct sadb_x_nat_t_port *p;
 
 	len = PFKEY_ALIGN8(sizeof(struct sadb_x_nat_t_port));
 
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return (NULL);
 	m_align(m, len);
 	m->m_len = len;
 	p = mtod(m, struct sadb_x_nat_t_port *);
 
 	bzero(p, len);
 	p->sadb_x_nat_t_port_len = PFKEY_UNIT64(len);
 	p->sadb_x_nat_t_port_exttype = type;
 	p->sadb_x_nat_t_port_port = port;
 
 	return (m);
 }
 
 /* 
  * Get port from sockaddr. Port is in network byte order.
  */
 u_int16_t
 key_portfromsaddr(struct sockaddr *sa)
 {
 
 	switch (sa->sa_family) {
 #ifdef INET
 	case AF_INET:
 		return ((struct sockaddr_in *)sa)->sin_port;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		return ((struct sockaddr_in6 *)sa)->sin6_port;
 #endif
 	}
 	KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 		printf("DP %s unexpected address family %d\n",
 			__func__, sa->sa_family));
 	return (0);
 }
 #endif /* IPSEC_NAT_T */
 
 /*
  * Set port in struct sockaddr. Port is in network byte order.
  */
 static void
 key_porttosaddr(struct sockaddr *sa, u_int16_t port)
 {
 
 	switch (sa->sa_family) {
 #ifdef INET
 	case AF_INET:
 		((struct sockaddr_in *)sa)->sin_port = port;
 		break;
 #endif
 #ifdef INET6
 	case AF_INET6:
 		((struct sockaddr_in6 *)sa)->sin6_port = port;
 		break;
 #endif
 	default:
 		ipseclog((LOG_DEBUG, "%s: unexpected address family %d.\n",
 			__func__, sa->sa_family));
 		break;
 	}
 }
 
 /*
  * set data into sadb_x_policy
  */
 static struct mbuf *
 key_setsadbxpolicy(u_int16_t type, u_int8_t dir, u_int32_t id)
 {
 	struct mbuf *m;
 	struct sadb_x_policy *p;
 	size_t len;
 
 	len = PFKEY_ALIGN8(sizeof(struct sadb_x_policy));
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return (NULL);
 	m_align(m, len);
 	m->m_len = len;
 	p = mtod(m, struct sadb_x_policy *);
 
 	bzero(p, len);
 	p->sadb_x_policy_len = PFKEY_UNIT64(len);
 	p->sadb_x_policy_exttype = SADB_X_EXT_POLICY;
 	p->sadb_x_policy_type = type;
 	p->sadb_x_policy_dir = dir;
 	p->sadb_x_policy_id = id;
 
 	return m;
 }
 
 /* %%% utilities */
 /* Take a key message (sadb_key) from the socket and turn it into one
  * of the kernel's key structures (seckey).
  *
  * IN: pointer to the src
  * OUT: NULL no more memory
  */
 struct seckey *
 key_dup_keymsg(const struct sadb_key *src, u_int len,
     struct malloc_type *type)
 {
 	struct seckey *dst;
 	dst = (struct seckey *)malloc(sizeof(struct seckey), type, M_NOWAIT);
 	if (dst != NULL) {
 		dst->bits = src->sadb_key_bits;
 		dst->key_data = (char *)malloc(len, type, M_NOWAIT);
 		if (dst->key_data != NULL) {
 			bcopy((const char *)src + sizeof(struct sadb_key), 
 			      dst->key_data, len);
 		} else {
 			ipseclog((LOG_DEBUG, "%s: No more memory.\n", 
 				  __func__));
 			free(dst, type);
 			dst = NULL;
 		}
 	} else {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", 
 			  __func__));
 
 	}
 	return dst;
 }
 
 /* Take a lifetime message (sadb_lifetime) passed in on a socket and
  * turn it into one of the kernel's lifetime structures (seclifetime).
  *
  * IN: pointer to the destination, source and malloc type
  * OUT: NULL, no more memory
  */
 
 static struct seclifetime *
 key_dup_lifemsg(const struct sadb_lifetime *src, struct malloc_type *type)
 {
 	struct seclifetime *dst = NULL;
 
 	dst = (struct seclifetime *)malloc(sizeof(struct seclifetime), 
 					   type, M_NOWAIT);
 	if (dst == NULL) {
 		/* XXX counter */
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 	} else {
 		dst->allocations = src->sadb_lifetime_allocations;
 		dst->bytes = src->sadb_lifetime_bytes;
 		dst->addtime = src->sadb_lifetime_addtime;
 		dst->usetime = src->sadb_lifetime_usetime;
 	}
 	return dst;
 }
 
 /* compare my own address
  * OUT:	1: true, i.e. my address.
  *	0: false
  */
 int
 key_ismyaddr(struct sockaddr *sa)
 {
 
 	IPSEC_ASSERT(sa != NULL, ("null sockaddr"));
 	switch (sa->sa_family) {
 #ifdef INET
 	case AF_INET:
 		return (in_localip(satosin(sa)->sin_addr));
 #endif
 #ifdef INET6
 	case AF_INET6:
 		return key_ismyaddr6((struct sockaddr_in6 *)sa);
 #endif
 	}
 
 	return 0;
 }
 
 #ifdef INET6
 /*
  * compare my own address for IPv6.
  * 1: ours
  * 0: other
  * NOTE: derived ip6_input() in KAME. This is necessary to modify more.
  */
 #include 
 
 static int
 key_ismyaddr6(struct sockaddr_in6 *sin6)
 {
 	struct in6_ifaddr *ia;
 #if 0
 	struct in6_multi *in6m;
 #endif
 
 	IN6_IFADDR_RLOCK();
 	TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) {
 		if (key_sockaddrcmp((struct sockaddr *)&sin6,
 		    (struct sockaddr *)&ia->ia_addr, 0) == 0) {
 			IN6_IFADDR_RUNLOCK();
 			return 1;
 		}
 
 #if 0
 		/*
 		 * XXX Multicast
 		 * XXX why do we care about multlicast here while we don't care
 		 * about IPv4 multicast??
 		 * XXX scope
 		 */
 		in6m = NULL;
 		IN6_LOOKUP_MULTI(sin6->sin6_addr, ia->ia_ifp, in6m);
 		if (in6m) {
 			IN6_IFADDR_RUNLOCK();
 			return 1;
 		}
 #endif
 	}
 	IN6_IFADDR_RUNLOCK();
 
 	/* loopback, just for safety */
 	if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
 		return 1;
 
 	return 0;
 }
 #endif /*INET6*/
 
 /*
  * compare two secasindex structure.
  * flag can specify to compare 2 saidxes.
  * compare two secasindex structure without both mode and reqid.
  * don't compare port.
  * IN:  
  *      saidx0: source, it can be in SAD.
  *      saidx1: object.
  * OUT: 
  *      1 : equal
  *      0 : not equal
  */
 static int
 key_cmpsaidx(const struct secasindex *saidx0, const struct secasindex *saidx1,
     int flag)
 {
 	int chkport = 0;
 
 	/* sanity */
 	if (saidx0 == NULL && saidx1 == NULL)
 		return 1;
 
 	if (saidx0 == NULL || saidx1 == NULL)
 		return 0;
 
 	if (saidx0->proto != saidx1->proto)
 		return 0;
 
 	if (flag == CMP_EXACTLY) {
 		if (saidx0->mode != saidx1->mode)
 			return 0;
 		if (saidx0->reqid != saidx1->reqid)
 			return 0;
 		if (bcmp(&saidx0->src, &saidx1->src, saidx0->src.sa.sa_len) != 0 ||
 		    bcmp(&saidx0->dst, &saidx1->dst, saidx0->dst.sa.sa_len) != 0)
 			return 0;
 	} else {
 
 		/* CMP_MODE_REQID, CMP_REQID, CMP_HEAD */
 		if (flag == CMP_MODE_REQID
 		  ||flag == CMP_REQID) {
 			/*
 			 * If reqid of SPD is non-zero, unique SA is required.
 			 * The result must be of same reqid in this case.
 			 */
 			if (saidx1->reqid != 0 && saidx0->reqid != saidx1->reqid)
 				return 0;
 		}
 
 		if (flag == CMP_MODE_REQID) {
 			if (saidx0->mode != IPSEC_MODE_ANY
 			 && saidx0->mode != saidx1->mode)
 				return 0;
 		}
 
 #ifdef IPSEC_NAT_T
 		/*
 		 * If NAT-T is enabled, check ports for tunnel mode.
 		 * Do not check ports if they are set to zero in the SPD.
 		 * Also do not do it for native transport mode, as there
 		 * is no port information available in the SP.
 		 */
 		if ((saidx1->mode == IPSEC_MODE_TUNNEL ||
 		     (saidx1->mode == IPSEC_MODE_TRANSPORT &&
 		      saidx1->proto == IPPROTO_ESP)) &&
 		    saidx1->src.sa.sa_family == AF_INET &&
 		    saidx1->dst.sa.sa_family == AF_INET &&
 		    ((const struct sockaddr_in *)(&saidx1->src))->sin_port &&
 		    ((const struct sockaddr_in *)(&saidx1->dst))->sin_port)
 			chkport = 1;
 #endif /* IPSEC_NAT_T */
 
 		if (key_sockaddrcmp(&saidx0->src.sa, &saidx1->src.sa, chkport) != 0) {
 			return 0;
 		}
 		if (key_sockaddrcmp(&saidx0->dst.sa, &saidx1->dst.sa, chkport) != 0) {
 			return 0;
 		}
 	}
 
 	return 1;
 }
 
 /*
  * compare two secindex structure exactly.
  * IN:
  *	spidx0: source, it is often in SPD.
  *	spidx1: object, it is often from PFKEY message.
  * OUT:
  *	1 : equal
  *	0 : not equal
  */
 static int
 key_cmpspidx_exactly(struct secpolicyindex *spidx0,
     struct secpolicyindex *spidx1)
 {
 	/* sanity */
 	if (spidx0 == NULL && spidx1 == NULL)
 		return 1;
 
 	if (spidx0 == NULL || spidx1 == NULL)
 		return 0;
 
 	if (spidx0->prefs != spidx1->prefs
 	 || spidx0->prefd != spidx1->prefd
 	 || spidx0->ul_proto != spidx1->ul_proto)
 		return 0;
 
 	return key_sockaddrcmp(&spidx0->src.sa, &spidx1->src.sa, 1) == 0 &&
 	       key_sockaddrcmp(&spidx0->dst.sa, &spidx1->dst.sa, 1) == 0;
 }
 
 /*
  * compare two secindex structure with mask.
  * IN:
  *	spidx0: source, it is often in SPD.
  *	spidx1: object, it is often from IP header.
  * OUT:
  *	1 : equal
  *	0 : not equal
  */
 static int
 key_cmpspidx_withmask(struct secpolicyindex *spidx0,
     struct secpolicyindex *spidx1)
 {
 	/* sanity */
 	if (spidx0 == NULL && spidx1 == NULL)
 		return 1;
 
 	if (spidx0 == NULL || spidx1 == NULL)
 		return 0;
 
 	if (spidx0->src.sa.sa_family != spidx1->src.sa.sa_family ||
 	    spidx0->dst.sa.sa_family != spidx1->dst.sa.sa_family ||
 	    spidx0->src.sa.sa_len != spidx1->src.sa.sa_len ||
 	    spidx0->dst.sa.sa_len != spidx1->dst.sa.sa_len)
 		return 0;
 
 	/* if spidx.ul_proto == IPSEC_ULPROTO_ANY, ignore. */
 	if (spidx0->ul_proto != (u_int16_t)IPSEC_ULPROTO_ANY
 	 && spidx0->ul_proto != spidx1->ul_proto)
 		return 0;
 
 	switch (spidx0->src.sa.sa_family) {
 	case AF_INET:
 		if (spidx0->src.sin.sin_port != IPSEC_PORT_ANY
 		 && spidx0->src.sin.sin_port != spidx1->src.sin.sin_port)
 			return 0;
 		if (!key_bbcmp(&spidx0->src.sin.sin_addr,
 		    &spidx1->src.sin.sin_addr, spidx0->prefs))
 			return 0;
 		break;
 	case AF_INET6:
 		if (spidx0->src.sin6.sin6_port != IPSEC_PORT_ANY
 		 && spidx0->src.sin6.sin6_port != spidx1->src.sin6.sin6_port)
 			return 0;
 		/*
 		 * scope_id check. if sin6_scope_id is 0, we regard it
 		 * as a wildcard scope, which matches any scope zone ID. 
 		 */
 		if (spidx0->src.sin6.sin6_scope_id &&
 		    spidx1->src.sin6.sin6_scope_id &&
 		    spidx0->src.sin6.sin6_scope_id != spidx1->src.sin6.sin6_scope_id)
 			return 0;
 		if (!key_bbcmp(&spidx0->src.sin6.sin6_addr,
 		    &spidx1->src.sin6.sin6_addr, spidx0->prefs))
 			return 0;
 		break;
 	default:
 		/* XXX */
 		if (bcmp(&spidx0->src, &spidx1->src, spidx0->src.sa.sa_len) != 0)
 			return 0;
 		break;
 	}
 
 	switch (spidx0->dst.sa.sa_family) {
 	case AF_INET:
 		if (spidx0->dst.sin.sin_port != IPSEC_PORT_ANY
 		 && spidx0->dst.sin.sin_port != spidx1->dst.sin.sin_port)
 			return 0;
 		if (!key_bbcmp(&spidx0->dst.sin.sin_addr,
 		    &spidx1->dst.sin.sin_addr, spidx0->prefd))
 			return 0;
 		break;
 	case AF_INET6:
 		if (spidx0->dst.sin6.sin6_port != IPSEC_PORT_ANY
 		 && spidx0->dst.sin6.sin6_port != spidx1->dst.sin6.sin6_port)
 			return 0;
 		/*
 		 * scope_id check. if sin6_scope_id is 0, we regard it
 		 * as a wildcard scope, which matches any scope zone ID. 
 		 */
 		if (spidx0->dst.sin6.sin6_scope_id &&
 		    spidx1->dst.sin6.sin6_scope_id &&
 		    spidx0->dst.sin6.sin6_scope_id != spidx1->dst.sin6.sin6_scope_id)
 			return 0;
 		if (!key_bbcmp(&spidx0->dst.sin6.sin6_addr,
 		    &spidx1->dst.sin6.sin6_addr, spidx0->prefd))
 			return 0;
 		break;
 	default:
 		/* XXX */
 		if (bcmp(&spidx0->dst, &spidx1->dst, spidx0->dst.sa.sa_len) != 0)
 			return 0;
 		break;
 	}
 
 	/* XXX Do we check other field ?  e.g. flowinfo */
 
 	return 1;
 }
 
 /* returns 0 on match */
 static int
 key_sockaddrcmp(const struct sockaddr *sa1, const struct sockaddr *sa2,
     int port)
 {
 #ifdef satosin
 #undef satosin
 #endif
 #define satosin(s) ((const struct sockaddr_in *)s)
 #ifdef satosin6
 #undef satosin6
 #endif
 #define satosin6(s) ((const struct sockaddr_in6 *)s)
 	if (sa1->sa_family != sa2->sa_family || sa1->sa_len != sa2->sa_len)
 		return 1;
 
 	switch (sa1->sa_family) {
 	case AF_INET:
 		if (sa1->sa_len != sizeof(struct sockaddr_in))
 			return 1;
 		if (satosin(sa1)->sin_addr.s_addr !=
 		    satosin(sa2)->sin_addr.s_addr) {
 			return 1;
 		}
 		if (port && satosin(sa1)->sin_port != satosin(sa2)->sin_port)
 			return 1;
 		break;
 	case AF_INET6:
 		if (sa1->sa_len != sizeof(struct sockaddr_in6))
 			return 1;	/*EINVAL*/
 		if (satosin6(sa1)->sin6_scope_id !=
 		    satosin6(sa2)->sin6_scope_id) {
 			return 1;
 		}
 		if (!IN6_ARE_ADDR_EQUAL(&satosin6(sa1)->sin6_addr,
 		    &satosin6(sa2)->sin6_addr)) {
 			return 1;
 		}
 		if (port &&
 		    satosin6(sa1)->sin6_port != satosin6(sa2)->sin6_port) {
 			return 1;
 		}
 		break;
 	default:
 		if (bcmp(sa1, sa2, sa1->sa_len) != 0)
 			return 1;
 		break;
 	}
 
 	return 0;
 #undef satosin
 #undef satosin6
 }
 
 /*
  * compare two buffers with mask.
  * IN:
  *	addr1: source
  *	addr2: object
  *	bits:  Number of bits to compare
  * OUT:
  *	1 : equal
  *	0 : not equal
  */
 static int
 key_bbcmp(const void *a1, const void *a2, u_int bits)
 {
 	const unsigned char *p1 = a1;
 	const unsigned char *p2 = a2;
 
 	/* XXX: This could be considerably faster if we compare a word
 	 * at a time, but it is complicated on LSB Endian machines */
 
 	/* Handle null pointers */
 	if (p1 == NULL || p2 == NULL)
 		return (p1 == p2);
 
 	while (bits >= 8) {
 		if (*p1++ != *p2++)
 			return 0;
 		bits -= 8;
 	}
 
 	if (bits > 0) {
 		u_int8_t mask = ~((1<<(8-bits))-1);
 		if ((*p1 & mask) != (*p2 & mask))
 			return 0;
 	}
 	return 1;	/* Match! */
 }
 
 static void
 key_flush_spd(time_t now)
 {
-	static u_int16_t sptree_scangen = 0;
-	u_int16_t gen = sptree_scangen++;
+	SPTREE_RLOCK_TRACKER;
 	struct secpolicy *sp;
 	u_int dir;
 
 	/* SPD */
 	for (dir = 0; dir < IPSEC_DIR_MAX; dir++) {
 restart:
-		SPTREE_LOCK();
-		LIST_FOREACH(sp, &V_sptree[dir], chain) {
-			if (sp->scangen == gen)		/* previously handled */
-				continue;
-			sp->scangen = gen;
-			if (sp->state == IPSEC_SPSTATE_DEAD &&
-			    sp->refcnt == 1) {
-				/*
-				 * Ensure that we only decrease refcnt once,
-				 * when we're the last consumer.
-				 * Directly call SP_DELREF/key_delsp instead
-				 * of KEY_FREESP to avoid unlocking/relocking
-				 * SPTREE_LOCK before key_delsp: may refcnt
-				 * be increased again during that time ?
-				 * NB: also clean entries created by
-				 * key_spdflush
-				 */
-				SP_DELREF(sp);
-				key_delsp(sp);
-				SPTREE_UNLOCK();
-				goto restart;
-			}
+		SPTREE_RLOCK();
+		TAILQ_FOREACH(sp, &V_sptree[dir], chain) {
 			if (sp->lifetime == 0 && sp->validtime == 0)
 				continue;
-			if ((sp->lifetime && now - sp->created > sp->lifetime)
-			 || (sp->validtime && now - sp->lastused > sp->validtime)) {
-				sp->state = IPSEC_SPSTATE_DEAD;
-				SPTREE_UNLOCK();
+			if ((sp->lifetime &&
+			    now - sp->created > sp->lifetime) ||
+			    (sp->validtime &&
+			    now - sp->lastused > sp->validtime)) {
+				SPTREE_RUNLOCK();
+				key_unlink(sp);
 				key_spdexpire(sp);
+				KEY_FREESP(&sp);
 				goto restart;
 			}
 		}
-		SPTREE_UNLOCK();
+		SPTREE_RUNLOCK();
 	}
 }
 
 static void
 key_flush_sad(time_t now)
 {
 	struct secashead *sah, *nextsah;
 	struct secasvar *sav, *nextsav;
 
 	/* SAD */
 	SAHTREE_LOCK();
 	LIST_FOREACH_SAFE(sah, &V_sahtree, chain, nextsah) {
 		/* if sah has been dead, then delete it and process next sah. */
 		if (sah->state == SADB_SASTATE_DEAD) {
 			key_delsah(sah);
 			continue;
 		}
 
 		/* if LARVAL entry doesn't become MATURE, delete it. */
 		LIST_FOREACH_SAFE(sav, &sah->savtree[SADB_SASTATE_LARVAL], chain, nextsav) {
 			/* Need to also check refcnt for a larval SA ??? */
 			if (now - sav->created > V_key_larval_lifetime)
 				KEY_FREESAV(&sav);
 		}
 
 		/*
 		 * check MATURE entry to start to send expire message
 		 * whether or not.
 		 */
 		LIST_FOREACH_SAFE(sav, &sah->savtree[SADB_SASTATE_MATURE], chain, nextsav) {
 			/* we don't need to check. */
 			if (sav->lft_s == NULL)
 				continue;
 
 			/* sanity check */
 			if (sav->lft_c == NULL) {
 				ipseclog((LOG_DEBUG,"%s: there is no CURRENT "
 					"time, why?\n", __func__));
 				continue;
 			}
 
 			/* check SOFT lifetime */
 			if (sav->lft_s->addtime != 0 &&
 			    now - sav->created > sav->lft_s->addtime) {
 				key_sa_chgstate(sav, SADB_SASTATE_DYING);
 				/* 
 				 * Actually, only send expire message if
 				 * SA has been used, as it was done before,
 				 * but should we always send such message,
 				 * and let IKE daemon decide if it should be
 				 * renegotiated or not ?
 				 * XXX expire message will actually NOT be
 				 * sent if SA is only used after soft
 				 * lifetime has been reached, see below
 				 * (DYING state)
 				 */
 				if (sav->lft_c->usetime != 0)
 					key_expire(sav);
 			}
 			/* check SOFT lifetime by bytes */
 			/*
 			 * XXX I don't know the way to delete this SA
 			 * when new SA is installed.  Caution when it's
 			 * installed too big lifetime by time.
 			 */
 			else if (sav->lft_s->bytes != 0 &&
 			    sav->lft_s->bytes < sav->lft_c->bytes) {
 
 				key_sa_chgstate(sav, SADB_SASTATE_DYING);
 				/*
 				 * XXX If we keep to send expire
 				 * message in the status of
 				 * DYING. Do remove below code.
 				 */
 				key_expire(sav);
 			}
 		}
 
 		/* check DYING entry to change status to DEAD. */
 		LIST_FOREACH_SAFE(sav, &sah->savtree[SADB_SASTATE_DYING], chain, nextsav) {
 			/* we don't need to check. */
 			if (sav->lft_h == NULL)
 				continue;
 
 			/* sanity check */
 			if (sav->lft_c == NULL) {
 				ipseclog((LOG_DEBUG, "%s: there is no CURRENT "
 					"time, why?\n", __func__));
 				continue;
 			}
 
 			if (sav->lft_h->addtime != 0 &&
 			    now - sav->created > sav->lft_h->addtime) {
 				key_sa_chgstate(sav, SADB_SASTATE_DEAD);
 				KEY_FREESAV(&sav);
 			}
 #if 0	/* XXX Should we keep to send expire message until HARD lifetime ? */
 			else if (sav->lft_s != NULL
 			      && sav->lft_s->addtime != 0
 			      && now - sav->created > sav->lft_s->addtime) {
 				/*
 				 * XXX: should be checked to be
 				 * installed the valid SA.
 				 */
 
 				/*
 				 * If there is no SA then sending
 				 * expire message.
 				 */
 				key_expire(sav);
 			}
 #endif
 			/* check HARD lifetime by bytes */
 			else if (sav->lft_h->bytes != 0 &&
 			    sav->lft_h->bytes < sav->lft_c->bytes) {
 				key_sa_chgstate(sav, SADB_SASTATE_DEAD);
 				KEY_FREESAV(&sav);
 			}
 		}
 
 		/* delete entry in DEAD */
 		LIST_FOREACH_SAFE(sav, &sah->savtree[SADB_SASTATE_DEAD], chain, nextsav) {
 			/* sanity check */
 			if (sav->state != SADB_SASTATE_DEAD) {
 				ipseclog((LOG_DEBUG, "%s: invalid sav->state "
 					"(queue: %d SA: %d): kill it anyway\n",
 					__func__,
 					SADB_SASTATE_DEAD, sav->state));
 			}
 			/*
 			 * do not call key_freesav() here.
 			 * sav should already be freed, and sav->refcnt
 			 * shows other references to sav
 			 * (such as from SPD).
 			 */
 		}
 	}
 	SAHTREE_UNLOCK();
 }
 
 static void
 key_flush_acq(time_t now)
 {
 	struct secacq *acq, *nextacq;
 
 	/* ACQ tree */
 	ACQ_LOCK();
 	for (acq = LIST_FIRST(&V_acqtree); acq != NULL; acq = nextacq) {
 		nextacq = LIST_NEXT(acq, chain);
 		if (now - acq->created > V_key_blockacq_lifetime
 		 && __LIST_CHAINED(acq)) {
 			LIST_REMOVE(acq, chain);
 			free(acq, M_IPSEC_SAQ);
 		}
 	}
 	ACQ_UNLOCK();
 }
 
 static void
 key_flush_spacq(time_t now)
 {
 	struct secspacq *acq, *nextacq;
 
 	/* SP ACQ tree */
 	SPACQ_LOCK();
 	for (acq = LIST_FIRST(&V_spacqtree); acq != NULL; acq = nextacq) {
 		nextacq = LIST_NEXT(acq, chain);
 		if (now - acq->created > V_key_blockacq_lifetime
 		 && __LIST_CHAINED(acq)) {
 			LIST_REMOVE(acq, chain);
 			free(acq, M_IPSEC_SAQ);
 		}
 	}
 	SPACQ_UNLOCK();
 }
 
 /*
  * time handler.
  * scanning SPD and SAD to check status for each entries,
  * and do to remove or to expire.
  * XXX: year 2038 problem may remain.
  */
 static void
 key_timehandler(void *arg)
 {
 	VNET_ITERATOR_DECL(vnet_iter);
 	time_t now = time_second;
 
 	VNET_LIST_RLOCK_NOSLEEP();
 	VNET_FOREACH(vnet_iter) {
 		CURVNET_SET(vnet_iter);
 		key_flush_spd(now);
 		key_flush_sad(now);
 		key_flush_acq(now);
 		key_flush_spacq(now);
 		CURVNET_RESTORE();
 	}
 	VNET_LIST_RUNLOCK_NOSLEEP();
 
 #ifndef IPSEC_DEBUG2
 	/* do exchange to tick time !! */
 	callout_schedule(&key_timer, hz);
 #endif /* IPSEC_DEBUG2 */
 }
 
 u_long
 key_random()
 {
 	u_long value;
 
 	key_randomfill(&value, sizeof(value));
 	return value;
 }
 
 void
 key_randomfill(void *p, size_t l)
 {
 	size_t n;
 	u_long v;
 	static int warn = 1;
 
 	n = 0;
 	n = (size_t)read_random(p, (u_int)l);
 	/* last resort */
 	while (n < l) {
 		v = random();
 		bcopy(&v, (u_int8_t *)p + n,
 		    l - n < sizeof(v) ? l - n : sizeof(v));
 		n += sizeof(v);
 
 		if (warn) {
 			printf("WARNING: pseudo-random number generator "
 			    "used for IPsec processing\n");
 			warn = 0;
 		}
 	}
 }
 
 /*
  * map SADB_SATYPE_* to IPPROTO_*.
  * if satype == SADB_SATYPE then satype is mapped to ~0.
  * OUT:
  *	0: invalid satype.
  */
 static u_int16_t
 key_satype2proto(u_int8_t satype)
 {
 	switch (satype) {
 	case SADB_SATYPE_UNSPEC:
 		return IPSEC_PROTO_ANY;
 	case SADB_SATYPE_AH:
 		return IPPROTO_AH;
 	case SADB_SATYPE_ESP:
 		return IPPROTO_ESP;
 	case SADB_X_SATYPE_IPCOMP:
 		return IPPROTO_IPCOMP;
 	case SADB_X_SATYPE_TCPSIGNATURE:
 		return IPPROTO_TCP;
 	default:
 		return 0;
 	}
 	/* NOTREACHED */
 }
 
 /*
  * map IPPROTO_* to SADB_SATYPE_*
  * OUT:
  *	0: invalid protocol type.
  */
 static u_int8_t
 key_proto2satype(u_int16_t proto)
 {
 	switch (proto) {
 	case IPPROTO_AH:
 		return SADB_SATYPE_AH;
 	case IPPROTO_ESP:
 		return SADB_SATYPE_ESP;
 	case IPPROTO_IPCOMP:
 		return SADB_X_SATYPE_IPCOMP;
 	case IPPROTO_TCP:
 		return SADB_X_SATYPE_TCPSIGNATURE;
 	default:
 		return 0;
 	}
 	/* NOTREACHED */
 }
 
 /* %%% PF_KEY */
 /*
  * SADB_GETSPI processing is to receive
  *	
  * from the IKMPd, to assign a unique spi value, to hang on the INBOUND
  * tree with the status of LARVAL, and send
  *	
  * to the IKMPd.
  *
  * IN:	mhp: pointer to the pointer to each header.
  * OUT:	NULL if fail.
  *	other if success, return pointer to the message to send.
  */
 static int
 key_getspi(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct sadb_address *src0, *dst0;
 	struct secasindex saidx;
 	struct secashead *newsah;
 	struct secasvar *newsav;
 	u_int8_t proto;
 	u_int32_t spi;
 	u_int8_t mode;
 	u_int32_t reqid;
 	int error;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	if (mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_DST] == NULL) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->ext[SADB_X_EXT_SA2] != NULL) {
 		mode = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_mode;
 		reqid = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_reqid;
 	} else {
 		mode = IPSEC_MODE_ANY;
 		reqid = 0;
 	}
 
 	src0 = (struct sadb_address *)(mhp->ext[SADB_EXT_ADDRESS_SRC]);
 	dst0 = (struct sadb_address *)(mhp->ext[SADB_EXT_ADDRESS_DST]);
 
 	/* map satype to proto */
 	if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/*
 	 * Make sure the port numbers are zero.
 	 * In case of NAT-T we will update them later if needed.
 	 */
 	switch (((struct sockaddr *)(src0 + 1))->sa_family) {
 	case AF_INET:
 		if (((struct sockaddr *)(src0 + 1))->sa_len !=
 		    sizeof(struct sockaddr_in))
 			return key_senderror(so, m, EINVAL);
 		((struct sockaddr_in *)(src0 + 1))->sin_port = 0;
 		break;
 	case AF_INET6:
 		if (((struct sockaddr *)(src0 + 1))->sa_len !=
 		    sizeof(struct sockaddr_in6))
 			return key_senderror(so, m, EINVAL);
 		((struct sockaddr_in6 *)(src0 + 1))->sin6_port = 0;
 		break;
 	default:
 		; /*???*/
 	}
 	switch (((struct sockaddr *)(dst0 + 1))->sa_family) {
 	case AF_INET:
 		if (((struct sockaddr *)(dst0 + 1))->sa_len !=
 		    sizeof(struct sockaddr_in))
 			return key_senderror(so, m, EINVAL);
 		((struct sockaddr_in *)(dst0 + 1))->sin_port = 0;
 		break;
 	case AF_INET6:
 		if (((struct sockaddr *)(dst0 + 1))->sa_len !=
 		    sizeof(struct sockaddr_in6))
 			return key_senderror(so, m, EINVAL);
 		((struct sockaddr_in6 *)(dst0 + 1))->sin6_port = 0;
 		break;
 	default:
 		; /*???*/
 	}
 
 	/* XXX boundary check against sa_len */
 	KEY_SETSECASIDX(proto, mode, reqid, src0 + 1, dst0 + 1, &saidx);
 
 #ifdef IPSEC_NAT_T
 	/*
 	 * Handle NAT-T info if present.
 	 * We made sure the port numbers are zero above, so we do
 	 * not have to worry in case we do not update them.
 	 */
 	if (mhp->ext[SADB_X_EXT_NAT_T_OAI] != NULL)
 		ipseclog((LOG_DEBUG, "%s: NAT-T OAi present\n", __func__));
 	if (mhp->ext[SADB_X_EXT_NAT_T_OAR] != NULL)
 		ipseclog((LOG_DEBUG, "%s: NAT-T OAr present\n", __func__));
 
 	if (mhp->ext[SADB_X_EXT_NAT_T_TYPE] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_SPORT] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_DPORT] != NULL) {
 		struct sadb_x_nat_t_type *type;
 		struct sadb_x_nat_t_port *sport, *dport;
 
 		if (mhp->extlen[SADB_X_EXT_NAT_T_TYPE] < sizeof(*type) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_SPORT] < sizeof(*sport) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_DPORT] < sizeof(*dport)) {
 			ipseclog((LOG_DEBUG, "%s: invalid nat-t message "
 			    "passed.\n", __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 
 		sport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_SPORT];
 		dport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_DPORT];
 
 		if (sport)
 			KEY_PORTTOSADDR(&saidx.src, sport->sadb_x_nat_t_port_port);
 		if (dport)
 			KEY_PORTTOSADDR(&saidx.dst, dport->sadb_x_nat_t_port_port);
 	}
 #endif
 
 	/* SPI allocation */
 	spi = key_do_getnewspi((struct sadb_spirange *)mhp->ext[SADB_EXT_SPIRANGE],
 	                       &saidx);
 	if (spi == 0)
 		return key_senderror(so, m, EINVAL);
 
 	/* get a SA index */
 	if ((newsah = key_getsah(&saidx)) == NULL) {
 		/* create a new SA index */
 		if ((newsah = key_newsah(&saidx)) == NULL) {
 			ipseclog((LOG_DEBUG, "%s: No more memory.\n",__func__));
 			return key_senderror(so, m, ENOBUFS);
 		}
 	}
 
 	/* get a new SA */
 	/* XXX rewrite */
 	newsav = KEY_NEWSAV(m, mhp, newsah, &error);
 	if (newsav == NULL) {
 		/* XXX don't free new SA index allocated in above. */
 		return key_senderror(so, m, error);
 	}
 
 	/* set spi */
 	newsav->spi = htonl(spi);
 
 	/* delete the entry in acqtree */
 	if (mhp->msg->sadb_msg_seq != 0) {
 		struct secacq *acq;
 		if ((acq = key_getacqbyseq(mhp->msg->sadb_msg_seq)) != NULL) {
 			/* reset counter in order to deletion by timehandler. */
 			acq->created = time_second;
 			acq->count = 0;
 		}
     	}
 
     {
 	struct mbuf *n, *nn;
 	struct sadb_sa *m_sa;
 	struct sadb_msg *newmsg;
 	int off, len;
 
 	/* create new sadb_msg to reply. */
 	len = PFKEY_ALIGN8(sizeof(struct sadb_msg)) +
 	    PFKEY_ALIGN8(sizeof(struct sadb_sa));
 
 	MGETHDR(n, M_NOWAIT, MT_DATA);
 	if (len > MHLEN) {
 		MCLGET(n, M_NOWAIT);
 		if ((n->m_flags & M_EXT) == 0) {
 			m_freem(n);
 			n = NULL;
 		}
 	}
 	if (!n)
 		return key_senderror(so, m, ENOBUFS);
 
 	n->m_len = len;
 	n->m_next = NULL;
 	off = 0;
 
 	m_copydata(m, 0, sizeof(struct sadb_msg), mtod(n, caddr_t) + off);
 	off += PFKEY_ALIGN8(sizeof(struct sadb_msg));
 
 	m_sa = (struct sadb_sa *)(mtod(n, caddr_t) + off);
 	m_sa->sadb_sa_len = PFKEY_UNIT64(sizeof(struct sadb_sa));
 	m_sa->sadb_sa_exttype = SADB_EXT_SA;
 	m_sa->sadb_sa_spi = htonl(spi);
 	off += PFKEY_ALIGN8(sizeof(struct sadb_sa));
 
 	IPSEC_ASSERT(off == len,
 		("length inconsistency (off %u len %u)", off, len));
 
 	n->m_next = key_gather_mbuf(m, mhp, 0, 2, SADB_EXT_ADDRESS_SRC,
 	    SADB_EXT_ADDRESS_DST);
 	if (!n->m_next) {
 		m_freem(n);
 		return key_senderror(so, m, ENOBUFS);
 	}
 
 	if (n->m_len < sizeof(struct sadb_msg)) {
 		n = m_pullup(n, sizeof(struct sadb_msg));
 		if (n == NULL)
 			return key_sendup_mbuf(so, m, KEY_SENDUP_ONE);
 	}
 
 	n->m_pkthdr.len = 0;
 	for (nn = n; nn; nn = nn->m_next)
 		n->m_pkthdr.len += nn->m_len;
 
 	newmsg = mtod(n, struct sadb_msg *);
 	newmsg->sadb_msg_seq = newsav->seq;
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len);
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ONE);
     }
 }
 
 /*
  * allocating new SPI
  * called by key_getspi().
  * OUT:
  *	0:	failure.
  *	others: success.
  */
 static u_int32_t
 key_do_getnewspi(struct sadb_spirange *spirange, struct secasindex *saidx)
 {
 	u_int32_t newspi;
 	u_int32_t min, max;
 	int count = V_key_spi_trycnt;
 
 	/* set spi range to allocate */
 	if (spirange != NULL) {
 		min = spirange->sadb_spirange_min;
 		max = spirange->sadb_spirange_max;
 	} else {
 		min = V_key_spi_minval;
 		max = V_key_spi_maxval;
 	}
 	/* IPCOMP needs 2-byte SPI */
 	if (saidx->proto == IPPROTO_IPCOMP) {
 		u_int32_t t;
 		if (min >= 0x10000)
 			min = 0xffff;
 		if (max >= 0x10000)
 			max = 0xffff;
 		if (min > max) {
 			t = min; min = max; max = t;
 		}
 	}
 
 	if (min == max) {
 		if (key_checkspidup(saidx, min) != NULL) {
 			ipseclog((LOG_DEBUG, "%s: SPI %u exists already.\n",
 				__func__, min));
 			return 0;
 		}
 
 		count--; /* taking one cost. */
 		newspi = min;
 
 	} else {
 
 		/* init SPI */
 		newspi = 0;
 
 		/* when requesting to allocate spi ranged */
 		while (count--) {
 			/* generate pseudo-random SPI value ranged. */
 			newspi = min + (key_random() % (max - min + 1));
 
 			if (key_checkspidup(saidx, newspi) == NULL)
 				break;
 		}
 
 		if (count == 0 || newspi == 0) {
 			ipseclog((LOG_DEBUG, "%s: to allocate spi is failed.\n",
 				__func__));
 			return 0;
 		}
 	}
 
 	/* statistics */
 	keystat.getspi_count =
 		(keystat.getspi_count + V_key_spi_trycnt - count) / 2;
 
 	return newspi;
 }
 
 /*
  * SADB_UPDATE processing
  * receive
  *   
  * from the ikmpd, and update a secasvar entry whose status is SADB_SASTATE_LARVAL.
  * and send
  *   
  * to the ikmpd.
  *
  * m will always be freed.
  */
 static int
 key_update(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct sadb_sa *sa0;
 	struct sadb_address *src0, *dst0;
 #ifdef IPSEC_NAT_T
 	struct sadb_x_nat_t_type *type;
 	struct sadb_x_nat_t_port *sport, *dport;
 	struct sadb_address *iaddr, *raddr;
 	struct sadb_x_nat_t_frag *frag;
 #endif
 	struct secasindex saidx;
 	struct secashead *sah;
 	struct secasvar *sav;
 	u_int16_t proto;
 	u_int8_t mode;
 	u_int32_t reqid;
 	int error;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* map satype to proto */
 	if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	if (mhp->ext[SADB_EXT_SA] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_DST] == NULL ||
 	    (mhp->msg->sadb_msg_satype == SADB_SATYPE_ESP &&
 	     mhp->ext[SADB_EXT_KEY_ENCRYPT] == NULL) ||
 	    (mhp->msg->sadb_msg_satype == SADB_SATYPE_AH &&
 	     mhp->ext[SADB_EXT_KEY_AUTH] == NULL) ||
 	    (mhp->ext[SADB_EXT_LIFETIME_HARD] != NULL &&
 	     mhp->ext[SADB_EXT_LIFETIME_SOFT] == NULL) ||
 	    (mhp->ext[SADB_EXT_LIFETIME_HARD] == NULL &&
 	     mhp->ext[SADB_EXT_LIFETIME_SOFT] != NULL)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->extlen[SADB_EXT_SA] < sizeof(struct sadb_sa) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->ext[SADB_X_EXT_SA2] != NULL) {
 		mode = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_mode;
 		reqid = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_reqid;
 	} else {
 		mode = IPSEC_MODE_ANY;
 		reqid = 0;
 	}
 	/* XXX boundary checking for other extensions */
 
 	sa0 = (struct sadb_sa *)mhp->ext[SADB_EXT_SA];
 	src0 = (struct sadb_address *)(mhp->ext[SADB_EXT_ADDRESS_SRC]);
 	dst0 = (struct sadb_address *)(mhp->ext[SADB_EXT_ADDRESS_DST]);
 
 	/* XXX boundary check against sa_len */
 	KEY_SETSECASIDX(proto, mode, reqid, src0 + 1, dst0 + 1, &saidx);
 
 	/*
 	 * Make sure the port numbers are zero.
 	 * In case of NAT-T we will update them later if needed.
 	 */
 	KEY_PORTTOSADDR(&saidx.src, 0);
 	KEY_PORTTOSADDR(&saidx.dst, 0);
 
 #ifdef IPSEC_NAT_T
 	/*
 	 * Handle NAT-T info if present.
 	 */
 	if (mhp->ext[SADB_X_EXT_NAT_T_TYPE] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_SPORT] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_DPORT] != NULL) {
 
 		if (mhp->extlen[SADB_X_EXT_NAT_T_TYPE] < sizeof(*type) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_SPORT] < sizeof(*sport) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_DPORT] < sizeof(*dport)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message.\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 
 		type = (struct sadb_x_nat_t_type *)
 		    mhp->ext[SADB_X_EXT_NAT_T_TYPE];
 		sport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_SPORT];
 		dport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_DPORT];
 	} else {
 		type = 0;
 		sport = dport = 0;
 	}
 	if (mhp->ext[SADB_X_EXT_NAT_T_OAI] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_OAR] != NULL) {
 		if (mhp->extlen[SADB_X_EXT_NAT_T_OAI] < sizeof(*iaddr) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_OAR] < sizeof(*raddr)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 		iaddr = (struct sadb_address *)mhp->ext[SADB_X_EXT_NAT_T_OAI];
 		raddr = (struct sadb_address *)mhp->ext[SADB_X_EXT_NAT_T_OAR];
 		ipseclog((LOG_DEBUG, "%s: NAT-T OAi/r present\n", __func__));
 	} else {
 		iaddr = raddr = NULL;
 	}
 	if (mhp->ext[SADB_X_EXT_NAT_T_FRAG] != NULL) {
 		if (mhp->extlen[SADB_X_EXT_NAT_T_FRAG] < sizeof(*frag)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 		frag = (struct sadb_x_nat_t_frag *)
 		    mhp->ext[SADB_X_EXT_NAT_T_FRAG];
 	} else {
 		frag = 0;
 	}
 #endif
 
 	/* get a SA header */
 	if ((sah = key_getsah(&saidx)) == NULL) {
 		ipseclog((LOG_DEBUG, "%s: no SA index found.\n", __func__));
 		return key_senderror(so, m, ENOENT);
 	}
 
 	/* set spidx if there */
 	/* XXX rewrite */
 	error = key_setident(sah, m, mhp);
 	if (error)
 		return key_senderror(so, m, error);
 
 	/* find a SA with sequence number. */
 #ifdef IPSEC_DOSEQCHECK
 	if (mhp->msg->sadb_msg_seq != 0
 	 && (sav = key_getsavbyseq(sah, mhp->msg->sadb_msg_seq)) == NULL) {
 		ipseclog((LOG_DEBUG, "%s: no larval SA with sequence %u "
 			"exists.\n", __func__, mhp->msg->sadb_msg_seq));
 		return key_senderror(so, m, ENOENT);
 	}
 #else
 	SAHTREE_LOCK();
 	sav = key_getsavbyspi(sah, sa0->sadb_sa_spi);
 	SAHTREE_UNLOCK();
 	if (sav == NULL) {
 		ipseclog((LOG_DEBUG, "%s: no such a SA found (spi:%u)\n",
 			__func__, (u_int32_t)ntohl(sa0->sadb_sa_spi)));
 		return key_senderror(so, m, EINVAL);
 	}
 #endif
 
 	/* validity check */
 	if (sav->sah->saidx.proto != proto) {
 		ipseclog((LOG_DEBUG, "%s: protocol mismatched "
 			"(DB=%u param=%u)\n", __func__,
 			sav->sah->saidx.proto, proto));
 		return key_senderror(so, m, EINVAL);
 	}
 #ifdef IPSEC_DOSEQCHECK
 	if (sav->spi != sa0->sadb_sa_spi) {
 		ipseclog((LOG_DEBUG, "%s: SPI mismatched (DB:%u param:%u)\n",
 		    __func__,
 		    (u_int32_t)ntohl(sav->spi),
 		    (u_int32_t)ntohl(sa0->sadb_sa_spi)));
 		return key_senderror(so, m, EINVAL);
 	}
 #endif
 	if (sav->pid != mhp->msg->sadb_msg_pid) {
 		ipseclog((LOG_DEBUG, "%s: pid mismatched (DB:%u param:%u)\n",
 		    __func__, sav->pid, mhp->msg->sadb_msg_pid));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/* copy sav values */
 	error = key_setsaval(sav, m, mhp);
 	if (error) {
 		KEY_FREESAV(&sav);
 		return key_senderror(so, m, error);
 	}
 
 #ifdef IPSEC_NAT_T
 	/*
 	 * Handle more NAT-T info if present,
 	 * now that we have a sav to fill.
 	 */
 	if (type)
 		sav->natt_type = type->sadb_x_nat_t_type_type;
 
 	if (sport)
 		KEY_PORTTOSADDR(&sav->sah->saidx.src,
 		    sport->sadb_x_nat_t_port_port);
 	if (dport)
 		KEY_PORTTOSADDR(&sav->sah->saidx.dst,
 		    dport->sadb_x_nat_t_port_port);
 
 #if 0
 	/*
 	 * In case SADB_X_EXT_NAT_T_FRAG was not given, leave it at 0.
 	 * We should actually check for a minimum MTU here, if we
 	 * want to support it in ip_output.
 	 */
 	if (frag)
 		sav->natt_esp_frag_len = frag->sadb_x_nat_t_frag_fraglen;
 #endif
 #endif
 
 	/* check SA values to be mature. */
 	if ((mhp->msg->sadb_msg_errno = key_mature(sav)) != 0) {
 		KEY_FREESAV(&sav);
 		return key_senderror(so, m, 0);
 	}
 
     {
 	struct mbuf *n;
 
 	/* set msg buf from mhp */
 	n = key_getmsgbuf_x1(m, mhp);
 	if (n == NULL) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return key_senderror(so, m, ENOBUFS);
 	}
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);
     }
 }
 
 /*
  * search SAD with sequence for a SA which state is SADB_SASTATE_LARVAL.
  * only called by key_update().
  * OUT:
  *	NULL	: not found
  *	others	: found, pointer to a SA.
  */
 #ifdef IPSEC_DOSEQCHECK
 static struct secasvar *
 key_getsavbyseq(struct secashead *sah, u_int32_t seq)
 {
 	struct secasvar *sav;
 	u_int state;
 
 	state = SADB_SASTATE_LARVAL;
 
 	/* search SAD with sequence number ? */
 	LIST_FOREACH(sav, &sah->savtree[state], chain) {
 
 		KEY_CHKSASTATE(state, sav->state, __func__);
 
 		if (sav->seq == seq) {
 			sa_addref(sav);
 			KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
 				printf("DP %s cause refcnt++:%d SA:%p\n",
 					__func__, sav->refcnt, sav));
 			return sav;
 		}
 	}
 
 	return NULL;
 }
 #endif
 
 /*
  * SADB_ADD processing
  * add an entry to SA database, when received
  *   
  * from the ikmpd,
  * and send
  *   
  * to the ikmpd.
  *
  * IGNORE identity and sensitivity messages.
  *
  * m will always be freed.
  */
 static int
 key_add(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct sadb_sa *sa0;
 	struct sadb_address *src0, *dst0;
 #ifdef IPSEC_NAT_T
 	struct sadb_x_nat_t_type *type;
 	struct sadb_address *iaddr, *raddr;
 	struct sadb_x_nat_t_frag *frag;
 #endif
 	struct secasindex saidx;
 	struct secashead *newsah;
 	struct secasvar *newsav;
 	u_int16_t proto;
 	u_int8_t mode;
 	u_int32_t reqid;
 	int error;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* map satype to proto */
 	if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	if (mhp->ext[SADB_EXT_SA] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_DST] == NULL ||
 	    (mhp->msg->sadb_msg_satype == SADB_SATYPE_ESP &&
 	     mhp->ext[SADB_EXT_KEY_ENCRYPT] == NULL) ||
 	    (mhp->msg->sadb_msg_satype == SADB_SATYPE_AH &&
 	     mhp->ext[SADB_EXT_KEY_AUTH] == NULL) ||
 	    (mhp->ext[SADB_EXT_LIFETIME_HARD] != NULL &&
 	     mhp->ext[SADB_EXT_LIFETIME_SOFT] == NULL) ||
 	    (mhp->ext[SADB_EXT_LIFETIME_HARD] == NULL &&
 	     mhp->ext[SADB_EXT_LIFETIME_SOFT] != NULL)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->extlen[SADB_EXT_SA] < sizeof(struct sadb_sa) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) {
 		/* XXX need more */
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->ext[SADB_X_EXT_SA2] != NULL) {
 		mode = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_mode;
 		reqid = ((struct sadb_x_sa2 *)mhp->ext[SADB_X_EXT_SA2])->sadb_x_sa2_reqid;
 	} else {
 		mode = IPSEC_MODE_ANY;
 		reqid = 0;
 	}
 
 	sa0 = (struct sadb_sa *)mhp->ext[SADB_EXT_SA];
 	src0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_SRC];
 	dst0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_DST];
 
 	/* XXX boundary check against sa_len */
 	KEY_SETSECASIDX(proto, mode, reqid, src0 + 1, dst0 + 1, &saidx);
 
 	/*
 	 * Make sure the port numbers are zero.
 	 * In case of NAT-T we will update them later if needed.
 	 */
 	KEY_PORTTOSADDR(&saidx.src, 0);
 	KEY_PORTTOSADDR(&saidx.dst, 0);
 
 #ifdef IPSEC_NAT_T
 	/*
 	 * Handle NAT-T info if present.
 	 */
 	if (mhp->ext[SADB_X_EXT_NAT_T_TYPE] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_SPORT] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_DPORT] != NULL) {
 		struct sadb_x_nat_t_port *sport, *dport;
 
 		if (mhp->extlen[SADB_X_EXT_NAT_T_TYPE] < sizeof(*type) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_SPORT] < sizeof(*sport) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_DPORT] < sizeof(*dport)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message.\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 
 		type = (struct sadb_x_nat_t_type *)
 		    mhp->ext[SADB_X_EXT_NAT_T_TYPE];
 		sport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_SPORT];
 		dport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_DPORT];
 
 		if (sport)
 			KEY_PORTTOSADDR(&saidx.src,
 			    sport->sadb_x_nat_t_port_port);
 		if (dport)
 			KEY_PORTTOSADDR(&saidx.dst,
 			    dport->sadb_x_nat_t_port_port);
 	} else {
 		type = 0;
 	}
 	if (mhp->ext[SADB_X_EXT_NAT_T_OAI] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_OAR] != NULL) {
 		if (mhp->extlen[SADB_X_EXT_NAT_T_OAI] < sizeof(*iaddr) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_OAR] < sizeof(*raddr)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 		iaddr = (struct sadb_address *)mhp->ext[SADB_X_EXT_NAT_T_OAI];
 		raddr = (struct sadb_address *)mhp->ext[SADB_X_EXT_NAT_T_OAR];
 		ipseclog((LOG_DEBUG, "%s: NAT-T OAi/r present\n", __func__));
 	} else {
 		iaddr = raddr = NULL;
 	}
 	if (mhp->ext[SADB_X_EXT_NAT_T_FRAG] != NULL) {
 		if (mhp->extlen[SADB_X_EXT_NAT_T_FRAG] < sizeof(*frag)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 		frag = (struct sadb_x_nat_t_frag *)
 		    mhp->ext[SADB_X_EXT_NAT_T_FRAG];
 	} else {
 		frag = 0;
 	}
 #endif
 
 	/* get a SA header */
 	if ((newsah = key_getsah(&saidx)) == NULL) {
 		/* create a new SA header */
 		if ((newsah = key_newsah(&saidx)) == NULL) {
 			ipseclog((LOG_DEBUG, "%s: No more memory.\n",__func__));
 			return key_senderror(so, m, ENOBUFS);
 		}
 	}
 
 	/* set spidx if there */
 	/* XXX rewrite */
 	error = key_setident(newsah, m, mhp);
 	if (error) {
 		return key_senderror(so, m, error);
 	}
 
 	/* create new SA entry. */
 	/* We can create new SA only if SPI is differenct. */
 	SAHTREE_LOCK();
 	newsav = key_getsavbyspi(newsah, sa0->sadb_sa_spi);
 	SAHTREE_UNLOCK();
 	if (newsav != NULL) {
 		ipseclog((LOG_DEBUG, "%s: SA already exists.\n", __func__));
 		return key_senderror(so, m, EEXIST);
 	}
 	newsav = KEY_NEWSAV(m, mhp, newsah, &error);
 	if (newsav == NULL) {
 		return key_senderror(so, m, error);
 	}
 
 #ifdef IPSEC_NAT_T
 	/*
 	 * Handle more NAT-T info if present,
 	 * now that we have a sav to fill.
 	 */
 	if (type)
 		newsav->natt_type = type->sadb_x_nat_t_type_type;
 
 #if 0
 	/*
 	 * In case SADB_X_EXT_NAT_T_FRAG was not given, leave it at 0.
 	 * We should actually check for a minimum MTU here, if we
 	 * want to support it in ip_output.
 	 */
 	if (frag)
 		newsav->natt_esp_frag_len = frag->sadb_x_nat_t_frag_fraglen;
 #endif
 #endif
 
 	/* check SA values to be mature. */
 	if ((error = key_mature(newsav)) != 0) {
 		KEY_FREESAV(&newsav);
 		return key_senderror(so, m, error);
 	}
 
 	/*
 	 * don't call key_freesav() here, as we would like to keep the SA
 	 * in the database on success.
 	 */
 
     {
 	struct mbuf *n;
 
 	/* set msg buf from mhp */
 	n = key_getmsgbuf_x1(m, mhp);
 	if (n == NULL) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return key_senderror(so, m, ENOBUFS);
 	}
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);
     }
 }
 
 /* m is retained */
 static int
 key_setident(struct secashead *sah, struct mbuf *m,
     const struct sadb_msghdr *mhp)
 {
 	const struct sadb_ident *idsrc, *iddst;
 	int idsrclen, iddstlen;
 
 	IPSEC_ASSERT(sah != NULL, ("null secashead"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* don't make buffer if not there */
 	if (mhp->ext[SADB_EXT_IDENTITY_SRC] == NULL &&
 	    mhp->ext[SADB_EXT_IDENTITY_DST] == NULL) {
 		sah->idents = NULL;
 		sah->identd = NULL;
 		return 0;
 	}
 	
 	if (mhp->ext[SADB_EXT_IDENTITY_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_IDENTITY_DST] == NULL) {
 		ipseclog((LOG_DEBUG, "%s: invalid identity.\n", __func__));
 		return EINVAL;
 	}
 
 	idsrc = (const struct sadb_ident *)mhp->ext[SADB_EXT_IDENTITY_SRC];
 	iddst = (const struct sadb_ident *)mhp->ext[SADB_EXT_IDENTITY_DST];
 	idsrclen = mhp->extlen[SADB_EXT_IDENTITY_SRC];
 	iddstlen = mhp->extlen[SADB_EXT_IDENTITY_DST];
 
 	/* validity check */
 	if (idsrc->sadb_ident_type != iddst->sadb_ident_type) {
 		ipseclog((LOG_DEBUG, "%s: ident type mismatch.\n", __func__));
 		return EINVAL;
 	}
 
 	switch (idsrc->sadb_ident_type) {
 	case SADB_IDENTTYPE_PREFIX:
 	case SADB_IDENTTYPE_FQDN:
 	case SADB_IDENTTYPE_USERFQDN:
 	default:
 		/* XXX do nothing */
 		sah->idents = NULL;
 		sah->identd = NULL;
 	 	return 0;
 	}
 
 	/* make structure */
 	sah->idents = malloc(sizeof(struct secident), M_IPSEC_MISC, M_NOWAIT);
 	if (sah->idents == NULL) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return ENOBUFS;
 	}
 	sah->identd = malloc(sizeof(struct secident), M_IPSEC_MISC, M_NOWAIT);
 	if (sah->identd == NULL) {
 		free(sah->idents, M_IPSEC_MISC);
 		sah->idents = NULL;
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return ENOBUFS;
 	}
 	sah->idents->type = idsrc->sadb_ident_type;
 	sah->idents->id = idsrc->sadb_ident_id;
 
 	sah->identd->type = iddst->sadb_ident_type;
 	sah->identd->id = iddst->sadb_ident_id;
 
 	return 0;
 }
 
 /*
  * m will not be freed on return.
  * it is caller's responsibility to free the result. 
  */
 static struct mbuf *
 key_getmsgbuf_x1(struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct mbuf *n;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* create new sadb_msg to reply. */
 	n = key_gather_mbuf(m, mhp, 1, 9, SADB_EXT_RESERVED,
 	    SADB_EXT_SA, SADB_X_EXT_SA2,
 	    SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST,
 	    SADB_EXT_LIFETIME_HARD, SADB_EXT_LIFETIME_SOFT,
 	    SADB_EXT_IDENTITY_SRC, SADB_EXT_IDENTITY_DST);
 	if (!n)
 		return NULL;
 
 	if (n->m_len < sizeof(struct sadb_msg)) {
 		n = m_pullup(n, sizeof(struct sadb_msg));
 		if (n == NULL)
 			return NULL;
 	}
 	mtod(n, struct sadb_msg *)->sadb_msg_errno = 0;
 	mtod(n, struct sadb_msg *)->sadb_msg_len =
 	    PFKEY_UNIT64(n->m_pkthdr.len);
 
 	return n;
 }
 
 /*
  * SADB_DELETE processing
  * receive
  *   
  * from the ikmpd, and set SADB_SASTATE_DEAD,
  * and send,
  *   
  * to the ikmpd.
  *
  * m will always be freed.
  */
 static int
 key_delete(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct sadb_sa *sa0;
 	struct sadb_address *src0, *dst0;
 	struct secasindex saidx;
 	struct secashead *sah;
 	struct secasvar *sav = NULL;
 	u_int16_t proto;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* map satype to proto */
 	if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	if (mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_DST] == NULL) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	if (mhp->ext[SADB_EXT_SA] == NULL) {
 		/*
 		 * Caller wants us to delete all non-LARVAL SAs
 		 * that match the src/dst.  This is used during
 		 * IKE INITIAL-CONTACT.
 		 */
 		ipseclog((LOG_DEBUG, "%s: doing delete all.\n", __func__));
 		return key_delete_all(so, m, mhp, proto);
 	} else if (mhp->extlen[SADB_EXT_SA] < sizeof(struct sadb_sa)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	sa0 = (struct sadb_sa *)mhp->ext[SADB_EXT_SA];
 	src0 = (struct sadb_address *)(mhp->ext[SADB_EXT_ADDRESS_SRC]);
 	dst0 = (struct sadb_address *)(mhp->ext[SADB_EXT_ADDRESS_DST]);
 
 	/* XXX boundary check against sa_len */
 	KEY_SETSECASIDX(proto, IPSEC_MODE_ANY, 0, src0 + 1, dst0 + 1, &saidx);
 
 	/*
 	 * Make sure the port numbers are zero.
 	 * In case of NAT-T we will update them later if needed.
 	 */
 	KEY_PORTTOSADDR(&saidx.src, 0);
 	KEY_PORTTOSADDR(&saidx.dst, 0);
 
 #ifdef IPSEC_NAT_T
 	/*
 	 * Handle NAT-T info if present.
 	 */
 	if (mhp->ext[SADB_X_EXT_NAT_T_SPORT] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_DPORT] != NULL) {
 		struct sadb_x_nat_t_port *sport, *dport;
 
 		if (mhp->extlen[SADB_X_EXT_NAT_T_SPORT] < sizeof(*sport) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_DPORT] < sizeof(*dport)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message.\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 
 		sport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_SPORT];
 		dport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_DPORT];
 
 		if (sport)
 			KEY_PORTTOSADDR(&saidx.src,
 			    sport->sadb_x_nat_t_port_port);
 		if (dport)
 			KEY_PORTTOSADDR(&saidx.dst,
 			    dport->sadb_x_nat_t_port_port);
 	}
 #endif
 
 	/* get a SA header */
 	SAHTREE_LOCK();
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (sah->state == SADB_SASTATE_DEAD)
 			continue;
 		if (key_cmpsaidx(&sah->saidx, &saidx, CMP_HEAD) == 0)
 			continue;
 
 		/* get a SA with SPI. */
 		sav = key_getsavbyspi(sah, sa0->sadb_sa_spi);
 		if (sav)
 			break;
 	}
 	if (sah == NULL) {
 		SAHTREE_UNLOCK();
 		ipseclog((LOG_DEBUG, "%s: no SA found.\n", __func__));
 		return key_senderror(so, m, ENOENT);
 	}
 
 	key_sa_chgstate(sav, SADB_SASTATE_DEAD);
 	KEY_FREESAV(&sav);
 	SAHTREE_UNLOCK();
 
     {
 	struct mbuf *n;
 	struct sadb_msg *newmsg;
 
 	/* create new sadb_msg to reply. */
 	/* XXX-BZ NAT-T extensions? */
 	n = key_gather_mbuf(m, mhp, 1, 4, SADB_EXT_RESERVED,
 	    SADB_EXT_SA, SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST);
 	if (!n)
 		return key_senderror(so, m, ENOBUFS);
 
 	if (n->m_len < sizeof(struct sadb_msg)) {
 		n = m_pullup(n, sizeof(struct sadb_msg));
 		if (n == NULL)
 			return key_senderror(so, m, ENOBUFS);
 	}
 	newmsg = mtod(n, struct sadb_msg *);
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len);
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);
     }
 }
 
 /*
  * delete all SAs for src/dst.  Called from key_delete().
  */
 static int
 key_delete_all(struct socket *so, struct mbuf *m,
     const struct sadb_msghdr *mhp, u_int16_t proto)
 {
 	struct sadb_address *src0, *dst0;
 	struct secasindex saidx;
 	struct secashead *sah;
 	struct secasvar *sav, *nextsav;
 	u_int stateidx, state;
 
 	src0 = (struct sadb_address *)(mhp->ext[SADB_EXT_ADDRESS_SRC]);
 	dst0 = (struct sadb_address *)(mhp->ext[SADB_EXT_ADDRESS_DST]);
 
 	/* XXX boundary check against sa_len */
 	KEY_SETSECASIDX(proto, IPSEC_MODE_ANY, 0, src0 + 1, dst0 + 1, &saidx);
 
 	/*
 	 * Make sure the port numbers are zero.
 	 * In case of NAT-T we will update them later if needed.
 	 */
 	KEY_PORTTOSADDR(&saidx.src, 0);
 	KEY_PORTTOSADDR(&saidx.dst, 0);
 
 #ifdef IPSEC_NAT_T
 	/*
 	 * Handle NAT-T info if present.
 	 */
 
 	if (mhp->ext[SADB_X_EXT_NAT_T_SPORT] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_DPORT] != NULL) {
 		struct sadb_x_nat_t_port *sport, *dport;
 
 		if (mhp->extlen[SADB_X_EXT_NAT_T_SPORT] < sizeof(*sport) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_DPORT] < sizeof(*dport)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message.\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 
 		sport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_SPORT];
 		dport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_DPORT];
 
 		if (sport)
 			KEY_PORTTOSADDR(&saidx.src,
 			    sport->sadb_x_nat_t_port_port);
 		if (dport)
 			KEY_PORTTOSADDR(&saidx.dst,
 			    dport->sadb_x_nat_t_port_port);
 	}
 #endif
 
 	SAHTREE_LOCK();
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (sah->state == SADB_SASTATE_DEAD)
 			continue;
 		if (key_cmpsaidx(&sah->saidx, &saidx, CMP_HEAD) == 0)
 			continue;
 
 		/* Delete all non-LARVAL SAs. */
 		for (stateidx = 0;
 		     stateidx < _ARRAYLEN(saorder_state_alive);
 		     stateidx++) {
 			state = saorder_state_alive[stateidx];
 			if (state == SADB_SASTATE_LARVAL)
 				continue;
 			for (sav = LIST_FIRST(&sah->savtree[state]);
 			     sav != NULL; sav = nextsav) {
 				nextsav = LIST_NEXT(sav, chain);
 				/* sanity check */
 				if (sav->state != state) {
 					ipseclog((LOG_DEBUG, "%s: invalid "
 						"sav->state (queue %d SA %d)\n",
 						__func__, state, sav->state));
 					continue;
 				}
 				
 				key_sa_chgstate(sav, SADB_SASTATE_DEAD);
 				KEY_FREESAV(&sav);
 			}
 		}
 	}
 	SAHTREE_UNLOCK();
     {
 	struct mbuf *n;
 	struct sadb_msg *newmsg;
 
 	/* create new sadb_msg to reply. */
 	/* XXX-BZ NAT-T extensions? */
 	n = key_gather_mbuf(m, mhp, 1, 3, SADB_EXT_RESERVED,
 	    SADB_EXT_ADDRESS_SRC, SADB_EXT_ADDRESS_DST);
 	if (!n)
 		return key_senderror(so, m, ENOBUFS);
 
 	if (n->m_len < sizeof(struct sadb_msg)) {
 		n = m_pullup(n, sizeof(struct sadb_msg));
 		if (n == NULL)
 			return key_senderror(so, m, ENOBUFS);
 	}
 	newmsg = mtod(n, struct sadb_msg *);
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(n->m_pkthdr.len);
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);
     }
 }
 
 /*
  * SADB_GET processing
  * receive
  *   
  * from the ikmpd, and get a SP and a SA to respond,
  * and send,
  *   
  * to the ikmpd.
  *
  * m will always be freed.
  */
 static int
 key_get(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct sadb_sa *sa0;
 	struct sadb_address *src0, *dst0;
 	struct secasindex saidx;
 	struct secashead *sah;
 	struct secasvar *sav = NULL;
 	u_int16_t proto;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* map satype to proto */
 	if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	if (mhp->ext[SADB_EXT_SA] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_DST] == NULL) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->extlen[SADB_EXT_SA] < sizeof(struct sadb_sa) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address)) {
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	sa0 = (struct sadb_sa *)mhp->ext[SADB_EXT_SA];
 	src0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_SRC];
 	dst0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_DST];
 
 	/* XXX boundary check against sa_len */
 	KEY_SETSECASIDX(proto, IPSEC_MODE_ANY, 0, src0 + 1, dst0 + 1, &saidx);
 
 	/*
 	 * Make sure the port numbers are zero.
 	 * In case of NAT-T we will update them later if needed.
 	 */
 	KEY_PORTTOSADDR(&saidx.src, 0);
 	KEY_PORTTOSADDR(&saidx.dst, 0);
 
 #ifdef IPSEC_NAT_T
 	/*
 	 * Handle NAT-T info if present.
 	 */
 
 	if (mhp->ext[SADB_X_EXT_NAT_T_SPORT] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_DPORT] != NULL) {
 		struct sadb_x_nat_t_port *sport, *dport;
 
 		if (mhp->extlen[SADB_X_EXT_NAT_T_SPORT] < sizeof(*sport) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_DPORT] < sizeof(*dport)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message.\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 
 		sport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_SPORT];
 		dport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_DPORT];
 
 		if (sport)
 			KEY_PORTTOSADDR(&saidx.src,
 			    sport->sadb_x_nat_t_port_port);
 		if (dport)
 			KEY_PORTTOSADDR(&saidx.dst,
 			    dport->sadb_x_nat_t_port_port);
 	}
 #endif
 
 	/* get a SA header */
 	SAHTREE_LOCK();
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (sah->state == SADB_SASTATE_DEAD)
 			continue;
 		if (key_cmpsaidx(&sah->saidx, &saidx, CMP_HEAD) == 0)
 			continue;
 
 		/* get a SA with SPI. */
 		sav = key_getsavbyspi(sah, sa0->sadb_sa_spi);
 		if (sav)
 			break;
 	}
 	SAHTREE_UNLOCK();
 	if (sah == NULL) {
 		ipseclog((LOG_DEBUG, "%s: no SA found.\n", __func__));
 		return key_senderror(so, m, ENOENT);
 	}
 
     {
 	struct mbuf *n;
 	u_int8_t satype;
 
 	/* map proto to satype */
 	if ((satype = key_proto2satype(sah->saidx.proto)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: there was invalid proto in SAD.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/* create new sadb_msg to reply. */
 	n = key_setdumpsa(sav, SADB_GET, satype, mhp->msg->sadb_msg_seq,
 	    mhp->msg->sadb_msg_pid);
 	if (!n)
 		return key_senderror(so, m, ENOBUFS);
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ONE);
     }
 }
 
 /* XXX make it sysctl-configurable? */
 static void
 key_getcomb_setlifetime(struct sadb_comb *comb)
 {
 
 	comb->sadb_comb_soft_allocations = 1;
 	comb->sadb_comb_hard_allocations = 1;
 	comb->sadb_comb_soft_bytes = 0;
 	comb->sadb_comb_hard_bytes = 0;
 	comb->sadb_comb_hard_addtime = 86400;	/* 1 day */
 	comb->sadb_comb_soft_addtime = comb->sadb_comb_soft_addtime * 80 / 100;
 	comb->sadb_comb_soft_usetime = 28800;	/* 8 hours */
 	comb->sadb_comb_hard_usetime = comb->sadb_comb_hard_usetime * 80 / 100;
 }
 
 /*
  * XXX reorder combinations by preference
  * XXX no idea if the user wants ESP authentication or not
  */
 static struct mbuf *
 key_getcomb_esp()
 {
 	struct sadb_comb *comb;
 	struct enc_xform *algo;
 	struct mbuf *result = NULL, *m, *n;
 	int encmin;
 	int i, off, o;
 	int totlen;
 	const int l = PFKEY_ALIGN8(sizeof(struct sadb_comb));
 
 	m = NULL;
 	for (i = 1; i <= SADB_EALG_MAX; i++) {
 		algo = esp_algorithm_lookup(i);
 		if (algo == NULL)
 			continue;
 
 		/* discard algorithms with key size smaller than system min */
 		if (_BITS(algo->maxkey) < V_ipsec_esp_keymin)
 			continue;
 		if (_BITS(algo->minkey) < V_ipsec_esp_keymin)
 			encmin = V_ipsec_esp_keymin;
 		else
 			encmin = _BITS(algo->minkey);
 
 		if (V_ipsec_esp_auth)
 			m = key_getcomb_ah();
 		else {
 			IPSEC_ASSERT(l <= MLEN,
 				("l=%u > MLEN=%lu", l, (u_long) MLEN));
 			MGET(m, M_NOWAIT, MT_DATA);
 			if (m) {
 				M_ALIGN(m, l);
 				m->m_len = l;
 				m->m_next = NULL;
 				bzero(mtod(m, caddr_t), m->m_len);
 			}
 		}
 		if (!m)
 			goto fail;
 
 		totlen = 0;
 		for (n = m; n; n = n->m_next)
 			totlen += n->m_len;
 		IPSEC_ASSERT((totlen % l) == 0, ("totlen=%u, l=%u", totlen, l));
 
 		for (off = 0; off < totlen; off += l) {
 			n = m_pulldown(m, off, l, &o);
 			if (!n) {
 				/* m is already freed */
 				goto fail;
 			}
 			comb = (struct sadb_comb *)(mtod(n, caddr_t) + o);
 			bzero(comb, sizeof(*comb));
 			key_getcomb_setlifetime(comb);
 			comb->sadb_comb_encrypt = i;
 			comb->sadb_comb_encrypt_minbits = encmin;
 			comb->sadb_comb_encrypt_maxbits = _BITS(algo->maxkey);
 		}
 
 		if (!result)
 			result = m;
 		else
 			m_cat(result, m);
 	}
 
 	return result;
 
  fail:
 	if (result)
 		m_freem(result);
 	return NULL;
 }
 
 static void
 key_getsizes_ah(const struct auth_hash *ah, int alg, u_int16_t* min,
     u_int16_t* max)
 {
 
 	*min = *max = ah->keysize;
 	if (ah->keysize == 0) {
 		/*
 		 * Transform takes arbitrary key size but algorithm
 		 * key size is restricted.  Enforce this here.
 		 */
 		switch (alg) {
 		case SADB_X_AALG_MD5:	*min = *max = 16; break;
 		case SADB_X_AALG_SHA:	*min = *max = 20; break;
 		case SADB_X_AALG_NULL:	*min = 1; *max = 256; break;
 		case SADB_X_AALG_SHA2_256: *min = *max = 32; break;
 		case SADB_X_AALG_SHA2_384: *min = *max = 48; break;
 		case SADB_X_AALG_SHA2_512: *min = *max = 64; break;
 		default:
 			DPRINTF(("%s: unknown AH algorithm %u\n",
 				__func__, alg));
 			break;
 		}
 	}
 }
 
 /*
  * XXX reorder combinations by preference
  */
 static struct mbuf *
 key_getcomb_ah()
 {
 	struct sadb_comb *comb;
 	struct auth_hash *algo;
 	struct mbuf *m;
 	u_int16_t minkeysize, maxkeysize;
 	int i;
 	const int l = PFKEY_ALIGN8(sizeof(struct sadb_comb));
 
 	m = NULL;
 	for (i = 1; i <= SADB_AALG_MAX; i++) {
 #if 1
 		/* we prefer HMAC algorithms, not old algorithms */
 		if (i != SADB_AALG_SHA1HMAC &&
 		    i != SADB_AALG_MD5HMAC  &&
 		    i != SADB_X_AALG_SHA2_256 &&
 		    i != SADB_X_AALG_SHA2_384 &&
 		    i != SADB_X_AALG_SHA2_512)
 			continue;
 #endif
 		algo = ah_algorithm_lookup(i);
 		if (!algo)
 			continue;
 		key_getsizes_ah(algo, i, &minkeysize, &maxkeysize);
 		/* discard algorithms with key size smaller than system min */
 		if (_BITS(minkeysize) < V_ipsec_ah_keymin)
 			continue;
 
 		if (!m) {
 			IPSEC_ASSERT(l <= MLEN,
 				("l=%u > MLEN=%lu", l, (u_long) MLEN));
 			MGET(m, M_NOWAIT, MT_DATA);
 			if (m) {
 				M_ALIGN(m, l);
 				m->m_len = l;
 				m->m_next = NULL;
 			}
 		} else
 			M_PREPEND(m, l, M_NOWAIT);
 		if (!m)
 			return NULL;
 
 		comb = mtod(m, struct sadb_comb *);
 		bzero(comb, sizeof(*comb));
 		key_getcomb_setlifetime(comb);
 		comb->sadb_comb_auth = i;
 		comb->sadb_comb_auth_minbits = _BITS(minkeysize);
 		comb->sadb_comb_auth_maxbits = _BITS(maxkeysize);
 	}
 
 	return m;
 }
 
 /*
  * not really an official behavior.  discussed in pf_key@inner.net in Sep2000.
  * XXX reorder combinations by preference
  */
 static struct mbuf *
 key_getcomb_ipcomp()
 {
 	struct sadb_comb *comb;
 	struct comp_algo *algo;
 	struct mbuf *m;
 	int i;
 	const int l = PFKEY_ALIGN8(sizeof(struct sadb_comb));
 
 	m = NULL;
 	for (i = 1; i <= SADB_X_CALG_MAX; i++) {
 		algo = ipcomp_algorithm_lookup(i);
 		if (!algo)
 			continue;
 
 		if (!m) {
 			IPSEC_ASSERT(l <= MLEN,
 				("l=%u > MLEN=%lu", l, (u_long) MLEN));
 			MGET(m, M_NOWAIT, MT_DATA);
 			if (m) {
 				M_ALIGN(m, l);
 				m->m_len = l;
 				m->m_next = NULL;
 			}
 		} else
 			M_PREPEND(m, l, M_NOWAIT);
 		if (!m)
 			return NULL;
 
 		comb = mtod(m, struct sadb_comb *);
 		bzero(comb, sizeof(*comb));
 		key_getcomb_setlifetime(comb);
 		comb->sadb_comb_encrypt = i;
 		/* what should we set into sadb_comb_*_{min,max}bits? */
 	}
 
 	return m;
 }
 
 /*
  * XXX no way to pass mode (transport/tunnel) to userland
  * XXX replay checking?
  * XXX sysctl interface to ipsec_{ah,esp}_keymin
  */
 static struct mbuf *
 key_getprop(const struct secasindex *saidx)
 {
 	struct sadb_prop *prop;
 	struct mbuf *m, *n;
 	const int l = PFKEY_ALIGN8(sizeof(struct sadb_prop));
 	int totlen;
 
 	switch (saidx->proto)  {
 	case IPPROTO_ESP:
 		m = key_getcomb_esp();
 		break;
 	case IPPROTO_AH:
 		m = key_getcomb_ah();
 		break;
 	case IPPROTO_IPCOMP:
 		m = key_getcomb_ipcomp();
 		break;
 	default:
 		return NULL;
 	}
 
 	if (!m)
 		return NULL;
 	M_PREPEND(m, l, M_NOWAIT);
 	if (!m)
 		return NULL;
 
 	totlen = 0;
 	for (n = m; n; n = n->m_next)
 		totlen += n->m_len;
 
 	prop = mtod(m, struct sadb_prop *);
 	bzero(prop, sizeof(*prop));
 	prop->sadb_prop_len = PFKEY_UNIT64(totlen);
 	prop->sadb_prop_exttype = SADB_EXT_PROPOSAL;
 	prop->sadb_prop_replay = 32;	/* XXX */
 
 	return m;
 }
 
 /*
  * SADB_ACQUIRE processing called by key_checkrequest() and key_acquire2().
  * send
  *   
  * to KMD, and expect to receive
  *    with SADB_ACQUIRE if error occured,
  * or
  *    with SADB_GETSPI
  * from KMD by PF_KEY.
  *
  * XXX x_policy is outside of RFC2367 (KAME extension).
  * XXX sensitivity is not supported.
  * XXX for ipcomp, RFC2367 does not define how to fill in proposal.
  * see comment for key_getcomb_ipcomp().
  *
  * OUT:
  *    0     : succeed
  *    others: error number
  */
 static int
 key_acquire(const struct secasindex *saidx, struct secpolicy *sp)
 {
 	struct mbuf *result = NULL, *m;
 	struct secacq *newacq;
 	u_int8_t satype;
 	int error = -1;
 	u_int32_t seq;
 
 	IPSEC_ASSERT(saidx != NULL, ("null saidx"));
 	satype = key_proto2satype(saidx->proto);
 	IPSEC_ASSERT(satype != 0, ("null satype, protocol %u", saidx->proto));
 
 	/*
 	 * We never do anything about acquirng SA.  There is anather
 	 * solution that kernel blocks to send SADB_ACQUIRE message until
 	 * getting something message from IKEd.  In later case, to be
 	 * managed with ACQUIRING list.
 	 */
 	/* Get an entry to check whether sending message or not. */
 	if ((newacq = key_getacq(saidx)) != NULL) {
 		if (V_key_blockacq_count < newacq->count) {
 			/* reset counter and do send message. */
 			newacq->count = 0;
 		} else {
 			/* increment counter and do nothing. */
 			newacq->count++;
 			return 0;
 		}
 	} else {
 		/* make new entry for blocking to send SADB_ACQUIRE. */
 		if ((newacq = key_newacq(saidx)) == NULL)
 			return ENOBUFS;
 	}
 
 
 	seq = newacq->seq;
 	m = key_setsadbmsg(SADB_ACQUIRE, 0, satype, seq, 0, 0);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	result = m;
 
 	/*
 	 * No SADB_X_EXT_NAT_T_* here: we do not know
 	 * anything related to NAT-T at this time.
 	 */
 
 	/* set sadb_address for saidx's. */
 	m = key_setsadbaddr(SADB_EXT_ADDRESS_SRC,
 	    &saidx->src.sa, FULLMASK, IPSEC_ULPROTO_ANY);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	m = key_setsadbaddr(SADB_EXT_ADDRESS_DST,
 	    &saidx->dst.sa, FULLMASK, IPSEC_ULPROTO_ANY);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	/* XXX proxy address (optional) */
 
 	/* set sadb_x_policy */
 	if (sp) {
 		m = key_setsadbxpolicy(sp->policy, sp->spidx.dir, sp->id);
 		if (!m) {
 			error = ENOBUFS;
 			goto fail;
 		}
 		m_cat(result, m);
 	}
 
 	/* XXX identity (optional) */
 #if 0
 	if (idexttype && fqdn) {
 		/* create identity extension (FQDN) */
 		struct sadb_ident *id;
 		int fqdnlen;
 
 		fqdnlen = strlen(fqdn) + 1;	/* +1 for terminating-NUL */
 		id = (struct sadb_ident *)p;
 		bzero(id, sizeof(*id) + PFKEY_ALIGN8(fqdnlen));
 		id->sadb_ident_len = PFKEY_UNIT64(sizeof(*id) + PFKEY_ALIGN8(fqdnlen));
 		id->sadb_ident_exttype = idexttype;
 		id->sadb_ident_type = SADB_IDENTTYPE_FQDN;
 		bcopy(fqdn, id + 1, fqdnlen);
 		p += sizeof(struct sadb_ident) + PFKEY_ALIGN8(fqdnlen);
 	}
 
 	if (idexttype) {
 		/* create identity extension (USERFQDN) */
 		struct sadb_ident *id;
 		int userfqdnlen;
 
 		if (userfqdn) {
 			/* +1 for terminating-NUL */
 			userfqdnlen = strlen(userfqdn) + 1;
 		} else
 			userfqdnlen = 0;
 		id = (struct sadb_ident *)p;
 		bzero(id, sizeof(*id) + PFKEY_ALIGN8(userfqdnlen));
 		id->sadb_ident_len = PFKEY_UNIT64(sizeof(*id) + PFKEY_ALIGN8(userfqdnlen));
 		id->sadb_ident_exttype = idexttype;
 		id->sadb_ident_type = SADB_IDENTTYPE_USERFQDN;
 		/* XXX is it correct? */
 		if (curproc && curproc->p_cred)
 			id->sadb_ident_id = curproc->p_cred->p_ruid;
 		if (userfqdn && userfqdnlen)
 			bcopy(userfqdn, id + 1, userfqdnlen);
 		p += sizeof(struct sadb_ident) + PFKEY_ALIGN8(userfqdnlen);
 	}
 #endif
 
 	/* XXX sensitivity (optional) */
 
 	/* create proposal/combination extension */
 	m = key_getprop(saidx);
 #if 0
 	/*
 	 * spec conformant: always attach proposal/combination extension,
 	 * the problem is that we have no way to attach it for ipcomp,
 	 * due to the way sadb_comb is declared in RFC2367.
 	 */
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 #else
 	/*
 	 * outside of spec; make proposal/combination extension optional.
 	 */
 	if (m)
 		m_cat(result, m);
 #endif
 
 	if ((result->m_flags & M_PKTHDR) == 0) {
 		error = EINVAL;
 		goto fail;
 	}
 
 	if (result->m_len < sizeof(struct sadb_msg)) {
 		result = m_pullup(result, sizeof(struct sadb_msg));
 		if (result == NULL) {
 			error = ENOBUFS;
 			goto fail;
 		}
 	}
 
 	result->m_pkthdr.len = 0;
 	for (m = result; m; m = m->m_next)
 		result->m_pkthdr.len += m->m_len;
 
 	mtod(result, struct sadb_msg *)->sadb_msg_len =
 	    PFKEY_UNIT64(result->m_pkthdr.len);
 
 	return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED);
 
  fail:
 	if (result)
 		m_freem(result);
 	return error;
 }
 
 static struct secacq *
 key_newacq(const struct secasindex *saidx)
 {
 	struct secacq *newacq;
 
 	/* get new entry */
 	newacq = malloc(sizeof(struct secacq), M_IPSEC_SAQ, M_NOWAIT|M_ZERO);
 	if (newacq == NULL) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return NULL;
 	}
 
 	/* copy secindex */
 	bcopy(saidx, &newacq->saidx, sizeof(newacq->saidx));
 	newacq->seq = (V_acq_seq == ~0 ? 1 : ++V_acq_seq);
 	newacq->created = time_second;
 	newacq->count = 0;
 
 	/* add to acqtree */
 	ACQ_LOCK();
 	LIST_INSERT_HEAD(&V_acqtree, newacq, chain);
 	ACQ_UNLOCK();
 
 	return newacq;
 }
 
 static struct secacq *
 key_getacq(const struct secasindex *saidx)
 {
 	struct secacq *acq;
 
 	ACQ_LOCK();
 	LIST_FOREACH(acq, &V_acqtree, chain) {
 		if (key_cmpsaidx(saidx, &acq->saidx, CMP_EXACTLY))
 			break;
 	}
 	ACQ_UNLOCK();
 
 	return acq;
 }
 
 static struct secacq *
 key_getacqbyseq(u_int32_t seq)
 {
 	struct secacq *acq;
 
 	ACQ_LOCK();
 	LIST_FOREACH(acq, &V_acqtree, chain) {
 		if (acq->seq == seq)
 			break;
 	}
 	ACQ_UNLOCK();
 
 	return acq;
 }
 
 static struct secspacq *
 key_newspacq(struct secpolicyindex *spidx)
 {
 	struct secspacq *acq;
 
 	/* get new entry */
 	acq = malloc(sizeof(struct secspacq), M_IPSEC_SAQ, M_NOWAIT|M_ZERO);
 	if (acq == NULL) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return NULL;
 	}
 
 	/* copy secindex */
 	bcopy(spidx, &acq->spidx, sizeof(acq->spidx));
 	acq->created = time_second;
 	acq->count = 0;
 
 	/* add to spacqtree */
 	SPACQ_LOCK();
 	LIST_INSERT_HEAD(&V_spacqtree, acq, chain);
 	SPACQ_UNLOCK();
 
 	return acq;
 }
 
 static struct secspacq *
 key_getspacq(struct secpolicyindex *spidx)
 {
 	struct secspacq *acq;
 
 	SPACQ_LOCK();
 	LIST_FOREACH(acq, &V_spacqtree, chain) {
 		if (key_cmpspidx_exactly(spidx, &acq->spidx)) {
 			/* NB: return holding spacq_lock */
 			return acq;
 		}
 	}
 	SPACQ_UNLOCK();
 
 	return NULL;
 }
 
 /*
  * SADB_ACQUIRE processing,
  * in first situation, is receiving
  *   
  * from the ikmpd, and clear sequence of its secasvar entry.
  *
  * In second situation, is receiving
  *   
  * from a user land process, and return
  *   
  * to the socket.
  *
  * m will always be freed.
  */
 static int
 key_acquire2(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	const struct sadb_address *src0, *dst0;
 	struct secasindex saidx;
 	struct secashead *sah;
 	u_int16_t proto;
 	int error;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/*
 	 * Error message from KMd.
 	 * We assume that if error was occured in IKEd, the length of PFKEY
 	 * message is equal to the size of sadb_msg structure.
 	 * We do not raise error even if error occured in this function.
 	 */
 	if (mhp->msg->sadb_msg_len == PFKEY_UNIT64(sizeof(struct sadb_msg))) {
 		struct secacq *acq;
 
 		/* check sequence number */
 		if (mhp->msg->sadb_msg_seq == 0) {
 			ipseclog((LOG_DEBUG, "%s: must specify sequence "
 				"number.\n", __func__));
 			m_freem(m);
 			return 0;
 		}
 
 		if ((acq = key_getacqbyseq(mhp->msg->sadb_msg_seq)) == NULL) {
 			/*
 			 * the specified larval SA is already gone, or we got
 			 * a bogus sequence number.  we can silently ignore it.
 			 */
 			m_freem(m);
 			return 0;
 		}
 
 		/* reset acq counter in order to deletion by timehander. */
 		acq->created = time_second;
 		acq->count = 0;
 		m_freem(m);
 		return 0;
 	}
 
 	/*
 	 * This message is from user land.
 	 */
 
 	/* map satype to proto */
 	if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	if (mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	    mhp->ext[SADB_EXT_ADDRESS_DST] == NULL ||
 	    mhp->ext[SADB_EXT_PROPOSAL] == NULL) {
 		/* error */
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 	if (mhp->extlen[SADB_EXT_ADDRESS_SRC] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_ADDRESS_DST] < sizeof(struct sadb_address) ||
 	    mhp->extlen[SADB_EXT_PROPOSAL] < sizeof(struct sadb_prop)) {
 		/* error */
 		ipseclog((LOG_DEBUG, "%s: invalid message is passed.\n",	
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	src0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_SRC];
 	dst0 = (struct sadb_address *)mhp->ext[SADB_EXT_ADDRESS_DST];
 
 	/* XXX boundary check against sa_len */
 	KEY_SETSECASIDX(proto, IPSEC_MODE_ANY, 0, src0 + 1, dst0 + 1, &saidx);
 
 	/*
 	 * Make sure the port numbers are zero.
 	 * In case of NAT-T we will update them later if needed.
 	 */
 	KEY_PORTTOSADDR(&saidx.src, 0);
 	KEY_PORTTOSADDR(&saidx.dst, 0);
 
 #ifndef IPSEC_NAT_T
 	/*
 	 * Handle NAT-T info if present.
 	 */
 
 	if (mhp->ext[SADB_X_EXT_NAT_T_SPORT] != NULL &&
 	    mhp->ext[SADB_X_EXT_NAT_T_DPORT] != NULL) {
 		struct sadb_x_nat_t_port *sport, *dport;
 
 		if (mhp->extlen[SADB_X_EXT_NAT_T_SPORT] < sizeof(*sport) ||
 		    mhp->extlen[SADB_X_EXT_NAT_T_DPORT] < sizeof(*dport)) {
 			ipseclog((LOG_DEBUG, "%s: invalid message.\n",
 			    __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 
 		sport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_SPORT];
 		dport = (struct sadb_x_nat_t_port *)
 		    mhp->ext[SADB_X_EXT_NAT_T_DPORT];
 
 		if (sport)
 			KEY_PORTTOSADDR(&saidx.src,
 			    sport->sadb_x_nat_t_port_port);
 		if (dport)
 			KEY_PORTTOSADDR(&saidx.dst,
 			    dport->sadb_x_nat_t_port_port);
 	}
 #endif
 
 	/* get a SA index */
 	SAHTREE_LOCK();
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (sah->state == SADB_SASTATE_DEAD)
 			continue;
 		if (key_cmpsaidx(&sah->saidx, &saidx, CMP_MODE_REQID))
 			break;
 	}
 	SAHTREE_UNLOCK();
 	if (sah != NULL) {
 		ipseclog((LOG_DEBUG, "%s: a SA exists already.\n", __func__));
 		return key_senderror(so, m, EEXIST);
 	}
 
 	error = key_acquire(&saidx, NULL);
 	if (error != 0) {
 		ipseclog((LOG_DEBUG, "%s: error %d returned from key_acquire\n",
 			__func__, mhp->msg->sadb_msg_errno));
 		return key_senderror(so, m, error);
 	}
 
 	return key_sendup_mbuf(so, m, KEY_SENDUP_REGISTERED);
 }
 
 /*
  * SADB_REGISTER processing.
  * If SATYPE_UNSPEC has been passed as satype, only return sabd_supported.
  * receive
  *   
  * from the ikmpd, and register a socket to send PF_KEY messages,
  * and send
  *   
  * to KMD by PF_KEY.
  * If socket is detached, must free from regnode.
  *
  * m will always be freed.
  */
 static int
 key_register(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct secreg *reg, *newreg = 0;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* check for invalid register message */
 	if (mhp->msg->sadb_msg_satype >= sizeof(V_regtree)/sizeof(V_regtree[0]))
 		return key_senderror(so, m, EINVAL);
 
 	/* When SATYPE_UNSPEC is specified, only return sabd_supported. */
 	if (mhp->msg->sadb_msg_satype == SADB_SATYPE_UNSPEC)
 		goto setmsg;
 
 	/* check whether existing or not */
 	REGTREE_LOCK();
 	LIST_FOREACH(reg, &V_regtree[mhp->msg->sadb_msg_satype], chain) {
 		if (reg->so == so) {
 			REGTREE_UNLOCK();
 			ipseclog((LOG_DEBUG, "%s: socket exists already.\n",
 				__func__));
 			return key_senderror(so, m, EEXIST);
 		}
 	}
 
 	/* create regnode */
 	newreg =  malloc(sizeof(struct secreg), M_IPSEC_SAR, M_NOWAIT|M_ZERO);
 	if (newreg == NULL) {
 		REGTREE_UNLOCK();
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return key_senderror(so, m, ENOBUFS);
 	}
 
 	newreg->so = so;
 	((struct keycb *)sotorawcb(so))->kp_registered++;
 
 	/* add regnode to regtree. */
 	LIST_INSERT_HEAD(&V_regtree[mhp->msg->sadb_msg_satype], newreg, chain);
 	REGTREE_UNLOCK();
 
   setmsg:
     {
 	struct mbuf *n;
 	struct sadb_msg *newmsg;
 	struct sadb_supported *sup;
 	u_int len, alen, elen;
 	int off;
 	int i;
 	struct sadb_alg *alg;
 
 	/* create new sadb_msg to reply. */
 	alen = 0;
 	for (i = 1; i <= SADB_AALG_MAX; i++) {
 		if (ah_algorithm_lookup(i))
 			alen += sizeof(struct sadb_alg);
 	}
 	if (alen)
 		alen += sizeof(struct sadb_supported);
 	elen = 0;
 	for (i = 1; i <= SADB_EALG_MAX; i++) {
 		if (esp_algorithm_lookup(i))
 			elen += sizeof(struct sadb_alg);
 	}
 	if (elen)
 		elen += sizeof(struct sadb_supported);
 
 	len = sizeof(struct sadb_msg) + alen + elen;
 
 	if (len > MCLBYTES)
 		return key_senderror(so, m, ENOBUFS);
 
 	MGETHDR(n, M_NOWAIT, MT_DATA);
 	if (len > MHLEN) {
 		MCLGET(n, M_NOWAIT);
 		if ((n->m_flags & M_EXT) == 0) {
 			m_freem(n);
 			n = NULL;
 		}
 	}
 	if (!n)
 		return key_senderror(so, m, ENOBUFS);
 
 	n->m_pkthdr.len = n->m_len = len;
 	n->m_next = NULL;
 	off = 0;
 
 	m_copydata(m, 0, sizeof(struct sadb_msg), mtod(n, caddr_t) + off);
 	newmsg = mtod(n, struct sadb_msg *);
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(len);
 	off += PFKEY_ALIGN8(sizeof(struct sadb_msg));
 
 	/* for authentication algorithm */
 	if (alen) {
 		sup = (struct sadb_supported *)(mtod(n, caddr_t) + off);
 		sup->sadb_supported_len = PFKEY_UNIT64(alen);
 		sup->sadb_supported_exttype = SADB_EXT_SUPPORTED_AUTH;
 		off += PFKEY_ALIGN8(sizeof(*sup));
 
 		for (i = 1; i <= SADB_AALG_MAX; i++) {
 			struct auth_hash *aalgo;
 			u_int16_t minkeysize, maxkeysize;
 
 			aalgo = ah_algorithm_lookup(i);
 			if (!aalgo)
 				continue;
 			alg = (struct sadb_alg *)(mtod(n, caddr_t) + off);
 			alg->sadb_alg_id = i;
 			alg->sadb_alg_ivlen = 0;
 			key_getsizes_ah(aalgo, i, &minkeysize, &maxkeysize);
 			alg->sadb_alg_minbits = _BITS(minkeysize);
 			alg->sadb_alg_maxbits = _BITS(maxkeysize);
 			off += PFKEY_ALIGN8(sizeof(*alg));
 		}
 	}
 
 	/* for encryption algorithm */
 	if (elen) {
 		sup = (struct sadb_supported *)(mtod(n, caddr_t) + off);
 		sup->sadb_supported_len = PFKEY_UNIT64(elen);
 		sup->sadb_supported_exttype = SADB_EXT_SUPPORTED_ENCRYPT;
 		off += PFKEY_ALIGN8(sizeof(*sup));
 
 		for (i = 1; i <= SADB_EALG_MAX; i++) {
 			struct enc_xform *ealgo;
 
 			ealgo = esp_algorithm_lookup(i);
 			if (!ealgo)
 				continue;
 			alg = (struct sadb_alg *)(mtod(n, caddr_t) + off);
 			alg->sadb_alg_id = i;
 			alg->sadb_alg_ivlen = ealgo->blocksize;
 			alg->sadb_alg_minbits = _BITS(ealgo->minkey);
 			alg->sadb_alg_maxbits = _BITS(ealgo->maxkey);
 			off += PFKEY_ALIGN8(sizeof(struct sadb_alg));
 		}
 	}
 
 	IPSEC_ASSERT(off == len,
 		("length assumption failed (off %u len %u)", off, len));
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_REGISTERED);
     }
 }
 
 /*
  * free secreg entry registered.
  * XXX: I want to do free a socket marked done SADB_RESIGER to socket.
  */
 void
 key_freereg(struct socket *so)
 {
 	struct secreg *reg;
 	int i;
 
 	IPSEC_ASSERT(so != NULL, ("NULL so"));
 
 	/*
 	 * check whether existing or not.
 	 * check all type of SA, because there is a potential that
 	 * one socket is registered to multiple type of SA.
 	 */
 	REGTREE_LOCK();
 	for (i = 0; i <= SADB_SATYPE_MAX; i++) {
 		LIST_FOREACH(reg, &V_regtree[i], chain) {
 			if (reg->so == so && __LIST_CHAINED(reg)) {
 				LIST_REMOVE(reg, chain);
 				free(reg, M_IPSEC_SAR);
 				break;
 			}
 		}
 	}
 	REGTREE_UNLOCK();
 }
 
 /*
  * SADB_EXPIRE processing
  * send
  *   
  * to KMD by PF_KEY.
  * NOTE: We send only soft lifetime extension.
  *
  * OUT:	0	: succeed
  *	others	: error number
  */
 static int
 key_expire(struct secasvar *sav)
 {
 	int satype;
 	struct mbuf *result = NULL, *m;
 	int len;
 	int error = -1;
 	struct sadb_lifetime *lt;
 
 	IPSEC_ASSERT (sav != NULL, ("null sav"));
 	IPSEC_ASSERT (sav->sah != NULL, ("null sa header"));
 
 	/* set msg header */
 	satype = key_proto2satype(sav->sah->saidx.proto);
 	IPSEC_ASSERT(satype != 0, ("invalid proto, satype %u", satype));
 	m = key_setsadbmsg(SADB_EXPIRE, 0, satype, sav->seq, 0, sav->refcnt);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	result = m;
 
 	/* create SA extension */
 	m = key_setsadbsa(sav);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	/* create SA extension */
 	m = key_setsadbxsa2(sav->sah->saidx.mode,
 			sav->replay ? sav->replay->count : 0,
 			sav->sah->saidx.reqid);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	/* create lifetime extension (current and soft) */
 	len = PFKEY_ALIGN8(sizeof(*lt)) * 2;
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_align(m, len);
 	m->m_len = len;
 	bzero(mtod(m, caddr_t), len);
 	lt = mtod(m, struct sadb_lifetime *);
 	lt->sadb_lifetime_len = PFKEY_UNIT64(sizeof(struct sadb_lifetime));
 	lt->sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT;
 	lt->sadb_lifetime_allocations = sav->lft_c->allocations;
 	lt->sadb_lifetime_bytes = sav->lft_c->bytes;
 	lt->sadb_lifetime_addtime = sav->lft_c->addtime;
 	lt->sadb_lifetime_usetime = sav->lft_c->usetime;
 	lt = (struct sadb_lifetime *)(mtod(m, caddr_t) + len / 2);
 	lt->sadb_lifetime_len = PFKEY_UNIT64(sizeof(struct sadb_lifetime));
 	lt->sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT;
 	lt->sadb_lifetime_allocations = sav->lft_s->allocations;
 	lt->sadb_lifetime_bytes = sav->lft_s->bytes;
 	lt->sadb_lifetime_addtime = sav->lft_s->addtime;
 	lt->sadb_lifetime_usetime = sav->lft_s->usetime;
 	m_cat(result, m);
 
 	/* set sadb_address for source */
 	m = key_setsadbaddr(SADB_EXT_ADDRESS_SRC,
 	    &sav->sah->saidx.src.sa,
 	    FULLMASK, IPSEC_ULPROTO_ANY);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	/* set sadb_address for destination */
 	m = key_setsadbaddr(SADB_EXT_ADDRESS_DST,
 	    &sav->sah->saidx.dst.sa,
 	    FULLMASK, IPSEC_ULPROTO_ANY);
 	if (!m) {
 		error = ENOBUFS;
 		goto fail;
 	}
 	m_cat(result, m);
 
 	/*
 	 * XXX-BZ Handle NAT-T extensions here.
 	 */
 
 	if ((result->m_flags & M_PKTHDR) == 0) {
 		error = EINVAL;
 		goto fail;
 	}
 
 	if (result->m_len < sizeof(struct sadb_msg)) {
 		result = m_pullup(result, sizeof(struct sadb_msg));
 		if (result == NULL) {
 			error = ENOBUFS;
 			goto fail;
 		}
 	}
 
 	result->m_pkthdr.len = 0;
 	for (m = result; m; m = m->m_next)
 		result->m_pkthdr.len += m->m_len;
 
 	mtod(result, struct sadb_msg *)->sadb_msg_len =
 	    PFKEY_UNIT64(result->m_pkthdr.len);
 
 	return key_sendup_mbuf(NULL, result, KEY_SENDUP_REGISTERED);
 
  fail:
 	if (result)
 		m_freem(result);
 	return error;
 }
 
 /*
  * SADB_FLUSH processing
  * receive
  *   
  * from the ikmpd, and free all entries in secastree.
  * and send,
  *   
  * to the ikmpd.
  * NOTE: to do is only marking SADB_SASTATE_DEAD.
  *
  * m will always be freed.
  */
 static int
 key_flush(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct sadb_msg *newmsg;
 	struct secashead *sah, *nextsah;
 	struct secasvar *sav, *nextsav;
 	u_int16_t proto;
 	u_int8_t state;
 	u_int stateidx;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* map satype to proto */
 	if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/* no SATYPE specified, i.e. flushing all SA. */
 	SAHTREE_LOCK();
 	for (sah = LIST_FIRST(&V_sahtree);
 	     sah != NULL;
 	     sah = nextsah) {
 		nextsah = LIST_NEXT(sah, chain);
 
 		if (mhp->msg->sadb_msg_satype != SADB_SATYPE_UNSPEC
 		 && proto != sah->saidx.proto)
 			continue;
 
 		for (stateidx = 0;
 		     stateidx < _ARRAYLEN(saorder_state_alive);
 		     stateidx++) {
 			state = saorder_state_any[stateidx];
 			for (sav = LIST_FIRST(&sah->savtree[state]);
 			     sav != NULL;
 			     sav = nextsav) {
 
 				nextsav = LIST_NEXT(sav, chain);
 
 				key_sa_chgstate(sav, SADB_SASTATE_DEAD);
 				KEY_FREESAV(&sav);
 			}
 		}
 
 		sah->state = SADB_SASTATE_DEAD;
 	}
 	SAHTREE_UNLOCK();
 
 	if (m->m_len < sizeof(struct sadb_msg) ||
 	    sizeof(struct sadb_msg) > m->m_len + M_TRAILINGSPACE(m)) {
 		ipseclog((LOG_DEBUG, "%s: No more memory.\n", __func__));
 		return key_senderror(so, m, ENOBUFS);
 	}
 
 	if (m->m_next)
 		m_freem(m->m_next);
 	m->m_next = NULL;
 	m->m_pkthdr.len = m->m_len = sizeof(struct sadb_msg);
 	newmsg = mtod(m, struct sadb_msg *);
 	newmsg->sadb_msg_errno = 0;
 	newmsg->sadb_msg_len = PFKEY_UNIT64(m->m_pkthdr.len);
 
 	return key_sendup_mbuf(so, m, KEY_SENDUP_ALL);
 }
 
 /*
  * SADB_DUMP processing
  * dump all entries including status of DEAD in SAD.
  * receive
  *   
  * from the ikmpd, and dump all secasvar leaves
  * and send,
  *    .....
  * to the ikmpd.
  *
  * m will always be freed.
  */
 static int
 key_dump(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	struct secashead *sah;
 	struct secasvar *sav;
 	u_int16_t proto;
 	u_int stateidx;
 	u_int8_t satype;
 	u_int8_t state;
 	int cnt;
 	struct sadb_msg *newmsg;
 	struct mbuf *n;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	/* map satype to proto */
 	if ((proto = key_satype2proto(mhp->msg->sadb_msg_satype)) == 0) {
 		ipseclog((LOG_DEBUG, "%s: invalid satype is passed.\n",
 			__func__));
 		return key_senderror(so, m, EINVAL);
 	}
 
 	/* count sav entries to be sent to the userland. */
 	cnt = 0;
 	SAHTREE_LOCK();
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (mhp->msg->sadb_msg_satype != SADB_SATYPE_UNSPEC
 		 && proto != sah->saidx.proto)
 			continue;
 
 		for (stateidx = 0;
 		     stateidx < _ARRAYLEN(saorder_state_any);
 		     stateidx++) {
 			state = saorder_state_any[stateidx];
 			LIST_FOREACH(sav, &sah->savtree[state], chain) {
 				cnt++;
 			}
 		}
 	}
 
 	if (cnt == 0) {
 		SAHTREE_UNLOCK();
 		return key_senderror(so, m, ENOENT);
 	}
 
 	/* send this to the userland, one at a time. */
 	newmsg = NULL;
 	LIST_FOREACH(sah, &V_sahtree, chain) {
 		if (mhp->msg->sadb_msg_satype != SADB_SATYPE_UNSPEC
 		 && proto != sah->saidx.proto)
 			continue;
 
 		/* map proto to satype */
 		if ((satype = key_proto2satype(sah->saidx.proto)) == 0) {
 			SAHTREE_UNLOCK();
 			ipseclog((LOG_DEBUG, "%s: there was invalid proto in "
 				"SAD.\n", __func__));
 			return key_senderror(so, m, EINVAL);
 		}
 
 		for (stateidx = 0;
 		     stateidx < _ARRAYLEN(saorder_state_any);
 		     stateidx++) {
 			state = saorder_state_any[stateidx];
 			LIST_FOREACH(sav, &sah->savtree[state], chain) {
 				n = key_setdumpsa(sav, SADB_DUMP, satype,
 				    --cnt, mhp->msg->sadb_msg_pid);
 				if (!n) {
 					SAHTREE_UNLOCK();
 					return key_senderror(so, m, ENOBUFS);
 				}
 				key_sendup_mbuf(so, n, KEY_SENDUP_ONE);
 			}
 		}
 	}
 	SAHTREE_UNLOCK();
 
 	m_freem(m);
 	return 0;
 }
 
 /*
  * SADB_X_PROMISC processing
  *
  * m will always be freed.
  */
 static int
 key_promisc(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp)
 {
 	int olen;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(mhp->msg != NULL, ("null msg"));
 
 	olen = PFKEY_UNUNIT64(mhp->msg->sadb_msg_len);
 
 	if (olen < sizeof(struct sadb_msg)) {
 #if 1
 		return key_senderror(so, m, EINVAL);
 #else
 		m_freem(m);
 		return 0;
 #endif
 	} else if (olen == sizeof(struct sadb_msg)) {
 		/* enable/disable promisc mode */
 		struct keycb *kp;
 
 		if ((kp = (struct keycb *)sotorawcb(so)) == NULL)
 			return key_senderror(so, m, EINVAL);
 		mhp->msg->sadb_msg_errno = 0;
 		switch (mhp->msg->sadb_msg_satype) {
 		case 0:
 		case 1:
 			kp->kp_promisc = mhp->msg->sadb_msg_satype;
 			break;
 		default:
 			return key_senderror(so, m, EINVAL);
 		}
 
 		/* send the original message back to everyone */
 		mhp->msg->sadb_msg_errno = 0;
 		return key_sendup_mbuf(so, m, KEY_SENDUP_ALL);
 	} else {
 		/* send packet as is */
 
 		m_adj(m, PFKEY_ALIGN8(sizeof(struct sadb_msg)));
 
 		/* TODO: if sadb_msg_seq is specified, send to specific pid */
 		return key_sendup_mbuf(so, m, KEY_SENDUP_ALL);
 	}
 }
 
 static int (*key_typesw[])(struct socket *, struct mbuf *,
 		const struct sadb_msghdr *) = {
 	NULL,		/* SADB_RESERVED */
 	key_getspi,	/* SADB_GETSPI */
 	key_update,	/* SADB_UPDATE */
 	key_add,	/* SADB_ADD */
 	key_delete,	/* SADB_DELETE */
 	key_get,	/* SADB_GET */
 	key_acquire2,	/* SADB_ACQUIRE */
 	key_register,	/* SADB_REGISTER */
 	NULL,		/* SADB_EXPIRE */
 	key_flush,	/* SADB_FLUSH */
 	key_dump,	/* SADB_DUMP */
 	key_promisc,	/* SADB_X_PROMISC */
 	NULL,		/* SADB_X_PCHANGE */
 	key_spdadd,	/* SADB_X_SPDUPDATE */
 	key_spdadd,	/* SADB_X_SPDADD */
 	key_spddelete,	/* SADB_X_SPDDELETE */
 	key_spdget,	/* SADB_X_SPDGET */
 	NULL,		/* SADB_X_SPDACQUIRE */
 	key_spddump,	/* SADB_X_SPDDUMP */
 	key_spdflush,	/* SADB_X_SPDFLUSH */
 	key_spdadd,	/* SADB_X_SPDSETIDX */
 	NULL,		/* SADB_X_SPDEXPIRE */
 	key_spddelete2,	/* SADB_X_SPDDELETE2 */
 };
 
 /*
  * parse sadb_msg buffer to process PFKEYv2,
  * and create a data to response if needed.
  * I think to be dealed with mbuf directly.
  * IN:
  *     msgp  : pointer to pointer to a received buffer pulluped.
  *             This is rewrited to response.
  *     so    : pointer to socket.
  * OUT:
  *    length for buffer to send to user process.
  */
 int
 key_parse(struct mbuf *m, struct socket *so)
 {
 	struct sadb_msg *msg;
 	struct sadb_msghdr mh;
 	u_int orglen;
 	int error;
 	int target;
 
 	IPSEC_ASSERT(so != NULL, ("null socket"));
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 
 #if 0	/*kdebug_sadb assumes msg in linear buffer*/
 	KEYDEBUG(KEYDEBUG_KEY_DUMP,
 		ipseclog((LOG_DEBUG, "%s: passed sadb_msg\n", __func__));
 		kdebug_sadb(msg));
 #endif
 
 	if (m->m_len < sizeof(struct sadb_msg)) {
 		m = m_pullup(m, sizeof(struct sadb_msg));
 		if (!m)
 			return ENOBUFS;
 	}
 	msg = mtod(m, struct sadb_msg *);
 	orglen = PFKEY_UNUNIT64(msg->sadb_msg_len);
 	target = KEY_SENDUP_ONE;
 
 	if ((m->m_flags & M_PKTHDR) == 0 ||
 	    m->m_pkthdr.len != m->m_pkthdr.len) {
 		ipseclog((LOG_DEBUG, "%s: invalid message length.\n",__func__));
 		PFKEYSTAT_INC(out_invlen);
 		error = EINVAL;
 		goto senderror;
 	}
 
 	if (msg->sadb_msg_version != PF_KEY_V2) {
 		ipseclog((LOG_DEBUG, "%s: PF_KEY version %u is mismatched.\n",
 		    __func__, msg->sadb_msg_version));
 		PFKEYSTAT_INC(out_invver);
 		error = EINVAL;
 		goto senderror;
 	}
 
 	if (msg->sadb_msg_type > SADB_MAX) {
 		ipseclog((LOG_DEBUG, "%s: invalid type %u is passed.\n",
 		    __func__, msg->sadb_msg_type));
 		PFKEYSTAT_INC(out_invmsgtype);
 		error = EINVAL;
 		goto senderror;
 	}
 
 	/* for old-fashioned code - should be nuked */
 	if (m->m_pkthdr.len > MCLBYTES) {
 		m_freem(m);
 		return ENOBUFS;
 	}
 	if (m->m_next) {
 		struct mbuf *n;
 
 		MGETHDR(n, M_NOWAIT, MT_DATA);
 		if (n && m->m_pkthdr.len > MHLEN) {
 			MCLGET(n, M_NOWAIT);
 			if ((n->m_flags & M_EXT) == 0) {
 				m_free(n);
 				n = NULL;
 			}
 		}
 		if (!n) {
 			m_freem(m);
 			return ENOBUFS;
 		}
 		m_copydata(m, 0, m->m_pkthdr.len, mtod(n, caddr_t));
 		n->m_pkthdr.len = n->m_len = m->m_pkthdr.len;
 		n->m_next = NULL;
 		m_freem(m);
 		m = n;
 	}
 
 	/* align the mbuf chain so that extensions are in contiguous region. */
 	error = key_align(m, &mh);
 	if (error)
 		return error;
 
 	msg = mh.msg;
 
 	/* check SA type */
 	switch (msg->sadb_msg_satype) {
 	case SADB_SATYPE_UNSPEC:
 		switch (msg->sadb_msg_type) {
 		case SADB_GETSPI:
 		case SADB_UPDATE:
 		case SADB_ADD:
 		case SADB_DELETE:
 		case SADB_GET:
 		case SADB_ACQUIRE:
 		case SADB_EXPIRE:
 			ipseclog((LOG_DEBUG, "%s: must specify satype "
 			    "when msg type=%u.\n", __func__,
 			    msg->sadb_msg_type));
 			PFKEYSTAT_INC(out_invsatype);
 			error = EINVAL;
 			goto senderror;
 		}
 		break;
 	case SADB_SATYPE_AH:
 	case SADB_SATYPE_ESP:
 	case SADB_X_SATYPE_IPCOMP:
 	case SADB_X_SATYPE_TCPSIGNATURE:
 		switch (msg->sadb_msg_type) {
 		case SADB_X_SPDADD:
 		case SADB_X_SPDDELETE:
 		case SADB_X_SPDGET:
 		case SADB_X_SPDDUMP:
 		case SADB_X_SPDFLUSH:
 		case SADB_X_SPDSETIDX:
 		case SADB_X_SPDUPDATE:
 		case SADB_X_SPDDELETE2:
 			ipseclog((LOG_DEBUG, "%s: illegal satype=%u\n",
 				__func__, msg->sadb_msg_type));
 			PFKEYSTAT_INC(out_invsatype);
 			error = EINVAL;
 			goto senderror;
 		}
 		break;
 	case SADB_SATYPE_RSVP:
 	case SADB_SATYPE_OSPFV2:
 	case SADB_SATYPE_RIPV2:
 	case SADB_SATYPE_MIP:
 		ipseclog((LOG_DEBUG, "%s: type %u isn't supported.\n",
 			__func__, msg->sadb_msg_satype));
 		PFKEYSTAT_INC(out_invsatype);
 		error = EOPNOTSUPP;
 		goto senderror;
 	case 1:	/* XXX: What does it do? */
 		if (msg->sadb_msg_type == SADB_X_PROMISC)
 			break;
 		/*FALLTHROUGH*/
 	default:
 		ipseclog((LOG_DEBUG, "%s: invalid type %u is passed.\n",
 			__func__, msg->sadb_msg_satype));
 		PFKEYSTAT_INC(out_invsatype);
 		error = EINVAL;
 		goto senderror;
 	}
 
 	/* check field of upper layer protocol and address family */
 	if (mh.ext[SADB_EXT_ADDRESS_SRC] != NULL
 	 && mh.ext[SADB_EXT_ADDRESS_DST] != NULL) {
 		struct sadb_address *src0, *dst0;
 		u_int plen;
 
 		src0 = (struct sadb_address *)(mh.ext[SADB_EXT_ADDRESS_SRC]);
 		dst0 = (struct sadb_address *)(mh.ext[SADB_EXT_ADDRESS_DST]);
 
 		/* check upper layer protocol */
 		if (src0->sadb_address_proto != dst0->sadb_address_proto) {
 			ipseclog((LOG_DEBUG, "%s: upper layer protocol "
 				"mismatched.\n", __func__));
 			PFKEYSTAT_INC(out_invaddr);
 			error = EINVAL;
 			goto senderror;
 		}
 
 		/* check family */
 		if (PFKEY_ADDR_SADDR(src0)->sa_family !=
 		    PFKEY_ADDR_SADDR(dst0)->sa_family) {
 			ipseclog((LOG_DEBUG, "%s: address family mismatched.\n",
 				__func__));
 			PFKEYSTAT_INC(out_invaddr);
 			error = EINVAL;
 			goto senderror;
 		}
 		if (PFKEY_ADDR_SADDR(src0)->sa_len !=
 		    PFKEY_ADDR_SADDR(dst0)->sa_len) {
 			ipseclog((LOG_DEBUG, "%s: address struct size "
 				"mismatched.\n", __func__));
 			PFKEYSTAT_INC(out_invaddr);
 			error = EINVAL;
 			goto senderror;
 		}
 
 		switch (PFKEY_ADDR_SADDR(src0)->sa_family) {
 		case AF_INET:
 			if (PFKEY_ADDR_SADDR(src0)->sa_len !=
 			    sizeof(struct sockaddr_in)) {
 				PFKEYSTAT_INC(out_invaddr);
 				error = EINVAL;
 				goto senderror;
 			}
 			break;
 		case AF_INET6:
 			if (PFKEY_ADDR_SADDR(src0)->sa_len !=
 			    sizeof(struct sockaddr_in6)) {
 				PFKEYSTAT_INC(out_invaddr);
 				error = EINVAL;
 				goto senderror;
 			}
 			break;
 		default:
 			ipseclog((LOG_DEBUG, "%s: unsupported address family\n",
 				__func__));
 			PFKEYSTAT_INC(out_invaddr);
 			error = EAFNOSUPPORT;
 			goto senderror;
 		}
 
 		switch (PFKEY_ADDR_SADDR(src0)->sa_family) {
 		case AF_INET:
 			plen = sizeof(struct in_addr) << 3;
 			break;
 		case AF_INET6:
 			plen = sizeof(struct in6_addr) << 3;
 			break;
 		default:
 			plen = 0;	/*fool gcc*/
 			break;
 		}
 
 		/* check max prefix length */
 		if (src0->sadb_address_prefixlen > plen ||
 		    dst0->sadb_address_prefixlen > plen) {
 			ipseclog((LOG_DEBUG, "%s: illegal prefixlen.\n",
 				__func__));
 			PFKEYSTAT_INC(out_invaddr);
 			error = EINVAL;
 			goto senderror;
 		}
 
 		/*
 		 * prefixlen == 0 is valid because there can be a case when
 		 * all addresses are matched.
 		 */
 	}
 
 	if (msg->sadb_msg_type >= sizeof(key_typesw)/sizeof(key_typesw[0]) ||
 	    key_typesw[msg->sadb_msg_type] == NULL) {
 		PFKEYSTAT_INC(out_invmsgtype);
 		error = EINVAL;
 		goto senderror;
 	}
 
 	return (*key_typesw[msg->sadb_msg_type])(so, m, &mh);
 
 senderror:
 	msg->sadb_msg_errno = error;
 	return key_sendup_mbuf(so, m, target);
 }
 
 static int
 key_senderror(struct socket *so, struct mbuf *m, int code)
 {
 	struct sadb_msg *msg;
 
 	IPSEC_ASSERT(m->m_len >= sizeof(struct sadb_msg),
 		("mbuf too small, len %u", m->m_len));
 
 	msg = mtod(m, struct sadb_msg *);
 	msg->sadb_msg_errno = code;
 	return key_sendup_mbuf(so, m, KEY_SENDUP_ONE);
 }
 
 /*
  * set the pointer to each header into message buffer.
  * m will be freed on error.
  * XXX larger-than-MCLBYTES extension?
  */
 static int
 key_align(struct mbuf *m, struct sadb_msghdr *mhp)
 {
 	struct mbuf *n;
 	struct sadb_ext *ext;
 	size_t off, end;
 	int extlen;
 	int toff;
 
 	IPSEC_ASSERT(m != NULL, ("null mbuf"));
 	IPSEC_ASSERT(mhp != NULL, ("null msghdr"));
 	IPSEC_ASSERT(m->m_len >= sizeof(struct sadb_msg),
 		("mbuf too small, len %u", m->m_len));
 
 	/* initialize */
 	bzero(mhp, sizeof(*mhp));
 
 	mhp->msg = mtod(m, struct sadb_msg *);
 	mhp->ext[0] = (struct sadb_ext *)mhp->msg;	/*XXX backward compat */
 
 	end = PFKEY_UNUNIT64(mhp->msg->sadb_msg_len);
 	extlen = end;	/*just in case extlen is not updated*/
 	for (off = sizeof(struct sadb_msg); off < end; off += extlen) {
 		n = m_pulldown(m, off, sizeof(struct sadb_ext), &toff);
 		if (!n) {
 			/* m is already freed */
 			return ENOBUFS;
 		}
 		ext = (struct sadb_ext *)(mtod(n, caddr_t) + toff);
 
 		/* set pointer */
 		switch (ext->sadb_ext_type) {
 		case SADB_EXT_SA:
 		case SADB_EXT_ADDRESS_SRC:
 		case SADB_EXT_ADDRESS_DST:
 		case SADB_EXT_ADDRESS_PROXY:
 		case SADB_EXT_LIFETIME_CURRENT:
 		case SADB_EXT_LIFETIME_HARD:
 		case SADB_EXT_LIFETIME_SOFT:
 		case SADB_EXT_KEY_AUTH:
 		case SADB_EXT_KEY_ENCRYPT:
 		case SADB_EXT_IDENTITY_SRC:
 		case SADB_EXT_IDENTITY_DST:
 		case SADB_EXT_SENSITIVITY:
 		case SADB_EXT_PROPOSAL:
 		case SADB_EXT_SUPPORTED_AUTH:
 		case SADB_EXT_SUPPORTED_ENCRYPT:
 		case SADB_EXT_SPIRANGE:
 		case SADB_X_EXT_POLICY:
 		case SADB_X_EXT_SA2:
 #ifdef IPSEC_NAT_T
 		case SADB_X_EXT_NAT_T_TYPE:
 		case SADB_X_EXT_NAT_T_SPORT:
 		case SADB_X_EXT_NAT_T_DPORT:
 		case SADB_X_EXT_NAT_T_OAI:
 		case SADB_X_EXT_NAT_T_OAR:
 		case SADB_X_EXT_NAT_T_FRAG:
 #endif
 			/* duplicate check */
 			/*
 			 * XXX Are there duplication payloads of either
 			 * KEY_AUTH or KEY_ENCRYPT ?
 			 */
 			if (mhp->ext[ext->sadb_ext_type] != NULL) {
 				ipseclog((LOG_DEBUG, "%s: duplicate ext_type "
 					"%u\n", __func__, ext->sadb_ext_type));
 				m_freem(m);
 				PFKEYSTAT_INC(out_dupext);
 				return EINVAL;
 			}
 			break;
 		default:
 			ipseclog((LOG_DEBUG, "%s: invalid ext_type %u\n",
 				__func__, ext->sadb_ext_type));
 			m_freem(m);
 			PFKEYSTAT_INC(out_invexttype);
 			return EINVAL;
 		}
 
 		extlen = PFKEY_UNUNIT64(ext->sadb_ext_len);
 
 		if (key_validate_ext(ext, extlen)) {
 			m_freem(m);
 			PFKEYSTAT_INC(out_invlen);
 			return EINVAL;
 		}
 
 		n = m_pulldown(m, off, extlen, &toff);
 		if (!n) {
 			/* m is already freed */
 			return ENOBUFS;
 		}
 		ext = (struct sadb_ext *)(mtod(n, caddr_t) + toff);
 
 		mhp->ext[ext->sadb_ext_type] = ext;
 		mhp->extoff[ext->sadb_ext_type] = off;
 		mhp->extlen[ext->sadb_ext_type] = extlen;
 	}
 
 	if (off != end) {
 		m_freem(m);
 		PFKEYSTAT_INC(out_invlen);
 		return EINVAL;
 	}
 
 	return 0;
 }
 
 static int
 key_validate_ext(const struct sadb_ext *ext, int len)
 {
 	const struct sockaddr *sa;
 	enum { NONE, ADDR } checktype = NONE;
 	int baselen = 0;
 	const int sal = offsetof(struct sockaddr, sa_len) + sizeof(sa->sa_len);
 
 	if (len != PFKEY_UNUNIT64(ext->sadb_ext_len))
 		return EINVAL;
 
 	/* if it does not match minimum/maximum length, bail */
 	if (ext->sadb_ext_type >= sizeof(minsize) / sizeof(minsize[0]) ||
 	    ext->sadb_ext_type >= sizeof(maxsize) / sizeof(maxsize[0]))
 		return EINVAL;
 	if (!minsize[ext->sadb_ext_type] || len < minsize[ext->sadb_ext_type])
 		return EINVAL;
 	if (maxsize[ext->sadb_ext_type] && len > maxsize[ext->sadb_ext_type])
 		return EINVAL;
 
 	/* more checks based on sadb_ext_type XXX need more */
 	switch (ext->sadb_ext_type) {
 	case SADB_EXT_ADDRESS_SRC:
 	case SADB_EXT_ADDRESS_DST:
 	case SADB_EXT_ADDRESS_PROXY:
 		baselen = PFKEY_ALIGN8(sizeof(struct sadb_address));
 		checktype = ADDR;
 		break;
 	case SADB_EXT_IDENTITY_SRC:
 	case SADB_EXT_IDENTITY_DST:
 		if (((const struct sadb_ident *)ext)->sadb_ident_type ==
 		    SADB_X_IDENTTYPE_ADDR) {
 			baselen = PFKEY_ALIGN8(sizeof(struct sadb_ident));
 			checktype = ADDR;
 		} else
 			checktype = NONE;
 		break;
 	default:
 		checktype = NONE;
 		break;
 	}
 
 	switch (checktype) {
 	case NONE:
 		break;
 	case ADDR:
 		sa = (const struct sockaddr *)(((const u_int8_t*)ext)+baselen);
 		if (len < baselen + sal)
 			return EINVAL;
 		if (baselen + PFKEY_ALIGN8(sa->sa_len) != len)
 			return EINVAL;
 		break;
 	}
 
 	return 0;
 }
 
 void
 key_init(void)
 {
 	int i;
 
 	for (i = 0; i < IPSEC_DIR_MAX; i++)
-		LIST_INIT(&V_sptree[i]);
+		TAILQ_INIT(&V_sptree[i]);
 
 	LIST_INIT(&V_sahtree);
 
 	for (i = 0; i <= SADB_SATYPE_MAX; i++)
 		LIST_INIT(&V_regtree[i]);
 
 	LIST_INIT(&V_acqtree);
 	LIST_INIT(&V_spacqtree);
 
-	/* system default */
-	V_ip4_def_policy.policy = IPSEC_POLICY_NONE;
-	V_ip4_def_policy.refcnt++;	/*never reclaim this*/
-
 	if (!IS_DEFAULT_VNET(curvnet))
 		return;
 
 	SPTREE_LOCK_INIT();
 	REGTREE_LOCK_INIT();
 	SAHTREE_LOCK_INIT();
 	ACQ_LOCK_INIT();
 	SPACQ_LOCK_INIT();
 
 #ifndef IPSEC_DEBUG2
 	callout_init(&key_timer, CALLOUT_MPSAFE);
 	callout_reset(&key_timer, hz, key_timehandler, NULL);
 #endif /*IPSEC_DEBUG2*/
 
 	/* initialize key statistics */
 	keystat.getspi_count = 1;
 
 	printf("IPsec: Initialized Security Association Processing.\n");
 }
 
 #ifdef VIMAGE
 void
 key_destroy(void)
 {
+	TAILQ_HEAD(, secpolicy) drainq;
 	struct secpolicy *sp, *nextsp;
 	struct secacq *acq, *nextacq;
 	struct secspacq *spacq, *nextspacq;
 	struct secashead *sah, *nextsah;
 	struct secreg *reg;
 	int i;
 
-	SPTREE_LOCK();
+	TAILQ_INIT(&drainq);
+	SPTREE_WLOCK();
 	for (i = 0; i < IPSEC_DIR_MAX; i++) {
-		for (sp = LIST_FIRST(&V_sptree[i]); 
-		    sp != NULL; sp = nextsp) {
-			nextsp = LIST_NEXT(sp, chain);
-			if (__LIST_CHAINED(sp)) {
-				LIST_REMOVE(sp, chain);
-				free(sp, M_IPSEC_SP);
-			}
-		}
+		TAILQ_CONCAT(&drainq, &V_sptree[i], chain);
 	}
-	SPTREE_UNLOCK();
+	SPTREE_WUNLOCK();
+	sp = TAILQ_FIRST(&drainq);
+	while (sp != NULL) {
+		nextsp = TAILQ_NEXT(sp, chain);
+		KEY_FREESP(&sp);
+		sp = nextsp;
+	}
 
 	SAHTREE_LOCK();
 	for (sah = LIST_FIRST(&V_sahtree); sah != NULL; sah = nextsah) {
 		nextsah = LIST_NEXT(sah, chain);
 		if (__LIST_CHAINED(sah)) {
 			LIST_REMOVE(sah, chain);
 			free(sah, M_IPSEC_SAH);
 		}
 	}
 	SAHTREE_UNLOCK();
 
 	REGTREE_LOCK();
 	for (i = 0; i <= SADB_SATYPE_MAX; i++) {
 		LIST_FOREACH(reg, &V_regtree[i], chain) {
 			if (__LIST_CHAINED(reg)) {
 				LIST_REMOVE(reg, chain);
 				free(reg, M_IPSEC_SAR);
 				break;
 			}
 		}
 	}
 	REGTREE_UNLOCK();
 
 	ACQ_LOCK();
 	for (acq = LIST_FIRST(&V_acqtree); acq != NULL; acq = nextacq) {
 		nextacq = LIST_NEXT(acq, chain);
 		if (__LIST_CHAINED(acq)) {
 			LIST_REMOVE(acq, chain);
 			free(acq, M_IPSEC_SAQ);
 		}
 	}
 	ACQ_UNLOCK();
 
 	SPACQ_LOCK();
 	for (spacq = LIST_FIRST(&V_spacqtree); spacq != NULL;
 	    spacq = nextspacq) {
 		nextspacq = LIST_NEXT(spacq, chain);
 		if (__LIST_CHAINED(spacq)) {
 			LIST_REMOVE(spacq, chain);
 			free(spacq, M_IPSEC_SAQ);
 		}
 	}
 	SPACQ_UNLOCK();
 }
 #endif
 
 /*
  * XXX: maybe This function is called after INBOUND IPsec processing.
  *
  * Special check for tunnel-mode packets.
  * We must make some checks for consistency between inner and outer IP header.
  *
  * xxx more checks to be provided
  */
 int
 key_checktunnelsanity(struct secasvar *sav, u_int family, caddr_t src,
     caddr_t dst)
 {
 	IPSEC_ASSERT(sav->sah != NULL, ("null SA header"));
 
 	/* XXX: check inner IP header */
 
 	return 1;
 }
 
 /* record data transfer on SA, and update timestamps */
 void
 key_sa_recordxfer(struct secasvar *sav, struct mbuf *m)
 {
 	IPSEC_ASSERT(sav != NULL, ("Null secasvar"));
 	IPSEC_ASSERT(m != NULL, ("Null mbuf"));
 	if (!sav->lft_c)
 		return;
 
 	/*
 	 * XXX Currently, there is a difference of bytes size
 	 * between inbound and outbound processing.
 	 */
 	sav->lft_c->bytes += m->m_pkthdr.len;
 	/* to check bytes lifetime is done in key_timehandler(). */
 
 	/*
 	 * We use the number of packets as the unit of
 	 * allocations.  We increment the variable
 	 * whenever {esp,ah}_{in,out}put is called.
 	 */
 	sav->lft_c->allocations++;
 	/* XXX check for expires? */
 
 	/*
 	 * NOTE: We record CURRENT usetime by using wall clock,
 	 * in seconds.  HARD and SOFT lifetime are measured by the time
 	 * difference (again in seconds) from usetime.
 	 *
 	 *	usetime
 	 *	v     expire   expire
 	 * -----+-----+--------+---> t
 	 *	<--------------> HARD
 	 *	<-----> SOFT
 	 */
 	sav->lft_c->usetime = time_second;
 	/* XXX check for expires? */
 
 	return;
 }
 
 static void
 key_sa_chgstate(struct secasvar *sav, u_int8_t state)
 {
 	IPSEC_ASSERT(sav != NULL, ("NULL sav"));
 	SAHTREE_LOCK_ASSERT();
 
 	if (sav->state != state) {
 		if (__LIST_CHAINED(sav))
 			LIST_REMOVE(sav, chain);
 		sav->state = state;
 		LIST_INSERT_HEAD(&sav->sah->savtree[state], sav, chain);
 	}
 }
 
 void
 key_sa_stir_iv(struct secasvar *sav)
 {
 
 	IPSEC_ASSERT(sav->iv != NULL, ("null IV"));
 	key_randomfill(sav->iv, sav->ivlen);
 }
 
 /*
  * Take one of the kernel's security keys and convert it into a PF_KEY
  * structure within an mbuf, suitable for sending up to a waiting
  * application in user land.
  * 
  * IN: 
  *    src: A pointer to a kernel security key.
  *    exttype: Which type of key this is. Refer to the PF_KEY data structures.
  * OUT:
  *    a valid mbuf or NULL indicating an error
  *
  */
 
 static struct mbuf *
 key_setkey(struct seckey *src, u_int16_t exttype) 
 {
 	struct mbuf *m;
 	struct sadb_key *p;
 	int len;
 
 	if (src == NULL)
 		return NULL;
 
 	len = PFKEY_ALIGN8(sizeof(struct sadb_key) + _KEYLEN(src));
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return NULL;
 	m_align(m, len);
 	m->m_len = len;
 	p = mtod(m, struct sadb_key *);
 	bzero(p, len);
 	p->sadb_key_len = PFKEY_UNIT64(len);
 	p->sadb_key_exttype = exttype;
 	p->sadb_key_bits = src->bits;
 	bcopy(src->key_data, _KEYBUF(p), _KEYLEN(src));
 
 	return m;
 }
 
 /*
  * Take one of the kernel's lifetime data structures and convert it
  * into a PF_KEY structure within an mbuf, suitable for sending up to
  * a waiting application in user land.
  * 
  * IN: 
  *    src: A pointer to a kernel lifetime structure.
  *    exttype: Which type of lifetime this is. Refer to the PF_KEY 
  *             data structures for more information.
  * OUT:
  *    a valid mbuf or NULL indicating an error
  *
  */
 
 static struct mbuf *
 key_setlifetime(struct seclifetime *src, u_int16_t exttype)
 {
 	struct mbuf *m = NULL;
 	struct sadb_lifetime *p;
 	int len = PFKEY_ALIGN8(sizeof(struct sadb_lifetime));
 
 	if (src == NULL)
 		return NULL;
 
 	m = m_get2(len, M_NOWAIT, MT_DATA, 0);
 	if (m == NULL)
 		return m;
 	m_align(m, len);
 	m->m_len = len;
 	p = mtod(m, struct sadb_lifetime *);
 
 	bzero(p, len);
 	p->sadb_lifetime_len = PFKEY_UNIT64(len);
 	p->sadb_lifetime_exttype = exttype;
 	p->sadb_lifetime_allocations = src->allocations;
 	p->sadb_lifetime_bytes = src->bytes;
 	p->sadb_lifetime_addtime = src->addtime;
 	p->sadb_lifetime_usetime = src->usetime;
 	
 	return m;
 
 }
Index: projects/arm_intrng/sys/netipsec/key_debug.c
===================================================================
--- projects/arm_intrng/sys/netipsec/key_debug.c	(revision 276247)
+++ projects/arm_intrng/sys/netipsec/key_debug.c	(revision 276248)
@@ -1,746 +1,746 @@
 /*	$FreeBSD$	*/
 /*	$KAME: key_debug.c,v 1.26 2001/06/27 10:46:50 sakane Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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.
  */
 
 #ifdef _KERNEL
 #include "opt_inet.h"
 #include "opt_inet6.h"
 #include "opt_ipsec.h"
 #endif
 
 #include 
 #include 
 #ifdef _KERNEL
 #include 
 #include 
 #include 
 #endif
 #include 
 
 #include 
 
 #include 
 #include 
 
 #include 
 #include 
 #ifdef _KERNEL
 #include 
 #endif
 
 #ifndef _KERNEL
 #include 
 #include 
 #include 
 #endif /* !_KERNEL */
 
 static void kdebug_sadb_prop(struct sadb_ext *);
 static void kdebug_sadb_identity(struct sadb_ext *);
 static void kdebug_sadb_supported(struct sadb_ext *);
 static void kdebug_sadb_lifetime(struct sadb_ext *);
 static void kdebug_sadb_sa(struct sadb_ext *);
 static void kdebug_sadb_address(struct sadb_ext *);
 static void kdebug_sadb_key(struct sadb_ext *);
 static void kdebug_sadb_x_sa2(struct sadb_ext *);
 
 #ifdef _KERNEL
 static void kdebug_secreplay(struct secreplay *);
 #endif
 
 #ifndef _KERNEL
 #define panic(fmt, ...)	{ printf(fmt, ## __VA_ARGS__); exit(-1); }
 #endif
 
 /* NOTE: host byte order */
 
 /* %%%: about struct sadb_msg */
 void
 kdebug_sadb(struct sadb_msg *base)
 {
 	struct sadb_ext *ext;
 	int tlen, extlen;
 
 	/* sanity check */
 	if (base == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("sadb_msg{ version=%u type=%u errno=%u satype=%u\n",
 	    base->sadb_msg_version, base->sadb_msg_type,
 	    base->sadb_msg_errno, base->sadb_msg_satype);
 	printf("  len=%u reserved=%u seq=%u pid=%u\n",
 	    base->sadb_msg_len, base->sadb_msg_reserved,
 	    base->sadb_msg_seq, base->sadb_msg_pid);
 
 	tlen = PFKEY_UNUNIT64(base->sadb_msg_len) - sizeof(struct sadb_msg);
 	ext = (struct sadb_ext *)((caddr_t)base + sizeof(struct sadb_msg));
 
 	while (tlen > 0) {
 		printf("sadb_ext{ len=%u type=%u }\n",
 		    ext->sadb_ext_len, ext->sadb_ext_type);
 
 		if (ext->sadb_ext_len == 0) {
 			printf("%s: invalid ext_len=0 was passed.\n", __func__);
 			return;
 		}
 		if (ext->sadb_ext_len > tlen) {
 			printf("%s: ext_len too big (%u > %u).\n",
 				__func__, ext->sadb_ext_len, tlen);
 			return;
 		}
 
 		switch (ext->sadb_ext_type) {
 		case SADB_EXT_SA:
 			kdebug_sadb_sa(ext);
 			break;
 		case SADB_EXT_LIFETIME_CURRENT:
 		case SADB_EXT_LIFETIME_HARD:
 		case SADB_EXT_LIFETIME_SOFT:
 			kdebug_sadb_lifetime(ext);
 			break;
 		case SADB_EXT_ADDRESS_SRC:
 		case SADB_EXT_ADDRESS_DST:
 		case SADB_EXT_ADDRESS_PROXY:
 			kdebug_sadb_address(ext);
 			break;
 		case SADB_EXT_KEY_AUTH:
 		case SADB_EXT_KEY_ENCRYPT:
 			kdebug_sadb_key(ext);
 			break;
 		case SADB_EXT_IDENTITY_SRC:
 		case SADB_EXT_IDENTITY_DST:
 			kdebug_sadb_identity(ext);
 			break;
 		case SADB_EXT_SENSITIVITY:
 			break;
 		case SADB_EXT_PROPOSAL:
 			kdebug_sadb_prop(ext);
 			break;
 		case SADB_EXT_SUPPORTED_AUTH:
 		case SADB_EXT_SUPPORTED_ENCRYPT:
 			kdebug_sadb_supported(ext);
 			break;
 		case SADB_EXT_SPIRANGE:
 		case SADB_X_EXT_KMPRIVATE:
 			break;
 		case SADB_X_EXT_POLICY:
 			kdebug_sadb_x_policy(ext);
 			break;
 		case SADB_X_EXT_SA2:
 			kdebug_sadb_x_sa2(ext);
 			break;
 		default:
 			printf("%s: invalid ext_type %u\n", __func__,
 			    ext->sadb_ext_type);
 			return;
 		}
 
 		extlen = PFKEY_UNUNIT64(ext->sadb_ext_len);
 		tlen -= extlen;
 		ext = (struct sadb_ext *)((caddr_t)ext + extlen);
 	}
 
 	return;
 }
 
 static void
 kdebug_sadb_prop(struct sadb_ext *ext)
 {
 	struct sadb_prop *prop = (struct sadb_prop *)ext;
 	struct sadb_comb *comb;
 	int len;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	len = (PFKEY_UNUNIT64(prop->sadb_prop_len) - sizeof(*prop))
 		/ sizeof(*comb);
 	comb = (struct sadb_comb *)(prop + 1);
 	printf("sadb_prop{ replay=%u\n", prop->sadb_prop_replay);
 
 	while (len--) {
 		printf("sadb_comb{ auth=%u encrypt=%u "
 			"flags=0x%04x reserved=0x%08x\n",
 			comb->sadb_comb_auth, comb->sadb_comb_encrypt,
 			comb->sadb_comb_flags, comb->sadb_comb_reserved);
 
 		printf("  auth_minbits=%u auth_maxbits=%u "
 			"encrypt_minbits=%u encrypt_maxbits=%u\n",
 			comb->sadb_comb_auth_minbits,
 			comb->sadb_comb_auth_maxbits,
 			comb->sadb_comb_encrypt_minbits,
 			comb->sadb_comb_encrypt_maxbits);
 
 		printf("  soft_alloc=%u hard_alloc=%u "
 			"soft_bytes=%lu hard_bytes=%lu\n",
 			comb->sadb_comb_soft_allocations,
 			comb->sadb_comb_hard_allocations,
 			(unsigned long)comb->sadb_comb_soft_bytes,
 			(unsigned long)comb->sadb_comb_hard_bytes);
 
 		printf("  soft_alloc=%lu hard_alloc=%lu "
 			"soft_bytes=%lu hard_bytes=%lu }\n",
 			(unsigned long)comb->sadb_comb_soft_addtime,
 			(unsigned long)comb->sadb_comb_hard_addtime,
 			(unsigned long)comb->sadb_comb_soft_usetime,
 			(unsigned long)comb->sadb_comb_hard_usetime);
 		comb++;
 	}
 	printf("}\n");
 
 	return;
 }
 
 static void
 kdebug_sadb_identity(struct sadb_ext *ext)
 {
 	struct sadb_ident *id = (struct sadb_ident *)ext;
 	int len;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	len = PFKEY_UNUNIT64(id->sadb_ident_len) - sizeof(*id);
 	printf("sadb_ident_%s{",
 	    id->sadb_ident_exttype == SADB_EXT_IDENTITY_SRC ? "src" : "dst");
 	switch (id->sadb_ident_type) {
 	default:
 		printf(" type=%d id=%lu",
 			id->sadb_ident_type, (u_long)id->sadb_ident_id);
 		if (len) {
 #ifdef _KERNEL
 			ipsec_hexdump((caddr_t)(id + 1), len); /*XXX cast ?*/
 #else
 			char *p, *ep;
 			printf("\n  str=\"");
 			p = (char *)(id + 1);
 			ep = p + len;
 			for (/*nothing*/; *p && p < ep; p++) {
 				if (isprint(*p))
 					printf("%c", *p & 0xff);
 				else
 					printf("\\%03o", *p & 0xff);
 			}
 #endif
 			printf("\"");
 		}
 		break;
 	}
 
 	printf(" }\n");
 
 	return;
 }
 
 static void
 kdebug_sadb_supported(struct sadb_ext *ext)
 {
 	struct sadb_supported *sup = (struct sadb_supported *)ext;
 	struct sadb_alg *alg;
 	int len;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	len = (PFKEY_UNUNIT64(sup->sadb_supported_len) - sizeof(*sup))
 		/ sizeof(*alg);
 	alg = (struct sadb_alg *)(sup + 1);
 	printf("sadb_sup{\n");
 	while (len--) {
 		printf("  { id=%d ivlen=%d min=%d max=%d }\n",
 			alg->sadb_alg_id, alg->sadb_alg_ivlen,
 			alg->sadb_alg_minbits, alg->sadb_alg_maxbits);
 		alg++;
 	}
 	printf("}\n");
 
 	return;
 }
 
 static void
 kdebug_sadb_lifetime(struct sadb_ext *ext)
 {
 	struct sadb_lifetime *lft = (struct sadb_lifetime *)ext;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("sadb_lifetime{ alloc=%u, bytes=%u\n",
 		lft->sadb_lifetime_allocations,
 		(u_int32_t)lft->sadb_lifetime_bytes);
 	printf("  addtime=%u, usetime=%u }\n",
 		(u_int32_t)lft->sadb_lifetime_addtime,
 		(u_int32_t)lft->sadb_lifetime_usetime);
 
 	return;
 }
 
 static void
 kdebug_sadb_sa(struct sadb_ext *ext)
 {
 	struct sadb_sa *sa = (struct sadb_sa *)ext;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("sadb_sa{ spi=%u replay=%u state=%u\n",
 	    (u_int32_t)ntohl(sa->sadb_sa_spi), sa->sadb_sa_replay,
 	    sa->sadb_sa_state);
 	printf("  auth=%u encrypt=%u flags=0x%08x }\n",
 	    sa->sadb_sa_auth, sa->sadb_sa_encrypt, sa->sadb_sa_flags);
 
 	return;
 }
 
 static void
 kdebug_sadb_address(struct sadb_ext *ext)
 {
 	struct sadb_address *addr = (struct sadb_address *)ext;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("sadb_address{ proto=%u prefixlen=%u reserved=0x%02x%02x }\n",
 	    addr->sadb_address_proto, addr->sadb_address_prefixlen,
 	    ((u_char *)&addr->sadb_address_reserved)[0],
 	    ((u_char *)&addr->sadb_address_reserved)[1]);
 
 	kdebug_sockaddr((struct sockaddr *)((caddr_t)ext + sizeof(*addr)));
 
 	return;
 }
 
 static void
 kdebug_sadb_key(struct sadb_ext *ext)
 {
 	struct sadb_key *key = (struct sadb_key *)ext;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("sadb_key{ bits=%u reserved=%u\n",
 	    key->sadb_key_bits, key->sadb_key_reserved);
 	printf("  key=");
 
 	/* sanity check 2 */
 	if ((key->sadb_key_bits >> 3) >
 		(PFKEY_UNUNIT64(key->sadb_key_len) - sizeof(struct sadb_key))) {
 		printf("%s: key length mismatch, bit:%d len:%ld.\n",
 			__func__,
 			key->sadb_key_bits >> 3,
 			(long)PFKEY_UNUNIT64(key->sadb_key_len) - sizeof(struct sadb_key));
 	}
 
 	ipsec_hexdump((caddr_t)key + sizeof(struct sadb_key),
 	              key->sadb_key_bits >> 3);
 	printf(" }\n");
 	return;
 }
 
 static void
 kdebug_sadb_x_sa2(struct sadb_ext *ext)
 {
 	struct sadb_x_sa2 *sa2 = (struct sadb_x_sa2 *)ext;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("sadb_x_sa2{ mode=%u reqid=%u\n",
 	    sa2->sadb_x_sa2_mode, sa2->sadb_x_sa2_reqid);
 	printf("  reserved1=%u reserved2=%u sequence=%u }\n",
 	    sa2->sadb_x_sa2_reserved1, sa2->sadb_x_sa2_reserved2,
 	    sa2->sadb_x_sa2_sequence);
 
 	return;
 }
 
 void
 kdebug_sadb_x_policy(struct sadb_ext *ext)
 {
 	struct sadb_x_policy *xpl = (struct sadb_x_policy *)ext;
 	struct sockaddr *addr;
 
 	/* sanity check */
 	if (ext == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("sadb_x_policy{ type=%u dir=%u id=%x }\n",
 		xpl->sadb_x_policy_type, xpl->sadb_x_policy_dir,
 		xpl->sadb_x_policy_id);
 
 	if (xpl->sadb_x_policy_type == IPSEC_POLICY_IPSEC) {
 		int tlen;
 		struct sadb_x_ipsecrequest *xisr;
 
 		tlen = PFKEY_UNUNIT64(xpl->sadb_x_policy_len) - sizeof(*xpl);
 		xisr = (struct sadb_x_ipsecrequest *)(xpl + 1);
 
 		while (tlen > 0) {
 			printf(" { len=%u proto=%u mode=%u level=%u reqid=%u\n",
 				xisr->sadb_x_ipsecrequest_len,
 				xisr->sadb_x_ipsecrequest_proto,
 				xisr->sadb_x_ipsecrequest_mode,
 				xisr->sadb_x_ipsecrequest_level,
 				xisr->sadb_x_ipsecrequest_reqid);
 
 			if (xisr->sadb_x_ipsecrequest_len > sizeof(*xisr)) {
 				addr = (struct sockaddr *)(xisr + 1);
 				kdebug_sockaddr(addr);
 				addr = (struct sockaddr *)((caddr_t)addr
 							+ addr->sa_len);
 				kdebug_sockaddr(addr);
 			}
 
 			printf(" }\n");
 
 			/* prevent infinite loop */
 			if (xisr->sadb_x_ipsecrequest_len <= 0) {
 				printf("%s: wrong policy struct.\n", __func__);
 				return;
 			}
 			/* prevent overflow */
 			if (xisr->sadb_x_ipsecrequest_len > tlen) {
 				printf("%s: invalid ipsec policy length "
 					"(%u > %u)\n", __func__,
 					xisr->sadb_x_ipsecrequest_len, tlen);
 				return;
 			}
 
 			tlen -= xisr->sadb_x_ipsecrequest_len;
 
 			xisr = (struct sadb_x_ipsecrequest *)((caddr_t)xisr
 			                + xisr->sadb_x_ipsecrequest_len);
 		}
 
 		if (tlen != 0)
 			panic("%s: wrong policy struct.\n", __func__);
 	}
 
 	return;
 }
 
 #ifdef _KERNEL
 /* %%%: about SPD and SAD */
 void
 kdebug_secpolicy(struct secpolicy *sp)
 {
 	/* sanity check */
 	if (sp == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
-	printf("secpolicy{ refcnt=%u state=%u policy=%u\n",
-		sp->refcnt, sp->state, sp->policy);
+	printf("secpolicy{ refcnt=%u policy=%u\n",
+		sp->refcnt, sp->policy);
 
 	kdebug_secpolicyindex(&sp->spidx);
 
 	switch (sp->policy) {
 	case IPSEC_POLICY_DISCARD:
 		printf("  type=discard }\n");
 		break;
 	case IPSEC_POLICY_NONE:
 		printf("  type=none }\n");
 		break;
 	case IPSEC_POLICY_IPSEC:
 	    {
 		struct ipsecrequest *isr;
 		for (isr = sp->req; isr != NULL; isr = isr->next) {
 
 			printf("  level=%u\n", isr->level);
 			kdebug_secasindex(&isr->saidx);
 
 			if (isr->sav != NULL)
 				kdebug_secasv(isr->sav);
 		}
 		printf("  }\n");
 	    }
 		break;
 	case IPSEC_POLICY_BYPASS:
 		printf("  type=bypass }\n");
 		break;
 	case IPSEC_POLICY_ENTRUST:
 		printf("  type=entrust }\n");
 		break;
 	default:
 		printf("%s: Invalid policy found. %d\n", __func__, sp->policy);
 		break;
 	}
 
 	return;
 }
 
 void
 kdebug_secpolicyindex(struct secpolicyindex *spidx)
 {
 	/* sanity check */
 	if (spidx == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("secpolicyindex{ dir=%u prefs=%u prefd=%u ul_proto=%u\n",
 		spidx->dir, spidx->prefs, spidx->prefd, spidx->ul_proto);
 
 	ipsec_hexdump((caddr_t)&spidx->src,
 		((struct sockaddr *)&spidx->src)->sa_len);
 	printf("\n");
 	ipsec_hexdump((caddr_t)&spidx->dst,
 		((struct sockaddr *)&spidx->dst)->sa_len);
 	printf("}\n");
 
 	return;
 }
 
 void
 kdebug_secasindex(struct secasindex *saidx)
 {
 	/* sanity check */
 	if (saidx == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("secasindex{ mode=%u proto=%u\n",
 		saidx->mode, saidx->proto);
 
 	ipsec_hexdump((caddr_t)&saidx->src,
 		((struct sockaddr *)&saidx->src)->sa_len);
 	printf("\n");
 	ipsec_hexdump((caddr_t)&saidx->dst,
 		((struct sockaddr *)&saidx->dst)->sa_len);
 	printf("\n");
 
 	return;
 }
 
 static void
 kdebug_sec_lifetime(struct seclifetime *lft)
 {
 	/* sanity check */
 	if (lft == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("sec_lifetime{ alloc=%u, bytes=%u\n",
 		lft->allocations, (u_int32_t)lft->bytes);
 	printf("  addtime=%u, usetime=%u }\n",
 		(u_int32_t)lft->addtime, (u_int32_t)lft->usetime);
 
 	return;
 }
 
 void
 kdebug_secasv(struct secasvar *sav)
 {
 	/* sanity check */
 	if (sav == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf("secas{");
 	kdebug_secasindex(&sav->sah->saidx);
 
 	printf("  refcnt=%u state=%u auth=%u enc=%u\n",
 	    sav->refcnt, sav->state, sav->alg_auth, sav->alg_enc);
 	printf("  spi=%u flags=%u\n",
 	    (u_int32_t)ntohl(sav->spi), sav->flags);
 
 	if (sav->key_auth != NULL)
 		kdebug_sadb_key((struct sadb_ext *)sav->key_auth);
 	if (sav->key_enc != NULL)
 		kdebug_sadb_key((struct sadb_ext *)sav->key_enc);
 	if (sav->iv != NULL) {
 		printf("  iv=");
 		ipsec_hexdump(sav->iv, sav->ivlen ? sav->ivlen : 8);
 		printf("\n");
 	}
 
 	if (sav->replay != NULL)
 		kdebug_secreplay(sav->replay);
 	if (sav->lft_c != NULL)
 		kdebug_sec_lifetime(sav->lft_c);
 	if (sav->lft_h != NULL)
 		kdebug_sec_lifetime(sav->lft_h);
 	if (sav->lft_s != NULL)
 		kdebug_sec_lifetime(sav->lft_s);
 
 #ifdef notyet
 	/* XXX: misc[123] ? */
 #endif
 
 	return;
 }
 
 static void
 kdebug_secreplay(struct secreplay *rpl)
 {
 	int len, l;
 
 	/* sanity check */
 	if (rpl == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	printf(" secreplay{ count=%u wsize=%u seq=%u lastseq=%u",
 	    rpl->count, rpl->wsize, rpl->seq, rpl->lastseq);
 
 	if (rpl->bitmap == NULL) {
 		printf(" }\n");
 		return;
 	}
 
 	printf("\n   bitmap { ");
 
 	for (len = 0; len < rpl->wsize; len++) {
 		for (l = 7; l >= 0; l--)
 			printf("%u", (((rpl->bitmap)[len] >> l) & 1) ? 1 : 0);
 	}
 	printf(" }\n");
 
 	return;
 }
 
 void
 kdebug_mbufhdr(struct mbuf *m)
 {
 	/* sanity check */
 	if (m == NULL)
 		return;
 
 	printf("mbuf(%p){ m_next:%p m_nextpkt:%p m_data:%p "
 	       "m_len:%d m_type:0x%02x m_flags:0x%02x }\n",
 		m, m->m_next, m->m_nextpkt, m->m_data,
 		m->m_len, m->m_type, m->m_flags);
 
 	if (m->m_flags & M_PKTHDR) {
 		printf("  m_pkthdr{ len:%d rcvif:%p }\n",
 		    m->m_pkthdr.len, m->m_pkthdr.rcvif);
 	}
 
 	if (m->m_flags & M_EXT) {
 		printf("  m_ext{ ext_buf:%p ext_free:%p "
 		       "ext_size:%u ext_cnt:%p }\n",
 			m->m_ext.ext_buf, m->m_ext.ext_free,
 			m->m_ext.ext_size, m->m_ext.ext_cnt);
 	}
 
 	return;
 }
 
 void
 kdebug_mbuf(struct mbuf *m0)
 {
 	struct mbuf *m = m0;
 	int i, j;
 
 	for (j = 0; m; m = m->m_next) {
 		kdebug_mbufhdr(m);
 		printf("  m_data:\n");
 		for (i = 0; i < m->m_len; i++) {
 			if (i && i % 32 == 0)
 				printf("\n");
 			if (i % 4 == 0)
 				printf(" ");
 			printf("%02x", mtod(m, u_char *)[i]);
 			j++;
 		}
 		printf("\n");
 	}
 
 	return;
 }
 #endif /* _KERNEL */
 
 void
 kdebug_sockaddr(struct sockaddr *addr)
 {
 	struct sockaddr_in *sin4;
 #ifdef INET6
 	struct sockaddr_in6 *sin6;
 #endif
 
 	/* sanity check */
 	if (addr == NULL)
 		panic("%s: NULL pointer was passed.\n", __func__);
 
 	/* NOTE: We deal with port number as host byte order. */
 	printf("sockaddr{ len=%u family=%u", addr->sa_len, addr->sa_family);
 
 	switch (addr->sa_family) {
 	case AF_INET:
 		sin4 = (struct sockaddr_in *)addr;
 		printf(" port=%u\n", ntohs(sin4->sin_port));
 		ipsec_hexdump((caddr_t)&sin4->sin_addr, sizeof(sin4->sin_addr));
 		break;
 #ifdef INET6
 	case AF_INET6:
 		sin6 = (struct sockaddr_in6 *)addr;
 		printf(" port=%u\n", ntohs(sin6->sin6_port));
 		printf("  flowinfo=0x%08x, scope_id=0x%08x\n",
 		    sin6->sin6_flowinfo, sin6->sin6_scope_id);
 		ipsec_hexdump((caddr_t)&sin6->sin6_addr,
 		    sizeof(sin6->sin6_addr));
 		break;
 #endif
 	}
 
 	printf("  }\n");
 
 	return;
 }
 
 void
 ipsec_bindump(caddr_t buf, int len)
 {
 	int i;
 
 	for (i = 0; i < len; i++)
 		printf("%c", (unsigned char)buf[i]);
 
 	return;
 }
 
 
 void
 ipsec_hexdump(caddr_t buf, int len)
 {
 	int i;
 
 	for (i = 0; i < len; i++) {
 		if (i != 0 && i % 32 == 0) printf("\n");
 		if (i % 4 == 0) printf(" ");
 		printf("%02x", (unsigned char)buf[i]);
 	}
 #if 0
 	if (i % 32 != 0) printf("\n");
 #endif
 
 	return;
 }
Index: projects/arm_intrng/sys
===================================================================
--- projects/arm_intrng/sys	(revision 276247)
+++ projects/arm_intrng/sys	(revision 276248)

Property changes on: projects/arm_intrng/sys
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head/sys:r276183-276247
Index: projects/arm_intrng/tools/build/mk/OptionalObsoleteFiles.inc
===================================================================
--- projects/arm_intrng/tools/build/mk/OptionalObsoleteFiles.inc	(revision 276247)
+++ projects/arm_intrng/tools/build/mk/OptionalObsoleteFiles.inc	(revision 276248)
@@ -1,4792 +1,4771 @@
 #
 # $FreeBSD$
 #
 # This file add support for the WITHOUT_* and WITH_* knobs in src.conf(5) to
 # the check-old and delete-old* targets.
 #
 
 .if ${MK_ACCT} == no
 OLD_FILES+=etc/periodic/daily/310.accounting
 OLD_FILES+=usr/sbin/accton
 OLD_FILES+=usr/sbin/sa
 OLD_FILES+=usr/share/man/man8/accton.8.gz
 OLD_FILES+=usr/share/man/man8/sa.8.gz
 .endif
 
 .if ${MK_ACPI} == no
 OLD_FILES+=usr/sbin/acpiconf
 OLD_FILES+=usr/sbin/acpidb
 OLD_FILES+=usr/sbin/acpidump
 OLD_FILES+=usr/sbin/iasl
 OLD_FILES+=usr/share/man/man8/acpiconf.8.gz
 OLD_FILES+=usr/share/man/man8/acpidb.8.gz
 OLD_FILES+=usr/share/man/man8/acpidump.8.gz
 OLD_FILES+=usr/share/man/man8/iasl.8.gz
 .endif
 
 .if ${MK_AMD} == no
 OLD_FILES+=etc/amd.map
 OLD_FILES+=usr/bin/pawd
 OLD_FILES+=usr/sbin/amd
 OLD_FILES+=usr/sbin/amq
 OLD_FILES+=usr/sbin/fixmount
 OLD_FILES+=usr/sbin/fsinfo
 OLD_FILES+=usr/sbin/hlfsd
 OLD_FILES+=usr/sbin/mk-amd-map
 OLD_FILES+=usr/sbin/wire-test
 OLD_FILES+=usr/share/examples/etc/amd.map
 OLD_FILES+=usr/share/info/am-utils.info.gz
 OLD_FILES+=usr/share/man/man1/pawd.1.gz
 OLD_FILES+=usr/share/man/man5/amd.conf.5.gz
 OLD_FILES+=usr/share/man/man8/amd.8.gz
 OLD_FILES+=usr/share/man/man8/amq.8.gz
 OLD_FILES+=usr/share/man/man8/fixmount.8.gz
 OLD_FILES+=usr/share/man/man8/fsinfo.8.gz
 OLD_FILES+=usr/share/man/man8/hlfsd.8.gz
 OLD_FILES+=usr/share/man/man8/mk-amd-map.8.gz
 OLD_FILES+=usr/share/man/man8/wire-test.8.gz
 .endif
 
 .if ${MK_APM} == no
 OLD_FILES+=etc/apmd.conf
 OLD_FILES+=usr/sbin/apm
 OLD_FILES+=usr/share/examples/etc/apmd.conf
 OLD_FILES+=usr/share/man/man8/amd64/apm.8.gz
 OLD_FILES+=usr/share/man/man8/amd64/apmconf.8.gz
 .endif
 
 .if ${MK_AT} == no
 OLD_FILES+=usr/bin/at
 OLD_FILES+=usr/bin/atq
 OLD_FILES+=usr/bin/atrm
 OLD_FILES+=usr/bin/batch
 OLD_FILES+=usr/libexec/atrun
 OLD_FILES+=usr/share/man/man1/at.1.gz
 OLD_FILES+=usr/share/man/man1/atq.1.gz
 OLD_FILES+=usr/share/man/man1/atrm.1.gz
 OLD_FILES+=usr/share/man/man1/batch.1.gz
 OLD_FILES+=usr/share/man/man8/atrun.8.gz
 .endif
 
 .if ${MK_ATM} == no
 OLD_FILES+=rescue/atmconfig
 OLD_FILES+=sbin/atmconfig
 OLD_FILES+=usr/bin/sscop
 OLD_FILES+=usr/include/bsnmp/snmp_atm.h
 OLD_FILES+=usr/include/netnatm/addr.h
 OLD_FILES+=usr/include/netnatm/api/atmapi.h
 OLD_FILES+=usr/include/netnatm/api/ccatm.h
 OLD_FILES+=usr/include/netnatm/api/unisap.h
 OLD_DIRS+=usr/include/netnatm/api
 OLD_FILES+=usr/include/netnatm/msg/uni_config.h
 OLD_FILES+=usr/include/netnatm/msg/uni_hdr.h
 OLD_FILES+=usr/include/netnatm/msg/uni_ie.h
 OLD_FILES+=usr/include/netnatm/msg/uni_msg.h
 OLD_FILES+=usr/include/netnatm/msg/unimsglib.h
 OLD_FILES+=usr/include/netnatm/msg/uniprint.h
 OLD_FILES+=usr/include/netnatm/msg/unistruct.h
 OLD_DIRS+=usr/include/netnatm/msg
 OLD_FILES+=usr/include/netnatm/saal/sscfu.h
 OLD_FILES+=usr/include/netnatm/saal/sscfudef.h
 OLD_FILES+=usr/include/netnatm/saal/sscop.h
 OLD_FILES+=usr/include/netnatm/saal/sscopdef.h
 OLD_DIRS+=usr/include/netnatm/saal
 OLD_FILES+=usr/include/netnatm/sig/uni.h
 OLD_FILES+=usr/include/netnatm/sig/unidef.h
 OLD_FILES+=usr/include/netnatm/sig/unisig.h
 OLD_DIRS+=usr/include/netnatm/sig
 OLD_FILES+=usr/include/netnatm/unimsg.h
 OLD_FILES+=usr/lib/libngatm.a
 OLD_FILES+=usr/lib/libngatm.so
 OLD_LIBS+=usr/lib/libngatm.so.4
 OLD_FILES+=usr/lib/libngatm_p.a
 OLD_FILES+=usr/lib/snmp_atm.so
 OLD_LIBS+=usr/lib/snmp_atm.so.6
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/libngatm.a
 OLD_FILES+=usr/lib32/libngatm.so
 OLD_LIBS+=usr/lib32/libngatm.so.4
 OLD_FILES+=usr/lib32/libngatm_p.a
 .endif
 OLD_FILES+=usr/share/doc/atm/atmconfig.help
 OLD_FILES+=usr/share/doc/atm/atmconfig_device.help
 OLD_DIRS+=usr/share/doc/atm
 OLD_FILES+=usr/share/man/man1/sscop.1.gz
 OLD_FILES+=usr/share/man/man3/libngatm.3.gz
 OLD_FILES+=usr/share/man/man3/snmp_atm.3.gz
 OLD_FILES+=usr/share/man/man3/uniaddr.3.gz
 OLD_FILES+=usr/share/man/man3/unifunc.3.gz
 OLD_FILES+=usr/share/man/man3/unimsg.3.gz
 OLD_FILES+=usr/share/man/man3/unisap.3.gz
 OLD_FILES+=usr/share/man/man3/unistruct.3.gz
 OLD_FILES+=usr/share/man/man8/atmconfig.8.gz
 OLD_FILES+=usr/share/snmp/defs/atm_freebsd.def
 OLD_FILES+=usr/share/snmp/defs/atm_tree.def
 OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM-FREEBSD-MIB.txt
 OLD_FILES+=usr/share/snmp/mibs/BEGEMOT-ATM.txt
 .endif
 
 .if ${MK_AUDIT} == no
 OLD_FILES+=usr/sbin/audit
 OLD_FILES+=usr/sbin/auditd
 OLD_FILES+=usr/sbin/auditreduce
 OLD_FILES+=usr/sbin/praudit
 OLD_FILES+=usr/share/man/man1/auditreduce.1.gz
 OLD_FILES+=usr/share/man/man1/praudit.1.gz
 OLD_FILES+=usr/share/man/man8/audit.8.gz
 OLD_FILES+=usr/share/man/man8/auditd.8.gz
 .endif
 
 .if ${MK_AUTHPF} == no
 OLD_FILES+=usr/sbin/authpf
 OLD_FILES+=usr/sbin/authpf-noip
 OLD_FILES+=usr/share/man/man8/authpf.8.gz
 OLD_FILES+=usr/share/man/man8/authpf-noip.8.gz
 .endif
 
 .if ${MK_BLUETOOTH} == no
 OLD_FILES+=etc/bluetooth/hcsecd.conf
 OLD_FILES+=etc/bluetooth/hosts
 OLD_FILES+=etc/bluetooth/protocols
 OLD_DIRS+=etc/bluetooth
 OLD_FILES+=usr/bin/bthost
 OLD_FILES+=usr/bin/btsockstat
 OLD_FILES+=usr/bin/rfcomm_sppd
 OLD_FILES+=usr/include/bluetooth.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_bluetooth.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_bt3c.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_btsocket.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_btsocket_hci_raw.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_btsocket_l2cap.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_btsocket_rfcomm.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_btsocket_sco.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_h4.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_hci.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_l2cap.h
 OLD_FILES+=usr/include/netgraph/bluetooth/include/ng_ubt.h
 OLD_DIRS+=usr/include/netgraph/bluetooth/include
 OLD_DIRS+=usr/include/netgraph/bluetooth
 OLD_FILES+=usr/include/sdp.h
 OLD_FILES+=usr/lib/libbluetooth.a
 OLD_FILES+=usr/lib/libbluetooth.so
 OLD_LIBS+=usr/lib/libbluetooth.so.4
 OLD_FILES+=usr/lib/libbluetooth_p.a
 OLD_FILES+=usr/lib/libsdp.a
 OLD_FILES+=usr/lib/libsdp.so
 OLD_LIBS+=usr/lib/libsdp.so.4
 OLD_FILES+=usr/lib/libsdp_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/libbluetooth.a
 OLD_FILES+=usr/lib32/libbluetooth.so
 OLD_LIBS+=usr/lib32/libbluetooth.so.4
 OLD_FILES+=usr/lib32/libbluetooth_p.a
 OLD_FILES+=usr/lib32/libsdp.a
 OLD_FILES+=usr/lib32/libsdp.so
 OLD_LIBS+=usr/lib32/libsdp.so.4
 OLD_FILES+=usr/lib32/libsdp_p.a
 .endif
 OLD_FILES+=usr/sbin/bcmfw
 OLD_FILES+=usr/sbin/bt3cfw
 OLD_FILES+=usr/sbin/bthidcontrol
 OLD_FILES+=usr/sbin/bthidd
 OLD_FILES+=usr/sbin/btpand
 OLD_FILES+=usr/sbin/hccontrol
 OLD_FILES+=usr/sbin/hcsecd
 OLD_FILES+=usr/sbin/hcseriald
 OLD_FILES+=usr/sbin/l2control
 OLD_FILES+=usr/sbin/l2ping
 OLD_FILES+=usr/sbin/rfcomm_pppd
 OLD_FILES+=usr/sbin/sdpcontrol
 OLD_FILES+=usr/sbin/sdpd
 OLD_FILES+=usr/share/man/man1/bthost.1.gz
 OLD_FILES+=usr/share/man/man1/btsockstat.1.gz
 OLD_FILES+=usr/share/man/man1/rfcomm_sppd.1.gz
 OLD_FILES+=usr/share/man/man3/SDP_GET128.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_GET16.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_GET32.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_GET64.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_GET8.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_PUT128.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_PUT16.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_PUT32.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_PUT64.3.gz
 OLD_FILES+=usr/share/man/man3/SDP_PUT8.3.gz
 OLD_FILES+=usr/share/man/man3/bdaddr_any.3.gz
 OLD_FILES+=usr/share/man/man3/bdaddr_copy.3.gz
 OLD_FILES+=usr/share/man/man3/bdaddr_same.3.gz
 OLD_FILES+=usr/share/man/man3/bluetooth.3.gz
 OLD_FILES+=usr/share/man/man3/bt_aton.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devaddr.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devclose.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devenum.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devfilter.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devfilter_evt_clr.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devfilter_evt_set.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devfilter_evt_tst.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devfilter_pkt_clr.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devfilter_pkt_set.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devfilter_pkt_tst.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devinfo.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devinquiry.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devname.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devopen.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devreq.3.gz
 OLD_FILES+=usr/share/man/man3/bt_devsend.3.gz
 OLD_FILES+=usr/share/man/man3/bt_endhostent.3.gz
 OLD_FILES+=usr/share/man/man3/bt_endprotoent.3.gz
 OLD_FILES+=usr/share/man/man3/bt_gethostbyaddr.3.gz
 OLD_FILES+=usr/share/man/man3/bt_gethostbyname.3.gz
 OLD_FILES+=usr/share/man/man3/bt_gethostent.3.gz
 OLD_FILES+=usr/share/man/man3/bt_getprotobyname.3.gz
 OLD_FILES+=usr/share/man/man3/bt_getprotobynumber.3.gz
 OLD_FILES+=usr/share/man/man3/bt_getprotoent.3.gz
 OLD_FILES+=usr/share/man/man3/bt_ntoa.3.gz
 OLD_FILES+=usr/share/man/man3/bt_sethostent.3.gz
 OLD_FILES+=usr/share/man/man3/bt_setprotoent.3.gz
 OLD_FILES+=usr/share/man/man3/sdp.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_attr2desc.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_change_service.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_close.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_error.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_open.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_open_local.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_register_service.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_search.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_unregister_service.3.gz
 OLD_FILES+=usr/share/man/man3/sdp_uuid2desc.3.gz
 OLD_FILES+=usr/share/man/man5/hcsecd.conf.5.gz
 OLD_FILES+=usr/share/man/man8/bcmfw.8.gz
 OLD_FILES+=usr/share/man/man8/bt3cfw.8.gz
 OLD_FILES+=usr/share/man/man8/bthidcontrol.8.gz
 OLD_FILES+=usr/share/man/man8/bthidd.8.gz
 OLD_FILES+=usr/share/man/man8/btpand.8.gz
 OLD_FILES+=usr/share/man/man8/hccontrol.8.gz
 OLD_FILES+=usr/share/man/man8/hcsecd.8.gz
 OLD_FILES+=usr/share/man/man8/hcseriald.8.gz
 OLD_FILES+=usr/share/man/man8/l2control.8.gz
 OLD_FILES+=usr/share/man/man8/l2ping.8.gz
 OLD_FILES+=usr/share/man/man8/rfcomm_pppd.8.gz
 OLD_FILES+=usr/share/man/man8/sdpcontrol.8.gz
 OLD_FILES+=usr/share/man/man8/sdpd.8.gz
 .endif
 
 #.if ${MK_BOOT} == no
 # to be filled in
 #.endif
 
 .if ${MK_CALENDAR} == no
 OLD_FILES+=etc/periodic/daily/300.calendar
 OLD_FILES+=usr/bin/calendar
 OLD_FILES+=usr/share/calendar/calendar.all
 OLD_FILES+=usr/share/calendar/calendar.australia
 OLD_FILES+=usr/share/calendar/calendar.birthday
 OLD_FILES+=usr/share/calendar/calendar.brazilian
 OLD_FILES+=usr/share/calendar/calendar.christian
 OLD_FILES+=usr/share/calendar/calendar.computer
 OLD_FILES+=usr/share/calendar/calendar.croatian
 OLD_FILES+=usr/share/calendar/calendar.dutch
 OLD_FILES+=usr/share/calendar/calendar.freebsd
 OLD_FILES+=usr/share/calendar/calendar.french
 OLD_FILES+=usr/share/calendar/calendar.german
 OLD_FILES+=usr/share/calendar/calendar.history
 OLD_FILES+=usr/share/calendar/calendar.holiday
 OLD_FILES+=usr/share/calendar/calendar.hungarian
 OLD_FILES+=usr/share/calendar/calendar.judaic
 OLD_FILES+=usr/share/calendar/calendar.lotr
 OLD_FILES+=usr/share/calendar/calendar.music
 OLD_FILES+=usr/share/calendar/calendar.newzealand
 OLD_FILES+=usr/share/calendar/calendar.russian
 OLD_FILES+=usr/share/calendar/calendar.southafrica
 OLD_FILES+=usr/share/calendar/calendar.ukrainian
 OLD_FILES+=usr/share/calendar/calendar.usholiday
 OLD_FILES+=usr/share/calendar/calendar.world
 OLD_FILES+=usr/share/calendar/de_AT.ISO_8859-15/calendar.feiertag
 OLD_DIRS+=usr/share/calendar/de_AT.ISO_8859-15
 OLD_FILES+=usr/share/calendar/de_DE.ISO8859-1/calendar.all
 OLD_FILES+=usr/share/calendar/de_DE.ISO8859-1/calendar.feiertag
 OLD_FILES+=usr/share/calendar/de_DE.ISO8859-1/calendar.geschichte
 OLD_FILES+=usr/share/calendar/de_DE.ISO8859-1/calendar.kirche
 OLD_FILES+=usr/share/calendar/de_DE.ISO8859-1/calendar.literatur
 OLD_FILES+=usr/share/calendar/de_DE.ISO8859-1/calendar.musik
 OLD_FILES+=usr/share/calendar/de_DE.ISO8859-1/calendar.wissenschaft
 OLD_DIRS+=usr/share/calendar/de_DE.ISO8859-1
 OLD_FILES+=usr/share/calendar/de_DE.ISO8859-15
 OLD_FILES+=usr/share/calendar/fr_FR.ISO8859-1/calendar.all
 OLD_FILES+=usr/share/calendar/fr_FR.ISO8859-1/calendar.fetes
 OLD_FILES+=usr/share/calendar/fr_FR.ISO8859-1/calendar.french
 OLD_FILES+=usr/share/calendar/fr_FR.ISO8859-1/calendar.jferies
 OLD_FILES+=usr/share/calendar/fr_FR.ISO8859-1/calendar.proverbes
 OLD_DIRS+=usr/share/calendar/fr_FR.ISO8859-1
 OLD_FILES+=usr/share/calendar/fr_FR.ISO8859-15
 OLD_FILES+=usr/share/calendar/hr_HR.ISO8859-2/calendar.all
 OLD_FILES+=usr/share/calendar/hr_HR.ISO8859-2/calendar.praznici
 OLD_DIRS+=usr/share/calendar/hr_HR.ISO8859-2
 OLD_FILES+=usr/share/calendar/hu_HU.ISO8859-2/calendar.all
 OLD_FILES+=usr/share/calendar/hu_HU.ISO8859-2/calendar.nevnapok
 OLD_FILES+=usr/share/calendar/hu_HU.ISO8859-2/calendar.unnepek
 OLD_DIRS+=usr/share/calendar/hu_HU.ISO8859-2
 OLD_FILES+=usr/share/calendar/pt_BR.ISO8859-1/calendar.all
 OLD_FILES+=usr/share/calendar/pt_BR.ISO8859-1/calendar.commemorative
 OLD_FILES+=usr/share/calendar/pt_BR.ISO8859-1/calendar.holidays
 OLD_FILES+=usr/share/calendar/pt_BR.ISO8859-1/calendar.mcommemorative
 OLD_DIRS+=usr/share/calendar/pt_BR.ISO8859-1
 OLD_FILES+=usr/share/calendar/pt_BR.UTF-8/calendar.all
 OLD_FILES+=usr/share/calendar/pt_BR.UTF-8/calendar.commemorative
 OLD_FILES+=usr/share/calendar/pt_BR.UTF-8/calendar.holidays
 OLD_FILES+=usr/share/calendar/pt_BR.UTF-8/calendar.mcommemorative
 OLD_DIRS+=usr/share/calendar/pt_BR.UTF-8
 OLD_FILES+=usr/share/calendar/ru_RU.KOI8-R/calendar.all
 OLD_FILES+=usr/share/calendar/ru_RU.KOI8-R/calendar.common
 OLD_FILES+=usr/share/calendar/ru_RU.KOI8-R/calendar.holiday
 OLD_FILES+=usr/share/calendar/ru_RU.KOI8-R/calendar.military
 OLD_FILES+=usr/share/calendar/ru_RU.KOI8-R/calendar.orthodox
 OLD_FILES+=usr/share/calendar/ru_RU.KOI8-R/calendar.pagan
 OLD_DIRS+=usr/share/calendar/ru_RU.KOI8-R
 OLD_FILES+=usr/share/calendar/ru_RU.UTF-8/calendar.all
 OLD_FILES+=usr/share/calendar/ru_RU.UTF-8/calendar.common
 OLD_FILES+=usr/share/calendar/ru_RU.UTF-8/calendar.holiday
 OLD_FILES+=usr/share/calendar/ru_RU.UTF-8/calendar.military
 OLD_FILES+=usr/share/calendar/ru_RU.UTF-8/calendar.orthodox
 OLD_FILES+=usr/share/calendar/ru_RU.UTF-8/calendar.pagan
 OLD_DIRS+=usr/share/calendar/ru_RU.UTF-8
 OLD_FILES+=usr/share/calendar/uk_UA.KOI8-U/calendar.all
 OLD_FILES+=usr/share/calendar/uk_UA.KOI8-U/calendar.holiday
 OLD_FILES+=usr/share/calendar/uk_UA.KOI8-U/calendar.misc
 OLD_FILES+=usr/share/calendar/uk_UA.KOI8-U/calendar.orthodox
 OLD_DIRS+=usr/share/calendar/uk_UA.KOI8-U
 OLD_DIRS+=usr/share/calendar
 OLD_FILES+=usr/share/man/man1/calendar.1.gz
 .endif
 
 .if ${MK_CASPER} == no
 OLD_FILES+=etc/rc.d/casperd
 OLD_LIBS+=lib/libcasper.so.0
 OLD_FILES+=sbin/casper
 OLD_FILES+=usr/lib/libcasper.a
 .endif
 
 .if ${MK_CDDL} == no
 OLD_LIBS+=lib/libavl.so.2
 OLD_LIBS+=lib/libctf.so.2
 OLD_LIBS+=lib/libdtrace.so.2
 OLD_LIBS+=lib/libnvpair.so.2
 OLD_LIBS+=lib/libumem.so.2
 OLD_LIBS+=lib/libuutil.so.2
 OLD_FILES+=usr/bin/ctfconvert
 OLD_FILES+=usr/bin/ctfdump
 OLD_FILES+=usr/bin/ctfmerge
 OLD_FILES+=usr/bin/sgsmsg
 OLD_FILES+=usr/lib/dtrace/drti.o
 OLD_FILES+=usr/lib/dtrace/errno.d
 OLD_FILES+=usr/lib/dtrace/io.d
 OLD_FILES+=usr/lib/dtrace/ip.d
 OLD_FILES+=usr/lib/dtrace/psinfo.d
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
 OLD_FILES+=usr/lib/dtrace/regs_x86.d
 .endif
 OLD_FILES+=usr/lib/dtrace/signal.d
 OLD_FILES+=usr/lib/dtrace/tcp.d
 OLD_FILES+=usr/lib/dtrace/udp.d
 OLD_FILES+=usr/lib/dtrace/unistd.d
 OLD_DIRS+=usr/lib/dtrace
 OLD_FILES+=usr/lib/libavl.a
 OLD_FILES+=usr/lib/libavl.so
 OLD_FILES+=usr/lib/libavl_p.a
 OLD_FILES+=usr/lib/libctf.a
 OLD_FILES+=usr/lib/libctf.so
 OLD_FILES+=usr/lib/libctf_p.a
 OLD_FILES+=usr/lib/libdtrace.a
 OLD_FILES+=usr/lib/libdtrace.so
 OLD_FILES+=usr/lib/libdtrace_p.a
 OLD_FILES+=usr/lib/libnvpair.a
 OLD_FILES+=usr/lib/libnvpair.so
 OLD_FILES+=usr/lib/libnvpair_p.a
 OLD_FILES+=usr/lib/libumem.a
 OLD_FILES+=usr/lib/libumem.so
 OLD_FILES+=usr/lib/libumem_p.a
 OLD_FILES+=usr/lib/libuutil.a
 OLD_FILES+=usr/lib/libuutil.so
 OLD_FILES+=usr/lib/libuutil_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/dtrace/drti.o
 OLD_DIRS+=usr/lib32/dtrace
 OLD_FILES+=usr/lib32/libavl.a
 OLD_FILES+=usr/lib32/libavl.so
 OLD_LIBS+=usr/lib32/libavl.so.2
 OLD_FILES+=usr/lib32/libavl_p.a
 OLD_FILES+=usr/lib32/libctf.a
 OLD_FILES+=usr/lib32/libctf.so
 OLD_LIBS+=usr/lib32/libctf.so.2
 OLD_FILES+=usr/lib32/libctf_p.a
 OLD_FILES+=usr/lib32/libdtrace.a
 OLD_FILES+=usr/lib32/libdtrace.so
 OLD_LIBS+=usr/lib32/libdtrace.so.2
 OLD_FILES+=usr/lib32/libdtrace_p.a
 OLD_FILES+=usr/lib32/libnvpair.a
 OLD_FILES+=usr/lib32/libnvpair.so
 OLD_LIBS+=usr/lib32/libnvpair.so.2
 OLD_FILES+=usr/lib32/libnvpair_p.a
 OLD_FILES+=usr/lib32/libumem.a
 OLD_FILES+=usr/lib32/libumem.so
 OLD_LIBS+=usr/lib32/libumem.so.2
 OLD_FILES+=usr/lib32/libumem_p.a
 OLD_FILES+=usr/lib32/libuutil.a
 OLD_FILES+=usr/lib32/libuutil.so
 OLD_LIBS+=usr/lib32/libuutil.so.2
 OLD_FILES+=usr/lib32/libuutil_p.a
 .endif
 OLD_FILES+=usr/sbin/dtrace
 OLD_FILES+=usr/sbin/lockstat
 OLD_FILES+=usr/share/man/man1/dtrace.1.gz
 .endif
 
 .if ${MK_ZFS} == no
 OLD_FILES+=boot/gptzfsboot
 OLD_FILES+=boot/zfsboot
 OLD_FILES+=boot/zfsloader
 OLD_FILES+=etc/devd/zfs.conf
 OLD_FILES+=etc/periodic/daily/404.status-zfs
 OLD_FILES+=etc/periodic/daily/800.scrub-zfs
 OLD_LIBS+=lib/libzfs.so.2
 OLD_LIBS+=lib/libzfs_core.so.2
 OLD_LIBS+=lib/libzpool.so.2
 OLD_FILES+=rescue/zfs
 OLD_FILES+=rescue/zpool
 OLD_FILES+=sbin/zfs
 OLD_FILES+=sbin/zpool
 OLD_FILES+=usr/bin/zinject
 OLD_FILES+=usr/bin/ztest
 OLD_FILES+=usr/lib/libzfs.a
 OLD_FILES+=usr/lib/libzfs.so
 OLD_FILES+=usr/lib/libzfs_core.a
 OLD_FILES+=usr/lib/libzfs_core.so
 OLD_FILES+=usr/lib/libzfs_core_p.a
 OLD_FILES+=usr/lib/libzfs_p.a
 OLD_FILES+=usr/lib/libzpool.a
 OLD_FILES+=usr/lib/libzpool.so
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/libzfs.a
 OLD_FILES+=usr/lib32/libzfs.so
 OLD_LIBS+=usr/lib32/libzfs.so.2
 OLD_FILES+=usr/lib32/libzfs_core.a
 OLD_FILES+=usr/lib32/libzfs_core.so
 OLD_LIBS+=usr/lib32/libzfs_core.so.2
 OLD_FILES+=usr/lib32/libzfs_core_p.a
 OLD_FILES+=usr/lib32/libzfs_p.a
 OLD_FILES+=usr/lib32/libzpool.a
 OLD_FILES+=usr/lib32/libzpool.so
 OLD_LIBS+=usr/lib32/libzpool.so.2
 .endif
 OLD_FILES+=usr/sbin/zdb
 OLD_FILES+=usr/share/man/man8/zdb.8.gz
 OLD_FILES+=usr/share/man/man8/zfs.8.gz
 OLD_FILES+=usr/share/man/man8/zpool.8.gz
 .endif
 
 .if ${MK_CLANG} == no
 OLD_FILES+=usr/bin/clang
 OLD_FILES+=usr/bin/clang++
 OLD_FILES+=usr/bin/clang-cpp
 OLD_FILES+=usr/bin/clang-tblgen
 OLD_FILES+=usr/bin/tblgen
 OLD_FILES+=usr/include/clang/3.4.1/__wmmintrin_aes.h
 OLD_FILES+=usr/include/clang/3.4.1/__wmmintrin_pclmul.h
 OLD_FILES+=usr/include/clang/3.4.1/altivec.h
 OLD_FILES+=usr/include/clang/3.4.1/ammintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/arm_neon.h
 OLD_FILES+=usr/include/clang/3.4.1/avx2intrin.h
 OLD_FILES+=usr/include/clang/3.4.1/avxintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/bmi2intrin.h
 OLD_FILES+=usr/include/clang/3.4.1/bmiintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/cpuid.h
 OLD_FILES+=usr/include/clang/3.4.1/emmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/f16cintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/fma4intrin.h
 OLD_FILES+=usr/include/clang/3.4.1/fmaintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/immintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/lzcntintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/mm3dnow.h
 OLD_FILES+=usr/include/clang/3.4.1/mm_malloc.h
 OLD_FILES+=usr/include/clang/3.4.1/mmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/module.map
 OLD_FILES+=usr/include/clang/3.4.1/nmmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/pmmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/popcntintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/prfchwintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/rdseedintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/rtmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/shaintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/smmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/tbmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/tmmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/wmmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/x86intrin.h
 OLD_FILES+=usr/include/clang/3.4.1/xmmintrin.h
 OLD_FILES+=usr/include/clang/3.4.1/xopintrin.h
 OLD_DIRS+=usr/include/clang/3.4.1
 OLD_DIRS+=usr/include/clang
 OLD_FILES+=usr/share/doc/llvm/clang/LICENSE.TXT
 OLD_DIRS+=usr/share/doc/llvm/clang
 OLD_FILES+=usr/share/doc/llvm/COPYRIGHT.regex
 OLD_FILES+=usr/share/doc/llvm/LICENSE.TXT
 OLD_DIRS+=usr/share/doc/llvm
 OLD_FILES+=usr/share/man/man1/clang.1.gz
 OLD_FILES+=usr/share/man/man1/clang++.1.gz
 OLD_FILES+=usr/share/man/man1/clang-cpp.1.gz
 OLD_FILES+=usr/share/man/man1/tblgen.1.gz
 .endif
 
 .if ${MK_CLANG_EXTRAS} == no
 OLD_FILES+=usr/bin/bugpoint
 OLD_FILES+=usr/bin/llc
 OLD_FILES+=usr/bin/lli
 OLD_FILES+=usr/bin/llvm-ar
 OLD_FILES+=usr/bin/llvm-as
 OLD_FILES+=usr/bin/llvm-bcanalyzer
 OLD_FILES+=usr/bin/llvm-diff
 OLD_FILES+=usr/bin/llvm-dis
 OLD_FILES+=usr/bin/llvm-extract
 OLD_FILES+=usr/bin/llvm-ld
 OLD_FILES+=usr/bin/llvm-link
 OLD_FILES+=usr/bin/llvm-mc
 OLD_FILES+=usr/bin/llvm-nm
 OLD_FILES+=usr/bin/llvm-objdump
 OLD_FILES+=usr/bin/llvm-rtdyld
 OLD_FILES+=usr/bin/llvm-stub
 OLD_FILES+=usr/bin/macho-dump
 OLD_FILES+=usr/bin/opt
 OLD_FILES+=usr/share/man/man1/bugpoint.1.gz
 OLD_FILES+=usr/share/man/man1/llc.1.gz
 OLD_FILES+=usr/share/man/man1/lli.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-ar.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-as.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-bcanalyzer.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-diff.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-dis.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-extract.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-ld.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-link.1.gz
 OLD_FILES+=usr/share/man/man1/llvm-nm.1.gz
 OLD_FILES+=usr/share/man/man1/opt.1.gz
 .endif
 
 .if ${MK_CPP} == no
 OLD_FILES+=usr/bin/cpp
 OLD_FILES+=usr/share/man/man1/cpp.1.gz
 .endif
 
 #.if ${MK_CRYPT} == no
 # to be filled in
 #.endif
 
 .if ${MK_CTM} == no
 OLD_FILES+=usr/sbin/ctm
 OLD_FILES+=usr/sbin/ctm_dequeue
 OLD_FILES+=usr/sbin/ctm_rmail
 OLD_FILES+=usr/sbin/ctm_smail
 OLD_FILES+=usr/share/man/man1/ctm.1.gz
 OLD_FILES+=usr/share/man/man1/ctm_dequeue.1.gz
 OLD_FILES+=usr/share/man/man1/ctm_rmail.1.gz
 OLD_FILES+=usr/share/man/man1/ctm_smail.1.gz
 OLD_FILES+=usr/share/man/man5/ctm.5.gz
 .endif
 
 # devd(8) not listed here on purpose
 .if ${MK_CXX} == no
 OLD_FILES+=usr/bin/CC
 OLD_FILES+=usr/bin/c++
 OLD_FILES+=usr/bin/c++filt
 OLD_FILES+=usr/bin/g++
 OLD_FILES+=usr/libexec/cc1plus
 .if ${MK_GCC} == no
 OLD_FILES+=usr/bin/gperf
 OLD_FILES+=usr/share/info/gperf.info.gz
 OLD_FILES+=usr/share/man/man1/gperf.1.gz
 .endif
 .endif
 
 .if ${MK_FMTREE} == no
 OLD_FILES+=usr/sbin/fmtree
 OLD_FILES+=usr/share/man/man8/fmtree.8.gz
 .endif
 
 .if ${MK_GNUCXX} == no
 OLD_FILES+=usr/bin/g++
 OLD_FILES+=usr/include/c++/4.2/algorithm
 OLD_FILES+=usr/include/c++/4.2/backward/algo.h
 OLD_FILES+=usr/include/c++/4.2/backward/algobase.h
 OLD_FILES+=usr/include/c++/4.2/backward/alloc.h
 OLD_FILES+=usr/include/c++/4.2/backward/backward_warning.h
 OLD_FILES+=usr/include/c++/4.2/backward/bvector.h
 OLD_FILES+=usr/include/c++/4.2/backward/complex.h
 OLD_FILES+=usr/include/c++/4.2/backward/defalloc.h
 OLD_FILES+=usr/include/c++/4.2/backward/deque.h
 OLD_FILES+=usr/include/c++/4.2/backward/fstream.h
 OLD_FILES+=usr/include/c++/4.2/backward/function.h
 OLD_FILES+=usr/include/c++/4.2/backward/hash_map.h
 OLD_FILES+=usr/include/c++/4.2/backward/hash_set.h
 OLD_FILES+=usr/include/c++/4.2/backward/hashtable.h
 OLD_FILES+=usr/include/c++/4.2/backward/heap.h
 OLD_FILES+=usr/include/c++/4.2/backward/iomanip.h
 OLD_FILES+=usr/include/c++/4.2/backward/iostream.h
 OLD_FILES+=usr/include/c++/4.2/backward/istream.h
 OLD_FILES+=usr/include/c++/4.2/backward/iterator.h
 OLD_FILES+=usr/include/c++/4.2/backward/list.h
 OLD_FILES+=usr/include/c++/4.2/backward/map.h
 OLD_FILES+=usr/include/c++/4.2/backward/multimap.h
 OLD_FILES+=usr/include/c++/4.2/backward/multiset.h
 OLD_FILES+=usr/include/c++/4.2/backward/new.h
 OLD_FILES+=usr/include/c++/4.2/backward/ostream.h
 OLD_FILES+=usr/include/c++/4.2/backward/pair.h
 OLD_FILES+=usr/include/c++/4.2/backward/queue.h
 OLD_FILES+=usr/include/c++/4.2/backward/rope.h
 OLD_FILES+=usr/include/c++/4.2/backward/set.h
 OLD_FILES+=usr/include/c++/4.2/backward/slist.h
 OLD_FILES+=usr/include/c++/4.2/backward/stack.h
 OLD_FILES+=usr/include/c++/4.2/backward/stream.h
 OLD_FILES+=usr/include/c++/4.2/backward/streambuf.h
 OLD_FILES+=usr/include/c++/4.2/backward/strstream
 OLD_FILES+=usr/include/c++/4.2/backward/tempbuf.h
 OLD_FILES+=usr/include/c++/4.2/backward/tree.h
 OLD_FILES+=usr/include/c++/4.2/backward/vector.h
 OLD_FILES+=usr/include/c++/4.2/bits/allocator.h
 OLD_FILES+=usr/include/c++/4.2/bits/atomic_word.h
 OLD_FILES+=usr/include/c++/4.2/bits/basic_file.h
 OLD_FILES+=usr/include/c++/4.2/bits/basic_ios.h
 OLD_FILES+=usr/include/c++/4.2/bits/basic_ios.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/basic_string.h
 OLD_FILES+=usr/include/c++/4.2/bits/basic_string.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/boost_concept_check.h
 OLD_FILES+=usr/include/c++/4.2/bits/c++allocator.h
 OLD_FILES+=usr/include/c++/4.2/bits/c++config.h
 OLD_FILES+=usr/include/c++/4.2/bits/c++io.h
 OLD_FILES+=usr/include/c++/4.2/bits/c++locale.h
 OLD_FILES+=usr/include/c++/4.2/bits/c++locale_internal.h
 OLD_FILES+=usr/include/c++/4.2/bits/char_traits.h
 OLD_FILES+=usr/include/c++/4.2/bits/cmath.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/codecvt.h
 OLD_FILES+=usr/include/c++/4.2/bits/compatibility.h
 OLD_FILES+=usr/include/c++/4.2/bits/concept_check.h
 OLD_FILES+=usr/include/c++/4.2/bits/cpp_type_traits.h
 OLD_FILES+=usr/include/c++/4.2/bits/cpu_defines.h
 OLD_FILES+=usr/include/c++/4.2/bits/ctype_base.h
 OLD_FILES+=usr/include/c++/4.2/bits/ctype_inline.h
 OLD_FILES+=usr/include/c++/4.2/bits/ctype_noninline.h
 OLD_FILES+=usr/include/c++/4.2/bits/cxxabi_tweaks.h
 OLD_FILES+=usr/include/c++/4.2/bits/deque.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/fstream.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/functexcept.h
 OLD_FILES+=usr/include/c++/4.2/bits/gslice.h
 OLD_FILES+=usr/include/c++/4.2/bits/gslice_array.h
 OLD_FILES+=usr/include/c++/4.2/bits/gthr-default.h
 OLD_FILES+=usr/include/c++/4.2/bits/gthr-posix.h
 OLD_FILES+=usr/include/c++/4.2/bits/gthr-single.h
 OLD_FILES+=usr/include/c++/4.2/bits/gthr-tpf.h
 OLD_FILES+=usr/include/c++/4.2/bits/gthr.h
 OLD_FILES+=usr/include/c++/4.2/bits/indirect_array.h
 OLD_FILES+=usr/include/c++/4.2/bits/ios_base.h
 OLD_FILES+=usr/include/c++/4.2/bits/istream.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/list.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/locale_classes.h
 OLD_FILES+=usr/include/c++/4.2/bits/locale_facets.h
 OLD_FILES+=usr/include/c++/4.2/bits/locale_facets.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/localefwd.h
 OLD_FILES+=usr/include/c++/4.2/bits/mask_array.h
 OLD_FILES+=usr/include/c++/4.2/bits/messages_members.h
 OLD_FILES+=usr/include/c++/4.2/bits/os_defines.h
 OLD_FILES+=usr/include/c++/4.2/bits/ostream.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/ostream_insert.h
 OLD_FILES+=usr/include/c++/4.2/bits/postypes.h
 OLD_FILES+=usr/include/c++/4.2/bits/slice_array.h
 OLD_FILES+=usr/include/c++/4.2/bits/sstream.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/stl_algo.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_algobase.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_bvector.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_construct.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_deque.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_function.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_heap.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_iterator.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_iterator_base_funcs.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_iterator_base_types.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_list.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_map.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_multimap.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_multiset.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_numeric.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_pair.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_queue.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_raw_storage_iter.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_relops.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_set.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_stack.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_tempbuf.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_tree.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_uninitialized.h
 OLD_FILES+=usr/include/c++/4.2/bits/stl_vector.h
 OLD_FILES+=usr/include/c++/4.2/bits/stream_iterator.h
 OLD_FILES+=usr/include/c++/4.2/bits/streambuf.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/streambuf_iterator.h
 OLD_FILES+=usr/include/c++/4.2/bits/stringfwd.h
 OLD_FILES+=usr/include/c++/4.2/bits/time_members.h
 OLD_FILES+=usr/include/c++/4.2/bits/valarray_after.h
 OLD_FILES+=usr/include/c++/4.2/bits/valarray_array.h
 OLD_FILES+=usr/include/c++/4.2/bits/valarray_array.tcc
 OLD_FILES+=usr/include/c++/4.2/bits/valarray_before.h
 OLD_FILES+=usr/include/c++/4.2/bits/vector.tcc
 OLD_FILES+=usr/include/c++/4.2/bitset
 OLD_FILES+=usr/include/c++/4.2/cassert
 OLD_FILES+=usr/include/c++/4.2/cctype
 OLD_FILES+=usr/include/c++/4.2/cerrno
 OLD_FILES+=usr/include/c++/4.2/cfloat
 OLD_FILES+=usr/include/c++/4.2/ciso646
 OLD_FILES+=usr/include/c++/4.2/climits
 OLD_FILES+=usr/include/c++/4.2/clocale
 OLD_FILES+=usr/include/c++/4.2/cmath
 OLD_FILES+=usr/include/c++/4.2/complex
 OLD_FILES+=usr/include/c++/4.2/csetjmp
 OLD_FILES+=usr/include/c++/4.2/csignal
 OLD_FILES+=usr/include/c++/4.2/cstdarg
 OLD_FILES+=usr/include/c++/4.2/cstddef
 OLD_FILES+=usr/include/c++/4.2/cstdio
 OLD_FILES+=usr/include/c++/4.2/cstdlib
 OLD_FILES+=usr/include/c++/4.2/cstring
 OLD_FILES+=usr/include/c++/4.2/ctime
 OLD_FILES+=usr/include/c++/4.2/cwchar
 OLD_FILES+=usr/include/c++/4.2/cwctype
 OLD_FILES+=usr/include/c++/4.2/cxxabi.h
 OLD_FILES+=usr/include/c++/4.2/debug/bitset
 OLD_FILES+=usr/include/c++/4.2/debug/debug.h
 OLD_FILES+=usr/include/c++/4.2/debug/deque
 OLD_FILES+=usr/include/c++/4.2/debug/formatter.h
 OLD_FILES+=usr/include/c++/4.2/debug/functions.h
 OLD_FILES+=usr/include/c++/4.2/debug/hash_map
 OLD_FILES+=usr/include/c++/4.2/debug/hash_map.h
 OLD_FILES+=usr/include/c++/4.2/debug/hash_multimap.h
 OLD_FILES+=usr/include/c++/4.2/debug/hash_multiset.h
 OLD_FILES+=usr/include/c++/4.2/debug/hash_set
 OLD_FILES+=usr/include/c++/4.2/debug/hash_set.h
 OLD_FILES+=usr/include/c++/4.2/debug/list
 OLD_FILES+=usr/include/c++/4.2/debug/macros.h
 OLD_FILES+=usr/include/c++/4.2/debug/map
 OLD_FILES+=usr/include/c++/4.2/debug/map.h
 OLD_FILES+=usr/include/c++/4.2/debug/multimap.h
 OLD_FILES+=usr/include/c++/4.2/debug/multiset.h
 OLD_FILES+=usr/include/c++/4.2/debug/safe_base.h
 OLD_FILES+=usr/include/c++/4.2/debug/safe_iterator.h
 OLD_FILES+=usr/include/c++/4.2/debug/safe_iterator.tcc
 OLD_FILES+=usr/include/c++/4.2/debug/safe_sequence.h
 OLD_FILES+=usr/include/c++/4.2/debug/set
 OLD_FILES+=usr/include/c++/4.2/debug/set.h
 OLD_FILES+=usr/include/c++/4.2/debug/string
 OLD_FILES+=usr/include/c++/4.2/debug/vector
 OLD_FILES+=usr/include/c++/4.2/deque
 OLD_FILES+=usr/include/c++/4.2/exception
 OLD_FILES+=usr/include/c++/4.2/exception_defines.h
 OLD_FILES+=usr/include/c++/4.2/ext/algorithm
 OLD_FILES+=usr/include/c++/4.2/ext/array_allocator.h
 OLD_FILES+=usr/include/c++/4.2/ext/atomicity.h
 OLD_FILES+=usr/include/c++/4.2/ext/bitmap_allocator.h
 OLD_FILES+=usr/include/c++/4.2/ext/codecvt_specializations.h
 OLD_FILES+=usr/include/c++/4.2/ext/concurrence.h
 OLD_FILES+=usr/include/c++/4.2/ext/debug_allocator.h
 OLD_FILES+=usr/include/c++/4.2/ext/functional
 OLD_FILES+=usr/include/c++/4.2/ext/hash_fun.h
 OLD_FILES+=usr/include/c++/4.2/ext/hash_map
 OLD_FILES+=usr/include/c++/4.2/ext/hash_set
 OLD_FILES+=usr/include/c++/4.2/ext/hashtable.h
 OLD_FILES+=usr/include/c++/4.2/ext/iterator
 OLD_FILES+=usr/include/c++/4.2/ext/malloc_allocator.h
 OLD_FILES+=usr/include/c++/4.2/ext/memory
 OLD_FILES+=usr/include/c++/4.2/ext/mt_allocator.h
 OLD_FILES+=usr/include/c++/4.2/ext/new_allocator.h
 OLD_FILES+=usr/include/c++/4.2/ext/numeric
 OLD_FILES+=usr/include/c++/4.2/ext/numeric_traits.h
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/assoc_container.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/basic_tree_policy/basic_tree_policy_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/basic_tree_policy/null_node_metadata.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/basic_tree_policy/traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/basic_types.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/bin_search_tree_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/cond_dtor_entry_dealtor.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/cond_key_dtor_entry_dealtor.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/iterators_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/node_iterators.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/point_iterators.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/policy_access_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/r_erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/rotate_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/bin_search_tree_/traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/const_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/const_point_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/entry_cmp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/entry_pred.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/iterators_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/policy_access_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/resize_policy.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binary_heap_/trace_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_/binomial_heap_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/binomial_heap_base_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/binomial_heap_base_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/cmp_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/cond_key_dtor_entry_dealtor.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/debug_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/entry_list_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/erase_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/find_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/insert_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/iterators_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/policy_access_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/resize_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/standard_policies.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cc_hash_table_map_/trace_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/cond_dealtor.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/container_base_dispatch.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/eq_fn/eq_by_less.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/debug_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/erase_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/find_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/find_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/insert_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/iterator_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/policy_access_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_no_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/resize_store_hash_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/standard_policies.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/gp_hash_table_map_/trace_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/direct_mask_range_hashing_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/direct_mod_range_hashing_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/linear_probe_fn_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/mask_based_range_hashing.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/mod_based_range_hashing.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/probe_fn_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/quadratic_probe_fn_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/ranged_hash_fn.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/ranged_probe_fn.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/sample_probe_fn.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/sample_range_hashing.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/sample_ranged_hash_fn.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/hash_fn/sample_ranged_probe_fn.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/const_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/const_point_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/iterators_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/node.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/null_metadata.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/policy_access_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/left_child_next_sibling_heap_/trace_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/constructor_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/entry_metadata_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/iterators_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/lu_map_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_map_/trace_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_policy/counter_lu_metadata.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_policy/counter_lu_policy_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_policy/mtf_lu_policy_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/list_update_policy/sample_update_policy.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/map_debug_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/cond_dtor.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/iterators_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/node_iterators.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/policy_access_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/ov_tree_map_/traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pairing_heap_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pairing_heap_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pairing_heap_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pairing_heap_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pairing_heap_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pairing_heap_/pairing_heap_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pairing_heap_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/child_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/cond_dtor_entry_dealtor.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/const_child_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/head.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/insert_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/internal_node.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/iterators_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/leaf.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/node_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/node_iterators.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/node_metadata_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/point_iterators.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/policy_access_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/r_erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/rotate_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/split_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/split_join_branch_bag.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/synth_e_access_traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/trace_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/pat_trie_/update_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/priority_queue_base_dispatch.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/node.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/rb_tree_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rb_tree_map_/traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/rc_binomial_heap_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/rc_binomial_heap_/trace_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/cc_hash_max_collision_check_resize_trigger_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/hash_exponential_size_policy_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/hash_load_check_resize_trigger_size_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/hash_standard_resize_policy_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/sample_resize_policy.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/sample_resize_trigger.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/resize_policy/sample_size_policy.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/info_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/node.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/splay_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/splay_tree_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/splay_tree_/traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/standard_policies.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/thin_heap_/constructors_destructor_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/thin_heap_/debug_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/thin_heap_/erase_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/thin_heap_/find_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/thin_heap_/insert_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/thin_heap_/split_join_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/thin_heap_/thin_heap_.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/thin_heap_/trace_fn_imps.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/tree_policy/null_node_update_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/tree_policy/order_statistics_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/tree_policy/sample_tree_node_update.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/tree_trace_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/trie_policy/null_node_update_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/trie_policy/order_statistics_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/trie_policy/prefix_search_node_update_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/trie_policy/sample_trie_e_access_traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/trie_policy/sample_trie_node_update.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/trie_policy/string_trie_e_access_traits_imp.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/trie_policy/trie_policy_base.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/type_utils.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/types_traits.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/unordered_iterator/const_point_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/unordered_iterator/iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/exception.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/hash_policy.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/list_update_policy.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/priority_queue.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/tag_and_trait.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/tree_policy.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pb_ds/trie_policy.hpp
 OLD_FILES+=usr/include/c++/4.2/ext/pod_char_traits.h
 OLD_FILES+=usr/include/c++/4.2/ext/pool_allocator.h
 OLD_FILES+=usr/include/c++/4.2/ext/rb_tree
 OLD_FILES+=usr/include/c++/4.2/ext/rc_string_base.h
 OLD_FILES+=usr/include/c++/4.2/ext/rope
 OLD_FILES+=usr/include/c++/4.2/ext/ropeimpl.h
 OLD_FILES+=usr/include/c++/4.2/ext/slist
 OLD_FILES+=usr/include/c++/4.2/ext/sso_string_base.h
 OLD_FILES+=usr/include/c++/4.2/ext/stdio_filebuf.h
 OLD_FILES+=usr/include/c++/4.2/ext/stdio_sync_filebuf.h
 OLD_FILES+=usr/include/c++/4.2/ext/throw_allocator.h
 OLD_FILES+=usr/include/c++/4.2/ext/type_traits.h
 OLD_FILES+=usr/include/c++/4.2/ext/typelist.h
 OLD_FILES+=usr/include/c++/4.2/ext/vstring.h
 OLD_FILES+=usr/include/c++/4.2/ext/vstring.tcc
 OLD_FILES+=usr/include/c++/4.2/ext/vstring_fwd.h
 OLD_FILES+=usr/include/c++/4.2/ext/vstring_util.h
 OLD_FILES+=usr/include/c++/4.2/fstream
 OLD_FILES+=usr/include/c++/4.2/functional
 OLD_FILES+=usr/include/c++/4.2/iomanip
 OLD_FILES+=usr/include/c++/4.2/ios
 OLD_FILES+=usr/include/c++/4.2/iosfwd
 OLD_FILES+=usr/include/c++/4.2/iostream
 OLD_FILES+=usr/include/c++/4.2/istream
 OLD_FILES+=usr/include/c++/4.2/iterator
 OLD_FILES+=usr/include/c++/4.2/limits
 OLD_FILES+=usr/include/c++/4.2/list
 OLD_FILES+=usr/include/c++/4.2/locale
 OLD_FILES+=usr/include/c++/4.2/map
 OLD_FILES+=usr/include/c++/4.2/memory
 OLD_FILES+=usr/include/c++/4.2/new
 OLD_FILES+=usr/include/c++/4.2/numeric
 OLD_FILES+=usr/include/c++/4.2/ostream
 OLD_FILES+=usr/include/c++/4.2/queue
 OLD_FILES+=usr/include/c++/4.2/set
 OLD_FILES+=usr/include/c++/4.2/sstream
 OLD_FILES+=usr/include/c++/4.2/stack
 OLD_FILES+=usr/include/c++/4.2/stdexcept
 OLD_FILES+=usr/include/c++/4.2/streambuf
 OLD_FILES+=usr/include/c++/4.2/string
 OLD_FILES+=usr/include/c++/4.2/tr1/array
 OLD_FILES+=usr/include/c++/4.2/tr1/bind_iterate.h
 OLD_FILES+=usr/include/c++/4.2/tr1/bind_repeat.h
 OLD_FILES+=usr/include/c++/4.2/tr1/boost_shared_ptr.h
 OLD_FILES+=usr/include/c++/4.2/tr1/cctype
 OLD_FILES+=usr/include/c++/4.2/tr1/cfenv
 OLD_FILES+=usr/include/c++/4.2/tr1/cfloat
 OLD_FILES+=usr/include/c++/4.2/tr1/cinttypes
 OLD_FILES+=usr/include/c++/4.2/tr1/climits
 OLD_FILES+=usr/include/c++/4.2/tr1/cmath
 OLD_FILES+=usr/include/c++/4.2/tr1/common.h
 OLD_FILES+=usr/include/c++/4.2/tr1/complex
 OLD_FILES+=usr/include/c++/4.2/tr1/cstdarg
 OLD_FILES+=usr/include/c++/4.2/tr1/cstdbool
 OLD_FILES+=usr/include/c++/4.2/tr1/cstdint
 OLD_FILES+=usr/include/c++/4.2/tr1/cstdio
 OLD_FILES+=usr/include/c++/4.2/tr1/cstdlib
 OLD_FILES+=usr/include/c++/4.2/tr1/ctgmath
 OLD_FILES+=usr/include/c++/4.2/tr1/ctime
 OLD_FILES+=usr/include/c++/4.2/tr1/ctype.h
 OLD_FILES+=usr/include/c++/4.2/tr1/cwchar
 OLD_FILES+=usr/include/c++/4.2/tr1/cwctype
 OLD_FILES+=usr/include/c++/4.2/tr1/fenv.h
 OLD_FILES+=usr/include/c++/4.2/tr1/float.h
 OLD_FILES+=usr/include/c++/4.2/tr1/functional
 OLD_FILES+=usr/include/c++/4.2/tr1/functional_hash.h
 OLD_FILES+=usr/include/c++/4.2/tr1/functional_iterate.h
 OLD_FILES+=usr/include/c++/4.2/tr1/hashtable
 OLD_FILES+=usr/include/c++/4.2/tr1/hashtable_policy.h
 OLD_FILES+=usr/include/c++/4.2/tr1/inttypes.h
 OLD_FILES+=usr/include/c++/4.2/tr1/limits.h
 OLD_FILES+=usr/include/c++/4.2/tr1/math.h
 OLD_FILES+=usr/include/c++/4.2/tr1/memory
 OLD_FILES+=usr/include/c++/4.2/tr1/mu_iterate.h
 OLD_FILES+=usr/include/c++/4.2/tr1/random
 OLD_FILES+=usr/include/c++/4.2/tr1/random.tcc
 OLD_FILES+=usr/include/c++/4.2/tr1/ref_fwd.h
 OLD_FILES+=usr/include/c++/4.2/tr1/ref_wrap_iterate.h
 OLD_FILES+=usr/include/c++/4.2/tr1/repeat.h
 OLD_FILES+=usr/include/c++/4.2/tr1/stdarg.h
 OLD_FILES+=usr/include/c++/4.2/tr1/stdbool.h
 OLD_FILES+=usr/include/c++/4.2/tr1/stdint.h
 OLD_FILES+=usr/include/c++/4.2/tr1/stdio.h
 OLD_FILES+=usr/include/c++/4.2/tr1/stdlib.h
 OLD_FILES+=usr/include/c++/4.2/tr1/tgmath.h
 OLD_FILES+=usr/include/c++/4.2/tr1/tuple
 OLD_FILES+=usr/include/c++/4.2/tr1/tuple_defs.h
 OLD_FILES+=usr/include/c++/4.2/tr1/tuple_iterate.h
 OLD_FILES+=usr/include/c++/4.2/tr1/type_traits
 OLD_FILES+=usr/include/c++/4.2/tr1/type_traits_fwd.h
 OLD_FILES+=usr/include/c++/4.2/tr1/unordered_map
 OLD_FILES+=usr/include/c++/4.2/tr1/unordered_set
 OLD_FILES+=usr/include/c++/4.2/tr1/utility
 OLD_FILES+=usr/include/c++/4.2/tr1/wchar.h
 OLD_FILES+=usr/include/c++/4.2/tr1/wctype.h
 OLD_FILES+=usr/include/c++/4.2/typeinfo
 OLD_FILES+=usr/include/c++/4.2/utility
 OLD_FILES+=usr/include/c++/4.2/valarray
 OLD_FILES+=usr/include/c++/4.2/vector
 OLD_FILES+=usr/lib/libstdc++.a
 OLD_FILES+=usr/lib/libstdc++.so
 OLD_LIBS+=usr/lib/libstdc++.so.6
 OLD_FILES+=usr/lib/libstdc++_p.a
 OLD_FILES+=usr/lib/libsupc++.a
 OLD_FILES+=usr/lib/libsupc++.so
 OLD_LIBS+=usr/lib/libsupc++.so.1
 OLD_FILES+=usr/lib/libsupc++_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/libstdc++.a
 OLD_FILES+=usr/lib32/libstdc++.so
 OLD_LIBS+=usr/lib32/libstdc++.so.6
 OLD_FILES+=usr/lib32/libstdc++_p.a
 OLD_FILES+=usr/lib32/libsupc++.a
 OLD_FILES+=usr/lib32/libsupc++.so
 OLD_LIBS+=usr/lib32/libsupc++.so.1
 OLD_FILES+=usr/lib32/libsupc++_p.a
 .endif
 OLD_FILES+=usr/libexec/cc1plus
 .endif
 
 .if ${MK_DICT} == no
 OLD_FILES+=usr/share/dict/README
 OLD_FILES+=usr/share/dict/eign
 OLD_FILES+=usr/share/dict/freebsd
 OLD_FILES+=usr/share/dict/propernames
 OLD_FILES+=usr/share/dict/web2
 OLD_FILES+=usr/share/dict/web2a
 OLD_FILES+=usr/share/dict/words
 OLD_DIRS+=usr/share/dict
 .endif
 
 .if ${MK_ELFTOOLCHAIN_TOOLS} == no
 OLD_FILES+=usr/bin/elfcopy
 OLD_FILES+=usr/share/man/man1/elfcopy.1.gz
 .endif
 
 #.if ${MK_EXAMPLES} == no
 # to be filled in
 #.endif
 
 .if ${MK_FLOPPY} == no
 OLD_FILES+=usr/sbin/fdcontrol
 OLD_FILES+=usr/sbin/fdformat
 OLD_FILES+=usr/sbin/fdread
 OLD_FILES+=usr/sbin/fdwrite
 OLD_FILES+=usr/share/man/man1/fdformat.1.gz
 OLD_FILES+=usr/share/man/man1/fdread.1.gz
 OLD_FILES+=usr/share/man/man1/fdwrite.1.gz
 OLD_FILES+=usr/share/man/man8/fdcontrol.8.gz
 .endif
 
 .if ${MK_FREEBSD_UPDATE} == no
 OLD_FILES+=etc/freebsd-update.conf
 OLD_FILES+=usr/sbin/freebsd-update
 OLD_FILES+=usr/share/examples/etc/freebsd-update.conf
 OLD_FILES+=usr/share/man/man5/freebsd-update.conf.5.gz
 OLD_FILES+=usr/share/man/man8/freebsd-update.8.gz
 .endif
 
 .if ${MK_GAMES} == no
 OLD_FILES+=usr/games/bcd
 OLD_FILES+=usr/games/caesar
 OLD_FILES+=usr/games/factor
 OLD_FILES+=usr/games/fortune
 OLD_FILES+=usr/games/grdc
 OLD_FILES+=usr/games/morse
 OLD_FILES+=usr/games/number
 OLD_FILES+=usr/games/pom
 OLD_FILES+=usr/games/ppt
 OLD_FILES+=usr/games/primes
 OLD_FILES+=usr/games/random
 OLD_FILES+=usr/games/rot13
 OLD_FILES+=usr/games/strfile
 OLD_FILES+=usr/games/unstr
 OLD_DIRS+=usr/games
 OLD_FILES+=usr/share/games/fortune/fortunes
 OLD_FILES+=usr/share/games/fortune/fortunes.dat
 OLD_FILES+=usr/share/games/fortune/freebsd-tips
 OLD_FILES+=usr/share/games/fortune/freebsd-tips.dat
 OLD_FILES+=usr/share/games/fortune/gerrold.limerick
 OLD_FILES+=usr/share/games/fortune/gerrold.limerick.dat
 OLD_FILES+=usr/share/games/fortune/limerick
 OLD_FILES+=usr/share/games/fortune/limerick.dat
 OLD_FILES+=usr/share/games/fortune/murphy
 OLD_FILES+=usr/share/games/fortune/murphy-o
 OLD_FILES+=usr/share/games/fortune/murphy-o.dat
 OLD_FILES+=usr/share/games/fortune/murphy.dat
 OLD_FILES+=usr/share/games/fortune/startrek
 OLD_FILES+=usr/share/games/fortune/startrek.dat
 OLD_FILES+=usr/share/games/fortune/zippy
 OLD_FILES+=usr/share/games/fortune/zippy.dat
 OLD_DIRS+=usr/share/games/fortune
 OLD_DIRS+=usr/share/games
 OLD_FILES+=usr/share/man/man6/bcd.6.gz
 OLD_FILES+=usr/share/man/man6/caesar.6.gz
 OLD_FILES+=usr/share/man/man6/factor.6.gz
 OLD_FILES+=usr/share/man/man6/fortune.6.gz
 OLD_FILES+=usr/share/man/man6/grdc.6.gz
 OLD_FILES+=usr/share/man/man6/morse.6.gz
 OLD_FILES+=usr/share/man/man6/number.6.gz
 OLD_FILES+=usr/share/man/man6/pom.6.gz
 OLD_FILES+=usr/share/man/man6/ppt.6.gz
 OLD_FILES+=usr/share/man/man6/primes.6.gz
 OLD_FILES+=usr/share/man/man6/random.6.gz
 OLD_FILES+=usr/share/man/man6/rot13.6.gz
 OLD_FILES+=usr/share/man/man8/strfile.8.gz
 OLD_FILES+=usr/share/man/man8/unstr.8.gz
 .endif
 
 .if ${MK_GCC} == no
 OLD_FILES+=usr/bin/c++filt
 OLD_FILES+=usr/bin/g++
 OLD_FILES+=usr/bin/gcc
 OLD_FILES+=usr/bin/gcov
 OLD_FILES+=usr/bin/gcpp
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "i386"
 OLD_FILES+=usr/include/gcc/4.2/__wmmintrin_aes.h
 OLD_FILES+=usr/include/gcc/4.2/__wmmintrin_pclmul.h
 OLD_FILES+=usr/include/gcc/4.2/ammintrin.h
 OLD_FILES+=usr/include/gcc/4.2/emmintrin.h
 OLD_FILES+=usr/include/gcc/4.2/mm3dnow.h
 OLD_FILES+=usr/include/gcc/4.2/mm_malloc.h
 OLD_FILES+=usr/include/gcc/4.2/mmintrin.h
 OLD_FILES+=usr/include/gcc/4.2/pmmintrin.h
 OLD_FILES+=usr/include/gcc/4.2/tmmintrin.h
 OLD_FILES+=usr/include/gcc/4.2/wmmintrin.h
 OLD_FILES+=usr/include/gcc/4.2/xmmintrin.h
 .elif ${TARGET_ARCH} == "arm"
 OLD_FILES+=usr/include/gcc/4.2/mmintrin.h
 .elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/include/gcc/4.2/altivec.h
 OLD_FILES+=usr/include/gcc/4.2/ppc-asm.h
 OLD_FILES+=usr/include/gcc/4.2/spe.h
 .endif
 OLD_FILES+=usr/libexec/cc1
 OLD_FILES+=usr/libexec/cc1plus
 OLD_FILES+=usr/share/info/cpp.info.gz
 OLD_FILES+=usr/share/info/cppinternals.info.gz
 OLD_FILES+=usr/share/info/gcc.info.gz
 OLD_FILES+=usr/share/info/gccint.info.gz
 OLD_FILES+=usr/share/man/man1/g++.1.gz
 OLD_FILES+=usr/share/man/man1/gcc.1.gz
 OLD_FILES+=usr/share/man/man1/gcov.1.gz
 OLD_FILES+=usr/share/man/man1/gcpp.1.gz
 .endif
 
 .if ${MK_GCOV} == no
 OLD_FILES+=usr/bin/gcov
 OLD_FILES+=usr/share/man/man1/gcov.1.gz
 .endif
 
 .if ${MK_GDB} == no
 OLD_FILES+=usr/bin/gdb
 OLD_FILES+=usr/bin/gdbserver
 OLD_FILES+=usr/bin/gdbtui
 OLD_FILES+=usr/bin/kgdb
 OLD_FILES+=usr/share/info/gdb.info.gz
 OLD_FILES+=usr/share/info/gdbint.info.gz
 OLD_FILES+=usr/share/info/stabs.info.gz
 OLD_FILES+=usr/share/man/man1/gdb.1.gz
 OLD_FILES+=usr/share/man/man1/gdbserver.1.gz
 OLD_FILES+=usr/share/man/man1/kgdb.1.gz
 .endif
 
-.if ${MK_GPIB} == no
-OLD_FILES+=usr/include/dev/ieee488/ibfoo_int.h
-OLD_FILES+=usr/include/dev/ieee488/tnt4882.h
-OLD_FILES+=usr/include/dev/ieee488/ugpib.h
-OLD_FILES+=usr/include/dev/ieee488/upd7210.h
-OLD_DIRS+=usr/include/dev/ieee488
-OLD_FILES+=usr/include/gpib/gpib.h
-OLD_DIRS+=usr/include/gpib
-OLD_FILES+=usr/lib/libgpib.a
-OLD_FILES+=usr/lib/libgpib.so
-OLD_LIBS+=usr/lib/libgpib.so.3
-OLD_FILES+=usr/lib/libgpib_p.a
-.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
-OLD_FILES+=usr/lib32/libgpib.a
-OLD_FILES+=usr/lib32/libgpib.so
-OLD_LIBS+=usr/lib32/libgpib.so.3
-OLD_FILES+=usr/lib32/libgpib_p.a
-.endif
-.endif
-
 .if ${MK_GPIO} == no
 OLD_FILES+=usr/sbin/gpioctl
 OLD_FILES+=usr/share/man/man8/gpioctl.8.gz
 .endif
 
 # Also includes vgrind(1)
 .if ${MK_GROFF} == no
 OLD_FILES+=usr/bin/addftinfo
 OLD_FILES+=usr/bin/afmtodit
 OLD_FILES+=usr/bin/eqn
 OLD_FILES+=usr/bin/grn
 OLD_FILES+=usr/bin/grodvi
 OLD_FILES+=usr/bin/groff
 OLD_FILES+=usr/bin/grog
 OLD_FILES+=usr/bin/grolbp
 OLD_FILES+=usr/bin/grolj4
 OLD_FILES+=usr/bin/grops
 OLD_FILES+=usr/bin/grotty
 OLD_FILES+=usr/bin/hpftodit
 OLD_FILES+=usr/bin/indxbib
 OLD_FILES+=usr/bin/lkbib
 OLD_FILES+=usr/bin/lookbib
 OLD_FILES+=usr/bin/mmroff
 OLD_FILES+=usr/bin/neqn
 OLD_FILES+=usr/bin/nroff
 OLD_FILES+=usr/bin/pfbtops
 OLD_FILES+=usr/bin/pic
 OLD_FILES+=usr/bin/post-grohtml
 OLD_FILES+=usr/bin/pre-grohtml
 OLD_FILES+=usr/bin/psroff
 OLD_FILES+=usr/bin/refer
 OLD_FILES+=usr/bin/soelim
 OLD_FILES+=usr/bin/tbl
 OLD_FILES+=usr/bin/tfmtodit
 OLD_FILES+=usr/bin/troff
 OLD_FILES+=usr/bin/vgrind
 OLD_FILES+=usr/libexec/vfontedpr
 OLD_FILES+=usr/share/groff_font/devX100-12/CB
 OLD_FILES+=usr/share/groff_font/devX100-12/CBI
 OLD_FILES+=usr/share/groff_font/devX100-12/CI
 OLD_FILES+=usr/share/groff_font/devX100-12/CR
 OLD_FILES+=usr/share/groff_font/devX100-12/DESC
 OLD_FILES+=usr/share/groff_font/devX100-12/HB
 OLD_FILES+=usr/share/groff_font/devX100-12/HBI
 OLD_FILES+=usr/share/groff_font/devX100-12/HI
 OLD_FILES+=usr/share/groff_font/devX100-12/HR
 OLD_FILES+=usr/share/groff_font/devX100-12/NB
 OLD_FILES+=usr/share/groff_font/devX100-12/NBI
 OLD_FILES+=usr/share/groff_font/devX100-12/NI
 OLD_FILES+=usr/share/groff_font/devX100-12/NR
 OLD_FILES+=usr/share/groff_font/devX100-12/S
 OLD_FILES+=usr/share/groff_font/devX100-12/TB
 OLD_FILES+=usr/share/groff_font/devX100-12/TBI
 OLD_FILES+=usr/share/groff_font/devX100-12/TI
 OLD_FILES+=usr/share/groff_font/devX100-12/TR
 OLD_DIRS+=usr/share/groff_font/devX100-12
 OLD_FILES+=usr/share/groff_font/devX100/CB
 OLD_FILES+=usr/share/groff_font/devX100/CBI
 OLD_FILES+=usr/share/groff_font/devX100/CI
 OLD_FILES+=usr/share/groff_font/devX100/CR
 OLD_FILES+=usr/share/groff_font/devX100/DESC
 OLD_FILES+=usr/share/groff_font/devX100/HB
 OLD_FILES+=usr/share/groff_font/devX100/HBI
 OLD_FILES+=usr/share/groff_font/devX100/HI
 OLD_FILES+=usr/share/groff_font/devX100/HR
 OLD_FILES+=usr/share/groff_font/devX100/NB
 OLD_FILES+=usr/share/groff_font/devX100/NBI
 OLD_FILES+=usr/share/groff_font/devX100/NI
 OLD_FILES+=usr/share/groff_font/devX100/NR
 OLD_FILES+=usr/share/groff_font/devX100/S
 OLD_FILES+=usr/share/groff_font/devX100/TB
 OLD_FILES+=usr/share/groff_font/devX100/TBI
 OLD_FILES+=usr/share/groff_font/devX100/TI
 OLD_FILES+=usr/share/groff_font/devX100/TR
 OLD_DIRS+=usr/share/groff_font/devX100
 OLD_FILES+=usr/share/groff_font/devX75-12/CB
 OLD_FILES+=usr/share/groff_font/devX75-12/CBI
 OLD_FILES+=usr/share/groff_font/devX75-12/CI
 OLD_FILES+=usr/share/groff_font/devX75-12/CR
 OLD_FILES+=usr/share/groff_font/devX75-12/DESC
 OLD_FILES+=usr/share/groff_font/devX75-12/HB
 OLD_FILES+=usr/share/groff_font/devX75-12/HBI
 OLD_FILES+=usr/share/groff_font/devX75-12/HI
 OLD_FILES+=usr/share/groff_font/devX75-12/HR
 OLD_FILES+=usr/share/groff_font/devX75-12/NB
 OLD_FILES+=usr/share/groff_font/devX75-12/NBI
 OLD_FILES+=usr/share/groff_font/devX75-12/NI
 OLD_FILES+=usr/share/groff_font/devX75-12/NR
 OLD_FILES+=usr/share/groff_font/devX75-12/S
 OLD_FILES+=usr/share/groff_font/devX75-12/TB
 OLD_FILES+=usr/share/groff_font/devX75-12/TBI
 OLD_FILES+=usr/share/groff_font/devX75-12/TI
 OLD_FILES+=usr/share/groff_font/devX75-12/TR
 OLD_DIRS+=usr/share/groff_font/devX75-12
 OLD_FILES+=usr/share/groff_font/devX75/CB
 OLD_FILES+=usr/share/groff_font/devX75/CBI
 OLD_FILES+=usr/share/groff_font/devX75/CI
 OLD_FILES+=usr/share/groff_font/devX75/CR
 OLD_FILES+=usr/share/groff_font/devX75/DESC
 OLD_FILES+=usr/share/groff_font/devX75/HB
 OLD_FILES+=usr/share/groff_font/devX75/HBI
 OLD_FILES+=usr/share/groff_font/devX75/HI
 OLD_FILES+=usr/share/groff_font/devX75/HR
 OLD_FILES+=usr/share/groff_font/devX75/NB
 OLD_FILES+=usr/share/groff_font/devX75/NBI
 OLD_FILES+=usr/share/groff_font/devX75/NI
 OLD_FILES+=usr/share/groff_font/devX75/NR
 OLD_FILES+=usr/share/groff_font/devX75/S
 OLD_FILES+=usr/share/groff_font/devX75/TB
 OLD_FILES+=usr/share/groff_font/devX75/TBI
 OLD_FILES+=usr/share/groff_font/devX75/TI
 OLD_FILES+=usr/share/groff_font/devX75/TR
 OLD_DIRS+=usr/share/groff_font/devX75
 OLD_FILES+=usr/share/groff_font/devascii/B
 OLD_FILES+=usr/share/groff_font/devascii/BI
 OLD_FILES+=usr/share/groff_font/devascii/CW
 OLD_FILES+=usr/share/groff_font/devascii/DESC
 OLD_FILES+=usr/share/groff_font/devascii/I
 OLD_FILES+=usr/share/groff_font/devascii/L
 OLD_FILES+=usr/share/groff_font/devascii/R
 OLD_FILES+=usr/share/groff_font/devascii/S
 OLD_DIRS+=usr/share/groff_font/devascii
 OLD_FILES+=usr/share/groff_font/devcp1047/B
 OLD_FILES+=usr/share/groff_font/devcp1047/BI
 OLD_FILES+=usr/share/groff_font/devcp1047/CW
 OLD_FILES+=usr/share/groff_font/devcp1047/DESC
 OLD_FILES+=usr/share/groff_font/devcp1047/I
 OLD_FILES+=usr/share/groff_font/devcp1047/L
 OLD_FILES+=usr/share/groff_font/devcp1047/R
 OLD_FILES+=usr/share/groff_font/devcp1047/S
 OLD_DIRS+=usr/share/groff_font/devcp1047
 OLD_FILES+=usr/share/groff_font/devdvi/CW
 OLD_FILES+=usr/share/groff_font/devdvi/CWEC
 OLD_FILES+=usr/share/groff_font/devdvi/CWI
 OLD_FILES+=usr/share/groff_font/devdvi/CWIEC
 OLD_FILES+=usr/share/groff_font/devdvi/CWITC
 OLD_FILES+=usr/share/groff_font/devdvi/CWTC
 OLD_FILES+=usr/share/groff_font/devdvi/CompileFonts
 OLD_FILES+=usr/share/groff_font/devdvi/DESC
 OLD_FILES+=usr/share/groff_font/devdvi/EX
 OLD_FILES+=usr/share/groff_font/devdvi/HB
 OLD_FILES+=usr/share/groff_font/devdvi/HBEC
 OLD_FILES+=usr/share/groff_font/devdvi/HBI
 OLD_FILES+=usr/share/groff_font/devdvi/HBIEC
 OLD_FILES+=usr/share/groff_font/devdvi/HBITC
 OLD_FILES+=usr/share/groff_font/devdvi/HBTC
 OLD_FILES+=usr/share/groff_font/devdvi/HI
 OLD_FILES+=usr/share/groff_font/devdvi/HIEC
 OLD_FILES+=usr/share/groff_font/devdvi/HITC
 OLD_FILES+=usr/share/groff_font/devdvi/HR
 OLD_FILES+=usr/share/groff_font/devdvi/HREC
 OLD_FILES+=usr/share/groff_font/devdvi/HRTC
 OLD_FILES+=usr/share/groff_font/devdvi/MI
 OLD_FILES+=usr/share/groff_font/devdvi/Makefile
 OLD_FILES+=usr/share/groff_font/devdvi/S
 OLD_FILES+=usr/share/groff_font/devdvi/SA
 OLD_FILES+=usr/share/groff_font/devdvi/SB
 OLD_FILES+=usr/share/groff_font/devdvi/SC
 OLD_FILES+=usr/share/groff_font/devdvi/TB
 OLD_FILES+=usr/share/groff_font/devdvi/TBEC
 OLD_FILES+=usr/share/groff_font/devdvi/TBI
 OLD_FILES+=usr/share/groff_font/devdvi/TBIEC
 OLD_FILES+=usr/share/groff_font/devdvi/TBITC
 OLD_FILES+=usr/share/groff_font/devdvi/TBTC
 OLD_FILES+=usr/share/groff_font/devdvi/TI
 OLD_FILES+=usr/share/groff_font/devdvi/TIEC
 OLD_FILES+=usr/share/groff_font/devdvi/TITC
 OLD_FILES+=usr/share/groff_font/devdvi/TR
 OLD_FILES+=usr/share/groff_font/devdvi/TREC
 OLD_FILES+=usr/share/groff_font/devdvi/TRTC
 OLD_FILES+=usr/share/groff_font/devdvi/ec.map
 OLD_FILES+=usr/share/groff_font/devdvi/msam.map
 OLD_FILES+=usr/share/groff_font/devdvi/msbm.map
 OLD_FILES+=usr/share/groff_font/devdvi/tc.map
 OLD_FILES+=usr/share/groff_font/devdvi/texb.map
 OLD_FILES+=usr/share/groff_font/devdvi/texex.map
 OLD_FILES+=usr/share/groff_font/devdvi/texi.map
 OLD_FILES+=usr/share/groff_font/devdvi/texmi.map
 OLD_FILES+=usr/share/groff_font/devdvi/texr.map
 OLD_FILES+=usr/share/groff_font/devdvi/texsy.map
 OLD_FILES+=usr/share/groff_font/devdvi/textex.map
 OLD_FILES+=usr/share/groff_font/devdvi/textt.map
 OLD_DIRS+=usr/share/groff_font/devdvi
 OLD_FILES+=usr/share/groff_font/devhtml/B
 OLD_FILES+=usr/share/groff_font/devhtml/BI
 OLD_FILES+=usr/share/groff_font/devhtml/CB
 OLD_FILES+=usr/share/groff_font/devhtml/CBI
 OLD_FILES+=usr/share/groff_font/devhtml/CI
 OLD_FILES+=usr/share/groff_font/devhtml/CR
 OLD_FILES+=usr/share/groff_font/devhtml/DESC
 OLD_FILES+=usr/share/groff_font/devhtml/I
 OLD_FILES+=usr/share/groff_font/devhtml/R
 OLD_FILES+=usr/share/groff_font/devhtml/S
 OLD_DIRS+=usr/share/groff_font/devhtml
 OLD_FILES+=usr/share/groff_font/devkoi8-r/B
 OLD_FILES+=usr/share/groff_font/devkoi8-r/BI
 OLD_FILES+=usr/share/groff_font/devkoi8-r/CW
 OLD_FILES+=usr/share/groff_font/devkoi8-r/DESC
 OLD_FILES+=usr/share/groff_font/devkoi8-r/I
 OLD_FILES+=usr/share/groff_font/devkoi8-r/L
 OLD_FILES+=usr/share/groff_font/devkoi8-r/R
 OLD_FILES+=usr/share/groff_font/devkoi8-r/S
 OLD_DIRS+=usr/share/groff_font/devkoi8-r
 OLD_FILES+=usr/share/groff_font/devlatin1/B
 OLD_FILES+=usr/share/groff_font/devlatin1/BI
 OLD_FILES+=usr/share/groff_font/devlatin1/CW
 OLD_FILES+=usr/share/groff_font/devlatin1/DESC
 OLD_FILES+=usr/share/groff_font/devlatin1/I
 OLD_FILES+=usr/share/groff_font/devlatin1/L
 OLD_FILES+=usr/share/groff_font/devlatin1/R
 OLD_FILES+=usr/share/groff_font/devlatin1/S
 OLD_DIRS+=usr/share/groff_font/devlatin1
 OLD_FILES+=usr/share/groff_font/devlbp/CB
 OLD_FILES+=usr/share/groff_font/devlbp/CI
 OLD_FILES+=usr/share/groff_font/devlbp/CR
 OLD_FILES+=usr/share/groff_font/devlbp/DESC
 OLD_FILES+=usr/share/groff_font/devlbp/EB
 OLD_FILES+=usr/share/groff_font/devlbp/EI
 OLD_FILES+=usr/share/groff_font/devlbp/ER
 OLD_FILES+=usr/share/groff_font/devlbp/HB
 OLD_FILES+=usr/share/groff_font/devlbp/HBI
 OLD_FILES+=usr/share/groff_font/devlbp/HI
 OLD_FILES+=usr/share/groff_font/devlbp/HNB
 OLD_FILES+=usr/share/groff_font/devlbp/HNBI
 OLD_FILES+=usr/share/groff_font/devlbp/HNI
 OLD_FILES+=usr/share/groff_font/devlbp/HNR
 OLD_FILES+=usr/share/groff_font/devlbp/HR
 OLD_FILES+=usr/share/groff_font/devlbp/TB
 OLD_FILES+=usr/share/groff_font/devlbp/TBI
 OLD_FILES+=usr/share/groff_font/devlbp/TI
 OLD_FILES+=usr/share/groff_font/devlbp/TR
 OLD_DIRS+=usr/share/groff_font/devlbp
 OLD_FILES+=usr/share/groff_font/devlj4/AB
 OLD_FILES+=usr/share/groff_font/devlj4/ABI
 OLD_FILES+=usr/share/groff_font/devlj4/AI
 OLD_FILES+=usr/share/groff_font/devlj4/ALBB
 OLD_FILES+=usr/share/groff_font/devlj4/ALBR
 OLD_FILES+=usr/share/groff_font/devlj4/AOB
 OLD_FILES+=usr/share/groff_font/devlj4/AOI
 OLD_FILES+=usr/share/groff_font/devlj4/AOR
 OLD_FILES+=usr/share/groff_font/devlj4/AR
 OLD_FILES+=usr/share/groff_font/devlj4/CB
 OLD_FILES+=usr/share/groff_font/devlj4/CBI
 OLD_FILES+=usr/share/groff_font/devlj4/CI
 OLD_FILES+=usr/share/groff_font/devlj4/CLARENDON
 OLD_FILES+=usr/share/groff_font/devlj4/CORONET
 OLD_FILES+=usr/share/groff_font/devlj4/CR
 OLD_FILES+=usr/share/groff_font/devlj4/DESC
 OLD_FILES+=usr/share/groff_font/devlj4/GB
 OLD_FILES+=usr/share/groff_font/devlj4/GBI
 OLD_FILES+=usr/share/groff_font/devlj4/GI
 OLD_FILES+=usr/share/groff_font/devlj4/GR
 OLD_FILES+=usr/share/groff_font/devlj4/LGB
 OLD_FILES+=usr/share/groff_font/devlj4/LGI
 OLD_FILES+=usr/share/groff_font/devlj4/LGR
 OLD_FILES+=usr/share/groff_font/devlj4/MARIGOLD
 OLD_FILES+=usr/share/groff_font/devlj4/OB
 OLD_FILES+=usr/share/groff_font/devlj4/OBI
 OLD_FILES+=usr/share/groff_font/devlj4/OI
 OLD_FILES+=usr/share/groff_font/devlj4/OR
 OLD_FILES+=usr/share/groff_font/devlj4/S
 OLD_FILES+=usr/share/groff_font/devlj4/SYMBOL
 OLD_FILES+=usr/share/groff_font/devlj4/TB
 OLD_FILES+=usr/share/groff_font/devlj4/TBI
 OLD_FILES+=usr/share/groff_font/devlj4/TI
 OLD_FILES+=usr/share/groff_font/devlj4/TNRB
 OLD_FILES+=usr/share/groff_font/devlj4/TNRBI
 OLD_FILES+=usr/share/groff_font/devlj4/TNRI
 OLD_FILES+=usr/share/groff_font/devlj4/TNRR
 OLD_FILES+=usr/share/groff_font/devlj4/TR
 OLD_FILES+=usr/share/groff_font/devlj4/UB
 OLD_FILES+=usr/share/groff_font/devlj4/UBI
 OLD_FILES+=usr/share/groff_font/devlj4/UCB
 OLD_FILES+=usr/share/groff_font/devlj4/UCBI
 OLD_FILES+=usr/share/groff_font/devlj4/UCI
 OLD_FILES+=usr/share/groff_font/devlj4/UCR
 OLD_FILES+=usr/share/groff_font/devlj4/UI
 OLD_FILES+=usr/share/groff_font/devlj4/UR
 OLD_FILES+=usr/share/groff_font/devlj4/WINGDINGS
 OLD_DIRS+=usr/share/groff_font/devlj4
 OLD_FILES+=usr/share/groff_font/devps/AB
 OLD_FILES+=usr/share/groff_font/devps/ABI
 OLD_FILES+=usr/share/groff_font/devps/AI
 OLD_FILES+=usr/share/groff_font/devps/AR
 OLD_FILES+=usr/share/groff_font/devps/BMB
 OLD_FILES+=usr/share/groff_font/devps/BMBI
 OLD_FILES+=usr/share/groff_font/devps/BMI
 OLD_FILES+=usr/share/groff_font/devps/BMR
 OLD_FILES+=usr/share/groff_font/devps/CB
 OLD_FILES+=usr/share/groff_font/devps/CBI
 OLD_FILES+=usr/share/groff_font/devps/CI
 OLD_FILES+=usr/share/groff_font/devps/CR
 OLD_FILES+=usr/share/groff_font/devps/DESC
 OLD_FILES+=usr/share/groff_font/devps/EURO
 OLD_FILES+=usr/share/groff_font/devps/HB
 OLD_FILES+=usr/share/groff_font/devps/HBI
 OLD_FILES+=usr/share/groff_font/devps/HI
 OLD_FILES+=usr/share/groff_font/devps/HNB
 OLD_FILES+=usr/share/groff_font/devps/HNBI
 OLD_FILES+=usr/share/groff_font/devps/HNI
 OLD_FILES+=usr/share/groff_font/devps/HNR
 OLD_FILES+=usr/share/groff_font/devps/HR
 OLD_FILES+=usr/share/groff_font/devps/Makefile
 OLD_FILES+=usr/share/groff_font/devps/NB
 OLD_FILES+=usr/share/groff_font/devps/NBI
 OLD_FILES+=usr/share/groff_font/devps/NI
 OLD_FILES+=usr/share/groff_font/devps/NR
 OLD_FILES+=usr/share/groff_font/devps/PB
 OLD_FILES+=usr/share/groff_font/devps/PBI
 OLD_FILES+=usr/share/groff_font/devps/PI
 OLD_FILES+=usr/share/groff_font/devps/PR
 OLD_FILES+=usr/share/groff_font/devps/S
 OLD_FILES+=usr/share/groff_font/devps/SS
 OLD_FILES+=usr/share/groff_font/devps/TB
 OLD_FILES+=usr/share/groff_font/devps/TBI
 OLD_FILES+=usr/share/groff_font/devps/TI
 OLD_FILES+=usr/share/groff_font/devps/TR
 OLD_FILES+=usr/share/groff_font/devps/ZCMI
 OLD_FILES+=usr/share/groff_font/devps/ZD
 OLD_FILES+=usr/share/groff_font/devps/ZDR
 OLD_FILES+=usr/share/groff_font/devps/afmname
 OLD_FILES+=usr/share/groff_font/devps/dingbats.map
 OLD_FILES+=usr/share/groff_font/devps/dingbats.rmap
 OLD_FILES+=usr/share/groff_font/devps/download
 OLD_FILES+=usr/share/groff_font/devps/freeeuro.pfa
 OLD_FILES+=usr/share/groff_font/devps/lgreekmap
 OLD_FILES+=usr/share/groff_font/devps/prologue
 OLD_FILES+=usr/share/groff_font/devps/symbol.sed
 OLD_FILES+=usr/share/groff_font/devps/symbolchars
 OLD_FILES+=usr/share/groff_font/devps/symbolsl.afm
 OLD_FILES+=usr/share/groff_font/devps/symbolsl.pfa
 OLD_FILES+=usr/share/groff_font/devps/text.enc
 OLD_FILES+=usr/share/groff_font/devps/textmap
 OLD_FILES+=usr/share/groff_font/devps/zapfdr.pfa
 OLD_DIRS+=usr/share/groff_font/devps
 OLD_FILES+=usr/share/groff_font/devutf8/B
 OLD_FILES+=usr/share/groff_font/devutf8/BI
 OLD_FILES+=usr/share/groff_font/devutf8/CW
 OLD_FILES+=usr/share/groff_font/devutf8/DESC
 OLD_FILES+=usr/share/groff_font/devutf8/I
 OLD_FILES+=usr/share/groff_font/devutf8/L
 OLD_FILES+=usr/share/groff_font/devutf8/R
 OLD_FILES+=usr/share/groff_font/devutf8/S
 OLD_DIRS+=usr/share/groff_font/devutf8
 OLD_DIRS+=usr/share/groff_font
 OLD_FILES+=usr/share/info/groff.info.gz
 OLD_FILES+=usr/share/man/man1/addftinfo.1.gz
 OLD_FILES+=usr/share/man/man1/afmtodit.1.gz
 OLD_FILES+=usr/share/man/man1/eqn.1.gz
 OLD_FILES+=usr/share/man/man1/grn.1.gz
 OLD_FILES+=usr/share/man/man1/grodvi.1.gz
 OLD_FILES+=usr/share/man/man1/groff.1.gz
 OLD_FILES+=usr/share/man/man1/grog.1.gz
 OLD_FILES+=usr/share/man/man1/grolbp.1.gz
 OLD_FILES+=usr/share/man/man1/grolj4.1.gz
 OLD_FILES+=usr/share/man/man1/grops.1.gz
 OLD_FILES+=usr/share/man/man1/grotty.1.gz
 OLD_FILES+=usr/share/man/man1/hpftodit.1.gz
 OLD_FILES+=usr/share/man/man1/indxbib.1.gz
 OLD_FILES+=usr/share/man/man1/lkbib.1.gz
 OLD_FILES+=usr/share/man/man1/lookbib.1.gz
 OLD_FILES+=usr/share/man/man1/mmroff.1.gz
 OLD_FILES+=usr/share/man/man1/neqn.1.gz
 OLD_FILES+=usr/share/man/man1/nroff.1.gz
 OLD_FILES+=usr/share/man/man1/pfbtops.1.gz
 OLD_FILES+=usr/share/man/man1/pic.1.gz
 OLD_FILES+=usr/share/man/man1/psroff.1.gz
 OLD_FILES+=usr/share/man/man1/refer.1.gz
 OLD_FILES+=usr/share/man/man1/soelim.1.gz
 OLD_FILES+=usr/share/man/man1/tbl.1.gz
 OLD_FILES+=usr/share/man/man1/tfmtodit.1.gz
 OLD_FILES+=usr/share/man/man1/troff.1.gz
 OLD_FILES+=usr/share/man/man1/vgrind.1.gz
 OLD_FILES+=usr/share/man/man5/groff_font.5.gz
 OLD_FILES+=usr/share/man/man5/groff_out.5.gz
 OLD_FILES+=usr/share/man/man5/groff_tmac.5.gz
 OLD_FILES+=usr/share/man/man5/lj4_font.5.gz
 OLD_FILES+=usr/share/man/man5/tmac.5.gz
 OLD_FILES+=usr/share/man/man5/vgrindefs.5.gz
 OLD_FILES+=usr/share/man/man7/ditroff.7.gz
 OLD_FILES+=usr/share/man/man7/groff.7.gz
 OLD_FILES+=usr/share/man/man7/groff_char.7.gz
 OLD_FILES+=usr/share/man/man7/groff_diff.7.gz
 OLD_FILES+=usr/share/man/man7/groff_man.7.gz
 OLD_FILES+=usr/share/man/man7/groff_mdoc.7.gz
 OLD_FILES+=usr/share/man/man7/groff_me.7.gz
 OLD_FILES+=usr/share/man/man7/groff_mm.7.gz
 OLD_FILES+=usr/share/man/man7/groff_mmse.7.gz
 OLD_FILES+=usr/share/man/man7/groff_ms.7.gz
 OLD_FILES+=usr/share/man/man7/groff_trace.7.gz
 OLD_FILES+=usr/share/man/man7/groff_www.7.gz
 OLD_FILES+=usr/share/man/man7/mdoc.samples.7.gz
 OLD_FILES+=usr/share/man/man7/me.7.gz
 OLD_FILES+=usr/share/man/man7/mm.7.gz
 OLD_FILES+=usr/share/man/man7/mmse.7.gz
 OLD_FILES+=usr/share/man/man7/ms.7.gz
 OLD_FILES+=usr/share/man/man7/orig_me.7.gz
 OLD_FILES+=usr/share/man/man7/roff.7.gz
 OLD_FILES+=usr/share/me/acm.me
 OLD_FILES+=usr/share/me/chars.me
 OLD_FILES+=usr/share/me/deltext.me
 OLD_FILES+=usr/share/me/eqn.me
 OLD_FILES+=usr/share/me/float.me
 OLD_FILES+=usr/share/me/footnote.me
 OLD_FILES+=usr/share/me/index.me
 OLD_FILES+=usr/share/me/letterhead.me
 OLD_FILES+=usr/share/me/local.me
 OLD_FILES+=usr/share/me/null.me
 OLD_FILES+=usr/share/me/refer.me
 OLD_FILES+=usr/share/me/revisions
 OLD_FILES+=usr/share/me/sh.me
 OLD_FILES+=usr/share/me/tbl.me
 OLD_FILES+=usr/share/me/thesis.me
 OLD_DIRS+=usr/share/me
 OLD_FILES+=usr/share/misc/vgrindefs
 OLD_FILES+=usr/share/misc/vgrindefs.db
 OLD_FILES+=usr/share/tmac/X.tmac
 OLD_FILES+=usr/share/tmac/Xps.tmac
 OLD_FILES+=usr/share/tmac/a4.tmac
 OLD_FILES+=usr/share/tmac/an-old.tmac
 OLD_FILES+=usr/share/tmac/an.tmac
 OLD_FILES+=usr/share/tmac/andoc.tmac
 OLD_FILES+=usr/share/tmac/composite.tmac
 OLD_FILES+=usr/share/tmac/cp1047.tmac
 OLD_FILES+=usr/share/tmac/devtag.tmac
 OLD_FILES+=usr/share/tmac/doc.tmac
 OLD_FILES+=usr/share/tmac/dvi.tmac
 OLD_FILES+=usr/share/tmac/e.tmac
 OLD_FILES+=usr/share/tmac/ec.tmac
 OLD_FILES+=usr/share/tmac/eqnrc
 OLD_FILES+=usr/share/tmac/europs.tmac
 OLD_FILES+=usr/share/tmac/html-end.tmac
 OLD_FILES+=usr/share/tmac/html.tmac
 OLD_FILES+=usr/share/tmac/hyphen.ru
 OLD_FILES+=usr/share/tmac/hyphen.us
 OLD_FILES+=usr/share/tmac/hyphenex.us
 OLD_FILES+=usr/share/tmac/koi8-r.tmac
 OLD_FILES+=usr/share/tmac/latin1.tmac
 OLD_FILES+=usr/share/tmac/latin2.tmac
 OLD_FILES+=usr/share/tmac/latin9.tmac
 OLD_FILES+=usr/share/tmac/lbp.tmac
 OLD_FILES+=usr/share/tmac/lj4.tmac
 OLD_FILES+=usr/share/tmac/m.tmac
 OLD_FILES+=usr/share/tmac/man.local
 OLD_FILES+=usr/share/tmac/man.tmac
 OLD_FILES+=usr/share/tmac/mandoc.tmac
 OLD_FILES+=usr/share/tmac/mdoc.local
 OLD_FILES+=usr/share/tmac/mdoc.tmac
 OLD_FILES+=usr/share/tmac/mdoc/doc-common
 OLD_FILES+=usr/share/tmac/mdoc/doc-ditroff
 OLD_FILES+=usr/share/tmac/mdoc/doc-nroff
 OLD_FILES+=usr/share/tmac/mdoc/doc-syms
 OLD_FILES+=usr/share/tmac/mdoc/fr.ISO8859-1
 OLD_FILES+=usr/share/tmac/mdoc/ru.KOI8-R
 OLD_DIRS+=usr/share/tmac/mdoc
 OLD_FILES+=usr/share/tmac/me.tmac
 OLD_FILES+=usr/share/tmac/mm/0.MT
 OLD_FILES+=usr/share/tmac/mm/4.MT
 OLD_FILES+=usr/share/tmac/mm/5.MT
 OLD_FILES+=usr/share/tmac/mm/locale
 OLD_FILES+=usr/share/tmac/mm/mm.tmac
 OLD_FILES+=usr/share/tmac/mm/mmse.tmac
 OLD_FILES+=usr/share/tmac/mm/ms.cov
 OLD_FILES+=usr/share/tmac/mm/se_locale
 OLD_FILES+=usr/share/tmac/mm/se_ms.cov
 OLD_DIRS+=usr/share/tmac/mm
 OLD_FILES+=usr/share/tmac/ms.tmac
 OLD_FILES+=usr/share/tmac/mse.tmac
 OLD_FILES+=usr/share/tmac/papersize.tmac
 OLD_FILES+=usr/share/tmac/pic.tmac
 OLD_FILES+=usr/share/tmac/ps.tmac
 OLD_FILES+=usr/share/tmac/psatk.tmac
 OLD_FILES+=usr/share/tmac/psold.tmac
 OLD_FILES+=usr/share/tmac/pspic.tmac
 OLD_FILES+=usr/share/tmac/s.tmac
 OLD_FILES+=usr/share/tmac/safer.tmac
 OLD_FILES+=usr/share/tmac/tmac.orig_me
 OLD_FILES+=usr/share/tmac/tmac.vgrind
 OLD_FILES+=usr/share/tmac/trace.tmac
 OLD_FILES+=usr/share/tmac/troffrc
 OLD_FILES+=usr/share/tmac/troffrc-end
 OLD_FILES+=usr/share/tmac/tty-char.tmac
 OLD_FILES+=usr/share/tmac/tty.tmac
 OLD_FILES+=usr/share/tmac/unicode.tmac
 OLD_FILES+=usr/share/tmac/www.tmac
 OLD_DIRS+=usr/share/tmac
 .endif
 
 .if ${MK_GSSAPI} == no
 OLD_FILES+=usr/include/gssapi/gssapi.h
 OLD_DIRS+=usr/include/gssapi
 OLD_FILES+=usr/include/gssapi.h
 OLD_FILES+=usr/lib/libgssapi.a
 OLD_FILES+=usr/lib/libgssapi.so
 OLD_LIBS+=usr/lib/libgssapi.so.10
 OLD_FILES+=usr/lib/libgssapi_p.a
 OLD_FILES+=usr/lib/librpcsec_gss.a
 OLD_FILES+=usr/lib/librpcsec_gss.so
 OLD_LIBS+=usr/lib/librpcsec_gss.so.1
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/libgssapi.a
 OLD_FILES+=usr/lib32/libgssapi.so
 OLD_LIBS+=usr/lib32/libgssapi.so.10
 OLD_FILES+=usr/lib32/libgssapi_p.a
 OLD_FILES+=usr/lib32/librpcsec_gss.a
 OLD_FILES+=usr/lib32/librpcsec_gss.so
 OLD_LIBS+=usr/lib32/librpcsec_gss.so.1
 .endif
 OLD_FILES+=usr/sbin/gssd
 OLD_FILES+=usr/share/man/man3/gss_accept_sec_context.3.gz
 OLD_FILES+=usr/share/man/man3/gss_acquire_cred.3.gz
 OLD_FILES+=usr/share/man/man3/gss_add_cred.3.gz
 OLD_FILES+=usr/share/man/man3/gss_add_oid_set_member.3.gz
 OLD_FILES+=usr/share/man/man3/gss_canonicalize_name.3.gz
 OLD_FILES+=usr/share/man/man3/gss_compare_name.3.gz
 OLD_FILES+=usr/share/man/man3/gss_context_time.3.gz
 OLD_FILES+=usr/share/man/man3/gss_create_empty_oid_set.3.gz
 OLD_FILES+=usr/share/man/man3/gss_delete_sec_context.3.gz
 OLD_FILES+=usr/share/man/man3/gss_display_name.3.gz
 OLD_FILES+=usr/share/man/man3/gss_display_status.3.gz
 OLD_FILES+=usr/share/man/man3/gss_duplicate_name.3.gz
 OLD_FILES+=usr/share/man/man3/gss_export_name.3.gz
 OLD_FILES+=usr/share/man/man3/gss_export_sec_context.3.gz
 OLD_FILES+=usr/share/man/man3/gss_get_mic.3.gz
 OLD_FILES+=usr/share/man/man3/gss_import_name.3.gz
 OLD_FILES+=usr/share/man/man3/gss_import_sec_context.3.gz
 OLD_FILES+=usr/share/man/man3/gss_indicate_mechs.3.gz
 OLD_FILES+=usr/share/man/man3/gss_init_sec_context.3.gz
 OLD_FILES+=usr/share/man/man3/gss_inquire_context.3.gz
 OLD_FILES+=usr/share/man/man3/gss_inquire_cred.3.gz
 OLD_FILES+=usr/share/man/man3/gss_inquire_cred_by_mech.3.gz
 OLD_FILES+=usr/share/man/man3/gss_inquire_mechs_for_name.3.gz
 OLD_FILES+=usr/share/man/man3/gss_inquire_names_for_mech.3.gz
 OLD_FILES+=usr/share/man/man3/gss_process_context_token.3.gz
 OLD_FILES+=usr/share/man/man3/gss_release_buffer.3.gz
 OLD_FILES+=usr/share/man/man3/gss_release_cred.3.gz
 OLD_FILES+=usr/share/man/man3/gss_release_name.3.gz
 OLD_FILES+=usr/share/man/man3/gss_release_oid_set.3.gz
 OLD_FILES+=usr/share/man/man3/gss_seal.3.gz
 OLD_FILES+=usr/share/man/man3/gss_sign.3.gz
 OLD_FILES+=usr/share/man/man3/gss_test_oid_set_member.3.gz
 OLD_FILES+=usr/share/man/man3/gss_unseal.3.gz
 OLD_FILES+=usr/share/man/man3/gss_unwrap.3.gz
 OLD_FILES+=usr/share/man/man3/gss_verify.3.gz
 OLD_FILES+=usr/share/man/man3/gss_verify_mic.3.gz
 OLD_FILES+=usr/share/man/man3/gss_wrap.3.gz
 OLD_FILES+=usr/share/man/man3/gss_wrap_size_limit.3.gz
 OLD_FILES+=usr/share/man/man3/gssapi.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_get_error.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_get_mech_info.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_get_mechanisms.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_get_principal_name.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_get_versions.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_getcred.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_is_installed.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_max_data_length.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_mech_to_oid.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_oid_to_mech.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_qop_to_num.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_seccreate.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_set_callback.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_set_defaults.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_set_svc_name.3.gz
 OLD_FILES+=usr/share/man/man3/rpc_gss_svc_max_data_length.3.gz
 OLD_FILES+=usr/share/man/man3/rpcsec_gss.3.gz
 OLD_FILES+=usr/share/man/man5/mech.5.gz
 OLD_FILES+=usr/share/man/man5/qop.5.gz
 OLD_FILES+=usr/share/man/man8/gssd.8.gz
 .endif
 
 .if ${MK_HESIOD} == no
 OLD_FILES+=usr/bin/hesinfo
 OLD_FILES+=usr/include/hesiod.h
 OLD_FILES+=usr/share/man/man1/hesinfo.1.gz
 OLD_FILES+=usr/share/man/man3/hesiod.3.gz
 OLD_FILES+=usr/share/man/man5/hesiod.conf.5.gz
 .endif
 
 #.if ${MK_HTML} == no
 # to be filled in
 #.endif
 
 .if ${MK_ICONV} == no
 OLD_FILES+=usr/bin/iconv
 OLD_FILES+=usr/bin/mkcsmapper
 OLD_FILES+=usr/bin/mkesdb
 OLD_FILES+=usr/include/_libiconv_compat.h
 OLD_FILES+=usr/include/iconv.h
 OLD_FILES+=usr/share/man/man1/iconv.1.gz
 OLD_FILES+=usr/share/man/man1/mkcsmapper.1.gz
 OLD_FILES+=usr/share/man/man1/mkesdb.1.gz
 OLD_FILES+=usr/share/man/man3/__iconv.3.gz
 OLD_FILES+=usr/share/man/man3/__iconv_free_list.3.gz	
 OLD_FILES+=usr/share/man/man3/__iconv_get_list.3.gz
 OLD_FILES+=usr/share/man/man3/iconv.3.gz
 OLD_FILES+=usr/share/man/man3/iconv_canonicalize.3.gz	
 OLD_FILES+=usr/share/man/man3/iconv_close.3.gz
 OLD_FILES+=usr/share/man/man3/iconv_open.3.gz
 OLD_FILES+=usr/share/man/man3/iconv_open_into.3.gz
 OLD_FILES+=usr/share/man/man3/iconvctl.3.gz
 OLD_FILES+=usr/share/man/man3/iconvlist.3.gz	
 .endif
 
 .if ${MK_INET6} == no
 OLD_FILES+=sbin/ping6
 OLD_FILES+=sbin/rtsol
 OLD_FILES+=usr/sbin/ip6addrctl
 OLD_FILES+=usr/sbin/mld6query
 OLD_FILES+=usr/sbin/ndp
 OLD_FILES+=usr/sbin/rip6query
 OLD_FILES+=usr/sbin/route6d
 OLD_FILES+=usr/sbin/rrenumd
 OLD_FILES+=usr/sbin/rtadvd
 OLD_FILES+=usr/sbin/rtsold
 OLD_FILES+=usr/sbin/traceroute6
 OLD_FILES+=usr/share/man/man5/rrenumd.conf.5.gz
 OLD_FILES+=usr/share/man/man5/rtadvd.conf.5.gz
 OLD_FILES+=usr/share/man/man8/ip6addrctl.8.gz
 OLD_FILES+=usr/share/man/man8/mld6query.8.gz
 OLD_FILES+=usr/share/man/man8/ndp.8.gz
 OLD_FILES+=usr/share/man/man8/ping6.8.gz
 OLD_FILES+=usr/share/man/man8/rip6query.8.gz
 OLD_FILES+=usr/share/man/man8/route6d.8.gz
 OLD_FILES+=usr/share/man/man8/rrenumd.8.gz
 OLD_FILES+=usr/share/man/man8/rtadvd.8.gz
 OLD_FILES+=usr/share/man/man8/rtsol.8.gz
 OLD_FILES+=usr/share/man/man8/rtsold.8.gz
 OLD_FILES+=usr/share/man/man8/traceroute6.8.gz
 .endif
 
 .if ${MK_INET6_SUPPORT} == no
 OLD_FILES+=rescue/ping6
 .endif
 
 .if ${MK_INFO} == no
 OLD_FILES+=usr/bin/info
 OLD_FILES+=usr/bin/infokey
 OLD_FILES+=usr/bin/install-info
 OLD_FILES+=usr/bin/makeinfo
 OLD_FILES+=usr/bin/texindex
 OLD_FILES+=usr/share/info/am-utils.info.gz
 OLD_FILES+=usr/share/info/as-utils.info.gz
 OLD_FILES+=usr/share/info/binutils.info.gz
 OLD_FILES+=usr/share/info/com_err.info.gz
 OLD_FILES+=usr/share/info/diff.info.gz
 OLD_FILES+=usr/share/info/gdb.info.gz
 OLD_FILES+=usr/share/info/gdbint.info.gz
 OLD_FILES+=usr/share/info/gperf.info.gz
 OLD_FILES+=usr/share/info/grep.info.gz
 OLD_FILES+=usr/share/info/groff.info.gz
 OLD_FILES+=usr/share/info/heimdal.info.gz
 OLD_FILES+=usr/share/info/history.info.gz
 OLD_FILES+=usr/share/info/info-stnd.info.gz
 OLD_FILES+=usr/share/info/info.info.gz
 OLD_FILES+=usr/share/info/ld.info.gz
 OLD_FILES+=usr/share/info/regex.info.gz
 OLD_FILES+=usr/share/info/rluserman.info.gz
 OLD_FILES+=usr/share/info/stabs.info.gz
 OLD_FILES+=usr/share/info/texinfo.info.gz
 OLD_FILES+=usr/share/man/man1/info.1.gz
 OLD_FILES+=usr/share/man/man1/infokey.1.gz
 OLD_FILES+=usr/share/man/man1/install-info.1.gz
 OLD_FILES+=usr/share/man/man1/makeinfo.1.gz
 OLD_FILES+=usr/share/man/man1/texindex.1.gz
 OLD_FILES+=usr/share/man/man5/info.5.gz
 OLD_FILES+=usr/share/man/man5/texinfo.5.gz
 .endif
 
 .if ${MK_IPFILTER} == no
 OLD_FILES+=etc/periodic/security/510.ipfdenied
 OLD_FILES+=etc/periodic/security/610.ipf6denied
 OLD_FILES+=rescue/ipf
 OLD_FILES+=sbin/ipf
 OLD_FILES+=sbin/ipfs
 OLD_FILES+=sbin/ipfstat
 OLD_FILES+=sbin/ipftest
 OLD_FILES+=sbin/ipmon
 OLD_FILES+=sbin/ipnat
 OLD_FILES+=sbin/ippool
 OLD_FILES+=sbin/ipresend
 OLD_FILES+=usr/include/netinet/ip_auth.h
 OLD_FILES+=usr/include/netinet/ip_compat.h
 OLD_FILES+=usr/include/netinet/ip_fil.h
 OLD_FILES+=usr/include/netinet/ip_frag.h
 OLD_FILES+=usr/include/netinet/ip_htable.h
 OLD_FILES+=usr/include/netinet/ip_lookup.h
 OLD_FILES+=usr/include/netinet/ip_nat.h
 OLD_FILES+=usr/include/netinet/ip_pool.h
 OLD_FILES+=usr/include/netinet/ip_proxy.h
 OLD_FILES+=usr/include/netinet/ip_rules.h
 OLD_FILES+=usr/include/netinet/ip_scan.h
 OLD_FILES+=usr/include/netinet/ip_state.h
 OLD_FILES+=usr/include/netinet/ip_sync.h
 OLD_FILES+=usr/include/netinet/ipl.h
 OLD_FILES+=usr/share/examples/ipfilter/README
 OLD_FILES+=usr/share/examples/ipfilter/BASIC.NAT
 OLD_FILES+=usr/share/examples/ipfilter/BASIC_1.FW
 OLD_FILES+=usr/share/examples/ipfilter/BASIC_2.FW
 OLD_FILES+=usr/share/examples/ipfilter/example.1
 OLD_FILES+=usr/share/examples/ipfilter/example.2
 OLD_FILES+=usr/share/examples/ipfilter/example.3
 OLD_FILES+=usr/share/examples/ipfilter/example.4
 OLD_FILES+=usr/share/examples/ipfilter/example.5
 OLD_FILES+=usr/share/examples/ipfilter/example.6
 OLD_FILES+=usr/share/examples/ipfilter/example.7
 OLD_FILES+=usr/share/examples/ipfilter/example.8
 OLD_FILES+=usr/share/examples/ipfilter/example.9
 OLD_FILES+=usr/share/examples/ipfilter/example.10
 OLD_FILES+=usr/share/examples/ipfilter/example.11
 OLD_FILES+=usr/share/examples/ipfilter/example.12
 OLD_FILES+=usr/share/examples/ipfilter/example.13
 OLD_FILES+=usr/share/examples/ipfilter/example.sr
 OLD_FILES+=usr/share/examples/ipfilter/firewall
 OLD_FILES+=usr/share/examples/ipfilter/ftp-proxy
 OLD_FILES+=usr/share/examples/ipfilter/ftppxy
 OLD_FILES+=usr/share/examples/ipfilter/nat-setup
 OLD_FILES+=usr/share/examples/ipfilter/nat.eg
 OLD_FILES+=usr/share/examples/ipfilter/server
 OLD_FILES+=usr/share/examples/ipfilter/tcpstate
 OLD_FILES+=usr/share/examples/ipfilter/example.14
 OLD_FILES+=usr/share/examples/ipfilter/firewall.1
 OLD_FILES+=usr/share/examples/ipfilter/firewall.2
 OLD_FILES+=usr/share/examples/ipfilter/ipf.conf.permissive
 OLD_FILES+=usr/share/examples/ipfilter/ipf.conf.restrictive
 OLD_FILES+=usr/share/examples/ipfilter/ipf.conf.sample
 OLD_FILES+=usr/share/examples/ipfilter/ipnat.conf.sample
 OLD_FILES+=usr/share/examples/ipfilter/ipf-howto.txt
 OLD_FILES+=usr/share/examples/ipfilter/examples.txt
 OLD_FILES+=usr/share/examples/ipfilter/rules.txt
 OLD_FILES+=usr/share/examples/ipfilter/mkfilters
 OLD_DIRS+=usr/share/examples/ipfilter
 OLD_FILES+=usr/share/man/man1/ipftest.1.gz
 OLD_FILES+=usr/share/man/man1/ipresend.1.gz
 OLD_FILES+=usr/share/man/man4/ipf.4.gz
 OLD_FILES+=usr/share/man/man4/ipl.4.gz
 OLD_FILES+=usr/share/man/man4/ipfilter.4.gz
 OLD_FILES+=usr/share/man/man4/ipnat.4.gz
 OLD_FILES+=usr/share/man/man5/ipf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipf6.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.5.gz
 OLD_FILES+=usr/share/man/man5/ipnat.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ippool.5.gz
 OLD_FILES+=usr/share/man/man8/ipf.8.gz
 OLD_FILES+=usr/share/man/man8/ipfs.8.gz
 OLD_FILES+=usr/share/man/man8/ipfstat.8.gz
 OLD_FILES+=usr/share/man/man8/ipmon.8.gz
 OLD_FILES+=usr/share/man/man8/ipnat.8.gz
 OLD_FILES+=usr/share/man/man8/ippool.8.gz
 .endif
 
 .if ${MK_IPFW} == no
 OLD_FILES+=etc/periodic/security/500.ipfwdenied
 OLD_FILES+=etc/periodic/security/550.ipfwlimit
 OLD_FILES+=sbin/ipfw
 OLD_FILES+=sbin/natd
 OLD_FILES+=usr/sbin/ipfwpcap
 OLD_FILES+=usr/share/man/man8/ipfw.8.gz
 OLD_FILES+=usr/share/man/man8/ipfwpcap.8.gz
 OLD_FILES+=usr/share/man/man8/natd.8.gz
 .endif
 
 .if ${MK_JAIL} == no
 OLD_FILES+=usr/sbin/jail
 OLD_FILES+=usr/sbin/jexec
 OLD_FILES+=usr/sbin/jls
 OLD_FILES+=usr/share/man/man8/jail.8.gz
 OLD_FILES+=usr/share/man/man8/jexec.8.gz
 OLD_FILES+=usr/share/man/man8/jls.8.gz
 .endif
 
 .if ${MK_KERBEROS} == no
 OLD_FILES+=usr/bin/compile_et
 OLD_FILES+=usr/bin/hxtool
 OLD_FILES+=usr/bin/kadmin
 OLD_FILES+=usr/bin/kdestroy
 OLD_FILES+=usr/bin/kf
 OLD_FILES+=usr/bin/kgetcred
 OLD_FILES+=usr/bin/kinit
 OLD_FILES+=usr/bin/klist
 OLD_FILES+=usr/bin/kpasswd
 OLD_FILES+=usr/bin/krb5-config
 OLD_FILES+=usr/bin/ksu
 OLD_FILES+=usr/bin/kswitch
 OLD_FILES+=usr/bin/string2key
 OLD_FILES+=usr/bin/verify_krb5_conf
 OLD_FILES+=usr/include/asn1-common.h
 OLD_FILES+=usr/include/asn1_err.h
 OLD_FILES+=usr/include/base64.h
 OLD_FILES+=usr/include/cms_asn1.h
 OLD_FILES+=usr/include/crmf_asn1.h
 OLD_FILES+=usr/include/der-private.h
 OLD_FILES+=usr/include/der-protos.h
 OLD_FILES+=usr/include/der.h
 OLD_FILES+=usr/include/digest_asn1.h
 OLD_FILES+=usr/include/getarg.h
 OLD_FILES+=usr/include/gssapi/gssapi_krb5.h
 OLD_FILES+=usr/include/hdb-protos.h
 OLD_FILES+=usr/include/hdb.h
 OLD_FILES+=usr/include/hdb_asn1.h
 OLD_FILES+=usr/include/hdb_err.h
 OLD_FILES+=usr/include/heim_asn1.h
 OLD_FILES+=usr/include/heim_err.h
 OLD_FILES+=usr/include/heim_threads.h
 OLD_FILES+=usr/include/heimbase.h
 OLD_FILES+=usr/include/heimntlm-protos.h
 OLD_FILES+=usr/include/heimntlm.h
 OLD_FILES+=usr/include/hex.h
 OLD_FILES+=usr/include/hx509-private.h
 OLD_FILES+=usr/include/hx509-protos.h
 OLD_FILES+=usr/include/hx509.h
 OLD_FILES+=usr/include/hx509_err.h
 OLD_FILES+=usr/include/k524_err.h
 OLD_FILES+=usr/include/kadm5/admin.h
 OLD_FILES+=usr/include/kadm5/kadm5-private.h
 OLD_FILES+=usr/include/kadm5/kadm5-protos.h
 OLD_FILES+=usr/include/kadm5/kadm5-pwcheck.h
 OLD_FILES+=usr/include/kadm5/kadm5_err.h
 OLD_FILES+=usr/include/kadm5/private.h
 OLD_DIRS+=usr/include/kadm5
 OLD_FILES+=usr/include/kafs.h
 OLD_FILES+=usr/include/kdc-protos.h
 OLD_FILES+=usr/include/kdc.h
 OLD_FILES+=usr/include/krb5-private.h
 OLD_FILES+=usr/include/krb5-protos.h
 OLD_FILES+=usr/include/krb5-types.h
 OLD_FILES+=usr/include/krb5.h
 OLD_FILES+=usr/include/krb5/ccache_plugin.h
 OLD_FILES+=usr/include/krb5/locate_plugin.h
 OLD_FILES+=usr/include/krb5/send_to_kdc_plugin.h
 OLD_FILES+=usr/include/krb5/windc_plugin.h
 OLD_DIRS+=usr/include/krb5
 OLD_FILES+=usr/include/krb5_asn1.h
 OLD_FILES+=usr/include/krb5_ccapi.h
 OLD_FILES+=usr/include/krb5_err.h
 OLD_FILES+=usr/include/kx509_asn1.h
 OLD_FILES+=usr/include/ntlm_err.h
 OLD_FILES+=usr/include/ocsp_asn1.h
 OLD_FILES+=usr/include/parse_bytes.h
 OLD_FILES+=usr/include/parse_time.h
 OLD_FILES+=usr/include/parse_units.h
 OLD_FILES+=usr/include/pkcs10_asn1.h
 OLD_FILES+=usr/include/pkcs12_asn1.h
 OLD_FILES+=usr/include/pkcs8_asn1.h
 OLD_FILES+=usr/include/pkcs9_asn1.h
 OLD_FILES+=usr/include/pkinit_asn1.h
 OLD_FILES+=usr/include/resolve.h
 OLD_FILES+=usr/include/rfc2459_asn1.h
 OLD_FILES+=usr/include/roken-common.h
 OLD_FILES+=usr/include/rtbl.h
 OLD_FILES+=usr/include/wind.h
 OLD_FILES+=usr/include/wind_err.h
 OLD_FILES+=usr/include/xdbm.h
 OLD_FILES+=usr/lib/libasn1.a
 OLD_FILES+=usr/lib/libasn1.so
 OLD_LIBS+=usr/lib/libasn1.so.11
 OLD_FILES+=usr/lib/libasn1_p.a
 OLD_FILES+=usr/lib/libcom_err.a
 OLD_FILES+=usr/lib/libcom_err.so
 OLD_LIBS+=usr/lib/libcom_err.so.5
 OLD_FILES+=usr/lib/libcom_err_p.a
 OLD_FILES+=usr/lib/libgssapi_krb5.a
 OLD_FILES+=usr/lib/libgssapi_krb5.so
 OLD_LIBS+=usr/lib/libgssapi_krb5.so.10
 OLD_FILES+=usr/lib/libgssapi_krb5_p.a
 OLD_FILES+=usr/lib/libgssapi_ntlm.a
 OLD_FILES+=usr/lib/libgssapi_ntlm.so
 OLD_LIBS+=usr/lib/libgssapi_ntlm.so.10
 OLD_FILES+=usr/lib/libgssapi_ntlm_p.a
 OLD_FILES+=usr/lib/libgssapi_spnego.a
 OLD_FILES+=usr/lib/libgssapi_spnego.so
 OLD_LIBS+=usr/lib/libgssapi_spnego.so.10
 OLD_FILES+=usr/lib/libgssapi_spnego_p.a
 OLD_FILES+=usr/lib/libhdb.a
 OLD_FILES+=usr/lib/libhdb.so
 OLD_LIBS+=usr/lib/libhdb.so.11
 OLD_FILES+=usr/lib/libhdb_p.a
 OLD_FILES+=usr/lib/libheimbase.a
 OLD_FILES+=usr/lib/libheimbase.so
 OLD_LIBS+=usr/lib/libheimbase.so.11
 OLD_FILES+=usr/lib/libheimbase_p.a
 OLD_FILES+=usr/lib/libheimntlm.a
 OLD_FILES+=usr/lib/libheimntlm.so
 OLD_LIBS+=usr/lib/libheimntlm.so.11
 OLD_FILES+=usr/lib/libheimntlm_p.a
 OLD_FILES+=usr/lib/libheimsqlite.a
 OLD_FILES+=usr/lib/libheimsqlite.so
 OLD_LIBS+=usr/lib/libheimsqlite.so.11
 OLD_FILES+=usr/lib/libheimsqlite_p.a
 OLD_FILES+=usr/lib/libhx509.a
 OLD_FILES+=usr/lib/libhx509.so
 OLD_LIBS+=usr/lib/libhx509.so.11
 OLD_FILES+=usr/lib/libhx509_p.a
 OLD_FILES+=usr/lib/libkadm5clnt.a
 OLD_FILES+=usr/lib/libkadm5clnt.so
 OLD_LIBS+=usr/lib/libkadm5clnt.so.11
 OLD_FILES+=usr/lib/libkadm5clnt_p.a
 OLD_FILES+=usr/lib/libkadm5srv.a
 OLD_FILES+=usr/lib/libkadm5srv.so
 OLD_LIBS+=usr/lib/libkadm5srv.so.11
 OLD_FILES+=usr/lib/libkadm5srv_p.a
 OLD_FILES+=usr/lib/libkafs5.a
 OLD_FILES+=usr/lib/libkafs5.so
 OLD_LIBS+=usr/lib/libkafs5.so.11
 OLD_FILES+=usr/lib/libkafs5_p.a
 OLD_FILES+=usr/lib/libkdc.a
 OLD_FILES+=usr/lib/libkdc.so
 OLD_LIBS+=usr/lib/libkdc.so.11
 OLD_FILES+=usr/lib/libkdc_p.a
 OLD_FILES+=usr/lib/libkrb5.a
 OLD_FILES+=usr/lib/libkrb5.so
 OLD_LIBS+=usr/lib/libkrb5.so.11
 OLD_FILES+=usr/lib/libkrb5_p.a
 OLD_FILES+=usr/lib/libroken.a
 OLD_FILES+=usr/lib/libroken.so
 OLD_LIBS+=usr/lib/libroken.so.11
 OLD_FILES+=usr/lib/libroken_p.a
 OLD_FILES+=usr/lib/libwind.a
 OLD_FILES+=usr/lib/libwind.so
 OLD_LIBS+=usr/lib/libwind.so.11
 OLD_FILES+=usr/lib/libwind_p.a
 OLD_FILES+=usr/lib/pam_krb5.so
 OLD_LIBS+=usr/lib/pam_krb5.so.5
 OLD_FILES+=usr/lib/pam_ksu.so
 OLD_LIBS+=usr/lib/pam_ksu.so.5
 OLD_FILES+=usr/lib/private/libheimipcc.a
 OLD_FILES+=usr/lib/private/libheimipcc.so
 OLD_LIBS+=usr/lib/private/libheimipcc.so.11
 OLD_FILES+=usr/lib/private/libheimipcc_p.a
 OLD_FILES+=usr/lib/private/libheimipcs.a
 OLD_FILES+=usr/lib/private/libheimipcs.so
 OLD_LIBS+=usr/lib/private/libheimipcs.so.11
 OLD_FILES+=usr/lib/private/libheimipcs_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/libasn1.a
 OLD_FILES+=usr/lib32/libasn1.so
 OLD_LIBS+=usr/lib32/libasn1.so.11
 OLD_FILES+=usr/lib32/libasn1_p.a
 OLD_FILES+=usr/lib32/libgssapi_krb5.a
 OLD_FILES+=usr/lib32/libgssapi_krb5.so
 OLD_LIBS+=usr/lib32/libgssapi_krb5.so.10
 OLD_FILES+=usr/lib32/libgssapi_krb5_p.a
 OLD_FILES+=usr/lib32/libgssapi_ntlm.a
 OLD_FILES+=usr/lib32/libgssapi_ntlm.so
 OLD_LIBS+=usr/lib32/libgssapi_ntlm.so.10
 OLD_FILES+=usr/lib32/libgssapi_ntlm_p.a
 OLD_FILES+=usr/lib32/libgssapi_spnego.a
 OLD_FILES+=usr/lib32/libgssapi_spnego.so
 OLD_LIBS+=usr/lib32/libgssapi_spnego.so.10
 OLD_FILES+=usr/lib32/libgssapi_spnego_p.a
 OLD_FILES+=usr/lib32/libhdb.a
 OLD_FILES+=usr/lib32/libhdb.so
 OLD_LIBS+=usr/lib32/libhdb.so.11
 OLD_FILES+=usr/lib32/libhdb_p.a
 OLD_FILES+=usr/lib32/libheimbase.a
 OLD_FILES+=usr/lib32/libheimbase.so
 OLD_LIBS+=usr/lib32/libheimbase.so.11
 OLD_FILES+=usr/lib32/libheimbase_p.a
 OLD_FILES+=usr/lib32/libheimntlm.a
 OLD_FILES+=usr/lib32/libheimntlm.so
 OLD_LIBS+=usr/lib32/libheimntlm.so.11
 OLD_FILES+=usr/lib32/libheimntlm_p.a
 OLD_FILES+=usr/lib32/libheimsqlite.a
 OLD_FILES+=usr/lib32/libheimsqlite.so
 OLD_LIBS+=usr/lib32/libheimsqlite.so.11
 OLD_FILES+=usr/lib32/libheimsqlite_p.a
 OLD_FILES+=usr/lib32/libhx509.a
 OLD_FILES+=usr/lib32/libhx509.so
 OLD_LIBS+=usr/lib32/libhx509.so.11
 OLD_FILES+=usr/lib32/libhx509_p.a
 OLD_FILES+=usr/lib32/libkadm5clnt.a
 OLD_FILES+=usr/lib32/libkadm5clnt.so
 OLD_LIBS+=usr/lib32/libkadm5clnt.so.11
 OLD_FILES+=usr/lib32/libkadm5clnt_p.a
 OLD_FILES+=usr/lib32/libkadm5srv.a
 OLD_FILES+=usr/lib32/libkadm5srv.so
 OLD_LIBS+=usr/lib32/libkadm5srv.so.11
 OLD_FILES+=usr/lib32/libkadm5srv_p.a
 OLD_FILES+=usr/lib32/libkafs5.a
 OLD_FILES+=usr/lib32/libkafs5.so
 OLD_LIBS+=usr/lib32/libkafs5.so.11
 OLD_FILES+=usr/lib32/libkafs5_p.a
 OLD_FILES+=usr/lib32/libkdc.a
 OLD_FILES+=usr/lib32/libkdc.so
 OLD_LIBS+=usr/lib32/libkdc.so.11
 OLD_FILES+=usr/lib32/libkdc_p.a
 OLD_FILES+=usr/lib32/libkrb5.a
 OLD_FILES+=usr/lib32/libkrb5.so
 OLD_LIBS+=usr/lib32/libkrb5.so.11
 OLD_FILES+=usr/lib32/libkrb5_p.a
 OLD_FILES+=usr/lib32/libroken.a
 OLD_FILES+=usr/lib32/libroken.so
 OLD_LIBS+=usr/lib32/libroken.so.11
 OLD_FILES+=usr/lib32/libroken_p.a
 OLD_FILES+=usr/lib32/libwind.a
 OLD_FILES+=usr/lib32/libwind.so
 OLD_LIBS+=usr/lib32/libwind.so.11
 OLD_FILES+=usr/lib32/libwind_p.a
 OLD_FILES+=usr/lib32/pam_krb5.so
 OLD_LIBS+=usr/lib32/pam_krb5.so.5
 OLD_FILES+=usr/lib32/pam_ksu.so
 OLD_LIBS+=usr/lib32/pam_ksu.so.5
 OLD_FILES+=usr/lib32/private/libheimipcc.a
 OLD_FILES+=usr/lib32/private/libheimipcc.so
 OLD_LIBS+=usr/lib32/private/libheimipcc.so.11
 OLD_FILES+=usr/lib32/private/libheimipcc_p.a
 OLD_FILES+=usr/lib32/private/libheimipcs.a
 OLD_FILES+=usr/lib32/private/libheimipcs.so
 OLD_LIBS+=usr/lib32/private/libheimipcs.so.11
 OLD_FILES+=usr/lib32/private/libheimipcs_p.a
 .endif
 OLD_FILES+=usr/libexec/digest-service
 OLD_FILES+=usr/libexec/hprop
 OLD_FILES+=usr/libexec/hpropd
 OLD_FILES+=usr/libexec/ipropd-master
 OLD_FILES+=usr/libexec/ipropd-slave
 OLD_FILES+=usr/libexec/kadmind
 OLD_FILES+=usr/libexec/kcm
 OLD_FILES+=usr/libexec/kdc
 OLD_FILES+=usr/libexec/kdigest
 OLD_FILES+=usr/libexec/kfd
 OLD_FILES+=usr/libexec/kimpersonate
 OLD_FILES+=usr/libexec/kpasswdd
 OLD_FILES+=usr/sbin/kstash
 OLD_FILES+=usr/sbin/ktutil
 OLD_FILES+=usr/sbin/iprop-log
 OLD_FILES+=usr/share/info/heimdal.info.gz
 OLD_FILES+=usr/share/man/man1/kdestroy.1.gz
 OLD_FILES+=usr/share/man/man1/kf.1.gz
 OLD_FILES+=usr/share/man/man1/kinit.1.gz
 OLD_FILES+=usr/share/man/man1/klist.1.gz
 OLD_FILES+=usr/share/man/man1/kpasswd.1.gz
 OLD_FILES+=usr/share/man/man1/krb5-config.1.gz
 OLD_FILES+=usr/share/man/man1/kswitch.1.gz
 OLD_FILES+=usr/share/man/man3/HDB.3.gz
 OLD_FILES+=usr/share/man/man3/hdb__del.3.gz
 OLD_FILES+=usr/share/man/man3/hdb__get.3.gz
 OLD_FILES+=usr/share/man/man3/hdb__put.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_auth_status.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_check_constrained_delegation.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_check_pkinit_ms_upn_match.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_check_s4u2self.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_close.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_destroy.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_entry_ex.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_fetch_kvno.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_firstkey.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_free.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_get_realms.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_lock.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_name.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_nextkey.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_open.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_password.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_remove.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_rename.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_store.3.gz
 OLD_FILES+=usr/share/man/man3/hdb_unlock.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_build_ntlm1_master.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_build_ntlm2_master.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_calculate_lm2.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_calculate_ntlm1.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_calculate_ntlm2.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_decode_targetinfo.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_encode_targetinfo.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_encode_type1.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_encode_type2.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_encode_type3.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_free_buf.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_free_targetinfo.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_free_type1.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_free_type2.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_free_type3.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_keyex_unwrap.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_nt_key.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_ntlmv2_key.3.gz
 OLD_FILES+=usr/share/man/man3/heim_ntlm_verify_ntlm2.3.gz
 OLD_FILES+=usr/share/man/man3/hx509.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_bitstring_print.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_sign.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_sign_self.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_add_crl_dp_uri.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_add_eku.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_add_san_hostname.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_add_san_jid.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_add_san_ms_upn.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_add_san_otherName.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_add_san_pkinit.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_add_san_rfc822name.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_init.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_ca.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_domaincontroller.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_notAfter.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_notAfter_lifetime.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_notBefore.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_proxy.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_serialnumber.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_spki.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_subject.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_template.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_set_unique.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_subject_expand.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ca_tbs_template_units.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_binary.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_check_eku.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_cmp.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_find_subjectAltName_otherName.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_SPKI.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_SPKI_AlgorithmIdentifier.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_attribute.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_base_subject.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_friendly_name.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_issuer.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_issuer_unique_id.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_notAfter.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_notBefore.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_serialnumber.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_subject.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_get_subject_unique_id.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_init.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_init_data.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_keyusage_print.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_ref.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cert_set_friendly_name.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_add.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_append.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_end_seq.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_filter.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_find.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_info.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_init.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_iter_f.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_merge.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_next_cert.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_start_seq.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_certs_store.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ci_print_names.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_clear_error_string.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cms.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cms_create_signed_1.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cms_envelope_1.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cms_unenvelope.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cms_unwrap_ContentInfo.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cms_verify_signed.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_cms_wrap_ContentInfo.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_context_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_context_init.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_context_set_missing_revoke.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_crl_add_revoked_certs.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_crl_alloc.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_crl_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_crl_lifetime.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_crl_sign.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_crypto.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_env.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_env_add.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_env_add_binding.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_env_find.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_env_find_binding.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_env_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_env_lfind.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_err.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_error.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_free_error_string.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_free_octet_string_list.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_general_name_unparse.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_get_error_string.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_get_one_cert.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_keyset.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_lock.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_misc.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name_binary.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name_cmp.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name_copy.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name_expand.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name_is_null_p.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name_to_Name.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_name_to_string.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ocsp_request.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_ocsp_verify.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_oid_print.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_oid_sprint.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_parse_name.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_peer.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_peer_info_add_cms_alg.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_peer_info_alloc.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_peer_info_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_peer_info_set_cert.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_peer_info_set_cms_algs.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_print.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_print_cert.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_print_stdout.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_alloc.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_match_cmp_func.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_match_eku.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_match_friendly_name.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_match_issuer_serial.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_match_option.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_statistic_file.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_query_unparse_stats.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_revoke.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_revoke_add_crl.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_revoke_add_ocsp.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_revoke_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_revoke_init.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_revoke_ocsp_print.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_revoke_verify.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_set_error_string.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_set_error_stringv.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_unparse_der_name.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_validate_cert.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_validate_ctx_add_flags.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_validate_ctx_free.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_validate_ctx_init.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_validate_ctx_set_print.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_attach_anchors.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_attach_revoke.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_ctx_f_allow_default_trustanchors.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_destroy_ctx.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_hostname.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_init_ctx.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_path.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_set_max_depth.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_set_proxy_certificate.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_set_strict_rfc3280_verification.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_set_time.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_verify_signature.3.gz
 OLD_FILES+=usr/share/man/man3/hx509_xfree.3.gz
 OLD_FILES+=usr/share/man/man3/k_afs_cell_of_file.3.gz
 OLD_FILES+=usr/share/man/man3/k_hasafs.3.gz
 OLD_FILES+=usr/share/man/man3/k_pioctl.3.gz
 OLD_FILES+=usr/share/man/man3/k_setpag.3.gz
 OLD_FILES+=usr/share/man/man3/k_unlog.3.gz
 OLD_FILES+=usr/share/man/man3/kadm5_pwcheck.3.gz
 OLD_FILES+=usr/share/man/man3/kafs.3.gz
 OLD_FILES+=usr/share/man/man3/kafs5.3.gz
 OLD_FILES+=usr/share/man/man3/kafs_set_verbose.3.gz
 OLD_FILES+=usr/share/man/man3/kafs_settoken.3.gz
 OLD_FILES+=usr/share/man/man3/kafs_settoken5.3.gz
 OLD_FILES+=usr/share/man/man3/kafs_settoken_rxkad.3.gz
 OLD_FILES+=usr/share/man/man3/krb5.3.gz
 OLD_FILES+=usr/share/man/man3/krb524_convert_creds_kdc.3.gz
 OLD_FILES+=usr/share/man/man3/krb524_convert_creds_kdc_ccache.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_425_conv_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_425_conv_principal_ext.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_524_conv_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_acc_ops.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_acl_match_file.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_acl_match_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_add_et_list.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_add_extra_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_add_ignore_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_addlog_dest.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_addlog_func.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_addr2sockaddr.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_address.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_address_compare.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_address_order.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_address_prefixlen_boundary.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_address_search.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_afslog.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_afslog_uid.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_allow_weak_crypto.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_aname_to_localname.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_anyaddr.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_appdefault.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_appdefault_boolean.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_appdefault_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_appdefault_time.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_append_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_genaddrs.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_getaddrs.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_getflags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_getkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_getlocalsubkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_getrcache.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_getremotesubkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_getuserkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_init.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_initivector.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setaddrs.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setaddrs_from_fd.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setflags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setivector.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setlocalsubkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setrcache.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setremotesubkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_con_setuserkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_context.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_getauthenticator.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_getcksumtype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_getkeytype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_getlocalseqnumber.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_getremoteseqnumber.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_setcksumtype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_setkeytype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_setlocalseqnumber.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_auth_setremoteseqnumber.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_build_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_build_principal_ext.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_build_principal_va.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_build_principal_va_ext.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_c_enctype_compare.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_c_make_checksum.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_cache_end_seq_get.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_cache_get_first.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_cache_match.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_cache_next.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_clear_mcred.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_close.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_copy_cache.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_copy_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_copy_match_f.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_default_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_destroy.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_end_seq_get.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_gen_new.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_config.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_friendly_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_full_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_kdc_offset.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_lifetime.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_ops.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_prefix_ops.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_type.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_get_version.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_initialize.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_last_change_time.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_move.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_new_unique.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_next_cred.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_register.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_remove_cred.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_resolve.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_retrieve_cred.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_set_config.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_set_default_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_set_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_set_friendly_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_set_kdc_offset.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_start_seq_get.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_store_cred.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_support_switch.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cc_switch.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ccache.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ccache_intro.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cccol_cursor_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cccol_cursor_new.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cccol_cursor_next.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cccol_last_change_time.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_change_password.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_check_transited.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_checksum_is_collision_proof.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_checksum_is_keyed.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_checksumsize.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_cksumtype_to_enctype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_clear_error_message.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_clear_error_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_closelog.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_compare_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_file_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_free_strings.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_get_bool.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_get_bool_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_get_list.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_get_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_get_string_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_get_strings.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_get_time.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_get_time_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_parse_file_multi.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_parse_string_multi.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_vget_bool.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_vget_bool_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_vget_list.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_vget_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_vget_string_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_vget_strings.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_vget_time.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_config_vget_time_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_address.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_context.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_creds_contents.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_data.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_host_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_keyblock.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_keyblock_contents.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_copy_ticket.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_create_checksum.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_create_checksum_iov.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_credential.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_creds_get_ticket_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto_destroy.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto_fx_cf2.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto_getblocksize.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto_getconfoundersize.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto_getenctype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto_getpadsize.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto_init.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_crypto_iov.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_data_alloc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_data_cmp.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_data_copy.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_data_ct_cmp.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_data_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_data_realloc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_data_zero.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_decrypt.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_decrypt_EncryptedData.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_decrypt_iov_ivec.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_deprecated.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_digest.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_digest_probe.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_eai_to_heim_errno.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_encrypt.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_encrypt_EncryptedData.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_encrypt_iov_ivec.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_enctype_disable.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_enctype_enable.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_enctype_valid.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_enctypes_compatible_keys.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_error.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_expand_hostname.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_expand_hostname_realms.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_fcc_ops.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_fileformats.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_find_padata.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_address.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_config_files.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_context.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_cred_contents.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_creds_contents.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_data.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_data_contents.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_error_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_host_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_keyblock.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_keyblock_contents.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_krbhst.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_ticket.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_free_unparsed_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_fwd_tgt_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_generate_random_block.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_generate_subkey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_generate_subkey_extended.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_all_client_addrs.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_all_server_addrs.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_cred_from_kdc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_cred_from_kdc_opt.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_credentials.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_default_config_files.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_default_in_tkt_etypes.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_default_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_default_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_default_realms.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_dns_canonicalize_hostname.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_extra_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_fcache_version.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_forwarded_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_host_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_ignore_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_in_cred.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_in_tkt_with_keytab.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_in_tkt_with_password.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_in_tkt_with_skey.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_init_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_init_creds_keyblock.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_init_creds_keytab.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_init_creds_opt_alloc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_init_creds_opt_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_init_creds_opt_get_error.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_init_creds_opt_init.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_init_creds_password.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_kdc_sec_offset.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_krb524hst.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_krb_admin_hst.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_krb_changepw_hst.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_krbhst.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_max_time_skew.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_use_admin_kdc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_get_validated_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_getportbyname.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_h_addr2addr.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_h_addr2sockaddr.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_h_errno_to_heim_errno.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_context.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_get.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_get_error.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_init.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_intro.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_set_keytab.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_set_password.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_set_service.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_creds_step.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_init_ets.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_initlog.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_introduction.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_is_config_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_is_thread_safe.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kerberos_enctypes.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keyblock_get_enctype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keyblock_init.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keyblock_zero.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keytab.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keytab_intro.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keytab_key_proc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keytype_to_enctypes.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keytype_to_enctypes_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_keytype_to_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_krbhst_format_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_krbhst_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_krbhst_get_addrinfo.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_krbhst_init.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_krbhst_next.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_krbhst_next_as_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_krbhst_reset.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_add_entry.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_close.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_compare.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_copy_entry_contents.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_default_modify_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_default_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_destroy.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_end_seq_get.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_free_entry.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_get_entry.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_get_full_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_get_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_get_type.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_have_content.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_next_entry.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_read_service_key.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_register.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_remove_entry.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_resolve.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kt_start_seq_get.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_kuserok.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_log.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_log_msg.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_make_addrport.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_make_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_max_sockaddr_size.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_mcc_ops.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_mk_req.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_mk_safe.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_openlog.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_pac.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_pac_get_buffer.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_pac_verify.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_parse_address.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_parse_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_parse_name_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_parse_nametype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_password_key_proc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_plugin_register.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_prepend_config_files_default.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_princ_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_princ_set_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_compare.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_compare_any_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_get_comp_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_get_num_comp.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_get_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_get_type.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_intro.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_is_krbtgt.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_match.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_set_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_principal_set_type.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_print_address.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_random_to_key.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rcache.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rd_error.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rd_req_ctx.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rd_req_in_ctx_alloc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rd_req_in_set_keytab.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rd_req_in_set_pac_check.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rd_req_out_ctx_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rd_req_out_get_server.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_rd_safe.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_realm_compare.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_address.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_addrs.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_authdata.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_creds_tag.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_data.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_int16.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_int32.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_int8.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_keyblock.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_stringz.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_times.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_uint16.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_uint32.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ret_uint8.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_config_files.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_default_in_tkt_etypes.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_default_realm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_dns_canonicalize_hostname.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_error_message.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_error_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_extra_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_fcache_version.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_home_dir_access.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_ignore_addresses.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_kdc_sec_offset.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_max_time_skew.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_password.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_real_time.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_set_use_admin_kdc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_sname_to_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_sock_to_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_sockaddr2address.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_sockaddr2port.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_sockaddr_uninteresting.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_clear_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_emem.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_free.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_from_data.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_from_fd.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_from_mem.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_from_readonly_mem.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_get_byteorder.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_get_eof_code.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_is_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_read.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_seek.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_set_byteorder.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_set_eof_code.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_set_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_set_max_alloc.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_to_data.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_truncate.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_storage_write.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_address.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_addrs.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_authdata.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_creds_tag.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_data.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_int16.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_int32.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_int8.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_keyblock.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_principal.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_stringz.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_times.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_uint16.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_uint32.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_store_uint8.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_string_to_key.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_string_to_keytype.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_support.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ticket.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ticket_get_authorization_data_type.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ticket_get_client.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ticket_get_endtime.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ticket_get_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_ticket_get_server.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_timeofday.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_unparse_name.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_unparse_name_fixed.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_unparse_name_fixed_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_unparse_name_fixed_short.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_unparse_name_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_unparse_name_short.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_us_timeofday.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_v4compat.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_checksum.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_checksum_iov.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_init_creds.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_opt_init.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_opt_set_flags.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_opt_set_keytab.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_opt_set_secure.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_opt_set_service.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_user.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_user_lrealm.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_verify_user_opt.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_vlog.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_vlog_msg.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_vset_error_string.3.gz
 OLD_FILES+=usr/share/man/man3/krb5_vwarn.3.gz
 OLD_FILES+=usr/share/man/man3/krb_afslog.3.gz
 OLD_FILES+=usr/share/man/man3/krb_afslog_uid.3.gz
 OLD_FILES+=usr/share/man/man3/ntlm_buf.3.gz
 OLD_FILES+=usr/share/man/man3/ntlm_core.3.gz
 OLD_FILES+=usr/share/man/man3/ntlm_type1.3.gz
 OLD_FILES+=usr/share/man/man3/ntlm_type2.3.gz
 OLD_FILES+=usr/share/man/man3/ntlm_type3.3.gz
 OLD_FILES+=usr/share/man/man5/krb5.conf.5.gz
 OLD_FILES+=usr/share/man/man8/hprop.8.gz
 OLD_FILES+=usr/share/man/man8/hpropd.8.gz
 OLD_FILES+=usr/share/man/man8/iprop-log.8.gz
 OLD_FILES+=usr/share/man/man8/iprop.8.gz
 OLD_FILES+=usr/share/man/man8/kadmin.8.gz
 OLD_FILES+=usr/share/man/man8/kadmind.8.gz
 OLD_FILES+=usr/share/man/man8/kcm.8.gz
 OLD_FILES+=usr/share/man/man8/kdc.8.gz
 OLD_FILES+=usr/share/man/man8/kdigest.8.gz
 OLD_FILES+=usr/share/man/man8/kerberos.8.gz
 OLD_FILES+=usr/share/man/man8/kimpersonate.8.gz
 OLD_FILES+=usr/share/man/man8/kpasswdd.8.gz
 OLD_FILES+=usr/share/man/man8/kstash.8.gz
 OLD_FILES+=usr/share/man/man8/ktutil.8.gz
 OLD_FILES+=usr/share/man/man8/pam_krb5.8.gz
 OLD_FILES+=usr/share/man/man8/pam_ksu.8.gz
 OLD_FILES+=usr/share/man/man8/string2key.8.gz
 OLD_FILES+=usr/share/man/man8/verify_krb5_conf.8.gz
 .endif
 
 .if ${MK_LDNS} == no
 OLD_FILES+=usr/lib/private/libldns.a
 OLD_FILES+=usr/lib/private/libldns.so
 OLD_LIBS+=usr/lib/private/libldns.so.5
 OLD_FILES+=usr/lib/private/libldns_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/private/libldns.a
 OLD_FILES+=usr/lib32/private/libldns.so
 OLD_LIBS+=usr/lib32/private/libldns.so.5
 OLD_FILES+=usr/lib32/private/libldns_p.a
 .endif
 .endif
 
 .if ${MK_LDNS_UTILS} == no
 OLD_FILES+=usr/bin/drill
 OLD_FILES+=usr/share/man/man1/drill.1.gz
 OLD_FILES+=usr/bin/host
 OLD_FILES+=usr/share/man/man1/host.1.gz
 .endif
 
 #.if ${MK_LIB32} == no
 # to be filled in
 #.endif
 
 .if ${MK_LIBCPLUSPLUS} == no
 OLD_LIBS+=lib/libcxxrt.so.1
 OLD_FILES+=usr/lib/libc++.a
 OLD_FILES+=usr/lib/libc++_p.a
 OLD_FILES+=usr/lib/libc++.so
 OLD_LIBS+=usr/lib/libc++.so.1
 OLD_FILES+=usr/lib/libcxxrt.a
 OLD_FILES+=usr/lib/libcxxrt.so
 OLD_FILES+=usr/lib/libcxxrt_p.a
 OLD_FILES+=usr/include/c++/v1/__bit_reference
 OLD_FILES+=usr/include/c++/v1/__config
 OLD_FILES+=usr/include/c++/v1/__debug
 OLD_FILES+=usr/include/c++/v1/__functional_03
 OLD_FILES+=usr/include/c++/v1/__functional_base
 OLD_FILES+=usr/include/c++/v1/__functional_base_03
 OLD_FILES+=usr/include/c++/v1/__hash_table
 OLD_FILES+=usr/include/c++/v1/__locale
 OLD_FILES+=usr/include/c++/v1/__mutex_base
 OLD_FILES+=usr/include/c++/v1/__split_buffer
 OLD_FILES+=usr/include/c++/v1/__sso_allocator
 OLD_FILES+=usr/include/c++/v1/__std_stream
 OLD_FILES+=usr/include/c++/v1/__tree
 OLD_FILES+=usr/include/c++/v1/__tuple
 OLD_FILES+=usr/include/c++/v1/__tuple_03
 OLD_FILES+=usr/include/c++/v1/__undef_min_max
 OLD_FILES+=usr/include/c++/v1/algorithm
 OLD_FILES+=usr/include/c++/v1/array
 OLD_FILES+=usr/include/c++/v1/atomic
 OLD_FILES+=usr/include/c++/v1/bitset
 OLD_FILES+=usr/include/c++/v1/cassert
 OLD_FILES+=usr/include/c++/v1/ccomplex
 OLD_FILES+=usr/include/c++/v1/cctype
 OLD_FILES+=usr/include/c++/v1/cerrno
 OLD_FILES+=usr/include/c++/v1/cfenv
 OLD_FILES+=usr/include/c++/v1/cfloat
 OLD_FILES+=usr/include/c++/v1/chrono
 OLD_FILES+=usr/include/c++/v1/cinttypes
 OLD_FILES+=usr/include/c++/v1/ciso646
 OLD_FILES+=usr/include/c++/v1/climits
 OLD_FILES+=usr/include/c++/v1/clocale
 OLD_FILES+=usr/include/c++/v1/cmath
 OLD_FILES+=usr/include/c++/v1/codecvt
 OLD_FILES+=usr/include/c++/v1/complex
 OLD_FILES+=usr/include/c++/v1/complex.h
 OLD_FILES+=usr/include/c++/v1/condition_variable
 OLD_FILES+=usr/include/c++/v1/csetjmp
 OLD_FILES+=usr/include/c++/v1/csignal
 OLD_FILES+=usr/include/c++/v1/cstdarg
 OLD_FILES+=usr/include/c++/v1/cstdbool
 OLD_FILES+=usr/include/c++/v1/cstddef
 OLD_FILES+=usr/include/c++/v1/cstdint
 OLD_FILES+=usr/include/c++/v1/cstdio
 OLD_FILES+=usr/include/c++/v1/cstdlib
 OLD_FILES+=usr/include/c++/v1/cstring
 OLD_FILES+=usr/include/c++/v1/ctgmath
 OLD_FILES+=usr/include/c++/v1/ctime
 OLD_FILES+=usr/include/c++/v1/cwchar
 OLD_FILES+=usr/include/c++/v1/cwctype
 OLD_FILES+=usr/include/c++/v1/cxxabi.h
 OLD_FILES+=usr/include/c++/v1/deque
 OLD_FILES+=usr/include/c++/v1/exception
 OLD_FILES+=usr/include/c++/v1/experimental/dynarray
 OLD_FILES+=usr/include/c++/v1/experimental/optional
 OLD_FILES+=usr/include/c++/v1/ext/__hash
 OLD_FILES+=usr/include/c++/v1/ext/hash_map
 OLD_FILES+=usr/include/c++/v1/ext/hash_set
 OLD_FILES+=usr/include/c++/v1/forward_list
 OLD_FILES+=usr/include/c++/v1/fstream
 OLD_FILES+=usr/include/c++/v1/functional
 OLD_FILES+=usr/include/c++/v1/future
 OLD_FILES+=usr/include/c++/v1/initializer_list
 OLD_FILES+=usr/include/c++/v1/iomanip
 OLD_FILES+=usr/include/c++/v1/ios
 OLD_FILES+=usr/include/c++/v1/iosfwd
 OLD_FILES+=usr/include/c++/v1/iostream
 OLD_FILES+=usr/include/c++/v1/istream
 OLD_FILES+=usr/include/c++/v1/iterator
 OLD_FILES+=usr/include/c++/v1/limits
 OLD_FILES+=usr/include/c++/v1/list
 OLD_FILES+=usr/include/c++/v1/locale
 OLD_FILES+=usr/include/c++/v1/map
 OLD_FILES+=usr/include/c++/v1/memory
 OLD_FILES+=usr/include/c++/v1/mutex
 OLD_FILES+=usr/include/c++/v1/new
 OLD_FILES+=usr/include/c++/v1/numeric
 OLD_FILES+=usr/include/c++/v1/ostream
 OLD_FILES+=usr/include/c++/v1/queue
 OLD_FILES+=usr/include/c++/v1/random
 OLD_FILES+=usr/include/c++/v1/ratio
 OLD_FILES+=usr/include/c++/v1/regex
 OLD_FILES+=usr/include/c++/v1/scoped_allocator
 OLD_FILES+=usr/include/c++/v1/set
 OLD_FILES+=usr/include/c++/v1/sstream
 OLD_FILES+=usr/include/c++/v1/stack
 OLD_FILES+=usr/include/c++/v1/stdexcept
 OLD_FILES+=usr/include/c++/v1/streambuf
 OLD_FILES+=usr/include/c++/v1/string
 OLD_FILES+=usr/include/c++/v1/strstream
 OLD_FILES+=usr/include/c++/v1/system_error
 OLD_FILES+=usr/include/c++/v1/tgmath.h
 OLD_FILES+=usr/include/c++/v1/thread
 OLD_FILES+=usr/include/c++/v1/tuple
 OLD_FILES+=usr/include/c++/v1/type_traits
 OLD_FILES+=usr/include/c++/v1/typeindex
 OLD_FILES+=usr/include/c++/v1/typeinfo
 OLD_FILES+=usr/include/c++/v1/unordered_map
 OLD_FILES+=usr/include/c++/v1/unordered_set
 OLD_FILES+=usr/include/c++/v1/unwind-arm.h
 OLD_FILES+=usr/include/c++/v1/unwind-itanium.h
 OLD_FILES+=usr/include/c++/v1/unwind.h
 OLD_FILES+=usr/include/c++/v1/utility
 OLD_FILES+=usr/include/c++/v1/valarray
 OLD_FILES+=usr/include/c++/v1/vector
 OLD_DIRS+=usr/include/c++/v1/experimental
 OLD_DIRS+=usr/include/c++/v1/ext
 OLD_DIRS+=usr/include/c++/v1
 .endif
 
 #.if ${MK_LIBTHR} == no
 # to be filled in
 #.endif
 
 #.if ${MK_LOCALES} == no
 # to be filled in
 #.endif
 
 .if ${MK_LOCATE} == no
 OLD_FILES+=etc/locate.rc
 OLD_FILES+=etc/periodic/weekly/310.locate
 OLD_FILES+=usr/bin/locate
 OLD_FILES+=usr/libexec/locate.bigram
 OLD_FILES+=usr/libexec/locate.code
 OLD_FILES+=usr/libexec/locate.concatdb
 OLD_FILES+=usr/libexec/locate.mklocatedb
 OLD_FILES+=usr/libexec/locate.updatedb
 OLD_FILES+=usr/share/man/man1/locate.1.gz
 OLD_FILES+=usr/share/man/man8/locate.updatedb.8.gz
 OLD_FILES+=usr/share/man/man8/updatedb.8.gz
 .endif
 
 .if ${MK_LPR} == no
 OLD_FILES+=etc/hosts.lpd
 OLD_FILES+=etc/printcap
 OLD_FILES+=usr/bin/lp
 OLD_FILES+=usr/bin/lpq
 OLD_FILES+=usr/bin/lpr
 OLD_FILES+=usr/bin/lprm
 OLD_FILES+=usr/libexec/lpr/ru/bjc-240.sh.sample
 OLD_FILES+=usr/libexec/lpr/ru/koi2alt
 OLD_FILES+=usr/libexec/lpr/ru/koi2855
 OLD_DIRS+=usr/libexec/lpr/ru
 OLD_FILES+=usr/libexec/lpr/lpf
 OLD_DIRS+=usr/libexec/lpr
 OLD_FILES+=usr/sbin/chkprintcap
 OLD_FILES+=usr/sbin/lpc
 OLD_FILES+=usr/sbin/lpd
 OLD_FILES+=usr/sbin/lptest
 OLD_FILES+=usr/sbin/pac
 OLD_FILES+=usr/share/doc/smm/07.lpd/paper.ascii.gz
 OLD_DIRS+=usr/share/doc/smm/07.lpd
 OLD_FILES+=usr/share/examples/etc/hosts.lpd
 OLD_FILES+=usr/share/examples/etc/printcap
 OLD_FILES+=usr/share/man/man1/lp.1.gz
 OLD_FILES+=usr/share/man/man1/lpq.1.gz
 OLD_FILES+=usr/share/man/man1/lpr.1.gz
 OLD_FILES+=usr/share/man/man1/lprm.1.gz
 OLD_FILES+=usr/share/man/man1/lptest.1.gz
 OLD_FILES+=usr/share/man/man5/printcap.5.gz
 OLD_FILES+=usr/share/man/man8/chkprintcap.8.gz
 OLD_FILES+=usr/share/man/man8/lpc.8.gz
 OLD_FILES+=usr/share/man/man8/lpd.8.gz
 OLD_FILES+=usr/share/man/man8/pac.8.gz
 .endif
 
 .if ${MK_MAIL} == no
 OLD_FILES+=etc/periodic/daily/130.clean-msgs
 OLD_FILES+=usr/bin/Mail
 OLD_FILES+=usr/bin/biff
 OLD_FILES+=usr/bin/from
 OLD_FILES+=usr/bin/mail
 OLD_FILES+=usr/bin/mailx
 OLD_FILES+=usr/bin/msgs
 OLD_FILES+=usr/libexec/comsat
 OLD_FILES+=usr/share/examples/etc/mail.rc
 OLD_FILES+=usr/share/man/man1/Mail.1.gz
 OLD_FILES+=usr/share/man/man1/biff.1.gz
 OLD_FILES+=usr/share/man/man1/from.1.gz
 OLD_FILES+=usr/share/man/man1/mail.1.gz
 OLD_FILES+=usr/share/man/man1/mailx.1.gz
 OLD_FILES+=usr/share/man/man1/msgs.1.gz
 OLD_FILES+=usr/share/man/man8/comsat.8.gz
 OLD_FILES+=usr/share/misc/mail.help
 OLD_FILES+=usr/share/misc/mail.tildehelp
 .endif
 
 .if ${MK_MAILWRAPPER} == no
 OLD_FILES+=etc/mail/mailer.conf
 .if ${MK_SENDMAIL} == no
 OLD_FILES+=usr/sbin/mailwrapper
 .endif
 OLD_FILES+=usr/share/man/man8/mailwrapper.8.gz
 .endif
 
 #.if ${MK_MAN} == no
 # This should add a dependency to a special target which removes all man pages.
 # Listing all of them here is overkill.
 #.endif
 
 .if ${MK_NDIS} == no
 OLD_FILES+=usr/sbin/ndiscvt
 OLD_FILES+=usr/sbin/ndisgen
 OLD_FILES+=usr/share/man/man8/ndiscvt.8.gz
 OLD_FILES+=usr/share/man/man8/ndisgen.8.gz
 OLD_FILES+=usr/share/misc/windrv_stub.c
 .endif
 
 .if ${MK_NETCAT} == no
 OLD_FILES+=usr/bin/nc
 OLD_FILES+=usr/share/man/man1/nc.1.gz
 .endif
 
 .if ${MK_NIS} == no
 OLD_FILES+=usr/bin/ypcat
 OLD_FILES+=usr/bin/ypchfn
 OLD_FILES+=usr/bin/ypchpass
 OLD_FILES+=usr/bin/ypchsh
 OLD_FILES+=usr/bin/ypmatch
 OLD_FILES+=usr/bin/yppasswd
 OLD_FILES+=usr/bin/ypwhich
 OLD_FILES+=usr/include/ypclnt.h
 OLD_FILES+=usr/lib/libypclnt.a
 OLD_FILES+=usr/lib/libypclnt.so
 OLD_LIBS+=usr/lib/libypclnt.so.4
 OLD_FILES+=usr/lib/libypclnt_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/libypclnt.a
 OLD_FILES+=usr/lib32/libypclnt.so
 OLD_LIBS+=usr/lib32/libypclnt.so.4
 OLD_FILES+=usr/lib32/libypclnt_p.a
 .endif
 OLD_FILES+=usr/libexec/mknetid
 OLD_FILES+=usr/libexec/yppwupdate
 OLD_FILES+=usr/libexec/ypxfr
 OLD_FILES+=usr/sbin/rpc.yppasswdd
 OLD_FILES+=usr/sbin/rpc.ypupdated
 OLD_FILES+=usr/sbin/rpc.ypxfrd
 OLD_FILES+=usr/sbin/yp_mkdb
 OLD_FILES+=usr/sbin/ypbind
 OLD_FILES+=usr/sbin/ypinit
 OLD_FILES+=usr/sbin/yppoll
 OLD_FILES+=usr/sbin/yppush
 OLD_FILES+=usr/sbin/ypserv
 OLD_FILES+=usr/sbin/ypset
 OLD_FILES+=usr/share/man/man1/ypcat.1.gz
 OLD_FILES+=usr/share/man/man1/ypchfn.1.gz
 OLD_FILES+=usr/share/man/man1/ypchpass.1.gz
 OLD_FILES+=usr/share/man/man1/ypchsh.1.gz
 OLD_FILES+=usr/share/man/man1/ypmatch.1.gz
 OLD_FILES+=usr/share/man/man1/yppasswd.1.gz
 OLD_FILES+=usr/share/man/man1/ypwhich.1.gz
 OLD_FILES+=usr/share/man/man5/netid.5.gz
 OLD_FILES+=usr/share/man/man8/mknetid.8.gz
 OLD_FILES+=usr/share/man/man8/rpc.yppasswdd.8.gz
 OLD_FILES+=usr/share/man/man8/rpc.ypxfrd.8.gz
 OLD_FILES+=usr/share/man/man8/yp_mkdb.8.gz
 OLD_FILES+=usr/share/man/man8/ypbind.8.gz
 OLD_FILES+=usr/share/man/man8/ypinit.8.gz
 OLD_FILES+=usr/share/man/man8/yppoll.8.gz
 OLD_FILES+=usr/share/man/man8/yppush.8.gz
 OLD_FILES+=usr/share/man/man8/ypserv.8.gz
 OLD_FILES+=usr/share/man/man8/ypset.8.gz
 OLD_FILES+=usr/share/man/man8/ypxfr.8.gz
 OLD_FILES+=var/yp/Makefile
 OLD_FILES+=var/yp/Makefile.dist
 .endif
 
 .if ${MK_NLS} == no
 OLD_FILES+=usr/tests/bin/sh/builtins/locale1.0
 # to be filled in
 .endif
 
 .if ${MK_NTP} == no
 OLD_FILES+=etc/ntp.conf
 OLD_FILES+=etc/periodic/daily/480.status-ntpd
 OLD_FILES+=usr/bin/ntpq
 OLD_FILES+=usr/sbin/ntp-keygen
 OLD_FILES+=usr/sbin/ntpd
 OLD_FILES+=usr/sbin/ntpdate
 OLD_FILES+=usr/sbin/ntpdc
 OLD_FILES+=usr/sbin/ntptime
 OLD_FILES+=usr/sbin/sntp
 OLD_FILES+=usr/share/doc/ntp/accopt.html
 OLD_FILES+=usr/share/doc/ntp/assoc.html
 OLD_FILES+=usr/share/doc/ntp/audio.html
 OLD_FILES+=usr/share/doc/ntp/authopt.html
 OLD_FILES+=usr/share/doc/ntp/build.html
 OLD_FILES+=usr/share/doc/ntp/clockopt.html
 OLD_FILES+=usr/share/doc/ntp/config.html
 OLD_FILES+=usr/share/doc/ntp/confopt.html
 OLD_FILES+=usr/share/doc/ntp/copyright.html
 OLD_FILES+=usr/share/doc/ntp/debug.html
 OLD_FILES+=usr/share/doc/ntp/driver1.html
 OLD_FILES+=usr/share/doc/ntp/driver10.html
 OLD_FILES+=usr/share/doc/ntp/driver11.html
 OLD_FILES+=usr/share/doc/ntp/driver12.html
 OLD_FILES+=usr/share/doc/ntp/driver16.html
 OLD_FILES+=usr/share/doc/ntp/driver18.html
 OLD_FILES+=usr/share/doc/ntp/driver19.html
 OLD_FILES+=usr/share/doc/ntp/driver2.html
 OLD_FILES+=usr/share/doc/ntp/driver20.html
 OLD_FILES+=usr/share/doc/ntp/driver22.html
 OLD_FILES+=usr/share/doc/ntp/driver26.html
 OLD_FILES+=usr/share/doc/ntp/driver27.html
 OLD_FILES+=usr/share/doc/ntp/driver28.html
 OLD_FILES+=usr/share/doc/ntp/driver29.html
 OLD_FILES+=usr/share/doc/ntp/driver3.html
 OLD_FILES+=usr/share/doc/ntp/driver30.html
 OLD_FILES+=usr/share/doc/ntp/driver32.html
 OLD_FILES+=usr/share/doc/ntp/driver33.html
 OLD_FILES+=usr/share/doc/ntp/driver34.html
 OLD_FILES+=usr/share/doc/ntp/driver35.html
 OLD_FILES+=usr/share/doc/ntp/driver36.html
 OLD_FILES+=usr/share/doc/ntp/driver37.html
 OLD_FILES+=usr/share/doc/ntp/driver4.html
 OLD_FILES+=usr/share/doc/ntp/driver5.html
 OLD_FILES+=usr/share/doc/ntp/driver6.html
 OLD_FILES+=usr/share/doc/ntp/driver7.html
 OLD_FILES+=usr/share/doc/ntp/driver8.html
 OLD_FILES+=usr/share/doc/ntp/driver9.html
 OLD_FILES+=usr/share/doc/ntp/extern.html
 OLD_FILES+=usr/share/doc/ntp/hints.html
 OLD_FILES+=usr/share/doc/ntp/howto.html
 OLD_FILES+=usr/share/doc/ntp/index.html
 OLD_FILES+=usr/share/doc/ntp/kern.html
 OLD_FILES+=usr/share/doc/ntp/ldisc.html
 OLD_FILES+=usr/share/doc/ntp/measure.html
 OLD_FILES+=usr/share/doc/ntp/miscopt.html
 OLD_FILES+=usr/share/doc/ntp/monopt.html
 OLD_FILES+=usr/share/doc/ntp/mx4200data.html
 OLD_FILES+=usr/share/doc/ntp/notes.html
 OLD_FILES+=usr/share/doc/ntp/ntpd.html
 OLD_FILES+=usr/share/doc/ntp/ntpdate.html
 OLD_FILES+=usr/share/doc/ntp/ntpdc.html
 OLD_FILES+=usr/share/doc/ntp/ntpq.html
 OLD_FILES+=usr/share/doc/ntp/ntptime.html
 OLD_FILES+=usr/share/doc/ntp/ntptrace.html
 OLD_FILES+=usr/share/doc/ntp/parsedata.html
 OLD_FILES+=usr/share/doc/ntp/parsenew.html
 OLD_FILES+=usr/share/doc/ntp/patches.html
 OLD_FILES+=usr/share/doc/ntp/porting.html
 OLD_FILES+=usr/share/doc/ntp/pps.html
 OLD_FILES+=usr/share/doc/ntp/prefer.html
 OLD_FILES+=usr/share/doc/ntp/quick.html
 OLD_FILES+=usr/share/doc/ntp/rdebug.html
 OLD_FILES+=usr/share/doc/ntp/refclock.html
 OLD_FILES+=usr/share/doc/ntp/release.html
 OLD_FILES+=usr/share/doc/ntp/tickadj.html
 OLD_DIRS+=usr/share/doc/ntp
 OLD_FILES+=usr/share/examples/etc/ntp.conf
 OLD_FILES+=usr/share/man/man5/ntp.conf.5.gz
 OLD_FILES+=usr/share/man/man5/ntp.keys.5.gz
 OLD_FILES+=usr/share/man/man8/ntp-keygen.8.gz
 OLD_FILES+=usr/share/man/man8/ntpd.8.gz
 OLD_FILES+=usr/share/man/man8/ntpdate.8.gz
 OLD_FILES+=usr/share/man/man8/ntpdc.8.gz
 OLD_FILES+=usr/share/man/man8/ntpq.8.gz
 OLD_FILES+=usr/share/man/man8/ntptime.8.gz
 .endif
 
 #.if ${MK_OBJC} == no
 # to be filled in
 #.endif
 
 .if ${MK_OPENSSH} == no
 OLD_FILES+=usr/bin/sftp
 OLD_FILES+=usr/bin/ssh
 OLD_FILES+=usr/bin/ssh-add
 OLD_FILES+=usr/bin/ssh-agent
 OLD_FILES+=usr/bin/ssh-copy-id
 OLD_FILES+=usr/bin/ssh-keygen
 OLD_FILES+=usr/bin/ssh-keyscan
 OLD_FILES+=usr/lib/private/libssh.a
 OLD_FILES+=usr/lib/private/libssh.so
 OLD_LIBS+=usr/lib/private/libssh.so.5
 OLD_FILES+=usr/lib/private/libssh_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/private/libssh.a
 OLD_FILES+=usr/lib32/private/libssh.so
 OLD_LIBS+=usr/lib32/private/libssh.so.5
 OLD_FILES+=usr/lib32/private/libssh_p.a
 .endif
 OLD_FILES+=usr/libexec/sftp-server
 OLD_FILES+=usr/libexec/ssh-keysign
 OLD_FILES+=usr/libexec/ssh-pkcs11-helper
 OLD_FILES+=usr/sbin/sshd
 .endif
 
 .if ${MK_OPENSSL} == no
 OLD_FILES+=etc/rc.d/keyserv
 .endif
 
 .if ${MK_PC_SYSINSTALL} == no
 # backend-partmanager
 OLD_FILES+=usr/share/pc-sysinstall/backend-partmanager/create-part.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-partmanager/delete-part.sh
 # backend-query
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-emulation.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-laptop.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/detect-nics.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-info.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-list.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/disk-part.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/enable-net.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/get-packages.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-components.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-config.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-mirrors.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-packages.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-rsync-backups.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/list-tzones.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/query-langs.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/send-logs.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/setup-ssh-keys.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/set-mirror.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/sys-mem.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/test-live.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/test-netup.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/update-part-list.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-layouts.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-models.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend-query/xkeyboard-variants.sh
 # backend
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-bsdlabel.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-cleanup.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-disk.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-extractimage.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-ftp.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-installcomponents.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-installpackages.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-localize.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-mountdisk.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-mountoptical.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-networking.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-newfs.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-parse.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-packages.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-runcommands.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-unmount.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-upgrade.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions-users.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/functions.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/installimage.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/parseconfig.sh
 OLD_FILES+=usr/share/pc-sysinstall/backend/startautoinstall.sh
 # conf
 OLD_FILES+=usr/share/pc-sysinstall/conf/avail-langs
 OLD_FILES+=usr/share/pc-sysinstall/conf/exclude-from-upgrade
 OLD_FILES+=usr/share/pc-sysinstall/conf/license/bsd-en.txt
 OLD_FILES+=usr/share/pc-sysinstall/conf/license/intel-en.txt
 OLD_FILES+=usr/share/pc-sysinstall/conf/license/nvidia-en.txt
 OLD_FILES+=usr/share/pc-sysinstall/conf/pc-sysinstall.conf
 # doc
 OLD_FILES+=usr/share/pc-sysinstall/doc/help-disk-list
 OLD_FILES+=usr/share/pc-sysinstall/doc/help-disk-size
 OLD_FILES+=usr/share/pc-sysinstall/doc/help-index
 OLD_FILES+=usr/share/pc-sysinstall/doc/help-start-autoinstall
 # examples
 OLD_FILES+=usr/share/examples/pc-sysinstall/README
 OLD_FILES+=usr/share/examples/pc-sysinstall/pc-autoinstall.conf
 OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.fbsd-netinstall
 OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.geli
 OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.gmirror
 OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.netinstall
 OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.restore
 OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.rsync
 OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.upgrade
 OLD_FILES+=usr/share/examples/pc-sysinstall/pcinstall.cfg.zfs
 # pc-sysinstall
 OLD_FILES+=usr/sbin/pc-sysinstall
 OLD_FILES+=usr/share/man/man8/pc-sysinstall.8.gz
 OLD_DIRS+=usr/share/pc-sysinstall/backend
 OLD_DIRS+=usr/share/pc-sysinstall/backend-partmanager
 OLD_DIRS+=usr/share/pc-sysinstall/backend-query
 OLD_DIRS+=usr/share/pc-sysinstall/conf/license
 OLD_DIRS+=usr/share/pc-sysinstall/conf
 OLD_DIRS+=usr/share/pc-sysinstall/doc
 OLD_DIRS+=usr/share/pc-sysinstall
 OLD_DIRS+=usr/share/examples/pc-sysinstall
 .endif
 
 .if ${MK_PF} == no
 OLD_FILES+=etc/periodic/security/520.pfdenied
 OLD_FILES+=etc/pf.os
 OLD_FILES+=etc/rc.d/ftp-proxy
 OLD_FILES+=sbin/pfctl
 OLD_FILES+=sbin/pflogd
 OLD_FILES+=usr/libexec/tftp-proxy
 OLD_FILES+=usr/sbin/ftp-proxy
 OLD_FILES+=usr/share/examples/etc/pf.os
 OLD_FILES+=usr/share/examples/pf/ackpri
 OLD_FILES+=usr/share/examples/pf/faq-example1
 OLD_FILES+=usr/share/examples/pf/faq-example2
 OLD_FILES+=usr/share/examples/pf/faq-example3
 OLD_FILES+=usr/share/examples/pf/pf.conf
 OLD_FILES+=usr/share/examples/pf/queue1
 OLD_FILES+=usr/share/examples/pf/queue2
 OLD_FILES+=usr/share/examples/pf/queue3
 OLD_FILES+=usr/share/examples/pf/queue4
 OLD_FILES+=usr/share/examples/pf/spamd
 OLD_DIRS+=usr/share/examples/pf
 OLD_FILES+=usr/share/man/man4/pf.4.gz
 OLD_FILES+=usr/share/man/man4/pflog.4.gz
 OLD_FILES+=usr/share/man/man4/pfsync.4.gz
 OLD_FILES+=usr/share/man/man5/pf.conf.5.gz
 OLD_FILES+=usr/share/man/man5/pf.os.5.gz
 OLD_FILES+=usr/share/man/man8/ftp-proxy.8.gz
 OLD_FILES+=usr/share/man/man8/pfctl.8.gz
 OLD_FILES+=usr/share/man/man8/pflogd.8.gz
 OLD_FILES+=usr/share/man/man8/tftp-proxy.8.gz
 .endif
 
 .if ${MK_PKGBOOTSTRAP} == no
 OLD_FILES+=usr/sbin/pkg
 OLD_FILES+=usr/share/man/man7/pkg.7.gz
 .endif
 
 .if ${MK_PORTSNAP} == no
 OLD_FILES+=etc/portsnap.conf
 OLD_FILES+=usr/libexec/make_index
 OLD_FILES+=usr/libexec/phttpget
 OLD_FILES+=usr/sbin/portsnap
 OLD_FILES+=usr/share/examples/etc/portsnap.conf
 OLD_FILES+=usr/share/man/man8/portsnap.8.gz
 .endif
 
 .if ${MK_PPP} == no
 OLD_FILES+=etc/ppp/ppp.conf
 OLD_DIRS+=etc/ppp
 OLD_FILES+=usr/sbin/ppp
 OLD_FILES+=usr/sbin/pppctl
 OLD_FILES+=usr/share/man/man8/ppp.8.gz
 OLD_FILES+=usr/share/man/man8/pppctl.8.gz
 .endif
 
 .if ${MK_PROFILE} == no
 OLD_FILES+=usr/lib/libalias_cuseeme_p.a
 OLD_FILES+=usr/lib/libalias_dummy_p.a
 OLD_FILES+=usr/lib/libalias_ftp_p.a
 OLD_FILES+=usr/lib/libalias_irc_p.a
 OLD_FILES+=usr/lib/libalias_nbt_p.a
 OLD_FILES+=usr/lib/libalias_p.a
 OLD_FILES+=usr/lib/libalias_pptp_p.a
 OLD_FILES+=usr/lib/libalias_skinny_p.a
 OLD_FILES+=usr/lib/libalias_smedia_p.a
 OLD_FILES+=usr/lib/libarchive_p.a
 OLD_FILES+=usr/lib/libasn1_p.a
 OLD_FILES+=usr/lib/libbegemot_p.a
 OLD_FILES+=usr/lib/libbluetooth_p.a
 OLD_FILES+=usr/lib/libbsdxml_p.a
 OLD_FILES+=usr/lib/libbsm_p.a
 OLD_FILES+=usr/lib/libbsnmp_p.a
 OLD_FILES+=usr/lib/libbz2_p.a
 OLD_FILES+=usr/lib/libc_p.a
 OLD_FILES+=usr/lib/libcalendar_p.a
 OLD_FILES+=usr/lib/libcam_p.a
 OLD_FILES+=usr/lib/libcom_err_p.a
 OLD_FILES+=usr/lib/libcompat_p.a
 OLD_FILES+=usr/lib/libcrypt_p.a
 OLD_FILES+=usr/lib/libcrypto_p.a
 OLD_FILES+=usr/lib/libcurses_p.a
 OLD_FILES+=usr/lib/libcursesw_p.a
 OLD_FILES+=usr/lib/libdevinfo_p.a
 OLD_FILES+=usr/lib/libdevstat_p.a
 OLD_FILES+=usr/lib/libdialog_p.a
 OLD_FILES+=usr/lib/libedit_p.a
 OLD_FILES+=usr/lib/libelf_p.a
 OLD_FILES+=usr/lib/libfetch_p.a
 OLD_FILES+=usr/lib/libfl_p.a
 OLD_FILES+=usr/lib/libform_p.a
 OLD_FILES+=usr/lib/libformw_p.a
 OLD_FILES+=usr/lib/libgcc_p.a
 OLD_FILES+=usr/lib/libgeom_p.a
 OLD_FILES+=usr/lib/libgnuregex_p.a
-OLD_FILES+=usr/lib/libgpib_p.a
 OLD_FILES+=usr/lib/libgssapi_krb5_p.a
 OLD_FILES+=usr/lib/libgssapi_p.a
 OLD_FILES+=usr/lib/libhdb_p.a
 OLD_FILES+=usr/lib/libheimbase_p.a
 OLD_FILES+=usr/lib/libheimsqlite_p.a
 OLD_FILES+=usr/lib/libhistory_p.a
 OLD_FILES+=usr/lib/libipsec_p.a
 OLD_FILES+=usr/lib/libjail_p.a
 OLD_FILES+=usr/lib/libkadm5clnt_p.a
 OLD_FILES+=usr/lib/libkadm5srv_p.a
 OLD_FILES+=usr/lib/libkafs5_p.a
 OLD_FILES+=usr/lib/libkdc_p.a
 OLD_FILES+=usr/lib/libkiconv_p.a
 OLD_FILES+=usr/lib/libkrb5_p.a
 OLD_FILES+=usr/lib/libkvm_p.a
 OLD_FILES+=usr/lib/libl_p.a
 OLD_FILES+=usr/lib/libln_p.a
 OLD_FILES+=usr/lib/libm_p.a
 OLD_FILES+=usr/lib/libmagic_p.a
 OLD_FILES+=usr/lib/libmd_p.a
 OLD_FILES+=usr/lib/libmemstat_p.a
 OLD_FILES+=usr/lib/libmenu_p.a
 OLD_FILES+=usr/lib/libmenuw_p.a
 OLD_FILES+=usr/lib/libmilter_p.a
 OLD_FILES+=usr/lib/libmp_p.a
 OLD_FILES+=usr/lib/libncurses_p.a
 OLD_FILES+=usr/lib/libncursesw_p.a
 OLD_FILES+=usr/lib/libnetgraph_p.a
 OLD_FILES+=usr/lib/libngatm_p.a
 OLD_FILES+=usr/lib/libopie_p.a
 OLD_FILES+=usr/lib/libpanel_p.a
 OLD_FILES+=usr/lib/libpanelw_p.a
 OLD_FILES+=usr/lib/libpcap_p.a
 OLD_FILES+=usr/lib/libpmc_p.a
 OLD_FILES+=usr/lib/libpthread_p.a
 OLD_FILES+=usr/lib/libradius_p.a
 OLD_FILES+=usr/lib/libroken_p.a
 OLD_FILES+=usr/lib/librpcsvc_p.a
 OLD_FILES+=usr/lib/librt_p.a
 OLD_FILES+=usr/lib/libsbuf_p.a
 OLD_FILES+=usr/lib/libsdp_p.a
 OLD_FILES+=usr/lib/libsmb_p.a
 OLD_FILES+=usr/lib/libssl_p.a
 OLD_FILES+=usr/lib/libstdc++_p.a
 OLD_FILES+=usr/lib/libsupc++_p.a
 OLD_FILES+=usr/lib/libtacplus_p.a
 OLD_FILES+=usr/lib/libtermcap_p.a
 OLD_FILES+=usr/lib/libtermcapw_p.a
 OLD_FILES+=usr/lib/libtermlib_p.a
 OLD_FILES+=usr/lib/libtermlibw_p.a
 OLD_FILES+=usr/lib/libthr_p.a
 OLD_FILES+=usr/lib/libthread_db_p.a
 OLD_FILES+=usr/lib/libtinfo_p.a
 OLD_FILES+=usr/lib/libtinfow_p.a
 OLD_FILES+=usr/lib/libufs_p.a
 OLD_FILES+=usr/lib/libugidfw_p.a
 OLD_FILES+=usr/lib/libusbhid_p.a
 OLD_FILES+=usr/lib/libutil_p.a
 OLD_FILES+=usr/lib/libvgl_p.a
 OLD_FILES+=usr/lib/libwind_p.a
 OLD_FILES+=usr/lib/libwrap_p.a
 OLD_FILES+=usr/lib/liby_p.a
 OLD_FILES+=usr/lib/libypclnt_p.a
 OLD_FILES+=usr/lib/libz_p.a
 OLD_FILES+=usr/lib/private/libldns_p.a
 OLD_FILES+=usr/lib/private/libssh_p.a
 .endif
 
 .if ${MK_RCMDS} == no
 OLD_FILES+=bin/rcp
 OLD_FILES+=etc/rc.d/rwho
 OLD_FILES+=etc/periodic/daily/140.clean-rwho 
 OLD_FILES+=etc/periodic/daily/430.status-rwho
 OLD_FILES+=rescue/rcp
 OLD_FILES+=usr/bin/rlogin
 OLD_FILES+=usr/bin/rsh
 OLD_FILES+=usr/bin/ruptime
 OLD_FILES+=usr/bin/rwho
 OLD_FILES+=usr/libexec/rlogind
 OLD_FILES+=usr/libexec/rshd
 OLD_FILES+=usr/sbin/rwhod
 OLD_FILES+=usr/share/man/man1/rcp.1.gz
 OLD_FILES+=usr/share/man/man1/rlogin.1.gz
 OLD_FILES+=usr/share/man/man1/rsh.1.gz
 OLD_FILES+=usr/share/man/man1/ruptime.1.gz
 OLD_FILES+=usr/share/man/man1/rwho.1.gz
 OLD_FILES+=usr/share/man/man8/rlogind.8.gz
 OLD_FILES+=usr/share/man/man8/rshd.8.gz
 OLD_FILES+=usr/share/man/man8/rwhod.8.gz
 .endif
 
 .if ${MK_RCS} == no
 OLD_FILES+=usr/bin/ci
 OLD_FILES+=usr/bin/co
 OLD_FILES+=usr/bin/ident
 OLD_FILES+=usr/bin/merge
 OLD_FILES+=usr/bin/rcs
 OLD_FILES+=usr/bin/rcsclean
 OLD_FILES+=usr/bin/rcsdiff
 OLD_FILES+=usr/bin/rcsfreeze
 OLD_FILES+=usr/bin/rcsmerge
 OLD_FILES+=usr/bin/rlog
 OLD_FILES+=usr/sbin/etcupdate
 OLD_FILES+=usr/share/man/man1/ci.1.gz
 OLD_FILES+=usr/share/man/man1/co.1.gz
 OLD_FILES+=usr/share/man/man1/ident.1.gz
 OLD_FILES+=usr/share/man/man1/merge.1.gz
 OLD_FILES+=usr/share/man/man1/rcs.1.gz
 OLD_FILES+=usr/share/man/man1/rcsclean.1.gz
 OLD_FILES+=usr/share/man/man1/rcsdiff.1.gz
 OLD_FILES+=usr/share/man/man1/rcsfreeze.1.gz
 OLD_FILES+=usr/share/man/man1/rcsintro.1.gz
 OLD_FILES+=usr/share/man/man1/rcsmerge.1.gz
 OLD_FILES+=usr/share/man/man1/rlog.1.gz
 OLD_FILES+=usr/share/man/man5/rcsfile.5.gz
 OLD_FILES+=usr/share/man/man8/etcupdate.8.gz
 .endif
 
 #.if ${MK_RESCUE} == no
 # to be filled in or replaced with a special target
 #.endif
 
 .if ${MK_ROUTED} == no
 OLD_FILES+=sbin/routed
 OLD_FILES+=sbin/rtquery
 OLD_FILES+=usr/share/man/man8/routed.8.gz
 OLD_FILES+=usr/share/man/man8/rtquery.8.gz
 .endif
 
 .if ${MK_SENDMAIL} == no
 OLD_FILES+=etc/periodic/daily/150.clean-hoststat
 OLD_FILES+=etc/periodic/daily/440.status-mailq
 OLD_FILES+=etc/periodic/daily/460.status-mail-rejects
 OLD_FILES+=etc/periodic/daily/500.queuerun
 .if ${MK_MAILWRAPPER} == no
 OLD_FILES+=bin/rmail
 .endif
 OLD_FILES+=usr/bin/vacation
 OLD_FILES+=usr/include/libmilter/mfapi.h
 OLD_FILES+=usr/include/libmilter/mfdef.h
 OLD_DIRS+=usr/include/libmilter
 OLD_FILES+=usr/lib/libmilter.a
 OLD_FILES+=usr/lib/libmilter.so
 OLD_LIBS+=usr/lib/libmilter.so.5
 OLD_FILES+=usr/lib/libmilter_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/libmilter.a
 OLD_FILES+=usr/lib32/libmilter.so
 OLD_LIBS+=usr/lib32/libmilter.so.5
 OLD_FILES+=usr/lib32/libmilter_p.a
 .endif
 OLD_FILES+=usr/libexec/mail.local
 OLD_FILES+=usr/libexec/sendmail/sendmail
 OLD_FILES+=usr/libexec/smrsh
 OLD_FILES+=usr/sbin/editmap
 OLD_FILES+=usr/sbin/mailstats
 OLD_FILES+=usr/sbin/makemap
 OLD_FILES+=usr/sbin/praliases
 OLD_FILES+=usr/share/doc/smm/08.sendmailop/paper.ascii.gz
 OLD_DIRS+=usr/share/doc/smm/08.sendmailop
 OLD_FILES+=usr/share/man/man1/mailq.1.gz
 OLD_FILES+=usr/share/man/man1/newaliases.1.gz
 OLD_FILES+=usr/share/man/man1/vacation.1.gz
 OLD_FILES+=usr/share/man/man5/aliases.5.gz
 OLD_FILES+=usr/share/man/man8/editmap.8.gz
 OLD_FILES+=usr/share/man/man8/hoststat.8.gz
 OLD_FILES+=usr/share/man/man8/mail.local.8.gz
 OLD_FILES+=usr/share/man/man8/mailstats.8.gz
 OLD_FILES+=usr/share/man/man8/makemap.8.gz
 OLD_FILES+=usr/share/man/man8/praliases.8.gz
 OLD_FILES+=usr/share/man/man8/purgestat.8.gz
 OLD_FILES+=usr/share/man/man8/rmail.8.gz
 OLD_FILES+=usr/share/man/man8/sendmail.8.gz
 OLD_FILES+=usr/share/man/man8/smrsh.8.gz
 OLD_FILES+=usr/share/sendmail/cf/README
 OLD_FILES+=usr/share/sendmail/cf/cf/Makefile
 OLD_FILES+=usr/share/sendmail/cf/cf/README
 OLD_FILES+=usr/share/sendmail/cf/cf/chez.cs.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/clientproto.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/cs-hpux10.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/cs-hpux9.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/cs-osf1.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/cs-solaris2.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/cs-sunos4.1.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/cs-ultrix4.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/cyrusproto.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-bsd4.4.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-hpux10.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-hpux9.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-linux.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-mpeix.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-nextstep3.3.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-osf1.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-solaris.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-sunos4.1.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/generic-ultrix4.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/huginn.cs.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/knecht.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/mail.cs.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/mail.eecs.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/mailspool.cs.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/python.cs.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/s2k-osf1.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/s2k-ultrix4.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/submit.cf
 OLD_FILES+=usr/share/sendmail/cf/cf/submit.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/tcpproto.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/ucbarpa.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/ucbvax.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/uucpproto.mc
 OLD_FILES+=usr/share/sendmail/cf/cf/vangogh.cs.mc
 OLD_DIRS+=usr/share/sendmail/cf/cf
 OLD_FILES+=usr/share/sendmail/cf/domain/Berkeley.EDU.m4
 OLD_FILES+=usr/share/sendmail/cf/domain/CS.Berkeley.EDU.m4
 OLD_FILES+=usr/share/sendmail/cf/domain/EECS.Berkeley.EDU.m4
 OLD_FILES+=usr/share/sendmail/cf/domain/S2K.Berkeley.EDU.m4
 OLD_FILES+=usr/share/sendmail/cf/domain/berkeley-only.m4
 OLD_FILES+=usr/share/sendmail/cf/domain/generic.m4
 OLD_DIRS+=usr/share/sendmail/cf/domain
 OLD_FILES+=usr/share/sendmail/cf/feature/accept_unqualified_senders.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/accept_unresolvable_domains.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/access_db.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/allmasquerade.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/always_add_domain.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/authinfo.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/badmx.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/bestmx_is_local.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/bitdomain.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/blacklist_recipients.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/block_bad_helo.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/compat_check.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/conncontrol.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/delay_checks.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/dnsbl.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/domaintable.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/enhdnsbl.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/generics_entire_domain.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/genericstable.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/greet_pause.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/ldap_routing.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/limited_masquerade.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/local_lmtp.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/local_no_masquerade.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/local_procmail.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/lookupdotdomain.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/loose_relay_check.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/mailertable.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/masquerade_entire_domain.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/masquerade_envelope.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/msp.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/mtamark.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/no_default_msa.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/nocanonify.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/notsticky.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/nouucp.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/nullclient.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/preserve_local_plus_detail.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/preserve_luser_host.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/promiscuous_relay.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/queuegroup.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/ratecontrol.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/redirect.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/relay_based_on_MX.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/relay_entire_domain.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/relay_hosts_only.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/relay_local_from.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/relay_mail_from.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/require_rdns.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/smrsh.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/stickyhost.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/use_client_ptr.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/use_ct_file.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/use_cw_file.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/uucpdomain.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/virtuser_entire_domain.m4
 OLD_FILES+=usr/share/sendmail/cf/feature/virtusertable.m4
 OLD_DIRS+=usr/share/sendmail/cf/feature
 OLD_FILES+=usr/share/sendmail/cf/hack/cssubdomain.m4
 OLD_DIRS+=usr/share/sendmail/cf/hack
 OLD_FILES+=usr/share/sendmail/cf/m4/cf.m4
 OLD_FILES+=usr/share/sendmail/cf/m4/cfhead.m4
 OLD_FILES+=usr/share/sendmail/cf/m4/proto.m4
 OLD_FILES+=usr/share/sendmail/cf/m4/version.m4
 OLD_DIRS+=usr/share/sendmail/cf/m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/cyrus.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/cyrusv2.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/fax.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/local.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/mail11.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/phquery.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/pop.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/procmail.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/qpage.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/smtp.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/usenet.m4
 OLD_FILES+=usr/share/sendmail/cf/mailer/uucp.m4
 OLD_DIRS+=usr/share/sendmail/cf/mailer
 OLD_FILES+=usr/share/sendmail/cf/ostype/a-ux.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/aix3.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/aix4.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/aix5.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/altos.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/amdahl-uts.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/bsd4.3.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/bsd4.4.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/bsdi.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/bsdi1.0.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/bsdi2.0.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/darwin.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/dgux.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/domainos.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/dragonfly.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/dynix3.2.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/freebsd4.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/freebsd5.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/freebsd6.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/gnu.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/hpux10.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/hpux11.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/hpux9.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/irix4.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/irix5.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/irix6.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/isc4.1.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/linux.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/maxion.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/mklinux.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/mpeix.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/nextstep.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/openbsd.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/osf1.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/powerux.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/ptx2.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/qnx.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/riscos4.5.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/sco-uw-2.1.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/sco3.2.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/sinix.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/solaris11.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/solaris2.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/solaris2.ml.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/solaris2.pre5.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/solaris8.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/sunos3.5.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/sunos4.1.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/svr4.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/ultrix4.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/unicos.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/unicosmk.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/unicosmp.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/unixware7.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/unknown.m4
 OLD_FILES+=usr/share/sendmail/cf/ostype/uxpds.m4
 OLD_DIRS+=usr/share/sendmail/cf/ostype
 OLD_FILES+=usr/share/sendmail/cf/sendmail.schema
 OLD_FILES+=usr/share/sendmail/cf/sh/makeinfo.sh
 OLD_DIRS+=usr/share/sendmail/cf/sh
 OLD_FILES+=usr/share/sendmail/cf/siteconfig/uucp.cogsci.m4
 OLD_FILES+=usr/share/sendmail/cf/siteconfig/uucp.old.arpa.m4
 OLD_FILES+=usr/share/sendmail/cf/siteconfig/uucp.ucbarpa.m4
 OLD_FILES+=usr/share/sendmail/cf/siteconfig/uucp.ucbvax.m4
 OLD_DIRS+=usr/share/sendmail/cf/siteconfig
 OLD_DIRS+=usr/share/sendmail/cf
 OLD_DIRS+=usr/share/sendmail
 .endif
 
 .if ${MK_SHAREDOCS} == no
 OLD_FILES+=usr/share/doc/pjdfstest/README
 OLD_DIRS+=usr/share/doc/pjdfstest
 .endif
 
 #.if ${MK_SYSCONS} == no
 # to be filled in
 #.endif
 
 .if ${MK_TCSH} == no
 OLD_FILES+=bin/csh
 OLD_FILES+=bin/tcsh
 OLD_FILES+=rescue/csh
 OLD_FILES+=rescue/tcsh
 OLD_FILES+=usr/share/examples/tcsh/complete.tcsh
 OLD_FILES+=usr/share/examples/tcsh/csh-mode.el
 OLD_DIRS+=usr/share/examples/tcsh
 OLD_FILES+=usr/share/man/man1/csh.1.gz
 OLD_FILES+=usr/share/man/man1/tcsh.1.gz
 OLD_FILES+=usr/share/nls/de_AT.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/de_AT.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/de_AT.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/de_CH.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/de_CH.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/de_CH.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/de_DE.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/de_DE.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/de_DE.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/el_GR.ISO8859-7/tcsh.cat
 OLD_FILES+=usr/share/nls/el_GR.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/es_ES.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/es_ES.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/es_ES.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/et_EE.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/et_EE.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/fi_FI.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/fi_FI.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/fi_FI.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_BE.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_BE.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_BE.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_CA.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_CA.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_CA.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_CH.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_CH.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_CH.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_FR.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_FR.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/fr_FR.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/it_CH.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/it_CH.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/it_CH.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/it_IT.ISO8859-1/tcsh.cat
 OLD_FILES+=usr/share/nls/it_IT.ISO8859-15/tcsh.cat
 OLD_FILES+=usr/share/nls/it_IT.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/ja_JP.SJIS/tcsh.cat
 OLD_FILES+=usr/share/nls/ja_JP.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/ja_JP.eucJP/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.CP1251/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.CP866/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.ISO8859-5/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/tcsh.cat
 OLD_FILES+=usr/share/nls/ru_RU.UTF-8/tcsh.cat
 OLD_FILES+=usr/share/nls/uk_UA.ISO8859-5/tcsh.cat
 OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/tcsh.cat
 OLD_FILES+=usr/share/nls/uk_UA.UTF-8/tcsh.cat
 .endif
 
 .if ${MK_TELNET} == no
 OLD_FILES+=usr/bin/telnet
 OLD_FILES+=usr/libexec/telnetd
 OLD_FILES+=usr/share/man/man1/telnet.1.gz
 OLD_FILES+=usr/share/man/man8/telnetd.8.gz
 .endif
 
 .if ${MK_TESTS} == yes
 OLD_FILES+=usr/bin/atf-sh
 OLD_FILES+=usr/include/atf-c++/config.hpp
 OLD_FILES+=usr/include/atf-c/config.h
 OLD_LIBS+=usr/lib/libatf-c++.a
 OLD_LIBS+=usr/lib/libatf-c++.so
 OLD_LIBS+=usr/lib/libatf-c++.so.1
 OLD_LIBS+=usr/lib/libatf-c++.so.2
 OLD_LIBS+=usr/lib/libatf-c++_p.a
 OLD_LIBS+=usr/lib/libatf-c.a
 OLD_LIBS+=usr/lib/libatf-c.so
 OLD_LIBS+=usr/lib/libatf-c.so.1
 OLD_LIBS+=usr/lib/libatf-c_p.a
 OLD_LIBS+=usr/lib/private/libatf-c.so.0
 OLD_LIBS+=usr/lib/private/libatf-c++.so.1
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_LIBS+=usr/lib32/libatf-c++.a
 OLD_LIBS+=usr/lib32/libatf-c++.so
 OLD_LIBS+=usr/lib32/libatf-c++.so.1
 OLD_LIBS+=usr/lib32/libatf-c++.so.2
 OLD_LIBS+=usr/lib32/libatf-c++_p.a
 OLD_LIBS+=usr/lib32/libatf-c.a
 OLD_LIBS+=usr/lib32/libatf-c.so
 OLD_LIBS+=usr/lib32/libatf-c.so.1
 OLD_LIBS+=usr/lib32/libatf-c_p.a
 OLD_LIBS+=usr/lib32/private/libatf-c.so.0
 OLD_LIBS+=usr/lib32/private/libatf-c++.so.1
 .endif
 OLD_FILES+=usr/libdata/pkgconfig/atf-c++.pc
 OLD_FILES+=usr/libdata/pkgconfig/atf-c.pc
 OLD_FILES+=usr/libdata/pkgconfig/atf-sh.pc
 OLD_FILES+=usr/share/aclocal/atf-c++.m4
 OLD_FILES+=usr/share/aclocal/atf-c.m4
 OLD_FILES+=usr/share/aclocal/atf-common.m4
 OLD_FILES+=usr/share/aclocal/atf-sh.m4
 OLD_DIRS+=usr/share/aclocal
 OLD_FILES+=usr/tests/bin/chown/units_basics
 OLD_FILES+=usr/tests/bin/date/legacy_test
 OLD_FILES+=usr/tests/bin/sh/legacy_test
 OLD_FILES+=usr/tests/usr.bin/atf/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/atf/atf-sh/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/atf/atf-sh/atf_check_test
 OLD_FILES+=usr/tests/usr.bin/atf/atf-sh/config_test
 OLD_FILES+=usr/tests/usr.bin/atf/atf-sh/integration_test
 OLD_FILES+=usr/tests/usr.bin/atf/atf-sh/misc_helpers
 OLD_FILES+=usr/tests/usr.bin/atf/atf-sh/normalize_test
 OLD_FILES+=usr/tests/usr.bin/atf/atf-sh/tc_test
 OLD_FILES+=usr/tests/usr.bin/atf/atf-sh/tp_test
 OLD_DIRS+=usr/tests/usr.bin/atf/atf-sh
 OLD_DIRS+=usr/tests/usr.bin/atf
 OLD_FILES+=usr/tests/lib/atf/libatf-c/test_helpers_test
 OLD_FILES+=usr/tests/lib/atf/test-programs/fork_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/application_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/config_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/detail/expand_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/detail/parser_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/detail/sanity_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/detail/ui_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/env_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/exceptions_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/expand_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/fs_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/parser_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/process_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/sanity_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/pkg_config_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/text_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/ui_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/config_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/dynstr_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/env_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/fs_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/list_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/map_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/pkg_config_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/process_helpers
 OLD_FILES+=usr/tests/lib/atf/libatf-c/process_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/sanity_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/text_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/user_test
 .if ${MK_MAKE} == yes
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.status.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.status.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.status.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.status.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.status.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stderr.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stderr.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stderr.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stderr.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stderr.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stdout.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stdout.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stdout.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stdout.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/expected.stdout.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd/libtest.a
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.status.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.status.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.status.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.status.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.status.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stderr.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stderr.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stderr.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stderr.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stderr.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stdout.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stdout.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stdout.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stdout.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/expected.stdout.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod/libtest.a
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.status.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.status.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.status.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.status.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.status.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stderr.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stderr.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stderr.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stderr.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stderr.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stdout.3
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stdout.4
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stdout.5
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stdout.6
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/expected.stdout.7
 OLD_FILES+=usr/tests/usr.bin/make/archives/fmt_oldbsd/libtest.a
 OLD_FILES+=usr/tests/usr.bin/make/archives/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/basic/t0/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/basic/t0/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/basic/t0/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t0/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t0/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t1/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/basic/t1/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/basic/t1/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/basic/t1/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t1/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t1/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t2/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/basic/t2/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/basic/t2/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/basic/t2/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t2/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t2/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t3/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/basic/t3/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/basic/t3/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t3/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/t3/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/basic/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/execution/ellipsis/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/execution/ellipsis/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/execution/ellipsis/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/execution/ellipsis/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/ellipsis/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/ellipsis/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/empty/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/execution/empty/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/execution/empty/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/execution/empty/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/empty/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/empty/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/joberr/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/execution/joberr/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/execution/joberr/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/execution/joberr/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/joberr/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/joberr/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/plus/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/execution/plus/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/execution/plus/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/execution/plus/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/plus/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/plus/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/execution/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/builtin/sh
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/meta/sh
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/path/sh
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/path_select/shell
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/replace/shell
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/shell/select/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/shell/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/basic/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/basic/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/basic/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/basic/TEST1.a
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/basic/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/basic/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/basic/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild1/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild1/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild1/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild1/TEST1.a
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild1/TEST2.a
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild1/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild1/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild1/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild2/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild2/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild2/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild2/TEST1.a
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild2/TEST2.a
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild2/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild2/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/src_wild2/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/suffixes/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/syntax/directive-t0/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/syntax/directive-t0/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/syntax/directive-t0/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/syntax/directive-t0/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/directive-t0/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/directive-t0/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.status.3
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.status.4
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.status.5
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stderr.3
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stderr.4
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stderr.5
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stdout.3
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stdout.4
 OLD_FILES+=usr/tests/usr.bin/make/syntax/enl/expected.stdout.5
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/funny-targets/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/syntax/semi/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/syntax/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/2/1/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/2/1/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/2/1/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/2/1/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/2/1/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/2/1/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/2/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/mk/sys.mk
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/mk/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t0/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/2/1/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/2/1/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/2/1/cleanup
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/2/1/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/2/1/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/2/1/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/2/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/mk/sys.mk
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/mk/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t1/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/2/1/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/2/1/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/2/1/cleanup
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/2/1/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/2/1/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/2/1/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/2/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/mk/sys.mk
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/mk/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/t2/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/sysmk/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_M/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_M/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_M/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_M/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_M/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_M/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.status.3
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.stderr.3
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/variables/modifier_t/expected.stdout.3
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/expected.status.2
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/expected.stderr.2
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/opt_V/expected.stdout.2
 OLD_FILES+=usr/tests/usr.bin/make/variables/t0/legacy_test
 OLD_FILES+=usr/tests/usr.bin/make/variables/t0/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/variables/t0/Makefile.test
 OLD_FILES+=usr/tests/usr.bin/make/variables/t0/expected.status.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/t0/expected.stderr.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/t0/expected.stdout.1
 OLD_FILES+=usr/tests/usr.bin/make/variables/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/Kyuafile
 OLD_FILES+=usr/tests/usr.bin/make/common.sh
 OLD_FILES+=usr/tests/usr.bin/make/test-new.mk
 OLD_DIRS+=usr/tests/usr.bin/make/variables/t0
 OLD_DIRS+=usr/tests/usr.bin/make/variables/opt_V
 OLD_DIRS+=usr/tests/usr.bin/make/variables/modifier_t
 OLD_DIRS+=usr/tests/usr.bin/make/variables/modifier_M
 OLD_DIRS+=usr/tests/usr.bin/make/variables
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t2/mk
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t2/2/1
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t2/2
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t2
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t1/mk
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t1/2/1
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t1/2
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t1
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t0/mk
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t0/2/1
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t0/2
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk/t0
 OLD_DIRS+=usr/tests/usr.bin/make/sysmk
 OLD_DIRS+=usr/tests/usr.bin/make/syntax/semi
 OLD_DIRS+=usr/tests/usr.bin/make/syntax/funny-targets
 OLD_DIRS+=usr/tests/usr.bin/make/syntax/enl
 OLD_DIRS+=usr/tests/usr.bin/make/syntax/directive-t0
 OLD_DIRS+=usr/tests/usr.bin/make/syntax
 OLD_DIRS+=usr/tests/usr.bin/make/suffixes/src_wild2
 OLD_DIRS+=usr/tests/usr.bin/make/suffixes/src_wild1
 OLD_DIRS+=usr/tests/usr.bin/make/suffixes/basic
 OLD_DIRS+=usr/tests/usr.bin/make/suffixes
 OLD_DIRS+=usr/tests/usr.bin/make/shell/select
 OLD_DIRS+=usr/tests/usr.bin/make/shell/replace
 OLD_DIRS+=usr/tests/usr.bin/make/shell/path_select
 OLD_DIRS+=usr/tests/usr.bin/make/shell/path
 OLD_DIRS+=usr/tests/usr.bin/make/shell/meta
 OLD_DIRS+=usr/tests/usr.bin/make/shell/builtin
 OLD_DIRS+=usr/tests/usr.bin/make/shell
 OLD_DIRS+=usr/tests/usr.bin/make/execution/plus
 OLD_DIRS+=usr/tests/usr.bin/make/execution/joberr
 OLD_DIRS+=usr/tests/usr.bin/make/execution/empty
 OLD_DIRS+=usr/tests/usr.bin/make/execution/ellipsis
 OLD_DIRS+=usr/tests/usr.bin/make/execution
 OLD_DIRS+=usr/tests/usr.bin/make/basic/t3
 OLD_DIRS+=usr/tests/usr.bin/make/basic/t2
 OLD_DIRS+=usr/tests/usr.bin/make/basic/t1
 OLD_DIRS+=usr/tests/usr.bin/make/basic/t0
 OLD_DIRS+=usr/tests/usr.bin/make/basic
 OLD_DIRS+=usr/tests/usr.bin/make/archives/fmt_oldbsd
 OLD_DIRS+=usr/tests/usr.bin/make/archives/fmt_44bsd_mod
 OLD_DIRS+=usr/tests/usr.bin/make/archives/fmt_44bsd
 OLD_DIRS+=usr/tests/usr.bin/make/archives
 OLD_DIRS+=usr/tests/usr.bin/make
 OLD_FILES+=usr/tests/usr.bin/yacc/legacy_test
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.00.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.01.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.02.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.03.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.04.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.05.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.06.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.07.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.08.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.09.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.10.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.11.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.12.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.13.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.14.out
 OLD_FILES+=usr/tests/usr.bin/yacc/regress.sh
 OLD_FILES+=usr/tests/usr.bin/yacc/undefined.y
 .endif
 .else
 # ATF libraries.
 OLD_FILES+=usr/bin/atf-sh
 OLD_DIRS+=usr/include/atf-c
 OLD_FILES+=usr/include/atf-c/build.h
 OLD_FILES+=usr/include/atf-c/check.h
 OLD_FILES+=usr/include/atf-c/config.h
 OLD_FILES+=usr/include/atf-c/defs.h
 OLD_FILES+=usr/include/atf-c/error.h
 OLD_FILES+=usr/include/atf-c/error_fwd.h
 OLD_FILES+=usr/include/atf-c/macros.h
 OLD_FILES+=usr/include/atf-c/tc.h
 OLD_FILES+=usr/include/atf-c/tp.h
 OLD_FILES+=usr/include/atf-c/utils.h
 OLD_FILES+=usr/include/atf-c.h
 OLD_DIRS+=usr/include/atf-c++
 OLD_FILES+=usr/include/atf-c++/build.hpp
 OLD_FILES+=usr/include/atf-c++/check.hpp
 OLD_FILES+=usr/include/atf-c++/config.hpp
 OLD_FILES+=usr/include/atf-c++/macros.hpp
 OLD_FILES+=usr/include/atf-c++/tests.hpp
 OLD_FILES+=usr/include/atf-c++/utils.hpp
 OLD_FILES+=usr/include/atf-c++.hpp
 OLD_FILES+=usr/lib/libatf-c_p.a
 OLD_FILES+=usr/lib/libatf-c.so.1
 OLD_FILES+=usr/lib/libatf-c.so
 OLD_FILES+=usr/lib/libatf-c++.a
 OLD_FILES+=usr/lib/libatf-c++_p.a
 OLD_FILES+=usr/lib/libatf-c++.so.1
 OLD_FILES+=usr/lib/libatf-c++.so
 OLD_FILES+=usr/lib/libatf-c.a
 OLD_FILES+=usr/libexec/atf-check
 OLD_DIRS+=usr/share/atf
 OLD_FILES+=usr/share/atf/libatf-sh.subr
 OLD_DIRS+=usr/share/doc/atf
 OLD_FILES+=usr/share/doc/atf/AUTHORS
 OLD_FILES+=usr/share/doc/atf/COPYING
 OLD_FILES+=usr/share/doc/atf/NEWS
 OLD_FILES+=usr/share/doc/atf/README
 OLD_FILES+=usr/share/man/man1/atf-check.1.gz
 OLD_FILES+=usr/share/man/man1/atf-sh.1.gz
 OLD_FILES+=usr/share/man/man1/atf-test-program.1.gz
 OLD_FILES+=usr/share/man/man3/atf-c-api.3.gz
 OLD_FILES+=usr/share/man/man3/atf-c++-api.3.gz
 OLD_FILES+=usr/share/man/man3/atf-sh-api.3.gz
 OLD_FILES+=usr/share/man/man4/atf-test-case.4.gz
 OLD_FILES+=usr/share/mk/atf.test.mk
 
 # Test suite.
 . if exists(${DESTDIR}${TESTSBASE})
 TESTS_DIRS!=find ${DESTDIR}${TESTSBASE} -type d | sed -e 's,^${DESTDIR}/,,'; echo
 OLD_DIRS+=${TESTS_DIRS}
 TESTS_FILES!=find ${DESTDIR}${TESTSBASE} \! -type d | sed -e 's,^${DESTDIR}/,,'; echo
 OLD_FILES+=${TESTS_FILES}
 . endif
 .endif	# Test suite.
 
 #.if ${MK_TOOLCHAIN} == no
 # to be filled in
 #.endif
 
 .if ${MK_UNBOUND} == no
 OLD_FILES+=etc/rc.d/local_unbound
 OLD_FILES+=usr/lib/private/libunbound.a
 OLD_FILES+=usr/lib/private/libunbound.so
 OLD_LIBS+=usr/lib/private/libunbound.so.5
 OLD_FILES+=usr/lib/private/libunbound_p.a
 .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
 OLD_FILES+=usr/lib32/private/libunbound.a
 OLD_FILES+=usr/lib32/private/libunbound.so
 OLD_LIBS+=usr/lib32/private/libunbound.so.5
 OLD_FILES+=usr/lib32/private/libunbound_p.a
 .endif
 OLD_FILES+=usr/sbin/local-unbound-setup
 OLD_FILES+=usr/sbin/unbound
 OLD_FILES+=usr/sbin/unbound-anchor
 OLD_FILES+=usr/sbin/unbound-checkconf
 OLD_FILES+=usr/sbin/unbound-control
 OLD_FILES+=usr/sbin/unbound-control-setup
 .endif
 
 .if ${MK_USB} == no
 OLD_FILES+=etc/devd/uauth.conf
 OLD_FILES+=etc/devd/usb.conf
 .endif
 
 .if ${MK_UTMPX} == no
 OLD_FILES+=etc/periodic/monthly/200.accounting
 OLD_FILES+=usr/bin/last
 OLD_FILES+=usr/bin/users
 OLD_FILES+=usr/bin/who
 OLD_FILES+=usr/sbin/ac
 OLD_FILES+=usr/sbin/lastlogin
 OLD_FILES+=usr/sbin/utx
 OLD_FILES+=usr/share/man/man1/last.1.gz
 OLD_FILES+=usr/share/man/man1/users.1.gz
 OLD_FILES+=usr/share/man/man1/who.1.gz
 OLD_FILES+=usr/share/man/man8/ac.8.gz
 OLD_FILES+=usr/share/man/man8/lastlogin.8.gz
 OLD_FILES+=usr/share/man/man8/utx.8.gz
 .endif
 
 .if ${MK_WIRELESS} == no
 OLD_FILES+=etc/regdomain.xml
 OLD_FILES+=usr/sbin/ancontrol
 OLD_FILES+=usr/sbin/hostapd
 OLD_FILES+=usr/sbin/hostapd_cli
 OLD_FILES+=usr/sbin/ndis_events
 OLD_FILES+=usr/sbin/wlandebug
 .if ${TARGET_ARCH} == "i386"
 OLD_FILES+=usr/sbin/wlconfig
 .endif
 OLD_FILES+=usr/sbin/wpa_cli
 OLD_FILES+=usr/sbin/wpa_passphrase
 OLD_FILES+=usr/sbin/wpa_supplicant
 OLD_FILES+=usr/share/examples/etc/regdomain.xml
 OLD_FILES+=usr/share/examples/etc/wpa_supplicant.conf
 OLD_FILES+=usr/share/examples/hostapd/hostapd.conf
 OLD_FILES+=usr/share/examples/hostapd/hostapd.eap_user
 OLD_FILES+=usr/share/examples/hostapd/hostapd.wpa_psk
 OLD_DIRS+=usr/share/examples/hostapd
 OLD_FILES+=usr/share/man/man5/hostapd.conf.5.gz
 OLD_FILES+=usr/share/man/man5/wpa_supplicant.conf.5.gz
 OLD_FILES+=usr/share/man/man8/ancontrol.8.gz
 OLD_FILES+=usr/share/man/man8/hostapd.8.gz
 OLD_FILES+=usr/share/man/man8/hostapd_cli.8.gz
 .if ${TARGET_ARCH} == "i386"
 OLD_FILES+=usr/share/man/man8/i386/wlconfig.8.gz
 .endif
 OLD_FILES+=usr/share/man/man8/ndis_events.8.gz
 OLD_FILES+=usr/share/man/man8/wlandebug.8.gz
 OLD_FILES+=usr/share/man/man8/wpa_cli.8.gz
 OLD_FILES+=usr/share/man/man8/wpa_passphrase.8.gz
 OLD_FILES+=usr/share/man/man8/wpa_supplicant.8.gz
 .endif
 
 .if ${MK_SVNLITE} == no || ${MK_SVN} == yes
 OLD_FILES+=usr/bin/svnlite
 OLD_FILES+=usr/bin/svnliteadmin
 OLD_FILES+=usr/bin/svnlitedumpfilter
 OLD_FILES+=usr/bin/svnlitelook
 OLD_FILES+=usr/bin/svnlitemucc
 OLD_FILES+=usr/bin/svnliterdump
 OLD_FILES+=usr/bin/svnliteserve
 OLD_FILES+=usr/bin/svnlitesync
 OLD_FILES+=usr/bin/svnliteversion
 OLD_FILES+=usr/share/man/man1/svnlite.1.gz
 .endif
 
 .if ${MK_SVN} == no
 OLD_FILES+=usr/bin/svn
 OLD_FILES+=usr/bin/svnadmin
 OLD_FILES+=usr/bin/svndumpfilter
 OLD_FILES+=usr/bin/svnlook
 OLD_FILES+=usr/bin/svnmucc
 OLD_FILES+=usr/bin/svnrdump
 OLD_FILES+=usr/bin/svnserve
 OLD_FILES+=usr/bin/svnsync
 OLD_FILES+=usr/bin/svnversion
 .endif
 
 .if ${MK_DMAGENT} == no
 OLD_FILES+=usr/libexec/dma
 OLD_FILES+=usr/libexec/dma-mbox-create
 OLD_FILES+=usr/share/man/man8/dma.8.gz
 OLD_FILES+=usr/share/examples/dma/mailer.conf
 .endif
 
 .if ${MK_HYPERV} == no
 OLD_FILES+=etc/devd/hyperv.conf
 OLD_FILES+=usr/libexec/hyperv/hv_set_ifconfig
 OLD_FILES+=usr/libexec/hyperv/hv_get_dns_info
 OLD_FILES+=usr/libexec/hyperv/hv_get_dhcp_info
 OLD_FILES+=usr/sbin/hv_kvp_daemon
 OLD_FILES+=usr/share/man/man8/hv_kvp_daemon.8.gz
 .endif
Index: projects/arm_intrng/tools/build/options/WITHOUT_GPIB
===================================================================
--- projects/arm_intrng/tools/build/options/WITHOUT_GPIB	(revision 276247)
+++ projects/arm_intrng/tools/build/options/WITHOUT_GPIB	(nonexistent)
@@ -1,2 +0,0 @@
-.\" $FreeBSD$
-Set to not build GPIB bus support.

Property changes on: projects/arm_intrng/tools/build/options/WITHOUT_GPIB
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: projects/arm_intrng/tools/tools/sysbuild/sysbuild.sh
===================================================================
--- projects/arm_intrng/tools/tools/sysbuild/sysbuild.sh	(revision 276247)
+++ projects/arm_intrng/tools/tools/sysbuild/sysbuild.sh	(revision 276248)
@@ -1,637 +1,639 @@
 #!/bin/sh
 #
 # Copyright (c) 1994-2009 Poul-Henning Kamp.
 # 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 AUTHOR 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 AUTHOR 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.
 #
 # $FreeBSD$
 #
 
 set -e
 
 exec < /dev/null
 
 if [ `uname -m` = "i386" -o `uname -m` = "amd64" ] ; then
 	TARGET_PART=`df / | sed '
 	1d
 	s/[    ].*//
 	s,/dev/,,
 	s,s1a,s3a,
 	s,s2a,s1a,
 	s,s3a,s2a,
 	'`
 
 	FREEBSD_PART=`sed -n	\
 		-e 's/#.*//'	\
 		-e '/[ 	]\/freebsd[ 	]/!d'	\
 		-e 's/[ 	].*//p'	\
 		/etc/fstab`
 
 	# Calculate a suggested gpart command
 	TARGET_DISK=`expr ${TARGET_PART} : '\(.*\)s[12]a$' || true`
 	TARGET_SLICE=`expr ${TARGET_PART} : '.*s\([12]\)a$' || true`
 	GPART_SUGGESTION="gpart set -a active -i $TARGET_SLICE /dev/$TARGET_DISK"
 	unset TARGET_DISK TARGET_SLICE
 else
 	TARGET_PART=unknown
 	FREEBSD_PART=unknown
 	GPART_SUGGESTION=unknown
 fi
 
 
 # Relative to /freebsd
 PORTS_PATH=ports
 SRC_PATH=src
 # OBJ_PATH=obj
 
 # Name of kernel
 KERNCONF=GENERIC
 
 # srcconf
 #SRCCONF="SRCCONF=/usr/src/src.conf"
 
 # -j arg to make(1)
 
 ncpu=`sysctl -n kern.smp.cpus`
 if [ $ncpu -gt 1 ] ; then
 	JARG="-j $ncpu"
 fi
 
 # serial console ?
 SERCONS=false
 
 # Remotely mounted distfiles
 # REMOTEDISTFILES=fs:/rdonly/distfiles
 
 # Proxy
 #FTP_PROXY=http://127.0.0.1:3128/
 #HTTP_PROXY=http://127.0.0.1:3128/
 #export FTP_PROXY HTTP_PROXY
 
 PORTS_WE_WANT='
 '
 
 PORTS_OPTS="BATCH=YES A4=yes"
 
 CONFIGFILES='
 '
 
 SBMNT="/mnt.sysbuild"
 
 cleanup() (
 )
 
 before_ports() (
 )
 
 before_ports_chroot() (
 )
 
 final_root() (
 )
 
 final_chroot() (
 )
 
 #######################################################################
 # -P is a pretty neat way to clean junk out from your ports dist-files:
 #
 #	mkdir /freebsd/ports/distfiles.old
 #	mv /freebsd/ports/distfiles/* /freebsd/ports/distfiles.old
 #	sh sysbuild.sh -c $yourconfig -P /freebsd/ports/distfiles.old
 #	rm -rf /freebsd/ports/distfiles.old
 #
 # Unfortunately bsd.ports.mk does not attempt to use a hard-link so
 # while this runs you need diskspace for both your old and your "new"
 # distfiles.
 #
 #######################################################################
 
 usage () {
 	(
         echo "Usage: $0 [-b/-k/-w] [-c config_file]"
         echo "  -b      suppress builds (both kernel and world)"
         echo "  -k      suppress buildkernel"
         echo "  -w      suppress buildworld"
         echo "  -p      used cached packages"
         echo "  -P  prefetch ports"
         echo "  -c      specify config file"
         ) 1>&2
         exit 2
 }
 
 #######################################################################
 #######################################################################
 
 if [ ! -f $0 ] ; then
 	echo "Must be able to access self ($0)" 1>&2
 	exit 1
 fi
 
 if grep -q 'Magic String: 0`0nQT40W%l,CX&' $0 ; then
 	true
 else
 	echo "self ($0) does not contain magic string" 1>&2
 	exit 1
 fi
 
 #######################################################################
 
 set -e
 
 log_it() (
 	a="$*"
 	set `cat /tmp/_sb_log`
 	TX=`date +%s`
 	echo "$1 $TX" > /tmp/_sb_log
 	DT=`expr $TX - $1 || true`
 	DL=`expr $TX - $2 || true`
 	echo -n "### `date +%H:%M:%S`"
 	printf " ### %5d ### %5d ### %s\n" $DT $DL "$a"
 )
 
 #######################################################################
 
 
 ports_recurse() (
 	t=$1
 	shift
 	if [ "x$t" = "x." ] ; then
 		true > /tmp/_.plist
 		true > /tmp/_.plist.tdone
 		echo 'digraph {' > /tmp/_.plist.dot
 	fi
 	if grep -q "^$t\$" /tmp/_.plist.tdone ; then
 		return
 	fi
 	echo "$t" >> /tmp/_.plist.tdone
 	for d
 	do
 		if [ ! -d $d ] ; then
 			echo "Missing port $d" 1>&2
 			continue
 		fi
 		if [ ! -f $d/Makefile ] ; then
 			echo "Missing port $d" 1>&2
 			continue
 		fi
 		if [ "x$t" != "x." ] ; then
 			echo "\"$t\" -> \"$d\"" >> /tmp/_.plist.dot
 		fi
 		if grep -q "^$d\$" /tmp/_.plist ; then
 			true
 		elif grep -q "^$d\$" /tmp/_.plist.tdone ; then
 			true
 		else
 			(
 			cd $d
 			ports_recurse $d `make -V _DEPEND_DIRS ${PORTS_OPTS}`
 			)
 			echo "$d" >> /tmp/_.plist
 		fi
 	done
 	if [ "x$t" = "x." ] ; then
 		echo '}' >> /tmp/_.plist.dot
 	fi
 )
 
 ports_build() (
 
 	ports_recurse . $PORTS_WE_WANT 
 
+	if [ "x${PKG_DIR}" != "x" ] ; then
+		mkdir -p ${PKG_DIR}
+	fi
+
 	# Now build & install them
 	for p in `cat /tmp/_.plist`
 	do
 		b=`echo $p | tr / _`
 		t=`echo $p | sed 's,/usr/ports/,,'`
 		pn=`cd $p && make package-name`
 
 		if [ "x`basename $p`" == "xpkg" ] ; then
 			log_it "Very Special: $t ($pn)"
 
 			(
 			cd $p
-			make clean ${PORTS_OPTS}
-			make all ${PORTS_OPTS}
-			make install ${PORTS_OPTS}
+			make clean all install ${PORTS_OPTS}
 			) > _.$b 2>&1 < /dev/null
 			continue
 		fi
 
 		if pkg info $pn > /dev/null 2>&1 ; then
 			log_it "Already installed: $t ($pn)"
 			continue
 		fi
 
 		if [ "x${PKG_DIR}" != "x" -a -f ${PKG_DIR}/$pn.txz ] ; then
 			if [ "x$use_pkg" = "x-p" ] ; then
 				log_it "Install $t ($pn)"
 				(
 				set +e
 				pkg add ${PKG_DIR}/$pn.txz || true
 				) > _.$b 2>&1 < /dev/null
 				continue
 			fi
 		fi
 
 		miss=`(cd $p ; make missing ${PORTS_OPTS}) || true`
 
 		if [ "x${miss}" != "x" ] ; then
 			log_it "MISSING for $p:" $miss
 			continue
 		fi
 
 		log_it "build $pn ($p)"
 		(
 			set +e
 			cd $p
 			make clean ${PORTS_OPTS}
 			if make install ${PORTS_OPTS} ; then
 				if [ "x${PKG_DIR}" != "x" ] ; then
 					make package ${PORTS_OPTS}
 				fi
 			else
 				log_it FAIL build $p
 			fi
 			make clean
 		) > _.$b 2>&1 < /dev/null
 	done
 )
 
 ports_prefetch() (
 	(
 	set +x
 	ldir=$1
 	true > /${ldir}/_.prefetch
 	echo "Building /tmp/_.plist" >> /${ldir}/_.prefetch
 
 	ports_recurse . $PORTS_WE_WANT
 
 	echo "Completed /tmp/_.plist" >> /${ldir}/_.prefetch
 	# Now checksump/fetch them
 	for p in `cat /tmp/_.plist`
 	do
 		b=`echo $p | tr / _`
 		(
 			cd $p
 			if make checksum $PORTS_OPTS ; then
 				rm -f /${ldir}/_.prefetch.$b
 				echo "OK $p" >> /${ldir}/_.prefetch
 				exit 0
 			fi
 			make distclean
 			make checksum $PORTS_OPTS || true
 
 			if make checksum $PORTS_OPTS > /dev/null 2>&1 ; then
 				rm -f /${ldir}/_.prefetch.$b
 				echo "OK $p" >> /${ldir}/_.prefetch
 			else
 				echo "BAD $p" >> /${ldir}/_.prefetch
 			fi
 		) > /${ldir}/_.prefetch.$b 2>&1
 	done
 	echo "Done" >> /${ldir}/_.prefetch
 	) 
 )
 
 #######################################################################
 
 do_world=true
 do_kernel=true
 do_prefetch=false
 use_pkg=""
 c_arg=""
 
 set +e
 args=`getopt bc:hkpP:w $*`
 if [ $? -ne 0 ] ; then
 	usage
 fi
 set -e
 
 set -- $args
 for i
 do
 	case "$i"
 	in
 	-b)
 		shift;
 		do_world=false
 		do_kernel=false
 		;;
 	-c)
 		c_arg=$2
 		if [ ! -f "$c_arg" ] ; then
 			echo "Cannot read $c_arg" 1>&2
 			usage
 		fi
 		. "$2"
 		shift
 		shift
 		;;
 	-h)
 		usage
 		;;
 	-k)
 		shift;
 		do_kernel=false
 		;;
 	-p)
 		shift;
 		use_pkg="-p"
 		;;
 	-P)
 		shift;
 		do_prefetch=true
 		distfile_cache=$1
 		shift;
 		;;
 	-w)
 		shift;
 		do_world=false
 		;;
 	--)
 		shift
 		break;
 		;;
 	esac
 done
 
 #######################################################################
 
 if [ "x$1" = "xchroot_script" ] ; then
 	set -e
 
 	shift
 
 	before_ports_chroot
 
 	ports_build
 
 	exit 0
 fi
 
 if [ "x$1" = "xfinal_chroot" ] ; then
 	final_chroot
 	exit 0
 fi
 
 if [ $# -gt 0 ] ; then
         echo "$0: Extraneous arguments supplied"
         usage
 fi
 
 #######################################################################
 
 T0=`date +%s`
 echo $T0 $T0 > /tmp/_sb_log
 
 [ ! -d ${SBMNT} ] && mkdir -p ${SBMNT}
 
 if $do_prefetch ; then
 	rm -rf /tmp/sysbuild/ports
 	mkdir -p /tmp/sysbuild/ports
 	ln -s ${distfile_cache} /tmp/sysbuild/ports/distfiles
 	export PORTS_OPTS=CD_MOUNTPTS=/tmp/sysbuild
 	ports_prefetch /tmp 
 	exit 0
 fi
 
 log_it Unmount everything
 (
 	( cleanup )
 	umount /freebsd/distfiles || true
 	umount ${SBMNT}/freebsd/distfiles || true
 	umount ${FREEBSD_PART} || true
 	umount ${SBMNT}/freebsd || true
 	umount ${SBMNT}/dev || true
 	umount ${SBMNT} || true
 	umount /dev/${TARGET_PART} || true
 ) # > /dev/null 2>&1
 
 log_it Prepare running image
 mkdir -p /freebsd
 mount ${FREEBSD_PART} /freebsd
 
 #######################################################################
 
 if [ ! -d /freebsd/${PORTS_PATH} ] ;  then
 	echo PORTS_PATH does not exist 1>&2
 	exit 1
 fi
 
 if [ ! -d /freebsd/${SRC_PATH} ] ;  then
 	echo SRC_PATH does not exist 1>&2
 	exit 1
 fi
 
 log_it TARGET_PART $TARGET_PART
 sleep 5
 
 rm -rf /usr/ports
 ln -s /freebsd/${PORTS_PATH} /usr/ports
 
 rm -rf /usr/src
 ln -s /freebsd/${SRC_PATH} /usr/src
 
 if $do_world ; then
 	if [ "x${OBJ_PATH}" != "x" ] ; then
 		rm -rf /usr/obj
 		mkdir -p /freebsd/${OBJ_PATH}
 		ln -s /freebsd/${OBJ_PATH} /usr/obj
 	else
 		rm -rf /usr/obj
 		mkdir -p /usr/obj
 	fi
 fi
 
 #######################################################################
 
 for i in ${PORTS_WE_WANT}
 do
 	if [ ! -d $i ]  ; then
 		echo "Port $i not found" 1>&2
 		exit 2
 	fi
 done
 
 export PORTS_WE_WANT
 export PORTS_OPTS
 
 #######################################################################
 
 log_it Prepare destination partition
 newfs -t -E -O2 -U /dev/${TARGET_PART} > /dev/null
 mount /dev/${TARGET_PART} ${SBMNT}
 mkdir -p ${SBMNT}/dev
 mount -t devfs devfs ${SBMNT}/dev
 
 if [ "x${REMOTEDISTFILES}" != "x" ] ; then
 	rm -rf /freebsd/${PORTS_PATH}/distfiles
 	ln -s /freebsd/distfiles /freebsd/${PORTS_PATH}/distfiles
 	mkdir -p /freebsd/distfiles
 	mount  ${REMOTEDISTFILES} /freebsd/distfiles
 fi
 
 log_it copy ports config files
 (cd / ; find var/db/ports -print | cpio -dumpv ${SBMNT} > /dev/null 2>&1)
 
 log_it "Start prefetch of ports distfiles"
 ports_prefetch ${SBMNT} &
 
 if $do_world ; then
 	(
 	cd /usr/src
 	log_it "Buildworld"
 	make ${JARG} -s buildworld ${SRCCONF} > ${SBMNT}/_.bw 2>&1
 	)
 fi
 
 if $do_kernel ; then
 	(
 	cd /usr/src
 	log_it "Buildkernel"
 	make ${JARG} -s buildkernel KERNCONF=$KERNCONF > ${SBMNT}/_.bk 2>&1
 	)
 fi
 
 
 log_it Installworld
 (cd /usr/src && make ${JARG} installworld DESTDIR=${SBMNT} ${SRCCONF} ) \
 	> ${SBMNT}/_.iw 2>&1
 
 log_it distribution
 (cd /usr/src/etc && make -m /usr/src/share/mk distribution DESTDIR=${SBMNT} ${SRCCONF} ) \
 	> ${SBMNT}/_.dist 2>&1
 
 log_it Installkernel
 (cd /usr/src && make ${JARG} installkernel DESTDIR=${SBMNT} KERNCONF=$KERNCONF ) \
 	> ${SBMNT}/_.ik 2>&1
 
 if [ "x${OBJ_PATH}" != "x" ] ; then
 	rmdir ${SBMNT}/usr/obj
 	ln -s /freebsd/${OBJ_PATH} ${SBMNT}/usr/obj
 fi
 
 log_it Wait for ports prefetch
 log_it "(Tail ${SBMNT}/_.prefetch for progress)"
 wait
 
 log_it Move filesystems
 
 if [ "x${REMOTEDISTFILES}" != "x" ] ; then
 	umount /freebsd/distfiles
 fi
 umount ${FREEBSD_PART} || true
 mkdir -p ${SBMNT}/freebsd
 mount ${FREEBSD_PART} ${SBMNT}/freebsd
 if [ "x${REMOTEDISTFILES}" != "x" ] ; then
 	mount  ${REMOTEDISTFILES} ${SBMNT}/freebsd/distfiles
 fi
 
 rm -rf ${SBMNT}/usr/ports || true
 ln -s /freebsd/${PORTS_PATH} ${SBMNT}/usr/ports
 
 rm -rf ${SBMNT}/usr/src || true
 ln -s /freebsd/${SRC_PATH} ${SBMNT}/usr/src
 
 log_it Build and install ports
 
 # Make sure fetching will work in the chroot
 if [ -f /etc/resolv.conf ] ; then
 	log_it copy resolv.conf
 	cp /etc/resolv.conf ${SBMNT}/etc
 	chflags schg ${SBMNT}/etc/resolv.conf
 fi
 
 if [ -f /etc/localtime ] ; then
 	log_it copy localtime
 	cp /etc/localtime ${SBMNT}/etc
 fi
 
 log_it ldconfig in chroot
 chroot ${SBMNT} sh /etc/rc.d/ldconfig start
 
 log_it before_ports
 ( 
 	before_ports 
 )
 
 log_it fixing fstab
 sed "/[ 	]\/[ 	]/s;^[^ 	]*[ 	];/dev/${TARGET_PART}	;" \
 	/etc/fstab > ${SBMNT}/etc/fstab
 
 log_it build ports
 
 cp $0 ${SBMNT}/root
 cp /tmp/_sb_log ${SBMNT}/tmp
 b=`basename $0`
 if [ "x$c_arg" != "x" ] ; then
 	cp $c_arg ${SBMNT}/root
 	chroot ${SBMNT} sh /root/$0 -c /root/`basename $c_arg` $use_pkg chroot_script 
 else
 	chroot ${SBMNT} sh /root/$0 $use_pkg chroot_script
 fi
 cp ${SBMNT}/tmp/_sb_log /tmp
 
 log_it create all mountpoints
 grep -v '^[ 	]*#' ${SBMNT}/etc/fstab | 
 while read a b c
 do
 	mkdir -p ${SBMNT}/$b
 done
 
 if [ "x$SERCONS" != "xfalse" ] ; then
 	log_it serial console
 	echo " -h" > ${SBMNT}/boot.config
 	sed -i "" -e /ttyd0/s/off/on/ ${SBMNT}/etc/ttys
 	sed -i "" -e /ttyu0/s/off/on/ ${SBMNT}/etc/ttys
 	sed -i "" -e '/^ttyv[0-8]/s/	on/	off/' ${SBMNT}/etc/ttys
 fi
 
 log_it move dist config files "(expect warnings)"
 (
 	cd ${SBMNT}
 	mkdir root/configfiles_dist
 	find ${CONFIGFILES} -print | cpio -dumpv root/configfiles_dist
 )
 
 log_it copy live config files
 (cd / && find ${CONFIGFILES} -print | cpio -dumpv ${SBMNT})
 
 log_it final_root
 ( final_root )
 log_it final_chroot
 cp /tmp/_sb_log ${SBMNT}/tmp
 if [ "x$c_arg" != "x" ] ; then
 	chroot ${SBMNT} sh /root/$0 -c /root/`basename $c_arg` final_chroot
 else
 	chroot ${SBMNT} sh /root/$0 final_chroot
 fi
 cp ${SBMNT}/tmp/_sb_log /tmp
 log_it "Check these messages (if any):"
 grep '^Stop' ${SBMNT}/_* || true
 log_it DONE
 echo "Now you probably want to:"
 echo "    $GPART_SUGGESTION"
 echo "    shutdown -r now"
Index: projects/arm_intrng/usr.bin/man/man.sh
===================================================================
--- projects/arm_intrng/usr.bin/man/man.sh	(revision 276247)
+++ projects/arm_intrng/usr.bin/man/man.sh	(revision 276248)
@@ -1,994 +1,994 @@
 #! /bin/sh
 #
 #  Copyright (c) 2010 Gordon Tetlow
 #  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 AUTHOR 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 AUTHOR 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.
 #
 # $FreeBSD$
 
 # Usage: add_to_manpath path
 # Adds a variable to manpath while ensuring we don't have duplicates.
 # Returns true if we were able to add something. False otherwise.
 add_to_manpath() {
 	case "$manpath" in
 	*:$1)	decho "  Skipping duplicate manpath entry $1" 2 ;;
 	$1:*)	decho "  Skipping duplicate manpath entry $1" 2 ;;
 	*:$1:*)	decho "  Skipping duplicate manpath entry $1" 2 ;;
 	*)	if [ -d "$1" ]; then
 			decho "  Adding $1 to manpath"
 			manpath="$manpath:$1"
 			return 0
 		fi
 		;;
 	esac
 
 	return 1
 }
 
 # Usage: build_manlocales
 # Builds a correct MANLOCALES variable.
 build_manlocales() {
 	# If the user has set manlocales, who are we to argue.
 	if [ -n "$MANLOCALES" ]; then
 		return
 	fi
 
 	parse_configs
 
 	# Trim leading colon
 	MANLOCALES=${manlocales#:}
 
 	decho "Available manual locales: $MANLOCALES"
 }
 
 # Usage: build_manpath
 # Builds a correct MANPATH variable.
 build_manpath() {
 	local IFS
 
 	# If the user has set a manpath, who are we to argue.
 	if [ -n "$MANPATH" ]; then
 		return
 	fi
 
 	search_path
 
 	decho "Adding default manpath entries"
 	IFS=:
 	for path in $man_default_path; do
 		add_to_manpath "$path"
 	done
 	unset IFS
 
 	parse_configs
 
 	# Trim leading colon
 	MANPATH=${manpath#:}
 
 	decho "Using manual path: $MANPATH"
 }
 
 # Usage: check_cat catglob
 # Checks to see if a cat glob is available.
 check_cat() {
 	if exists "$1"; then
 		use_cat=yes
 		catpage=$found
 		setup_cattool $catpage
 		decho "    Found catpage $catpage"
 		return 0
 	else
 		return 1
 	fi
 }
 
 # Usage: check_man manglob catglob
 # Given 2 globs, figures out if the manglob is available, if so, check to
 # see if the catglob is also available and up to date.
 check_man() {
 	if exists "$1"; then
 		# We have a match, check for a cat page
 		manpage=$found
 		setup_cattool $manpage
 		decho "    Found manpage $manpage"
 
 		if [ -n "${use_width}" ]; then
 			# non-standard width
 			unset use_cat
 			decho "    Skipping catpage: non-standard page width"
 		elif exists "$2" && is_newer $found $manpage; then
 			# cat page found and is newer, use that
 			use_cat=yes
 			catpage=$found
 			setup_cattool $catpage
 			decho "    Using catpage $catpage"
 		else
 			# no cat page or is older
 			unset use_cat
 			decho "    Skipping catpage: not found or old"
 		fi
 		return 0
 	fi
 
 	return 1
 }
 
 # Usage: decho "string" [debuglevel]
 # Echoes to stderr string prefaced with -- if high enough debuglevel.
 decho() {
 	if [ $debug -ge ${2:-1} ]; then
 		echo "-- $1" >&2
 	fi
 }
 
 # Usage: exists glob
 # Returns true if glob resolves to a real file.
 exists() {
 	local IFS
 
 	# Don't accidentally inherit callers IFS (breaks perl manpages)
 	unset IFS
 
 	# Use some globbing tricks in the shell to determine if a file
 	# exists or not.
 	set +f
 	set -- "$1" $1
 	set -f
 
 	if [ "$1" != "$2" -a -r "$2" ]; then
 		found="$2"
 		return 0
 	fi
 
 	return 1
 }
 
 # Usage: find_file path section subdir pagename
 # Returns: true if something is matched and found.
 # Search the given path/section combo for a given page.
 find_file() {
 	local manroot catroot mann man0 catn cat0
 
 	manroot="$1/man$2"
 	catroot="$1/cat$2"
 	if [ -n "$3" ]; then
 		manroot="$manroot/$3"
 		catroot="$catroot/$3"
 	fi
 
 	if [ ! -d "$manroot" ]; then
 		return 1
 	fi
 	decho "  Searching directory $manroot" 2
 
 	mann="$manroot/$4.$2*"
 	man0="$manroot/$4.0*"
 	catn="$catroot/$4.$2*"
 	cat0="$catroot/$4.0*"
 
 	# This is the behavior as seen by the original man utility.
 	# Let's not change that which doesn't seem broken.
 	if check_man "$mann" "$catn"; then
 		return 0
 	elif check_man "$man0" "$cat0"; then
 		return 0
 	elif check_cat "$catn"; then
 		return 0
 	elif check_cat "$cat0"; then
 		return 0
 	fi
 
 	return 1
 }
 
 # Usage: is_newer file1 file2
 # Returns true if file1 is newer than file2 as calculated by mtime.
 is_newer() {
 	if ! [ "$1" -ot "$2" ]; then
 		decho "    mtime: $1 not older than $2" 3
 		return 0
 	else
 		decho "    mtime: $1 older than $2" 3
 		return 1
 	fi
 }
 
 # Usage: manpath_parse_args "$@"
 # Parses commandline options for manpath.
 manpath_parse_args() {
 	local cmd_arg
 
 	while getopts 'Ldq' cmd_arg; do
 		case "${cmd_arg}" in
 		L)	Lflag=Lflag ;;
 		d)	debug=$(( $debug + 1 )) ;;
 		q)	qflag=qflag ;;
 		*)	manpath_usage ;;
 		esac
 	done >&2
 }
 
 # Usage: manpath_usage
 # Display usage for the manpath(1) utility.
 manpath_usage() {
 	echo 'usage: manpath [-Ldq]' >&2
 	exit 1
 }
 
 # Usage: manpath_warnings
 # Display some warnings to stderr.
 manpath_warnings() {
 	if [ -z "$Lflag" -a -n "$MANPATH" ]; then
 		echo "(Warning: MANPATH environment variable set)" >&2
 	fi
 
 	if [ -n "$Lflag" -a -n "$MANLOCALES" ]; then
 		echo "(Warning: MANLOCALES environment variable set)" >&2
 	fi
 }
 
 # Usage: man_check_for_so page path
 # Returns: True if able to resolve the file, false if it ended in tears.
 # Detects the presence of the .so directive and causes the file to be
 # redirected to another source file.
 man_check_for_so() {
 	local IFS line tstr
 
 	unset IFS
 
 	# We need to loop to accommodate multiple .so directives.
 	while true
 	do
 		line=$($cattool $manpage | head -1)
 		case "$line" in
 		.so*)	trim "${line#.so}"
 			decho "$manpage includes $tstr"
 			# Glob and check for the file.
 			if ! check_man "$path/$tstr*" ""; then
 				decho "  Unable to find $tstr"
 				return 1
 			fi
 			;;
 		*)	break ;;
 		esac
 	done
 
 	return 0
 }
 
 # Usage: man_display_page
 # Display either the manpage or catpage depending on the use_cat variable
 man_display_page() {
 	local IFS pipeline testline
 
 	# We are called with IFS set to colon. This causes really weird
 	# things to happen for the variables that have spaces in them.
 	unset IFS
 
 	# If we are supposed to use a catpage and we aren't using troff(1)
 	# just zcat the catpage and we are done.
 	if [ -z "$tflag" -a -n "$use_cat" ]; then
 		if [ -n "$wflag" ]; then
 			echo "$catpage (source: $manpage)"
 			ret=0
 		else
 			if [ $debug -gt 0 ]; then
 				decho "Command: $cattool $catpage | $MANPAGER"
 				ret=0
 			else
 				eval "$cattool $catpage | $MANPAGER"
 				ret=$?
 			fi
 		fi
 		return
 	fi
 
 	# Okay, we are using the manpage, do we just need to output the
 	# name of the manpage?
 	if [ -n "$wflag" ]; then
 		echo "$manpage"
 		ret=0
 		return
 	fi
 
 	testline="mandoc -Tlint -Werror 2>/dev/null"
-	pipeline="mandoc -Tlocale | $MANPAGER"
+	pipeline="mandoc | $MANPAGER"
 
 	if ! eval "$cattool $manpage | $testline" ;then
 		if which -s groff; then
 			man_display_page_groff
 		else
 			echo "This manpage needs groff(1) to be rendered" >&2
 			echo "First install groff(1): " >&2
 			echo "pkg install groff " >&2
 			ret=1
 		fi
 		return
 	fi
 
 	if [ $debug -gt 0 ]; then
 		decho "Command: $cattool $manpage | $pipeline"
 		ret=0
 	else
 		eval "$cattool $manpage | $pipeline"
 		ret=$?
 	fi
 }
 
 # Usage: man_display_page_groff
 # Display the manpage using groff
 man_display_page_groff() {
 	local EQN NROFF PIC TBL TROFF REFER VGRIND
 	local IFS l nroff_dev pipeline preproc_arg tool
 
 	# So, we really do need to parse the manpage. First, figure out the
 	# device flag (-T) we have to pass to eqn(1) and groff(1). Then,
 	# setup the pipeline of commands based on the user's request.
 
 	# If the manpage is from a particular charset, we need to setup nroff
 	# to properly output for the correct device.
 	case "${manpage}" in
 	*.${man_charset}/*)
 		# I don't pretend to know this; I'm just copying from the
 		# previous version of man(1).
 		case "$man_charset" in
 		KOI8-R)		nroff_dev="koi8-r" ;;
 		ISO8859-1)	nroff_dev="latin1" ;;
 		ISO8859-15)	nroff_dev="latin1" ;;
 		UTF-8)		nroff_dev="utf8" ;;
 		*)		nroff_dev="ascii" ;;
 		esac
 
 		NROFF="$NROFF -T$nroff_dev"
 		EQN="$EQN -T$nroff_dev"
 
 		# Iff the manpage is from the locale and not just the charset,
 		# then we need to define the locale string.
 		case "${manpage}" in
 		*/${man_lang}_${man_country}.${man_charset}/*)
 			NROFF="$NROFF -dlocale=$man_lang.$man_charset"
 			;;
 		*/${man_lang}.${man_charset}/*)
 			NROFF="$NROFF -dlocale=$man_lang.$man_charset"
 			;;
 		esac
 
 		# Allow language specific calls to override the default
 		# set of utilities.
 		l=$(echo $man_lang | tr [:lower:] [:upper:])
 		for tool in EQN NROFF PIC TBL TROFF REFER VGRIND; do
 			eval "$tool=\${${tool}_$l:-\$$tool}"
 		done
 		;;
 	*)	NROFF="$NROFF -Tascii"
 		EQN="$EQN -Tascii"
 		;;
 	esac
 
 	if [ -z "$MANCOLOR" ]; then
 		NROFF="$NROFF -P-c"
 	fi
 
 	if [ -n "${use_width}" ]; then
 		NROFF="$NROFF -rLL=${use_width}n -rLT=${use_width}n"
 	fi
 
 	if [ -n "$MANROFFSEQ" ]; then
 		set -- -$MANROFFSEQ
 		while getopts 'egprtv' preproc_arg; do
 			case "${preproc_arg}" in
 			e)	pipeline="$pipeline | $EQN" ;;
 			g)	;; # Ignore for compatibility.
 			p)	pipeline="$pipeline | $PIC" ;;
 			r)	pipeline="$pipeline | $REFER" ;;
 			t)	pipeline="$pipeline | $TBL" ;;
 			v)	pipeline="$pipeline | $VGRIND" ;;
 			*)	usage ;;
 			esac
 		done
 		# Strip the leading " | " from the resulting pipeline.
 		pipeline="${pipeline#" | "}"
 	else
 		pipeline="$TBL"
 	fi
 
 	if [ -n "$tflag" ]; then
 		pipeline="$pipeline | $TROFF"
 	else
 		pipeline="$pipeline | $NROFF | $MANPAGER"
 	fi
 
 	if [ $debug -gt 0 ]; then
 		decho "Command: $cattool $manpage | $pipeline"
 		ret=0
 	else
 		eval "$cattool $manpage | $pipeline"
 		ret=$?
 	fi
 }
 
 # Usage: man_find_and_display page
 # Search through the manpaths looking for the given page.
 man_find_and_display() {
 	local found_page locpath p path sect
 
 	# Check to see if it's a file. But only if it has a '/' in
 	# the filename.
 	case "$1" in
 	*/*)	if [ -f "$1" -a -r "$1" ]; then
 			decho "Found a usable page, displaying that"
 			unset use_cat
 			manpage="$1"
 			setup_cattool $manpage
 			if man_check_for_so $manpage $(dirname $manpage); then
 				found_page=yes
 				man_display_page
 			fi
 			return
 		fi
 		;;
 	esac
 
 	IFS=:
 	for sect in $MANSECT; do
 		decho "Searching section $sect" 2
 		for path in $MANPATH; do
 			for locpath in $locpaths; do
 				p=$path/$locpath
 				p=${p%/.} # Rid ourselves of the trailing /.
 
 				# Check if there is a MACHINE specific manpath.
 				if find_file $p $sect $MACHINE "$1"; then
 					if man_check_for_so $manpage $p; then
 						found_page=yes
 						man_display_page
 						if [ -n "$aflag" ]; then
 							continue 2
 						else
 							return
 						fi
 					fi
 				fi
 
 				# Check if there is a MACHINE_ARCH
 				# specific manpath.
 				if find_file $p $sect $MACHINE_ARCH "$1"; then
 					if man_check_for_so $manpage $p; then
 						found_page=yes
 						man_display_page
 						if [ -n "$aflag" ]; then
 							continue 2
 						else
 							return
 						fi
 					fi
 				fi
 
 				# Check plain old manpath.
 				if find_file $p $sect '' "$1"; then
 					if man_check_for_so $manpage $p; then
 						found_page=yes
 						man_display_page
 						if [ -n "$aflag" ]; then
 							continue 2
 						else
 							return
 						fi
 					fi
 				fi
 			done
 		done
 	done
 	unset IFS
 
 	# Nothing? Well, we are done then.
 	if [ -z "$found_page" ]; then
 		echo "No manual entry for $1" >&2
 		ret=1
 		return
 	fi
 }
 
 # Usage: man_parse_args "$@"
 # Parses commandline options for man.
 man_parse_args() {
 	local IFS cmd_arg
 
 	while getopts 'M:P:S:adfhkm:op:tw' cmd_arg; do
 		case "${cmd_arg}" in
 		M)	MANPATH=$OPTARG ;;
 		P)	MANPAGER=$OPTARG ;;
 		S)	MANSECT=$OPTARG ;;
 		a)	aflag=aflag ;;
 		d)	debug=$(( $debug + 1 )) ;;
 		f)	fflag=fflag ;;
 		h)	man_usage 0 ;;
 		k)	kflag=kflag ;;
 		m)	mflag=$OPTARG ;;
 		o)	oflag=oflag ;;
 		p)	MANROFFSEQ=$OPTARG ;;
 		t)	tflag=tflag ;;
 		w)	wflag=wflag ;;
 		*)	man_usage ;;
 		esac
 	done >&2
 
 	shift $(( $OPTIND - 1 ))
 
 	# Check the args for incompatible options.
 	case "${fflag}${kflag}${tflag}${wflag}" in
 	fflagkflag*)	echo "Incompatible options: -f and -k"; man_usage ;;
 	fflag*tflag*)	echo "Incompatible options: -f and -t"; man_usage ;;
 	fflag*wflag)	echo "Incompatible options: -f and -w"; man_usage ;;
 	*kflagtflag*)	echo "Incompatible options: -k and -t"; man_usage ;;
 	*kflag*wflag)	echo "Incompatible options: -k and -w"; man_usage ;;
 	*tflagwflag)	echo "Incompatible options: -t and -w"; man_usage ;;
 	esac
 
 	# Short circuit for whatis(1) and apropos(1)
 	if [ -n "$fflag" ]; then
 		do_whatis "$@"
 		exit
 	fi
 
 	if [ -n "$kflag" ]; then
 		do_apropos "$@"
 		exit
 	fi
 
 	IFS=:
 	for sect in $man_default_sections; do
 		if [ "$sect" = "$1" ]; then
 			decho "Detected manual section as first arg: $1"
 			MANSECT="$1"
 			shift
 			break
 		fi
 	done
 	unset IFS
 
 	pages="$*"
 }
 
 # Usage: man_setup
 # Setup various trivial but essential variables.
 man_setup() {
 	# Setup machine and architecture variables.
 	if [ -n "$mflag" ]; then
 		MACHINE_ARCH=${mflag%%:*}
 		MACHINE=${mflag##*:}
 	fi
 	if [ -z "$MACHINE_ARCH" ]; then
 		MACHINE_ARCH=$($SYSCTL -n hw.machine_arch)
 	fi
 	if [ -z "$MACHINE" ]; then
 		MACHINE=$($SYSCTL -n hw.machine)
 	fi
 	decho "Using architecture: $MACHINE_ARCH:$MACHINE"
 
 	setup_pager
 
 	# Setup manual sections to search.
 	if [ -z "$MANSECT" ]; then
 		MANSECT=$man_default_sections
 	fi
 	decho "Using manual sections: $MANSECT"
 
 	build_manpath
 	man_setup_locale
 	man_setup_width
 }
 
 # Usage: man_setup_width
 # Set up page width.
 man_setup_width() {
 	local sizes
 
 	unset use_width
 	case "$MANWIDTH" in
 	[0-9]*)
 		if [ "$MANWIDTH" -gt 0 2>/dev/null ]; then
 			use_width=$MANWIDTH
 		fi
 		;;
 	[Tt][Tt][Yy])
 		if { sizes=$($STTY size 0>&3 2>/dev/null); } 3>&1; then
 			set -- $sizes
 			if [ $2 -gt 80 ]; then
 				use_width=$(($2-2))
 			fi
 		fi
 		;;
 	esac
 	if [ -n "$use_width" ]; then
 		decho "Using non-standard page width: ${use_width}"
 	else
 		decho 'Using standard page width'
 	fi
 }
 
 # Usage: man_setup_locale
 # Setup necessary locale variables.
 man_setup_locale() {
 	local lang_cc
 
 	locpaths='.'
 	man_charset='US-ASCII'
 
 	# Setup locale information.
 	if [ -n "$oflag" ]; then
 		decho 'Using non-localized manpages'
 	else
 		# Use the locale tool to give us the proper LC_CTYPE
 		eval $( $LOCALE )
 
 		case "$LC_CTYPE" in
 		C)		;;
 		POSIX)		;;
 		[a-z][a-z]_[A-Z][A-Z]\.*)
 				lang_cc="${LC_CTYPE%.*}"
 				man_lang="${LC_CTYPE%_*}"
 				man_country="${lang_cc#*_}"
 				man_charset="${LC_CTYPE#*.}"
 				locpaths="$LC_CTYPE"
 				locpaths="$locpaths:$man_lang.$man_charset"
 				if [ "$man_lang" != "en" ]; then
 					locpaths="$locpaths:en.$man_charset"
 				fi
 				locpaths="$locpaths:."
 				;;
 		*)		echo 'Unknown locale, assuming C' >&2
 				;;
 		esac
 	fi
 
 	decho "Using locale paths: $locpaths"
 }
 
 # Usage: man_usage [exitcode]
 # Display usage for the man utility.
 man_usage() {
 	echo 'Usage:'
 	echo ' man [-adho] [-t | -w] [-M manpath] [-P pager] [-S mansect]'
 	echo '     [-m arch[:machine]] [-p [eprtv]] [mansect] page [...]'
 	echo ' man -f page [...] -- Emulates whatis(1)'
 	echo ' man -k page [...] -- Emulates apropos(1)'
 
 	# When exit'ing with -h, it's not an error.
 	exit ${1:-1}
 }
 
 # Usage: parse_configs
 # Reads the end-user adjustable config files.
 parse_configs() {
 	local IFS file files
 
 	if [ -n "$parsed_configs" ]; then
 		return
 	fi
 
 	unset IFS
 
 	# Read the global config first in case the user wants
 	# to override config_local.
 	if [ -r "$config_global" ]; then
 		parse_file "$config_global"
 	fi
 
 	# Glob the list of files to parse.
 	set +f
 	files=$(echo $config_local)
 	set -f
 
 	for file in $files; do
 		if [ -r "$file" ]; then
 			parse_file "$file"
 		fi
 	done
 
 	parsed_configs='yes'
 }
 
 # Usage: parse_file file
 # Reads the specified config files.
 parse_file() {
 	local file line tstr var
 
 	file="$1"
 	decho "Parsing config file: $file"
 	while read line; do
 		decho "  $line" 2
 		case "$line" in
 		\#*)		decho "    Comment" 3
 				;;
 		MANPATH*)	decho "    MANPATH" 3
 				trim "${line#MANPATH}"
 				add_to_manpath "$tstr"
 				;;
 		MANLOCALE*)	decho "    MANLOCALE" 3
 				trim "${line#MANLOCALE}"
 				manlocales="$manlocales:$tstr"
 				;;
 		MANCONFIG*)	decho "    MANCONFIG" 3
 				trim "${line#MANCONFIG}"
 				config_local="$tstr"
 				;;
 		# Set variables in the form of FOO_BAR
 		*_*[\ \	]*)	var="${line%%[\ \	]*}"
 				trim "${line#$var}"
 				eval "$var=\"$tstr\""
 				decho "    Parsed $var" 3
 				;;
 		esac
 	done < "$file"
 }
 
 # Usage: search_path
 # Traverse $PATH looking for manpaths.
 search_path() {
 	local IFS p path
 
 	decho "Searching PATH for man directories"
 
 	IFS=:
 	for path in $PATH; do
 		# Do a little special casing since the base manpages
 		# are in /usr/share/man instead of /usr/man or /man.
 		case "$path" in
 		/bin|/usr/bin)	add_to_manpath "/usr/share/man" ;;
 		*)	if add_to_manpath "$path/man"; then
 				:
 			elif add_to_manpath "$path/MAN"; then
 				:
 			else
 				case "$path" in
 				*/bin)	p="${path%/bin}/man"
 					add_to_manpath "$p"
 					;;
 				*)	;;
 				esac
 			fi
 			;;
 		esac
 	done
 	unset IFS
 
 	if [ -z "$manpath" ]; then
 		decho '  Unable to find any manpaths, using default'
 		manpath=$man_default_path
 	fi
 }
 
 # Usage: search_whatis cmd [arglist]
 # Do the heavy lifting for apropos/whatis
 search_whatis() {
 	local IFS bad cmd f good key keywords loc opt out path rval wlist
 
 	cmd="$1"
 	shift
 
 	whatis_parse_args "$@"
 
 	build_manpath
 	build_manlocales
 	setup_pager
 
 	if [ "$cmd" = "whatis" ]; then
 		opt="-w"
 	fi
 
 	f='whatis'
 
 	IFS=:
 	for path in $MANPATH; do
 		if [ \! -d "$path" ]; then
 			decho "Skipping non-existent path: $path" 2
 			continue
 		fi
 
 		if [ -f "$path/$f" -a -r "$path/$f" ]; then
 			decho "Found whatis: $path/$f"
 			wlist="$wlist $path/$f"
 		fi
 
 		for loc in $MANLOCALES; do
 			if [ -f "$path/$loc/$f" -a -r "$path/$loc/$f" ]; then
 				decho "Found whatis: $path/$loc/$f"
 				wlist="$wlist $path/$loc/$f"
 			fi
 		done
 	done
 	unset IFS
 
 	if [ -z "$wlist" ]; then
 		echo "$cmd: no whatis databases in $MANPATH" >&2
 		exit 1
 	fi
 
 	rval=0
 	for key in $keywords; do
 		out=$(grep -Ehi $opt -- "$key" $wlist)
 		if [ -n "$out" ]; then
 			good="$good\\n$out"
 		else
 			bad="$bad\\n$key: nothing appropriate"
 			rval=1
 		fi
 	done
 
 	# Strip leading carriage return.
 	good=${good#\\n}
 	bad=${bad#\\n}
 
 	if [ -n "$good" ]; then
 		echo -e "$good" | $MANPAGER
 	fi
 
 	if [ -n "$bad" ]; then
 		echo -e "$bad" >&2
 	fi
 
 	exit $rval
 }
 
 # Usage: setup_cattool page
 # Finds an appropriate decompressor based on extension
 setup_cattool() {
 	case "$1" in
 	*.bz)	cattool='/usr/bin/bzcat' ;;
 	*.bz2)	cattool='/usr/bin/bzcat' ;;
 	*.gz)	cattool='/usr/bin/zcat' ;;
 	*.lzma)	cattool='/usr/bin/lzcat' ;;
 	*.xz)	cattool='/usr/bin/xzcat' ;;
 	*)	cattool='/usr/bin/zcat -f' ;;
 	esac
 }
 
 # Usage: setup_pager
 # Correctly sets $MANPAGER
 setup_pager() {
 	# Setup pager.
 	if [ -z "$MANPAGER" ]; then
 		if [ -n "$MANCOLOR" ]; then
 			MANPAGER="less -sR"
 		else
 			if [ -n "$PAGER" ]; then
 				MANPAGER="$PAGER"
 			else
 				MANPAGER="more -s"
 			fi
 		fi
 	fi
 	decho "Using pager: $MANPAGER"
 }
 
 # Usage: trim string
 # Trims whitespace from beginning and end of a variable
 trim() {
 	tstr=$1
 	while true; do
 		case "$tstr" in
 		[\ \	]*)	tstr="${tstr##[\ \	]}" ;;
 		*[\ \	])	tstr="${tstr%%[\ \	]}" ;;
 		*)		break ;;
 		esac
 	done
 }
 
 # Usage: whatis_parse_args "$@"
 # Parse commandline args for whatis and apropos.
 whatis_parse_args() {
 	local cmd_arg
 	while getopts 'd' cmd_arg; do
 		case "${cmd_arg}" in
 		d)	debug=$(( $debug + 1 )) ;;
 		*)	whatis_usage ;;
 		esac
 	done >&2
 
 	shift $(( $OPTIND - 1 ))
 
 	keywords="$*"
 }
 
 # Usage: whatis_usage
 # Display usage for the whatis/apropos utility.
 whatis_usage() {
 	echo "usage: $cmd [-d] keyword [...]"
 	exit 1
 }
 
 
 
 # Supported commands
 do_apropos() {
 	search_whatis apropos "$@"
 }
 
 do_man() {
 	man_parse_args "$@"
 	if [ -z "$pages" ]; then
 		echo 'What manual page do you want?' >&2
 		exit 1
 	fi
 	man_setup
 
 	for page in $pages; do
 		decho "Searching for $page"
 		man_find_and_display "$page"
 	done
 
 	exit ${ret:-0}
 }
 
 do_manpath() {
 	manpath_parse_args "$@"
 	if [ -z "$qflag" ]; then
 		manpath_warnings
 	fi
 	if [ -n "$Lflag" ]; then
 		build_manlocales
 		echo $MANLOCALES
 	else
 		build_manpath
 		echo $MANPATH
 	fi
 	exit 0
 }
 
 do_whatis() {
 	search_whatis whatis "$@"
 }
 
 # User's PATH setting decides on the groff-suite to pick up.
 EQN=eqn
 NROFF='groff -S -P-h -Wall -mtty-char -man'
 PIC=pic
 REFER=refer
 TBL=tbl
 TROFF='groff -S -man'
 VGRIND=vgrind
 
 LOCALE=/usr/bin/locale
 STTY=/bin/stty
 SYSCTL=/sbin/sysctl
 
 debug=0
 man_default_sections='1:8:2:3:n:4:5:6:7:9:l'
 man_default_path='/usr/share/man:/usr/share/openssl/man:/usr/local/man'
 cattool='/usr/bin/zcat -f'
 
 config_global='/etc/man.conf'
 
 # This can be overridden via a setting in /etc/man.conf.
 config_local='/usr/local/etc/man.d/*.conf'
 
 # Set noglobbing for now. I don't want spurious globbing.
 set -f
 
 case "$0" in
 *apropos)	do_apropos "$@" ;;
 *manpath)	do_manpath "$@" ;;
 *whatis)	do_whatis "$@" ;;
 *)		do_man "$@" ;;
 esac
Index: projects/arm_intrng/usr.bin/mandoc/Makefile
===================================================================
--- projects/arm_intrng/usr.bin/mandoc/Makefile	(revision 276247)
+++ projects/arm_intrng/usr.bin/mandoc/Makefile	(revision 276248)
@@ -1,48 +1,49 @@
 # $FreeBSD$
 
 MDOCMLDIR=	${.CURDIR}/../../contrib/mdocml
 .PATH: ${MDOCMLDIR}
 
 PROG=	mandoc
 FILES=	example.style.css style.css
 FILESDIR=	${SHAREDIR}/mdocml
 LINKS=	mdocml
 MAN=	mandoc.1 eqn.7 mandoc_char.7 tbl.7 man.7 mdoc.7 # roff.7
 MLINKS= mandoc.1 mdocml.1
 
 HTML_SRCS=	eqn_html.c \
 		html.c \
 		man_html.c \
 		mdoc_html.c \
 		tbl_html.c
 
 MAN_SRCS=	mdoc_man.c
 
 TERM_SRCS=	eqn_term.c \
 		man_term.c \
 		mdoc_term.c \
 		term.c \
 		term_ascii.c \
 		term_ps.c \
 		tbl_term.c
 
+DB_SRCS=	mandocdb.c \
+		mansearch.c \
+		mansearch_const.c \
+		manpath.c
+
 SRCS=		${HTML_SRCS} \
 		${MAN_SRCS} \
 		${TERM_SRCS} \
 		main.c \
 		out.c \
 		tree.c
 
-APROPOS_SRCS=	mansearch.c \
-		mansearch_const.c \
-		manpath.c
+SRCS+=	${DB_SRCS}
 
-SRCS+=	${APROPOS_SRCS}
-
-WARNS?=	3
+WARNS?=	2
 CFLAGS+= -DHAVE_CONFIG_H \
 	 -I${.CURDIR}/../../lib/libohash/ \
 	 -I${.CURDIR}/../../contrib/sqlite3
 LIBADD=	mandoc ohash sqlite3
 
 .include 
Index: projects/arm_intrng/usr.bin/patch/patch.c
===================================================================
--- projects/arm_intrng/usr.bin/patch/patch.c	(revision 276247)
+++ projects/arm_intrng/usr.bin/patch/patch.c	(revision 276248)
@@ -1,1079 +1,1079 @@
 /*-
  * Copyright 1986, Larry Wall
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following condition is met:
  * 1. Redistributions of source code must retain the above copyright notice,
  * this condition and the following disclaimer.
  * 
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
  * 
  * patch - a program to apply diffs to original files
  *
  * -C option added in 1998, original code by Marc Espie, based on FreeBSD
  * behaviour
  *
- * $OpenBSD: patch.c,v 1.52 2014/11/26 18:34:51 millert Exp $
+ * $OpenBSD: patch.c,v 1.54 2014/12/13 10:31:07 tobias Exp $
  * $FreeBSD$
  *
  */
 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "common.h"
 #include "util.h"
 #include "pch.h"
 #include "inp.h"
 #include "backupfile.h"
 #include "pathnames.h"
 
 mode_t		filemode = 0644;
 
 char		*buf;			/* general purpose buffer */
 size_t		buf_size;		/* size of the general purpose buffer */
 
 bool		using_plan_a = true;	/* try to keep everything in memory */
 bool		out_of_mem = false;	/* ran out of memory in plan a */
 
 #define MAXFILEC 2
 
 char		*filearg[MAXFILEC];
 bool		ok_to_create_file = false;
 char		*outname = NULL;
 char		*origprae = NULL;
 char		*TMPOUTNAME;
 char		*TMPINNAME;
 char		*TMPREJNAME;
 char		*TMPPATNAME;
 bool		toutkeep = false;
 bool		trejkeep = false;
 bool		warn_on_invalid_line;
 bool		last_line_missing_eol;
 
 #ifdef DEBUGGING
 int		debug = 0;
 #endif
 
 bool		force = false;
 bool		batch = false;
 bool		verbose = true;
 bool		reverse = false;
 bool		noreverse = false;
 bool		skip_rest_of_patch = false;
 int		strippath = 957;
 bool		canonicalize = false;
 bool		check_only = false;
 int		diff_type = 0;
 char		*revision = NULL;	/* prerequisite revision, if any */
 LINENUM		input_lines = 0;	/* how long is input file in lines */
 int		posix = 0;		/* strict POSIX mode? */
 
 static void	reinitialize_almost_everything(void);
 static void	get_some_switches(void);
 static LINENUM	locate_hunk(LINENUM);
 static void	abort_context_hunk(void);
 static void	rej_line(int, LINENUM);
 static void	abort_hunk(void);
 static void	apply_hunk(LINENUM);
 static void	init_output(const char *);
 static void	init_reject(const char *);
 static void	copy_till(LINENUM, bool);
 static bool	spew_output(void);
 static void	dump_line(LINENUM, bool);
 static bool	patch_match(LINENUM, LINENUM, LINENUM);
 static bool	similar(const char *, const char *, int);
 static void	usage(void);
 
 /* true if -E was specified on command line.  */
 static bool	remove_empty_files = false;
 
 /* true if -R was specified on command line.  */
 static bool	reverse_flag_specified = false;
 
 /* buffer holding the name of the rejected patch file. */
 static char	rejname[NAME_MAX + 1];
 
 /* how many input lines have been irretractibly output */
 static LINENUM	last_frozen_line = 0;
 
 static int	Argc;		/* guess */
 static char	**Argv;
 static int	Argc_last;	/* for restarting plan_b */
 static char	**Argv_last;
 
 static FILE	*ofp = NULL;	/* output file pointer */
 static FILE	*rejfp = NULL;	/* reject file pointer */
 
 static int	filec = 0;	/* how many file arguments? */
 static LINENUM	last_offset = 0;
 static LINENUM	maxfuzz = 2;
 
 /* patch using ifdef, ifndef, etc. */
 static bool		do_defines = false;
 /* #ifdef xyzzy */
 static char		if_defined[128];
 /* #ifndef xyzzy */
 static char		not_defined[128];
 /* #else */
 static const char	else_defined[] = "#else\n";
 /* #endif xyzzy */
 static char		end_defined[128];
 
 
 /* Apply a set of diffs as appropriate. */
 
 int
 main(int argc, char *argv[])
 {
 	int	error = 0, hunk, failed, i, fd;
 	bool	patch_seen, reverse_seen;
 	LINENUM	where = 0, newwhere, fuzz, mymaxfuzz;
 	const	char *tmpdir;
 	char	*v;
 
 	setvbuf(stdout, NULL, _IOLBF, 0);
 	setvbuf(stderr, NULL, _IOLBF, 0);
 	for (i = 0; i < MAXFILEC; i++)
 		filearg[i] = NULL;
 
 	buf_size = INITLINELEN;
 	buf = malloc((unsigned)(buf_size));
 	if (buf == NULL)
 		fatal("out of memory\n");
 
 	/* Cons up the names of the temporary files.  */
 	if ((tmpdir = getenv("TMPDIR")) == NULL || *tmpdir == '\0')
 		tmpdir = _PATH_TMP;
 	for (i = strlen(tmpdir) - 1; i > 0 && tmpdir[i] == '/'; i--)
 		;
 	i++;
 	if (asprintf(&TMPOUTNAME, "%.*s/patchoXXXXXXXXXX", i, tmpdir) == -1)
 		fatal("cannot allocate memory");
 	if ((fd = mkstemp(TMPOUTNAME)) < 0)
 		pfatal("can't create %s", TMPOUTNAME);
 	close(fd);
 
 	if (asprintf(&TMPINNAME, "%.*s/patchiXXXXXXXXXX", i, tmpdir) == -1)
 		fatal("cannot allocate memory");
 	if ((fd = mkstemp(TMPINNAME)) < 0)
 		pfatal("can't create %s", TMPINNAME);
 	close(fd);
 
 	if (asprintf(&TMPREJNAME, "%.*s/patchrXXXXXXXXXX", i, tmpdir) == -1)
 		fatal("cannot allocate memory");
 	if ((fd = mkstemp(TMPREJNAME)) < 0)
 		pfatal("can't create %s", TMPREJNAME);
 	close(fd);
 
 	if (asprintf(&TMPPATNAME, "%.*s/patchpXXXXXXXXXX", i, tmpdir) == -1)
 		fatal("cannot allocate memory");
 	if ((fd = mkstemp(TMPPATNAME)) < 0)
 		pfatal("can't create %s", TMPPATNAME);
 	close(fd);
 
 	v = getenv("SIMPLE_BACKUP_SUFFIX");
 	if (v)
 		simple_backup_suffix = v;
 	else
 		simple_backup_suffix = ORIGEXT;
 
 	/* parse switches */
 	Argc = argc;
 	Argv = argv;
 	get_some_switches();
 
 	if (backup_type == none) {
 		if ((v = getenv("PATCH_VERSION_CONTROL")) == NULL)
 			v = getenv("VERSION_CONTROL");
 		if (v != NULL || !posix)
 			backup_type = get_version(v);	/* OK to pass NULL. */
 	}
 
 	/* make sure we clean up /tmp in case of disaster */
 	set_signals(0);
 
 	patch_seen = false;
 	for (open_patch_file(filearg[1]); there_is_another_patch();
 	    reinitialize_almost_everything()) {
 		/* for each patch in patch file */
-		
+
 		patch_seen = true;
 
 		warn_on_invalid_line = true;
 
 		if (outname == NULL)
-			outname = savestr(filearg[0]);
+			outname = xstrdup(filearg[0]);
 
 		/* for ed script just up and do it and exit */
 		if (diff_type == ED_DIFF) {
 			do_ed_script();
 			continue;
 		}
 		/* initialize the patched file */
 		if (!skip_rest_of_patch)
 			init_output(TMPOUTNAME);
 
 		/* initialize reject file */
 		init_reject(TMPREJNAME);
 
 		/* find out where all the lines are */
 		if (!skip_rest_of_patch)
 			scan_input(filearg[0]);
 
 		/*
 		 * from here on, open no standard i/o files, because
 		 * malloc might misfire and we can't catch it easily
 		 */
 
 		/* apply each hunk of patch */
 		hunk = 0;
 		failed = 0;
 		reverse_seen = false;
 		out_of_mem = false;
 		while (another_hunk()) {
 			hunk++;
 			fuzz = 0;
 			mymaxfuzz = pch_context();
 			if (maxfuzz < mymaxfuzz)
 				mymaxfuzz = maxfuzz;
 			if (!skip_rest_of_patch) {
 				do {
 					where = locate_hunk(fuzz);
 					if (hunk == 1 && where == 0 && !force && !reverse_seen) {
 						/* dwim for reversed patch? */
 						if (!pch_swap()) {
 							if (fuzz == 0)
 								say("Not enough memory to try swapped hunk!  Assuming unswapped.\n");
 							continue;
 						}
 						reverse = !reverse;
 						/* try again */
 						where = locate_hunk(fuzz);
 						if (where == 0) {
 							/* didn't find it swapped */
 							if (!pch_swap())
 								/* put it back to normal */
 								fatal("lost hunk on alloc error!\n");
 							reverse = !reverse;
 						} else if (noreverse) {
 							if (!pch_swap())
 								/* put it back to normal */
 								fatal("lost hunk on alloc error!\n");
 							reverse = !reverse;
 							say("Ignoring previously applied (or reversed) patch.\n");
 							skip_rest_of_patch = true;
 						} else if (batch) {
 							if (verbose)
 								say("%seversed (or previously applied) patch detected!  %s -R.",
 								    reverse ? "R" : "Unr",
 								    reverse ? "Assuming" : "Ignoring");
 						} else {
 							ask("%seversed (or previously applied) patch detected!  %s -R? [y] ",
 							    reverse ? "R" : "Unr",
 							    reverse ? "Assume" : "Ignore");
 							if (*buf == 'n') {
 								ask("Apply anyway? [n] ");
 								if (*buf != 'y')
 									skip_rest_of_patch = true;
 								else
 									reverse_seen = true;
 								where = 0;
 								reverse = !reverse;
 								if (!pch_swap())
 									/* put it back to normal */
 									fatal("lost hunk on alloc error!\n");
 							}
 						}
 					}
 				} while (!skip_rest_of_patch && where == 0 &&
 				    ++fuzz <= mymaxfuzz);
 
 				if (skip_rest_of_patch) {	/* just got decided */
 					if (ferror(ofp) || fclose(ofp)) {
 						say("Error writing %s\n",
 						    TMPOUTNAME);
 						error = 1;
 					}
 					ofp = NULL;
 				}
 			}
 			newwhere = pch_newfirst() + last_offset;
 			if (skip_rest_of_patch) {
 				abort_hunk();
 				failed++;
 				if (verbose)
 					say("Hunk #%d ignored at %ld.\n",
 					    hunk, newwhere);
 			} else if (where == 0) {
 				abort_hunk();
 				failed++;
 				if (verbose)
 					say("Hunk #%d failed at %ld.\n",
 					    hunk, newwhere);
 			} else {
 				apply_hunk(where);
 				if (verbose) {
 					say("Hunk #%d succeeded at %ld",
 					    hunk, newwhere);
 					if (fuzz != 0)
 						say(" with fuzz %ld", fuzz);
 					if (last_offset)
 						say(" (offset %ld line%s)",
 						    last_offset,
 						    last_offset == 1L ? "" : "s");
 					say(".\n");
 				}
 			}
 		}
 
 		if (out_of_mem && using_plan_a) {
 			Argc = Argc_last;
 			Argv = Argv_last;
 			say("\n\nRan out of memory using Plan A--trying again...\n\n");
 			if (ofp)
 				fclose(ofp);
 			ofp = NULL;
 			if (rejfp)
 				fclose(rejfp);
 			rejfp = NULL;
 			continue;
 		}
 		if (hunk == 0)
 			fatal("Internal error: hunk should not be 0\n");
 
 		/* finish spewing out the new file */
 		if (!skip_rest_of_patch && !spew_output()) {
 			say("Can't write %s\n", TMPOUTNAME);
 			error = 1;
 		}
 
 		/* and put the output where desired */
 		ignore_signals();
 		if (!skip_rest_of_patch) {
 			struct stat	statbuf;
 			char	*realout = outname;
 
 			if (!check_only) {
 				if (move_file(TMPOUTNAME, outname) < 0) {
 					toutkeep = true;
 					realout = TMPOUTNAME;
 					chmod(TMPOUTNAME, filemode);
 				} else
 					chmod(outname, filemode);
 
 				if (remove_empty_files &&
 				    stat(realout, &statbuf) == 0 &&
 				    statbuf.st_size == 0) {
 					if (verbose)
 						say("Removing %s (empty after patching).\n",
 						    realout);
 					unlink(realout);
 				}
 			}
 		}
 		if (ferror(rejfp) || fclose(rejfp)) {
 			say("Error writing %s\n", rejname);
 			error = 1;
 		}
 		rejfp = NULL;
 		if (failed) {
 			error = 1;
 			if (*rejname == '\0') {
 				if (strlcpy(rejname, outname,
 				    sizeof(rejname)) >= sizeof(rejname))
 					fatal("filename %s is too long\n", outname);
 				if (strlcat(rejname, REJEXT,
 				    sizeof(rejname)) >= sizeof(rejname))
 					fatal("filename %s is too long\n", outname);
 			}
 			if (!check_only)
 				say("%d out of %d hunks %s--saving rejects to %s\n",
 				    failed, hunk, skip_rest_of_patch ? "ignored" : "failed", rejname);
 			else
 				say("%d out of %d hunks %s while patching %s\n",
 				    failed, hunk, skip_rest_of_patch ? "ignored" : "failed", filearg[0]);
 			if (!check_only && move_file(TMPREJNAME, rejname) < 0)
 				trejkeep = true;
 		}
 		set_signals(1);
 	}
-	
+
 	if (!patch_seen)
 		error = 2;
 
 	my_exit(error);
 	/* NOTREACHED */
 }
 
 /* Prepare to find the next patch to do in the patch file. */
 
 static void
 reinitialize_almost_everything(void)
 {
 	re_patch();
 	re_input();
 
 	input_lines = 0;
 	last_frozen_line = 0;
 
 	filec = 0;
 	if (!out_of_mem) {
 		free(filearg[0]);
 		filearg[0] = NULL;
 	}
 
 	free(outname);
 	outname = NULL;
 
 	last_offset = 0;
 	diff_type = 0;
 
 	free(revision);
 	revision = NULL;
 
 	reverse = reverse_flag_specified;
 	skip_rest_of_patch = false;
 
 	get_some_switches();
 }
 
 /* Process switches and filenames. */
 
 static void
 get_some_switches(void)
 {
 	const char *options = "b::B:cCd:D:eEfF:i:lnNo:p:r:RstuvV:x:z:";
 	static struct option longopts[] = {
 		{"backup",		no_argument,		0,	'b'},
 		{"batch",		no_argument,		0,	't'},
 		{"check",		no_argument,		0,	'C'},
 		{"context",		no_argument,		0,	'c'},
 		{"debug",		required_argument,	0,	'x'},
 		{"directory",		required_argument,	0,	'd'},
 		{"dry-run",		no_argument,		0,	'C'},
 		{"ed",			no_argument,		0,	'e'},
 		{"force",		no_argument,		0,	'f'},
 		{"forward",		no_argument,		0,	'N'},
 		{"fuzz",		required_argument,	0,	'F'},
 		{"ifdef",		required_argument,	0,	'D'},
 		{"input",		required_argument,	0,	'i'},
 		{"ignore-whitespace",	no_argument,		0,	'l'},
 		{"normal",		no_argument,		0,	'n'},
 		{"output",		required_argument,	0,	'o'},
 		{"prefix",		required_argument,	0,	'B'},
 		{"quiet",		no_argument,		0,	's'},
 		{"reject-file",		required_argument,	0,	'r'},
 		{"remove-empty-files",	no_argument,		0,	'E'},
 		{"reverse",		no_argument,		0,	'R'},
 		{"silent",		no_argument,		0,	's'},
 		{"strip",		required_argument,	0,	'p'},
 		{"suffix",		required_argument,	0,	'z'},
 		{"unified",		no_argument,		0,	'u'},
 		{"version",		no_argument,		0,	'v'},
 		{"version-control",	required_argument,	0,	'V'},
 		{"posix",		no_argument,		&posix,	1},
 		{NULL,			0,			0,	0}
 	};
 	int ch;
 
 	rejname[0] = '\0';
 	Argc_last = Argc;
 	Argv_last = Argv;
 	if (!Argc)
 		return;
 	optreset = optind = 1;
 	while ((ch = getopt_long(Argc, Argv, options, longopts, NULL)) != -1) {
 		switch (ch) {
 		case 'b':
 			if (backup_type == none)
 				backup_type = numbered_existing;
 			if (optarg == NULL)
 				break;
 			if (verbose)
 				say("Warning, the ``-b suffix'' option has been"
 				    " obsoleted by the -z option.\n");
 			/* FALLTHROUGH */
 		case 'z':
 			/* must directly follow 'b' case for backwards compat */
-			simple_backup_suffix = savestr(optarg);
+			simple_backup_suffix = xstrdup(optarg);
 			break;
 		case 'B':
-			origprae = savestr(optarg);
+			origprae = xstrdup(optarg);
 			break;
 		case 'c':
 			diff_type = CONTEXT_DIFF;
 			break;
 		case 'C':
 			check_only = true;
 			break;
 		case 'd':
 			if (chdir(optarg) < 0)
 				pfatal("can't cd to %s", optarg);
 			break;
 		case 'D':
 			do_defines = true;
 			if (!isalpha((unsigned char)*optarg) && *optarg != '_')
 				fatal("argument to -D is not an identifier\n");
 			snprintf(if_defined, sizeof if_defined,
 			    "#ifdef %s\n", optarg);
 			snprintf(not_defined, sizeof not_defined,
 			    "#ifndef %s\n", optarg);
 			snprintf(end_defined, sizeof end_defined,
 			    "#endif /* %s */\n", optarg);
 			break;
 		case 'e':
 			diff_type = ED_DIFF;
 			break;
 		case 'E':
 			remove_empty_files = true;
 			break;
 		case 'f':
 			force = true;
 			break;
 		case 'F':
 			maxfuzz = atoi(optarg);
 			break;
 		case 'i':
 			if (++filec == MAXFILEC)
 				fatal("too many file arguments\n");
-			filearg[filec] = savestr(optarg);
+			filearg[filec] = xstrdup(optarg);
 			break;
 		case 'l':
 			canonicalize = true;
 			break;
 		case 'n':
 			diff_type = NORMAL_DIFF;
 			break;
 		case 'N':
 			noreverse = true;
 			break;
 		case 'o':
-			outname = savestr(optarg);
+			outname = xstrdup(optarg);
 			break;
 		case 'p':
 			strippath = atoi(optarg);
 			break;
 		case 'r':
 			if (strlcpy(rejname, optarg,
 			    sizeof(rejname)) >= sizeof(rejname))
 				fatal("argument for -r is too long\n");
 			break;
 		case 'R':
 			reverse = true;
 			reverse_flag_specified = true;
 			break;
 		case 's':
 			verbose = false;
 			break;
 		case 't':
 			batch = true;
 			break;
 		case 'u':
 			diff_type = UNI_DIFF;
 			break;
 		case 'v':
 			version();
 			break;
 		case 'V':
 			backup_type = get_version(optarg);
 			break;
 #ifdef DEBUGGING
 		case 'x':
 			debug = atoi(optarg);
 			break;
 #endif
 		default:
 			if (ch != '\0')
 				usage();
 			break;
 		}
 	}
 	Argc -= optind;
 	Argv += optind;
 
 	if (Argc > 0) {
-		filearg[0] = savestr(*Argv++);
+		filearg[0] = xstrdup(*Argv++);
 		Argc--;
 		while (Argc > 0) {
 			if (++filec == MAXFILEC)
 				fatal("too many file arguments\n");
-			filearg[filec] = savestr(*Argv++);
+			filearg[filec] = xstrdup(*Argv++);
 			Argc--;
 		}
 	}
 
 	if (getenv("POSIXLY_CORRECT") != NULL)
 		posix = 1;
 }
 
 static void
 usage(void)
 {
 	fprintf(stderr,
 "usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory]\n"
 "             [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count]\n"
 "             [-r rej-name] [-V t | nil | never] [-x number] [-z backup-ext]\n"
 "             [--posix] [origfile [patchfile]]\n"
 "       patch = first_guess)	/* do not try lines < 0 */
 		max_neg_offset = first_guess - 1;
 	if (first_guess <= input_lines && patch_match(first_guess, 0, fuzz))
 		return first_guess;
 	for (offset = 1; ; offset++) {
 		bool	check_after = (offset <= max_pos_offset);
 		bool	check_before = (offset <= max_neg_offset);
 
 		if (check_after && patch_match(first_guess, offset, fuzz)) {
 #ifdef DEBUGGING
 			if (debug & 1)
 				say("Offset changing from %ld to %ld\n",
 				    last_offset, offset);
 #endif
 			last_offset = offset;
 			return first_guess + offset;
 		} else if (check_before && patch_match(first_guess, -offset, fuzz)) {
 #ifdef DEBUGGING
 			if (debug & 1)
 				say("Offset changing from %ld to %ld\n",
 				    last_offset, -offset);
 #endif
 			last_offset = -offset;
 			return first_guess - offset;
 		} else if (!check_before && !check_after)
 			return 0;
 	}
 }
 
 /* We did not find the pattern, dump out the hunk so they can handle it. */
 
 static void
 abort_context_hunk(void)
 {
 	LINENUM	i;
 	const LINENUM	pat_end = pch_end();
 	/*
 	 * add in last_offset to guess the same as the previous successful
 	 * hunk
 	 */
 	const LINENUM	oldfirst = pch_first() + last_offset;
 	const LINENUM	newfirst = pch_newfirst() + last_offset;
 	const LINENUM	oldlast = oldfirst + pch_ptrn_lines() - 1;
 	const LINENUM	newlast = newfirst + pch_repl_lines() - 1;
 	const char	*stars = (diff_type >= NEW_CONTEXT_DIFF ? " ****" : "");
 	const char	*minuses = (diff_type >= NEW_CONTEXT_DIFF ? " ----" : " -----");
 
 	fprintf(rejfp, "***************\n");
 	for (i = 0; i <= pat_end; i++) {
 		switch (pch_char(i)) {
 		case '*':
 			if (oldlast < oldfirst)
 				fprintf(rejfp, "*** 0%s\n", stars);
 			else if (oldlast == oldfirst)
 				fprintf(rejfp, "*** %ld%s\n", oldfirst, stars);
 			else
 				fprintf(rejfp, "*** %ld,%ld%s\n", oldfirst,
 				    oldlast, stars);
 			break;
 		case '=':
 			if (newlast < newfirst)
 				fprintf(rejfp, "--- 0%s\n", minuses);
 			else if (newlast == newfirst)
 				fprintf(rejfp, "--- %ld%s\n", newfirst, minuses);
 			else
 				fprintf(rejfp, "--- %ld,%ld%s\n", newfirst,
 				    newlast, minuses);
 			break;
 		case '\n':
 			fprintf(rejfp, "%s", pfetch(i));
 			break;
 		case ' ':
 		case '-':
 		case '+':
 		case '!':
 			fprintf(rejfp, "%c %s", pch_char(i), pfetch(i));
 			break;
 		default:
 			fatal("fatal internal error in abort_context_hunk\n");
 		}
 	}
 }
 
 static void
 rej_line(int ch, LINENUM i)
 {
 	unsigned short len;
 	const char *line = pfetch(i);
 
 	len = strnlen(line, USHRT_MAX);
 
 	fprintf(rejfp, "%c%s", ch, line);
 	if (len == 0 || line[len-1] != '\n') {
 		if (len >= USHRT_MAX)
 			fprintf(rejfp, "\n\\ Line too long\n");
 		else
 			fprintf(rejfp, "\n\\ No newline at end of line\n");
 	}
 }
 
 static void
 abort_hunk(void)
 {
 	LINENUM		i, j, split;
 	int		ch1, ch2;
 	const LINENUM	pat_end = pch_end();
 	const LINENUM	oldfirst = pch_first() + last_offset;
 	const LINENUM	newfirst = pch_newfirst() + last_offset;
 
 	if (diff_type != UNI_DIFF) {
 		abort_context_hunk();
 		return;
 	}
 	split = -1;
 	for (i = 0; i <= pat_end; i++) {
 		if (pch_char(i) == '=') {
 			split = i;
 			break;
 		}
 	}
 	if (split == -1) {
 		fprintf(rejfp, "malformed hunk: no split found\n");
 		return;
 	}
 	i = 0;
 	j = split + 1;
 	fprintf(rejfp, "@@ -%ld,%ld +%ld,%ld @@\n",
 	    pch_ptrn_lines() ? oldfirst : 0,
 	    pch_ptrn_lines(), newfirst, pch_repl_lines());
 	while (i < split || j <= pat_end) {
 		ch1 = i < split ? pch_char(i) : -1;
 		ch2 = j <= pat_end ? pch_char(j) : -1;
 		if (ch1 == '-') {
 			rej_line('-', i);
 			i++;
 		} else if (ch1 == ' ' && ch2 == ' ') {
 			rej_line(' ', i);
 			i++;
 			j++;
 		} else if (ch1 == '!' && ch2 == '!') {
 			while (i < split && ch1 == '!') {
 				rej_line('-', i);
 				i++;
 				ch1 = i < split ? pch_char(i) : -1;
 			}
 			while (j <= pat_end && ch2 == '!') {
 				rej_line('+', j);
 				j++;
 				ch2 = j <= pat_end ? pch_char(j) : -1;
 			}
 		} else if (ch1 == '*') {
 			i++;
 		} else if (ch2 == '+' || ch2 == ' ') {
 			rej_line(ch2, j);
 			j++;
 		} else {
 			fprintf(rejfp, "internal error on (%ld %ld %ld)\n",
 			    i, split, j);
 			rej_line(ch1, i);
 			rej_line(ch2, j);
 			return;
 		}
 	}
 }
 
 /* We found where to apply it (we hope), so do it. */
 
 static void
 apply_hunk(LINENUM where)
 {
 	LINENUM		old = 1;
 	const LINENUM	lastline = pch_ptrn_lines();
 	LINENUM		new = lastline + 1;
 #define OUTSIDE 0
 #define IN_IFNDEF 1
 #define IN_IFDEF 2
 #define IN_ELSE 3
 	int		def_state = OUTSIDE;
 	const LINENUM	pat_end = pch_end();
 
 	where--;
 	while (pch_char(new) == '=' || pch_char(new) == '\n')
 		new++;
 
 	while (old <= lastline) {
 		if (pch_char(old) == '-') {
 			copy_till(where + old - 1, false);
 			if (do_defines) {
 				if (def_state == OUTSIDE) {
 					fputs(not_defined, ofp);
 					def_state = IN_IFNDEF;
 				} else if (def_state == IN_IFDEF) {
 					fputs(else_defined, ofp);
 					def_state = IN_ELSE;
 				}
 				fputs(pfetch(old), ofp);
 			}
 			last_frozen_line++;
 			old++;
 		} else if (new > pat_end) {
 			break;
 		} else if (pch_char(new) == '+') {
 			copy_till(where + old - 1, false);
 			if (do_defines) {
 				if (def_state == IN_IFNDEF) {
 					fputs(else_defined, ofp);
 					def_state = IN_ELSE;
 				} else if (def_state == OUTSIDE) {
 					fputs(if_defined, ofp);
 					def_state = IN_IFDEF;
 				}
 			}
 			fputs(pfetch(new), ofp);
 			new++;
 		} else if (pch_char(new) != pch_char(old)) {
 			say("Out-of-sync patch, lines %ld,%ld--mangled text or line numbers, maybe?\n",
 			    pch_hunk_beg() + old,
 			    pch_hunk_beg() + new);
 #ifdef DEBUGGING
 			say("oldchar = '%c', newchar = '%c'\n",
 			    pch_char(old), pch_char(new));
 #endif
 			my_exit(2);
 		} else if (pch_char(new) == '!') {
 			copy_till(where + old - 1, false);
 			if (do_defines) {
 				fputs(not_defined, ofp);
 				def_state = IN_IFNDEF;
 			}
 			while (pch_char(old) == '!') {
 				if (do_defines) {
 					fputs(pfetch(old), ofp);
 				}
 				last_frozen_line++;
 				old++;
 			}
 			if (do_defines) {
 				fputs(else_defined, ofp);
 				def_state = IN_ELSE;
 			}
 			while (pch_char(new) == '!') {
 				fputs(pfetch(new), ofp);
 				new++;
 			}
 		} else {
 			if (pch_char(new) != ' ')
 				fatal("Internal error: expected ' '\n");
 			old++;
 			new++;
 			if (do_defines && def_state != OUTSIDE) {
 				fputs(end_defined, ofp);
 				def_state = OUTSIDE;
 			}
 		}
 	}
 	if (new <= pat_end && pch_char(new) == '+') {
 		copy_till(where + old - 1, false);
 		if (do_defines) {
 			if (def_state == OUTSIDE) {
 				fputs(if_defined, ofp);
 				def_state = IN_IFDEF;
 			} else if (def_state == IN_IFNDEF) {
 				fputs(else_defined, ofp);
 				def_state = IN_ELSE;
 			}
 		}
 		while (new <= pat_end && pch_char(new) == '+') {
 			fputs(pfetch(new), ofp);
 			new++;
 		}
 	}
 	if (do_defines && def_state != OUTSIDE) {
 		fputs(end_defined, ofp);
 	}
 }
 
 /*
  * Open the new file.
  */
 static void
 init_output(const char *name)
 {
 	ofp = fopen(name, "w");
 	if (ofp == NULL)
 		pfatal("can't create %s", name);
 }
 
 /*
  * Open a file to put hunks we can't locate.
  */
 static void
 init_reject(const char *name)
 {
 	rejfp = fopen(name, "w");
 	if (rejfp == NULL)
 		pfatal("can't create %s", name);
 }
 
 /*
  * Copy input file to output, up to wherever hunk is to be applied.
  * If endoffile is true, treat the last line specially since it may
  * lack a newline.
  */
 static void
 copy_till(LINENUM lastline, bool endoffile)
 {
 	if (last_frozen_line > lastline)
 		fatal("misordered hunks! output would be garbled\n");
 	while (last_frozen_line < lastline) {
 		if (++last_frozen_line == lastline && endoffile)
 			dump_line(last_frozen_line, !last_line_missing_eol);
 		else
 			dump_line(last_frozen_line, true);
 	}
 }
 
 /*
  * Finish copying the input file to the output file.
  */
 static bool
 spew_output(void)
 {
 	int rv;
 
 #ifdef DEBUGGING
 	if (debug & 256)
 		say("il=%ld lfl=%ld\n", input_lines, last_frozen_line);
 #endif
 	if (input_lines)
 		copy_till(input_lines, true);	/* dump remainder of file */
 	rv = ferror(ofp) == 0 && fclose(ofp) == 0;
 	ofp = NULL;
 	return rv;
 }
 
 /*
  * Copy one line from input to output.
  */
 static void
 dump_line(LINENUM line, bool write_newline)
 {
 	char	*s;
 
 	s = ifetch(line, 0);
 	if (s == NULL)
 		return;
 	/* Note: string is not NUL terminated. */
 	for (; *s != '\n'; s++)
 		putc(*s, ofp);
 	if (write_newline)
 		putc('\n', ofp);
 }
 
 /*
  * Does the patch pattern match at line base+offset?
  */
 static bool
 patch_match(LINENUM base, LINENUM offset, LINENUM fuzz)
 {
 	LINENUM		pline = 1 + fuzz;
 	LINENUM		iline;
 	LINENUM		pat_lines = pch_ptrn_lines() - fuzz;
 	const char	*ilineptr;
 	const char	*plineptr;
 	unsigned short	plinelen;
 
 	for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) {
 		ilineptr = ifetch(iline, offset >= 0);
 		if (ilineptr == NULL)
 			return false;
 		plineptr = pfetch(pline);
 		plinelen = pch_line_len(pline);
 		if (canonicalize) {
 			if (!similar(ilineptr, plineptr, plinelen))
 				return false;
 		} else if (strnNE(ilineptr, plineptr, plinelen))
 			return false;
 		if (iline == input_lines) {
 			/*
 			 * We are looking at the last line of the file.
 			 * If the file has no eol, the patch line should
 			 * not have one either and vice-versa. Note that
 			 * plinelen > 0.
 			 */
 			if (last_line_missing_eol) {
 				if (plineptr[plinelen - 1] == '\n')
 					return false;
 			} else {
 				if (plineptr[plinelen - 1] != '\n')
 					return false;
 			}
 		}
 	}
 	return true;
 }
 
 /*
  * Do two lines match with canonicalized white space?
  */
 static bool
 similar(const char *a, const char *b, int len)
 {
 	while (len) {
 		if (isspace((unsigned char)*b)) {	/* whitespace (or \n) to match? */
 			if (!isspace((unsigned char)*a))	/* no corresponding whitespace? */
 				return false;
 			while (len && isspace((unsigned char)*b) && *b != '\n')
 				b++, len--;	/* skip pattern whitespace */
 			while (isspace((unsigned char)*a) && *a != '\n')
 				a++;	/* skip target whitespace */
 			if (*a == '\n' || *b == '\n')
 				return (*a == *b);	/* should end in sync */
 		} else if (*a++ != *b++)	/* match non-whitespace chars */
 			return false;
 		else
 			len--;	/* probably not necessary */
 	}
 	return true;		/* actually, this is not reached */
 	/* since there is always a \n */
 }
Index: projects/arm_intrng/usr.bin/patch/pch.c
===================================================================
--- projects/arm_intrng/usr.bin/patch/pch.c	(revision 276247)
+++ projects/arm_intrng/usr.bin/patch/pch.c	(revision 276248)
@@ -1,1621 +1,1621 @@
 
 /*-
  * Copyright 1986, Larry Wall
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following condition is met:
  * 1. Redistributions of source code must retain the above copyright notice,
  * this condition and the following disclaimer.
  * 
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
  * 
  * patch - a program to apply diffs to original files
  *
  * -C option added in 1998, original code by Marc Espie, based on FreeBSD
  * behaviour
  *
  * $OpenBSD: pch.c,v 1.43 2014/11/18 17:03:35 tobias Exp $
  * $FreeBSD$
  */
 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "common.h"
 #include "util.h"
 #include "pch.h"
 #include "pathnames.h"
 
 /* Patch (diff listing) abstract type. */
 
 static off_t	p_filesize;	/* size of the patch file */
 static LINENUM	p_first;	/* 1st line number */
 static LINENUM	p_newfirst;	/* 1st line number of replacement */
 static LINENUM	p_ptrn_lines;	/* # lines in pattern */
 static LINENUM	p_repl_lines;	/* # lines in replacement text */
 static LINENUM	p_end = -1;	/* last line in hunk */
 static LINENUM	p_max;		/* max allowed value of p_end */
 static LINENUM	p_context = 3;	/* # of context lines */
 static LINENUM	p_input_line = 0;	/* current line # from patch file */
 static char	**p_line = NULL;/* the text of the hunk */
 static unsigned short	*p_len = NULL; /* length of each line */
 static char	*p_char = NULL;	/* +, -, and ! */
 static int	hunkmax = INITHUNKMAX;	/* size of above arrays to begin with */
 static int	p_indent;	/* indent to patch */
 static off_t	p_base;		/* where to intuit this time */
 static LINENUM	p_bline;	/* line # of p_base */
 static off_t	p_start;	/* where intuit found a patch */
 static LINENUM	p_sline;	/* and the line number for it */
 static LINENUM	p_hunk_beg;	/* line number of current hunk */
 static LINENUM	p_efake = -1;	/* end of faked up lines--don't free */
 static LINENUM	p_bfake = -1;	/* beg of faked up lines */
 static FILE	*pfp = NULL;	/* patch file pointer */
 static char	*bestguess = NULL;	/* guess at correct filename */
 
 static void	grow_hunkmax(void);
 static int	intuit_diff_type(void);
 static void	next_intuit_at(off_t, LINENUM);
 static void	skip_to(off_t, LINENUM);
 static size_t	pgets(bool _do_indent);
 static char	*best_name(const struct file_name *, bool);
 static char	*posix_name(const struct file_name *, bool);
 static size_t	num_components(const char *);
 static LINENUM	strtolinenum(char *, char **);
 
 /*
  * Prepare to look for the next patch in the patch file.
  */
 void
 re_patch(void)
 {
 	p_first = 0;
 	p_newfirst = 0;
 	p_ptrn_lines = 0;
 	p_repl_lines = 0;
 	p_end = (LINENUM) - 1;
 	p_max = 0;
 	p_indent = 0;
 }
 
 /*
  * Open the patch file at the beginning of time.
  */
 void
 open_patch_file(const char *filename)
 {
 	struct stat filestat;
 	int nr, nw;
 
 	if (filename == NULL || *filename == '\0' || strEQ(filename, "-")) {
 		pfp = fopen(TMPPATNAME, "w");
 		if (pfp == NULL)
 			pfatal("can't create %s", TMPPATNAME);
 		while ((nr = fread(buf, 1, buf_size, stdin)) > 0) {
 			nw = fwrite(buf, 1, nr, pfp);
 			if (nr != nw)
 				pfatal("write error to %s", TMPPATNAME);
 		}
 		if (ferror(pfp) || fclose(pfp))
 			pfatal("can't write %s", TMPPATNAME);
 		filename = TMPPATNAME;
 	}
 	pfp = fopen(filename, "r");
 	if (pfp == NULL)
 		pfatal("patch file %s not found", filename);
 	if (fstat(fileno(pfp), &filestat))
 		pfatal("can't stat %s", filename);
 	p_filesize = filestat.st_size;
 	next_intuit_at(0, 1L);	/* start at the beginning */
 	set_hunkmax();
 }
 
 /*
  * Make sure our dynamically realloced tables are malloced to begin with.
  */
 void
 set_hunkmax(void)
 {
 	if (p_line == NULL)
 		p_line = malloc(hunkmax * sizeof(char *));
 	if (p_len == NULL)
 		p_len = malloc(hunkmax * sizeof(unsigned short));
 	if (p_char == NULL)
 		p_char = malloc(hunkmax * sizeof(char));
 }
 
 /*
  * Enlarge the arrays containing the current hunk of patch.
  */
 static void
 grow_hunkmax(void)
 {
 	int new_hunkmax = hunkmax * 2;
 
 	if (p_line == NULL || p_len == NULL || p_char == NULL)
 		fatal("Internal memory allocation error\n");
 
 	p_line = reallocf(p_line, new_hunkmax * sizeof(char *));
 	p_len = reallocf(p_len, new_hunkmax * sizeof(unsigned short));
 	p_char = reallocf(p_char, new_hunkmax * sizeof(char));
 
 	if (p_line != NULL && p_len != NULL && p_char != NULL) {
 		hunkmax = new_hunkmax;
 		return;
 	}
 
 	if (!using_plan_a)
 		fatal("out of memory\n");
 	out_of_mem = true;	/* whatever is null will be allocated again */
 				/* from within plan_a(), of all places */
 }
 
 /* True if the remainder of the patch file contains a diff of some sort. */
 
 bool
 there_is_another_patch(void)
 {
 	bool exists = false;
 
 	if (p_base != 0 && p_base >= p_filesize) {
 		if (verbose)
 			say("done\n");
 		return false;
 	}
 	if (verbose)
 		say("Hmm...");
 	diff_type = intuit_diff_type();
 	if (!diff_type) {
 		if (p_base != 0) {
 			if (verbose)
 				say("  Ignoring the trailing garbage.\ndone\n");
 		} else
 			say("  I can't seem to find a patch in there anywhere.\n");
 		return false;
 	}
 	if (verbose)
 		say("  %sooks like %s to me...\n",
 		    (p_base == 0 ? "L" : "The next patch l"),
 		    diff_type == UNI_DIFF ? "a unified diff" :
 		    diff_type == CONTEXT_DIFF ? "a context diff" :
 		diff_type == NEW_CONTEXT_DIFF ? "a new-style context diff" :
 		    diff_type == NORMAL_DIFF ? "a normal diff" :
 		    "an ed script");
 	if (p_indent && verbose)
 		say("(Patch is indented %d space%s.)\n", p_indent,
 		    p_indent == 1 ? "" : "s");
 	skip_to(p_start, p_sline);
 	while (filearg[0] == NULL) {
 		if (force || batch) {
 			say("No file to patch.  Skipping...\n");
-			filearg[0] = savestr(bestguess);
+			filearg[0] = xstrdup(bestguess);
 			skip_rest_of_patch = true;
 			return true;
 		}
 		ask("File to patch: ");
 		if (*buf != '\n') {
 			free(bestguess);
-			bestguess = savestr(buf);
+			bestguess = xstrdup(buf);
 			filearg[0] = fetchname(buf, &exists, 0);
 		}
 		if (!exists) {
 			ask("No file found--skip this patch? [n] ");
 			if (*buf != 'y')
 				continue;
 			if (verbose)
 				say("Skipping patch...\n");
 			free(filearg[0]);
 			filearg[0] = fetchname(bestguess, &exists, 0);
 			skip_rest_of_patch = true;
 			return true;
 		}
 	}
 	return true;
 }
 
 static void
 p4_fetchname(struct file_name *name, char *str)
 {
 	char *t, *h;
 
 	/* Skip leading whitespace. */
 	while (isspace((unsigned char)*str))
 		str++;
 
 	/* Remove the file revision number. */
 	for (t = str, h = NULL; *t != '\0' && !isspace((unsigned char)*t); t++)
 		if (*t == '#')
 			h = t;
 	if (h != NULL)
 		*h = '\0';
 
 	name->path = fetchname(str, &name->exists, strippath);
 }
 
 /* Determine what kind of diff is in the remaining part of the patch file. */
 
 static int
 intuit_diff_type(void)
 {
 	off_t	this_line = 0, previous_line;
 	off_t	first_command_line = -1;
 	LINENUM	fcl_line = -1;
 	bool	last_line_was_command = false, this_is_a_command = false;
 	bool	stars_last_line = false, stars_this_line = false;
 	char	*s, *t;
 	int	indent, retval;
 	struct file_name names[MAX_FILE];
 
 	memset(names, 0, sizeof(names));
 	ok_to_create_file = false;
 	fseeko(pfp, p_base, SEEK_SET);
 	p_input_line = p_bline - 1;
 	for (;;) {
 		previous_line = this_line;
 		last_line_was_command = this_is_a_command;
 		stars_last_line = stars_this_line;
 		this_line = ftello(pfp);
 		indent = 0;
 		p_input_line++;
 		if (pgets(false) == 0) {
 			if (first_command_line >= 0) {
 				/* nothing but deletes!? */
 				p_start = first_command_line;
 				p_sline = fcl_line;
 				retval = ED_DIFF;
 				goto scan_exit;
 			} else {
 				p_start = this_line;
 				p_sline = p_input_line;
 				retval = 0;
 				goto scan_exit;
 			}
 		}
 		for (s = buf; *s == ' ' || *s == '\t' || *s == 'X'; s++) {
 			if (*s == '\t')
 				indent += 8 - (indent % 8);
 			else
 				indent++;
 		}
 		for (t = s; isdigit((unsigned char)*t) || *t == ','; t++)
 			;
 		this_is_a_command = (isdigit((unsigned char)*s) &&
 		    (*t == 'd' || *t == 'c' || *t == 'a'));
 		if (first_command_line < 0 && this_is_a_command) {
 			first_command_line = this_line;
 			fcl_line = p_input_line;
 			p_indent = indent;	/* assume this for now */
 		}
 		if (!stars_last_line && strnEQ(s, "*** ", 4))
 			names[OLD_FILE].path = fetchname(s + 4,
 			    &names[OLD_FILE].exists, strippath);
 		else if (strnEQ(s, "--- ", 4))
 			names[NEW_FILE].path = fetchname(s + 4,
 			    &names[NEW_FILE].exists, strippath);
 		else if (strnEQ(s, "+++ ", 4))
 			/* pretend it is the old name */
 			names[OLD_FILE].path = fetchname(s + 4,
 			    &names[OLD_FILE].exists, strippath);
 		else if (strnEQ(s, "Index:", 6))
 			names[INDEX_FILE].path = fetchname(s + 6,
 			    &names[INDEX_FILE].exists, strippath);
 		else if (strnEQ(s, "Prereq:", 7)) {
 			for (t = s + 7; isspace((unsigned char)*t); t++)
 				;
-			revision = savestr(t);
+			revision = xstrdup(t);
 			for (t = revision;
 			     *t && !isspace((unsigned char)*t); t++)
 				;
 			*t = '\0';
 			if (*revision == '\0') {
 				free(revision);
 				revision = NULL;
 			}
 		} else if (strnEQ(s, "==== ", 5)) {
 			/* Perforce-style diffs. */
 			if ((t = strstr(s + 5, " - ")) != NULL)
 				p4_fetchname(&names[NEW_FILE], t + 3);
 			p4_fetchname(&names[OLD_FILE], s + 5);
 		}
 		if ((!diff_type || diff_type == ED_DIFF) &&
 		    first_command_line >= 0 &&
 		    strEQ(s, ".\n")) {
 			p_indent = indent;
 			p_start = first_command_line;
 			p_sline = fcl_line;
 			retval = ED_DIFF;
 			goto scan_exit;
 		}
 		if ((!diff_type || diff_type == UNI_DIFF) && strnEQ(s, "@@ -", 4)) {
 			if (strnEQ(s + 4, "0,0", 3))
 				ok_to_create_file = true;
 			p_indent = indent;
 			p_start = this_line;
 			p_sline = p_input_line;
 			retval = UNI_DIFF;
 			goto scan_exit;
 		}
 		stars_this_line = strnEQ(s, "********", 8);
 		if ((!diff_type || diff_type == CONTEXT_DIFF) && stars_last_line &&
 		    strnEQ(s, "*** ", 4)) {
 			if (strtolinenum(s + 4, &s) == 0)
 				ok_to_create_file = true;
 			/*
 			 * If this is a new context diff the character just
 			 * at the end of the line is a '*'.
 			 */
 			while (*s && *s != '\n')
 				s++;
 			p_indent = indent;
 			p_start = previous_line;
 			p_sline = p_input_line - 1;
 			retval = (*(s - 1) == '*' ? NEW_CONTEXT_DIFF : CONTEXT_DIFF);
 			goto scan_exit;
 		}
 		if ((!diff_type || diff_type == NORMAL_DIFF) &&
 		    last_line_was_command &&
 		    (strnEQ(s, "< ", 2) || strnEQ(s, "> ", 2))) {
 			p_start = previous_line;
 			p_sline = p_input_line - 1;
 			p_indent = indent;
 			retval = NORMAL_DIFF;
 			goto scan_exit;
 		}
 	}
 scan_exit:
 	if (retval == UNI_DIFF) {
 		/* unswap old and new */
 		struct file_name tmp = names[OLD_FILE];
 		names[OLD_FILE] = names[NEW_FILE];
 		names[NEW_FILE] = tmp;
 	}
 	if (filearg[0] == NULL) {
 		if (posix)
 			filearg[0] = posix_name(names, ok_to_create_file);
 		else {
 			/* Ignore the Index: name for context diffs, like GNU */
 			if (names[OLD_FILE].path != NULL ||
 			    names[NEW_FILE].path != NULL) {
 				free(names[INDEX_FILE].path);
 				names[INDEX_FILE].path = NULL;
 			}
 			filearg[0] = best_name(names, ok_to_create_file);
 		}
 	}
 
 	free(bestguess);
 	bestguess = NULL;
 	if (filearg[0] != NULL)
-		bestguess = savestr(filearg[0]);
+		bestguess = xstrdup(filearg[0]);
 	else if (!ok_to_create_file) {
 		/*
 		 * We don't want to create a new file but we need a
 		 * filename to set bestguess.  Avoid setting filearg[0]
 		 * so the file is not created automatically.
 		 */
 		if (posix)
 			bestguess = posix_name(names, true);
 		else
 			bestguess = best_name(names, true);
 	}
 	free(names[OLD_FILE].path);
 	free(names[NEW_FILE].path);
 	free(names[INDEX_FILE].path);
 	return retval;
 }
 
 /*
  * Remember where this patch ends so we know where to start up again.
  */
 static void
 next_intuit_at(off_t file_pos, LINENUM file_line)
 {
 	p_base = file_pos;
 	p_bline = file_line;
 }
 
 /*
  * Basically a verbose fseeko() to the actual diff listing.
  */
 static void
 skip_to(off_t file_pos, LINENUM file_line)
 {
 	size_t	len;
 
 	if (p_base > file_pos)
 		fatal("Internal error: seek %lld>%lld\n",
 		   (long long)p_base, (long long)file_pos);
 	if (verbose && p_base < file_pos) {
 		fseeko(pfp, p_base, SEEK_SET);
 		say("The text leading up to this was:\n--------------------------\n");
 		while (ftello(pfp) < file_pos) {
 			len = pgets(false);
 			if (len == 0)
 				fatal("Unexpected end of file\n");
 			say("|%s", buf);
 		}
 		say("--------------------------\n");
 	} else
 		fseeko(pfp, file_pos, SEEK_SET);
 	p_input_line = file_line - 1;
 }
 
 /* Make this a function for better debugging.  */
 static void
 malformed(void)
 {
 	fatal("malformed patch at line %ld: %s", p_input_line, buf);
 	/* about as informative as "Syntax error" in C */
 }
 
 /*
  * True if the line has been discarded (i.e. it is a line saying
  *  "\ No newline at end of file".)
  */
 static bool
 remove_special_line(void)
 {
 	int	c;
 
 	c = fgetc(pfp);
 	if (c == '\\') {
 		do {
 			c = fgetc(pfp);
 		} while (c != EOF && c != '\n');
 
 		return true;
 	}
 	if (c != EOF)
 		fseeko(pfp, -1, SEEK_CUR);
 
 	return false;
 }
 
 /*
  * True if there is more of the current diff listing to process.
  */
 bool
 another_hunk(void)
 {
 	off_t	line_beginning;			/* file pos of the current line */
 	LINENUM	repl_beginning;			/* index of --- line */
 	LINENUM	fillcnt;			/* #lines of missing ptrn or repl */
 	LINENUM	fillsrc;			/* index of first line to copy */
 	LINENUM	filldst;			/* index of first missing line */
 	bool	ptrn_spaces_eaten;		/* ptrn was slightly misformed */
 	bool	repl_could_be_missing;		/* no + or ! lines in this hunk */
 	bool	repl_missing;			/* we are now backtracking */
 	off_t	repl_backtrack_position;	/* file pos of first repl line */
 	LINENUM	repl_patch_line;		/* input line number for same */
 	LINENUM	ptrn_copiable;			/* # of copiable lines in ptrn */
 	char	*s;
 	size_t	len;
 	int	context = 0;
 
 	while (p_end >= 0) {
 		if (p_end == p_efake)
 			p_end = p_bfake;	/* don't free twice */
 		else
 			free(p_line[p_end]);
 		p_end--;
 	}
 	p_efake = -1;
 
 	p_max = hunkmax;	/* gets reduced when --- found */
 	if (diff_type == CONTEXT_DIFF || diff_type == NEW_CONTEXT_DIFF) {
 		line_beginning = ftello(pfp);
 		repl_beginning = 0;
 		fillcnt = 0;
 		fillsrc = 0;
 		filldst = 0;
 		ptrn_spaces_eaten = false;
 		repl_could_be_missing = true;
 		repl_missing = false;
 		repl_backtrack_position = 0;
 		repl_patch_line = 0;
 		ptrn_copiable = 0;
 
 		len = pgets(true);
 		p_input_line++;
 		if (len == 0 || strnNE(buf, "********", 8)) {
 			next_intuit_at(line_beginning, p_input_line);
 			return false;
 		}
 		p_context = 100;
 		p_hunk_beg = p_input_line + 1;
 		while (p_end < p_max) {
 			line_beginning = ftello(pfp);
 			len = pgets(true);
 			p_input_line++;
 			if (len == 0) {
 				if (p_max - p_end < 4) {
 					/* assume blank lines got chopped */
 					strlcpy(buf, "  \n", buf_size);
 				} else {
 					if (repl_beginning && repl_could_be_missing) {
 						repl_missing = true;
 						goto hunk_done;
 					}
 					fatal("unexpected end of file in patch\n");
 				}
 			}
 			p_end++;
 			if (p_end >= hunkmax)
 				fatal("Internal error: hunk larger than hunk "
 				    "buffer size");
 			p_char[p_end] = *buf;
 			p_line[p_end] = NULL;
 			switch (*buf) {
 			case '*':
 				if (strnEQ(buf, "********", 8)) {
 					if (repl_beginning && repl_could_be_missing) {
 						repl_missing = true;
 						goto hunk_done;
 					} else
 						fatal("unexpected end of hunk "
 						    "at line %ld\n",
 						    p_input_line);
 				}
 				if (p_end != 0) {
 					if (repl_beginning && repl_could_be_missing) {
 						repl_missing = true;
 						goto hunk_done;
 					}
 					fatal("unexpected *** at line %ld: %s",
 					    p_input_line, buf);
 				}
 				context = 0;
 				p_line[p_end] = savestr(buf);
 				if (out_of_mem) {
 					p_end--;
 					return false;
 				}
 				for (s = buf;
 				     *s && !isdigit((unsigned char)*s); s++)
 					;
 				if (!*s)
 					malformed();
 				if (strnEQ(s, "0,0", 3))
 					memmove(s, s + 2, strlen(s + 2) + 1);
 				p_first = strtolinenum(s, &s);
 				if (*s == ',') {
 					for (;
 					     *s && !isdigit((unsigned char)*s); s++)
 						;
 					if (!*s)
 						malformed();
 					p_ptrn_lines = strtolinenum(s, &s) - p_first + 1;
 					if (p_ptrn_lines < 0)
 						malformed();
 				} else if (p_first)
 					p_ptrn_lines = 1;
 				else {
 					p_ptrn_lines = 0;
 					p_first = 1;
 				}
 				if (p_first >= LINENUM_MAX - p_ptrn_lines ||
 				    p_ptrn_lines >= LINENUM_MAX - 6)
 					malformed();
 
 				/* we need this much at least */
 				p_max = p_ptrn_lines + 6;
 				while (p_max >= hunkmax)
 					grow_hunkmax();
 				p_max = hunkmax;
 				break;
 			case '-':
 				if (buf[1] == '-') {
 					if (repl_beginning ||
 					    (p_end != p_ptrn_lines + 1 +
 					    (p_char[p_end - 1] == '\n'))) {
 						if (p_end == 1) {
 							/*
 							 * `old' lines were omitted;
 							 * set up to fill them in
 							 * from 'new' context lines.
 							 */
 							p_end = p_ptrn_lines + 1;
 							fillsrc = p_end + 1;
 							filldst = 1;
 							fillcnt = p_ptrn_lines;
 						} else {
 							if (repl_beginning) {
 								if (repl_could_be_missing) {
 									repl_missing = true;
 									goto hunk_done;
 								}
 								fatal("duplicate \"---\" at line %ld--check line numbers at line %ld\n",
 								    p_input_line, p_hunk_beg + repl_beginning);
 							} else {
 								fatal("%s \"---\" at line %ld--check line numbers at line %ld\n",
 								    (p_end <= p_ptrn_lines
 								    ? "Premature"
 								    : "Overdue"),
 								    p_input_line, p_hunk_beg);
 							}
 						}
 					}
 					repl_beginning = p_end;
 					repl_backtrack_position = ftello(pfp);
 					repl_patch_line = p_input_line;
 					p_line[p_end] = savestr(buf);
 					if (out_of_mem) {
 						p_end--;
 						return false;
 					}
 					p_char[p_end] = '=';
 					for (s = buf; *s && !isdigit((unsigned char)*s); s++)
 						;
 					if (!*s)
 						malformed();
 					p_newfirst = strtolinenum(s, &s);
 					if (*s == ',') {
 						for (; *s && !isdigit((unsigned char)*s); s++)
 							;
 						if (!*s)
 							malformed();
 						p_repl_lines = strtolinenum(s, &s) -
 						    p_newfirst + 1;
 						if (p_repl_lines < 0)
 							malformed();
 					} else if (p_newfirst)
 						p_repl_lines = 1;
 					else {
 						p_repl_lines = 0;
 						p_newfirst = 1;
 					}
 					if (p_newfirst >= LINENUM_MAX - p_repl_lines ||
 					    p_repl_lines >= LINENUM_MAX - p_end)
 						malformed();
 					p_max = p_repl_lines + p_end;
 					if (p_max > MAXHUNKSIZE)
 						fatal("hunk too large (%ld lines) at line %ld: %s",
 						    p_max, p_input_line, buf);
 					while (p_max >= hunkmax)
 						grow_hunkmax();
 					if (p_repl_lines != ptrn_copiable &&
 					    (p_context != 0 || p_repl_lines != 1))
 						repl_could_be_missing = false;
 					break;
 				}
 				goto change_line;
 			case '+':
 			case '!':
 				repl_could_be_missing = false;
 		change_line:
 				if (buf[1] == '\n' && canonicalize)
 					strlcpy(buf + 1, " \n", buf_size - 1);
 				if (!isspace((unsigned char)buf[1]) &&
 				    buf[1] != '>' && buf[1] != '<' &&
 				    repl_beginning && repl_could_be_missing) {
 					repl_missing = true;
 					goto hunk_done;
 				}
 				if (context >= 0) {
 					if (context < p_context)
 						p_context = context;
 					context = -1000;
 				}
 				p_line[p_end] = savestr(buf + 2);
 				if (out_of_mem) {
 					p_end--;
 					return false;
 				}
 				if (p_end == p_ptrn_lines) {
 					if (remove_special_line()) {
 						int	l;
 
 						l = strlen(p_line[p_end]) - 1;
 						(p_line[p_end])[l] = 0;
 					}
 				}
 				break;
 			case '\t':
 			case '\n':	/* assume the 2 spaces got eaten */
 				if (repl_beginning && repl_could_be_missing &&
 				    (!ptrn_spaces_eaten ||
 				    diff_type == NEW_CONTEXT_DIFF)) {
 					repl_missing = true;
 					goto hunk_done;
 				}
 				p_line[p_end] = savestr(buf);
 				if (out_of_mem) {
 					p_end--;
 					return false;
 				}
 				if (p_end != p_ptrn_lines + 1) {
 					ptrn_spaces_eaten |= (repl_beginning != 0);
 					context++;
 					if (!repl_beginning)
 						ptrn_copiable++;
 					p_char[p_end] = ' ';
 				}
 				break;
 			case ' ':
 				if (!isspace((unsigned char)buf[1]) &&
 				    repl_beginning && repl_could_be_missing) {
 					repl_missing = true;
 					goto hunk_done;
 				}
 				context++;
 				if (!repl_beginning)
 					ptrn_copiable++;
 				p_line[p_end] = savestr(buf + 2);
 				if (out_of_mem) {
 					p_end--;
 					return false;
 				}
 				break;
 			default:
 				if (repl_beginning && repl_could_be_missing) {
 					repl_missing = true;
 					goto hunk_done;
 				}
 				malformed();
 			}
 			/* set up p_len for strncmp() so we don't have to */
 			/* assume null termination */
 			if (p_line[p_end])
 				p_len[p_end] = strlen(p_line[p_end]);
 			else
 				p_len[p_end] = 0;
 		}
 
 hunk_done:
 		if (p_end >= 0 && !repl_beginning)
 			fatal("no --- found in patch at line %ld\n", pch_hunk_beg());
 
 		if (repl_missing) {
 
 			/* reset state back to just after --- */
 			p_input_line = repl_patch_line;
 			for (p_end--; p_end > repl_beginning; p_end--)
 				free(p_line[p_end]);
 			fseeko(pfp, repl_backtrack_position, SEEK_SET);
 
 			/* redundant 'new' context lines were omitted - set */
 			/* up to fill them in from the old file context */
 			if (!p_context && p_repl_lines == 1) {
 				p_repl_lines = 0;
 				p_max--;
 			}
 			fillsrc = 1;
 			filldst = repl_beginning + 1;
 			fillcnt = p_repl_lines;
 			p_end = p_max;
 		} else if (!p_context && fillcnt == 1) {
 			/* the first hunk was a null hunk with no context */
 			/* and we were expecting one line -- fix it up. */
 			while (filldst < p_end) {
 				p_line[filldst] = p_line[filldst + 1];
 				p_char[filldst] = p_char[filldst + 1];
 				p_len[filldst] = p_len[filldst + 1];
 				filldst++;
 			}
 #if 0
 			repl_beginning--;	/* this doesn't need to be fixed */
 #endif
 			p_end--;
 			p_first++;	/* do append rather than insert */
 			fillcnt = 0;
 			p_ptrn_lines = 0;
 		}
 		if (diff_type == CONTEXT_DIFF &&
 		    (fillcnt || (p_first > 1 && ptrn_copiable > 2 * p_context))) {
 			if (verbose)
 				say("%s\n%s\n%s\n",
 				    "(Fascinating--this is really a new-style context diff but without",
 				    "the telltale extra asterisks on the *** line that usually indicate",
 				    "the new style...)");
 			diff_type = NEW_CONTEXT_DIFF;
 		}
 		/* if there were omitted context lines, fill them in now */
 		if (fillcnt) {
 			p_bfake = filldst;	/* remember where not to free() */
 			p_efake = filldst + fillcnt - 1;
 			while (fillcnt-- > 0) {
 				while (fillsrc <= p_end && p_char[fillsrc] != ' ')
 					fillsrc++;
 				if (fillsrc > p_end)
 					fatal("replacement text or line numbers mangled in hunk at line %ld\n",
 					    p_hunk_beg);
 				p_line[filldst] = p_line[fillsrc];
 				p_char[filldst] = p_char[fillsrc];
 				p_len[filldst] = p_len[fillsrc];
 				fillsrc++;
 				filldst++;
 			}
 			while (fillsrc <= p_end && fillsrc != repl_beginning &&
 			    p_char[fillsrc] != ' ')
 				fillsrc++;
 #ifdef DEBUGGING
 			if (debug & 64)
 				printf("fillsrc %ld, filldst %ld, rb %ld, e+1 %ld\n",
 				fillsrc, filldst, repl_beginning, p_end + 1);
 #endif
 			if (fillsrc != p_end + 1 && fillsrc != repl_beginning)
 				malformed();
 			if (filldst != p_end + 1 && filldst != repl_beginning)
 				malformed();
 		}
 		if (p_line[p_end] != NULL) {
 			if (remove_special_line()) {
 				p_len[p_end] -= 1;
 				(p_line[p_end])[p_len[p_end]] = 0;
 			}
 		}
 	} else if (diff_type == UNI_DIFF) {
 		LINENUM	fillold;	/* index of old lines */
 		LINENUM	fillnew;	/* index of new lines */
 		char	ch;
 
 		line_beginning = ftello(pfp); /* file pos of the current line */
 		len = pgets(true);
 		p_input_line++;
 		if (len == 0 || strnNE(buf, "@@ -", 4)) {
 			next_intuit_at(line_beginning, p_input_line);
 			return false;
 		}
 		s = buf + 4;
 		if (!*s)
 			malformed();
 		p_first = strtolinenum(s, &s);
 		if (*s == ',') {
 			p_ptrn_lines = strtolinenum(s + 1, &s);
 		} else
 			p_ptrn_lines = 1;
 		if (*s == ' ')
 			s++;
 		if (*s != '+' || !*++s)
 			malformed();
 		p_newfirst = strtolinenum(s, &s);
 		if (*s == ',') {
 			p_repl_lines = strtolinenum(s + 1, &s);
 		} else
 			p_repl_lines = 1;
 		if (*s == ' ')
 			s++;
 		if (*s != '@')
 			malformed();
 		if (p_first >= LINENUM_MAX - p_ptrn_lines ||
 		    p_newfirst > LINENUM_MAX - p_repl_lines ||
 		    p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1)
 			malformed();
 		if (!p_ptrn_lines)
 			p_first++;	/* do append rather than insert */
 		p_max = p_ptrn_lines + p_repl_lines + 1;
 		while (p_max >= hunkmax)
 			grow_hunkmax();
 		fillold = 1;
 		fillnew = fillold + p_ptrn_lines;
 		p_end = fillnew + p_repl_lines;
 		snprintf(buf, buf_size, "*** %ld,%ld ****\n", p_first,
 		    p_first + p_ptrn_lines - 1);
 		p_line[0] = savestr(buf);
 		if (out_of_mem) {
 			p_end = -1;
 			return false;
 		}
 		p_char[0] = '*';
 		snprintf(buf, buf_size, "--- %ld,%ld ----\n", p_newfirst,
 		    p_newfirst + p_repl_lines - 1);
 		p_line[fillnew] = savestr(buf);
 		if (out_of_mem) {
 			p_end = 0;
 			return false;
 		}
 		p_char[fillnew++] = '=';
 		p_context = 100;
 		context = 0;
 		p_hunk_beg = p_input_line + 1;
 		while (fillold <= p_ptrn_lines || fillnew <= p_end) {
 			line_beginning = ftello(pfp);
 			len = pgets(true);
 			p_input_line++;
 			if (len == 0) {
 				if (p_max - fillnew < 3) {
 					/* assume blank lines got chopped */
 					strlcpy(buf, " \n", buf_size);
 				} else {
 					fatal("unexpected end of file in patch\n");
 				}
 			}
 			if (*buf == '\t' || *buf == '\n') {
 				ch = ' ';	/* assume the space got eaten */
 				s = savestr(buf);
 			} else {
 				ch = *buf;
 				s = savestr(buf + 1);
 			}
 			if (out_of_mem) {
 				while (--fillnew > p_ptrn_lines)
 					free(p_line[fillnew]);
 				p_end = fillold - 1;
 				return false;
 			}
 			switch (ch) {
 			case '-':
 				if (fillold > p_ptrn_lines) {
 					free(s);
 					p_end = fillnew - 1;
 					malformed();
 				}
 				p_char[fillold] = ch;
 				p_line[fillold] = s;
 				p_len[fillold++] = strlen(s);
 				if (fillold > p_ptrn_lines) {
 					if (remove_special_line()) {
 						p_len[fillold - 1] -= 1;
 						s[p_len[fillold - 1]] = 0;
 					}
 				}
 				break;
 			case '=':
 				ch = ' ';
 				/* FALL THROUGH */
 			case ' ':
 				if (fillold > p_ptrn_lines) {
 					free(s);
 					while (--fillnew > p_ptrn_lines)
 						free(p_line[fillnew]);
 					p_end = fillold - 1;
 					malformed();
 				}
 				context++;
 				p_char[fillold] = ch;
 				p_line[fillold] = s;
 				p_len[fillold++] = strlen(s);
 				s = savestr(s);
 				if (out_of_mem) {
 					while (--fillnew > p_ptrn_lines)
 						free(p_line[fillnew]);
 					p_end = fillold - 1;
 					return false;
 				}
 				if (fillold > p_ptrn_lines) {
 					if (remove_special_line()) {
 						p_len[fillold - 1] -= 1;
 						s[p_len[fillold - 1]] = 0;
 					}
 				}
 				/* FALL THROUGH */
 			case '+':
 				if (fillnew > p_end) {
 					free(s);
 					while (--fillnew > p_ptrn_lines)
 						free(p_line[fillnew]);
 					p_end = fillold - 1;
 					malformed();
 				}
 				p_char[fillnew] = ch;
 				p_line[fillnew] = s;
 				p_len[fillnew++] = strlen(s);
 				if (fillold > p_ptrn_lines) {
 					if (remove_special_line()) {
 						p_len[fillnew - 1] -= 1;
 						s[p_len[fillnew - 1]] = 0;
 					}
 				}
 				break;
 			default:
 				p_end = fillnew;
 				malformed();
 			}
 			if (ch != ' ' && context > 0) {
 				if (context < p_context)
 					p_context = context;
 				context = -1000;
 			}
 		}		/* while */
 	} else {		/* normal diff--fake it up */
 		char	hunk_type;
 		int	i;
 		LINENUM	min, max;
 
 		line_beginning = ftello(pfp);
 		p_context = 0;
 		len = pgets(true);
 		p_input_line++;
 		if (len == 0 || !isdigit((unsigned char)*buf)) {
 			next_intuit_at(line_beginning, p_input_line);
 			return false;
 		}
 		p_first = strtolinenum(buf, &s);
 		if (*s == ',') {
 			p_ptrn_lines = strtolinenum(s + 1, &s) - p_first + 1;
 			if (p_ptrn_lines < 0)
 				malformed();
 		} else
 			p_ptrn_lines = (*s != 'a');
 		hunk_type = *s;
 		if (hunk_type == 'a')
 			p_first++;	/* do append rather than insert */
 		min = strtolinenum(s + 1, &s);
 		if (*s == ',')
 			max = strtolinenum(s + 1, &s);
 		else
 			max = min;
 		if (min < 0 || min > max || max - min == LINENUM_MAX)
 			malformed();
 		if (hunk_type == 'd')
 			min++;
 		p_newfirst = min;
 		p_repl_lines = max - min + 1;
 		if (p_newfirst > LINENUM_MAX - p_repl_lines ||
 		    p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1)
 			malformed();
 		p_end = p_ptrn_lines + p_repl_lines + 1;
 		if (p_end > MAXHUNKSIZE)
 			fatal("hunk too large (%ld lines) at line %ld: %s",
 			    p_end, p_input_line, buf);
 		while (p_end >= hunkmax)
 			grow_hunkmax();
 		snprintf(buf, buf_size, "*** %ld,%ld\n", p_first,
 		    p_first + p_ptrn_lines - 1);
 		p_line[0] = savestr(buf);
 		if (out_of_mem) {
 			p_end = -1;
 			return false;
 		}
 		p_char[0] = '*';
 		for (i = 1; i <= p_ptrn_lines; i++) {
 			len = pgets(true);
 			p_input_line++;
 			if (len == 0)
 				fatal("unexpected end of file in patch at line %ld\n",
 				    p_input_line);
 			if (*buf != '<')
 				fatal("< expected at line %ld of patch\n",
 				    p_input_line);
 			p_line[i] = savestr(buf + 2);
 			if (out_of_mem) {
 				p_end = i - 1;
 				return false;
 			}
 			p_len[i] = strlen(p_line[i]);
 			p_char[i] = '-';
 		}
 
 		if (remove_special_line()) {
 			p_len[i - 1] -= 1;
 			(p_line[i - 1])[p_len[i - 1]] = 0;
 		}
 		if (hunk_type == 'c') {
 			len = pgets(true);
 			p_input_line++;
 			if (len == 0)
 				fatal("unexpected end of file in patch at line %ld\n",
 				    p_input_line);
 			if (*buf != '-')
 				fatal("--- expected at line %ld of patch\n",
 				    p_input_line);
 		}
 		snprintf(buf, buf_size, "--- %ld,%ld\n", min, max);
 		p_line[i] = savestr(buf);
 		if (out_of_mem) {
 			p_end = i - 1;
 			return false;
 		}
 		p_char[i] = '=';
 		for (i++; i <= p_end; i++) {
 			len = pgets(true);
 			p_input_line++;
 			if (len == 0)
 				fatal("unexpected end of file in patch at line %ld\n",
 				    p_input_line);
 			if (*buf != '>')
 				fatal("> expected at line %ld of patch\n",
 				    p_input_line);
 			p_line[i] = savestr(buf + 2);
 			if (out_of_mem) {
 				p_end = i - 1;
 				return false;
 			}
 			p_len[i] = strlen(p_line[i]);
 			p_char[i] = '+';
 		}
 
 		if (remove_special_line()) {
 			p_len[i - 1] -= 1;
 			(p_line[i - 1])[p_len[i - 1]] = 0;
 		}
 	}
 	if (reverse)		/* backwards patch? */
 		if (!pch_swap())
 			say("Not enough memory to swap next hunk!\n");
 #ifdef DEBUGGING
 	if (debug & 2) {
 		int	i;
 		char	special;
 
 		for (i = 0; i <= p_end; i++) {
 			if (i == p_ptrn_lines)
 				special = '^';
 			else
 				special = ' ';
 			fprintf(stderr, "%3d %c %c %s", i, p_char[i],
 			    special, p_line[i]);
 			fflush(stderr);
 		}
 	}
 #endif
 	if (p_end + 1 < hunkmax)/* paranoia reigns supreme... */
 		p_char[p_end + 1] = '^';	/* add a stopper for apply_hunk */
 	return true;
 }
 
 /*
  * Input a line from the patch file.
  * Worry about indentation if do_indent is true.
  * The line is read directly into the buf global variable which
  * is resized if necessary in order to hold the complete line.
  * Returns the number of characters read including the terminating
  * '\n', if any.
  */
 size_t
 pgets(bool do_indent)
 {
 	char *line;
 	size_t len;
 	int indent = 0, skipped = 0;
 
 	line = fgetln(pfp, &len);
 	if (line != NULL) {
 		if (len + 1 > buf_size) {
 			while (len + 1 > buf_size)
 				buf_size *= 2;
 			free(buf);
 			buf = malloc(buf_size);
 			if (buf == NULL)
 				fatal("out of memory\n");
 		}
 		if (do_indent == 1 && p_indent) {
 			for (;
 			    indent < p_indent && (*line == ' ' || *line == '\t' || *line == 'X');
 			    line++, skipped++) {
 				if (*line == '\t')
 					indent += 8 - (indent %7);
 				else
 					indent++;
 			}
 		}
 		memcpy(buf, line, len - skipped);
 		buf[len - skipped] = '\0';
 	}
 	return len;
 }
 
 
 /*
  * Reverse the old and new portions of the current hunk.
  */
 bool
 pch_swap(void)
 {
 	char	**tp_line;	/* the text of the hunk */
 	unsigned short	*tp_len;/* length of each line */
 	char	*tp_char;	/* +, -, and ! */
 	LINENUM	i;
 	LINENUM	n;
 	bool	blankline = false;
 	char	*s;
 
 	i = p_first;
 	p_first = p_newfirst;
 	p_newfirst = i;
 
 	/* make a scratch copy */
 
 	tp_line = p_line;
 	tp_len = p_len;
 	tp_char = p_char;
 	p_line = NULL;	/* force set_hunkmax to allocate again */
 	p_len = NULL;
 	p_char = NULL;
 	set_hunkmax();
 	if (p_line == NULL || p_len == NULL || p_char == NULL) {
 
 		free(p_line);
 		p_line = tp_line;
 		free(p_len);
 		p_len = tp_len;
 		free(p_char);
 		p_char = tp_char;
 		return false;	/* not enough memory to swap hunk! */
 	}
 	/* now turn the new into the old */
 
 	i = p_ptrn_lines + 1;
 	if (tp_char[i] == '\n') {	/* account for possible blank line */
 		blankline = true;
 		i++;
 	}
 	if (p_efake >= 0) {	/* fix non-freeable ptr range */
 		if (p_efake <= i)
 			n = p_end - i + 1;
 		else
 			n = -i;
 		p_efake += n;
 		p_bfake += n;
 	}
 	for (n = 0; i <= p_end; i++, n++) {
 		p_line[n] = tp_line[i];
 		p_char[n] = tp_char[i];
 		if (p_char[n] == '+')
 			p_char[n] = '-';
 		p_len[n] = tp_len[i];
 	}
 	if (blankline) {
 		i = p_ptrn_lines + 1;
 		p_line[n] = tp_line[i];
 		p_char[n] = tp_char[i];
 		p_len[n] = tp_len[i];
 		n++;
 	}
 	if (p_char[0] != '=')
 		fatal("Malformed patch at line %ld: expected '=' found '%c'\n",
 		    p_input_line, p_char[0]);
 	p_char[0] = '*';
 	for (s = p_line[0]; *s; s++)
 		if (*s == '-')
 			*s = '*';
 
 	/* now turn the old into the new */
 
 	if (p_char[0] != '*')
 		fatal("Malformed patch at line %ld: expected '*' found '%c'\n",
 		    p_input_line, p_char[0]);
 	tp_char[0] = '=';
 	for (s = tp_line[0]; *s; s++)
 		if (*s == '*')
 			*s = '-';
 	for (i = 0; n <= p_end; i++, n++) {
 		p_line[n] = tp_line[i];
 		p_char[n] = tp_char[i];
 		if (p_char[n] == '-')
 			p_char[n] = '+';
 		p_len[n] = tp_len[i];
 	}
 
 	if (i != p_ptrn_lines + 1)
 		fatal("Malformed patch at line %ld: expected %ld lines, "
 		    "got %ld\n",
 		    p_input_line, p_ptrn_lines + 1, i);
 
 	i = p_ptrn_lines;
 	p_ptrn_lines = p_repl_lines;
 	p_repl_lines = i;
 
 	free(tp_line);
 	free(tp_len);
 	free(tp_char);
 
 	return true;
 }
 
 /*
  * Return the specified line position in the old file of the old context.
  */
 LINENUM
 pch_first(void)
 {
 	return p_first;
 }
 
 /*
  * Return the number of lines of old context.
  */
 LINENUM
 pch_ptrn_lines(void)
 {
 	return p_ptrn_lines;
 }
 
 /*
  * Return the probable line position in the new file of the first line.
  */
 LINENUM
 pch_newfirst(void)
 {
 	return p_newfirst;
 }
 
 /*
  * Return the number of lines in the replacement text including context.
  */
 LINENUM
 pch_repl_lines(void)
 {
 	return p_repl_lines;
 }
 
 /*
  * Return the number of lines in the whole hunk.
  */
 LINENUM
 pch_end(void)
 {
 	return p_end;
 }
 
 /*
  * Return the number of context lines before the first changed line.
  */
 LINENUM
 pch_context(void)
 {
 	return p_context;
 }
 
 /*
  * Return the length of a particular patch line.
  */
 unsigned short
 pch_line_len(LINENUM line)
 {
 	return p_len[line];
 }
 
 /*
  * Return the control character (+, -, *, !, etc) for a patch line.
  */
 char
 pch_char(LINENUM line)
 {
 	return p_char[line];
 }
 
 /*
  * Return a pointer to a particular patch line.
  */
 char *
 pfetch(LINENUM line)
 {
 	return p_line[line];
 }
 
 /*
  * Return where in the patch file this hunk began, for error messages.
  */
 LINENUM
 pch_hunk_beg(void)
 {
 	return p_hunk_beg;
 }
 
 /*
  * Apply an ed script by feeding ed itself.
  */
 void
 do_ed_script(void)
 {
 	char	*t;
 	off_t	beginning_of_this_line;
 	FILE	*pipefp = NULL;
 
 	if (!skip_rest_of_patch) {
 		if (copy_file(filearg[0], TMPOUTNAME) < 0) {
 			unlink(TMPOUTNAME);
 			fatal("can't create temp file %s", TMPOUTNAME);
 		}
 		snprintf(buf, buf_size, "%s%s%s", _PATH_ED,
 		    verbose ? " " : " -s ", TMPOUTNAME);
 		pipefp = popen(buf, "w");
 	}
 	for (;;) {
 		beginning_of_this_line = ftello(pfp);
 		if (pgets(true) == 0) {
 			next_intuit_at(beginning_of_this_line, p_input_line);
 			break;
 		}
 		p_input_line++;
 		for (t = buf; isdigit((unsigned char)*t) || *t == ','; t++)
 			;
 		/* POSIX defines allowed commands as {a,c,d,i,s} */
 		if (isdigit((unsigned char)*buf) &&
 		    (*t == 'a' || *t == 'c' || *t == 'd' || *t == 'i' || *t == 's')) {
 			if (pipefp != NULL)
 				fputs(buf, pipefp);
 			if (*t != 'd') {
 				while (pgets(true)) {
 					p_input_line++;
 					if (pipefp != NULL)
 						fputs(buf, pipefp);
 					if (strEQ(buf, ".\n"))
 						break;
 				}
 			}
 		} else {
 			next_intuit_at(beginning_of_this_line, p_input_line);
 			break;
 		}
 	}
 	if (pipefp == NULL)
 		return;
 	fprintf(pipefp, "w\n");
 	fprintf(pipefp, "q\n");
 	fflush(pipefp);
 	pclose(pipefp);
 	ignore_signals();
 	if (!check_only) {
 		if (move_file(TMPOUTNAME, outname) < 0) {
 			toutkeep = true;
 			chmod(TMPOUTNAME, filemode);
 		} else
 			chmod(outname, filemode);
 	}
 	set_signals(1);
 }
 
 /*
  * Choose the name of the file to be patched based on POSIX rules.
  * NOTE: the POSIX rules are amazingly stupid and we only follow them
  *       if the user specified --posix or set POSIXLY_CORRECT.
  */
 static char *
 posix_name(const struct file_name *names, bool assume_exists)
 {
 	char *path = NULL;
 	int i;
 
 	/*
 	 * POSIX states that the filename will be chosen from one
 	 * of the old, new and index names (in that order) if
 	 * the file exists relative to CWD after -p stripping.
 	 */
 	for (i = 0; i < MAX_FILE; i++) {
 		if (names[i].path != NULL && names[i].exists) {
 			path = names[i].path;
 			break;
 		}
 	}
 	if (path == NULL && !assume_exists) {
 		/*
 		 * No files found, look for something we can checkout from
 		 * RCS/SCCS dirs.  Same order as above.
 		 */
 		for (i = 0; i < MAX_FILE; i++) {
 			if (names[i].path != NULL &&
 			    (path = checked_in(names[i].path)) != NULL)
 				break;
 		}
 		/*
 		 * Still no match?  Check to see if the diff could be creating
 		 * a new file.
 		 */
 		if (path == NULL && ok_to_create_file &&
 		    names[NEW_FILE].path != NULL)
 			path = names[NEW_FILE].path;
 	}
 
-	return path ? savestr(path) : NULL;
+	return path ? xstrdup(path) : NULL;
 }
 
 static char *
 compare_names(const struct file_name *names, bool assume_exists, int phase)
 {
 	size_t min_components, min_baselen, min_len, tmp;
 	char *best = NULL;
 	char *path;
 	int i;
 
 	/*
 	 * The "best" name is the one with the fewest number of path
 	 * components, the shortest basename length, and the shortest
 	 * overall length (in that order).  We only use the Index: file
 	 * if neither of the old or new files could be intuited from
 	 * the diff header.
 	 */
 	min_components = min_baselen = min_len = SIZE_MAX;
 	for (i = INDEX_FILE; i >= OLD_FILE; i--) {
 		path = names[i].path;
 		if (path == NULL ||
 		    (phase == 1 && !names[i].exists && !assume_exists) ||
 		    (phase == 2 && checked_in(path) == NULL))
 			continue;
 		if ((tmp = num_components(path)) > min_components)
 			continue;
 		if (tmp < min_components) {
 			min_components = tmp;
 			best = path;
 		}
 		if ((tmp = strlen(basename(path))) > min_baselen)
 			continue;
 		if (tmp < min_baselen) {
 			min_baselen = tmp;
 			best = path;
 		}
 		if ((tmp = strlen(path)) > min_len)
 			continue;
 		min_len = tmp;
 		best = path;
 	}
 	return best;
 }
 
 /*
  * Choose the name of the file to be patched based the "best" one
  * available.
  */
 static char *
 best_name(const struct file_name *names, bool assume_exists)
 {
 	char *best;
 
 	best = compare_names(names, assume_exists, 1);
 	if (best == NULL) {
 		best = compare_names(names, assume_exists, 2);
 		/*
 		 * Still no match?  Check to see if the diff could be creating
 		 * a new file.
 		 */
 		if (best == NULL && ok_to_create_file &&
 		    names[NEW_FILE].path != NULL)
 			best = names[NEW_FILE].path;
 	}
 
-	return best ? savestr(best) : NULL;
+	return best ? xstrdup(best) : NULL;
 }
 
 static size_t
 num_components(const char *path)
 {
 	size_t n;
 	const char *cp;
 
 	for (n = 0, cp = path; (cp = strchr(cp, '/')) != NULL; n++, cp++) {
 		while (*cp == '/')
 			cp++;		/* skip consecutive slashes */
 	}
 	return n;
 }
 
 /*
  * Convert number at NPTR into LINENUM and save address of first
  * character that is not a digit in ENDPTR.  If conversion is not
  * possible, call fatal.
  */
 static LINENUM
 strtolinenum(char *nptr, char **endptr)
 {
 	LINENUM rv;
 	char c;
 	char *p;
 	const char *errstr;
 
 	for (p = nptr; isdigit((unsigned char)*p); p++)
 		;
 
 	if (p == nptr)
 		malformed();
 
 	c = *p;
 	*p = '\0';
 
 	rv = strtonum(nptr, 0, LINENUM_MAX, &errstr);
 	if (errstr != NULL)
 		fatal("invalid line number at line %ld: `%s' is %s\n",
 		    p_input_line, nptr, errstr);
- 
+
 	*p = c;
 	*endptr = p;
 
 	return rv;
 }
Index: projects/arm_intrng/usr.bin/patch/util.c
===================================================================
--- projects/arm_intrng/usr.bin/patch/util.c	(revision 276247)
+++ projects/arm_intrng/usr.bin/patch/util.c	(revision 276248)
@@ -1,432 +1,448 @@
 /*-
  * Copyright 1986, Larry Wall
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following condition is met:
  * 1. Redistributions of source code must retain the above copyright notice,
  * this condition and the following disclaimer.
  * 
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
  * 
  * patch - a program to apply diffs to original files
  *
  * -C option added in 1998, original code by Marc Espie, based on FreeBSD
  * behaviour
  *
  * $OpenBSD: util.c,v 1.35 2010/07/24 01:10:12 ray Exp $
  * $FreeBSD$
  */
 
 #include 
 #include 
 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 
 #include "common.h"
 #include "util.h"
 #include "backupfile.h"
 #include "pathnames.h"
 
 /* Rename a file, copying it if necessary. */
 
 int
 move_file(const char *from, const char *to)
 {
 	int	fromfd;
 	ssize_t	i;
 
 	/* to stdout? */
 
 	if (strEQ(to, "-")) {
 #ifdef DEBUGGING
 		if (debug & 4)
 			say("Moving %s to stdout.\n", from);
 #endif
 		fromfd = open(from, O_RDONLY);
 		if (fromfd < 0)
 			pfatal("internal error, can't reopen %s", from);
 		while ((i = read(fromfd, buf, buf_size)) > 0)
 			if (write(STDOUT_FILENO, buf, i) != i)
 				pfatal("write failed");
 		close(fromfd);
 		return 0;
 	}
 	if (backup_file(to) < 0) {
 		say("Can't backup %s, output is in %s: %s\n", to, from,
 		    strerror(errno));
 		return -1;
 	}
 #ifdef DEBUGGING
 	if (debug & 4)
 		say("Moving %s to %s.\n", from, to);
 #endif
 	if (rename(from, to) < 0) {
 		if (errno != EXDEV || copy_file(from, to) < 0) {
 			say("Can't create %s, output is in %s: %s\n",
 			    to, from, strerror(errno));
 			return -1;
 		}
 	}
 	return 0;
 }
 
 /* Backup the original file.  */
 
 int
 backup_file(const char *orig)
 {
 	struct stat	filestat;
 	char		bakname[MAXPATHLEN], *s, *simplename;
 	dev_t		orig_device;
 	ino_t		orig_inode;
 
 	if (backup_type == none || stat(orig, &filestat) != 0)
 		return 0;			/* nothing to do */
 	/*
 	 * If the user used zero prefixes or suffixes, then
 	 * he doesn't want backups.  Yet we have to remove
 	 * orig to break possible hardlinks.
 	 */
 	if ((origprae && *origprae == 0) || *simple_backup_suffix == 0) {
 		unlink(orig);
 		return 0;
 	}
 	orig_device = filestat.st_dev;
 	orig_inode = filestat.st_ino;
 
 	if (origprae) {
 		if (strlcpy(bakname, origprae, sizeof(bakname)) >= sizeof(bakname) ||
 		    strlcat(bakname, orig, sizeof(bakname)) >= sizeof(bakname))
 			fatal("filename %s too long for buffer\n", origprae);
 	} else {
 		if ((s = find_backup_file_name(orig)) == NULL)
 			fatal("out of memory\n");
 		if (strlcpy(bakname, s, sizeof(bakname)) >= sizeof(bakname))
 			fatal("filename %s too long for buffer\n", s);
 		free(s);
 	}
 
 	if ((simplename = strrchr(bakname, '/')) != NULL)
 		simplename = simplename + 1;
 	else
 		simplename = bakname;
 
 	/*
 	 * Find a backup name that is not the same file. Change the
 	 * first lowercase char into uppercase; if that isn't
 	 * sufficient, chop off the first char and try again.
 	 */
 	while (stat(bakname, &filestat) == 0 &&
 	    orig_device == filestat.st_dev && orig_inode == filestat.st_ino) {
 		/* Skip initial non-lowercase chars.  */
 		for (s = simplename; *s && !islower((unsigned char)*s); s++)
 			;
 		if (*s)
 			*s = toupper((unsigned char)*s);
 		else
 			memmove(simplename, simplename + 1,
 			    strlen(simplename + 1) + 1);
 	}
 #ifdef DEBUGGING
 	if (debug & 4)
 		say("Moving %s to %s.\n", orig, bakname);
 #endif
 	if (rename(orig, bakname) < 0) {
 		if (errno != EXDEV || copy_file(orig, bakname) < 0)
 			return -1;
 	}
 	return 0;
 }
 
 /*
  * Copy a file.
  */
 int
 copy_file(const char *from, const char *to)
 {
 	int	tofd, fromfd;
 	ssize_t	i;
 
 	tofd = open(to, O_CREAT|O_TRUNC|O_WRONLY, 0666);
 	if (tofd < 0)
 		return -1;
 	fromfd = open(from, O_RDONLY, 0);
 	if (fromfd < 0)
 		pfatal("internal error, can't reopen %s", from);
 	while ((i = read(fromfd, buf, buf_size)) > 0)
 		if (write(tofd, buf, i) != i)
 			pfatal("write to %s failed", to);
 	close(fromfd);
 	close(tofd);
 	return 0;
 }
 
 /*
  * Allocate a unique area for a string.
  */
 char *
 savestr(const char *s)
 {
 	char	*rv;
 
 	if (!s)
 		s = "Oops";
 	rv = strdup(s);
 	if (rv == NULL) {
 		if (using_plan_a)
 			out_of_mem = true;
 		else
 			fatal("out of memory\n");
 	}
 	return rv;
 }
 
 /*
+ * Allocate a unique area for a string.  Call fatal if out of memory.
+ */
+char *
+xstrdup(const char *s)
+{
+	char	*rv;
+
+	if (!s)
+		s = "Oops";
+	rv = strdup(s);
+	if (rv == NULL)
+		fatal("out of memory\n");
+	return rv;
+}
+
+/*
  * Vanilla terminal output (buffered).
  */
 void
 say(const char *fmt, ...)
 {
 	va_list	ap;
 
 	va_start(ap, fmt);
 	vfprintf(stdout, fmt, ap);
 	va_end(ap);
 	fflush(stdout);
 }
 
 /*
  * Terminal output, pun intended.
  */
 void
 fatal(const char *fmt, ...)
 {
 	va_list	ap;
 
 	va_start(ap, fmt);
 	fprintf(stderr, "patch: **** ");
 	vfprintf(stderr, fmt, ap);
 	va_end(ap);
 	my_exit(2);
 }
 
 /*
  * Say something from patch, something from the system, then silence . . .
  */
 void
 pfatal(const char *fmt, ...)
 {
 	va_list	ap;
 	int	errnum = errno;
 
 	fprintf(stderr, "patch: **** ");
 	va_start(ap, fmt);
 	vfprintf(stderr, fmt, ap);
 	va_end(ap);
 	fprintf(stderr, ": %s\n", strerror(errnum));
 	my_exit(2);
 }
 
 /*
  * Get a response from the user via /dev/tty
  */
 void
 ask(const char *fmt, ...)
 {
 	va_list	ap;
 	ssize_t	nr = 0;
 	static	int ttyfd = -1;
 
 	va_start(ap, fmt);
 	vfprintf(stdout, fmt, ap);
 	va_end(ap);
 	fflush(stdout);
 	if (ttyfd < 0)
 		ttyfd = open(_PATH_TTY, O_RDONLY);
 	if (ttyfd >= 0) {
 		if ((nr = read(ttyfd, buf, buf_size)) > 0 &&
 		    buf[nr - 1] == '\n')
 			buf[nr - 1] = '\0';
 	}
 	if (ttyfd < 0 || nr <= 0) {
 		/* no tty or error reading, pretend user entered 'return' */
 		putchar('\n');
 		buf[0] = '\0';
 	}
 }
 
 /*
  * How to handle certain events when not in a critical region.
  */
 void
 set_signals(int reset)
 {
 	static sig_t	hupval, intval;
 
 	if (!reset) {
 		hupval = signal(SIGHUP, SIG_IGN);
 		if (hupval != SIG_IGN)
 			hupval = my_exit;
 		intval = signal(SIGINT, SIG_IGN);
 		if (intval != SIG_IGN)
 			intval = my_exit;
 	}
 	signal(SIGHUP, hupval);
 	signal(SIGINT, intval);
 }
 
 /*
  * How to handle certain events when in a critical region.
  */
 void
 ignore_signals(void)
 {
 	signal(SIGHUP, SIG_IGN);
 	signal(SIGINT, SIG_IGN);
 }
 
 /*
  * Make sure we'll have the directories to create a file. If `striplast' is
  * true, ignore the last element of `filename'.
  */
 
 void
 makedirs(const char *filename, bool striplast)
 {
 	char	*tmpbuf;
 
 	if ((tmpbuf = strdup(filename)) == NULL)
 		fatal("out of memory\n");
 
 	if (striplast) {
 		char	*s = strrchr(tmpbuf, '/');
 		if (s == NULL) {
 			free(tmpbuf);
 			return;	/* nothing to be done */
 		}
 		*s = '\0';
 	}
 	if (mkpath(tmpbuf) != 0)
 		pfatal("creation of %s failed", tmpbuf);
 	free(tmpbuf);
 }
 
 /*
  * Make filenames more reasonable.
  */
 char *
 fetchname(const char *at, bool *exists, int strip_leading)
 {
 	char		*fullname, *name, *t;
 	int		sleading, tab;
 	struct stat	filestat;
 
 	if (at == NULL || *at == '\0')
 		return NULL;
 	while (isspace((unsigned char)*at))
 		at++;
 #ifdef DEBUGGING
 	if (debug & 128)
 		say("fetchname %s %d\n", at, strip_leading);
 #endif
 	/* So files can be created by diffing against /dev/null.  */
 	if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1))
 		return NULL;
 	name = fullname = t = savestr(at);
 
 	tab = strchr(t, '\t') != NULL;
 	/* Strip off up to `strip_leading' path components and NUL terminate. */
 	for (sleading = strip_leading; *t != '\0' && ((tab && *t != '\t') ||
 	    !isspace((unsigned char)*t)); t++) {
 		if (t[0] == '/' && t[1] != '/' && t[1] != '\0')
 			if (--sleading >= 0)
 				name = t + 1;
 	}
 	*t = '\0';
 
 	/*
 	 * If no -p option was given (957 is the default value!), we were
 	 * given a relative pathname, and the leading directories that we
 	 * just stripped off all exist, put them back on.
 	 */
 	if (strip_leading == 957 && name != fullname && *fullname != '/') {
 		name[-1] = '\0';
 		if (stat(fullname, &filestat) == 0 && S_ISDIR(filestat.st_mode)) {
 			name[-1] = '/';
 			name = fullname;
 		}
 	}
 	name = savestr(name);
 	free(fullname);
 
 	*exists = stat(name, &filestat) == 0;
 	return name;
 }
 
 /*
  * Takes the name returned by fetchname and looks in RCS/SCCS directories
  * for a checked in version.
  */
 char *
 checked_in(char *file)
 {
 	char		*filebase, *filedir, tmpbuf[MAXPATHLEN];
 	struct stat	filestat;
 
 	filebase = basename(file);
 	filedir = dirname(file);
 
 #define try(f, a1, a2, a3) \
 (snprintf(tmpbuf, sizeof tmpbuf, f, a1, a2, a3), stat(tmpbuf, &filestat) == 0)
 
 	if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) ||
 	    try("%s/RCS/%s%s", filedir, filebase, "") ||
 	    try("%s/%s%s", filedir, filebase, RCSSUFFIX) ||
 	    try("%s/SCCS/%s%s", filedir, SCCSPREFIX, filebase) ||
 	    try("%s/%s%s", filedir, SCCSPREFIX, filebase))
 		return file;
 
 	return NULL;
 }
 
 void
 version(void)
 {
 	fprintf(stderr, "patch 2.0-12u10 FreeBSD\n");
 	my_exit(EXIT_SUCCESS);
 }
 
 /*
  * Exit with cleanup.
  */
 void
 my_exit(int status)
 {
 	unlink(TMPINNAME);
 	if (!toutkeep)
 		unlink(TMPOUTNAME);
 	if (!trejkeep)
 		unlink(TMPREJNAME);
 	unlink(TMPPATNAME);
 	exit(status);
 }
Index: projects/arm_intrng/usr.bin/patch/util.h
===================================================================
--- projects/arm_intrng/usr.bin/patch/util.h	(revision 276247)
+++ projects/arm_intrng/usr.bin/patch/util.h	(revision 276248)
@@ -1,51 +1,52 @@
 /*-
  * Copyright 1986, Larry Wall
  * 
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following condition is met:
  * 1. Redistributions of source code must retain the above copyright notice,
  * this condition and the following disclaimer.
  * 
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
  * 
  * patch - a program to apply diffs to original files
  *
  * -C option added in 1998, original code by Marc Espie, based on FreeBSD
  * behaviour
  *
- * $OpenBSD: util.h,v 1.15 2005/06/20 07:14:06 otto Exp $
+ * $OpenBSD: util.h,v 1.16 2014/12/13 10:31:07 tobias Exp $
  * $FreeBSD$
  */
 
 char		*fetchname(const char *, bool *, int);
 char		*checked_in(char *);
 int		backup_file(const char *);
 int		move_file(const char *, const char *);
 int		copy_file(const char *, const char *);
 void		say(const char *, ...)
 		    __attribute__((__format__(__printf__, 1, 2)));
 void		fatal(const char *, ...)
 		    __attribute__((__format__(__printf__, 1, 2)));
 void		pfatal(const char *, ...)
 		    __attribute__((__format__(__printf__, 1, 2)));
 void		ask(const char *, ...)
 		    __attribute__((__format__(__printf__, 1, 2)));
 char		*savestr(const char *);
+char		*xstrdup(const char *);
 void		set_signals(int);
 void		ignore_signals(void);
 void		makedirs(const char *, bool);
 void		version(void);
 void		my_exit(int) __attribute__((noreturn));
 
 /* in mkpath.c */
 extern int mkpath(char *);
Index: projects/arm_intrng
===================================================================
--- projects/arm_intrng	(revision 276247)
+++ projects/arm_intrng	(revision 276248)

Property changes on: projects/arm_intrng
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /head:r276183-276247